@auto-engineer/server-generator-apollo-emmett 0.2.0 → 0.8.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 (76) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-test.log +5 -108
  3. package/.turbo/turbo-type-check.log +1 -1
  4. package/CHANGELOG.md +7 -0
  5. package/dist/codegen/extract/commands.d.ts +11 -5
  6. package/dist/codegen/extract/commands.d.ts.map +1 -1
  7. package/dist/codegen/extract/commands.js +27 -12
  8. package/dist/codegen/extract/commands.js.map +1 -1
  9. package/dist/codegen/extract/data-sink.d.ts.map +1 -1
  10. package/dist/codegen/extract/data-sink.js +52 -28
  11. package/dist/codegen/extract/data-sink.js.map +1 -1
  12. package/dist/codegen/extract/gwt.d.ts.map +1 -1
  13. package/dist/codegen/extract/gwt.js +37 -6
  14. package/dist/codegen/extract/gwt.js.map +1 -1
  15. package/dist/codegen/extract/messages.d.ts.map +1 -1
  16. package/dist/codegen/extract/messages.js +38 -6
  17. package/dist/codegen/extract/messages.js.map +1 -1
  18. package/dist/codegen/extract/query.d.ts.map +1 -1
  19. package/dist/codegen/extract/query.js +9 -2
  20. package/dist/codegen/extract/query.js.map +1 -1
  21. package/dist/codegen/scaffoldFromSchema.d.ts.map +1 -1
  22. package/dist/codegen/scaffoldFromSchema.js +21 -6
  23. package/dist/codegen/scaffoldFromSchema.js.map +1 -1
  24. package/dist/codegen/templates/command/commands.specs.ts +28 -19
  25. package/dist/codegen/templates/command/decide.specs.specs.ts +75 -57
  26. package/dist/codegen/templates/command/decide.specs.ts +147 -110
  27. package/dist/codegen/templates/command/events.specs.ts +38 -29
  28. package/dist/codegen/templates/command/evolve.specs.ts +33 -24
  29. package/dist/codegen/templates/command/handle.specs.ts +61 -43
  30. package/dist/codegen/templates/command/mutation.resolver.specs.ts +28 -19
  31. package/dist/codegen/templates/command/register.specs.ts +34 -25
  32. package/dist/codegen/templates/command/state.specs.ts +34 -25
  33. package/dist/codegen/templates/query/projection.specs.specs..ts +100 -80
  34. package/dist/codegen/templates/query/projection.specs.ts +101 -81
  35. package/dist/codegen/templates/query/query.resolver.specs.ts +2 -2
  36. package/dist/codegen/templates/query/state.specs.ts +1 -1
  37. package/dist/codegen/templates/react/react.specs.specs.ts +86 -68
  38. package/dist/codegen/templates/react/react.specs.ts +123 -96
  39. package/dist/codegen/templates/react/react.specs.ts.ejs +9 -1
  40. package/dist/codegen/templates/react/react.ts.ejs +8 -1
  41. package/dist/codegen/templates/react/register.specs.ts +123 -96
  42. package/dist/codegen/templates/react/register.ts.ejs +8 -1
  43. package/dist/codegen/test-data/specVariant1.d.ts.map +1 -1
  44. package/dist/codegen/test-data/specVariant1.js +92 -65
  45. package/dist/codegen/test-data/specVariant1.js.map +1 -1
  46. package/dist/codegen/types.d.ts +4 -4
  47. package/dist/codegen/types.d.ts.map +1 -1
  48. package/package.json +9 -9
  49. package/src/codegen/extract/commands.ts +48 -19
  50. package/src/codegen/extract/data-sink.ts +68 -31
  51. package/src/codegen/extract/gwt.ts +45 -10
  52. package/src/codegen/extract/messages.ts +49 -7
  53. package/src/codegen/extract/query.ts +15 -2
  54. package/src/codegen/scaffoldFromSchema.ts +27 -6
  55. package/src/codegen/templates/command/commands.specs.ts +28 -19
  56. package/src/codegen/templates/command/decide.specs.specs.ts +75 -57
  57. package/src/codegen/templates/command/decide.specs.ts +147 -110
  58. package/src/codegen/templates/command/events.specs.ts +38 -29
  59. package/src/codegen/templates/command/evolve.specs.ts +33 -24
  60. package/src/codegen/templates/command/handle.specs.ts +61 -43
  61. package/src/codegen/templates/command/mutation.resolver.specs.ts +28 -19
  62. package/src/codegen/templates/command/register.specs.ts +34 -25
  63. package/src/codegen/templates/command/state.specs.ts +34 -25
  64. package/src/codegen/templates/query/projection.specs.specs..ts +100 -80
  65. package/src/codegen/templates/query/projection.specs.ts +101 -81
  66. package/src/codegen/templates/query/query.resolver.specs.ts +2 -2
  67. package/src/codegen/templates/query/state.specs.ts +1 -1
  68. package/src/codegen/templates/react/react.specs.specs.ts +86 -68
  69. package/src/codegen/templates/react/react.specs.ts +123 -96
  70. package/src/codegen/templates/react/react.specs.ts.ejs +9 -1
  71. package/src/codegen/templates/react/react.ts.ejs +8 -1
  72. package/src/codegen/templates/react/register.specs.ts +123 -96
  73. package/src/codegen/templates/react/register.ts.ejs +8 -1
  74. package/src/codegen/test-data/specVariant1.ts +92 -65
  75. package/src/codegen/types.ts +4 -4
  76. package/tsconfig.tsbuildinfo +1 -1
