@open-mercato/cli 0.11.1-develop.8784.1.e9d95a72f5 → 0.11.1-develop.8843.1.b02f9b125d

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 (210) hide show
  1. package/.turbo/turbo-build.log +8 -2
  2. package/AGENTS.md +2 -0
  3. package/dist/agentic/guides/architecture.md +1 -0
  4. package/dist/agentic/guides/module-facts.json +2453 -1146
  5. package/dist/agentic/guides/module-facts.v2.json +2453 -1146
  6. package/dist/agentic/guides/modules/agent_orchestrator/index.md +1 -1
  7. package/dist/agentic/guides/modules/ai_assistant/index.md +1 -1
  8. package/dist/agentic/guides/modules/ai_assistant/owned-contract-module-metadata.md +1 -1
  9. package/dist/agentic/guides/modules/api_docs/index.md +1 -1
  10. package/dist/agentic/guides/modules/api_keys/index.md +1 -1
  11. package/dist/agentic/guides/modules/assisted_selling/index.md +1 -1
  12. package/dist/agentic/guides/modules/attachments/index.md +1 -1
  13. package/dist/agentic/guides/modules/audit_logs/index.md +1 -1
  14. package/dist/agentic/guides/modules/auth/index.md +1 -1
  15. package/dist/agentic/guides/modules/auth/owned-contract-module-metadata.md +1 -1
  16. package/dist/agentic/guides/modules/availability/index.md +1 -1
  17. package/dist/agentic/guides/modules/backups/index.md +1 -1
  18. package/dist/agentic/guides/modules/business_rules/index.md +1 -1
  19. package/dist/agentic/guides/modules/carrier_inpost/index.md +1 -1
  20. package/dist/agentic/guides/modules/cart/index.md +1 -1
  21. package/dist/agentic/guides/modules/cart/owned-contract-module-metadata.md +1 -1
  22. package/dist/agentic/guides/modules/catalog/di-registrations-rich.md +11 -8
  23. package/dist/agentic/guides/modules/catalog/di-service-tokens.md +5 -5
  24. package/dist/agentic/guides/modules/catalog/exact-override-targets.md +11 -8
  25. package/dist/agentic/guides/modules/catalog/index.md +2 -2
  26. package/dist/agentic/guides/modules/catalog/owned-contract-module-metadata.md +1 -1
  27. package/dist/agentic/guides/modules/channel_apns/index.md +1 -1
  28. package/dist/agentic/guides/modules/channel_discord/index.md +1 -1
  29. package/dist/agentic/guides/modules/channel_expo/index.md +1 -1
  30. package/dist/agentic/guides/modules/channel_fcm/index.md +1 -1
  31. package/dist/agentic/guides/modules/channel_gmail/index.md +1 -1
  32. package/dist/agentic/guides/modules/channel_gmail/owned-contract-module-metadata.md +1 -1
  33. package/dist/agentic/guides/modules/channel_imap/index.md +1 -1
  34. package/dist/agentic/guides/modules/channel_imap/owned-contract-module-metadata.md +1 -1
  35. package/dist/agentic/guides/modules/channel_resend/index.md +1 -1
  36. package/dist/agentic/guides/modules/channel_ses/index.md +1 -1
  37. package/dist/agentic/guides/modules/channel_smtp/index.md +1 -1
  38. package/dist/agentic/guides/modules/checkout/index.md +1 -1
  39. package/dist/agentic/guides/modules/communication_channels/exact-override-targets.md +2 -2
  40. package/dist/agentic/guides/modules/communication_channels/index.md +1 -1
  41. package/dist/agentic/guides/modules/communication_channels/owned-contract-module-metadata.md +1 -1
  42. package/dist/agentic/guides/modules/communication_channels/workers.md +2 -2
  43. package/dist/agentic/guides/modules/configs/acl-features.md +2 -1
  44. package/dist/agentic/guides/modules/configs/backend-pages.md +1 -0
  45. package/dist/agentic/guides/modules/configs/entities.md +0 -1
  46. package/dist/agentic/guides/modules/configs/exact-override-targets.md +2 -0
  47. package/dist/agentic/guides/modules/configs/host-extension-points.md +10 -0
  48. package/dist/agentic/guides/modules/configs/index.md +5 -3
  49. package/dist/agentic/guides/modules/configs/owned-contract-module-metadata.md +1 -1
  50. package/dist/agentic/guides/modules/configs/setup.md +1 -1
  51. package/dist/agentic/guides/modules/configs/umes-diagnostics.md +9 -0
  52. package/dist/agentic/guides/modules/configs/umes-hosts.md +9 -1
  53. package/dist/agentic/guides/modules/content/index.md +1 -1
  54. package/dist/agentic/guides/modules/currencies/index.md +1 -1
  55. package/dist/agentic/guides/modules/customer_accounts/active-extension-bindings.md +1 -1
  56. package/dist/agentic/guides/modules/customer_accounts/index.md +1 -1
  57. package/dist/agentic/guides/modules/customer_groups/index.md +1 -1
  58. package/dist/agentic/guides/modules/customers/acl-features.md +2 -1
  59. package/dist/agentic/guides/modules/customers/active-extension-bindings.md +2 -0
  60. package/dist/agentic/guides/modules/customers/contribution-resolutions.md +2 -0
  61. package/dist/agentic/guides/modules/customers/di-registrations-rich.md +8 -5
  62. package/dist/agentic/guides/modules/customers/domain-commands.md +1 -1
  63. package/dist/agentic/guides/modules/customers/exact-override-targets.md +11 -5
  64. package/dist/agentic/guides/modules/customers/index.md +5 -5
  65. package/dist/agentic/guides/modules/customers/owned-contract-module-metadata.md +1 -1
  66. package/dist/agentic/guides/modules/customers/umes-contributions.md +2 -0
  67. package/dist/agentic/guides/modules/dashboards/active-extension-bindings.md +0 -10
  68. package/dist/agentic/guides/modules/dashboards/contribution-resolutions.md +0 -10
  69. package/dist/agentic/guides/modules/dashboards/exact-override-targets.md +0 -10
  70. package/dist/agentic/guides/modules/dashboards/index.md +5 -5
  71. package/dist/agentic/guides/modules/dashboards/umes-contributions.md +0 -10
  72. package/dist/agentic/guides/modules/data_sync/index.md +1 -1
  73. package/dist/agentic/guides/modules/design_system/index.md +1 -1
  74. package/dist/agentic/guides/modules/devices/index.md +1 -1
  75. package/dist/agentic/guides/modules/devices/owned-contract-module-metadata.md +1 -1
  76. package/dist/agentic/guides/modules/dictionaries/index.md +1 -1
  77. package/dist/agentic/guides/modules/directory/index.md +1 -1
  78. package/dist/agentic/guides/modules/documents/index.md +1 -1
  79. package/dist/agentic/guides/modules/ecommerce/index.md +1 -1
  80. package/dist/agentic/guides/modules/ecommerce/owned-contract-module-metadata.md +1 -1
  81. package/dist/agentic/guides/modules/entities/index.md +1 -1
  82. package/dist/agentic/guides/modules/entities/owned-contract-module-metadata.md +1 -1
  83. package/dist/agentic/guides/modules/eudr/index.md +1 -1
  84. package/dist/agentic/guides/modules/events/index.md +1 -1
  85. package/dist/agentic/guides/modules/events/owned-contract-module-metadata.md +1 -1
  86. package/dist/agentic/guides/modules/feature_toggles/index.md +1 -1
  87. package/dist/agentic/guides/modules/forms/index.md +1 -1
  88. package/dist/agentic/guides/modules/gateway_autopay/index.md +1 -1
  89. package/dist/agentic/guides/modules/gateway_stripe/index.md +1 -1
  90. package/dist/agentic/guides/modules/gateway_tpay/index.md +1 -1
  91. package/dist/agentic/guides/modules/generators/index.md +1 -1
  92. package/dist/agentic/guides/modules/inbox_ops/index.md +1 -1
  93. package/dist/agentic/guides/modules/integrations/index.md +1 -1
  94. package/dist/agentic/guides/modules/integrations/owned-contract-module-metadata.md +1 -1
  95. package/dist/agentic/guides/modules/ledger/index.md +1 -1
  96. package/dist/agentic/guides/modules/maintenance/contribution-resolutions.md +11 -0
  97. package/dist/agentic/guides/modules/maintenance/events.md +14 -0
  98. package/dist/agentic/guides/modules/maintenance/exact-override-targets.md +11 -0
  99. package/dist/agentic/guides/modules/maintenance/index.md +17 -0
  100. package/dist/agentic/guides/modules/maintenance/owned-contract-module-metadata.md +11 -0
  101. package/dist/agentic/guides/modules/maintenance/umes-contributions.md +11 -0
  102. package/dist/agentic/guides/modules/maintenance/umes-hosts.md +14 -0
  103. package/dist/agentic/guides/modules/messages/index.md +1 -1
  104. package/dist/agentic/guides/modules/notifications/index.md +1 -1
  105. package/dist/agentic/guides/modules/onboarding/index.md +1 -1
  106. package/dist/agentic/guides/modules/payment_gateways/exact-override-targets.md +3 -3
  107. package/dist/agentic/guides/modules/payment_gateways/index.md +1 -1
  108. package/dist/agentic/guides/modules/payment_gateways/setup.md +1 -1
  109. package/dist/agentic/guides/modules/perspectives/index.md +1 -1
  110. package/dist/agentic/guides/modules/phone_calls/index.md +1 -1
  111. package/dist/agentic/guides/modules/phone_calls/owned-contract-module-metadata.md +1 -1
  112. package/dist/agentic/guides/modules/planner/index.md +1 -1
  113. package/dist/agentic/guides/modules/portal/index.md +1 -1
  114. package/dist/agentic/guides/modules/progress/index.md +1 -1
  115. package/dist/agentic/guides/modules/promotions/index.md +1 -1
  116. package/dist/agentic/guides/modules/push_notifications/index.md +1 -1
  117. package/dist/agentic/guides/modules/query_index/index.md +1 -1
  118. package/dist/agentic/guides/modules/record_locks/index.md +1 -1
  119. package/dist/agentic/guides/modules/resources/index.md +1 -1
  120. package/dist/agentic/guides/modules/sales/active-extension-bindings.md +8 -0
  121. package/dist/agentic/guides/modules/sales/contribution-resolutions.md +8 -0
  122. package/dist/agentic/guides/modules/sales/di-registrations-rich.md +31 -30
  123. package/dist/agentic/guides/modules/sales/di-service-tokens.md +5 -5
  124. package/dist/agentic/guides/modules/sales/exact-override-targets.md +39 -30
  125. package/dist/agentic/guides/modules/sales/index.md +5 -5
  126. package/dist/agentic/guides/modules/sales/owned-contract-module-metadata.md +1 -1
  127. package/dist/agentic/guides/modules/sales/umes-contributions.md +8 -0
  128. package/dist/agentic/guides/modules/scheduler/index.md +1 -1
  129. package/dist/agentic/guides/modules/search/index.md +1 -1
  130. package/dist/agentic/guides/modules/search/owned-contract-module-metadata.md +1 -1
  131. package/dist/agentic/guides/modules/security/index.md +1 -1
  132. package/dist/agentic/guides/modules/seeds/index.md +1 -1
  133. package/dist/agentic/guides/modules/shipping_carriers/active-extension-bindings.md +1 -1
  134. package/dist/agentic/guides/modules/shipping_carriers/index.md +1 -1
  135. package/dist/agentic/guides/modules/sso/index.md +1 -1
  136. package/dist/agentic/guides/modules/staff/active-extension-bindings.md +2 -1
  137. package/dist/agentic/guides/modules/staff/contribution-resolutions.md +1 -0
  138. package/dist/agentic/guides/modules/staff/exact-override-targets.md +1 -0
  139. package/dist/agentic/guides/modules/staff/index.md +8 -8
  140. package/dist/agentic/guides/modules/staff/umes-contributions.md +1 -0
  141. package/dist/agentic/guides/modules/storage_s3/index.md +1 -1
  142. package/dist/agentic/guides/modules/sync_akeneo/index.md +1 -1
  143. package/dist/agentic/guides/modules/sync_excel/index.md +1 -1
  144. package/dist/agentic/guides/modules/system_status_overlays/index.md +1 -1
  145. package/dist/agentic/guides/modules/telemetry/index.md +1 -1
  146. package/dist/agentic/guides/modules/tillio/index.md +1 -1
  147. package/dist/agentic/guides/modules/translations/index.md +1 -1
  148. package/dist/agentic/guides/modules/upgrade_actions/cli-commands.md +11 -0
  149. package/dist/agentic/guides/modules/upgrade_actions/contribution-resolutions.md +12 -0
  150. package/dist/agentic/guides/modules/upgrade_actions/entities.md +11 -0
  151. package/dist/agentic/guides/modules/upgrade_actions/exact-override-targets.md +12 -0
  152. package/dist/agentic/guides/modules/upgrade_actions/index.md +18 -0
  153. package/dist/agentic/guides/modules/upgrade_actions/owned-contract-module-metadata.md +11 -0
  154. package/dist/agentic/guides/modules/upgrade_actions/umes-contributions.md +12 -0
  155. package/dist/agentic/guides/modules/upgrade_actions/umes-hosts.md +11 -0
  156. package/dist/agentic/guides/modules/warranty_claims/index.md +1 -1
  157. package/dist/agentic/guides/modules/webhooks/index.md +1 -1
  158. package/dist/agentic/guides/modules/wms/index.md +1 -1
  159. package/dist/agentic/guides/modules/workflows/domain-commands.md +3 -0
  160. package/dist/agentic/guides/modules/workflows/index.md +1 -1
  161. package/dist/agentic/guides/production-deployment.md +6 -0
  162. package/dist/agentic/guides/reference-module-facts.json +1 -1
  163. package/dist/agentic/guides/upstream/BACKWARD_COMPATIBILITY.md +17 -9
  164. package/dist/agentic/guides/upstream/manifest.json +2 -2
  165. package/dist/agentic/shared/AGENTS.md.template +1 -1
  166. package/dist/agentic/shared/ai/harness/cases.json +7 -7
  167. package/dist/lib/generators/extensions/dashboard-widgets.js +46 -4
  168. package/dist/lib/generators/extensions/dashboard-widgets.js.map +2 -2
  169. package/dist/lib/generators/extensions/workflows.js +25 -2
  170. package/dist/lib/generators/extensions/workflows.js.map +2 -2
  171. package/dist/lib/generators/module-facts.js +2 -0
  172. package/dist/lib/generators/module-facts.js.map +2 -2
  173. package/dist/lib/generators/module-registry.js +35 -6
  174. package/dist/lib/generators/module-registry.js.map +2 -2
  175. package/dist/lib/module-coupling/analyze.js +391 -0
  176. package/dist/lib/module-coupling/analyze.js.map +7 -0
  177. package/dist/lib/module-diagnostics.js +160 -0
  178. package/dist/lib/module-diagnostics.js.map +7 -0
  179. package/dist/lib/module-index.js +103 -0
  180. package/dist/lib/module-index.js.map +7 -0
  181. package/dist/lib/testing/ephemeral-database-guard.js +89 -0
  182. package/dist/lib/testing/ephemeral-database-guard.js.map +7 -0
  183. package/dist/lib/testing/integration-discovery.js +20 -15
  184. package/dist/lib/testing/integration-discovery.js.map +3 -3
  185. package/dist/mercato.js +45 -5
  186. package/dist/mercato.js.map +2 -2
  187. package/package.json +7 -7
  188. package/src/__tests__/init-ephemeral-database.test.ts +112 -0
  189. package/src/__tests__/mercato.test.ts +15 -0
  190. package/src/__tests__/rotation-json-output.test.ts +13 -0
  191. package/src/lib/__tests__/module-diagnostics.test.ts +207 -0
  192. package/src/lib/__tests__/modules-config.test.ts +1 -0
  193. package/src/lib/generators/__tests__/module-facts.customers.fixture.test.ts +2 -1
  194. package/src/lib/generators/__tests__/module-facts.owned-contracts.test.ts +2 -2
  195. package/src/lib/generators/__tests__/module-registry-requires-enforcement.test.ts +18 -0
  196. package/src/lib/generators/__tests__/output-snapshots.test.ts +19 -0
  197. package/src/lib/generators/__tests__/registry-variant-parity.test.ts +95 -19
  198. package/src/lib/generators/__tests__/structural-contracts.test.ts +18 -0
  199. package/src/lib/generators/extensions/dashboard-widgets.ts +49 -3
  200. package/src/lib/generators/extensions/workflows.ts +26 -2
  201. package/src/lib/generators/module-facts.ts +2 -0
  202. package/src/lib/generators/module-registry.ts +55 -7
  203. package/src/lib/module-coupling/analyze.ts +464 -0
  204. package/src/lib/module-diagnostics.ts +182 -0
  205. package/src/lib/module-index.ts +133 -0
  206. package/src/lib/testing/__tests__/ephemeral-database-guard.test.ts +88 -0
  207. package/src/lib/testing/__tests__/integration-discovery.test.ts +26 -2
  208. package/src/lib/testing/ephemeral-database-guard.ts +105 -0
  209. package/src/lib/testing/integration-discovery.ts +19 -11
  210. package/src/mercato.ts +47 -5
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/lib/generators/extensions/dashboard-widgets.ts"],
4
- "sourcesContent": ["import { VariableDeclarationKind } from 'ts-morph'\nimport type { GeneratorExtension } from '../extension'\nimport { scanModuleDir, SCAN_CONFIGS } from '../scanner'\nimport { arrayLiteral, arrowFunction, identifier, methodCall, nullishCoalesce, objectLiteral, propertyAccess, writeValue } from '../ast'\nimport { dynamicImportExpression, renderGeneratedTsSource } from './shared'\n\ntype DashboardWidgetEntry = {\n moduleId: string\n key: string\n source: 'app' | 'package'\n importPath: string\n}\n\nexport function createDashboardWidgetsExtension(): GeneratorExtension {\n const widgetEntries = new Map<string, DashboardWidgetEntry>()\n\n return {\n id: 'registry.dashboard-widgets',\n outputFiles: ['dashboard-widgets.generated.ts'],\n scanModule(ctx) {\n const files = scanModuleDir(ctx.roots, SCAN_CONFIGS.dashboardWidgets)\n for (const { relPath, fromApp } of files) {\n const segments = relPath.split('/')\n const file = segments.pop() ?? ''\n const base = file.replace(/\\.(t|j)sx?$/, '')\n const importPath = ctx.sanitizeGeneratedModuleSpecifier(\n `${fromApp ? ctx.imps.appBase : ctx.imps.pkgBase}/widgets/dashboard/${[...segments, base].join('/')}`\n )\n const key = [ctx.moduleId, ...segments, base].filter(Boolean).join(':')\n const entry: DashboardWidgetEntry = {\n moduleId: ctx.moduleId,\n key,\n source: fromApp ? 'app' : 'package',\n importPath,\n }\n const existing = widgetEntries.get(key)\n if (!existing || (existing.source !== 'app' && entry.source === 'app')) {\n widgetEntries.set(key, entry)\n }\n }\n },\n generateOutput() {\n const entries = Array.from(widgetEntries.entries())\n .sort(([left], [right]) => left.localeCompare(right))\n .map(([, entry]) =>\n objectLiteral([\n { name: 'moduleId', value: entry.moduleId },\n { name: 'key', value: entry.key },\n { name: 'source', value: entry.source },\n {\n name: 'loader',\n value: arrowFunction({\n body: methodCall(dynamicImportExpression(entry.importPath), 'then', [\n arrowFunction({\n parameters: ['mod'],\n body: nullishCoalesce([\n propertyAccess(identifier('mod'), 'default'),\n identifier('mod'),\n ]),\n }),\n ]),\n }),\n },\n ]),\n )\n\n const output = renderGeneratedTsSource({\n fileName: 'dashboard-widgets.generated.ts',\n imports: [\n { namedImports: [{ name: 'ModuleDashboardWidgetEntry', isTypeOnly: true }], moduleSpecifier: '@open-mercato/shared/modules/registry' },\n ],\n build(sourceFile) {\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n isExported: true,\n declarations: [\n {\n name: 'dashboardWidgetEntries',\n type: 'ModuleDashboardWidgetEntry[]',\n initializer: arrayLiteral(entries, writeValue),\n },\n ],\n })\n },\n })\n\n return new Map([['dashboard-widgets.generated.ts', output]])\n },\n }\n}\n"],
5
- "mappings": "AAAA,SAAS,+BAA+B;AAExC,SAAS,eAAe,oBAAoB;AAC5C,SAAS,cAAc,eAAe,YAAY,YAAY,iBAAiB,eAAe,gBAAgB,kBAAkB;AAChI,SAAS,yBAAyB,+BAA+B;AAS1D,SAAS,kCAAsD;AACpE,QAAM,gBAAgB,oBAAI,IAAkC;AAE5D,SAAO;AAAA,IACL,IAAI;AAAA,IACJ,aAAa,CAAC,gCAAgC;AAAA,IAC9C,WAAW,KAAK;AACd,YAAM,QAAQ,cAAc,IAAI,OAAO,aAAa,gBAAgB;AACpE,iBAAW,EAAE,SAAS,QAAQ,KAAK,OAAO;AACxC,cAAM,WAAW,QAAQ,MAAM,GAAG;AAClC,cAAM,OAAO,SAAS,IAAI,KAAK;AAC/B,cAAM,OAAO,KAAK,QAAQ,eAAe,EAAE;AAC3C,cAAM,aAAa,IAAI;AAAA,UACrB,GAAG,UAAU,IAAI,KAAK,UAAU,IAAI,KAAK,OAAO,sBAAsB,CAAC,GAAG,UAAU,IAAI,EAAE,KAAK,GAAG,CAAC;AAAA,QACrG;AACA,cAAM,MAAM,CAAC,IAAI,UAAU,GAAG,UAAU,IAAI,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AACtE,cAAM,QAA8B;AAAA,UAClC,UAAU,IAAI;AAAA,UACd;AAAA,UACA,QAAQ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AAM;AAAA,gBACN,aAAa,aAAa,SAAS,UAAU;AAAA,cAC/C;AAAA,YACF;AAAA,UACF,CAAC;AAAA,QACH;AAAA,MACF,CAAC;AAED,aAAO,oBAAI,IAAI,CAAC,CAAC,kCAAkC,MAAM,CAAC,CAAC;AAAA,IAC7D;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import fs from 'node:fs'\nimport path from 'node:path'\nimport ts from 'typescript-js'\nimport { VariableDeclarationKind } from 'ts-morph'\nimport type { GeneratorExtension } from '../extension'\nimport {\n MODULE_CODE_EXTENSIONS,\n resolveStandaloneSourceMirrorBase,\n scanModuleDir,\n SCAN_CONFIGS,\n stripModuleCodeExtension,\n type ModuleRoots,\n type ScannedFile,\n} from '../scanner'\nimport { arrayLiteral, arrowFunction, identifier, methodCall, nullishCoalesce, objectLiteral, propertyAccess, writeValue } from '../ast'\nimport { dynamicImportExpression, renderGeneratedTsSource } from './shared'\n\ntype DashboardWidgetEntry = {\n moduleId: string\n key: string\n source: 'app' | 'package'\n importPath: string\n}\n\nfunction readRegisteredWidgetKey(absolutePath: string): string | undefined {\n if (!fs.existsSync(absolutePath)) return undefined\n const source = ts.createSourceFile(absolutePath, fs.readFileSync(absolutePath, 'utf8'), ts.ScriptTarget.Latest, true)\n const values = new Map<string, string>()\n let exportName: string | undefined\n for (const statement of source.statements) {\n if (ts.isVariableStatement(statement)) {\n const exported = statement.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword)\n for (const declaration of statement.declarationList.declarations) {\n if (!ts.isIdentifier(declaration.name) || !declaration.initializer) continue\n if (!ts.isStringLiteralLike(declaration.initializer) || !declaration.initializer.text) continue\n values.set(declaration.name.text, declaration.initializer.text)\n if (exported && declaration.name.text === 'dashboardWidgetKey') exportName = declaration.name.text\n }\n } else if (ts.isExportDeclaration(statement) && !statement.moduleSpecifier && statement.exportClause\n && ts.isNamedExports(statement.exportClause)) {\n const key = statement.exportClause.elements.find((item) => item.name.text === 'dashboardWidgetKey')\n if (key) exportName = (key.propertyName ?? key.name).text\n }\n }\n return exportName ? values.get(exportName) : undefined\n}\n\nexport function resolveDashboardWidgetKey(moduleId: string, roots: ModuleRoots, file: ScannedFile): string {\n const relative = path.join('widgets', 'dashboard', file.relPath)\n const fallback = [moduleId, ...stripModuleCodeExtension(file.relPath).split('/')].join(':')\n const packageBase = resolveStandaloneSourceMirrorBase(roots.pkgBase) ?? roots.pkgBase\n if (!file.fromApp) return readRegisteredWidgetKey(path.join(packageBase, relative)) ?? fallback\n const appKey = readRegisteredWidgetKey(path.join(roots.appBase, relative))\n if (appKey) return appKey\n const packagePath = stripModuleCodeExtension(path.join(packageBase, relative))\n const packageExtension = MODULE_CODE_EXTENSIONS.find((extension) => fs.existsSync(packagePath + extension))\n return (packageExtension && readRegisteredWidgetKey(packagePath + packageExtension)) ?? fallback\n}\n\nexport function createDashboardWidgetsExtension(): GeneratorExtension {\n const widgetEntries = new Map<string, DashboardWidgetEntry>()\n\n return {\n id: 'registry.dashboard-widgets',\n outputFiles: ['dashboard-widgets.generated.ts'],\n scanModule(ctx) {\n const files = scanModuleDir(ctx.roots, SCAN_CONFIGS.dashboardWidgets)\n for (const { relPath, fromApp } of files) {\n const segments = relPath.split('/')\n const file = segments.pop() ?? ''\n const base = stripModuleCodeExtension(file)\n const importPath = ctx.sanitizeGeneratedModuleSpecifier(\n `${fromApp ? ctx.imps.appBase : ctx.imps.pkgBase}/widgets/dashboard/${[...segments, base].join('/')}`\n )\n const key = resolveDashboardWidgetKey(ctx.moduleId, ctx.roots, { relPath, fromApp })\n const entry: DashboardWidgetEntry = {\n moduleId: ctx.moduleId,\n key,\n source: fromApp ? 'app' : 'package',\n importPath,\n }\n const existing = widgetEntries.get(key)\n if (!existing || (existing.source !== 'app' && entry.source === 'app')) {\n widgetEntries.set(key, entry)\n }\n }\n },\n generateOutput() {\n const entries = Array.from(widgetEntries.entries())\n .sort(([left], [right]) => left.localeCompare(right))\n .map(([, entry]) =>\n objectLiteral([\n { name: 'moduleId', value: entry.moduleId },\n { name: 'key', value: entry.key },\n { name: 'source', value: entry.source },\n {\n name: 'loader',\n value: arrowFunction({\n body: methodCall(dynamicImportExpression(entry.importPath), 'then', [\n arrowFunction({\n parameters: ['mod'],\n body: nullishCoalesce([\n propertyAccess(identifier('mod'), 'default'),\n identifier('mod'),\n ]),\n }),\n ]),\n }),\n },\n ]),\n )\n\n const output = renderGeneratedTsSource({\n fileName: 'dashboard-widgets.generated.ts',\n imports: [\n { namedImports: [{ name: 'ModuleDashboardWidgetEntry', isTypeOnly: true }], moduleSpecifier: '@open-mercato/shared/modules/registry' },\n ],\n build(sourceFile) {\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n isExported: true,\n declarations: [\n {\n name: 'dashboardWidgetEntries',\n type: 'ModuleDashboardWidgetEntry[]',\n initializer: arrayLiteral(entries, writeValue),\n },\n ],\n })\n },\n })\n\n return new Map([['dashboard-widgets.generated.ts', output]])\n },\n }\n}\n"],
5
+ "mappings": "AAAA,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,OAAO,QAAQ;AACf,SAAS,+BAA+B;AAExC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP,SAAS,cAAc,eAAe,YAAY,YAAY,iBAAiB,eAAe,gBAAgB,kBAAkB;AAChI,SAAS,yBAAyB,+BAA+B;AASjE,SAAS,wBAAwB,cAA0C;AACzE,MAAI,CAAC,GAAG,WAAW,YAAY,EAAG,QAAO;AACzC,QAAM,SAAS,GAAG,iBAAiB,cAAc,GAAG,aAAa,cAAc,MAAM,GAAG,GAAG,aAAa,QAAQ,IAAI;AACpH,QAAM,SAAS,oBAAI,IAAoB;AACvC,MAAI;AACJ,aAAW,aAAa,OAAO,YAAY;AACzC,QAAI,GAAG,oBAAoB,SAAS,GAAG;AACrC,YAAM,WAAW,UAAU,WAAW,KAAK,CAAC,aAAa,SAAS,SAAS,GAAG,WAAW,aAAa;AACtG,iB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,cAAc;AAAA,cACnB,MAAM,WAAW,wBAAwB,MAAM,UAAU,GAAG,QAAQ;AAAA,gBAClE,cAAc;AAAA,kBACZ,YAAY,CAAC,KAAK;AAAA,kBAClB,MAAM,gBAAgB;AAAA,oBACpB,eAAe,WAAW,KAAK,GAAG,SAAS;AAAA,oBAC3C,WAAW,KAAK;AAAA,kBAClB,CAAC;AAAA,gBACH,CAAC;AAAA,cACH,CAAC;AAAA,YACH,CAAC;AAAA,UACH;AAAA,QACF,CAAC;AAAA,MACH;AAEF,YAAM,SAAS,wBAAwB;AAAA,QACrC,UAAU;AAAA,QACV,SAAS;AAAA,UACP,EAAE,cAAc,CAAC,EAAE,MAAM,8BAA8B,YAAY,KAAK,CAAC,GAAG,iBAAiB,wCAAwC;AAAA,QACvI;AAAA,QACA,MAAM,YAAY;AAChB,qBAAW,qBAAqB;AAAA,YAC9B,iBAAiB,wBAAwB;AAAA,YACzC,YAAY;AAAA,YACZ,cAAc;AAAA,cACZ;AAAA,gBACE,MAAM;AAAA,gBACN,MAAM;AAAA,gBACN,aAAa,aAAa,SAAS,UAAU;AAAA,cAC/C;AAAA,YACF;AAAA,UACF,CAAC;AAAA,QACH;AAAA,MACF,CAAC;AAED,aAAO,oBAAI,IAAI,CAAC,CAAC,kCAAkC,MAAM,CAAC,CAAC;AAAA,IAC7D;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -17,10 +17,15 @@ import {
17
17
  function createWorkflowsExtension() {
18
18
  const imports = [];
19
19
  const entries = [];
20
+ let registrarImport;
20
21
  return {
21
22
  id: "registry.workflows",
22
- outputFiles: ["workflows.generated.ts"],
23
+ outputFiles: ["workflows.generated.ts", "workflow-registrations.generated.ts"],
23
24
  scanModule(ctx) {
25
+ if (ctx.moduleId === "workflows") {
26
+ const registrar = ctx.resolveModuleFile(ctx.roots, ctx.imps, "lib/code-registry.ts");
27
+ if (registrar) registrarImport = ctx.sanitizeGeneratedModuleSpecifier(registrar.importPath);
28
+ }
24
29
  ctx.processStandaloneConfig({
25
30
  roots: ctx.roots,
26
31
  imps: ctx.imps,
@@ -129,7 +134,25 @@ function createWorkflowsExtension() {
129
134
  });
130
135
  }
131
136
  });
132
- return /* @__PURE__ */ new Map([["workflows.generated.ts", output]]);
137
+ const registrationOutput = renderGeneratedTsSource({
138
+ fileName: "workflow-registrations.generated.ts",
139
+ imports: registrarImport ? [
140
+ { namedImports: [{ name: "allCodeWorkflows" }], moduleSpecifier: "./workflows.generated" },
141
+ { namedImports: [{ name: "registerCodeWorkflows" }], moduleSpecifier: registrarImport }
142
+ ] : [],
143
+ build(sourceFile) {
144
+ sourceFile.addFunction({
145
+ name: "registerGeneratedCodeWorkflows",
146
+ isExported: true,
147
+ returnType: "void",
148
+ statements: registrarImport ? ["registerCodeWorkflows(allCodeWorkflows)"] : []
149
+ });
150
+ }
151
+ });
152
+ return /* @__PURE__ */ new Map([
153
+ ["workflows.generated.ts", output],
154
+ ["workflow-registrations.generated.ts", registrationOutput]
155
+ ]);
133
156
  }
