@auto-engineer/narrative 0.11.11 → 0.11.12

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 +1 -1
  2. package/CHANGELOG.md +11 -0
  3. package/dist/src/getFlows.cache.specs.js +18 -18
  4. package/dist/src/getFlows.cache.specs.js.map +1 -1
  5. package/dist/src/getNarratives.specs.d.ts +2 -0
  6. package/dist/src/getNarratives.specs.d.ts.map +1 -0
  7. package/dist/src/{getFlows.specs.js → getNarratives.specs.js} +22 -22
  8. package/dist/src/getNarratives.specs.js.map +1 -0
  9. package/dist/src/id/addAutoIds.specs.js +6 -6
  10. package/dist/src/id/addAutoIds.specs.js.map +1 -1
  11. package/dist/src/id/hasAllIds.specs.js +16 -16
  12. package/dist/src/id/hasAllIds.specs.js.map +1 -1
  13. package/dist/src/model-to-flow.specs.js +3 -3
  14. package/dist/src/model-to-flow.specs.js.map +1 -1
  15. package/dist/src/samples/items.narrative.d.ts +2 -0
  16. package/dist/src/samples/items.narrative.d.ts.map +1 -0
  17. package/dist/src/samples/{items.flow.js → items.narrative.js} +1 -1
  18. package/dist/src/samples/items.narrative.js.map +1 -0
  19. package/dist/src/samples/mixed-given-types.narrative.d.ts +2 -0
  20. package/dist/src/samples/mixed-given-types.narrative.d.ts.map +1 -0
  21. package/dist/src/samples/{mixed-given-types.flow.js → mixed-given-types.narrative.js} +1 -1
  22. package/dist/src/samples/mixed-given-types.narrative.js.map +1 -0
  23. package/dist/src/samples/{place-order.flow.d.ts → place-order.narrative.d.ts} +2 -2
  24. package/dist/src/samples/place-order.narrative.d.ts.map +1 -0
  25. package/dist/src/samples/{place-order.flow.js → place-order.narrative.js} +1 -1
  26. package/dist/src/samples/place-order.narrative.js.map +1 -0
  27. package/dist/src/samples/questionnaires.narrative.d.ts +2 -0
  28. package/dist/src/samples/questionnaires.narrative.d.ts.map +1 -0
  29. package/dist/src/samples/{questionnaires.flow.js → questionnaires.narrative.js} +1 -1
  30. package/dist/src/samples/questionnaires.narrative.js.map +1 -0
  31. package/dist/src/samples/seasonal-assistant.schema.json +1 -1
  32. package/dist/src/samples/test-with-ids.narrative.d.ts +2 -0
  33. package/dist/src/samples/test-with-ids.narrative.d.ts.map +1 -0
  34. package/dist/src/samples/{test-with-ids.flow.js → test-with-ids.narrative.js} +1 -1
  35. package/dist/src/samples/test-with-ids.narrative.js.map +1 -0
  36. package/dist/src/schema.d.ts +2991 -2991
  37. package/dist/tsconfig.tsbuildinfo +1 -1
  38. package/package.json +5 -5
  39. package/src/getFlows.cache.specs.ts +18 -18
  40. package/src/{getFlows.specs.ts → getNarratives.specs.ts} +23 -21
  41. package/src/id/addAutoIds.specs.ts +6 -6
  42. package/src/id/hasAllIds.specs.ts +16 -16
  43. package/src/model-to-flow.specs.ts +3 -3
  44. package/src/samples/{place-order.flow.ts → place-order.narrative.ts} +2 -2
  45. package/src/samples/seasonal-assistant.schema.json +1 -1
  46. package/.turbo/turbo-format.log +0 -4
  47. package/.turbo/turbo-lint.log +0 -4
  48. package/.turbo/turbo-test.log +0 -14
  49. package/.turbo/turbo-type-check.log +0 -4
  50. package/dist/src/data-flow-builders.d.ts +0 -71
  51. package/dist/src/data-flow-builders.d.ts.map +0 -1
  52. package/dist/src/data-flow-builders.js +0 -326
  53. package/dist/src/data-flow-builders.js.map +0 -1
  54. package/dist/src/flow-context.d.ts +0 -25
  55. package/dist/src/flow-context.d.ts.map +0 -1
  56. package/dist/src/flow-context.js +0 -579
  57. package/dist/src/flow-context.js.map +0 -1
  58. package/dist/src/flow-context.specs.d.ts +0 -2
  59. package/dist/src/flow-context.specs.d.ts.map +0 -1
  60. package/dist/src/flow-context.specs.js +0 -185
  61. package/dist/src/flow-context.specs.js.map +0 -1
  62. package/dist/src/flow-registry.d.ts +0 -12
  63. package/dist/src/flow-registry.d.ts.map +0 -1
  64. package/dist/src/flow-registry.js +0 -46
  65. package/dist/src/flow-registry.js.map +0 -1
  66. package/dist/src/flow.d.ts +0 -49
  67. package/dist/src/flow.d.ts.map +0 -1
  68. package/dist/src/flow.js +0 -146
  69. package/dist/src/flow.js.map +0 -1
  70. package/dist/src/getFlows.d.ts +0 -21
  71. package/dist/src/getFlows.d.ts.map +0 -1
  72. package/dist/src/getFlows.js +0 -119
  73. package/dist/src/getFlows.js.map +0 -1
  74. package/dist/src/getFlows.specs.d.ts +0 -2
  75. package/dist/src/getFlows.specs.d.ts.map +0 -1
  76. package/dist/src/getFlows.specs.js.map +0 -1
  77. package/dist/src/samples/items.flow.d.ts +0 -2
  78. package/dist/src/samples/items.flow.d.ts.map +0 -1
  79. package/dist/src/samples/items.flow.js.map +0 -1
  80. package/dist/src/samples/mixed-given-types.flow.d.ts +0 -2
  81. package/dist/src/samples/mixed-given-types.flow.d.ts.map +0 -1
  82. package/dist/src/samples/mixed-given-types.flow.js.map +0 -1
  83. package/dist/src/samples/place-order.flow.d.ts.map +0 -1
  84. package/dist/src/samples/place-order.flow.js.map +0 -1
  85. package/dist/src/samples/questionnaires.flow.d.ts +0 -2
  86. package/dist/src/samples/questionnaires.flow.d.ts.map +0 -1
  87. package/dist/src/samples/questionnaires.flow.js.map +0 -1
  88. package/dist/src/samples/test-with-ids.flow.d.ts +0 -2
  89. package/dist/src/samples/test-with-ids.flow.d.ts.map +0 -1
  90. package/dist/src/samples/test-with-ids.flow.js.map +0 -1
  91. package/dist/src/transformers/flow-to-model/assemble.d.ts +0 -3
  92. package/dist/src/transformers/flow-to-model/assemble.d.ts.map +0 -1
  93. package/dist/src/transformers/flow-to-model/assemble.js +0 -9
  94. package/dist/src/transformers/flow-to-model/assemble.js.map +0 -1
  95. package/dist/src/transformers/flow-to-model/debug.d.ts +0 -3
  96. package/dist/src/transformers/flow-to-model/debug.d.ts.map +0 -1
  97. package/dist/src/transformers/flow-to-model/debug.js +0 -6
  98. package/dist/src/transformers/flow-to-model/debug.js.map +0 -1
  99. package/dist/src/transformers/flow-to-model/example-shapes.d.ts +0 -6
  100. package/dist/src/transformers/flow-to-model/example-shapes.d.ts.map +0 -1
  101. package/dist/src/transformers/flow-to-model/example-shapes.js +0 -60
  102. package/dist/src/transformers/flow-to-model/example-shapes.js.map +0 -1
  103. package/dist/src/transformers/flow-to-model/guards.d.ts +0 -15
  104. package/dist/src/transformers/flow-to-model/guards.d.ts.map +0 -1
  105. package/dist/src/transformers/flow-to-model/guards.js +0 -18
  106. package/dist/src/transformers/flow-to-model/guards.js.map +0 -1
  107. package/dist/src/transformers/flow-to-model/index.d.ts +0 -4
  108. package/dist/src/transformers/flow-to-model/index.d.ts.map +0 -1
  109. package/dist/src/transformers/flow-to-model/index.js +0 -193
  110. package/dist/src/transformers/flow-to-model/index.js.map +0 -1
  111. package/dist/src/transformers/flow-to-model/inlining.d.ts +0 -4
  112. package/dist/src/transformers/flow-to-model/inlining.d.ts.map +0 -1
  113. package/dist/src/transformers/flow-to-model/inlining.js +0 -95
  114. package/dist/src/transformers/flow-to-model/inlining.js.map +0 -1
  115. package/dist/src/transformers/flow-to-model/integrations.d.ts +0 -36
  116. package/dist/src/transformers/flow-to-model/integrations.d.ts.map +0 -1
  117. package/dist/src/transformers/flow-to-model/integrations.js +0 -147
  118. package/dist/src/transformers/flow-to-model/integrations.js.map +0 -1
  119. package/dist/src/transformers/flow-to-model/messages.d.ts +0 -5
  120. package/dist/src/transformers/flow-to-model/messages.d.ts.map +0 -1
  121. package/dist/src/transformers/flow-to-model/messages.js +0 -88
  122. package/dist/src/transformers/flow-to-model/messages.js.map +0 -1
  123. package/dist/src/transformers/flow-to-model/normalize.d.ts +0 -3
  124. package/dist/src/transformers/flow-to-model/normalize.d.ts.map +0 -1
  125. package/dist/src/transformers/flow-to-model/normalize.js +0 -23
  126. package/dist/src/transformers/flow-to-model/normalize.js.map +0 -1
  127. package/dist/src/transformers/flow-to-model/spec-processors.d.ts +0 -34
  128. package/dist/src/transformers/flow-to-model/spec-processors.d.ts.map +0 -1
  129. package/dist/src/transformers/flow-to-model/spec-processors.js +0 -395
  130. package/dist/src/transformers/flow-to-model/spec-processors.js.map +0 -1
  131. package/dist/src/transformers/flow-to-model/strings.d.ts +0 -2
  132. package/dist/src/transformers/flow-to-model/strings.d.ts.map +0 -1
  133. package/dist/src/transformers/flow-to-model/strings.js +0 -11
  134. package/dist/src/transformers/flow-to-model/strings.js.map +0 -1
  135. package/dist/src/transformers/flow-to-model/type-inference.d.ts +0 -3
  136. package/dist/src/transformers/flow-to-model/type-inference.d.ts.map +0 -1
  137. package/dist/src/transformers/flow-to-model/type-inference.js +0 -92
  138. package/dist/src/transformers/flow-to-model/type-inference.js.map +0 -1
  139. package/dist/src/transformers/flow-to-model/type-inference.specs.d.ts +0 -2
  140. package/dist/src/transformers/flow-to-model/type-inference.specs.d.ts.map +0 -1
  141. package/dist/src/transformers/flow-to-model/type-inference.specs.js +0 -167
  142. package/dist/src/transformers/flow-to-model/type-inference.specs.js.map +0 -1
  143. package/dist/src/transformers/flow-to-model/zod-adapter.d.ts +0 -6
  144. package/dist/src/transformers/flow-to-model/zod-adapter.d.ts.map +0 -1
  145. package/dist/src/transformers/flow-to-model/zod-adapter.js +0 -101
  146. package/dist/src/transformers/flow-to-model/zod-adapter.js.map +0 -1
  147. package/dist/src/transformers/model-to-flow/analysis/extract-flow.d.ts +0 -2
  148. package/dist/src/transformers/model-to-flow/analysis/extract-flow.d.ts.map +0 -1
  149. package/dist/src/transformers/model-to-flow/analysis/extract-flow.js +0 -22
  150. package/dist/src/transformers/model-to-flow/analysis/extract-flow.js.map +0 -1
  151. package/dist/src/transformers/model-to-flow/analysis/lint-helpers.d.ts +0 -18
  152. package/dist/src/transformers/model-to-flow/analysis/lint-helpers.d.ts.map +0 -1
  153. package/dist/src/transformers/model-to-flow/analysis/lint-helpers.js +0 -78
  154. package/dist/src/transformers/model-to-flow/analysis/lint-helpers.js.map +0 -1
  155. package/dist/src/transformers/model-to-flow/analysis/type-decls.d.ts +0 -7
  156. package/dist/src/transformers/model-to-flow/analysis/type-decls.d.ts.map +0 -1
  157. package/dist/src/transformers/model-to-flow/analysis/type-decls.js +0 -74
  158. package/dist/src/transformers/model-to-flow/analysis/type-decls.js.map +0 -1
  159. package/dist/src/transformers/model-to-flow/analysis/usage.d.ts +0 -9
  160. package/dist/src/transformers/model-to-flow/analysis/usage.d.ts.map +0 -1
  161. package/dist/src/transformers/model-to-flow/analysis/usage.js +0 -90
  162. package/dist/src/transformers/model-to-flow/analysis/usage.js.map +0 -1
  163. package/dist/src/transformers/model-to-flow/ast/emit-helpers.d.ts +0 -18
  164. package/dist/src/transformers/model-to-flow/ast/emit-helpers.d.ts.map +0 -1
  165. package/dist/src/transformers/model-to-flow/ast/emit-helpers.js +0 -159
  166. package/dist/src/transformers/model-to-flow/ast/emit-helpers.js.map +0 -1
  167. package/dist/src/transformers/model-to-flow/formatting/prettier.d.ts +0 -2
  168. package/dist/src/transformers/model-to-flow/formatting/prettier.d.ts.map +0 -1
  169. package/dist/src/transformers/model-to-flow/formatting/prettier.js +0 -26
  170. package/dist/src/transformers/model-to-flow/formatting/prettier.js.map +0 -1
  171. package/dist/src/transformers/model-to-flow/formatting/sort-types.d.ts +0 -6
  172. package/dist/src/transformers/model-to-flow/formatting/sort-types.d.ts.map +0 -1
  173. package/dist/src/transformers/model-to-flow/formatting/sort-types.js +0 -17
  174. package/dist/src/transformers/model-to-flow/formatting/sort-types.js.map +0 -1
  175. package/dist/src/transformers/model-to-flow/generators/compose.d.ts +0 -6
  176. package/dist/src/transformers/model-to-flow/generators/compose.d.ts.map +0 -1
  177. package/dist/src/transformers/model-to-flow/generators/compose.js +0 -79
  178. package/dist/src/transformers/model-to-flow/generators/compose.js.map +0 -1
  179. package/dist/src/transformers/model-to-flow/generators/flow.d.ts +0 -15
  180. package/dist/src/transformers/model-to-flow/generators/flow.d.ts.map +0 -1
  181. package/dist/src/transformers/model-to-flow/generators/flow.js +0 -316
  182. package/dist/src/transformers/model-to-flow/generators/flow.js.map +0 -1
  183. package/dist/src/transformers/model-to-flow/generators/gwt.d.ts +0 -57
  184. package/dist/src/transformers/model-to-flow/generators/gwt.d.ts.map +0 -1
  185. package/dist/src/transformers/model-to-flow/generators/gwt.js +0 -186
  186. package/dist/src/transformers/model-to-flow/generators/gwt.js.map +0 -1
  187. package/dist/src/transformers/model-to-flow/generators/imports.d.ts +0 -16
  188. package/dist/src/transformers/model-to-flow/generators/imports.d.ts.map +0 -1
  189. package/dist/src/transformers/model-to-flow/generators/imports.js +0 -57
  190. package/dist/src/transformers/model-to-flow/generators/imports.js.map +0 -1
  191. package/dist/src/transformers/model-to-flow/generators/types.d.ts +0 -13
  192. package/dist/src/transformers/model-to-flow/generators/types.d.ts.map +0 -1
  193. package/dist/src/transformers/model-to-flow/generators/types.js +0 -22
  194. package/dist/src/transformers/model-to-flow/generators/types.js.map +0 -1
  195. package/dist/src/transformers/model-to-flow/index.d.ts +0 -13
  196. package/dist/src/transformers/model-to-flow/index.d.ts.map +0 -1
  197. package/dist/src/transformers/model-to-flow/index.js +0 -25
  198. package/dist/src/transformers/model-to-flow/index.js.map +0 -1
  199. package/dist/src/transformers/model-to-flow/utils/integration-extractor.d.ts +0 -12
  200. package/dist/src/transformers/model-to-flow/utils/integration-extractor.d.ts.map +0 -1
  201. package/dist/src/transformers/model-to-flow/utils/integration-extractor.js +0 -64
  202. package/dist/src/transformers/model-to-flow/utils/integration-extractor.js.map +0 -1
  203. package/dist/src/transformers/model-to-flow/utils/strings.d.ts +0 -9
  204. package/dist/src/transformers/model-to-flow/utils/strings.d.ts.map +0 -1
  205. package/dist/src/transformers/model-to-flow/utils/strings.js +0 -11
  206. package/dist/src/transformers/model-to-flow/utils/strings.js.map +0 -1
  207. /package/src/samples/{items.flow.ts → items.narrative.ts} +0 -0
  208. /package/src/samples/{mixed-given-types.flow.ts → mixed-given-types.narrative.ts} +0 -0
  209. /package/src/samples/{questionnaires.flow.ts → questionnaires.narrative.ts} +0 -0
  210. /package/src/samples/{test-with-ids.flow.ts → test-with-ids.narrative.ts} +0 -0
