@open-mercato/cli 0.6.6-develop.6457.1.41b39a465a → 0.6.6-develop.6460.1.f94c74174c

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.
Files changed (75) hide show
  1. package/.turbo/turbo-build.log +45 -1
  2. package/build.mjs +25 -15
  3. package/dist/agentic/guides/module-facts.json +3375 -349
  4. package/dist/agentic/guides/modules/ai_assistant.md +57 -0
  5. package/dist/agentic/guides/modules/api_docs.md +39 -0
  6. package/dist/agentic/guides/modules/api_keys.md +41 -0
  7. package/dist/agentic/guides/modules/attachments.md +46 -0
  8. package/dist/agentic/guides/modules/audit_logs.md +42 -0
  9. package/dist/agentic/guides/modules/auth.md +1 -1
  10. package/dist/agentic/guides/modules/business_rules.md +44 -0
  11. package/dist/agentic/guides/modules/catalog.md +1 -1
  12. package/dist/agentic/guides/modules/channel_gmail.md +39 -0
  13. package/dist/agentic/guides/modules/channel_imap.md +39 -0
  14. package/dist/agentic/guides/modules/checkout.md +60 -0
  15. package/dist/agentic/guides/modules/communication_channels.md +65 -0
  16. package/dist/agentic/guides/modules/configs.md +42 -0
  17. package/dist/agentic/guides/modules/content.md +39 -0
  18. package/dist/agentic/guides/modules/currencies.md +1 -1
  19. package/dist/agentic/guides/modules/customer_accounts.md +1 -1
  20. package/dist/agentic/guides/modules/customers.md +1 -1
  21. package/dist/agentic/guides/modules/dashboards.md +43 -0
  22. package/dist/agentic/guides/modules/data_sync.md +1 -1
  23. package/dist/agentic/guides/modules/dictionaries.md +46 -0
  24. package/dist/agentic/guides/modules/directory.md +49 -0
  25. package/dist/agentic/guides/modules/entities.md +46 -0
  26. package/dist/agentic/guides/modules/events.md +39 -0
  27. package/dist/agentic/guides/modules/feature_toggles.md +42 -0
  28. package/dist/agentic/guides/modules/gateway_stripe.md +39 -0
  29. package/dist/agentic/guides/modules/generators.md +39 -0
  30. package/dist/agentic/guides/modules/inbox_ops.md +59 -0
  31. package/dist/agentic/guides/modules/integrations.md +1 -1
  32. package/dist/agentic/guides/modules/messages.md +55 -0
  33. package/dist/agentic/guides/modules/notifications.md +41 -0
  34. package/dist/agentic/guides/modules/onboarding.md +41 -0
  35. package/dist/agentic/guides/modules/payment_gateways.md +52 -0
  36. package/dist/agentic/guides/modules/perspectives.md +42 -0
  37. package/dist/agentic/guides/modules/planner.md +49 -0
  38. package/dist/agentic/guides/modules/portal.md +39 -0
  39. package/dist/agentic/guides/modules/progress.md +48 -0
  40. package/dist/agentic/guides/modules/query_index.md +46 -0
  41. package/dist/agentic/guides/modules/record_locks.md +53 -0
  42. package/dist/agentic/guides/modules/resources.md +62 -0
  43. package/dist/agentic/guides/modules/sales.md +1 -1
  44. package/dist/agentic/guides/modules/scheduler.md +46 -0
  45. package/dist/agentic/guides/modules/search.md +39 -0
  46. package/dist/agentic/guides/modules/security.md +67 -0
  47. package/dist/agentic/guides/modules/shipping_carriers.md +51 -0
  48. package/dist/agentic/guides/modules/sso.md +59 -0
  49. package/dist/agentic/guides/modules/staff.md +88 -0
  50. package/dist/agentic/guides/modules/storage_s3.md +39 -0
  51. package/dist/agentic/guides/modules/sync_akeneo.md +39 -0
  52. package/dist/agentic/guides/modules/sync_excel.md +41 -0
  53. package/dist/agentic/guides/modules/system_status_overlays.md +39 -0
  54. package/dist/agentic/guides/modules/translations.md +44 -0
  55. package/dist/agentic/guides/modules/webhooks.md +54 -0
  56. package/dist/agentic/guides/modules/workflows.md +1 -1
  57. package/dist/lib/generators/index.js +0 -2
  58. package/dist/lib/generators/index.js.map +2 -2
  59. package/dist/lib/generators/module-facts-discovery.js +46 -0
  60. package/dist/lib/generators/module-facts-discovery.js.map +7 -0
  61. package/dist/lib/generators/module-facts.js +14 -8
  62. package/dist/lib/generators/module-facts.js.map +2 -2
  63. package/dist/mercato.js +1 -3
  64. package/dist/mercato.js.map +2 -2
  65. package/package.json +5 -5
  66. package/src/__tests__/mercato.test.ts +0 -5
  67. package/src/lib/generators/__tests__/module-facts.bc-guard.test.ts +36 -23
  68. package/src/lib/generators/__tests__/module-facts.discovery.test.ts +88 -0
  69. package/src/lib/generators/index.ts +0 -1
  70. package/src/lib/generators/module-facts-discovery.ts +58 -0
  71. package/src/lib/generators/module-facts.ts +50 -10
  72. package/src/mercato.ts +0 -2
  73. package/dist/lib/generators/module-facts-generate.js +0 -52
  74. package/dist/lib/generators/module-facts-generate.js.map +0 -7
  75. package/src/lib/generators/module-facts-generate.ts +0 -68
@@ -0,0 +1,39 @@
1
+ # system_status_overlays — module facts (generated, do not edit)
2
+ <!-- generated from @open-mercato/core 0.6.6-develop.6460.1.f94c74174c — R1 staleness stamp -->
3
+
4
+ ## Entities
5
+
6
+ _none_
7
+
8
+ ## Events (0)
9
+
10
+ _none_
11
+
12
+ ## ACL features (0)
13
+
14
+ _none_
15
+
16
+ ## API routes
17
+
18
+ _none_
19
+
20
+ ## DI service tokens
21
+
22
+ _none_
23
+
24
+ ## Search entities
25
+
26
+ _none_
27
+
28
+ ## Host extension points
29
+
30
+ - Entity IDs: _none_
31
+ - Table IDs: _none_
32
+
33
+ ## Notifications
34
+
35
+ _none_
36
+
37
+ ## CLI
38
+
39
+ _none_
@@ -0,0 +1,44 @@
1
+ # translations — module facts (generated, do not edit)
2
+ <!-- generated from @open-mercato/core 0.6.6-develop.6460.1.f94c74174c — R1 staleness stamp -->
3
+
4
+ ## Entities
5
+
6
+ | Entity ID | Class | Table | Editable | CustomFields |
7
+ |---|---|---|---|---|
8
+ | translations:entity_translation | EntityTranslation | entity_translations | yes | no |
9
+
10
+ ## Events (2)
11
+
12
+ | ID | Category | Entity |
13
+ |---|---|---|
14
+ | translations.translation.updated | crud | translation |
15
+ | translations.translation.deleted | crud | translation |
16
+
17
+ ## ACL features (3)
18
+
19
+ translations.view · translations.manage · translations.manage_locales
20
+
21
+ ## API routes
22
+
23
+ _none_
24
+
25
+ ## DI service tokens
26
+
27
+ _none_
28
+
29
+ ## Search entities
30
+
31
+ _none_
32
+
33
+ ## Host extension points
34
+
35
+ - Entity IDs: _none_
36
+ - Table IDs: _none_
37
+
38
+ ## Notifications
39
+
40
+ _none_
41
+
42
+ ## CLI
43
+
44
+ _none_
@@ -0,0 +1,54 @@
1
+ # webhooks — module facts (generated, do not edit)
2
+ <!-- generated from @open-mercato/core 0.6.6-develop.6460.1.f94c74174c — R1 staleness stamp -->
3
+
4
+ ## Entities
5
+
6
+ | Entity ID | Class | Table | Editable | CustomFields |
7
+ |---|---|---|---|---|
8
+ | webhooks:webhook_entity | WebhookEntity | webhooks | yes | no |
9
+ | webhooks:webhook_delivery_entity | WebhookDeliveryEntity | webhook_deliveries | yes | no |
10
+ | webhooks:webhook_inbound_receipt_entity | WebhookInboundReceiptEntity | webhook_inbound_receipts | no | no |
11
+
12
+ ## Events (10)
13
+
14
+ | ID | Category | Entity |
15
+ |---|---|---|
16
+ | webhooks.webhook.created | — | webhook |
17
+ | webhooks.webhook.updated | — | webhook |
18
+ | webhooks.webhook.deleted | — | webhook |
19
+ | webhooks.delivery.enqueued | — | delivery |
20
+ | webhooks.delivery.succeeded | — | delivery |
21
+ | webhooks.delivery.failed | — | delivery |
22
+ | webhooks.delivery.exhausted | — | delivery |
23
+ | webhooks.webhook.disabled | — | webhook |
24
+ | webhooks.inbound.received | — | inbound |
25
+ | webhooks.secret.rotated | — | webhook |
26
+
27
+ ## ACL features (4)
28
+
29
+ webhooks.view · webhooks.manage · webhooks.secrets · webhooks.test
30
+
31
+ ## API routes
32
+
33
+ _none_
34
+
35
+ ## DI service tokens
36
+
37
+ _none_
38
+
39
+ ## Search entities
40
+
41
+ _none_
42
+
43
+ ## Host extension points
44
+
45
+ - Entity IDs: webhooks:webhook_entity · webhooks:webhook_delivery_entity · webhooks:webhook_inbound_receipt_entity
46
+ - Table IDs: webhooks.deliveries · webhooks.list
47
+
48
+ ## Notifications
49
+
50
+ webhooks.delivery.failed
51
+
52
+ ## CLI
53
+
54
+ _none_
@@ -1,5 +1,5 @@
1
1
  # workflows — module facts (generated, do not edit)
2
- <!-- generated from @open-mercato/core 0.6.6-develop.6457.1.41b39a465a — R1 staleness stamp -->
2
+ <!-- generated from @open-mercato/core 0.6.6-develop.6460.1.f94c74174c — R1 staleness stamp -->
3
3
 
4
4
  ## Entities
5
5
 
@@ -4,12 +4,10 @@ import { generateModuleEntities } from "./module-entities.js";
4
4
  import { generateModuleDi } from "./module-di.js";
5
5
  import { generateModulePackageSources } from "./module-package-sources.js";
6
6
  import { generateOpenApi } from "./openapi.js";
