@constructive-io/graphql-codegen 2.23.3 → 2.24.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 (92) hide show
  1. package/README.md +147 -2
  2. package/cli/codegen/babel-ast.d.ts +53 -0
  3. package/cli/codegen/babel-ast.js +160 -0
  4. package/cli/codegen/barrel.d.ts +7 -2
  5. package/cli/codegen/barrel.js +193 -102
  6. package/cli/codegen/client.js +61 -0
  7. package/cli/codegen/custom-mutations.d.ts +2 -12
  8. package/cli/codegen/custom-mutations.js +116 -124
  9. package/cli/codegen/custom-queries.d.ts +2 -10
  10. package/cli/codegen/custom-queries.js +236 -335
  11. package/cli/codegen/gql-ast.js +22 -1
  12. package/cli/codegen/index.d.ts +3 -0
  13. package/cli/codegen/index.js +73 -3
  14. package/cli/codegen/invalidation.d.ts +20 -0
  15. package/cli/codegen/invalidation.js +327 -0
  16. package/cli/codegen/mutation-keys.d.ts +24 -0
  17. package/cli/codegen/mutation-keys.js +247 -0
  18. package/cli/codegen/mutations.d.ts +5 -19
  19. package/cli/codegen/mutations.js +385 -383
  20. package/cli/codegen/orm/barrel.d.ts +1 -1
  21. package/cli/codegen/orm/barrel.js +42 -10
  22. package/cli/codegen/orm/client-generator.d.ts +1 -19
  23. package/cli/codegen/orm/client-generator.js +108 -77
  24. package/cli/codegen/orm/custom-ops-generator.d.ts +1 -12
  25. package/cli/codegen/orm/custom-ops-generator.js +192 -235
  26. package/cli/codegen/orm/input-types-generator.d.ts +13 -1
  27. package/cli/codegen/orm/input-types-generator.js +425 -147
  28. package/cli/codegen/orm/model-generator.d.ts +1 -19
  29. package/cli/codegen/orm/model-generator.js +229 -234
  30. package/cli/codegen/queries.d.ts +4 -12
  31. package/cli/codegen/queries.js +660 -390
  32. package/cli/codegen/query-keys.d.ts +15 -0
  33. package/cli/codegen/query-keys.js +477 -0
  34. package/cli/codegen/scalars.js +1 -0
  35. package/cli/codegen/schema-types-generator.d.ts +15 -10
  36. package/cli/codegen/schema-types-generator.js +87 -175
  37. package/cli/codegen/type-resolver.d.ts +1 -30
  38. package/cli/codegen/type-resolver.js +0 -53
  39. package/cli/codegen/types.d.ts +1 -1
  40. package/cli/codegen/types.js +76 -21
  41. package/cli/codegen/utils.d.ts +6 -0
  42. package/cli/codegen/utils.js +19 -0
  43. package/esm/cli/codegen/babel-ast.d.ts +53 -0
  44. package/esm/cli/codegen/babel-ast.js +111 -0
  45. package/esm/cli/codegen/barrel.d.ts +7 -2
  46. package/esm/cli/codegen/barrel.js +161 -103
  47. package/esm/cli/codegen/client.js +61 -0
  48. package/esm/cli/codegen/custom-mutations.d.ts +2 -12
  49. package/esm/cli/codegen/custom-mutations.js +83 -124
  50. package/esm/cli/codegen/custom-queries.d.ts +2 -10
  51. package/esm/cli/codegen/custom-queries.js +204 -336
  52. package/esm/cli/codegen/gql-ast.js +23 -2
  53. package/esm/cli/codegen/index.d.ts +3 -0
  54. package/esm/cli/codegen/index.js +69 -2
  55. package/esm/cli/codegen/invalidation.d.ts +20 -0
  56. package/esm/cli/codegen/invalidation.js +291 -0
  57. package/esm/cli/codegen/mutation-keys.d.ts +24 -0
  58. package/esm/cli/codegen/mutation-keys.js +211 -0
  59. package/esm/cli/codegen/mutations.d.ts +5 -19
  60. package/esm/cli/codegen/mutations.js +353 -384
  61. package/esm/cli/codegen/orm/barrel.d.ts +1 -1
  62. package/esm/cli/codegen/orm/barrel.js +10 -11
  63. package/esm/cli/codegen/orm/client-generator.d.ts +1 -19
  64. package/esm/cli/codegen/orm/client-generator.js +76 -78
  65. package/esm/cli/codegen/orm/custom-ops-generator.d.ts +1 -12
  66. package/esm/cli/codegen/orm/custom-ops-generator.js +160 -236
  67. package/esm/cli/codegen/orm/input-types-generator.d.ts +13 -1
  68. package/esm/cli/codegen/orm/input-types-generator.js +393 -148
  69. package/esm/cli/codegen/orm/model-generator.d.ts +1 -19
  70. package/esm/cli/codegen/orm/model-generator.js +197 -235
  71. package/esm/cli/codegen/queries.d.ts +4 -12
  72. package/esm/cli/codegen/queries.js +628 -391
  73. package/esm/cli/codegen/query-keys.d.ts +15 -0
  74. package/esm/cli/codegen/query-keys.js +441 -0
  75. package/esm/cli/codegen/scalars.js +1 -0
  76. package/esm/cli/codegen/schema-types-generator.d.ts +15 -10
  77. package/esm/cli/codegen/schema-types-generator.js +54 -175
  78. package/esm/cli/codegen/type-resolver.d.ts +1 -30
  79. package/esm/cli/codegen/type-resolver.js +0 -49
  80. package/esm/cli/codegen/types.d.ts +1 -1
  81. package/esm/cli/codegen/types.js +44 -22
  82. package/esm/cli/codegen/utils.d.ts +6 -0
  83. package/esm/cli/codegen/utils.js +18 -0
  84. package/esm/types/config.d.ts +75 -0
  85. package/esm/types/config.js +18 -0
  86. package/package.json +6 -4
  87. package/types/config.d.ts +75 -0
  88. package/types/config.js +19 -1
  89. package/cli/codegen/ts-ast.d.ts +0 -124
  90. package/cli/codegen/ts-ast.js +0 -280
  91. package/esm/cli/codegen/ts-ast.d.ts +0 -124
  92. package/esm/cli/codegen/ts-ast.js +0 -260
