@constructive-io/graphql-codegen 2.31.0 → 2.32.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.
@@ -13,7 +13,7 @@ const input_types_generator_1 = require("./input-types-generator");
13
13
  function generateOrm(options) {
14
14
  const { tables, customOperations, config } = options;
15
15
  const files = [];
16
- const useSharedTypes = config.orm?.useSharedTypes ?? true;
16
+ const useSharedTypes = config.orm.useSharedTypes;
17
17
  const hasCustomQueries = (customOperations?.queries.length ?? 0) > 0;
18
18
  const hasCustomMutations = (customOperations?.mutations.length ?? 0) > 0;
19
19
  const typeRegistry = customOperations?.typeRegistry;
@@ -48,6 +48,6 @@ export interface GenerateOrmResult {
48
48
  errors?: string[];
49
49
  }
50
50
  /**
51
- * Execute the generate-orm command
51
+ * Execute the generate-orm command (generates ORM client)
52
52
  */
53
- export declare function generateOrmCommand(options?: GenerateOrmOptions): Promise<GenerateOrmResult>;
53
+ export declare function generateOrm(options?: GenerateOrmOptions): Promise<GenerateOrmResult>;
@@ -8,7 +8,7 @@
8
8
  * 3. Generates a Prisma-like ORM client with fluent API
9
9
  */
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.generateOrmCommand = generateOrmCommand;
11
+ exports.generateOrm = generateOrm;
12
12
  const config_1 = require("../../types/config");
13
13
  const source_1 = require("../introspect/source");
14
14
  const shared_1 = require("./shared");
@@ -16,9 +16,9 @@ const init_1 = require("./init");
16
16
  const generate_1 = require("./generate");
17
17
  const orm_1 = require("../codegen/orm");
18
18
  /**
19
- * Execute the generate-orm command
19
+ * Execute the generate-orm command (generates ORM client)
20
20
  */
21
- async function generateOrmCommand(options = {}) {
21
+ async function generateOrm(options = {}) {
22
22
  if (options.verbose) {
23
23
  console.log('Loading configuration...');
24
24
  }
@@ -71,7 +71,7 @@ async function generateOrmCommand(options = {}) {
71
71
  }
72
72
  async function generateOrmForTarget(target, options, isMultiTarget) {
73
73
  const config = target.config;
74
- const outputDir = options.output || config.orm?.output || './generated/orm';
74
+ const outputDir = options.output || config.orm.output;
75
75
  const prefix = isMultiTarget ? `[${target.name}] ` : '';
76
76
  const log = options.verbose
77
77
  ? (message) => console.log(`${prefix}${message}`)
@@ -40,9 +40,9 @@ export interface GenerateResult {
40
40
  errors?: string[];
41
41
  }
42
42
  /**
43
- * Execute the generate command
43
+ * Execute the generate command (generates React Query SDK)
44
44
  */
45
- export declare function generateCommand(options?: GenerateOptions): Promise<GenerateResult>;
45
+ export declare function generateReactQuery(options?: GenerateOptions): Promise<GenerateResult>;
46
46
  export interface GeneratedFile {
47
47
  path: string;
48
48
  content: string;
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.generateCommand = generateCommand;
36
+ exports.generateReactQuery = generateReactQuery;
37
37
  exports.writeGeneratedFiles = writeGeneratedFiles;
38
38
  exports.formatOutput = formatOutput;
39
39
  /**
@@ -53,9 +53,9 @@ const shared_1 = require("./shared");
53
53
  const init_1 = require("./init");
54
54
  const codegen_1 = require("../codegen");
55
55
  /**
56
- * Execute the generate command
56
+ * Execute the generate command (generates React Query SDK)
57
57
  */
58
- async function generateCommand(options = {}) {
58
+ async function generateReactQuery(options = {}) {
59
59
  if (options.verbose) {
60
60
  console.log('Loading configuration...');
61
61
  }
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export { initCommand, findConfigFile, loadConfigFile } from './init';
5
5
  export type { InitOptions, InitResult } from './init';
6
- export { generateCommand } from './generate';
6
+ export { generateReactQuery } from './generate';
7
7
  export type { GenerateOptions, GenerateResult, GenerateTargetResult } from './generate';
8
- export { generateOrmCommand } from './generate-orm';
8
+ export { generateOrm } from './generate-orm';
9
9
  export type { GenerateOrmOptions, GenerateOrmResult, GenerateOrmTargetResult } from './generate-orm';
@@ -3,12 +3,12 @@
3
3
  * CLI commands exports
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.generateOrmCommand = exports.generateCommand = exports.loadConfigFile = exports.findConfigFile = exports.initCommand = void 0;
6
+ exports.generateOrm = exports.generateReactQuery = exports.loadConfigFile = exports.findConfigFile = exports.initCommand = void 0;
7
7
  var init_1 = require("./init");
8
8
  Object.defineProperty(exports, "initCommand", { enumerable: true, get: function () { return init_1.initCommand; } });
9
9
  Object.defineProperty(exports, "findConfigFile", { enumerable: true, get: function () { return init_1.findConfigFile; } });
10
10
  Object.defineProperty(exports, "loadConfigFile", { enumerable: true, get: function () { return init_1.loadConfigFile; } });
11
11
  var generate_1 = require("./generate");
12
- Object.defineProperty(exports, "generateCommand", { enumerable: true, get: function () { return generate_1.generateCommand; } });
12
+ Object.defineProperty(exports, "generateReactQuery", { enumerable: true, get: function () { return generate_1.generateReactQuery; } });
13
13
  var generate_orm_1 = require("./generate-orm");
14
- Object.defineProperty(exports, "generateOrmCommand", { enumerable: true, get: function () { return generate_orm_1.generateOrmCommand; } });
14
+ Object.defineProperty(exports, "generateOrm", { enumerable: true, get: function () { return generate_orm_1.generateOrm; } });
@@ -29,8 +29,11 @@ async function runCodegenPipeline(options) {
29
29
  let tables = (0, infer_tables_1.inferTablesFromIntrospection)(introspection);
30
30
  const totalTables = tables.length;
31
31
  log(` Found ${totalTables} tables`);
32
- // 3. Filter tables by config
33
- tables = (0, transform_1.filterTables)(tables, config.tables.include, config.tables.exclude);
32
+ // 3. Filter tables by config (combine exclude and systemExclude)
33
+ tables = (0, transform_1.filterTables)(tables, config.tables.include, [
34
+ ...config.tables.exclude,
35
+ ...config.tables.systemExclude,
36
+ ]);
34
37
  const filteredTables = tables.length;
35
38
  log(` After filtering: ${filteredTables} tables`);
36
39
  // 4. Transform introspection to operations
@@ -45,9 +48,9 @@ async function runCodegenPipeline(options) {
45
48
  let customQueries = [];
46
49
  let customMutations = [];
47
50
  if (!skipCustomOperations) {
48
- // Filter by config include/exclude
49
- const filteredQueries = (0, transform_schema_1.filterOperations)(allQueries, config.queries.include, config.queries.exclude);
50
- const filteredMutations = (0, transform_schema_1.filterOperations)(allMutations, config.mutations.include, config.mutations.exclude);
51
+ // Filter by config include/exclude (combine exclude and systemExclude)
52
+ const filteredQueries = (0, transform_schema_1.filterOperations)(allQueries, config.queries.include, [...config.queries.exclude, ...config.queries.systemExclude]);
53
+ const filteredMutations = (0, transform_schema_1.filterOperations)(allMutations, config.mutations.include, [...config.mutations.exclude, ...config.mutations.systemExclude]);
51
54
  log(` After config filtering: ${filteredQueries.length} queries, ${filteredMutations.length} mutations`);
52
55
  // Remove table operations (already handled by table generators)
53
56
  customQueries = (0, transform_schema_1.getCustomOperations)(filteredQueries, tableOperationNames);
package/cli/index.js CHANGED
@@ -294,7 +294,7 @@ async function handleGenerate(argv) {
294
294
  });
295
295
  return;
296
296
  }
297
- const result = await (0, generate_1.generateCommand)({
297
+ const result = await (0, generate_1.generateReactQuery)({
298
298
  config,
299
299
  target,
300
300
  endpoint,
@@ -410,7 +410,7 @@ async function handleGenerateOrm(argv) {
410
410
  });
411
411
  return;
412
412
  }
413
- const result = await (0, generate_orm_1.generateOrmCommand)({
413
+ const result = await (0, generate_orm_1.generateOrm)({
414
414
  config,
415
415
  target,
416
416
  endpoint,
@@ -137,7 +137,7 @@ class WatchOrchestrator {
137
137
  try {
138
138
  let result;
139
139
  if (this.options.generatorType === 'generate') {
140
- result = await (0, generate_1.generateCommand)({
140
+ result = await (0, generate_1.generateReactQuery)({
141
141
  config: this.options.configPath,
142
142
  target: this.options.target,
143
143
  endpoint: this.options.config.endpoint,
@@ -148,11 +148,11 @@ class WatchOrchestrator {
148
148
  });
149
149
  }
150
150
  else {
151
- result = await (0, generate_orm_1.generateOrmCommand)({
151
+ result = await (0, generate_orm_1.generateOrm)({
152
152
  config: this.options.configPath,
153
153
  target: this.options.target,
154
154
  endpoint: this.options.config.endpoint,
155
- output: this.options.outputDir ?? this.options.config.orm?.output,
155
+ output: this.options.outputDir ?? this.options.config.orm.output,
156
156
  authorization: this.options.authorization,
157
157
  verbose: this.watchOptions.verbose,
158
158
  skipCustomOperations: this.options.skipCustomOperations,
@@ -9,7 +9,7 @@ import { generateInputTypesFile, collectInputTypeNames, collectPayloadTypeNames
9
9
  export function generateOrm(options) {
10
10
  const { tables, customOperations, config } = options;
11
11
  const files = [];
12
- const useSharedTypes = config.orm?.useSharedTypes ?? true;
12
+ const useSharedTypes = config.orm.useSharedTypes;
13
13
  const hasCustomQueries = (customOperations?.queries.length ?? 0) > 0;
14
14
  const hasCustomMutations = (customOperations?.mutations.length ?? 0) > 0;
15
15
  const typeRegistry = customOperations?.typeRegistry;
@@ -48,6 +48,6 @@ export interface GenerateOrmResult {
48
48
  errors?: string[];
49
49
  }
50
50
  /**
51
- * Execute the generate-orm command
51
+ * Execute the generate-orm command (generates ORM client)
52
52
  */
53
- export declare function generateOrmCommand(options?: GenerateOrmOptions): Promise<GenerateOrmResult>;
53
+ export declare function generateOrm(options?: GenerateOrmOptions): Promise<GenerateOrmResult>;
@@ -11,11 +11,11 @@ import { createSchemaSource, validateSourceOptions, } from '../introspect/source
11
11
  import { runCodegenPipeline, validateTablesFound } from './shared';
12
12
  import { findConfigFile, loadConfigFile } from './init';
13
13
  import { writeGeneratedFiles } from './generate';
14
- import { generateOrm } from '../codegen/orm';
14
+ import { generateOrm as generateOrmFiles } from '../codegen/orm';
15
15
  /**
16
- * Execute the generate-orm command
16
+ * Execute the generate-orm command (generates ORM client)
17
17
  */
18
- export async function generateOrmCommand(options = {}) {
18
+ export async function generateOrm(options = {}) {
19
19
  if (options.verbose) {
20
20
  console.log('Loading configuration...');
21
21
  }
@@ -68,7 +68,7 @@ export async function generateOrmCommand(options = {}) {
68
68
  }
69
69
  async function generateOrmForTarget(target, options, isMultiTarget) {
70
70
  const config = target.config;
71
- const outputDir = options.output || config.orm?.output || './generated/orm';
71
+ const outputDir = options.output || config.orm.output;
72
72
  const prefix = isMultiTarget ? `[${target.name}] ` : '';
73
73
  const log = options.verbose
74
74
  ? (message) => console.log(`${prefix}${message}`)
@@ -132,7 +132,7 @@ async function generateOrmForTarget(target, options, isMultiTarget) {
132
132
  }
133
133
  // 4. Generate ORM code
134
134
  console.log(`${prefix}Generating code...`);
135
- const { files: generatedFiles, stats: genStats } = generateOrm({
135
+ const { files: generatedFiles, stats: genStats } = generateOrmFiles({
136
136
  tables,
137
137
  customOperations: {
138
138
  queries: customOperations.queries,
@@ -40,9 +40,9 @@ export interface GenerateResult {
40
40
  errors?: string[];
41
41
  }
42
42
  /**
43
- * Execute the generate command
43
+ * Execute the generate command (generates React Query SDK)
44
44
  */
45
- export declare function generateCommand(options?: GenerateOptions): Promise<GenerateResult>;
45
+ export declare function generateReactQuery(options?: GenerateOptions): Promise<GenerateResult>;
46
46
  export interface GeneratedFile {
47
47
  path: string;
48
48
  content: string;
@@ -15,9 +15,9 @@ import { runCodegenPipeline, validateTablesFound } from './shared';
15
15
  import { findConfigFile, loadConfigFile } from './init';
16
16
  import { generate } from '../codegen';
17
17
  /**
18
- * Execute the generate command
18
+ * Execute the generate command (generates React Query SDK)
19
19
  */
20
- export async function generateCommand(options = {}) {
20
+ export async function generateReactQuery(options = {}) {
21
21
  if (options.verbose) {
22
22
  console.log('Loading configuration...');
23
23
  }
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export { initCommand, findConfigFile, loadConfigFile } from './init';
5
5
  export type { InitOptions, InitResult } from './init';
6
- export { generateCommand } from './generate';
6
+ export { generateReactQuery } from './generate';
7
7
  export type { GenerateOptions, GenerateResult, GenerateTargetResult } from './generate';
8
- export { generateOrmCommand } from './generate-orm';
8
+ export { generateOrm } from './generate-orm';
9
9
  export type { GenerateOrmOptions, GenerateOrmResult, GenerateOrmTargetResult } from './generate-orm';
@@ -2,5 +2,5 @@
2
2
  * CLI commands exports
3
3
  */
4
4
  export { initCommand, findConfigFile, loadConfigFile } from './init';
5
- export { generateCommand } from './generate';
6
- export { generateOrmCommand } from './generate-orm';
5
+ export { generateReactQuery } from './generate';
6
+ export { generateOrm } from './generate-orm';
@@ -25,8 +25,11 @@ export async function runCodegenPipeline(options) {
25
25
  let tables = inferTablesFromIntrospection(introspection);
26
26
  const totalTables = tables.length;
27
27
  log(` Found ${totalTables} tables`);
28
- // 3. Filter tables by config
29
- tables = filterTables(tables, config.tables.include, config.tables.exclude);
28
+ // 3. Filter tables by config (combine exclude and systemExclude)
29
+ tables = filterTables(tables, config.tables.include, [
30
+ ...config.tables.exclude,
31
+ ...config.tables.systemExclude,
32
+ ]);
30
33
  const filteredTables = tables.length;
31
34
  log(` After filtering: ${filteredTables} tables`);
32
35
  // 4. Transform introspection to operations
@@ -41,9 +44,9 @@ export async function runCodegenPipeline(options) {
41
44
  let customQueries = [];
42
45
  let customMutations = [];
43
46
  if (!skipCustomOperations) {
44
- // Filter by config include/exclude
45
- const filteredQueries = filterOperations(allQueries, config.queries.include, config.queries.exclude);
46
- const filteredMutations = filterOperations(allMutations, config.mutations.include, config.mutations.exclude);
47
+ // Filter by config include/exclude (combine exclude and systemExclude)
48
+ const filteredQueries = filterOperations(allQueries, config.queries.include, [...config.queries.exclude, ...config.queries.systemExclude]);
49
+ const filteredMutations = filterOperations(allMutations, config.mutations.include, [...config.mutations.exclude, ...config.mutations.systemExclude]);
47
50
  log(` After config filtering: ${filteredQueries.length} queries, ${filteredMutations.length} mutations`);
48
51
  // Remove table operations (already handled by table generators)
49
52
  customQueries = getCustomOperations(filteredQueries, tableOperationNames);
package/esm/cli/index.js CHANGED
@@ -4,8 +4,8 @@
4
4
  */
5
5
  import { CLI, cliExitWithError, extractFirst, getPackageJson } from 'inquirerer';
6
6
  import { initCommand, findConfigFile, loadConfigFile } from './commands/init';
7
- import { generateCommand } from './commands/generate';
8
- import { generateOrmCommand } from './commands/generate-orm';
7
+ import { generateReactQuery } from './commands/generate';
8
+ import { generateOrm } from './commands/generate-orm';
9
9
  import { startWatch } from './watch';
10
10
  import { isMultiConfig, mergeConfig, resolveConfig, } from '../types/config';
11
11
  const usageText = `
@@ -258,7 +258,7 @@ async function handleGenerate(argv) {
258
258
  });
259
259
  return;
260
260
  }
261
- const result = await generateCommand({
261
+ const result = await generateReactQuery({
262
262
  config,
263
263
  target,
264
264
  endpoint,
@@ -374,7 +374,7 @@ async function handleGenerateOrm(argv) {
374
374
  });
375
375
  return;
376
376
  }
377
- const result = await generateOrmCommand({
377
+ const result = await generateOrm({
378
378
  config,
379
379
  target,
380
380
  endpoint,
@@ -5,8 +5,8 @@
5
5
  */
6
6
  import { SchemaPoller } from './poller';
7
7
  import { debounce } from './debounce';
8
- import { generateCommand } from '../commands/generate';
9
- import { generateOrmCommand, } from '../commands/generate-orm';
8
+ import { generateReactQuery } from '../commands/generate';
9
+ import { generateOrm, } from '../commands/generate-orm';
10
10
  /**
11
11
  * Main watch orchestrator class
12
12
  */
@@ -133,7 +133,7 @@ export class WatchOrchestrator {
133
133
  try {
134
134
  let result;
135
135
  if (this.options.generatorType === 'generate') {
136
- result = await generateCommand({
136
+ result = await generateReactQuery({
137
137
  config: this.options.configPath,
138
138
  target: this.options.target,
139
139
  endpoint: this.options.config.endpoint,
@@ -144,11 +144,11 @@ export class WatchOrchestrator {
144
144
  });
145
145
  }
146
146
  else {
147
- result = await generateOrmCommand({
147
+ result = await generateOrm({
148
148
  config: this.options.configPath,
149
149
  target: this.options.target,
150
150
  endpoint: this.options.config.endpoint,
151
- output: this.options.outputDir ?? this.options.config.orm?.output,
151
+ output: this.options.outputDir ?? this.options.config.orm.output,
152
152
  authorization: this.options.authorization,
153
153
  verbose: this.watchOptions.verbose,
154
154
  skipCustomOperations: this.options.skipCustomOperations,
package/esm/index.d.ts CHANGED
@@ -10,5 +10,5 @@ export * from './core';
10
10
  export * from './generators';
11
11
  export * from './client';
12
12
  export { defineConfig } from './types/config';
13
- export { generateCommand, generateOrmCommand, findConfigFile, loadConfigFile, } from './cli/commands';
13
+ export { generateReactQuery, generateOrm, findConfigFile, loadConfigFile, } from './cli/commands';
14
14
  export type { GenerateOptions, GenerateResult, GenerateTargetResult, GenerateOrmOptions, GenerateOrmResult, GenerateOrmTargetResult, InitOptions, InitResult, } from './cli/commands';
package/esm/index.js CHANGED
@@ -16,4 +16,4 @@ export * from './client';
16
16
  // Config definition helper
17
17
  export { defineConfig } from './types/config';
18
18
  // CLI command exports (for packages/cli consumption)
19
- export { generateCommand, generateOrmCommand, findConfigFile, loadConfigFile, } from './cli/commands';
19
+ export { generateReactQuery, generateOrm, findConfigFile, loadConfigFile, } from './cli/commands';
@@ -88,6 +88,8 @@ export interface GraphQLSDKConfigTarget {
88
88
  include?: string[];
89
89
  /** Tables to exclude (glob patterns supported) */
90
90
  exclude?: string[];
91
+ /** System-level tables to always exclude (can be overridden to [] to disable) */
92
+ systemExclude?: string[];
91
93
  };
92
94
  /**
93
95
  * Query operation filtering (for ALL queries from __schema introspection)
@@ -96,8 +98,10 @@ export interface GraphQLSDKConfigTarget {
96
98
  queries?: {
97
99
  /** Query names to include - defaults to ['*'] */
98
100
  include?: string[];
99
- /** Query names to exclude - defaults to ['_meta', 'query'] */
101
+ /** Query names to exclude */
100
102
  exclude?: string[];
103
+ /** System-level queries to always exclude (defaults to ['_meta', 'query'], can be overridden to [] to disable) */
104
+ systemExclude?: string[];
101
105
  };
102
106
  /**
103
107
  * Mutation operation filtering (for ALL mutations from __schema introspection)
@@ -108,6 +112,8 @@ export interface GraphQLSDKConfigTarget {
108
112
  include?: string[];
109
113
  /** Mutation names to exclude */
110
114
  exclude?: string[];
115
+ /** System-level mutations to always exclude (can be overridden to [] to disable) */
116
+ systemExclude?: string[];
111
117
  };
112
118
  /**
113
119
  * Fields to exclude globally from all tables
@@ -145,6 +151,11 @@ export interface GraphQLSDKConfigTarget {
145
151
  * When set, generates a Prisma-like ORM client in addition to or instead of React Query hooks
146
152
  */
147
153
  orm?: {
154
+ /**
155
+ * Whether to generate ORM client
156
+ * @default false
157
+ */
158
+ enabled?: boolean;
148
159
  /**
149
160
  * Output directory for generated ORM client
150
161
  * @default './generated/orm'
@@ -262,14 +273,17 @@ export interface ResolvedConfig {
262
273
  tables: {
263
274
  include: string[];
264
275
  exclude: string[];
276
+ systemExclude: string[];
265
277
  };
266
278
  queries: {
267
279
  include: string[];
268
280
  exclude: string[];
281
+ systemExclude: string[];
269
282
  };
270
283
  mutations: {
271
284
  include: string[];
272
285
  exclude: string[];
286
+ systemExclude: string[];
273
287
  };
274
288
  excludeFields: string[];
275
289
  hooks: {
@@ -285,9 +299,10 @@ export interface ResolvedConfig {
285
299
  skipQueryField: boolean;
286
300
  };
287
301
  orm: {
302
+ enabled: boolean;
288
303
  output: string;
289
304
  useSharedTypes: boolean;
290
- } | null;
305
+ };
291
306
  reactQuery: {
292
307
  enabled: boolean;
293
308
  };
@@ -305,14 +320,7 @@ export declare const DEFAULT_QUERY_KEY_CONFIG: ResolvedQueryKeyConfig;
305
320
  /**
306
321
  * Default configuration values
307
322
  */
308
- export declare const DEFAULT_CONFIG: Omit<ResolvedConfig, 'endpoint' | 'schema'>;
309
- /**
310
- * Default ORM configuration values
311
- */
312
- export declare const DEFAULT_ORM_CONFIG: {
313
- output: string;
314
- useSharedTypes: boolean;
315
- };
323
+ export declare const DEFAULT_CONFIG: ResolvedConfig;
316
324
  /**
317
325
  * Helper function to define configuration with type checking
318
326
  */
@@ -329,11 +337,14 @@ export interface ResolvedTargetConfig {
329
337
  */
330
338
  export declare function isMultiConfig(config: GraphQLSDKConfig): config is GraphQLSDKMultiConfig;
331
339
  /**
332
- * Merge two target configs (defaults + overrides)
340
+ * Merge two target configs (defaults + overrides).
341
+ * Uses deepmerge with array replacement strategy - when a user specifies
342
+ * an array like include: ['users'], it replaces the default ['*'] entirely.
333
343
  */
334
344
  export declare function mergeConfig(base: GraphQLSDKConfigTarget, overrides: GraphQLSDKConfigTarget): GraphQLSDKConfigTarget;
335
345
  /**
336
- * Resolve configuration by applying defaults
346
+ * Resolve configuration by applying defaults.
347
+ * Uses deepmerge with array replacement strategy.
337
348
  */
338
349
  export declare function resolveConfig(config: GraphQLSDKConfig): ResolvedConfig;
339
350
  /**
@@ -1,6 +1,13 @@
1
1
  /**
2
2
  * SDK Configuration types
3
3
  */
4
+ import deepmerge from 'deepmerge';
5
+ /**
6
+ * Array merge strategy that replaces arrays (source wins over target).
7
+ * This ensures that when a user specifies include: ['users'], it replaces
8
+ * the default ['*'] rather than merging to ['*', 'users'].
9
+ */
10
+ const replaceArrays = (_target, source) => source;
4
11
  /**
5
12
  * Default watch configuration values
6
13
  */
@@ -24,19 +31,24 @@ export const DEFAULT_QUERY_KEY_CONFIG = {
24
31
  * Default configuration values
25
32
  */
26
33
  export const DEFAULT_CONFIG = {
34
+ endpoint: '',
35
+ schema: null,
27
36
  headers: {},
28
37
  output: './generated/graphql',
29
38
  tables: {
30
39
  include: ['*'],
31
40
  exclude: [],
41
+ systemExclude: [],
32
42
  },
33
43
  queries: {
34
44
  include: ['*'],
35
- exclude: ['_meta', 'query'], // Internal PostGraphile queries
45
+ exclude: [],
46
+ systemExclude: ['_meta', 'query'], // Internal PostGraphile queries
36
47
  },
37
48
  mutations: {
38
49
  include: ['*'],
39
50
  exclude: [],
51
+ systemExclude: [],
40
52
  },
41
53
  excludeFields: [],
42
54
  hooks: {
@@ -51,20 +63,17 @@ export const DEFAULT_CONFIG = {
51
63
  maxFieldDepth: 2,
52
64
  skipQueryField: true,
53
65
  },
54
- orm: null, // ORM generation disabled by default
66
+ orm: {
67
+ enabled: false,
68
+ output: './generated/orm',
69
+ useSharedTypes: true,
70
+ },
55
71
  reactQuery: {
56
- enabled: true, // React Query hooks enabled by default for generate command
72
+ enabled: false,
57
73
  },
58
74
  queryKeys: DEFAULT_QUERY_KEY_CONFIG,
59
75
  watch: DEFAULT_WATCH_CONFIG,
60
76
  };
61
- /**
62
- * Default ORM configuration values
63
- */
64
- export const DEFAULT_ORM_CONFIG = {
65
- output: './generated/orm',
66
- useSharedTypes: true,
67
- };
68
77
  /**
69
78
  * Helper function to define configuration with type checking
70
79
  */
@@ -79,129 +88,22 @@ export function isMultiConfig(config) {
79
88
  return typeof targets === 'object' && targets !== null;
80
89
  }
81
90
  /**
82
- * Merge two target configs (defaults + overrides)
91
+ * Merge two target configs (defaults + overrides).
92
+ * Uses deepmerge with array replacement strategy - when a user specifies
93
+ * an array like include: ['users'], it replaces the default ['*'] entirely.
83
94
  */
84
95
  export function mergeConfig(base, overrides) {
85
- const headers = base.headers || overrides.headers
86
- ? { ...(base.headers ?? {}), ...(overrides.headers ?? {}) }
87
- : undefined;
88
- const tables = base.tables || overrides.tables
89
- ? { ...(base.tables ?? {}), ...(overrides.tables ?? {}) }
90
- : undefined;
91
- const queries = base.queries || overrides.queries
92
- ? { ...(base.queries ?? {}), ...(overrides.queries ?? {}) }
93
- : undefined;
94
- const mutations = base.mutations || overrides.mutations
95
- ? { ...(base.mutations ?? {}), ...(overrides.mutations ?? {}) }
96
- : undefined;
97
- const hooks = base.hooks || overrides.hooks
98
- ? { ...(base.hooks ?? {}), ...(overrides.hooks ?? {}) }
99
- : undefined;
100
- const postgraphile = base.postgraphile || overrides.postgraphile
101
- ? { ...(base.postgraphile ?? {}), ...(overrides.postgraphile ?? {}) }
102
- : undefined;
103
- const codegen = base.codegen || overrides.codegen
104
- ? { ...(base.codegen ?? {}), ...(overrides.codegen ?? {}) }
105
- : undefined;
106
- const orm = base.orm || overrides.orm
107
- ? { ...(base.orm ?? {}), ...(overrides.orm ?? {}) }
108
- : undefined;
109
- const reactQuery = base.reactQuery || overrides.reactQuery
110
- ? { ...(base.reactQuery ?? {}), ...(overrides.reactQuery ?? {}) }
111
- : undefined;
112
- const queryKeys = base.queryKeys || overrides.queryKeys
113
- ? {
114
- ...(base.queryKeys ?? {}),
115
- ...(overrides.queryKeys ?? {}),
116
- relationships: {
117
- ...(base.queryKeys?.relationships ?? {}),
118
- ...(overrides.queryKeys?.relationships ?? {}),
119
- },
120
- }
121
- : undefined;
122
- const watch = base.watch || overrides.watch
123
- ? { ...(base.watch ?? {}), ...(overrides.watch ?? {}) }
124
- : undefined;
125
- return {
126
- ...base,
127
- ...overrides,
128
- headers,
129
- tables,
130
- queries,
131
- mutations,
132
- hooks,
133
- postgraphile,
134
- codegen,
135
- orm,
136
- reactQuery,
137
- queryKeys,
138
- watch,
139
- };
96
+ return deepmerge(base, overrides, { arrayMerge: replaceArrays });
140
97
  }
141
98
  /**
142
- * Resolve configuration by applying defaults
99
+ * Resolve configuration by applying defaults.
100
+ * Uses deepmerge with array replacement strategy.
143
101
  */
144
102
  export function resolveConfig(config) {
145
103
  if (isMultiConfig(config)) {
146
104
  throw new Error('Multi-target config cannot be resolved with resolveConfig(). Use resolveConfigTargets().');
147
105
  }
148
- return {
149
- endpoint: config.endpoint ?? '',
150
- schema: config.schema ?? null,
151
- headers: config.headers ?? DEFAULT_CONFIG.headers,
152
- output: config.output ?? DEFAULT_CONFIG.output,
153
- tables: {
154
- include: config.tables?.include ?? DEFAULT_CONFIG.tables.include,
155
- exclude: config.tables?.exclude ?? DEFAULT_CONFIG.tables.exclude,
156
- },
157
- queries: {
158
- include: config.queries?.include ?? DEFAULT_CONFIG.queries.include,
159
- exclude: config.queries?.exclude ?? DEFAULT_CONFIG.queries.exclude,
160
- },
161
- mutations: {
162
- include: config.mutations?.include ?? DEFAULT_CONFIG.mutations.include,
163
- exclude: config.mutations?.exclude ?? DEFAULT_CONFIG.mutations.exclude,
164
- },
165
- excludeFields: config.excludeFields ?? DEFAULT_CONFIG.excludeFields,
166
- hooks: {
167
- queries: config.hooks?.queries ?? DEFAULT_CONFIG.hooks.queries,
168
- mutations: config.hooks?.mutations ?? DEFAULT_CONFIG.hooks.mutations,
169
- queryKeyPrefix: config.hooks?.queryKeyPrefix ?? DEFAULT_CONFIG.hooks.queryKeyPrefix,
170
- },
171
- postgraphile: {
172
- schema: config.postgraphile?.schema ?? DEFAULT_CONFIG.postgraphile.schema,
173
- },
174
- codegen: {
175
- maxFieldDepth: config.codegen?.maxFieldDepth ?? DEFAULT_CONFIG.codegen.maxFieldDepth,
176
- skipQueryField: config.codegen?.skipQueryField ?? DEFAULT_CONFIG.codegen.skipQueryField,
177
- },
178
- orm: config.orm
179
- ? {
180
- output: config.orm.output ?? DEFAULT_ORM_CONFIG.output,
181
- useSharedTypes: config.orm.useSharedTypes ?? DEFAULT_ORM_CONFIG.useSharedTypes,
182
- }
183
- : null,
184
- reactQuery: {
185
- enabled: config.reactQuery?.enabled ?? DEFAULT_CONFIG.reactQuery.enabled,
186
- },
187
- queryKeys: {
188
- style: config.queryKeys?.style ?? DEFAULT_QUERY_KEY_CONFIG.style,
189
- relationships: config.queryKeys?.relationships ??
190
- DEFAULT_QUERY_KEY_CONFIG.relationships,
191
- generateScopedKeys: config.queryKeys?.generateScopedKeys ??
192
- DEFAULT_QUERY_KEY_CONFIG.generateScopedKeys,
193
- generateCascadeHelpers: config.queryKeys?.generateCascadeHelpers ??
194
- DEFAULT_QUERY_KEY_CONFIG.generateCascadeHelpers,
195
- generateMutationKeys: config.queryKeys?.generateMutationKeys ??
196
- DEFAULT_QUERY_KEY_CONFIG.generateMutationKeys,
197
- },
198
- watch: {
199
- pollInterval: config.watch?.pollInterval ?? DEFAULT_WATCH_CONFIG.pollInterval,
200
- debounce: config.watch?.debounce ?? DEFAULT_WATCH_CONFIG.debounce,
201
- touchFile: config.watch?.touchFile ?? DEFAULT_WATCH_CONFIG.touchFile,
202
- clearScreen: config.watch?.clearScreen ?? DEFAULT_WATCH_CONFIG.clearScreen,
203
- },
204
- };
106
+ return deepmerge(DEFAULT_CONFIG, config, { arrayMerge: replaceArrays });
205
107
  }
206
108
  /**
207
109
  * Resolve all targets in a multi-target config
package/index.d.ts CHANGED
@@ -10,5 +10,5 @@ export * from './core';
10
10
  export * from './generators';
11
11
  export * from './client';
12
12
  export { defineConfig } from './types/config';
13
- export { generateCommand, generateOrmCommand, findConfigFile, loadConfigFile, } from './cli/commands';
13
+ export { generateReactQuery, generateOrm, findConfigFile, loadConfigFile, } from './cli/commands';
14
14
  export type { GenerateOptions, GenerateResult, GenerateTargetResult, GenerateOrmOptions, GenerateOrmResult, GenerateOrmTargetResult, InitOptions, InitResult, } from './cli/commands';
package/index.js CHANGED
@@ -21,7 +21,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
21
21
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
22
22
  };
23
23
  Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.loadConfigFile = exports.findConfigFile = exports.generateOrmCommand = exports.generateCommand = exports.defineConfig = void 0;
24
+ exports.loadConfigFile = exports.findConfigFile = exports.generateOrm = exports.generateReactQuery = exports.defineConfig = void 0;
25
25
  // Core types
26
26
  __exportStar(require("./types"), exports);
27
27
  // Core query building
@@ -35,7 +35,7 @@ var config_1 = require("./types/config");
35
35
  Object.defineProperty(exports, "defineConfig", { enumerable: true, get: function () { return config_1.defineConfig; } });
36
36
  // CLI command exports (for packages/cli consumption)
37
37
  var commands_1 = require("./cli/commands");
38
- Object.defineProperty(exports, "generateCommand", { enumerable: true, get: function () { return commands_1.generateCommand; } });
39
- Object.defineProperty(exports, "generateOrmCommand", { enumerable: true, get: function () { return commands_1.generateOrmCommand; } });
38
+ Object.defineProperty(exports, "generateReactQuery", { enumerable: true, get: function () { return commands_1.generateReactQuery; } });
39
+ Object.defineProperty(exports, "generateOrm", { enumerable: true, get: function () { return commands_1.generateOrm; } });
40
40
  Object.defineProperty(exports, "findConfigFile", { enumerable: true, get: function () { return commands_1.findConfigFile; } });
41
41
  Object.defineProperty(exports, "loadConfigFile", { enumerable: true, get: function () { return commands_1.loadConfigFile; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructive-io/graphql-codegen",
3
- "version": "2.31.0",
3
+ "version": "2.32.0",
4
4
  "description": "CLI-based GraphQL SDK generator for PostGraphile endpoints with React Query hooks",
5
5
  "keywords": [
6
6
  "graphql",
@@ -59,6 +59,7 @@
59
59
  "@constructive-io/graphql-types": "^2.14.0",
60
60
  "@inquirerer/utils": "^3.2.0",
61
61
  "ajv": "^8.17.1",
62
+ "deepmerge": "^4.3.1",
62
63
  "find-and-require-package-json": "^0.9.0",
63
64
  "gql-ast": "^2.6.0",
64
65
  "graphql": "15.10.1",
@@ -91,5 +92,5 @@
91
92
  "tsx": "^4.21.0",
92
93
  "typescript": "^5.9.3"
93
94
  },
94
- "gitHead": "57fdad16730e5a09c033ac218c8674e7599db7da"
95
+ "gitHead": "39b5c59b01b8ce391dc14daf5a9430ca0ff67574"
95
96
  }
package/types/config.d.ts CHANGED
@@ -88,6 +88,8 @@ export interface GraphQLSDKConfigTarget {
88
88
  include?: string[];
89
89
  /** Tables to exclude (glob patterns supported) */
90
90
  exclude?: string[];
91
+ /** System-level tables to always exclude (can be overridden to [] to disable) */
92
+ systemExclude?: string[];
91
93
  };
92
94
  /**
93
95
  * Query operation filtering (for ALL queries from __schema introspection)
@@ -96,8 +98,10 @@ export interface GraphQLSDKConfigTarget {
96
98
  queries?: {
97
99
  /** Query names to include - defaults to ['*'] */
98
100
  include?: string[];
99
- /** Query names to exclude - defaults to ['_meta', 'query'] */
101
+ /** Query names to exclude */
100
102
  exclude?: string[];
103
+ /** System-level queries to always exclude (defaults to ['_meta', 'query'], can be overridden to [] to disable) */
104
+ systemExclude?: string[];
101
105
  };
102
106
  /**
103
107
  * Mutation operation filtering (for ALL mutations from __schema introspection)
@@ -108,6 +112,8 @@ export interface GraphQLSDKConfigTarget {
108
112
  include?: string[];
109
113
  /** Mutation names to exclude */
110
114
  exclude?: string[];
115
+ /** System-level mutations to always exclude (can be overridden to [] to disable) */
116
+ systemExclude?: string[];
111
117
  };
112
118
  /**
113
119
  * Fields to exclude globally from all tables
@@ -145,6 +151,11 @@ export interface GraphQLSDKConfigTarget {
145
151
  * When set, generates a Prisma-like ORM client in addition to or instead of React Query hooks
146
152
  */
147
153
  orm?: {
154
+ /**
155
+ * Whether to generate ORM client
156
+ * @default false
157
+ */
158
+ enabled?: boolean;
148
159
  /**
149
160
  * Output directory for generated ORM client
150
161
  * @default './generated/orm'
@@ -262,14 +273,17 @@ export interface ResolvedConfig {
262
273
  tables: {
263
274
  include: string[];
264
275
  exclude: string[];
276
+ systemExclude: string[];
265
277
  };
266
278
  queries: {
267
279
  include: string[];
268
280
  exclude: string[];
281
+ systemExclude: string[];
269
282
  };
270
283
  mutations: {
271
284
  include: string[];
272
285
  exclude: string[];
286
+ systemExclude: string[];
273
287
  };
274
288
  excludeFields: string[];
275
289
  hooks: {
@@ -285,9 +299,10 @@ export interface ResolvedConfig {
285
299
  skipQueryField: boolean;
286
300
  };
287
301
  orm: {
302
+ enabled: boolean;
288
303
  output: string;
289
304
  useSharedTypes: boolean;
290
- } | null;
305
+ };
291
306
  reactQuery: {
292
307
  enabled: boolean;
293
308
  };
@@ -305,14 +320,7 @@ export declare const DEFAULT_QUERY_KEY_CONFIG: ResolvedQueryKeyConfig;
305
320
  /**
306
321
  * Default configuration values
307
322
  */
308
- export declare const DEFAULT_CONFIG: Omit<ResolvedConfig, 'endpoint' | 'schema'>;
309
- /**
310
- * Default ORM configuration values
311
- */
312
- export declare const DEFAULT_ORM_CONFIG: {
313
- output: string;
314
- useSharedTypes: boolean;
315
- };
323
+ export declare const DEFAULT_CONFIG: ResolvedConfig;
316
324
  /**
317
325
  * Helper function to define configuration with type checking
318
326
  */
@@ -329,11 +337,14 @@ export interface ResolvedTargetConfig {
329
337
  */
330
338
  export declare function isMultiConfig(config: GraphQLSDKConfig): config is GraphQLSDKMultiConfig;
331
339
  /**
332
- * Merge two target configs (defaults + overrides)
340
+ * Merge two target configs (defaults + overrides).
341
+ * Uses deepmerge with array replacement strategy - when a user specifies
342
+ * an array like include: ['users'], it replaces the default ['*'] entirely.
333
343
  */
334
344
  export declare function mergeConfig(base: GraphQLSDKConfigTarget, overrides: GraphQLSDKConfigTarget): GraphQLSDKConfigTarget;
335
345
  /**
336
- * Resolve configuration by applying defaults
346
+ * Resolve configuration by applying defaults.
347
+ * Uses deepmerge with array replacement strategy.
337
348
  */
338
349
  export declare function resolveConfig(config: GraphQLSDKConfig): ResolvedConfig;
339
350
  /**
package/types/config.js CHANGED
@@ -2,13 +2,23 @@
2
2
  /**
3
3
  * SDK Configuration types
4
4
  */
5
+ var __importDefault = (this && this.__importDefault) || function (mod) {
6
+ return (mod && mod.__esModule) ? mod : { "default": mod };
7
+ };
5
8
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.DEFAULT_ORM_CONFIG = exports.DEFAULT_CONFIG = exports.DEFAULT_QUERY_KEY_CONFIG = exports.DEFAULT_WATCH_CONFIG = void 0;
9
+ exports.DEFAULT_CONFIG = exports.DEFAULT_QUERY_KEY_CONFIG = exports.DEFAULT_WATCH_CONFIG = void 0;
7
10
  exports.defineConfig = defineConfig;
8
11
  exports.isMultiConfig = isMultiConfig;
9
12
  exports.mergeConfig = mergeConfig;
10
13
  exports.resolveConfig = resolveConfig;
11
14
  exports.resolveConfigTargets = resolveConfigTargets;
15
+ const deepmerge_1 = __importDefault(require("deepmerge"));
16
+ /**
17
+ * Array merge strategy that replaces arrays (source wins over target).
18
+ * This ensures that when a user specifies include: ['users'], it replaces
19
+ * the default ['*'] rather than merging to ['*', 'users'].
20
+ */
21
+ const replaceArrays = (_target, source) => source;
12
22
  /**
13
23
  * Default watch configuration values
14
24
  */
@@ -32,19 +42,24 @@ exports.DEFAULT_QUERY_KEY_CONFIG = {
32
42
  * Default configuration values
33
43
  */
34
44
  exports.DEFAULT_CONFIG = {
45
+ endpoint: '',
46
+ schema: null,
35
47
  headers: {},
36
48
  output: './generated/graphql',
37
49
  tables: {
38
50
  include: ['*'],
39
51
  exclude: [],
52
+ systemExclude: [],
40
53
  },
41
54
  queries: {
42
55
  include: ['*'],
43
- exclude: ['_meta', 'query'], // Internal PostGraphile queries
56
+ exclude: [],
57
+ systemExclude: ['_meta', 'query'], // Internal PostGraphile queries
44
58
  },
45
59
  mutations: {
46
60
  include: ['*'],
47
61
  exclude: [],
62
+ systemExclude: [],
48
63
  },
49
64
  excludeFields: [],
50
65
  hooks: {
@@ -59,20 +74,17 @@ exports.DEFAULT_CONFIG = {
59
74
  maxFieldDepth: 2,
60
75
  skipQueryField: true,
61
76
  },
62
- orm: null, // ORM generation disabled by default
77
+ orm: {
78
+ enabled: false,
79
+ output: './generated/orm',
80
+ useSharedTypes: true,
81
+ },
63
82
  reactQuery: {
64
- enabled: true, // React Query hooks enabled by default for generate command
83
+ enabled: false,
65
84
  },
66
85
  queryKeys: exports.DEFAULT_QUERY_KEY_CONFIG,
67
86
  watch: exports.DEFAULT_WATCH_CONFIG,
68
87
  };
69
- /**
70
- * Default ORM configuration values
71
- */
72
- exports.DEFAULT_ORM_CONFIG = {
73
- output: './generated/orm',
74
- useSharedTypes: true,
75
- };
76
88
  /**
77
89
  * Helper function to define configuration with type checking
78
90
  */
@@ -87,129 +99,22 @@ function isMultiConfig(config) {
87
99
  return typeof targets === 'object' && targets !== null;
88
100
  }
89
101
  /**
90
- * Merge two target configs (defaults + overrides)
102
+ * Merge two target configs (defaults + overrides).
103
+ * Uses deepmerge with array replacement strategy - when a user specifies
104
+ * an array like include: ['users'], it replaces the default ['*'] entirely.
91
105
  */
92
106
  function mergeConfig(base, overrides) {
93
- const headers = base.headers || overrides.headers
94
- ? { ...(base.headers ?? {}), ...(overrides.headers ?? {}) }
95
- : undefined;
96
- const tables = base.tables || overrides.tables
97
- ? { ...(base.tables ?? {}), ...(overrides.tables ?? {}) }
98
- : undefined;
99
- const queries = base.queries || overrides.queries
100
- ? { ...(base.queries ?? {}), ...(overrides.queries ?? {}) }
101
- : undefined;
102
- const mutations = base.mutations || overrides.mutations
103
- ? { ...(base.mutations ?? {}), ...(overrides.mutations ?? {}) }
104
- : undefined;
105
- const hooks = base.hooks || overrides.hooks
106
- ? { ...(base.hooks ?? {}), ...(overrides.hooks ?? {}) }
107
- : undefined;
108
- const postgraphile = base.postgraphile || overrides.postgraphile
109
- ? { ...(base.postgraphile ?? {}), ...(overrides.postgraphile ?? {}) }
110
- : undefined;
111
- const codegen = base.codegen || overrides.codegen
112
- ? { ...(base.codegen ?? {}), ...(overrides.codegen ?? {}) }
113
- : undefined;
114
- const orm = base.orm || overrides.orm
115
- ? { ...(base.orm ?? {}), ...(overrides.orm ?? {}) }
116
- : undefined;
117
- const reactQuery = base.reactQuery || overrides.reactQuery
118
- ? { ...(base.reactQuery ?? {}), ...(overrides.reactQuery ?? {}) }
119
- : undefined;
120
- const queryKeys = base.queryKeys || overrides.queryKeys
121
- ? {
122
- ...(base.queryKeys ?? {}),
123
- ...(overrides.queryKeys ?? {}),
124
- relationships: {
125
- ...(base.queryKeys?.relationships ?? {}),
126
- ...(overrides.queryKeys?.relationships ?? {}),
127
- },
128
- }
129
- : undefined;
130
- const watch = base.watch || overrides.watch
131
- ? { ...(base.watch ?? {}), ...(overrides.watch ?? {}) }
132
- : undefined;
133
- return {
134
- ...base,
135
- ...overrides,
136
- headers,
137
- tables,
138
- queries,
139
- mutations,
140
- hooks,
141
- postgraphile,
142
- codegen,
143
- orm,
144
- reactQuery,
145
- queryKeys,
146
- watch,
147
- };
107
+ return (0, deepmerge_1.default)(base, overrides, { arrayMerge: replaceArrays });
148
108
  }
149
109
  /**
150
- * Resolve configuration by applying defaults
110
+ * Resolve configuration by applying defaults.
111
+ * Uses deepmerge with array replacement strategy.
151
112
  */
152
113
  function resolveConfig(config) {
153
114
  if (isMultiConfig(config)) {
154
115
  throw new Error('Multi-target config cannot be resolved with resolveConfig(). Use resolveConfigTargets().');
155
116
  }
156
- return {
157
- endpoint: config.endpoint ?? '',
158
- schema: config.schema ?? null,
159
- headers: config.headers ?? exports.DEFAULT_CONFIG.headers,
160
- output: config.output ?? exports.DEFAULT_CONFIG.output,
161
- tables: {
162
- include: config.tables?.include ?? exports.DEFAULT_CONFIG.tables.include,
163
- exclude: config.tables?.exclude ?? exports.DEFAULT_CONFIG.tables.exclude,
164
- },
165
- queries: {
166
- include: config.queries?.include ?? exports.DEFAULT_CONFIG.queries.include,
167
- exclude: config.queries?.exclude ?? exports.DEFAULT_CONFIG.queries.exclude,
168
- },
169
- mutations: {
170
- include: config.mutations?.include ?? exports.DEFAULT_CONFIG.mutations.include,
171
- exclude: config.mutations?.exclude ?? exports.DEFAULT_CONFIG.mutations.exclude,
172
- },
173
- excludeFields: config.excludeFields ?? exports.DEFAULT_CONFIG.excludeFields,
174
- hooks: {
175
- queries: config.hooks?.queries ?? exports.DEFAULT_CONFIG.hooks.queries,
176
- mutations: config.hooks?.mutations ?? exports.DEFAULT_CONFIG.hooks.mutations,
177
- queryKeyPrefix: config.hooks?.queryKeyPrefix ?? exports.DEFAULT_CONFIG.hooks.queryKeyPrefix,
178
- },
179
- postgraphile: {
180
- schema: config.postgraphile?.schema ?? exports.DEFAULT_CONFIG.postgraphile.schema,
181
- },
182
- codegen: {
183
- maxFieldDepth: config.codegen?.maxFieldDepth ?? exports.DEFAULT_CONFIG.codegen.maxFieldDepth,
184
- skipQueryField: config.codegen?.skipQueryField ?? exports.DEFAULT_CONFIG.codegen.skipQueryField,
185
- },
186
- orm: config.orm
187
- ? {
188
- output: config.orm.output ?? exports.DEFAULT_ORM_CONFIG.output,
189
- useSharedTypes: config.orm.useSharedTypes ?? exports.DEFAULT_ORM_CONFIG.useSharedTypes,
190
- }
191
- : null,
192
- reactQuery: {
193
- enabled: config.reactQuery?.enabled ?? exports.DEFAULT_CONFIG.reactQuery.enabled,
194
- },
195
- queryKeys: {
196
- style: config.queryKeys?.style ?? exports.DEFAULT_QUERY_KEY_CONFIG.style,
197
- relationships: config.queryKeys?.relationships ??
198
- exports.DEFAULT_QUERY_KEY_CONFIG.relationships,
199
- generateScopedKeys: config.queryKeys?.generateScopedKeys ??
200
- exports.DEFAULT_QUERY_KEY_CONFIG.generateScopedKeys,
201
- generateCascadeHelpers: config.queryKeys?.generateCascadeHelpers ??
202
- exports.DEFAULT_QUERY_KEY_CONFIG.generateCascadeHelpers,
203
- generateMutationKeys: config.queryKeys?.generateMutationKeys ??
204
- exports.DEFAULT_QUERY_KEY_CONFIG.generateMutationKeys,
205
- },
206
- watch: {
207
- pollInterval: config.watch?.pollInterval ?? exports.DEFAULT_WATCH_CONFIG.pollInterval,
208
- debounce: config.watch?.debounce ?? exports.DEFAULT_WATCH_CONFIG.debounce,
209
- touchFile: config.watch?.touchFile ?? exports.DEFAULT_WATCH_CONFIG.touchFile,
210
- clearScreen: config.watch?.clearScreen ?? exports.DEFAULT_WATCH_CONFIG.clearScreen,
211
- },
212
- };
117
+ return (0, deepmerge_1.default)(exports.DEFAULT_CONFIG, config, { arrayMerge: replaceArrays });
213
118
  }
214
119
  /**
215
120
  * Resolve all targets in a multi-target config