7
- import { generateModuleFacts } from "./module-facts-generate.js";
8
7
  export {
9
8
  generateEntityIds,
10
9
  generateModuleDi,
11
10
  generateModuleEntities,
12
- generateModuleFacts,
13
11
  generateModulePackageSources,
14
12
  generateModuleRegistry,
15
13
  generateModuleRegistryApp,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/generators/index.ts"],
4
- "sourcesContent": ["export { generateEntityIds, type EntityIdsOptions } from './entity-ids'\nexport { generateModuleRegistry, generateModuleRegistryApp, generateModuleRegistryCli, type ModuleRegistryOptions } from './module-registry'\nexport { generateModuleEntities, type ModuleEntitiesOptions } from './module-entities'\nexport { generateModuleDi, type ModuleDiOptions } from './module-di'\nexport { generateModulePackageSources, type ModulePackageSourcesOptions } from './module-package-sources'\nexport { generateOpenApi, type GenerateOpenApiOptions } from './openapi'\nexport { generateModuleFacts, type ModuleFactsOptions } from './module-facts-generate'\n"],
5
- "mappings": "AAAA,SAAS,yBAAgD;AACzD,SAAS,wBAAwB,2BAA2B,iCAA6D;AACzH,SAAS,8BAA0D;AACnE,SAAS,wBAA8C;AACvD,SAAS,oCAAsE;AAC/E,SAAS,uBAAoD;AAC7D,SAAS,2BAAoD;",
4
+ "sourcesContent": ["export { generateEntityIds, type EntityIdsOptions } from './entity-ids'\nexport { generateModuleRegistry, generateModuleRegistryApp, generateModuleRegistryCli, type ModuleRegistryOptions } from './module-registry'\nexport { generateModuleEntities, type ModuleEntitiesOptions } from './module-entities'\nexport { generateModuleDi, type ModuleDiOptions } from './module-di'\nexport { generateModulePackageSources, type ModulePackageSourcesOptions } from './module-package-sources'\nexport { generateOpenApi, type GenerateOpenApiOptions } from './openapi'\n"],
5
+ "mappings": "AAAA,SAAS,yBAAgD;AACzD,SAAS,wBAAwB,2BAA2B,iCAA6D;AACzH,SAAS,8BAA0D;AACnE,SAAS,wBAA8C;AACvD,SAAS,oCAAsE;AAC/E,SAAS,uBAAoD;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,46 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { discoverModulesInPackage } from "../module-package.js";
4
+ const READABLE_CONVENTION_FILES = [
5
+ "index",
6
+ "acl",
7
+ "events",
8
+ "di",
9
+ path.join("data", "entities"),
10
+ path.join("db", "entities")
11
+ ];
12
+ function hasReadableModuleSource(moduleRoot) {
13
+ if (!fs.existsSync(moduleRoot)) return false;
14
+ for (const basename of READABLE_CONVENTION_FILES) {
15
+ for (const extension of [".ts", ".tsx"]) {
16
+ if (fs.existsSync(path.join(moduleRoot, `${basename}${extension}`))) return true;
17
+ }
18
+ }
19
+ return false;
20
+ }
21
+ function dedupeById(sources) {
22
+ const seen = /* @__PURE__ */ new Set();
23
+ const result = [];
24
+ for (const source of sources) {
25
+ if (seen.has(source.moduleId)) continue;
26
+ seen.add(source.moduleId);
27
+ result.push(source);
28
+ }
29
+ return result;
30
+ }
31
+ function discoverPackageModuleSources(resolver) {
32
+ const sources = [];
33
+ for (const pkg of resolver.discoverPackages()) {
34
+ for (const discovered of discoverModulesInPackage(pkg.path)) {
35
+ const moduleRoot = path.join(pkg.modulesPath, discovered.moduleId);
36
+ if (!hasReadableModuleSource(moduleRoot)) continue;
37
+ sources.push({ moduleId: discovered.moduleId, moduleRoot, from: pkg.name });
38
+ }
39
+ }
40
+ return dedupeById(sources);
41
+ }
42
+ export {
43
+ discoverPackageModuleSources,
44
+ hasReadableModuleSource
45
+ };
46
+ //# sourceMappingURL=module-facts-discovery.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/lib/generators/module-facts-discovery.ts"],
4
+ "sourcesContent": ["import fs from 'node:fs'\nimport path from 'node:path'\nimport type { PackageResolver } from '../resolver'\nimport { discoverModulesInPackage } from '../module-package'\nimport type { ModuleFactSource } from './module-facts'\n\nconst READABLE_CONVENTION_FILES = [\n 'index',\n 'acl',\n 'events',\n 'di',\n path.join('data', 'entities'),\n path.join('db', 'entities'),\n]\n\n/**\n * True when the module directory exposes at least one recognised convention file as\n * TypeScript source. This is the auto-discovery boundary that skips `.js`-only\n * installs (standalone `node_modules/@open-mercato/<pkg>/dist/modules`) \u2014 the extractor's\n * ts-morph reader only parses `.ts`/`.tsx`, so a `.js`-only root would yield empty facts.\n */\nexport function hasReadableModuleSource(moduleRoot: string): boolean {\n if (!fs.existsSync(moduleRoot)) return false\n for (const basename of READABLE_CONVENTION_FILES) {\n for (const extension of ['.ts', '.tsx']) {\n if (fs.existsSync(path.join(moduleRoot, `${basename}${extension}`))) return true\n }\n }\n return false\n}\n\nfunction dedupeById(sources: ModuleFactSource[]): ModuleFactSource[] {\n const seen = new Set<string>()\n const result: ModuleFactSource[] = []\n for (const source of sources) {\n if (seen.has(source.moduleId)) continue\n seen.add(source.moduleId)\n result.push(source)\n }\n return result\n}\n\n/**\n * Package-scan discovery for the create-app build: every package-provided module\n * across `@open-mercato/*` workspace packages (core plus others), never `apps/*`\n * demo modules. Routes through the resolver rather than hardcoded paths.\n */\nexport function discoverPackageModuleSources(resolver: PackageResolver): ModuleFactSource[] {\n const sources: ModuleFactSource[] = []\n for (const pkg of resolver.discoverPackages()) {\n for (const discovered of discoverModulesInPackage(pkg.path)) {\n const moduleRoot = path.join(pkg.modulesPath, discovered.moduleId)\n if (!hasReadableModuleSource(moduleRoot)) continue\n sources.push({ moduleId: discovered.moduleId, moduleRoot, from: pkg.name })\n }\n }\n return dedupeById(sources)\n}\n"],
5
+ "mappings": "AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AAEjB,SAAS,gCAAgC;AAGzC,MAAM,4BAA4B;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,KAAK,KAAK,QAAQ,UAAU;AAAA,EAC5B,KAAK,KAAK,MAAM,UAAU;AAC5B;AAQO,SAAS,wBAAwB,YAA6B;AACnE,MAAI,CAAC,GAAG,WAAW,UAAU,EAAG,QAAO;AACvC,aAAW,YAAY,2BAA2B;AAChD,eAAW,aAAa,CAAC,OAAO,MAAM,GAAG;AACvC,UAAI,GAAG,WAAW,KAAK,KAAK,YAAY,GAAG,QAAQ,GAAG,SAAS,EAAE,CAAC,EAAG,QAAO;AAAA,IAC9E;AAAA,EACF;AACA,SAAO;AACT;AAEA,SAAS,WAAW,SAAiD;AACnE,QAAM,OAAO,oBAAI,IAAY;AAC7B,QAAM,SAA6B,CAAC;AACpC,aAAW,UAAU,SAAS;AAC5B,QAAI,KAAK,IAAI,OAAO,QAAQ,EAAG;AAC/B,SAAK,IAAI,OAAO,QAAQ;AACxB,WAAO,KAAK,MAAM;AAAA,EACpB;AACA,SAAO;AACT;AAOO,SAAS,6BAA6B,UAA+C;AAC1F,QAAM,UAA8B,CAAC;AACrC,aAAW,OAAO,SAAS,iBAAiB,GAAG;AAC7C,eAAW,cAAc,yBAAyB,IAAI,IAAI,GAAG;AAC3D,YAAM,aAAa,KAAK,KAAK,IAAI,aAAa,WAAW,QAAQ;AACjE,UAAI,CAAC,wBAAwB,UAAU,EAAG;AAC1C,cAAQ,KAAK,EAAE,UAAU,WAAW,UAAU,YAAY,MAAM,IAAI,KAAK,CAAC;AAAA,IAC5E;AAAA,EACF;AACA,SAAO,WAAW,OAAO;AAC3B;",
6
+ "names": []
7
+ }
@@ -537,8 +537,11 @@ function extractModuleMeta(indexFilePath) {
537
537
  };
538
538
  }
