@constructive-io/graphql-codegen 4.0.0 → 4.0.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.
- package/cli/index.js +5 -4
- package/cli/shared.js +9 -2
- package/esm/cli/index.js +5 -4
- package/esm/cli/shared.js +9 -2
- package/package.json +3 -3
package/cli/index.js
CHANGED
|
@@ -80,10 +80,11 @@ const commands = async (argv, prompter, _options) => {
|
|
|
80
80
|
let hasError = false;
|
|
81
81
|
for (const name of names) {
|
|
82
82
|
console.log(`\n[${name}]`);
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
...
|
|
86
|
-
}
|
|
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);
|
|
87
88
|
(0, shared_1.printResult)(result);
|
|
88
89
|
if (!result.success)
|
|
89
90
|
hasError = true;
|
package/cli/shared.js
CHANGED
|
@@ -162,7 +162,10 @@ function flattenDbFields(config) {
|
|
|
162
162
|
function buildDbConfig(options) {
|
|
163
163
|
const { schemas, apiNames, ...rest } = options;
|
|
164
164
|
if (schemas || apiNames) {
|
|
165
|
-
return {
|
|
165
|
+
return {
|
|
166
|
+
...rest,
|
|
167
|
+
db: filterDefined({ schemas, apiNames }),
|
|
168
|
+
};
|
|
166
169
|
}
|
|
167
170
|
return rest;
|
|
168
171
|
}
|
|
@@ -202,5 +205,9 @@ function buildGenerateOptions(answers, fileConfig = {}) {
|
|
|
202
205
|
const camelized = (0, exports.camelizeArgv)(answers);
|
|
203
206
|
const normalized = normalizeCodegenListOptions(camelized);
|
|
204
207
|
const withDb = buildDbConfig(normalized);
|
|
205
|
-
|
|
208
|
+
const merged = { ...fileConfig, ...withDb };
|
|
209
|
+
if (fileConfig.db && merged.db) {
|
|
210
|
+
merged.db = { ...fileConfig.db, ...merged.db };
|
|
211
|
+
}
|
|
212
|
+
return merged;
|
|
206
213
|
}
|
package/esm/cli/index.js
CHANGED
|
@@ -77,10 +77,11 @@ export const commands = async (argv, prompter, _options) => {
|
|
|
77
77
|
let hasError = false;
|
|
78
78
|
for (const name of names) {
|
|
79
79
|
console.log(`\n[${name}]`);
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
...
|
|
83
|
-
}
|
|
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);
|
|
84
85
|
printResult(result);
|
|
85
86
|
if (!result.success)
|
|
86
87
|
hasError = true;
|
package/esm/cli/shared.js
CHANGED
|
@@ -148,7 +148,10 @@ export function flattenDbFields(config) {
|
|
|
148
148
|
export function buildDbConfig(options) {
|
|
149
149
|
const { schemas, apiNames, ...rest } = options;
|
|
150
150
|
if (schemas || apiNames) {
|
|
151
|
-
return {
|
|
151
|
+
return {
|
|
152
|
+
...rest,
|
|
153
|
+
db: filterDefined({ schemas, apiNames }),
|
|
154
|
+
};
|
|
152
155
|
}
|
|
153
156
|
return rest;
|
|
154
157
|
}
|
|
@@ -188,5 +191,9 @@ export function buildGenerateOptions(answers, fileConfig = {}) {
|
|
|
188
191
|
const camelized = camelizeArgv(answers);
|
|
189
192
|
const normalized = normalizeCodegenListOptions(camelized);
|
|
190
193
|
const withDb = buildDbConfig(normalized);
|
|
191
|
-
|
|
194
|
+
const merged = { ...fileConfig, ...withDb };
|
|
195
|
+
if (fileConfig.db && merged.db) {
|
|
196
|
+
merged.db = { ...fileConfig.db, ...merged.db };
|
|
197
|
+
}
|
|
198
|
+
return merged;
|
|
192
199
|
}
|
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.1",
|
|
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": "c05d6bd3dfa36690aefe21079042666dfae801a1"
|
|
103
103
|
}
|