@auto-engineer/narrative 0.12.1 → 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.
Files changed (95) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +24 -0
  3. package/dist/src/commands/export-schema-runner.js +1 -1
  4. package/dist/src/commands/export-schema-runner.js.map +1 -1
  5. package/dist/src/fluent-builder.js +3 -3
  6. package/dist/src/fluent-builder.js.map +1 -1
  7. package/dist/src/getNarratives.specs.js +157 -161
  8. package/dist/src/getNarratives.specs.js.map +1 -1
  9. package/dist/src/id/addAutoIds.d.ts.map +1 -1
  10. package/dist/src/id/addAutoIds.js +23 -10
  11. package/dist/src/id/addAutoIds.js.map +1 -1
  12. package/dist/src/id/addAutoIds.specs.js +55 -46
  13. package/dist/src/id/addAutoIds.specs.js.map +1 -1
  14. package/dist/src/id/generators.js +1 -1
  15. package/dist/src/id/generators.js.map +1 -1
  16. package/dist/src/id/hasAllIds.d.ts.map +1 -1
  17. package/dist/src/id/hasAllIds.js +8 -3
  18. package/dist/src/id/hasAllIds.js.map +1 -1
  19. package/dist/src/id/hasAllIds.specs.js +142 -215
  20. package/dist/src/id/hasAllIds.specs.js.map +1 -1
  21. package/dist/src/index.d.ts +7 -8
  22. package/dist/src/index.d.ts.map +1 -1
  23. package/dist/src/index.js +3 -3
  24. package/dist/src/index.js.map +1 -1
  25. package/dist/src/loader/graph.d.ts.map +1 -1
  26. package/dist/src/loader/graph.js +13 -6
  27. package/dist/src/loader/graph.js.map +1 -1
  28. package/dist/src/loader/ts-utils.d.ts +1 -0
  29. package/dist/src/loader/ts-utils.d.ts.map +1 -1
  30. package/dist/src/loader/ts-utils.js +95 -16
  31. package/dist/src/loader/ts-utils.js.map +1 -1
  32. package/dist/src/model-to-narrative.specs.js +548 -466
  33. package/dist/src/model-to-narrative.specs.js.map +1 -1
  34. package/dist/src/narrative-context.d.ts +8 -8
  35. package/dist/src/narrative-context.d.ts.map +1 -1
  36. package/dist/src/narrative-context.js +111 -301
  37. package/dist/src/narrative-context.js.map +1 -1
  38. package/dist/src/narrative-context.specs.js +15 -55
  39. package/dist/src/narrative-context.specs.js.map +1 -1
  40. package/dist/src/narrative.d.ts +19 -22
  41. package/dist/src/narrative.d.ts.map +1 -1
  42. package/dist/src/narrative.js +42 -71
  43. package/dist/src/narrative.js.map +1 -1
  44. package/dist/src/samples/questionnaires.narrative.js +10 -10
  45. package/dist/src/samples/questionnaires.narrative.js.map +1 -1
  46. package/dist/src/samples/test-with-ids.narrative.js +13 -29
  47. package/dist/src/samples/test-with-ids.narrative.js.map +1 -1
  48. package/dist/src/schema.d.ts +2704 -8293
  49. package/dist/src/schema.d.ts.map +1 -1
  50. package/dist/src/schema.js +26 -47
  51. package/dist/src/schema.js.map +1 -1
  52. package/dist/src/slice-builder.js +3 -3
  53. package/dist/src/slice-builder.js.map +1 -1
  54. package/dist/src/transformers/model-to-narrative/generators/flow.d.ts.map +1 -1
  55. package/dist/src/transformers/model-to-narrative/generators/flow.js +118 -74
  56. package/dist/src/transformers/model-to-narrative/generators/flow.js.map +1 -1
  57. package/dist/src/transformers/model-to-narrative/generators/gwt.d.ts +9 -1
  58. package/dist/src/transformers/model-to-narrative/generators/gwt.d.ts.map +1 -1
  59. package/dist/src/transformers/model-to-narrative/generators/gwt.js +112 -112
  60. package/dist/src/transformers/model-to-narrative/generators/gwt.js.map +1 -1
  61. package/dist/src/transformers/model-to-narrative/generators/imports.d.ts +1 -1
  62. package/dist/src/transformers/model-to-narrative/generators/imports.d.ts.map +1 -1
  63. package/dist/src/transformers/model-to-narrative/generators/imports.js +13 -9
  64. package/dist/src/transformers/model-to-narrative/generators/imports.js.map +1 -1
  65. package/dist/src/transformers/narrative-to-model/index.d.ts.map +1 -1
  66. package/dist/src/transformers/narrative-to-model/index.js +50 -23
  67. package/dist/src/transformers/narrative-to-model/index.js.map +1 -1
  68. package/dist/src/transformers/narrative-to-model/type-inference.specs.js +100 -90
  69. package/dist/src/transformers/narrative-to-model/type-inference.specs.js.map +1 -1
  70. package/dist/tsconfig.tsbuildinfo +1 -1
  71. package/package.json +5 -5
  72. package/src/commands/export-schema-runner.ts +3 -1
  73. package/src/fluent-builder.ts +3 -3
  74. package/src/getNarratives.specs.ts +176 -184
  75. package/src/id/addAutoIds.specs.ts +55 -48
  76. package/src/id/addAutoIds.ts +28 -11
  77. package/src/id/generators.ts +1 -1
  78. package/src/id/hasAllIds.specs.ts +147 -245
  79. package/src/id/hasAllIds.ts +11 -4
  80. package/src/index.ts +11 -12
  81. package/src/loader/graph.ts +23 -6
  82. package/src/loader/ts-utils.ts +169 -26
  83. package/src/model-to-narrative.specs.ts +548 -466
  84. package/src/narrative-context.specs.ts +73 -116
  85. package/src/narrative-context.ts +127 -374
  86. package/src/narrative.ts +70 -120
  87. package/src/samples/questionnaires.narrative.ts +10 -10
  88. package/src/samples/test-with-ids.narrative.ts +23 -31
  89. package/src/schema.ts +33 -52
  90. package/src/slice-builder.ts +3 -3
  91. package/src/transformers/model-to-narrative/generators/flow.ts +191 -85
  92. package/src/transformers/model-to-narrative/generators/gwt.ts +195 -178
  93. package/src/transformers/model-to-narrative/generators/imports.ts +13 -9
  94. package/src/transformers/narrative-to-model/index.ts +87 -26
  95. package/src/transformers/narrative-to-model/type-inference.specs.ts +100 -90