539
539
  function extractModuleFacts(options) {
540
- const { moduleId, coreSrcRoot, coreVersion = null } = options;
541
- const moduleRoot = path.join(coreSrcRoot, moduleId);
540
+ const { moduleId, coreVersion = null } = options;
541
+ const moduleRoot = options.moduleRoot ?? (options.coreSrcRoot ? path.join(options.coreSrcRoot, moduleId) : null);
542
+ if (!moduleRoot) {
543
+ throw new Error(`[internal] extractModuleFacts requires moduleRoot or coreSrcRoot for module "${moduleId}"`);
544
+ }
542
545
  const entitiesFilePath = resolveConventionFile(path.join(moduleRoot, "data"), "entities") ?? resolveConventionFile(path.join(moduleRoot, "db"), "entities") ?? resolveConventionFile(path.join(moduleRoot, "data"), "schema");
543
546
  const ceFilePath = resolveConventionFile(moduleRoot, "ce");
544
547
  const eventsFilePath = resolveConventionFile(moduleRoot, "events");
@@ -704,20 +707,23 @@ function renderModuleFactsJson(factsByModule) {
704
707
  `;
705
708
  }
706
709
  function extractAllModuleFacts(options) {
707
- const moduleIds = options.moduleIds ?? MODULE_FACTS_ALLOWLIST;
710
+ const sources = options.sources ? [...options.sources] : options.coreSrcRoot ? (options.moduleIds ?? MODULE_FACTS_ALLOWLIST).map((moduleId) => ({
711
+ moduleId,
712
+ moduleRoot: path.join(options.coreSrcRoot, moduleId)
713
+ })) : [];
708
714
  const factsByModule = {};
709
715
  const markdownByModule = {};
710
716
  const warnings = [];
711
- for (const moduleId of moduleIds) {
717
+ for (const source of sources) {
712
718
  const facts = extractModuleFacts({
713
- moduleId,
714
- coreSrcRoot: options.coreSrcRoot,
719
+ moduleId: source.moduleId,
720
+ moduleRoot: source.moduleRoot,
715
721
  coreVersion: options.coreVersion ?? null,
716
722
  registryPath: options.registryPath ?? null,
717
723
  registrySource: options.registrySource ?? null
718
724
  });
719
- factsByModule[moduleId] = facts;
720
- markdownByModule[moduleId] = renderModuleFactsMarkdown(facts);
725
+ factsByModule[source.moduleId] = facts;
726
+ markdownByModule[source.moduleId] = renderModuleFactsMarkdown(facts);
721
727
  warnings.push(...facts.warnings);
722
728
  }
723
729
  return { factsByModule, markdownByModule, warnings };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/lib/generators/module-facts.ts"],
4
- "sourcesContent": ["import fs from 'node:fs'\nimport path from 'node:path'\nimport ts from 'typescript'\nimport { toSnake } from '../utils'\n\nexport interface ModuleEntityFact {\n id: string\n class: string\n table: string\n editable: boolean\n customFields: boolean\n}\n\nexport interface ApiRouteAuthRule {\n requireAuth?: boolean\n requireFeatures?: string[]\n requireRoles?: string[]\n}\n\nexport interface ModuleApiRouteFact {\n path: string\n methods: string[]\n auth: Record<string, ApiRouteAuthRule>\n}\n\nexport interface ModuleEventFact {\n id: string\n label?: string\n category: string | null\n entity: string | null\n}\n\nexport interface ModuleHostTokens {\n entityIds: string[]\n tableIds: string[]\n}\n\nexport interface ModuleFacts {\n module: string\n title: string | null\n description: string | null\n coreVersion: string | null\n entities: ModuleEntityFact[]\n events: ModuleEventFact[]\n aclFeatures: string[]\n apiRoutes: ModuleApiRouteFact[]\n diTokens: string[]\n searchEntities: string[]\n hostTokens: ModuleHostTokens\n notifications: string[]\n cli: string[]\n warnings: string[]\n}\n\nexport interface ExtractModuleFactsOptions {\n moduleId: string\n coreSrcRoot: string\n coreVersion?: string | null\n registryPath?: string | null\n registrySource?: string | null\n}\n\nexport const MODULE_FACTS_ALLOWLIST = [\n 'auth',\n 'catalog',\n 'currencies',\n 'customer_accounts',\n 'customers',\n 'data_sync',\n 'integrations',\n 'sales',\n 'workflows',\n] as const\n\nexport type ModuleFactsModuleId = (typeof MODULE_FACTS_ALLOWLIST)[number]\n\nfunction readSourceFile(filePath: string): ts.SourceFile | null {\n if (!fs.existsSync(filePath)) return null\n const source = fs.readFileSync(filePath, 'utf8')\n const scriptKind = filePath.endsWith('.tsx') ? ts.ScriptKind.TSX : ts.ScriptKind.TS\n return ts.createSourceFile(filePath, source, ts.ScriptTarget.ES2020, true, scriptKind)\n}\n\nfunction resolveConventionFile(baseDir: string, basename: string): string | null {\n for (const extension of ['.ts', '.tsx']) {\n const candidate = path.join(baseDir, `${basename}${extension}`)\n if (fs.existsSync(candidate)) return candidate\n }\n return null\n}\n\nfunction readStringPropertyInitializer(\n objectLiteral: ts.ObjectLiteralExpression,\n propertyName: string,\n): string | undefined {\n for (const property of objectLiteral.properties) {\n if (!ts.isPropertyAssignment(property)) continue\n const name = ts.isIdentifier(property.name)\n ? property.name.text\n : ts.isStringLiteralLike(property.name)\n ? property.name.text\n : undefined\n if (name !== propertyName) continue\n if (ts.isStringLiteralLike(property.initializer)) return property.initializer.text\n return undefined\n }\n return undefined\n}\n\nfunction getClassDecoratorCall(node: ts.ClassDeclaration, decoratorName: string): ts.CallExpression | undefined {\n const decorators = ts.canHaveDecorators(node) ? ts.getDecorators(node) ?? [] : []\n for (const decorator of decorators) {\n const expression = decorator.expression\n if (!ts.isCallExpression(expression)) continue\n if (ts.isIdentifier(expression.expression) && expression.expression.text === decoratorName) {\n return expression\n }\n }\n return undefined\n}\n\nfunction readDecoratorTableName(decoratorCall: ts.CallExpression): string | undefined {\n const firstArgument = decoratorCall.arguments[0]\n if (!firstArgument || !ts.isObjectLiteralExpression(firstArgument)) return undefined\n return readStringPropertyInitializer(firstArgument, 'tableName')\n}\n\nfunction getPropertyDecoratorName(member: ts.PropertyDeclaration): string | undefined {\n const decorators = ts.canHaveDecorators(member) ? ts.getDecorators(member) ?? [] : []\n for (const decorator of decorators) {\n const expression = decorator.expression\n if (!ts.isCallExpression(expression)) continue\n const firstArgument = expression.arguments[0]\n if (!firstArgument || !ts.isObjectLiteralExpression(firstArgument)) continue\n const columnName = readStringPropertyInitializer(firstArgument, 'name')\n if (columnName) return columnName\n }\n return undefined\n}\n\nfunction classHasUpdatedAtColumn(node: ts.ClassDeclaration): boolean {\n for (const member of node.members) {\n if (!ts.isPropertyDeclaration(member) || !member.name) continue\n const propertyName = ts.isIdentifier(member.name)\n ? member.name.text\n : ts.isStringLiteralLike(member.name)\n ? member.name.text\n : undefined\n if (propertyName === 'updatedAt') return true\n if (getPropertyDecoratorName(member) === 'updated_at') return true\n }\n return false\n}\n\nfunction collectCustomFieldEntityIds(ceFilePath: string | null): Set<string> {\n const result = new Set<string>()\n if (!ceFilePath) return result\n const sourceFile = readSourceFile(ceFilePath)\n if (!sourceFile) return result\n\n const visit = (node: ts.Node): void => {\n if (ts.isObjectLiteralExpression(node)) {\n const id = readStringPropertyInitializer(node, 'id')\n if (id && id.includes(':')) result.add(id)\n }\n node.forEachChild(visit)\n }\n sourceFile.forEachChild(visit)\n return result\n}\n\nfunction extractEntities(\n moduleId: string,\n entitiesFilePath: string | null,\n customFieldEntityIds: Set<string>,\n): ModuleEntityFact[] {\n const sourceFile = entitiesFilePath ? readSourceFile(entitiesFilePath) : null\n if (!sourceFile) return []\n\n const facts: ModuleEntityFact[] = []\n sourceFile.forEachChild((node) => {\n if (!ts.isClassDeclaration(node) || !node.name) return\n const isExported = node.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword)\n if (!isExported) return\n const entityDecorator = getClassDecoratorCall(node, 'Entity')\n if (!entityDecorator) return\n\n const className = node.name.text\n const table = readDecoratorTableName(entityDecorator)\n if (!table) return\n\n const entityId = `${moduleId}:${toSnake(className)}`\n facts.push({\n id: entityId,\n class: className,\n table,\n editable: classHasUpdatedAtColumn(node),\n customFields: customFieldEntityIds.has(entityId),\n })\n })\n\n return facts\n}\n\nfunction unwrapExpression(expression: ts.Expression): ts.Expression {\n let current = expression\n while (ts.isAsExpression(current) || ts.isParenthesizedExpression(current) || ts.isTypeAssertionExpression(current)) {\n current = current.expression\n }\n return current\n}\n\nfunction unwrapArrayLiteral(expression: ts.Expression): ts.ArrayLiteralExpression | null {\n const current = unwrapExpression(expression)\n return ts.isArrayLiteralExpression(current) ? current : null\n}\n\nfunction getPropertyName(property: ts.ObjectLiteralElementLike): string | undefined {\n if (!ts.isPropertyAssignment(property) && !ts.isShorthandPropertyAssignment(property)) return undefined\n const name = property.name\n if (!name) return undefined\n if (ts.isIdentifier(name)) return name.text\n if (ts.isStringLiteralLike(name)) return name.text\n return undefined\n}\n\nfunction getObjectPropertyInitializer(\n objectLiteral: ts.ObjectLiteralExpression,\n propertyName: string,\n): ts.Expression | undefined {\n for (const property of objectLiteral.properties) {\n if (!ts.isPropertyAssignment(property)) continue\n if (getPropertyName(property) === propertyName) return property.initializer\n }\n return undefined\n}\n\nfunction findObjectLiteralDeclaration(\n sourceFile: ts.SourceFile,\n variableName: string,\n): ts.ObjectLiteralExpression | null {\n let result: ts.ObjectLiteralExpression | null = null\n const visit = (node: ts.Node): void => {\n if (result) return\n if (\n ts.isVariableDeclaration(node) &&\n ts.isIdentifier(node.name) &&\n node.name.text === variableName &&\n node.initializer\n ) {\n const unwrapped = unwrapExpression(node.initializer)\n if (ts.isObjectLiteralExpression(unwrapped)) {\n result = unwrapped\n return\n }\n }\n node.forEachChild(visit)\n }\n sourceFile.forEachChild(visit)\n return result\n}\n\nfunction buildVariableInitializerMap(sourceFile: ts.SourceFile): Map<string, ts.Expression> {\n const initializers = new Map<string, ts.Expression>()\n const visit = (node: ts.Node): void => {\n if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name) && node.initializer) {\n if (!initializers.has(node.name.text)) initializers.set(node.name.text, node.initializer)\n }\n node.forEachChild(visit)\n }\n sourceFile.forEachChild(visit)\n return initializers\n}\n\nfunction resolveToObjectLiteral(\n expression: ts.Expression,\n initializers: Map<string, ts.Expression>,\n): ts.ObjectLiteralExpression | null {\n const unwrapped = unwrapExpression(expression)\n if (ts.isObjectLiteralExpression(unwrapped)) return unwrapped\n if (ts.isIdentifier(unwrapped)) {\n const referenced = initializers.get(unwrapped.text)\n if (referenced) return resolveToObjectLiteral(referenced, initializers)\n }\n return null\n}\n\nfunction resolveToArrayLiteral(\n expression: ts.Expression,\n initializers: Map<string, ts.Expression>,\n): ts.ArrayLiteralExpression | null {\n const unwrapped = unwrapExpression(expression)\n if (ts.isArrayLiteralExpression(unwrapped)) return unwrapped\n if (ts.isIdentifier(unwrapped)) {\n const referenced = initializers.get(unwrapped.text)\n if (referenced) return resolveToArrayLiteral(referenced, initializers)\n }\n return null\n}\n\nfunction findDefaultExportExpression(sourceFile: ts.SourceFile): ts.Expression | null {\n for (const statement of sourceFile.statements) {\n if (ts.isExportAssignment(statement) && !statement.isExportEquals) return statement.expression\n }\n return null\n}\n\nfunction findArrayLiteralDeclaration(\n sourceFile: ts.SourceFile,\n variableName: string,\n): ts.ArrayLiteralExpression | null {\n let result: ts.ArrayLiteralExpression | null = null\n const visit = (node: ts.Node): void => {\n if (result) return\n if (\n ts.isVariableDeclaration(node) &&\n ts.isIdentifier(node.name) &&\n node.name.text === variableName &&\n node.initializer\n ) {\n const arrayLiteral = unwrapArrayLiteral(node.initializer)\n if (arrayLiteral) {\n result = arrayLiteral\n return\n }\n }\n node.forEachChild(visit)\n }\n sourceFile.forEachChild(visit)\n return result\n}\n\nfunction extractEvents(eventsFilePath: string | null): ModuleEventFact[] {\n const sourceFile = eventsFilePath ? readSourceFile(eventsFilePath) : null\n if (!sourceFile) return []\n\n const eventsArray = findArrayLiteralDeclaration(sourceFile, 'events')\n if (!eventsArray) return []\n\n const facts: ModuleEventFact[] = []\n for (const element of eventsArray.elements) {\n if (!ts.isObjectLiteralExpression(element)) continue\n const id = readStringPropertyInitializer(element, 'id')\n if (!id) continue\n const label = readStringPropertyInitializer(element, 'label')\n const category = readStringPropertyInitializer(element, 'category')\n const entity = readStringPropertyInitializer(element, 'entity')\n const fact: ModuleEventFact = {\n id,\n category: category ?? null,\n entity: entity ?? null,\n }\n if (label !== undefined) fact.label = label\n facts.push(fact)\n }\n\n return facts\n}\n\nfunction extractAclFeatures(aclFilePath: string | null): string[] {\n const sourceFile = aclFilePath ? readSourceFile(aclFilePath) : null\n if (!sourceFile) return []\n\n const featuresArray = findArrayLiteralDeclaration(sourceFile, 'features')\n if (!featuresArray) return []\n\n const featureIds: string[] = []\n const seen = new Set<string>()\n for (const element of featuresArray.elements) {\n let featureId: string | undefined\n if (ts.isObjectLiteralExpression(element)) {\n featureId = readStringPropertyInitializer(element, 'id')\n } else if (ts.isStringLiteralLike(element)) {\n featureId = element.text\n }\n if (!featureId || seen.has(featureId)) continue\n seen.add(featureId)\n featureIds.push(featureId)\n }\n\n return featureIds\n}\n\nfunction readBooleanPropertyInitializer(\n objectLiteral: ts.ObjectLiteralExpression,\n propertyName: string,\n): boolean | undefined {\n const initializer = getObjectPropertyInitializer(objectLiteral, propertyName)\n if (!initializer) return undefined\n if (initializer.kind === ts.SyntaxKind.TrueKeyword) return true\n if (initializer.kind === ts.SyntaxKind.FalseKeyword) return false\n return undefined\n}\n\nfunction readStringArrayPropertyInitializer(\n objectLiteral: ts.ObjectLiteralExpression,\n propertyName: string,\n): string[] | undefined {\n const initializer = getObjectPropertyInitializer(objectLiteral, propertyName)\n if (!initializer) return undefined\n const arrayLiteral = unwrapArrayLiteral(initializer)\n if (!arrayLiteral) return undefined\n const values: string[] = []\n for (const element of arrayLiteral.elements) {\n if (ts.isStringLiteralLike(element)) values.push(element.text)\n }\n return values\n}\n\nfunction parseApiRouteAuthRule(metadataLiteral: ts.ObjectLiteralExpression): ApiRouteAuthRule {\n const rule: ApiRouteAuthRule = {}\n const requireAuth = readBooleanPropertyInitializer(metadataLiteral, 'requireAuth')\n if (requireAuth !== undefined) rule.requireAuth = requireAuth\n const requireFeatures = readStringArrayPropertyInitializer(metadataLiteral, 'requireFeatures')\n if (requireFeatures && requireFeatures.length > 0) rule.requireFeatures = requireFeatures\n const requireRoles = readStringArrayPropertyInitializer(metadataLiteral, 'requireRoles')\n if (requireRoles && requireRoles.length > 0) rule.requireRoles = requireRoles\n return rule\n}\n\nfunction parseApiRouteEntry(entryLiteral: ts.ObjectLiteralExpression): ModuleApiRouteFact | null {\n const routePath = readStringPropertyInitializer(entryLiteral, 'path')\n if (!routePath) return null\n\n const methods: string[] = []\n const seenMethods = new Set<string>()\n const handlersInitializer = getObjectPropertyInitializer(entryLiteral, 'handlers')\n if (handlersInitializer && ts.isObjectLiteralExpression(handlersInitializer)) {\n for (const property of handlersInitializer.properties) {\n const methodName = getPropertyName(property)\n if (methodName && !seenMethods.has(methodName)) {\n seenMethods.add(methodName)\n methods.push(methodName)\n }\n }\n } else {\n const singleMethod = readStringPropertyInitializer(entryLiteral, 'method')\n if (singleMethod && !seenMethods.has(singleMethod)) {\n seenMethods.add(singleMethod)\n methods.push(singleMethod)\n }\n }\n\n const auth: Record<string, ApiRouteAuthRule> = {}\n const metadataInitializer = getObjectPropertyInitializer(entryLiteral, 'metadata')\n if (metadataInitializer && ts.isObjectLiteralExpression(metadataInitializer)) {\n for (const property of metadataInitializer.properties) {\n if (!ts.isPropertyAssignment(property)) continue\n const methodName = getPropertyName(property)\n if (!methodName) continue\n const methodMetadata = unwrapExpression(property.initializer)\n if (!ts.isObjectLiteralExpression(methodMetadata)) continue\n auth[methodName] = parseApiRouteAuthRule(methodMetadata)\n if (!seenMethods.has(methodName)) {\n seenMethods.add(methodName)\n methods.push(methodName)\n }\n }\n }\n\n return { path: routePath, methods, auth }\n}\n\nfunction extractApiRoutes(\n moduleId: string,\n registrySource: string | null,\n registryDescription: string,\n warnings: string[],\n): ModuleApiRouteFact[] {\n if (registrySource == null) {\n warnings.push(`[module-facts] module registry unavailable (${registryDescription}); API route auth omitted for ${moduleId}`)\n return []\n }\n\n const sourceFile = ts.createSourceFile(\n 'module-registry.generated.ts',\n registrySource,\n ts.ScriptTarget.ES2020,\n true,\n ts.ScriptKind.TS,\n )\n\n const routes: ModuleApiRouteFact[] = []\n const seenPaths = new Set<string>()\n const visit = (node: ts.Node): void => {\n if (ts.isObjectLiteralExpression(node) && readStringPropertyInitializer(node, 'id') === moduleId) {\n const apisInitializer = getObjectPropertyInitializer(node, 'apis')\n const apisArray = apisInitializer ? unwrapArrayLiteral(apisInitializer) : null\n if (apisArray) {\n for (const element of apisArray.elements) {\n if (!ts.isObjectLiteralExpression(element)) continue\n const route = parseApiRouteEntry(element)\n if (route && !seenPaths.has(route.path)) {\n seenPaths.add(route.path)\n routes.push(route)\n }\n }\n }\n }\n node.forEachChild(visit)\n }\n sourceFile.forEachChild(visit)\n return routes\n}\n\nfunction resolveRegistrySource(options: ExtractModuleFactsOptions): { source: string | null; description: string } {\n if (typeof options.registrySource === 'string') {\n return { source: options.registrySource, description: 'registrySource' }\n }\n if (options.registryPath) {\n if (!fs.existsSync(options.registryPath)) {\n return { source: null, description: options.registryPath }\n }\n return { source: fs.readFileSync(options.registryPath, 'utf8'), description: options.registryPath }\n }\n return { source: null, description: 'registryPath not provided' }\n}\n\nfunction detectAwilixRegistrationKind(expression: ts.Expression): string | null {\n let current: ts.Expression = unwrapExpression(expression)\n while (ts.isCallExpression(current)) {\n const callee = current.expression\n if (ts.isIdentifier(callee)) return callee.text\n if (ts.isPropertyAccessExpression(callee)) {\n current = callee.expression\n continue\n }\n break\n }\n return null\n}\n\nfunction extractDiTokens(diFilePath: string | null): string[] {\n if (!diFilePath) return []\n const sourceFile = readSourceFile(diFilePath)\n if (!sourceFile) return []\n\n const tokens: string[] = []\n const seen = new Set<string>()\n const visit = (node: ts.Node): void => {\n if (\n ts.isCallExpression(node) &&\n ts.isPropertyAccessExpression(node.expression) &&\n node.expression.name.text === 'register'\n ) {\n const argument = node.arguments[0]\n if (argument && ts.isObjectLiteralExpression(argument)) {\n for (const property of argument.properties) {\n if (!ts.isPropertyAssignment(property)) continue\n const kind = detectAwilixRegistrationKind(property.initializer)\n if (kind !== 'asFunction' && kind !== 'asClass') continue\n const tokenName = getPropertyName(property)\n if (tokenName && !seen.has(tokenName)) {\n seen.add(tokenName)\n tokens.push(tokenName)\n }\n }\n }\n }\n node.forEachChild(visit)\n }\n sourceFile.forEachChild(visit)\n return tokens\n}\n\nfunction extractSearchEntities(searchFilePath: string | null, warnings: string[]): string[] {\n if (!searchFilePath) return []\n const sourceFile = readSourceFile(searchFilePath)\n if (!sourceFile) return []\n\n const searchConfig = findObjectLiteralDeclaration(sourceFile, 'searchConfig')\n if (!searchConfig) {\n warnings.push(`[module-facts] search.ts present but no searchConfig object literal: ${searchFilePath}`)\n return []\n }\n const entitiesInitializer = getObjectPropertyInitializer(searchConfig, 'entities')\n const entitiesArray = entitiesInitializer ? unwrapArrayLiteral(entitiesInitializer) : null\n if (!entitiesArray) {\n warnings.push(`[module-facts] searchConfig.entities is not an array literal: ${searchFilePath}`)\n return []\n }\n\n const entityIds: string[] = []\n const seen = new Set<string>()\n for (const element of entitiesArray.elements) {\n if (!ts.isObjectLiteralExpression(element)) continue\n const entityId = readStringPropertyInitializer(element, 'entityId')\n if (entityId && !seen.has(entityId)) {\n seen.add(entityId)\n entityIds.push(entityId)\n }\n }\n return entityIds\n}\n\nfunction extractNotifications(notificationsFilePath: string | null, warnings: string[]): string[] {\n if (!notificationsFilePath) return []\n const sourceFile = readSourceFile(notificationsFilePath)\n if (!sourceFile) return []\n\n const notificationsArray =\n findArrayLiteralDeclaration(sourceFile, 'notificationTypes') ??\n findArrayLiteralDeclaration(sourceFile, 'notifications')\n if (!notificationsArray) {\n warnings.push(`[module-facts] notifications.ts present but no notificationTypes array literal: ${notificationsFilePath}`)\n return []\n }\n\n const notificationIds: string[] = []\n const seen = new Set<string>()\n for (const element of notificationsArray.elements) {\n if (!ts.isObjectLiteralExpression(element)) continue\n const notificationId = readStringPropertyInitializer(element, 'type')\n if (notificationId && !seen.has(notificationId)) {\n seen.add(notificationId)\n notificationIds.push(notificationId)\n }\n }\n return notificationIds\n}\n\nfunction extractCli(cliFilePath: string | null, warnings: string[]): string[] {\n if (!cliFilePath) return []\n const sourceFile = readSourceFile(cliFilePath)\n if (!sourceFile) return []\n\n const defaultExport = findDefaultExportExpression(sourceFile)\n if (!defaultExport) {\n warnings.push(`[module-facts] cli.ts present but no default export: ${cliFilePath}`)\n return []\n }\n\n const initializers = buildVariableInitializerMap(sourceFile)\n const collectCommand = (objectLiteral: ts.ObjectLiteralExpression): string | undefined =>\n readStringPropertyInitializer(objectLiteral, 'command')\n\n const commands: string[] = []\n const seen = new Set<string>()\n const pushCommand = (command: string | undefined): void => {\n if (command && !seen.has(command)) {\n seen.add(command)\n commands.push(command)\n }\n }\n\n const arrayLiteral = resolveToArrayLiteral(defaultExport, initializers)\n if (arrayLiteral) {\n for (const element of arrayLiteral.elements) {\n const objectLiteral = resolveToObjectLiteral(element, initializers)\n if (objectLiteral) pushCommand(collectCommand(objectLiteral))\n }\n return commands\n }\n\n const singleObject = resolveToObjectLiteral(defaultExport, initializers)\n if (singleObject) {\n pushCommand(collectCommand(singleObject))\n return commands\n }\n\n warnings.push(`[module-facts] cli.ts default export is neither an array nor an object literal: ${cliFilePath}`)\n return commands\n}\n\nfunction listSourceFilesRecursive(directory: string): string[] {\n const files: string[] = []\n for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {\n if (entry.name === '__tests__' || entry.name === 'node_modules') continue\n const fullPath = path.join(directory, entry.name)\n if (entry.isDirectory()) {\n files.push(...listSourceFilesRecursive(fullPath))\n } else if (/\\.tsx?$/.test(entry.name) && !entry.name.endsWith('.d.ts')) {\n files.push(fullPath)\n }\n }\n return files\n}\n\nfunction extractTableIds(backendDir: string): string[] {\n if (!fs.existsSync(backendDir)) return []\n\n const tableIds: string[] = []\n const seen = new Set<string>()\n for (const filePath of listSourceFilesRecursive(backendDir)) {\n const sourceFile = readSourceFile(filePath)\n if (!sourceFile) continue\n const visit = (node: ts.Node): void => {\n if (ts.isPropertyAssignment(node)) {\n const propertyName = getPropertyName(node)\n if (\n (propertyName === 'tableId' || propertyName === 'extensionTableId') &&\n ts.isStringLiteralLike(node.initializer)\n ) {\n const value = node.initializer.text\n if (value && !seen.has(value)) {\n seen.add(value)\n tableIds.push(value)\n }\n }\n }\n node.forEachChild(visit)\n }\n sourceFile.forEachChild(visit)\n }\n tableIds.sort((a, b) => (a < b ? -1 : a > b ? 1 : 0))\n return tableIds\n}\n\nfunction extractHostEntityIds(entities: ModuleEntityFact[]): string[] {\n return entities.filter((entity) => entity.id.endsWith('_entity')).map((entity) => entity.id)\n}\n\nfunction extractModuleMeta(indexFilePath: string | null): { title: string | null; description: string | null } {\n if (!indexFilePath) return { title: null, description: null }\n const sourceFile = readSourceFile(indexFilePath)\n if (!sourceFile) return { title: null, description: null }\n const metadata = findObjectLiteralDeclaration(sourceFile, 'metadata')\n if (!metadata) return { title: null, description: null }\n return {\n title: readStringPropertyInitializer(metadata, 'title') ?? null,\n description: readStringPropertyInitializer(metadata, 'description') ?? null,\n }\n}\n\nexport function extractModuleFacts(options: ExtractModuleFactsOptions): ModuleFacts {\n const { moduleId, coreSrcRoot, coreVersion = null } = options\n const moduleRoot = path.join(coreSrcRoot, moduleId)\n\n const entitiesFilePath =\n resolveConventionFile(path.join(moduleRoot, 'data'), 'entities') ??\n resolveConventionFile(path.join(moduleRoot, 'db'), 'entities') ??\n resolveConventionFile(path.join(moduleRoot, 'data'), 'schema')\n const ceFilePath = resolveConventionFile(moduleRoot, 'ce')\n const eventsFilePath = resolveConventionFile(moduleRoot, 'events')\n const aclFilePath = resolveConventionFile(moduleRoot, 'acl')\n const diFilePath = resolveConventionFile(moduleRoot, 'di')\n const searchFilePath = resolveConventionFile(moduleRoot, 'search')\n const notificationsFilePath = resolveConventionFile(moduleRoot, 'notifications')\n const cliFilePath = resolveConventionFile(moduleRoot, 'cli')\n const indexFilePath = resolveConventionFile(moduleRoot, 'index')\n const backendDir = path.join(moduleRoot, 'backend')\n\n const warnings: string[] = []\n const { title, description } = extractModuleMeta(indexFilePath)\n const customFieldEntityIds = collectCustomFieldEntityIds(ceFilePath)\n const entities = extractEntities(moduleId, entitiesFilePath, customFieldEntityIds)\n const events = extractEvents(eventsFilePath)\n const aclFeatures = extractAclFeatures(aclFilePath)\n\n const { source: registrySource, description: registryDescription } = resolveRegistrySource(options)\n const apiRoutes = extractApiRoutes(moduleId, registrySource, registryDescription, warnings)\n const diTokens = extractDiTokens(diFilePath)\n const searchEntities = extractSearchEntities(searchFilePath, warnings)\n const notifications = extractNotifications(notificationsFilePath, warnings)\n const cli = extractCli(cliFilePath, warnings)\n const hostTokens: ModuleHostTokens = {\n entityIds: extractHostEntityIds(entities),\n tableIds: extractTableIds(backendDir),\n }\n\n return {\n module: moduleId,\n title,\n description,\n coreVersion,\n entities,\n events,\n aclFeatures,\n apiRoutes,\n diTokens,\n searchEntities,\n hostTokens,\n notifications,\n cli,\n warnings,\n }\n}\n\nexport interface ModuleFactsJsonEvent {\n id: string\n category: string | null\n entity: string | null\n}\n\nexport interface ModuleFactsJsonEntry {\n title: string | null\n description: string | null\n coreVersion: string | null\n entities: ModuleEntityFact[]\n events: ModuleFactsJsonEvent[]\n aclFeatures: string[]\n apiRoutes: ModuleApiRouteFact[]\n diTokens: string[]\n searchEntities: string[]\n hostTokens: ModuleHostTokens\n notifications: string[]\n cli: string[]\n}\n\nconst EMPTY_SECTION_MARKER = '_none_'\n\nfunction renderVersionStamp(coreVersion: string | null): string {\n const version = coreVersion && coreVersion.length > 0 ? coreVersion : '<unknown>'\n return `<!-- generated from @open-mercato/core ${version} \u2014 R1 staleness stamp -->`\n}\n\nfunction renderEntitiesSection(entities: ModuleEntityFact[]): string {\n if (entities.length === 0) return `## Entities\\n\\n${EMPTY_SECTION_MARKER}`\n const header = '| Entity ID | Class | Table | Editable | CustomFields |'\n const divider = '|---|---|---|---|---|'\n const rows = entities.map(\n (entity) =>\n `| ${entity.id} | ${entity.class} | ${entity.table} | ${entity.editable ? 'yes' : 'no'} | ${entity.customFields ? 'yes' : 'no'} |`,\n )\n return ['## Entities', '', header, divider, ...rows].join('\\n')\n}\n\nfunction renderEventsSection(events: ModuleEventFact[]): string {\n const heading = `## Events (${events.length})`\n if (events.length === 0) return `${heading}\\n\\n${EMPTY_SECTION_MARKER}`\n const header = '| ID | Category | Entity |'\n const divider = '|---|---|---|'\n const rows = events.map((event) => `| ${event.id} | ${event.category ?? '\u2014'} | ${event.entity ?? '\u2014'} |`)\n return [heading, '', header, divider, ...rows].join('\\n')\n}\n\nfunction renderInlineListSection(heading: string, values: string[]): string {\n if (values.length === 0) return `${heading}\\n\\n${EMPTY_SECTION_MARKER}`\n return `${heading}\\n\\n${values.join(' \u00B7 ')}`\n}\n\nfunction describeAuthRule(rule: ApiRouteAuthRule | undefined): string {\n if (!rule) return 'public'\n if (rule.requireFeatures && rule.requireFeatures.length > 0) return rule.requireFeatures.join(', ')\n if (rule.requireRoles && rule.requireRoles.length > 0) return rule.requireRoles.join(', ')\n if (rule.requireAuth) return 'auth'\n return 'public'\n}\n\nfunction renderApiRouteAuthCell(route: ModuleApiRouteFact): string {\n if (route.methods.length === 0) return '\u2014'\n const groups: Array<{ label: string; methods: string[] }> = []\n for (const method of route.methods) {\n const label = describeAuthRule(route.auth[method])\n const existing = groups.find((group) => group.label === label)\n if (existing) existing.methods.push(method)\n else groups.push({ label, methods: [method] })\n }\n return groups.map((group) => `${group.methods.join('/')} \u2192 ${group.label}`).join(' \u00B7 ')\n}\n\nfunction renderApiRoutesSection(routes: ModuleApiRouteFact[]): string {\n if (routes.length === 0) return `## API routes\\n\\n${EMPTY_SECTION_MARKER}`\n const header = '| Path | Methods | Auth (per-method requireFeatures) |'\n const divider = '|---|---|---|'\n const rows = routes.map(\n (route) => `| ${route.path} | ${route.methods.join(' ')} | ${renderApiRouteAuthCell(route)} |`,\n )\n return ['## API routes', '', header, divider, ...rows].join('\\n')\n}\n\nfunction renderHostTokensSection(hostTokens: ModuleHostTokens): string {\n const entityIdsLine = hostTokens.entityIds.length > 0 ? hostTokens.entityIds.join(' \u00B7 ') : EMPTY_SECTION_MARKER\n const tableIdsLine = hostTokens.tableIds.length > 0 ? hostTokens.tableIds.join(' \u00B7 ') : EMPTY_SECTION_MARKER\n return ['## Host extension points', '', `- Entity IDs: ${entityIdsLine}`, `- Table IDs: ${tableIdsLine}`].join('\\n')\n}\n\nexport function renderModuleFactsMarkdown(facts: ModuleFacts): string {\n const sections = [\n `# ${facts.module} \u2014 module facts (generated, do not edit)`,\n renderVersionStamp(facts.coreVersion),\n '',\n renderEntitiesSection(facts.entities),\n '',\n renderEventsSection(facts.events),\n '',\n renderInlineListSection(`## ACL features (${facts.aclFeatures.length})`, facts.aclFeatures),\n '',\n renderApiRoutesSection(facts.apiRoutes),\n '',\n renderInlineListSection('## DI service tokens', facts.diTokens),\n '',\n renderInlineListSection('## Search entities', facts.searchEntities),\n '',\n renderHostTokensSection(facts.hostTokens),\n '',\n renderInlineListSection('## Notifications', facts.notifications),\n '',\n renderInlineListSection('## CLI', facts.cli),\n '',\n ]\n return sections.join('\\n')\n}\n\nexport function toModuleFactsJsonEntry(facts: ModuleFacts): ModuleFactsJsonEntry {\n return {\n title: facts.title,\n description: facts.description,\n coreVersion: facts.coreVersion,\n entities: facts.entities,\n events: facts.events.map((event) => ({ id: event.id, category: event.category, entity: event.entity })),\n aclFeatures: facts.aclFeatures,\n apiRoutes: facts.apiRoutes,\n diTokens: facts.diTokens,\n searchEntities: facts.searchEntities,\n hostTokens: facts.hostTokens,\n notifications: facts.notifications,\n cli: facts.cli,\n }\n}\n\nexport function buildModuleFactsJsonObject(\n factsByModule: Record<string, ModuleFacts>,\n): Record<string, ModuleFactsJsonEntry> {\n const result: Record<string, ModuleFactsJsonEntry> = {}\n for (const moduleId of Object.keys(factsByModule).sort((a, b) => (a < b ? -1 : a > b ? 1 : 0))) {\n result[moduleId] = toModuleFactsJsonEntry(factsByModule[moduleId])\n }\n return result\n}\n\nexport function renderModuleFactsJson(factsByModule: Record<string, ModuleFacts>): string {\n return `${JSON.stringify(buildModuleFactsJsonObject(factsByModule), null, 2)}\\n`\n}\n\nexport interface ExtractAllModuleFactsOptions {\n coreSrcRoot: string\n registryPath?: string | null\n registrySource?: string | null\n coreVersion?: string | null\n moduleIds?: readonly string[]\n}\n\nexport interface ExtractAllModuleFactsResult {\n factsByModule: Record<string, ModuleFacts>\n markdownByModule: Record<string, string>\n warnings: string[]\n}\n\nexport function extractAllModuleFacts(options: ExtractAllModuleFactsOptions): ExtractAllModuleFactsResult {\n const moduleIds = options.moduleIds ?? MODULE_FACTS_ALLOWLIST\n const factsByModule: Record<string, ModuleFacts> = {}\n const markdownByModule: Record<string, string> = {}\n const warnings: string[] = []\n for (const moduleId of moduleIds) {\n const facts = extractModuleFacts({\n moduleId,\n coreSrcRoot: options.coreSrcRoot,\n coreVersion: options.coreVersion ?? null,\n registryPath: options.registryPath ?? null,\n registrySource: options.registrySource ?? null,\n })\n factsByModule[moduleId] = facts\n markdownByModule[moduleId] = renderModuleFactsMarkdown(facts)\n warnings.push(...facts.warnings)\n }\n return { factsByModule, markdownByModule, warnings }\n}\n"],
5
- "mappings": "AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,QAAQ;AACf,SAAS,eAAe;AA2DjB,MAAM,yBAAyB;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAIA,SAAS,eAAe,UAAwC;AAC9D,MAAI,CAAC,GAAG,WAAW,QAAQ,EAAG,QAAO;AACrC,QAAM,SAAS,GAAG,aAAa,UAAU,MAAM;AAC/C,QAAM,aAAa,SAAS,SAAS,MAAM,IAAI,GAAG,WAAW,MAAM,GAAG,WAAW;AACjF,SAAO,GAAG,iBAAiB,UAAU,QAAQ,GAAG,aAAa,QAAQ,MAAM,UAAU;AACvF;AAEA,SAAS,sBAAsB,SAAiB,UAAiC;AAC/E,aAAW,aAAa,CAAC,OAAO,MAAM,GAAG;AACvC,UAAM,YAAY,KAAK,KAAK,SAAS,GAAG,QAAQ,GAAG,SAAS,EAAE;AAC9D,QAAI,GAAG,WAAW,SAAS,EAAG,QAAO;AAAA,EACvC;AACA,SAAO;AACT;AAEA,SAAS,8BACP,eACA,cACoB;AACpB,aAAW,YAAY,cAAc,YAAY;AAC/C,QAAI,CAAC,GAAG,qBAAqB,QAAQ,EAAG;AACxC,UAAM,OAAO,GAAG,aAAa,SAAS,IAAI,IACtC,SAAS,KAAK,OACd,GAAG,oBAAoB,SAAS,IAAI,IAClC,SAAS,KAAK,OACd;AACN,QAAI,SAAS,aAAc;AAC3B,QAAI,GAAG,oBAAoB,SAAS,WAAW,EAAG,QAAO,SA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F;AAEO,SAAS,2BACd,eACsC;AACtC,QAAM,SAA+C,CAAC;AACtD,aAAW,YAAY,OAAO,KAAK,aAAa,EAAE,KAAK,CAAC,GAAG,MAAO,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,CAAE,GAAG;AAC9F,WAAO,QAAQ,IAAI,uBAAuB,cAAc,QAAQ,CAAC;AAAA,EACnE;AACA,SAAO;AACT;AAEO,SAAS,sBAAsB,eAAoD;AACxF,SAAO,GAAG,KAAK,UAAU,2BAA2B,aAAa,GAAG,MAAM,CAAC,CAAC;AAAA;AAC9E;AAgBO,SAAS,sBAAsB,SAAoE;AACxG,QAAM,YAAY,QAAQ,aAAa;AACvC,QAAM,gBAA6C,CAAC;AACpD,QAAM,mBAA2C,CAAC;AAClD,QAAM,WAAqB,CAAC;AAC5B,aAAW,YAAY,WAAW;AAChC,UAAM,QAAQ,mBAAmB;AAAA,MAC/B;AAAA,MACA,aAAa,QAAQ;AAAA,MACrB,aAAa,QAAQ,eAAe;AAAA,MACpC,cAAc,QAAQ,gBAAgB;AAAA,MACtC,gBAAgB,QAAQ,kBAAkB;AAAA,IAC5C,CAAC;AACD,kBAAc,QAAQ,IAAI;AAC1B,qBAAiB,QAAQ,IAAI,0BAA0B,KAAK;AAC5D,aAAS,KAAK,GAAG,MAAM,QAAQ;AAAA,EACjC;AACA,SAAO,EAAE,eAAe,kBAAkB,SAAS;AACrD;",
4
+ "sourcesContent": ["import fs from 'node:fs'\nimport path from 'node:path'\nimport ts from 'typescript'\nimport { toSnake } from '../utils'\n\nexport interface ModuleEntityFact {\n id: string\n class: string\n table: string\n editable: boolean\n customFields: boolean\n}\n\nexport interface ApiRouteAuthRule {\n requireAuth?: boolean\n requireFeatures?: string[]\n requireRoles?: string[]\n}\n\nexport interface ModuleApiRouteFact {\n path: string\n methods: string[]\n auth: Record<string, ApiRouteAuthRule>\n}\n\nexport interface ModuleEventFact {\n id: string\n label?: string\n category: string | null\n entity: string | null\n}\n\nexport interface ModuleHostTokens {\n entityIds: string[]\n tableIds: string[]\n}\n\nexport interface ModuleFacts {\n module: string\n title: string | null\n description: string | null\n coreVersion: string | null\n entities: ModuleEntityFact[]\n events: ModuleEventFact[]\n aclFeatures: string[]\n apiRoutes: ModuleApiRouteFact[]\n diTokens: string[]\n searchEntities: string[]\n hostTokens: ModuleHostTokens\n notifications: string[]\n cli: string[]\n warnings: string[]\n}\n\nexport interface ExtractModuleFactsOptions {\n moduleId: string\n /**\n * Parent modules directory joined with `moduleId` to locate the module source.\n * Legacy input; prefer the explicit per-module `moduleRoot` for modules that do\n * not live under a single shared root (auto-discovery). One of `moduleRoot` /\n * `coreSrcRoot` must be provided.\n */\n coreSrcRoot?: string\n /** Explicit module source directory. When set it overrides `coreSrcRoot + moduleId`. */\n moduleRoot?: string\n coreVersion?: string | null\n registryPath?: string | null\n registrySource?: string | null\n}\n\n/** A discovered module and the source directory its facts are extracted from. */\nexport interface ModuleFactSource {\n moduleId: string\n moduleRoot: string\n from?: string\n}\n\n/**\n * @deprecated Superseded by auto-discovery (`discoverPackageModuleSources` in\n * `module-facts-discovery.ts`). Retained as a stable export for one minor; no\n * longer gates which modules receive fact-sheets.\n */\nexport const MODULE_FACTS_ALLOWLIST = [\n 'auth',\n 'catalog',\n 'currencies',\n 'customer_accounts',\n 'customers',\n 'data_sync',\n 'integrations',\n 'sales',\n 'workflows',\n] as const\n\n/** @deprecated See {@link MODULE_FACTS_ALLOWLIST}. */\nexport type ModuleFactsModuleId = (typeof MODULE_FACTS_ALLOWLIST)[number]\n\nfunction readSourceFile(filePath: string): ts.SourceFile | null {\n if (!fs.existsSync(filePath)) return null\n const source = fs.readFileSync(filePath, 'utf8')\n const scriptKind = filePath.endsWith('.tsx') ? ts.ScriptKind.TSX : ts.ScriptKind.TS\n return ts.createSourceFile(filePath, source, ts.ScriptTarget.ES2020, true, scriptKind)\n}\n\nfunction resolveConventionFile(baseDir: string, basename: string): string | null {\n for (const extension of ['.ts', '.tsx']) {\n const candidate = path.join(baseDir, `${basename}${extension}`)\n if (fs.existsSync(candidate)) return candidate\n }\n return null\n}\n\nfunction readStringPropertyInitializer(\n objectLiteral: ts.ObjectLiteralExpression,\n propertyName: string,\n): string | undefined {\n for (const property of objectLiteral.properties) {\n if (!ts.isPropertyAssignment(property)) continue\n const name = ts.isIdentifier(property.name)\n ? property.name.text\n : ts.isStringLiteralLike(property.name)\n ? property.name.text\n : undefined\n if (name !== propertyName) continue\n if (ts.isStringLiteralLike(property.initializer)) return property.initializer.text\n return undefined\n }\n return undefined\n}\n\nfunction getClassDecoratorCall(node: ts.ClassDeclaration, decoratorName: string): ts.CallExpression | undefined {\n const decorators = ts.canHaveDecorators(node) ? ts.getDecorators(node) ?? [] : []\n for (const decorator of decorators) {\n const expression = decorator.expression\n if (!ts.isCallExpression(expression)) continue\n if (ts.isIdentifier(expression.expression) && expression.expression.text === decoratorName) {\n return expression\n }\n }\n return undefined\n}\n\nfunction readDecoratorTableName(decoratorCall: ts.CallExpression): string | undefined {\n const firstArgument = decoratorCall.arguments[0]\n if (!firstArgument || !ts.isObjectLiteralExpression(firstArgument)) return undefined\n return readStringPropertyInitializer(firstArgument, 'tableName')\n}\n\nfunction getPropertyDecoratorName(member: ts.PropertyDeclaration): string | undefined {\n const decorators = ts.canHaveDecorators(member) ? ts.getDecorators(member) ?? [] : []\n for (const decorator of decorators) {\n const expression = decorator.expression\n if (!ts.isCallExpression(expression)) continue\n const firstArgument = expression.arguments[0]\n if (!firstArgument || !ts.isObjectLiteralExpression(firstArgument)) continue\n const columnName = readStringPropertyInitializer(firstArgument, 'name')\n if (columnName) return columnName\n }\n return undefined\n}\n\nfunction classHasUpdatedAtColumn(node: ts.ClassDeclaration): boolean {\n for (const member of node.members) {\n if (!ts.isPropertyDeclaration(member) || !member.name) continue\n const propertyName = ts.isIdentifier(member.name)\n ? member.name.text\n : ts.isStringLiteralLike(member.name)\n ? member.name.text\n : undefined\n if (propertyName === 'updatedAt') return true\n if (getPropertyDecoratorName(member) === 'updated_at') return true\n }\n return false\n}\n\nfunction collectCustomFieldEntityIds(ceFilePath: string | null): Set<string> {\n const result = new Set<string>()\n if (!ceFilePath) return result\n const sourceFile = readSourceFile(ceFilePath)\n if (!sourceFile) return result\n\n const visit = (node: ts.Node): void => {\n if (ts.isObjectLiteralExpression(node)) {\n const id = readStringPropertyInitializer(node, 'id')\n if (id && id.includes(':')) result.add(id)\n }\n node.forEachChild(visit)\n }\n sourceFile.forEachChild(visit)\n return result\n}\n\nfunction extractEntities(\n moduleId: string,\n entitiesFilePath: string | null,\n customFieldEntityIds: Set<string>,\n): ModuleEntityFact[] {\n const sourceFile = entitiesFilePath ? readSourceFile(entitiesFilePath) : null\n if (!sourceFile) return []\n\n const facts: ModuleEntityFact[] = []\n sourceFile.forEachChild((node) => {\n if (!ts.isClassDeclaration(node) || !node.name) return\n const isExported = node.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword)\n if (!isExported) return\n const entityDecorator = getClassDecoratorCall(node, 'Entity')\n if (!entityDecorator) return\n\n const className = node.name.text\n const table = readDecoratorTableName(entityDecorator)\n if (!table) return\n\n const entityId = `${moduleId}:${toSnake(className)}`\n facts.push({\n id: entityId,\n class: className,\n table,\n editable: classHasUpdatedAtColumn(node),\n customFields: customFieldEntityIds.has(entityId),\n })\n })\n\n return facts\n}\n\nfunction unwrapExpression(expression: ts.Expression): ts.Expression {\n let current = expression\n while (ts.isAsExpression(current) || ts.isParenthesizedExpression(current) || ts.isTypeAssertionExpression(current)) {\n current = current.expression\n }\n return current\n}\n\nfunction unwrapArrayLiteral(expression: ts.Expression): ts.ArrayLiteralExpression | null {\n const current = unwrapExpression(expression)\n return ts.isArrayLiteralExpression(current) ? current : null\n}\n\nfunction getPropertyName(property: ts.ObjectLiteralElementLike): string | undefined {\n if (!ts.isPropertyAssignment(property) && !ts.isShorthandPropertyAssignment(property)) return undefined\n const name = property.name\n if (!name) return undefined\n if (ts.isIdentifier(name)) return name.text\n if (ts.isStringLiteralLike(name)) return name.text\n return undefined\n}\n\nfunction getObjectPropertyInitializer(\n objectLiteral: ts.ObjectLiteralExpression,\n propertyName: string,\n): ts.Expression | undefined {\n for (const property of objectLiteral.properties) {\n if (!ts.isPropertyAssignment(property)) continue\n if (getPropertyName(property) === propertyName) return property.initializer\n }\n return undefined\n}\n\nfunction findObjectLiteralDeclaration(\n sourceFile: ts.SourceFile,\n variableName: string,\n): ts.ObjectLiteralExpression | null {\n let result: ts.ObjectLiteralExpression | null = null\n const visit = (node: ts.Node): void => {\n if (result) return\n if (\n ts.isVariableDeclaration(node) &&\n ts.isIdentifier(node.name) &&\n node.name.text === variableName &&\n node.initializer\n ) {\n const unwrapped = unwrapExpression(node.initializer)\n if (ts.isObjectLiteralExpression(unwrapped)) {\n result = unwrapped\n return\n }\n }\n node.forEachChild(visit)\n }\n sourceFile.forEachChild(visit)\n return result\n}\n\nfunction buildVariableInitializerMap(sourceFile: ts.SourceFile): Map<string, ts.Expression> {\n const initializers = new Map<string, ts.Expression>()\n const visit = (node: ts.Node): void => {\n if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name) && node.initializer) {\n if (!initializers.has(node.name.text)) initializers.set(node.name.text, node.initializer)\n }\n node.forEachChild(visit)\n }\n sourceFile.forEachChild(visit)\n return initializers\n}\n\nfunction resolveToObjectLiteral(\n expression: ts.Expression,\n initializers: Map<string, ts.Expression>,\n): ts.ObjectLiteralExpression | null {\n const unwrapped = unwrapExpression(expression)\n if (ts.isObjectLiteralExpression(unwrapped)) return unwrapped\n if (ts.isIdentifier(unwrapped)) {\n const referenced = initializers.get(unwrapped.text)\n if (referenced) return resolveToObjectLiteral(referenced, initializers)\n }\n return null\n}\n\nfunction resolveToArrayLiteral(\n expression: ts.Expression,\n initializers: Map<string, ts.Expression>,\n): ts.ArrayLiteralExpression | null {\n const unwrapped = unwrapExpression(expression)\n if (ts.isArrayLiteralExpression(unwrapped)) return unwrapped\n if (ts.isIdentifier(unwrapped)) {\n const referenced = initializers.get(unwrapped.text)\n if (referenced) return resolveToArrayLiteral(referenced, initializers)\n }\n return null\n}\n\nfunction findDefaultExportExpression(sourceFile: ts.SourceFile): ts.Expression | null {\n for (const statement of sourceFile.statements) {\n if (ts.isExportAssignment(statement) && !statement.isExportEquals) return statement.expression\n }\n return null\n}\n\nfunction findArrayLiteralDeclaration(\n sourceFile: ts.SourceFile,\n variableName: string,\n): ts.ArrayLiteralExpression | null {\n let result: ts.ArrayLiteralExpression | null = null\n const visit = (node: ts.Node): void => {\n if (result) return\n if (\n ts.isVariableDeclaration(node) &&\n ts.isIdentifier(node.name) &&\n node.name.text === variableName &&\n node.initializer\n ) {\n const arrayLiteral = unwrapArrayLiteral(node.initializer)\n if (arrayLiteral) {\n result = arrayLiteral\n return\n }\n }\n node.forEachChild(visit)\n }\n sourceFile.forEachChild(visit)\n return result\n}\n\nfunction extractEvents(eventsFilePath: string | null): ModuleEventFact[] {\n const sourceFile = eventsFilePath ? readSourceFile(eventsFilePath) : null\n if (!sourceFile) return []\n\n const eventsArray = findArrayLiteralDeclaration(sourceFile, 'events')\n if (!eventsArray) return []\n\n const facts: ModuleEventFact[] = []\n for (const element of eventsArray.elements) {\n if (!ts.isObjectLiteralExpression(element)) continue\n const id = readStringPropertyInitializer(element, 'id')\n if (!id) continue\n const label = readStringPropertyInitializer(element, 'label')\n const category = readStringPropertyInitializer(element, 'category')\n const entity = readStringPropertyInitializer(element, 'entity')\n const fact: ModuleEventFact = {\n id,\n category: category ?? null,\n entity: entity ?? null,\n }\n if (label !== undefined) fact.label = label\n facts.push(fact)\n }\n\n return facts\n}\n\nfunction extractAclFeatures(aclFilePath: string | null): string[] {\n const sourceFile = aclFilePath ? readSourceFile(aclFilePath) : null\n if (!sourceFile) return []\n\n const featuresArray = findArrayLiteralDeclaration(sourceFile, 'features')\n if (!featuresArray) return []\n\n const featureIds: string[] = []\n const seen = new Set<string>()\n for (const element of featuresArray.elements) {\n let featureId: string | undefined\n if (ts.isObjectLiteralExpression(element)) {\n featureId = readStringPropertyInitializer(element, 'id')\n } else if (ts.isStringLiteralLike(element)) {\n featureId = element.text\n }\n if (!featureId || seen.has(featureId)) continue\n seen.add(featureId)\n featureIds.push(featureId)\n }\n\n return featureIds\n}\n\nfunction readBooleanPropertyInitializer(\n objectLiteral: ts.ObjectLiteralExpression,\n propertyName: string,\n): boolean | undefined {\n const initializer = getObjectPropertyInitializer(objectLiteral, propertyName)\n if (!initializer) return undefined\n if (initializer.kind === ts.SyntaxKind.TrueKeyword) return true\n if (initializer.kind === ts.SyntaxKind.FalseKeyword) return false\n return undefined\n}\n\nfunction readStringArrayPropertyInitializer(\n objectLiteral: ts.ObjectLiteralExpression,\n propertyName: string,\n): string[] | undefined {\n const initializer = getObjectPropertyInitializer(objectLiteral, propertyName)\n if (!initializer) return undefined\n const arrayLiteral = unwrapArrayLiteral(initializer)\n if (!arrayLiteral) return undefined\n const values: string[] = []\n for (const element of arrayLiteral.elements) {\n if (ts.isStringLiteralLike(element)) values.push(element.text)\n }\n return values\n}\n\nfunction parseApiRouteAuthRule(metadataLiteral: ts.ObjectLiteralExpression): ApiRouteAuthRule {\n const rule: ApiRouteAuthRule = {}\n const requireAuth = readBooleanPropertyInitializer(metadataLiteral, 'requireAuth')\n if (requireAuth !== undefined) rule.requireAuth = requireAuth\n const requireFeatures = readStringArrayPropertyInitializer(metadataLiteral, 'requireFeatures')\n if (requireFeatures && requireFeatures.length > 0) rule.requireFeatures = requireFeatures\n const requireRoles = readStringArrayPropertyInitializer(metadataLiteral, 'requireRoles')\n if (requireRoles && requireRoles.length > 0) rule.requireRoles = requireRoles\n return rule\n}\n\nfunction parseApiRouteEntry(entryLiteral: ts.ObjectLiteralExpression): ModuleApiRouteFact | null {\n const routePath = readStringPropertyInitializer(entryLiteral, 'path')\n if (!routePath) return null\n\n const methods: string[] = []\n const seenMethods = new Set<string>()\n const handlersInitializer = getObjectPropertyInitializer(entryLiteral, 'handlers')\n if (handlersInitializer && ts.isObjectLiteralExpression(handlersInitializer)) {\n for (const property of handlersInitializer.properties) {\n const methodName = getPropertyName(property)\n if (methodName && !seenMethods.has(methodName)) {\n seenMethods.add(methodName)\n methods.push(methodName)\n }\n }\n } else {\n const singleMethod = readStringPropertyInitializer(entryLiteral, 'method')\n if (singleMethod && !seenMethods.has(singleMethod)) {\n seenMethods.add(singleMethod)\n methods.push(singleMethod)\n }\n }\n\n const auth: Record<string, ApiRouteAuthRule> = {}\n const metadataInitializer = getObjectPropertyInitializer(entryLiteral, 'metadata')\n if (metadataInitializer && ts.isObjectLiteralExpression(metadataInitializer)) {\n for (const property of metadataInitializer.properties) {\n if (!ts.isPropertyAssignment(property)) continue\n const methodName = getPropertyName(property)\n if (!methodName) continue\n const methodMetadata = unwrapExpression(property.initializer)\n if (!ts.isObjectLiteralExpression(methodMetadata)) continue\n auth[methodName] = parseApiRouteAuthRule(methodMetadata)\n if (!seenMethods.has(methodName)) {\n seenMethods.add(methodName)\n methods.push(methodName)\n }\n }\n }\n\n return { path: routePath, methods, auth }\n}\n\nfunction extractApiRoutes(\n moduleId: string,\n registrySource: string | null,\n registryDescription: string,\n warnings: string[],\n): ModuleApiRouteFact[] {\n if (registrySource == null) {\n warnings.push(`[module-facts] module registry unavailable (${registryDescription}); API route auth omitted for ${moduleId}`)\n return []\n }\n\n const sourceFile = ts.createSourceFile(\n 'module-registry.generated.ts',\n registrySource,\n ts.ScriptTarget.ES2020,\n true,\n ts.ScriptKind.TS,\n )\n\n const routes: ModuleApiRouteFact[] = []\n const seenPaths = new Set<string>()\n const visit = (node: ts.Node): void => {\n if (ts.isObjectLiteralExpression(node) && readStringPropertyInitializer(node, 'id') === moduleId) {\n const apisInitializer = getObjectPropertyInitializer(node, 'apis')\n const apisArray = apisInitializer ? unwrapArrayLiteral(apisInitializer) : null\n if (apisArray) {\n for (const element of apisArray.elements) {\n if (!ts.isObjectLiteralExpression(element)) continue\n const route = parseApiRouteEntry(element)\n if (route && !seenPaths.has(route.path)) {\n seenPaths.add(route.path)\n routes.push(route)\n }\n }\n }\n }\n node.forEachChild(visit)\n }\n sourceFile.forEachChild(visit)\n return routes\n}\n\nfunction resolveRegistrySource(options: ExtractModuleFactsOptions): { source: string | null; description: string } {\n if (typeof options.registrySource === 'string') {\n return { source: options.registrySource, description: 'registrySource' }\n }\n if (options.registryPath) {\n if (!fs.existsSync(options.registryPath)) {\n return { source: null, description: options.registryPath }\n }\n return { source: fs.readFileSync(options.registryPath, 'utf8'), description: options.registryPath }\n }\n return { source: null, description: 'registryPath not provided' }\n}\n\nfunction detectAwilixRegistrationKind(expression: ts.Expression): string | null {\n let current: ts.Expression = unwrapExpression(expression)\n while (ts.isCallExpression(current)) {\n const callee = current.expression\n if (ts.isIdentifier(callee)) return callee.text\n if (ts.isPropertyAccessExpression(callee)) {\n current = callee.expression\n continue\n }\n break\n }\n return null\n}\n\nfunction extractDiTokens(diFilePath: string | null): string[] {\n if (!diFilePath) return []\n const sourceFile = readSourceFile(diFilePath)\n if (!sourceFile) return []\n\n const tokens: string[] = []\n const seen = new Set<string>()\n const visit = (node: ts.Node): void => {\n if (\n ts.isCallExpression(node) &&\n ts.isPropertyAccessExpression(node.expression) &&\n node.expression.name.text === 'register'\n ) {\n const argument = node.arguments[0]\n if (argument && ts.isObjectLiteralExpression(argument)) {\n for (const property of argument.properties) {\n if (!ts.isPropertyAssignment(property)) continue\n const kind = detectAwilixRegistrationKind(property.initializer)\n if (kind !== 'asFunction' && kind !== 'asClass') continue\n const tokenName = getPropertyName(property)\n if (tokenName && !seen.has(tokenName)) {\n seen.add(tokenName)\n tokens.push(tokenName)\n }\n }\n }\n }\n node.forEachChild(visit)\n }\n sourceFile.forEachChild(visit)\n return tokens\n}\n\nfunction extractSearchEntities(searchFilePath: string | null, warnings: string[]): string[] {\n if (!searchFilePath) return []\n const sourceFile = readSourceFile(searchFilePath)\n if (!sourceFile) return []\n\n const searchConfig = findObjectLiteralDeclaration(sourceFile, 'searchConfig')\n if (!searchConfig) {\n warnings.push(`[module-facts] search.ts present but no searchConfig object literal: ${searchFilePath}`)\n return []\n }\n const entitiesInitializer = getObjectPropertyInitializer(searchConfig, 'entities')\n const entitiesArray = entitiesInitializer ? unwrapArrayLiteral(entitiesInitializer) : null\n if (!entitiesArray) {\n warnings.push(`[module-facts] searchConfig.entities is not an array literal: ${searchFilePath}`)\n return []\n }\n\n const entityIds: string[] = []\n const seen = new Set<string>()\n for (const element of entitiesArray.elements) {\n if (!ts.isObjectLiteralExpression(element)) continue\n const entityId = readStringPropertyInitializer(element, 'entityId')\n if (entityId && !seen.has(entityId)) {\n seen.add(entityId)\n entityIds.push(entityId)\n }\n }\n return entityIds\n}\n\nfunction extractNotifications(notificationsFilePath: string | null, warnings: string[]): string[] {\n if (!notificationsFilePath) return []\n const sourceFile = readSourceFile(notificationsFilePath)\n if (!sourceFile) return []\n\n const notificationsArray =\n findArrayLiteralDeclaration(sourceFile, 'notificationTypes') ??\n findArrayLiteralDeclaration(sourceFile, 'notifications')\n if (!notificationsArray) {\n warnings.push(`[module-facts] notifications.ts present but no notificationTypes array literal: ${notificationsFilePath}`)\n return []\n }\n\n const notificationIds: string[] = []\n const seen = new Set<string>()\n for (const element of notificationsArray.elements) {\n if (!ts.isObjectLiteralExpression(element)) continue\n const notificationId = readStringPropertyInitializer(element, 'type')\n if (notificationId && !seen.has(notificationId)) {\n seen.add(notificationId)\n notificationIds.push(notificationId)\n }\n }\n return notificationIds\n}\n\nfunction extractCli(cliFilePath: string | null, warnings: string[]): string[] {\n if (!cliFilePath) return []\n const sourceFile = readSourceFile(cliFilePath)\n if (!sourceFile) return []\n\n const defaultExport = findDefaultExportExpression(sourceFile)\n if (!defaultExport) {\n warnings.push(`[module-facts] cli.ts present but no default export: ${cliFilePath}`)\n return []\n }\n\n const initializers = buildVariableInitializerMap(sourceFile)\n const collectCommand = (objectLiteral: ts.ObjectLiteralExpression): string | undefined =>\n readStringPropertyInitializer(objectLiteral, 'command')\n\n const commands: string[] = []\n const seen = new Set<string>()\n const pushCommand = (command: string | undefined): void => {\n if (command && !seen.has(command)) {\n seen.add(command)\n commands.push(command)\n }\n }\n\n const arrayLiteral = resolveToArrayLiteral(defaultExport, initializers)\n if (arrayLiteral) {\n for (const element of arrayLiteral.elements) {\n const objectLiteral = resolveToObjectLiteral(element, initializers)\n if (objectLiteral) pushCommand(collectCommand(objectLiteral))\n }\n return commands\n }\n\n const singleObject = resolveToObjectLiteral(defaultExport, initializers)\n if (singleObject) {\n pushCommand(collectCommand(singleObject))\n return commands\n }\n\n warnings.push(`[module-facts] cli.ts default export is neither an array nor an object literal: ${cliFilePath}`)\n return commands\n}\n\nfunction listSourceFilesRecursive(directory: string): string[] {\n const files: string[] = []\n for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {\n if (entry.name === '__tests__' || entry.name === 'node_modules') continue\n const fullPath = path.join(directory, entry.name)\n if (entry.isDirectory()) {\n files.push(...listSourceFilesRecursive(fullPath))\n } else if (/\\.tsx?$/.test(entry.name) && !entry.name.endsWith('.d.ts')) {\n files.push(fullPath)\n }\n }\n return files\n}\n\nfunction extractTableIds(backendDir: string): string[] {\n if (!fs.existsSync(backendDir)) return []\n\n const tableIds: string[] = []\n const seen = new Set<string>()\n for (const filePath of listSourceFilesRecursive(backendDir)) {\n const sourceFile = readSourceFile(filePath)\n if (!sourceFile) continue\n const visit = (node: ts.Node): void => {\n if (ts.isPropertyAssignment(node)) {\n const propertyName = getPropertyName(node)\n if (\n (propertyName === 'tableId' || propertyName === 'extensionTableId') &&\n ts.isStringLiteralLike(node.initializer)\n ) {\n const value = node.initializer.text\n if (value && !seen.has(value)) {\n seen.add(value)\n tableIds.push(value)\n }\n }\n }\n node.forEachChild(visit)\n }\n sourceFile.forEachChild(visit)\n }\n tableIds.sort((a, b) => (a < b ? -1 : a > b ? 1 : 0))\n return tableIds\n}\n\nfunction extractHostEntityIds(entities: ModuleEntityFact[]): string[] {\n return entities.filter((entity) => entity.id.endsWith('_entity')).map((entity) => entity.id)\n}\n\nfunction extractModuleMeta(indexFilePath: string | null): { title: string | null; description: string | null } {\n if (!indexFilePath) return { title: null, description: null }\n const sourceFile = readSourceFile(indexFilePath)\n if (!sourceFile) return { title: null, description: null }\n const metadata = findObjectLiteralDeclaration(sourceFile, 'metadata')\n if (!metadata) return { title: null, description: null }\n return {\n title: readStringPropertyInitializer(metadata, 'title') ?? null,\n description: readStringPropertyInitializer(metadata, 'description') ?? null,\n }\n}\n\nexport function extractModuleFacts(options: ExtractModuleFactsOptions): ModuleFacts {\n const { moduleId, coreVersion = null } = options\n const moduleRoot = options.moduleRoot\n ?? (options.coreSrcRoot ? path.join(options.coreSrcRoot, moduleId) : null)\n if (!moduleRoot) {\n throw new Error(`[internal] extractModuleFacts requires moduleRoot or coreSrcRoot for module \"${moduleId}\"`)\n }\n\n const entitiesFilePath =\n resolveConventionFile(path.join(moduleRoot, 'data'), 'entities') ??\n resolveConventionFile(path.join(moduleRoot, 'db'), 'entities') ??\n resolveConventionFile(path.join(moduleRoot, 'data'), 'schema')\n const ceFilePath = resolveConventionFile(moduleRoot, 'ce')\n const eventsFilePath = resolveConventionFile(moduleRoot, 'events')\n const aclFilePath = resolveConventionFile(moduleRoot, 'acl')\n const diFilePath = resolveConventionFile(moduleRoot, 'di')\n const searchFilePath = resolveConventionFile(moduleRoot, 'search')\n const notificationsFilePath = resolveConventionFile(moduleRoot, 'notifications')\n const cliFilePath = resolveConventionFile(moduleRoot, 'cli')\n const indexFilePath = resolveConventionFile(moduleRoot, 'index')\n const backendDir = path.join(moduleRoot, 'backend')\n\n const warnings: string[] = []\n const { title, description } = extractModuleMeta(indexFilePath)\n const customFieldEntityIds = collectCustomFieldEntityIds(ceFilePath)\n const entities = extractEntities(moduleId, entitiesFilePath, customFieldEntityIds)\n const events = extractEvents(eventsFilePath)\n const aclFeatures = extractAclFeatures(aclFilePath)\n\n const { source: registrySource, description: registryDescription } = resolveRegistrySource(options)\n const apiRoutes = extractApiRoutes(moduleId, registrySource, registryDescription, warnings)\n const diTokens = extractDiTokens(diFilePath)\n const searchEntities = extractSearchEntities(searchFilePath, warnings)\n const notifications = extractNotifications(notificationsFilePath, warnings)\n const cli = extractCli(cliFilePath, warnings)\n const hostTokens: ModuleHostTokens = {\n entityIds: extractHostEntityIds(entities),\n tableIds: extractTableIds(backendDir),\n }\n\n return {\n module: moduleId,\n title,\n description,\n coreVersion,\n entities,\n events,\n aclFeatures,\n apiRoutes,\n diTokens,\n searchEntities,\n hostTokens,\n notifications,\n cli,\n warnings,\n }\n}\n\nexport interface ModuleFactsJsonEvent {\n id: string\n category: string | null\n entity: string | null\n}\n\nexport interface ModuleFactsJsonEntry {\n title: string | null\n description: string | null\n coreVersion: string | null\n entities: ModuleEntityFact[]\n events: ModuleFactsJsonEvent[]\n aclFeatures: string[]\n apiRoutes: ModuleApiRouteFact[]\n diTokens: string[]\n searchEntities: string[]\n hostTokens: ModuleHostTokens\n notifications: string[]\n cli: string[]\n}\n\nconst EMPTY_SECTION_MARKER = '_none_'\n\nfunction renderVersionStamp(coreVersion: string | null): string {\n const version = coreVersion && coreVersion.length > 0 ? coreVersion : '<unknown>'\n return `<!-- generated from @open-mercato/core ${version} \u2014 R1 staleness stamp -->`\n}\n\nfunction renderEntitiesSection(entities: ModuleEntityFact[]): string {\n if (entities.length === 0) return `## Entities\\n\\n${EMPTY_SECTION_MARKER}`\n const header = '| Entity ID | Class | Table | Editable | CustomFields |'\n const divider = '|---|---|---|---|---|'\n const rows = entities.map(\n (entity) =>\n `| ${entity.id} | ${entity.class} | ${entity.table} | ${entity.editable ? 'yes' : 'no'} | ${entity.customFields ? 'yes' : 'no'} |`,\n )\n return ['## Entities', '', header, divider, ...rows].join('\\n')\n}\n\nfunction renderEventsSection(events: ModuleEventFact[]): string {\n const heading = `## Events (${events.length})`\n if (events.length === 0) return `${heading}\\n\\n${EMPTY_SECTION_MARKER}`\n const header = '| ID | Category | Entity |'\n const divider = '|---|---|---|'\n const rows = events.map((event) => `| ${event.id} | ${event.category ?? '\u2014'} | ${event.entity ?? '\u2014'} |`)\n return [heading, '', header, divider, ...rows].join('\\n')\n}\n\nfunction renderInlineListSection(heading: string, values: string[]): string {\n if (values.length === 0) return `${heading}\\n\\n${EMPTY_SECTION_MARKER}`\n return `${heading}\\n\\n${values.join(' \u00B7 ')}`\n}\n\nfunction describeAuthRule(rule: ApiRouteAuthRule | undefined): string {\n if (!rule) return 'public'\n if (rule.requireFeatures && rule.requireFeatures.length > 0) return rule.requireFeatures.join(', ')\n if (rule.requireRoles && rule.requireRoles.length > 0) return rule.requireRoles.join(', ')\n if (rule.requireAuth) return 'auth'\n return 'public'\n}\n\nfunction renderApiRouteAuthCell(route: ModuleApiRouteFact): string {\n if (route.methods.length === 0) return '\u2014'\n const groups: Array<{ label: string; methods: string[] }> = []\n for (const method of route.methods) {\n const label = describeAuthRule(route.auth[method])\n const existing = groups.find((group) => group.label === label)\n if (existing) existing.methods.push(method)\n else groups.push({ label, methods: [method] })\n }\n return groups.map((group) => `${group.methods.join('/')} \u2192 ${group.label}`).join(' \u00B7 ')\n}\n\nfunction renderApiRoutesSection(routes: ModuleApiRouteFact[]): string {\n if (routes.length === 0) return `## API routes\\n\\n${EMPTY_SECTION_MARKER}`\n const header = '| Path | Methods | Auth (per-method requireFeatures) |'\n const divider = '|---|---|---|'\n const rows = routes.map(\n (route) => `| ${route.path} | ${route.methods.join(' ')} | ${renderApiRouteAuthCell(route)} |`,\n )\n return ['## API routes', '', header, divider, ...rows].join('\\n')\n}\n\nfunction renderHostTokensSection(hostTokens: ModuleHostTokens): string {\n const entityIdsLine = hostTokens.entityIds.length > 0 ? hostTokens.entityIds.join(' \u00B7 ') : EMPTY_SECTION_MARKER\n const tableIdsLine = hostTokens.tableIds.length > 0 ? hostTokens.tableIds.join(' \u00B7 ') : EMPTY_SECTION_MARKER\n return ['## Host extension points', '', `- Entity IDs: ${entityIdsLine}`, `- Table IDs: ${tableIdsLine}`].join('\\n')\n}\n\nexport function renderModuleFactsMarkdown(facts: ModuleFacts): string {\n const sections = [\n `# ${facts.module} \u2014 module facts (generated, do not edit)`,\n renderVersionStamp(facts.coreVersion),\n '',\n renderEntitiesSection(facts.entities),\n '',\n renderEventsSection(facts.events),\n '',\n renderInlineListSection(`## ACL features (${facts.aclFeatures.length})`, facts.aclFeatures),\n '',\n renderApiRoutesSection(facts.apiRoutes),\n '',\n renderInlineListSection('## DI service tokens', facts.diTokens),\n '',\n renderInlineListSection('## Search entities', facts.searchEntities),\n '',\n renderHostTokensSection(facts.hostTokens),\n '',\n renderInlineListSection('## Notifications', facts.notifications),\n '',\n renderInlineListSection('## CLI', facts.cli),\n '',\n ]\n return sections.join('\\n')\n}\n\nexport function toModuleFactsJsonEntry(facts: ModuleFacts): ModuleFactsJsonEntry {\n return {\n title: facts.title,\n description: facts.description,\n coreVersion: facts.coreVersion,\n entities: facts.entities,\n events: facts.events.map((event) => ({ id: event.id, category: event.category, entity: event.entity })),\n aclFeatures: facts.aclFeatures,\n apiRoutes: facts.apiRoutes,\n diTokens: facts.diTokens,\n searchEntities: facts.searchEntities,\n hostTokens: facts.hostTokens,\n notifications: facts.notifications,\n cli: facts.cli,\n }\n}\n\nexport function buildModuleFactsJsonObject(\n factsByModule: Record<string, ModuleFacts>,\n): Record<string, ModuleFactsJsonEntry> {\n const result: Record<string, ModuleFactsJsonEntry> = {}\n for (const moduleId of Object.keys(factsByModule).sort((a, b) => (a < b ? -1 : a > b ? 1 : 0))) {\n result[moduleId] = toModuleFactsJsonEntry(factsByModule[moduleId])\n }\n return result\n}\n\nexport function renderModuleFactsJson(factsByModule: Record<string, ModuleFacts>): string {\n return `${JSON.stringify(buildModuleFactsJsonObject(factsByModule), null, 2)}\\n`\n}\n\nexport interface ExtractAllModuleFactsOptions {\n /**\n * Discovered module sources (auto-discovery path). When provided, each entry's\n * explicit `moduleRoot` is used and `coreSrcRoot`/`moduleIds` are ignored.\n */\n sources?: readonly ModuleFactSource[]\n /** Legacy shared-root path. Used only when `sources` is not provided. */\n coreSrcRoot?: string\n registryPath?: string | null\n registrySource?: string | null\n coreVersion?: string | null\n /** @deprecated Legacy allowlist iteration; only consulted when `sources` is absent. */\n moduleIds?: readonly string[]\n}\n\nexport interface ExtractAllModuleFactsResult {\n factsByModule: Record<string, ModuleFacts>\n markdownByModule: Record<string, string>\n warnings: string[]\n}\n\nexport function extractAllModuleFacts(options: ExtractAllModuleFactsOptions): ExtractAllModuleFactsResult {\n const sources: ModuleFactSource[] = options.sources\n ? [...options.sources]\n : (options.coreSrcRoot\n ? (options.moduleIds ?? MODULE_FACTS_ALLOWLIST).map((moduleId) => ({\n moduleId,\n moduleRoot: path.join(options.coreSrcRoot as string, moduleId),\n }))\n : [])\n\n const factsByModule: Record<string, ModuleFacts> = {}\n const markdownByModule: Record<string, string> = {}\n const warnings: string[] = []\n for (const source of sources) {\n const facts = extractModuleFacts({\n moduleId: source.moduleId,\n moduleRoot: source.moduleRoot,\n coreVersion: options.coreVersion ?? null,\n registryPath: options.registryPath ?? null,\n registrySource: options.registrySource ?? null,\n })\n factsByModule[source.moduleId] = facts\n markdownByModule[source.moduleId] = renderModuleFactsMarkdown(facts)\n warnings.push(...facts.warnings)\n }\n return { factsByModule, markdownByModule, warnings }\n}\n"],
5
+ "mappings": "AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,QAAQ;AACf,SAAS,eAAe;AA+EjB,MAAM,yBAAyB;AAAA,EACpC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAKA,SAAS,eAAe,UAAwC;AAC9D,MAAI,CAAC,GAAG,WAAW,QAAQ,EAAG,QAAO;AACrC,QAAM,SAAS,GAAG,aAAa,UAAU,MAAM;AAC/C,QAAM,aAAa,SAAS,SAAS,MAAM,IAAI,GAAG,WAAW,MAAM,GAAG,WAAW;AACjF,SAAO,GAAG,iBAAiB,UAAU,QAAQ,GAAG,aAAa,QAAQ,MAAM,UAAU;AACvF;AAEA,SAAS,sBAAsB,SAAiB,UAAiC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AA2C,CAAC;AAClD,QAAM,WAAqB,CAAC;AAC5B,aAAW,UAAU,SAAS;AAC5B,UAAM,QAAQ,mBAAmB;AAAA,MAC/B,UAAU,OAAO;AAAA,MACjB,YAAY,OAAO;AAAA,MACnB,aAAa,QAAQ,eAAe;AAAA,MACpC,cAAc,QAAQ,gBAAgB;AAAA,MACtC,gBAAgB,QAAQ,kBAAkB;AAAA,IAC5C,CAAC;AACD,kBAAc,OAAO,QAAQ,IAAI;AACjC,qBAAiB,OAAO,QAAQ,IAAI,0BAA0B,KAAK;AACnE,aAAS,KAAK,GAAG,MAAM,QAAQ;AAAA,EACjC;AACA,SAAO,EAAE,eAAe,kBAAkB,SAAS;AACrD;",
6
6
  "names": []
7
7
  }
package/dist/mercato.js CHANGED
@@ -558,8 +558,7 @@ async function runGeneratorSuite(quiet) {
558
558
  generateModuleEntities,
559
559
  generateModuleDi,
560
560
  generateModulePackageSources,
561
- generateOpenApi,
562
- generateModuleFacts
561
+ generateOpenApi
563
562
  } = await import("./lib/generators/index.js");
564
563
  const resolver = createResolver();
565
564
  await generateEntityIds({ resolver, quiet });
@@ -570,7 +569,6 @@ async function runGeneratorSuite(quiet) {
570
569
  await generateModuleDi({ resolver, quiet });
571
570
  await generateModulePackageSources({ resolver, quiet });
572
571
  await generateOpenApi({ resolver, quiet });
573
- await generateModuleFacts({ resolver, quiet });
574
572
  }
575
573
  function createGenerateWatchChecksumFn() {
576
574
  return async () => {