@@ -1,95 +0,0 @@
1
- function inlineIdentifier(name, lookup, seen = new Set()) {
2
- // avoid infinite recursion on cyclical type graphs
3
- if (seen.has(name))
4
- return undefined;
5
- seen.add(name);
6
- const ti = lookup.get(name);
7
- if (!ti)
8
- return undefined;
9
- // If the referenced type has object-like fields, inline them as { a: T; b?: U }
10
- if (Array.isArray(ti.dataFields) && ti.dataFields.length > 0) {
11
- const parts = ti.dataFields.map((f) => {
12
- const nested = inlineTypeString(f.type, lookup, seen);
13
- const typeStr = nested ?? f.type;
14
- return `${f.name}${f.required ? '' : '?'}: ${typeStr}`;
15
- });
16
- return `{ ${parts.join('; ')} }`;
17
- }
18
- // If we don't have field info, we can't inline safely
19
- return undefined;
20
- }
21
- function handleArrayType(type, lookup, seen) {
22
- const arr = type.match(/^Array<\s*([^>]+)\s*>$/);
23
- if (arr) {
24
- const inner = arr[1].trim();
25
- const inlinedInner = inlineTypeString(inner, lookup, seen) ?? inlineIdentifier(inner, lookup, seen);
26
- if (inlinedInner !== undefined && inlinedInner !== null)
27
- return `Array<${inlinedInner}>`;
28
- }
29
- return undefined;
30
- }
31
- function isPrimitiveType(type) {
32
- return (type === 'string' ||
33
- type === 'number' ||
34
- type === 'boolean' ||
35
- type === 'Date' ||
36
- type === 'unknown' ||
37
- type === 'any');
38
- }
39
- function isStructuralType(type) {
40
- const trimmed = type.trim();
41
- return (trimmed.startsWith('{') && trimmed.endsWith('}')) || trimmed.includes(' | null') || trimmed.includes('|null');
42
- }
43
- function inlineTypeString(type, lookup, seen = new Set()) {
44
- // Array<T>
45
- const arrayResult = handleArrayType(type, lookup, seen);
46
- if (arrayResult !== undefined)
47
- return arrayResult;
48
- // Basic primitives we don't touch
49
- if (isPrimitiveType(type)) {
50
- return undefined;
51
- }
52
- // Already structural? (starts with '{' and ends with '}' or looks like a union with null)
53
- if (isStructuralType(type)) {
54
- return undefined; // keep as is
55
- }
56
- // Handle union types like "string | null"
57
- if (type.includes(' | ')) {
58
- const parts = type.split(' | ').map((p) => p.trim());
59
- const inlinedParts = parts.map((part) => {
60
- if (isPrimitiveType(part) || part === 'null') {
61
- return part;
62
- }
63
- const inlined = inlineTypeString(part, lookup, seen);
64
- return inlined ?? part;
65
- });
66
- // Fix: Convert "unknown" back to "null" in union types (TypeScript parsing issue)
67
- // Only replace unknown with null when it's part of a union with other types
68
- const result = inlinedParts.join(' | ');
69
- if (inlinedParts.length > 1 && inlinedParts.includes('unknown')) {
70
- return result.replace(/\bunknown\b/g, 'null');
71
- }
72
- return result;
73
- }
74
- // Single identifier? Try to inline it
75
- const ident = type.match(/^[A-Za-z_]\w*$/);
76
- if (ident) {
77
- const asObj = inlineIdentifier(type, lookup, seen);
78
- if (asObj !== undefined)
79
- return asObj;
80
- return undefined;
81
- }
82
- // Generic we don't specially handle (Record<...>, etc.) -> leave as-is
83
- return undefined;
84
- }
85
- export function inlineAllMessageFieldTypes(msgs, lookup) {
86
- for (const [, msg] of msgs) {
87
- if (!Array.isArray(msg.fields))
88
- continue;
89
- msg.fields = msg.fields.map((f) => {
90
- const inlined = inlineTypeString(f.type, lookup);
91
- return inlined !== undefined ? { ...f, type: inlined } : f;
92
- });
93
- }
94
- }
95
- //# sourceMappingURL=inlining.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inlining.js","sourceRoot":"","sources":["../../../../src/transformers/flow-to-model/inlining.ts"],"names":[],"mappings":"AAGA,SAAS,gBAAgB,CAAC,IAAY,EAAE,MAA6B,EAAE,OAAO,IAAI,GAAG,EAAU;IAC7F,mDAAmD;IACnD,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC;IACrC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAEf,MAAM,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,CAAC,EAAE;QAAE,OAAO,SAAS,CAAC;IAE1B,gFAAgF;IAChF,IAAI,KAAK,CAAC,OAAO,CAAC,E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C,CAAC,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
@@ -1,36 +0,0 @@
1
- import { Integration } from '../../types';
2
- import { Message } from '../../index';
3
- export declare function addIntegrationImportPath(integrationName: string, importPath: string): void;
4
- export declare function addIntegrationToMap(integrations: Map<string, {
5
- name: string;
6
- description?: string;
7
- source: string;
8
- }>, system: string): void;
9
- export declare function processDestination(d: {
10
- destination: unknown;
11
- }, integrations: Map<string, {
12
- name: string;
13
- description?: string;
14
- source: string;
15
- }>, messages: Map<string, Message>): void;
16
- export declare function processOrigin(d: {
17
- origin: unknown;
18
- }, integrations: Map<string, {
19
- name: string;
20
- description?: string;
21
- source: string;
22
- }>): void;
23
- export declare function processWithStateOrigin(d: {
24
- _withState: unknown;
25
- }, integrations: Map<string, {
26
- name: string;
27
- description?: string;
28
- source: string;
29
- }>): void;
30
- export declare function processDataItemIntegrations(d: unknown, integrations: Map<string, {
31
- name: string;
32
- description?: string;
33
- source: string;
34
- }>, messages: Map<string, Message>): void;
35
- export declare const extractMessagesFromIntegrations: (integrations: Integration[]) => Message[];
36
- //# sourceMappingURL=integrations.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"integrations.d.ts","sourceRoot":"","sources":["../../../../src/transformers/flow-to-model/integrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAStC,wBAAgB,wBAAwB,CAAC,eAAe,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAE1F;AAED,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,EACjF,MAAM,EAAE,MAAM,GACb,IAAI,CAeN;AAED,wBA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ithState, isValidIntegration } from './guards.js';
4
- import { processDestinationMessage } from './messages.js';
5
- import { integrationExportRegistry } from '../../integration-export-registry.js';
6
- const integrationImportPaths = new Map();
7
- export function addIntegrationImportPath(integrationName, importPath) {
8
- integrationImportPaths.set(integrationName, importPath);
9
- }
10
- export function addIntegrationToMap(integrations, system) {
11
- if (!integrations.has(system)) {
12
- let sourcePath = integrationImportPaths.get(system);
13
- if (sourcePath === null || sourcePath === undefined || sourcePath === '') {
14
- sourcePath = integrationExportRegistry.getSourcePath(system);
15
- }
16
- if (sourcePath !== null && sourcePath !== undefined && sourcePath !== '') {
17
- integrations.set(system, {
18
- name: system,
19
- description: `${system} integration`,
20
- source: sourcePath,
21
- });
22
- }
23
- }
24
- }
25
- export function processDestination(d, integrations, messages) {
26
- if (isValidIntegration(d.destination)) {
27
- d.destination.systems.forEach((system) => {
28
- addIntegrationToMap(integrations, system);
29
- if (typeof d.destination === 'object' &&
30
- d.destination !== null &&
31
- 'message' in d.destination &&
32
- d.destination.message !== null) {
33
- processDestinationMessage(d.destination.message, messages);
34
- }
35
- });
36
- }
37
- }
38
- export function processOrigin(d, integrations) {
39
- if (isValidIntegration(d.origin)) {
40
- d.origin.systems.forEach((system) => {
41
- addIntegrationToMap(integrations, system);
42
- });
43
- }
44
- }
45
- export function processWithStateOrigin(d, integrations) {
46
- if (typeof d._withState === 'object' && d._withState !== null && 'origin' in d._withState) {
47
- const withState = d._withState;
48
- if (isValidIntegration(withState.origin)) {
49
- withState.origin.systems.forEach((system) => {
50
- addIntegrationToMap(integrations, system);
51
- });
52
- }
53
- }
54
- }
55
- export function processDataItemIntegrations(d, integrations, messages) {
56
- if (hasDestination(d)) {
57
- processDestination(d, integrations, messages);
58
- }
59
- if (hasOrigin(d)) {
60
- processOrigin(d, integrations);
61
- }
62
- if (hasWithState(d)) {
63
- processWithStateOrigin(d, integrations);
64
- }
65
- }
66
- function flattenStateEnvelope(fields) {
67
- const dataIdx = fields.findIndex((f) => f.name === 'data' && typeof f.type === 'string' && f.type.trim().startsWith('{'));
68
- if (dataIdx !== -1) {
69
- const src = fields[dataIdx].type; // "{ a: T, b?: U }" or "{ a: T; b?: U }"
70
- const bodyMatch = src.match(/^\{\s*([^}]*)\s*\}$/);
71
- if (bodyMatch && bodyMatch[1]) {
72
- const body = bodyMatch[1];
73
- const inner = [];
74
- // support comma OR semicolon separators
75
- const re = /(\w+)(\?)?\s*:\s*([^;,]+)(?=[;,]|$)/g;
76
- let m;
77
- while ((m = re.exec(body)) !== null) {
78
- inner.push({ name: m[1], required: !m[2], type: m[3].trim() });
79
- }
80
- return fields
81
- .filter((f) => f.name !== 'type' && f.name !== 'data')
82
- .concat(inner.map((f) => ({ ...f, required: f.required })));
83
- }
84
- }
85
- // No envelope? still drop the discriminator 'type'
86
- return fields.filter((f) => f.name !== 'type');
87
- }
88
- function createMessageFromFields(name, fields, messageType) {
89
- if (messageType === 'event') {
90
- return {
91
- type: 'event',
92
- name,
93
- fields,
94
- source: 'external',
95
- metadata: { version: 1 },
96
- };
97
- }
98
- else if (messageType === 'command') {
99
- return {
100
- type: 'command',
101
- name,
102
- fields,
103
- metadata: { version: 1 },
104
- };
105
- }
106
- else {
107
- return {
108
- type: 'state',
109
- name,
110
- fields,
111
- metadata: { version: 1 },
112
- };
113
- }
114
- }
115
- const extractSchemaType = (integration, schemaType, messageType) => {
116
- const messages = [];
117
- const schema = integration[schemaType]?.schema;
118
- if (schema) {
119
- debugIntegrations(`[extractMessagesFromIntegrations] Found ${schemaType}.schema:`, Object.keys(schema));
120
- for (const [name, schemaItem] of Object.entries(schema)) {
121
- if (schemaItem) {
122
- let fields = zodSchemaToFields(schemaItem);
123
- // Flatten state envelope { type, data: { ... } } for integration-derived states
124
- if (messageType === 'state') {
125
- fields = flattenStateEnvelope(fields);
126
- }
127
- debugIntegrations(`[extractMessagesFromIntegrations] Creating ${messageType} message '${name}' with fields:`, fields);
128
- messages.push(createMessageFromFields(name, fields, messageType));
129
- }
130
- }
131
- }
132
- else {
133
- debugIntegrations(`[extractMessagesFromIntegrations] No ${schemaType}.schema found for ${integration.name}`);
134
- }
135
- return messages;
136
- };
137
- export const extractMessagesFromIntegrations = (integrations) => {
138
- const messages = [];
139
- for (const integration of integrations) {
140
- debugIntegrations('Processing integration for message extraction: %s', integration.name);
141
- messages.push(...extractSchemaType(integration, 'Commands', 'command'));
142
- messages.push(...extractSchemaType(integration, 'Queries', 'state'));
143
- messages.push(...extractSchemaType(integration, 'Reactions', 'event'));
144
- }
145
- return messages;
146
- };
147
- //# sourceMappingURL=integrations.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"integrations.js","sourceRoot":"","sources":["../../../../src/transformers/flow-to-model/integrations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACvF,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAE9E,MAAM,sBAAsB,GAAG,IAAI,GAAG,EAAkB,CAAC;AAEzD,MAAM,UAAU,wBAAwB,CAAC,eAAuB,EAAE,UAAkB;IAClF,sBAAsB,CAAC,GAAG,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,YAAiF,EACjF,MAAc;IAEd,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9B,IAAI,UAAU,GAAG,sBAAsB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACpD,IAAI,UAAU,KAAK,IAAI,IAAI,UAAU,KAAK,SAAS,IAAI,UAAU,KAAK,EAAE,EAAE,CAAC;YACzE,UAAU,GAAG,yBAAyB,CAAC,aA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,CAAC;YACpE,CAAC;QACH,CAAC;IACH,CAAC;SAAM,CAAC;QACN,iBAAiB,CAAC,wCAAwC,UAAU,qBAAqB,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;IAC/G,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAAC,YAA2B,EAAa,EAAE;IACxF,MAAM,QAAQ,GAAc,EAAE,CAAC;IAE/B,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;QACvC,iBAAiB,CAAC,mDAAmD,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;QAEzF,QAAQ,CAAC,IAAI,CAAC,GAAG,iBAAiB,CAAC,WAAW,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC;QACxE,QAAQ,CAAC,IAAI,CAAC,GAAG,iBAAiB,CAAC,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;QACrE,QAAQ,CAAC,IAAI,CAAC,GAAG,iBAAiB,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;IACzE,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC"}
@@ -1,5 +0,0 @@
1
- import { TypeInfo } from '../../loader/ts-utils';
2
- import { Message } from '../../index';
3
- export declare function createMessage(name: string, typeInfo: TypeInfo | undefined, messageType: 'command' | 'event' | 'state'): Message;
4
- export declare function processDestinationMessage(message: unknown, messages: Map<string, Message>): void;
5
- //# sourceMappingURL=messages.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../../src/transformers/flow-to-model/messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAkDtC,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,QAAQ,GAAG,SAAS,EAC9B,WAAW,EAAE,SAAS,GAAG,OAAO,GAAG,OAAO,GACzC,OAAO,CAkCT;AAED,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAYhG"}
@@ -1,88 +0,0 @@
1
- function mapKindToMessageType(k) {
2
- if (k === 'command')
3
- return 'command';
4
- if (k === 'query')
5
- return 'state';
6
- return 'event';
7
- }
8
- function buildInitialFields(typeInfo) {
9
- return (typeInfo?.dataFields ?? []).map((f) => ({
10
- name: f.name,
11
- type: f.type.includes(' | ') ? f.type.replace(/\bunknown\b/g, 'null') : f.type, // Fix TypeScript parsing issue: unknown -> null in union types only
12
- required: f.required,
13
- description: undefined,
14
- defaultValue: undefined,
15
- }));
16
- }
17
- function parseEnvelopeFields(src) {
18
- const inner = [];
19
- const m = src.match(/^\{\s*([^}]*)\s*\}$/);
20
- if (m && m[1]) {
21
- const body = m[1];
22
- const re = /(\w+)(\?)?\s*:\s*([^;,]+)(?=[;,]|$)/g;
23
- let match;
24
- while ((match = re.exec(body)) !== null) {
25
- inner.push({
26
- name: match[1],
27
- required: !match[2],
28
- type: match[3].trim(),
29
- });
30
- }
31
- }
32
- return inner;
33
- }
34
- function processStateFields(fields) {
35
- const dataField = fields.find((f) => f.name === 'data' && true && f.type.trim().startsWith('{'));
36
- if (dataField) {
37
- const inner = parseEnvelopeFields(dataField.type);
38
- // Replace envelope with flattened inner fields, drop 'type' and 'data'
39
- return fields
40
- .filter((f) => f.name !== 'type' && f.name !== 'data')
41
- .concat(inner.map((f) => ({ ...f, description: undefined, defaultValue: undefined })));
42
- }
43
- return fields;
44
- }
45
- export function createMessage(name, typeInfo, messageType) {
46
- let fields = buildInitialFields(typeInfo);
47
- if (messageType === 'state') {
48
- fields = processStateFields(fields);
49
- }
50
- const metadata = { version: 1 };
51
- if (messageType === 'event') {
52
- return {
53
- type: 'event',
54
- name,
55
- fields,
56
- source: 'internal',
57
- metadata,
58
- };
59
- }
60
- if (messageType === 'command') {
61
- return {
62
- type: 'command',
63
- name,
64
- fields,
65
- metadata,
66
- };
67
- }
68
- return {
69
- type: 'state',
70
- name,
71
- fields,
72
- metadata,
73
- };
74
- }
75
- export function processDestinationMessage(message, messages) {
76
- if (typeof message === 'object' && message !== null && 'name' in message && 'type' in message) {
77
- const typedMessage = message;
78
- if (typeof typedMessage.name === 'string' && typeof typedMessage.type === 'string') {
79
- const messageType = typedMessage.type;
80
- const mappedType = mapKindToMessageType(messageType);
81
- if (!messages.has(typedMessage.name)) {
82
- // For integration messages without TypeInfo, create empty field list
83
- messages.set(typedMessage.name, createMessage(typedMessage.name, undefined, mappedType));
84
- }
85
- }
86
- }
87
- }
88
- //# sourceMappingURL=messages.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../../src/transformers/flow-to-model/messages.ts"],"names":[],"mappings":"AAGA,SAAS,oBAAoB,CAAC,CAAmC;IAC/D,IAAI,CAAC,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IACtC,IAAI,CAAC,KAAK,OAAO;QAAE,OAAO,OAAO,CAAC;IAClC,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,kBAAkB,CAAC,QAA8B;IACxD,OAAO,CAAC,QAAQ,EAAE,UAAU,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC9C,IAAI,EAAE,CAAC,CAAC,IAAI;QACZ,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,oEAAoE;QACpJ,QAAQ,EAAE,CAAC,CAAC,QAAQ;QACpB,WAAW,EAAE,SAAS;QACtB,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wC,CAAC;YAC1E,MAAM,UAAU,GAAG,oBAAoB,CAAC,WAAW,CAAC,CAAC;YACrD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;gBACrC,qEAAqE;gBACrE,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,aAAa,CAAC,YAAY,CAAC,IAAI,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;YAC3F,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -1,3 +0,0 @@
1
- import { Message } from '../../index';
2
- export declare function preferNewFields(newFields: Message['fields'], oldFields?: Message['fields']): boolean;
3
- //# sourceMappingURL=normalize.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../../src/transformers/flow-to-model/normalize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAWtC,wBAAgB,eAAe,CAAC,SAAS,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,GAAG,OAAO,CAepG"}
@@ -1,23 +0,0 @@
1
- function hasEnvelope(fields = []) {
2
- const names = new Set(fields.map((f) => f.name));
3
- return names.has('data') || names.has('type');
4
- }
5
- function effectiveLen(fields = []) {
6
- return fields.filter((f) => f.name !== 'type' && f.name !== 'data').length;
7
- }
8
- export function preferNewFields(newFields, oldFields) {
9
- if (oldFields === undefined || oldFields === null)
10
- return true;
11
- const oldHasEnv = hasEnvelope(oldFields);
12
- const newHasEnv = hasEnvelope(newFields);
13
- const oldLen = effectiveLen(oldFields);
14
- const newLen = effectiveLen(newFields);
15
- // Prefer non-envelope over envelope, but only if the new shape has real fields
16
- if (oldHasEnv && !newHasEnv)
17
- return newLen > 0;
18
- if (!oldHasEnv && newHasEnv)
19
- return false;
20
- // Otherwise prefer richer (or equal) shapes, counting only real fields
21
- return newLen >= oldLen;
22
- }
23
- //# sourceMappingURL=normalize.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../../../src/transformers/flow-to-model/normalize.ts"],"names":[],"mappings":"AAEA,SAAS,WAAW,CAAC,SAA6B,EAAE;IAClD,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACjD,OAAO,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAChD,CAAC;AAED,SAAS,YAAY,CAAC,SAA6B,EAAE;IACnD,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,MAAM,CAAC;AAC7E,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,SAA4B,EAAE,SAA6B;IACzF,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAE/D,MAAM,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;IACzC,MAAM,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC;IAEzC,MAAM,MAAM,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;IACvC,MAAM,MAAM,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;IAEvC,+EAA+E;IAC/E,IAAI,SAAS,IAAI,CAAC,SAAS;QAAE,OAAO,MAAM,GAAG,CAAC,CAAC;IAC/C,IAAI,CAAC,SAAS,IAAI,SAAS;QAAE,OAAO,KAAK,CAAC;IAE1C,uEAAuE;IACvE,OAAO,MAAM,IAAI,MAAM,CAAC;AAC1B,CAAC"}
@@ -1,34 +0,0 @@
1
- import { TypeInfo } from '../../loader/ts-utils';
2
- import { Message } from '../../index';
3
- import { ExampleShapeHints } from './example-shapes';
4
- type TypeResolver = (t: string, expected?: 'command' | 'event' | 'state', exampleData?: unknown) => {
5
- resolvedName: string;
6
- typeInfo: TypeInfo | undefined;
7
- };
8
- export declare function processGiven(given: Array<{
9
- eventRef?: string;
10
- commandRef?: string;
11
- stateRef?: string;
12
- exampleData?: unknown;
13
- }>, resolveTypeAndInfo: TypeResolver, messages: Map<string, Message>, exampleShapeHints: ExampleShapeHints): void;
14
- export declare function processWhen(when: {
15
- commandRef?: string;
16
- eventRef?: string;
17
- stateRef?: string;
18
- exampleData?: unknown;
19
- } | Array<{
20
- commandRef?: string;
21
- eventRef?: string;
22
- stateRef?: string;
23
- exampleData?: unknown;
24
- }>, slice: {
25
- type: string;
26
- }, resolveTypeAndInfo: TypeResolver, messages: Map<string, Message>, exampleShapeHints: ExampleShapeHints): void;
27
- export declare function processThen(then: Array<{
28
- eventRef?: string;
29
- commandRef?: string;
30
- stateRef?: string;
31
- exampleData?: unknown;
32
- }>, resolveTypeAndInfo: TypeResolver, messages: Map<string, Message>, exampleShapeHints: ExampleShapeHints): void;
33
- export {};
34
- //# sourceMappingURL=spec-processors.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spec-processors.d.ts","sourceRoot":"","sources":["../../../../src/transformers/flow-to-model/spec-processors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC,OAAO,EAAE,iBAAiB,EAA8B,MAAM,kBAAkB,CAAC;AAKjF,KAAK,YAAY,GAAG,CAClB,CAAC,EAAE,MAAM,EACT,QAAQ,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,OAAO,EACxC,WAAW,CAAC,EAAE,OAAO,KAClB;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAA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