@auto-engineer/server-generator-nestjs 1.87.0 → 1.89.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/CHANGELOG.md CHANGED
@@ -1,5 +1,100 @@
1
1
  # @auto-engineer/server-generator-nestjs
2
2
 
3
+ ## 1.89.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`93ff5a5`](https://github.com/BeOnAuto/auto-engineer/commit/93ff5a559f087bb875b2b1e165713e1dc6fbea5b) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-generator-apollo-emmett**: embed instructions in scaffold templates
8
+
9
+ - [`514525d`](https://github.com/BeOnAuto/auto-engineer/commit/514525d0ae9542693fc44e6922fd0c31d229c8c9) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **narrative**: export validateSliceRequests and add integration tests
10
+
11
+ - [`7af6ae4`](https://github.com/BeOnAuto/auto-engineer/commit/7af6ae46d50a7115da047d07824a4d3e4983338f) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **narrative**: add nested field validation for query slice requests
12
+
13
+ - [`971394a`](https://github.com/BeOnAuto/auto-engineer/commit/971394ad8d47faad27acf6c4fa82d11010568cda) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-generator-apollo-emmett**: type-annotate aggregateStream + dynamic error listing
14
+
15
+ - [`dbfbe69`](https://github.com/BeOnAuto/auto-engineer/commit/dbfbe69e5fc1efb8a65df1d3d480b36c9666b95a) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **narrative**: add validate-slice-requests skeleton with parse safety
16
+
17
+ - [`d7b3af9`](https://github.com/BeOnAuto/auto-engineer/commit/d7b3af912b1e9f7e4f0bfc91b65768341f87229c) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **narrative**: add query validation for operation type, state, and top-level fields
18
+
19
+ - [`a36fc79`](https://github.com/BeOnAuto/auto-engineer/commit/a36fc79f40d236b49983574a7f8607e9028e3daf) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-generator-apollo-emmett**: filter linking field to primitive types only
20
+
21
+ - [`73ef7b1`](https://github.com/BeOnAuto/auto-engineer/commit/73ef7b1f2818e72cc5b1cc77400f44ed948e0d39) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-generator-apollo-emmett**: filter event And-steps from react Then items
22
+
23
+ - [`ea41643`](https://github.com/BeOnAuto/auto-engineer/commit/ea41643cbd1303f50313e7dd20d92d4f3a775114) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-generator-apollo-emmett**: use parsedRequest for command mutation names
24
+
25
+ - [`3e9cf93`](https://github.com/BeOnAuto/auto-engineer/commit/3e9cf93af40df9636ae33b9e749dd85ca0b0802e) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-generator-apollo-emmett**: add expectEvents typing shim to decide.specs.ts.ejs
26
+
27
+ - [`0231c5f`](https://github.com/BeOnAuto/auto-engineer/commit/0231c5f5a771786d6534c8a0f9d6dd2856d6b893) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **narrative**: parseGraphQlRequest accepts mutation operations
28
+
29
+ - [`aacffe9`](https://github.com/BeOnAuto/auto-engineer/commit/aacffe9244a1b364f550caf9b0d5d9ce9c905c2c) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-generator-nestjs**: use parsedRequest for mutation and query names
30
+
31
+ - [`a527ccc`](https://github.com/BeOnAuto/auto-engineer/commit/a527ccc39d7f769609252ebefcb4b26e5fe84316) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **narrative**: add mutation validation to validate-slice-requests
32
+
33
+ ### Patch Changes
34
+
35
+ - [`dc9b7d9`](https://github.com/BeOnAuto/auto-engineer/commit/dc9b7d9cbcebaf5e34025b6f08b9152f87a67073) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-generator-apollo-emmett**: update ketchup plan for bursts 13-14
36
+
37
+ - [`1d1f519`](https://github.com/BeOnAuto/auto-engineer/commit/1d1f519fa17ba95228e58ef12ce64e3919c0697d) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **narrative**: add ketchup plan for validate-slice-requests
38
+
39
+ - [`8bbbc30`](https://github.com/BeOnAuto/auto-engineer/commit/8bbbc309734ff5dce3b51473f018caa31208fa7a) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-generator-apollo-emmett**: mark burst 18 done in ketchup plan
40
+
41
+ - [`aabe8ae`](https://github.com/BeOnAuto/auto-engineer/commit/aabe8ae4feb13e8ee4b6d3e8a7ef50bb845eaebf) Thanks [@github-actions[bot]](https://github.com/github-actions%5Bbot%5D)! - - **server-generator-apollo-emmett**: derive stable metadata.now for ISO date fields
42
+ - **server-generator-apollo-emmett**: resolve findOne idField from events when missing in Then state
43
+ - **server-generator-apollo-emmett**: return array idField natively from extraction
44
+ - **server-implementer**: add prompt guardrails for phantom enums and hardcoded projections
45
+ - **server-generator-apollo-emmett**: align instruction comment with \_state parameter name
46
+
47
+ - [`5af523f`](https://github.com/BeOnAuto/auto-engineer/commit/5af523f9cb5d1a4e6275589e1f12173637c6458e) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-generator-apollo-emmett**: fix [object Object] serialization bugs
48
+
49
+ - [`a4053ef`](https://github.com/BeOnAuto/auto-engineer/commit/a4053ef91284b9718bacef58ebd3ab250d4cda79) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-generator-apollo-emmett**: update decide.specs.ts snapshots for dynamic errors
50
+
51
+ - [`b63c308`](https://github.com/BeOnAuto/auto-engineer/commit/b63c308209f0316ea3b0433a82d46dec8e15169a) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-implementer**: add anti-hardcoding rules for decide functions
52
+
53
+ - [`1947b66`](https://github.com/BeOnAuto/auto-engineer/commit/1947b66d0b4687abcde75f29fc32c8665b929582) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-generator-apollo-emmett**: move burst 17 to done in ketchup plan
54
+
55
+ - [`16c9541`](https://github.com/BeOnAuto/auto-engineer/commit/16c954130331be27f54f2e1ef451545b7e22161d) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **narrative**: extract parseGraphQlRequest to narrative package
56
+
57
+ - [`bad8ef9`](https://github.com/BeOnAuto/auto-engineer/commit/bad8ef9ceb73f9b7efda58f821073ec9894ee7fb) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **narrative**: rename ParsedGraphQlQuery to ParsedGraphQlOperation
58
+
59
+ - [`a058731`](https://github.com/BeOnAuto/auto-engineer/commit/a0587319d6772df61b4004df1584d884222e7304) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **global**: add ketchup plan for parsedRequest mutation names
60
+
61
+ - [`d6f6ef6`](https://github.com/BeOnAuto/auto-engineer/commit/d6f6ef6f79ceb712ccfcf00a22789c55d6e9a0b4) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-generator-apollo-emmett**: omit non-command fields from Then assertions
62
+ - **server-generator-apollo-emmett**: derive stable metadata.now for ISO date fields
63
+ - **server-generator-apollo-emmett**: resolve findOne idField from events when missing in Then state
64
+ - **server-generator-apollo-emmett**: return array idField natively from extraction
65
+ - **server-implementer**: add prompt guardrails for phantom enums and hardcoded projections
66
+
67
+ - [`667b53f`](https://github.com/BeOnAuto/auto-engineer/commit/667b53f02b3cc933efe520022dd2f85ba1fbec3b) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-generator-apollo-emmett**: move burst 14 to done in ketchup plan
68
+
69
+ - [`e69b385`](https://github.com/BeOnAuto/auto-engineer/commit/e69b38526ab9fd522ef91955a3ee98ed3c611473) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **narrative**: mark all bursts done in ketchup plan
70
+
71
+ - Updated dependencies [[`dc9b7d9`](https://github.com/BeOnAuto/auto-engineer/commit/dc9b7d9cbcebaf5e34025b6f08b9152f87a67073), [`93ff5a5`](https://github.com/BeOnAuto/auto-engineer/commit/93ff5a559f087bb875b2b1e165713e1dc6fbea5b), [`514525d`](https://github.com/BeOnAuto/auto-engineer/commit/514525d0ae9542693fc44e6922fd0c31d229c8c9), [`7af6ae4`](https://github.com/BeOnAuto/auto-engineer/commit/7af6ae46d50a7115da047d07824a4d3e4983338f), [`1d1f519`](https://github.com/BeOnAuto/auto-engineer/commit/1d1f519fa17ba95228e58ef12ce64e3919c0697d), [`8bbbc30`](https://github.com/BeOnAuto/auto-engineer/commit/8bbbc309734ff5dce3b51473f018caa31208fa7a), [`aabe8ae`](https://github.com/BeOnAuto/auto-engineer/commit/aabe8ae4feb13e8ee4b6d3e8a7ef50bb845eaebf), [`971394a`](https://github.com/BeOnAuto/auto-engineer/commit/971394ad8d47faad27acf6c4fa82d11010568cda), [`5af523f`](https://github.com/BeOnAuto/auto-engineer/commit/5af523f9cb5d1a4e6275589e1f12173637c6458e), [`a4053ef`](https://github.com/BeOnAuto/auto-engineer/commit/a4053ef91284b9718bacef58ebd3ab250d4cda79), [`dbfbe69`](https://github.com/BeOnAuto/auto-engineer/commit/dbfbe69e5fc1efb8a65df1d3d480b36c9666b95a), [`d7b3af9`](https://github.com/BeOnAuto/auto-engineer/commit/d7b3af912b1e9f7e4f0bfc91b65768341f87229c), [`a36fc79`](https://github.com/BeOnAuto/auto-engineer/commit/a36fc79f40d236b49983574a7f8607e9028e3daf), [`73ef7b1`](https://github.com/BeOnAuto/auto-engineer/commit/73ef7b1f2818e72cc5b1cc77400f44ed948e0d39), [`ea41643`](https://github.com/BeOnAuto/auto-engineer/commit/ea41643cbd1303f50313e7dd20d92d4f3a775114), [`3e9cf93`](https://github.com/BeOnAuto/auto-engineer/commit/3e9cf93af40df9636ae33b9e749dd85ca0b0802e), [`0231c5f`](https://github.com/BeOnAuto/auto-engineer/commit/0231c5f5a771786d6534c8a0f9d6dd2856d6b893), [`b63c308`](https://github.com/BeOnAuto/auto-engineer/commit/b63c308209f0316ea3b0433a82d46dec8e15169a), [`1947b66`](https://github.com/BeOnAuto/auto-engineer/commit/1947b66d0b4687abcde75f29fc32c8665b929582), [`aacffe9`](https://github.com/BeOnAuto/auto-engineer/commit/aacffe9244a1b364f550caf9b0d5d9ce9c905c2c), [`a527ccc`](https://github.com/BeOnAuto/auto-engineer/commit/a527ccc39d7f769609252ebefcb4b26e5fe84316), [`16c9541`](https://github.com/BeOnAuto/auto-engineer/commit/16c954130331be27f54f2e1ef451545b7e22161d), [`bad8ef9`](https://github.com/BeOnAuto/auto-engineer/commit/bad8ef9ceb73f9b7efda58f821073ec9894ee7fb), [`a058731`](https://github.com/BeOnAuto/auto-engineer/commit/a0587319d6772df61b4004df1584d884222e7304), [`d6f6ef6`](https://github.com/BeOnAuto/auto-engineer/commit/d6f6ef6f79ceb712ccfcf00a22789c55d6e9a0b4), [`667b53f`](https://github.com/BeOnAuto/auto-engineer/commit/667b53f02b3cc933efe520022dd2f85ba1fbec3b), [`e69b385`](https://github.com/BeOnAuto/auto-engineer/commit/e69b38526ab9fd522ef91955a3ee98ed3c611473)]:
72
+ - @auto-engineer/narrative@1.89.0
73
+
74
+ ## 1.88.0
75
+
76
+ ### Minor Changes
77
+
78
+ - [`0bd0133`](https://github.com/BeOnAuto/auto-engineer/commit/0bd0133f31bbcf82b4496619c06ec52b8b7c0443) Thanks [@github-actions[bot]](https://github.com/github-actions%5Bbot%5D)! - - **dev-server**: emit ComponentDBFileUploaded event on artifact upload
79
+ - **global**: version packages
80
+
81
+ ### Patch Changes
82
+
83
+ - [`18d9065`](https://github.com/BeOnAuto/auto-engineer/commit/18d9065870dbd41ddac298c6b5a288dc9f9d5898) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-generator-apollo-emmett**: align instruction comment with \_state parameter name
84
+
85
+ - [`48aed87`](https://github.com/BeOnAuto/auto-engineer/commit/48aed87a84982422ae52fd42626433fd0195cd61) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-implementer**: add prompt guardrails for phantom enums and hardcoded projections
86
+
87
+ - [`b7bfd7b`](https://github.com/BeOnAuto/auto-engineer/commit/b7bfd7bf198713e5b4639a8f9dd8e720378b1c76) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-generator-apollo-emmett**: derive stable metadata.now for ISO date fields
88
+
89
+ - [`af9294c`](https://github.com/BeOnAuto/auto-engineer/commit/af9294c4b2c44546124bffba1df76eb7da59e1a1) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-generator-apollo-emmett**: return array idField natively from extraction
90
+
91
+ - [`ac6ff49`](https://github.com/BeOnAuto/auto-engineer/commit/ac6ff49ff17333fb1c7cab099084fb5b314b7658) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-implementer**: update ketchup plan with Bursts 6-7
92
+
93
+ - [`b47c94a`](https://github.com/BeOnAuto/auto-engineer/commit/b47c94a1936734f5defafdcae9fa7060d0fefbb0) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **server-generator-apollo-emmett**: resolve findOne idField from events when missing in Then state
94
+
95
+ - Updated dependencies [[`0bd0133`](https://github.com/BeOnAuto/auto-engineer/commit/0bd0133f31bbcf82b4496619c06ec52b8b7c0443), [`18d9065`](https://github.com/BeOnAuto/auto-engineer/commit/18d9065870dbd41ddac298c6b5a288dc9f9d5898), [`48aed87`](https://github.com/BeOnAuto/auto-engineer/commit/48aed87a84982422ae52fd42626433fd0195cd61), [`b7bfd7b`](https://github.com/BeOnAuto/auto-engineer/commit/b7bfd7bf198713e5b4639a8f9dd8e720378b1c76), [`af9294c`](https://github.com/BeOnAuto/auto-engineer/commit/af9294c4b2c44546124bffba1df76eb7da59e1a1), [`ac6ff49`](https://github.com/BeOnAuto/auto-engineer/commit/ac6ff49ff17333fb1c7cab099084fb5b314b7658), [`b47c94a`](https://github.com/BeOnAuto/auto-engineer/commit/b47c94a1936734f5defafdcae9fa7060d0fefbb0)]:
96
+ - @auto-engineer/narrative@1.88.0
97
+
3
98
  ## 1.87.0
4
99
 
5
100
  ### Minor Changes
package/package.json CHANGED
@@ -40,7 +40,7 @@
40
40
  "ts-node": "^10.9.2",
41
41
  "type-fest": "^4.41.0",
42
42
  "uuid": "^11.0.0",
43
- "@auto-engineer/narrative": "1.87.0"
43
+ "@auto-engineer/narrative": "1.89.0"
44
44
  },
45
45
  "publishConfig": {
46
46
  "access": "public"
@@ -52,9 +52,9 @@
52
52
  "tsx": "^4.19.2",
53
53
  "typescript": "^5.8.3",
54
54
  "vitest": "^3.2.4",
55
- "@auto-engineer/cli": "1.87.0"
55
+ "@auto-engineer/cli": "1.89.0"
56
56
  },
57
- "version": "1.87.0",
57
+ "version": "1.89.0",
58
58
  "scripts": {
59
59
  "generate:server": "tsx src/cli/index.ts",
60
60
  "-DISABLE-build": "tsc && tsx ../../scripts/fix-esm-imports.ts && rm -rf dist/src/codegen/templates && mkdir -p dist/src/codegen && cp -r src/codegen/templates dist/src/codegen/templates && cp -r src/shared dist/src",
@@ -10,9 +10,9 @@ import { ensureDirExists, ensureDirPath, toKebabCase } from './utils/path.js';
10
10
 
11
11
  const debug = createDebug('auto:server-generator-nestjs:scaffold');
12
12
 
13
+ import { parseSliceRequest } from '@auto-engineer/narrative';
13
14
  import { type ConsolidatedEntity, consolidateEntityFields } from './entity-consolidation.js';
14
15
  import { getStreamFromSink } from './extract/data-sink.js';
15
- import { parseGraphQlRequest } from './extract/graphql.js';
16
16
  import {
17
17
  baseTs,
18
18
  buildCommandGwtMapping,
@@ -353,7 +353,7 @@ async function prepareTemplateData(
353
353
  projectionSingleton,
354
354
  projectionName,
355
355
  projectionType: projectionName != null ? pascalCase(projectionName) : undefined,
356
- parsedRequest: slice.type === 'query' && slice.request != null ? parseGraphQlRequest(slice.request) : undefined,
356
+ parsedRequest: parseSliceRequest(slice),
357
357
  messages: allMessages,
358
358
  message:
359
359
  slice.type === 'query' && allMessages
@@ -1,7 +1,7 @@
1
1
  <%
2
2
  const command = commands[0];
3
3
  if (!command) return '';
4
- const mutationName = camelCase(sliceName);
4
+ const mutationName = parsedRequest?.operationName ?? camelCase(sliceName);
5
5
  %>import { Mutation, Resolver, Args } from '@nestjs/graphql';
6
6
  import { Logger, Injectable } from '@nestjs/common';
7
7
  import { CommandBus } from '@nestjs/cqrs';
@@ -1,6 +1,6 @@
1
1
  <%
2
2
  const typeName = projectionType || pascalCase(sliceName) + 'State';
3
- const queryName = camelCase(projectionName || sliceName);
3
+ const queryName = parsedRequest?.operationName ?? camelCase(projectionName || sliceName);
4
4
  const isSingleton = projectionSingleton === true;
5
5
  %>import { Query, Resolver } from '@nestjs/graphql';
6
6
  import { Injectable } from '@nestjs/common';
@@ -1,103 +0,0 @@
1
- import { type OperationDefinitionNode, parse, print, type TypeNode } from 'graphql';
2
-
3
- export interface ParsedArg {
4
- name: string;
5
- tsType: string;
6
- graphqlType: string;
7
- nullable: boolean;
8
- }
9
-
10
- export interface ParsedGraphQlQuery {
11
- queryName: string;
12
- args: ParsedArg[];
13
- returnType: string;
14
- tsReturnType: string;
15
- }
16
-
17
- function getTypeName(typeNode: TypeNode): { graphqlType: string; nullable: boolean } {
18
- if (typeNode.kind === 'NamedType') {
19
- return { graphqlType: typeNode.name.value, nullable: true };
20
- } else if (typeNode.kind === 'NonNullType') {
21
- const inner = getTypeName(typeNode.type);
22
- return { ...inner, nullable: false };
23
- } else {
24
- return getTypeName(typeNode.type);
25
- }
26
- }
27
-
28
- function graphqlToTs(type: string): string {
29
- switch (type) {
30
- case 'String':
31
- return 'string';
32
- case 'Int':
33
- case 'Float':
34
- case 'Number':
35
- return 'number';
36
- case 'Boolean':
37
- return 'boolean';
38
- case 'Date':
39
- return 'Date';
40
- default:
41
- return type;
42
- }
43
- }
44
-
45
- function convertJsonAstToSdl(request: string): string {
46
- // Handle JSON-serialized AST
47
- if (request.startsWith('{') && request.includes('"kind"')) {
48
- try {
49
- const ast = JSON.parse(request) as unknown;
50
- if (typeof ast === 'object' && ast !== null && 'kind' in ast && ast.kind === 'Document') {
51
- // Convert AST to SDL string - cast is safe here as we've validated it's a Document
52
- return print(ast as Parameters<typeof print>[0]);
53
- }
54
- } catch {
55
- // If parsing fails, assume it's already a GraphQL string
56
- }
57
- }
58
- return request;
59
- }
60
-
61
- export function parseGraphQlRequest(request: string): ParsedGraphQlQuery {
62
- const sdlRequest = convertJsonAstToSdl(request);
63
-
64
- const ast = parse(sdlRequest);
65
- const op = ast.definitions.find(
66
- (d): d is OperationDefinitionNode => d.kind === 'OperationDefinition' && d.operation === 'query',
67
- );
68
-
69
- if (!op) throw new Error('No query operation found');
70
-
71
- const queryName = op.name?.value;
72
- if (queryName == null) throw new Error('Query must have a name');
73
-
74
- const args: ParsedArg[] = (op.variableDefinitions ?? []).map((def) => {
75
- const varName = def.variable.name.value;
76
- const { graphqlType, nullable } = getTypeName(def.type);
77
- return {
78
- name: varName,
79
- graphqlType,
80
- tsType: graphqlToTs(graphqlType),
81
- nullable,
82
- };
83
- });
84
-
85
- const field = op.selectionSet.selections[0];
86
- if (field?.kind !== 'Field' || !field.name.value) {
87
- throw new Error('Query selection must be a field');
88
- }
89
-
90
- const baseName = field.name.value;
91
- const returnType = `${pascalCase(baseName)}View`;
92
-
93
- return {
94
- queryName: baseName,
95
- args,
96
- returnType,
97
- tsReturnType: `${returnType}[]`,
98
- };
99
- }
100
-
101
- function pascalCase(input: string): string {
102
- return input.replace(/(^\w|_\w)/g, (match) => match.replace('_', '').toUpperCase());
103
- }