@constructive-io/graphql-codegen 4.15.2 → 4.15.4
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/handler.js +13 -4
- package/cli/index.js +6 -2
- package/core/generate.d.ts +2 -5
- package/core/generate.js +16 -8
- package/core/introspect/source/pgpm-module.js +4 -0
- package/esm/cli/handler.js +13 -4
- package/esm/cli/index.js +6 -2
- package/esm/core/generate.d.ts +2 -5
- package/esm/core/generate.js +16 -8
- package/esm/core/introspect/source/pgpm-module.js +5 -1
- package/esm/types/config.d.ts +29 -0
- package/esm/types/index.d.ts +1 -1
- package/package.json +7 -7
- package/types/config.d.ts +29 -0
- package/types/index.d.ts +1 -1
package/cli/handler.js
CHANGED
|
@@ -6,7 +6,13 @@ const generate_1 = require("../core/generate");
|
|
|
6
6
|
const shared_1 = require("./shared");
|
|
7
7
|
async function runCodegenHandler(argv, prompter) {
|
|
8
8
|
const args = (0, shared_1.camelizeArgv)(argv);
|
|
9
|
-
const
|
|
9
|
+
const schemaConfig = args.schemaEnabled
|
|
10
|
+
? {
|
|
11
|
+
enabled: true,
|
|
12
|
+
...(args.schemaOutput ? { output: String(args.schemaOutput) } : {}),
|
|
13
|
+
...(args.schemaFilename ? { filename: String(args.schemaFilename) } : {}),
|
|
14
|
+
}
|
|
15
|
+
: undefined;
|
|
10
16
|
const hasSourceFlags = Boolean(args.endpoint || args.schemaFile || args.schemaDir || args.schemas || args.apiNames);
|
|
11
17
|
const configPath = args.config ||
|
|
12
18
|
(!hasSourceFlags ? (0, config_1.findConfigFile)() : undefined);
|
|
@@ -36,7 +42,7 @@ async function runCodegenHandler(argv, prompter) {
|
|
|
36
42
|
const { results, hasError } = await (0, generate_1.generateMulti)({
|
|
37
43
|
configs: selectedTargets,
|
|
38
44
|
cliOverrides: cliOptions,
|
|
39
|
-
|
|
45
|
+
schema: schemaConfig,
|
|
40
46
|
});
|
|
41
47
|
for (const { name, result } of results) {
|
|
42
48
|
console.log(`\n[${name}]`);
|
|
@@ -59,7 +65,7 @@ async function runCodegenHandler(argv, prompter) {
|
|
|
59
65
|
if (expanded) {
|
|
60
66
|
const { results, hasError } = await (0, generate_1.generateMulti)({
|
|
61
67
|
configs: expanded,
|
|
62
|
-
|
|
68
|
+
schema: schemaConfig,
|
|
63
69
|
});
|
|
64
70
|
for (const { name, result } of results) {
|
|
65
71
|
console.log(`\n[${name}]`);
|
|
@@ -69,6 +75,9 @@ async function runCodegenHandler(argv, prompter) {
|
|
|
69
75
|
process.exit(1);
|
|
70
76
|
return;
|
|
71
77
|
}
|
|
72
|
-
const result = await (0, generate_1.generate)({
|
|
78
|
+
const result = await (0, generate_1.generate)({
|
|
79
|
+
...options,
|
|
80
|
+
...(schemaConfig ? { schema: schemaConfig } : {}),
|
|
81
|
+
});
|
|
73
82
|
(0, shared_1.printResult)(result);
|
|
74
83
|
}
|
package/cli/index.js
CHANGED
|
@@ -37,9 +37,11 @@ Generator Options:
|
|
|
37
37
|
-v, --verbose Show detailed output
|
|
38
38
|
|
|
39
39
|
Schema Export:
|
|
40
|
-
--schema-
|
|
40
|
+
--schema-enabled Export GraphQL SDL instead of running full codegen.
|
|
41
41
|
Works with any source (endpoint, file, database, PGPM).
|
|
42
42
|
With multiple apiNames, writes one .graphql per API.
|
|
43
|
+
--schema-output <dir> Output directory for the exported schema file
|
|
44
|
+
--schema-filename <name> Filename for the exported schema (default: schema.graphql)
|
|
43
45
|
|
|
44
46
|
-h, --help Show this help message
|
|
45
47
|
--version Show version number
|
|
@@ -71,12 +73,14 @@ exports.options = {
|
|
|
71
73
|
a: 'authorization',
|
|
72
74
|
v: 'verbose',
|
|
73
75
|
},
|
|
74
|
-
boolean: ['schema-
|
|
76
|
+
boolean: ['schema-enabled'],
|
|
75
77
|
string: [
|
|
76
78
|
'config',
|
|
77
79
|
'endpoint',
|
|
78
80
|
'schema-file',
|
|
79
81
|
'schema-dir',
|
|
82
|
+
'schema-output',
|
|
83
|
+
'schema-filename',
|
|
80
84
|
'output',
|
|
81
85
|
'target',
|
|
82
86
|
'authorization',
|
package/core/generate.d.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import type { CliConfig, GraphQLSDKConfigTarget } from '../types/config';
|
|
1
|
+
import type { CliConfig, GraphQLSDKConfigTarget, SchemaConfig } from '../types/config';
|
|
2
2
|
import type { CleanOperation, CleanTable, TypeRegistry } from '../types/schema';
|
|
3
3
|
export interface GenerateOptions extends GraphQLSDKConfigTarget {
|
|
4
4
|
authorization?: string;
|
|
5
5
|
verbose?: boolean;
|
|
6
6
|
dryRun?: boolean;
|
|
7
7
|
skipCustomOperations?: boolean;
|
|
8
|
-
schemaOnly?: boolean;
|
|
9
|
-
schemaOnlyOutput?: string;
|
|
10
|
-
schemaOnlyFilename?: string;
|
|
11
8
|
}
|
|
12
9
|
export interface GenerateResult {
|
|
13
10
|
success: boolean;
|
|
@@ -47,7 +44,7 @@ export interface GenerateMultiOptions {
|
|
|
47
44
|
cliOverrides?: Partial<GraphQLSDKConfigTarget>;
|
|
48
45
|
verbose?: boolean;
|
|
49
46
|
dryRun?: boolean;
|
|
50
|
-
|
|
47
|
+
schema?: SchemaConfig;
|
|
51
48
|
unifiedCli?: CliConfig | boolean;
|
|
52
49
|
}
|
|
53
50
|
export interface GenerateMultiResult {
|
package/core/generate.js
CHANGED
|
@@ -50,6 +50,7 @@ const fs = __importStar(require("node:fs"));
|
|
|
50
50
|
const node_path_1 = __importDefault(require("node:path"));
|
|
51
51
|
const graphql_1 = require("graphql");
|
|
52
52
|
const core_1 = require("@pgpmjs/core");
|
|
53
|
+
const pg_cache_1 = require("pg-cache");
|
|
53
54
|
const pgsql_client_1 = require("pgsql-client");
|
|
54
55
|
const pgsql_seed_1 = require("pgsql-seed");
|
|
55
56
|
const config_1 = require("../types/config");
|
|
@@ -91,7 +92,8 @@ async function generate(options = {}, internalOptions) {
|
|
|
91
92
|
// Auto-enable nodeHttpAdapter when CLI is enabled, unless explicitly set to false
|
|
92
93
|
const useNodeHttpAdapter = options.nodeHttpAdapter === true ||
|
|
93
94
|
(runCli && options.nodeHttpAdapter !== false);
|
|
94
|
-
|
|
95
|
+
const schemaEnabled = !!options.schema?.enabled;
|
|
96
|
+
if (!schemaEnabled && !runReactQuery && !runOrm && !runCli) {
|
|
95
97
|
return {
|
|
96
98
|
success: false,
|
|
97
99
|
message: 'No generators enabled. Use reactQuery: true, orm: true, or cli: true in your config.',
|
|
@@ -118,7 +120,7 @@ async function generate(options = {}, internalOptions) {
|
|
|
118
120
|
authorization: options.authorization || config.headers?.Authorization,
|
|
119
121
|
headers: config.headers,
|
|
120
122
|
});
|
|
121
|
-
if (
|
|
123
|
+
if (schemaEnabled && !runReactQuery && !runOrm && !runCli) {
|
|
122
124
|
try {
|
|
123
125
|
console.log(`Fetching schema from ${source.describe()}...`);
|
|
124
126
|
const { introspection } = await source.fetch();
|
|
@@ -131,9 +133,9 @@ async function generate(options = {}, internalOptions) {
|
|
|
131
133
|
output: outputRoot,
|
|
132
134
|
};
|
|
133
135
|
}
|
|
134
|
-
const outDir = node_path_1.default.resolve(options.
|
|
136
|
+
const outDir = node_path_1.default.resolve(options.schema?.output || outputRoot || '.');
|
|
135
137
|
await fs.promises.mkdir(outDir, { recursive: true });
|
|
136
|
-
const filename = options.
|
|
138
|
+
const filename = options.schema?.filename || 'schema.graphql';
|
|
137
139
|
const filePath = node_path_1.default.join(outDir, filename);
|
|
138
140
|
await fs.promises.writeFile(filePath, sdl, 'utf-8');
|
|
139
141
|
return {
|
|
@@ -538,12 +540,13 @@ function applySharedPgpmDb(config, sharedSources) {
|
|
|
538
540
|
};
|
|
539
541
|
}
|
|
540
542
|
async function generateMulti(options) {
|
|
541
|
-
const { configs, cliOverrides, verbose, dryRun,
|
|
543
|
+
const { configs, cliOverrides, verbose, dryRun, schema, unifiedCli } = options;
|
|
542
544
|
const names = Object.keys(configs);
|
|
543
545
|
const results = [];
|
|
544
546
|
let hasError = false;
|
|
547
|
+
const schemaEnabled = !!schema?.enabled;
|
|
545
548
|
const targetInfos = [];
|
|
546
|
-
const useUnifiedCli = !
|
|
549
|
+
const useUnifiedCli = !schemaEnabled && !!unifiedCli && names.length > 1;
|
|
547
550
|
const cliTargets = [];
|
|
548
551
|
const sharedSources = await prepareSharedPgpmSources(configs, cliOverrides);
|
|
549
552
|
try {
|
|
@@ -557,8 +560,9 @@ async function generateMulti(options) {
|
|
|
557
560
|
...targetConfig,
|
|
558
561
|
verbose,
|
|
559
562
|
dryRun,
|
|
560
|
-
|
|
561
|
-
|
|
563
|
+
schema: schemaEnabled
|
|
564
|
+
? { ...schema, filename: schema?.filename ?? `${name}.graphql` }
|
|
565
|
+
: targetConfig.schema,
|
|
562
566
|
}, useUnifiedCli ? { skipCli: true, targetName: name } : { targetName: name });
|
|
563
567
|
results.push({ name, result });
|
|
564
568
|
if (!result.success) {
|
|
@@ -681,6 +685,10 @@ async function generateMulti(options) {
|
|
|
681
685
|
finally {
|
|
682
686
|
for (const shared of sharedSources.values()) {
|
|
683
687
|
const keepDb = Object.values(configs).some((c) => c.db?.keepDb);
|
|
688
|
+
// Release pg-cache pool for this ephemeral database before dropping
|
|
689
|
+
// deployPgpm() caches connections that must be closed first
|
|
690
|
+
pg_cache_1.pgCache.delete(shared.ephemeralDb.config.database);
|
|
691
|
+
await pg_cache_1.pgCache.waitForDisposals();
|
|
684
692
|
shared.ephemeralDb.teardown({ keepDb });
|
|
685
693
|
}
|
|
686
694
|
}
|
|
@@ -136,6 +136,10 @@ class PgpmModuleSchemaSource {
|
|
|
136
136
|
return { introspection };
|
|
137
137
|
}
|
|
138
138
|
finally {
|
|
139
|
+
// Release pg-cache pool for this ephemeral database before dropping
|
|
140
|
+
// deployPgpm() and getPgPool() cache connections that must be closed first
|
|
141
|
+
pg_cache_1.pgCache.delete(dbConfig.database);
|
|
142
|
+
await pg_cache_1.pgCache.waitForDisposals();
|
|
139
143
|
// Clean up the ephemeral database
|
|
140
144
|
teardown({ keepDb });
|
|
141
145
|
if (keepDb) {
|
package/esm/cli/handler.js
CHANGED
|
@@ -3,7 +3,13 @@ import { expandApiNamesToMultiTarget, expandSchemaDirToMultiTarget, generate, ge
|
|
|
3
3
|
import { buildDbConfig, buildGenerateOptions, camelizeArgv, codegenQuestions, hasResolvedCodegenSource, normalizeCodegenListOptions, printResult, seedArgvFromConfig, } from './shared';
|
|
4
4
|
export async function runCodegenHandler(argv, prompter) {
|
|
5
5
|
const args = camelizeArgv(argv);
|
|
6
|
-
const
|
|
6
|
+
const schemaConfig = args.schemaEnabled
|
|
7
|
+
? {
|
|
8
|
+
enabled: true,
|
|
9
|
+
...(args.schemaOutput ? { output: String(args.schemaOutput) } : {}),
|
|
10
|
+
...(args.schemaFilename ? { filename: String(args.schemaFilename) } : {}),
|
|
11
|
+
}
|
|
12
|
+
: undefined;
|
|
7
13
|
const hasSourceFlags = Boolean(args.endpoint || args.schemaFile || args.schemaDir || args.schemas || args.apiNames);
|
|
8
14
|
const configPath = args.config ||
|
|
9
15
|
(!hasSourceFlags ? findConfigFile() : undefined);
|
|
@@ -33,7 +39,7 @@ export async function runCodegenHandler(argv, prompter) {
|
|
|
33
39
|
const { results, hasError } = await generateMulti({
|
|
34
40
|
configs: selectedTargets,
|
|
35
41
|
cliOverrides: cliOptions,
|
|
36
|
-
|
|
42
|
+
schema: schemaConfig,
|
|
37
43
|
});
|
|
38
44
|
for (const { name, result } of results) {
|
|
39
45
|
console.log(`\n[${name}]`);
|
|
@@ -56,7 +62,7 @@ export async function runCodegenHandler(argv, prompter) {
|
|
|
56
62
|
if (expanded) {
|
|
57
63
|
const { results, hasError } = await generateMulti({
|
|
58
64
|
configs: expanded,
|
|
59
|
-
|
|
65
|
+
schema: schemaConfig,
|
|
60
66
|
});
|
|
61
67
|
for (const { name, result } of results) {
|
|
62
68
|
console.log(`\n[${name}]`);
|
|
@@ -66,6 +72,9 @@ export async function runCodegenHandler(argv, prompter) {
|
|
|
66
72
|
process.exit(1);
|
|
67
73
|
return;
|
|
68
74
|
}
|
|
69
|
-
const result = await generate({
|
|
75
|
+
const result = await generate({
|
|
76
|
+
...options,
|
|
77
|
+
...(schemaConfig ? { schema: schemaConfig } : {}),
|
|
78
|
+
});
|
|
70
79
|
printResult(result);
|
|
71
80
|
}
|
package/esm/cli/index.js
CHANGED
|
@@ -34,9 +34,11 @@ Generator Options:
|
|
|
34
34
|
-v, --verbose Show detailed output
|
|
35
35
|
|
|
36
36
|
Schema Export:
|
|
37
|
-
--schema-
|
|
37
|
+
--schema-enabled Export GraphQL SDL instead of running full codegen.
|
|
38
38
|
Works with any source (endpoint, file, database, PGPM).
|
|
39
39
|
With multiple apiNames, writes one .graphql per API.
|
|
40
|
+
--schema-output <dir> Output directory for the exported schema file
|
|
41
|
+
--schema-filename <name> Filename for the exported schema (default: schema.graphql)
|
|
40
42
|
|
|
41
43
|
-h, --help Show this help message
|
|
42
44
|
--version Show version number
|
|
@@ -67,12 +69,14 @@ export const options = {
|
|
|
67
69
|
a: 'authorization',
|
|
68
70
|
v: 'verbose',
|
|
69
71
|
},
|
|
70
|
-
boolean: ['schema-
|
|
72
|
+
boolean: ['schema-enabled'],
|
|
71
73
|
string: [
|
|
72
74
|
'config',
|
|
73
75
|
'endpoint',
|
|
74
76
|
'schema-file',
|
|
75
77
|
'schema-dir',
|
|
78
|
+
'schema-output',
|
|
79
|
+
'schema-filename',
|
|
76
80
|
'output',
|
|
77
81
|
'target',
|
|
78
82
|
'authorization',
|
package/esm/core/generate.d.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import type { CliConfig, GraphQLSDKConfigTarget } from '../types/config';
|
|
1
|
+
import type { CliConfig, GraphQLSDKConfigTarget, SchemaConfig } from '../types/config';
|
|
2
2
|
import type { CleanOperation, CleanTable, TypeRegistry } from '../types/schema';
|
|
3
3
|
export interface GenerateOptions extends GraphQLSDKConfigTarget {
|
|
4
4
|
authorization?: string;
|
|
5
5
|
verbose?: boolean;
|
|
6
6
|
dryRun?: boolean;
|
|
7
7
|
skipCustomOperations?: boolean;
|
|
8
|
-
schemaOnly?: boolean;
|
|
9
|
-
schemaOnlyOutput?: string;
|
|
10
|
-
schemaOnlyFilename?: string;
|
|
11
8
|
}
|
|
12
9
|
export interface GenerateResult {
|
|
13
10
|
success: boolean;
|
|
@@ -47,7 +44,7 @@ export interface GenerateMultiOptions {
|
|
|
47
44
|
cliOverrides?: Partial<GraphQLSDKConfigTarget>;
|
|
48
45
|
verbose?: boolean;
|
|
49
46
|
dryRun?: boolean;
|
|
50
|
-
|
|
47
|
+
schema?: SchemaConfig;
|
|
51
48
|
unifiedCli?: CliConfig | boolean;
|
|
52
49
|
}
|
|
53
50
|
export interface GenerateMultiResult {
|
package/esm/core/generate.js
CHANGED
|
@@ -8,6 +8,7 @@ import * as fs from 'node:fs';
|
|
|
8
8
|
import path from 'node:path';
|
|
9
9
|
import { buildClientSchema, printSchema } from 'graphql';
|
|
10
10
|
import { PgpmPackage } from '@pgpmjs/core';
|
|
11
|
+
import { pgCache } from 'pg-cache';
|
|
11
12
|
import { createEphemeralDb } from 'pgsql-client';
|
|
12
13
|
import { deployPgpm } from 'pgsql-seed';
|
|
13
14
|
import { getConfigOptions } from '../types/config';
|
|
@@ -49,7 +50,8 @@ export async function generate(options = {}, internalOptions) {
|
|
|
49
50
|
// Auto-enable nodeHttpAdapter when CLI is enabled, unless explicitly set to false
|
|
50
51
|
const useNodeHttpAdapter = options.nodeHttpAdapter === true ||
|
|
51
52
|
(runCli && options.nodeHttpAdapter !== false);
|
|
52
|
-
|
|
53
|
+
const schemaEnabled = !!options.schema?.enabled;
|
|
54
|
+
if (!schemaEnabled && !runReactQuery && !runOrm && !runCli) {
|
|
53
55
|
return {
|
|
54
56
|
success: false,
|
|
55
57
|
message: 'No generators enabled. Use reactQuery: true, orm: true, or cli: true in your config.',
|
|
@@ -76,7 +78,7 @@ export async function generate(options = {}, internalOptions) {
|
|
|
76
78
|
authorization: options.authorization || config.headers?.Authorization,
|
|
77
79
|
headers: config.headers,
|
|
78
80
|
});
|
|
79
|
-
if (
|
|
81
|
+
if (schemaEnabled && !runReactQuery && !runOrm && !runCli) {
|
|
80
82
|
try {
|
|
81
83
|
console.log(`Fetching schema from ${source.describe()}...`);
|
|
82
84
|
const { introspection } = await source.fetch();
|
|
@@ -89,9 +91,9 @@ export async function generate(options = {}, internalOptions) {
|
|
|
89
91
|
output: outputRoot,
|
|
90
92
|
};
|
|
91
93
|
}
|
|
92
|
-
const outDir = path.resolve(options.
|
|
94
|
+
const outDir = path.resolve(options.schema?.output || outputRoot || '.');
|
|
93
95
|
await fs.promises.mkdir(outDir, { recursive: true });
|
|
94
|
-
const filename = options.
|
|
96
|
+
const filename = options.schema?.filename || 'schema.graphql';
|
|
95
97
|
const filePath = path.join(outDir, filename);
|
|
96
98
|
await fs.promises.writeFile(filePath, sdl, 'utf-8');
|
|
97
99
|
return {
|
|
@@ -496,12 +498,13 @@ function applySharedPgpmDb(config, sharedSources) {
|
|
|
496
498
|
};
|
|
497
499
|
}
|
|
498
500
|
export async function generateMulti(options) {
|
|
499
|
-
const { configs, cliOverrides, verbose, dryRun,
|
|
501
|
+
const { configs, cliOverrides, verbose, dryRun, schema, unifiedCli } = options;
|
|
500
502
|
const names = Object.keys(configs);
|
|
501
503
|
const results = [];
|
|
502
504
|
let hasError = false;
|
|
505
|
+
const schemaEnabled = !!schema?.enabled;
|
|
503
506
|
const targetInfos = [];
|
|
504
|
-
const useUnifiedCli = !
|
|
507
|
+
const useUnifiedCli = !schemaEnabled && !!unifiedCli && names.length > 1;
|
|
505
508
|
const cliTargets = [];
|
|
506
509
|
const sharedSources = await prepareSharedPgpmSources(configs, cliOverrides);
|
|
507
510
|
try {
|
|
@@ -515,8 +518,9 @@ export async function generateMulti(options) {
|
|
|
515
518
|
...targetConfig,
|
|
516
519
|
verbose,
|
|
517
520
|
dryRun,
|
|
518
|
-
|
|
519
|
-
|
|
521
|
+
schema: schemaEnabled
|
|
522
|
+
? { ...schema, filename: schema?.filename ?? `${name}.graphql` }
|
|
523
|
+
: targetConfig.schema,
|
|
520
524
|
}, useUnifiedCli ? { skipCli: true, targetName: name } : { targetName: name });
|
|
521
525
|
results.push({ name, result });
|
|
522
526
|
if (!result.success) {
|
|
@@ -639,6 +643,10 @@ export async function generateMulti(options) {
|
|
|
639
643
|
finally {
|
|
640
644
|
for (const shared of sharedSources.values()) {
|
|
641
645
|
const keepDb = Object.values(configs).some((c) => c.db?.keepDb);
|
|
646
|
+
// Release pg-cache pool for this ephemeral database before dropping
|
|
647
|
+
// deployPgpm() caches connections that must be closed first
|
|
648
|
+
pgCache.delete(shared.ephemeralDb.config.database);
|
|
649
|
+
await pgCache.waitForDisposals();
|
|
642
650
|
shared.ephemeralDb.teardown({ keepDb });
|
|
643
651
|
}
|
|
644
652
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { PgpmPackage } from '@pgpmjs/core';
|
|
11
11
|
import { buildSchema, introspectionFromSchema } from 'graphql';
|
|
12
|
-
import { getPgPool } from 'pg-cache';
|
|
12
|
+
import { getPgPool, pgCache } from 'pg-cache';
|
|
13
13
|
import { createEphemeralDb } from 'pgsql-client';
|
|
14
14
|
import { deployPgpm } from 'pgsql-seed';
|
|
15
15
|
import { buildSchemaSDL } from 'graphile-schema';
|
|
@@ -131,6 +131,10 @@ export class PgpmModuleSchemaSource {
|
|
|
131
131
|
return { introspection };
|
|
132
132
|
}
|
|
133
133
|
finally {
|
|
134
|
+
// Release pg-cache pool for this ephemeral database before dropping
|
|
135
|
+
// deployPgpm() and getPgPool() cache connections that must be closed first
|
|
136
|
+
pgCache.delete(dbConfig.database);
|
|
137
|
+
await pgCache.waitForDisposals();
|
|
134
138
|
// Clean up the ephemeral database
|
|
135
139
|
teardown({ keepDb });
|
|
136
140
|
if (keepDb) {
|
package/esm/types/config.d.ts
CHANGED
|
@@ -145,6 +145,29 @@ export interface DocsConfig {
|
|
|
145
145
|
*/
|
|
146
146
|
skills?: boolean;
|
|
147
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* Schema export configuration
|
|
150
|
+
* Controls SDL schema export behavior.
|
|
151
|
+
*/
|
|
152
|
+
export interface SchemaConfig {
|
|
153
|
+
/**
|
|
154
|
+
* Enable schema SDL export
|
|
155
|
+
* When true, fetches the schema and writes it as a .graphql SDL file.
|
|
156
|
+
* If no generators are enabled (orm, reactQuery, cli), only the schema is exported.
|
|
157
|
+
* @default false
|
|
158
|
+
*/
|
|
159
|
+
enabled?: boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Output directory for the exported schema file
|
|
162
|
+
* @default same as the target's output directory
|
|
163
|
+
*/
|
|
164
|
+
output?: string;
|
|
165
|
+
/**
|
|
166
|
+
* Filename for the exported schema file
|
|
167
|
+
* @default 'schema.graphql'
|
|
168
|
+
*/
|
|
169
|
+
filename?: string;
|
|
170
|
+
}
|
|
148
171
|
/**
|
|
149
172
|
* Infrastructure command name overrides for collision handling.
|
|
150
173
|
* When a target name collides with a default infra command name,
|
|
@@ -340,6 +363,12 @@ export interface GraphQLSDKConfigTarget {
|
|
|
340
363
|
* @default { readme: true, agents: true, mcp: false }
|
|
341
364
|
*/
|
|
342
365
|
docs?: DocsConfig | boolean;
|
|
366
|
+
/**
|
|
367
|
+
* Schema export configuration
|
|
368
|
+
* When enabled, exports the GraphQL SDL to a file.
|
|
369
|
+
* If no generators are also enabled, this acts as a schema-only export.
|
|
370
|
+
*/
|
|
371
|
+
schema?: SchemaConfig;
|
|
343
372
|
/**
|
|
344
373
|
* Custom path for generated skill files.
|
|
345
374
|
* When set, skills are written to this directory.
|
package/esm/types/index.d.ts
CHANGED
|
@@ -5,5 +5,5 @@ export type { CleanBelongsToRelation, CleanField, CleanFieldType, CleanHasManyRe
|
|
|
5
5
|
export type { ConnectionResult, FieldFilter, Filter, FilterOperator, OrderByItem, PageInfo, QueryOptions, RelationalFilter, } from './query';
|
|
6
6
|
export type { CreateInput, DeleteInput, MutationOptions, MutationResult, UpdateInput, } from './mutation';
|
|
7
7
|
export type { FieldSelection, FieldSelectionPreset, SelectionOptions, SimpleFieldSelection, } from './selection';
|
|
8
|
-
export type { GraphQLSDKConfig, GraphQLSDKConfigTarget } from './config';
|
|
8
|
+
export type { GraphQLSDKConfig, GraphQLSDKConfigTarget, SchemaConfig } from './config';
|
|
9
9
|
export { DEFAULT_CONFIG, defineConfig, getConfigOptions, mergeConfig, } from './config';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructive-io/graphql-codegen",
|
|
3
|
-
"version": "4.15.
|
|
3
|
+
"version": "4.15.4",
|
|
4
4
|
"description": "GraphQL SDK generator for Constructive databases with React Query hooks",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"graphql",
|
|
@@ -56,15 +56,15 @@
|
|
|
56
56
|
"@0no-co/graphql.web": "^1.1.2",
|
|
57
57
|
"@babel/generator": "^7.29.1",
|
|
58
58
|
"@babel/types": "^7.29.0",
|
|
59
|
-
"@constructive-io/graphql-query": "^3.6.
|
|
59
|
+
"@constructive-io/graphql-query": "^3.6.5",
|
|
60
60
|
"@constructive-io/graphql-types": "^3.3.4",
|
|
61
61
|
"@inquirerer/utils": "^3.3.4",
|
|
62
|
-
"@pgpmjs/core": "^6.7.
|
|
62
|
+
"@pgpmjs/core": "^6.7.1",
|
|
63
63
|
"ajv": "^8.18.0",
|
|
64
64
|
"deepmerge": "^4.3.1",
|
|
65
65
|
"find-and-require-package-json": "^0.9.1",
|
|
66
66
|
"gql-ast": "^3.3.3",
|
|
67
|
-
"graphile-schema": "^1.6.
|
|
67
|
+
"graphile-schema": "^1.6.5",
|
|
68
68
|
"graphql": "16.13.0",
|
|
69
69
|
"inflekt": "^0.3.3",
|
|
70
70
|
"inquirerer": "^4.7.0",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"oxfmt": "^0.40.0",
|
|
74
74
|
"pg-cache": "^3.3.4",
|
|
75
75
|
"pg-env": "^1.7.3",
|
|
76
|
-
"pgsql-client": "^3.5.
|
|
77
|
-
"pgsql-seed": "^2.5.
|
|
76
|
+
"pgsql-client": "^3.5.7",
|
|
77
|
+
"pgsql-seed": "^2.5.7",
|
|
78
78
|
"undici": "^7.24.3"
|
|
79
79
|
},
|
|
80
80
|
"peerDependencies": {
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"tsx": "^4.21.0",
|
|
102
102
|
"typescript": "^5.9.3"
|
|
103
103
|
},
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "8edfd4913d37603659afa968489dc84d6bab769d"
|
|
105
105
|
}
|
package/types/config.d.ts
CHANGED
|
@@ -145,6 +145,29 @@ export interface DocsConfig {
|
|
|
145
145
|
*/
|
|
146
146
|
skills?: boolean;
|
|
147
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* Schema export configuration
|
|
150
|
+
* Controls SDL schema export behavior.
|
|
151
|
+
*/
|
|
152
|
+
export interface SchemaConfig {
|
|
153
|
+
/**
|
|
154
|
+
* Enable schema SDL export
|
|
155
|
+
* When true, fetches the schema and writes it as a .graphql SDL file.
|
|
156
|
+
* If no generators are enabled (orm, reactQuery, cli), only the schema is exported.
|
|
157
|
+
* @default false
|
|
158
|
+
*/
|
|
159
|
+
enabled?: boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Output directory for the exported schema file
|
|
162
|
+
* @default same as the target's output directory
|
|
163
|
+
*/
|
|
164
|
+
output?: string;
|
|
165
|
+
/**
|
|
166
|
+
* Filename for the exported schema file
|
|
167
|
+
* @default 'schema.graphql'
|
|
168
|
+
*/
|
|
169
|
+
filename?: string;
|
|
170
|
+
}
|
|
148
171
|
/**
|
|
149
172
|
* Infrastructure command name overrides for collision handling.
|
|
150
173
|
* When a target name collides with a default infra command name,
|
|
@@ -340,6 +363,12 @@ export interface GraphQLSDKConfigTarget {
|
|
|
340
363
|
* @default { readme: true, agents: true, mcp: false }
|
|
341
364
|
*/
|
|
342
365
|
docs?: DocsConfig | boolean;
|
|
366
|
+
/**
|
|
367
|
+
* Schema export configuration
|
|
368
|
+
* When enabled, exports the GraphQL SDL to a file.
|
|
369
|
+
* If no generators are also enabled, this acts as a schema-only export.
|
|
370
|
+
*/
|
|
371
|
+
schema?: SchemaConfig;
|
|
343
372
|
/**
|
|
344
373
|
* Custom path for generated skill files.
|
|
345
374
|
* When set, skills are written to this directory.
|
package/types/index.d.ts
CHANGED
|
@@ -5,5 +5,5 @@ export type { CleanBelongsToRelation, CleanField, CleanFieldType, CleanHasManyRe
|
|
|
5
5
|
export type { ConnectionResult, FieldFilter, Filter, FilterOperator, OrderByItem, PageInfo, QueryOptions, RelationalFilter, } from './query';
|
|
6
6
|
export type { CreateInput, DeleteInput, MutationOptions, MutationResult, UpdateInput, } from './mutation';
|
|
7
7
|
export type { FieldSelection, FieldSelectionPreset, SelectionOptions, SimpleFieldSelection, } from './selection';
|
|
8
|
-
export type { GraphQLSDKConfig, GraphQLSDKConfigTarget } from './config';
|
|
8
|
+
export type { GraphQLSDKConfig, GraphQLSDKConfigTarget, SchemaConfig } from './config';
|
|
9
9
|
export { DEFAULT_CONFIG, defineConfig, getConfigOptions, mergeConfig, } from './config';
|