@@ -1,109 +1,174 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.generateQueriesBarrel = generateQueriesBarrel;
4
37
  exports.generateMutationsBarrel = generateMutationsBarrel;
5
38
  exports.generateMainBarrel = generateMainBarrel;
6
39
  exports.generateCustomQueriesBarrel = generateCustomQueriesBarrel;
7
40
  exports.generateCustomMutationsBarrel = generateCustomMutationsBarrel;
8
- const ts_ast_1 = require("./ts-ast");
41
+ const t = __importStar(require("@babel/types"));
42
+ const babel_ast_1 = require("./babel-ast");
9
43
  const utils_1 = require("./utils");
10
44
  const type_resolver_1 = require("./type-resolver");
45
+ /**
46
+ * Helper to create export * from './module' statement
47
+ */
48
+ function exportAllFrom(modulePath) {
49
+ return t.exportAllDeclaration(t.stringLiteral(modulePath));
50
+ }
11
51
  /**
12
52
  * Generate the queries/index.ts barrel file
13
53
  */
14
54
  function generateQueriesBarrel(tables) {
15
- const lines = [(0, ts_ast_1.createFileHeader)('Query hooks barrel export'), ''];
55
+ const statements = [];
16
56
  // Export all query hooks
17
57
  for (const table of tables) {
18
58
  const listHookName = (0, utils_1.getListQueryHookName)(table);
19
- const singleHookName = (0, utils_1.getSingleQueryHookName)(table);
20
- lines.push(`export * from './${listHookName}';`);
21
- lines.push(`export * from './${singleHookName}';`);
59
+ statements.push(exportAllFrom(`./${listHookName}`));
60
+ // Only export single query hook if table has valid primary key
61
+ if ((0, utils_1.hasValidPrimaryKey)(table)) {
62
+ const singleHookName = (0, utils_1.getSingleQueryHookName)(table);
63
+ statements.push(exportAllFrom(`./${singleHookName}`));
64
+ }
65
+ }
66
+ // Add file header as leading comment on first statement
67
+ if (statements.length > 0) {
68
+ (0, babel_ast_1.addJSDocComment)(statements[0], [
69
+ 'Query hooks barrel export',
70
+ '@generated by @constructive-io/graphql-codegen',
71
+ 'DO NOT EDIT - changes will be overwritten',
72
+ ]);
22
73
  }
23
- return lines.join('\n') + '\n';
74
+ return (0, babel_ast_1.generateCode)(statements);
24
75
  }