@@ -20,32 +20,41 @@ describe('generateScaffoldFilePlans', () => {
20
20
  },
21
21
  server: {
22
22
  description: 'test',
23
- gwt: [
24
- {
25
- when: {
26
- commandRef: 'CreateListing',
27
- exampleData: {
28
- propertyId: 'listing_123',
29
- title: 'Modern Downtown Apartment',
30
- listedAt: '2024-01-15T10:00:00Z',
31
- rating: 4.8,
32
- metadata: { foo: 'bar' },
33
- },
34
- },
35
- then: [
36
- {
37
- eventRef: 'ListingCreated',
38
- exampleData: {
39
- propertyId: 'listing_123',
40
- title: 'Modern Downtown Apartment',
41
- listedAt: '2024-01-15T10:00:00Z',
42
- rating: 4.8,
43
- metadata: { foo: 'bar' },
23
+ specs: {
24
+ name: 'Create listing command',
25
+ rules: [
26
+ {
27
+ description: 'Should create listing successfully',
28
+ examples: [
29
+ {
30
+ description: 'User creates listing with valid data',
31
+ when: {
32
+ commandRef: 'CreateListing',
33
+ exampleData: {
34
+ propertyId: 'listing_123',
35
+ title: 'Modern Downtown Apartment',
36
+ listedAt: '2024-01-15T10:00:00Z',
37
+ rating: 4.8,
38
+ metadata: { foo: 'bar' },
39
+ },
40
+ },
41
+ then: [
42
+ {
43
+ eventRef: 'ListingCreated',
44
+ exampleData: {
45
+ propertyId: 'listing_123',
46
+ title: 'Modern Downtown Apartment',
47
+ listedAt: '2024-01-15T10:00:00Z',
48
+ rating: 4.8,
49
+ metadata: { foo: 'bar' },
50
+ },
51
+ },
52
+ ],
44
53
  },
45
- },
46
- ],
47
- },
48
- ],
54
+ ],
55
+ },
56
+ ],
57
+ },
49
58
  data: [
50
59
  {
51
60
  target: {
@@ -19,32 +19,41 @@ describe('state.ts.ejs', () => {
19
19
  },
20
20
  server: {
21
21
  description: 'test',
22
- gwt: [
23
- {
24
- when: {
25
- commandRef: 'CreateListing',
26
- exampleData: {
27
- propertyId: 'listing_123',
28
- title: 'nice apartment',
29
- pricePerNight: 250,
30
- available: true,
31
- rating: 4.8,
32
- metadata: { foo: 'bar' },
33
- },
34
- },
35
- then: [
36
- {
37
- eventRef: 'ListingCreated',
38
- exampleData: {
39
- propertyId: 'listing_123',
40
- listedAt: '2024-01-15T10:00:00Z',
41
- rating: 4.8,
42
- metadata: { foo: 'bar' },
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: 'nice apartment',
35
+ pricePerNight: 250,
36
+ available: true,
37
+ rating: 4.8,
38
+ metadata: { foo: 'bar' },
39
+ },
40
+ },
41
+ then: [
42
+ {
43
+ eventRef: 'ListingCreated',
44
+ exampleData: {
45
+ propertyId: 'listing_123',
46
+ listedAt: '2024-01-15T10:00:00Z',
47
+ rating: 4.8,
48
+ metadata: { foo: 'bar' },
49
+ },
50
+ },
51
+ ],
43
52
  },
44
- },
45
- ],
46
- },
47
- ],
53
+ ],
54
+ },
55
+ ],
56
+ },
48
57
  },
49
58
  },
