@constructive-io/graphql-codegen 4.0.0 → 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 +2 -4
- package/cli/shared.d.ts +1 -1
- package/cli/shared.js +6 -2
- package/esm/cli/index.js +2 -4
- package/esm/cli/shared.d.ts +1 -1
- package/esm/cli/shared.js +6 -2
- package/package.json +3 -3
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,10 +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 result = await (0, generate_1.generate)(
|
|
84
|
-
...targets[name],
|
|
85
|
-
...cliOptions,
|
|
86
|
-
});
|
|
84
|
+
const result = await (0, generate_1.generate)((0, config_2.mergeConfig)(targets[name], cliOptions));
|
|
87
85
|
(0, shared_1.printResult)(result);
|
|
88
86
|
if (!result.success)
|
|
89
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
|
|
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;
|
|
@@ -162,7 +163,10 @@ function flattenDbFields(config) {
|
|
|
162
163
|
function buildDbConfig(options) {
|
|
163
164
|
const { schemas, apiNames, ...rest } = options;
|
|
164
165
|
if (schemas || apiNames) {
|
|
165
|
-
return {
|
|
166
|
+
return {
|
|
167
|
+
...rest,
|
|
168
|
+
db: filterDefined({ schemas, apiNames }),
|
|
169
|
+
};
|
|
166
170
|
}
|
|
167
171
|
return rest;
|
|
168
172
|
}
|
|
@@ -202,5 +206,5 @@ function buildGenerateOptions(answers, fileConfig = {}) {
|
|
|
202
206
|
const camelized = (0, exports.camelizeArgv)(answers);
|
|
203
207
|
const normalized = normalizeCodegenListOptions(camelized);
|
|
204
208
|
const withDb = buildDbConfig(normalized);
|
|
205
|
-
return
|
|
209
|
+
return (0, config_1.mergeConfig)(fileConfig, withDb);
|
|
206
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,10 +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 result = await generate(
|
|
81
|
-
...targets[name],
|
|
82
|
-
...cliOptions,
|
|
83
|
-
});
|
|
81
|
+
const result = await generate(mergeConfig(targets[name], cliOptions));
|
|
84
82
|
printResult(result);
|
|
85
83
|
if (!result.success)
|
|
86
84
|
hasError = true;
|
package/esm/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
|
|
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;
|
|
@@ -148,7 +149,10 @@ export function flattenDbFields(config) {
|
|
|
148
149
|
export function buildDbConfig(options) {
|
|
149
150
|
const { schemas, apiNames, ...rest } = options;
|
|
150
151
|
if (schemas || apiNames) {
|
|
151
|
-
return {
|
|
152
|
+
return {
|
|
153
|
+
...rest,
|
|
154
|
+
db: filterDefined({ schemas, apiNames }),
|
|
155
|
+
};
|
|
152
156
|
}
|
|
153
157
|
return rest;
|
|
154
158
|
}
|
|
@@ -188,5 +192,5 @@ export function buildGenerateOptions(answers, fileConfig = {}) {
|
|
|
188
192
|
const camelized = camelizeArgv(answers);
|
|
189
193
|
const normalized = normalizeCodegenListOptions(camelized);
|
|
190
194
|
const withDb = buildDbConfig(normalized);
|
|
191
|
-
return
|
|
195
|
+
return mergeConfig(fileConfig, withDb);
|
|
192
196
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructive-io/graphql-codegen",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"description": "GraphQL SDK generator for Constructive databases with React Query hooks",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"graphql",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@0no-co/graphql.web": "^1.1.2",
|
|
57
57
|
"@babel/generator": "^7.28.6",
|
|
58
58
|
"@babel/types": "^7.28.6",
|
|
59
|
-
"@constructive-io/graphql-server": "^4.0.
|
|
59
|
+
"@constructive-io/graphql-server": "^4.0.1",
|
|
60
60
|
"@constructive-io/graphql-types": "^3.0.0",
|
|
61
61
|
"@inquirerer/utils": "^3.2.3",
|
|
62
62
|
"@pgpmjs/core": "^6.0.0",
|
|
@@ -99,5 +99,5 @@
|
|
|
99
99
|
"tsx": "^4.21.0",
|
|
100
100
|
"typescript": "^5.9.3"
|
|
101
101
|
},
|
|
102
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "02b0cf9bbb95891237f250e032df15d59beabde6"
|
|
103
103
|
}
|