@vladimirdev635/gql-codegen 0.0.109 → 0.0.111

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 (120) hide show
  1. package/actors/text-diff.d.ts +2 -0
  2. package/actors/text-diff.js +113 -0
  3. package/actors/ts/gql-client/actor.d.ts +8 -2
  4. package/actors/ts/gql-client/actor.js +5 -5
  5. package/actors/ts/gql-client/generators/help-nodes/build-subscription-callback-function.d.ts +4 -0
  6. package/actors/ts/gql-client/generators/help-nodes/build-subscription-callback-function.js +35 -0
  7. package/actors/ts/gql-client/generators/help-nodes/build-sync-callback-function.d.ts +4 -0
  8. package/actors/ts/gql-client/generators/help-nodes/build-sync-callback-function.js +35 -0
  9. package/actors/ts/gql-client/generators/help-nodes/callback-arrow-func.d.ts +3 -0
  10. package/actors/ts/gql-client/generators/help-nodes/callback-arrow-func.js +15 -0
  11. package/actors/ts/gql-client/generators/help-nodes/index.d.ts +9 -0
  12. package/actors/ts/gql-client/generators/help-nodes/index.js +71 -0
  13. package/actors/ts/gql-client/generators/help-nodes/sdk-operations-type-node.d.ts +4 -0
  14. package/actors/ts/gql-client/generators/help-nodes/sdk-operations-type-node.js +17 -0
  15. package/actors/ts/gql-client/generators/help-nodes/sdk-type.d.ts +7 -0
  16. package/actors/ts/gql-client/generators/help-nodes/sdk-type.js +21 -0
  17. package/actors/ts/gql-client/generators/help-nodes/subscription-method-func-alias.d.ts +3 -0
  18. package/actors/ts/gql-client/generators/help-nodes/subscription-method-func-alias.js +14 -0
  19. package/actors/ts/gql-client/generators/help-nodes/sync-method-func-alias.d.ts +3 -0
  20. package/actors/ts/gql-client/generators/help-nodes/sync-method-func-alias.js +13 -0
  21. package/actors/ts/gql-client/generators/main.d.ts +1 -1
  22. package/actors/ts/gql-client/generators/main.js +41 -71
  23. package/actors/ts/gql-client/generators/operation-function-block.d.ts +3 -0
  24. package/actors/ts/gql-client/generators/operation-function-block.js +21 -0
  25. package/actors/ts/gql-client/generators/operation-return-type.d.ts +4 -0
  26. package/actors/ts/gql-client/generators/operation-return-type.js +16 -0
  27. package/actors/ts/gql-client-framework/actor.d.ts +42 -0
  28. package/actors/ts/gql-client-framework/actor.js +11 -0
  29. package/actors/ts/gql-client-framework/generators/help-nodes/index.d.ts +8 -0
  30. package/actors/ts/gql-client-framework/generators/help-nodes/index.js +55 -0
  31. package/actors/ts/gql-client-framework/generators/help-nodes/lazy-hook-builder.d.ts +4 -0
  32. package/actors/ts/gql-client-framework/generators/help-nodes/lazy-hook-builder.js +44 -0
  33. package/actors/ts/gql-client-framework/generators/help-nodes/sdk-operations-type-node.d.ts +4 -0
  34. package/actors/ts/gql-client-framework/generators/help-nodes/sdk-operations-type-node.js +45 -0
  35. package/actors/ts/gql-client-framework/generators/help-nodes/sdk-type.d.ts +7 -0
  36. package/actors/ts/gql-client-framework/generators/help-nodes/sdk-type.js +21 -0
  37. package/actors/ts/gql-client-framework/generators/help-nodes/subscription-hook-builders.d.ts +4 -0
  38. package/actors/ts/gql-client-framework/generators/help-nodes/subscription-hook-builders.js +52 -0
  39. package/actors/ts/gql-client-framework/generators/help-nodes/sync-hook-builders.d.ts +4 -0
  40. package/actors/ts/gql-client-framework/generators/help-nodes/sync-hook-builders.js +52 -0
  41. package/actors/ts/gql-client-framework/generators/main.js +88 -0
  42. package/actors/ts/gql-client-framework/index.d.ts +1 -0
  43. package/actors/ts/gql-client-framework/index.js +1 -0
  44. package/actors/ts/gql-client-react/actor.d.ts +5 -11
  45. package/actors/ts/gql-client-react/actor.js +10 -9
  46. package/actors/ts/gql-client-react/index.d.ts +1 -1
  47. package/actors/ts/gql-client-vue/actor.d.ts +5 -11
  48. package/actors/ts/gql-client-vue/actor.js +27 -9
  49. package/actors/ts/gql-client-vue/index.d.ts +1 -1
  50. package/actors/ts/graphql/actor.d.ts +5 -4
  51. package/actors/ts/graphql/actor.js +6 -6
  52. package/actors/ts/graphql/generators/client/fragments/document.d.ts +5 -0
  53. package/actors/ts/graphql/generators/client/fragments/document.js +10 -0
  54. package/actors/ts/graphql/generators/client/fragments/index.d.ts +4 -0
  55. package/actors/ts/graphql/generators/client/fragments/index.js +24 -0
  56. package/actors/ts/graphql/generators/client/fragments/schema.d.ts +6 -0
  57. package/actors/ts/graphql/generators/client/fragments/schema.js +12 -0
  58. package/actors/ts/graphql/generators/client/fragments/spec/index.d.ts +5 -0
  59. package/actors/ts/graphql/generators/client/fragments/spec/index.js +8 -0
  60. package/actors/ts/graphql/generators/client/fragments/spec/object/field_selection.d.ts +7 -0
  61. package/actors/ts/graphql/generators/client/fragments/spec/object/field_selection.js +27 -0
  62. package/actors/ts/graphql/generators/client/fragments/spec/object/index.d.ts +8 -0
  63. package/actors/ts/graphql/generators/client/fragments/spec/object/index.js +23 -0
  64. package/actors/ts/graphql/generators/client/fragments/spec/object/selection.d.ts +8 -0
  65. package/actors/ts/graphql/generators/client/fragments/spec/object/selection.js +25 -0
  66. package/actors/ts/graphql/generators/client/fragments/spec/object/spread_selection.d.ts +2 -0
  67. package/actors/ts/graphql/generators/client/fragments/spec/object/spread_selection.js +13 -0
  68. package/actors/ts/graphql/generators/client/fragments/spec/object/typename_field.d.ts +5 -0
  69. package/actors/ts/graphql/generators/client/fragments/spec/object/typename_field.js +13 -0
  70. package/actors/ts/graphql/generators/client/{fragments.d.ts → fragments/spec/shared.d.ts} +5 -10
  71. package/actors/ts/graphql/generators/client/fragments/spec/shared.js +59 -0
  72. package/actors/ts/graphql/generators/client/fragments/spec/union/index.d.ts +6 -0
  73. package/actors/ts/graphql/generators/client/fragments/spec/union/index.js +28 -0
  74. package/actors/ts/graphql/generators/client/fragments/spec/union/selections.d.ts +7 -0
  75. package/actors/ts/graphql/generators/client/fragments/spec/union/selections.js +21 -0
  76. package/actors/ts/graphql/generators/client/main.d.ts +3 -3
  77. package/actors/ts/graphql/generators/client/main.js +5 -21
  78. package/actors/ts/graphql/generators/client/operations/index.d.ts +8 -0
  79. package/actors/ts/graphql/generators/client/operations/index.js +33 -0
  80. package/actors/ts/graphql/generators/client/operations/input-schema.d.ts +5 -0
  81. package/actors/ts/graphql/generators/client/operations/input-schema.js +16 -0
  82. package/actors/ts/graphql/generators/client/operations/node.d.ts +6 -0
  83. package/actors/ts/graphql/generators/client/operations/node.js +20 -0
  84. package/actors/ts/graphql/generators/client/operations/output-schema.d.ts +6 -0
  85. package/actors/ts/graphql/generators/client/operations/output-schema.js +8 -0
  86. package/actors/ts/graphql/generators/main.d.ts +2 -2
  87. package/actors/ts/graphql/generators/main.js +1 -1
  88. package/actors/ts/graphql/generators/server/inputs.d.ts +1 -1
  89. package/actors/ts/graphql/generators/server/inputs.js +6 -6
  90. package/actors/ts/graphql/generators/server/main.d.ts +2 -2
  91. package/actors/ts/graphql/generators/server/objects.js +2 -2
  92. package/actors/ts/graphql/generators/server/scalars/additional.d.ts +1 -0
  93. package/actors/ts/graphql/generators/server/scalars/additional.js +2 -1
  94. package/actors/ts/graphql/generators/server/shared.d.ts +3 -2
  95. package/actors/ts/graphql/generators/server/shared.js +10 -1
  96. package/actors/ts/graphql/generators/server/unions.js +2 -2
  97. package/actors/ts/graphql/index.d.ts +1 -1
  98. package/actors/ts/graphql/index.js +1 -1
  99. package/actors/ts/index.d.ts +2 -1
  100. package/actors/ts/index.js +1 -0
  101. package/actors/ts/shared.d.ts +5 -0
  102. package/actors/ts/utils.d.ts +2 -4
  103. package/actors/ts/utils.js +4 -3
  104. package/actors/utils.d.ts +3 -0
  105. package/actors/utils.js +22 -0
  106. package/config.d.ts +6 -1
  107. package/config.js +18 -1
  108. package/index.d.ts +1 -1
  109. package/index.js +1 -0
  110. package/main.d.ts +2 -2
  111. package/main.js +2 -2
  112. package/package.json +5 -1
  113. package/schema/client/operation.d.ts +3 -0
  114. package/actors/ts/gql-client-react/generators/main.d.ts +0 -4
  115. package/actors/ts/gql-client-react/generators/main.js +0 -121
  116. package/actors/ts/gql-client-vue/generators/main.js +0 -135
  117. package/actors/ts/graphql/generators/client/fragments.js +0 -195
  118. package/actors/ts/graphql/generators/client/operations.d.ts +0 -7
  119. package/actors/ts/graphql/generators/client/operations.js +0 -68
  120. /package/actors/ts/{gql-client-vue → gql-client-framework}/generators/main.d.ts +0 -0