50
59
  ],
@@ -17,46 +17,56 @@ describe('projection.specs.ts.ejs', () => {
17
17
  client: { description: '', specs: [] },
18
18
  server: {
19
19
  description: '',
20
- gwt: [
21
- {
22
- when: {
23
- commandRef: 'CreateListing',
24
- exampleData: {
25
- propertyId: 'listing_123',
26
- title: 'Sea View Flat',
27
- pricePerNight: 120,
28
- location: 'Brighton',
29
- maxGuests: 4,
30
- },
31
- },
32
- then: [
33
- {
34
- eventRef: 'ListingCreated',
35
- exampleData: {
36
- propertyId: 'listing_123',
37
- title: 'Sea View Flat',
38
- pricePerNight: 120,
39
- location: 'Brighton',
40
- maxGuests: 4,
20
+ specs: {
21
+ name: 'CreateListing command',
22
+ rules: [
23
+ {
24
+ description: 'Should handle listing operations',
25
+ examples: [
26
+ {
27
+ description: 'User creates listing successfully',
28
+ when: {
29
+ commandRef: 'CreateListing',
30
+ exampleData: {
31
+ propertyId: 'listing_123',
32
+ title: 'Sea View Flat',
33
+ pricePerNight: 120,
34
+ location: 'Brighton',
35
+ maxGuests: 4,
36
+ },
37
+ },
38
+ then: [
39
+ {
40
+ eventRef: 'ListingCreated',
41
+ exampleData: {
42
+ propertyId: 'listing_123',
43
+ title: 'Sea View Flat',
44
+ pricePerNight: 120,
45
+ location: 'Brighton',
46
+ maxGuests: 4,
47
+ },
48
+ },
49
+ ],
41
50
  },
42
- },
43
- ],
44
- },
45
- {
46
- when: {
47
- commandRef: 'RemoveListing',
48
- exampleData: {
49
- propertyId: 'listing_123',
50
- },
51
+ {
52
+ description: 'User removes listing successfully',
53
+ when: {
54
+ commandRef: 'RemoveListing',
55
+ exampleData: {
56
+ propertyId: 'listing_123',
57
+ },
58
+ },
59
+ then: [
60
+ {
61
+ eventRef: 'ListingRemoved',
62
+ exampleData: {},
63
+ },
64
+ ],
65
+ },
66
+ ],
51
67
  },
52
- then: [
53
- {
54
- eventRef: 'ListingRemoved',
55
- exampleData: {},
56
- },
57
- ],
58
- },
59
- ],
68
+ ],
69
+ },
60
70
  },
61
71
  },
62
72
  {
@@ -79,50 +89,60 @@ describe('projection.specs.ts.ejs', () => {
79
89
  },
80
90
  },
81
91
  ],
82
- gwt: [
83
- {
84
- given: [
85
- {
86
- eventRef: 'ListingCreated',
87
- exampleData: {
88
- propertyId: 'listing_123',
89
- title: 'Sea View Flat',
90
- pricePerNight: 120,
91
- location: 'Brighton',
92
- maxGuests: 4,
93
- },
94
- },
95
- ],
96
- then: [
97
- {
98
- stateRef: 'AvailableListings',
99
- exampleData: {
100
- propertyId: 'listing_123',
101
- title: 'Sea View Flat',
102
- pricePerNight: 120,
103
- location: 'Brighton',
104
- maxGuests: 4,
92
+ specs: {
93
+ name: 'Search listings query',
94
+ rules: [
95
+ {
96
+ description: 'Should project listings correctly',
97
+ examples: [
98
+ {
99
+ description: 'Listing created shows in search results',
100
+ when: [
101
+ {
102
+ eventRef: 'ListingCreated',
103
+ exampleData: {
104
+ propertyId: 'listing_123',
105
+ title: 'Sea View Flat',
106
+ pricePerNight: 120,
107
+ location: 'Brighton',
108
+ maxGuests: 4,
109
+ },
110
+ },
111
+ ],
112
+ then: [
113
+ {
114
+ stateRef: 'AvailableListings',
115
+ exampleData: {
116
+ propertyId: 'listing_123',
117
+ title: 'Sea View Flat',
118
+ pricePerNight: 120,
119
+ location: 'Brighton',
120
+ maxGuests: 4,
121
+ },
122
+ },
123
+ ],
105
124
  },
106
- },
107
- ],
108
- },
109
- {
110
- given: [
111
- {
112
- eventRef: 'ListingRemoved',
113
- exampleData: {
114
- propertyId: 'listing_123',
125
+ {
126
+ description: 'Listing removed disappears from search results',
127
+ when: [
128
+ {
129
+ eventRef: 'ListingRemoved',
130
+ exampleData: {
131
+ propertyId: 'listing_123',
132
+ },
133
+ },
134
+ ],
135
+ then: [
136
+ {
137
+ stateRef: 'AvailableListings',
138
+ exampleData: {},
139
+ },
140
+ ],
115
141
  },
116
- },
117
- ],
118
- then: [
119
- {
120
- stateRef: 'AvailableListings',
121
- exampleData: {},
122
- },
123
- ],
124
- },
125
- ],
142
+ ],
143
+ },
144
+ ],
145
+ },
126
146
  },
127
147
  },
128
148
  ],
@@ -20,46 +20,56 @@ describe('projection.ts.ejs', () => {
20
20
  },
21
21
  server: {
22
22
  description: 'handles create/remove listing',
23
- gwt: [
24
- {
25
- when: {
26
- commandRef: 'CreateListing',
27
- exampleData: {
28
- propertyId: 'listing_123',
29
- title: 'Sea View Flat',
30
- pricePerNight: 120,
31
- location: 'Brighton',
32
- maxGuests: 4,
33
- },
34
- },
35
- then: [
36
- {
37
- eventRef: 'ListingCreated',
38
- exampleData: {
39
- propertyId: 'listing_123',
40
- title: 'Sea View Flat',
41
- pricePerNight: 120,
42
- location: 'Brighton',
43
- maxGuests: 4,
23
+ specs: {
24
+ name: 'Create/remove listing command',
25
+ rules: [
26
+ {
27
+ description: 'Should handle listing operations',
28
+ examples: [
29
+ {
30
+ description: 'User creates listing successfully',
31
+ when: {
32
+ commandRef: 'CreateListing',
33
+ exampleData: {
34
+ propertyId: 'listing_123',
35
+ title: 'Sea View Flat',
36
+ pricePerNight: 120,
37
+ location: 'Brighton',
38
+ maxGuests: 4,
39
+ },
40
+ },
41
+ then: [
42
+ {
43
+ eventRef: 'ListingCreated',
44
+ exampleData: {
45
+ propertyId: 'listing_123',
46
+ title: 'Sea View Flat',
47
+ pricePerNight: 120,
48
+ location: 'Brighton',
49
+ maxGuests: 4,
50
+ },
51
+ },
52
+ ],
44
53
  },
45
- },
46
- ],
47
- },
48
- {
49
- when: {
50
- commandRef: 'RemoveListing',
51
- exampleData: {
52
- propertyId: 'listing_123',
53
- },
54
+ {
55
+ description: 'User removes listing successfully',
56
+ when: {
57
+ commandRef: 'RemoveListing',
58
+ exampleData: {
59
+ propertyId: 'listing_123',
60
+ },
61
+ },
62
+ then: [
63
+ {
64
+ eventRef: 'ListingRemoved',
65
+ exampleData: {},
66
+ },
67
+ ],
68
+ },
69
+ ],
54
70
  },
55
- then: [
56
- {
57
- eventRef: 'ListingRemoved',
58
- exampleData: {},
59
- },
60
- ],
61
- },
62
- ],
71
+ ],
72
+ },
63
73
  },
64
74
  },
65
75
  {
@@ -85,50 +95,60 @@ describe('projection.ts.ejs', () => {
85
95
  },
86
96
  },
87
97
  ],
88
- gwt: [
89
- {
90
- given: [
91
- {
92
- eventRef: 'ListingCreated',
93
- exampleData: {
94
- propertyId: 'listing_123',
95
- title: 'Sea View Flat',
96
- pricePerNight: 120,
97
- location: 'Brighton',
98
- maxGuests: 4,
99
- },
100
- },
101
- ],
102
- then: [
103
- {
104
- stateRef: 'AvailableListings',
105
- exampleData: {
106
- propertyId: 'listing_123',
107
- title: 'Sea View Flat',
108
- pricePerNight: 120,
109
- location: 'Brighton',
110
- maxGuests: 4,
98
+ specs: {
99
+ name: 'Search listings query',
100
+ rules: [
101
+ {
102
+ description: 'Should project listings correctly',
103
+ examples: [
104
+ {
105
+ description: 'Listing created shows in search results',
106
+ when: [
107
+ {
108
+ eventRef: 'ListingCreated',
109
+ exampleData: {
110
+ propertyId: 'listing_123',
111
+ title: 'Sea View Flat',
112
+ pricePerNight: 120,
113
+ location: 'Brighton',
114
+ maxGuests: 4,
115
+ },
116
+ },
117
+ ],
118
+ then: [
119
+ {
120
+ stateRef: 'AvailableListings',
121
+ exampleData: {
122
+ propertyId: 'listing_123',
123
+ title: 'Sea View Flat',
124
+ pricePerNight: 120,
125
+ location: 'Brighton',
126
+ maxGuests: 4,
127
+ },
128
+ },
129
+ ],
111
130
  },
112
- },
113
- ],
114
- },
115
- {
116
- given: [
117
- {
118
- eventRef: 'ListingRemoved',
119
- exampleData: {
120
- propertyId: 'listing_123',
131
+ {
132
+ description: 'Listing removed disappears from search results',
133
+ when: [
134
+ {
135
+ eventRef: 'ListingRemoved',
136
+ exampleData: {
137
+ propertyId: 'listing_123',
138
+ },
139
+ },
140
+ ],
141
+ then: [
142
+ {
143
+ stateRef: 'AvailableListings',
144
+ exampleData: {},
145
+ },
146
+ ],
121
147
  },
122
- },
123
- ],
124
- then: [
125
- {
126
- stateRef: 'AvailableListings',
127
- exampleData: {},
128
- },
129
- ],
130
- },
131
- ],
148
+ ],
149
+ },
150
+ ],
151
+ },
132
152
  },
133
153
  },
134
154
  ],
@@ -279,7 +299,7 @@ describe('projection.ts.ejs', () => {
279
299
  },
280
300
  },
281
301
  ],
282
- gwt: [],
302
+ specs: { name: '', rules: [] },
283
303
  },
284
304
  },
285
305
  ],
@@ -43,7 +43,7 @@ describe('query.resolver.ts.ejs', () => {
43
43
  },
44
44
  },
45
45
  ],
46
- gwt: [],
46
+ specs: { name: '', rules: [] },
47
47
  },
48
48
  },
49
49
  ],
@@ -166,7 +166,7 @@ describe('query.resolver.ts.ejs', () => {
166
166
  },
167
167
  },
168
168
  ],
169
- gwt: [],
169
+ specs: { name: '', rules: [] },
170
170
  },
171
171
  },
172
172
  ],
@@ -32,7 +32,7 @@ describe('state.ts.ejs', () => {
32
32
  },
33
33
  },
34
34
  ],
35
- gwt: [],
35
+ specs: { name: '', rules: [] },
36
36
  },
37
37
  },
38
38
  ],