25
76
  /**
26
77
  * Generate the mutations/index.ts barrel file
27
78
  */
28
79
  function generateMutationsBarrel(tables) {
29
- const lines = [
30
- (0, ts_ast_1.createFileHeader)('Mutation hooks barrel export'),
31
- '',
32
- ];
80
+ const statements = [];
33
81
  // Export all mutation hooks
34
82
  for (const table of tables) {
35
83
  const createHookName = (0, utils_1.getCreateMutationHookName)(table);
36
84
  const updateHookName = (0, utils_1.getUpdateMutationHookName)(table);
37
85
  const deleteHookName = (0, utils_1.getDeleteMutationHookName)(table);
38
- lines.push(`export * from './${createHookName}';`);
86
+ statements.push(exportAllFrom(`./${createHookName}`));
39
87
  // Only add update/delete if they exist
40
88
  if (table.query?.update !== null) {
41
- lines.push(`export * from './${updateHookName}';`);
89
+ statements.push(exportAllFrom(`./${updateHookName}`));
42
90
  }
43
91
  if (table.query?.delete !== null) {
44
- lines.push(`export * from './${deleteHookName}';`);
92
+ statements.push(exportAllFrom(`./${deleteHookName}`));
45
93
  }
46
94
  }
47
- return lines.join('\n') + '\n';
95
+ // Add file header as leading comment on first statement
96
+ if (statements.length > 0) {
97
+ (0, babel_ast_1.addJSDocComment)(statements[0], [
98
+ 'Mutation hooks barrel export',
99
+ '@generated by @constructive-io/graphql-codegen',
100
+ 'DO NOT EDIT - changes will be overwritten',
101
+ ]);
102
+ }
103
+ return (0, babel_ast_1.generateCode)(statements);
48
104
  }
