@constructive-io/graphql-codegen 3.2.0 → 3.3.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.
- package/README.md +25 -30
- package/cli/index.js +36 -41
- package/cli/shared.d.ts +15 -17
- package/cli/shared.js +113 -21
- package/client/error.js +31 -9
- package/client/execute.js +2 -2
- package/client/index.d.ts +3 -3
- package/client/index.js +6 -6
- package/core/ast.d.ts +1 -1
- package/core/ast.js +1 -1
- package/core/codegen/babel-ast.d.ts +1 -1
- package/core/codegen/babel-ast.js +2 -2
- package/core/codegen/barrel.d.ts +0 -6
- package/core/codegen/barrel.js +22 -19
- package/core/codegen/client.d.ts +2 -12
- package/core/codegen/client.js +7 -21
- package/core/codegen/custom-mutations.d.ts +0 -14
- package/core/codegen/custom-mutations.js +139 -88
- package/core/codegen/custom-queries.d.ts +0 -14
- package/core/codegen/custom-queries.js +483 -193
- package/core/codegen/hooks-ast.d.ts +75 -0
- package/core/codegen/hooks-ast.js +522 -0
- package/core/codegen/index.d.ts +16 -18
- package/core/codegen/index.js +42 -88
- package/core/codegen/invalidation.d.ts +1 -7
- package/core/codegen/invalidation.js +50 -16
- package/core/codegen/mutation-keys.d.ts +1 -10
- package/core/codegen/mutation-keys.js +22 -8
- package/core/codegen/mutations.d.ts +0 -13
- package/core/codegen/mutations.js +301 -366
- package/core/codegen/orm/barrel.d.ts +0 -5
- package/core/codegen/orm/barrel.js +5 -0
- package/core/codegen/orm/client-generator.d.ts +0 -5
- package/core/codegen/orm/client-generator.js +7 -2
- package/core/codegen/orm/client.js +3 -1
- package/core/codegen/orm/custom-ops-generator.d.ts +0 -6
- package/core/codegen/orm/custom-ops-generator.js +104 -51
- package/core/codegen/orm/index.d.ts +4 -4
- package/core/codegen/orm/index.js +28 -15
- package/core/codegen/orm/input-types-generator.d.ts +1 -13
- package/core/codegen/orm/input-types-generator.js +85 -23
- package/core/codegen/orm/model-generator.d.ts +0 -5
- package/core/codegen/orm/model-generator.js +309 -131
- package/core/codegen/orm/select-types.d.ts +19 -14
- package/core/codegen/queries.d.ts +0 -8
- package/core/codegen/queries.js +360 -559
- package/core/codegen/query-keys.d.ts +1 -1
- package/core/codegen/query-keys.js +37 -23
- package/core/codegen/scalars.js +3 -1
- package/core/codegen/schema-types-generator.d.ts +1 -1
- package/core/codegen/schema-types-generator.js +17 -2
- package/core/codegen/select-helpers.d.ts +19 -0
- package/core/codegen/select-helpers.js +40 -0
- package/core/codegen/selection.d.ts +4 -0
- package/core/codegen/selection.js +65 -0
- package/core/codegen/shared/index.d.ts +2 -15
- package/core/codegen/shared/index.js +17 -4
- package/core/codegen/templates/hooks-client.ts +49 -0
- package/core/codegen/templates/hooks-selection.ts +58 -0
- package/core/codegen/templates/orm-client.ts +8 -6
- package/core/codegen/templates/query-builder.ts +250 -46
- package/core/codegen/templates/select-types.ts +31 -14
- package/core/codegen/type-resolver.d.ts +1 -5
- package/core/codegen/type-resolver.js +0 -22
- package/core/codegen/types.d.ts +0 -3
- package/core/codegen/types.js +71 -14
- package/core/codegen/utils.d.ts +1 -4
- package/core/codegen/utils.js +4 -1
- package/core/config/index.d.ts +1 -1
- package/core/config/resolver.js +1 -3
- package/core/generate.js +38 -50
- package/core/index.d.ts +3 -3
- package/core/index.js +3 -4
- package/core/introspect/index.d.ts +6 -6
- package/core/introspect/index.js +5 -8
- package/core/introspect/infer-tables.d.ts +0 -14
- package/core/introspect/infer-tables.js +15 -1
- package/core/introspect/source/database.js +1 -1
- package/core/introspect/source/endpoint.d.ts +0 -6
- package/core/introspect/source/endpoint.js +7 -1
- package/core/introspect/source/index.d.ts +4 -4
- package/core/introspect/source/index.js +5 -9
- package/core/introspect/source/pgpm-module.js +3 -3
- package/core/introspect/transform-schema.d.ts +2 -2
- package/core/introspect/transform-schema.js +2 -2
- package/core/output/index.d.ts +1 -1
- package/core/output/index.js +2 -2
- package/core/output/writer.d.ts +3 -0
- package/core/output/writer.js +20 -1
- package/core/pipeline/index.d.ts +2 -2
- package/core/query-builder.d.ts +2 -2
- package/core/query-builder.js +1 -1
- package/core/watch/index.d.ts +4 -4
- package/core/watch/index.js +9 -9
- package/core/watch/orchestrator.js +5 -3
- package/esm/cli/index.js +37 -42
- package/esm/cli/shared.d.ts +15 -17
- package/esm/cli/shared.js +103 -20
- package/esm/client/error.js +31 -9
- package/esm/client/execute.js +2 -2
- package/esm/client/index.d.ts +3 -3
- package/esm/client/index.js +3 -3
- package/esm/core/ast.d.ts +1 -1
- package/esm/core/ast.js +1 -1
- package/esm/core/codegen/babel-ast.d.ts +1 -1
- package/esm/core/codegen/babel-ast.js +2 -2
- package/esm/core/codegen/barrel.d.ts +0 -6
- package/esm/core/codegen/barrel.js +23 -20
- package/esm/core/codegen/client.d.ts +2 -12
- package/esm/core/codegen/client.js +7 -21
- package/esm/core/codegen/custom-mutations.d.ts +0 -14
- package/esm/core/codegen/custom-mutations.js +141 -90
- package/esm/core/codegen/custom-queries.d.ts +0 -14
- package/esm/core/codegen/custom-queries.js +486 -196
- package/esm/core/codegen/hooks-ast.d.ts +75 -0
- package/esm/core/codegen/hooks-ast.js +424 -0
- package/esm/core/codegen/index.d.ts +16 -18
- package/esm/core/codegen/index.js +26 -71
- package/esm/core/codegen/invalidation.d.ts +1 -7
- package/esm/core/codegen/invalidation.js +51 -17
- package/esm/core/codegen/mutation-keys.d.ts +1 -10
- package/esm/core/codegen/mutation-keys.js +23 -9
- package/esm/core/codegen/mutations.d.ts +0 -13
- package/esm/core/codegen/mutations.js +302 -367
- package/esm/core/codegen/orm/barrel.d.ts +0 -5
- package/esm/core/codegen/orm/barrel.js +6 -1
- package/esm/core/codegen/orm/client-generator.d.ts +0 -5
- package/esm/core/codegen/orm/client-generator.js +7 -2
- package/esm/core/codegen/orm/client.js +3 -1
- package/esm/core/codegen/orm/custom-ops-generator.d.ts +0 -6
- package/esm/core/codegen/orm/custom-ops-generator.js +103 -50
- package/esm/core/codegen/orm/index.d.ts +4 -4
- package/esm/core/codegen/orm/index.js +25 -12
- package/esm/core/codegen/orm/input-types-generator.d.ts +1 -13
- package/esm/core/codegen/orm/input-types-generator.js +85 -23
- package/esm/core/codegen/orm/model-generator.d.ts +0 -5
- package/esm/core/codegen/orm/model-generator.js +310 -132
- package/esm/core/codegen/orm/select-types.d.ts +19 -14
- package/esm/core/codegen/queries.d.ts +0 -8
- package/esm/core/codegen/queries.js +362 -561
- package/esm/core/codegen/query-keys.d.ts +1 -1
- package/esm/core/codegen/query-keys.js +38 -24
- package/esm/core/codegen/scalars.js +3 -1
- package/esm/core/codegen/schema-types-generator.d.ts +1 -1
- package/esm/core/codegen/schema-types-generator.js +17 -2
- package/esm/core/codegen/select-helpers.d.ts +19 -0
- package/esm/core/codegen/select-helpers.js +35 -0
- package/esm/core/codegen/selection.d.ts +4 -0
- package/esm/core/codegen/selection.js +29 -0
- package/esm/core/codegen/shared/index.d.ts +2 -15
- package/esm/core/codegen/shared/index.js +16 -3
- package/esm/core/codegen/type-resolver.d.ts +1 -5
- package/esm/core/codegen/type-resolver.js +1 -22
- package/esm/core/codegen/types.d.ts +0 -3
- package/esm/core/codegen/types.js +72 -15
- package/esm/core/codegen/utils.d.ts +1 -4
- package/esm/core/codegen/utils.js +4 -1
- package/esm/core/config/index.d.ts +1 -1
- package/esm/core/config/resolver.js +2 -4
- package/esm/core/generate.js +38 -50
- package/esm/core/index.d.ts +3 -3
- package/esm/core/index.js +2 -3
- package/esm/core/introspect/index.d.ts +6 -6
- package/esm/core/introspect/index.js +3 -6
- package/esm/core/introspect/infer-tables.d.ts +0 -14
- package/esm/core/introspect/infer-tables.js +16 -2
- package/esm/core/introspect/source/database.js +2 -2
- package/esm/core/introspect/source/endpoint.d.ts +0 -6
- package/esm/core/introspect/source/endpoint.js +7 -1
- package/esm/core/introspect/source/index.d.ts +4 -4
- package/esm/core/introspect/source/index.js +6 -10
- package/esm/core/introspect/source/pgpm-module.js +3 -3
- package/esm/core/introspect/transform-schema.d.ts +2 -2
- package/esm/core/introspect/transform-schema.js +2 -2
- package/esm/core/output/index.d.ts +1 -1
- package/esm/core/output/index.js +1 -1
- package/esm/core/output/writer.d.ts +3 -0
- package/esm/core/output/writer.js +20 -1
- package/esm/core/pipeline/index.d.ts +2 -2
- package/esm/core/pipeline/index.js +2 -2
- package/esm/core/query-builder.d.ts +2 -2
- package/esm/core/query-builder.js +2 -2
- package/esm/core/watch/index.d.ts +4 -4
- package/esm/core/watch/index.js +3 -3
- package/esm/core/watch/orchestrator.js +5 -3
- package/esm/generators/index.d.ts +3 -3
- package/esm/generators/index.js +3 -3
- package/esm/generators/mutations.d.ts +1 -1
- package/esm/generators/select.d.ts +1 -1
- package/esm/index.d.ts +3 -3
- package/esm/index.js +1 -4
- package/esm/types/config.d.ts +0 -10
- package/esm/types/config.js +0 -2
- package/esm/types/index.d.ts +6 -6
- package/esm/types/index.js +1 -1
- package/generators/index.d.ts +3 -3
- package/generators/index.js +8 -8
- package/generators/mutations.d.ts +1 -1
- package/generators/select.d.ts +1 -1
- package/index.d.ts +3 -3
- package/index.js +11 -5
- package/package.json +11 -11
- package/types/config.d.ts +0 -10
- package/types/config.js +0 -2
- package/types/index.d.ts +6 -6
- package/types/index.js +2 -2
- package/core/codegen/gql-ast.d.ts +0 -41
- package/core/codegen/gql-ast.js +0 -353
- package/core/codegen/schema-gql-ast.d.ts +0 -51
- package/core/codegen/schema-gql-ast.js +0 -385
- package/core/codegen/templates/client.browser.ts +0 -271
- package/core/codegen/templates/client.node.ts +0 -337
- package/esm/core/codegen/gql-ast.d.ts +0 -41
- package/esm/core/codegen/gql-ast.js +0 -312
- package/esm/core/codegen/schema-gql-ast.d.ts +0 -51
- package/esm/core/codegen/schema-gql-ast.js +0 -343
package/core/codegen/types.js
CHANGED
|
@@ -34,29 +34,84 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.generateTypesFile = generateTypesFile;
|
|
37
|
+
/**
|
|
38
|
+
* Types generator - generates types.ts with entity interfaces using Babel AST
|
|
39
|
+
*/
|
|
37
40
|
const t = __importStar(require("@babel/types"));
|
|
38
41
|
const babel_ast_1 = require("./babel-ast");
|
|
39
42
|
const utils_1 = require("./utils");
|
|
40
43
|
/** All filter type configurations - scalar and list filters */
|
|
41
44
|
const FILTER_CONFIGS = [
|
|
42
45
|
// Scalar filters
|
|
43
|
-
{
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
{
|
|
47
|
+
name: 'StringFilter',
|
|
48
|
+
tsType: 'string',
|
|
49
|
+
operators: ['equality', 'distinct', 'inArray', 'comparison', 'string'],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
name: 'IntFilter',
|
|
53
|
+
tsType: 'number',
|
|
54
|
+
operators: ['equality', 'distinct', 'inArray', 'comparison'],
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'FloatFilter',
|
|
58
|
+
tsType: 'number',
|
|
59
|
+
operators: ['equality', 'distinct', 'inArray', 'comparison'],
|
|
60
|
+
},
|
|
46
61
|
{ name: 'BooleanFilter', tsType: 'boolean', operators: ['equality'] },
|
|
47
|
-
{
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
{
|
|
62
|
+
{
|
|
63
|
+
name: 'UUIDFilter',
|
|
64
|
+
tsType: 'string',
|
|
65
|
+
operators: ['equality', 'distinct', 'inArray'],
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'DatetimeFilter',
|
|
69
|
+
tsType: 'string',
|
|
70
|
+
operators: ['equality', 'distinct', 'inArray', 'comparison'],
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'DateFilter',
|
|
74
|
+
tsType: 'string',
|
|
75
|
+
operators: ['equality', 'distinct', 'inArray', 'comparison'],
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'JSONFilter',
|
|
79
|
+
tsType: 'Record<string, unknown>',
|
|
80
|
+
operators: ['equality', 'distinct', 'json'],
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: 'BigIntFilter',
|
|
84
|
+
tsType: 'string',
|
|
85
|
+
operators: ['equality', 'distinct', 'inArray', 'comparison'],
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: 'BigFloatFilter',
|
|
89
|
+
tsType: 'string',
|
|
90
|
+
operators: ['equality', 'distinct', 'inArray', 'comparison'],
|
|
91
|
+
},
|
|
53
92
|
{ name: 'BitStringFilter', tsType: 'string', operators: ['equality'] },
|
|
54
|
-
{
|
|
93
|
+
{
|
|
94
|
+
name: 'InternetAddressFilter',
|
|
95
|
+
tsType: 'string',
|
|
96
|
+
operators: ['equality', 'distinct', 'inArray', 'comparison', 'inet'],
|
|
97
|
+
},
|
|
55
98
|
{ name: 'FullTextFilter', tsType: 'string', operators: ['fulltext'] },
|
|
56
99
|
// List filters
|
|
57
|
-
{
|
|
58
|
-
|
|
59
|
-
|
|
100
|
+
{
|
|
101
|
+
name: 'StringListFilter',
|
|
102
|
+
tsType: 'string[]',
|
|
103
|
+
operators: ['equality', 'distinct', 'comparison', 'listArray'],
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: 'IntListFilter',
|
|
107
|
+
tsType: 'number[]',
|
|
108
|
+
operators: ['equality', 'distinct', 'comparison', 'listArray'],
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
name: 'UUIDListFilter',
|
|
112
|
+
tsType: 'string[]',
|
|
113
|
+
operators: ['equality', 'distinct', 'comparison', 'listArray'],
|
|
114
|
+
},
|
|
60
115
|
];
|
|
61
116
|
/** Build filter properties based on operator sets */
|
|
62
117
|
function buildFilterProperties(tsType, operators) {
|
|
@@ -111,7 +166,9 @@ function parseTypeAnnotation(typeStr) {
|
|
|
111
166
|
if (typeStr === 'unknown')
|
|
112
167
|
return t.tsUnknownKeyword();
|
|
113
168
|
if (typeStr.includes(' | ')) {
|
|
114
|
-
const parts = typeStr
|
|
169
|
+
const parts = typeStr
|
|
170
|
+
.split(' | ')
|
|
171
|
+
.map((p) => parseTypeAnnotation(p.trim()));
|
|
115
172
|
return t.tsUnionType(parts);
|
|
116
173
|
}
|
|
117
174
|
if (typeStr.endsWith('[]')) {
|
package/core/codegen/utils.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Codegen utilities - naming conventions, type mapping, and helpers
|
|
3
|
-
*/
|
|
4
|
-
import type { CleanTable, CleanField, CleanFieldType } from '../../types/schema';
|
|
1
|
+
import type { CleanField, CleanFieldType, CleanTable } from '../../types/schema';
|
|
5
2
|
/** Lowercase first character */
|
|
6
3
|
export declare function lcFirst(str: string): string;
|
|
7
4
|
/** Uppercase first character */
|
package/core/codegen/utils.js
CHANGED
|
@@ -39,8 +39,11 @@ exports.hasValidPrimaryKey = hasValidPrimaryKey;
|
|
|
39
39
|
exports.getQueryKeyPrefix = getQueryKeyPrefix;
|
|
40
40
|
exports.getGeneratedFileHeader = getGeneratedFileHeader;
|
|
41
41
|
exports.indent = indent;
|
|
42
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Codegen utilities - naming conventions, type mapping, and helpers
|
|
44
|
+
*/
|
|
43
45
|
const inflekt_1 = require("inflekt");
|
|
46
|
+
const scalars_1 = require("./scalars");
|
|
44
47
|
// ============================================================================
|
|
45
48
|
// String manipulation
|
|
46
49
|
// ============================================================================
|
package/core/config/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Configuration module exports
|
|
3
3
|
*/
|
|
4
4
|
export { CONFIG_FILENAME, findConfigFile, loadConfigFile, type LoadConfigFileResult, } from './loader';
|
|
5
|
-
export {
|
|
5
|
+
export { type ConfigOverrideOptions, loadAndResolveConfig, type LoadConfigResult, loadWatchConfig, } from './resolver';
|
package/core/config/resolver.js
CHANGED
|
@@ -42,9 +42,7 @@ async function loadAndResolveConfig(options) {
|
|
|
42
42
|
}
|
|
43
43
|
const mergedConfig = (0, config_1.mergeConfig)(baseConfig, overrides);
|
|
44
44
|
// Check if we have a source (endpoint, schemaFile, or db)
|
|
45
|
-
const hasSource = mergedConfig.endpoint ||
|
|
46
|
-
mergedConfig.schemaFile ||
|
|
47
|
-
mergedConfig.db;
|
|
45
|
+
const hasSource = mergedConfig.endpoint || mergedConfig.schemaFile || mergedConfig.db;
|
|
48
46
|
if (!hasSource) {
|
|
49
47
|
return {
|
|
50
48
|
success: false,
|
package/core/generate.js
CHANGED
|
@@ -10,15 +10,15 @@ exports.generate = generate;
|
|
|
10
10
|
* This is the primary entry point for programmatic usage.
|
|
11
11
|
* The CLI is a thin wrapper around this function.
|
|
12
12
|
*/
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const pipeline_1 = require("./pipeline");
|
|
13
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
14
|
+
const config_1 = require("../types/config");
|
|
16
15
|
const codegen_1 = require("./codegen");
|
|
17
16
|
const barrel_1 = require("./codegen/barrel");
|
|
18
17
|
const orm_1 = require("./codegen/orm");
|
|
19
18
|
const shared_1 = require("./codegen/shared");
|
|
19
|
+
const introspect_1 = require("./introspect");
|
|
20
20
|
const output_1 = require("./output");
|
|
21
|
-
const
|
|
21
|
+
const pipeline_1 = require("./pipeline");
|
|
22
22
|
/**
|
|
23
23
|
* Main generate function - takes a single config and generates code
|
|
24
24
|
*
|
|
@@ -30,8 +30,10 @@ async function generate(options = {}) {
|
|
|
30
30
|
const config = (0, config_1.getConfigOptions)(options);
|
|
31
31
|
const outputRoot = config.output;
|
|
32
32
|
// Determine which generators to run
|
|
33
|
+
// ORM is always required when React Query is enabled (hooks delegate to ORM)
|
|
34
|
+
// This handles minimist setting orm=false when --orm flag is absent
|
|
33
35
|
const runReactQuery = config.reactQuery ?? false;
|
|
34
|
-
const runOrm =
|
|
36
|
+
const runOrm = runReactQuery || (options.orm !== undefined ? !!options.orm : false);
|
|
35
37
|
if (!runReactQuery && !runOrm) {
|
|
36
38
|
return {
|
|
37
39
|
success: false,
|
|
@@ -56,7 +58,7 @@ async function generate(options = {}) {
|
|
|
56
58
|
endpoint: config.endpoint || undefined,
|
|
57
59
|
schemaFile: config.schemaFile || undefined,
|
|
58
60
|
db: config.db,
|
|
59
|
-
authorization: options.authorization || config.headers?.
|
|
61
|
+
authorization: options.authorization || config.headers?.Authorization,
|
|
60
62
|
headers: config.headers,
|
|
61
63
|
});
|
|
62
64
|
// Run pipeline
|
|
@@ -89,6 +91,7 @@ async function generate(options = {}) {
|
|
|
89
91
|
}
|
|
90
92
|
const allFilesWritten = [];
|
|
91
93
|
const bothEnabled = runReactQuery && runOrm;
|
|
94
|
+
const filesToWrite = [];
|
|
92
95
|
// Generate shared types when both are enabled
|
|
93
96
|
if (bothEnabled) {
|
|
94
97
|
console.log('Generating shared types...');
|
|
@@ -101,22 +104,10 @@ async function generate(options = {}) {
|
|
|
101
104
|
},
|
|
102
105
|
config,
|
|
103
106
|
});
|
|
104
|
-
|
|
105
|
-
const writeResult = await (0, output_1.writeGeneratedFiles)(sharedResult.files, outputRoot, []);
|
|
106
|
-
if (!writeResult.success) {
|
|
107
|
-
return {
|
|
108
|
-
success: false,
|
|
109
|
-
message: `Failed to write shared types: ${writeResult.errors?.join(', ')}`,
|
|
110
|
-
output: outputRoot,
|
|
111
|
-
errors: writeResult.errors,
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
allFilesWritten.push(...(writeResult.filesWritten ?? []));
|
|
115
|
-
}
|
|
107
|
+
filesToWrite.push(...sharedResult.files);
|
|
116
108
|
}
|
|
117
109
|
// Generate React Query hooks
|
|
118
110
|
if (runReactQuery) {
|
|
119
|
-
const hooksDir = path_1.default.join(outputRoot, 'hooks');
|
|
120
111
|
console.log('Generating React Query hooks...');
|
|
121
112
|
const { files } = (0, codegen_1.generate)({
|
|
122
113
|
tables,
|
|
@@ -128,22 +119,13 @@ async function generate(options = {}) {
|
|
|
128
119
|
config,
|
|
129
120
|
sharedTypesPath: bothEnabled ? '..' : undefined,
|
|
130
121
|
});
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
success: false,
|
|
136
|
-
message: `Failed to write React Query hooks: ${writeResult.errors?.join(', ')}`,
|
|
137
|
-
output: outputRoot,
|
|
138
|
-
errors: writeResult.errors,
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
allFilesWritten.push(...(writeResult.filesWritten ?? []));
|
|
142
|
-
}
|
|
122
|
+
filesToWrite.push(...files.map((file) => ({
|
|
123
|
+
...file,
|
|
124
|
+
path: node_path_1.default.posix.join('hooks', file.path),
|
|
125
|
+
})));
|
|
143
126
|
}
|
|
144
127
|
// Generate ORM client
|
|
145
128
|
if (runOrm) {
|
|
146
|
-
const ormDir = path_1.default.join(outputRoot, 'orm');
|
|
147
129
|
console.log('Generating ORM client...');
|
|
148
130
|
const { files } = (0, orm_1.generateOrm)({
|
|
149
131
|
tables,
|
|
@@ -155,30 +137,36 @@ async function generate(options = {}) {
|
|
|
155
137
|
config,
|
|
156
138
|
sharedTypesPath: bothEnabled ? '..' : undefined,
|
|
157
139
|
});
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
success: false,
|
|
163
|
-
message: `Failed to write ORM client: ${writeResult.errors?.join(', ')}`,
|
|
164
|
-
output: outputRoot,
|
|
165
|
-
errors: writeResult.errors,
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
allFilesWritten.push(...(writeResult.filesWritten ?? []));
|
|
169
|
-
}
|
|
140
|
+
filesToWrite.push(...files.map((file) => ({
|
|
141
|
+
...file,
|
|
142
|
+
path: node_path_1.default.posix.join('orm', file.path),
|
|
143
|
+
})));
|
|
170
144
|
}
|
|
171
145
|
// Generate barrel file at output root
|
|
172
146
|
// This re-exports from the appropriate subdirectories based on which generators are enabled
|
|
147
|
+
const barrelContent = (0, barrel_1.generateRootBarrel)({
|
|
148
|
+
hasTypes: bothEnabled,
|
|
149
|
+
hasHooks: runReactQuery,
|
|
150
|
+
hasOrm: runOrm,
|
|
151
|
+
});
|
|
152
|
+
filesToWrite.push({ path: 'index.ts', content: barrelContent });
|
|
173
153
|
if (!options.dryRun) {
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
hasHooks: runReactQuery,
|
|
177
|
-
hasOrm: runOrm,
|
|
154
|
+
const writeResult = await (0, output_1.writeGeneratedFiles)(filesToWrite, outputRoot, [], {
|
|
155
|
+
pruneStaleFiles: true,
|
|
178
156
|
});
|
|
179
|
-
|
|
157
|
+
if (!writeResult.success) {
|
|
158
|
+
return {
|
|
159
|
+
success: false,
|
|
160
|
+
message: `Failed to write generated files: ${writeResult.errors?.join(', ')}`,
|
|
161
|
+
output: outputRoot,
|
|
162
|
+
errors: writeResult.errors,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
allFilesWritten.push(...(writeResult.filesWritten ?? []));
|
|
180
166
|
}
|
|
181
|
-
const generators = [runReactQuery && 'React Query', runOrm && 'ORM']
|
|
167
|
+
const generators = [runReactQuery && 'React Query', runOrm && 'ORM']
|
|
168
|
+
.filter(Boolean)
|
|
169
|
+
.join(' and ');
|
|
182
170
|
return {
|
|
183
171
|
success: true,
|
|
184
172
|
message: options.dryRun
|
package/core/index.d.ts
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* This module contains all the core business logic for graphql-codegen.
|
|
5
5
|
* The CLI is a thin wrapper around these core functions.
|
|
6
6
|
*/
|
|
7
|
-
export { generate } from './generate';
|
|
8
7
|
export type { GenerateOptions, GenerateResult } from './generate';
|
|
8
|
+
export { generate } from './generate';
|
|
9
9
|
export * from './types';
|
|
10
10
|
export * from './ast';
|
|
11
11
|
export * from './custom-ast';
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
12
|
+
export { MetaObject, QueryBuilder } from './query-builder';
|
|
13
|
+
export { convertFromMetaSchema, validateMetaObject } from './meta-object';
|
|
14
14
|
export * from './config';
|
|
15
15
|
export * from './codegen';
|
|
16
16
|
export * from './introspect';
|
package/core/index.js
CHANGED
|
@@ -20,8 +20,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
20
20
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.
|
|
24
|
-
// Main generate function (orchestrates the entire pipeline)
|
|
23
|
+
exports.validateMetaObject = exports.convertFromMetaSchema = exports.QueryBuilder = exports.MetaObject = exports.generate = void 0;
|
|
25
24
|
var generate_1 = require("./generate");
|
|
26
25
|
Object.defineProperty(exports, "generate", { enumerable: true, get: function () { return generate_1.generate; } });
|
|
27
26
|
// Types
|
|
@@ -31,12 +30,12 @@ __exportStar(require("./ast"), exports);
|
|
|
31
30
|
__exportStar(require("./custom-ast"), exports);
|
|
32
31
|
// Query builder
|
|
33
32
|
var query_builder_1 = require("./query-builder");
|
|
34
|
-
Object.defineProperty(exports, "QueryBuilder", { enumerable: true, get: function () { return query_builder_1.QueryBuilder; } });
|
|
35
33
|
Object.defineProperty(exports, "MetaObject", { enumerable: true, get: function () { return query_builder_1.MetaObject; } });
|
|
34
|
+
Object.defineProperty(exports, "QueryBuilder", { enumerable: true, get: function () { return query_builder_1.QueryBuilder; } });
|
|
36
35
|
// Meta object utilities
|
|
37
36
|
var meta_object_1 = require("./meta-object");
|
|
38
|
-
Object.defineProperty(exports, "validateMetaObject", { enumerable: true, get: function () { return meta_object_1.validateMetaObject; } });
|
|
39
37
|
Object.defineProperty(exports, "convertFromMetaSchema", { enumerable: true, get: function () { return meta_object_1.convertFromMetaSchema; } });
|
|
38
|
+
Object.defineProperty(exports, "validateMetaObject", { enumerable: true, get: function () { return meta_object_1.validateMetaObject; } });
|
|
40
39
|
// Configuration loading and resolution
|
|
41
40
|
__exportStar(require("./config"), exports);
|
|
42
41
|
// Code generation
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Introspection module exports
|
|
3
3
|
*/
|
|
4
|
-
export { inferTablesFromIntrospection } from './infer-tables';
|
|
5
4
|
export type { InferTablesOptions } from './infer-tables';
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export type { SchemaSource, SchemaSourceResult,
|
|
9
|
-
export {
|
|
5
|
+
export { inferTablesFromIntrospection } from './infer-tables';
|
|
6
|
+
export { pluralize, singularize } from 'inflekt';
|
|
7
|
+
export type { CreateSchemaSourceOptions, SchemaSource, SchemaSourceResult, } from './source';
|
|
8
|
+
export { createSchemaSource, EndpointSchemaSource, FileSchemaSource, SchemaSourceError, validateSourceOptions, } from './source';
|
|
10
9
|
export type { FetchSchemaOptions, FetchSchemaResult } from './fetch-schema';
|
|
11
|
-
export {
|
|
10
|
+
export { fetchSchema } from './fetch-schema';
|
|
11
|
+
export { filterTables, findTable, getTableNames } from './transform';
|
package/core/introspect/index.js
CHANGED
|
@@ -3,26 +3,23 @@
|
|
|
3
3
|
* Introspection module exports
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
// Table inference from introspection
|
|
6
|
+
exports.getTableNames = exports.findTable = exports.filterTables = exports.fetchSchema = exports.validateSourceOptions = exports.SchemaSourceError = exports.FileSchemaSource = exports.EndpointSchemaSource = exports.createSchemaSource = exports.singularize = exports.pluralize = exports.inferTablesFromIntrospection = void 0;
|
|
8
7
|
var infer_tables_1 = require("./infer-tables");
|
|
9
8
|
Object.defineProperty(exports, "inferTablesFromIntrospection", { enumerable: true, get: function () { return infer_tables_1.inferTablesFromIntrospection; } });
|
|
10
9
|
// Pluralization utilities (from inflekt)
|
|
11
10
|
var inflekt_1 = require("inflekt");
|
|
12
|
-
Object.defineProperty(exports, "singularize", { enumerable: true, get: function () { return inflekt_1.singularize; } });
|
|
13
11
|
Object.defineProperty(exports, "pluralize", { enumerable: true, get: function () { return inflekt_1.pluralize; } });
|
|
14
|
-
|
|
12
|
+
Object.defineProperty(exports, "singularize", { enumerable: true, get: function () { return inflekt_1.singularize; } });
|
|
15
13
|
var source_1 = require("./source");
|
|
16
14
|
Object.defineProperty(exports, "createSchemaSource", { enumerable: true, get: function () { return source_1.createSchemaSource; } });
|
|
17
|
-
Object.defineProperty(exports, "validateSourceOptions", { enumerable: true, get: function () { return source_1.validateSourceOptions; } });
|
|
18
15
|
Object.defineProperty(exports, "EndpointSchemaSource", { enumerable: true, get: function () { return source_1.EndpointSchemaSource; } });
|
|
19
16
|
Object.defineProperty(exports, "FileSchemaSource", { enumerable: true, get: function () { return source_1.FileSchemaSource; } });
|
|
20
17
|
Object.defineProperty(exports, "SchemaSourceError", { enumerable: true, get: function () { return source_1.SchemaSourceError; } });
|
|
21
|
-
|
|
18
|
+
Object.defineProperty(exports, "validateSourceOptions", { enumerable: true, get: function () { return source_1.validateSourceOptions; } });
|
|
22
19
|
var fetch_schema_1 = require("./fetch-schema");
|
|
23
20
|
Object.defineProperty(exports, "fetchSchema", { enumerable: true, get: function () { return fetch_schema_1.fetchSchema; } });
|
|
24
21
|
// Transform utilities (only filterTables, getTableNames, findTable are still useful)
|
|
25
22
|
var transform_1 = require("./transform");
|
|
26
|
-
Object.defineProperty(exports, "getTableNames", { enumerable: true, get: function () { return transform_1.getTableNames; } });
|
|
27
|
-
Object.defineProperty(exports, "findTable", { enumerable: true, get: function () { return transform_1.findTable; } });
|
|
28
23
|
Object.defineProperty(exports, "filterTables", { enumerable: true, get: function () { return transform_1.filterTables; } });
|
|
24
|
+
Object.defineProperty(exports, "findTable", { enumerable: true, get: function () { return transform_1.findTable; } });
|
|
25
|
+
Object.defineProperty(exports, "getTableNames", { enumerable: true, get: function () { return transform_1.getTableNames; } });
|
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Infer PostGraphile table metadata from standard GraphQL introspection
|
|
3
|
-
*
|
|
4
|
-
* This module replaces the need for the _meta query by recognizing PostGraphile's
|
|
5
|
-
* naming conventions and type patterns from standard GraphQL introspection.
|
|
6
|
-
*
|
|
7
|
-
* Key patterns recognized:
|
|
8
|
-
* - Connection types: {PluralName}Connection → entity name
|
|
9
|
-
* - Filter types: {Name}Filter
|
|
10
|
-
* - Input types: Create{Name}Input, Update{Name}Input, Delete{Name}Input
|
|
11
|
-
* - Payload types: Create{Name}Payload, Update{Name}Payload, Delete{Name}Payload
|
|
12
|
-
* - Query operations: {pluralName} (list), {singularName} (single)
|
|
13
|
-
* - Mutation operations: create{Name}, update{Name}, delete{Name}
|
|
14
|
-
*/
|
|
15
1
|
import type { IntrospectionQueryResponse } from '../../types/introspection';
|
|
16
2
|
import type { CleanTable } from '../../types/schema';
|
|
17
3
|
/**
|
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.inferTablesFromIntrospection = inferTablesFromIntrospection;
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Infer PostGraphile table metadata from standard GraphQL introspection
|
|
6
|
+
*
|
|
7
|
+
* This module replaces the need for the _meta query by recognizing PostGraphile's
|
|
8
|
+
* naming conventions and type patterns from standard GraphQL introspection.
|
|
9
|
+
*
|
|
10
|
+
* Key patterns recognized:
|
|
11
|
+
* - Connection types: {PluralName}Connection → entity name
|
|
12
|
+
* - Filter types: {Name}Filter
|
|
13
|
+
* - Input types: Create{Name}Input, Update{Name}Input, Delete{Name}Input
|
|
14
|
+
* - Payload types: Create{Name}Payload, Update{Name}Payload, Delete{Name}Payload
|
|
15
|
+
* - Query operations: {pluralName} (list), {singularName} (single)
|
|
16
|
+
* - Mutation operations: create{Name}, update{Name}, delete{Name}
|
|
17
|
+
*/
|
|
5
18
|
const inflekt_1 = require("inflekt");
|
|
19
|
+
const introspection_1 = require("../../types/introspection");
|
|
6
20
|
// ============================================================================
|
|
7
21
|
// Pattern Matching Constants
|
|
8
22
|
// ============================================================================
|
|
@@ -8,9 +8,9 @@ exports.DatabaseSchemaSource = void 0;
|
|
|
8
8
|
* introspection and converts it to introspection format.
|
|
9
9
|
*/
|
|
10
10
|
const graphql_1 = require("graphql");
|
|
11
|
-
const types_1 = require("./types");
|
|
12
11
|
const database_1 = require("../../database");
|
|
13
12
|
const api_schemas_1 = require("./api-schemas");
|
|
13
|
+
const types_1 = require("./types");
|
|
14
14
|
/**
|
|
15
15
|
* Schema source that loads from a PostgreSQL database
|
|
16
16
|
*
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Endpoint Schema Source
|
|
3
|
-
*
|
|
4
|
-
* Fetches GraphQL schema via introspection from a live endpoint.
|
|
5
|
-
* Wraps the existing fetchSchema() function with the SchemaSource interface.
|
|
6
|
-
*/
|
|
7
1
|
import type { SchemaSource, SchemaSourceResult } from './types';
|
|
8
2
|
export interface EndpointSchemaSourceOptions {
|
|
9
3
|
/**
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EndpointSchemaSource = void 0;
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Endpoint Schema Source
|
|
6
|
+
*
|
|
7
|
+
* Fetches GraphQL schema via introspection from a live endpoint.
|
|
8
|
+
* Wraps the existing fetchSchema() function with the SchemaSource interface.
|
|
9
|
+
*/
|
|
5
10
|
const fetch_schema_1 = require("../fetch-schema");
|
|
11
|
+
const types_1 = require("./types");
|
|
6
12
|
/**
|
|
7
13
|
* Schema source that fetches from a live GraphQL endpoint
|
|
8
14
|
*/
|
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
* - PostgreSQL databases (via PostGraphile introspection)
|
|
8
8
|
* - PGPM modules (via ephemeral database deployment)
|
|
9
9
|
*/
|
|
10
|
-
export * from './
|
|
10
|
+
export * from './api-schemas';
|
|
11
|
+
export * from './database';
|
|
11
12
|
export * from './endpoint';
|
|
12
13
|
export * from './file';
|
|
13
|
-
export * from './database';
|
|
14
14
|
export * from './pgpm-module';
|
|
15
|
-
export * from './
|
|
16
|
-
import type { SchemaSource } from './types';
|
|
15
|
+
export * from './types';
|
|
17
16
|
import type { DbConfig } from '../../../types/config';
|
|
17
|
+
import type { SchemaSource } from './types';
|
|
18
18
|
/**
|
|
19
19
|
* Options for endpoint-based schema source
|
|
20
20
|
*/
|
|
@@ -26,15 +26,15 @@ exports.validateSourceOptions = validateSourceOptions;
|
|
|
26
26
|
* - PostgreSQL databases (via PostGraphile introspection)
|
|
27
27
|
* - PGPM modules (via ephemeral database deployment)
|
|
28
28
|
*/
|
|
29
|
-
__exportStar(require("./
|
|
29
|
+
__exportStar(require("./api-schemas"), exports);
|
|
30
|
+
__exportStar(require("./database"), exports);
|
|
30
31
|
__exportStar(require("./endpoint"), exports);
|
|
31
32
|
__exportStar(require("./file"), exports);
|
|
32
|
-
__exportStar(require("./database"), exports);
|
|
33
33
|
__exportStar(require("./pgpm-module"), exports);
|
|
34
|
-
__exportStar(require("./
|
|
34
|
+
__exportStar(require("./types"), exports);
|
|
35
|
+
const database_1 = require("./database");
|
|
35
36
|
const endpoint_1 = require("./endpoint");
|
|
36
37
|
const file_1 = require("./file");
|
|
37
|
-
const database_1 = require("./database");
|
|
38
38
|
const pgpm_module_1 = require("./pgpm-module");
|
|
39
39
|
function detectSourceMode(options) {
|
|
40
40
|
if (options.endpoint)
|
|
@@ -112,11 +112,7 @@ function createSchemaSource(options) {
|
|
|
112
112
|
*/
|
|
113
113
|
function validateSourceOptions(options) {
|
|
114
114
|
// Count primary sources
|
|
115
|
-
const sources = [
|
|
116
|
-
options.endpoint,
|
|
117
|
-
options.schemaFile,
|
|
118
|
-
options.db,
|
|
119
|
-
].filter(Boolean);
|
|
115
|
+
const sources = [options.endpoint, options.schemaFile, options.db].filter(Boolean);
|
|
120
116
|
if (sources.length === 0) {
|
|
121
117
|
return {
|
|
122
118
|
valid: false,
|
|
@@ -12,14 +12,14 @@ exports.isPgpmWorkspaceOptions = isPgpmWorkspaceOptions;
|
|
|
12
12
|
* 3. Introspecting the database with PostGraphile
|
|
13
13
|
* 4. Cleaning up the ephemeral database (unless keepDb is true)
|
|
14
14
|
*/
|
|
15
|
-
const graphql_1 = require("graphql");
|
|
16
15
|
const core_1 = require("@pgpmjs/core");
|
|
16
|
+
const graphql_1 = require("graphql");
|
|
17
|
+
const pg_cache_1 = require("pg-cache");
|
|
17
18
|
const pgsql_client_1 = require("pgsql-client");
|
|
18
19
|
const pgsql_seed_1 = require("pgsql-seed");
|
|
19
|
-
const pg_cache_1 = require("pg-cache");
|
|
20
|
-
const types_1 = require("./types");
|
|
21
20
|
const database_1 = require("../../database");
|
|
22
21
|
const api_schemas_1 = require("./api-schemas");
|
|
22
|
+
const types_1 = require("./types");
|
|
23
23
|
/**
|
|
24
24
|
* Type guard to check if options use direct module path
|
|
25
25
|
*/
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* format used by code generators.
|
|
6
6
|
*/
|
|
7
7
|
import type { IntrospectionQueryResponse, IntrospectionType } from '../../types/introspection';
|
|
8
|
-
import {
|
|
8
|
+
import { getBaseTypeName, isNonNull, unwrapType } from '../../types/introspection';
|
|
9
9
|
import type { CleanOperation, TypeRegistry } from '../../types/schema';
|
|
10
10
|
/**
|
|
11
11
|
* Build a type registry from introspection types
|
|
@@ -83,4 +83,4 @@ export declare function isTableOperation(operation: CleanOperation, tableOperati
|
|
|
83
83
|
* - True custom operations (login, register, bootstrapUser, etc.)
|
|
84
84
|
*/
|
|
85
85
|
export declare function getCustomOperations(operations: CleanOperation[], tableOperationNames: TableOperationNames): CleanOperation[];
|
|
86
|
-
export {
|
|
86
|
+
export { getBaseTypeName, isNonNull, unwrapType };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.unwrapType = exports.isNonNull = exports.getBaseTypeName = void 0;
|
|
4
4
|
exports.buildTypeRegistry = buildTypeRegistry;
|
|
5
5
|
exports.transformSchemaToOperations = transformSchemaToOperations;
|
|
6
6
|
exports.filterOperations = filterOperations;
|
|
@@ -8,9 +8,9 @@ exports.getTableOperationNames = getTableOperationNames;
|
|
|
8
8
|
exports.isTableOperation = isTableOperation;
|
|
9
9
|
exports.getCustomOperations = getCustomOperations;
|
|
10
10
|
const introspection_1 = require("../../types/introspection");
|
|
11
|
-
Object.defineProperty(exports, "unwrapType", { enumerable: true, get: function () { return introspection_1.unwrapType; } });
|
|
12
11
|
Object.defineProperty(exports, "getBaseTypeName", { enumerable: true, get: function () { return introspection_1.getBaseTypeName; } });
|
|
13
12
|
Object.defineProperty(exports, "isNonNull", { enumerable: true, get: function () { return introspection_1.isNonNull; } });
|
|
13
|
+
Object.defineProperty(exports, "unwrapType", { enumerable: true, get: function () { return introspection_1.unwrapType; } });
|
|
14
14
|
// ============================================================================
|
|
15
15
|
// Type Registry Builder
|
|
16
16
|
// ============================================================================
|
package/core/output/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Output module exports
|
|
3
3
|
*/
|
|
4
|
-
export {
|
|
4
|
+
export { formatOutput, type GeneratedFile, writeGeneratedFiles, type WriteOptions, type WriteResult, } from './writer';
|
package/core/output/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Output module exports
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.writeGeneratedFiles = exports.formatOutput = void 0;
|
|
7
7
|
var writer_1 = require("./writer");
|
|
8
|
-
Object.defineProperty(exports, "writeGeneratedFiles", { enumerable: true, get: function () { return writer_1.writeGeneratedFiles; } });
|
|
9
8
|
Object.defineProperty(exports, "formatOutput", { enumerable: true, get: function () { return writer_1.formatOutput; } });
|
|
9
|
+
Object.defineProperty(exports, "writeGeneratedFiles", { enumerable: true, get: function () { return writer_1.writeGeneratedFiles; } });
|
package/core/output/writer.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export type { GeneratedFile };
|
|
|
6
6
|
export interface WriteResult {
|
|
7
7
|
success: boolean;
|
|
8
8
|
filesWritten?: string[];
|
|
9
|
+
filesRemoved?: string[];
|
|
9
10
|
errors?: string[];
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
@@ -16,6 +17,8 @@ export interface WriteOptions {
|
|
|
16
17
|
showProgress?: boolean;
|
|
17
18
|
/** Format files with oxfmt after writing (default: true) */
|
|
18
19
|
formatFiles?: boolean;
|
|
20
|
+
/** Remove stale .ts files in outputDir that are not in current file list (default: false) */
|
|
21
|
+
pruneStaleFiles?: boolean;
|
|
19
22
|
}
|
|
20
23
|
/**
|
|
21
24
|
* Write generated files to disk
|