@constructive-io/graphql-codegen 4.0.1 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cli/index.js CHANGED
@@ -11,6 +11,7 @@ exports.options = exports.commands = void 0;
11
11
  const inquirerer_1 = require("inquirerer");
12
12
  const config_1 = require("../core/config");
13
13
  const generate_1 = require("../core/generate");
14
+ const config_2 = require("../types/config");
14
15
  const shared_1 = require("./shared");
15
16
  const usage = `
16
17
  graphql-codegen - GraphQL SDK generator for Constructive databases
@@ -80,11 +81,7 @@ const commands = async (argv, prompter, _options) => {
80
81
  let hasError = false;
81
82
  for (const name of names) {
82
83
  console.log(`\n[${name}]`);
83
- const targetConfig = { ...targets[name], ...cliOptions };
84
- if (targets[name].db && targetConfig.db) {
85
- targetConfig.db = { ...targets[name].db, ...targetConfig.db };
86
- }
87
- const result = await (0, generate_1.generate)(targetConfig);
84
+ const result = await (0, generate_1.generate)((0, config_2.mergeConfig)(targets[name], cliOptions));
88
85
  (0, shared_1.printResult)(result);
89
86
  if (!result.success)
90
87
  hasError = true;
package/cli/shared.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { Question } from 'inquirerer';
2
2
  import type { GenerateResult } from '../core/generate';
3
- import type { GraphQLSDKConfigTarget } from '../types/config';
3
+ import { type GraphQLSDKConfigTarget } from '../types/config';
4
4
  export declare const splitCommas: (input: string | undefined) => string[] | undefined;
5
5
  export interface CodegenAnswers {
6
6
  endpoint?: string;
package/cli/shared.js CHANGED
@@ -17,6 +17,7 @@ exports.buildGenerateOptions = buildGenerateOptions;
17
17
  */
18
18
  const inflekt_1 = require("inflekt");
19
19
  const transform_keys_1 = require("inflekt/transform-keys");
20
+ const config_1 = require("../types/config");
20
21
  const splitCommas = (input) => {
21
22
  if (!input)
22
23
  return undefined;
@@ -205,9 +206,5 @@ function buildGenerateOptions(answers, fileConfig = {}) {
205
206
  const camelized = (0, exports.camelizeArgv)(answers);
206
207
  const normalized = normalizeCodegenListOptions(camelized);
207
208
  const withDb = buildDbConfig(normalized);
208
- const merged = { ...fileConfig, ...withDb };
209
- if (fileConfig.db && merged.db) {
210
- merged.db = { ...fileConfig.db, ...merged.db };
211
- }
212
- return merged;
209
+ return (0, config_1.mergeConfig)(fileConfig, withDb);
213
210
  }
package/esm/cli/index.js CHANGED
@@ -8,6 +8,7 @@
8
8
  import { CLI, getPackageJson } from 'inquirerer';
9
9
  import { findConfigFile, loadConfigFile } from '../core/config';
10
10
  import { generate } from '../core/generate';
11
+ import { mergeConfig } from '../types/config';
11
12
  import { buildDbConfig, buildGenerateOptions, camelizeArgv, codegenQuestions, hasResolvedCodegenSource, normalizeCodegenListOptions, printResult, seedArgvFromConfig, } from './shared';
12
13
  const usage = `
13
14
  graphql-codegen - GraphQL SDK generator for Constructive databases
@@ -77,11 +78,7 @@ export const commands = async (argv, prompter, _options) => {
77
78
  let hasError = false;
78
79
  for (const name of names) {
79
80
  console.log(`\n[${name}]`);
80
- const targetConfig = { ...targets[name], ...cliOptions };
81
- if (targets[name].db && targetConfig.db) {
82
- targetConfig.db = { ...targets[name].db, ...targetConfig.db };
83
- }
84
- const result = await generate(targetConfig);
81
+ const result = await generate(mergeConfig(targets[name], cliOptions));
85
82
  printResult(result);
86
83
  if (!result.success)
87
84
  hasError = true;
@@ -1,6 +1,6 @@
1
1
  import type { Question } from 'inquirerer';
2
2
  import type { GenerateResult } from '../core/generate';
3
- import type { GraphQLSDKConfigTarget } from '../types/config';
3
+ import { type GraphQLSDKConfigTarget } from '../types/config';
4
4
  export declare const splitCommas: (input: string | undefined) => string[] | undefined;
5
5
  export interface CodegenAnswers {
6
6
  endpoint?: string;
package/esm/cli/shared.js CHANGED
@@ -6,6 +6,7 @@
6
6
  */
7
7
  import { camelize } from 'inflekt';
8
8
  import { inflektTree } from 'inflekt/transform-keys';
9
+ import { mergeConfig } from '../types/config';
9
10
  export const splitCommas = (input) => {
10
11
  if (!input)
11
12
  return undefined;
@@ -191,9 +192,5 @@ export function buildGenerateOptions(answers, fileConfig = {}) {
191
192
  const camelized = camelizeArgv(answers);
192
193
  const normalized = normalizeCodegenListOptions(camelized);
193
194
  const withDb = buildDbConfig(normalized);
194
- const merged = { ...fileConfig, ...withDb };
195
- if (fileConfig.db && merged.db) {
196
- merged.db = { ...fileConfig.db, ...merged.db };
197
- }
198
- return merged;
195
+ return mergeConfig(fileConfig, withDb);
199
196
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructive-io/graphql-codegen",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "description": "GraphQL SDK generator for Constructive databases with React Query hooks",
5
5
  "keywords": [
6
6
  "graphql",
@@ -99,5 +99,5 @@
99
99
  "tsx": "^4.21.0",
100
100
  "typescript": "^5.9.3"
101
101
  },
102
- "gitHead": "c05d6bd3dfa36690aefe21079042666dfae801a1"
102
+ "gitHead": "02b0cf9bbb95891237f250e032df15d59beabde6"
103
103
  }