@auto-engineer/narrative 0.13.0 → 0.13.1
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 +11 -0
- package/dist/src/commands/export-schema-runner.js +1 -1
- package/dist/src/commands/export-schema-runner.js.map +1 -1
- package/dist/src/fluent-builder.js +3 -3
- package/dist/src/fluent-builder.js.map +1 -1
- package/dist/src/getNarratives.specs.js +149 -153
- package/dist/src/getNarratives.specs.js.map +1 -1
- package/dist/src/id/addAutoIds.d.ts.map +1 -1
- package/dist/src/id/addAutoIds.js +23 -10
- package/dist/src/id/addAutoIds.js.map +1 -1
- package/dist/src/id/addAutoIds.specs.js +54 -45
- package/dist/src/id/addAutoIds.specs.js.map +1 -1
- package/dist/src/id/hasAllIds.d.ts.map +1 -1
- package/dist/src/id/hasAllIds.js +8 -3
- package/dist/src/id/hasAllIds.js.map +1 -1
- package/dist/src/id/hasAllIds.specs.js +142 -215
- package/dist/src/id/hasAllIds.specs.js.map +1 -1
- package/dist/src/index.d.ts +6 -8
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/loader/graph.d.ts.map +1 -1
- package/dist/src/loader/graph.js +13 -6
- package/dist/src/loader/graph.js.map +1 -1
- package/dist/src/loader/ts-utils.d.ts +1 -0
- package/dist/src/loader/ts-utils.d.ts.map +1 -1
- package/dist/src/loader/ts-utils.js +95 -16
- package/dist/src/loader/ts-utils.js.map +1 -1
- package/dist/src/model-to-narrative.specs.js +531 -449
- package/dist/src/model-to-narrative.specs.js.map +1 -1
- package/dist/src/narrative-context.d.ts +8 -8
- package/dist/src/narrative-context.d.ts.map +1 -1
- package/dist/src/narrative-context.js +111 -301
- package/dist/src/narrative-context.js.map +1 -1
- package/dist/src/narrative-context.specs.js +15 -55
- package/dist/src/narrative-context.specs.js.map +1 -1
- package/dist/src/narrative.d.ts +19 -22
- package/dist/src/narrative.d.ts.map +1 -1
- package/dist/src/narrative.js +42 -71
- package/dist/src/narrative.js.map +1 -1
- package/dist/src/samples/test-with-ids.narrative.js +13 -29
- package/dist/src/samples/test-with-ids.narrative.js.map +1 -1
- package/dist/src/schema.d.ts +2704 -8293
- package/dist/src/schema.d.ts.map +1 -1
- package/dist/src/schema.js +26 -47
- package/dist/src/schema.js.map +1 -1
- package/dist/src/slice-builder.js +3 -3
- package/dist/src/slice-builder.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 +118 -74
- package/dist/src/transformers/model-to-narrative/generators/flow.js.map +1 -1
- package/dist/src/transformers/model-to-narrative/generators/gwt.d.ts +9 -1
- package/dist/src/transformers/model-to-narrative/generators/gwt.d.ts.map +1 -1
- package/dist/src/transformers/model-to-narrative/generators/gwt.js +112 -112
- package/dist/src/transformers/model-to-narrative/generators/gwt.js.map +1 -1
- package/dist/src/transformers/model-to-narrative/generators/imports.d.ts +1 -1
- package/dist/src/transformers/model-to-narrative/generators/imports.d.ts.map +1 -1
- package/dist/src/transformers/model-to-narrative/generators/imports.js +13 -9
- package/dist/src/transformers/model-to-narrative/generators/imports.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 +50 -23
- package/dist/src/transformers/narrative-to-model/index.js.map +1 -1
- package/dist/src/transformers/narrative-to-model/type-inference.specs.js +100 -90
- package/dist/src/transformers/narrative-to-model/type-inference.specs.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/commands/export-schema-runner.ts +3 -1
- package/src/fluent-builder.ts +3 -3
- package/src/getNarratives.specs.ts +168 -176
- package/src/id/addAutoIds.specs.ts +54 -47
- package/src/id/addAutoIds.ts +28 -11
- package/src/id/hasAllIds.specs.ts +147 -245
- package/src/id/hasAllIds.ts +11 -4
- package/src/index.ts +9 -12
- package/src/loader/graph.ts +23 -6
- package/src/loader/ts-utils.ts +169 -26
- package/src/model-to-narrative.specs.ts +531 -449
- package/src/narrative-context.specs.ts +73 -116
- package/src/narrative-context.ts +127 -374
- package/src/narrative.ts +70 -120
- package/src/samples/test-with-ids.narrative.ts +23 -31
- package/src/schema.ts +33 -52
- package/src/slice-builder.ts +3 -3
- package/src/transformers/model-to-narrative/generators/flow.ts +191 -85
- package/src/transformers/model-to-narrative/generators/gwt.ts +195 -178
- package/src/transformers/model-to-narrative/generators/imports.ts +13 -9
- package/src/transformers/narrative-to-model/index.ts +87 -26
- package/src/transformers/narrative-to-model/type-inference.specs.ts +100 -90
|
@@ -1,231 +1,158 @@
|
|
|
1
|
-
import { describe, expect, it
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
2
|
import { hasAllIds, addAutoIds } from './index.js';
|
|
3
|
-
import { getNarratives } from '../getNarratives.js';
|
|
4
|
-
import { InMemoryFileStore } from '@auto-engineer/file-store';
|
|
5
|
-
import * as flowApi from '../narrative.js';
|
|
6
|
-
import * as fluent from '../fluent-builder.js';
|
|
7
|
-
import * as dataBuilders from '../data-narrative-builders.js';
|
|
8
|
-
import * as typesApi from '../types.js';
|
|
9
|
-
import gql from 'graphql-tag';
|
|
10
|
-
const importMap = {
|
|
11
|
-
'../flow': flowApi,
|
|
12
|
-
'../fluent-builder': fluent,
|
|
13
|
-
'../data-flow-builders': dataBuilders,
|
|
14
|
-
'../types': typesApi,
|
|
15
|
-
'graphql-tag': gql,
|
|
16
|
-
};
|
|
17
3
|
describe('hasAllIds', () => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
})
|
|
135
|
-
|
|
136
|
-
const
|
|
137
|
-
const flowContent3 = new TextEncoder().encode(multipleFlowsSameSource);
|
|
138
|
-
const flowContent4 = new TextEncoder().encode(multipleFlowsIncomplete);
|
|
139
|
-
const flowContent5 = new TextEncoder().encode(multipleFlowsSliceMissing);
|
|
140
|
-
await vfs.write('/test/flow-without-ids.narrative.ts', flowContent1);
|
|
141
|
-
await vfs.write('/test/flow-with-ids.narrative.ts', flowContent2);
|
|
142
|
-
await vfs.write('/test/homepage.narrative.ts', flowContent3);
|
|
143
|
-
await vfs.write('/test/homepage-incomplete.narrative.ts', flowContent4);
|
|
144
|
-
await vfs.write('/test/homepage-slice-missing.narrative.ts', flowContent5);
|
|
145
|
-
});
|
|
146
|
-
it('should return false for models without IDs', async () => {
|
|
147
|
-
const result = await getNarratives({ vfs, root, pattern: /\.(narrative)\.(ts)$/, fastFsScan: true, importMap });
|
|
148
|
-
const model = result.toModel();
|
|
149
|
-
const flowWithoutIds = model.narratives.find((f) => f.name === 'Test Flow Without IDs');
|
|
150
|
-
expect(flowWithoutIds).toBeDefined();
|
|
151
|
-
if (flowWithoutIds) {
|
|
152
|
-
const modelWithoutIds = { ...model, narratives: [flowWithoutIds] };
|
|
153
|
-
expect(hasAllIds(modelWithoutIds)).toBe(false);
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
it('should return true for models with complete IDs', async () => {
|
|
157
|
-
const result = await getNarratives({ vfs, root, pattern: /\.(narrative)\.(ts)$/, fastFsScan: true, importMap });
|
|
158
|
-
const model = result.toModel();
|
|
4
|
+
const createModelWithoutIds = () => ({
|
|
5
|
+
variant: 'specs',
|
|
6
|
+
narratives: [
|
|
7
|
+
{
|
|
8
|
+
name: 'Test Flow Without IDs',
|
|
9
|
+
slices: [
|
|
10
|
+
{
|
|
11
|
+
type: 'command',
|
|
12
|
+
name: 'Test slice without ID',
|
|
13
|
+
client: { specs: [] },
|
|
14
|
+
server: {
|
|
15
|
+
description: 'Test server',
|
|
16
|
+
specs: [
|
|
17
|
+
{
|
|
18
|
+
type: 'gherkin',
|
|
19
|
+
feature: 'Test specs',
|
|
20
|
+
rules: [
|
|
21
|
+
{
|
|
22
|
+
name: 'Test rule without ID',
|
|
23
|
+
examples: [],
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
messages: [],
|
|
34
|
+
integrations: [],
|
|
35
|
+
});
|
|
36
|
+
const createModelWithIds = () => ({
|
|
37
|
+
variant: 'specs',
|
|
38
|
+
narratives: [
|
|
39
|
+
{
|
|
40
|
+
name: 'Test Flow with IDs',
|
|
41
|
+
id: 'FLOW-001',
|
|
42
|
+
slices: [
|
|
43
|
+
{
|
|
44
|
+
type: 'command',
|
|
45
|
+
name: 'Test slice with ID',
|
|
46
|
+
id: 'SLICE-001',
|
|
47
|
+
client: { specs: [] },
|
|
48
|
+
server: {
|
|
49
|
+
description: 'Test server',
|
|
50
|
+
specs: [
|
|
51
|
+
{
|
|
52
|
+
type: 'gherkin',
|
|
53
|
+
feature: 'Test specs',
|
|
54
|
+
rules: [
|
|
55
|
+
{
|
|
56
|
+
id: 'RULE-001',
|
|
57
|
+
name: 'Test rule with ID',
|
|
58
|
+
examples: [],
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
messages: [],
|
|
69
|
+
integrations: [],
|
|
70
|
+
});
|
|
71
|
+
const createMultipleFlowsModel = (includeAllIds, includeAllSliceIds) => ({
|
|
72
|
+
variant: 'specs',
|
|
73
|
+
narratives: [
|
|
74
|
+
{
|
|
75
|
+
name: 'Home Screen',
|
|
76
|
+
id: 'aifPcU3hw',
|
|
77
|
+
sourceFile: '/path/to/homepage.narrative.ts',
|
|
78
|
+
slices: [
|
|
79
|
+
{
|
|
80
|
+
name: 'Active Surveys Summary',
|
|
81
|
+
id: 'slice1',
|
|
82
|
+
type: 'experience',
|
|
83
|
+
client: { specs: [{ type: 'it', title: 'show active surveys summary' }] },
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: 'Create Survey',
|
|
89
|
+
id: includeAllIds ? 'MPviTMrQC' : undefined,
|
|
90
|
+
sourceFile: '/path/to/homepage.narrative.ts',
|
|
91
|
+
slices: [
|
|
92
|
+
{
|
|
93
|
+
name: 'Create Survey Form',
|
|
94
|
+
id: includeAllSliceIds ? 'slice2' : undefined,
|
|
95
|
+
type: 'experience',
|
|
96
|
+
client: { specs: [{ type: 'it', title: 'allow entering survey title' }] },
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: 'Response Analytics',
|
|
102
|
+
id: 'eME978Euk',
|
|
103
|
+
sourceFile: '/path/to/homepage.narrative.ts',
|
|
104
|
+
slices: [
|
|
105
|
+
{
|
|
106
|
+
name: 'Response Rate Charts',
|
|
107
|
+
id: 'slice3',
|
|
108
|
+
type: 'experience',
|
|
109
|
+
client: { specs: [{ type: 'it', title: 'show daily response rate charts' }] },
|
|
110
|
+
},
|
|
111
|
+
],
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
messages: [],
|
|
115
|
+
integrations: [],
|
|
116
|
+
});
|
|
117
|
+
it('should return false for models without IDs', () => {
|
|
118
|
+
const model = createModelWithoutIds();
|
|
119
|
+
expect(hasAllIds(model)).toBe(false);
|
|
120
|
+
});
|
|
121
|
+
it('should return true for models with complete IDs', () => {
|
|
122
|
+
const model = createModelWithoutIds();
|
|
159
123
|
const modelWithIds = addAutoIds(model);
|
|
160
124
|
expect(hasAllIds(modelWithIds)).toBe(true);
|
|
161
125
|
});
|
|
162
|
-
it('should return true for flows that already have IDs',
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
const testFlowWithIds = model.narratives.find((f) => f.name === 'Test Flow with IDs');
|
|
166
|
-
expect(testFlowWithIds).toBeDefined();
|
|
167
|
-
if (testFlowWithIds) {
|
|
168
|
-
const modelWithExistingIds = { ...model, narratives: [testFlowWithIds] };
|
|
169
|
-
expect(hasAllIds(modelWithExistingIds)).toBe(true);
|
|
170
|
-
}
|
|
126
|
+
it('should return true for flows that already have IDs', () => {
|
|
127
|
+
const model = createModelWithIds();
|
|
128
|
+
expect(hasAllIds(model)).toBe(true);
|
|
171
129
|
});
|
|
172
|
-
it('should return false if any slice is missing an ID',
|
|
173
|
-
const
|
|
174
|
-
const
|
|
175
|
-
const modelWithIds = addAutoIds(model);
|
|
176
|
-
expect(modelWithIds.narratives.length).toBeGreaterThan(0);
|
|
177
|
-
expect(modelWithIds.narratives[0].slices.length).toBeGreaterThan(0);
|
|
178
|
-
const modifiedModel = structuredClone(modelWithIds);
|
|
130
|
+
it('should return false if any slice is missing an ID', () => {
|
|
131
|
+
const model = createModelWithIds();
|
|
132
|
+
const modifiedModel = structuredClone(model);
|
|
179
133
|
modifiedModel.narratives[0].slices[0].id = '';
|
|
180
134
|
expect(hasAllIds(modifiedModel)).toBe(false);
|
|
181
135
|
});
|
|
182
|
-
it('should return false if any rule is missing an ID',
|
|
183
|
-
const
|
|
184
|
-
const
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
for (const slice of flow.slices) {
|
|
189
|
-
if ('server' in slice && slice.server?.specs?.rules !== undefined && slice.server.specs.rules.length > 0) {
|
|
190
|
-
const modifiedModel = structuredClone(modelWithIds);
|
|
191
|
-
const modifiedFlow = modifiedModel.narratives.find((f) => f.name === flow.name);
|
|
192
|
-
const modifiedSlice = modifiedFlow?.slices.find((s) => s.name === slice.name);
|
|
193
|
-
if (modifiedSlice && 'server' in modifiedSlice && modifiedSlice.server?.specs?.rules !== undefined) {
|
|
194
|
-
modifiedSlice.server.specs.rules[0].id = '';
|
|
195
|
-
expect(hasAllIds(modifiedModel)).toBe(false);
|
|
196
|
-
found = true;
|
|
197
|
-
break;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
if (found)
|
|
202
|
-
break;
|
|
136
|
+
it('should return false if any rule is missing an ID', () => {
|
|
137
|
+
const model = createModelWithIds();
|
|
138
|
+
const modifiedModel = structuredClone(model);
|
|
139
|
+
const slice = modifiedModel.narratives[0].slices[0];
|
|
140
|
+
if ('server' in slice && slice.server?.specs !== undefined && Array.isArray(slice.server.specs)) {
|
|
141
|
+
slice.server.specs[0].rules[0].id = '';
|
|
203
142
|
}
|
|
204
|
-
expect(
|
|
143
|
+
expect(hasAllIds(modifiedModel)).toBe(false);
|
|
205
144
|
});
|
|
206
|
-
it('should return true when multiple flows with same sourceFile all have IDs',
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
const homepageFlows = model.narratives.filter((f) => f.sourceFile !== undefined && f.sourceFile.includes('homepage.narrative.ts'));
|
|
210
|
-
expect(homepageFlows.length).toBe(3);
|
|
211
|
-
const homepageModel = { ...model, narratives: homepageFlows };
|
|
212
|
-
expect(hasAllIds(homepageModel)).toBe(true);
|
|
145
|
+
it('should return true when multiple flows with same sourceFile all have IDs', () => {
|
|
146
|
+
const model = createMultipleFlowsModel(true, true);
|
|
147
|
+
expect(hasAllIds(model)).toBe(true);
|
|
213
148
|
});
|
|
214
|
-
it('should return false when any flow in multiple flows with same sourceFile is missing ID',
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
const homepageFlows = model.narratives.filter((f) => f.sourceFile !== undefined && f.sourceFile.includes('homepage-incomplete.narrative.ts'));
|
|
218
|
-
expect(homepageFlows.length).toBe(3);
|
|
219
|
-
const homepageModel = { ...model, narratives: homepageFlows };
|
|
220
|
-
expect(hasAllIds(homepageModel)).toBe(false);
|
|
149
|
+
it('should return false when any flow in multiple flows with same sourceFile is missing ID', () => {
|
|
150
|
+
const model = createMultipleFlowsModel(false, true);
|
|
151
|
+
expect(hasAllIds(model)).toBe(false);
|
|
221
152
|
});
|
|
222
|
-
it('should return false when any slice in multiple flows with same sourceFile is missing ID',
|
|
223
|
-
const
|
|
224
|
-
|
|
225
|
-
const homepageFlows = model.narratives.filter((f) => f.sourceFile !== undefined && f.sourceFile.includes('homepage-slice-missing.narrative.ts'));
|
|
226
|
-
expect(homepageFlows.length).toBe(3);
|
|
227
|
-
const homepageModel = { ...model, narratives: homepageFlows };
|
|
228
|
-
expect(hasAllIds(homepageModel)).toBe(false);
|
|
153
|
+
it('should return false when any slice in multiple flows with same sourceFile is missing ID', () => {
|
|
154
|
+
const model = createMultipleFlowsModel(true, false);
|
|
155
|
+
expect(hasAllIds(model)).toBe(false);
|
|
229
156
|
});
|
|
230
157
|
});
|
|
231
158
|
//# sourceMappingURL=hasAllIds.specs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasAllIds.specs.js","sourceRoot":"","sources":["../../../src/id/hasAllIds.specs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"hasAllIds.specs.js","sourceRoot":"","sources":["../../../src/id/hasAllIds.specs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGhD,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,MAAM,qBAAqB,GAAG,GAAU,EAAE,CAAC,CAAC;QAC1C,OAAO,EAAE,OAAO;QAChB,UAAU,EAAE;YACV;gBACE,IAAI,EAAE,uBAAuB;gBAC7B,MAAM,EAAE;oBACN;wBACE,IAAI,EAAE,SAAS;wBACf,IAAI,EAAE,uBAAuB;wBAC7B,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;wBACrB,MAAM,EAAE;4BACN,WAAW,EAAE,aAAa;4BAC1B,KAAK,EAAE;gCACL;oCACE,IAAI,EAAE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CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0EAA0E,EAAE,GAAG,EAAE;QAClF,MAAM,KAAK,GAAG,wBAAwB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACnD,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,wFAAwF,EAAE,GAAG,EAAE;QAChG,MAAM,KAAK,GAAG,wBAAwB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACpD,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yFAAyF,EAAE,GAAG,EAAE;QACjG,MAAM,KAAK,GAAG,wBAAwB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACpD,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -9,22 +9,19 @@ export { command, query, react, experience, decide, evolve } from './fluent-buil
|
|
|
9
9
|
export { sink, source } from './data-narrative-builders';
|
|
10
10
|
export type { FieldSelector } from './data-narrative-builders';
|
|
11
11
|
export { narrative, narrative as flow } from './narrative';
|
|
12
|
-
export { client, server, specs, describe, it, should, request, data, rule, example } from './narrative';
|
|
12
|
+
export { client, server, specs, describe, it, should, request, data, rule, example, thenError } from './narrative';
|
|
13
|
+
export type { ExampleBuilder, GivenBuilder, WhenBuilder, ThenBuilder } from './narrative';
|
|
13
14
|
export type { SliceTypeValueInterface } from './narrative';
|
|
14
15
|
export { SliceType } from './narrative';
|
|
15
16
|
export { getNarratives } from './getNarratives';
|
|
16
17
|
export { modelToNarrative } from './transformers/model-to-narrative';
|
|
17
18
|
export type { ExportSchemaEvents } from './commands/export-schema';
|
|
18
|
-
export { createNarrativeSpec, given, when } from './testing';
|
|
19
|
-
export { NarrativeNamesSchema as NarrativeNamesSystemSchema, SliceNamesSchema as SliceNamesSystemSchema, ClientServerNamesSchema as ClientServerNamesSystemSchema, modelSchema as SpecsSystemSchema, MessageFieldSchema, MessageSchema, CommandSchema, EventSchema, StateSchema, IntegrationSchema, CommandSliceSchema, QuerySliceSchema, ReactSliceSchema, ExperienceSliceSchema, SliceSchema, NarrativeSchema, modelSchema,
|
|
20
|
-
import {
|
|
19
|
+
export { createNarrativeSpec, given as testGiven, when as testWhen } from './testing';
|
|
20
|
+
export { NarrativeNamesSchema as NarrativeNamesSystemSchema, SliceNamesSchema as SliceNamesSystemSchema, ClientServerNamesSchema as ClientServerNamesSystemSchema, modelSchema as SpecsSystemSchema, MessageFieldSchema, MessageSchema, CommandSchema, EventSchema, StateSchema, IntegrationSchema, CommandSliceSchema, QuerySliceSchema, ReactSliceSchema, ExperienceSliceSchema, SliceSchema, NarrativeSchema, modelSchema, ExampleSchema, RuleSchema, SpecSchema, StepSchema, StepErrorSchema, StepWithDocStringSchema, StepWithErrorSchema, } from './schema';
|
|
21
|
+
import { NarrativeSchema, SliceSchema, modelSchema, QuerySliceSchema, ReactSliceSchema, ExperienceSliceSchema, MessageSchema, MessageFieldSchema, CommandSliceSchema, ExampleSchema, RuleSchema, SpecSchema, StepSchema } from './schema';
|
|
21
22
|
export type Model = z.infer<typeof modelSchema>;
|
|
22
23
|
export type Narrative = z.infer<typeof NarrativeSchema>;
|
|
23
|
-
export type CommandExample = z.infer<typeof CommandExampleSchema>;
|
|
24
|
-
export type EventExample = z.infer<typeof EventExampleSchema>;
|
|
25
24
|
export type Slice = z.infer<typeof SliceSchema>;
|
|
26
|
-
export type StateExample = z.infer<typeof StateExampleSchema>;
|
|
27
|
-
export type ErrorExample = z.infer<typeof ErrorExampleSchema>;
|
|
28
25
|
export type QuerySlice = z.infer<typeof QuerySliceSchema>;
|
|
29
26
|
export type ReactSlice = z.infer<typeof ReactSliceSchema>;
|
|
30
27
|
export type CommandSlice = z.infer<typeof CommandSliceSchema>;
|
|
@@ -34,6 +31,7 @@ export type Example = z.infer<typeof ExampleSchema>;
|
|
|
34
31
|
export type MessageField = z.infer<typeof MessageFieldSchema>;
|
|
35
32
|
export type Rule = z.infer<typeof RuleSchema>;
|
|
36
33
|
export type Spec = z.infer<typeof SpecSchema>;
|
|
34
|
+
export type Step = z.infer<typeof StepSchema>;
|
|
37
35
|
export type { ClientSpecNode } from './schema';
|
|
38
36
|
export { addAutoIds, hasAllIds } from './id';
|
|
39
37
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,YAAY,EACV,WAAW,EACX,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,aAAa,EACb,WAAW,EACX,MAAM,EACN,KAAK,EACL,OAAO,EACP,KAAK,GACN,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAGlC,eAAO,MAAM,GAAG,GAAI,SAAS,oBAAoB,EAAE,GAAG,QAAQ,OAAO,EAAE,WAKtE,CAAC;AAGF,YAAY,EACV,yBAAyB,EACzB,uBAAuB,EACvB,0BAA0B,EAC1B,4BAA4B,GAC7B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,E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package/dist/src/index.js
CHANGED
|
@@ -14,15 +14,15 @@ export { command, query, react, experience, decide, evolve } from './fluent-buil
|
|
|
14
14
|
export { sink, source } from './data-narrative-builders.js';
|
|
15
15
|
// Narrative language functions
|
|
16
16
|
export { narrative, narrative as flow } from './narrative.js';
|
|
17
|
-
export { client, server, specs, describe, it, should, request, data, rule, example } from './narrative.js';
|
|
17
|
+
export { client, server, specs, describe, it, should, request, data, rule, example, thenError } from './narrative.js';
|
|
18
18
|
export { SliceType } from './narrative.js';
|
|
19
19
|
// Narrative conversion utilities
|
|
20
20
|
export { getNarratives } from './getNarratives.js';
|
|
21
21
|
export { modelToNarrative } from './transformers/model-to-narrative/index.js';
|
|
22
22
|
// Testing helpers
|
|
23
|
-
export { createNarrativeSpec, given, when } from './testing.js';
|
|
23
|
+
export { createNarrativeSpec, given as testGiven, when as testWhen } from './testing.js';
|
|
24
24
|
// Schema definitions for progressive narrative creation
|
|
25
|
-
export { NarrativeNamesSchema as NarrativeNamesSystemSchema, SliceNamesSchema as SliceNamesSystemSchema, ClientServerNamesSchema as ClientServerNamesSystemSchema, modelSchema as SpecsSystemSchema, MessageFieldSchema, MessageSchema, CommandSchema, EventSchema, StateSchema, IntegrationSchema, CommandSliceSchema, QuerySliceSchema, ReactSliceSchema, ExperienceSliceSchema, SliceSchema, NarrativeSchema, modelSchema,
|
|
25
|
+
export { NarrativeNamesSchema as NarrativeNamesSystemSchema, SliceNamesSchema as SliceNamesSystemSchema, ClientServerNamesSchema as ClientServerNamesSystemSchema, modelSchema as SpecsSystemSchema, MessageFieldSchema, MessageSchema, CommandSchema, EventSchema, StateSchema, IntegrationSchema, CommandSliceSchema, QuerySliceSchema, ReactSliceSchema, ExperienceSliceSchema, SliceSchema, NarrativeSchema, modelSchema, ExampleSchema, RuleSchema, SpecSchema, StepSchema, StepErrorSchema, StepWithDocStringSchema, StepWithErrorSchema, } from './schema.js';
|
|
26
26
|
// ID assignment utilities
|
|
27
27
|
export { addAutoIds, hasAllIds } from './id/index.js';
|
|
28
28
|
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AACjF,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,iBAAiB;AACjB,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,qCAAqC;AACrC,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,OAA6B,EAAE,GAAG,MAAiB,EAAE,EAAE;IACzE,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE;QACvC,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QACxB,OAAO,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACrF,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC,CAAC;AASF,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAErF,0BAA0B;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAGzD,+BAA+B;AAC/B,OAAO,EAAE,SAAS,EAAE,SAAS,IAAI,IAAI,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC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AAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAIrE,kBAAkB;AAClB,OAAO,EAAE,mBAAmB,EAAE,KAAK,IAAI,SAAS,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEtF,wDAAwD;AACxD,OAAO,EACL,oBAAoB,IAAI,0BAA0B,EAClD,gBAAgB,IAAI,sBAAsB,EAC1C,uBAAuB,IAAI,6BAA6B,EACxD,WAAW,IAAI,iBAAiB,EAChC,kBAAkB,EAClB,aAAa,EACb,aAAa,EACb,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,qBAAqB,EACrB,WAAW,EACX,eAAe,EACf,WAAW,EACX,aAAa,EACb,UAAU,EACV,UAAU,EACV,UAAU,EACV,eAAe,EACf,uBAAuB,EACvB,mBAAmB,GACpB,MAAM,UAAU,CAAC;AAgClB,0BAA0B;AAC1B,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../src/loader/graph.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../src/loader/graph.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAUL,QAAQ,EACT,MAAM,YAAY,CAAC;AAyIpB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,KAAK,CAAC;IACb,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAClC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IAChD,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,YAAY,EAAE,aAAa,EAAE,CAAC,CAAC;CACrE,CAAC;AAEF,wBAAsB,UAAU,CAC9B,UAAU,EAAE,MAAM,EAAE,EACpB,GAAG,EAAE,UAAU,EACf,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,gBAAgB,CAAC,CAoO3B"}
|
package/dist/src/loader/graph.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import createDebug from 'debug';
|
|
2
|
-
import { parseImports, parseTypeDefinitions, parseIntegrationExports, parseIntegrationImports, parseGivenTypeArguments, parseWhenTypeArguments, patchImportMeta, transpileToCjs, } from './ts-utils.js';
|
|
2
|
+
import { parseImports, parseTypeDefinitions, parseIntegrationExports, parseIntegrationImports, parseGivenTypeArguments, parseWhenTypeArguments, parseThenTypeArguments, patchImportMeta, transpileToCjs, } from './ts-utils.js';
|
|
3
3
|
import { toPosix } from './fs-path.js';
|
|
4
4
|
import { resolveSpecifier } from './resolver.js';
|
|
5
5
|
import { integrationExportRegistry } from '../integration-export-registry.js';
|
|
@@ -248,6 +248,7 @@ export async function buildGraph(entryFiles, vfs, importMap, rootDir) {
|
|
|
248
248
|
}
|
|
249
249
|
function extractTypeInfoFromProgram(program, checker) {
|
|
250
250
|
const whenTypesByFile = new Map();
|
|
251
|
+
const thenTypesByFile = new Map();
|
|
251
252
|
for (const sourceFile of program.getSourceFiles()) {
|
|
252
253
|
const posixPath = toPosix(sourceFile.fileName);
|
|
253
254
|
if (!sourceFiles.has(posixPath) || posixPath.endsWith('.d.ts'))
|
|
@@ -255,16 +256,21 @@ export async function buildGraph(entryFiles, vfs, importMap, rootDir) {
|
|
|
255
256
|
const fileTypeMap = typesByFile.get(posixPath) || new Map();
|
|
256
257
|
const extractedGivenTypes = parseGivenTypeArguments(ts, checker, sourceFile, fileTypeMap, typesByFile);
|
|
257
258
|
const extractedWhenTypes = parseWhenTypeArguments(ts, checker, sourceFile, fileTypeMap, typesByFile);
|
|
259
|
+
const extractedThenTypes = parseThenTypeArguments(ts, checker, sourceFile, fileTypeMap, typesByFile);
|
|
258
260
|
if (extractedGivenTypes.length > 0) {
|
|
259
261
|
givenTypesByFile.set(posixPath, extractedGivenTypes);
|
|
260
|
-
debug('[given-types] extracted %d
|
|
262
|
+
debug('[given-types] extracted %d given<T>() calls from %s', extractedGivenTypes.length, posixPath);
|
|
261
263
|
}
|
|
262
264
|
if (extractedWhenTypes.length > 0) {
|
|
263
265
|
whenTypesByFile.set(posixPath, extractedWhenTypes);
|
|
264
|
-
debug('[when-types] extracted %d
|
|
266
|
+
debug('[when-types] extracted %d when<T>() calls from %s: %o', extractedWhenTypes.length, posixPath, extractedWhenTypes.map((t) => ({ typeName: t.typeName, classification: t.classification })));
|
|
267
|
+
}
|
|
268
|
+
if (extractedThenTypes.length > 0) {
|
|
269
|
+
thenTypesByFile.set(posixPath, extractedThenTypes);
|
|
270
|
+
debug('[then-types] extracted %d then<T>() calls from %s: %o', extractedThenTypes.length, posixPath, extractedThenTypes.map((t) => ({ typeName: t.typeName, classification: t.classification })));
|
|
265
271
|
}
|
|
266
272
|
}
|
|
267
|
-
return whenTypesByFile;
|
|
273
|
+
return { whenTypes: whenTypesByFile, thenTypes: thenTypesByFile };
|
|
268
274
|
}
|
|
269
275
|
for (const entry of entryFiles) {
|
|
270
276
|
await buildRec(toPosix(entry));
|
|
@@ -273,8 +279,9 @@ export async function buildGraph(entryFiles, vfs, importMap, rootDir) {
|
|
|
273
279
|
await loadTypingFiles(pkgTypings);
|
|
274
280
|
const program = ts.createProgram([...sourceFiles.keys()], compilerOptions, host);
|
|
275
281
|
const checker = program.getTypeChecker();
|
|
276
|
-
const
|
|
277
|
-
givenTypesByFile.set('__whenTypes',
|
|
282
|
+
const { whenTypes, thenTypes } = extractTypeInfoFromProgram(program, checker);
|
|
283
|
+
givenTypesByFile.set('__whenTypes', whenTypes);
|
|
284
|
+
givenTypesByFile.set('__thenTypes', thenTypes);
|
|
278
285
|
const result = {
|
|
279
286
|
graph,
|
|
280
287
|
vfsFiles: [...vfsFiles].sort(),
|