@auto-engineer/server-generator-apollo-emmett 0.13.0 → 0.13.2

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 (92) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +16 -0
  3. package/dist/src/codegen/extract/commands.d.ts +7 -14
  4. package/dist/src/codegen/extract/commands.d.ts.map +1 -1
  5. package/dist/src/codegen/extract/commands.js.map +1 -1
  6. package/dist/src/codegen/extract/data-sink.d.ts +1 -1
  7. package/dist/src/codegen/extract/data-sink.d.ts.map +1 -1
  8. package/dist/src/codegen/extract/data-sink.js +9 -31
  9. package/dist/src/codegen/extract/data-sink.js.map +1 -1
  10. package/dist/src/codegen/extract/events.d.ts +4 -8
  11. package/dist/src/codegen/extract/events.d.ts.map +1 -1
  12. package/dist/src/codegen/extract/events.js.map +1 -1
  13. package/dist/src/codegen/extract/gwt.d.ts +2 -2
  14. package/dist/src/codegen/extract/gwt.d.ts.map +1 -1
  15. package/dist/src/codegen/extract/gwt.js +6 -21
  16. package/dist/src/codegen/extract/gwt.js.map +1 -1
  17. package/dist/src/codegen/extract/messages.d.ts +4 -4
  18. package/dist/src/codegen/extract/messages.d.ts.map +1 -1
  19. package/dist/src/codegen/extract/messages.js +24 -47
  20. package/dist/src/codegen/extract/messages.js.map +1 -1
  21. package/dist/src/codegen/extract/query.d.ts +5 -7
  22. package/dist/src/codegen/extract/query.d.ts.map +1 -1
  23. package/dist/src/codegen/extract/query.js +10 -8
  24. package/dist/src/codegen/extract/query.js.map +1 -1
  25. package/dist/src/codegen/extract/slice-normalizer.d.ts +29 -0
  26. package/dist/src/codegen/extract/slice-normalizer.d.ts.map +1 -0
  27. package/dist/src/codegen/extract/slice-normalizer.js +48 -0
  28. package/dist/src/codegen/extract/slice-normalizer.js.map +1 -0
  29. package/dist/src/codegen/extract/step-converter.d.ts +17 -0
  30. package/dist/src/codegen/extract/step-converter.d.ts.map +1 -0
  31. package/dist/src/codegen/extract/step-converter.js +82 -0
  32. package/dist/src/codegen/extract/step-converter.js.map +1 -0
  33. package/dist/src/codegen/extract/step-types.d.ts +30 -0
  34. package/dist/src/codegen/extract/step-types.d.ts.map +1 -0
  35. package/dist/src/codegen/extract/step-types.js +16 -0
  36. package/dist/src/codegen/extract/step-types.js.map +1 -0
  37. package/dist/src/codegen/scaffoldFromSchema.d.ts.map +1 -1
  38. package/dist/src/codegen/scaffoldFromSchema.js +7 -29
  39. package/dist/src/codegen/scaffoldFromSchema.js.map +1 -1
  40. package/dist/src/codegen/templates/command/commands.specs.ts +33 -28
  41. package/dist/src/codegen/templates/command/decide.specs.specs.ts +153 -138
  42. package/dist/src/codegen/templates/command/decide.specs.ts +169 -146
  43. package/dist/src/codegen/templates/command/events.specs.ts +43 -38
  44. package/dist/src/codegen/templates/command/evolve.specs.ts +38 -33
  45. package/dist/src/codegen/templates/command/handle.specs.ts +71 -61
  46. package/dist/src/codegen/templates/command/mutation.resolver.specs.ts +122 -102
  47. package/dist/src/codegen/templates/command/register.specs.ts +39 -34
  48. package/dist/src/codegen/templates/command/state.specs.ts +39 -34
  49. package/dist/src/codegen/templates/query/projection.specs.specs.ts +399 -359
  50. package/dist/src/codegen/templates/query/projection.specs.ts +242 -216
  51. package/dist/src/codegen/templates/query/projection.specs.ts.ejs +38 -12
  52. package/dist/src/codegen/templates/query/query.resolver.specs.ts +59 -51
  53. package/dist/src/codegen/templates/query/state.specs.ts +1 -1
  54. package/dist/src/codegen/templates/react/react.specs.specs.ts +93 -85
  55. package/dist/src/codegen/templates/react/react.specs.ts +135 -122
  56. package/dist/src/codegen/templates/react/register.specs.ts +135 -122
  57. package/dist/src/codegen/test-data/specVariant1.d.ts.map +1 -1
  58. package/dist/src/codegen/test-data/specVariant1.js +101 -90
  59. package/dist/src/codegen/test-data/specVariant1.js.map +1 -1
  60. package/dist/src/codegen/types.d.ts +5 -7
  61. package/dist/src/codegen/types.d.ts.map +1 -1
  62. package/dist/tsconfig.tsbuildinfo +1 -1
  63. package/package.json +4 -4
  64. package/src/codegen/extract/commands.ts +7 -8
  65. package/src/codegen/extract/data-sink.ts +16 -43
  66. package/src/codegen/extract/events.ts +4 -5
  67. package/src/codegen/extract/gwt.ts +12 -29
  68. package/src/codegen/extract/messages.ts +43 -70
  69. package/src/codegen/extract/query.ts +14 -12
  70. package/src/codegen/extract/slice-normalizer.ts +88 -0
  71. package/src/codegen/extract/step-converter.ts +124 -0
  72. package/src/codegen/extract/step-types.ts +52 -0
  73. package/src/codegen/scaffoldFromSchema.ts +8 -45
  74. package/src/codegen/templates/command/commands.specs.ts +33 -28
  75. package/src/codegen/templates/command/decide.specs.specs.ts +153 -138
  76. package/src/codegen/templates/command/decide.specs.ts +169 -146
  77. package/src/codegen/templates/command/events.specs.ts +43 -38
  78. package/src/codegen/templates/command/evolve.specs.ts +38 -33
  79. package/src/codegen/templates/command/handle.specs.ts +71 -61
  80. package/src/codegen/templates/command/mutation.resolver.specs.ts +122 -102
  81. package/src/codegen/templates/command/register.specs.ts +39 -34
  82. package/src/codegen/templates/command/state.specs.ts +39 -34
  83. package/src/codegen/templates/query/projection.specs.specs.ts +399 -359
  84. package/src/codegen/templates/query/projection.specs.ts +242 -216
  85. package/src/codegen/templates/query/projection.specs.ts.ejs +38 -12
  86. package/src/codegen/templates/query/query.resolver.specs.ts +59 -51
  87. package/src/codegen/templates/query/state.specs.ts +1 -1
  88. package/src/codegen/templates/react/react.specs.specs.ts +93 -85
  89. package/src/codegen/templates/react/react.specs.ts +135 -122
  90. package/src/codegen/templates/react/register.specs.ts +135 -122
  91. package/src/codegen/test-data/specVariant1.ts +101 -90
  92. package/src/codegen/types.ts +6 -4
