@revenexx/integrations-node-devkit 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../node_modules/tsup/assets/cjs_shims.js","../src/cli.ts","../src/env.ts","../src/index.ts","../src/errors.ts","../src/loader.ts","../src/persistence.ts","../src/store.ts","../src/resolve.ts","../src/server.ts","../src/http.ts","../src/projections.ts","../src/preview/scaffold.ts","../src/preview/templates.ts"],"sourcesContent":["// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n typeof document === \"undefined\" \n ? new URL(`file:${__filename}`).href \n : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') \n ? document.currentScript.src \n : new URL(\"main.js\", document.baseURI).href;\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n","#!/usr/bin/env node\n/**\n * `integrations-devkit` — local mock Integrations API + preview for a node package.\n *\n * integrations-devkit # start the mock API (+ static UI via --ui)\n * integrations-devkit preview # scaffold+install+run the Nuxt host together with the mock\n * integrations-devkit init-preview # only scaffold the Nuxt preview host\n * integrations-devkit reset # delete the persisted session overlay\n *\n * Options:\n * --dir <path> preview host dir (default: .revenexx-dev/preview)\n * --force overwrite existing scaffold files\n * --entry <path> package entry (default: src/index.ts, else dist/index.js)\n * --seed <dir> committed seeds dir (default: dev/seeds)\n * --state <file> session overlay file (default: .revenexx-dev/state.json)\n * --no-persist do not write the session overlay (in-memory only)\n * --port <n> listen port (default: $PORT or 3555)\n * --ui <dir> static UI build dir to serve (default: resolve the UI package)\n * --no-ui run API-only, do not serve a UI\n * --open open the preview in a browser\n * --env <path> env file to load *instead of* .env (default: .env when present)\n * --no-env do not load any env file\n */\n\nimport { existsSync, readdirSync, readFileSync, watch } from 'node:fs';\nimport type http from 'node:http';\nimport { createServer } from 'node:http';\nimport { createRequire } from 'node:module';\nimport { extname, join, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { loadEnvFile } from './env.js';\nimport { DEVKIT_VERSION } from './index.js';\nimport { type LoadedPackage, loadPackageFromEntry } from './loader.js';\nimport { applySeeds, loadSeedsFromDir, loadState, saveState } from './persistence.js';\nimport { previewDepsInstalled, previewExists, scaffoldPreview } from './preview/scaffold.js';\nimport { createRequestListener } from './server.js';\nimport { DevStore } from './store.js';\n\ninterface CliOptions {\n entry: string;\n seedDir: string;\n stateFile: string;\n persist: boolean;\n port: number;\n uiDir: string | null;\n serveUi: boolean;\n open: boolean;\n /** Preview host directory (default `.revenexx-dev/preview`). */\n previewDir: string;\n /** Overwrite existing scaffold files. */\n force: boolean;\n}\n\nfunction parseArgs(argv: string[]): { command: string | null; options: CliOptions } {\n const cwd = process.cwd();\n const opts: CliOptions = {\n entry: '',\n seedDir: resolve(cwd, 'dev/seeds'),\n stateFile: resolve(cwd, '.revenexx-dev/state.json'),\n persist: true,\n port: Number.parseInt(process.env.PORT ?? '3555', 10),\n uiDir: null,\n serveUi: true,\n open: false,\n previewDir: resolve(cwd, '.revenexx-dev/preview'),\n force: false,\n };\n let command: string | null = null;\n for (let i = 0; i < argv.length; i++) {\n const arg = argv[i];\n switch (arg) {\n case 'reset':\n command = 'reset';\n break;\n case 'init-preview':\n command = 'init-preview';\n break;\n case 'preview':\n command = 'preview';\n break;\n case '--dir':\n opts.previewDir = resolve(cwd, argv[++i] ?? '');\n break;\n case '--force':\n opts.force = true;\n break;\n case '--entry':\n opts.entry = resolve(cwd, argv[++i] ?? '');\n break;\n case '--seed':\n opts.seedDir = resolve(cwd, argv[++i] ?? '');\n break;\n case '--state':\n opts.stateFile = resolve(cwd, argv[++i] ?? '');\n break;\n case '--no-persist':\n opts.persist = false;\n break;\n case '--port':\n opts.port = Number.parseInt(argv[++i] ?? '3555', 10);\n break;\n case '--ui':\n opts.uiDir = resolve(cwd, argv[++i] ?? '');\n break;\n case '--no-ui':\n opts.serveUi = false;\n break;\n case '--open':\n opts.open = true;\n break;\n // Both are consumed by loadEnvFile() before parsing; listed here so they\n // do not fall through to the unknown-option branch. A repeated `--env`\n // resolves to the last one, so each occurrence skips its own value.\n case '--env':\n i++;\n break;\n case '--no-env':\n break;\n case '--version':\n case '-v':\n command = 'version';\n break;\n default:\n // Node acts on `--env-file[-if-exists]` itself but still forwards it\n // here, so accept and skip it rather than rejecting the user's input.\n // loadEnvFile() has already pointed them at `--env`.\n if (arg?.startsWith('--env-file')) {\n if (!arg.includes('=')) {\n i++;\n }\n break;\n }\n if (arg?.startsWith('-')) {\n console.error(`Unknown option: ${arg}`);\n process.exit(1);\n }\n }\n }\n if (!opts.entry) {\n const src = resolve(cwd, 'src/index.ts');\n opts.entry = existsSync(src) ? src : resolve(cwd, 'dist/index.js');\n }\n return { command, options: opts };\n}\n\n/** Loads any JSON schemas bundled in the package's `assets/schemas` dir. */\nfunction loadSchemas(): Record<string, unknown> {\n const here = fileURLToPath(new URL('.', import.meta.url));\n // dist/cli.js → package root is one level up.\n const schemasDir = resolve(here, '..', 'assets', 'schemas');\n const schemas: Record<string, unknown> = {};\n if (!existsSync(schemasDir)) {\n return schemas;\n }\n for (const file of readdirSync(schemasDir)) {\n if (extname(file) !== '.json') {\n continue;\n }\n const parsed = JSON.parse(readFileSync(join(schemasDir, file), 'utf-8'));\n // File `node-v0-draft.json` → keys `node/v0-draft` and (latest) `node`.\n // Split on the first dash only: domain=`node`, version=`v0-draft`.\n const base = file.replace(/\\.json$/, '');\n const dash = base.indexOf('-');\n if (dash > 0) {\n const domain = base.slice(0, dash);\n const version = base.slice(dash + 1);\n schemas[`${domain}/${version}`] = parsed;\n schemas[domain] = parsed;\n } else {\n schemas[base] = parsed;\n }\n }\n return schemas;\n}\n\n/**\n * Resolves a *static* UI build dir to serve. Only used for a prebuilt SPA\n * passed via `--ui`. The Cockpit UI (`@revenexx/studio-integrations`) is a Nuxt\n * *module*, not a static build — it is consumed by a Nuxt host app whose\n * `runtimeConfig.public.integrationsApi` points at this mock (see README).\n * Auto-resolution only kicks in for a package that ships a `dist/` with an\n * `index.html`; otherwise the devkit stays API-only.\n */\nfunction resolveUiDir(explicit: string | null): string | null {\n if (explicit) {\n return existsSync(explicit) ? explicit : null;\n }\n const candidates = ['@revenexx/studio-integrations'];\n const req = createRequire(import.meta.url);\n for (const pkg of candidates) {\n try {\n const entry = req.resolve(`${pkg}/package.json`);\n const dist = resolve(entry, '..', 'dist');\n if (existsSync(join(dist, 'index.html'))) {\n return dist;\n }\n } catch {\n // not installed / not a static build — fall through to API-only\n }\n }\n return null;\n}\n\nconst MIME: Record<string, string> = {\n '.html': 'text/html',\n '.js': 'text/javascript',\n '.mjs': 'text/javascript',\n '.css': 'text/css',\n '.json': 'application/json',\n '.svg': 'image/svg+xml',\n '.png': 'image/png',\n '.ico': 'image/x-icon',\n '.woff2': 'font/woff2',\n};\n\n/** Serves a static SPA build, falling back to index.html for client routes. */\nfunction serveStatic(uiDir: string, req: http.IncomingMessage, res: http.ServerResponse): void {\n const url = new URL(req.url ?? '/', 'http://localhost');\n const relative = url.pathname === '/' ? 'index.html' : url.pathname.replace(/^\\/+/, '');\n let filePath = resolve(uiDir, relative);\n if (!filePath.startsWith(uiDir) || !existsSync(filePath)) {\n filePath = join(uiDir, 'index.html');\n }\n if (!existsSync(filePath)) {\n res.writeHead(404).end('UI build not found');\n return;\n }\n res.writeHead(200, { 'Content-Type': MIME[extname(filePath)] ?? 'application/octet-stream' });\n res.end(readFileSync(filePath));\n}\n\ninterface MockHandle {\n uiDir: string | null;\n dispose(): void;\n}\n\n/** Boots the mock API (store + seeds + persistence + hot-reload). No signal handlers. */\nasync function startMock(options: CliOptions): Promise<MockHandle> {\n let loaded: LoadedPackage = await loadPackageFromEntry(options.entry);\n console.log(`Loaded ${loaded.nodes.length} node(s), ${loaded.credentials.length} credential(s), ${loaded.templates.length} template(s) from ${options.entry}`);\n\n const store = new DevStore();\n applySeeds(store, await loadSeedsFromDir(options.seedDir));\n if (options.persist) {\n const state = loadState(options.stateFile);\n if (state) {\n store.mergeSnapshot(state);\n console.log(`Restored session from ${options.stateFile}`);\n }\n // Attach persistence only now, so applying seeds doesn't rewrite the overlay.\n let timer: NodeJS.Timeout | undefined;\n store.setOnMutation(() => {\n clearTimeout(timer);\n timer = setTimeout(() => saveState(options.stateFile, store.toSnapshot()), 150);\n });\n }\n\n const schemas = loadSchemas();\n const apiListener = createRequestListener({ getPackage: () => loaded, store, schemas });\n\n const uiDir = options.serveUi ? resolveUiDir(options.uiDir) : null;\n const server = createServer((req, res) => {\n const pathname = new URL(req.url ?? '/', 'http://localhost').pathname;\n if (pathname.startsWith('/api/') || pathname === '/health') {\n apiListener(req, res);\n } else if (uiDir) {\n serveStatic(uiDir, req, res);\n } else {\n res.writeHead(404, { 'Content-Type': 'application/json' }).end(\n JSON.stringify({\n message: 'API-only. Point your Nuxt host (studio-integrations) integrationsApi at this URL, or pass --ui <static-build-dir>. CORS is open.',\n }),\n );\n }\n });\n\n await new Promise<void>(r => server.listen(options.port, r));\n\n const stopWatch = watchAndReload(options.entry, async () => {\n try {\n loaded = await loadPackageFromEntry(options.entry);\n console.log(`↻ Reloaded package (${loaded.nodes.length} nodes, ${loaded.credentials.length} credentials).`);\n } catch (err) {\n console.error(`Reload failed: ${(err as Error).message}`);\n }\n });\n\n return {\n uiDir,\n dispose() {\n if (options.persist) {\n saveState(options.stateFile, store.toSnapshot());\n }\n stopWatch?.();\n server.close();\n },\n };\n}\n\n/** Interactive mock server (API + optional static UI). */\nasync function run(options: CliOptions): Promise<void> {\n const mock = await startMock(options);\n const urlBase = `http://localhost:${options.port}`;\n console.log(`\\n Mock Integrations API ${urlBase}/api/v1`);\n console.log(mock.uiDir ? ` Preview UI ${urlBase}` : ` Preview UI API-only — set your Nuxt host's integrationsApi to ${urlBase}/api/v1`);\n console.log('\\n Watching for changes. Ctrl-C to stop.\\n');\n\n if (options.open && mock.uiDir) {\n void openBrowser(urlBase);\n }\n\n const shutdown = () => {\n mock.dispose();\n process.exit(0);\n };\n process.on('SIGINT', shutdown);\n process.on('SIGTERM', shutdown);\n}\n\n/** Watches the entry's directory tree and fires `onChange` (debounced). Returns a stop fn. */\nfunction watchAndReload(entry: string, onChange: () => void): (() => void) | undefined {\n const dir = resolve(entry, '..');\n let timer: NodeJS.Timeout | undefined;\n try {\n const watcher = watch(dir, { recursive: true }, (_event, file) => {\n if (file && /\\.[cm]?tsx?$|\\.js$/.test(file.toString())) {\n clearTimeout(timer);\n timer = setTimeout(onChange, 200);\n }\n });\n return () => watcher.close();\n } catch {\n // Recursive watch unsupported on this platform — skip hot-reload.\n console.warn('Hot-reload unavailable on this platform; restart to pick up changes.');\n return undefined;\n }\n}\n\n/** Runs `npm install` in `dir`, inheriting stdio. */\nasync function runNpmInstall(dir: string): Promise<void> {\n const { spawn } = await import('node:child_process');\n await new Promise<void>((resolvePromise, reject) => {\n const child = spawn('npm', ['install'], { cwd: dir, stdio: 'inherit' });\n child.on('exit', code => (code === 0 ? resolvePromise() : reject(new Error(`npm install exited with code ${code}`))));\n child.on('error', reject);\n });\n}\n\n/** Scaffolds (if needed), installs, and runs the Nuxt preview host + the mock together. */\nasync function preview(options: CliOptions): Promise<void> {\n const dir = options.previewDir;\n const apiUrl = `http://localhost:${options.port}/api/v1`;\n\n if (!previewExists(dir) || options.force) {\n scaffoldPreview({ dir, integrationsApiUrl: apiUrl, force: options.force, log: msg => console.log(msg) });\n }\n if (!previewDepsInstalled(dir)) {\n console.log('Installing preview-host dependencies (first run — this pulls Nuxt + the studio packages and may take a while)…');\n await runNpmInstall(dir);\n }\n\n const mock = await startMock({ ...options, serveUi: false });\n console.log(`\\n Mock Integrations API ${apiUrl}`);\n console.log(' Preview UI http://localhost:3000/integrations (Nuxt starting…)\\n');\n\n const { spawn } = await import('node:child_process');\n const child = spawn('npm', ['run', 'dev'], {\n cwd: dir,\n stdio: 'inherit',\n env: {\n ...process.env,\n NUXT_PUBLIC_INTEGRATIONS_API: apiUrl,\n NUXT_PUBLIC_DEV_TOKEN: process.env.NUXT_PUBLIC_DEV_TOKEN ?? 'dev',\n NUXT_PUBLIC_DEV_TENANT: process.env.NUXT_PUBLIC_DEV_TENANT ?? 'dev-tenant',\n },\n });\n\n const shutdown = () => {\n child.kill('SIGTERM');\n mock.dispose();\n process.exit(0);\n };\n process.on('SIGINT', shutdown);\n process.on('SIGTERM', shutdown);\n child.on('exit', code => {\n mock.dispose();\n process.exit(code ?? 0);\n });\n}\n\nasync function openBrowser(url: string): Promise<void> {\n const cmd = process.platform === 'darwin' ? 'open' : process.platform === 'win32' ? 'start' : 'xdg-open';\n const { spawn } = await import('node:child_process');\n spawn(cmd, [url], { stdio: 'ignore', detached: true }).unref();\n}\n\nasync function main(): Promise<void> {\n const argv = process.argv.slice(2);\n // Before parseArgs: it reads `PORT`, and seeds interpolate `${VAR}` from the\n // environment once the mock starts.\n const envFile = loadEnvFile(argv);\n const { command, options } = parseArgs(argv);\n if (command === 'version') {\n console.log(DEVKIT_VERSION);\n return;\n }\n if (envFile) {\n console.log(`Loaded env from ${envFile}`);\n }\n if (command === 'reset') {\n const { rmSync } = await import('node:fs');\n rmSync(options.stateFile, { force: true });\n console.log(`Removed ${options.stateFile}`);\n return;\n }\n if (command === 'init-preview') {\n scaffoldPreview({\n dir: options.previewDir,\n integrationsApiUrl: `http://localhost:${options.port}/api/v1`,\n force: options.force,\n log: msg => console.log(msg),\n });\n console.log(`\\nNext: \\`integrations-devkit preview\\` (installs deps + starts mock + Nuxt), or \\`cd ${options.previewDir} && npm install && npm run dev\\`.`);\n return;\n }\n if (command === 'preview') {\n await preview(options);\n return;\n }\n await run(options);\n}\n\nmain().catch(err => {\n console.error(err);\n process.exit(1);\n});\n","import { existsSync } from 'node:fs';\nimport { basename, resolve } from 'node:path';\n\n/**\n * `.env` loading for the CLI.\n *\n * Seeds reference secrets as `${VAR}` and {@link interpolateEnv} resolves those\n * from `process.env`, so without this the documented workflow — commit the\n * reference, keep the value in `.env` — only worked if the developer exported\n * the variables by hand.\n *\n * Loading happens before option parsing, because the CLI reads `PORT` for its\n * default port; a `.env` that sets `PORT` would otherwise be read too late.\n *\n * Exactly one file is ever loaded: `.env` by default, or the one named by\n * `--env`, which *replaces* the default rather than layering on top of it.\n * \"Use this env file\" is what the flag reads like, so leaving `.env` in play\n * would be the surprise. `--no-env` loads none.\n *\n * `process.loadEnvFile` deliberately does not overwrite variables that are\n * already set, so a shell-provided value always beats the file:\n *\n * REVENEXX_DEV_API_KEY=… npm run preview\n *\n * The flag is `--env`, *not* `--env-file`: Node reserves `--env-file` and\n * `--env-file-if-exists` and acts on them wherever they appear, including after\n * the script path. `node cli.js --env-file missing` therefore dies inside Node\n * with exit code 9 before this module is ever reached, so the devkit cannot own\n * that name. {@link nodeOwnedEnvFlag} spots the mistake and explains it.\n *\n * `--env` takes a path rather than Laravel's bare environment name, because it\n * mirrors Node's flag and because a path can point outside the package. A value\n * that looks like it was meant as a name still gets a pointed error — see\n * {@link missingFileMessage}.\n */\n\n/** Minimum Node version shipping `process.loadEnvFile`. */\nexport const ENV_FILE_MIN_NODE = '20.12';\n\n/** Flags Node itself consumes, positionally, and which the devkit must not reuse. */\nconst NODE_OWNED_FLAGS = ['--env-file', '--env-file-if-exists'];\n\nexport interface EnvFileChoice {\n /** Absolute path to load, or `null` when `--no-env` disabled loading. */\n path: string | null;\n /** True when the file was named with `--env` rather than defaulted to. */\n explicit: boolean;\n /** The `--env` value exactly as typed, kept for {@link missingFileMessage}. */\n raw?: string;\n}\n\n/**\n * Returns the Node-owned env flag present in `argv`, if any. Node has already\n * acted on it by the time the CLI runs — this exists only so the CLI can say so\n * instead of leaving the user wondering why `--env-file` behaved oddly.\n */\nexport function nodeOwnedEnvFlag(argv: string[]): string | null {\n return NODE_OWNED_FLAGS.find(flag => argv.includes(flag) || argv.some(arg => arg.startsWith(`${flag}=`))) ?? null;\n}\n\n/**\n * Decides which env file to load. Pure — touches neither disk nor `process.env`.\n *\n * A repeated `--env` resolves to the last one, matching every other option in\n * the CLI, whose parse loop simply overwrites. Every occurrence is still\n * validated, so a malformed earlier one is reported rather than skipped.\n */\nexport function resolveEnvFile(argv: string[], cwd: string = process.cwd()): EnvFileChoice {\n if (argv.includes('--no-env')) {\n return { path: null, explicit: false };\n }\n\n let named: EnvFileChoice | null = null;\n for (let i = 0; i < argv.length; i++) {\n // Strict equality: `--env-file` belongs to Node, and `--env-file=x` must\n // not be mistaken for a value-carrying `--env`.\n if (argv[i] !== '--env') {\n continue;\n }\n const value = argv[++i];\n if (!value || value.startsWith('-')) {\n throw new Error('--env requires a path.');\n }\n named = { path: resolve(cwd, value), explicit: true, raw: value };\n }\n\n return named ?? { path: resolve(cwd, '.env'), explicit: false };\n}\n\n/**\n * Explains a named-but-missing env file. When the value looks like a Laravel\n * environment name and the matching `.env.<name>` is right there, say so — the\n * bare \"does not exist\" would leave the user re-reading the flag's docs.\n */\nfunction missingFileMessage(choice: EnvFileChoice, cwd: string): string {\n const raw = choice.raw;\n if (raw && raw === basename(raw) && existsSync(resolve(cwd, `.env.${raw}`))) {\n return `--env: ${choice.path} does not exist. Did you mean --env .env.${raw}? The flag takes a path, not an environment name.`;\n }\n return `--env: ${choice.path} does not exist.`;\n}\n\nexport interface LoadEnvFileOptions {\n cwd?: string;\n warn?: (message: string) => void;\n}\n\n/**\n * Loads the env file chosen by {@link resolveEnvFile} into `process.env` and\n * returns its path, or `null` when nothing was loaded.\n *\n * A missing *default* `.env` is fine — most packages do not have one. A file\n * asked for by name and missing is an error: ignoring it would hide a typo and\n * resurface much later as a puzzling `Seed references ${X}` failure. There is no\n * fallback to `.env` in that case, since naming a file replaces the default.\n */\nexport function loadEnvFile(argv: string[], options: LoadEnvFileOptions = {}): string | null {\n const { cwd = process.cwd(), warn = (message: string) => console.warn(message) } = options;\n\n const nodeFlag = nodeOwnedEnvFlag(argv);\n if (nodeFlag) {\n warn(`Note: ${nodeFlag} is a Node flag and Node has already applied it. The devkit's own flag is --env <path>.`);\n }\n\n const choice = resolveEnvFile(argv, cwd);\n if (!choice.path) {\n return null;\n }\n if (!existsSync(choice.path)) {\n if (choice.explicit) {\n throw new Error(missingFileMessage(choice, cwd));\n }\n return null;\n }\n // npm's `engines` field is advisory, so an old runtime reaches this far.\n if (typeof process.loadEnvFile !== 'function') {\n warn(`Ignoring ${choice.path}: env-file support needs Node >= ${ENV_FILE_MIN_NODE} (running ${process.version}).`);\n return null;\n }\n\n process.loadEnvFile(choice.path);\n return choice.path;\n}\n","/**\n * `@revenexx/integrations-node-devkit` — local development kit for Revenexx\n * integration node packages. Dev/CI only; never bundled into a node package.\n *\n * Two surfaces:\n * - `@revenexx/integrations-node-devkit` → the mock-API preview server (this entry)\n * - `@revenexx/integrations-node-devkit/testing` → the unit-testing harness\n */\n\nimport { readFileSync } from 'node:fs';\n\n// Read from package.json rather than hardcoded, so the released version can\n// never drift from what `integrations-devkit --version` prints. `../` resolves\n// to the package root from both `src/` and the bundled `dist/`. The CJS build\n// needs tsup's `shims: true` for `import.meta.url`.\nconst manifestUrl = new URL('../package.json', import.meta.url);\nexport const DEVKIT_VERSION: string = JSON.parse(readFileSync(manifestUrl, 'utf8')).version;\n\nexport {\n ENV_FILE_MIN_NODE,\n type EnvFileChoice,\n loadEnvFile,\n type LoadEnvFileOptions,\n nodeOwnedEnvFlag,\n resolveEnvFile,\n} from './env.js';\nexport { DevApiError } from './errors.js';\nexport {\n ensureTsxRegistered,\n importFresh,\n type LoadedPackage,\n loadPackageFromEntry,\n resolveExports,\n} from './loader.js';\nexport {\n applySeeds,\n type CredentialSeed,\n type DevSeeds,\n interpolateEnv,\n loadSeedsFromDir,\n loadState,\n saveState,\n type SecretSeed,\n type WorkflowSeed,\n} from './persistence.js';\nexport {\n buildOAuthAuthorizeUrl,\n exchangeOAuthCode,\n findCredential,\n findCredentialType,\n findNode,\n nodeVersions,\n type ResolveNodeConfigInput,\n type ResolveNodeConfigResult,\n resolveCredentialInstance,\n resolveNodeConfig,\n testCredentialConfig,\n testCredentialInstance,\n type ValidateNodeConfigInput,\n type ValidateNodeConfigResult,\n validateNodeConfig,\n} from './resolve.js';\nexport {\n createDevServer,\n createRequestListener,\n type DevServerDeps,\n} from './server.js';\nexport {\n type CredentialRecord,\n DEV_TENANT_ID,\n DevStore,\n type DevStoreSnapshot,\n type SecretRecord,\n STORE_SCHEMA_VERSION,\n type TriggerRecord,\n type WorkflowRecord,\n} from './store.js';\n","/**\n * An error that maps to an HTTP status + JSON body in the mock API, mirroring\n * Laravel's `{message}` / `{message, errors}` envelopes.\n */\nexport class DevApiError extends Error {\n constructor(\n public readonly status: number,\n message: string,\n public readonly errors?: Record<string, string[]>,\n ) {\n super(message);\n this.name = 'DevApiError';\n }\n}\n","import { pathToFileURL } from 'node:url';\nimport { buildManifest, type ICredential, type INode, type ITemplateDescription, type NodeManifest } from '@revenexx/integrations-node-sdk';\n\n/**\n * A node package loaded into the dev process: its live `NODES` / `CREDENTIALS`\n * / `TEMPLATES` instances (so author-time resolvers, `test`, and `resolve` can\n * be invoked in-process — no bundle, no sandbox) plus the derived manifest the\n * mock API serves.\n */\nexport interface LoadedPackage {\n nodes: INode[];\n credentials: ICredential[];\n templates: ITemplateDescription[];\n manifest: NodeManifest;\n}\n\ninterface PackageExports {\n NODES?: unknown;\n CREDENTIALS?: unknown;\n TEMPLATES?: unknown;\n}\n\n/**\n * Validates a package's module exports and builds a {@link LoadedPackage}.\n * Mirrors the checks in the SDK's `rvnxx-nodes manifest` CLI so the dev loop\n * and the build produce identical manifests.\n */\nexport function resolveExports(mod: PackageExports): LoadedPackage {\n if (!Array.isArray(mod.NODES)) {\n throw new Error('Package entry does not export a `NODES` array. Export `NODES: INode[]`.');\n }\n if (mod.CREDENTIALS !== undefined && !Array.isArray(mod.CREDENTIALS)) {\n throw new Error('Package entry exports `CREDENTIALS` but it is not an array.');\n }\n if (mod.TEMPLATES !== undefined && !Array.isArray(mod.TEMPLATES)) {\n throw new Error('Package entry exports `TEMPLATES` but it is not an array.');\n }\n\n const nodes = mod.NODES as INode[];\n const credentials = (mod.CREDENTIALS as ICredential[] | undefined) ?? [];\n const templates = (mod.TEMPLATES as ITemplateDescription[] | undefined) ?? [];\n\n return {\n nodes,\n credentials,\n templates,\n manifest: buildManifest(nodes, credentials, templates),\n };\n}\n\nlet tsxRegistered = false;\n\n/**\n * Registers the `tsx` ESM loader once per process so `import()` can load\n * TypeScript sources directly. Idempotent.\n */\nexport async function ensureTsxRegistered(): Promise<void> {\n if (tsxRegistered) {\n return;\n }\n const { register } = await import('tsx/esm/api');\n register();\n tsxRegistered = true;\n}\n\n/** Imports a module by path, registering tsx first for TypeScript sources. */\nexport async function importFresh<T = unknown>(entryPath: string): Promise<T> {\n if (/\\.[cm]?tsx?$/.test(entryPath)) {\n await ensureTsxRegistered();\n }\n const href = `${pathToFileURL(entryPath).href}?t=${Date.now()}`;\n return (await import(href)) as T;\n}\n\n/**\n * Imports a package entry and resolves its exports. Supports TypeScript\n * sources directly (via `tsx`) so the preview runs against the developer's\n * live `src/`, not a built artifact. A cache-busting query is appended so\n * repeated calls (hot-reload) re-evaluate the module.\n */\nexport async function loadPackageFromEntry(entryPath: string): Promise<LoadedPackage> {\n return resolveExports(await importFresh<PackageExports>(entryPath));\n}\n","import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { dirname, resolve } from 'node:path';\nimport { importFresh } from './loader.js';\nimport { type DevStore, type DevStoreSnapshot, STORE_SCHEMA_VERSION } from './store.js';\n\n/**\n * Layered persistence for the preview session:\n * 1. committed seeds (this module's {@link applySeeds}) — the durable base,\n * with `${ENV_VAR}` references interpolated from the environment;\n * 2. `.revenexx-dev/state.json` overlay ({@link loadState}/{@link saveState}) —\n * interactive session state, versioned and disposable.\n */\n\nexport interface CredentialSeed {\n credentialTypeSlug: string;\n name: string;\n config: Record<string, unknown>;\n /** Stable id so workflows can reference the credential across restarts. */\n id?: string;\n status?: string;\n durableCreds?: Record<string, unknown> | null;\n}\n\nexport interface SecretSeed {\n key: string;\n value: string;\n}\n\nexport interface WorkflowSeed {\n name: string;\n definition: Record<string, unknown>;\n}\n\nexport interface DevSeeds {\n credentials?: CredentialSeed[];\n secrets?: SecretSeed[];\n workflows?: WorkflowSeed[];\n}\n\nconst ENV_REF = /\\$\\{([A-Z0-9_]+)\\}/g;\n\n/**\n * Recursively replaces `${ENV_VAR}` references in string values from `env`.\n * Throws a clear error when a referenced variable is unset so a developer\n * knows to add it to their `.env` — keeping secrets out of committed seeds.\n */\nexport function interpolateEnv<T>(value: T, env: NodeJS.ProcessEnv = process.env): T {\n if (typeof value === 'string') {\n return value.replace(ENV_REF, (_match, name: string) => {\n const resolved = env[name];\n if (resolved === undefined) {\n throw new Error(`Seed references \\${${name}} but that environment variable is not set (add it to your .env).`);\n }\n return resolved;\n }) as unknown as T;\n }\n if (Array.isArray(value)) {\n return value.map(item => interpolateEnv(item, env)) as unknown as T;\n }\n if (value && typeof value === 'object') {\n const out: Record<string, unknown> = {};\n for (const [key, val] of Object.entries(value)) {\n out[key] = interpolateEnv(val, env);\n }\n return out as T;\n }\n return value;\n}\n\n/** Applies committed seeds to the store (env-interpolated). */\nexport function applySeeds(store: DevStore, seeds: DevSeeds, env: NodeJS.ProcessEnv = process.env): void {\n for (const secret of seeds.secrets ?? []) {\n const { key, value } = interpolateEnv(secret, env);\n store.setSecret(key, value);\n }\n for (const credential of seeds.credentials ?? []) {\n const resolved = interpolateEnv(credential, env);\n store.createCredential({\n credentialTypeSlug: resolved.credentialTypeSlug,\n name: resolved.name,\n config: resolved.config,\n id: resolved.id,\n status: resolved.status,\n durableCreds: resolved.durableCreds ?? null,\n });\n }\n for (const workflow of seeds.workflows ?? []) {\n store.createWorkflow(interpolateEnv(workflow, env));\n }\n}\n\n/**\n * Reads a persisted session snapshot. Returns `null` (and warns) when the file\n * is absent or its `schemaVersion` no longer matches — the overlay is\n * disposable, so a mismatch is discarded rather than migrated.\n */\nexport function loadState(file: string, log: (msg: string) => void = console.warn): DevStoreSnapshot | null {\n if (!existsSync(file)) {\n return null;\n }\n let parsed: DevStoreSnapshot;\n try {\n parsed = JSON.parse(readFileSync(file, 'utf-8')) as DevStoreSnapshot;\n } catch {\n log(`Ignoring ${file}: not valid JSON.`);\n return null;\n }\n if (parsed.schemaVersion !== STORE_SCHEMA_VERSION) {\n log(`Ignoring ${file}: schemaVersion ${parsed.schemaVersion} != ${STORE_SCHEMA_VERSION} (discarded, seeds are the source of truth).`);\n return null;\n }\n return parsed;\n}\n\nexport function saveState(file: string, snapshot: DevStoreSnapshot): void {\n mkdirSync(dirname(file), { recursive: true });\n writeFileSync(file, JSON.stringify(snapshot, null, 2), 'utf-8');\n}\n\nconst SEED_ENTRY_CANDIDATES = ['index.ts', 'index.mjs', 'index.js', 'seeds.ts', 'seeds.js'];\n\n/**\n * Loads committed seeds from a directory (default `dev/seeds`). Resolves the\n * first present entry file and reads its `default` or named `seeds` export.\n * Returns empty seeds when no seed directory/entry exists.\n */\nexport async function loadSeedsFromDir(dir: string): Promise<DevSeeds> {\n for (const candidate of SEED_ENTRY_CANDIDATES) {\n const path = resolve(dir, candidate);\n if (existsSync(path)) {\n const mod = await importFresh<{ default?: DevSeeds; seeds?: DevSeeds }>(path);\n return mod.default ?? mod.seeds ?? {};\n }\n }\n return {};\n}\n","import { randomUUID } from 'node:crypto';\n\n/**\n * In-memory data store backing the mock Integrations API. Holds the tenant-\n * scoped resources a developer creates in the preview (credentials, secrets,\n * workflows, triggers). Serializable so a session can be persisted to and\n * rehydrated from `.revenexx-dev/state.json`.\n */\n\nexport const DEV_TENANT_ID = 'dev-tenant';\n\nexport interface CredentialRecord {\n id: string;\n tenantId: string;\n credentialTypeSlug: string;\n name: string;\n status: string;\n /** Full user-entered config, including secret fields (never sent to the UI verbatim). */\n config: Record<string, unknown>;\n /** System-managed long-lived secrets (e.g. an OAuth refresh token). */\n durableCreds: Record<string, unknown> | null;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface SecretRecord {\n key: string;\n value: string;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface WorkflowRecord {\n id: number;\n name: string;\n definition: Record<string, unknown>;\n buildStatus: string;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface TriggerRecord {\n id: string;\n workflowId: number;\n type: string;\n name: string | null;\n config: Record<string, unknown>;\n active: boolean;\n createdAt: string;\n updatedAt: string;\n}\n\nexport interface DevStoreSnapshot {\n schemaVersion: number;\n credentials: CredentialRecord[];\n secrets: SecretRecord[];\n workflows: WorkflowRecord[];\n triggers: TriggerRecord[];\n nextWorkflowId: number;\n}\n\nexport const STORE_SCHEMA_VERSION = 1;\n\nfunction now(): string {\n return new Date().toISOString();\n}\n\nexport class DevStore {\n private credentials = new Map<string, CredentialRecord>();\n private secrets = new Map<string, SecretRecord>();\n private workflows = new Map<number, WorkflowRecord>();\n private triggers = new Map<string, TriggerRecord>();\n private nextWorkflowId = 1;\n\n /**\n * @param onChange fired after any mutation so a caller (the CLI) can persist\n * the session to `.revenexx-dev/state.json`.\n */\n constructor(private onChange?: () => void) {}\n\n /** (Re)wire the post-mutation callback — e.g. attach it only after seeding. */\n setOnMutation(onChange: (() => void) | undefined): void {\n this.onChange = onChange;\n }\n\n private touch(): void {\n this.onChange?.();\n }\n\n // ------------------------------------------------------------- credentials\n\n listCredentials(typeSlug?: string): CredentialRecord[] {\n const all = [...this.credentials.values()];\n return typeSlug ? all.filter(c => c.credentialTypeSlug === typeSlug) : all;\n }\n\n getCredential(id: string): CredentialRecord | undefined {\n return this.credentials.get(id);\n }\n\n createCredential(input: {\n credentialTypeSlug: string;\n name: string;\n config: Record<string, unknown>;\n status?: string;\n /** Stable id — pass to keep a seeded credential's id fixed across restarts. */\n id?: string;\n durableCreds?: Record<string, unknown> | null;\n }): CredentialRecord {\n const ts = now();\n const record: CredentialRecord = {\n id: input.id ?? randomUUID(),\n tenantId: DEV_TENANT_ID,\n credentialTypeSlug: input.credentialTypeSlug,\n name: input.name,\n status: input.status ?? 'active',\n config: input.config,\n durableCreds: input.durableCreds ?? null,\n createdAt: ts,\n updatedAt: ts,\n };\n this.credentials.set(record.id, record);\n this.touch();\n return record;\n }\n\n updateCredential(id: string, patch: Partial<Pick<CredentialRecord, 'name' | 'config' | 'status' | 'durableCreds'>>): CredentialRecord | undefined {\n const record = this.credentials.get(id);\n if (!record) {\n return undefined;\n }\n if (patch.name !== undefined) {\n record.name = patch.name;\n }\n if (patch.config !== undefined) {\n record.config = patch.config;\n }\n if (patch.status !== undefined) {\n record.status = patch.status;\n }\n if (patch.durableCreds !== undefined) {\n record.durableCreds = patch.durableCreds;\n }\n record.updatedAt = now();\n this.touch();\n return record;\n }\n\n deleteCredential(id: string): boolean {\n const deleted = this.credentials.delete(id);\n if (deleted) {\n this.touch();\n }\n return deleted;\n }\n\n // ----------------------------------------------------------------- secrets\n\n listSecrets(): SecretRecord[] {\n return [...this.secrets.values()];\n }\n\n getSecret(key: string): SecretRecord | undefined {\n return this.secrets.get(key);\n }\n\n setSecret(key: string, value: string): SecretRecord {\n const existing = this.secrets.get(key);\n const ts = now();\n const record: SecretRecord = {\n key,\n value,\n createdAt: existing?.createdAt ?? ts,\n updatedAt: ts,\n };\n this.secrets.set(key, record);\n this.touch();\n return record;\n }\n\n deleteSecret(key: string): boolean {\n const deleted = this.secrets.delete(key);\n if (deleted) {\n this.touch();\n }\n return deleted;\n }\n\n // --------------------------------------------------------------- workflows\n\n listWorkflows(): WorkflowRecord[] {\n return [...this.workflows.values()];\n }\n\n getWorkflow(id: number): WorkflowRecord | undefined {\n return this.workflows.get(id);\n }\n\n createWorkflow(input: { name: string; definition: Record<string, unknown> }): WorkflowRecord {\n const ts = now();\n const record: WorkflowRecord = {\n id: this.nextWorkflowId++,\n name: input.name,\n definition: input.definition,\n buildStatus: 'ready',\n createdAt: ts,\n updatedAt: ts,\n };\n this.workflows.set(record.id, record);\n this.touch();\n return record;\n }\n\n updateWorkflow(id: number, patch: Partial<Pick<WorkflowRecord, 'name' | 'definition' | 'buildStatus'>>): WorkflowRecord | undefined {\n const record = this.workflows.get(id);\n if (!record) {\n return undefined;\n }\n Object.assign(record, patch, { updatedAt: now() });\n this.touch();\n return record;\n }\n\n deleteWorkflow(id: number): boolean {\n for (const trigger of this.triggers.values()) {\n if (trigger.workflowId === id) {\n this.triggers.delete(trigger.id);\n }\n }\n const deleted = this.workflows.delete(id);\n if (deleted) {\n this.touch();\n }\n return deleted;\n }\n\n // ---------------------------------------------------------------- triggers\n\n listTriggers(workflowId: number): TriggerRecord[] {\n return [...this.triggers.values()].filter(t => t.workflowId === workflowId);\n }\n\n getTrigger(id: string): TriggerRecord | undefined {\n return this.triggers.get(id);\n }\n\n createTrigger(input: {\n workflowId: number;\n type: string;\n name?: string | null;\n config?: Record<string, unknown>;\n active?: boolean;\n id?: string;\n }): TriggerRecord {\n const ts = now();\n const record: TriggerRecord = {\n id: input.id ?? randomUUID(),\n workflowId: input.workflowId,\n type: input.type,\n name: input.name ?? null,\n config: input.config ?? {},\n active: input.active ?? true,\n createdAt: ts,\n updatedAt: ts,\n };\n this.triggers.set(record.id, record);\n this.touch();\n return record;\n }\n\n replaceTrigger(id: string, input: { type: string; name?: string | null; config?: Record<string, unknown>; active?: boolean }): TriggerRecord | undefined {\n const record = this.triggers.get(id);\n if (!record) {\n return undefined;\n }\n record.type = input.type;\n record.name = input.name ?? null;\n record.config = input.config ?? {};\n record.active = input.active ?? true;\n record.updatedAt = now();\n this.touch();\n return record;\n }\n\n deleteTrigger(id: string): boolean {\n const deleted = this.triggers.delete(id);\n if (deleted) {\n this.touch();\n }\n return deleted;\n }\n\n // ------------------------------------------------------------- persistence\n\n toSnapshot(): DevStoreSnapshot {\n return {\n schemaVersion: STORE_SCHEMA_VERSION,\n credentials: [...this.credentials.values()],\n secrets: [...this.secrets.values()],\n workflows: [...this.workflows.values()],\n triggers: [...this.triggers.values()],\n nextWorkflowId: this.nextWorkflowId,\n };\n }\n\n loadSnapshot(snapshot: DevStoreSnapshot): void {\n this.credentials = new Map(snapshot.credentials.map(c => [c.id, c]));\n this.secrets = new Map(snapshot.secrets.map(s => [s.key, s]));\n this.workflows = new Map(snapshot.workflows.map(w => [w.id, w]));\n this.triggers = new Map(snapshot.triggers.map(t => [t.id, t]));\n this.nextWorkflowId = snapshot.nextWorkflowId ?? Math.max(0, ...snapshot.workflows.map(w => w.id)) + 1;\n }\n\n /**\n * Overlays a snapshot on top of the current contents (upsert by id/key), used\n * to layer the persisted `.revenexx-dev/state.json` session over the freshly\n * applied committed seeds. State entries win over seed entries with the same\n * id/key; seed-only entries are preserved.\n */\n mergeSnapshot(snapshot: DevStoreSnapshot): void {\n for (const c of snapshot.credentials) {\n this.credentials.set(c.id, c);\n }\n for (const s of snapshot.secrets) {\n this.secrets.set(s.key, s);\n }\n for (const w of snapshot.workflows) {\n this.workflows.set(w.id, w);\n }\n for (const t of snapshot.triggers) {\n this.triggers.set(t.id, t);\n }\n this.nextWorkflowId = Math.max(this.nextWorkflowId, snapshot.nextWorkflowId ?? 0, ...snapshot.workflows.map(w => w.id + 1));\n }\n}\n","import {\n type IConfigField,\n type IConfigOption,\n type ICredential,\n type ICredentialContext,\n type ICredentialDescription,\n type ICredentialResolveResult,\n type ICredentialTestResult,\n type INode,\n type INodeAuthorContext,\n type IOutputPort,\n isOAuthAuthorizeCredential,\n} from '@revenexx/integrations-node-sdk';\nimport { DevApiError } from './errors.js';\nimport type { LoadedPackage } from './loader.js';\nimport type { DevStore } from './store.js';\n\n/**\n * The fidelity centre of the mock API: instead of the production sandbox +\n * content-addressed bundle, the developer's live node/credential instances are\n * invoked directly in-process. Author-time resolvers, credential `test`, and\n * `resolve` run exactly as the developer wrote them. The PO-145 grant/security\n * model is intentionally omitted — this is dev-only.\n */\n\nconst noopLogger = {\n info() {},\n warn() {},\n error() {},\n};\n\nfunction compareSemver(a: string, b: string): number {\n const pa = a.split('.').map(n => Number.parseInt(n, 10) || 0);\n const pb = b.split('.').map(n => Number.parseInt(n, 10) || 0);\n for (let i = 0; i < 3; i++) {\n const diff = (pa[i] ?? 0) - (pb[i] ?? 0);\n if (diff !== 0) {\n return diff;\n }\n }\n return 0;\n}\n\nexport function nodeVersions(loaded: LoadedPackage, slug: string): string[] {\n return loaded.nodes\n .filter(n => n.description.slug === slug)\n .map(n => n.description.version)\n .sort((a, b) => compareSemver(b, a));\n}\n\nexport function findNode(loaded: LoadedPackage, slug: string, version?: string): INode {\n const matches = loaded.nodes.filter(n => n.description.slug === slug);\n if (matches.length === 0) {\n throw new DevApiError(404, `Node '${slug}' not found.`);\n }\n if (!version || version === 'latest') {\n return [...matches].sort((a, b) => compareSemver(b.description.version, a.description.version))[0]!;\n }\n const exact = matches.find(n => n.description.version === version);\n if (!exact) {\n throw new DevApiError(404, `Node '${slug}' has no version '${version}'.`);\n }\n return exact;\n}\n\nexport function findCredential(loaded: LoadedPackage, slug: string): ICredential {\n const cred = loaded.credentials.find(c => c.description.slug === slug);\n if (!cred) {\n throw new DevApiError(404, `Credential type '${slug}' not found.`);\n }\n return cred;\n}\n\nexport function findCredentialType(loaded: LoadedPackage, slug: string): ICredentialDescription {\n return findCredential(loaded, slug).description;\n}\n\nfunction credentialContext(store: DevStore, credentialId?: string): ICredentialContext {\n return {\n signal: new AbortController().signal,\n logger: noopLogger,\n persistDurableCreds: credentialId\n ? async (durableCreds: Record<string, unknown>) => {\n store.updateCredential(credentialId, { durableCreds });\n }\n : undefined,\n };\n}\n\n/** Resolves a credential instance's access data by running its real `resolve`. */\nexport async function resolveCredentialInstance(loaded: LoadedPackage, store: DevStore, credentialId: string): Promise<ICredentialResolveResult> {\n const instance = store.getCredential(credentialId);\n if (!instance) {\n throw new DevApiError(404, `Credential instance '${credentialId}' not found.`);\n }\n const cred = findCredential(loaded, instance.credentialTypeSlug);\n const ctx = credentialContext(store, credentialId);\n return cred.resolve(ctx, instance.config, instance.durableCreds);\n}\n\nfunction authorContext(loaded: LoadedPackage, store: DevStore, config: Record<string, unknown>, locale?: string): INodeAuthorContext {\n return {\n signal: new AbortController().signal,\n logger: noopLogger,\n config,\n secrets: {\n async get(key: string): Promise<string> {\n const secret = store.getSecret(key);\n if (!secret) {\n throw new DevApiError(404, `Secret '${key}' not found.`);\n }\n return secret.value;\n },\n },\n credentials: {\n async get(id: string): Promise<Record<string, unknown>> {\n return (await resolveCredentialInstance(loaded, store, id)).credentials;\n },\n },\n locale,\n };\n}\n\nexport interface ResolveNodeConfigInput {\n slug: string;\n version?: string;\n /** `\"*\"` (all), `\"outputs\"`, or a specific config field key. */\n target: string;\n config: Record<string, unknown>;\n locale?: string;\n}\n\nexport interface ResolveNodeConfigResult {\n options?: IConfigOption[];\n fields?: IConfigField[];\n outputs?: IOutputPort[];\n}\n\n/**\n * Runs a node's author-time resolvers for the requested `target`, mirroring\n * the server's `config:resolve` semantics.\n */\nexport async function resolveNodeConfig(loaded: LoadedPackage, store: DevStore, input: ResolveNodeConfigInput): Promise<ResolveNodeConfigResult> {\n const node = findNode(loaded, input.slug, input.version);\n const ctx = authorContext(loaded, store, input.config ?? {}, input.locale);\n\n try {\n if (input.target === 'outputs') {\n if (!node.resolveOutputs) {\n return { outputs: [] };\n }\n return { outputs: await node.resolveOutputs(ctx) };\n }\n\n if (input.target === '*') {\n const result: ResolveNodeConfigResult = {};\n if (node.resolveConfigSchema) {\n result.fields = await node.resolveConfigSchema(ctx);\n }\n if (node.resolveOutputs) {\n result.outputs = await node.resolveOutputs(ctx);\n }\n return result;\n }\n\n // A specific config field key.\n const field = node.description.config?.find(f => f.key === input.target);\n if (field?.type === 'dynamic-schema') {\n if (!node.resolveConfigSchema) {\n return { fields: [] };\n }\n return { fields: await node.resolveConfigSchema(ctx) };\n }\n if (!node.loadOptions) {\n return { options: [] };\n }\n return { options: await node.loadOptions(ctx, input.target) };\n } catch (err) {\n if (err instanceof DevApiError) {\n throw err;\n }\n throw new DevApiError(502, `Node resolve failed: ${(err as Error).message}`);\n }\n}\n\nexport interface ValidateNodeConfigInput {\n slug: string;\n version?: string;\n config: Record<string, unknown>;\n locale?: string;\n}\n\nexport interface ValidateNodeConfigResult {\n valid: boolean;\n /** Config field key → human-readable messages. Empty object when valid. */\n errors: Record<string, string[]>;\n}\n\n/** True when a value counts as \"provided\" (mirrors the UI's `isResolvableValue`). */\nfunction isProvided(value: unknown): boolean {\n if (value === undefined || value === null) {\n return false;\n }\n if (typeof value === 'string') {\n return value.trim().length > 0;\n }\n if (Array.isArray(value)) {\n return value.length > 0;\n }\n return true;\n}\n\n/** An expression placeholder (`${{…}}` / leading `=`) is \"set\" but not statically checkable. */\nfunction isExpression(value: unknown): boolean {\n return typeof value === 'string' && (value.startsWith('=') || value.includes('${{'));\n}\n\n/** Applies one field's static rules to `value`, pushing messages under `field.key`. */\nfunction validateField(field: IConfigField, value: unknown, errors: Record<string, string[]>): void {\n const push = (msg: string): void => {\n (errors[field.key] ??= []).push(msg);\n };\n const provided = isProvided(value);\n if (field.required && !provided) {\n push('This field is required.');\n return;\n }\n if (!provided || isExpression(value)) {\n // Optional-and-empty, or an expression the mock cannot evaluate — skip type/rules.\n return;\n }\n\n switch (field.type) {\n case 'string':\n case 'secret-ref':\n case 'expression':\n if (typeof value !== 'string') {\n push('Expected a string.');\n }\n break;\n case 'number':\n if (typeof value !== 'number' || Number.isNaN(value)) {\n push('Expected a number.');\n }\n break;\n case 'boolean':\n if (typeof value !== 'boolean') {\n push('Expected a boolean.');\n }\n break;\n case 'select':\n // Dynamic options are only known after resolve — can't check membership here.\n if (!field.dynamic && field.options && !field.options.some(o => o.value === value)) {\n push('Not one of the allowed options.');\n }\n break;\n case 'multiselect':\n if (!Array.isArray(value)) {\n push('Expected an array.');\n } else if (!field.dynamic && field.options) {\n const allowed = new Set(field.options.map(o => o.value));\n for (const v of value) {\n if (!allowed.has(v as string | number | boolean)) {\n push(`Value '${String(v)}' is not an allowed option.`);\n }\n }\n }\n break;\n case 'array':\n if (!Array.isArray(value)) {\n push('Expected an array.');\n }\n break;\n case 'object':\n if (typeof value !== 'object' || Array.isArray(value)) {\n push('Expected an object.');\n }\n break;\n // credentials-ref / dynamic-schema carry no scalar type check here.\n }\n\n const v = field.validation;\n if (v) {\n if (typeof value === 'string') {\n if (v.pattern !== undefined && !new RegExp(v.pattern).test(value)) {\n push(`Does not match pattern ${v.pattern}.`);\n }\n if (v.minLength !== undefined && value.length < v.minLength) {\n push(`Must be at least ${v.minLength} characters.`);\n }\n if (v.maxLength !== undefined && value.length > v.maxLength) {\n push(`Must be at most ${v.maxLength} characters.`);\n }\n }\n if (typeof value === 'number') {\n if (v.min !== undefined && value < v.min) {\n push(`Must be >= ${v.min}.`);\n }\n if (v.max !== undefined && value > v.max) {\n push(`Must be <= ${v.max}.`);\n }\n }\n if (Array.isArray(value)) {\n if (v.minLength !== undefined && value.length < v.minLength) {\n push(`Must have at least ${v.minLength} items.`);\n }\n if (v.maxLength !== undefined && value.length > v.maxLength) {\n push(`Must have at most ${v.maxLength} items.`);\n }\n }\n }\n}\n\n/**\n * Validates a submitted node `config` against the field rules in its manifest\n * (`required`, `IConfigValidation`, types, static options). For `dynamic-schema`\n * fields the resolved child schema is fetched and its rules applied to the\n * flattened keys. Deep cross-field validation is intentionally out of scope\n * (the production service does that on save); this mirrors the mock's\n * \"light, schema-based\" fidelity. Unknown extra keys are ignored.\n */\nexport async function validateNodeConfig(loaded: LoadedPackage, store: DevStore, input: ValidateNodeConfigInput): Promise<ValidateNodeConfigResult> {\n const node = findNode(loaded, input.slug, input.version);\n const config = input.config ?? {};\n const errors: Record<string, string[]> = {};\n const fields = node.description.config ?? [];\n\n for (const field of fields) {\n if (field.type === 'dynamic-schema') {\n continue; // resolved child fields are validated below\n }\n validateField(field, config[field.key], errors);\n }\n\n if (fields.some(f => f.type === 'dynamic-schema') && node.resolveConfigSchema) {\n const ctx = authorContext(loaded, store, config, input.locale);\n let children: IConfigField[];\n try {\n children = await node.resolveConfigSchema(ctx);\n } catch (err) {\n if (err instanceof DevApiError) {\n throw err;\n }\n throw new DevApiError(502, `Node resolve failed: ${(err as Error).message}`);\n }\n for (const child of children) {\n validateField(child, config[child.key], errors);\n }\n }\n\n return { valid: Object.keys(errors).length === 0, errors };\n}\n\n/** Runs a credential type's `test` against inline (unsaved) config. */\nexport async function testCredentialConfig(loaded: LoadedPackage, store: DevStore, typeSlug: string, config: Record<string, unknown>): Promise<ICredentialTestResult> {\n const cred = findCredential(loaded, typeSlug);\n return cred.test(credentialContext(store), config);\n}\n\n/** Runs `test` against a saved credential instance's stored config. */\nexport async function testCredentialInstance(loaded: LoadedPackage, store: DevStore, credentialId: string): Promise<ICredentialTestResult> {\n const instance = store.getCredential(credentialId);\n if (!instance) {\n throw new DevApiError(404, `Credential instance '${credentialId}' not found.`);\n }\n const cred = findCredential(loaded, instance.credentialTypeSlug);\n return cred.test(credentialContext(store, credentialId), instance.config);\n}\n\nexport async function buildOAuthAuthorizeUrl(\n loaded: LoadedPackage,\n store: DevStore,\n credentialId: string,\n params: { redirectUri: string; state: string },\n): Promise<{ authorizeUrl: string; codeVerifier?: string }> {\n const instance = store.getCredential(credentialId);\n if (!instance) {\n throw new DevApiError(404, `Credential instance '${credentialId}' not found.`);\n }\n const cred = findCredential(loaded, instance.credentialTypeSlug);\n if (!isOAuthAuthorizeCredential(cred)) {\n throw new DevApiError(422, `Credential type '${instance.credentialTypeSlug}' is not a 3-legged OAuth type.`);\n }\n return cred.buildAuthorizeUrl(credentialContext(store, credentialId), instance.config, params);\n}\n\nexport async function exchangeOAuthCode(\n loaded: LoadedPackage,\n store: DevStore,\n credentialId: string,\n params: { code: string; redirectUri: string; codeVerifier?: string },\n): Promise<{ durableCreds: Record<string, unknown> }> {\n const instance = store.getCredential(credentialId);\n if (!instance) {\n throw new DevApiError(404, `Credential instance '${credentialId}' not found.`);\n }\n const cred = findCredential(loaded, instance.credentialTypeSlug);\n if (!isOAuthAuthorizeCredential(cred)) {\n throw new DevApiError(422, `Credential type '${instance.credentialTypeSlug}' is not a 3-legged OAuth type.`);\n }\n const out = await cred.exchangeCode(credentialContext(store, credentialId), instance.config, params);\n store.updateCredential(credentialId, { durableCreds: out.durableCreds, status: 'active' });\n return out;\n}\n","import http from 'node:http';\nimport { DevApiError } from './errors.js';\nimport { readJson, sendError, sendJson } from './http.js';\nimport type { LoadedPackage } from './loader.js';\nimport { credentialInstanceToApi, credentialTypeToApi, nodeToApi, secretToApi, templateFullToApi, templateSummaryToApi, triggerToApi, workflowToApi } from './projections.js';\nimport {\n buildOAuthAuthorizeUrl,\n exchangeOAuthCode,\n findCredential,\n findCredentialType,\n nodeVersions,\n resolveNodeConfig,\n testCredentialConfig,\n testCredentialInstance,\n validateNodeConfig,\n} from './resolve.js';\nimport { DEV_TENANT_ID, type DevStore } from './store.js';\n\nexport interface DevServerDeps {\n /** Returns the currently-loaded package; a function so hot-reload can swap it. */\n getPackage(): LoadedPackage;\n store: DevStore;\n /** JSON schemas served at `/schemas/{domain}[/{version}]`, keyed by `domain` and `domain/version`. */\n schemas?: Record<string, unknown>;\n}\n\nconst SEGMENT = (s: string | undefined): string => decodeURIComponent(s ?? '');\n\n/** Builds the `(req, res)` request listener implementing the mock `/api/v1` surface. */\nexport function createRequestListener(deps: DevServerDeps): http.RequestListener {\n return (req, res) => {\n handle(req, res, deps).catch(err => sendError(res, err));\n };\n}\n\nexport function createDevServer(deps: DevServerDeps): http.Server {\n return http.createServer(createRequestListener(deps));\n}\n\nasync function handle(req: http.IncomingMessage, res: http.ServerResponse, deps: DevServerDeps): Promise<void> {\n const method = (req.method ?? 'GET').toUpperCase();\n if (method === 'OPTIONS') {\n sendJson(res, 204, {});\n return;\n }\n\n const url = new URL(req.url ?? '/', 'http://localhost');\n let pathname = url.pathname;\n if (pathname.startsWith('/api/v1')) {\n pathname = pathname.slice('/api/v1'.length);\n }\n const seg = pathname.split('/').filter(Boolean).map(SEGMENT);\n const loaded = deps.getPackage();\n const store = deps.store;\n\n switch (seg[0]) {\n case undefined:\n case 'health':\n return void sendJson(res, 200, { status: 'ok' });\n\n case 'me':\n return void sendJson(res, 200, {\n id: 'dev-user',\n name: 'Dev User',\n email: 'dev@revenexx.test',\n tenant_id: DEV_TENANT_ID,\n });\n\n case 'schemas':\n return handleSchemas(res, deps, seg);\n\n case 'nodes':\n return handleNodes(req, res, method, loaded, store, seg);\n\n case 'credential-types':\n return handleCredentialTypes(res, loaded, seg);\n\n case 'credentials':\n return handleCredentials(req, res, method, loaded, store, seg, url);\n\n case 'secrets':\n return handleSecrets(req, res, method, store, seg);\n\n case 'templates':\n return handleTemplates(req, res, method, loaded, store, seg);\n\n case 'workflows':\n return handleWorkflows(req, res, method, store, seg);\n\n default:\n return void sendJson(res, 404, { message: `No route for /${seg.join('/')}` });\n }\n}\n\n// --------------------------------------------------------------------- schemas\n\nfunction handleSchemas(res: http.ServerResponse, deps: DevServerDeps, seg: string[]): void {\n const domain = seg[1];\n const version = seg[2];\n if (!domain) {\n throw new DevApiError(404, 'Schema domain required.');\n }\n const schemas = deps.schemas ?? {};\n const schema = (version && schemas[`${domain}/${version}`]) || schemas[domain];\n if (!schema) {\n throw new DevApiError(404, `No schema for '${domain}${version ? `/${version}` : ''}'. Vendor it into assets/schemas.`);\n }\n sendJson(res, 200, schema);\n}\n\n// ----------------------------------------------------------------------- nodes\n\nasync function handleNodes(req: http.IncomingMessage, res: http.ServerResponse, method: string, loaded: LoadedPackage, store: DevStore, seg: string[]): Promise<void> {\n // GET /nodes\n if (seg.length === 1 && method === 'GET') {\n return void sendJson(res, 200, { data: loaded.manifest.nodes.map(nodeToApi) });\n }\n const slug = seg[1];\n if (!slug) {\n throw new DevApiError(404, 'Node slug required.');\n }\n\n // GET /nodes/{slug}/versions\n if (seg[2] === 'versions' && method === 'GET') {\n const versions = nodeVersions(loaded, slug);\n if (versions.length === 0) {\n throw new DevApiError(404, `Node '${slug}' not found.`);\n }\n return void sendJson(res, 200, { data: versions });\n }\n\n const version = seg[2];\n if (!version) {\n throw new DevApiError(404, 'Node version required.');\n }\n\n // POST /nodes/{slug}/{version}/config:resolve\n if (seg[3] === 'config:resolve' && method === 'POST') {\n const body = await readJson<{ target?: string; config?: Record<string, unknown>; locale?: string }>(req);\n if (!body.target) {\n throw new DevApiError(422, 'Field `target` is required.', { target: ['The target field is required.'] });\n }\n const result = await resolveNodeConfig(loaded, store, {\n slug,\n version,\n target: body.target,\n config: body.config ?? {},\n locale: body.locale,\n });\n return void sendJson(res, 200, result);\n }\n\n // POST /nodes/{slug}/{version}/config:validate\n if (seg[3] === 'config:validate' && method === 'POST') {\n const body = await readJson<{ config?: Record<string, unknown>; locale?: string }>(req);\n const result = await validateNodeConfig(loaded, store, {\n slug,\n version,\n config: body.config ?? {},\n locale: body.locale,\n });\n // 200 even when invalid — the `{ valid, errors }` body carries the verdict.\n return void sendJson(res, 200, result);\n }\n\n // GET /nodes/{slug}/{version}\n if (seg.length === 3 && method === 'GET') {\n const node = loaded.manifest.nodes.find(n => n.slug === slug && (version === 'latest' || n.version === version));\n if (!node) {\n throw new DevApiError(404, `Node '${slug}@${version}' not found.`);\n }\n return void sendJson(res, 200, nodeToApi(node));\n }\n\n throw new DevApiError(404, `No route for nodes/${seg.slice(1).join('/')}`);\n}\n\n// ------------------------------------------------------------- credential-types\n\nfunction handleCredentialTypes(res: http.ServerResponse, loaded: LoadedPackage, seg: string[]): void {\n if (seg.length === 1) {\n return void sendJson(res, 200, {\n data: (loaded.manifest.credentials ?? []).map(credentialTypeToApi),\n });\n }\n const slug = seg[1]!;\n const type = findCredentialType(loaded, slug); // throws 404\n sendJson(res, 200, { data: credentialTypeToApi(type) });\n}\n\n// ----------------------------------------------------------------- credentials\n\nasync function handleCredentials(req: http.IncomingMessage, res: http.ServerResponse, method: string, loaded: LoadedPackage, store: DevStore, seg: string[], url: URL): Promise<void> {\n const typeOf = (slug: string) => {\n try {\n return findCredentialType(loaded, slug);\n } catch {\n return undefined;\n }\n };\n\n // Collection-level routes.\n if (seg.length === 1) {\n if (method === 'GET') {\n const filter = url.searchParams.get('type') ?? undefined;\n const data = store.listCredentials(filter).map(c => credentialInstanceToApi(c, typeOf(c.credentialTypeSlug)));\n return void sendJson(res, 200, { data });\n }\n if (method === 'POST') {\n const body = await readJson<{ credential_type_slug?: string; name?: string; config?: Record<string, unknown> }>(req);\n if (!body.credential_type_slug || !body.name) {\n throw new DevApiError(422, 'Fields `credential_type_slug` and `name` are required.');\n }\n findCredential(loaded, body.credential_type_slug); // 404 if unknown type\n const record = store.createCredential({\n credentialTypeSlug: body.credential_type_slug,\n name: body.name,\n config: body.config ?? {},\n });\n return void sendJson(res, 201, credentialInstanceToApi(record, typeOf(record.credentialTypeSlug)));\n }\n }\n\n // POST /credentials/test (inline, unsaved)\n if (seg[1] === 'test' && method === 'POST') {\n const body = await readJson<{ credential_type_slug?: string; config?: Record<string, unknown> }>(req);\n if (!body.credential_type_slug) {\n throw new DevApiError(422, 'Field `credential_type_slug` is required.');\n }\n const result = await testCredentialConfig(loaded, store, body.credential_type_slug, body.config ?? {});\n return void sendJson(res, 200, result);\n }\n\n // GET /credentials/oauth/callback\n if (seg[1] === 'oauth' && seg[2] === 'callback' && method === 'GET') {\n const code = url.searchParams.get('code');\n const state = url.searchParams.get('state');\n if (!code || !state) {\n throw new DevApiError(422, 'OAuth callback requires `code` and `state`.');\n }\n // The state carries the credential id in the dev flow (see authorize-url below).\n const credentialId = state;\n const redirectUri = `${url.origin}/api/v1/credentials/oauth/callback`;\n await exchangeOAuthCode(loaded, store, credentialId, { code, redirectUri });\n return void sendJson(res, 200, { status: 'connected', credential_id: credentialId });\n }\n\n const id = seg[1];\n if (!id) {\n throw new DevApiError(404, 'Credential id required.');\n }\n\n // POST /credentials/{id}/test\n if (seg[2] === 'test' && method === 'POST') {\n const result = await testCredentialInstance(loaded, store, id);\n return void sendJson(res, 200, result);\n }\n\n // POST /credentials/{id}/oauth/authorize-url\n if (seg[2] === 'oauth' && seg[3] === 'authorize-url' && method === 'POST') {\n const redirectUri = 'http://localhost/api/v1/credentials/oauth/callback';\n // Dev flow: carry the credential id in `state` so the callback can find it.\n const result = await buildOAuthAuthorizeUrl(loaded, store, id, { redirectUri, state: id });\n return void sendJson(res, 200, { authorize_url: result.authorizeUrl });\n }\n\n // Item-level routes.\n if (seg.length === 2) {\n const record = store.getCredential(id);\n if (method === 'GET') {\n if (!record) {\n throw new DevApiError(404, `Credential '${id}' not found.`);\n }\n return void sendJson(res, 200, credentialInstanceToApi(record, typeOf(record.credentialTypeSlug)));\n }\n if (method === 'PATCH') {\n if (!record) {\n throw new DevApiError(404, `Credential '${id}' not found.`);\n }\n const body = await readJson<{ name?: string; config?: Record<string, unknown> }>(req);\n const updated = store.updateCredential(id, { name: body.name, config: body.config });\n return void sendJson(res, 200, credentialInstanceToApi(updated!, typeOf(updated!.credentialTypeSlug)));\n }\n if (method === 'DELETE') {\n store.deleteCredential(id);\n return void sendJson(res, 200, { deleted: true });\n }\n }\n\n throw new DevApiError(404, `No route for credentials/${seg.slice(1).join('/')}`);\n}\n\n// --------------------------------------------------------------------- secrets\n\nasync function handleSecrets(req: http.IncomingMessage, res: http.ServerResponse, method: string, store: DevStore, seg: string[]): Promise<void> {\n if (seg.length === 1) {\n if (method === 'GET') {\n return void sendJson(res, 200, { data: store.listSecrets().map(secretToApi) });\n }\n if (method === 'POST') {\n const body = await readJson<{ key?: string; value?: string }>(req);\n if (!body.key || body.value === undefined) {\n throw new DevApiError(422, 'Fields `key` and `value` are required.');\n }\n const record = store.setSecret(body.key, body.value);\n return void sendJson(res, 201, secretToApi(record));\n }\n }\n const key = seg[1];\n if (key) {\n if (method === 'PATCH') {\n const body = await readJson<{ value?: string }>(req);\n if (body.value === undefined) {\n throw new DevApiError(422, 'Field `value` is required.');\n }\n return void sendJson(res, 200, secretToApi(store.setSecret(key, body.value)));\n }\n if (method === 'DELETE') {\n store.deleteSecret(key);\n return void sendJson(res, 200, { deleted: true });\n }\n }\n throw new DevApiError(404, `No route for secrets/${seg.slice(1).join('/')}`);\n}\n\n// ------------------------------------------------------------------- templates\n\nasync function handleTemplates(req: http.IncomingMessage, res: http.ServerResponse, method: string, loaded: LoadedPackage, store: DevStore, seg: string[]): Promise<void> {\n const templates = loaded.manifest.templates ?? [];\n if (seg.length === 1 && method === 'GET') {\n return void sendJson(res, 200, { data: templates.map(templateSummaryToApi) });\n }\n const slug = seg[1];\n const template = templates.find(t => t.slug === slug);\n if (!template) {\n throw new DevApiError(404, `Template '${slug}' not found.`);\n }\n if (seg.length === 2 && method === 'GET') {\n return void sendJson(res, 200, templateFullToApi(template));\n }\n if (seg[2] === 'requirements' && method === 'GET') {\n // Best-effort: surface the credential types referenced by the template blob.\n return void sendJson(res, 200, { data: { credentials: [], secrets: [] } });\n }\n if (seg[2] === 'instantiate' && method === 'POST') {\n const body = await readJson<{ name?: string }>(req);\n const workflow = store.createWorkflow({\n name: body.name ?? String(template.name),\n definition: template.definition,\n });\n for (const trigger of template.triggers ?? []) {\n store.createTrigger({\n workflowId: workflow.id,\n type: trigger.type,\n name: trigger.name ?? null,\n config: trigger.config ?? {},\n active: trigger.active ?? true,\n id: trigger.handle,\n });\n }\n return void sendJson(res, 201, workflowToApi(workflow));\n }\n throw new DevApiError(404, `No route for templates/${seg.slice(1).join('/')}`);\n}\n\n// ------------------------------------------------------------------- workflows\n\nasync function handleWorkflows(req: http.IncomingMessage, res: http.ServerResponse, method: string, store: DevStore, seg: string[]): Promise<void> {\n if (seg.length === 1) {\n if (method === 'GET') {\n return void sendJson(res, 200, { data: store.listWorkflows().map(workflowToApi) });\n }\n if (method === 'POST') {\n const body = await readJson<{ name?: string; definition?: Record<string, unknown> }>(req);\n const workflow = store.createWorkflow({\n name: body.name ?? 'Untitled workflow',\n definition: body.definition ?? {},\n });\n return void sendJson(res, 201, workflowToApi(workflow));\n }\n }\n\n // Collection sub-routes registered before {id}.\n if (seg[1] === 'used-credentials' && method === 'GET') {\n return void sendJson(res, 200, { data: [] });\n }\n if (seg[1] === 'used-credential-types' && method === 'GET') {\n return void sendJson(res, 200, { data: [] });\n }\n\n const id = Number.parseInt(seg[1] ?? '', 10);\n if (Number.isNaN(id)) {\n throw new DevApiError(404, `No route for workflows/${seg.slice(1).join('/')}`);\n }\n\n // Triggers\n if (seg[2] === 'triggers') {\n if (seg.length === 3 && method === 'GET') {\n return void sendJson(res, 200, { data: store.listTriggers(id).map(triggerToApi) });\n }\n if (seg.length === 3 && method === 'POST') {\n const body = await readJson<{ type?: string; name?: string; config?: Record<string, unknown>; active?: boolean }>(req);\n if (!body.type) {\n throw new DevApiError(422, 'Field `type` is required.');\n }\n const trigger = store.createTrigger({ workflowId: id, type: body.type, name: body.name, config: body.config, active: body.active });\n return void sendJson(res, 201, triggerToApi(trigger));\n }\n const triggerId = seg[3];\n if (triggerId && method === 'PUT') {\n const body = await readJson<{ type?: string; name?: string; config?: Record<string, unknown>; active?: boolean }>(req);\n if (!body.type) {\n throw new DevApiError(422, 'Field `type` is required.');\n }\n const trigger = store.replaceTrigger(triggerId, { type: body.type, name: body.name, config: body.config, active: body.active });\n if (!trigger) {\n throw new DevApiError(404, `Trigger '${triggerId}' not found.`);\n }\n return void sendJson(res, 200, triggerToApi(trigger));\n }\n if (triggerId && method === 'DELETE') {\n store.deleteTrigger(triggerId);\n return void sendJson(res, 200, { deleted: true });\n }\n }\n\n // Item-level workflow routes.\n if (seg.length === 2) {\n const record = store.getWorkflow(id);\n if (method === 'GET') {\n if (!record) {\n throw new DevApiError(404, `Workflow '${id}' not found.`);\n }\n return void sendJson(res, 200, workflowToApi(record));\n }\n if (method === 'PUT') {\n const body = await readJson<{ name?: string; definition?: Record<string, unknown> }>(req);\n const updated = store.updateWorkflow(id, { name: body.name, definition: body.definition });\n if (!updated) {\n throw new DevApiError(404, `Workflow '${id}' not found.`);\n }\n return void sendJson(res, 200, workflowToApi(updated));\n }\n if (method === 'DELETE') {\n store.deleteWorkflow(id);\n return void sendJson(res, 200, { deleted: true });\n }\n }\n\n if ((seg[2] === 'credentials' || seg[2] === 'credential-types') && method === 'GET') {\n return void sendJson(res, 200, { data: [] });\n }\n\n throw new DevApiError(404, `No route for workflows/${seg.slice(1).join('/')}`);\n}\n","import type http from 'node:http';\nimport { DevApiError } from './errors.js';\n\nexport function sendJson(res: http.ServerResponse, status: number, body: unknown): void {\n const payload = JSON.stringify(body);\n res.writeHead(status, {\n 'Content-Type': 'application/json',\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Headers': '*',\n 'Access-Control-Allow-Methods': 'GET,POST,PUT,PATCH,DELETE,OPTIONS',\n });\n res.end(payload);\n}\n\n/** Maps a thrown error to the Laravel-style `{message}` / `{message, errors}` body. */\nexport function sendError(res: http.ServerResponse, err: unknown): void {\n if (err instanceof DevApiError) {\n sendJson(res, err.status, err.errors ? { message: err.message, errors: err.errors } : { message: err.message });\n return;\n }\n sendJson(res, 500, { message: (err as Error)?.message ?? 'Internal error' });\n}\n\nexport async function readBody(req: http.IncomingMessage): Promise<string> {\n let body = '';\n for await (const chunk of req) {\n body += chunk;\n }\n return body;\n}\n\n/** Reads + parses a JSON body; throws {@link DevApiError} 400 on malformed input. */\nexport async function readJson<T>(req: http.IncomingMessage): Promise<T> {\n const raw = await readBody(req);\n if (raw.trim() === '') {\n return {} as T;\n }\n try {\n return JSON.parse(raw) as T;\n } catch {\n throw new DevApiError(400, 'Invalid JSON body.');\n }\n}\n","import type { ICredentialDescription, INodeDescription, ITemplateDescription } from '@revenexx/integrations-node-sdk';\nimport { MANIFEST_VERSION } from '@revenexx/integrations-node-sdk';\nimport type { CredentialRecord, SecretRecord, TriggerRecord, WorkflowRecord } from './store.js';\n\n/**\n * Maps internal records + manifest descriptions to the exact JSON shapes the\n * production Laravel `/api/v1` surface returns, so the Cockpit UI consumes the\n * mock API without any awareness that it is mocked.\n */\n\nexport function hasDynamicOptions(desc: INodeDescription): boolean {\n return (desc.config ?? []).some(f => f.dynamic === true);\n}\n\nexport function hasDynamicSchema(desc: INodeDescription): boolean {\n return (desc.config ?? []).some(f => f.type === 'dynamic-schema');\n}\n\nexport function hasDynamicOutputs(desc: INodeDescription): boolean {\n return (desc.outputs ?? []).some(o => o.resolveOutputs === true);\n}\n\nexport function nodeToApi(desc: INodeDescription): Record<string, unknown> {\n const [namespace] = desc.slug.split(':');\n return {\n name: desc.name,\n namespace: namespace ?? null,\n slug: desc.slug,\n version: desc.version,\n manifest_version: MANIFEST_VERSION,\n manifest: desc,\n has_dynamic_options: hasDynamicOptions(desc),\n has_dynamic_schema: hasDynamicSchema(desc),\n has_dynamic_outputs: hasDynamicOutputs(desc),\n created_at: null,\n updated_at: null,\n };\n}\n\nexport function credentialTypeToApi(desc: ICredentialDescription): Record<string, unknown> {\n return {\n slug: desc.slug,\n version: desc.version,\n name: desc.name,\n description: desc.description ?? null,\n icon: desc.icon ?? null,\n auth_kind: desc.authKind,\n fields: desc.fields,\n };\n}\n\n/** Projects a credential instance to its masked public API shape (no secrets). */\nexport function credentialInstanceToApi(record: CredentialRecord, type: ICredentialDescription | undefined): Record<string, unknown> {\n const secretKeys = new Set((type?.fields ?? []).filter(f => f.type === 'secret').map(f => f.key));\n const knownKeys = new Set((type?.fields ?? []).map(f => f.key));\n const publicConfig: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(record.config)) {\n // Only surface known, non-secret fields; drop everything else defensively.\n if (knownKeys.has(key) && !secretKeys.has(key)) {\n publicConfig[key] = value;\n }\n }\n return {\n id: record.id,\n tenant_id: record.tenantId,\n credential_type_slug: record.credentialTypeSlug,\n name: record.name,\n status: record.status,\n public_config: publicConfig,\n created_at: record.createdAt,\n updated_at: record.updatedAt,\n };\n}\n\nexport function secretToApi(record: SecretRecord): Record<string, unknown> {\n return {\n key: record.key,\n created_at: record.createdAt,\n updated_at: record.updatedAt,\n };\n}\n\nexport function workflowToApi(record: WorkflowRecord): Record<string, unknown> {\n return {\n id: record.id,\n name: record.name,\n definition: record.definition,\n build_status: record.buildStatus,\n created_at: record.createdAt,\n updated_at: record.updatedAt,\n };\n}\n\nexport function triggerToApi(record: TriggerRecord): Record<string, unknown> {\n return {\n handle: record.id,\n id: record.id,\n workflow_id: record.workflowId,\n type: record.type,\n name: record.name,\n config: record.config,\n active: record.active,\n created_at: record.createdAt,\n updated_at: record.updatedAt,\n };\n}\n\nexport function templateSummaryToApi(t: ITemplateDescription): Record<string, unknown> {\n return {\n slug: t.slug,\n version: t.version,\n category: t.category,\n level: t.level,\n name: t.name,\n shortDescription: t.shortDescription ?? null,\n description: t.description ?? null,\n icon: t.icon ?? null,\n industries: t.industries ?? [],\n vendors: t.vendors ?? [],\n triggerTypes: (t.triggers ?? []).map(tr => tr.type),\n };\n}\n\nexport function templateFullToApi(t: ITemplateDescription): Record<string, unknown> {\n return {\n ...templateSummaryToApi(t),\n blobVersion: t.blobVersion,\n definition: t.definition,\n triggers: t.triggers ?? [],\n };\n}\n","import { existsSync, mkdirSync, writeFileSync } from 'node:fs';\nimport { dirname, join, resolve } from 'node:path';\nimport { previewTemplates } from './templates.js';\n\nexport interface ScaffoldPreviewOptions {\n /** Target directory for the host (default `.revenexx-dev/preview`). */\n dir: string;\n /** Mock API base URL baked into `.env`. */\n integrationsApiUrl: string;\n /** Overwrite existing files. */\n force?: boolean;\n log?: (msg: string) => void;\n}\n\nexport interface ScaffoldResult {\n dir: string;\n written: string[];\n skipped: string[];\n}\n\n/**\n * Writes the Nuxt preview host into `dir`. Idempotent: existing files are left\n * untouched unless `force` is set. Returns which files were written vs skipped.\n */\nexport function scaffoldPreview(options: ScaffoldPreviewOptions): ScaffoldResult {\n const log = options.log ?? (() => {});\n const files = previewTemplates({ integrationsApiUrl: options.integrationsApiUrl });\n const written: string[] = [];\n const skipped: string[] = [];\n\n for (const [relative, content] of Object.entries(files)) {\n const target = resolve(options.dir, relative);\n if (existsSync(target) && !options.force) {\n skipped.push(relative);\n continue;\n }\n mkdirSync(dirname(target), { recursive: true });\n writeFileSync(target, content, 'utf-8');\n written.push(relative);\n }\n\n if (written.length > 0) {\n log(`Scaffolded preview host in ${options.dir} (${written.length} file(s)).`);\n }\n if (skipped.length > 0) {\n log(`Kept ${skipped.length} existing file(s) (use --force to overwrite).`);\n }\n return { dir: options.dir, written, skipped };\n}\n\n/** True when the preview host has its dependencies installed. */\nexport function previewDepsInstalled(dir: string): boolean {\n return existsSync(join(dir, 'node_modules'));\n}\n\n/** True when a preview host has been scaffolded in `dir`. */\nexport function previewExists(dir: string): boolean {\n return existsSync(join(dir, 'package.json')) && existsSync(join(dir, 'nuxt.config.ts'));\n}\n","/**\n * File templates for the on-demand Nuxt preview host. The host is a minimal\n * Nuxt 4 SPA that registers the `@revenexx/studio-shared` and\n * `@revenexx/studio-integrations` Nuxt modules (the latter ships its own pages\n * under `/integrations`), pointed at the devkit's mock API. No custom auth shim is\n * needed — studio-shared's standalone `usePlatformAuth`/`usePlatformTenant`\n * read a dev token/tenant from `NUXT_PUBLIC_DEV_TOKEN` / `NUXT_PUBLIC_DEV_TENANT`.\n */\n\n/** Peer versions mirrored from `@revenexx/studio-integrations`'s peerDependencies. */\nconst VERSIONS = {\n nuxt: '^4.0.0',\n vue: '^3.5.0',\n studio: '^0.1.3',\n studioShared: '^0.2.0',\n studioIntegrations: '^0.5.1',\n vueFlowCore: '^1.48.2',\n vueFlowBackground: '^1.3.2',\n vueFlowControls: '^1.1.3',\n vueFlowMinimap: '^1.5.4',\n vueFlowNodeToolbar: '^1.1.1',\n dagre: '^3.0.0',\n lucide: '^1.0.0',\n solarIcons: '^1.2.1',\n // studio-integrations 0.5.x embeds a TipTap rich-text editor and vue-sonner toasts.\n tiptap: '^3.28.0',\n vueSonner: '^2.0.0',\n tailwindVite: '^4.0.0',\n tailwind: '^4.0.0',\n};\n\nexport interface PreviewTemplateOptions {\n /** Default mock API base URL baked into `.env` (runtime env still overrides). */\n integrationsApiUrl: string;\n}\n\nconst PACKAGE_JSON = `{\n \"name\": \"integrations-preview-host\",\n \"private\": true,\n \"type\": \"module\",\n \"scripts\": {\n \"dev\": \"nuxt dev\",\n \"build\": \"nuxt build\"\n },\n \"dependencies\": {\n \"@revenexx/studio\": \"${VERSIONS.studio}\",\n \"@revenexx/studio-integrations\": \"${VERSIONS.studioIntegrations}\",\n \"@revenexx/studio-shared\": \"${VERSIONS.studioShared}\",\n \"@solar-icons/nuxt\": \"${VERSIONS.solarIcons}\",\n \"@dagrejs/dagre\": \"${VERSIONS.dagre}\",\n \"@tiptap/core\": \"${VERSIONS.tiptap}\",\n \"@tiptap/extension-document\": \"${VERSIONS.tiptap}\",\n \"@tiptap/extension-history\": \"${VERSIONS.tiptap}\",\n \"@tiptap/extension-paragraph\": \"${VERSIONS.tiptap}\",\n \"@tiptap/extension-text\": \"${VERSIONS.tiptap}\",\n \"@tiptap/pm\": \"${VERSIONS.tiptap}\",\n \"@tiptap/vue-3\": \"${VERSIONS.tiptap}\",\n \"@vue-flow/background\": \"${VERSIONS.vueFlowBackground}\",\n \"@vue-flow/controls\": \"${VERSIONS.vueFlowControls}\",\n \"@vue-flow/core\": \"${VERSIONS.vueFlowCore}\",\n \"@vue-flow/minimap\": \"${VERSIONS.vueFlowMinimap}\",\n \"@vue-flow/node-toolbar\": \"${VERSIONS.vueFlowNodeToolbar}\",\n \"lucide-vue-next\": \"${VERSIONS.lucide}\",\n \"nuxt\": \"${VERSIONS.nuxt}\",\n \"vue\": \"${VERSIONS.vue}\",\n \"vue-sonner\": \"${VERSIONS.vueSonner}\"\n },\n \"devDependencies\": {\n \"@tailwindcss/vite\": \"${VERSIONS.tailwindVite}\",\n \"tailwindcss\": \"${VERSIONS.tailwind}\"\n }\n}\n`;\n\nconst NUXT_CONFIG = `import tailwindcss from '@tailwindcss/vite';\n\n// Minimal preview host for local integration-node development.\n// Generated by \\`integrations-devkit init-preview\\` — safe to edit or delete\n// (it lives under the gitignored .revenexx-dev/).\nexport default defineNuxtConfig({\n compatibilityDate: '2025-01-01',\n // SPA: no SSR, so the studio's browser-only composables (localStorage etc.)\n // behave exactly as in the real cockpit, and boot is fast.\n ssr: false,\n // studio-shared 0.2.x ships as a Nuxt MODULE (not a layer) — it must be\n // registered in 'modules', before studio-integrations which builds on it.\n // @solar-icons/nuxt provides the #solar-icons alias the studio components import.\n modules: ['@revenexx/studio-shared', '@solar-icons/nuxt', '@revenexx/studio-integrations'],\n css: ['~/assets/css/main.css'],\n vite: { plugins: [tailwindcss()] },\n runtimeConfig: {\n public: {\n // Overridden at runtime by NUXT_PUBLIC_* env (see .env / the preview command).\n integrationsApi: '',\n devToken: '',\n devTenant: '',\n },\n },\n});\n`;\n\n// Tailwind v4 wiring per @revenexx/studio's README. @source globs are relative\n// to THIS file; they tell Tailwind's JIT to scan the shipped component classes\n// of studio + studio-shared + studio-integrations, or they render unstyled.\nconst MAIN_CSS = `@import \"tailwindcss\";\n@import \"@revenexx/studio/tokens\";\n@import \"@revenexx/studio/fonts\";\n\n@source \"../../node_modules/@revenexx/studio/dist\";\n@source \"../../node_modules/@revenexx/studio-shared/components\";\n@source \"../../node_modules/@revenexx/studio-integrations/dist/runtime\";\n\n/* Phase 1: workflow EXECUTION is not wired up in the devkit preview yet, so the\n Workflows surface is hidden until phase 2. This hides the sidebar nav entry\n and any deep links to the workflow editor; the routes are also redirected by\n middleware/hide-workflows.global.ts. */\na[href^=\"/integrations/workflows\"] { display: none !important; }\nli:has(> a[href^=\"/integrations/workflows\"]) { display: none !important; }\n`;\n\n// Shell mirrors services/integrations/studio-ui's app.vue: the studio pages size\n// themselves against a definite height (h-svh), the brand background is #f3f1fa,\n// and the module's pages call toast.* (vue-sonner) so a global <Toaster> mount is\n// required. NuxtLoadingIndicator covers the on-demand route compile in dev.\nconst APP_VUE = `<script setup lang=\"ts\">\nimport { Toaster } from '@revenexx/studio'\n\nuseHead({ title: 'Integration Studio — devkit preview' })\n</script>\n\n<template>\n <div class=\"flex h-svh flex-col overflow-hidden bg-[#f3f1fa] text-foreground\">\n <NuxtLoadingIndicator color=\"var(--color-primary, #620DFF)\" :height=\"3\" />\n <div class=\"min-h-0 flex-1 pt-3\">\n <NuxtPage />\n </div>\n <Toaster rich-colors position=\"bottom-right\" :duration=\"3500\" close-button />\n </div>\n</template>\n`;\n\n// Landing page styled after services/integrations/studio-ui's pages/index.vue —\n// same studio design tokens (bg-card, text-mono, bg-primary, muted) so `/` looks\n// like the real dev host. No token gate: the devkit bakes a fixed dev token.\nconst INDEX_VUE = `<template>\n <div class=\"mx-auto flex min-h-full max-w-xl flex-col justify-center gap-6 px-6 py-12\">\n <div>\n <p class=\"text-mono text-muted-foreground\">Integrations · node devkit</p>\n <h1 class=\"mt-1 text-2xl font-medium\">Integration Studio — Preview</h1>\n <p class=\"mt-2 text-sm text-muted-foreground\">\n Lokaler Host für <code>@revenexx/studio-integrations</code> gegen die Mock-API\n deines Node-Pakets. Authentifizierung ist ein festes Dev-Token — nichts einzugeben.\n </p>\n </div>\n\n <div class=\"rounded-lg border border-black/[0.06] bg-card p-5 text-sm shadow-sm\">\n <p class=\"text-mono text-muted-foreground\">Session</p>\n <dl class=\"mt-2 grid grid-cols-[7rem_1fr] gap-y-1\">\n <dt class=\"text-muted-foreground\">Mock API</dt>\n <dd class=\"truncate font-mono text-xs leading-5\">{{ api }}</dd>\n <dt class=\"text-muted-foreground\">Tenant</dt>\n <dd class=\"font-mono text-xs leading-5\">{{ tenant }}</dd>\n </dl>\n </div>\n\n <div class=\"rounded-lg border border-black/[0.06] bg-card p-5 shadow-sm\">\n <p class=\"text-mono text-muted-foreground\">Einstieg</p>\n <div class=\"mt-3 flex flex-col gap-4\">\n <NuxtLink\n to=\"/nodes\"\n class=\"inline-flex w-fit items-center gap-2 rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:opacity-90\"\n >\n Lokale Nodes öffnen — Preview + Validierung\n </NuxtLink>\n <div class=\"flex flex-wrap gap-x-4 gap-y-1.5\">\n <NuxtLink\n v-for=\"link in quickLinks\"\n :key=\"link.to\"\n :to=\"link.to\"\n class=\"text-sm text-primary hover:underline\"\n >\n {{ link.label }}\n </NuxtLink>\n </div>\n </div>\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nconst rc = useRuntimeConfig().public\nconst api = rc.integrationsApi\nconst tenant = (rc.devTenant as string) || 'dev-tenant'\n\nconst quickLinks = [\n { to: '/integrations', label: 'Overview' },\n { to: '/integrations/credentials', label: 'Credentials' },\n { to: '/integrations/secrets', label: 'Secrets' },\n { to: '/nodes', label: 'Local nodes' },\n]\n</script>\n`;\n\n// Custom devkit page: lists the package's local nodes and, on click, opens the\n// REAL editor edit-view by REUSE — the exact studio <Dialog> lightbox from\n// WorkflowEditor.vue wrapping <IntegrationsNodeInspector> (the inspector is only\n// the dialog CONTENT; the studio Dialog owns the modal chrome/overlay). Config\n// fields + dynamic resolving run against the mock. On Save the dialog is kept\n// OPEN and the verdict shown: a success strip, or per-field errors fed back\n// through the inspector's `refusedFields` prop (wrong fields highlighted). The\n// page lives inside a template literal, so no backtick / ${ literals inside —\n// API paths use string concatenation.\nconst NODES_VUE = `<template>\n <div class=\"ndx-page\">\n <div class=\"ndx-inner\">\n <header class=\"ndx-head\">\n <h1>Lokale Nodes</h1>\n <p>Mock-API: <code>{{ apiUrl }}</code></p>\n <p v-if=\"loadError\" class=\"ndx-err\">{{ loadError }}</p>\n </header>\n\n <p v-if=\"loading\">Lade Nodes…</p>\n <p v-else-if=\"nodes.length === 0\">Keine Nodes gefunden. Exportiert dein Paket <code>NODES</code>?</p>\n\n <ul v-else class=\"ndx-grid\">\n <li v-for=\"n in nodes\" :key=\"n.slug + '@' + n.version\" class=\"ndx-card\" @click=\"openNode(n)\">\n <div class=\"ndx-card-title\">{{ label(n) }}</div>\n <div class=\"ndx-card-slug\">{{ n.slug }} · v{{ n.version }}</div>\n <div class=\"ndx-badges\">\n <span v-if=\"n.has_dynamic_options\" class=\"ndx-badge\">dynamic options</span>\n <span v-if=\"n.has_dynamic_schema\" class=\"ndx-badge\">dynamic schema</span>\n <span v-if=\"n.has_dynamic_outputs\" class=\"ndx-badge\">dynamic outputs</span>\n </div>\n </li>\n </ul>\n </div>\n\n <!-- REUSE of the exact editor lightbox: studio <Dialog> owns the modal\n chrome, <IntegrationsNodeInspector> is the content — mirrors\n WorkflowEditor.vue's <Dialog><DialogContent><NodeInspector/> block. -->\n <Dialog :open=\"!!selection\" @update:open=\"(v) => { if (!v) requestClose() }\">\n <DialogContent :show-close-button=\"false\" class=\"flex h-[min(680px,86vh)] w-[min(1100px,94vw)] max-w-none flex-col gap-0 overflow-hidden rounded-lg p-0 sm:max-w-none\">\n <div v-if=\"result === 'ok'\" class=\"ndx-strip ndx-strip-ok\">✓ Payload gültig — alles gut.</div>\n <div v-else-if=\"result === 'err'\" class=\"ndx-strip ndx-strip-err\">✗ Payload ungültig — {{ errorCount }} Feld(er) prüfen (rot markiert).</div>\n <div v-else-if=\"formError\" class=\"ndx-strip ndx-strip-err\">{{ formError }}</div>\n <IntegrationsNodeInspector\n v-if=\"selection\"\n :selection=\"selection\"\n :secret-keys=\"secretKeys\"\n :refused-fields=\"refused\"\n @update=\"onSubmit\"\n @close=\"requestClose\" />\n </DialogContent>\n </Dialog>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, onMounted, ref } from 'vue'\nimport { Dialog, DialogContent } from '@revenexx/studio'\n\ninterface ApiNode {\n name: string | Record<string, string>\n slug: string\n version: string\n manifest?: { name?: string | Record<string, string> }\n has_dynamic_options?: boolean\n has_dynamic_schema?: boolean\n has_dynamic_outputs?: boolean\n}\n\nconst apiUrl = useRuntimeConfig().public.integrationsApi\nconst client = useIntegrationsApi()\n// load() fills the reactive catalog the inspector reads via findManifest();\n// resolveLocalized() turns a LocalizedString into the active-locale string.\nconst { load, resolveLocalized } = useIntegrationsNodes()\n\nconst nodes = ref<ApiNode[]>([])\nconst loading = ref(true)\nconst loadError = ref<string | null>(null)\n\nconst selection = ref<any>(null)\nconst secretKeys = ref<string[]>([])\nconst refused = ref<Record<string, string>>({})\nconst result = ref<string | null>(null)\nconst formError = ref<string | null>(null)\n// Set synchronously in onSubmit so the inspector's own Save (it emits update THEN\n// close) does NOT close the dialog — we keep it open to show the verdict.\nconst validating = ref(false)\n\nconst errorCount = computed(() => Object.keys(refused.value).length)\n\nfunction label(n: ApiNode): string {\n return resolveLocalized(n.manifest?.name ?? n.name) || n.slug\n}\n\nonMounted(async () => {\n await load()\n try {\n const res = await client.get<any>('/nodes')\n nodes.value = (Array.isArray(res) ? res : res?.data ?? []) as ApiNode[]\n } catch (e: any) {\n loadError.value = e?.message ?? 'Nodes konnten nicht geladen werden.'\n } finally {\n loading.value = false\n }\n try {\n const secrets = await client.get<any>('/secrets')\n const list = (Array.isArray(secrets) ? secrets : secrets?.data ?? []) as Array<{ key: string }>\n secretKeys.value = list.map(s => s.key).filter(Boolean)\n } catch {\n // secrets are optional for the preview\n }\n})\n\nfunction openNode(n: ApiNode) {\n refused.value = {}\n result.value = null\n formError.value = null\n // Synthetic WorkflowNode selection (distinguished by nodeSlug); the inspector\n // resolves its manifest from the catalog load() populated above.\n selection.value = { id: 'preview', nodeSlug: n.slug, nodeVersion: n.version, name: label(n), config: {} }\n}\n\nasync function onSubmit(draft: any) {\n validating.value = true\n refused.value = {}\n result.value = null\n formError.value = null\n try {\n const slug = encodeURIComponent(draft.nodeSlug)\n const version = encodeURIComponent(draft.nodeVersion || 'latest')\n const res = await client.post<any>(\n '/nodes/' + slug + '/' + version + '/config:validate',\n { config: draft.config ?? {} },\n )\n if (res.valid) {\n result.value = 'ok'\n } else {\n refused.value = Object.fromEntries(\n Object.entries(res.errors ?? {}).map(([k, msgs]) => [k, (msgs as string[]).join(' ')]),\n )\n result.value = 'err'\n }\n } catch (e: any) {\n formError.value = e?.message ?? 'Validierung fehlgeschlagen.'\n } finally {\n validating.value = false\n }\n}\n\n// The inspector emits close on both Save and Cancel; the studio Dialog emits it\n// on Esc / backdrop. Hold the close while a Save-validation is in flight so the\n// dialog stays open to show the result; otherwise close (discard).\nfunction requestClose() {\n if (validating.value) return\n selection.value = null\n refused.value = {}\n result.value = null\n formError.value = null\n}\n</script>\n\n<style scoped>\n/* The app shell (app.vue) is h-svh + overflow-hidden, so this page must own its\n own vertical scroll — otherwise the node list is clipped and can't scroll. */\n.ndx-page { height: 100%; overflow-y: auto; }\n.ndx-inner { max-width: 60rem; margin: 0 auto; padding: 2rem; font-family: sans-serif; }\n.ndx-head h1 { font-size: 1.5rem; font-weight: 600; }\n.ndx-err { color: #b91c1c; }\n.ndx-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; margin-top: 1.5rem; }\n.ndx-card { border: 1px solid #d1d5db; border-radius: 0.5rem; padding: 1rem; cursor: pointer; transition: border-color .15s, box-shadow .15s; }\n.ndx-card:hover { border-color: #6366f1; box-shadow: 0 1px 6px rgba(0,0,0,.08); }\n.ndx-card-title { font-weight: 600; }\n.ndx-card-slug { color: #6b7280; font-size: .85rem; margin-top: .25rem; }\n.ndx-badges { margin-top: .5rem; display: flex; flex-wrap: wrap; gap: .35rem; }\n.ndx-badge { font-size: .7rem; background: #eef2ff; color: #4338ca; border-radius: .25rem; padding: .1rem .4rem; }\n\n/* Verdict strip shown at the top of the reused dialog content (does not close). */\n.ndx-strip { flex: 0 0 auto; padding: .5rem 1rem; font-size: .85rem; font-weight: 600; }\n.ndx-strip-ok { background: #dcfce7; color: #166534; }\n.ndx-strip-err { background: #fee2e2; color: #991b1b; }\n</style>\n`;\n\nconst GITIGNORE = `node_modules/\n.nuxt/\n.output/\n.data/\n`;\n\n// Auto-imported no-op stubs for the full-cockpit \"console\" composables that some\n// studio-integrations components (notably CredentialRevenexxSource, the \"Use\n// revenexx managed source\" picker in the credential dialog) reach for. The\n// slimmed preview has no console gateways (tenants, markets, managed SFTP / mail\n// / API keys), so without these the component throws \"useConsoleTenants is not\n// defined\" at setup and takes its sibling manual-config fields down with it —\n// leaving the credential dialog with NO input fields. These stubs let that\n// picker render empty instead of crashing, so manual credential creation works.\nconst CONSOLE_STUBS = `import { ref } from 'vue'\n\nexport function useConsoleTenants() {\n return { tenants: ref([]), onlyTenantSlug: ref(null), load: async () => {} }\n}\nexport function useActiveMarket() {\n return {\n markets: ref([]),\n activeCode: ref(''),\n isGlobal: ref(true),\n GLOBAL_MARKET_CODE: '__global__',\n fetchMarkets: async () => {},\n }\n}\nexport function useConsoleSftp() {\n return {\n accounts: ref([]),\n load: async () => {},\n revealPassword: async () => ({}),\n create: async () => ({}),\n refresh: async () => ({}),\n }\n}\nexport function useMailAdmin() {\n return {\n listCredentials: async () => [],\n getCredential: async () => ({}),\n createCredential: async () => ({}),\n }\n}\nexport function useConsoleApiKeys() {\n return { create: async () => ({ secret: '' }) }\n}\n`;\n\n// Phase 1: workflow execution isn't available in the devkit preview, so the\n// Workflows editor pages are off-limits until phase 2. Any navigation to them\n// (deep links from the dashboard, direct URLs) bounces back to the Integrations\n// dashboard. The nav entry itself is hidden via assets/css/main.css.\nconst HIDE_WORKFLOWS_MW = `export default defineNuxtRouteMiddleware((to) => {\n if (to.path === '/integrations/workflows' || to.path.startsWith('/integrations/workflows/')) {\n return navigateTo('/integrations')\n }\n})\n`;\n\nexport function previewTemplates(options: PreviewTemplateOptions): Record<string, string> {\n const env = `# Overrides the Nuxt runtimeConfig.public.* values.\nNUXT_PUBLIC_INTEGRATIONS_API=${options.integrationsApiUrl}\nNUXT_PUBLIC_DEV_TOKEN=dev\nNUXT_PUBLIC_DEV_TENANT=dev-tenant\n`;\n return {\n 'package.json': PACKAGE_JSON,\n 'nuxt.config.ts': NUXT_CONFIG,\n 'assets/css/main.css': MAIN_CSS,\n 'app.vue': APP_VUE,\n 'pages/index.vue': INDEX_VUE,\n 'pages/nodes.vue': NODES_VUE,\n 'composables/devkit-console-stubs.ts': CONSOLE_STUBS,\n 'middleware/hide-workflows.global.ts': HIDE_WORKFLOWS_MW,\n '.env': env,\n '.gitignore': GITIGNORE,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAM,mBAAmB,MACvB,OAAO,aAAa,cAChB,IAAI,IAAI,QAAQ,UAAU,EAAE,EAAE,OAC7B,SAAS,iBAAiB,SAAS,cAAc,QAAQ,YAAY,MAAM,WAC1E,SAAS,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,UAAU,KAAK,CAAC,EAAE,MAAM;AAC/D;AAEA,eAAe,OAAsB;AACnC,QAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AAGjC,QAAM,UAAU,YAAY,IAAI;AAChC,QAAM,EAAE,SAAS,QAAQ,IAAI,UAAU,IAAI;AAC3C,MAAI,YAAY,WAAW;AACzB,YAAQ,IAAI,cAAc;AAC1B;AAAA,EACF;AACA,MAAI,SAAS;AACX,YAAQ,IAAI,mBAAmB,OAAO,EAAE;AAAA,EAC1C;AACA,MAAI,YAAY,SAAS;AACvB,UAAM,EAAE,OAAO,IAAI,MAAM,OAAO,IAAS;AACzC,WAAO,QAAQ,WAAW,EAAE,OAAO,KAAK,CAAC;AACzC,YAAQ,IAAI,WAAW,QAAQ,SAAS,EAAE;AAC1C;AAAA,EACF;AACA,MAAI,YAAY,gBAAgB;AAC9B,oBAAgB;AAAA,MACd,KAAK,QAAQ;AAAA,MACb,oBAAoB,oBAAoB,QAAQ,IAAI;AAAA,MACpD,OAAO,QAAQ;AAAA,MACf,KAAK,SAAO,QAAQ,IAAI,GAAG;AAAA,IAC7B,CAAC;AACD,YAAQ,IAAI;AAAA,sFAAyF,QAAQ,UAAU,mCAAmC;AAC1J;AAAA,EACF;AACA,MAAI,YAAY,WAAW;AACzB,UAAM,QAAQ,OAAO;AACrB;AAAA,EACF;AACA,QAAM,IAAI,OAAO;AACnB;AAEA,KAAK,EAAE,MAAM,SAAO;AAClB,UAAQ,MAAM,GAAG;AACjB,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["import_node_fs","import_node_http","import_node_path","import_node_url","import_node_fs","import_node_fs","import_node_path","import_integrations_node_sdk","v","import_integrations_node_sdk","import_node_fs","import_node_path"]}