@open-mercato/cli 0.5.1-canary.2651.e8e710523e → 0.5.1-develop.2652.0276e72e45

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.
@@ -1,4 +1,4 @@
1
- Found 64 entry points
1
+ Found 63 entry points
2
2
  Copied create-app/agentic/ → dist/agentic/
3
3
  Discovered 16 standalone guides → dist/agentic/guides/
4
4
  CLI built successfully
@@ -7,7 +7,6 @@ import { createEnrichersExtension } from "./enrichers.js";
7
7
  import { createEventsExtension } from "./events.js";
8
8
  import { createGuardsExtension } from "./guards.js";
9
9
  import { createInboxActionsExtension } from "./inbox-actions.js";
10
- import { createInboxOpsSourcesExtension } from "./inbox-ops-sources.js";
11
10
  import { createInjectionWidgetsExtension } from "./injection-widgets.js";
12
11
  import { createInterceptorsExtension } from "./interceptors.js";
13
12
  import { createMessagesExtension } from "./messages.js";
@@ -28,7 +27,6 @@ function loadGeneratorExtensions() {
28
27
  createInterceptorsExtension(),
29
28
  createComponentOverridesExtension(),
30
29
  createInboxActionsExtension(),
31
- createInboxOpsSourcesExtension(),
32
30
  createGuardsExtension(),
33
31
  createCommandInterceptorsExtension(),
34
32
  createPageMiddlewareExtension(),
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/lib/generators/extensions/index.ts"],
4
- "sourcesContent": ["import type { GeneratorExtension } from '../extension'\nimport { createAiToolsExtension } from './ai-tools'\nimport { createAnalyticsExtension } from './analytics'\nimport { createCommandInterceptorsExtension } from './command-interceptors'\nimport { createComponentOverridesExtension } from './component-overrides'\nimport { createDashboardWidgetsExtension } from './dashboard-widgets'\nimport { createEnrichersExtension } from './enrichers'\nimport { createEventsExtension } from './events'\nimport { createGuardsExtension } from './guards'\nimport { createInboxActionsExtension } from './inbox-actions'\nimport { createInboxOpsSourcesExtension } from './inbox-ops-sources'\nimport { createInjectionWidgetsExtension } from './injection-widgets'\nimport { createInterceptorsExtension } from './interceptors'\nimport { createMessagesExtension } from './messages'\nimport { createNotificationsExtension } from './notifications'\nimport { createPageMiddlewareExtension } from './page-middleware'\nimport { createSearchExtension } from './search'\nimport { createTranslatableFieldsExtension } from './translatable-fields'\n\nexport function loadGeneratorExtensions(): GeneratorExtension[] {\n return [\n createSearchExtension(),\n createNotificationsExtension(),\n createMessagesExtension(),\n createAiToolsExtension(),\n createEventsExtension(),\n createAnalyticsExtension(),\n createTranslatableFieldsExtension(),\n createEnrichersExtension(),\n createInterceptorsExtension(),\n createComponentOverridesExtension(),\n createInboxActionsExtension(),\n createInboxOpsSourcesExtension(),\n createGuardsExtension(),\n createCommandInterceptorsExtension(),\n createPageMiddlewareExtension(),\n createDashboardWidgetsExtension(),\n createInjectionWidgetsExtension(),\n ]\n}\n"],
5
- "mappings": "AACA,SAAS,8BAA8B;AACvC,SAAS,gCAAgC;AACzC,SAAS,0CAA0C;AACnD,SAAS,yCAAyC;AAClD,SAAS,uCAAuC;AAChD,SAAS,gCAAgC;AACzC,SAAS,6BAA6B;AACtC,SAAS,6BAA6B;AACtC,SAAS,mCAAmC;AAC5C,SAAS,sCAAsC;AAC/C,SAAS,uCAAuC;AAChD,SAAS,mCAAmC;AAC5C,SAAS,+BAA+B;AACxC,SAAS,oCAAoC;AAC7C,SAAS,qCAAqC;AAC9C,SAAS,6BAA6B;AACtC,SAAS,yCAAyC;AAE3C,SAAS,0BAAgD;AAC9D,SAAO;AAAA,IACL,sBAAsB;AAAA,IACtB,6BAA6B;AAAA,IAC7B,wBAAwB;AAAA,IACxB,uBAAuB;AAAA,IACvB,sBAAsB;AAAA,IACtB,yBAAyB;AAAA,IACzB,kCAAkC;AAAA,IAClC,yBAAyB;AAAA,IACzB,4BAA4B;AAAA,IAC5B,kCAAkC;AAAA,IAClC,4BAA4B;AAAA,IAC5B,+BAA+B;AAAA,IAC/B,sBAAsB;AAAA,IACtB,mCAAmC;AAAA,IACnC,8BAA8B;AAAA,IAC9B,gCAAgC;AAAA,IAChC,gCAAgC;AAAA,EAClC;AACF;",
4
+ "sourcesContent": ["import type { GeneratorExtension } from '../extension'\nimport { createAiToolsExtension } from './ai-tools'\nimport { createAnalyticsExtension } from './analytics'\nimport { createCommandInterceptorsExtension } from './command-interceptors'\nimport { createComponentOverridesExtension } from './component-overrides'\nimport { createDashboardWidgetsExtension } from './dashboard-widgets'\nimport { createEnrichersExtension } from './enrichers'\nimport { createEventsExtension } from './events'\nimport { createGuardsExtension } from './guards'\nimport { createInboxActionsExtension } from './inbox-actions'\nimport { createInjectionWidgetsExtension } from './injection-widgets'\nimport { createInterceptorsExtension } from './interceptors'\nimport { createMessagesExtension } from './messages'\nimport { createNotificationsExtension } from './notifications'\nimport { createPageMiddlewareExtension } from './page-middleware'\nimport { createSearchExtension } from './search'\nimport { createTranslatableFieldsExtension } from './translatable-fields'\n\nexport function loadGeneratorExtensions(): GeneratorExtension[] {\n return [\n createSearchExtension(),\n createNotificationsExtension(),\n createMessagesExtension(),\n createAiToolsExtension(),\n createEventsExtension(),\n createAnalyticsExtension(),\n createTranslatableFieldsExtension(),\n createEnrichersExtension(),\n createInterceptorsExtension(),\n createComponentOverridesExtension(),\n createInboxActionsExtension(),\n createGuardsExtension(),\n createCommandInterceptorsExtension(),\n createPageMiddlewareExtension(),\n createDashboardWidgetsExtension(),\n createInjectionWidgetsExtension(),\n ]\n}\n"],
5
+ "mappings": "AACA,SAAS,8BAA8B;AACvC,SAAS,gCAAgC;AACzC,SAAS,0CAA0C;AACnD,SAAS,yCAAyC;AAClD,SAAS,uCAAuC;AAChD,SAAS,gCAAgC;AACzC,SAAS,6BAA6B;AACtC,SAAS,6BAA6B;AACtC,SAAS,mCAAmC;AAC5C,SAAS,uCAAuC;AAChD,SAAS,mCAAmC;AAC5C,SAAS,+BAA+B;AACxC,SAAS,oCAAoC;AAC7C,SAAS,qCAAqC;AAC9C,SAAS,6BAA6B;AACtC,SAAS,yCAAyC;AAE3C,SAAS,0BAAgD;AAC9D,SAAO;AAAA,IACL,sBAAsB;AAAA,IACtB,6BAA6B;AAAA,IAC7B,wBAAwB;AAAA,IACxB,uBAAuB;AAAA,IACvB,sBAAsB;AAAA,IACtB,yBAAyB;AAAA,IACzB,kCAAkC;AAAA,IAClC,yBAAyB;AAAA,IACzB,4BAA4B;AAAA,IAC5B,kCAAkC;AAAA,IAClC,4BAA4B;AAAA,IAC5B,sBAAsB;AAAA,IACtB,mCAAmC;AAAA,IACnC,8BAA8B;AAAA,IAC9B,gCAAgC;AAAA,IAChC,gCAAgC;AAAA,EAClC;AACF;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-mercato/cli",
3
- "version": "0.5.1-canary.2651.e8e710523e",
3
+ "version": "0.5.1-develop.2652.0276e72e45",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "exports": {
@@ -58,8 +58,8 @@
58
58
  "@mikro-orm/core": "^6.6.10",
59
59
  "@mikro-orm/migrations": "^6.6.10",
60
60
  "@mikro-orm/postgresql": "^6.6.10",
61
- "@open-mercato/queue": "0.5.1-canary.2651.e8e710523e",
62
- "@open-mercato/shared": "0.5.1-canary.2651.e8e710523e",
61
+ "@open-mercato/queue": "0.5.1-develop.2652.0276e72e45",
62
+ "@open-mercato/shared": "0.5.1-develop.2652.0276e72e45",
63
63
  "cross-spawn": "^7.0.6",
64
64
  "pg": "8.20.0",
65
65
  "semver": "^7.7.4",
@@ -69,10 +69,10 @@
69
69
  "typescript": "^5.9.3"
70
70
  },
71
71
  "peerDependencies": {
72
- "@open-mercato/shared": "0.5.1-canary.2651.e8e710523e"
72
+ "@open-mercato/shared": "0.5.1-develop.2652.0276e72e45"
73
73
  },
74
74
  "devDependencies": {
75
- "@open-mercato/shared": "0.5.1-canary.2651.e8e710523e",
75
+ "@open-mercato/shared": "0.5.1-develop.2652.0276e72e45",
76
76
  "@types/jest": "^30.0.0",
77
77
  "jest": "^30.3.0",
78
78
  "ts-jest": "^29.4.9"
@@ -1313,7 +1313,6 @@ describe('all generated files are valid with varying subsets', () => {
1313
1313
  'search.generated.ts',
1314
1314
  'notifications.generated.ts',
1315
1315
  'ai-tools.generated.ts',
1316
- 'inbox-ops-sources.generated.ts',
1317
1316
  'events.generated.ts',
1318
1317
  'analytics.generated.ts',
1319
1318
  'translations-fields.generated.ts',
@@ -1372,18 +1371,6 @@ describe('all generated files are valid with varying subsets', () => {
1372
1371
  expect(aiTools).not.toContain('no_ai')
1373
1372
  })
1374
1373
 
1375
- it('inbox-ops-sources.generated.ts is empty when no module provides inbox-ops-sources.ts', async () => {
1376
- scaffoldModule(tmpDir, 'no_sources', 'pkg', ['setup.ts'])
1377
- const resolver = createMockResolver(tmpDir, [
1378
- { id: 'no_sources', from: '@open-mercato/core' },
1379
- ])
1380
- await generateModuleRegistry({ resolver, quiet: true })
1381
-
1382
- const sourceRegistry = readGenerated(tmpDir, 'inbox-ops-sources.generated.ts')!
1383
- expect(sourceRegistry).toContain('export const inboxOpsSourceConfigEntries')
1384
- expect(sourceRegistry).not.toContain('no_sources')
1385
- })
1386
-
1387
1374
  it('security generated registries are empty when no module provides security convention files', async () => {
1388
1375
  scaffoldModule(tmpDir, 'no_security', 'pkg', ['setup.ts'])
1389
1376
  touchFile(
@@ -335,33 +335,6 @@ export default inboxActions
335
335
  `,
336
336
  )
337
337
 
338
- // -- Inbox Ops sources --
339
- touchFile(
340
- pkgModulePath('orders', 'inbox-ops-sources.ts'),
341
- `export const inboxOpsSourceAdapters = [
342
- {
343
- sourceEntityType: 'orders:message',
344
- async loadSource(args: any) { return args },
345
- async buildInput(args: any) {
346
- return {
347
- sourceEntityType: 'orders:message',
348
- sourceEntityId: args.sourceEntityId,
349
- body: 'hello',
350
- bodyFormat: 'text',
351
- participants: [],
352
- capabilities: {
353
- canDraftReply: false,
354
- canUseTimelineContext: false,
355
- },
356
- }
357
- },
358
- },
359
- ]
360
-
361
- export default inboxOpsSourceAdapters
362
- `,
363
- )
364
-
365
338
  // -- Analytics --
366
339
  touchFile(
367
340
  pkgModulePath('orders', 'analytics.ts'),
@@ -694,7 +667,6 @@ describe('generator output compatibility', () => {
694
667
  'frontend-routes.generated.ts',
695
668
  'guards.generated.ts',
696
669
  'inbox-actions.generated.ts',
697
- 'inbox-ops-sources.generated.ts',
698
670
  'injection-tables.generated.ts',
699
671
  'injection-widgets.generated.ts',
700
672
  'interceptors.generated.ts',
@@ -207,7 +207,6 @@ function scaffoldFixture(): ModuleEntry[] {
207
207
  touchFile(pkgModulePath('orders', 'notifications.handlers.ts'), `export const notificationHandlers = [\n { type: 'orders.order.created', handler: async (n: any) => {} },\n]\nexport default notificationHandlers\n`)
208
208
  touchFile(pkgModulePath('orders', 'translations.ts'), `export const translatableFields = {\n 'orders:sales_order': ['status_label', 'notes'],\n 'orders:order_item': ['product_name'],\n}\nexport default translatableFields\n`)
209
209
  touchFile(pkgModulePath('orders', 'inbox-actions.ts'), `export const inboxActions = [\n { type: 'orders.approve', id: 'orders.approve-order', label: 'Approve Order', icon: 'check', description: 'Approve pending', async execute(a: any) { return { ok: true } } },\n]\nexport default inboxActions\n`)
210
- touchFile(pkgModulePath('orders', 'inbox-ops-sources.ts'), `export const inboxOpsSourceAdapters = [\n {\n sourceEntityType: 'orders:message',\n async loadSource(args: any) { return args },\n async buildInput(args: any) {\n return {\n sourceEntityType: 'orders:message',\n sourceEntityId: args.sourceEntityId,\n body: 'hello',\n bodyFormat: 'text',\n participants: [],\n capabilities: {\n canDraftReply: false,\n canUseTimelineContext: false,\n },\n }\n },\n },\n]\n\nexport default inboxOpsSourceAdapters\n`)
211
210
  touchFile(pkgModulePath('orders', 'analytics.ts'), `export const analyticsConfig = {\n entities: [{ entityId: 'orders:sales_order', requiredFeatures: ['orders.view'], entityConfig: { tableName: 'sales_orders', dateField: 'created_at' }, fieldMappings: { id: { dbColumn: 'id', type: 'uuid' } } }],\n}\nexport default analyticsConfig\n`)
212
211
  touchFile(pkgModulePath('orders', 'ai-tools.ts'), `export const aiTools = [\n { name: 'list_orders', description: 'List recent orders', inputSchema: {}, requiredFeatures: ['orders.view'] },\n]\nexport default aiTools\n`)
213
212
  touchFile(pkgModulePath('orders', 'frontend', 'middleware.ts'), `export const middleware = [\n { id: 'orders.auth-check', pattern: '/orders/**', handler: async (req: any) => req },\n]\nexport default middleware\n`)
@@ -886,38 +885,6 @@ describe('inbox-actions.generated.ts', () => {
886
885
  })
887
886
  })
888
887
 
889
- // ---------------------------------------------------------------------------
890
- // inbox-ops-sources.generated.ts
891
- // ---------------------------------------------------------------------------
892
-
893
- describe('inbox-ops-sources.generated.ts', () => {
894
- let content: string
895
-
896
- beforeEach(async () => {
897
- const enabled = scaffoldFixture()
898
- const resolver = createMockResolver(enabled)
899
- await generateModuleRegistry({ resolver, quiet: true })
900
- content = readGenerated('inbox-ops-sources.generated.ts')
901
- })
902
-
903
- it('exports entries, flattened arrays, and lookup helpers', () => {
904
- expectExports(content, [
905
- 'inboxOpsSourceConfigEntries',
906
- 'inboxOpsSourceAdapters',
907
- 'getInboxOpsSourceAdapter',
908
- ])
909
- })
910
-
911
- it('has orders module entry with adapters property', () => {
912
- expectModuleIds(content, ['orders'])
913
- expect(content).toContain('adapters:')
914
- })
915
-
916
- it('imports source adapter types', () => {
917
- expect(hasTypeImport(content, 'InboxOpsSourceAdapter', '@open-mercato/shared/modules/inbox-ops-sources')).toBe(true)
918
- })
919
- })
920
-
921
888
  // ---------------------------------------------------------------------------
922
889
  // analytics.generated.ts
923
890
  // ---------------------------------------------------------------------------
@@ -8,7 +8,6 @@ import { createEnrichersExtension } from './enrichers'
8
8
  import { createEventsExtension } from './events'
9
9
  import { createGuardsExtension } from './guards'
10
10
  import { createInboxActionsExtension } from './inbox-actions'
11
- import { createInboxOpsSourcesExtension } from './inbox-ops-sources'
12
11
  import { createInjectionWidgetsExtension } from './injection-widgets'
13
12
  import { createInterceptorsExtension } from './interceptors'
14
13
  import { createMessagesExtension } from './messages'
@@ -30,7 +29,6 @@ export function loadGeneratorExtensions(): GeneratorExtension[] {
30
29
  createInterceptorsExtension(),
31
30
  createComponentOverridesExtension(),
32
31
  createInboxActionsExtension(),
33
- createInboxOpsSourcesExtension(),
34
32
  createGuardsExtension(),
35
33
  createCommandInterceptorsExtension(),
36
34
  createPageMiddlewareExtension(),
@@ -1,132 +0,0 @@
1
- import { VariableDeclarationKind } from "ts-morph";
2
- import {
3
- arrayLiteral,
4
- arrowFunction,
5
- binaryExpression,
6
- identifier,
7
- methodCall,
8
- newExpression,
9
- propertyAccess,
10
- returnStatement,
11
- writeValue
12
- } from "../ast/index.js";
13
- import { emptyArray, moduleEntry, namespaceFallback, renderGeneratedTsSource } from "./shared.js";
14
- function createInboxOpsSourcesExtension() {
15
- const imports = [];
16
- const entries = [];
17
- return {
18
- id: "registry.inbox-ops-sources",
19
- outputFiles: ["inbox-ops-sources.generated.ts"],
20
- scanModule(ctx) {
21
- ctx.processStandaloneConfig({
22
- roots: ctx.roots,
23
- imps: ctx.imps,
24
- modId: ctx.moduleId,
25
- relativePath: "inbox-ops-sources.ts",
26
- prefix: "INBOX_OPS_SOURCES",
27
- importIdRef: ctx.importIdRef,
28
- standaloneImports: imports,
29
- standaloneEntries: entries,
30
- writeConfig: ({ importName, moduleId }) => moduleEntry(moduleId, [
31
- {
32
- name: "adapters",
33
- value: namespaceFallback({
34
- importName,
35
- members: ["default", "inboxOpsSourceAdapters"],
36
- fallback: emptyArray(),
37
- castType: "InboxOpsSourceAdapter[]"
38
- })
39
- }
40
- ])
41
- });
42
- },
43
- generateOutput() {
44
- const output = renderGeneratedTsSource({
45
- fileName: "inbox-ops-sources.generated.ts",
46
- imports: [
47
- {
48
- namedImports: [
49
- { name: "InboxOpsSourceAdapter", isTypeOnly: true }
50
- ],
51
- moduleSpecifier: "@open-mercato/shared/modules/inbox-ops-sources"
52
- },
53
- ...imports
54
- ],
55
- build(sourceFile) {
56
- sourceFile.addTypeAlias({
57
- name: "InboxOpsSourceConfigEntry",
58
- type: "{ moduleId: string; adapters: InboxOpsSourceAdapter[] }"
59
- });
60
- sourceFile.addVariableStatement({
61
- declarationKind: VariableDeclarationKind.Const,
62
- declarations: [
63
- {
64
- name: "entriesRaw",
65
- type: "InboxOpsSourceConfigEntry[]",
66
- initializer: arrayLiteral(entries, writeValue)
67
- },
68
- {
69
- name: "entries",
70
- initializer: methodCall(identifier("entriesRaw"), "filter", [
71
- arrowFunction({
72
- parameters: ["entry"],
73
- body: binaryExpression(propertyAccess(propertyAccess(identifier("entry"), "adapters"), "length"), ">", 0)
74
- })
75
- ])
76
- }
77
- ]
78
- });
79
- sourceFile.addVariableStatement({
80
- declarationKind: VariableDeclarationKind.Const,
81
- isExported: true,
82
- declarations: [
83
- { name: "inboxOpsSourceConfigEntries", initializer: identifier("entries") },
84
- {
85
- name: "inboxOpsSourceAdapters",
86
- type: "InboxOpsSourceAdapter[]",
87
- initializer: methodCall(identifier("entries"), "flatMap", [
88
- arrowFunction({
89
- parameters: ["entry"],
90
- body: propertyAccess(identifier("entry"), "adapters")
91
- })
92
- ])
93
- }
94
- ]
95
- });
96
- sourceFile.addVariableStatement({
97
- declarationKind: VariableDeclarationKind.Const,
98
- declarations: [
99
- {
100
- name: "adapterMap",
101
- initializer: newExpression(identifier("Map"), [
102
- methodCall(identifier("inboxOpsSourceAdapters"), "map", [
103
- arrowFunction({
104
- parameters: ["adapter"],
105
- body: arrayLiteral(
106
- [propertyAccess(identifier("adapter"), "sourceEntityType"), identifier("adapter")],
107
- writeValue
108
- )
109
- })
110
- ])
111
- ])
112
- }
113
- ]
114
- });
115
- sourceFile.addFunction({
116
- name: "getInboxOpsSourceAdapter",
117
- isExported: true,
118
- parameters: [{ name: "sourceEntityType", type: "string" }],
119
- returnType: "InboxOpsSourceAdapter | undefined",
120
- statements: [returnStatement(methodCall(identifier("adapterMap"), "get", [identifier("sourceEntityType")]))]
121
- });
122
- },
123
- generator: "registry"
124
- });
125
- return /* @__PURE__ */ new Map([["inbox-ops-sources.generated.ts", output]]);
126
- }
127
- };
128
- }
129
- export {
130
- createInboxOpsSourcesExtension
131
- };
132
- //# sourceMappingURL=inbox-ops-sources.js.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../../src/lib/generators/extensions/inbox-ops-sources.ts"],
4
- "sourcesContent": ["import { VariableDeclarationKind, type WriterFunction } from 'ts-morph'\nimport type { GeneratorExtension } from '../extension'\nimport {\n arrayLiteral,\n arrowFunction,\n binaryExpression,\n identifier,\n methodCall,\n newExpression,\n propertyAccess,\n returnStatement,\n writeValue,\n} from '../ast'\nimport { emptyArray, moduleEntry, namespaceFallback, namespaceImportSpec, renderGeneratedTsSource } from './shared'\n\nexport function createInboxOpsSourcesExtension(): GeneratorExtension {\n const imports: Array<ReturnType<typeof namespaceImportSpec>> = []\n const entries: WriterFunction[] = []\n\n return {\n id: 'registry.inbox-ops-sources',\n outputFiles: ['inbox-ops-sources.generated.ts'],\n scanModule(ctx) {\n ctx.processStandaloneConfig({\n roots: ctx.roots,\n imps: ctx.imps,\n modId: ctx.moduleId,\n relativePath: 'inbox-ops-sources.ts',\n prefix: 'INBOX_OPS_SOURCES',\n importIdRef: ctx.importIdRef,\n standaloneImports: imports,\n standaloneEntries: entries,\n writeConfig: ({ importName, moduleId }) =>\n moduleEntry(moduleId, [\n {\n name: 'adapters',\n value: namespaceFallback({\n importName,\n members: ['default', 'inboxOpsSourceAdapters'],\n fallback: emptyArray(),\n castType: 'InboxOpsSourceAdapter[]',\n }),\n },\n ]),\n })\n },\n generateOutput() {\n const output = renderGeneratedTsSource({\n fileName: 'inbox-ops-sources.generated.ts',\n imports: [\n {\n namedImports: [\n { name: 'InboxOpsSourceAdapter', isTypeOnly: true },\n ],\n moduleSpecifier: '@open-mercato/shared/modules/inbox-ops-sources',\n },\n ...imports,\n ],\n build(sourceFile) {\n sourceFile.addTypeAlias({\n name: 'InboxOpsSourceConfigEntry',\n type: '{ moduleId: string; adapters: InboxOpsSourceAdapter[] }',\n })\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n declarations: [\n {\n name: 'entriesRaw',\n type: 'InboxOpsSourceConfigEntry[]',\n initializer: arrayLiteral(entries, writeValue),\n },\n {\n name: 'entries',\n initializer: methodCall(identifier('entriesRaw'), 'filter', [\n arrowFunction({\n parameters: ['entry'],\n body: binaryExpression(propertyAccess(propertyAccess(identifier('entry'), 'adapters'), 'length'), '>', 0),\n }),\n ]),\n },\n ],\n })\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n isExported: true,\n declarations: [\n { name: 'inboxOpsSourceConfigEntries', initializer: identifier('entries') },\n {\n name: 'inboxOpsSourceAdapters',\n type: 'InboxOpsSourceAdapter[]',\n initializer: methodCall(identifier('entries'), 'flatMap', [\n arrowFunction({\n parameters: ['entry'],\n body: propertyAccess(identifier('entry'), 'adapters'),\n }),\n ]),\n },\n ],\n })\n sourceFile.addVariableStatement({\n declarationKind: VariableDeclarationKind.Const,\n declarations: [\n {\n name: 'adapterMap',\n initializer: newExpression(identifier('Map'), [\n methodCall(identifier('inboxOpsSourceAdapters'), 'map', [\n arrowFunction({\n parameters: ['adapter'],\n body: arrayLiteral(\n [propertyAccess(identifier('adapter'), 'sourceEntityType'), identifier('adapter')],\n writeValue,\n ),\n }),\n ]),\n ]),\n },\n ],\n })\n sourceFile.addFunction({\n name: 'getInboxOpsSourceAdapter',\n isExported: true,\n parameters: [{ name: 'sourceEntityType', type: 'string' }],\n returnType: 'InboxOpsSourceAdapter | undefined',\n statements: [returnStatement(methodCall(identifier('adapterMap'), 'get', [identifier('sourceEntityType')]))],\n })\n },\n generator: 'registry',\n })\n\n return new Map([['inbox-ops-sources.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,EACA;AAAA,OACK;AACP,SAAS,YAAY,aAAa,mBAAwC,+BAA+B;AA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G,OAAO,CAAC,WAAW,kBAAkB,CAAC,CAAC,CAAC,CAAC;AAAA,UAC7G,CAAC;AAAA,QACH;AAAA,QACA,WAAW;AAAA,MACb,CAAC;AAED,aAAO,oBAAI,IAAI,CAAC,CAAC,kCAAkC,MAAM,CAAC,CAAC;AAAA,IAC7D;AAAA,EACF;AACF;",
6
- "names": []
7
- }
@@ -1,133 +0,0 @@
1
- import { VariableDeclarationKind, type WriterFunction } from 'ts-morph'
2
- import type { GeneratorExtension } from '../extension'
3
- import {
4
- arrayLiteral,
5
- arrowFunction,
6
- binaryExpression,
7
- identifier,
8
- methodCall,
9
- newExpression,
10
- propertyAccess,
11
- returnStatement,
12
- writeValue,
13
- } from '../ast'
14
- import { emptyArray, moduleEntry, namespaceFallback, namespaceImportSpec, renderGeneratedTsSource } from './shared'
15
-
16
- export function createInboxOpsSourcesExtension(): GeneratorExtension {
17
- const imports: Array<ReturnType<typeof namespaceImportSpec>> = []
18
- const entries: WriterFunction[] = []
19
-
20
- return {
21
- id: 'registry.inbox-ops-sources',
22
- outputFiles: ['inbox-ops-sources.generated.ts'],
23
- scanModule(ctx) {
24
- ctx.processStandaloneConfig({
25
- roots: ctx.roots,
26
- imps: ctx.imps,
27
- modId: ctx.moduleId,
28
- relativePath: 'inbox-ops-sources.ts',
29
- prefix: 'INBOX_OPS_SOURCES',
30
- importIdRef: ctx.importIdRef,
31
- standaloneImports: imports,
32
- standaloneEntries: entries,
33
- writeConfig: ({ importName, moduleId }) =>
34
- moduleEntry(moduleId, [
35
- {
36
- name: 'adapters',
37
- value: namespaceFallback({
38
- importName,
39
- members: ['default', 'inboxOpsSourceAdapters'],
40
- fallback: emptyArray(),
41
- castType: 'InboxOpsSourceAdapter[]',
42
- }),
43
- },
44
- ]),
45
- })
46
- },
47
- generateOutput() {
48
- const output = renderGeneratedTsSource({
49
- fileName: 'inbox-ops-sources.generated.ts',
50
- imports: [
51
- {
52
- namedImports: [
53
- { name: 'InboxOpsSourceAdapter', isTypeOnly: true },
54
- ],
55
- moduleSpecifier: '@open-mercato/shared/modules/inbox-ops-sources',
56
- },
57
- ...imports,
58
- ],
59
- build(sourceFile) {
60
- sourceFile.addTypeAlias({
61
- name: 'InboxOpsSourceConfigEntry',
62
- type: '{ moduleId: string; adapters: InboxOpsSourceAdapter[] }',
63
- })
64
- sourceFile.addVariableStatement({
65
- declarationKind: VariableDeclarationKind.Const,
66
- declarations: [
67
- {
68
- name: 'entriesRaw',
69
- type: 'InboxOpsSourceConfigEntry[]',
70
- initializer: arrayLiteral(entries, writeValue),
71
- },
72
- {
73
- name: 'entries',
74
- initializer: methodCall(identifier('entriesRaw'), 'filter', [
75
- arrowFunction({
76
- parameters: ['entry'],
77
- body: binaryExpression(propertyAccess(propertyAccess(identifier('entry'), 'adapters'), 'length'), '>', 0),
78
- }),
79
- ]),
80
- },
81
- ],
82
- })
83
- sourceFile.addVariableStatement({
84
- declarationKind: VariableDeclarationKind.Const,
85
- isExported: true,
86
- declarations: [
87
- { name: 'inboxOpsSourceConfigEntries', initializer: identifier('entries') },
88
- {
89
- name: 'inboxOpsSourceAdapters',
90
- type: 'InboxOpsSourceAdapter[]',
91
- initializer: methodCall(identifier('entries'), 'flatMap', [
92
- arrowFunction({
93
- parameters: ['entry'],
94
- body: propertyAccess(identifier('entry'), 'adapters'),
95
- }),
96
- ]),
97
- },
98
- ],
99
- })
100
- sourceFile.addVariableStatement({
101
- declarationKind: VariableDeclarationKind.Const,
102
- declarations: [
103
- {
104
- name: 'adapterMap',
105
- initializer: newExpression(identifier('Map'), [
106
- methodCall(identifier('inboxOpsSourceAdapters'), 'map', [
107
- arrowFunction({
108
- parameters: ['adapter'],
109
- body: arrayLiteral(
110
- [propertyAccess(identifier('adapter'), 'sourceEntityType'), identifier('adapter')],
111
- writeValue,
112
- ),
113
- }),
114
- ]),
115
- ]),
116
- },
117
- ],
118
- })
119
- sourceFile.addFunction({
120
- name: 'getInboxOpsSourceAdapter',
121
- isExported: true,
122
- parameters: [{ name: 'sourceEntityType', type: 'string' }],
123
- returnType: 'InboxOpsSourceAdapter | undefined',
124
- statements: [returnStatement(methodCall(identifier('adapterMap'), 'get', [identifier('sourceEntityType')]))],
125
- })
126
- },
127
- generator: 'registry',
128
- })
129
-
130
- return new Map([['inbox-ops-sources.generated.ts', output]])
131
- },
132
- }
133
- }