134
157
  };
135
158
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/lib/generators/extensions/workflows.ts"],
4
- "sourcesContent": ["import { VariableDeclarationKind, type WriterFunction } from 'ts-morph'\nimport type { GeneratorExtension } from '../extension'\nimport {\n asExpression,\n arrayLiteral,\n arrowFunction,\n binaryExpression,\n identifier,\n methodCall,\n propertyAccess,\n writeValue,\n} from '../ast'\nimport {\n moduleEntry,\n namespaceFallback,\n namespaceImportSpec,\n renderGeneratedTsSource,\n} from './shared'\n\nexport function createWorkflowsExtension(): GeneratorExtension {\n const imports: Array<ReturnType<typeof namespaceImportSpec>> = []\n const entries: WriterFunction[] = []\n\n return {\n id: 'registry.workflows',\n outputFiles: ['workflows.generated.ts'],\n scanModule(ctx) {\n ctx.processStandaloneConfig({\n roots: ctx.roots,\n imps: ctx.imps,\n modId: ctx.moduleId,\n relativePath: 'workflows.ts',\n prefix: 'WORKFLOWS',\n importIdRef: ctx.importIdRef,\n standaloneImports: imports,\n standaloneEntries: entries,\n sharedImports: ctx.sharedImports,\n writeConfig: ({ importName, moduleId }) =>\n moduleEntry(moduleId, [\n {\n name: 'config',\n value: namespaceFallback({\n importName,\n members: ['default', 'workflowsConfig'],\n fallback: identifier('null'),\n castType: 'WorkflowsModuleConfig | null',\n }),\n },\n ]),\n })\n },\n getModuleDeclContribution() {\n return null\n },\n generateOutput() {\n const output = renderGeneratedTsSource({\n fileName: 'workflows.generated.ts',\n imports: [\n {\n namedImports: [\n { name: 'WorkflowsModuleConfig', isTypeOnly: true },\n { name: 'CodeWorkflowDefinition', isTypeOnly: true },\n ],\n moduleSpecifier: '@open-mercato/shared/modules/workflows',\n },\n ...imports,\n ],\n build(sourceFile) {\n sourceFile.addTypeAlias({\n name: 'WorkflowsConfigEntry',\n type: '{ moduleId: string; config: WorkflowsModuleConfig | null }',\n })\n sourceFile.addTypeAlias({\n name: 'ResolvedWorkflowsConfigEntry',\n type: '{ moduleId: string; config: WorkflowsModuleConfig }',\n })\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n declarations: [\n {\n name: 'entriesRaw',\n type: 'WorkflowsConfigEntry[]',\n initializer: arrayLiteral(entries, writeValue),\n },\n ],\n })\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n declarations: [\n {\n name: 'entries',\n type: 'ResolvedWorkflowsConfigEntry[]',\n initializer: asExpression(\n methodCall(identifier('entriesRaw'), 'filter', [\n arrowFunction({\n parameters: ['entry'],\n body: binaryExpression(propertyAccess(identifier('entry'), 'config'), '!=', null),\n }),\n ]),\n 'ResolvedWorkflowsConfigEntry[]',\n ),\n },\n ],\n })\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n isExported: true,\n declarations: [\n {\n name: 'workflowModuleConfigEntries',\n initializer: identifier('entries'),\n },\n {\n name: 'workflowModuleConfigs',\n type: 'WorkflowsModuleConfig[]',\n initializer: methodCall(identifier('entries'), 'map', [\n arrowFunction({\n parameters: ['entry'],\n body: propertyAccess(identifier('entry'), 'config'),\n }),\n ]),\n },\n {\n name: 'allCodeWorkflows',\n type: 'CodeWorkflowDefinition[]',\n initializer: methodCall(identifier('entries'), 'flatMap', [\n arrowFunction({\n parameters: ['entry'],\n body: propertyAccess(propertyAccess(identifier('entry'), 'config'), 'workflows'),\n }),\n ]),\n },\n ],\n })\n },\n })\n\n return new Map([['workflows.generated.ts', output]])\n },\n }\n}\n"],
5
- "mappings": "AAAA,SAAS,+BAAoD;AAE7D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EAEA;AAAA,OACK;AAEA,SAAS,2BAA+C;AAC7D,QAAM,UAAyD,CAAC;AAChE,QAAM,UAA4B,CAAC;AAEnC,SAAO;AAAA,IACL,IAAI;AAAA,IACJ,aAAa,CAAC,wBAAwB;AAAA,IACtC,WAAW,KAAK;AACd,UAAI,wBAAwB;AAAA,QAC1B,OAAO,IAAI;AAAA,QACX,MAAM,IAAI;AAAA,QACV,OAAO,IAAI;AAAA,QACX,cAAc;AAAA,QACd,QAAQ;AAAA,QACR,aAAa,IAAI;AAAA,QACjB,mBAAmB;AAAA,QACnB,mBAAmB;AAAA,QACnB,eAAe,IAAI;AAAA,QACnB,aAAa,CAAC,EAAE,YAAY,SAAS,MACnC,YAAY,UAAU;AAAA,UACpB;AAAA,YACE,MAAM;AAAA,YACN,OAAO,kBAAkB;AAAA,cACvB;AAAA,cACA,SAAS,CAAC,WAAW,iBAAiB;AAAA,cACtC,UAAU,WAAW,MAAM;AAAA,cAC3B,UAAU;AAAA,YACZ,CAAC;AAAA,UACH;AAAA,QACF,CAAC;AAAA,MACL,CAAC;AAAA,IACH;AAAA,IACA,4BAA4B;AAC1B,aAAO;AAAA,IACT;AAAA,IACA,iBAAiB;AACf,YAAM,SAAS,wBAA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AAG,OAAO;AAAA,kBACpD,cAAc;AAAA,oBACZ,YAAY,CAAC,OAAO;AAAA,oBACpB,MAAM,eAAe,WAAW,OAAO,GAAG,QAAQ;AAAA,kBACpD,CAAC;AAAA,gBACH,CAAC;AAAA,cACH;AAAA,cACA;AAAA,gBACE,MAAM;AAAA,gBACN,MAAM;AAAA,gBACN,aAAa,WAAW,WAAW,SAAS,GAAG,WAAW;AAAA,kBACxD,cAAc;AAAA,oBACZ,YAAY,CAAC,OAAO;AAAA,oBACpB,MAAM,eAAe,eAAe,WAAW,OAAO,GAAG,QAAQ,GAAG,WAAW;AAAA,kBACjF,CAAC;AAAA,gBACH,CAAC;AAAA,cACH;AAAA,YACF;AAAA,UACF,CAAC;AAAA,QACH;AAAA,MACF,CAAC;AAED,aAAO,oBAAI,IAAI,CAAC,CAAC,0BAA0B,MAAM,CAAC,CAAC;AAAA,IACrD;AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import { VariableDeclarationKind, type WriterFunction } from 'ts-morph'\nimport type { GeneratorExtension } from '../extension'\nimport {\n asExpression,\n arrayLiteral,\n arrowFunction,\n binaryExpression,\n identifier,\n methodCall,\n propertyAccess,\n writeValue,\n} from '../ast'\nimport {\n moduleEntry,\n namespaceFallback,\n namespaceImportSpec,\n renderGeneratedTsSource,\n} from './shared'\n\nexport function createWorkflowsExtension(): GeneratorExtension {\n const imports: Array<ReturnType<typeof namespaceImportSpec>> = []\n const entries: WriterFunction[] = []\n let registrarImport: string | undefined\n\n return {\n id: 'registry.workflows',\n outputFiles: ['workflows.generated.ts', 'workflow-registrations.generated.ts'],\n scanModule(ctx) {\n if (ctx.moduleId === 'workflows') {\n const registrar = ctx.resolveModuleFile(ctx.roots, ctx.imps, 'lib/code-registry.ts')\n if (registrar) registrarImport = ctx.sanitizeGeneratedModuleSpecifier(registrar.importPath)\n }\n ctx.processStandaloneConfig({\n roots: ctx.roots,\n imps: ctx.imps,\n modId: ctx.moduleId,\n relativePath: 'workflows.ts',\n prefix: 'WORKFLOWS',\n importIdRef: ctx.importIdRef,\n standaloneImports: imports,\n standaloneEntries: entries,\n sharedImports: ctx.sharedImports,\n writeConfig: ({ importName, moduleId }) =>\n moduleEntry(moduleId, [\n {\n name: 'config',\n value: namespaceFallback({\n importName,\n members: ['default', 'workflowsConfig'],\n fallback: identifier('null'),\n castType: 'WorkflowsModuleConfig | null',\n }),\n },\n ]),\n })\n },\n getModuleDeclContribution() {\n return null\n },\n generateOutput() {\n const output = renderGeneratedTsSource({\n fileName: 'workflows.generated.ts',\n imports: [\n {\n namedImports: [\n { name: 'WorkflowsModuleConfig', isTypeOnly: true },\n { name: 'CodeWorkflowDefinition', isTypeOnly: true },\n ],\n moduleSpecifier: '@open-mercato/shared/modules/workflows',\n },\n ...imports,\n ],\n build(sourceFile) {\n sourceFile.addTypeAlias({\n name: 'WorkflowsConfigEntry',\n type: '{ moduleId: string; config: WorkflowsModuleConfig | null }',\n })\n sourceFile.addTypeAlias({\n name: 'ResolvedWorkflowsConfigEntry',\n type: '{ moduleId: string; config: WorkflowsModuleConfig }',\n })\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n declarations: [\n {\n name: 'entriesRaw',\n type: 'WorkflowsConfigEntry[]',\n initializer: arrayLiteral(entries, writeValue),\n },\n ],\n })\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n declarations: [\n {\n name: 'entries',\n type: 'ResolvedWorkflowsConfigEntry[]',\n initializer: asExpression(\n methodCall(identifier('entriesRaw'), 'filter', [\n arrowFunction({\n parameters: ['entry'],\n body: binaryExpression(propertyAccess(identifier('entry'), 'config'), '!=', null),\n }),\n ]),\n 'ResolvedWorkflowsConfigEntry[]',\n ),\n },\n ],\n })\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n isExported: true,\n declarations: [\n {\n name: 'workflowModuleConfigEntries',\n initializer: identifier('entries'),\n },\n {\n name: 'workflowModuleConfigs',\n type: 'WorkflowsModuleConfig[]',\n initializer: methodCall(identifier('entries'), 'map', [\n arrowFunction({\n parameters: ['entry'],\n body: propertyAccess(identifier('entry'), 'config'),\n }),\n ]),\n },\n {\n name: 'allCodeWorkflows',\n type: 'CodeWorkflowDefinition[]',\n initializer: methodCall(identifier('entries'), 'flatMap', [\n arrowFunction({\n parameters: ['entry'],\n body: propertyAccess(propertyAccess(identifier('entry'), 'config'), 'workflows'),\n }),\n ]),\n },\n ],\n })\n },\n })\n\n const registrationOutput = renderGeneratedTsSource({\n fileName: 'workflow-registrations.generated.ts',\n imports: registrarImport ? [\n { namedImports: [{ name: 'allCodeWorkflows' }], moduleSpecifier: './workflows.generated' },\n { namedImports: [{ name: 'registerCodeWorkflows' }], moduleSpecifier: registrarImport },\n ] : [],\n build(sourceFile) {\n sourceFile.addFunction({\n name: 'registerGeneratedCodeWorkflows',\n isExported: true,\n returnType: 'void',\n statements: registrarImport ? ['registerCodeWorkflows(allCodeWorkflows)'] : [],\n })\n },\n })\n\n return new Map([\n ['workflows.generated.ts', output],\n ['workflow-registrations.generated.ts', registrationOutput],\n ])\n },\n }\n}\n"],
5
+ "mappings": "AAAA,SAAS,+BAAoD;AAE7D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EAEA;AAAA,OACK;AAEA,SAAS,2BAA+C;AAC7D,QAAM,UAAyD,CAAC;AAChE,QAAM,UAA4B,CAAC;AACnC,MAAI;AAEJ,SAAO;AAAA,IACL,IAAI;AAAA,IACJ,aAAa,CAAC,0BAA0B,qCAAqC;AAAA,IAC7E,WAAW,KAAK;AACd,UAAI,IAAI,aAAa,aAAa;AAChC,cAAM,YAAY,IAAI,kBAAkB,IAAI,OAAO,IAAI,MAAM,sBAAsB;AACnF,YAAI,UAAW,mBAAkB,IAAI,iCAAiC,UAAU,UAAU;AAAA,MAC5F;AACA,UAAI,wBAAwB;AAAA,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AwB,CAAC,GAAG,iBAAiB,gBAAgB;AAAA,QACxF,IAAI,CAAC;AAAA,QACL,MAAM,YAAY;AAChB,qBAAW,YAAY;AAAA,YACrB,MAAM;AAAA,YACN,YAAY;AAAA,YACZ,YAAY;AAAA,YACZ,YAAY,kBAAkB,CAAC,yCAAyC,IAAI,CAAC;AAAA,UAC/E,CAAC;AAAA,QACH;AAAA,MACF,CAAC;AAED,aAAO,oBAAI,IAAI;AAAA,QACb,CAAC,0BAA0B,MAAM;AAAA,QACjC,CAAC,uCAAuC,kBAAkB;AAAA,MAC5D,CAAC;AAAA,IACH;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -1042,6 +1042,8 @@ function extractModuleMetadataContract(indexFilePath, moduleId, sourcePath) {
1042
1042
  if (version) facts.version = version;
1043
1043
  const requires = readStringArrayPropertyInitializer(metadata, "requires");
1044
1044
  if (requires && requires.length > 0) facts.requires = requires;
1045
+ const optionalRequires = readStringArrayPropertyInitializer(metadata, "optionalRequires");
1046
+ if (optionalRequires && optionalRequires.length > 0) facts.optionalRequires = optionalRequires;
1045
1047
  const ejectable = readBooleanPropertyInitializer(metadata, "ejectable");
1046
1048
  if (ejectable !== void 0) facts.ejectable = ejectable;
1047
1049
  return {