@auto-engineer/server-generator-apollo-emmett 1.110.4 → 1.110.6
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/.turbo/turbo-test.log +5 -5
- package/.turbo/turbo-type-check.log +1 -1
- package/CHANGELOG.md +57 -0
- package/dist/src/codegen/templates/command/decide.specs.ts +12 -8
- package/dist/src/codegen/templates/command/decide.specs.ts.ejs +6 -1
- package/dist/src/codegen/templates/command/decide.ts.ejs +3 -2
- package/dist/src/codegen/templates/command/evolve.specs.ts +5 -0
- package/dist/src/codegen/templates/command/evolve.ts.ejs +5 -0
- package/dist/src/codegen/templates/query/projection.specs.specs.ts +228 -5
- package/dist/src/codegen/templates/query/projection.specs.ts +24 -3
- package/dist/src/codegen/templates/query/projection.specs.ts.ejs +15 -5
- package/dist/src/codegen/templates/query/projection.ts.ejs +9 -3
- package/dist/src/codegen/templates/query/query.resolver.specs.ts +4 -4
- package/dist/src/codegen/templates/query/query.resolver.ts.ejs +1 -1
- package/dist/src/codegen/templates/react/react.specs.ts +7 -0
- package/dist/src/codegen/templates/react/react.ts.ejs +7 -0
- package/dist/src/codegen/templates/react/register.specs.ts +6 -0
- package/dist/src/codegen/templates/react/register.ts.ejs +6 -0
- package/ketchup-plan.md +5 -0
- package/package.json +4 -4
- package/src/codegen/templates/command/decide.specs.ts +12 -8
- package/src/codegen/templates/command/decide.specs.ts.ejs +6 -1
- package/src/codegen/templates/command/decide.ts.ejs +3 -2
- package/src/codegen/templates/command/evolve.specs.ts +5 -0
- package/src/codegen/templates/command/evolve.ts.ejs +5 -0
- package/src/codegen/templates/query/projection.specs.specs.ts +228 -5
- package/src/codegen/templates/query/projection.specs.ts +24 -3
- package/src/codegen/templates/query/projection.specs.ts.ejs +15 -5
- package/src/codegen/templates/query/projection.ts.ejs +9 -3
- package/src/codegen/templates/query/query.resolver.specs.ts +4 -4
- package/src/codegen/templates/query/query.resolver.ts.ejs +1 -1
- package/src/codegen/templates/react/react.specs.ts +7 -0
- package/src/codegen/templates/react/react.ts.ejs +7 -0
- package/src/codegen/templates/react/register.specs.ts +6 -0
- package/src/codegen/templates/react/register.ts.ejs +6 -0
|
@@ -277,13 +277,23 @@ if (isCompositeKey) {
|
|
|
277
277
|
}
|
|
278
278
|
%>
|
|
279
279
|
|
|
280
|
-
|
|
281
|
-
|
|
280
|
+
<%
|
|
281
|
+
const stateKeys = Object.keys(expectedState.exampleData || {});
|
|
282
|
+
const queryArgs = isQueryActionTest
|
|
283
|
+
? (testCase.when?.args
|
|
284
|
+
|| (Array.isArray(testCase.when) && testCase.when[0]?.exampleData)
|
|
285
|
+
|| {})
|
|
286
|
+
: {};
|
|
287
|
+
const queryArgKeys = new Set(Object.keys(queryArgs));
|
|
288
|
+
const assertionKeys = stateKeys.filter(k => !queryArgKeys.has(k));
|
|
282
289
|
const stateMessage = messages.find(m => m.name === targetName);
|
|
283
|
-
|
|
284
|
-
|
|
290
|
+
const isPartial = assertionKeys.length < stateKeys.length;
|
|
291
|
+
-%>
|
|
292
|
+
const expected<%= isPartial ? '' : `: ${TargetType}` %> = {
|
|
293
|
+
<% for (let i = 0; i < assertionKeys.length; i++) {
|
|
294
|
+
const key = assertionKeys[i];
|
|
285
295
|
const value = expectedState.exampleData[key];
|
|
286
|
-
const isLast = i ===
|
|
296
|
+
const isLast = i === assertionKeys.length - 1;
|
|
287
297
|
const field = stateMessage?.fields?.find(f => f.name === key);
|
|
288
298
|
const tsType = field?.tsType || field?.type || 'string';
|
|
289
299
|
const formattedValue = formatSpecValue(value, tsType);
|
|
@@ -132,6 +132,11 @@ case '<%= event.type %>': {
|
|
|
132
132
|
* Preserve all import paths above — they are generated from the model.
|
|
133
133
|
* ⚠️ `document` may be null (first event for this entity). Guard before accessing properties.
|
|
134
134
|
*
|
|
135
|
+
* CONSTRAINTS:
|
|
136
|
+
* - NEVER use `as SomeType` type assertions. Declare typed variables instead: `const x: Type = value;`
|
|
137
|
+
* - Only reference event.data fields listed in the "Event fields:" line below.
|
|
138
|
+
* - Do NOT modify anything outside this case block: imports, type parameters, canHandle, collectionName, and getDocumentId are auto-generated.
|
|
139
|
+
*
|
|
135
140
|
<% if (isSingleton) { -%>
|
|
136
141
|
* **SINGLETON AGGREGATION PATTERN**
|
|
137
142
|
*
|
|
@@ -188,11 +193,12 @@ case '<%= event.type %>': {
|
|
|
188
193
|
* internalField: SomeType;
|
|
189
194
|
* }
|
|
190
195
|
*
|
|
191
|
-
* 2.
|
|
196
|
+
* 2. Assign document to extended type:
|
|
192
197
|
* const current: Internal<%= pascalCase(targetName || 'State') %> = document ?? { ...defaults };
|
|
193
198
|
*
|
|
194
|
-
* 3.
|
|
195
|
-
*
|
|
199
|
+
* 3. Return via typed variable (preserves internal state for next event):
|
|
200
|
+
* const result: Internal<%= pascalCase(targetName || 'State') %> = { ...allFields, internalField };
|
|
201
|
+
* return result;
|
|
196
202
|
*
|
|
197
203
|
* This keeps internal state separate from the public GraphQL schema.
|
|
198
204
|
<% } -%>
|
|
@@ -114,9 +114,9 @@ describe('query.resolver.ts.ejs', () => {
|
|
|
114
114
|
return model.find((item) => {
|
|
115
115
|
if (location !== undefined && item.location !== location) return false;
|
|
116
116
|
|
|
117
|
-
//
|
|
117
|
+
// NOTE: 'maxPrice' has no matching field on the state type — add custom filter logic if needed.
|
|
118
118
|
|
|
119
|
-
//
|
|
119
|
+
// NOTE: 'minGuests' has no matching field on the state type — add custom filter logic if needed.
|
|
120
120
|
|
|
121
121
|
return true;
|
|
122
122
|
});
|
|
@@ -935,7 +935,7 @@ describe('query.resolver.ts.ejs', () => {
|
|
|
935
935
|
// If this query should return a single item, switch to findOne().
|
|
936
936
|
|
|
937
937
|
return model.find((item) => {
|
|
938
|
-
//
|
|
938
|
+
// NOTE: 'pantryId' has no matching field on the state type — add custom filter logic if needed.
|
|
939
939
|
|
|
940
940
|
return true;
|
|
941
941
|
});
|
|
@@ -1177,7 +1177,7 @@ describe('query.resolver.ts.ejs', () => {
|
|
|
1177
1177
|
// If this query should return a single item, switch to findOne().
|
|
1178
1178
|
|
|
1179
1179
|
return model.find((item) => {
|
|
1180
|
-
//
|
|
1180
|
+
// NOTE: 'pantryId' has no matching field on the state type — add custom filter logic if needed.
|
|
1181
1181
|
|
|
1182
1182
|
return true;
|
|
1183
1183
|
});
|
|
@@ -170,7 +170,7 @@ return model.find((<%= hasArgs ? 'item' : '_item' %>) => {
|
|
|
170
170
|
if (stateFieldNames.has(arg.name)) { %>
|
|
171
171
|
if (<%= arg.name %> !== undefined && item.<%= arg.name %> !== <%= arg.name %>) return false;
|
|
172
172
|
<% } else { %>
|
|
173
|
-
//
|
|
173
|
+
// NOTE: '<%= arg.name %>' has no matching field on the state type — add custom filter logic if needed.
|
|
174
174
|
<% }
|
|
175
175
|
}
|
|
176
176
|
} %>
|
|
@@ -256,6 +256,13 @@ describe('handle.ts.ejs (react slice)', () => {
|
|
|
256
256
|
* NEVER hardcode values copied from test assertions.
|
|
257
257
|
*
|
|
258
258
|
* Preserve all import paths above — they are generated from the model.
|
|
259
|
+
*
|
|
260
|
+
* CONSTRAINTS:
|
|
261
|
+
* - NEVER use \`as SomeType\` type assertions. Use typed variable declarations.
|
|
262
|
+
* - Only reference event.data fields listed in the "Event fields:" comment below. Check the type before accessing any field.
|
|
263
|
+
* - Do NOT modify the inMemoryReactor configuration, connectionOptions, import statements, or commandSender.send() call structure. Only fill in data fields marked TODO.
|
|
264
|
+
* - When event.data contains nested arrays/objects (e.g., exercises[].sets[]), iterate them to compute values. Do NOT cast arrays/objects to primitive types.
|
|
265
|
+
*
|
|
259
266
|
* Add business logic (validation, conditional sends) as needed.
|
|
260
267
|
*/
|
|
261
268
|
|
|
@@ -60,6 +60,13 @@ const willHaveAggregateStream = states.some(state =>
|
|
|
60
60
|
<% if (willHaveAggregateStream) { -%>
|
|
61
61
|
* Do NOT modify or remove aggregateStream calls — they load required state.
|
|
62
62
|
<% } -%>
|
|
63
|
+
*
|
|
64
|
+
* CONSTRAINTS:
|
|
65
|
+
* - NEVER use `as SomeType` type assertions. Use typed variable declarations.
|
|
66
|
+
* - Only reference event.data fields listed in the "Event fields:" comment below. Check the type before accessing any field.
|
|
67
|
+
* - Do NOT modify the inMemoryReactor configuration, connectionOptions, import statements, or commandSender.send() call structure. Only fill in data fields marked TODO.
|
|
68
|
+
* - When event.data contains nested arrays/objects (e.g., exercises[].sets[]), iterate them to compute values. Do NOT cast arrays/objects to primitive types.
|
|
69
|
+
*
|
|
63
70
|
* Add business logic (validation, conditional sends) as needed.
|
|
64
71
|
*/
|
|
65
72
|
<%
|
|
@@ -246,6 +246,12 @@ describe('register.ts.ejs (react slice)', () => {
|
|
|
246
246
|
* evolve: (s: Record<string, unknown>, e: { type: string; data: Record<string, unknown> }) => ...
|
|
247
247
|
* - NEVER hardcode values copied from test assertions.
|
|
248
248
|
* - Preserve all import paths above — they are generated from the model.
|
|
249
|
+
*
|
|
250
|
+
* CONSTRAINTS:
|
|
251
|
+
* - NEVER use \`as SomeType\` type assertions. Use typed variable declarations.
|
|
252
|
+
* - Only reference fields that exist on the event type (BookingRequested). Check the import above.
|
|
253
|
+
* - Do NOT modify the messageBus.subscribe() call, function signature, or import statements.
|
|
254
|
+
* - When event.data contains nested arrays/objects, iterate them. Do NOT cast to primitive types.
|
|
249
255
|
*/
|
|
250
256
|
|
|
251
257
|
// await messageBus.send({
|
|
@@ -38,6 +38,12 @@ async (event: <%= pascalCase(eventType) %>) => {
|
|
|
38
38
|
* evolve: (s: Record<string, unknown>, e: { type: string; data: Record<string, unknown> }) => ...
|
|
39
39
|
* - NEVER hardcode values copied from test assertions.
|
|
40
40
|
* - Preserve all import paths above — they are generated from the model.
|
|
41
|
+
*
|
|
42
|
+
* CONSTRAINTS:
|
|
43
|
+
* - NEVER use `as SomeType` type assertions. Use typed variable declarations.
|
|
44
|
+
* - Only reference fields that exist on the event type (<%= pascalCase(eventType) %>). Check the import above.
|
|
45
|
+
* - Do NOT modify the messageBus.subscribe() call, function signature, or import statements.
|
|
46
|
+
* - When event.data contains nested arrays/objects, iterate them. Do NOT cast to primitive types.
|
|
41
47
|
*/
|
|
42
48
|
|
|
43
49
|
// await messageBus.send({
|