49
105
  function generateMainBarrel(tables, options = {}) {
50
106
  // Support legacy signature where second arg was just hasSchemaTypes boolean
51
107
  const opts = typeof options === 'boolean'
52
108
  ? { hasSchemaTypes: options, hasMutations: true }
53
109
  : options;
54
- const { hasSchemaTypes = false, hasMutations = true } = opts;
55
- const tableNames = tables.map((t) => t.name).join(', ');
56
- const schemaTypesExport = hasSchemaTypes
57
- ? `
58
- // Schema types (input, payload, enum types)
59
- export * from './schema-types';
60
- `
61
- : '';
62
- const mutationsExport = hasMutations
63
- ? `
64
- // Mutation hooks
65
- export * from './mutations';
66
- `
67
- : '';
68
- return `/**
69
- * Auto-generated GraphQL SDK
70
- * @generated by @constructive-io/graphql-codegen
71
- *
72
- * Tables: ${tableNames}
73
- *
74
- * Usage:
75
- *
76
- * 1. Configure the client:
77
- * \`\`\`ts
78
- * import { configure } from './generated';
79
- *
80
- * configure({
81
- * endpoint: 'https://api.example.com/graphql',
82
- * headers: { Authorization: 'Bearer <token>' },
83
- * });
84
- * \`\`\`
85
- *
86
- * 2. Use the hooks:
87
- * \`\`\`tsx
88
- * import { useCarsQuery, useCreateCarMutation } from './generated';
89
- *
90
- * function MyComponent() {
91
- * const { data, isLoading } = useCarsQuery({ first: 10 });
92
- * const { mutate } = useCreateCarMutation();
93
- * // ...
94
- * }
95
- * \`\`\`
96
- */
97
-
98
- // Client configuration
99
- export * from './client';
100
-
101
- // Entity and filter types
102
- export * from './types';
103
- ${schemaTypesExport}
104
- // Query hooks
105
- export * from './queries';
106
- ${mutationsExport}`;
110
+ const { hasSchemaTypes = false, hasMutations = true, hasQueryKeys = false, hasMutationKeys = false, hasInvalidation = false, } = opts;
111
+ const tableNames = tables.map((tbl) => tbl.name).join(', ');
112
+ const statements = [];
113
+ // Client configuration
114
+ statements.push(exportAllFrom('./client'));
115
+ // Entity and filter types
116
+ statements.push(exportAllFrom('./types'));
117
+ // Schema types (input, payload, enum types)
118
+ if (hasSchemaTypes) {
119
+ statements.push(exportAllFrom('./schema-types'));
120
+ }
121
+ // Centralized query keys (for cache management)
122
+ if (hasQueryKeys) {
123
+ statements.push(exportAllFrom('./query-keys'));
124
+ }
125
+ // Centralized mutation keys (for tracking in-flight mutations)
126
+ if (hasMutationKeys) {
127
+ statements.push(exportAllFrom('./mutation-keys'));
128
+ }
129
+ // Cache invalidation helpers
130
+ if (hasInvalidation) {
131
+ statements.push(exportAllFrom('./invalidation'));
132
+ }
133
+ // Query hooks
134
+ statements.push(exportAllFrom('./queries'));
135
+ // Mutation hooks
136
+ if (hasMutations) {
137
+ statements.push(exportAllFrom('./mutations'));
138
+ }
139
+ // Add file header as leading comment on first statement
140
+ if (statements.length > 0) {
141
+ (0, babel_ast_1.addJSDocComment)(statements[0], [
142
+ 'Auto-generated GraphQL SDK',
143
+ '@generated by @constructive-io/graphql-codegen',
144
+ '',
145
+ `Tables: ${tableNames}`,
146
+ '',
147
+ 'Usage:',
148
+ '',
149
+ '1. Configure the client:',
150
+ '```ts',
151
+ "import { configure } from './generated';",
152
+ '',
153
+ 'configure({',
154
+ " endpoint: 'https://api.example.com/graphql',",
155
+ " headers: { Authorization: 'Bearer <token>' },",
156
+ '});',
157
+ '```',
158
+ '',
159
+ '2. Use the hooks:',
160
+ '```tsx',
161
+ "import { useCarsQuery, useCreateCarMutation } from './generated';",
162
+ '',
163
+ 'function MyComponent() {',
164
+ ' const { data, isLoading } = useCarsQuery({ first: 10 });',
165
+ ' const { mutate } = useCreateCarMutation();',
166
+ ' // ...',
167
+ '}',
168
+ '```',
169
+ ]);
170
+ }
171
+ return (0, babel_ast_1.generateCode)(statements);
107
172
  }
108
173
  // ============================================================================
109
174
  // Custom operation barrels (includes both table and custom hooks)