@@ -16,43 +16,46 @@ describe('Type inference in narrative-to-model transformer', () => {
16
16
  client: { specs: [] },
17
17
  server: {
18
18
  description: 'Submit answer server',
19
- specs: {
20
- name: 'Submit Answer Specs',
21
- rules: [
22
- {
23
- id: 'RULE-001',
24
- description: 'Should accept answer submission',
25
- examples: [
26
- {
27
- description: 'Valid answer submission',
28
- when: [
29
- {
30
- commandRef: 'AnswerQuestion',
31
- exampleData: {
32
- questionnaireId: 'q-001',
33
- participantId: 'participant-abc',
34
- questionId: 'q1',
35
- answer: 'Yes',
19
+ specs: [
20
+ {
21
+ type: 'gherkin',
22
+ feature: 'Submit Answer Specs',
23
+ rules: [
24
+ {
25
+ id: 'RULE-001',
26
+ name: 'Should accept answer submission',
27
+ examples: [
28
+ {
29
+ name: 'Valid answer submission',
30
+ steps: [
31
+ {
32
+ keyword: 'When',
33
+ text: 'AnswerQuestion',
34
+ docString: {
35
+ questionnaireId: 'q-001',
36
+ participantId: 'participant-abc',
37
+ questionId: 'q1',
38
+ answer: 'Yes',
39
+ },
36
40
  },
37
- },
38
- ],
39
- then: [
40
- {
41
- eventRef: 'QuestionAnswered',
42
- exampleData: {
43
- questionnaireId: 'q-001',
44
- participantId: 'participant-abc',
45
- questionId: 'q1',
46
- answer: 'Yes',
47
- savedAt: new Date(),
41
+ {
42
+ keyword: 'Then',
43
+ text: 'QuestionAnswered',
44
+ docString: {
45
+ questionnaireId: 'q-001',
46
+ participantId: 'participant-abc',
47
+ questionId: 'q1',
48
+ answer: 'Yes',
49
+ savedAt: new Date(),
50
+ },
48
51
  },
49
- },
50
- ],
51
- },
52
- ],
53
- },
54
- ],
55
- },
52
+ ],
53
+ },
54
+ ],
55
+ },
56
+ ],
57
+ },
58
+ ],
56
59
  },
57
60
  },
58
61
  {
@@ -62,39 +65,42 @@ describe('Type inference in narrative-to-model transformer', () => {
62
65
  client: { specs: [] },
63
66
  server: {
64
67
  description: 'Submit questionnaire server',
65
- specs: {
66
- name: 'Submit Questionnaire Specs',
67
- rules: [
68
- {
69
- id: 'RULE-002',
70
- description: 'Should submit questionnaire',
71
- examples: [
72
- {
73
- description: 'Valid questionnaire submission',
74
- when: [
75
- {
76
- commandRef: 'SubmitQuestionnaire',
77
- exampleData: {
78
- questionnaireId: 'q-001',
79
- participantId: 'participant-abc',
68
+ specs: [
69
+ {
70
+ type: 'gherkin',
71
+ feature: 'Submit Questionnaire Specs',
72
+ rules: [
73
+ {
74
+ id: 'RULE-002',
75
+ name: 'Should submit questionnaire',
76
+ examples: [
77
+ {
78
+ name: 'Valid questionnaire submission',
79
+ steps: [
80
+ {
81
+ keyword: 'When',
82
+ text: 'SubmitQuestionnaire',
83
+ docString: {
84
+ questionnaireId: 'q-001',
85
+ participantId: 'participant-abc',
86
+ },
80
87
  },
81
- },
82
- ],
83
- then: [
84
- {
85
- eventRef: 'QuestionnaireSubmitted',
86
- exampleData: {
87
- questionnaireId: 'q-001',
88
- participantId: 'participant-abc',
89
- submittedAt: new Date(),
88
+ {
89
+ keyword: 'Then',
90
+ text: 'QuestionnaireSubmitted',
91
+ docString: {
92
+ questionnaireId: 'q-001',
93
+ participantId: 'participant-abc',
94
+ submittedAt: new Date(),
95
+ },
90
96
  },
91
- },
92
- ],
93
- },
94
- ],
95
- },
96
- ],
97
- },
97
+ ],
98
+ },
99
+ ],
100
+ },
101
+ ],
102
+ },
103
+ ],
98
104
  },
99
105
  },
100
106
  ],
@@ -135,31 +141,35 @@ describe('Type inference in narrative-to-model transformer', () => {
135
141
  client: { specs: [] },
136
142
  server: {
137
143
  description: 'Single object server',
138
- specs: {
139
- name: 'Single Object Specs',
140
- rules: [
141
- {
142
- id: 'RULE-001',
143
- description: 'Should handle single object',
144
- examples: [
145
- {
146
- description: 'Single object example',
147
- // Single object, not array - this is what broke
148
- when: {
149
- commandRef: 'TestCommand',
150
- exampleData: { test: 'value' },
144
+ specs: [
145
+ {
146
+ type: 'gherkin',
147
+ feature: 'Single Object Specs',
148
+ rules: [
149
+ {
150
+ id: 'RULE-001',
151
+ name: 'Should handle single object',
152
+ examples: [
153
+ {
154
+ name: 'Single object example',
155
+ steps: [
156
+ {
157
+ keyword: 'When',
158
+ text: 'TestCommand',
159
+ docString: { test: 'value' },
160
+ },
161
+ {
162
+ keyword: 'Then',
163
+ text: 'TestEvent',
164
+ docString: { result: 'success' },
165
+ },
166
+ ],
151
167
  },
152
- then: [
153
- {
154
- eventRef: 'TestEvent',
155
- exampleData: { result: 'success' },
156
- },
157
- ],
158
- },
159
- ],
160
- },
161
- ],
162
- },
168
+ ],
169
+ },
170
+ ],
171
+ },
172
+ ],
163
173
  },
164
174
  },
165
175
  ],