@@ -1,195 +0,0 @@
1
- /* eslint-disable max-lines */
2
- import ts from 'typescript';
3
- import { generateSchemaName, generateZodInferTypeAlias, } from '../server/shared.js';
4
- import { generateZodObjectFieldSpec } from '../server/objects.js';
5
- import assert from 'assert';
6
- import { invokeMethod } from '../../../shared.js';
7
- export function extractFragmentNamesInSpec(schema, fragmentSpec) {
8
- if (fragmentSpec._type === 'UnionFragmentSpec') {
9
- return fragmentSpec.selections
10
- .map((s) => {
11
- if (s._type === 'SpreadSelection') {
12
- const fragment = schema.client.fragments[s.fragment];
13
- return [
14
- s.fragment,
15
- ...extractFragmentNamesInSpec(schema, fragment.spec),
16
- ];
17
- }
18
- if (s._type === 'ObjectConditionalSpreadSelection') {
19
- return extractFragmentNamesInSpec(schema, s.spec);
20
- }
21
- return [];
22
- })
23
- .flat();
24
- }
25
- return fragmentSpec.selections
26
- .map((s) => {
27
- if (s._type === 'SpreadSelection') {
28
- const fragment = schema.client.fragments[s.fragment];
29
- assert(fragment.spec !== undefined);
30
- return [
31
- s.fragment,
32
- ...extractFragmentNamesInSpec(schema, fragment.spec),
33
- ];
34
- }
35
- if (s._type === 'FieldSelection' && s.selection != null) {
36
- assert(s.selection !== undefined);
37
- return extractFragmentNamesInSpec(schema, s.selection);
38
- }
39
- return [];
40
- })
41
- .flat();
42
- }
43
- export function extractFragmentSourceTextsInSpec(schema, fragmentSpec) {
44
- return Array.from(new Set(extractFragmentNamesInSpec(schema, fragmentSpec))).map((f) => schema.client.fragments[f].sourceText);
45
- }
46
- function generateFragmentDocumentNode(schema, name, fragment) {
47
- return ts.factory.createVariableStatement([ts.factory.createToken(ts.SyntaxKind.ExportKeyword)], ts.factory.createVariableDeclarationList([
48
- ts.factory.createVariableDeclaration(ts.factory.createIdentifier(name + 'FragmentDocument'), undefined, undefined, ts.factory.createStringLiteral([
49
- fragment.sourceText,
50
- ...extractFragmentSourceTextsInSpec(schema, fragment.spec),
51
- ].join(' '))),
52
- ], ts.NodeFlags.Const));
53
- }
54
- function generateZodObjectSelection(scalarsMapping, schema, objectType, selection, typenameConfig) {
55
- switch (selection._type) {
56
- case 'TypenameField': {
57
- if ('ignore' in typenameConfig)
58
- return null;
59
- let expression = invokeMethod(ts.factory.createIdentifier('z'), 'literal', [ts.factory.createStringLiteral(objectType.name)]);
60
- if (selection.alias === null && typenameConfig.optional) {
61
- expression = invokeMethod(invokeMethod(expression, 'nullable', []), 'optional', []);
62
- }
63
- return ts.factory.createPropertyAssignment(selection.alias || '__typename', expression);
64
- }
65
- case 'FieldSelection': {
66
- const fieldSpec = objectType.fields[selection.name];
67
- let expression;
68
- if (selection.selection == null) {
69
- expression = generateZodObjectFieldSpec(scalarsMapping, fieldSpec);
70
- }
71
- else {
72
- const optional = fieldSpec.spec._type !== 'callable' ||
73
- !selection.selection.selections.every((s) => s._type === 'TypenameField') ||
74
- !fieldSpec.nullable;
75
- // eslint-disable-next-line no-use-before-define
76
- expression = generateZodFragmentSpecCallExpression(scalarsMapping, schema, selection.selection, { ensurePresent: true, optional });
77
- if (fieldSpec.spec._type === 'array' ||
78
- (fieldSpec.spec._type === 'callable' &&
79
- fieldSpec.spec.returnType._type === 'array')) {
80
- expression = ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('z'), 'array'), undefined, [expression]);
81
- }
82
- }
83
- if (fieldSpec.nullable) {
84
- expression = invokeMethod(invokeMethod(expression, 'nullable', []), 'optional', []);
85
- }
86
- return ts.factory.createPropertyAssignment(selection.alias, expression);
87
- }
88
- case 'SpreadSelection': {
89
- return ts.factory.createSpreadAssignment(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier(generateSchemaName(selection.fragment + 'Fragment')), 'shape'));
90
- }
91
- }
92
- }
93
- function resolveSelections(specSelections, typenameConfig) {
94
- const ignoreTypename = 'ignore' in typenameConfig;
95
- const selections = specSelections
96
- .filter((s) => s._type !== 'TypenameField' || !ignoreTypename)
97
- .toSorted((s1, s2) => s1._type.localeCompare(s2._type));
98
- if (ignoreTypename)
99
- return selections;
100
- const hasTypename = specSelections.some((s) => s._type === 'TypenameField');
101
- const hasSpreadSelection = specSelections.some((s) => s._type === 'SpreadSelection');
102
- if (!hasTypename) {
103
- if (hasSpreadSelection) {
104
- selections.push({ _type: 'TypenameField', alias: null });
105
- }
106
- else {
107
- selections.unshift({ _type: 'TypenameField', alias: null });
108
- }
109
- }
110
- return selections;
111
- }
112
- function generateZodObjectFragmentSpecCallExpression(scalarsMapping, schema, object, specSelections, insideLazy, typenameConfig) {
113
- const selections = resolveSelections(specSelections, typenameConfig);
114
- const expression = ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('z'), 'object'), undefined, [
115
- ts.factory.createObjectLiteralExpression(selections
116
- .map((s) => generateZodObjectSelection(scalarsMapping, schema, object, s, typenameConfig))
117
- .filter((s) => s !== null), true),
118
- ]);
119
- if (insideLazy)
120
- return expression;
121
- const hasSpreadSelection = selections.some((s) => s._type === 'SpreadSelection');
122
- if (!hasSpreadSelection)
123
- return expression;
124
- return ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('z'), 'lazy'), undefined, [
125
- ts.factory.createArrowFunction(undefined, undefined, [], undefined, ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken), expression),
126
- ]);
127
- }
128
- function resolveUnionSelections(schema, specSelections) {
129
- const typenameSelections = [];
130
- const objectSelections = specSelections
131
- .map((s) => {
132
- assert(s._type !== 'UnionConditionalSpreadSelection');
133
- if (s._type === 'TypenameField') {
134
- typenameSelections.push(s);
135
- return [];
136
- }
137
- if (s._type === 'ObjectConditionalSpreadSelection')
138
- return [s];
139
- const fragmentSpec = schema.client.fragments[s.fragment].spec;
140
- assert(fragmentSpec._type === 'UnionFragmentSpec');
141
- const [selections, tSelections] = resolveUnionSelections(schema, fragmentSpec.selections);
142
- typenameSelections.push(...tSelections);
143
- return selections;
144
- })
145
- .flat();
146
- return [objectSelections, typenameSelections];
147
- }
148
- function generateZodUnionFragmentSpecCallExpression(scalarsMapping, schema, spec) {
149
- const [objectSelections, typenameSelections] = resolveUnionSelections(schema, spec.selections);
150
- for (const item of Object.keys(schema.server.unions[spec.name].items)) {
151
- if (!objectSelections.some((s) => s.object === item)) {
152
- objectSelections.push({
153
- _type: 'ObjectConditionalSpreadSelection',
154
- object: item,
155
- spec: {
156
- _type: 'ObjectFragmentSpec',
157
- name: item,
158
- selections: [],
159
- },
160
- });
161
- }
162
- }
163
- const expression = ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('z'), 'union'), undefined, [
164
- ts.factory.createArrayLiteralExpression(objectSelections.map((s) => generateZodObjectFragmentSpecCallExpression(scalarsMapping, schema, schema.server.objects[s.object], [...s.spec.selections, ...typenameSelections], true, { ensurePresent: true, optional: false })), true),
165
- ]);
166
- return ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('z'), 'lazy'), undefined, [
167
- ts.factory.createArrowFunction(undefined, undefined, [], undefined, ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken), expression),
168
- ]);
169
- }
170
- export function generateZodFragmentSpecCallExpression(scalarsMapping, schema, spec, typenameConfig) {
171
- if (spec._type === 'ObjectFragmentSpec') {
172
- return generateZodObjectFragmentSpecCallExpression(scalarsMapping, schema, schema.server.objects[spec.name], spec.selections, false, typenameConfig || { ensurePresent: true, optional: true });
173
- }
174
- return generateZodUnionFragmentSpecCallExpression(scalarsMapping, schema, spec);
175
- }
176
- function generateZodFragmentSchema(scalarsMapping, schema, fragmentName, fragment) {
177
- return ts.factory.createVariableStatement([ts.factory.createToken(ts.SyntaxKind.ExportKeyword)], ts.factory.createVariableDeclarationList([
178
- ts.factory.createVariableDeclaration(ts.factory.createIdentifier(generateSchemaName(fragmentName + 'Fragment')), undefined, undefined, generateZodFragmentSpecCallExpression(scalarsMapping, schema, fragment.spec)),
179
- ], ts.NodeFlags.Const));
180
- }
181
- function generateFragmentSpecDeclarations(scalarsMapping, schema, fragmentName, fragment) {
182
- const fName = fragmentName + 'Fragment';
183
- return [
184
- generateFragmentDocumentNode(schema, fragmentName, fragment),
185
- generateZodFragmentSchema(scalarsMapping, schema, fragmentName, fragment),
186
- generateZodInferTypeAlias('output', fName, generateSchemaName(fName)),
187
- ];
188
- }
189
- export function generateFragmentTypes(scalarsMapping, schema) {
190
- return Object.entries(schema.client.fragments)
191
- .map(([name, fragment]) => {
192
- return generateFragmentSpecDeclarations(scalarsMapping, schema, name, fragment);
193
- })
194
- .flat();
195
- }
@@ -1,7 +0,0 @@
1
- import ts from 'typescript';
2
- import { RootSchema } from '../../../../../schema/root.js';
3
- import { operationSchema } from '../../../../../schema/client/operation.js';
4
- import { z } from 'zod/v4';
5
- import { ScalarsMapping } from '../server/scalars/mapping.js';
6
- export declare function opTypeToName(type: z.infer<typeof operationSchema>['type']): string;
7
- export declare function generateOperationsNodes(scalarsMapping: ScalarsMapping, schema: RootSchema): ts.Node[];
@@ -1,68 +0,0 @@
1
- /* eslint-disable max-lines */
2
- import ts from 'typescript';
3
- import { extractFragmentSourceTextsInSpec, generateZodFragmentSpecCallExpression, } from './fragments.js';
4
- import { generateSchemaName, generateZodInferTypeAlias, } from '../server/shared.js';
5
- import { generateInputTypeDefinitionFields } from '../server/inputs.js';
6
- export function opTypeToName(type) {
7
- switch (type) {
8
- case 'QUERY':
9
- return 'Query';
10
- case 'MUTATION':
11
- return 'Mutation';
12
- case 'SUBSCRIPTION':
13
- return 'Subscription';
14
- }
15
- }
16
- function parametersToFields(parameters) {
17
- return Object.fromEntries(Object.keys(parameters).map((name) => [
18
- name.slice(1),
19
- parameters[name],
20
- ]));
21
- }
22
- function generateOperationNode(schema, operation) {
23
- return ts.factory.createVariableStatement(ts.factory.createModifiersFromModifierFlags(ts.ModifierFlags.Export), ts.factory.createVariableDeclarationList([
24
- ts.factory.createVariableDeclaration(ts.factory.createIdentifier(operation.name + 'Operation'), undefined, undefined, ts.factory.createSatisfiesExpression(ts.factory.createAsExpression(ts.factory.createObjectLiteralExpression([
25
- ts.factory.createPropertyAssignment('name', ts.factory.createStringLiteral(operation.name)),
26
- ts.factory.createPropertyAssignment('type', ts.factory.createStringLiteral(operation.type)),
27
- ts.factory.createPropertyAssignment('document', ts.factory.createStringLiteral([
28
- operation.sourceText,
29
- ...extractFragmentSourceTextsInSpec(schema, operation.fragmentSpec),
30
- ].join(' '))),
31
- ts.factory.createPropertyAssignment('variablesSchema', ts.factory.createIdentifier(generateSchemaName(operation.name + 'Variables'))),
32
- ts.factory.createPropertyAssignment('resultSchema', ts.factory.createIdentifier(generateSchemaName(operation.name + 'Result'))),
33
- ], true), ts.factory.createTypeReferenceNode('const')), ts.factory.createTypeReferenceNode('Operation', [
34
- ts.factory.createTypeReferenceNode(operation.name + 'Variables'),
35
- ts.factory.createTypeReferenceNode(operation.name + 'Result'),
36
- ]))),
37
- ], ts.NodeFlags.Const));
38
- }
39
- function generateOperationZodInputSchema(scalarsMapping, operation) {
40
- return ts.factory.createVariableStatement([ts.factory.createToken(ts.SyntaxKind.ExportKeyword)], ts.factory.createVariableDeclarationList([
41
- ts.factory.createVariableDeclaration(ts.factory.createIdentifier(generateSchemaName(operation.name + 'Variables')), undefined, undefined, ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier('z'), 'object'), undefined, [
42
- ts.factory.createObjectLiteralExpression(generateInputTypeDefinitionFields(scalarsMapping, parametersToFields(operation.parameters)), true),
43
- ])),
44
- ], ts.NodeFlags.Const));
45
- }
46
- function genearteOperationZodOutputSchema(scalarsMapping, schema, operation) {
47
- return ts.factory.createVariableStatement([ts.factory.createToken(ts.SyntaxKind.ExportKeyword)], ts.factory.createVariableDeclarationList([
48
- ts.factory.createVariableDeclaration(ts.factory.createIdentifier(generateSchemaName(operation.name + 'Result')), undefined, undefined, generateZodFragmentSpecCallExpression(scalarsMapping, schema, operation.fragmentSpec)),
49
- ], ts.NodeFlags.Const));
50
- }
51
- function generateOperationNodes(scalarsMapping, schema, operation) {
52
- return [
53
- generateOperationZodInputSchema(scalarsMapping, operation),
54
- generateZodInferTypeAlias('input', operation.name + 'Variables', generateSchemaName(operation.name + 'Variables')),
55
- ts.factory.createIdentifier('\n'),
56
- genearteOperationZodOutputSchema(scalarsMapping, schema, operation),
57
- generateZodInferTypeAlias('output', operation.name + 'Result', generateSchemaName(operation.name + 'Result')),
58
- generateOperationNode(schema, operation),
59
- ts.factory.createIdentifier('\n'),
60
- ];
61
- }
62
- export function generateOperationsNodes(scalarsMapping, schema) {
63
- return Object.values(schema.client.operations)
64
- .map((operation) => {
65
- return generateOperationNodes(scalarsMapping, schema, operation);
66
- })
67
- .flat();
68
- }