@@ -112,60 +177,86 @@ ${mutationsExport}`;
112
177
  * Generate queries barrel including custom query operations
113
178
  */
114
179
  function generateCustomQueriesBarrel(tables, customQueryNames) {
115
- const lines = [
116
- (0, ts_ast_1.createFileHeader)('Query hooks barrel export'),
117
- '',
118
- '// Table-based query hooks',
119
- ];
180
+ const statements = [];
181
+ const exportedHooks = new Set();
120
182
  // Export all table query hooks
121
183
  for (const table of tables) {
122
184
  const listHookName = (0, utils_1.getListQueryHookName)(table);
123
- const singleHookName = (0, utils_1.getSingleQueryHookName)(table);
124
- lines.push(`export * from './${listHookName}';`);
125
- lines.push(`export * from './${singleHookName}';`);
126
- }
127
- // Add custom query hooks
128
- if (customQueryNames.length > 0) {
129
- lines.push('');
130
- lines.push('// Custom query hooks');
131
- for (const name of customQueryNames) {
132
- const hookName = (0, type_resolver_1.getOperationHookName)(name, 'query');
133
- lines.push(`export * from './${hookName}';`);
185
+ if (!exportedHooks.has(listHookName)) {
186
+ statements.push(exportAllFrom(`./${listHookName}`));
187
+ exportedHooks.add(listHookName);
188
+ }
189
+ // Only export single query hook if table has valid primary key
190
+ if ((0, utils_1.hasValidPrimaryKey)(table)) {
191
+ const singleHookName = (0, utils_1.getSingleQueryHookName)(table);
192
+ if (!exportedHooks.has(singleHookName)) {
193
+ statements.push(exportAllFrom(`./${singleHookName}`));
194
+ exportedHooks.add(singleHookName);
195
+ }
196
+ }
197
+ }
198
+ // Add custom query hooks (skip if already exported from table hooks)
199
+ for (const name of customQueryNames) {
200
+ const hookName = (0, type_resolver_1.getOperationHookName)(name, 'query');
201
+ if (!exportedHooks.has(hookName)) {
202
+ statements.push(exportAllFrom(`./${hookName}`));
203
+ exportedHooks.add(hookName);
134
204
  }
135
205
  }
136
- return lines.join('\n') + '\n';
206
+ // Add file header as leading comment on first statement
207
+ if (statements.length > 0) {
208
+ (0, babel_ast_1.addJSDocComment)(statements[0], [
209
+ 'Query hooks barrel export',
210
+ '@generated by @constructive-io/graphql-codegen',
211
+ 'DO NOT EDIT - changes will be overwritten',
212
+ ]);
213
+ }
214
+ return (0, babel_ast_1.generateCode)(statements);
137
215
  }
138
216
  /**
139
217
  * Generate mutations barrel including custom mutation operations
140
218
  */
141
219
  function generateCustomMutationsBarrel(tables, customMutationNames) {
142
- const lines = [
143
- (0, ts_ast_1.createFileHeader)('Mutation hooks barrel export'),
144
- '',
145
- '// Table-based mutation hooks',
146
- ];
220
+ const statements = [];
221
+ const exportedHooks = new Set();
147
222
  // Export all table mutation hooks
148
223
  for (const table of tables) {
149
224
  const createHookName = (0, utils_1.getCreateMutationHookName)(table);
150
- const updateHookName = (0, utils_1.getUpdateMutationHookName)(table);
151
- const deleteHookName = (0, utils_1.getDeleteMutationHookName)(table);
152
- lines.push(`export * from './${createHookName}';`);
225
+ if (!exportedHooks.has(createHookName)) {
226
+ statements.push(exportAllFrom(`./${createHookName}`));
227
+ exportedHooks.add(createHookName);
228
+ }
153
229
  // Only add update/delete if they exist
154
230
  if (table.query?.update !== null) {
155
- lines.push(`export * from './${updateHookName}';`);
231
+ const updateHookName = (0, utils_1.getUpdateMutationHookName)(table);
232
+ if (!exportedHooks.has(updateHookName)) {
233
+ statements.push(exportAllFrom(`./${updateHookName}`));
234
+ exportedHooks.add(updateHookName);
235
+ }
156
236
  }
157
237
  if (table.query?.delete !== null) {
158
- lines.push(`export * from './${deleteHookName}';`);
238
+ const deleteHookName = (0, utils_1.getDeleteMutationHookName)(table);
239
+ if (!exportedHooks.has(deleteHookName)) {
240
+ statements.push(exportAllFrom(`./${deleteHookName}`));
241
+ exportedHooks.add(deleteHookName);
242
+ }
159
243
  }
160
244
  }
161
- // Add custom mutation hooks
162
- if (customMutationNames.length > 0) {
163
- lines.push('');
164
- lines.push('// Custom mutation hooks');
165
- for (const name of customMutationNames) {
166
- const hookName = (0, type_resolver_1.getOperationHookName)(name, 'mutation');
167
- lines.push(`export * from './${hookName}';`);
245
+ // Add custom mutation hooks (skip if already exported from table hooks)
246
+ for (const name of customMutationNames) {
247
+ const hookName = (0, type_resolver_1.getOperationHookName)(name, 'mutation');
248
+ if (!exportedHooks.has(hookName)) {
249
+ statements.push(exportAllFrom(`./${hookName}`));
250
+ exportedHooks.add(hookName);
168
251
  }
169
252
  }
170
- return lines.join('\n') + '\n';
253
+ // Add file header as leading comment on first statement
254
+ if (statements.length > 0) {
255
+ (0, babel_ast_1.addJSDocComment)(statements[0], [
256
+ 'Mutation hooks barrel export',
257
+ '@generated by @constructive-io/graphql-codegen',
258
+ 'DO NOT EDIT - changes will be overwritten',
259
+ ]);
260
+ }
261
+ return (0, babel_ast_1.generateCode)(statements);
171
262
  }
@@ -199,5 +199,66 @@ export async function executeWithErrors<TData = unknown, TVariables = Record<str
199
199
  errors: json.errors ?? null,
200
200
  };
201
201
  }
202
+
203
+ // ============================================================================
204
+ // QueryClient Factory
205
+ // ============================================================================
206
+
207
+ /**
208
+ * Default QueryClient configuration optimized for GraphQL
209
+ *
210
+ * These defaults provide a good balance between freshness and performance:
211
+ * - staleTime: 1 minute - data considered fresh, won't refetch
212
+ * - gcTime: 5 minutes - unused data kept in cache
213
+ * - refetchOnWindowFocus: false - don't refetch when tab becomes active
214
+ * - retry: 1 - retry failed requests once
215
+ */
216
+ export const defaultQueryClientOptions = {
217
+ defaultOptions: {
218
+ queries: {
219
+ staleTime: 1000 * 60, // 1 minute
220
+ gcTime: 1000 * 60 * 5, // 5 minutes
221
+ refetchOnWindowFocus: false,
222
+ retry: 1,
223
+ },
224
+ },
225
+ };
226
+
227
+ /**
228
+ * QueryClient options type for createQueryClient
229
+ */
230
+ export interface CreateQueryClientOptions {
231
+ defaultOptions?: {
232
+ queries?: {
233
+ staleTime?: number;
234
+ gcTime?: number;
235
+ refetchOnWindowFocus?: boolean;
236
+ retry?: number | boolean;
237
+ retryDelay?: number | ((attemptIndex: number) => number);
238
+ };
239
+ mutations?: {
240
+ retry?: number | boolean;
241
+ retryDelay?: number | ((attemptIndex: number) => number);
242
+ };
243
+ };
244
+ }
245
+
246
+ // Note: createQueryClient is available when using with @tanstack/react-query
247
+ // Import QueryClient from '@tanstack/react-query' and use these options:
248
+ //
249
+ // import { QueryClient } from '@tanstack/react-query';
250
+ // const queryClient = new QueryClient(defaultQueryClientOptions);
251
+ //
252
+ // Or merge with your own options:
253
+ // const queryClient = new QueryClient({
254
+ // ...defaultQueryClientOptions,
255
+ // defaultOptions: {
256
+ // ...defaultQueryClientOptions.defaultOptions,
257
+ // queries: {
258
+ // ...defaultQueryClientOptions.defaultOptions.queries,
259
+ // staleTime: 30000, // Override specific options
260
+ // },
261
+ // },
262
+ // });
202
263
  `;