@@ -19,40 +19,45 @@ describe('generateScaffoldFilePlans', () => {
19
19
  },
20
20
  server: {
21
21
  description: 'test',
22
- specs: {
23
- name: 'Create listing command',
24
- rules: [
25
- {
26
- description: 'Should create listing successfully',
27
- examples: [
28
- {
29
- description: 'User creates listing with valid data',
30
- when: {
31
- commandRef: 'CreateListing',
32
- exampleData: {
33
- propertyId: 'listing_123',
34
- title: 'Modern Downtown Apartment',
35
- listedAt: '2024-01-15T10:00:00Z',
36
- rating: 4.8,
37
- metadata: { foo: 'bar' },
38
- },
39
- },
40
- then: [
41
- {
42
- eventRef: 'ListingCreated',
43
- exampleData: {
44
- propertyId: 'listing_123',
45
- listedAt: '2024-01-15T10:00:00Z',
46
- rating: 4.8,
47
- metadata: { foo: 'bar' },
22
+ specs: [
23
+ {
24
+ type: 'gherkin',
25
+ feature: 'Create listing command',
26
+ rules: [
27
+ {
28
+ name: 'Should create listing successfully',
29
+ examples: [
30
+ {
31
+ name: 'User creates listing with valid data',
32
+ steps: [
33
+ {
34
+ keyword: 'When',
35
+ text: 'CreateListing',
36
+ docString: {
37
+ propertyId: 'listing_123',
38
+ title: 'Modern Downtown Apartment',
39
+ listedAt: '2024-01-15T10:00:00Z',
40
+ rating: 4.8,
41
+ metadata: { foo: 'bar' },
42
+ },
48
43
  },
49
- },
50
- ],
51
- },
52
- ],
53
- },
54
- ],
55
- },
44
+ {
45
+ keyword: 'Then',
46
+ text: 'ListingCreated',
47
+ docString: {
48
+ propertyId: 'listing_123',
49
+ listedAt: '2024-01-15T10:00:00Z',
50
+ rating: 4.8,
51
+ metadata: { foo: 'bar' },
52
+ },
53
+ },
54
+ ],
55
+ },
56
+ ],
57
+ },
58
+ ],
59
+ },
60
+ ],
56
61
  data: [
57
62
  {
58
63
  target: {
@@ -181,35 +186,40 @@ describe('generateScaffoldFilePlans', () => {
181
186
  },
182
187
  },
183
188
  ],
184
- specs: {
185
- name: 'Suggest items command',
186
- rules: [
187
- {
188
- description: 'Should suggest items successfully',
189
- examples: [
190
- {
191
- description: 'User requests item suggestions',
192
- when: {
193
- commandRef: 'SuggestItems',
194
- exampleData: {
195
- sessionId: 'session-123',
196
- prompt: 'What should I buy?',
197
- },
198
- },
199
- then: [
200
- {
201
- eventRef: 'ItemsSuggested',
202
- exampleData: {
203
- sessionId: 'session-123',
204
- items: [],
189
+ specs: [
190
+ {
191
+ type: 'gherkin',
192
+ feature: 'Suggest items command',
193
+ rules: [
194
+ {
195
+ name: 'Should suggest items successfully',
196
+ examples: [
197
+ {
198
+ name: 'User requests item suggestions',
199
+ steps: [
200
+ {
201
+ keyword: 'When',
202
+ text: 'SuggestItems',
203
+ docString: {
204
+ sessionId: 'session-123',
205
+ prompt: 'What should I buy?',
206
+ },
205
207
  },
206
- },
207
- ],
208
- },
209
- ],
210
- },
211
- ],
212
- },
208
+ {
209
+ keyword: 'Then',
210
+ text: 'ItemsSuggested',
211
+ docString: {
212
+ sessionId: 'session-123',
213
+ items: [],
214
+ },
215
+ },
216
+ ],
217
+ },
218
+ ],
219
+ },
220
+ ],
221
+ },
222
+ ],
213
223
  },
214
224
  },
215
225
  ],
@@ -18,35 +18,40 @@ describe('mutation.resolver.ts.ejs', () => {
18
18
  },
19
19
  server: {
20
20
  description: 'Handles listing creation',
21
- specs: {
22
- name: 'Create listing command',
23
- rules: [
24
- {
25
- description: 'Should create listing successfully',
26
- examples: [
27
- {
28
- description: 'User creates listing with valid data',
29
- when: {
30
- commandRef: 'CreateListing',
31
- exampleData: {
32
- propertyId: 'listing_123',
33
- title: 'Modern Downtown Apartment',
34
- pricePerNight: 250,
35
- maxGuests: 4,
36
- amenities: ['wifi', 'kitchen'],
37
- available: true,
38
- tags: ['sea view', 'balcony'],
39
- rating: 4.8,
40
- metadata: { petsAllowed: true },
41
- listedAt: '2024-01-15T10:00:00Z',
42
- },
21
+ specs: [
22
+ {
23
+ type: 'gherkin',
24
+ feature: 'Create listing command',
25
+ rules: [
26
+ {
27
+ name: 'Should create listing successfully',
28
+ examples: [
29
+ {
30
+ name: 'User creates listing with valid data',
31
+ steps: [
32
+ {
33
+ keyword: 'When',
34
+ text: 'CreateListing',
35
+ docString: {
36
+ propertyId: 'listing_123',
37
+ title: 'Modern Downtown Apartment',
38
+ pricePerNight: 250,
39
+ maxGuests: 4,
40
+ amenities: ['wifi', 'kitchen'],
41
+ available: true,
42
+ tags: ['sea view', 'balcony'],
43
+ rating: 4.8,
44
+ metadata: { petsAllowed: true },
45
+ listedAt: '2024-01-15T10:00:00Z',
46
+ },
47
+ },
48
+ ],
43
49
  },
44
- then: [],
45
- },
46
- ],
47
- },
48
- ],
49
- },
50
+ ],
51
+ },
52
+ ],
53
+ },
54
+ ],
50
55
  },
51
56
  },
52
57
  ],
@@ -158,40 +163,45 @@ describe('mutation.resolver.ts.ejs', () => {
158
163
  destination: { type: 'stream', pattern: 'questionnaire-participantId' },
159
164
  },
160
165
  ],
161
- specs: {
162
- name: '',
163
- rules: [
164
- {
165
- description: 'answers are allowed while the questionnaire has not been submitted',
166
- examples: [
167
- {
168
- description: 'no questions have been answered yet',
169
- when: {
170
- commandRef: 'AnswerQuestion',
171
- exampleData: {
172
- questionnaireId: 'q-001',
173
- participantId: 'participant-abc',
174
- questionId: 'q1',
175
- answer: 'Yes',
176
- },
177
- },
178
- then: [
179
- {
180
- eventRef: 'QuestionAnswered',
181
- exampleData: {
182
- questionnaireId: 'q-001',
183
- participantId: 'participant-abc',
184
- questionId: 'q1',
185
- answer: 'Yes',
186
- savedAt: '2030-01-01T09:05:00.000Z',
166
+ specs: [
167
+ {
168
+ type: 'gherkin',
169
+ feature: '',
170
+ rules: [
171
+ {
172
+ name: 'answers are allowed while the questionnaire has not been submitted',
173
+ examples: [
174
+ {
175
+ name: 'no questions have been answered yet',
176
+ steps: [
177
+ {
178
+ keyword: 'When',
179
+ text: 'AnswerQuestion',
180
+ docString: {
181
+ questionnaireId: 'q-001',
182
+ participantId: 'participant-abc',
183
+ questionId: 'q1',
184
+ answer: 'Yes',
185
+ },
186
+ },
187
+ {
188
+ keyword: 'Then',
189
+ text: 'QuestionAnswered',
190
+ docString: {
191
+ questionnaireId: 'q-001',
192
+ participantId: 'participant-abc',
193
+ questionId: 'q1',
194
+ answer: 'Yes',
195
+ savedAt: '2030-01-01T09:05:00.000Z',
196
+ },
187
197
  },
188
- },
189
- ],
190
- },
191
- ],
192
- },
193
- ],
194
- },
198
+ ],
199
+ },
200
+ ],
201
+ },
202
+ ],
203
+ },
204
+ ],
195
205
  },
196
206
  },
197
207
  ],
@@ -270,27 +280,32 @@ describe('mutation.resolver.ts.ejs', () => {
270
280
  client: { specs: [] },
271
281
  server: {
272
282
  description: '',
273
- specs: {
274
- name: '',
275
- rules: [
276
- {
277
- description: 'add items',
278
- examples: [
279
- {
280
- description: 'happy path',
281
- when: {
282
- commandRef: 'AddItemsToCart',
283
- exampleData: {
284
- sessionId: 's-1',
285
- items: [{ productId: 'p1', quantity: 2 }],
286
- },
283
+ specs: [
284
+ {
285
+ type: 'gherkin',
286
+ feature: '',
287
+ rules: [
288
+ {
289
+ name: 'add items',
290
+ examples: [
291
+ {
292
+ name: 'happy path',
293
+ steps: [
294
+ {
295
+ keyword: 'When',
296
+ text: 'AddItemsToCart',
297
+ docString: {
298
+ sessionId: 's-1',
299
+ items: [{ productId: 'p1', quantity: 2 }],
300
+ },
301
+ },
302
+ ],
287
303
  },
288
- then: [],
289
- },
290
- ],
291
- },
292
- ],
293
- },
304
+ ],
305
+ },
306
+ ],
307
+ },
308
+ ],
294
309
  },
295
310
  },
296
311
  ],
@@ -370,28 +385,33 @@ export class AddItemsToCartResolver {
370
385
  },
371
386
  server: {
372
387
  description: '',
373
- specs: {
374
- name: '',
375
- rules: [
376
- {
377
- description: 'update price',
378
- examples: [
379
- {
380
- description: 'happy path',
381
- when: {
382
- commandRef: 'UpdateProductPrice',
383
- exampleData: {
384
- productId: 'p-1',
385
- price: 99.99,
386
- discount: 10.5,
387
- },
388
+ specs: [
389
+ {
390
+ type: 'gherkin',
391
+ feature: '',
392
+ rules: [
393
+ {
394
+ name: 'update price',
395
+ examples: [
396
+ {
397
+ name: 'happy path',
398
+ steps: [
399
+ {
400
+ keyword: 'When',
401
+ text: 'UpdateProductPrice',
402
+ docString: {
403
+ productId: 'p-1',
404
+ price: 99.99,
405
+ discount: 10.5,
406
+ },
407
+ },
408
+ ],
388
409
  },
389
- then: [],
390
- },
391
- ],
392
- },
393
- ],
394
- },
410
+ ],
411
+ },
412
+ ],
413
+ },
414
+ ],
395
415
  },
396
416
  },
397
417
  ],
@@ -19,41 +19,46 @@ describe('generateScaffoldFilePlans', () => {
19
19
  },
20
20
  server: {
21
21
  description: 'test',
22
- specs: {
23
- name: 'Create listing command',
24
- rules: [
25
- {
26
- description: 'Should create listing successfully',
27
- examples: [
28
- {
29
- description: 'User creates listing with valid data',
30
- when: {
31
- commandRef: 'CreateListing',
32
- exampleData: {
33
- propertyId: 'listing_123',
34
- title: 'Modern Downtown Apartment',
35
- listedAt: '2024-01-15T10:00:00Z',
36
- rating: 4.8,
37
- metadata: { foo: 'bar' },
38
- },
39
- },
40
- then: [
41
- {
42
- eventRef: 'ListingCreated',
43
- exampleData: {
44
- propertyId: 'listing_123',
45
- title: 'Modern Downtown Apartment',
46
- listedAt: '2024-01-15T10:00:00Z',
47
- rating: 4.8,
48
- metadata: { foo: 'bar' },
22
+ specs: [
23
+ {
24
+ type: 'gherkin',
25
+ feature: 'Create listing command',
26
+ rules: [
27
+ {
28
+ name: 'Should create listing successfully',
29
+ examples: [
30
+ {
31
+ name: 'User creates listing with valid data',
32
+ steps: [
33
+ {
34
+ keyword: 'When',
35
+ text: 'CreateListing',
36
+ docString: {
37
+ propertyId: 'listing_123',
38
+ title: 'Modern Downtown Apartment',
39
+ listedAt: '2024-01-15T10:00:00Z',
40
+ rating: 4.8,
41
+ metadata: { foo: 'bar' },
42
+ },
49
43
  },
50
- },
51
- ],
52
- },
53
- ],
54
- },
55
- ],
56
- },
44
+ {
45
+ keyword: 'Then',
46
+ text: 'ListingCreated',
47
+ docString: {
48
+ propertyId: 'listing_123',
49
+ title: 'Modern Downtown Apartment',
50
+ listedAt: '2024-01-15T10:00:00Z',
51
+ rating: 4.8,
52
+ metadata: { foo: 'bar' },
53
+ },
54
+ },
55
+ ],
56
+ },
57
+ ],
58
+ },
59
+ ],
60
+ },
61
+ ],
57
62
  data: [
58
63
  {
59
64
  target: {
@@ -18,41 +18,46 @@ describe('state.ts.ejs', () => {
18
18
  },
19
19
  server: {
20
20
  description: 'test',
21
- specs: {
22
- name: 'Create listing command',
23
- rules: [
24
- {
25
- description: 'Should create listing successfully',
26
- examples: [
27
- {
28
- description: 'User creates listing with valid data',
29
- when: {
30
- commandRef: 'CreateListing',
31
- exampleData: {
32
- propertyId: 'listing_123',
33
- title: 'nice apartment',
34
- pricePerNight: 250,
35
- available: true,
36
- rating: 4.8,
37
- metadata: { foo: 'bar' },
38
- },
39
- },
40
- then: [
41
- {
42
- eventRef: 'ListingCreated',
43
- exampleData: {
44
- propertyId: 'listing_123',
45
- listedAt: '2024-01-15T10:00:00Z',
46
- rating: 4.8,
47
- metadata: { foo: 'bar' },
21
+ specs: [
22
+ {
23
+ type: 'gherkin',
24
+ feature: 'Create listing command',
25
+ rules: [
26
+ {
27
+ name: 'Should create listing successfully',
28
+ examples: [
29
+ {
30
+ name: 'User creates listing with valid data',
31
+ steps: [
32
+ {
33
+ keyword: 'When',
34
+ text: 'CreateListing',
35
+ docString: {
36
+ propertyId: 'listing_123',
37
+ title: 'nice apartment',
38
+ pricePerNight: 250,
39
+ available: true,
40
+ rating: 4.8,
41
+ metadata: { foo: 'bar' },
42
+ },
43
+ },
44
+ {
45
+ keyword: 'Then',
46
+ text: 'ListingCreated',
47
+ docString: {
48
+ propertyId: 'listing_123',
49
+ listedAt: '2024-01-15T10:00:00Z',
50
+ rating: 4.8,
51
+ metadata: { foo: 'bar' },
52
+ },
48
53
  },
49
- },
50
- ],
51
- },
52
- ],
53
- },
54
- ],
55
- },
54
+ ],
55
+ },
56
+ ],
57
+ },
58
+ ],
59
+ },
60
+ ],
56
61
  },
57
62
  },
58
63
  ],