@auto-engineer/narrative 0.12.1 → 0.13.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/package.json CHANGED
@@ -23,9 +23,9 @@
23
23
  "typescript": "^5.9.2",
24
24
  "zod": "^3.22.4",
25
25
  "zod-to-json-schema": "^3.22.3",
26
- "@auto-engineer/file-store": "0.12.1",
27
- "@auto-engineer/id": "0.12.1",
28
- "@auto-engineer/message-bus": "0.12.1"
26
+ "@auto-engineer/file-store": "0.13.0",
27
+ "@auto-engineer/id": "0.13.0",
28
+ "@auto-engineer/message-bus": "0.13.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/node": "^20.0.0",
@@ -33,12 +33,12 @@
33
33
  "eslint-plugin-sort-keys-fix": "^1.1.2",
34
34
  "fake-indexeddb": "^6.0.0",
35
35
  "tsx": "^4.20.3",
36
- "@auto-engineer/cli": "0.12.1"
36
+ "@auto-engineer/cli": "0.13.0"
37
37
  },
38
38
  "publishConfig": {
39
39
  "access": "public"
40
40
  },
41
- "version": "0.12.1",
41
+ "version": "0.13.0",
42
42
  "scripts": {
43
43
  "build": "tsx scripts/build.ts",
44
44
  "test": "vitest run --reporter=dot",
@@ -408,7 +408,7 @@ describe('getNarratives', (_mode) => {
408
408
  import { flow, experience, it, specs } from '@auto-engineer/narrative';
409
409
 
410
410
  flow('Test Experience Flow', () => {
411
- experience('Homepage', 'AUTO-H1a4Bn6Cy').client(() => {
411
+ experience('Homepage', 'H1a4Bn6Cy').client(() => {
412
412
  specs(() => {
413
413
  it('show a hero section with a welcome message');
414
414
  it('allow user to start the questionnaire');
@@ -494,8 +494,8 @@ flow('Browser Test Flow', () => {
494
494
  const flowContent = `
495
495
  import { flow, experience } from '@auto-engineer/narrative';
496
496
 
497
- flow('Questionnaires', 'AUTO-Q9m2Kp4Lx', () => {
498
- experience('Homepage', 'AUTO-H1a4Bn6Cy').client(() => {});
497
+ flow('Questionnaires', 'Q9m2Kp4Lx', () => {
498
+ experience('Homepage', 'H1a4Bn6Cy').client(() => {});
499
499
  });
500
500
  `;
501
501
 
@@ -1035,11 +1035,11 @@ type SubmitQuestionnaire = Command<
1035
1035
  }
1036
1036
  >;
1037
1037
 
1038
- flow('Questionnaires', 'AUTO-Q9m2Kp4Lx', () => {
1039
- command('sends the questionnaire link', 'AUTO-S2b5Cp7Dz')
1038
+ flow('Questionnaires', 'Q9m2Kp4Lx', () => {
1039
+ command('sends the questionnaire link', 'S2b5Cp7Dz')
1040
1040
  .server(() => {
1041
1041
  specs(() => {
1042
- rule('questionnaire link is sent to participant', 'AUTO-r0A1Bo8X', () => {
1042
+ rule('questionnaire link is sent to participant', 'r0A1Bo8X', () => {
1043
1043
  example('sends the questionnaire link successfully')
1044
1044
  .when<SendQuestionnaireLink>({
1045
1045
  questionnaireId: 'q-001',
@@ -1069,10 +1069,10 @@ flow('Questionnaires', 'AUTO-Q9m2Kp4Lx', () => {
1069
1069
  });
1070
1070
  });
1071
1071
 
1072
- command('submits the questionnaire', 'AUTO-T5k9Jw3V')
1072
+ command('submits the questionnaire', 'T5k9Jw3V')
1073
1073
  .server(() => {
1074
1074
  specs(() => {
1075
- rule('questionnaire allowed to be submitted when all questions are answered', 'AUTO-r4H0Lx4U', () => {
1075
+ rule('questionnaire allowed to be submitted when all questions are answered', 'r4H0Lx4U', () => {
1076
1076
  example('submits the questionnaire successfully')
1077
1077
  .when<SubmitQuestionnaire>({
1078
1078
  questionnaireId: 'q-001',
@@ -73,7 +73,7 @@ describe('addAutoIds', () => {
73
73
  integrations: [],
74
74
  };
75
75
 
76
- const AUTO_ID_REGEX = /^AUTO-[A-Za-z0-9_]{9}$/;
76
+ const AUTO_ID_REGEX = /^[A-Za-z0-9_]{9}$/;
77
77
 
78
78
  it('should assign IDs to entities that do not have them', () => {
79
79
  const result = addAutoIds(flows);
@@ -1,5 +1,5 @@
1
1
  import { generateId } from '@auto-engineer/id';
2
2
 
3
3
  export function generateAutoId(): string {
4
- return generateId({ prefix: 'AUTO-' });
4
+ return generateId();
5
5
  }
@@ -61,24 +61,24 @@ flow('Test Flow with IDs', 'FLOW-001', () => {
61
61
  import { flow, specs, it } from '../narrative';
62
62
  import { experience } from '../fluent-builder';
63
63
 
64
- flow('Home Screen', 'AUTO-aifPcU3hw', () => {
65
- experience('Active Surveys Summary', 'AUTO-slice1').client(() => {
64
+ flow('Home Screen', 'aifPcU3hw', () => {
65
+ experience('Active Surveys Summary', 'slice1').client(() => {
66
66
  specs(() => {
67
67
  it('show active surveys summary');
68
68
  });
69
69
  });
70
70
  });
71
71
 
72
- flow('Create Survey', 'AUTO-MPviTMrQC', () => {
73
- experience('Create Survey Form', 'AUTO-slice2').client(() => {
72
+ flow('Create Survey', 'MPviTMrQC', () => {
73
+ experience('Create Survey Form', 'slice2').client(() => {
74
74
  specs(() => {
75
75
  it('allow entering survey title');
76
76
  });
77
77
  });
78
78
  });
79
79
 
80
- flow('Response Analytics', 'AUTO-eME978Euk', () => {
81
- experience('Response Rate Charts', 'AUTO-slice3').client(() => {
80
+ flow('Response Analytics', 'eME978Euk', () => {
81
+ experience('Response Rate Charts', 'slice3').client(() => {
82
82
  specs(() => {
83
83
  it('show daily response rate charts');
84
84
  });
@@ -89,8 +89,8 @@ flow('Response Analytics', 'AUTO-eME978Euk', () => {
89
89
  import { flow, specs, it } from '../narrative';
90
90
  import { experience } from '../fluent-builder';
91
91
 
92
- flow('Home Screen', 'AUTO-aifPcU3hw', () => {
93
- experience('Active Surveys Summary', 'AUTO-slice1').client(() => {
92
+ flow('Home Screen', 'aifPcU3hw', () => {
93
+ experience('Active Surveys Summary', 'slice1').client(() => {
94
94
  specs(() => {
95
95
  it('show active surveys summary');
96
96
  });
@@ -98,15 +98,15 @@ flow('Home Screen', 'AUTO-aifPcU3hw', () => {
98
98
  });
99
99
 
100
100
  flow('Create Survey', () => {
101
- experience('Create Survey Form', 'AUTO-slice2').client(() => {
101
+ experience('Create Survey Form', 'slice2').client(() => {
102
102
  specs(() => {
103
103
  it('allow entering survey title');
104
104
  });
105
105
  });
106
106
  });
107
107
 
108
- flow('Response Analytics', 'AUTO-eME978Euk', () => {
109
- experience('Response Rate Charts', 'AUTO-slice3').client(() => {
108
+ flow('Response Analytics', 'eME978Euk', () => {
109
+ experience('Response Rate Charts', 'slice3').client(() => {
110
110
  specs(() => {
111
111
  it('show daily response rate charts');
112
112
  });
@@ -117,15 +117,15 @@ flow('Response Analytics', 'AUTO-eME978Euk', () => {
117
117
  import { flow, specs, it } from '../narrative';
118
118
  import { experience } from '../fluent-builder';
119
119
 
120
- flow('Home Screen', 'AUTO-aifPcU3hw', () => {
121
- experience('Active Surveys Summary', 'AUTO-slice1').client(() => {
120
+ flow('Home Screen', 'aifPcU3hw', () => {
121
+ experience('Active Surveys Summary', 'slice1').client(() => {
122
122
  specs(() => {
123
123
  it('show active surveys summary');
124
124
  });
125
125
  });
126
126
  });
127
127
 
128
- flow('Create Survey', 'AUTO-MPviTMrQC', () => {
128
+ flow('Create Survey', 'MPviTMrQC', () => {
129
129
  experience('Create Survey Form').client(() => {
130
130
  specs(() => {
131
131
  it('allow entering survey title');
@@ -133,8 +133,8 @@ flow('Create Survey', 'AUTO-MPviTMrQC', () => {
133
133
  });
134
134
  });
135
135
 
136
- flow('Response Analytics', 'AUTO-eME978Euk', () => {
137
- experience('Response Rate Charts', 'AUTO-slice3').client(() => {
136
+ flow('Response Analytics', 'eME978Euk', () => {
137
+ experience('Response Rate Charts', 'slice3').client(() => {
138
138
  specs(() => {
139
139
  it('show daily response rate charts');
140
140
  });
package/src/index.ts CHANGED
@@ -52,6 +52,8 @@ export { SliceType } from './narrative';
52
52
  export { getNarratives } from './getNarratives';
53
53
  export { modelToNarrative } from './transformers/model-to-narrative';
54
54
 
55
+ export type { ExportSchemaEvents } from './commands/export-schema';
56
+
55
57
  // Testing helpers
56
58
  export { createNarrativeSpec, given, when } from './testing';
57
59
 
@@ -699,11 +699,11 @@ narrative('Questionnaire Flow', 'QUEST-001', () => {});
699
699
  narratives: [
700
700
  {
701
701
  name: 'Questionnaires',
702
- id: 'AUTO-Q9m2Kp4Lx',
702
+ id: 'Q9m2Kp4Lx',
703
703
  slices: [
704
704
  {
705
705
  name: 'Homepage',
706
- id: 'AUTO-H1a4Bn6Cy',
706
+ id: 'H1a4Bn6Cy',
707
707
  type: 'experience',
708
708
  client: {
709
709
  specs: [
@@ -714,7 +714,7 @@ narrative('Questionnaire Flow', 'QUEST-001', () => {});
714
714
  },
715
715
  {
716
716
  name: 'views the questionnaire',
717
- id: 'AUTO-V7n8Rq5M',
717
+ id: 'V7n8Rq5M',
718
718
  type: 'query',
719
719
  client: {
720
720
  specs: [
@@ -751,7 +751,7 @@ narrative('Questionnaire Flow', 'QUEST-001', () => {});
751
751
  name: '',
752
752
  rules: [
753
753
  {
754
- id: 'AUTO-r1A3Bp9W',
754
+ id: 'r1A3Bp9W',
755
755
  description: 'questionnaires show current progress',
756
756
  examples: [
757
757
  {
@@ -963,12 +963,12 @@ type QuestionnaireProgress = State<
963
963
  }[];
964
964
  }
965
965
  >;
966
- narrative('Questionnaires', 'AUTO-Q9m2Kp4Lx', () => {
967
- experience('Homepage', 'AUTO-H1a4Bn6Cy').client(() => {
966
+ narrative('Questionnaires', 'Q9m2Kp4Lx', () => {
967
+ experience('Homepage', 'H1a4Bn6Cy').client(() => {
968
968
  it('show a hero section with a welcome message');
969
969
  it('allow user to start the questionnaire');
970
970
  });
971
- query('views the questionnaire', 'AUTO-V7n8Rq5M')
971
+ query('views the questionnaire', 'V7n8Rq5M')
972
972
  .client(() => {
973
973
  describe('Questionnaire Progress', () => {
974
974
  it('focus on the current question based on the progress state');
@@ -995,7 +995,7 @@ narrative('Questionnaires', 'AUTO-Q9m2Kp4Lx', () => {
995
995
  .server(() => {
996
996
  data([source().state('QuestionnaireProgress').fromProjection('Questionnaires', 'questionnaire-participantId')]);
997
997
  specs(() => {
998
- rule('questionnaires show current progress', 'AUTO-r1A3Bp9W', () => {
998
+ rule('questionnaires show current progress', 'r1A3Bp9W', () => {
999
999
  example('a question has already been answered')
1000
1000
  .given<QuestionnaireLinkSent>({
1001
1001
  questionnaireId: 'q-001',
@@ -1046,7 +1046,7 @@ narrative('Questionnaires', 'AUTO-Q9m2Kp4Lx', () => {
1046
1046
  name: 'Test Rules',
1047
1047
  rules: [
1048
1048
  {
1049
- id: 'AUTO-r1A3Bp9W',
1049
+ id: 'r1A3Bp9W',
1050
1050
  description: 'questionnaires show current progress',
1051
1051
  examples: [
1052
1052
  {
@@ -1176,7 +1176,7 @@ type QuestionnaireProgress = State<
1176
1176
  narrative('Test Flow', 'TEST-FLOW', () => {
1177
1177
  query('test slice', 'TEST-SLICE').server(() => {
1178
1178
  specs('Test Rules', () => {
1179
- rule('questionnaires show current progress', 'AUTO-r1A3Bp9W', () => {
1179
+ rule('questionnaires show current progress', 'r1A3Bp9W', () => {
1180
1180
  example('a question has already been answered')
1181
1181
  .given<QuestionnaireLinkSent>({ questionnaireId: 'q-001', participantId: 'participant-abc' })
1182
1182
  .when<QuestionAnswered>({ questionnaireId: 'q-001', questionId: 'q1', answer: 'Yes' })
@@ -1213,7 +1213,7 @@ narrative('Test Flow', 'TEST-FLOW', () => {
1213
1213
  name: 'Multi Given Rules',
1214
1214
  rules: [
1215
1215
  {
1216
- id: 'AUTO-MultiGiven',
1216
+ id: 'MultiGiven',
1217
1217
  description: 'all questions have been answered',
1218
1218
  examples: [
1219
1219
  {
@@ -1391,7 +1391,7 @@ type QuestionnaireProgress = State<
1391
1391
  narrative('Multi Given Flow', 'MULTI-GIVEN', () => {
1392
1392
  query('multi given slice', 'MULTI-SLICE').server(() => {
1393
1393
  specs('Multi Given Rules', () => {
1394
- rule('all questions have been answered', 'AUTO-MultiGiven', () => {
1394
+ rule('all questions have been answered', 'MultiGiven', () => {
1395
1395
  example('questionnaire with multiple events')
1396
1396
  .given<QuestionnaireConfig>({ questionnaireId: 'q-001', numberOfQuestions: 3 })
1397
1397
  .and<QuestionnaireLinkSent>({
@@ -1484,7 +1484,7 @@ narrative('Multi Given Flow', 'MULTI-GIVEN', () => {
1484
1484
  name: 'Database State Rules',
1485
1485
  rules: [
1486
1486
  {
1487
- id: 'AUTO-RefState',
1487
+ id: 'RefState',
1488
1488
  description: 'questionnaire config is available when referenced',
1489
1489
  examples: [
1490
1490
  {
@@ -1579,7 +1579,7 @@ narrative('Referenced States Flow', 'REF-STATES', () => {
1579
1579
  source().state('QuestionnaireConfig').fromDatabase('ConfigStore', { questionnaireId: '$questionnaireId' }),
1580
1580
  ]);
1581
1581
  specs('Database State Rules', () => {
1582
- rule('questionnaire config is available when referenced', 'AUTO-RefState', () => {
1582
+ rule('questionnaire config is available when referenced', 'RefState', () => {
1583
1583
  example('config from database is accessible')
1584
1584
  .given<QuestionnaireConfig>({
1585
1585
  questionnaireId: 'q-001',
@@ -1621,7 +1621,7 @@ narrative('Referenced States Flow', 'REF-STATES', () => {
1621
1621
  name: 'Date Field Rules',
1622
1622
  rules: [
1623
1623
  {
1624
- id: 'AUTO-DateRule',
1624
+ id: 'DateRule',
1625
1625
  description: 'handles Date fields correctly',
1626
1626
  examples: [
1627
1627
  {
@@ -1730,7 +1730,7 @@ type ProcessState = State<
1730
1730
  narrative('Date Handling Flow', 'DATE-FLOW', () => {
1731
1731
  query('date handling slice', 'DATE-SLICE').server(() => {
1732
1732
  specs('Date Field Rules', () => {
1733
- rule('handles Date fields correctly', 'AUTO-DateRule', () => {
1733
+ rule('handles Date fields correctly', 'DateRule', () => {
1734
1734
  example('event with Date fields')
1735
1735
  .given<TimestampedEvent>({
1736
1736
  id: 'event-123',
@@ -1762,7 +1762,7 @@ narrative('Date Handling Flow', 'DATE-FLOW', () => {
1762
1762
  slices: [
1763
1763
  {
1764
1764
  name: 'Active Surveys Summary',
1765
- id: 'AUTO-aifPcU3hw',
1765
+ id: 'aifPcU3hw',
1766
1766
  type: 'experience',
1767
1767
  client: {
1768
1768
  specs: [{ type: 'it', title: 'show active surveys summary' }],
@@ -1776,7 +1776,7 @@ narrative('Date Handling Flow', 'DATE-FLOW', () => {
1776
1776
  slices: [
1777
1777
  {
1778
1778
  name: 'Create Survey Form',
1779
- id: 'AUTO-MPviTMrQC',
1779
+ id: 'MPviTMrQC',
1780
1780
  type: 'experience',
1781
1781
  client: {
1782
1782
  specs: [{ type: 'it', title: 'allow entering survey title' }],
@@ -1790,7 +1790,7 @@ narrative('Date Handling Flow', 'DATE-FLOW', () => {
1790
1790
  slices: [
1791
1791
  {
1792
1792
  name: 'Response Rate Charts',
1793
- id: 'AUTO-eME978Euk',
1793
+ id: 'eME978Euk',
1794
1794
  type: 'experience',
1795
1795
  client: {
1796
1796
  specs: [{ type: 'it', title: 'show daily response rate charts' }],
@@ -1807,17 +1807,17 @@ narrative('Date Handling Flow', 'DATE-FLOW', () => {
1807
1807
 
1808
1808
  expect(code).toEqual(`import { experience, it, narrative } from '@auto-engineer/narrative';
1809
1809
  narrative('Home Screen', () => {
1810
- experience('Active Surveys Summary', 'AUTO-aifPcU3hw').client(() => {
1810
+ experience('Active Surveys Summary', 'aifPcU3hw').client(() => {
1811
1811
  it('show active surveys summary');
1812
1812
  });
1813
1813
  });
1814
1814
  narrative('Create Survey', () => {
1815
- experience('Create Survey Form', 'AUTO-MPviTMrQC').client(() => {
1815
+ experience('Create Survey Form', 'MPviTMrQC').client(() => {
1816
1816
  it('allow entering survey title');
1817
1817
  });
1818
1818
  });
1819
1819
  narrative('Response Analytics', () => {
1820
- experience('Response Rate Charts', 'AUTO-eME978Euk').client(() => {
1820
+ experience('Response Rate Charts', 'eME978Euk').client(() => {
1821
1821
  it('show daily response rate charts');
1822
1822
  });
1823
1823
  });
@@ -95,16 +95,16 @@ type QuestionnaireProgress = State<
95
95
  }
96
96
  >;
97
97
 
98
- flow('Questionnaires', 'AUTO-Q9m2Kp4Lx', () => {
99
- experience('Homepage', 'AUTO-H1a4Bn6Cy').client(() => {
98
+ flow('Questionnaires', 'Q9m2Kp4Lx', () => {
99
+ experience('Homepage', 'H1a4Bn6Cy').client(() => {
100
100
  it('show a hero section with a welcome message');
101
101
  it('allow user to start the questionnaire');
102
102
  });
103
103
 
104
- query('views the questionnaire', 'AUTO-V7n8Rq5M')
104
+ query('views the questionnaire', 'V7n8Rq5M')
105
105
  .server(() => {
106
106
  specs(() => {
107
- rule('questionnaires show current progress', 'AUTO-r1A3Bp9W', () => {
107
+ rule('questionnaires show current progress', 'r1A3Bp9W', () => {
108
108
  example('a question has already been answered')
109
109
  .given<QuestionnaireLinkSent>({
110
110
  questionnaireId: 'q-001',
@@ -170,10 +170,10 @@ flow('Questionnaires', 'AUTO-Q9m2Kp4Lx', () => {
170
170
  });
171
171
  });
172
172
 
173
- command('submits a questionnaire answer', 'AUTO-S4j6Nt8Z')
173
+ command('submits a questionnaire answer', 'S4j6Nt8Z')
174
174
  .server(() => {
175
175
  specs(() => {
176
- rule('answers are allowed while the questionnaire has not been submitted', 'AUTO-r2D5Eq0Y', () => {
176
+ rule('answers are allowed while the questionnaire has not been submitted', 'r2D5Eq0Y', () => {
177
177
  example('no questions have been answered yet')
178
178
  .when<AnswerQuestion>({
179
179
  questionnaireId: 'q-001',
@@ -228,10 +228,10 @@ flow('Questionnaires', 'AUTO-Q9m2Kp4Lx', () => {
228
228
  });
229
229
  });
230
230
 
231
- query('questionnaire ready for submission', 'AUTO-R3f7Hu1X')
231
+ query('questionnaire ready for submission', 'R3f7Hu1X')
232
232
  .server(() => {
233
233
  specs(() => {
234
- rule('questionnaire is ready for submission when all questions are answered', 'AUTO-r3G8Iv2W', () => {
234
+ rule('questionnaire is ready for submission when all questions are answered', 'r3G8Iv2W', () => {
235
235
  example('all questions have been answered')
236
236
  .given<QuestionnaireConfig>({
237
237
  questionnaireId: 'q-001',
@@ -319,10 +319,10 @@ flow('Questionnaires', 'AUTO-Q9m2Kp4Lx', () => {
319
319
  });
320
320
  });
321
321
 
322
- command('submits the questionnaire', 'AUTO-T5k9Jw3V')
322
+ command('submits the questionnaire', 'T5k9Jw3V')
323
323
  .server(() => {
324
324
  specs(() => {
325
- rule('questionnaire allowed to be submitted when all questions are answered', 'AUTO-r4H0Lx4U', () => {
325
+ rule('questionnaire allowed to be submitted when all questions are answered', 'r4H0Lx4U', () => {
326
326
  example('submits the questionnaire successfully')
327
327
  .when<SubmitQuestionnaire>({
328
328
  questionnaireId: 'q-001',