@open-mercato/cli 0.11.1-develop.8910.1.d07a49d70a → 0.11.1-develop.8929.1.493f6c653c
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/.turbo/turbo-build.log +6 -2
- package/dist/agentic/guides/module-facts.json +356 -399
- package/dist/agentic/guides/module-facts.v2.json +356 -399
- package/dist/agentic/guides/modules/agent_orchestrator/active-extension-bindings.md +1 -1
- package/dist/agentic/guides/modules/agent_orchestrator/exact-override-targets.md +1 -1
- package/dist/agentic/guides/modules/agent_orchestrator/index.md +1 -1
- package/dist/agentic/guides/modules/agent_orchestrator/workers.md +1 -1
- package/dist/agentic/guides/modules/ai_assistant/exact-override-targets.md +2 -2
- package/dist/agentic/guides/modules/ai_assistant/index.md +1 -1
- package/dist/agentic/guides/modules/ai_assistant/workers.md +2 -2
- package/dist/agentic/guides/modules/api_docs/index.md +1 -1
- package/dist/agentic/guides/modules/api_keys/index.md +1 -1
- package/dist/agentic/guides/modules/assisted_selling/index.md +1 -1
- package/dist/agentic/guides/modules/attachments/index.md +1 -1
- package/dist/agentic/guides/modules/audit_logs/index.md +1 -1
- package/dist/agentic/guides/modules/auth/entities.md +1 -0
- package/dist/agentic/guides/modules/auth/index.md +2 -2
- package/dist/agentic/guides/modules/auth/umes-hosts.md +1 -0
- package/dist/agentic/guides/modules/availability/index.md +1 -1
- package/dist/agentic/guides/modules/backups/index.md +1 -1
- package/dist/agentic/guides/modules/business_rules/index.md +1 -1
- package/dist/agentic/guides/modules/carrier_inpost/index.md +1 -1
- package/dist/agentic/guides/modules/cart/index.md +1 -1
- package/dist/agentic/guides/modules/catalog/domain-commands.md +0 -1
- package/dist/agentic/guides/modules/catalog/index.md +1 -1
- package/dist/agentic/guides/modules/channel_apns/index.md +1 -1
- package/dist/agentic/guides/modules/channel_discord/index.md +1 -1
- package/dist/agentic/guides/modules/channel_expo/index.md +1 -1
- package/dist/agentic/guides/modules/channel_fcm/index.md +1 -1
- package/dist/agentic/guides/modules/channel_gmail/index.md +1 -1
- package/dist/agentic/guides/modules/channel_imap/index.md +1 -1
- package/dist/agentic/guides/modules/channel_ms365/index.md +1 -1
- package/dist/agentic/guides/modules/channel_resend/index.md +1 -1
- package/dist/agentic/guides/modules/channel_ses/index.md +1 -1
- package/dist/agentic/guides/modules/channel_smtp/index.md +1 -1
- package/dist/agentic/guides/modules/checkout/index.md +1 -1
- package/dist/agentic/guides/modules/communication_channels/index.md +1 -1
- package/dist/agentic/guides/modules/configs/index.md +1 -1
- package/dist/agentic/guides/modules/content/index.md +1 -1
- package/dist/agentic/guides/modules/currencies/index.md +1 -1
- package/dist/agentic/guides/modules/customer_accounts/exact-override-targets.md +4 -4
- package/dist/agentic/guides/modules/customer_accounts/index.md +1 -1
- package/dist/agentic/guides/modules/customer_accounts/workers.md +4 -4
- package/dist/agentic/guides/modules/customer_groups/index.md +1 -1
- package/dist/agentic/guides/modules/customers/index.md +1 -1
- package/dist/agentic/guides/modules/dashboards/index.md +1 -1
- package/dist/agentic/guides/modules/data_sync/index.md +1 -1
- package/dist/agentic/guides/modules/design_system/index.md +1 -1
- package/dist/agentic/guides/modules/devices/index.md +1 -1
- package/dist/agentic/guides/modules/dictionaries/index.md +1 -1
- package/dist/agentic/guides/modules/directory/index.md +1 -1
- package/dist/agentic/guides/modules/documents/index.md +1 -1
- package/dist/agentic/guides/modules/ecommerce/index.md +1 -1
- package/dist/agentic/guides/modules/entities/index.md +1 -1
- package/dist/agentic/guides/modules/eudr/index.md +1 -1
- package/dist/agentic/guides/modules/events/index.md +1 -1
- package/dist/agentic/guides/modules/feature_toggles/index.md +1 -1
- package/dist/agentic/guides/modules/forms/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_autopay/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_stripe/index.md +1 -1
- package/dist/agentic/guides/modules/gateway_tpay/index.md +1 -1
- package/dist/agentic/guides/modules/generators/index.md +1 -1
- package/dist/agentic/guides/modules/gus_regon/index.md +1 -1
- package/dist/agentic/guides/modules/inbox_ops/index.md +1 -1
- package/dist/agentic/guides/modules/integrations/index.md +1 -1
- package/dist/agentic/guides/modules/ledger/index.md +1 -1
- package/dist/agentic/guides/modules/maintenance/index.md +1 -1
- package/dist/agentic/guides/modules/messages/index.md +1 -1
- package/dist/agentic/guides/modules/notifications/index.md +1 -1
- package/dist/agentic/guides/modules/onboarding/index.md +1 -1
- package/dist/agentic/guides/modules/payment_gateways/exact-override-targets.md +1 -1
- package/dist/agentic/guides/modules/payment_gateways/index.md +1 -1
- package/dist/agentic/guides/modules/payment_gateways/workers.md +1 -1
- package/dist/agentic/guides/modules/perspectives/index.md +1 -1
- package/dist/agentic/guides/modules/phone_calls/index.md +1 -1
- package/dist/agentic/guides/modules/planner/index.md +1 -1
- package/dist/agentic/guides/modules/portal/index.md +1 -1
- package/dist/agentic/guides/modules/progress/index.md +1 -1
- package/dist/agentic/guides/modules/promotions/index.md +1 -1
- package/dist/agentic/guides/modules/push_notifications/index.md +1 -1
- package/dist/agentic/guides/modules/query_index/index.md +1 -1
- package/dist/agentic/guides/modules/record_locks/index.md +1 -1
- package/dist/agentic/guides/modules/resources/index.md +1 -1
- package/dist/agentic/guides/modules/sales/exact-override-targets.md +4 -4
- package/dist/agentic/guides/modules/sales/index.md +1 -1
- package/dist/agentic/guides/modules/sales/setup.md +1 -1
- package/dist/agentic/guides/modules/sales_invoices_gl_posting/index.md +1 -1
- package/dist/agentic/guides/modules/scheduler/di-registrations-rich.md +3 -3
- package/dist/agentic/guides/modules/scheduler/di-service-tokens.md +3 -3
- package/dist/agentic/guides/modules/scheduler/exact-override-targets.md +4 -9
- package/dist/agentic/guides/modules/scheduler/index.md +3 -4
- package/dist/agentic/guides/modules/scheduler/workers.md +1 -1
- package/dist/agentic/guides/modules/search/di-registrations-rich.md +4 -4
- package/dist/agentic/guides/modules/search/di-service-tokens.md +13 -0
- package/dist/agentic/guides/modules/search/exact-override-targets.md +4 -4
- package/dist/agentic/guides/modules/search/index.md +3 -2
- package/dist/agentic/guides/modules/security/index.md +1 -1
- package/dist/agentic/guides/modules/seeds/index.md +1 -1
- package/dist/agentic/guides/modules/shipping_carriers/index.md +1 -1
- package/dist/agentic/guides/modules/sso/index.md +1 -1
- package/dist/agentic/guides/modules/staff/index.md +1 -1
- package/dist/agentic/guides/modules/storage_s3/index.md +1 -1
- package/dist/agentic/guides/modules/sync_akeneo/index.md +1 -1
- package/dist/agentic/guides/modules/sync_excel/index.md +1 -1
- package/dist/agentic/guides/modules/sync_shopify/index.md +1 -1
- package/dist/agentic/guides/modules/system_status_overlays/index.md +1 -1
- package/dist/agentic/guides/modules/telemetry/index.md +1 -1
- package/dist/agentic/guides/modules/tenant_boundaries/generator-plugins.md +11 -0
- package/dist/agentic/guides/modules/tenant_boundaries/index.md +13 -0
- package/dist/agentic/guides/modules/tenant_boundaries/owned-contract-module-metadata.md +11 -0
- package/dist/agentic/guides/modules/tillio/index.md +1 -1
- package/dist/agentic/guides/modules/translations/index.md +1 -1
- package/dist/agentic/guides/modules/upgrade_actions/index.md +1 -1
- package/dist/agentic/guides/modules/warranty_claims/index.md +1 -1
- package/dist/agentic/guides/modules/webhooks/index.md +1 -1
- package/dist/agentic/guides/modules/wms/index.md +1 -1
- package/dist/agentic/guides/modules/workflows/index.md +1 -1
- package/dist/agentic/guides/reference-module-facts.json +2 -2
- package/dist/agentic/guides/reference-modules/example/index.md +1 -1
- package/dist/agentic/guides/upstream/manifest.json +1 -1
- package/dist/agentic/shared/AGENTS.md.template +3 -3
- package/dist/agentic/shared/ai/harness/cases.json +4 -4
- package/dist/bin.js +6 -3
- package/dist/bin.js.map +2 -2
- package/dist/i18n/de.json +5 -1
- package/dist/i18n/en.json +5 -1
- package/dist/i18n/es.json +5 -1
- package/dist/i18n/ko.json +5 -1
- package/dist/i18n/pl.json +5 -1
- package/dist/lib/cli-bootstrap-mode.js +10 -1
- package/dist/lib/cli-bootstrap-mode.js.map +2 -2
- package/dist/lib/db/commands.js +18 -3
- package/dist/lib/db/commands.js.map +2 -2
- package/dist/lib/db/maintenance-client.js +72 -0
- package/dist/lib/db/maintenance-client.js.map +7 -0
- package/dist/lib/generate-watch-structure.js +2 -1
- package/dist/lib/generate-watch-structure.js.map +2 -2
- package/dist/lib/generators/database-declarations.js +21 -0
- package/dist/lib/generators/database-declarations.js.map +7 -0
- package/dist/lib/generators/module-registry.js +19 -3
- package/dist/lib/generators/module-registry.js.map +2 -2
- package/dist/lib/init-existing-database.js +91 -1
- package/dist/lib/init-existing-database.js.map +2 -2
- package/dist/lib/init-i18n.js +13 -0
- package/dist/lib/init-i18n.js.map +7 -0
- package/dist/lib/init-secrets.js +2 -10
- package/dist/lib/init-secrets.js.map +2 -2
- package/dist/lib/scheduler-supervisor.js +47 -7
- package/dist/lib/scheduler-supervisor.js.map +2 -2
- package/dist/lib/server-start-lock.js +120 -21
- package/dist/lib/server-start-lock.js.map +2 -2
- package/dist/lib/worker-job-handler.js +36 -26
- package/dist/lib/worker-job-handler.js.map +2 -2
- package/dist/mercato.js +93 -54
- package/dist/mercato.js.map +3 -3
- package/package.json +7 -7
- package/src/__tests__/mercato.test.ts +166 -9
- package/src/bin.ts +10 -4
- package/src/i18n/de.json +5 -1
- package/src/i18n/en.json +5 -1
- package/src/i18n/es.json +5 -1
- package/src/i18n/ko.json +5 -1
- package/src/i18n/pl.json +5 -1
- package/src/lib/__tests__/cli-bootstrap-mode.test.ts +76 -1
- package/src/lib/__tests__/generate-watch-structure.test.ts +26 -0
- package/src/lib/__tests__/rotation-kms-warning-presentation.test.ts +1 -1
- package/src/lib/__tests__/scheduler-supervisor.test.ts +107 -0
- package/src/lib/__tests__/server-start-lock.test.ts +400 -0
- package/src/lib/__tests__/worker-job-handler.database.test.ts +76 -0
- package/src/lib/cli-bootstrap-mode.ts +12 -2
- package/src/lib/db/__tests__/commands.migrate-reindex.test.ts +72 -1
- package/src/lib/db/__tests__/maintenance-client.test.ts +70 -0
- package/src/lib/db/commands.ts +20 -6
- package/src/lib/db/maintenance-client.ts +54 -0
- package/src/lib/generate-watch-structure.ts +2 -1
- package/src/lib/generators/__tests__/database-declarations.test.ts +69 -0
- package/src/lib/generators/__tests__/incremental-registry.test.ts +1 -1
- package/src/lib/generators/__tests__/module-subset.test.ts +17 -1
- package/src/lib/generators/database-declarations.ts +19 -0
- package/src/lib/generators/module-registry.ts +23 -4
- package/src/lib/init-existing-database.ts +107 -0
- package/src/lib/init-i18n.ts +11 -0
- package/src/lib/init-secrets.ts +2 -12
- package/src/lib/scheduler-supervisor.ts +40 -7
- package/src/lib/server-start-lock.ts +170 -19
- package/src/lib/worker-job-handler.ts +39 -28
- package/src/mercato.ts +92 -53
- package/dist/agentic/guides/modules/scheduler/cli-commands.md +0 -15
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
import { Client, Pool } from "pg";
|
|
3
|
+
import { configureDatabasePool, isDatabaseRuntimeEnabled, resolveDatabaseConnectionUrl, runWithFreshDatabaseExecutionContext } from "@open-mercato/shared/lib/db/runtime";
|
|
4
|
+
import { getSslConfig } from "@open-mercato/shared/lib/db/ssl";
|
|
5
|
+
async function createCliMaintenanceClient(connectionString, options) {
|
|
6
|
+
if (!isDatabaseRuntimeEnabled()) {
|
|
7
|
+
const client = new Client({ connectionString, ssl: getSslConfig(), ...options?.pinned ? { keepAlive: true } : {} });
|
|
8
|
+
if (options?.pinned) client.on("error", () => void 0);
|
|
9
|
+
return client;
|
|
10
|
+
}
|
|
11
|
+
if (!connectionString) throw new Error("[internal] Database maintenance requires a configured connection");
|
|
12
|
+
const pool = new Pool({ connectionString: resolveDatabaseConnectionUrl("maintenance", connectionString), ssl: getSslConfig(), max: 1, connectionTimeoutMillis: 5e3, statement_timeout: 3e4, ...options?.pinned ? { keepAlive: true } : {} });
|
|
13
|
+
const lifecycle = await (async () => {
|
|
14
|
+
try {
|
|
15
|
+
return configureDatabasePool(pool, { id: "cli.maintenance", purpose: "maintenance", tables: [] });
|
|
16
|
+
} catch (error) {
|
|
17
|
+
await pool.end();
|
|
18
|
+
throw error;
|
|
19
|
+
}
|
|
20
|
+
})();
|
|
21
|
+
const invoke = (callback) => runWithFreshDatabaseExecutionContext({ kind: "maintenance", tenantId: null, source: "cli", operation: "database-maintenance" }, callback);
|
|
22
|
+
const end = async () => {
|
|
23
|
+
try {
|
|
24
|
+
await pool.end();
|
|
25
|
+
} finally {
|
|
26
|
+
lifecycle.dispose();
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
if (options?.pinned) {
|
|
30
|
+
const connection = Promise.withResolvers();
|
|
31
|
+
const closed = Promise.withResolvers();
|
|
32
|
+
let lease;
|
|
33
|
+
return {
|
|
34
|
+
connect: async () => {
|
|
35
|
+
lease ??= invoke(async () => {
|
|
36
|
+
await lifecycle.ready();
|
|
37
|
+
const client = await pool.connect();
|
|
38
|
+
const runInOwnerScope = AsyncLocalStorage.snapshot();
|
|
39
|
+
try {
|
|
40
|
+
client.on("error", () => void 0);
|
|
41
|
+
connection.resolve(((...args) => runInOwnerScope(() => Reflect.apply(client.query, client, args))));
|
|
42
|
+
await closed.promise;
|
|
43
|
+
} finally {
|
|
44
|
+
client.release(true);
|
|
45
|
+
}
|
|
46
|
+
}).catch(connection.reject);
|
|
47
|
+
await connection.promise;
|
|
48
|
+
},
|
|
49
|
+
query: (async (...args) => Reflect.apply(await connection.promise, void 0, args)),
|
|
50
|
+
end: async () => {
|
|
51
|
+
closed.resolve();
|
|
52
|
+
try {
|
|
53
|
+
await lease;
|
|
54
|
+
} finally {
|
|
55
|
+
await end();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
return {
|
|
61
|
+
connect: () => invoke(() => lifecycle.ready()),
|
|
62
|
+
query: ((...arguments_) => invoke(async () => {
|
|
63
|
+
await lifecycle.ready();
|
|
64
|
+
return Reflect.apply(pool.query, pool, arguments_);
|
|
65
|
+
})),
|
|
66
|
+
end
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
export {
|
|
70
|
+
createCliMaintenanceClient
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=maintenance-client.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/lib/db/maintenance-client.ts"],
|
|
4
|
+
"sourcesContent": ["import { AsyncLocalStorage } from 'node:async_hooks'\nimport { Client, Pool } from 'pg'\nimport { configureDatabasePool, isDatabaseRuntimeEnabled, resolveDatabaseConnectionUrl, runWithFreshDatabaseExecutionContext } from '@open-mercato/shared/lib/db/runtime'\nimport { getSslConfig } from '@open-mercato/shared/lib/db/ssl'\n\nexport async function createCliMaintenanceClient(connectionString: string | undefined, options?: { pinned?: boolean }) {\n if (!isDatabaseRuntimeEnabled()) {\n const client = new Client({ connectionString, ssl: getSslConfig(), ...(options?.pinned ? { keepAlive: true } : {}) })\n if (options?.pinned) client.on('error', () => undefined)\n return client\n }\n if (!connectionString) throw new Error('[internal] Database maintenance requires a configured connection')\n const pool = new Pool({ connectionString: resolveDatabaseConnectionUrl('maintenance', connectionString), ssl: getSslConfig(), max: 1, connectionTimeoutMillis: 5_000, statement_timeout: 30_000, ...(options?.pinned ? { keepAlive: true } : {}) })\n const lifecycle = await (async () => {\n try { return configureDatabasePool(pool, { id: 'cli.maintenance', purpose: 'maintenance', tables: [] }) } catch (error) { await pool.end(); throw error }\n })()\n const invoke = <Result>(callback: () => Promise<Result>) => runWithFreshDatabaseExecutionContext({ kind: 'maintenance', tenantId: null, source: 'cli', operation: 'database-maintenance' }, callback)\n const end = async () => { try { await pool.end() } finally { lifecycle.dispose() } }\n if (options?.pinned) {\n const connection = Promise.withResolvers<Pool['query']>()\n const closed = Promise.withResolvers<void>()\n let lease: Promise<void> | undefined\n return {\n connect: async () => {\n lease ??= invoke(async () => {\n await lifecycle.ready()\n const client = await pool.connect()\n const runInOwnerScope = AsyncLocalStorage.snapshot()\n try {\n client.on('error', () => undefined)\n connection.resolve(((...args: unknown[]) => runInOwnerScope(() => Reflect.apply(client.query, client, args))) as Pool['query'])\n await closed.promise\n } finally {\n client.release(true)\n }\n }).catch(connection.reject)\n await connection.promise\n },\n query: (async (...args: unknown[]) => Reflect.apply(await connection.promise, undefined, args)) as Pool['query'],\n end: async () => {\n closed.resolve()\n try { await lease } finally { await end() }\n },\n }\n }\n return {\n connect: () => invoke(() => lifecycle.ready()),\n query: ((...arguments_: unknown[]) => invoke(async () => {\n await lifecycle.ready()\n return Reflect.apply(pool.query, pool, arguments_)\n })) as Pool['query'],\n end,\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,yBAAyB;AAClC,SAAS,QAAQ,YAAY;AAC7B,SAAS,uBAAuB,0BAA0B,8BAA8B,4CAA4C;AACpI,SAAS,oBAAoB;AAE7B,eAAsB,2BAA2B,kBAAsC,SAAgC;AACrH,MAAI,CAAC,yBAAyB,GAAG;AAC/B,UAAM,SAAS,IAAI,OAAO,EAAE,kBAAkB,KAAK,aAAa,GAAG,GAAI,SAAS,SAAS,EAAE,WAAW,KAAK,IAAI,CAAC,EAAG,CAAC;AACpH,QAAI,SAAS,OAAQ,QAAO,GAAG,SAAS,MAAM,MAAS;AACvD,WAAO;AAAA,EACT;AACA,MAAI,CAAC,iBAAkB,OAAM,IAAI,MAAM,kEAAkE;AACzG,QAAM,OAAO,IAAI,KAAK,EAAE,kBAAkB,6BAA6B,eAAe,gBAAgB,GAAG,KAAK,aAAa,GAAG,KAAK,GAAG,yBAAyB,KAAO,mBAAmB,KAAQ,GAAI,SAAS,SAAS,EAAE,WAAW,KAAK,IAAI,CAAC,EAAG,CAAC;AAClP,QAAM,YAAY,OAAO,YAAY;AACnC,QAAI;AAAE,aAAO,sBAAsB,MAAM,EAAE,IAAI,mBAAmB,SAAS,eAAe,QAAQ,CAAC,EAAE,CAAC;AAAA,IAAE,SAAS,OAAO;AAAE,YAAM,KAAK,IAAI;AAAG,Y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AU;AAAA,IACnD,CAAC;AAAA,IACD;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -2,6 +2,7 @@ import crypto from "node:crypto";
|
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import ts from "typescript-js";
|
|
5
|
+
import { databaseDeclarationsPlugin } from "./generators/database-declarations.js";
|
|
5
6
|
import {
|
|
6
7
|
MODULE_CODE_EXTENSIONS,
|
|
7
8
|
SCAN_CONFIGS,
|
|
@@ -533,7 +534,7 @@ function collectGenerateWatchStructureSnapshot(options, cache) {
|
|
|
533
534
|
const collector = new SnapshotCollector(cacheState);
|
|
534
535
|
for (const reason of options.webResearchAdapterFullReasons ?? []) collector.fullReasons.add(reason);
|
|
535
536
|
collector.file(`configuration:${options.modulesFile}`, options.modulesFile, { category: "configuration" });
|
|
536
|
-
const plugins = /* @__PURE__ */ new Set();
|
|
537
|
+
const plugins = /* @__PURE__ */ new Set([databaseDeclarationsPlugin.conventionFile]);
|
|
537
538
|
options.moduleRoots.forEach((roots, index) => addModule(collector, roots, index, plugins));
|
|
538
539
|
options.moduleRoots.forEach((roots, index) => {
|
|
539
540
|
const identity = `module:${index}:${roots.moduleId ?? path.basename(roots.appBase)}:${roots.appBase}:${roots.pkgBase}`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/lib/generate-watch-structure.ts"],
|
|
4
|
-
"sourcesContent": ["import crypto from 'node:crypto'\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport ts from 'typescript-js'\nimport {\n MODULE_CODE_EXTENSIONS,\n SCAN_CONFIGS,\n resolveStandaloneSourceMirrorBase,\n scanModuleDir,\n stripModuleCodeExtension,\n type ModuleRoots,\n type ScanConfig,\n type ScannedFile,\n} from './generators/scanner'\nimport type {\n GenerateWatchCategory, GenerateWatchChange, GenerateWatchRecord, GenerateWatchSnapshot,\n} from './generate-watch-plan'\n\ntype InputKind = { category: GenerateWatchCategory; extensionId?: string }\ntype WatchRoots = ModuleRoots & { moduleId?: string; from?: string }\nexport type GenerateWatchStructureOptions = {\n modulesFile: string\n moduleRoots: WatchRoots[]\n /** Dependency/configuration inputs whose changes require a conservative full generation. */\n additionalInputs?: string[]\n /** Inputs consumed specifically by OpenAPI generation. */\n openapiInputs?: string[]\n cacheProviderInputs?: string[]\n /** Candidate package manifests consumed specifically by web-research adapter discovery. */\n webResearchAdapterInputs?: string[]\n /** Adapter discovery failures that make this capture non-authoritative. */\n webResearchAdapterFullReasons?: readonly string[]\n}\n\n/**\n * Facts derived from one stat identity of a tracked file. Source text and parsed\n * ASTs are capture-local; only these small extracted values outlive a capture.\n */\ntype CachedStructureFile = {\n identity: string\n fingerprint: string\n parseFailed?: true\n pageFingerprint?: string | null\n imports?: { specifiers: string[]; uncertain: boolean }\n pluginConventions?: string[] | null\n supervisorOverride?: boolean\n}\n\ntype GenerateWatchStructureCacheState = {\n files: Map<string, CachedStructureFile>\n}\n\ndeclare const generateWatchStructureCacheBrand: unique symbol\nexport type GenerateWatchStructureCache = {\n readonly [generateWatchStructureCacheBrand]: true\n}\n\nconst cacheStates = new WeakMap<GenerateWatchStructureCache, GenerateWatchStructureCacheState>()\n\nexport function createGenerateWatchStructureCache(): GenerateWatchStructureCache {\n const cache = {} as GenerateWatchStructureCache\n cacheStates.set(cache, { files: new Map() })\n return cache\n}\n\nconst REGISTRY_CONVENTIONS = [\n 'index', 'acl', 'setup', 'runtime', 'encryption', 'ce', 'integration', 'vector',\n 'data/extensions', 'data/fields',\n]\nconst EXTENSION_CONVENTIONS: Readonly<Record<string, string>> = {\n notifications: 'registry.notifications',\n 'notifications.client': 'registry.notifications',\n 'notifications.handlers': 'registry.notifications',\n 'message-types': 'registry.messages',\n 'message-objects': 'registry.messages',\n 'ai-tools': 'registry.ai-tools',\n 'ai-agents': 'registry.ai-agents',\n analytics: 'registry.analytics',\n translations: 'registry.translatable-fields',\n workflows: 'registry.workflows',\n 'inbox-actions': 'registry.inbox-actions',\n 'data/enrichers': 'registry.enrichers',\n 'data/guards': 'registry.guards',\n 'api/interceptors': 'registry.interceptors',\n 'commands/interceptors': 'registry.command-interceptors',\n 'widgets/components': 'registry.component-overrides',\n 'frontend/middleware': 'registry.page-middleware',\n 'backend/middleware': 'registry.page-middleware',\n}\n\n// These two policies mirror the registry's command/legacy-API scans; all other\n// directory discovery is shared with the generator through SCAN_CONFIGS.\nconst COMMAND_SCAN_CONFIG: ScanConfig = {\n folder: 'commands',\n include: (name) => MODULE_CODE_EXTENSIONS.some((extension) => name.endsWith(extension))\n && !name.endsWith('.d.ts') && !/\\.(test|spec)\\.[jt]sx?$/.test(name)\n && !['index', 'shared', 'factory'].includes(stripModuleCodeExtension(name)),\n}\nconst LEGACY_API_SCAN_CONFIGS: ScanConfig[] = ['get', 'post', 'put', 'patch', 'delete'].map((method) => ({\n folder: `api/${method}`,\n include: (name) => /\\.[jt]s$/.test(name) && !/\\.(test|spec)\\.[jt]s$/.test(name),\n}))\n\nfunction checksum(value: string): string {\n return crypto.createHash('md5').update(value).digest('hex')\n}\n\nfunction isMissing(error: unknown): boolean {\n return typeof error === 'object' && error !== null && 'code' in error\n && (error.code === 'ENOENT' || error.code === 'ENOTDIR')\n}\n\nfunction unwrap(node: ts.Expression): ts.Expression {\n while (ts.isParenthesizedExpression(node) || ts.isAsExpression(node)\n || ts.isTypeAssertionExpression(node) || ts.isSatisfiesExpression(node)) node = node.expression\n return node\n}\n\n/** Read only static declaration data; never execute a plugin to watch it. */\nfunction pluginConventions(file: ts.SourceFile): string[] | null {\n const declarations = new Map<string, ts.Expression>()\n let exported: ts.Expression | undefined\n for (const statement of file.statements) {\n if (ts.isVariableStatement(statement)) {\n for (const declaration of statement.declarationList.declarations) {\n if (ts.isIdentifier(declaration.name) && declaration.initializer) {\n declarations.set(declaration.name.text, declaration.initializer)\n if (declaration.name.text === 'generatorPlugins'\n && statement.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword)) {\n exported = declaration.initializer\n }\n }\n }\n } else if (ts.isExportAssignment(statement)) {\n exported ??= statement.expression\n } else if (ts.isImportDeclaration(statement)) {\n if (!statement.importClause?.isTypeOnly) return null\n } else if (!ts.isFunctionDeclaration(statement) && !ts.isInterfaceDeclaration(statement)\n && !ts.isTypeAliasDeclaration(statement) && !ts.isEmptyStatement(statement)) return null\n }\n if (!exported) return null\n const resolve = (expression: ts.Expression, seen = new Set<string>()): ts.Expression | null => {\n const node = unwrap(expression)\n if (!ts.isIdentifier(node)) return node\n if (seen.has(node.text)) return null\n seen.add(node.text)\n const value = declarations.get(node.text)\n return value ? resolve(value, seen) : null\n }\n const plugins = resolve(exported)\n if (!plugins || !ts.isArrayLiteralExpression(plugins)) return null\n const conventions: string[] = []\n for (const element of plugins.elements) {\n const plugin = resolve(element)\n if (!plugin || !ts.isObjectLiteralExpression(plugin)) return null\n let convention: string | undefined\n for (const property of plugin.properties) {\n if (ts.isSpreadAssignment(property) || ts.isComputedPropertyName(property.name)) return null\n if (property.name.getText(file).replace(/^['\"]|['\"]$/g, '') !== 'conventionFile') continue\n const value = ts.isPropertyAssignment(property) ? resolve(property.initializer) : null\n if (!value || !ts.isStringLiteralLike(value)) return null\n convention = value.text\n }\n if (!convention) return null\n conventions.push(convention)\n }\n return conventions\n}\n\n/** `null` when the page exports metadata (content fingerprint applies); otherwise its default-export marker. */\nfunction pageFingerprint(parsed: ts.SourceFile): string | null {\n const metadata = parsed.statements.some((statement) => {\n if (ts.isExportDeclaration(statement)) {\n return !statement.exportClause || (ts.isNamedExports(statement.exportClause)\n && statement.exportClause.elements.some((element) => element.name.text === 'metadata'))\n }\n if (!ts.canHaveModifiers(statement)\n || !ts.getModifiers(statement)?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword)) return false\n if (ts.isVariableStatement(statement)) {\n return statement.declarationList.declarations.some((declaration) => /\\bmetadata\\b/.test(declaration.name.getText(parsed)))\n }\n return (ts.isFunctionDeclaration(statement) || ts.isClassDeclaration(statement)) && statement.name?.text === 'metadata'\n })\n if (metadata) return null\n const hasDefault = parsed.statements.some((statement) =>\n (ts.isExportAssignment(statement) && !statement.isExportEquals)\n || (ts.canHaveModifiers(statement) && ts.getModifiers(statement)?.some((modifier) => modifier.kind === ts.SyntaxKind.DefaultKeyword))\n || (ts.isExportDeclaration(statement) && statement.exportClause && ts.isNamedExports(statement.exportClause)\n && statement.exportClause.elements.some((element) => element.name.text === 'default')),\n )\n return `page:default:${hasDefault}`\n}\n\nconst SUPERVISOR_OVERRIDE_CALLS = ['applyWorkerOverrides', 'applyCliOverrides']\n\nfunction declaresSupervisorOverride(parsed: ts.SourceFile): boolean {\n const direct = new Set<string>()\n const namespaces = new Set<string>()\n for (const statement of parsed.statements) {\n if (!ts.isImportDeclaration(statement) || !ts.isStringLiteralLike(statement.moduleSpecifier)\n || statement.moduleSpecifier.text !== '@open-mercato/shared/modules/overrides') continue\n const bindings = statement.importClause?.namedBindings\n if (bindings && ts.isNamespaceImport(bindings)) namespaces.add(bindings.name.text)\n if (bindings && ts.isNamedImports(bindings)) {\n for (const element of bindings.elements) {\n if (SUPERVISOR_OVERRIDE_CALLS.includes(element.propertyName?.text ?? element.name.text)) direct.add(element.name.text)\n }\n }\n }\n let found = false\n const visit = (node: ts.Node): void => {\n if (ts.isCallExpression(node)) {\n const expression = node.expression\n if (ts.isIdentifier(expression) && direct.has(expression.text)) found = true\n if (ts.isPropertyAccessExpression(expression) && ts.isIdentifier(expression.expression)\n && namespaces.has(expression.expression.text)\n && SUPERVISOR_OVERRIDE_CALLS.includes(expression.name.text)) found = true\n }\n if (!found) ts.forEachChild(node, visit)\n }\n visit(parsed)\n return found\n}\n\n/** Module specifiers evaluated at load time; `uncertain` marks a non-literal import()/require(). */\nfunction staticImports(parsed: ts.SourceFile): { specifiers: string[]; uncertain: boolean } {\n const specifiers: string[] = []\n let uncertain = false\n const visit = (node: ts.Node): void => {\n // Handler/component bodies are not evaluated to discover registrations.\n // Static imports are still tracked, including imports used by metadata.\n if (ts.isFunctionLike(node)) return\n if (ts.isImportDeclaration(node)) {\n if (node.importClause?.isTypeOnly) return\n const bindings = node.importClause?.namedBindings\n if (!node.importClause?.name && bindings && ts.isNamedImports(bindings)\n && bindings.elements.length > 0 && bindings.elements.every((element) => element.isTypeOnly)) return\n if (ts.isStringLiteralLike(node.moduleSpecifier)) specifiers.push(node.moduleSpecifier.text)\n return\n }\n if (ts.isExportDeclaration(node) && !node.isTypeOnly && node.moduleSpecifier\n && ts.isStringLiteralLike(node.moduleSpecifier)) specifiers.push(node.moduleSpecifier.text)\n if (ts.isCallExpression(node) && (node.expression.kind === ts.SyntaxKind.ImportKeyword\n || (ts.isIdentifier(node.expression) && node.expression.text === 'require'))) {\n const argument = node.arguments[0]\n if (argument && ts.isStringLiteralLike(argument)) specifiers.push(argument.text)\n else uncertain = true\n }\n ts.forEachChild(node, visit)\n }\n visit(parsed)\n return { specifiers, uncertain }\n}\n\nclass SnapshotCollector {\n readonly records = new Map<string, GenerateWatchRecord>()\n readonly fullReasons = new Set<string>()\n private readonly stats = new Map<string, fs.Stats | null>()\n private readonly identities = new Map<string, string | null>()\n readonly uncertainDependencies = new Set<string>()\n readonly uncertainPluginDescriptors = new Set<string>()\n private readonly dependencySeeds = new Map<string, Map<string, InputKind>>()\n readonly inspectedCachePaths = new Set<string>()\n private readonly sources = new Map<string, string>()\n private readonly parsedFiles = new Map<string, ts.SourceFile>()\n\n constructor(private readonly cache: GenerateWatchStructureCacheState) {}\n\n private identity(file: string): string | null {\n if (!this.identities.has(file)) this.stat(file)\n return this.identities.get(file) ?? null\n }\n\n private seedDependency(file: string, kind: InputKind): void {\n const identity = `${kind.category}:${kind.extensionId ?? ''}`\n const kinds = this.dependencySeeds.get(file) ?? new Map<string, InputKind>()\n kinds.set(identity, kind)\n this.dependencySeeds.set(file, kinds)\n }\n\n stat(file: string): fs.Stats | null {\n if (this.stats.has(file)) return this.stats.get(file) ?? null\n try {\n const stat = fs.statSync(file)\n const identity = [stat.dev, stat.ino, stat.size, stat.mtimeMs, stat.ctimeMs].join(':')\n this.stats.set(file, stat)\n this.identities.set(file, identity)\n return stat\n } catch (error) {\n if (!isMissing(error)) this.fullReasons.add(`Cannot inspect generator input: ${file}`)\n this.stats.set(file, null)\n this.identities.set(file, null)\n return null\n }\n }\n\n /** Stat-keyed cache entry for a readable file; unchanged identities are never re-read. */\n entry(file: string): CachedStructureFile | null {\n const stat = this.stat(file)\n const identity = this.identity(file)\n if (!stat?.isFile() || !identity) {\n this.fullReasons.add(`Cannot read generator input: ${file}`)\n return null\n }\n this.inspectedCachePaths.add(file)\n const cached = this.cache.files.get(file)\n if (cached?.identity === identity) return cached\n const source = this.readSource(file)\n if (source === null) return null\n const entry: CachedStructureFile = { identity, fingerprint: checksum(source) }\n this.cache.files.set(file, entry)\n return entry\n }\n\n private readSource(file: string): string | null {\n const known = this.sources.get(file)\n if (known !== undefined) return known\n try {\n const source = fs.readFileSync(file, 'utf8')\n this.sources.set(file, source)\n return source\n } catch {\n this.fullReasons.add(`Cannot read generator input: ${file}`)\n return null\n }\n }\n\n /** Capture-local AST for a file whose cached facts are missing; parse failures are cached per identity. */\n parsed(file: string, entry: CachedStructureFile): ts.SourceFile | null {\n if (entry.parseFailed) {\n this.fullReasons.add(`Cannot parse generator input: ${file}`)\n return null\n }\n const known = this.parsedFiles.get(file)\n if (known) return known\n const source = this.readSource(file)\n if (source === null) return null\n let parsed: ts.SourceFile\n try {\n parsed = ts.createSourceFile(file, source, ts.ScriptTarget.Latest, true)\n } catch {\n this.fullReasons.add(`Cannot parse generator input: ${file}`)\n return null\n }\n const diagnostics = (parsed as ts.SourceFile & { parseDiagnostics?: readonly ts.Diagnostic[] }).parseDiagnostics\n if (diagnostics?.length) {\n entry.parseFailed = true\n this.fullReasons.add(`Cannot parse generator input: ${file}`)\n return null\n }\n this.parsedFiles.set(file, parsed)\n return parsed\n }\n\n record(key: string, file: string, kind: InputKind, fingerprint: string): void {\n this.records.set(key, { key, path: file, ...kind, fingerprint })\n }\n\n file(key: string, file: string, kind: InputKind, mode: 'content' | 'page' | 'membership' | 'stat' = 'content'): void {\n if (!this.stat(file)?.isFile()) return\n if (mode === 'membership') {\n this.record(key, file, kind, 'present')\n return\n }\n if (mode === 'stat') {\n this.record(key, file, kind, this.identity(file) ?? 'present')\n return\n }\n const entry = this.entry(file)\n if (!entry) {\n this.record(key, file, kind, 'unreadable')\n return\n }\n if (mode === 'page') {\n if (entry.pageFingerprint === undefined) {\n const parsed = this.parsed(file, entry)\n if (!parsed) {\n this.record(key, file, kind, 'unparseable')\n return\n }\n entry.pageFingerprint = pageFingerprint(parsed)\n }\n if (entry.pageFingerprint !== null) {\n this.record(key, file, kind, entry.pageFingerprint)\n return\n }\n }\n this.record(key, file, kind, entry.fingerprint)\n if (/\\.[cm]?[jt]sx?$/.test(file)) this.seedDependency(file, kind)\n }\n\n codeFile(base: string, relativePath: string): string | null {\n const stripped = stripModuleCodeExtension(relativePath)\n const candidates = [relativePath, ...MODULE_CODE_EXTENSIONS.map((extension) => `${stripped}${extension}`)]\n for (const candidate of candidates) {\n const file = path.join(base, candidate)\n if (this.stat(file)?.isFile()) return file\n }\n return null\n }\n\n scan(roots: ModuleRoots, config: ScanConfig): ScannedFile[] {\n try {\n return scanModuleDir(roots, config)\n } catch {\n this.fullReasons.add(`Cannot scan generator inputs: ${roots.appBase}, ${roots.pkgBase}/${config.folder}`)\n return []\n }\n }\n\n entries(directory: string): fs.Dirent[] {\n if (!this.stat(directory)?.isDirectory()) return []\n try {\n return fs.readdirSync(directory, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))\n } catch {\n this.fullReasons.add(`Cannot scan generator inputs: ${directory}`)\n return []\n }\n }\n\n pair(identity: string, roots: ModuleRoots, relativePath: string, kind: InputKind, mode: 'content' | 'page' = 'content'): string[] {\n const sourceBase = resolveStandaloneSourceMirrorBase(roots.pkgBase) ?? roots.pkgBase\n const app = this.codeFile(roots.appBase, relativePath)\n const source = app ?? this.codeFile(sourceBase, relativePath)\n // Conventions retain stale compiled inputs after source deletion. Directory\n // scans still enumerate only the authoritative source mirror before pairing.\n const runtime = !app && sourceBase !== roots.pkgBase\n ? this.codeFile(roots.pkgBase, stripModuleCodeExtension(relativePath))\n : source\n const primary = source ?? runtime\n if (!primary) return []\n const logical = stripModuleCodeExtension(relativePath).replace(/\\\\/g, '/')\n const key = `${identity}:${kind.category}:${kind.extensionId ?? ''}:${logical}`\n if (source) this.file(`${key}:source`, source, kind, mode)\n if (runtime && runtime !== source) this.file(`${key}:runtime`, runtime, kind, mode)\n // Physical ownership is part of the fingerprint even for identical bytes.\n this.record(`${key}:authority`, primary, kind, JSON.stringify([source, runtime]))\n return source && runtime && runtime !== source ? [source, runtime] : [primary]\n }\n\n tree(identity: string, directory: string, kind: InputKind, skipTests = true): void {\n for (const entry of this.entries(directory)) {\n if (skipTests && (entry.name === '__tests__' || entry.name === '__mocks__')) continue\n const file = path.join(directory, entry.name)\n if (entry.isDirectory()) this.tree(identity, file, kind, skipTests)\n else if (entry.isFile()) this.file(`${identity}:${file}`, file, kind)\n }\n }\n\n supervisor(appSource: string): void {\n const pending = [appSource]\n let found = false\n while (pending.length > 0 && !found) {\n const directory = pending.pop()!\n for (const entry of this.entries(directory)) {\n const file = path.join(directory, entry.name)\n if (entry.isDirectory()) {\n if (entry.name !== '__tests__' && entry.name !== 'node_modules') pending.push(file)\n continue\n }\n if (!/\\.[cm]?tsx?$/.test(entry.name) || /(?:^|\\.)test\\.[cm]?tsx?$/.test(entry.name)) continue\n const cached = this.entry(file)\n if (!cached) continue\n if (cached.supervisorOverride === undefined) {\n if (!this.readSource(file)?.includes('@open-mercato/shared/modules/overrides')) {\n cached.supervisorOverride = false\n continue\n }\n const parsed = this.parsed(file, cached)\n if (!parsed) continue\n cached.supervisorOverride = declaresSupervisorOverride(parsed)\n }\n if (cached.supervisorOverride) {\n found = true\n break\n }\n }\n }\n this.record('supervisor-overrides', appSource, { category: 'registry-convention', extensionId: 'supervisor' }, String(found))\n }\n\n dependencies(appSource: string): void {\n const visited = new Set<string>()\n const pending = [...this.dependencySeeds]\n .flatMap(([file, kinds]) => [...kinds.entries()].map(([identity, kind]) => ({ file, identity, kind })))\n .sort((left, right) => right.file.localeCompare(left.file) || right.identity.localeCompare(left.identity))\n while (pending.length > 0) {\n const { file, identity, kind } = pending.pop()!\n const visitKey = `${identity}:${file}`\n if (visited.has(visitKey)) continue\n visited.add(visitKey)\n const cached = this.entry(file)\n if (!cached) continue\n if (!cached.imports) {\n const parsed = this.parsed(file, cached)\n if (!parsed) continue\n cached.imports = staticImports(parsed)\n }\n if (cached.imports.uncertain) this.uncertainDependencies.add(file)\n const imports = cached.imports.specifiers\n for (const specifier of imports) {\n if (!specifier.startsWith('.') && !specifier.startsWith('@/')) continue\n const target = specifier.startsWith('@/')\n ? path.join(appSource, specifier.slice(2)) : path.resolve(path.dirname(file), specifier)\n const resolved = this.codeFile(path.dirname(target), path.basename(target))\n ?? this.codeFile(target, 'index')\n const dependencyKey = `dependency:${identity}:${file}:${target}`\n if (!resolved) {\n // Keep an absence record so a newly supplied helper invalidates the plan.\n this.record(dependencyKey, target, kind, 'missing')\n continue\n }\n // A generator's own outputs must not feed back into its watcher baseline.\n if (resolved.includes(`${path.sep}.mercato${path.sep}`) || resolved.includes(`${path.sep}generated${path.sep}`)) continue\n const fingerprint = this.entry(resolved)?.fingerprint ?? 'unreadable'\n this.record(dependencyKey, resolved, kind, `${resolved}:${fingerprint}`)\n if (/\\.[cm]?[jt]sx?$/.test(resolved)) pending.push({ file: resolved, identity, kind })\n }\n }\n }\n}\n\nfunction addModule(collector: SnapshotCollector, roots: WatchRoots, index: number, plugins: Set<string>): void {\n const distMarker = `${path.sep}dist${path.sep}modules${path.sep}`\n const distIndex = roots.pkgBase.lastIndexOf(distMarker)\n if (distIndex >= 0) {\n const packageRoot = roots.pkgBase.slice(0, distIndex)\n collector.stat(path.join(packageRoot, 'src', 'modules', roots.pkgBase.slice(distIndex + distMarker.length)))\n }\n const sourceBase = resolveStandaloneSourceMirrorBase(roots.pkgBase) ?? roots.pkgBase\n const identity = `module:${index}:${roots.moduleId ?? path.basename(roots.appBase)}:${roots.appBase}:${roots.pkgBase}`\n collector.record(`${identity}:roots`, roots.appBase, { category: 'configuration' }, JSON.stringify([\n Object.entries(roots).sort(([left], [right]) => left.localeCompare(right)), sourceBase,\n collector.stat(roots.appBase)?.isDirectory() ?? false, collector.stat(roots.pkgBase)?.isDirectory() ?? false,\n ]))\n const convention = (relativePath: string, kind: InputKind) => collector.pair(identity, roots, `${relativePath}.ts`, kind)\n for (const relativePath of REGISTRY_CONVENTIONS) convention(relativePath, { category: 'registry-convention' })\n // Section definitions can change shared field sets, route manifests, and OpenAPI together.\n convention('form-sections', { category: 'configuration' })\n for (const [relativePath, extensionId] of Object.entries(EXTENSION_CONVENTIONS)) {\n convention(relativePath, { category: 'extension', extensionId })\n }\n collector.pair(identity, roots, 'widgets/payments/client.tsx', { category: 'extension', extensionId: 'registry.notifications' })\n for (const category of ['cli', 'di', 'search', 'events'] as const) convention(category, { category })\n convention('widgets/injection-table', { category: 'injection-widgets' })\n for (const descriptor of convention('generators', { category: 'generator-plugin' })) {\n const cached = collector.entry(descriptor)\n if (cached && cached.pluginConventions === undefined) {\n const parsed = collector.parsed(descriptor, cached)\n if (parsed) cached.pluginConventions = pluginConventions(parsed)\n }\n const discovered = cached?.pluginConventions ?? null\n if (discovered === null) collector.uncertainPluginDescriptors.add(descriptor)\n else for (const file of discovered) plugins.add(file)\n }\n\n // Entity generators use direct app/package candidates, including legacy db and\n // override/schema fallbacks, rather than resolveModuleFile's source authority.\n for (const base of new Set([roots.appBase, roots.pkgBase, sourceBase])) {\n for (const directory of ['data', 'db']) {\n for (const stem of ['entities.override', 'entities', 'schema']) {\n for (const extension of MODULE_CODE_EXTENSIONS) {\n const file = path.join(base, directory, `${stem}${extension}`)\n collector.file(`${identity}:entities:${file}`, file, { category: 'entities' })\n }\n }\n }\n }\n if (distIndex >= 0) {\n const packageRoot = roots.pkgBase.slice(0, distIndex)\n const direct = path.join(packageRoot, 'generated')\n collector.record(`${identity}:package-entities-direct-root`, direct, { category: 'entities' },\n collector.stat(direct)?.isDirectory() ? 'directory' : 'missing')\n const generated = collector.stat(direct)?.isDirectory() ? direct : path.join(packageRoot, 'dist', 'generated')\n collector.record(`${identity}:package-entities-root`, generated, { category: 'entities' }, generated)\n for (const extension of ['.ts', '.js']) {\n const ids = path.join(generated, `entities.ids.generated${extension}`)\n collector.file(`${identity}:package-entities:${ids}`, ids, { category: 'entities' })\n for (const entry of collector.entries(path.join(generated, 'entities'))) {\n if (!entry.isDirectory()) continue\n const fields = path.join(generated, 'entities', entry.name, `index${extension}`)\n collector.file(`${identity}:package-entities:${fields}`, fields, { category: 'entities' })\n }\n }\n }\n const scans: Array<[ScanConfig, GenerateWatchCategory]> = [\n [SCAN_CONFIGS.apiRoutes, 'api-route'], [SCAN_CONFIGS.apiPlainFiles, 'api-route'],\n ...LEGACY_API_SCAN_CONFIGS.map((config): [ScanConfig, GenerateWatchCategory] => [config, 'api-route']),\n [COMMAND_SCAN_CONFIG, 'commands'], [SCAN_CONFIGS.subscribers, 'subscribers'],\n [SCAN_CONFIGS.workers, 'workers'], [SCAN_CONFIGS.dashboardWidgets, 'dashboard-widgets'],\n [SCAN_CONFIGS.injectionWidgets, 'injection-widgets'],\n [SCAN_CONFIGS.frontendPages, 'frontend-page'], [SCAN_CONFIGS.backendPages, 'backend-page'],\n ]\n for (const [config, category] of scans) {\n for (const scanned of collector.scan(roots, config)) {\n const relativePath = `${config.folder}/${scanned.relPath}`\n // Exact conventions in route/page directories are not route registrations.\n if (EXTENSION_CONVENTIONS[stripModuleCodeExtension(relativePath)]) continue\n const page = category === 'frontend-page' || category === 'backend-page'\n const files = collector.pair(identity, roots, relativePath, { category }, page ? 'page' : 'content')\n if (!page) continue\n for (const file of files) {\n const stem = stripModuleCodeExtension(path.basename(file))\n for (const candidate of [stem === 'page' ? 'page.meta' : `${stem}.meta`, 'meta']) {\n const metadata = collector.codeFile(path.dirname(file), candidate)\n if (metadata) collector.file(`${identity}:${category}:metadata:${metadata}`, metadata, { category })\n }\n }\n }\n }\n for (const base of new Set([sourceBase, roots.appBase])) {\n const directory = path.join(base, 'i18n')\n for (const entry of collector.entries(directory)) {\n if (!entry.isFile() || !/^[a-zA-Z0-9][a-zA-Z0-9_-]*\\.json$/.test(entry.name)) continue\n const file = path.join(directory, entry.name)\n collector.file(`${identity}:i18n:${file}`, file, { category: 'i18n' }, 'membership')\n if (base === sourceBase && sourceBase !== roots.pkgBase) {\n const runtime = path.join(roots.pkgBase, 'i18n', entry.name)\n collector.file(`${identity}:i18n:runtime:${runtime}`, runtime, { category: 'i18n' }, 'membership')\n }\n }\n collector.tree(`${identity}:agents`, path.join(base, 'agents'), { category: 'extension', extensionId: 'registry.agent-files' })\n }\n}\n\nexport function collectGenerateWatchStructureSnapshot(\n options: GenerateWatchStructureOptions,\n cache?: GenerateWatchStructureCache,\n): GenerateWatchSnapshot {\n const cacheState = cache ? cacheStates.get(cache) : { files: new Map<string, CachedStructureFile>() }\n if (!cacheState) throw new TypeError('Invalid generate watch structure cache')\n const collector = new SnapshotCollector(cacheState)\n for (const reason of options.webResearchAdapterFullReasons ?? []) collector.fullReasons.add(reason)\n collector.file(`configuration:${options.modulesFile}`, options.modulesFile, { category: 'configuration' })\n const plugins = new Set<string>()\n options.moduleRoots.forEach((roots, index) => addModule(collector, roots, index, plugins))\n options.moduleRoots.forEach((roots, index) => {\n const identity = `module:${index}:${roots.moduleId ?? path.basename(roots.appBase)}:${roots.appBase}:${roots.pkgBase}`\n for (const relativePath of plugins) collector.pair(identity, roots, relativePath, { category: 'generator-plugin' })\n })\n const knownInputs = new Map<string, GenerateWatchRecord>()\n for (const record of collector.records.values()) {\n if (record.category !== 'configuration') knownInputs.set(record.path, record)\n }\n const ordered = (inputs: readonly string[] | undefined) =>\n [...new Set(inputs ?? [])].sort((left, right) => left < right ? -1 : left > right ? 1 : 0)\n for (const input of ordered(options.additionalInputs)) {\n if (knownInputs.has(input)) continue\n const stat = collector.stat(input)\n if (stat?.isFile()) collector.file(`configuration:${input}`, input, { category: 'configuration' })\n else collector.record(`configuration:${input}`, input, { category: 'configuration' }, stat?.isDirectory() ? 'directory' : 'missing')\n }\n const addSpecializedInputs = (\n inputs: readonly string[] | undefined,\n kind: InputKind,\n keyPrefix: string,\n mode: 'content' | 'stat' | 'membership' = 'content',\n ) => {\n for (const input of ordered(inputs)) {\n const stat = collector.stat(input)\n if (stat?.isFile()) collector.file(`${keyPrefix}:${input}`, input, kind, mode)\n else collector.record(`${keyPrefix}:${input}`, input, kind, stat?.isDirectory() ? 'directory' : 'missing')\n }\n }\n addSpecializedInputs(options.openapiInputs, { category: 'openapi' }, 'openapi-input')\n addSpecializedInputs(\n options.webResearchAdapterInputs,\n { category: 'web-research-adapters' },\n 'web-research-adapter-input',\n 'stat',\n )\n addSpecializedInputs(options.cacheProviderInputs, { category: 'cache-providers' }, 'cache-provider-input', 'membership')\n collector.supervisor(path.dirname(options.modulesFile))\n collector.dependencies(path.dirname(options.modulesFile))\n // A dynamic descriptor is valid source, not a transient failed capture. Until\n // its dependencies can be proven, watch all potential module contributions.\n // Changes require a full suite, but an unchanged successful baseline is clean.\n if (collector.uncertainPluginDescriptors.size > 0 || collector.uncertainDependencies.size > 0) {\n const category = collector.uncertainPluginDescriptors.size > 0 ? 'generator-plugin' : 'unknown'\n for (const roots of options.moduleRoots) {\n for (const base of new Set([roots.appBase, roots.pkgBase, resolveStandaloneSourceMirrorBase(roots.pkgBase)])) {\n if (base) collector.tree(`uncertain-dependencies:${base}`, base, { category }, false)\n }\n }\n for (const descriptor of collector.uncertainPluginDescriptors) {\n collector.record(`uncertain-plugin:${descriptor}`, descriptor, { category: 'generator-plugin' }, 'unresolved-conventions')\n }\n for (const dependency of collector.uncertainDependencies) {\n collector.record(`uncertain-dependency:${dependency}`, dependency, { category: 'unknown' }, 'unresolved-import')\n }\n }\n const records = new Map([...collector.records].sort(([left], [right]) => left.localeCompare(right)))\n const fullReasons = [...collector.fullReasons].sort((left, right) => left < right ? -1 : left > right ? 1 : 0)\n if (fullReasons.length === 0) {\n for (const cachedPath of cacheState.files.keys()) {\n if (!collector.inspectedCachePaths.has(cachedPath)) cacheState.files.delete(cachedPath)\n }\n }\n return {\n checksum: checksum(JSON.stringify([[...records.values()], fullReasons])),\n records,\n fullReasons,\n }\n}\n\nexport function diffGenerateWatchStructureSnapshots(\n previous: GenerateWatchSnapshot,\n next: GenerateWatchSnapshot,\n): GenerateWatchChange[] {\n const changes: GenerateWatchChange[] = []\n for (const key of [...new Set([...previous.records.keys(), ...next.records.keys()])].sort((left, right) => left < right ? -1 : left > right ? 1 : 0)) {\n const before = previous.records.get(key)\n const after = next.records.get(key)\n if (before && after && before.fingerprint === after.fingerprint && before.path === after.path\n && before.category === after.category && before.extensionId === after.extensionId) continue\n const record = after ?? before!\n changes.push({\n key, kind: !before ? 'add' : !after ? 'delete' : 'change',\n category: record.category, path: record.path,\n ...(record.extensionId ? { extensionId: record.extensionId } : {}),\n })\n }\n return changes\n}\n\n/** Legacy callers intentionally receive only the opaque snapshot checksum. */\nexport function calculateGenerateWatchStructureChecksum(options: GenerateWatchStructureOptions): string {\n return collectGenerateWatchStructureSnapshot(options).checksum\n}\n"],
|
|
5
|
-
"mappings": "AAAA,OAAO,YAAY;AACnB,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,QAAQ;AACf;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AA4CP,MAAM,cAAc,oBAAI,QAAuE;AAExF,SAAS,oCAAiE;AAC/E,QAAM,QAAQ,CAAC;AACf,cAAY,IAAI,OAAO,EAAE,OAAO,oBAAI,IAAI,EAAE,CAAC;AAC3C,SAAO;AACT;AAEA,MAAM,uBAAuB;AAAA,EAC3B;AAAA,EAAS;AAAA,EAAO;A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,MAAK,MAAM,CAAC,SAAS,QAAQ,CAAC,QAAQ,WAAW;AAAA,MACjD,UAAU,OAAO;AAAA,MAAU,MAAM,OAAO;AAAA,MACxC,GAAI,OAAO,cAAc,EAAE,aAAa,OAAO,YAAY,IAAI,CAAC;AAAA,IAClE,CAAC;AAAA,EACH;AACA,SAAO;AACT;AAGO,SAAS,wCAAwC,SAAgD;AACtG,SAAO,sCAAsC,OAAO,EAAE;AACxD;",
|
|
4
|
+
"sourcesContent": ["import crypto from 'node:crypto'\nimport fs from 'node:fs'\nimport path from 'node:path'\nimport ts from 'typescript-js'\nimport { databaseDeclarationsPlugin } from './generators/database-declarations'\nimport {\n MODULE_CODE_EXTENSIONS,\n SCAN_CONFIGS,\n resolveStandaloneSourceMirrorBase,\n scanModuleDir,\n stripModuleCodeExtension,\n type ModuleRoots,\n type ScanConfig,\n type ScannedFile,\n} from './generators/scanner'\nimport type {\n GenerateWatchCategory, GenerateWatchChange, GenerateWatchRecord, GenerateWatchSnapshot,\n} from './generate-watch-plan'\n\ntype InputKind = { category: GenerateWatchCategory; extensionId?: string }\ntype WatchRoots = ModuleRoots & { moduleId?: string; from?: string }\nexport type GenerateWatchStructureOptions = {\n modulesFile: string\n moduleRoots: WatchRoots[]\n /** Dependency/configuration inputs whose changes require a conservative full generation. */\n additionalInputs?: string[]\n /** Inputs consumed specifically by OpenAPI generation. */\n openapiInputs?: string[]\n cacheProviderInputs?: string[]\n /** Candidate package manifests consumed specifically by web-research adapter discovery. */\n webResearchAdapterInputs?: string[]\n /** Adapter discovery failures that make this capture non-authoritative. */\n webResearchAdapterFullReasons?: readonly string[]\n}\n\n/**\n * Facts derived from one stat identity of a tracked file. Source text and parsed\n * ASTs are capture-local; only these small extracted values outlive a capture.\n */\ntype CachedStructureFile = {\n identity: string\n fingerprint: string\n parseFailed?: true\n pageFingerprint?: string | null\n imports?: { specifiers: string[]; uncertain: boolean }\n pluginConventions?: string[] | null\n supervisorOverride?: boolean\n}\n\ntype GenerateWatchStructureCacheState = {\n files: Map<string, CachedStructureFile>\n}\n\ndeclare const generateWatchStructureCacheBrand: unique symbol\nexport type GenerateWatchStructureCache = {\n readonly [generateWatchStructureCacheBrand]: true\n}\n\nconst cacheStates = new WeakMap<GenerateWatchStructureCache, GenerateWatchStructureCacheState>()\n\nexport function createGenerateWatchStructureCache(): GenerateWatchStructureCache {\n const cache = {} as GenerateWatchStructureCache\n cacheStates.set(cache, { files: new Map() })\n return cache\n}\n\nconst REGISTRY_CONVENTIONS = [\n 'index', 'acl', 'setup', 'runtime', 'encryption', 'ce', 'integration', 'vector',\n 'data/extensions', 'data/fields',\n]\nconst EXTENSION_CONVENTIONS: Readonly<Record<string, string>> = {\n notifications: 'registry.notifications',\n 'notifications.client': 'registry.notifications',\n 'notifications.handlers': 'registry.notifications',\n 'message-types': 'registry.messages',\n 'message-objects': 'registry.messages',\n 'ai-tools': 'registry.ai-tools',\n 'ai-agents': 'registry.ai-agents',\n analytics: 'registry.analytics',\n translations: 'registry.translatable-fields',\n workflows: 'registry.workflows',\n 'inbox-actions': 'registry.inbox-actions',\n 'data/enrichers': 'registry.enrichers',\n 'data/guards': 'registry.guards',\n 'api/interceptors': 'registry.interceptors',\n 'commands/interceptors': 'registry.command-interceptors',\n 'widgets/components': 'registry.component-overrides',\n 'frontend/middleware': 'registry.page-middleware',\n 'backend/middleware': 'registry.page-middleware',\n}\n\n// These two policies mirror the registry's command/legacy-API scans; all other\n// directory discovery is shared with the generator through SCAN_CONFIGS.\nconst COMMAND_SCAN_CONFIG: ScanConfig = {\n folder: 'commands',\n include: (name) => MODULE_CODE_EXTENSIONS.some((extension) => name.endsWith(extension))\n && !name.endsWith('.d.ts') && !/\\.(test|spec)\\.[jt]sx?$/.test(name)\n && !['index', 'shared', 'factory'].includes(stripModuleCodeExtension(name)),\n}\nconst LEGACY_API_SCAN_CONFIGS: ScanConfig[] = ['get', 'post', 'put', 'patch', 'delete'].map((method) => ({\n folder: `api/${method}`,\n include: (name) => /\\.[jt]s$/.test(name) && !/\\.(test|spec)\\.[jt]s$/.test(name),\n}))\n\nfunction checksum(value: string): string {\n return crypto.createHash('md5').update(value).digest('hex')\n}\n\nfunction isMissing(error: unknown): boolean {\n return typeof error === 'object' && error !== null && 'code' in error\n && (error.code === 'ENOENT' || error.code === 'ENOTDIR')\n}\n\nfunction unwrap(node: ts.Expression): ts.Expression {\n while (ts.isParenthesizedExpression(node) || ts.isAsExpression(node)\n || ts.isTypeAssertionExpression(node) || ts.isSatisfiesExpression(node)) node = node.expression\n return node\n}\n\n/** Read only static declaration data; never execute a plugin to watch it. */\nfunction pluginConventions(file: ts.SourceFile): string[] | null {\n const declarations = new Map<string, ts.Expression>()\n let exported: ts.Expression | undefined\n for (const statement of file.statements) {\n if (ts.isVariableStatement(statement)) {\n for (const declaration of statement.declarationList.declarations) {\n if (ts.isIdentifier(declaration.name) && declaration.initializer) {\n declarations.set(declaration.name.text, declaration.initializer)\n if (declaration.name.text === 'generatorPlugins'\n && statement.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword)) {\n exported = declaration.initializer\n }\n }\n }\n } else if (ts.isExportAssignment(statement)) {\n exported ??= statement.expression\n } else if (ts.isImportDeclaration(statement)) {\n if (!statement.importClause?.isTypeOnly) return null\n } else if (!ts.isFunctionDeclaration(statement) && !ts.isInterfaceDeclaration(statement)\n && !ts.isTypeAliasDeclaration(statement) && !ts.isEmptyStatement(statement)) return null\n }\n if (!exported) return null\n const resolve = (expression: ts.Expression, seen = new Set<string>()): ts.Expression | null => {\n const node = unwrap(expression)\n if (!ts.isIdentifier(node)) return node\n if (seen.has(node.text)) return null\n seen.add(node.text)\n const value = declarations.get(node.text)\n return value ? resolve(value, seen) : null\n }\n const plugins = resolve(exported)\n if (!plugins || !ts.isArrayLiteralExpression(plugins)) return null\n const conventions: string[] = []\n for (const element of plugins.elements) {\n const plugin = resolve(element)\n if (!plugin || !ts.isObjectLiteralExpression(plugin)) return null\n let convention: string | undefined\n for (const property of plugin.properties) {\n if (ts.isSpreadAssignment(property) || ts.isComputedPropertyName(property.name)) return null\n if (property.name.getText(file).replace(/^['\"]|['\"]$/g, '') !== 'conventionFile') continue\n const value = ts.isPropertyAssignment(property) ? resolve(property.initializer) : null\n if (!value || !ts.isStringLiteralLike(value)) return null\n convention = value.text\n }\n if (!convention) return null\n conventions.push(convention)\n }\n return conventions\n}\n\n/** `null` when the page exports metadata (content fingerprint applies); otherwise its default-export marker. */\nfunction pageFingerprint(parsed: ts.SourceFile): string | null {\n const metadata = parsed.statements.some((statement) => {\n if (ts.isExportDeclaration(statement)) {\n return !statement.exportClause || (ts.isNamedExports(statement.exportClause)\n && statement.exportClause.elements.some((element) => element.name.text === 'metadata'))\n }\n if (!ts.canHaveModifiers(statement)\n || !ts.getModifiers(statement)?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword)) return false\n if (ts.isVariableStatement(statement)) {\n return statement.declarationList.declarations.some((declaration) => /\\bmetadata\\b/.test(declaration.name.getText(parsed)))\n }\n return (ts.isFunctionDeclaration(statement) || ts.isClassDeclaration(statement)) && statement.name?.text === 'metadata'\n })\n if (metadata) return null\n const hasDefault = parsed.statements.some((statement) =>\n (ts.isExportAssignment(statement) && !statement.isExportEquals)\n || (ts.canHaveModifiers(statement) && ts.getModifiers(statement)?.some((modifier) => modifier.kind === ts.SyntaxKind.DefaultKeyword))\n || (ts.isExportDeclaration(statement) && statement.exportClause && ts.isNamedExports(statement.exportClause)\n && statement.exportClause.elements.some((element) => element.name.text === 'default')),\n )\n return `page:default:${hasDefault}`\n}\n\nconst SUPERVISOR_OVERRIDE_CALLS = ['applyWorkerOverrides', 'applyCliOverrides']\n\nfunction declaresSupervisorOverride(parsed: ts.SourceFile): boolean {\n const direct = new Set<string>()\n const namespaces = new Set<string>()\n for (const statement of parsed.statements) {\n if (!ts.isImportDeclaration(statement) || !ts.isStringLiteralLike(statement.moduleSpecifier)\n || statement.moduleSpecifier.text !== '@open-mercato/shared/modules/overrides') continue\n const bindings = statement.importClause?.namedBindings\n if (bindings && ts.isNamespaceImport(bindings)) namespaces.add(bindings.name.text)\n if (bindings && ts.isNamedImports(bindings)) {\n for (const element of bindings.elements) {\n if (SUPERVISOR_OVERRIDE_CALLS.includes(element.propertyName?.text ?? element.name.text)) direct.add(element.name.text)\n }\n }\n }\n let found = false\n const visit = (node: ts.Node): void => {\n if (ts.isCallExpression(node)) {\n const expression = node.expression\n if (ts.isIdentifier(expression) && direct.has(expression.text)) found = true\n if (ts.isPropertyAccessExpression(expression) && ts.isIdentifier(expression.expression)\n && namespaces.has(expression.expression.text)\n && SUPERVISOR_OVERRIDE_CALLS.includes(expression.name.text)) found = true\n }\n if (!found) ts.forEachChild(node, visit)\n }\n visit(parsed)\n return found\n}\n\n/** Module specifiers evaluated at load time; `uncertain` marks a non-literal import()/require(). */\nfunction staticImports(parsed: ts.SourceFile): { specifiers: string[]; uncertain: boolean } {\n const specifiers: string[] = []\n let uncertain = false\n const visit = (node: ts.Node): void => {\n // Handler/component bodies are not evaluated to discover registrations.\n // Static imports are still tracked, including imports used by metadata.\n if (ts.isFunctionLike(node)) return\n if (ts.isImportDeclaration(node)) {\n if (node.importClause?.isTypeOnly) return\n const bindings = node.importClause?.namedBindings\n if (!node.importClause?.name && bindings && ts.isNamedImports(bindings)\n && bindings.elements.length > 0 && bindings.elements.every((element) => element.isTypeOnly)) return\n if (ts.isStringLiteralLike(node.moduleSpecifier)) specifiers.push(node.moduleSpecifier.text)\n return\n }\n if (ts.isExportDeclaration(node) && !node.isTypeOnly && node.moduleSpecifier\n && ts.isStringLiteralLike(node.moduleSpecifier)) specifiers.push(node.moduleSpecifier.text)\n if (ts.isCallExpression(node) && (node.expression.kind === ts.SyntaxKind.ImportKeyword\n || (ts.isIdentifier(node.expression) && node.expression.text === 'require'))) {\n const argument = node.arguments[0]\n if (argument && ts.isStringLiteralLike(argument)) specifiers.push(argument.text)\n else uncertain = true\n }\n ts.forEachChild(node, visit)\n }\n visit(parsed)\n return { specifiers, uncertain }\n}\n\nclass SnapshotCollector {\n readonly records = new Map<string, GenerateWatchRecord>()\n readonly fullReasons = new Set<string>()\n private readonly stats = new Map<string, fs.Stats | null>()\n private readonly identities = new Map<string, string | null>()\n readonly uncertainDependencies = new Set<string>()\n readonly uncertainPluginDescriptors = new Set<string>()\n private readonly dependencySeeds = new Map<string, Map<string, InputKind>>()\n readonly inspectedCachePaths = new Set<string>()\n private readonly sources = new Map<string, string>()\n private readonly parsedFiles = new Map<string, ts.SourceFile>()\n\n constructor(private readonly cache: GenerateWatchStructureCacheState) {}\n\n private identity(file: string): string | null {\n if (!this.identities.has(file)) this.stat(file)\n return this.identities.get(file) ?? null\n }\n\n private seedDependency(file: string, kind: InputKind): void {\n const identity = `${kind.category}:${kind.extensionId ?? ''}`\n const kinds = this.dependencySeeds.get(file) ?? new Map<string, InputKind>()\n kinds.set(identity, kind)\n this.dependencySeeds.set(file, kinds)\n }\n\n stat(file: string): fs.Stats | null {\n if (this.stats.has(file)) return this.stats.get(file) ?? null\n try {\n const stat = fs.statSync(file)\n const identity = [stat.dev, stat.ino, stat.size, stat.mtimeMs, stat.ctimeMs].join(':')\n this.stats.set(file, stat)\n this.identities.set(file, identity)\n return stat\n } catch (error) {\n if (!isMissing(error)) this.fullReasons.add(`Cannot inspect generator input: ${file}`)\n this.stats.set(file, null)\n this.identities.set(file, null)\n return null\n }\n }\n\n /** Stat-keyed cache entry for a readable file; unchanged identities are never re-read. */\n entry(file: string): CachedStructureFile | null {\n const stat = this.stat(file)\n const identity = this.identity(file)\n if (!stat?.isFile() || !identity) {\n this.fullReasons.add(`Cannot read generator input: ${file}`)\n return null\n }\n this.inspectedCachePaths.add(file)\n const cached = this.cache.files.get(file)\n if (cached?.identity === identity) return cached\n const source = this.readSource(file)\n if (source === null) return null\n const entry: CachedStructureFile = { identity, fingerprint: checksum(source) }\n this.cache.files.set(file, entry)\n return entry\n }\n\n private readSource(file: string): string | null {\n const known = this.sources.get(file)\n if (known !== undefined) return known\n try {\n const source = fs.readFileSync(file, 'utf8')\n this.sources.set(file, source)\n return source\n } catch {\n this.fullReasons.add(`Cannot read generator input: ${file}`)\n return null\n }\n }\n\n /** Capture-local AST for a file whose cached facts are missing; parse failures are cached per identity. */\n parsed(file: string, entry: CachedStructureFile): ts.SourceFile | null {\n if (entry.parseFailed) {\n this.fullReasons.add(`Cannot parse generator input: ${file}`)\n return null\n }\n const known = this.parsedFiles.get(file)\n if (known) return known\n const source = this.readSource(file)\n if (source === null) return null\n let parsed: ts.SourceFile\n try {\n parsed = ts.createSourceFile(file, source, ts.ScriptTarget.Latest, true)\n } catch {\n this.fullReasons.add(`Cannot parse generator input: ${file}`)\n return null\n }\n const diagnostics = (parsed as ts.SourceFile & { parseDiagnostics?: readonly ts.Diagnostic[] }).parseDiagnostics\n if (diagnostics?.length) {\n entry.parseFailed = true\n this.fullReasons.add(`Cannot parse generator input: ${file}`)\n return null\n }\n this.parsedFiles.set(file, parsed)\n return parsed\n }\n\n record(key: string, file: string, kind: InputKind, fingerprint: string): void {\n this.records.set(key, { key, path: file, ...kind, fingerprint })\n }\n\n file(key: string, file: string, kind: InputKind, mode: 'content' | 'page' | 'membership' | 'stat' = 'content'): void {\n if (!this.stat(file)?.isFile()) return\n if (mode === 'membership') {\n this.record(key, file, kind, 'present')\n return\n }\n if (mode === 'stat') {\n this.record(key, file, kind, this.identity(file) ?? 'present')\n return\n }\n const entry = this.entry(file)\n if (!entry) {\n this.record(key, file, kind, 'unreadable')\n return\n }\n if (mode === 'page') {\n if (entry.pageFingerprint === undefined) {\n const parsed = this.parsed(file, entry)\n if (!parsed) {\n this.record(key, file, kind, 'unparseable')\n return\n }\n entry.pageFingerprint = pageFingerprint(parsed)\n }\n if (entry.pageFingerprint !== null) {\n this.record(key, file, kind, entry.pageFingerprint)\n return\n }\n }\n this.record(key, file, kind, entry.fingerprint)\n if (/\\.[cm]?[jt]sx?$/.test(file)) this.seedDependency(file, kind)\n }\n\n codeFile(base: string, relativePath: string): string | null {\n const stripped = stripModuleCodeExtension(relativePath)\n const candidates = [relativePath, ...MODULE_CODE_EXTENSIONS.map((extension) => `${stripped}${extension}`)]\n for (const candidate of candidates) {\n const file = path.join(base, candidate)\n if (this.stat(file)?.isFile()) return file\n }\n return null\n }\n\n scan(roots: ModuleRoots, config: ScanConfig): ScannedFile[] {\n try {\n return scanModuleDir(roots, config)\n } catch {\n this.fullReasons.add(`Cannot scan generator inputs: ${roots.appBase}, ${roots.pkgBase}/${config.folder}`)\n return []\n }\n }\n\n entries(directory: string): fs.Dirent[] {\n if (!this.stat(directory)?.isDirectory()) return []\n try {\n return fs.readdirSync(directory, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))\n } catch {\n this.fullReasons.add(`Cannot scan generator inputs: ${directory}`)\n return []\n }\n }\n\n pair(identity: string, roots: ModuleRoots, relativePath: string, kind: InputKind, mode: 'content' | 'page' = 'content'): string[] {\n const sourceBase = resolveStandaloneSourceMirrorBase(roots.pkgBase) ?? roots.pkgBase\n const app = this.codeFile(roots.appBase, relativePath)\n const source = app ?? this.codeFile(sourceBase, relativePath)\n // Conventions retain stale compiled inputs after source deletion. Directory\n // scans still enumerate only the authoritative source mirror before pairing.\n const runtime = !app && sourceBase !== roots.pkgBase\n ? this.codeFile(roots.pkgBase, stripModuleCodeExtension(relativePath))\n : source\n const primary = source ?? runtime\n if (!primary) return []\n const logical = stripModuleCodeExtension(relativePath).replace(/\\\\/g, '/')\n const key = `${identity}:${kind.category}:${kind.extensionId ?? ''}:${logical}`\n if (source) this.file(`${key}:source`, source, kind, mode)\n if (runtime && runtime !== source) this.file(`${key}:runtime`, runtime, kind, mode)\n // Physical ownership is part of the fingerprint even for identical bytes.\n this.record(`${key}:authority`, primary, kind, JSON.stringify([source, runtime]))\n return source && runtime && runtime !== source ? [source, runtime] : [primary]\n }\n\n tree(identity: string, directory: string, kind: InputKind, skipTests = true): void {\n for (const entry of this.entries(directory)) {\n if (skipTests && (entry.name === '__tests__' || entry.name === '__mocks__')) continue\n const file = path.join(directory, entry.name)\n if (entry.isDirectory()) this.tree(identity, file, kind, skipTests)\n else if (entry.isFile()) this.file(`${identity}:${file}`, file, kind)\n }\n }\n\n supervisor(appSource: string): void {\n const pending = [appSource]\n let found = false\n while (pending.length > 0 && !found) {\n const directory = pending.pop()!\n for (const entry of this.entries(directory)) {\n const file = path.join(directory, entry.name)\n if (entry.isDirectory()) {\n if (entry.name !== '__tests__' && entry.name !== 'node_modules') pending.push(file)\n continue\n }\n if (!/\\.[cm]?tsx?$/.test(entry.name) || /(?:^|\\.)test\\.[cm]?tsx?$/.test(entry.name)) continue\n const cached = this.entry(file)\n if (!cached) continue\n if (cached.supervisorOverride === undefined) {\n if (!this.readSource(file)?.includes('@open-mercato/shared/modules/overrides')) {\n cached.supervisorOverride = false\n continue\n }\n const parsed = this.parsed(file, cached)\n if (!parsed) continue\n cached.supervisorOverride = declaresSupervisorOverride(parsed)\n }\n if (cached.supervisorOverride) {\n found = true\n break\n }\n }\n }\n this.record('supervisor-overrides', appSource, { category: 'registry-convention', extensionId: 'supervisor' }, String(found))\n }\n\n dependencies(appSource: string): void {\n const visited = new Set<string>()\n const pending = [...this.dependencySeeds]\n .flatMap(([file, kinds]) => [...kinds.entries()].map(([identity, kind]) => ({ file, identity, kind })))\n .sort((left, right) => right.file.localeCompare(left.file) || right.identity.localeCompare(left.identity))\n while (pending.length > 0) {\n const { file, identity, kind } = pending.pop()!\n const visitKey = `${identity}:${file}`\n if (visited.has(visitKey)) continue\n visited.add(visitKey)\n const cached = this.entry(file)\n if (!cached) continue\n if (!cached.imports) {\n const parsed = this.parsed(file, cached)\n if (!parsed) continue\n cached.imports = staticImports(parsed)\n }\n if (cached.imports.uncertain) this.uncertainDependencies.add(file)\n const imports = cached.imports.specifiers\n for (const specifier of imports) {\n if (!specifier.startsWith('.') && !specifier.startsWith('@/')) continue\n const target = specifier.startsWith('@/')\n ? path.join(appSource, specifier.slice(2)) : path.resolve(path.dirname(file), specifier)\n const resolved = this.codeFile(path.dirname(target), path.basename(target))\n ?? this.codeFile(target, 'index')\n const dependencyKey = `dependency:${identity}:${file}:${target}`\n if (!resolved) {\n // Keep an absence record so a newly supplied helper invalidates the plan.\n this.record(dependencyKey, target, kind, 'missing')\n continue\n }\n // A generator's own outputs must not feed back into its watcher baseline.\n if (resolved.includes(`${path.sep}.mercato${path.sep}`) || resolved.includes(`${path.sep}generated${path.sep}`)) continue\n const fingerprint = this.entry(resolved)?.fingerprint ?? 'unreadable'\n this.record(dependencyKey, resolved, kind, `${resolved}:${fingerprint}`)\n if (/\\.[cm]?[jt]sx?$/.test(resolved)) pending.push({ file: resolved, identity, kind })\n }\n }\n }\n}\n\nfunction addModule(collector: SnapshotCollector, roots: WatchRoots, index: number, plugins: Set<string>): void {\n const distMarker = `${path.sep}dist${path.sep}modules${path.sep}`\n const distIndex = roots.pkgBase.lastIndexOf(distMarker)\n if (distIndex >= 0) {\n const packageRoot = roots.pkgBase.slice(0, distIndex)\n collector.stat(path.join(packageRoot, 'src', 'modules', roots.pkgBase.slice(distIndex + distMarker.length)))\n }\n const sourceBase = resolveStandaloneSourceMirrorBase(roots.pkgBase) ?? roots.pkgBase\n const identity = `module:${index}:${roots.moduleId ?? path.basename(roots.appBase)}:${roots.appBase}:${roots.pkgBase}`\n collector.record(`${identity}:roots`, roots.appBase, { category: 'configuration' }, JSON.stringify([\n Object.entries(roots).sort(([left], [right]) => left.localeCompare(right)), sourceBase,\n collector.stat(roots.appBase)?.isDirectory() ?? false, collector.stat(roots.pkgBase)?.isDirectory() ?? false,\n ]))\n const convention = (relativePath: string, kind: InputKind) => collector.pair(identity, roots, `${relativePath}.ts`, kind)\n for (const relativePath of REGISTRY_CONVENTIONS) convention(relativePath, { category: 'registry-convention' })\n // Section definitions can change shared field sets, route manifests, and OpenAPI together.\n convention('form-sections', { category: 'configuration' })\n for (const [relativePath, extensionId] of Object.entries(EXTENSION_CONVENTIONS)) {\n convention(relativePath, { category: 'extension', extensionId })\n }\n collector.pair(identity, roots, 'widgets/payments/client.tsx', { category: 'extension', extensionId: 'registry.notifications' })\n for (const category of ['cli', 'di', 'search', 'events'] as const) convention(category, { category })\n convention('widgets/injection-table', { category: 'injection-widgets' })\n for (const descriptor of convention('generators', { category: 'generator-plugin' })) {\n const cached = collector.entry(descriptor)\n if (cached && cached.pluginConventions === undefined) {\n const parsed = collector.parsed(descriptor, cached)\n if (parsed) cached.pluginConventions = pluginConventions(parsed)\n }\n const discovered = cached?.pluginConventions ?? null\n if (discovered === null) collector.uncertainPluginDescriptors.add(descriptor)\n else for (const file of discovered) plugins.add(file)\n }\n\n // Entity generators use direct app/package candidates, including legacy db and\n // override/schema fallbacks, rather than resolveModuleFile's source authority.\n for (const base of new Set([roots.appBase, roots.pkgBase, sourceBase])) {\n for (const directory of ['data', 'db']) {\n for (const stem of ['entities.override', 'entities', 'schema']) {\n for (const extension of MODULE_CODE_EXTENSIONS) {\n const file = path.join(base, directory, `${stem}${extension}`)\n collector.file(`${identity}:entities:${file}`, file, { category: 'entities' })\n }\n }\n }\n }\n if (distIndex >= 0) {\n const packageRoot = roots.pkgBase.slice(0, distIndex)\n const direct = path.join(packageRoot, 'generated')\n collector.record(`${identity}:package-entities-direct-root`, direct, { category: 'entities' },\n collector.stat(direct)?.isDirectory() ? 'directory' : 'missing')\n const generated = collector.stat(direct)?.isDirectory() ? direct : path.join(packageRoot, 'dist', 'generated')\n collector.record(`${identity}:package-entities-root`, generated, { category: 'entities' }, generated)\n for (const extension of ['.ts', '.js']) {\n const ids = path.join(generated, `entities.ids.generated${extension}`)\n collector.file(`${identity}:package-entities:${ids}`, ids, { category: 'entities' })\n for (const entry of collector.entries(path.join(generated, 'entities'))) {\n if (!entry.isDirectory()) continue\n const fields = path.join(generated, 'entities', entry.name, `index${extension}`)\n collector.file(`${identity}:package-entities:${fields}`, fields, { category: 'entities' })\n }\n }\n }\n const scans: Array<[ScanConfig, GenerateWatchCategory]> = [\n [SCAN_CONFIGS.apiRoutes, 'api-route'], [SCAN_CONFIGS.apiPlainFiles, 'api-route'],\n ...LEGACY_API_SCAN_CONFIGS.map((config): [ScanConfig, GenerateWatchCategory] => [config, 'api-route']),\n [COMMAND_SCAN_CONFIG, 'commands'], [SCAN_CONFIGS.subscribers, 'subscribers'],\n [SCAN_CONFIGS.workers, 'workers'], [SCAN_CONFIGS.dashboardWidgets, 'dashboard-widgets'],\n [SCAN_CONFIGS.injectionWidgets, 'injection-widgets'],\n [SCAN_CONFIGS.frontendPages, 'frontend-page'], [SCAN_CONFIGS.backendPages, 'backend-page'],\n ]\n for (const [config, category] of scans) {\n for (const scanned of collector.scan(roots, config)) {\n const relativePath = `${config.folder}/${scanned.relPath}`\n // Exact conventions in route/page directories are not route registrations.\n if (EXTENSION_CONVENTIONS[stripModuleCodeExtension(relativePath)]) continue\n const page = category === 'frontend-page' || category === 'backend-page'\n const files = collector.pair(identity, roots, relativePath, { category }, page ? 'page' : 'content')\n if (!page) continue\n for (const file of files) {\n const stem = stripModuleCodeExtension(path.basename(file))\n for (const candidate of [stem === 'page' ? 'page.meta' : `${stem}.meta`, 'meta']) {\n const metadata = collector.codeFile(path.dirname(file), candidate)\n if (metadata) collector.file(`${identity}:${category}:metadata:${metadata}`, metadata, { category })\n }\n }\n }\n }\n for (const base of new Set([sourceBase, roots.appBase])) {\n const directory = path.join(base, 'i18n')\n for (const entry of collector.entries(directory)) {\n if (!entry.isFile() || !/^[a-zA-Z0-9][a-zA-Z0-9_-]*\\.json$/.test(entry.name)) continue\n const file = path.join(directory, entry.name)\n collector.file(`${identity}:i18n:${file}`, file, { category: 'i18n' }, 'membership')\n if (base === sourceBase && sourceBase !== roots.pkgBase) {\n const runtime = path.join(roots.pkgBase, 'i18n', entry.name)\n collector.file(`${identity}:i18n:runtime:${runtime}`, runtime, { category: 'i18n' }, 'membership')\n }\n }\n collector.tree(`${identity}:agents`, path.join(base, 'agents'), { category: 'extension', extensionId: 'registry.agent-files' })\n }\n}\n\nexport function collectGenerateWatchStructureSnapshot(\n options: GenerateWatchStructureOptions,\n cache?: GenerateWatchStructureCache,\n): GenerateWatchSnapshot {\n const cacheState = cache ? cacheStates.get(cache) : { files: new Map<string, CachedStructureFile>() }\n if (!cacheState) throw new TypeError('Invalid generate watch structure cache')\n const collector = new SnapshotCollector(cacheState)\n for (const reason of options.webResearchAdapterFullReasons ?? []) collector.fullReasons.add(reason)\n collector.file(`configuration:${options.modulesFile}`, options.modulesFile, { category: 'configuration' })\n const plugins = new Set([databaseDeclarationsPlugin.conventionFile])\n options.moduleRoots.forEach((roots, index) => addModule(collector, roots, index, plugins))\n options.moduleRoots.forEach((roots, index) => {\n const identity = `module:${index}:${roots.moduleId ?? path.basename(roots.appBase)}:${roots.appBase}:${roots.pkgBase}`\n for (const relativePath of plugins) collector.pair(identity, roots, relativePath, { category: 'generator-plugin' })\n })\n const knownInputs = new Map<string, GenerateWatchRecord>()\n for (const record of collector.records.values()) {\n if (record.category !== 'configuration') knownInputs.set(record.path, record)\n }\n const ordered = (inputs: readonly string[] | undefined) =>\n [...new Set(inputs ?? [])].sort((left, right) => left < right ? -1 : left > right ? 1 : 0)\n for (const input of ordered(options.additionalInputs)) {\n if (knownInputs.has(input)) continue\n const stat = collector.stat(input)\n if (stat?.isFile()) collector.file(`configuration:${input}`, input, { category: 'configuration' })\n else collector.record(`configuration:${input}`, input, { category: 'configuration' }, stat?.isDirectory() ? 'directory' : 'missing')\n }\n const addSpecializedInputs = (\n inputs: readonly string[] | undefined,\n kind: InputKind,\n keyPrefix: string,\n mode: 'content' | 'stat' | 'membership' = 'content',\n ) => {\n for (const input of ordered(inputs)) {\n const stat = collector.stat(input)\n if (stat?.isFile()) collector.file(`${keyPrefix}:${input}`, input, kind, mode)\n else collector.record(`${keyPrefix}:${input}`, input, kind, stat?.isDirectory() ? 'directory' : 'missing')\n }\n }\n addSpecializedInputs(options.openapiInputs, { category: 'openapi' }, 'openapi-input')\n addSpecializedInputs(\n options.webResearchAdapterInputs,\n { category: 'web-research-adapters' },\n 'web-research-adapter-input',\n 'stat',\n )\n addSpecializedInputs(options.cacheProviderInputs, { category: 'cache-providers' }, 'cache-provider-input', 'membership')\n collector.supervisor(path.dirname(options.modulesFile))\n collector.dependencies(path.dirname(options.modulesFile))\n // A dynamic descriptor is valid source, not a transient failed capture. Until\n // its dependencies can be proven, watch all potential module contributions.\n // Changes require a full suite, but an unchanged successful baseline is clean.\n if (collector.uncertainPluginDescriptors.size > 0 || collector.uncertainDependencies.size > 0) {\n const category = collector.uncertainPluginDescriptors.size > 0 ? 'generator-plugin' : 'unknown'\n for (const roots of options.moduleRoots) {\n for (const base of new Set([roots.appBase, roots.pkgBase, resolveStandaloneSourceMirrorBase(roots.pkgBase)])) {\n if (base) collector.tree(`uncertain-dependencies:${base}`, base, { category }, false)\n }\n }\n for (const descriptor of collector.uncertainPluginDescriptors) {\n collector.record(`uncertain-plugin:${descriptor}`, descriptor, { category: 'generator-plugin' }, 'unresolved-conventions')\n }\n for (const dependency of collector.uncertainDependencies) {\n collector.record(`uncertain-dependency:${dependency}`, dependency, { category: 'unknown' }, 'unresolved-import')\n }\n }\n const records = new Map([...collector.records].sort(([left], [right]) => left.localeCompare(right)))\n const fullReasons = [...collector.fullReasons].sort((left, right) => left < right ? -1 : left > right ? 1 : 0)\n if (fullReasons.length === 0) {\n for (const cachedPath of cacheState.files.keys()) {\n if (!collector.inspectedCachePaths.has(cachedPath)) cacheState.files.delete(cachedPath)\n }\n }\n return {\n checksum: checksum(JSON.stringify([[...records.values()], fullReasons])),\n records,\n fullReasons,\n }\n}\n\nexport function diffGenerateWatchStructureSnapshots(\n previous: GenerateWatchSnapshot,\n next: GenerateWatchSnapshot,\n): GenerateWatchChange[] {\n const changes: GenerateWatchChange[] = []\n for (const key of [...new Set([...previous.records.keys(), ...next.records.keys()])].sort((left, right) => left < right ? -1 : left > right ? 1 : 0)) {\n const before = previous.records.get(key)\n const after = next.records.get(key)\n if (before && after && before.fingerprint === after.fingerprint && before.path === after.path\n && before.category === after.category && before.extensionId === after.extensionId) continue\n const record = after ?? before!\n changes.push({\n key, kind: !before ? 'add' : !after ? 'delete' : 'change',\n category: record.category, path: record.path,\n ...(record.extensionId ? { extensionId: record.extensionId } : {}),\n })\n }\n return changes\n}\n\n/** Legacy callers intentionally receive only the opaque snapshot checksum. */\nexport function calculateGenerateWatchStructureChecksum(options: GenerateWatchStructureOptions): string {\n return collectGenerateWatchStructureSnapshot(options).checksum\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,YAAY;AACnB,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,QAAQ;AACf,SAAS,kCAAkC;AAC3C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AA4CP,MAAM,cAAc,oBAAI,QAAuE;AAExF,SAAS,oCAAiE;AAC/E,QAAM,QAAQ,CAAC;AACf,cAAY,IAAI,OAAO,EAAE,OAAO,oBAAI,IAAI,EAAE,CAAC;AAC3C,SAAO;AACT;AAEA,MAAM,uBAAuB;AAAA,EAC3B;AAAA,EAAS;AAAA,EAAO;AAAA,EAAS;AAAA,EAAW;AAAA,EAAc;AAAA,EAAM;AAAA,EAAe;AAAA,EACvE;AAAA,EAAmB;AACrB;AACA,MAAM,wBAA0D;AAAA,EAC9D,eAAe;AAAA,EACf,wBAAwB;AAAA,EACxB,0BAA0B;AAAA,EAC1B,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,WAAW;AAAA,EACX,cAAc;AAAA,EACd,WAAW;AAAA,EACX,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,oBAAoB;AAAA,EACpB,yBAAyB;AAAA,EACzB,sBAAsB;AAAA,EACtB,uBAAuB;AAAA,EACvB,sBAAsB;AACxB;AAIA,MAAM,sBAAkC;AAAA,EACtC,QAAQ;AAAA,EACR,SAAS,CAAC,SAAS,uBAAuB,KAAK,CAAC,cAAc,KAAK,S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IACxF;AAAA,EACF;AACA,SAAO;AAAA,IACL,UAAU,SAAS,KAAK,UAAU,CAAC,CAAC,GAAG,QAAQ,OAAO,CAAC,GAAG,WAAW,CAAC,CAAC;AAAA,IACvE;AAAA,IACA;AAAA,EACF;AACF;AAEO,SAAS,oCACd,UACA,MACuB;AACvB,QAAM,UAAiC,CAAC;AACxC,aAAW,OAAO,CAAC,GAAG,oBAAI,IAAI,CAAC,GAAG,SAAS,QAAQ,KAAK,GAAG,GAAG,KAAK,QAAQ,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,UAAU,OAAO,QAAQ,KAAK,OAAO,QAAQ,IAAI,CAAC,GAAG;AACpJ,UAAM,SAAS,SAAS,QAAQ,IAAI,GAAG;AACvC,UAAM,QAAQ,KAAK,QAAQ,IAAI,GAAG;AAClC,QAAI,UAAU,SAAS,OAAO,gBAAgB,MAAM,eAAe,OAAO,SAAS,MAAM,QACpF,OAAO,aAAa,MAAM,YAAY,OAAO,gBAAgB,MAAM,YAAa;AACrF,UAAM,SAAS,SAAS;AACxB,YAAQ,KAAK;AAAA,MACX;AAAA,MAAK,MAAM,CAAC,SAAS,QAAQ,CAAC,QAAQ,WAAW;AAAA,MACjD,UAAU,OAAO;AAAA,MAAU,MAAM,OAAO;AAAA,MACxC,GAAI,OAAO,cAAc,EAAE,aAAa,OAAO,YAAY,IAAI,CAAC;AAAA,IAClE,CAAC;AAAA,EACH;AACA,SAAO;AACT;AAGO,SAAS,wCAAwC,SAAgD;AACtG,SAAO,sCAAsC,OAAO,EAAE;AACxD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const databaseDeclarationsPlugin = {
|
|
2
|
+
id: "database.declarations",
|
|
3
|
+
conventionFile: "database.ts",
|
|
4
|
+
importPrefix: "DATABASE_DECLARATIONS",
|
|
5
|
+
configExpr: (name, moduleId) => `{ moduleId: '${moduleId}', declarations: ${name}.databaseDeclarations }`,
|
|
6
|
+
outputFileName: "database-declarations.generated.ts",
|
|
7
|
+
buildOutput: ({ importSection, entriesLiteral }) => `// AUTO-GENERATED by mercato generate registry
|
|
8
|
+
import type { DatabaseModuleDeclarationEntry } from '@open-mercato/shared/lib/db/declarations'
|
|
9
|
+
${importSection}
|
|
10
|
+
export const databaseModuleDeclarations: DatabaseModuleDeclarationEntry[] = [${entriesLiteral}]
|
|
11
|
+
`,
|
|
12
|
+
bootstrapRegistration: {
|
|
13
|
+
entriesExportName: "databaseModuleDeclarations",
|
|
14
|
+
registrationImports: ["import { registerDatabaseModuleDeclarations } from '@open-mercato/shared/lib/db/declarations'"],
|
|
15
|
+
buildCall: (name) => `registerDatabaseModuleDeclarations(${name})`
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
databaseDeclarationsPlugin
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=database-declarations.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/lib/generators/database-declarations.ts"],
|
|
4
|
+
"sourcesContent": ["import type { GeneratorPlugin } from '@open-mercato/shared/modules/generators'\n\nexport const databaseDeclarationsPlugin: GeneratorPlugin = {\n id: 'database.declarations',\n conventionFile: 'database.ts',\n importPrefix: 'DATABASE_DECLARATIONS',\n configExpr: (name, moduleId) => `{ moduleId: '${moduleId}', declarations: ${name}.databaseDeclarations }`,\n outputFileName: 'database-declarations.generated.ts',\n buildOutput: ({ importSection, entriesLiteral }) => `// AUTO-GENERATED by mercato generate registry\nimport type { DatabaseModuleDeclarationEntry } from '@open-mercato/shared/lib/db/declarations'\n${importSection}\nexport const databaseModuleDeclarations: DatabaseModuleDeclarationEntry[] = [${entriesLiteral}]\n`,\n bootstrapRegistration: {\n entriesExportName: 'databaseModuleDeclarations',\n registrationImports: [\"import { registerDatabaseModuleDeclarations } from '@open-mercato/shared/lib/db/declarations'\"],\n buildCall: (name) => `registerDatabaseModuleDeclarations(${name})`,\n },\n}\n"],
|
|
5
|
+
"mappings": "AAEO,MAAM,6BAA8C;AAAA,EACzD,IAAI;AAAA,EACJ,gBAAgB;AAAA,EAChB,cAAc;AAAA,EACd,YAAY,CAAC,MAAM,aAAa,gBAAgB,QAAQ,oBAAoB,IAAI;AAAA,EAChF,gBAAgB;AAAA,EAChB,aAAa,CAAC,EAAE,eAAe,eAAe,MAAM;AAAA;AAAA,EAEpD,aAAa;AAAA,+EACgE,cAAc;AAAA;AAAA,EAE3F,uBAAuB;AAAA,IACrB,mBAAmB;AAAA,IACnB,qBAAqB,CAAC,+FAA+F;AAAA,IACrH,WAAW,CAAC,SAAS,sCAAsC,IAAI;AAAA,EACjE;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -70,6 +70,7 @@ import {
|
|
|
70
70
|
resolveStandaloneSourceMirrorBase
|
|
71
71
|
} from "./scanner.js";
|
|
72
72
|
import { loadGeneratorExtensions } from "./extensions/index.js";
|
|
73
|
+
import { databaseDeclarationsPlugin } from "./database-declarations.js";
|
|
73
74
|
import { resolveDashboardWidgetKey } from "./extensions/dashboard-widgets.js";
|
|
74
75
|
import { prepareCrudFormSectionRegistries, writeCrudFormSectionRegistries, writeDerivedCrudFormSectionRoutes } from "./form-sections.js";
|
|
75
76
|
import {
|
|
@@ -2841,8 +2842,12 @@ async function generateModuleRegistryFromDiscovery(options) {
|
|
|
2841
2842
|
const outputDir = resolver.getOutputDir();
|
|
2842
2843
|
const enabled = discovery.enabled;
|
|
2843
2844
|
const extensions = loadGeneratorExtensions(resolver);
|
|
2844
|
-
const pluginRegistry = /* @__PURE__ */ new Map(
|
|
2845
|
-
|
|
2845
|
+
const pluginRegistry = /* @__PURE__ */ new Map([
|
|
2846
|
+
[databaseDeclarationsPlugin.id, databaseDeclarationsPlugin]
|
|
2847
|
+
]);
|
|
2848
|
+
const pluginState = /* @__PURE__ */ new Map([
|
|
2849
|
+
[databaseDeclarationsPlugin.id, { imports: [], configs: [] }]
|
|
2850
|
+
]);
|
|
2846
2851
|
for (const discovered of discovery.modules) {
|
|
2847
2852
|
const resolved = discovered.resolve("generators.ts");
|
|
2848
2853
|
if (!resolved) continue;
|
|
@@ -3888,10 +3893,21 @@ async function generateModuleRegistryCliFromDiscovery(options) {
|
|
|
3888
3893
|
const commandLoaderEntries = [];
|
|
3889
3894
|
const devSupervisorWorkers = [];
|
|
3890
3895
|
let schedulerStartStatus = "missing-module";
|
|
3891
|
-
let requiresFullBootstrap = selectsRegistryOutput(options, "supervisor") && (enabled.some((entry) => entry.devSupervisorRequiresFullBootstrap === true) || appDeclaresProgrammaticDevSupervisorOverrides(resolver.getAppDir()));
|
|
3896
|
+
let requiresFullBootstrap = selectsRegistryOutput(options, "supervisor") && (discovery.modules.some((module) => Boolean(module.resolve(databaseDeclarationsPlugin.conventionFile))) || enabled.some((entry) => entry.devSupervisorRequiresFullBootstrap === true) || appDeclaresProgrammaticDevSupervisorOverrides(resolver.getAppDir()));
|
|
3892
3897
|
for (const discovered of discovery.modules) {
|
|
3893
3898
|
const { modId, imps, appImportBase } = discovered;
|
|
3894
3899
|
commandLoaderEntries.push(...discovered.commandLoaderEntries);
|
|
3900
|
+
const generatorSource = discovered.resolve("generators.ts");
|
|
3901
|
+
if (generatorSource) {
|
|
3902
|
+
assertGeneratorPluginUsesTypeOnlyImports(generatorSource.absolutePath);
|
|
3903
|
+
try {
|
|
3904
|
+
const pluginModule = await import(buildCacheBustedSourceImportUrl(generatorSource.absolutePath));
|
|
3905
|
+
const plugins = pluginModule.generatorPlugins ?? pluginModule.default ?? [];
|
|
3906
|
+
requiresFullBootstrap ||= plugins.some((plugin) => Boolean(plugin.bootstrapRegistration));
|
|
3907
|
+
} catch {
|
|
3908
|
+
requiresFullBootstrap = true;
|
|
3909
|
+
}
|
|
3910
|
+
}
|
|
3895
3911
|
let cliImportName = null;
|
|
3896
3912
|
const translations = [];
|
|
3897
3913
|
const subscribers = [];
|