203
264
  }
@@ -21,28 +21,18 @@ export interface GenerateCustomMutationHookOptions {
21
21
  typeRegistry: TypeRegistry;
22
22
  maxDepth?: number;
23
23
  skipQueryField?: boolean;
24
- /** Whether to generate React Query hooks (default: true for backwards compatibility) */
25
24
  reactQueryEnabled?: boolean;
26
- /** Table entity type names (for import path resolution) */
27
25
  tableTypeNames?: Set<string>;
26
+ useCentralizedKeys?: boolean;
28
27
  }
29
- /**
30
- * Generate a custom mutation hook file
31
- * When reactQueryEnabled is false, returns null since mutations require React Query
32
- */
33
28
  export declare function generateCustomMutationHook(options: GenerateCustomMutationHookOptions): GeneratedCustomMutationFile | null;
34
29
  export interface GenerateAllCustomMutationHooksOptions {
35
30
  operations: CleanOperation[];
36
31
  typeRegistry: TypeRegistry;
37
32
  maxDepth?: number;
38
33
  skipQueryField?: boolean;
39
- /** Whether to generate React Query hooks (default: true for backwards compatibility) */
40
34
  reactQueryEnabled?: boolean;
41
- /** Table entity type names (for import path resolution) */
42
35
  tableTypeNames?: Set<string>;
36
+ useCentralizedKeys?: boolean;
43
37
  }
44
- /**
45
- * Generate all custom mutation hook files
46
- * When reactQueryEnabled is false, returns empty array since mutations require React Query
47
- */
48
38
  export declare function generateAllCustomMutationHooks(options: GenerateAllCustomMutationHooksOptions): GeneratedCustomMutationFile[];