Files
wursor/api/src/sandbox/subset.ts
T
SinachPat a037b882e9
Mirror to GitHub / mirror (push) Canceled after 0s
feat: Sprint 1 — Playwright e2e + sandbox orchestration (TDD)
- e2e: Playwright chat-flow (sign up -> chat) with api/web webServer harness
- api: sandbox services subset/media-proxy/manifest/gc + DockerClient contract
- api: SandboxManager orchestrator (fake-Docker tested); /health route
- 53 unit tests green; Playwright e2e green
2026-08-15 20:01:58 +01:00

20 lines
817 B
TypeScript

import type { Playbook, SiteExport, SubsetRequest, SubsetResult } from './types.ts';
const PLAYBOOK_TABLES: Record<Playbook, Set<string>> = {
content: new Set(['wp_posts', 'wp_postmeta', 'wp_options']),
design: new Set(['wp_posts', 'wp_postmeta', 'wp_options', 'wp_terms', 'wp_term_taxonomy', 'wp_term_relationships']),
plugin: new Set(['wp_options']),
};
const secret = /(_key|_secret|smtp_pass)$/;
export function exportDbSubset(dump: SiteExport, request: SubsetRequest): SubsetResult {
const wanted = PLAYBOOK_TABLES[request.playbook];
const tables = Object.keys(dump.tables).filter((name) => wanted.has(name));
const options = (dump.tables.wp_options ?? [])
.map((row) => String(row.option_name ?? ''))
.filter((name) => name !== '' && !secret.test(name));
return { tables, options };
}