@auto-engineer/narrative 0.21.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +23 -0
- package/dist/src/id/addAutoIds.d.ts.map +1 -1
- package/dist/src/id/addAutoIds.js +16 -11
- package/dist/src/id/addAutoIds.js.map +1 -1
- package/dist/src/id/hasAllIds.d.ts.map +1 -1
- package/dist/src/id/hasAllIds.js +8 -2
- package/dist/src/id/hasAllIds.js.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/narrative-context.d.ts +2 -2
- package/dist/src/narrative-context.d.ts.map +1 -1
- package/dist/src/narrative-context.js +18 -15
- package/dist/src/narrative-context.js.map +1 -1
- package/dist/src/narrative.d.ts +2 -2
- package/dist/src/narrative.d.ts.map +1 -1
- package/dist/src/narrative.js +6 -3
- package/dist/src/narrative.js.map +1 -1
- package/dist/src/samples/seasonal-assistant.schema.json +73 -65
- package/dist/src/schema.d.ts +13937 -7286
- package/dist/src/schema.d.ts.map +1 -1
- package/dist/src/schema.js +9 -6
- package/dist/src/schema.js.map +1 -1
- package/dist/src/transformers/model-to-narrative/generators/flow.d.ts.map +1 -1
- package/dist/src/transformers/model-to-narrative/generators/flow.js +10 -4
- package/dist/src/transformers/model-to-narrative/generators/flow.js.map +1 -1
- package/dist/src/transformers/narrative-to-model/index.d.ts.map +1 -1
- package/dist/src/transformers/narrative-to-model/index.js +6 -3
- package/dist/src/transformers/narrative-to-model/index.js.map +1 -1
- package/dist/src/types.d.ts +4 -0
- package/dist/src/types.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/src/getNarratives.specs.ts +30 -30
- package/src/id/addAutoIds.specs.ts +79 -61
- package/src/id/addAutoIds.ts +17 -11
- package/src/id/hasAllIds.specs.ts +100 -54
- package/src/id/hasAllIds.ts +8 -2
- package/src/index.ts +2 -1
- package/src/model-to-narrative.specs.ts +206 -158
- package/src/narrative-context.ts +22 -16
- package/src/narrative.ts +8 -4
- package/src/samples/seasonal-assistant.schema.json +73 -65
- package/src/schema.ts +10 -6
- package/src/transformers/model-to-narrative/generators/flow.ts +14 -5
- package/src/transformers/narrative-to-model/index.ts +6 -3
- package/src/types.ts +5 -0
- package/.turbo/turbo-format.log +0 -4
- package/.turbo/turbo-lint.log +0 -4
- package/.turbo/turbo-test.log +0 -14
- package/.turbo/turbo-type-check.log +0 -5
- package/dist/src/commands/export-schema-runner.d.ts +0 -3
- package/dist/src/commands/export-schema-runner.d.ts.map +0 -1
- package/dist/src/commands/export-schema-runner.js +0 -53
- package/dist/src/commands/export-schema-runner.js.map +0 -1
- package/dist/src/fluent-builder.specs.d.ts +0 -2
- package/dist/src/fluent-builder.specs.d.ts.map +0 -1
- package/dist/src/fluent-builder.specs.js +0 -28
- package/dist/src/fluent-builder.specs.js.map +0 -1
- package/dist/src/getNarratives.cache.specs.d.ts +0 -2
- package/dist/src/getNarratives.cache.specs.d.ts.map +0 -1
- package/dist/src/getNarratives.cache.specs.js +0 -234
- package/dist/src/getNarratives.cache.specs.js.map +0 -1
- package/dist/src/getNarratives.specs.d.ts +0 -2
- package/dist/src/getNarratives.specs.d.ts.map +0 -1
- package/dist/src/getNarratives.specs.js +0 -1294
- package/dist/src/getNarratives.specs.js.map +0 -1
- package/dist/src/id/addAutoIds.specs.d.ts +0 -2
- package/dist/src/id/addAutoIds.specs.d.ts.map +0 -1
- package/dist/src/id/addAutoIds.specs.js +0 -265
- package/dist/src/id/addAutoIds.specs.js.map +0 -1
- package/dist/src/id/hasAllIds.specs.d.ts +0 -2
- package/dist/src/id/hasAllIds.specs.d.ts.map +0 -1
- package/dist/src/id/hasAllIds.specs.js +0 -231
- package/dist/src/id/hasAllIds.specs.js.map +0 -1
- package/dist/src/model-to-narrative.specs.d.ts +0 -2
- package/dist/src/model-to-narrative.specs.d.ts.map +0 -1
- package/dist/src/model-to-narrative.specs.js +0 -2378
- package/dist/src/model-to-narrative.specs.js.map +0 -1
- package/dist/src/narrative-context.specs.d.ts +0 -2
- package/dist/src/narrative-context.specs.d.ts.map +0 -1
- package/dist/src/narrative-context.specs.js +0 -185
- package/dist/src/narrative-context.specs.js.map +0 -1
- package/dist/src/transformers/narrative-to-model/type-inference.specs.d.ts +0 -2
- package/dist/src/transformers/narrative-to-model/type-inference.specs.d.ts.map +0 -1
- package/dist/src/transformers/narrative-to-model/type-inference.specs.js +0 -167
- package/dist/src/transformers/narrative-to-model/type-inference.specs.js.map +0 -1
package/src/narrative.ts
CHANGED
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
startServerBlock,
|
|
19
19
|
} from './narrative-context';
|
|
20
20
|
import { registry } from './narrative-registry';
|
|
21
|
-
import type { DataItem } from './types';
|
|
21
|
+
import type { Data, DataItem } from './types';
|
|
22
22
|
|
|
23
23
|
const debug = createDebug('auto:narrative:narrative');
|
|
24
24
|
if ('color' in debug && typeof debug === 'object') {
|
|
@@ -214,20 +214,24 @@ export interface SliceTypeValueInterface {
|
|
|
214
214
|
readonly value: 'command' | 'query' | 'react';
|
|
215
215
|
}
|
|
216
216
|
|
|
217
|
-
export function data(
|
|
217
|
+
export function data(config: Data | DataItem[]): void {
|
|
218
218
|
const slice = getCurrentSlice();
|
|
219
219
|
if (!slice) throw new Error('No active slice for data configuration');
|
|
220
220
|
|
|
221
|
+
// Normalize to Data structure - cast needed since DataItem includes __type discriminator
|
|
222
|
+
// which gets stripped by setSliceData
|
|
223
|
+
const dataConfig: Data = Array.isArray(config) ? { items: config as unknown as Data['items'] } : config;
|
|
224
|
+
|
|
221
225
|
const sliceType = slice.type;
|
|
222
226
|
|
|
223
227
|
if (sliceType === SliceType.QUERY) {
|
|
224
|
-
const hasSink = items.some((item) => '__type' in item && item.__type === 'sink');
|
|
228
|
+
const hasSink = dataConfig.items.some((item) => '__type' in item && item.__type === 'sink');
|
|
225
229
|
if (hasSink) {
|
|
226
230
|
throw new Error('Query slices cannot have data sinks, only sources');
|
|
227
231
|
}
|
|
228
232
|
}
|
|
229
233
|
|
|
230
|
-
setSliceData(
|
|
234
|
+
setSliceData(dataConfig);
|
|
231
235
|
}
|
|
232
236
|
|
|
233
237
|
export { narrative as flow };
|
|
@@ -26,18 +26,20 @@
|
|
|
26
26
|
"request": "mutation EnterShoppingCriteria($input: EnterShoppingCriteriaInput!) {\n enterShoppingCriteria(input: $input) {\n success\n error {\n type\n message\n }\n }\n}",
|
|
27
27
|
"server": {
|
|
28
28
|
"description": "",
|
|
29
|
-
"data":
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
|
|
29
|
+
"data": {
|
|
30
|
+
"items": [
|
|
31
|
+
{
|
|
32
|
+
"target": {
|
|
33
|
+
"type": "Event",
|
|
34
|
+
"name": "ShoppingCriteriaEntered"
|
|
35
|
+
},
|
|
36
|
+
"destination": {
|
|
37
|
+
"type": "stream",
|
|
38
|
+
"pattern": "shopping-session-${sessionId}"
|
|
39
|
+
}
|
|
38
40
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
]
|
|
42
|
+
},
|
|
41
43
|
"specs": {
|
|
42
44
|
"name": "When shopper submits criteria, a shopping session is started",
|
|
43
45
|
"rules": [
|
|
@@ -114,43 +116,45 @@
|
|
|
114
116
|
},
|
|
115
117
|
"server": {
|
|
116
118
|
"description": "",
|
|
117
|
-
"data":
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
"type": "Command",
|
|
121
|
-
"name": "SuggestShoppingItems"
|
|
122
|
-
},
|
|
123
|
-
"destination": {
|
|
124
|
-
"type": "integration",
|
|
125
|
-
"systems": ["AI"],
|
|
126
|
-
"message": {
|
|
127
|
-
"name": "DoChat",
|
|
128
|
-
"type": "command"
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
"_additionalInstructions": "add the following to the DoChat: schemaName: Products, systemPrompt: use the PRODUCT_CATALOGUE_PRODUCTS MCP tool to get product data",
|
|
132
|
-
"_withState": {
|
|
119
|
+
"data": {
|
|
120
|
+
"items": [
|
|
121
|
+
{
|
|
133
122
|
"target": {
|
|
134
|
-
"type": "
|
|
135
|
-
"name": "
|
|
123
|
+
"type": "Command",
|
|
124
|
+
"name": "SuggestShoppingItems"
|
|
136
125
|
},
|
|
137
|
-
"
|
|
126
|
+
"destination": {
|
|
138
127
|
"type": "integration",
|
|
139
|
-
"systems": ["
|
|
128
|
+
"systems": ["AI"],
|
|
129
|
+
"message": {
|
|
130
|
+
"name": "DoChat",
|
|
131
|
+
"type": "command"
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
"_additionalInstructions": "add the following to the DoChat: schemaName: Products, systemPrompt: use the PRODUCT_CATALOGUE_PRODUCTS MCP tool to get product data",
|
|
135
|
+
"_withState": {
|
|
136
|
+
"target": {
|
|
137
|
+
"type": "State",
|
|
138
|
+
"name": "Products"
|
|
139
|
+
},
|
|
140
|
+
"origin": {
|
|
141
|
+
"type": "integration",
|
|
142
|
+
"systems": ["ProductCatalog"]
|
|
143
|
+
}
|
|
140
144
|
}
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
"target": {
|
|
145
|
-
"type": "Event",
|
|
146
|
-
"name": "ShoppingItemsSuggested"
|
|
147
145
|
},
|
|
148
|
-
|
|
149
|
-
"
|
|
150
|
-
|
|
146
|
+
{
|
|
147
|
+
"target": {
|
|
148
|
+
"type": "Event",
|
|
149
|
+
"name": "ShoppingItemsSuggested"
|
|
150
|
+
},
|
|
151
|
+
"destination": {
|
|
152
|
+
"type": "stream",
|
|
153
|
+
"pattern": "shopping-session-${sessionId}"
|
|
154
|
+
}
|
|
151
155
|
}
|
|
152
|
-
|
|
153
|
-
|
|
156
|
+
]
|
|
157
|
+
},
|
|
154
158
|
"specs": {
|
|
155
159
|
"name": "When chat is triggered, AI suggests items based on product catalog",
|
|
156
160
|
"rules": [
|
|
@@ -268,19 +272,21 @@
|
|
|
268
272
|
"request": "query GetSuggestedItems($sessionId: ID!) {\n suggestedItems(sessionId: $sessionId) {\n items {\n productId\n name\n quantity\n reason\n }\n }\n}",
|
|
269
273
|
"server": {
|
|
270
274
|
"description": "",
|
|
271
|
-
"data":
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
"
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
"
|
|
279
|
-
|
|
280
|
-
|
|
275
|
+
"data": {
|
|
276
|
+
"items": [
|
|
277
|
+
{
|
|
278
|
+
"target": {
|
|
279
|
+
"type": "State",
|
|
280
|
+
"name": "SuggestedItems"
|
|
281
|
+
},
|
|
282
|
+
"origin": {
|
|
283
|
+
"type": "projection",
|
|
284
|
+
"name": "SuggestedItemsProjection",
|
|
285
|
+
"idField": "sessionId"
|
|
286
|
+
}
|
|
281
287
|
}
|
|
282
|
-
|
|
283
|
-
|
|
288
|
+
]
|
|
289
|
+
},
|
|
284
290
|
"specs": {
|
|
285
291
|
"name": "Suggested items are available for viewing",
|
|
286
292
|
"rules": [
|
|
@@ -380,18 +386,20 @@
|
|
|
380
386
|
},
|
|
381
387
|
"server": {
|
|
382
388
|
"description": "",
|
|
383
|
-
"data":
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
"
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
"
|
|
391
|
-
|
|
389
|
+
"data": {
|
|
390
|
+
"items": [
|
|
391
|
+
{
|
|
392
|
+
"target": {
|
|
393
|
+
"type": "Event",
|
|
394
|
+
"name": "ItemsAddedToCart"
|
|
395
|
+
},
|
|
396
|
+
"destination": {
|
|
397
|
+
"type": "stream",
|
|
398
|
+
"pattern": "shopping-session-${sessionId}"
|
|
399
|
+
}
|
|
392
400
|
}
|
|
393
|
-
|
|
394
|
-
|
|
401
|
+
]
|
|
402
|
+
},
|
|
395
403
|
"specs": {
|
|
396
404
|
"name": "When shopper accepts items, they are added to cart",
|
|
397
405
|
"rules": [
|
package/src/schema.ts
CHANGED
|
@@ -134,6 +134,13 @@ const DataSourceSchema = z
|
|
|
134
134
|
})
|
|
135
135
|
.describe('Data source configuration for inbound data flow');
|
|
136
136
|
|
|
137
|
+
export const DataSchema = z
|
|
138
|
+
.object({
|
|
139
|
+
id: z.string().optional().describe('Optional unique identifier for the data configuration'),
|
|
140
|
+
items: z.array(z.union([DataSinkSchema, DataSourceSchema])).describe('Array of data sinks and sources'),
|
|
141
|
+
})
|
|
142
|
+
.describe('Data configuration containing sinks and sources');
|
|
143
|
+
|
|
137
144
|
const MessageFieldSchema = z
|
|
138
145
|
.object({
|
|
139
146
|
name: z.string(),
|
|
@@ -262,7 +269,7 @@ const CommandSliceSchema = BaseSliceSchema.extend({
|
|
|
262
269
|
request: z.string().describe('Command request (GraphQL, REST endpoint, or other query format)').optional(),
|
|
263
270
|
server: z.object({
|
|
264
271
|
description: z.string(),
|
|
265
|
-
data:
|
|
272
|
+
data: DataSchema.optional().describe('Data configuration for command slices'),
|
|
266
273
|
specs: z.array(SpecSchema).describe('Server-side specifications with rules and examples'),
|
|
267
274
|
}),
|
|
268
275
|
}).describe('Command slice handling user actions and business logic');
|
|
@@ -275,7 +282,7 @@ const QuerySliceSchema = BaseSliceSchema.extend({
|
|
|
275
282
|
request: z.string().describe('Query request (GraphQL, REST endpoint, or other query format)').optional(),
|
|
276
283
|
server: z.object({
|
|
277
284
|
description: z.string(),
|
|
278
|
-
data:
|
|
285
|
+
data: DataSchema.optional().describe('Data configuration for query slices'),
|
|
279
286
|
specs: z.array(SpecSchema).describe('Server-side specifications with rules and examples'),
|
|
280
287
|
}),
|
|
281
288
|
}).describe('Query slice for reading data and maintaining projections');
|
|
@@ -284,10 +291,7 @@ const ReactSliceSchema = BaseSliceSchema.extend({
|
|
|
284
291
|
type: z.literal('react'),
|
|
285
292
|
server: z.object({
|
|
286
293
|
description: z.string().optional(),
|
|
287
|
-
data:
|
|
288
|
-
.array(z.union([DataSinkSchema, DataSourceSchema]))
|
|
289
|
-
.optional()
|
|
290
|
-
.describe('Data items for react slices (mix of sinks and sources)'),
|
|
294
|
+
data: DataSchema.optional().describe('Data configuration for react slices'),
|
|
291
295
|
specs: z.array(SpecSchema).describe('Server-side specifications with rules and examples'),
|
|
292
296
|
}),
|
|
293
297
|
}).describe('React slice for automated responses to events');
|
|
@@ -368,12 +368,21 @@ function buildSingleDataItem(
|
|
|
368
368
|
function buildDataItems(
|
|
369
369
|
ts: typeof import('typescript'),
|
|
370
370
|
f: tsNS.NodeFactory,
|
|
371
|
-
items: Array<DataSinkItem | DataSourceItem
|
|
371
|
+
data: { id?: string; items: Array<DataSinkItem | DataSourceItem> },
|
|
372
372
|
) {
|
|
373
|
-
const calls = items.map((it) => buildSingleDataItem(ts, f, it));
|
|
373
|
+
const calls = data.items.map((it) => buildSingleDataItem(ts, f, it));
|
|
374
|
+
|
|
375
|
+
// Build the data object: { id?: string, items: [...] }
|
|
376
|
+
const properties: tsNS.ObjectLiteralElementLike[] = [];
|
|
377
|
+
|
|
378
|
+
if (data.id != null && data.id !== '') {
|
|
379
|
+
properties.push(f.createPropertyAssignment('id', f.createStringLiteral(data.id)));
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
properties.push(f.createPropertyAssignment('items', f.createArrayLiteralExpression(calls, false)));
|
|
374
383
|
|
|
375
384
|
return f.createExpressionStatement(
|
|
376
|
-
f.createCallExpression(f.createIdentifier('data'), undefined, [f.
|
|
385
|
+
f.createCallExpression(f.createIdentifier('data'), undefined, [f.createObjectLiteralExpression(properties, false)]),
|
|
377
386
|
);
|
|
378
387
|
}
|
|
379
388
|
|
|
@@ -668,8 +677,8 @@ function buildServerStatements(
|
|
|
668
677
|
): tsNS.Statement[] {
|
|
669
678
|
const statements: tsNS.Statement[] = [];
|
|
670
679
|
|
|
671
|
-
if (server.data
|
|
672
|
-
statements.push(buildDataItems(ts, f, server.data as Array<DataSinkItem | DataSourceItem>));
|
|
680
|
+
if (server.data?.items && server.data.items.length > 0) {
|
|
681
|
+
statements.push(buildDataItems(ts, f, server.data as { id?: string; items: Array<DataSinkItem | DataSourceItem> }));
|
|
673
682
|
}
|
|
674
683
|
|
|
675
684
|
if (server.specs !== null && server.specs !== undefined) {
|
|
@@ -240,9 +240,12 @@ function processSliceIntegrations(
|
|
|
240
240
|
): void {
|
|
241
241
|
// Integrations: from data & via
|
|
242
242
|
if ('server' in slice && slice.server != null && 'data' in slice.server && slice.server.data !== undefined) {
|
|
243
|
-
slice.server.data.
|
|
244
|
-
|
|
245
|
-
|
|
243
|
+
const dataItems = slice.server.data.items;
|
|
244
|
+
if (Array.isArray(dataItems)) {
|
|
245
|
+
dataItems.forEach((d: unknown) => {
|
|
246
|
+
processDataItemIntegrations(d, integrations, messages);
|
|
247
|
+
});
|
|
248
|
+
}
|
|
246
249
|
}
|
|
247
250
|
if ('via' in slice && slice.via) {
|
|
248
251
|
slice.via.forEach((integrationName: string) => {
|
package/src/types.ts
CHANGED
|
@@ -159,6 +159,11 @@ export interface DataItem {
|
|
|
159
159
|
__type: 'sink' | 'source';
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
+
export interface Data {
|
|
163
|
+
id?: string;
|
|
164
|
+
items: (DataSink | DataSource)[];
|
|
165
|
+
}
|
|
166
|
+
|
|
162
167
|
export type DefaultRecord = Record<string, unknown>;
|
|
163
168
|
|
|
164
169
|
export type State<
|
package/.turbo/turbo-format.log
DELETED
package/.turbo/turbo-lint.log
DELETED
package/.turbo/turbo-test.log
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
> @auto-engineer/narrative@0.21.0 test /Users/sam/code/auto/2/auto-engineer-2/packages/narrative
|
|
3
|
-
> vitest run --reporter=dot
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
RUN v3.2.4 /Users/sam/code/auto/2/auto-engineer-2/packages/narrative
|
|
7
|
-
|
|
8
|
-
············································································································································································································
|
|
9
|
-
|
|
10
|
-
Test Files 14 passed (14)
|
|
11
|
-
Tests 204 passed (204)
|
|
12
|
-
Start at 18:49:24
|
|
13
|
-
Duration 3.39s (transform 4.21s, setup 0ms, collect 11.92s, tests 2.33s, environment 1ms, prepare 3.08s)
|
|
14
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"export-schema-runner.d.ts","sourceRoot":"","sources":["../../../src/commands/export-schema-runner.ts"],"names":[],"mappings":""}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// This runner is executed in the target directory context to avoid module resolution issues
|
|
3
|
-
import { resolve } from 'path';
|
|
4
|
-
import { writeFileSync, mkdirSync } from 'fs';
|
|
5
|
-
import createDebug from 'debug';
|
|
6
|
-
import { NodeFileStore } from '@auto-engineer/file-store';
|
|
7
|
-
const debug = createDebug('auto:narrative:export-schema-runner');
|
|
8
|
-
if ('color' in debug && typeof debug === 'object') {
|
|
9
|
-
debug.color = '4';
|
|
10
|
-
} // blue
|
|
11
|
-
const main = async () => {
|
|
12
|
-
const contextDir = process.argv[2] || './.context';
|
|
13
|
-
const narrativesDir = process.argv[3] || './narratives';
|
|
14
|
-
debug('Starting export-schema-runner');
|
|
15
|
-
debug(' Context dir: %s', contextDir);
|
|
16
|
-
debug(' Flows dir: %s', narrativesDir);
|
|
17
|
-
try {
|
|
18
|
-
// Import from the installed package in the target directory
|
|
19
|
-
// This ensures we use the same module instance as the flow files
|
|
20
|
-
const narrative = await import('@auto-engineer/narrative');
|
|
21
|
-
const { getNarratives } = narrative;
|
|
22
|
-
if (typeof getNarratives !== 'function') {
|
|
23
|
-
throw new Error('getNarratives not found in @auto-engineer/narrative exports');
|
|
24
|
-
}
|
|
25
|
-
const narrativesPath = resolve(process.cwd(), narrativesDir);
|
|
26
|
-
debug('Resolved narratives path: %s', narrativesPath);
|
|
27
|
-
const result = await getNarratives({ vfs: new NodeFileStore(), root: narrativesPath });
|
|
28
|
-
const schema = result.toModel();
|
|
29
|
-
debug('Schema generated with %d narratives, %d messages, %d integrations', schema.narratives.length, schema.messages.length, schema.integrations?.length ?? 0);
|
|
30
|
-
const json = JSON.stringify(schema, null, 2);
|
|
31
|
-
const resolvedContextDir = resolve(process.cwd(), contextDir);
|
|
32
|
-
const outPath = resolve(resolvedContextDir, 'schema.json');
|
|
33
|
-
mkdirSync(resolvedContextDir, { recursive: true });
|
|
34
|
-
writeFileSync(outPath, json);
|
|
35
|
-
debug('Schema written to: %s', outPath);
|
|
36
|
-
// Output success as JSON for parent process
|
|
37
|
-
console.log(JSON.stringify({
|
|
38
|
-
success: true,
|
|
39
|
-
outputPath: outPath,
|
|
40
|
-
}));
|
|
41
|
-
}
|
|
42
|
-
catch (error) {
|
|
43
|
-
debug('Error occurred: %o', error);
|
|
44
|
-
// Output error as JSON for parent process
|
|
45
|
-
console.log(JSON.stringify({
|
|
46
|
-
success: false,
|
|
47
|
-
error: error instanceof Error ? error.message : 'Unknown error occurred',
|
|
48
|
-
}));
|
|
49
|
-
process.exit(1);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
void main();
|
|
53
|
-
//# sourceMappingURL=export-schema-runner.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"export-schema-runner.js","sourceRoot":"","sources":["../../../src/commands/export-schema-runner.ts"],"names":[],"mappings":";AACA,4FAA4F;AAC5F,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,WAAW,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,MAAM,KAAK,GAAG,WAAW,CAAC,qCAAqC,CAAC,CAAC;AACjE,IAAI,OAAO,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;IACjD,KAA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,MAAM,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,CAAC,CAAC;QAC9D,MAAM,OAAO,GAAG,OAAO,CAAC,kBAAkB,EAAE,aAAa,CAAC,CAAC;QAE3D,SAAS,CAAC,kBAAkB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACnD,aAAa,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC7B,KAAK,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;QAExC,4CAA4C;QAC5C,OAAO,CAAC,GAAG,CACT,IAAI,CAAC,SAAS,CAAC;YACb,OAAO,EAAE,IAAI;YACb,UAAU,EAAE,OAAO;SACpB,CAAC,CACH,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;QAEnC,0CAA0C;QAC1C,OAAO,CAAC,GAAG,CACT,IAAI,CAAC,SAAS,CAAC;YACb,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB;SACzE,CAAC,CACH,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC;AAEF,KAAK,IAAI,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fluent-builder.specs.d.ts","sourceRoot":"","sources":["../../src/fluent-builder.specs.ts"],"names":[],"mappings":""}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
2
|
-
import { command, react } from './fluent-builder.js';
|
|
3
|
-
import { createIntegration } from './types.js';
|
|
4
|
-
import { startNarrative, clearCurrentNarrative } from './narrative-context.js';
|
|
5
|
-
// Test integrations
|
|
6
|
-
const MailChimp = createIntegration('mailchimp', 'MailChimp');
|
|
7
|
-
const Twilio = createIntegration('twilio', 'Twilio');
|
|
8
|
-
describe('via method', () => {
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
startNarrative('test-flow');
|
|
11
|
-
});
|
|
12
|
-
afterEach(() => {
|
|
13
|
-
clearCurrentNarrative();
|
|
14
|
-
});
|
|
15
|
-
it('should accept a single integration', () => {
|
|
16
|
-
const slice = command('test').via(MailChimp);
|
|
17
|
-
expect(slice).toBeDefined();
|
|
18
|
-
});
|
|
19
|
-
it('should accept multiple integrations as array', () => {
|
|
20
|
-
const slice = command('test').via([MailChimp, Twilio]);
|
|
21
|
-
expect(slice).toBeDefined();
|
|
22
|
-
});
|
|
23
|
-
it('should work with react', () => {
|
|
24
|
-
const slice = react('test').via([MailChimp, Twilio]);
|
|
25
|
-
expect(slice).toBeDefined();
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
//# sourceMappingURL=fluent-builder.specs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fluent-builder.specs.js","sourceRoot":"","sources":["../../src/fluent-builder.specs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE5E,oBAAoB;AACpB,MAAM,SAAS,GAAG,iBAAiB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAC9D,MAAM,MAAM,GAAG,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAErD,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;IAC1B,UAAU,CAAC,GAAG,EAAE;QACd,cAAc,CAA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