@constructive-io/graphql-codegen 2.32.0 → 3.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/README.md +429 -1691
- package/cli/index.d.ts +5 -2
- package/cli/index.js +98 -581
- package/cli/shared.d.ts +35 -0
- package/cli/shared.js +106 -0
- package/{esm/cli → core}/codegen/barrel.d.ts +1 -1
- package/{cli → core}/codegen/barrel.js +1 -4
- package/{esm/cli → core}/codegen/index.d.ts +15 -5
- package/{cli → core}/codegen/index.js +44 -24
- package/{cli → core}/codegen/invalidation.d.ts +2 -2
- package/{esm/cli → core}/codegen/mutation-keys.d.ts +2 -2
- package/{cli → core}/codegen/orm/client-generator.js +2 -3
- package/{esm/cli → core}/codegen/orm/index.d.ts +9 -2
- package/{cli → core}/codegen/orm/index.js +3 -2
- package/{cli → core}/codegen/query-keys.d.ts +2 -2
- package/core/codegen/shared/index.d.ts +39 -0
- package/core/codegen/shared/index.js +118 -0
- package/core/config/index.d.ts +5 -0
- package/core/config/index.js +13 -0
- package/core/config/loader.d.ts +18 -0
- package/{cli/commands/init.js → core/config/loader.js} +7 -94
- package/core/config/resolver.d.ts +46 -0
- package/core/config/resolver.js +104 -0
- package/core/database/index.d.ts +43 -0
- package/core/database/index.js +85 -0
- package/core/generate.d.ts +22 -0
- package/core/generate.js +192 -0
- package/core/index.d.ts +13 -1
- package/core/index.js +22 -2
- package/{cli → core}/introspect/fetch-schema.js +58 -9
- package/core/introspect/source/api-schemas.d.ts +44 -0
- package/core/introspect/source/api-schemas.js +122 -0
- package/core/introspect/source/database.d.ts +32 -0
- package/core/introspect/source/database.js +91 -0
- package/core/introspect/source/index.d.ts +112 -0
- package/core/introspect/source/index.js +173 -0
- package/core/introspect/source/pgpm-module.d.ts +83 -0
- package/core/introspect/source/pgpm-module.js +200 -0
- package/core/output/index.d.ts +4 -0
- package/core/output/index.js +9 -0
- package/core/output/writer.d.ts +38 -0
- package/core/output/writer.js +156 -0
- package/{cli/commands/shared.d.ts → core/pipeline/index.d.ts} +5 -3
- package/{cli/commands/shared.js → core/pipeline/index.js} +4 -0
- package/{cli → core}/watch/orchestrator.d.ts +25 -3
- package/{cli → core}/watch/orchestrator.js +35 -27
- package/{cli → core}/watch/types.d.ts +1 -1
- package/esm/cli/index.d.ts +5 -2
- package/esm/cli/index.js +97 -547
- package/esm/cli/shared.d.ts +35 -0
- package/esm/cli/shared.js +101 -0
- package/{cli → esm/core}/codegen/barrel.d.ts +1 -1
- package/esm/{cli → core}/codegen/barrel.js +1 -4
- package/{cli → esm/core}/codegen/index.d.ts +15 -5
- package/esm/{cli → core}/codegen/index.js +44 -24
- package/esm/{cli → core}/codegen/invalidation.d.ts +2 -2
- package/{cli → esm/core}/codegen/mutation-keys.d.ts +2 -2
- package/esm/{cli → core}/codegen/orm/client-generator.js +2 -3
- package/{cli → esm/core}/codegen/orm/index.d.ts +9 -2
- package/esm/{cli → core}/codegen/orm/index.js +3 -2
- package/esm/{cli → core}/codegen/query-keys.d.ts +2 -2
- package/esm/core/codegen/shared/index.d.ts +39 -0
- package/esm/core/codegen/shared/index.js +79 -0
- package/esm/core/config/index.d.ts +5 -0
- package/esm/core/config/index.js +5 -0
- package/esm/core/config/loader.d.ts +18 -0
- package/esm/core/config/loader.js +71 -0
- package/esm/core/config/resolver.d.ts +46 -0
- package/esm/core/config/resolver.js +100 -0
- package/esm/core/database/index.d.ts +43 -0
- package/esm/core/database/index.js +48 -0
- package/esm/core/generate.d.ts +22 -0
- package/esm/core/generate.js +186 -0
- package/esm/core/index.d.ts +13 -1
- package/esm/core/index.js +20 -1
- package/esm/{cli → core}/introspect/fetch-schema.js +55 -9
- package/esm/core/introspect/source/api-schemas.d.ts +44 -0
- package/esm/core/introspect/source/api-schemas.js +117 -0
- package/esm/core/introspect/source/database.d.ts +32 -0
- package/esm/core/introspect/source/database.js +87 -0
- package/esm/core/introspect/source/index.d.ts +112 -0
- package/esm/core/introspect/source/index.js +154 -0
- package/esm/core/introspect/source/pgpm-module.d.ts +83 -0
- package/esm/core/introspect/source/pgpm-module.js +194 -0
- package/esm/core/output/index.d.ts +4 -0
- package/esm/core/output/index.js +4 -0
- package/esm/core/output/writer.d.ts +38 -0
- package/esm/core/output/writer.js +119 -0
- package/esm/{cli/commands/shared.d.ts → core/pipeline/index.d.ts} +5 -3
- package/esm/{cli/commands/shared.js → core/pipeline/index.js} +1 -0
- package/esm/{cli → core}/watch/orchestrator.d.ts +25 -3
- package/esm/{cli → core}/watch/orchestrator.js +35 -27
- package/esm/{cli → core}/watch/types.d.ts +1 -1
- package/esm/index.d.ts +8 -3
- package/esm/index.js +9 -3
- package/esm/types/config.d.ts +101 -138
- package/esm/types/config.js +8 -35
- package/esm/types/index.d.ts +2 -2
- package/esm/types/index.js +1 -1
- package/index.d.ts +8 -3
- package/index.js +18 -8
- package/package.json +18 -11
- package/types/config.d.ts +101 -138
- package/types/config.js +9 -38
- package/types/index.d.ts +2 -2
- package/types/index.js +3 -3
- package/cli/commands/generate-orm.d.ts +0 -53
- package/cli/commands/generate-orm.js +0 -292
- package/cli/commands/generate.d.ts +0 -66
- package/cli/commands/generate.js +0 -431
- package/cli/commands/index.d.ts +0 -9
- package/cli/commands/index.js +0 -14
- package/cli/commands/init.d.ts +0 -35
- package/cli/introspect/source/index.d.ts +0 -48
- package/cli/introspect/source/index.js +0 -72
- package/esm/cli/commands/generate-orm.d.ts +0 -53
- package/esm/cli/commands/generate-orm.js +0 -289
- package/esm/cli/commands/generate.d.ts +0 -66
- package/esm/cli/commands/generate.js +0 -393
- package/esm/cli/commands/index.d.ts +0 -9
- package/esm/cli/commands/index.js +0 -6
- package/esm/cli/commands/init.d.ts +0 -35
- package/esm/cli/commands/init.js +0 -158
- package/esm/cli/introspect/source/index.d.ts +0 -48
- package/esm/cli/introspect/source/index.js +0 -54
- /package/{cli → core}/codegen/babel-ast.d.ts +0 -0
- /package/{cli → core}/codegen/babel-ast.js +0 -0
- /package/{cli → core}/codegen/client.d.ts +0 -0
- /package/{cli → core}/codegen/client.js +0 -0
- /package/{cli → core}/codegen/custom-mutations.d.ts +0 -0
- /package/{cli → core}/codegen/custom-mutations.js +0 -0
- /package/{cli → core}/codegen/custom-queries.d.ts +0 -0
- /package/{cli → core}/codegen/custom-queries.js +0 -0
- /package/{cli → core}/codegen/gql-ast.d.ts +0 -0
- /package/{cli → core}/codegen/gql-ast.js +0 -0
- /package/{cli → core}/codegen/invalidation.js +0 -0
- /package/{cli → core}/codegen/mutation-keys.js +0 -0
- /package/{cli → core}/codegen/mutations.d.ts +0 -0
- /package/{cli → core}/codegen/mutations.js +0 -0
- /package/{cli → core}/codegen/orm/barrel.d.ts +0 -0
- /package/{cli → core}/codegen/orm/barrel.js +0 -0
- /package/{cli → core}/codegen/orm/client-generator.d.ts +0 -0
- /package/{cli → core}/codegen/orm/client.d.ts +0 -0
- /package/{cli → core}/codegen/orm/client.js +0 -0
- /package/{cli → core}/codegen/orm/custom-ops-generator.d.ts +0 -0
- /package/{cli → core}/codegen/orm/custom-ops-generator.js +0 -0
- /package/{cli → core}/codegen/orm/input-types-generator.d.ts +0 -0
- /package/{cli → core}/codegen/orm/input-types-generator.js +0 -0
- /package/{cli → core}/codegen/orm/model-generator.d.ts +0 -0
- /package/{cli → core}/codegen/orm/model-generator.js +0 -0
- /package/{cli → core}/codegen/orm/query-builder.d.ts +0 -0
- /package/{cli → core}/codegen/orm/query-builder.js +0 -0
- /package/{cli → core}/codegen/orm/query-builder.ts +0 -0
- /package/{cli → core}/codegen/orm/select-types.d.ts +0 -0
- /package/{cli → core}/codegen/orm/select-types.js +0 -0
- /package/{cli → core}/codegen/queries.d.ts +0 -0
- /package/{cli → core}/codegen/queries.js +0 -0
- /package/{cli → core}/codegen/query-keys.js +0 -0
- /package/{cli → core}/codegen/scalars.d.ts +0 -0
- /package/{cli → core}/codegen/scalars.js +0 -0
- /package/{cli → core}/codegen/schema-gql-ast.d.ts +0 -0
- /package/{cli → core}/codegen/schema-gql-ast.js +0 -0
- /package/{cli → core}/codegen/schema-types-generator.d.ts +0 -0
- /package/{cli → core}/codegen/schema-types-generator.js +0 -0
- /package/{cli → core}/codegen/type-resolver.d.ts +0 -0
- /package/{cli → core}/codegen/type-resolver.js +0 -0
- /package/{cli → core}/codegen/types.d.ts +0 -0
- /package/{cli → core}/codegen/types.js +0 -0
- /package/{cli → core}/codegen/utils.d.ts +0 -0
- /package/{cli → core}/codegen/utils.js +0 -0
- /package/{cli → core}/introspect/fetch-schema.d.ts +0 -0
- /package/{cli → core}/introspect/index.d.ts +0 -0
- /package/{cli → core}/introspect/index.js +0 -0
- /package/{cli → core}/introspect/infer-tables.d.ts +0 -0
- /package/{cli → core}/introspect/infer-tables.js +0 -0
- /package/{cli → core}/introspect/schema-query.d.ts +0 -0
- /package/{cli → core}/introspect/schema-query.js +0 -0
- /package/{cli → core}/introspect/source/endpoint.d.ts +0 -0
- /package/{cli → core}/introspect/source/endpoint.js +0 -0
- /package/{cli → core}/introspect/source/file.d.ts +0 -0
- /package/{cli → core}/introspect/source/file.js +0 -0
- /package/{cli → core}/introspect/source/types.d.ts +0 -0
- /package/{cli → core}/introspect/source/types.js +0 -0
- /package/{cli → core}/introspect/transform-schema.d.ts +0 -0
- /package/{cli → core}/introspect/transform-schema.js +0 -0
- /package/{cli → core}/introspect/transform.d.ts +0 -0
- /package/{cli → core}/introspect/transform.js +0 -0
- /package/{cli → core}/watch/cache.d.ts +0 -0
- /package/{cli → core}/watch/cache.js +0 -0
- /package/{cli → core}/watch/debounce.d.ts +0 -0
- /package/{cli → core}/watch/debounce.js +0 -0
- /package/{cli → core}/watch/hash.d.ts +0 -0
- /package/{cli → core}/watch/hash.js +0 -0
- /package/{cli → core}/watch/index.d.ts +0 -0
- /package/{cli → core}/watch/index.js +0 -0
- /package/{cli → core}/watch/poller.d.ts +0 -0
- /package/{cli → core}/watch/poller.js +0 -0
- /package/{cli → core}/watch/types.js +0 -0
- /package/esm/{cli → core}/codegen/babel-ast.d.ts +0 -0
- /package/esm/{cli → core}/codegen/babel-ast.js +0 -0
- /package/esm/{cli → core}/codegen/client.d.ts +0 -0
- /package/esm/{cli → core}/codegen/client.js +0 -0
- /package/esm/{cli → core}/codegen/custom-mutations.d.ts +0 -0
- /package/esm/{cli → core}/codegen/custom-mutations.js +0 -0
- /package/esm/{cli → core}/codegen/custom-queries.d.ts +0 -0
- /package/esm/{cli → core}/codegen/custom-queries.js +0 -0
- /package/esm/{cli → core}/codegen/gql-ast.d.ts +0 -0
- /package/esm/{cli → core}/codegen/gql-ast.js +0 -0
- /package/esm/{cli → core}/codegen/invalidation.js +0 -0
- /package/esm/{cli → core}/codegen/mutation-keys.js +0 -0
- /package/esm/{cli → core}/codegen/mutations.d.ts +0 -0
- /package/esm/{cli → core}/codegen/mutations.js +0 -0
- /package/esm/{cli → core}/codegen/orm/barrel.d.ts +0 -0
- /package/esm/{cli → core}/codegen/orm/barrel.js +0 -0
- /package/esm/{cli → core}/codegen/orm/client-generator.d.ts +0 -0
- /package/esm/{cli → core}/codegen/orm/client.d.ts +0 -0
- /package/esm/{cli → core}/codegen/orm/client.js +0 -0
- /package/esm/{cli → core}/codegen/orm/custom-ops-generator.d.ts +0 -0
- /package/esm/{cli → core}/codegen/orm/custom-ops-generator.js +0 -0
- /package/esm/{cli → core}/codegen/orm/input-types-generator.d.ts +0 -0
- /package/esm/{cli → core}/codegen/orm/input-types-generator.js +0 -0
- /package/esm/{cli → core}/codegen/orm/model-generator.d.ts +0 -0
- /package/esm/{cli → core}/codegen/orm/model-generator.js +0 -0
- /package/esm/{cli → core}/codegen/orm/query-builder.d.ts +0 -0
- /package/esm/{cli → core}/codegen/orm/query-builder.js +0 -0
- /package/esm/{cli → core}/codegen/orm/select-types.d.ts +0 -0
- /package/esm/{cli → core}/codegen/orm/select-types.js +0 -0
- /package/esm/{cli → core}/codegen/queries.d.ts +0 -0
- /package/esm/{cli → core}/codegen/queries.js +0 -0
- /package/esm/{cli → core}/codegen/query-keys.js +0 -0
- /package/esm/{cli → core}/codegen/scalars.d.ts +0 -0
- /package/esm/{cli → core}/codegen/scalars.js +0 -0
- /package/esm/{cli → core}/codegen/schema-gql-ast.d.ts +0 -0
- /package/esm/{cli → core}/codegen/schema-gql-ast.js +0 -0
- /package/esm/{cli → core}/codegen/schema-types-generator.d.ts +0 -0
- /package/esm/{cli → core}/codegen/schema-types-generator.js +0 -0
- /package/esm/{cli → core}/codegen/type-resolver.d.ts +0 -0
- /package/esm/{cli → core}/codegen/type-resolver.js +0 -0
- /package/esm/{cli → core}/codegen/types.d.ts +0 -0
- /package/esm/{cli → core}/codegen/types.js +0 -0
- /package/esm/{cli → core}/codegen/utils.d.ts +0 -0
- /package/esm/{cli → core}/codegen/utils.js +0 -0
- /package/esm/{cli → core}/introspect/fetch-schema.d.ts +0 -0
- /package/esm/{cli → core}/introspect/index.d.ts +0 -0
- /package/esm/{cli → core}/introspect/index.js +0 -0
- /package/esm/{cli → core}/introspect/infer-tables.d.ts +0 -0
- /package/esm/{cli → core}/introspect/infer-tables.js +0 -0
- /package/esm/{cli → core}/introspect/schema-query.d.ts +0 -0
- /package/esm/{cli → core}/introspect/schema-query.js +0 -0
- /package/esm/{cli → core}/introspect/source/endpoint.d.ts +0 -0
- /package/esm/{cli → core}/introspect/source/endpoint.js +0 -0
- /package/esm/{cli → core}/introspect/source/file.d.ts +0 -0
- /package/esm/{cli → core}/introspect/source/file.js +0 -0
- /package/esm/{cli → core}/introspect/source/types.d.ts +0 -0
- /package/esm/{cli → core}/introspect/source/types.js +0 -0
- /package/esm/{cli → core}/introspect/transform-schema.d.ts +0 -0
- /package/esm/{cli → core}/introspect/transform-schema.js +0 -0
- /package/esm/{cli → core}/introspect/transform.d.ts +0 -0
- /package/esm/{cli → core}/introspect/transform.js +0 -0
- /package/esm/{cli → core}/watch/cache.d.ts +0 -0
- /package/esm/{cli → core}/watch/cache.js +0 -0
- /package/esm/{cli → core}/watch/debounce.d.ts +0 -0
- /package/esm/{cli → core}/watch/debounce.js +0 -0
- /package/esm/{cli → core}/watch/hash.d.ts +0 -0
- /package/esm/{cli → core}/watch/hash.js +0 -0
- /package/esm/{cli → core}/watch/index.d.ts +0 -0
- /package/esm/{cli → core}/watch/index.js +0 -0
- /package/esm/{cli → core}/watch/poller.d.ts +0 -0
- /package/esm/{cli → core}/watch/poller.js +0 -0
- /package/esm/{cli → core}/watch/types.js +0 -0
package/types/config.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* SDK Configuration types
|
|
3
3
|
*/
|
|
4
|
+
import type { PgConfig } from 'pg-env';
|
|
4
5
|
/**
|
|
5
6
|
* Entity relationship definition for cascade invalidation
|
|
6
7
|
*/
|
|
@@ -56,21 +57,84 @@ export interface QueryKeyConfig {
|
|
|
56
57
|
*/
|
|
57
58
|
generateMutationKeys?: boolean;
|
|
58
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* PGPM module configuration for ephemeral database creation
|
|
62
|
+
*/
|
|
63
|
+
export interface PgpmConfig {
|
|
64
|
+
/**
|
|
65
|
+
* Path to a PGPM module directory
|
|
66
|
+
* Creates an ephemeral database, deploys the module, and introspects
|
|
67
|
+
*/
|
|
68
|
+
modulePath?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Path to a PGPM workspace directory
|
|
71
|
+
* Must be used together with `moduleName`
|
|
72
|
+
*/
|
|
73
|
+
workspacePath?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Name of the module within the PGPM workspace
|
|
76
|
+
* Must be used together with `workspacePath`
|
|
77
|
+
*/
|
|
78
|
+
moduleName?: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Database configuration for direct database introspection
|
|
82
|
+
*/
|
|
83
|
+
export interface DbConfig {
|
|
84
|
+
/**
|
|
85
|
+
* PostgreSQL connection configuration
|
|
86
|
+
* Falls back to environment variables (PGHOST, PGPORT, PGUSER, PGPASSWORD, PGDATABASE)
|
|
87
|
+
* via @pgpmjs/env when not specified
|
|
88
|
+
*/
|
|
89
|
+
config?: Partial<PgConfig>;
|
|
90
|
+
/**
|
|
91
|
+
* PGPM module configuration for ephemeral database creation
|
|
92
|
+
* When specified, creates an ephemeral database from the module
|
|
93
|
+
*/
|
|
94
|
+
pgpm?: PgpmConfig;
|
|
95
|
+
/**
|
|
96
|
+
* PostgreSQL schemas to introspect
|
|
97
|
+
* Mutually exclusive with `apiNames`
|
|
98
|
+
* @example ['public', 'app_public']
|
|
99
|
+
*/
|
|
100
|
+
schemas?: string[];
|
|
101
|
+
/**
|
|
102
|
+
* API names to resolve schemas from
|
|
103
|
+
* Queries services_public.api_schemas to automatically determine schemas
|
|
104
|
+
* Mutually exclusive with `schemas`
|
|
105
|
+
* @example ['my_api']
|
|
106
|
+
*/
|
|
107
|
+
apiNames?: string[];
|
|
108
|
+
/**
|
|
109
|
+
* Keep the ephemeral database after introspection (for debugging)
|
|
110
|
+
* Only applies when using pgpm
|
|
111
|
+
* @default false
|
|
112
|
+
*/
|
|
113
|
+
keepDb?: boolean;
|
|
114
|
+
}
|
|
59
115
|
/**
|
|
60
116
|
* Target configuration for graphql-codegen
|
|
61
117
|
* Represents a single schema source and output destination.
|
|
118
|
+
*
|
|
119
|
+
* Source options (choose one):
|
|
120
|
+
* - endpoint: GraphQL endpoint URL for live introspection
|
|
121
|
+
* - schemaFile: Path to GraphQL schema file (.graphql)
|
|
122
|
+
* - db: Database configuration for direct introspection or PGPM module
|
|
62
123
|
*/
|
|
63
124
|
export interface GraphQLSDKConfigTarget {
|
|
64
125
|
/**
|
|
65
126
|
* GraphQL endpoint URL for live introspection
|
|
66
|
-
* Either endpoint or schema must be provided
|
|
67
127
|
*/
|
|
68
128
|
endpoint?: string;
|
|
69
129
|
/**
|
|
70
130
|
* Path to GraphQL schema file (.graphql) for file-based generation
|
|
71
|
-
* Either endpoint or schema must be provided
|
|
72
131
|
*/
|
|
73
|
-
|
|
132
|
+
schemaFile?: string;
|
|
133
|
+
/**
|
|
134
|
+
* Database configuration for direct database introspection or PGPM module
|
|
135
|
+
* Use db.schemas or db.apiNames to specify which schemas to introspect
|
|
136
|
+
*/
|
|
137
|
+
db?: DbConfig;
|
|
74
138
|
/**
|
|
75
139
|
* Headers to include in introspection requests
|
|
76
140
|
*/
|
|
@@ -147,39 +211,18 @@ export interface GraphQLSDKConfigTarget {
|
|
|
147
211
|
skipQueryField?: boolean;
|
|
148
212
|
};
|
|
149
213
|
/**
|
|
150
|
-
* ORM client
|
|
151
|
-
* When
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
* Whether to generate ORM client
|
|
156
|
-
* @default false
|
|
157
|
-
*/
|
|
158
|
-
enabled?: boolean;
|
|
159
|
-
/**
|
|
160
|
-
* Output directory for generated ORM client
|
|
161
|
-
* @default './generated/orm'
|
|
162
|
-
*/
|
|
163
|
-
output?: string;
|
|
164
|
-
/**
|
|
165
|
-
* Whether to import shared types from hooks output or generate standalone
|
|
166
|
-
* When true, ORM types.ts will re-export from ../graphql/types
|
|
167
|
-
* @default true
|
|
168
|
-
*/
|
|
169
|
-
useSharedTypes?: boolean;
|
|
170
|
-
};
|
|
214
|
+
* Whether to generate ORM client
|
|
215
|
+
* When enabled, generates a Prisma-like ORM client to {output}/orm
|
|
216
|
+
* @default false
|
|
217
|
+
*/
|
|
218
|
+
orm?: boolean;
|
|
171
219
|
/**
|
|
172
|
-
* React Query
|
|
173
|
-
*
|
|
220
|
+
* Whether to generate React Query hooks
|
|
221
|
+
* When enabled, generates React Query hooks to {output}/hooks
|
|
222
|
+
* When false, only standalone fetch functions are generated (no React dependency)
|
|
223
|
+
* @default false
|
|
174
224
|
*/
|
|
175
|
-
reactQuery?:
|
|
176
|
-
/**
|
|
177
|
-
* Whether to generate React Query hooks (useQuery, useMutation)
|
|
178
|
-
* When false, only standalone fetch functions are generated (no React dependency)
|
|
179
|
-
* @default false
|
|
180
|
-
*/
|
|
181
|
-
enabled?: boolean;
|
|
182
|
-
};
|
|
225
|
+
reactQuery?: boolean;
|
|
183
226
|
/**
|
|
184
227
|
* Query key generation configuration
|
|
185
228
|
* Controls how query keys are structured for cache management
|
|
@@ -190,24 +233,31 @@ export interface GraphQLSDKConfigTarget {
|
|
|
190
233
|
* When enabled via CLI --watch flag, the CLI will poll the endpoint for schema changes
|
|
191
234
|
*/
|
|
192
235
|
watch?: WatchConfig;
|
|
193
|
-
}
|
|
194
|
-
/**
|
|
195
|
-
* Multi-target configuration for graphql-codegen
|
|
196
|
-
*/
|
|
197
|
-
export interface GraphQLSDKMultiConfig {
|
|
198
236
|
/**
|
|
199
|
-
*
|
|
237
|
+
* Authorization header value (convenience option, also available in headers)
|
|
200
238
|
*/
|
|
201
|
-
|
|
239
|
+
authorization?: string;
|
|
202
240
|
/**
|
|
203
|
-
*
|
|
241
|
+
* Enable verbose output
|
|
242
|
+
* @default false
|
|
204
243
|
*/
|
|
205
|
-
|
|
244
|
+
verbose?: boolean;
|
|
245
|
+
/**
|
|
246
|
+
* Dry run - don't write files, just show what would be generated
|
|
247
|
+
* @default false
|
|
248
|
+
*/
|
|
249
|
+
dryRun?: boolean;
|
|
250
|
+
/**
|
|
251
|
+
* Skip custom operations (only generate table CRUD)
|
|
252
|
+
* @default false
|
|
253
|
+
*/
|
|
254
|
+
skipCustomOperations?: boolean;
|
|
206
255
|
}
|
|
207
256
|
/**
|
|
208
257
|
* Main configuration type for graphql-codegen
|
|
258
|
+
* This is the same as GraphQLSDKConfigTarget - we keep the alias for clarity.
|
|
209
259
|
*/
|
|
210
|
-
export type GraphQLSDKConfig = GraphQLSDKConfigTarget
|
|
260
|
+
export type GraphQLSDKConfig = GraphQLSDKConfigTarget;
|
|
211
261
|
/**
|
|
212
262
|
* Watch mode configuration options
|
|
213
263
|
*
|
|
@@ -237,117 +287,30 @@ export interface WatchConfig {
|
|
|
237
287
|
*/
|
|
238
288
|
clearScreen?: boolean;
|
|
239
289
|
}
|
|
240
|
-
/**
|
|
241
|
-
* Resolved watch configuration with defaults applied
|
|
242
|
-
*/
|
|
243
|
-
export interface ResolvedWatchConfig {
|
|
244
|
-
pollInterval: number;
|
|
245
|
-
debounce: number;
|
|
246
|
-
touchFile: string | null;
|
|
247
|
-
clearScreen: boolean;
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Resolved query key configuration with defaults applied
|
|
251
|
-
*/
|
|
252
|
-
export interface ResolvedQueryKeyConfig {
|
|
253
|
-
style: 'flat' | 'hierarchical';
|
|
254
|
-
relationships: Record<string, EntityRelationship>;
|
|
255
|
-
generateScopedKeys: boolean;
|
|
256
|
-
generateCascadeHelpers: boolean;
|
|
257
|
-
generateMutationKeys: boolean;
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* Resolved configuration with defaults applied
|
|
261
|
-
*/
|
|
262
|
-
export interface ResolvedConfig {
|
|
263
|
-
/**
|
|
264
|
-
* GraphQL endpoint URL (empty string if using schema file)
|
|
265
|
-
*/
|
|
266
|
-
endpoint: string;
|
|
267
|
-
/**
|
|
268
|
-
* Path to GraphQL schema file (null if using endpoint)
|
|
269
|
-
*/
|
|
270
|
-
schema: string | null;
|
|
271
|
-
headers: Record<string, string>;
|
|
272
|
-
output: string;
|
|
273
|
-
tables: {
|
|
274
|
-
include: string[];
|
|
275
|
-
exclude: string[];
|
|
276
|
-
systemExclude: string[];
|
|
277
|
-
};
|
|
278
|
-
queries: {
|
|
279
|
-
include: string[];
|
|
280
|
-
exclude: string[];
|
|
281
|
-
systemExclude: string[];
|
|
282
|
-
};
|
|
283
|
-
mutations: {
|
|
284
|
-
include: string[];
|
|
285
|
-
exclude: string[];
|
|
286
|
-
systemExclude: string[];
|
|
287
|
-
};
|
|
288
|
-
excludeFields: string[];
|
|
289
|
-
hooks: {
|
|
290
|
-
queries: boolean;
|
|
291
|
-
mutations: boolean;
|
|
292
|
-
queryKeyPrefix: string;
|
|
293
|
-
};
|
|
294
|
-
postgraphile: {
|
|
295
|
-
schema: string;
|
|
296
|
-
};
|
|
297
|
-
codegen: {
|
|
298
|
-
maxFieldDepth: number;
|
|
299
|
-
skipQueryField: boolean;
|
|
300
|
-
};
|
|
301
|
-
orm: {
|
|
302
|
-
enabled: boolean;
|
|
303
|
-
output: string;
|
|
304
|
-
useSharedTypes: boolean;
|
|
305
|
-
};
|
|
306
|
-
reactQuery: {
|
|
307
|
-
enabled: boolean;
|
|
308
|
-
};
|
|
309
|
-
queryKeys: ResolvedQueryKeyConfig;
|
|
310
|
-
watch: ResolvedWatchConfig;
|
|
311
|
-
}
|
|
312
290
|
/**
|
|
313
291
|
* Default watch configuration values
|
|
314
292
|
*/
|
|
315
|
-
export declare const DEFAULT_WATCH_CONFIG:
|
|
293
|
+
export declare const DEFAULT_WATCH_CONFIG: WatchConfig;
|
|
316
294
|
/**
|
|
317
295
|
* Default query key configuration values
|
|
318
296
|
*/
|
|
319
|
-
export declare const DEFAULT_QUERY_KEY_CONFIG:
|
|
297
|
+
export declare const DEFAULT_QUERY_KEY_CONFIG: QueryKeyConfig;
|
|
320
298
|
/**
|
|
321
299
|
* Default configuration values
|
|
322
300
|
*/
|
|
323
|
-
export declare const DEFAULT_CONFIG:
|
|
301
|
+
export declare const DEFAULT_CONFIG: GraphQLSDKConfigTarget;
|
|
324
302
|
/**
|
|
325
303
|
* Helper function to define configuration with type checking
|
|
326
304
|
*/
|
|
327
305
|
export declare function defineConfig(config: GraphQLSDKConfig): GraphQLSDKConfig;
|
|
328
306
|
/**
|
|
329
|
-
*
|
|
330
|
-
*/
|
|
331
|
-
export interface ResolvedTargetConfig {
|
|
332
|
-
name: string;
|
|
333
|
-
config: ResolvedConfig;
|
|
334
|
-
}
|
|
335
|
-
/**
|
|
336
|
-
* Type guard for multi-target configs
|
|
337
|
-
*/
|
|
338
|
-
export declare function isMultiConfig(config: GraphQLSDKConfig): config is GraphQLSDKMultiConfig;
|
|
339
|
-
/**
|
|
340
|
-
* Merge two target configs (defaults + overrides).
|
|
307
|
+
* Merge two configs (base + overrides).
|
|
341
308
|
* Uses deepmerge with array replacement strategy - when a user specifies
|
|
342
309
|
* an array like include: ['users'], it replaces the default ['*'] entirely.
|
|
343
310
|
*/
|
|
344
311
|
export declare function mergeConfig(base: GraphQLSDKConfigTarget, overrides: GraphQLSDKConfigTarget): GraphQLSDKConfigTarget;
|
|
345
312
|
/**
|
|
346
|
-
*
|
|
347
|
-
*
|
|
348
|
-
*/
|
|
349
|
-
export declare function resolveConfig(config: GraphQLSDKConfig): ResolvedConfig;
|
|
350
|
-
/**
|
|
351
|
-
* Resolve all targets in a multi-target config
|
|
313
|
+
* Get configuration options by merging defaults with user config.
|
|
314
|
+
* Similar to getEnvOptions pattern from @pgpmjs/env.
|
|
352
315
|
*/
|
|
353
|
-
export declare function
|
|
316
|
+
export declare function getConfigOptions(overrides?: GraphQLSDKConfigTarget): GraphQLSDKConfigTarget;
|
package/types/config.js
CHANGED
|
@@ -8,10 +8,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.DEFAULT_CONFIG = exports.DEFAULT_QUERY_KEY_CONFIG = exports.DEFAULT_WATCH_CONFIG = void 0;
|
|
10
10
|
exports.defineConfig = defineConfig;
|
|
11
|
-
exports.isMultiConfig = isMultiConfig;
|
|
12
11
|
exports.mergeConfig = mergeConfig;
|
|
13
|
-
exports.
|
|
14
|
-
exports.resolveConfigTargets = resolveConfigTargets;
|
|
12
|
+
exports.getConfigOptions = getConfigOptions;
|
|
15
13
|
const deepmerge_1 = __importDefault(require("deepmerge"));
|
|
16
14
|
/**
|
|
17
15
|
* Array merge strategy that replaces arrays (source wins over target).
|
|
@@ -25,7 +23,7 @@ const replaceArrays = (_target, source) => source;
|
|
|
25
23
|
exports.DEFAULT_WATCH_CONFIG = {
|
|
26
24
|
pollInterval: 3000,
|
|
27
25
|
debounce: 800,
|
|
28
|
-
touchFile:
|
|
26
|
+
touchFile: undefined,
|
|
29
27
|
clearScreen: true,
|
|
30
28
|
};
|
|
31
29
|
/**
|
|
@@ -43,7 +41,6 @@ exports.DEFAULT_QUERY_KEY_CONFIG = {
|
|
|
43
41
|
*/
|
|
44
42
|
exports.DEFAULT_CONFIG = {
|
|
45
43
|
endpoint: '',
|
|
46
|
-
schema: null,
|
|
47
44
|
headers: {},
|
|
48
45
|
output: './generated/graphql',
|
|
49
46
|
tables: {
|
|
@@ -74,14 +71,8 @@ exports.DEFAULT_CONFIG = {
|
|
|
74
71
|
maxFieldDepth: 2,
|
|
75
72
|
skipQueryField: true,
|
|
76
73
|
},
|
|
77
|
-
orm:
|
|
78
|
-
|
|
79
|
-
output: './generated/orm',
|
|
80
|
-
useSharedTypes: true,
|
|
81
|
-
},
|
|
82
|
-
reactQuery: {
|
|
83
|
-
enabled: false,
|
|
84
|
-
},
|
|
74
|
+
orm: false,
|
|
75
|
+
reactQuery: false,
|
|
85
76
|
queryKeys: exports.DEFAULT_QUERY_KEY_CONFIG,
|
|
86
77
|
watch: exports.DEFAULT_WATCH_CONFIG,
|
|
87
78
|
};
|
|
@@ -92,14 +83,7 @@ function defineConfig(config) {
|
|
|
92
83
|
return config;
|
|
93
84
|
}
|
|
94
85
|
/**
|
|
95
|
-
*
|
|
96
|
-
*/
|
|
97
|
-
function isMultiConfig(config) {
|
|
98
|
-
const targets = config.targets;
|
|
99
|
-
return typeof targets === 'object' && targets !== null;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Merge two target configs (defaults + overrides).
|
|
86
|
+
* Merge two configs (base + overrides).
|
|
103
87
|
* Uses deepmerge with array replacement strategy - when a user specifies
|
|
104
88
|
* an array like include: ['users'], it replaces the default ['*'] entirely.
|
|
105
89
|
*/
|
|
@@ -107,22 +91,9 @@ function mergeConfig(base, overrides) {
|
|
|
107
91
|
return (0, deepmerge_1.default)(base, overrides, { arrayMerge: replaceArrays });
|
|
108
92
|
}
|
|
109
93
|
/**
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*/
|
|
113
|
-
function resolveConfig(config) {
|
|
114
|
-
if (isMultiConfig(config)) {
|
|
115
|
-
throw new Error('Multi-target config cannot be resolved with resolveConfig(). Use resolveConfigTargets().');
|
|
116
|
-
}
|
|
117
|
-
return (0, deepmerge_1.default)(exports.DEFAULT_CONFIG, config, { arrayMerge: replaceArrays });
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Resolve all targets in a multi-target config
|
|
94
|
+
* Get configuration options by merging defaults with user config.
|
|
95
|
+
* Similar to getEnvOptions pattern from @pgpmjs/env.
|
|
121
96
|
*/
|
|
122
|
-
function
|
|
123
|
-
|
|
124
|
-
return Object.entries(config.targets).map(([name, target]) => ({
|
|
125
|
-
name,
|
|
126
|
-
config: resolveConfig(mergeConfig(defaults, target)),
|
|
127
|
-
}));
|
|
97
|
+
function getConfigOptions(overrides = {}) {
|
|
98
|
+
return (0, deepmerge_1.default)(exports.DEFAULT_CONFIG, overrides, { arrayMerge: replaceArrays });
|
|
128
99
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -5,5 +5,5 @@ export type { CleanTable, CleanField, CleanFieldType, CleanRelations, CleanBelon
|
|
|
5
5
|
export type { PageInfo, ConnectionResult, QueryOptions, OrderByItem, FilterOperator, FieldFilter, RelationalFilter, Filter, } from './query';
|
|
6
6
|
export type { MutationOptions, CreateInput, UpdateInput, DeleteInput, MutationResult, } from './mutation';
|
|
7
7
|
export type { SimpleFieldSelection, FieldSelectionPreset, FieldSelection, SelectionOptions, } from './selection';
|
|
8
|
-
export type { GraphQLSDKConfig, GraphQLSDKConfigTarget,
|
|
9
|
-
export { defineConfig,
|
|
8
|
+
export type { GraphQLSDKConfig, GraphQLSDKConfigTarget, } from './config';
|
|
9
|
+
export { defineConfig, getConfigOptions, mergeConfig, DEFAULT_CONFIG, } from './config';
|
package/types/index.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Type exports for @constructive-io/graphql-codegen
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.DEFAULT_CONFIG = exports.
|
|
6
|
+
exports.DEFAULT_CONFIG = exports.mergeConfig = exports.getConfigOptions = exports.defineConfig = void 0;
|
|
7
7
|
var config_1 = require("./config");
|
|
8
8
|
Object.defineProperty(exports, "defineConfig", { enumerable: true, get: function () { return config_1.defineConfig; } });
|
|
9
|
-
Object.defineProperty(exports, "
|
|
10
|
-
Object.defineProperty(exports, "
|
|
9
|
+
Object.defineProperty(exports, "getConfigOptions", { enumerable: true, get: function () { return config_1.getConfigOptions; } });
|
|
10
|
+
Object.defineProperty(exports, "mergeConfig", { enumerable: true, get: function () { return config_1.mergeConfig; } });
|
|
11
11
|
Object.defineProperty(exports, "DEFAULT_CONFIG", { enumerable: true, get: function () { return config_1.DEFAULT_CONFIG; } });
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generate ORM command - generates Prisma-like ORM client from GraphQL schema
|
|
3
|
-
*
|
|
4
|
-
* This command:
|
|
5
|
-
* 1. Fetches schema from endpoint or loads from file
|
|
6
|
-
* 2. Infers table metadata from introspection (replaces _meta)
|
|
7
|
-
* 3. Generates a Prisma-like ORM client with fluent API
|
|
8
|
-
*/
|
|
9
|
-
export interface GenerateOrmOptions {
|
|
10
|
-
/** Path to config file */
|
|
11
|
-
config?: string;
|
|
12
|
-
/** Named target in a multi-target config */
|
|
13
|
-
target?: string;
|
|
14
|
-
/** GraphQL endpoint URL (overrides config) */
|
|
15
|
-
endpoint?: string;
|
|
16
|
-
/** Path to GraphQL schema file (.graphql) */
|
|
17
|
-
schema?: string;
|
|
18
|
-
/** Output directory (overrides config) */
|
|
19
|
-
output?: string;
|
|
20
|
-
/** Authorization header */
|
|
21
|
-
authorization?: string;
|
|
22
|
-
/** Verbose output */
|
|
23
|
-
verbose?: boolean;
|
|
24
|
-
/** Dry run - don't write files */
|
|
25
|
-
dryRun?: boolean;
|
|
26
|
-
/** Skip custom operations (only generate table CRUD) */
|
|
27
|
-
skipCustomOperations?: boolean;
|
|
28
|
-
}
|
|
29
|
-
export interface GenerateOrmTargetResult {
|
|
30
|
-
name: string;
|
|
31
|
-
output: string;
|
|
32
|
-
success: boolean;
|
|
33
|
-
message: string;
|
|
34
|
-
tables?: string[];
|
|
35
|
-
customQueries?: string[];
|
|
36
|
-
customMutations?: string[];
|
|
37
|
-
filesWritten?: string[];
|
|
38
|
-
errors?: string[];
|
|
39
|
-
}
|
|
40
|
-
export interface GenerateOrmResult {
|
|
41
|
-
success: boolean;
|
|
42
|
-
message: string;
|
|
43
|
-
targets?: GenerateOrmTargetResult[];
|
|
44
|
-
tables?: string[];
|
|
45
|
-
customQueries?: string[];
|
|
46
|
-
customMutations?: string[];
|
|
47
|
-
filesWritten?: string[];
|
|
48
|
-
errors?: string[];
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Execute the generate-orm command (generates ORM client)
|
|
52
|
-
*/
|
|
53
|
-
export declare function generateOrm(options?: GenerateOrmOptions): Promise<GenerateOrmResult>;
|