everything-dev 1.51.6 → 1.51.7
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.
- package/dist/_virtual/_rolldown/runtime.cjs +0 -2
- package/dist/cli/db-doctor.cjs +1 -1
- package/dist/cli/db-doctor.cjs.map +1 -1
- package/dist/cli/db-doctor.mjs +1 -1
- package/dist/cli/db-repair.cjs +1 -1
- package/dist/cli/db-repair.cjs.map +1 -1
- package/dist/cli/db-repair.mjs +1 -1
- package/dist/contract.d.cts +16 -16
- package/dist/contract.d.mts +16 -16
- package/dist/infra/preflight.cjs +1 -1
- package/dist/infra/preflight.cjs.map +1 -1
- package/dist/infra/preflight.mjs +1 -1
- package/dist/infra/preflight.mjs.map +1 -1
- package/dist/plugin.d.cts +7 -7
- package/dist/plugin.d.mts +7 -7
- package/dist/types.d.cts +2 -2
- package/dist/types.d.mts +2 -2
- package/package.json +3 -2
- package/dist/_virtual/_rolldown/runtime.mjs +0 -32
|
@@ -5,7 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
9
8
|
var __copyProps = (to, from, except, desc) => {
|
|
10
9
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
10
|
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
@@ -27,5 +26,4 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
26
|
|
|
28
27
|
//#endregion
|
|
29
28
|
|
|
30
|
-
exports.__commonJSMin = __commonJSMin;
|
|
31
29
|
exports.__toESM = __toESM;
|
package/dist/cli/db-doctor.cjs
CHANGED
|
@@ -28,7 +28,7 @@ function readLocalMigrations(workspaceDir) {
|
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
async function diagnosePlugin(info) {
|
|
31
|
-
const { Pool } = await
|
|
31
|
+
const { Pool } = await import("pg");
|
|
32
32
|
const slug = require_db.pluginMigrationSlug(info.key);
|
|
33
33
|
const storage = require_db.getMigrationStorage(slug);
|
|
34
34
|
const journalTable = storage.table;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db-doctor.cjs","names":["pluginMigrationSlug","getMigrationStorage","extractExpectedTables"],"sources":["../../src/cli/db-doctor.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport { extractExpectedTables, getMigrationStorage, pluginMigrationSlug } from \"../db\";\nimport type { PluginDbInfo } from \"./db-studio\";\n\nexport interface DoctorReport {\n plugin: string;\n slug: string;\n journalTable: string;\n journalSchema: string;\n dbSecret: string;\n dbUrl: string;\n workspaceDir: string | undefined;\n localMigrationCount: number;\n appliedHashCount: number;\n expectedTables: string[];\n missingTables: string[];\n migrationHashes: string[];\n diagnosis: string;\n error?: string;\n}\n\nfunction hashFile(raw: string): string {\n return createHash(\"sha256\").update(raw).digest(\"hex\");\n}\n\ninterface LocalMigration {\n tag: string;\n hash: string;\n sql: string[];\n}\n\nfunction readLocalMigrations(workspaceDir: string): LocalMigration[] {\n const migrationsDir = resolve(workspaceDir, \"src/db/migrations\");\n const metaDir = join(migrationsDir, \"meta\");\n const journalPath = join(metaDir, \"_journal.json\");\n if (!existsSync(journalPath)) return [];\n\n const journal = JSON.parse(readFileSync(journalPath, \"utf8\")) as {\n entries: { idx: number; tag: string }[];\n };\n\n return journal.entries.map((entry) => {\n const sqlPath = join(migrationsDir, `${entry.tag}.sql`);\n if (!existsSync(sqlPath)) {\n return { tag: entry.tag, hash: \"\", sql: [] };\n }\n const raw = readFileSync(sqlPath, \"utf8\");\n const sql = raw.split(\"--> statement-breakpoint\").map((s) => s.trim());\n return { tag: entry.tag, hash: hashFile(raw), sql };\n });\n}\n\nexport async function diagnosePlugin(info: PluginDbInfo): Promise<DoctorReport> {\n const { Pool } = await import(\"pg\");\n\n const slug = pluginMigrationSlug(info.key);\n const storage = getMigrationStorage(slug);\n const journalTable = storage.table;\n const journalSchema = storage.schema;\n const journalRef = `\"${journalSchema}\".\"${journalTable}\"`;\n\n const localMigrations = info.workspaceDir ? readLocalMigrations(info.workspaceDir) : [];\n\n const expectedTables = extractExpectedTables(localMigrations);\n const localHashes = localMigrations.map((m) => m.hash).filter(Boolean);\n const migrationHashes = localHashes;\n\n const pool = new Pool({\n connectionString: info.databaseUrl,\n ssl:\n info.databaseUrl.includes(\"localhost\") || info.databaseUrl.includes(\"127.0.0.1\")\n ? false\n : { rejectUnauthorized: false },\n max: 1,\n connectionTimeoutMillis: 10_000,\n });\n\n try {\n const journalExists = await pool.query(`\n SELECT EXISTS (\n SELECT 1 FROM information_schema.tables\n WHERE table_schema = '${journalSchema}' AND table_name = '${journalTable}'\n ) AS exists\n `);\n\n let appliedHashCount = 0;\n if (journalExists.rows[0]?.exists) {\n const result = await pool.query(`SELECT hash FROM ${journalRef}`);\n appliedHashCount = result.rows.length;\n }\n\n let missingTables: string[] = [];\n if (expectedTables.length > 0) {\n const tableResult = await pool.query(\n `\n SELECT table_name FROM information_schema.tables\n WHERE table_schema = 'public'\n AND table_name = ANY($1)\n `,\n [expectedTables],\n );\n const existing = new Set(tableResult.rows.map((r: any) => r.table_name));\n missingTables = expectedTables.filter((t) => !existing.has(t));\n }\n\n let diagnosis: string;\n if (localMigrations.length === 0) {\n diagnosis = \"no-local-migrations\";\n } else if (appliedHashCount === 0 && missingTables.length === 0 && localHashes.length > 0) {\n // Journal is empty but all expected public tables exist.\n diagnosis = \"untracked-existing-schema\";\n } else if (appliedHashCount === 0 && localHashes.length > 0) {\n diagnosis = \"unapplied\";\n } else if (missingTables.length === 0) {\n diagnosis = \"healthy\";\n } else if (missingTables.length === expectedTables.length) {\n diagnosis = \"drift-safe-repair\";\n } else {\n diagnosis = \"drift-manual\";\n }\n\n const masked = info.databaseUrl.replace(/\\/\\/[^:]+:[^@]+@/, \"//***:***@\");\n\n return {\n plugin: info.key,\n slug,\n journalTable,\n journalSchema,\n dbSecret: info.databaseSecret,\n dbUrl: masked,\n workspaceDir: info.workspaceDir,\n localMigrationCount: localMigrations.length,\n appliedHashCount,\n expectedTables,\n missingTables,\n migrationHashes,\n diagnosis,\n };\n } catch (error) {\n return {\n plugin: info.key,\n slug,\n journalTable,\n journalSchema,\n dbSecret: info.databaseSecret,\n dbUrl: info.databaseUrl.replace(/\\/\\/[^:]+:[^@]+@/, \"//***:***@\"),\n workspaceDir: info.workspaceDir,\n localMigrationCount: localMigrations.length,\n appliedHashCount: 0,\n expectedTables,\n missingTables: [],\n migrationHashes: [],\n diagnosis: \"error\",\n error: error instanceof Error ? error.message : String(error),\n };\n } finally {\n await pool.end().catch(() => {});\n }\n}\n"],"mappings":";;;;;;AAuBA,SAAS,SAAS,KAAqB;CACrC,mCAAkB,QAAQ,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,KAAK;AACtD;AAQA,SAAS,oBAAoB,cAAwC;CACnE,MAAM,uCAAwB,cAAc,mBAAmB;CAE/D,MAAM,sDADe,eAAe,MACL,GAAG,eAAe;CACjD,IAAI,yBAAY,WAAW,GAAG,OAAO,CAAC;CAMtC,OAJgB,KAAK,gCAAmB,aAAa,MAAM,CAI9C,CAAC,CAAC,QAAQ,KAAK,UAAU;EACpC,MAAM,8BAAe,eAAe,GAAG,MAAM,IAAI,KAAK;EACtD,IAAI,yBAAY,OAAO,GACrB,OAAO;GAAE,KAAK,MAAM;GAAK,MAAM;GAAI,KAAK,CAAC;EAAE;EAE7C,MAAM,gCAAmB,SAAS,MAAM;EACxC,MAAM,MAAM,IAAI,MAAM,0BAA0B,CAAC,CAAC,KAAK,MAAM,EAAE,KAAK,CAAC;EACrE,OAAO;GAAE,KAAK,MAAM;GAAK,MAAM,SAAS,GAAG;GAAG;EAAI;CACpD,CAAC;AACH;AAEA,eAAsB,eAAe,MAA2C;CAC9E,MAAM,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"db-doctor.cjs","names":["pluginMigrationSlug","getMigrationStorage","extractExpectedTables"],"sources":["../../src/cli/db-doctor.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport { extractExpectedTables, getMigrationStorage, pluginMigrationSlug } from \"../db\";\nimport type { PluginDbInfo } from \"./db-studio\";\n\nexport interface DoctorReport {\n plugin: string;\n slug: string;\n journalTable: string;\n journalSchema: string;\n dbSecret: string;\n dbUrl: string;\n workspaceDir: string | undefined;\n localMigrationCount: number;\n appliedHashCount: number;\n expectedTables: string[];\n missingTables: string[];\n migrationHashes: string[];\n diagnosis: string;\n error?: string;\n}\n\nfunction hashFile(raw: string): string {\n return createHash(\"sha256\").update(raw).digest(\"hex\");\n}\n\ninterface LocalMigration {\n tag: string;\n hash: string;\n sql: string[];\n}\n\nfunction readLocalMigrations(workspaceDir: string): LocalMigration[] {\n const migrationsDir = resolve(workspaceDir, \"src/db/migrations\");\n const metaDir = join(migrationsDir, \"meta\");\n const journalPath = join(metaDir, \"_journal.json\");\n if (!existsSync(journalPath)) return [];\n\n const journal = JSON.parse(readFileSync(journalPath, \"utf8\")) as {\n entries: { idx: number; tag: string }[];\n };\n\n return journal.entries.map((entry) => {\n const sqlPath = join(migrationsDir, `${entry.tag}.sql`);\n if (!existsSync(sqlPath)) {\n return { tag: entry.tag, hash: \"\", sql: [] };\n }\n const raw = readFileSync(sqlPath, \"utf8\");\n const sql = raw.split(\"--> statement-breakpoint\").map((s) => s.trim());\n return { tag: entry.tag, hash: hashFile(raw), sql };\n });\n}\n\nexport async function diagnosePlugin(info: PluginDbInfo): Promise<DoctorReport> {\n const { Pool } = await import(\"pg\");\n\n const slug = pluginMigrationSlug(info.key);\n const storage = getMigrationStorage(slug);\n const journalTable = storage.table;\n const journalSchema = storage.schema;\n const journalRef = `\"${journalSchema}\".\"${journalTable}\"`;\n\n const localMigrations = info.workspaceDir ? readLocalMigrations(info.workspaceDir) : [];\n\n const expectedTables = extractExpectedTables(localMigrations);\n const localHashes = localMigrations.map((m) => m.hash).filter(Boolean);\n const migrationHashes = localHashes;\n\n const pool = new Pool({\n connectionString: info.databaseUrl,\n ssl:\n info.databaseUrl.includes(\"localhost\") || info.databaseUrl.includes(\"127.0.0.1\")\n ? false\n : { rejectUnauthorized: false },\n max: 1,\n connectionTimeoutMillis: 10_000,\n });\n\n try {\n const journalExists = await pool.query(`\n SELECT EXISTS (\n SELECT 1 FROM information_schema.tables\n WHERE table_schema = '${journalSchema}' AND table_name = '${journalTable}'\n ) AS exists\n `);\n\n let appliedHashCount = 0;\n if (journalExists.rows[0]?.exists) {\n const result = await pool.query(`SELECT hash FROM ${journalRef}`);\n appliedHashCount = result.rows.length;\n }\n\n let missingTables: string[] = [];\n if (expectedTables.length > 0) {\n const tableResult = await pool.query(\n `\n SELECT table_name FROM information_schema.tables\n WHERE table_schema = 'public'\n AND table_name = ANY($1)\n `,\n [expectedTables],\n );\n const existing = new Set(tableResult.rows.map((r: any) => r.table_name));\n missingTables = expectedTables.filter((t) => !existing.has(t));\n }\n\n let diagnosis: string;\n if (localMigrations.length === 0) {\n diagnosis = \"no-local-migrations\";\n } else if (appliedHashCount === 0 && missingTables.length === 0 && localHashes.length > 0) {\n // Journal is empty but all expected public tables exist.\n diagnosis = \"untracked-existing-schema\";\n } else if (appliedHashCount === 0 && localHashes.length > 0) {\n diagnosis = \"unapplied\";\n } else if (missingTables.length === 0) {\n diagnosis = \"healthy\";\n } else if (missingTables.length === expectedTables.length) {\n diagnosis = \"drift-safe-repair\";\n } else {\n diagnosis = \"drift-manual\";\n }\n\n const masked = info.databaseUrl.replace(/\\/\\/[^:]+:[^@]+@/, \"//***:***@\");\n\n return {\n plugin: info.key,\n slug,\n journalTable,\n journalSchema,\n dbSecret: info.databaseSecret,\n dbUrl: masked,\n workspaceDir: info.workspaceDir,\n localMigrationCount: localMigrations.length,\n appliedHashCount,\n expectedTables,\n missingTables,\n migrationHashes,\n diagnosis,\n };\n } catch (error) {\n return {\n plugin: info.key,\n slug,\n journalTable,\n journalSchema,\n dbSecret: info.databaseSecret,\n dbUrl: info.databaseUrl.replace(/\\/\\/[^:]+:[^@]+@/, \"//***:***@\"),\n workspaceDir: info.workspaceDir,\n localMigrationCount: localMigrations.length,\n appliedHashCount: 0,\n expectedTables,\n missingTables: [],\n migrationHashes: [],\n diagnosis: \"error\",\n error: error instanceof Error ? error.message : String(error),\n };\n } finally {\n await pool.end().catch(() => {});\n }\n}\n"],"mappings":";;;;;;AAuBA,SAAS,SAAS,KAAqB;CACrC,mCAAkB,QAAQ,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,KAAK;AACtD;AAQA,SAAS,oBAAoB,cAAwC;CACnE,MAAM,uCAAwB,cAAc,mBAAmB;CAE/D,MAAM,sDADe,eAAe,MACL,GAAG,eAAe;CACjD,IAAI,yBAAY,WAAW,GAAG,OAAO,CAAC;CAMtC,OAJgB,KAAK,gCAAmB,aAAa,MAAM,CAI9C,CAAC,CAAC,QAAQ,KAAK,UAAU;EACpC,MAAM,8BAAe,eAAe,GAAG,MAAM,IAAI,KAAK;EACtD,IAAI,yBAAY,OAAO,GACrB,OAAO;GAAE,KAAK,MAAM;GAAK,MAAM;GAAI,KAAK,CAAC;EAAE;EAE7C,MAAM,gCAAmB,SAAS,MAAM;EACxC,MAAM,MAAM,IAAI,MAAM,0BAA0B,CAAC,CAAC,KAAK,MAAM,EAAE,KAAK,CAAC;EACrE,OAAO;GAAE,KAAK,MAAM;GAAK,MAAM,SAAS,GAAG;GAAG;EAAI;CACpD,CAAC;AACH;AAEA,eAAsB,eAAe,MAA2C;CAC9E,MAAM,EAAE,SAAS,MAAM,OAAO;CAE9B,MAAM,OAAOA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c,WAAW,eAAe,QACjD,YAAY;OAEZ,YAAY;EAGd,MAAM,SAAS,KAAK,YAAY,QAAQ,oBAAoB,YAAY;EAExE,OAAO;GACL,QAAQ,KAAK;GACb;GACA;GACA;GACA,UAAU,KAAK;GACf,OAAO;GACP,cAAc,KAAK;GACnB,qBAAqB,gBAAgB;GACrC;GACA;GACA;GACA;GACA;EACF;CACF,SAAS,OAAO;EACd,OAAO;GACL,QAAQ,KAAK;GACb;GACA;GACA;GACA,UAAU,KAAK;GACf,OAAO,KAAK,YAAY,QAAQ,oBAAoB,YAAY;GAChE,cAAc,KAAK;GACnB,qBAAqB,gBAAgB;GACrC,kBAAkB;GAClB;GACA,eAAe,CAAC;GAChB,iBAAiB,CAAC;GAClB,WAAW;GACX,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EAC9D;CACF,UAAU;EACR,MAAM,KAAK,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC;CACjC;AACF"}
|
package/dist/cli/db-doctor.mjs
CHANGED
|
@@ -28,7 +28,7 @@ function readLocalMigrations(workspaceDir) {
|
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
async function diagnosePlugin(info) {
|
|
31
|
-
const { Pool } = await import("
|
|
31
|
+
const { Pool } = await import("pg");
|
|
32
32
|
const slug = pluginMigrationSlug(info.key);
|
|
33
33
|
const storage = getMigrationStorage(slug);
|
|
34
34
|
const journalTable = storage.table;
|
package/dist/cli/db-repair.cjs
CHANGED
|
@@ -48,7 +48,7 @@ async function repairPlugin(info, mode) {
|
|
|
48
48
|
message: `Cannot repair — diagnosis: ${diagnosis.diagnosis}`
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
const { Pool } = await
|
|
51
|
+
const { Pool } = await import("pg");
|
|
52
52
|
const journalRef = `"${diagnosis.journalSchema}"."${diagnosis.journalTable}"`;
|
|
53
53
|
const pool = new Pool({
|
|
54
54
|
connectionString: info.databaseUrl,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db-repair.cjs","names":["diagnosePlugin"],"sources":["../../src/cli/db-repair.ts"],"sourcesContent":["import { spawn } from \"node:child_process\";\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { type DoctorReport, diagnosePlugin } from \"./db-doctor\";\nimport type { PluginDbInfo } from \"./db-studio\";\n\nexport interface RepairResult {\n status: \"repaired\" | \"refused\" | \"error\";\n diagnosis: DoctorReport;\n message: string;\n}\n\nexport async function repairPlugin(\n info: PluginDbInfo,\n mode: \"history-reset\" | \"recreate\",\n): Promise<RepairResult> {\n const diagnosis = await diagnosePlugin(info);\n\n if (diagnosis.diagnosis === \"error\") {\n return {\n status: \"refused\",\n diagnosis,\n message: `Cannot repair — diagnosis failed: ${diagnosis.error}`,\n };\n }\n\n if (mode === \"recreate\") {\n return {\n status: \"refused\",\n diagnosis,\n message:\n \"Recreate mode is not supported without per-plugin database schemas. Use --mode history-reset instead.\",\n };\n }\n\n if (diagnosis.diagnosis !== \"drift-safe-repair\") {\n if (diagnosis.diagnosis === \"healthy\") {\n return { status: \"refused\", diagnosis, message: \"Database is healthy — no repair needed.\" };\n }\n if (diagnosis.diagnosis === \"no-local-migrations\") {\n return {\n status: \"refused\",\n diagnosis,\n message: \"No local migrations found for this plugin.\",\n };\n }\n if (diagnosis.diagnosis === \"drift-manual\") {\n return {\n status: \"refused\",\n diagnosis,\n message:\n `Partial drift detected (${diagnosis.missingTables.length}/${diagnosis.expectedTables.length} tables missing). ` +\n \"Manual intervention required — some tables exist but schema is incomplete.\",\n };\n }\n if (diagnosis.diagnosis === \"unapplied\") {\n return {\n status: \"refused\",\n diagnosis,\n message: \"Migrations have not been applied yet. Start the dev server to apply them.\",\n };\n }\n if (diagnosis.diagnosis === \"untracked-existing-schema\") {\n return {\n status: \"refused\",\n diagnosis,\n message:\n \"Tables exist but no matching migration history was found. \" +\n \"Run `drizzle-kit pull --init` in the plugin workspace to adopt the existing schema, \" +\n \"then run migrations from that baseline.\",\n };\n }\n return {\n status: \"refused\",\n diagnosis,\n message: `Cannot repair — diagnosis: ${diagnosis.diagnosis}`,\n };\n }\n\n // drift-safe-repair: drop the journal and replay\n const { Pool } = await import(\"pg\");\n const journalRef = `\"${diagnosis.journalSchema}\".\"${diagnosis.journalTable}\"`;\n const pool = new Pool({\n connectionString: info.databaseUrl,\n ssl:\n info.databaseUrl.includes(\"localhost\") || info.databaseUrl.includes(\"127.0.0.1\")\n ? false\n : { rejectUnauthorized: false },\n max: 1,\n connectionTimeoutMillis: 10_000,\n });\n\n try {\n await pool.query(`DROP TABLE IF EXISTS ${journalRef}`);\n\n if (info.workspaceDir) {\n const configPath = join(info.workspaceDir, \"drizzle.config.ts\");\n if (existsSync(configPath)) {\n try {\n await spawnDrizzleMigrate(info.workspaceDir, configPath);\n return {\n status: \"repaired\",\n diagnosis,\n message:\n `Migration history reset for ${diagnosis.plugin}. ` +\n `Migrations reapplied via drizzle-kit. Restart the dev server to confirm.`,\n };\n } catch (error) {\n return {\n status: \"repaired\",\n diagnosis,\n message:\n `Migration history reset for ${diagnosis.plugin}. ` +\n `Automatic reapply failed: ${error instanceof Error ? error.message : String(error)}. ` +\n `Run \\`bun run --cwd ${info.workspaceDir} db:migrate\\` manually.`,\n };\n }\n }\n }\n } catch (error) {\n return {\n status: \"error\",\n diagnosis,\n message: `Repair failed: ${error instanceof Error ? error.message : String(error)}`,\n };\n } finally {\n await pool.end().catch(() => {});\n }\n\n return {\n status: \"repaired\",\n diagnosis,\n message:\n `Migration history reset for ${diagnosis.plugin}. ` +\n \"No local drizzle.config.ts found — start the dev server to reapply migrations.\",\n };\n}\n\nfunction spawnDrizzleMigrate(cwd: string, configPath: string): Promise<void> {\n return new Promise((resolvePromise, reject) => {\n const child = spawn(\"npx\", [\"drizzle-kit\", \"migrate\", \"--config\", configPath], {\n cwd,\n stdio: \"pipe\",\n shell: true,\n });\n\n let stderr = \"\";\n child.stderr?.on(\"data\", (data: Buffer) => {\n stderr += data.toString();\n });\n\n child.on(\"error\", (err) => reject(err));\n\n child.on(\"exit\", (code) => {\n if (code === 0) {\n resolvePromise();\n } else {\n reject(new Error(`drizzle-kit migrate exited with code ${code}: ${stderr}`));\n }\n });\n });\n}\n"],"mappings":";;;;;;AAYA,eAAsB,aACpB,MACA,MACuB;CACvB,MAAM,YAAY,MAAMA,iCAAe,IAAI;CAE3C,IAAI,UAAU,cAAc,SAC1B,OAAO;EACL,QAAQ;EACR;EACA,SAAS,qCAAqC,UAAU;CAC1D;CAGF,IAAI,SAAS,YACX,OAAO;EACL,QAAQ;EACR;EACA,SACE;CACJ;CAGF,IAAI,UAAU,cAAc,qBAAqB;EAC/C,IAAI,UAAU,cAAc,WAC1B,OAAO;GAAE,QAAQ;GAAW;GAAW,SAAS;EAA0C;EAE5F,IAAI,UAAU,cAAc,uBAC1B,OAAO;GACL,QAAQ;GACR;GACA,SAAS;EACX;EAEF,IAAI,UAAU,cAAc,gBAC1B,OAAO;GACL,QAAQ;GACR;GACA,SACE,2BAA2B,UAAU,cAAc,OAAO,GAAG,UAAU,eAAe,OAAO;EAEjG;EAEF,IAAI,UAAU,cAAc,aAC1B,OAAO;GACL,QAAQ;GACR;GACA,SAAS;EACX;EAEF,IAAI,UAAU,cAAc,6BAC1B,OAAO;GACL,QAAQ;GACR;GACA,SACE;EAGJ;EAEF,OAAO;GACL,QAAQ;GACR;GACA,SAAS,8BAA8B,UAAU;EACnD;CACF;CAGA,MAAM,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"db-repair.cjs","names":["diagnosePlugin"],"sources":["../../src/cli/db-repair.ts"],"sourcesContent":["import { spawn } from \"node:child_process\";\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { type DoctorReport, diagnosePlugin } from \"./db-doctor\";\nimport type { PluginDbInfo } from \"./db-studio\";\n\nexport interface RepairResult {\n status: \"repaired\" | \"refused\" | \"error\";\n diagnosis: DoctorReport;\n message: string;\n}\n\nexport async function repairPlugin(\n info: PluginDbInfo,\n mode: \"history-reset\" | \"recreate\",\n): Promise<RepairResult> {\n const diagnosis = await diagnosePlugin(info);\n\n if (diagnosis.diagnosis === \"error\") {\n return {\n status: \"refused\",\n diagnosis,\n message: `Cannot repair — diagnosis failed: ${diagnosis.error}`,\n };\n }\n\n if (mode === \"recreate\") {\n return {\n status: \"refused\",\n diagnosis,\n message:\n \"Recreate mode is not supported without per-plugin database schemas. Use --mode history-reset instead.\",\n };\n }\n\n if (diagnosis.diagnosis !== \"drift-safe-repair\") {\n if (diagnosis.diagnosis === \"healthy\") {\n return { status: \"refused\", diagnosis, message: \"Database is healthy — no repair needed.\" };\n }\n if (diagnosis.diagnosis === \"no-local-migrations\") {\n return {\n status: \"refused\",\n diagnosis,\n message: \"No local migrations found for this plugin.\",\n };\n }\n if (diagnosis.diagnosis === \"drift-manual\") {\n return {\n status: \"refused\",\n diagnosis,\n message:\n `Partial drift detected (${diagnosis.missingTables.length}/${diagnosis.expectedTables.length} tables missing). ` +\n \"Manual intervention required — some tables exist but schema is incomplete.\",\n };\n }\n if (diagnosis.diagnosis === \"unapplied\") {\n return {\n status: \"refused\",\n diagnosis,\n message: \"Migrations have not been applied yet. Start the dev server to apply them.\",\n };\n }\n if (diagnosis.diagnosis === \"untracked-existing-schema\") {\n return {\n status: \"refused\",\n diagnosis,\n message:\n \"Tables exist but no matching migration history was found. \" +\n \"Run `drizzle-kit pull --init` in the plugin workspace to adopt the existing schema, \" +\n \"then run migrations from that baseline.\",\n };\n }\n return {\n status: \"refused\",\n diagnosis,\n message: `Cannot repair — diagnosis: ${diagnosis.diagnosis}`,\n };\n }\n\n // drift-safe-repair: drop the journal and replay\n const { Pool } = await import(\"pg\");\n const journalRef = `\"${diagnosis.journalSchema}\".\"${diagnosis.journalTable}\"`;\n const pool = new Pool({\n connectionString: info.databaseUrl,\n ssl:\n info.databaseUrl.includes(\"localhost\") || info.databaseUrl.includes(\"127.0.0.1\")\n ? false\n : { rejectUnauthorized: false },\n max: 1,\n connectionTimeoutMillis: 10_000,\n });\n\n try {\n await pool.query(`DROP TABLE IF EXISTS ${journalRef}`);\n\n if (info.workspaceDir) {\n const configPath = join(info.workspaceDir, \"drizzle.config.ts\");\n if (existsSync(configPath)) {\n try {\n await spawnDrizzleMigrate(info.workspaceDir, configPath);\n return {\n status: \"repaired\",\n diagnosis,\n message:\n `Migration history reset for ${diagnosis.plugin}. ` +\n `Migrations reapplied via drizzle-kit. Restart the dev server to confirm.`,\n };\n } catch (error) {\n return {\n status: \"repaired\",\n diagnosis,\n message:\n `Migration history reset for ${diagnosis.plugin}. ` +\n `Automatic reapply failed: ${error instanceof Error ? error.message : String(error)}. ` +\n `Run \\`bun run --cwd ${info.workspaceDir} db:migrate\\` manually.`,\n };\n }\n }\n }\n } catch (error) {\n return {\n status: \"error\",\n diagnosis,\n message: `Repair failed: ${error instanceof Error ? error.message : String(error)}`,\n };\n } finally {\n await pool.end().catch(() => {});\n }\n\n return {\n status: \"repaired\",\n diagnosis,\n message:\n `Migration history reset for ${diagnosis.plugin}. ` +\n \"No local drizzle.config.ts found — start the dev server to reapply migrations.\",\n };\n}\n\nfunction spawnDrizzleMigrate(cwd: string, configPath: string): Promise<void> {\n return new Promise((resolvePromise, reject) => {\n const child = spawn(\"npx\", [\"drizzle-kit\", \"migrate\", \"--config\", configPath], {\n cwd,\n stdio: \"pipe\",\n shell: true,\n });\n\n let stderr = \"\";\n child.stderr?.on(\"data\", (data: Buffer) => {\n stderr += data.toString();\n });\n\n child.on(\"error\", (err) => reject(err));\n\n child.on(\"exit\", (code) => {\n if (code === 0) {\n resolvePromise();\n } else {\n reject(new Error(`drizzle-kit migrate exited with code ${code}: ${stderr}`));\n }\n });\n });\n}\n"],"mappings":";;;;;;AAYA,eAAsB,aACpB,MACA,MACuB;CACvB,MAAM,YAAY,MAAMA,iCAAe,IAAI;CAE3C,IAAI,UAAU,cAAc,SAC1B,OAAO;EACL,QAAQ;EACR;EACA,SAAS,qCAAqC,UAAU;CAC1D;CAGF,IAAI,SAAS,Y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C7C;GACF;EAEJ;CACF,SAAS,OAAO;EACd,OAAO;GACL,QAAQ;GACR;GACA,SAAS,kBAAkB,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EAClF;CACF,UAAU;EACR,MAAM,KAAK,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC;CACjC;CAEA,OAAO;EACL,QAAQ;EACR;EACA,SACE,+BAA+B,UAAU,OAAO;CAEpD;AACF;AAEA,SAAS,oBAAoB,KAAa,YAAmC;CAC3E,OAAO,IAAI,SAAS,gBAAgB,WAAW;EAC7C,MAAM,sCAAc,OAAO;GAAC;GAAe;GAAW;GAAY;EAAU,GAAG;GAC7E;GACA,OAAO;GACP,OAAO;EACT,CAAC;EAED,IAAI,SAAS;EACb,MAAM,QAAQ,GAAG,SAAS,SAAiB;GACzC,UAAU,KAAK,SAAS;EAC1B,CAAC;EAED,MAAM,GAAG,UAAU,QAAQ,OAAO,GAAG,CAAC;EAEtC,MAAM,GAAG,SAAS,SAAS;GACzB,IAAI,SAAS,GACX,eAAe;QAEf,uBAAO,IAAI,MAAM,wCAAwC,KAAK,IAAI,QAAQ,CAAC;EAE/E,CAAC;CACH,CAAC;AACH"}
|
package/dist/cli/db-repair.mjs
CHANGED
|
@@ -48,7 +48,7 @@ async function repairPlugin(info, mode) {
|
|
|
48
48
|
message: `Cannot repair — diagnosis: ${diagnosis.diagnosis}`
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
const { Pool } = await import("
|
|
51
|
+
const { Pool } = await import("pg");
|
|
52
52
|
const journalRef = `"${diagnosis.journalSchema}"."${diagnosis.journalTable}"`;
|
|
53
53
|
const pool = new Pool({
|
|
54
54
|
connectionString: info.databaseUrl,
|
package/dist/contract.d.cts
CHANGED
|
@@ -34,8 +34,8 @@ declare const DevOptionsSchema: z.ZodObject<{
|
|
|
34
34
|
}, z.core.$strip>;
|
|
35
35
|
declare const DevResultSchema: z.ZodObject<{
|
|
36
36
|
status: z.ZodEnum<{
|
|
37
|
-
error: "error";
|
|
38
37
|
started: "started";
|
|
38
|
+
error: "error";
|
|
39
39
|
}>;
|
|
40
40
|
description: z.ZodString;
|
|
41
41
|
processes: z.ZodArray<z.ZodString>;
|
|
@@ -375,20 +375,20 @@ declare const KeyPublishResultSchema: z.ZodObject<{
|
|
|
375
375
|
error: z.ZodOptional<z.ZodString>;
|
|
376
376
|
}, z.core.$strip>;
|
|
377
377
|
declare const OverrideSectionSchema: z.ZodEnum<{
|
|
378
|
-
plugins: "plugins";
|
|
379
|
-
ui: "ui";
|
|
380
378
|
host: "host";
|
|
379
|
+
ui: "ui";
|
|
381
380
|
api: "api";
|
|
381
|
+
plugins: "plugins";
|
|
382
382
|
}>;
|
|
383
383
|
declare const RuntimeOverrideTargetBaseSchema: z.ZodEnum<{
|
|
384
|
-
plugins: "plugins";
|
|
385
384
|
ui: "ui";
|
|
386
385
|
api: "api";
|
|
386
|
+
plugins: "plugins";
|
|
387
387
|
}>;
|
|
388
388
|
declare const RuntimeOverrideTargetSchema: z.ZodUnion<readonly [z.ZodEnum<{
|
|
389
|
-
plugins: "plugins";
|
|
390
389
|
ui: "ui";
|
|
391
390
|
api: "api";
|
|
391
|
+
plugins: "plugins";
|
|
392
392
|
}>, z.ZodString]>;
|
|
393
393
|
declare const InitOptionsSchema: z.ZodObject<{
|
|
394
394
|
extends: z.ZodOptional<z.ZodString>;
|
|
@@ -398,10 +398,10 @@ declare const InitOptionsSchema: z.ZodObject<{
|
|
|
398
398
|
source: z.ZodOptional<z.ZodString>;
|
|
399
399
|
plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
400
400
|
overrides: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
401
|
-
plugins: "plugins";
|
|
402
|
-
ui: "ui";
|
|
403
401
|
host: "host";
|
|
402
|
+
ui: "ui";
|
|
404
403
|
api: "api";
|
|
404
|
+
plugins: "plugins";
|
|
405
405
|
}>>>;
|
|
406
406
|
noInteractive: z.ZodDefault<z.ZodBoolean>;
|
|
407
407
|
noInstall: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -418,10 +418,10 @@ declare const InitResultSchema: z.ZodObject<{
|
|
|
418
418
|
extends: z.ZodString;
|
|
419
419
|
plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
420
420
|
overrides: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
421
|
-
plugins: "plugins";
|
|
422
|
-
ui: "ui";
|
|
423
421
|
host: "host";
|
|
422
|
+
ui: "ui";
|
|
424
423
|
api: "api";
|
|
424
|
+
plugins: "plugins";
|
|
425
425
|
}>>>;
|
|
426
426
|
filesCopied: z.ZodNumber;
|
|
427
427
|
timings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -509,8 +509,8 @@ declare const StatusResultSchema: z.ZodObject<{
|
|
|
509
509
|
}, z.core.$strip>;
|
|
510
510
|
declare const TypesGenOptionsSchema: z.ZodObject<{
|
|
511
511
|
env: z.ZodOptional<z.ZodEnum<{
|
|
512
|
-
development: "development";
|
|
513
512
|
production: "production";
|
|
513
|
+
development: "development";
|
|
514
514
|
}>>;
|
|
515
515
|
dryRun: z.ZodDefault<z.ZodBoolean>;
|
|
516
516
|
}, z.core.$strip>;
|
|
@@ -696,8 +696,8 @@ declare const bosContract: {
|
|
|
696
696
|
interactive: z.ZodOptional<z.ZodBoolean>;
|
|
697
697
|
}, z.core.$strip>, z.ZodObject<{
|
|
698
698
|
status: z.ZodEnum<{
|
|
699
|
-
error: "error";
|
|
700
699
|
started: "started";
|
|
700
|
+
error: "error";
|
|
701
701
|
}>;
|
|
702
702
|
description: z.ZodString;
|
|
703
703
|
processes: z.ZodArray<z.ZodString>;
|
|
@@ -1022,10 +1022,10 @@ declare const bosContract: {
|
|
|
1022
1022
|
source: z.ZodOptional<z.ZodString>;
|
|
1023
1023
|
plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1024
1024
|
overrides: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
1025
|
-
plugins: "plugins";
|
|
1026
|
-
ui: "ui";
|
|
1027
1025
|
host: "host";
|
|
1026
|
+
ui: "ui";
|
|
1028
1027
|
api: "api";
|
|
1028
|
+
plugins: "plugins";
|
|
1029
1029
|
}>>>;
|
|
1030
1030
|
noInteractive: z.ZodDefault<z.ZodBoolean>;
|
|
1031
1031
|
noInstall: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -1041,10 +1041,10 @@ declare const bosContract: {
|
|
|
1041
1041
|
extends: z.ZodString;
|
|
1042
1042
|
plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1043
1043
|
overrides: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
1044
|
-
plugins: "plugins";
|
|
1045
|
-
ui: "ui";
|
|
1046
1044
|
host: "host";
|
|
1045
|
+
ui: "ui";
|
|
1047
1046
|
api: "api";
|
|
1047
|
+
plugins: "plugins";
|
|
1048
1048
|
}>>>;
|
|
1049
1049
|
filesCopied: z.ZodNumber;
|
|
1050
1050
|
timings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -1130,8 +1130,8 @@ declare const bosContract: {
|
|
|
1130
1130
|
}, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
1131
1131
|
typesGen: import("@orpc/contract").ContractProcedure<z.ZodObject<{
|
|
1132
1132
|
env: z.ZodOptional<z.ZodEnum<{
|
|
1133
|
-
development: "development";
|
|
1134
1133
|
production: "production";
|
|
1134
|
+
development: "development";
|
|
1135
1135
|
}>>;
|
|
1136
1136
|
dryRun: z.ZodDefault<z.ZodBoolean>;
|
|
1137
1137
|
}, z.core.$strip>, z.ZodObject<{
|
package/dist/contract.d.mts
CHANGED
|
@@ -34,8 +34,8 @@ declare const DevOptionsSchema: z.ZodObject<{
|
|
|
34
34
|
}, z.core.$strip>;
|
|
35
35
|
declare const DevResultSchema: z.ZodObject<{
|
|
36
36
|
status: z.ZodEnum<{
|
|
37
|
-
error: "error";
|
|
38
37
|
started: "started";
|
|
38
|
+
error: "error";
|
|
39
39
|
}>;
|
|
40
40
|
description: z.ZodString;
|
|
41
41
|
processes: z.ZodArray<z.ZodString>;
|
|
@@ -375,20 +375,20 @@ declare const KeyPublishResultSchema: z.ZodObject<{
|
|
|
375
375
|
error: z.ZodOptional<z.ZodString>;
|
|
376
376
|
}, z.core.$strip>;
|
|
377
377
|
declare const OverrideSectionSchema: z.ZodEnum<{
|
|
378
|
-
plugins: "plugins";
|
|
379
|
-
ui: "ui";
|
|
380
378
|
host: "host";
|
|
379
|
+
ui: "ui";
|
|
381
380
|
api: "api";
|
|
381
|
+
plugins: "plugins";
|
|
382
382
|
}>;
|
|
383
383
|
declare const RuntimeOverrideTargetBaseSchema: z.ZodEnum<{
|
|
384
|
-
plugins: "plugins";
|
|
385
384
|
ui: "ui";
|
|
386
385
|
api: "api";
|
|
386
|
+
plugins: "plugins";
|
|
387
387
|
}>;
|
|
388
388
|
declare const RuntimeOverrideTargetSchema: z.ZodUnion<readonly [z.ZodEnum<{
|
|
389
|
-
plugins: "plugins";
|
|
390
389
|
ui: "ui";
|
|
391
390
|
api: "api";
|
|
391
|
+
plugins: "plugins";
|
|
392
392
|
}>, z.ZodString]>;
|
|
393
393
|
declare const InitOptionsSchema: z.ZodObject<{
|
|
394
394
|
extends: z.ZodOptional<z.ZodString>;
|
|
@@ -398,10 +398,10 @@ declare const InitOptionsSchema: z.ZodObject<{
|
|
|
398
398
|
source: z.ZodOptional<z.ZodString>;
|
|
399
399
|
plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
400
400
|
overrides: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
401
|
-
plugins: "plugins";
|
|
402
|
-
ui: "ui";
|
|
403
401
|
host: "host";
|
|
402
|
+
ui: "ui";
|
|
404
403
|
api: "api";
|
|
404
|
+
plugins: "plugins";
|
|
405
405
|
}>>>;
|
|
406
406
|
noInteractive: z.ZodDefault<z.ZodBoolean>;
|
|
407
407
|
noInstall: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -418,10 +418,10 @@ declare const InitResultSchema: z.ZodObject<{
|
|
|
418
418
|
extends: z.ZodString;
|
|
419
419
|
plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
420
420
|
overrides: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
421
|
-
plugins: "plugins";
|
|
422
|
-
ui: "ui";
|
|
423
421
|
host: "host";
|
|
422
|
+
ui: "ui";
|
|
424
423
|
api: "api";
|
|
424
|
+
plugins: "plugins";
|
|
425
425
|
}>>>;
|
|
426
426
|
filesCopied: z.ZodNumber;
|
|
427
427
|
timings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -509,8 +509,8 @@ declare const StatusResultSchema: z.ZodObject<{
|
|
|
509
509
|
}, z.core.$strip>;
|
|
510
510
|
declare const TypesGenOptionsSchema: z.ZodObject<{
|
|
511
511
|
env: z.ZodOptional<z.ZodEnum<{
|
|
512
|
-
development: "development";
|
|
513
512
|
production: "production";
|
|
513
|
+
development: "development";
|
|
514
514
|
}>>;
|
|
515
515
|
dryRun: z.ZodDefault<z.ZodBoolean>;
|
|
516
516
|
}, z.core.$strip>;
|
|
@@ -696,8 +696,8 @@ declare const bosContract: {
|
|
|
696
696
|
interactive: z.ZodOptional<z.ZodBoolean>;
|
|
697
697
|
}, z.core.$strip>, z.ZodObject<{
|
|
698
698
|
status: z.ZodEnum<{
|
|
699
|
-
error: "error";
|
|
700
699
|
started: "started";
|
|
700
|
+
error: "error";
|
|
701
701
|
}>;
|
|
702
702
|
description: z.ZodString;
|
|
703
703
|
processes: z.ZodArray<z.ZodString>;
|
|
@@ -1022,10 +1022,10 @@ declare const bosContract: {
|
|
|
1022
1022
|
source: z.ZodOptional<z.ZodString>;
|
|
1023
1023
|
plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1024
1024
|
overrides: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
1025
|
-
plugins: "plugins";
|
|
1026
|
-
ui: "ui";
|
|
1027
1025
|
host: "host";
|
|
1026
|
+
ui: "ui";
|
|
1028
1027
|
api: "api";
|
|
1028
|
+
plugins: "plugins";
|
|
1029
1029
|
}>>>;
|
|
1030
1030
|
noInteractive: z.ZodDefault<z.ZodBoolean>;
|
|
1031
1031
|
noInstall: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -1041,10 +1041,10 @@ declare const bosContract: {
|
|
|
1041
1041
|
extends: z.ZodString;
|
|
1042
1042
|
plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1043
1043
|
overrides: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
1044
|
-
plugins: "plugins";
|
|
1045
|
-
ui: "ui";
|
|
1046
1044
|
host: "host";
|
|
1045
|
+
ui: "ui";
|
|
1047
1046
|
api: "api";
|
|
1047
|
+
plugins: "plugins";
|
|
1048
1048
|
}>>>;
|
|
1049
1049
|
filesCopied: z.ZodNumber;
|
|
1050
1050
|
timings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -1130,8 +1130,8 @@ declare const bosContract: {
|
|
|
1130
1130
|
}, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
1131
1131
|
typesGen: import("@orpc/contract").ContractProcedure<z.ZodObject<{
|
|
1132
1132
|
env: z.ZodOptional<z.ZodEnum<{
|
|
1133
|
-
development: "development";
|
|
1134
1133
|
production: "production";
|
|
1134
|
+
development: "development";
|
|
1135
1135
|
}>>;
|
|
1136
1136
|
dryRun: z.ZodDefault<z.ZodBoolean>;
|
|
1137
1137
|
}, z.core.$strip>, z.ZodObject<{
|
package/dist/infra/preflight.cjs
CHANGED
|
@@ -44,7 +44,7 @@ function checkPgConnection(url) {
|
|
|
44
44
|
return effect.Effect.gen(function* () {
|
|
45
45
|
if (!(yield* checkTcpReachable(new URL(url).hostname, Number(new URL(url).port) || 5432, 4e3))) return false;
|
|
46
46
|
try {
|
|
47
|
-
const { Pool } = yield* effect.Effect.promise(() =>
|
|
47
|
+
const { Pool } = yield* effect.Effect.promise(() => import("pg"));
|
|
48
48
|
const pool = new Pool({
|
|
49
49
|
connectionString: url,
|
|
50
50
|
connectionTimeoutMillis: 3e3
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preflight.cjs","names":["Effect"],"sources":["../../src/infra/preflight.ts"],"sourcesContent":["import { createConnection } from \"node:net\";\nimport { Effect } from \"effect\";\n\nexport interface PreflightTarget {\n secret: string;\n host: string;\n port: number;\n kind: \"postgres\" | \"redis\";\n url: string;\n}\n\nexport interface PreflightFailure {\n secret: string;\n host: string;\n port: number;\n error: string;\n}\n\nfunction parseLocalUrl(url: string): { host: string; port: number } | null {\n try {\n const match = url.match(/:\\/\\/([^:/]+):(\\d+)/);\n if (!match) return null;\n const host = match[1];\n const port = Number.parseInt(match[2], 10);\n if (Number.isNaN(port)) return null;\n if (host !== \"localhost\" && host !== \"127.0.0.1\") return null;\n return { host, port };\n } catch {\n return null;\n }\n}\n\nfunction checkTcpReachable(host: string, port: number, timeoutMs = 2000): Effect.Effect<boolean> {\n return Effect.async<boolean>((resume) => {\n const socket = createConnection({ host, port });\n const timer = setTimeout(() => {\n socket.destroy();\n resume(Effect.succeed(false));\n }, timeoutMs);\n\n socket.once(\"connect\", () => {\n clearTimeout(timer);\n socket.destroy();\n resume(Effect.succeed(true));\n });\n\n socket.once(\"error\", () => {\n clearTimeout(timer);\n socket.destroy();\n resume(Effect.succeed(false));\n });\n });\n}\n\nfunction checkPgConnection(url: string): Effect.Effect<boolean> {\n return Effect.gen(function* () {\n const reachable = yield* checkTcpReachable(\n new URL(url).hostname,\n Number(new URL(url).port) || 5432,\n 4000,\n );\n if (!reachable) return false;\n\n try {\n const { Pool } = yield* Effect.promise(() => import(\"pg\"));\n const pool = new Pool({ connectionString: url, connectionTimeoutMillis: 3000 });\n const client = yield* Effect.promise(() => pool.connect().then((c) => ({ client: c, pool })));\n try {\n yield* Effect.promise(() => client.client.query(\"SELECT 1\"));\n return true;\n } finally {\n client.client.release();\n yield* Effect.promise(() => client.pool.end().catch(() => {}));\n }\n } catch {\n return false;\n }\n });\n}\n\nfunction preflightTargetsFromEnv(env: Record<string, string>): PreflightTarget[] {\n const targets: PreflightTarget[] = [];\n for (const [secret, value] of Object.entries(env)) {\n if (!value) continue;\n if (secret.endsWith(\"_DATABASE_URL\")) {\n const parsed = parseLocalUrl(value);\n if (parsed) {\n targets.push({\n secret,\n host: parsed.host,\n port: parsed.port,\n kind: \"postgres\",\n url: value,\n });\n }\n } else if (secret.endsWith(\"_REDIS_URL\")) {\n const parsed = parseLocalUrl(value);\n if (parsed) {\n targets.push({ secret, host: parsed.host, port: parsed.port, kind: \"redis\", url: value });\n }\n }\n }\n return targets;\n}\n\nexport function preflightLocalInfra(\n env: Record<string, string>,\n overrides?: Record<string, string>,\n): Effect.Effect<PreflightFailure[], never> {\n const merged = overrides ? { ...env, ...overrides } : env;\n const targets = preflightTargetsFromEnv(merged);\n if (targets.length === 0) return Effect.succeed([]);\n\n return Effect.forEach(\n targets,\n (target) =>\n Effect.gen(function* () {\n if (target.kind === \"postgres\") {\n const ok = yield* checkPgConnection(target.url);\n if (ok) return null;\n const tcpOk = yield* checkTcpReachable(target.host, target.port);\n const pluginContext = target.secret.endsWith(\"_DATABASE_URL\")\n ? ` The plugin for ${target.secret} runs inside the local host process, so this DB must be reachable. Run \\`docker compose up -d --wait\\` to start local Postgres/Redis.`\n : \"\";\n if (tcpOk) {\n return {\n secret: target.secret,\n host: target.host,\n port: target.port,\n error: `${target.secret} at ${target.host}:${target.port} is reachable but Postgres connection failed. Check credentials and database name.${pluginContext}`,\n } satisfies PreflightFailure;\n }\n return {\n secret: target.secret,\n host: target.host,\n port: target.port,\n error: `${target.secret} points to ${target.host}:${target.port} but nothing is listening.${pluginContext}`,\n } satisfies PreflightFailure;\n }\n\n const reachable = yield* checkTcpReachable(target.host, target.port);\n if (reachable) return null;\n return {\n secret: target.secret,\n host: target.host,\n port: target.port,\n error: `${target.secret} points to ${target.host}:${target.port} but nothing is listening`,\n } satisfies PreflightFailure;\n }),\n { concurrency: \"unbounded\" },\n ).pipe(Effect.map((results) => results.filter((r): r is PreflightFailure => r !== null)));\n}\n"],"mappings":";;;;AAkBA,SAAS,cAAc,KAAoD;CACzE,IAAI;EACF,MAAM,QAAQ,IAAI,MAAM,qBAAqB;EAC7C,IAAI,CAAC,OAAO,OAAO;EACnB,MAAM,OAAO,MAAM;EACnB,MAAM,OAAO,OAAO,SAAS,MAAM,IAAI,EAAE;EACzC,IAAI,OAAO,MAAM,IAAI,GAAG,OAAO;EAC/B,IAAI,SAAS,eAAe,SAAS,aAAa,OAAO;EACzD,OAAO;GAAE;GAAM;EAAK;CACtB,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,kBAAkB,MAAc,MAAc,YAAY,KAA8B;CAC/F,OAAOA,cAAO,OAAgB,WAAW;EACvC,MAAM,wCAA0B;GAAE;GAAM;EAAK,CAAC;EAC9C,MAAM,QAAQ,iBAAiB;GAC7B,OAAO,QAAQ;GACf,OAAOA,cAAO,QAAQ,KAAK,CAAC;EAC9B,GAAG,SAAS;EAEZ,OAAO,KAAK,iBAAiB;GAC3B,aAAa,KAAK;GAClB,OAAO,QAAQ;GACf,OAAOA,cAAO,QAAQ,IAAI,CAAC;EAC7B,CAAC;EAED,OAAO,KAAK,eAAe;GACzB,aAAa,KAAK;GAClB,OAAO,QAAQ;GACf,OAAOA,cAAO,QAAQ,KAAK,CAAC;EAC9B,CAAC;CACH,CAAC;AACH;AAEA,SAAS,kBAAkB,KAAqC;CAC9D,OAAOA,cAAO,IAAI,aAAa;EAM7B,IAAI,EAAC,OALoB,kBACvB,IAAI,IAAI,GAAG,CAAC,CAAC,UACb,OAAO,IAAI,IAAI,GAAG,CAAC,CAAC,IAAI,KAAK,MAC7B,GACF,IACgB,OAAO;EAEvB,IAAI;GACF,MAAM,EAAE,SAAS,OAAOA,cAAO,
|
|
1
|
+
{"version":3,"file":"preflight.cjs","names":["Effect"],"sources":["../../src/infra/preflight.ts"],"sourcesContent":["import { createConnection } from \"node:net\";\nimport { Effect } from \"effect\";\n\nexport interface PreflightTarget {\n secret: string;\n host: string;\n port: number;\n kind: \"postgres\" | \"redis\";\n url: string;\n}\n\nexport interface PreflightFailure {\n secret: string;\n host: string;\n port: number;\n error: string;\n}\n\nfunction parseLocalUrl(url: string): { host: string; port: number } | null {\n try {\n const match = url.match(/:\\/\\/([^:/]+):(\\d+)/);\n if (!match) return null;\n const host = match[1];\n const port = Number.parseInt(match[2], 10);\n if (Number.isNaN(port)) return null;\n if (host !== \"localhost\" && host !== \"127.0.0.1\") return null;\n return { host, port };\n } catch {\n return null;\n }\n}\n\nfunction checkTcpReachable(host: string, port: number, timeoutMs = 2000): Effect.Effect<boolean> {\n return Effect.async<boolean>((resume) => {\n const socket = createConnection({ host, port });\n const timer = setTimeout(() => {\n socket.destroy();\n resume(Effect.succeed(false));\n }, timeoutMs);\n\n socket.once(\"connect\", () => {\n clearTimeout(timer);\n socket.destroy();\n resume(Effect.succeed(true));\n });\n\n socket.once(\"error\", () => {\n clearTimeout(timer);\n socket.destroy();\n resume(Effect.succeed(false));\n });\n });\n}\n\nfunction checkPgConnection(url: string): Effect.Effect<boolean> {\n return Effect.gen(function* () {\n const reachable = yield* checkTcpReachable(\n new URL(url).hostname,\n Number(new URL(url).port) || 5432,\n 4000,\n );\n if (!reachable) return false;\n\n try {\n const { Pool } = yield* Effect.promise(() => import(\"pg\"));\n const pool = new Pool({ connectionString: url, connectionTimeoutMillis: 3000 });\n const client = yield* Effect.promise(() => pool.connect().then((c) => ({ client: c, pool })));\n try {\n yield* Effect.promise(() => client.client.query(\"SELECT 1\"));\n return true;\n } finally {\n client.client.release();\n yield* Effect.promise(() => client.pool.end().catch(() => {}));\n }\n } catch {\n return false;\n }\n });\n}\n\nfunction preflightTargetsFromEnv(env: Record<string, string>): PreflightTarget[] {\n const targets: PreflightTarget[] = [];\n for (const [secret, value] of Object.entries(env)) {\n if (!value) continue;\n if (secret.endsWith(\"_DATABASE_URL\")) {\n const parsed = parseLocalUrl(value);\n if (parsed) {\n targets.push({\n secret,\n host: parsed.host,\n port: parsed.port,\n kind: \"postgres\",\n url: value,\n });\n }\n } else if (secret.endsWith(\"_REDIS_URL\")) {\n const parsed = parseLocalUrl(value);\n if (parsed) {\n targets.push({ secret, host: parsed.host, port: parsed.port, kind: \"redis\", url: value });\n }\n }\n }\n return targets;\n}\n\nexport function preflightLocalInfra(\n env: Record<string, string>,\n overrides?: Record<string, string>,\n): Effect.Effect<PreflightFailure[], never> {\n const merged = overrides ? { ...env, ...overrides } : env;\n const targets = preflightTargetsFromEnv(merged);\n if (targets.length === 0) return Effect.succeed([]);\n\n return Effect.forEach(\n targets,\n (target) =>\n Effect.gen(function* () {\n if (target.kind === \"postgres\") {\n const ok = yield* checkPgConnection(target.url);\n if (ok) return null;\n const tcpOk = yield* checkTcpReachable(target.host, target.port);\n const pluginContext = target.secret.endsWith(\"_DATABASE_URL\")\n ? ` The plugin for ${target.secret} runs inside the local host process, so this DB must be reachable. Run \\`docker compose up -d --wait\\` to start local Postgres/Redis.`\n : \"\";\n if (tcpOk) {\n return {\n secret: target.secret,\n host: target.host,\n port: target.port,\n error: `${target.secret} at ${target.host}:${target.port} is reachable but Postgres connection failed. Check credentials and database name.${pluginContext}`,\n } satisfies PreflightFailure;\n }\n return {\n secret: target.secret,\n host: target.host,\n port: target.port,\n error: `${target.secret} points to ${target.host}:${target.port} but nothing is listening.${pluginContext}`,\n } satisfies PreflightFailure;\n }\n\n const reachable = yield* checkTcpReachable(target.host, target.port);\n if (reachable) return null;\n return {\n secret: target.secret,\n host: target.host,\n port: target.port,\n error: `${target.secret} points to ${target.host}:${target.port} but nothing is listening`,\n } satisfies PreflightFailure;\n }),\n { concurrency: \"unbounded\" },\n ).pipe(Effect.map((results) => results.filter((r): r is PreflightFailure => r !== null)));\n}\n"],"mappings":";;;;AAkB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ACF,OAAO;IACL,QAAQ,OAAO;IACf,MAAM,OAAO;IACb,MAAM,OAAO;IACb,OAAO,GAAG,OAAO,OAAO,MAAM,OAAO,KAAK,GAAG,OAAO,KAAK,oFAAoF;GAC/I;GAEF,OAAO;IACL,QAAQ,OAAO;IACf,MAAM,OAAO;IACb,MAAM,OAAO;IACb,OAAO,GAAG,OAAO,OAAO,aAAa,OAAO,KAAK,GAAG,OAAO,KAAK,4BAA4B;GAC9F;EACF;EAGA,IAAI,OADqB,kBAAkB,OAAO,MAAM,OAAO,IAAI,GACpD,OAAO;EACtB,OAAO;GACL,QAAQ,OAAO;GACf,MAAM,OAAO;GACb,MAAM,OAAO;GACb,OAAO,GAAG,OAAO,OAAO,aAAa,OAAO,KAAK,GAAG,OAAO,KAAK;EAClE;CACF,CAAC,GACH,EAAE,aAAa,YAAY,CAC7B,CAAC,CAAC,KAAKA,cAAO,KAAK,YAAY,QAAQ,QAAQ,MAA6B,MAAM,IAAI,CAAC,CAAC;AAC1F"}
|
package/dist/infra/preflight.mjs
CHANGED
|
@@ -44,7 +44,7 @@ function checkPgConnection(url) {
|
|
|
44
44
|
return Effect.gen(function* () {
|
|
45
45
|
if (!(yield* checkTcpReachable(new URL(url).hostname, Number(new URL(url).port) || 5432, 4e3))) return false;
|
|
46
46
|
try {
|
|
47
|
-
const { Pool } = yield* Effect.promise(() => import("
|
|
47
|
+
const { Pool } = yield* Effect.promise(() => import("pg"));
|
|
48
48
|
const pool = new Pool({
|
|
49
49
|
connectionString: url,
|
|
50
50
|
connectionTimeoutMillis: 3e3
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preflight.mjs","names":[],"sources":["../../src/infra/preflight.ts"],"sourcesContent":["import { createConnection } from \"node:net\";\nimport { Effect } from \"effect\";\n\nexport interface PreflightTarget {\n secret: string;\n host: string;\n port: number;\n kind: \"postgres\" | \"redis\";\n url: string;\n}\n\nexport interface PreflightFailure {\n secret: string;\n host: string;\n port: number;\n error: string;\n}\n\nfunction parseLocalUrl(url: string): { host: string; port: number } | null {\n try {\n const match = url.match(/:\\/\\/([^:/]+):(\\d+)/);\n if (!match) return null;\n const host = match[1];\n const port = Number.parseInt(match[2], 10);\n if (Number.isNaN(port)) return null;\n if (host !== \"localhost\" && host !== \"127.0.0.1\") return null;\n return { host, port };\n } catch {\n return null;\n }\n}\n\nfunction checkTcpReachable(host: string, port: number, timeoutMs = 2000): Effect.Effect<boolean> {\n return Effect.async<boolean>((resume) => {\n const socket = createConnection({ host, port });\n const timer = setTimeout(() => {\n socket.destroy();\n resume(Effect.succeed(false));\n }, timeoutMs);\n\n socket.once(\"connect\", () => {\n clearTimeout(timer);\n socket.destroy();\n resume(Effect.succeed(true));\n });\n\n socket.once(\"error\", () => {\n clearTimeout(timer);\n socket.destroy();\n resume(Effect.succeed(false));\n });\n });\n}\n\nfunction checkPgConnection(url: string): Effect.Effect<boolean> {\n return Effect.gen(function* () {\n const reachable = yield* checkTcpReachable(\n new URL(url).hostname,\n Number(new URL(url).port) || 5432,\n 4000,\n );\n if (!reachable) return false;\n\n try {\n const { Pool } = yield* Effect.promise(() => import(\"pg\"));\n const pool = new Pool({ connectionString: url, connectionTimeoutMillis: 3000 });\n const client = yield* Effect.promise(() => pool.connect().then((c) => ({ client: c, pool })));\n try {\n yield* Effect.promise(() => client.client.query(\"SELECT 1\"));\n return true;\n } finally {\n client.client.release();\n yield* Effect.promise(() => client.pool.end().catch(() => {}));\n }\n } catch {\n return false;\n }\n });\n}\n\nfunction preflightTargetsFromEnv(env: Record<string, string>): PreflightTarget[] {\n const targets: PreflightTarget[] = [];\n for (const [secret, value] of Object.entries(env)) {\n if (!value) continue;\n if (secret.endsWith(\"_DATABASE_URL\")) {\n const parsed = parseLocalUrl(value);\n if (parsed) {\n targets.push({\n secret,\n host: parsed.host,\n port: parsed.port,\n kind: \"postgres\",\n url: value,\n });\n }\n } else if (secret.endsWith(\"_REDIS_URL\")) {\n const parsed = parseLocalUrl(value);\n if (parsed) {\n targets.push({ secret, host: parsed.host, port: parsed.port, kind: \"redis\", url: value });\n }\n }\n }\n return targets;\n}\n\nexport function preflightLocalInfra(\n env: Record<string, string>,\n overrides?: Record<string, string>,\n): Effect.Effect<PreflightFailure[], never> {\n const merged = overrides ? { ...env, ...overrides } : env;\n const targets = preflightTargetsFromEnv(merged);\n if (targets.length === 0) return Effect.succeed([]);\n\n return Effect.forEach(\n targets,\n (target) =>\n Effect.gen(function* () {\n if (target.kind === \"postgres\") {\n const ok = yield* checkPgConnection(target.url);\n if (ok) return null;\n const tcpOk = yield* checkTcpReachable(target.host, target.port);\n const pluginContext = target.secret.endsWith(\"_DATABASE_URL\")\n ? ` The plugin for ${target.secret} runs inside the local host process, so this DB must be reachable. Run \\`docker compose up -d --wait\\` to start local Postgres/Redis.`\n : \"\";\n if (tcpOk) {\n return {\n secret: target.secret,\n host: target.host,\n port: target.port,\n error: `${target.secret} at ${target.host}:${target.port} is reachable but Postgres connection failed. Check credentials and database name.${pluginContext}`,\n } satisfies PreflightFailure;\n }\n return {\n secret: target.secret,\n host: target.host,\n port: target.port,\n error: `${target.secret} points to ${target.host}:${target.port} but nothing is listening.${pluginContext}`,\n } satisfies PreflightFailure;\n }\n\n const reachable = yield* checkTcpReachable(target.host, target.port);\n if (reachable) return null;\n return {\n secret: target.secret,\n host: target.host,\n port: target.port,\n error: `${target.secret} points to ${target.host}:${target.port} but nothing is listening`,\n } satisfies PreflightFailure;\n }),\n { concurrency: \"unbounded\" },\n ).pipe(Effect.map((results) => results.filter((r): r is PreflightFailure => r !== null)));\n}\n"],"mappings":";;;;AAkBA,SAAS,cAAc,KAAoD;CACzE,IAAI;EACF,MAAM,QAAQ,IAAI,MAAM,qBAAqB;EAC7C,IAAI,CAAC,OAAO,OAAO;EACnB,MAAM,OAAO,MAAM;EACnB,MAAM,OAAO,OAAO,SAAS,MAAM,IAAI,EAAE;EACzC,IAAI,OAAO,MAAM,IAAI,GAAG,OAAO;EAC/B,IAAI,SAAS,eAAe,SAAS,aAAa,OAAO;EACzD,OAAO;GAAE;GAAM;EAAK;CACtB,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,kBAAkB,MAAc,MAAc,YAAY,KAA8B;CAC/F,OAAO,OAAO,OAAgB,WAAW;EACvC,MAAM,SAAS,iBAAiB;GAAE;GAAM;EAAK,CAAC;EAC9C,MAAM,QAAQ,iBAAiB;GAC7B,OAAO,QAAQ;GACf,OAAO,OAAO,QAAQ,KAAK,CAAC;EAC9B,GAAG,SAAS;EAEZ,OAAO,KAAK,iBAAiB;GAC3B,aAAa,KAAK;GAClB,OAAO,QAAQ;GACf,OAAO,OAAO,QAAQ,IAAI,CAAC;EAC7B,CAAC;EAED,OAAO,KAAK,eAAe;GACzB,aAAa,KAAK;GAClB,OAAO,QAAQ;GACf,OAAO,OAAO,QAAQ,KAAK,CAAC;EAC9B,CAAC;CACH,CAAC;AACH;AAEA,SAAS,kBAAkB,KAAqC;CAC9D,OAAO,OAAO,IAAI,aAAa;EAM7B,IAAI,EAAC,OALoB,kBACvB,IAAI,IAAI,GAAG,CAAC,CAAC,UACb,OAAO,IAAI,IAAI,GAAG,CAAC,CAAC,IAAI,KAAK,MAC7B,GACF,IACgB,OAAO;EAEvB,IAAI;GACF,MAAM,EAAE,SAAS,OAAO,OAAO,cAAc,OAAO,
|
|
1
|
+
{"version":3,"file":"preflight.mjs","names":[],"sources":["../../src/infra/preflight.ts"],"sourcesContent":["import { createConnection } from \"node:net\";\nimport { Effect } from \"effect\";\n\nexport interface PreflightTarget {\n secret: string;\n host: string;\n port: number;\n kind: \"postgres\" | \"redis\";\n url: string;\n}\n\nexport interface PreflightFailure {\n secret: string;\n host: string;\n port: number;\n error: string;\n}\n\nfunction parseLocalUrl(url: string): { host: string; port: number } | null {\n try {\n const match = url.match(/:\\/\\/([^:/]+):(\\d+)/);\n if (!match) return null;\n const host = match[1];\n const port = Number.parseInt(match[2], 10);\n if (Number.isNaN(port)) return null;\n if (host !== \"localhost\" && host !== \"127.0.0.1\") return null;\n return { host, port };\n } catch {\n return null;\n }\n}\n\nfunction checkTcpReachable(host: string, port: number, timeoutMs = 2000): Effect.Effect<boolean> {\n return Effect.async<boolean>((resume) => {\n const socket = createConnection({ host, port });\n const timer = setTimeout(() => {\n socket.destroy();\n resume(Effect.succeed(false));\n }, timeoutMs);\n\n socket.once(\"connect\", () => {\n clearTimeout(timer);\n socket.destroy();\n resume(Effect.succeed(true));\n });\n\n socket.once(\"error\", () => {\n clearTimeout(timer);\n socket.destroy();\n resume(Effect.succeed(false));\n });\n });\n}\n\nfunction checkPgConnection(url: string): Effect.Effect<boolean> {\n return Effect.gen(function* () {\n const reachable = yield* checkTcpReachable(\n new URL(url).hostname,\n Number(new URL(url).port) || 5432,\n 4000,\n );\n if (!reachable) return false;\n\n try {\n const { Pool } = yield* Effect.promise(() => import(\"pg\"));\n const pool = new Pool({ connectionString: url, connectionTimeoutMillis: 3000 });\n const client = yield* Effect.promise(() => pool.connect().then((c) => ({ client: c, pool })));\n try {\n yield* Effect.promise(() => client.client.query(\"SELECT 1\"));\n return true;\n } finally {\n client.client.release();\n yield* Effect.promise(() => client.pool.end().catch(() => {}));\n }\n } catch {\n return false;\n }\n });\n}\n\nfunction preflightTargetsFromEnv(env: Record<string, string>): PreflightTarget[] {\n const targets: PreflightTarget[] = [];\n for (const [secret, value] of Object.entries(env)) {\n if (!value) continue;\n if (secret.endsWith(\"_DATABASE_URL\")) {\n const parsed = parseLocalUrl(value);\n if (parsed) {\n targets.push({\n secret,\n host: parsed.host,\n port: parsed.port,\n kind: \"postgres\",\n url: value,\n });\n }\n } else if (secret.endsWith(\"_REDIS_URL\")) {\n const parsed = parseLocalUrl(value);\n if (parsed) {\n targets.push({ secret, host: parsed.host, port: parsed.port, kind: \"redis\", url: value });\n }\n }\n }\n return targets;\n}\n\nexport function preflightLocalInfra(\n env: Record<string, string>,\n overrides?: Record<string, string>,\n): Effect.Effect<PreflightFailure[], never> {\n const merged = overrides ? { ...env, ...overrides } : env;\n const targets = preflightTargetsFromEnv(merged);\n if (targets.length === 0) return Effect.succeed([]);\n\n return Effect.forEach(\n targets,\n (target) =>\n Effect.gen(function* () {\n if (target.kind === \"postgres\") {\n const ok = yield* checkPgConnection(target.url);\n if (ok) return null;\n const tcpOk = yield* checkTcpReachable(target.host, target.port);\n const pluginContext = target.secret.endsWith(\"_DATABASE_URL\")\n ? ` The plugin for ${target.secret} runs inside the local host process, so this DB must be reachable. Run \\`docker compose up -d --wait\\` to start local Postgres/Redis.`\n : \"\";\n if (tcpOk) {\n return {\n secret: target.secret,\n host: target.host,\n port: target.port,\n error: `${target.secret} at ${target.host}:${target.port} is reachable but Postgres connection failed. Check credentials and database name.${pluginContext}`,\n } satisfies PreflightFailure;\n }\n return {\n secret: target.secret,\n host: target.host,\n port: target.port,\n error: `${target.secret} points to ${target.host}:${target.port} but nothing is listening.${pluginContext}`,\n } satisfies PreflightFailure;\n }\n\n const reachable = yield* checkTcpReachable(target.host, target.port);\n if (reachable) return null;\n return {\n secret: target.secret,\n host: target.host,\n port: target.port,\n error: `${target.secret} points to ${target.host}:${target.port} but nothing is listening`,\n } satisfies PreflightFailure;\n }),\n { concurrency: \"unbounded\" },\n ).pipe(Effect.map((results) => results.filter((r): r is PreflightFailure => r !== null)));\n}\n"],"mappings":";;;;AAkBA,SAAS,cAAc,KAAoD;CACzE,IAAI;EACF,MAAM,QAAQ,IAAI,MAAM,qBAAqB;EAC7C,IAAI,CAAC,OAAO,OAAO;EACnB,MAAM,OAAO,MAAM;EACnB,MAAM,OAAO,OAAO,SAAS,MAAM,IAAI,EAAE;EACzC,IAAI,OAAO,MAAM,IAAI,GAAG,OAAO;EAC/B,IAAI,SAAS,eAAe,SAAS,aAAa,OAAO;EACzD,OAAO;GAAE;GAAM;EAAK;CACtB,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,kBAAkB,MAAc,MAAc,YAAY,KAA8B;CAC/F,OAAO,OAAO,OAAgB,WAAW;EACvC,MAAM,SAAS,iBAAi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AAO,OAAO,aAAa,OAAO,KAAK,GAAG,OAAO,KAAK;EAClE;CACF,CAAC,GACH,EAAE,aAAa,YAAY,CAC7B,CAAC,CAAC,KAAK,OAAO,KAAK,YAAY,QAAQ,QAAQ,MAA6B,MAAM,IAAI,CAAC,CAAC;AAC1F"}
|
package/dist/plugin.d.cts
CHANGED
|
@@ -61,8 +61,8 @@ declare const _default: import("every-plugin").LoadedPluginWithBinding<{
|
|
|
61
61
|
interactive: z.ZodOptional<z.ZodBoolean>;
|
|
62
62
|
}, z.core.$strip>, z.ZodObject<{
|
|
63
63
|
status: z.ZodEnum<{
|
|
64
|
-
error: "error";
|
|
65
64
|
started: "started";
|
|
65
|
+
error: "error";
|
|
66
66
|
}>;
|
|
67
67
|
description: z.ZodString;
|
|
68
68
|
processes: z.ZodArray<z.ZodString>;
|
|
@@ -387,10 +387,10 @@ declare const _default: import("every-plugin").LoadedPluginWithBinding<{
|
|
|
387
387
|
source: z.ZodOptional<z.ZodString>;
|
|
388
388
|
plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
389
389
|
overrides: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
390
|
-
plugins: "plugins";
|
|
391
|
-
ui: "ui";
|
|
392
390
|
host: "host";
|
|
391
|
+
ui: "ui";
|
|
393
392
|
api: "api";
|
|
393
|
+
plugins: "plugins";
|
|
394
394
|
}>>>;
|
|
395
395
|
noInteractive: z.ZodDefault<z.ZodBoolean>;
|
|
396
396
|
noInstall: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -406,10 +406,10 @@ declare const _default: import("every-plugin").LoadedPluginWithBinding<{
|
|
|
406
406
|
extends: z.ZodString;
|
|
407
407
|
plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
408
408
|
overrides: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
409
|
-
plugins: "plugins";
|
|
410
|
-
ui: "ui";
|
|
411
409
|
host: "host";
|
|
410
|
+
ui: "ui";
|
|
412
411
|
api: "api";
|
|
412
|
+
plugins: "plugins";
|
|
413
413
|
}>>>;
|
|
414
414
|
filesCopied: z.ZodNumber;
|
|
415
415
|
timings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -495,8 +495,8 @@ declare const _default: import("every-plugin").LoadedPluginWithBinding<{
|
|
|
495
495
|
}, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
496
496
|
typesGen: import("@orpc/contract").ContractProcedure<z.ZodObject<{
|
|
497
497
|
env: z.ZodOptional<z.ZodEnum<{
|
|
498
|
-
development: "development";
|
|
499
498
|
production: "production";
|
|
499
|
+
development: "development";
|
|
500
500
|
}>>;
|
|
501
501
|
dryRun: z.ZodDefault<z.ZodBoolean>;
|
|
502
502
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -734,7 +734,7 @@ declare const _default: import("every-plugin").LoadedPluginWithBinding<{
|
|
|
734
734
|
}> | undefined;
|
|
735
735
|
} | null;
|
|
736
736
|
runtimeConfig: {
|
|
737
|
-
env: "
|
|
737
|
+
env: "production" | "staging" | "development";
|
|
738
738
|
account: string;
|
|
739
739
|
networkId: "testnet" | "mainnet";
|
|
740
740
|
host: {
|
package/dist/plugin.d.mts
CHANGED
|
@@ -61,8 +61,8 @@ declare const _default: import("every-plugin").LoadedPluginWithBinding<{
|
|
|
61
61
|
interactive: z.ZodOptional<z.ZodBoolean>;
|
|
62
62
|
}, z.core.$strip>, z.ZodObject<{
|
|
63
63
|
status: z.ZodEnum<{
|
|
64
|
-
error: "error";
|
|
65
64
|
started: "started";
|
|
65
|
+
error: "error";
|
|
66
66
|
}>;
|
|
67
67
|
description: z.ZodString;
|
|
68
68
|
processes: z.ZodArray<z.ZodString>;
|
|
@@ -387,10 +387,10 @@ declare const _default: import("every-plugin").LoadedPluginWithBinding<{
|
|
|
387
387
|
source: z.ZodOptional<z.ZodString>;
|
|
388
388
|
plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
389
389
|
overrides: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
390
|
-
plugins: "plugins";
|
|
391
|
-
ui: "ui";
|
|
392
390
|
host: "host";
|
|
391
|
+
ui: "ui";
|
|
393
392
|
api: "api";
|
|
393
|
+
plugins: "plugins";
|
|
394
394
|
}>>>;
|
|
395
395
|
noInteractive: z.ZodDefault<z.ZodBoolean>;
|
|
396
396
|
noInstall: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -406,10 +406,10 @@ declare const _default: import("every-plugin").LoadedPluginWithBinding<{
|
|
|
406
406
|
extends: z.ZodString;
|
|
407
407
|
plugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
408
408
|
overrides: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
409
|
-
plugins: "plugins";
|
|
410
|
-
ui: "ui";
|
|
411
409
|
host: "host";
|
|
410
|
+
ui: "ui";
|
|
412
411
|
api: "api";
|
|
412
|
+
plugins: "plugins";
|
|
413
413
|
}>>>;
|
|
414
414
|
filesCopied: z.ZodNumber;
|
|
415
415
|
timings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -495,8 +495,8 @@ declare const _default: import("every-plugin").LoadedPluginWithBinding<{
|
|
|
495
495
|
}, z.core.$strip>, import("@orpc/contract").MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
496
496
|
typesGen: import("@orpc/contract").ContractProcedure<z.ZodObject<{
|
|
497
497
|
env: z.ZodOptional<z.ZodEnum<{
|
|
498
|
-
development: "development";
|
|
499
498
|
production: "production";
|
|
499
|
+
development: "development";
|
|
500
500
|
}>>;
|
|
501
501
|
dryRun: z.ZodDefault<z.ZodBoolean>;
|
|
502
502
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -734,7 +734,7 @@ declare const _default: import("every-plugin").LoadedPluginWithBinding<{
|
|
|
734
734
|
}> | undefined;
|
|
735
735
|
} | null;
|
|
736
736
|
runtimeConfig: {
|
|
737
|
-
env: "
|
|
737
|
+
env: "production" | "staging" | "development";
|
|
738
738
|
account: string;
|
|
739
739
|
networkId: "testnet" | "mainnet";
|
|
740
740
|
host: {
|
package/dist/types.d.cts
CHANGED
|
@@ -378,9 +378,9 @@ declare const BosConfigSchema: z.ZodObject<{
|
|
|
378
378
|
type BosConfig = z.infer<typeof BosConfigSchema>;
|
|
379
379
|
declare const RuntimeConfigSchema: z.ZodObject<{
|
|
380
380
|
env: z.ZodEnum<{
|
|
381
|
-
development: "development";
|
|
382
381
|
production: "production";
|
|
383
382
|
staging: "staging";
|
|
383
|
+
development: "development";
|
|
384
384
|
}>;
|
|
385
385
|
account: z.ZodString;
|
|
386
386
|
domain: z.ZodOptional<z.ZodString>;
|
|
@@ -507,9 +507,9 @@ declare const RuntimeConfigSchema: z.ZodObject<{
|
|
|
507
507
|
type RuntimeConfig = z.infer<typeof RuntimeConfigSchema>;
|
|
508
508
|
declare const ClientRuntimeConfigSchema: z.ZodObject<{
|
|
509
509
|
env: z.ZodEnum<{
|
|
510
|
-
development: "development";
|
|
511
510
|
production: "production";
|
|
512
511
|
staging: "staging";
|
|
512
|
+
development: "development";
|
|
513
513
|
}>;
|
|
514
514
|
account: z.ZodString;
|
|
515
515
|
networkId: z.ZodEnum<{
|
package/dist/types.d.mts
CHANGED
|
@@ -378,9 +378,9 @@ declare const BosConfigSchema: z.ZodObject<{
|
|
|
378
378
|
type BosConfig = z.infer<typeof BosConfigSchema>;
|
|
379
379
|
declare const RuntimeConfigSchema: z.ZodObject<{
|
|
380
380
|
env: z.ZodEnum<{
|
|
381
|
-
development: "development";
|
|
382
381
|
production: "production";
|
|
383
382
|
staging: "staging";
|
|
383
|
+
development: "development";
|
|
384
384
|
}>;
|
|
385
385
|
account: z.ZodString;
|
|
386
386
|
domain: z.ZodOptional<z.ZodString>;
|
|
@@ -507,9 +507,9 @@ declare const RuntimeConfigSchema: z.ZodObject<{
|
|
|
507
507
|
type RuntimeConfig = z.infer<typeof RuntimeConfigSchema>;
|
|
508
508
|
declare const ClientRuntimeConfigSchema: z.ZodObject<{
|
|
509
509
|
env: z.ZodEnum<{
|
|
510
|
-
development: "development";
|
|
511
510
|
production: "production";
|
|
512
511
|
staging: "staging";
|
|
512
|
+
development: "development";
|
|
513
513
|
}>;
|
|
514
514
|
account: z.ZodString;
|
|
515
515
|
networkId: z.ZodEnum<{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "everything-dev",
|
|
3
|
-
"version": "1.51.
|
|
3
|
+
"version": "1.51.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20.11"
|
|
@@ -140,10 +140,11 @@
|
|
|
140
140
|
"dotenv": "^17.3.1",
|
|
141
141
|
"effect": "^3.21.0",
|
|
142
142
|
"execa": "^9.5.2",
|
|
143
|
-
"every-plugin": "^2.
|
|
143
|
+
"every-plugin": "^2.10.0",
|
|
144
144
|
"glob": "^13.0.6",
|
|
145
145
|
"gradient-string": "^3.0.0",
|
|
146
146
|
"ink": "^6.8.0",
|
|
147
|
+
"pg": "^8.12.0",
|
|
147
148
|
"tar": "^7.4.3"
|
|
148
149
|
},
|
|
149
150
|
"peerDependencies": {
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
|
|
3
|
-
//#region \0rolldown/runtime.js
|
|
4
|
-
var __create = Object.create;
|
|
5
|
-
var __defProp = Object.defineProperty;
|
|
6
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
-
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
14
|
-
key = keys[i];
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
16
|
-
__defProp(to, key, {
|
|
17
|
-
get: ((k) => from[k]).bind(null, key),
|
|
18
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return to;
|
|
24
|
-
};
|
|
25
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
26
|
-
value: mod,
|
|
27
|
-
enumerable: true
|
|
28
|
-
}) : target, mod));
|
|
29
|
-
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
30
|
-
|
|
31
|
-
//#endregion
|
|
32
|
-
export { __commonJSMin, __require, __toESM };
|