@auto-engineer/server-generator-nestjs 1.88.0 → 1.90.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,93 @@
|
|
|
1
1
|
# @auto-engineer/server-generator-nestjs
|
|
2
2
|
|
|
3
|
+
## 1.90.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`090369e`](https://github.com/BeOnAuto/auto-engineer/commit/090369eb6c4a788a051851d93ad78e147f0ffa15) Thanks [@github-actions[bot]](https://github.com/github-actions%5Bbot%5D)! - - **server-generator-apollo-emmett**: filter event And-steps from react Then items
|
|
8
|
+
- **narrative**: export validateSliceRequests and add integration tests
|
|
9
|
+
- **narrative**: add nested field validation for query slice requests
|
|
10
|
+
- **narrative**: add query validation for operation type, state, and top-level fields
|
|
11
|
+
- **narrative**: add mutation validation to validate-slice-requests
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`3311f9b`](https://github.com/BeOnAuto/auto-engineer/commit/3311f9bdbc2e133f094a054f1526f653886302ab) Thanks [@SamHatoum](https://github.com/SamHatoum)! - - Standardized formatting and improved code readability in the create-auto-app package
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [[`3311f9b`](https://github.com/BeOnAuto/auto-engineer/commit/3311f9bdbc2e133f094a054f1526f653886302ab), [`090369e`](https://github.com/BeOnAuto/auto-engineer/commit/090369eb6c4a788a051851d93ad78e147f0ffa15)]:
|
|
18
|
+
- @auto-engineer/narrative@1.90.0
|
|
19
|
+
|
|
20
|
+
## 1.89.0
|
|
21
|
+
|
|
22
|
+
### Minor Changes
|
|
23
|
+
|
|
24
|
+
- [`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
|
|
25
|
+
|
|
26
|
+
- [`514525d`](https://github.com/BeOnAuto/auto-engineer/commit/514525d0ae9542693fc44e6922fd0c31d229c8c9) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **narrative**: export validateSliceRequests and add integration tests
|
|
27
|
+
|
|
28
|
+
- [`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
|
|
29
|
+
|
|
30
|
+
- [`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
|
|
31
|
+
|
|
32
|
+
- [`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
|
|
33
|
+
|
|
34
|
+
- [`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
|
|
35
|
+
|
|
36
|
+
- [`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
|
|
37
|
+
|
|
38
|
+
- [`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
|
|
39
|
+
|
|
40
|
+
- [`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
|
|
41
|
+
|
|
42
|
+
- [`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
|
|
43
|
+
|
|
44
|
+
- [`0231c5f`](https://github.com/BeOnAuto/auto-engineer/commit/0231c5f5a771786d6534c8a0f9d6dd2856d6b893) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **narrative**: parseGraphQlRequest accepts mutation operations
|
|
45
|
+
|
|
46
|
+
- [`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
|
|
47
|
+
|
|
48
|
+
- [`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
|
|
49
|
+
|
|
50
|
+
### Patch Changes
|
|
51
|
+
|
|
52
|
+
- [`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
|
|
53
|
+
|
|
54
|
+
- [`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
|
|
55
|
+
|
|
56
|
+
- [`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
|
|
57
|
+
|
|
58
|
+
- [`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
|
|
59
|
+
- **server-generator-apollo-emmett**: resolve findOne idField from events when missing in Then state
|
|
60
|
+
- **server-generator-apollo-emmett**: return array idField natively from extraction
|
|
61
|
+
- **server-implementer**: add prompt guardrails for phantom enums and hardcoded projections
|
|
62
|
+
- **server-generator-apollo-emmett**: align instruction comment with \_state parameter name
|
|
63
|
+
|
|
64
|
+
- [`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
|
|
65
|
+
|
|
66
|
+
- [`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
|
|
67
|
+
|
|
68
|
+
- [`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
|
|
69
|
+
|
|
70
|
+
- [`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
|
|
71
|
+
|
|
72
|
+
- [`16c9541`](https://github.com/BeOnAuto/auto-engineer/commit/16c954130331be27f54f2e1ef451545b7e22161d) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **narrative**: extract parseGraphQlRequest to narrative package
|
|
73
|
+
|
|
74
|
+
- [`bad8ef9`](https://github.com/BeOnAuto/auto-engineer/commit/bad8ef9ceb73f9b7efda58f821073ec9894ee7fb) Thanks [@rami-hatoum](https://github.com/rami-hatoum)! - - **narrative**: rename ParsedGraphQlQuery to ParsedGraphQlOperation
|
|
75
|
+
|
|
76
|
+
- [`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
|
|
77
|
+
|
|
78
|
+
- [`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
|
|
79
|
+
- **server-generator-apollo-emmett**: derive stable metadata.now for ISO date fields
|
|
80
|
+
- **server-generator-apollo-emmett**: resolve findOne idField from events when missing in Then state
|
|
81
|
+
- **server-generator-apollo-emmett**: return array idField natively from extraction
|
|
82
|
+
- **server-implementer**: add prompt guardrails for phantom enums and hardcoded projections
|
|
83
|
+
|
|
84
|
+
- [`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
|
|
85
|
+
|
|
86
|
+
- [`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
|
|
87
|
+
|
|
88
|
+
- 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)]:
|
|
89
|
+
- @auto-engineer/narrative@1.89.0
|
|
90
|
+
|
|
3
91
|
## 1.88.0
|
|
4
92
|
|
|
5
93
|
### 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.
|
|
43
|
+
"@auto-engineer/narrative": "1.90.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.
|
|
55
|
+
"@auto-engineer/cli": "1.90.0"
|
|
56
56
|
},
|
|
57
|
-
"version": "1.
|
|
57
|
+
"version": "1.90.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:
|
|
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
|
-
}
|