@constructive-io/graphql-codegen 2.31.0 → 3.0.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 +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} +12 -5
- 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} +9 -5
- 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 +110 -136
- package/esm/types/config.js +23 -148
- 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 +19 -11
- package/types/config.d.ts +110 -136
- package/types/config.js +28 -152
- 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/esm/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
|
*/
|
|
@@ -88,6 +152,8 @@ export interface GraphQLSDKConfigTarget {
|
|
|
88
152
|
include?: string[];
|
|
89
153
|
/** Tables to exclude (glob patterns supported) */
|
|
90
154
|
exclude?: string[];
|
|
155
|
+
/** System-level tables to always exclude (can be overridden to [] to disable) */
|
|
156
|
+
systemExclude?: string[];
|
|
91
157
|
};
|
|
92
158
|
/**
|
|
93
159
|
* Query operation filtering (for ALL queries from __schema introspection)
|
|
@@ -96,8 +162,10 @@ export interface GraphQLSDKConfigTarget {
|
|
|
96
162
|
queries?: {
|
|
97
163
|
/** Query names to include - defaults to ['*'] */
|
|
98
164
|
include?: string[];
|
|
99
|
-
/** Query names to exclude
|
|
165
|
+
/** Query names to exclude */
|
|
100
166
|
exclude?: string[];
|
|
167
|
+
/** System-level queries to always exclude (defaults to ['_meta', 'query'], can be overridden to [] to disable) */
|
|
168
|
+
systemExclude?: string[];
|
|
101
169
|
};
|
|
102
170
|
/**
|
|
103
171
|
* Mutation operation filtering (for ALL mutations from __schema introspection)
|
|
@@ -108,6 +176,8 @@ export interface GraphQLSDKConfigTarget {
|
|
|
108
176
|
include?: string[];
|
|
109
177
|
/** Mutation names to exclude */
|
|
110
178
|
exclude?: string[];
|
|
179
|
+
/** System-level mutations to always exclude (can be overridden to [] to disable) */
|
|
180
|
+
systemExclude?: string[];
|
|
111
181
|
};
|
|
112
182
|
/**
|
|
113
183
|
* Fields to exclude globally from all tables
|
|
@@ -141,34 +211,18 @@ export interface GraphQLSDKConfigTarget {
|
|
|
141
211
|
skipQueryField?: boolean;
|
|
142
212
|
};
|
|
143
213
|
/**
|
|
144
|
-
* ORM client
|
|
145
|
-
* When
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
* Output directory for generated ORM client
|
|
150
|
-
* @default './generated/orm'
|
|
151
|
-
*/
|
|
152
|
-
output?: string;
|
|
153
|
-
/**
|
|
154
|
-
* Whether to import shared types from hooks output or generate standalone
|
|
155
|
-
* When true, ORM types.ts will re-export from ../graphql/types
|
|
156
|
-
* @default true
|
|
157
|
-
*/
|
|
158
|
-
useSharedTypes?: boolean;
|
|
159
|
-
};
|
|
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;
|
|
160
219
|
/**
|
|
161
|
-
* React Query
|
|
162
|
-
*
|
|
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
|
|
163
224
|
*/
|
|
164
|
-
reactQuery?:
|
|
165
|
-
/**
|
|
166
|
-
* Whether to generate React Query hooks (useQuery, useMutation)
|
|
167
|
-
* When false, only standalone fetch functions are generated (no React dependency)
|
|
168
|
-
* @default false
|
|
169
|
-
*/
|
|
170
|
-
enabled?: boolean;
|
|
171
|
-
};
|
|
225
|
+
reactQuery?: boolean;
|
|
172
226
|
/**
|
|
173
227
|
* Query key generation configuration
|
|
174
228
|
* Controls how query keys are structured for cache management
|
|
@@ -179,24 +233,31 @@ export interface GraphQLSDKConfigTarget {
|
|
|
179
233
|
* When enabled via CLI --watch flag, the CLI will poll the endpoint for schema changes
|
|
180
234
|
*/
|
|
181
235
|
watch?: WatchConfig;
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Multi-target configuration for graphql-codegen
|
|
185
|
-
*/
|
|
186
|
-
export interface GraphQLSDKMultiConfig {
|
|
187
236
|
/**
|
|
188
|
-
*
|
|
237
|
+
* Authorization header value (convenience option, also available in headers)
|
|
238
|
+
*/
|
|
239
|
+
authorization?: string;
|
|
240
|
+
/**
|
|
241
|
+
* Enable verbose output
|
|
242
|
+
* @default false
|
|
243
|
+
*/
|
|
244
|
+
verbose?: boolean;
|
|
245
|
+
/**
|
|
246
|
+
* Dry run - don't write files, just show what would be generated
|
|
247
|
+
* @default false
|
|
189
248
|
*/
|
|
190
|
-
|
|
249
|
+
dryRun?: boolean;
|
|
191
250
|
/**
|
|
192
|
-
*
|
|
251
|
+
* Skip custom operations (only generate table CRUD)
|
|
252
|
+
* @default false
|
|
193
253
|
*/
|
|
194
|
-
|
|
254
|
+
skipCustomOperations?: boolean;
|
|
195
255
|
}
|
|
196
256
|
/**
|
|
197
257
|
* Main configuration type for graphql-codegen
|
|
258
|
+
* This is the same as GraphQLSDKConfigTarget - we keep the alias for clarity.
|
|
198
259
|
*/
|
|
199
|
-
export type GraphQLSDKConfig = GraphQLSDKConfigTarget
|
|
260
|
+
export type GraphQLSDKConfig = GraphQLSDKConfigTarget;
|
|
200
261
|
/**
|
|
201
262
|
* Watch mode configuration options
|
|
202
263
|
*
|
|
@@ -226,117 +287,30 @@ export interface WatchConfig {
|
|
|
226
287
|
*/
|
|
227
288
|
clearScreen?: boolean;
|
|
228
289
|
}
|
|
229
|
-
/**
|
|
230
|
-
* Resolved watch configuration with defaults applied
|
|
231
|
-
*/
|
|
232
|
-
export interface ResolvedWatchConfig {
|
|
233
|
-
pollInterval: number;
|
|
234
|
-
debounce: number;
|
|
235
|
-
touchFile: string | null;
|
|
236
|
-
clearScreen: boolean;
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Resolved query key configuration with defaults applied
|
|
240
|
-
*/
|
|
241
|
-
export interface ResolvedQueryKeyConfig {
|
|
242
|
-
style: 'flat' | 'hierarchical';
|
|
243
|
-
relationships: Record<string, EntityRelationship>;
|
|
244
|
-
generateScopedKeys: boolean;
|
|
245
|
-
generateCascadeHelpers: boolean;
|
|
246
|
-
generateMutationKeys: boolean;
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* Resolved configuration with defaults applied
|
|
250
|
-
*/
|
|
251
|
-
export interface ResolvedConfig {
|
|
252
|
-
/**
|
|
253
|
-
* GraphQL endpoint URL (empty string if using schema file)
|
|
254
|
-
*/
|
|
255
|
-
endpoint: string;
|
|
256
|
-
/**
|
|
257
|
-
* Path to GraphQL schema file (null if using endpoint)
|
|
258
|
-
*/
|
|
259
|
-
schema: string | null;
|
|
260
|
-
headers: Record<string, string>;
|
|
261
|
-
output: string;
|
|
262
|
-
tables: {
|
|
263
|
-
include: string[];
|
|
264
|
-
exclude: string[];
|
|
265
|
-
};
|
|
266
|
-
queries: {
|
|
267
|
-
include: string[];
|
|
268
|
-
exclude: string[];
|
|
269
|
-
};
|
|
270
|
-
mutations: {
|
|
271
|
-
include: string[];
|
|
272
|
-
exclude: string[];
|
|
273
|
-
};
|
|
274
|
-
excludeFields: string[];
|
|
275
|
-
hooks: {
|
|
276
|
-
queries: boolean;
|
|
277
|
-
mutations: boolean;
|
|
278
|
-
queryKeyPrefix: string;
|
|
279
|
-
};
|
|
280
|
-
postgraphile: {
|
|
281
|
-
schema: string;
|
|
282
|
-
};
|
|
283
|
-
codegen: {
|
|
284
|
-
maxFieldDepth: number;
|
|
285
|
-
skipQueryField: boolean;
|
|
286
|
-
};
|
|
287
|
-
orm: {
|
|
288
|
-
output: string;
|
|
289
|
-
useSharedTypes: boolean;
|
|
290
|
-
} | null;
|
|
291
|
-
reactQuery: {
|
|
292
|
-
enabled: boolean;
|
|
293
|
-
};
|
|
294
|
-
queryKeys: ResolvedQueryKeyConfig;
|
|
295
|
-
watch: ResolvedWatchConfig;
|
|
296
|
-
}
|
|
297
290
|
/**
|
|
298
291
|
* Default watch configuration values
|
|
299
292
|
*/
|
|
300
|
-
export declare const DEFAULT_WATCH_CONFIG:
|
|
293
|
+
export declare const DEFAULT_WATCH_CONFIG: WatchConfig;
|
|
301
294
|
/**
|
|
302
295
|
* Default query key configuration values
|
|
303
296
|
*/
|
|
304
|
-
export declare const DEFAULT_QUERY_KEY_CONFIG:
|
|
297
|
+
export declare const DEFAULT_QUERY_KEY_CONFIG: QueryKeyConfig;
|
|
305
298
|
/**
|
|
306
299
|
* Default configuration values
|
|
307
300
|
*/
|
|
308
|
-
export declare const DEFAULT_CONFIG:
|
|
309
|
-
/**
|
|
310
|
-
* Default ORM configuration values
|
|
311
|
-
*/
|
|
312
|
-
export declare const DEFAULT_ORM_CONFIG: {
|
|
313
|
-
output: string;
|
|
314
|
-
useSharedTypes: boolean;
|
|
315
|
-
};
|
|
301
|
+
export declare const DEFAULT_CONFIG: GraphQLSDKConfigTarget;
|
|
316
302
|
/**
|
|
317
303
|
* Helper function to define configuration with type checking
|
|
318
304
|
*/
|
|
319
305
|
export declare function defineConfig(config: GraphQLSDKConfig): GraphQLSDKConfig;
|
|
320
306
|
/**
|
|
321
|
-
*
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
name: string;
|
|
325
|
-
config: ResolvedConfig;
|
|
326
|
-
}
|
|
327
|
-
/**
|
|
328
|
-
* Type guard for multi-target configs
|
|
329
|
-
*/
|
|
330
|
-
export declare function isMultiConfig(config: GraphQLSDKConfig): config is GraphQLSDKMultiConfig;
|
|
331
|
-
/**
|
|
332
|
-
* Merge two target configs (defaults + overrides)
|
|
307
|
+
* Merge two configs (base + overrides).
|
|
308
|
+
* Uses deepmerge with array replacement strategy - when a user specifies
|
|
309
|
+
* an array like include: ['users'], it replaces the default ['*'] entirely.
|
|
333
310
|
*/
|
|
334
311
|
export declare function mergeConfig(base: GraphQLSDKConfigTarget, overrides: GraphQLSDKConfigTarget): GraphQLSDKConfigTarget;
|
|
335
312
|
/**
|
|
336
|
-
*
|
|
337
|
-
|
|
338
|
-
export declare function resolveConfig(config: GraphQLSDKConfig): ResolvedConfig;
|
|
339
|
-
/**
|
|
340
|
-
* 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.
|
|
341
315
|
*/
|
|
342
|
-
export declare function
|
|
316
|
+
export declare function getConfigOptions(overrides?: GraphQLSDKConfigTarget): GraphQLSDKConfigTarget;
|
package/esm/types/config.js
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* SDK Configuration types
|
|
3
3
|
*/
|
|
4
|
+
import deepmerge from 'deepmerge';
|
|
5
|
+
/**
|
|
6
|
+
* Array merge strategy that replaces arrays (source wins over target).
|
|
7
|
+
* This ensures that when a user specifies include: ['users'], it replaces
|
|
8
|
+
* the default ['*'] rather than merging to ['*', 'users'].
|
|
9
|
+
*/
|
|
10
|
+
const replaceArrays = (_target, source) => source;
|
|
4
11
|
/**
|
|
5
12
|
* Default watch configuration values
|
|
6
13
|
*/
|
|
7
14
|
export const DEFAULT_WATCH_CONFIG = {
|
|
8
15
|
pollInterval: 3000,
|
|
9
16
|
debounce: 800,
|
|
10
|
-
touchFile:
|
|
17
|
+
touchFile: undefined,
|
|
11
18
|
clearScreen: true,
|
|
12
19
|
};
|
|
13
20
|
/**
|
|
@@ -24,19 +31,23 @@ export const DEFAULT_QUERY_KEY_CONFIG = {
|
|
|
24
31
|
* Default configuration values
|
|
25
32
|
*/
|
|
26
33
|
export const DEFAULT_CONFIG = {
|
|
34
|
+
endpoint: '',
|
|
27
35
|
headers: {},
|
|
28
36
|
output: './generated/graphql',
|
|
29
37
|
tables: {
|
|
30
38
|
include: ['*'],
|
|
31
39
|
exclude: [],
|
|
40
|
+
systemExclude: [],
|
|
32
41
|
},
|
|
33
42
|
queries: {
|
|
34
43
|
include: ['*'],
|
|
35
|
-
exclude: [
|
|
44
|
+
exclude: [],
|
|
45
|
+
systemExclude: ['_meta', 'query'], // Internal PostGraphile queries
|
|
36
46
|
},
|
|
37
47
|
mutations: {
|
|
38
48
|
include: ['*'],
|
|
39
49
|
exclude: [],
|
|
50
|
+
systemExclude: [],
|
|
40
51
|
},
|
|
41
52
|
excludeFields: [],
|
|
42
53
|
hooks: {
|
|
@@ -51,20 +62,11 @@ export const DEFAULT_CONFIG = {
|
|
|
51
62
|
maxFieldDepth: 2,
|
|
52
63
|
skipQueryField: true,
|
|
53
64
|
},
|
|
54
|
-
orm:
|
|
55
|
-
reactQuery:
|
|
56
|
-
enabled: true, // React Query hooks enabled by default for generate command
|
|
57
|
-
},
|
|
65
|
+
orm: false,
|
|
66
|
+
reactQuery: false,
|
|
58
67
|
queryKeys: DEFAULT_QUERY_KEY_CONFIG,
|
|
59
68
|
watch: DEFAULT_WATCH_CONFIG,
|
|
60
69
|
};
|
|
61
|
-
/**
|
|
62
|
-
* Default ORM configuration values
|
|
63
|
-
*/
|
|
64
|
-
export const DEFAULT_ORM_CONFIG = {
|
|
65
|
-
output: './generated/orm',
|
|
66
|
-
useSharedTypes: true,
|
|
67
|
-
};
|
|
68
70
|
/**
|
|
69
71
|
* Helper function to define configuration with type checking
|
|
70
72
|
*/
|
|
@@ -72,144 +74,17 @@ export function defineConfig(config) {
|
|
|
72
74
|
return config;
|
|
73
75
|
}
|
|
74
76
|
/**
|
|
75
|
-
*
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const targets = config.targets;
|
|
79
|
-
return typeof targets === 'object' && targets !== null;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Merge two target configs (defaults + overrides)
|
|
77
|
+
* Merge two configs (base + overrides).
|
|
78
|
+
* Uses deepmerge with array replacement strategy - when a user specifies
|
|
79
|
+
* an array like include: ['users'], it replaces the default ['*'] entirely.
|
|
83
80
|
*/
|
|
84
81
|
export function mergeConfig(base, overrides) {
|
|
85
|
-
|
|
86
|
-
? { ...(base.headers ?? {}), ...(overrides.headers ?? {}) }
|
|
87
|
-
: undefined;
|
|
88
|
-
const tables = base.tables || overrides.tables
|
|
89
|
-
? { ...(base.tables ?? {}), ...(overrides.tables ?? {}) }
|
|
90
|
-
: undefined;
|
|
91
|
-
const queries = base.queries || overrides.queries
|
|
92
|
-
? { ...(base.queries ?? {}), ...(overrides.queries ?? {}) }
|
|
93
|
-
: undefined;
|
|
94
|
-
const mutations = base.mutations || overrides.mutations
|
|
95
|
-
? { ...(base.mutations ?? {}), ...(overrides.mutations ?? {}) }
|
|
96
|
-
: undefined;
|
|
97
|
-
const hooks = base.hooks || overrides.hooks
|
|
98
|
-
? { ...(base.hooks ?? {}), ...(overrides.hooks ?? {}) }
|
|
99
|
-
: undefined;
|
|
100
|
-
const postgraphile = base.postgraphile || overrides.postgraphile
|
|
101
|
-
? { ...(base.postgraphile ?? {}), ...(overrides.postgraphile ?? {}) }
|
|
102
|
-
: undefined;
|
|
103
|
-
const codegen = base.codegen || overrides.codegen
|
|
104
|
-
? { ...(base.codegen ?? {}), ...(overrides.codegen ?? {}) }
|
|
105
|
-
: undefined;
|
|
106
|
-
const orm = base.orm || overrides.orm
|
|
107
|
-
? { ...(base.orm ?? {}), ...(overrides.orm ?? {}) }
|
|
108
|
-
: undefined;
|
|
109
|
-
const reactQuery = base.reactQuery || overrides.reactQuery
|
|
110
|
-
? { ...(base.reactQuery ?? {}), ...(overrides.reactQuery ?? {}) }
|
|
111
|
-
: undefined;
|
|
112
|
-
const queryKeys = base.queryKeys || overrides.queryKeys
|
|
113
|
-
? {
|
|
114
|
-
...(base.queryKeys ?? {}),
|
|
115
|
-
...(overrides.queryKeys ?? {}),
|
|
116
|
-
relationships: {
|
|
117
|
-
...(base.queryKeys?.relationships ?? {}),
|
|
118
|
-
...(overrides.queryKeys?.relationships ?? {}),
|
|
119
|
-
},
|
|
120
|
-
}
|
|
121
|
-
: undefined;
|
|
122
|
-
const watch = base.watch || overrides.watch
|
|
123
|
-
? { ...(base.watch ?? {}), ...(overrides.watch ?? {}) }
|
|
124
|
-
: undefined;
|
|
125
|
-
return {
|
|
126
|
-
...base,
|
|
127
|
-
...overrides,
|
|
128
|
-
headers,
|
|
129
|
-
tables,
|
|
130
|
-
queries,
|
|
131
|
-
mutations,
|
|
132
|
-
hooks,
|
|
133
|
-
postgraphile,
|
|
134
|
-
codegen,
|
|
135
|
-
orm,
|
|
136
|
-
reactQuery,
|
|
137
|
-
queryKeys,
|
|
138
|
-
watch,
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Resolve configuration by applying defaults
|
|
143
|
-
*/
|
|
144
|
-
export function resolveConfig(config) {
|
|
145
|
-
if (isMultiConfig(config)) {
|
|
146
|
-
throw new Error('Multi-target config cannot be resolved with resolveConfig(). Use resolveConfigTargets().');
|
|
147
|
-
}
|
|
148
|
-
return {
|
|
149
|
-
endpoint: config.endpoint ?? '',
|
|
150
|
-
schema: config.schema ?? null,
|
|
151
|
-
headers: config.headers ?? DEFAULT_CONFIG.headers,
|
|
152
|
-
output: config.output ?? DEFAULT_CONFIG.output,
|
|
153
|
-
tables: {
|
|
154
|
-
include: config.tables?.include ?? DEFAULT_CONFIG.tables.include,
|
|
155
|
-
exclude: config.tables?.exclude ?? DEFAULT_CONFIG.tables.exclude,
|
|
156
|
-
},
|
|
157
|
-
queries: {
|
|
158
|
-
include: config.queries?.include ?? DEFAULT_CONFIG.queries.include,
|
|
159
|
-
exclude: config.queries?.exclude ?? DEFAULT_CONFIG.queries.exclude,
|
|
160
|
-
},
|
|
161
|
-
mutations: {
|
|
162
|
-
include: config.mutations?.include ?? DEFAULT_CONFIG.mutations.include,
|
|
163
|
-
exclude: config.mutations?.exclude ?? DEFAULT_CONFIG.mutations.exclude,
|
|
164
|
-
},
|
|
165
|
-
excludeFields: config.excludeFields ?? DEFAULT_CONFIG.excludeFields,
|
|
166
|
-
hooks: {
|
|
167
|
-
queries: config.hooks?.queries ?? DEFAULT_CONFIG.hooks.queries,
|
|
168
|
-
mutations: config.hooks?.mutations ?? DEFAULT_CONFIG.hooks.mutations,
|
|
169
|
-
queryKeyPrefix: config.hooks?.queryKeyPrefix ?? DEFAULT_CONFIG.hooks.queryKeyPrefix,
|
|
170
|
-
},
|
|
171
|
-
postgraphile: {
|
|
172
|
-
schema: config.postgraphile?.schema ?? DEFAULT_CONFIG.postgraphile.schema,
|
|
173
|
-
},
|
|
174
|
-
codegen: {
|
|
175
|
-
maxFieldDepth: config.codegen?.maxFieldDepth ?? DEFAULT_CONFIG.codegen.maxFieldDepth,
|
|
176
|
-
skipQueryField: config.codegen?.skipQueryField ?? DEFAULT_CONFIG.codegen.skipQueryField,
|
|
177
|
-
},
|
|
178
|
-
orm: config.orm
|
|
179
|
-
? {
|
|
180
|
-
output: config.orm.output ?? DEFAULT_ORM_CONFIG.output,
|
|
181
|
-
useSharedTypes: config.orm.useSharedTypes ?? DEFAULT_ORM_CONFIG.useSharedTypes,
|
|
182
|
-
}
|
|
183
|
-
: null,
|
|
184
|
-
reactQuery: {
|
|
185
|
-
enabled: config.reactQuery?.enabled ?? DEFAULT_CONFIG.reactQuery.enabled,
|
|
186
|
-
},
|
|
187
|
-
queryKeys: {
|
|
188
|
-
style: config.queryKeys?.style ?? DEFAULT_QUERY_KEY_CONFIG.style,
|
|
189
|
-
relationships: config.queryKeys?.relationships ??
|
|
190
|
-
DEFAULT_QUERY_KEY_CONFIG.relationships,
|
|
191
|
-
generateScopedKeys: config.queryKeys?.generateScopedKeys ??
|
|
192
|
-
DEFAULT_QUERY_KEY_CONFIG.generateScopedKeys,
|
|
193
|
-
generateCascadeHelpers: config.queryKeys?.generateCascadeHelpers ??
|
|
194
|
-
DEFAULT_QUERY_KEY_CONFIG.generateCascadeHelpers,
|
|
195
|
-
generateMutationKeys: config.queryKeys?.generateMutationKeys ??
|
|
196
|
-
DEFAULT_QUERY_KEY_CONFIG.generateMutationKeys,
|
|
197
|
-
},
|
|
198
|
-
watch: {
|
|
199
|
-
pollInterval: config.watch?.pollInterval ?? DEFAULT_WATCH_CONFIG.pollInterval,
|
|
200
|
-
debounce: config.watch?.debounce ?? DEFAULT_WATCH_CONFIG.debounce,
|
|
201
|
-
touchFile: config.watch?.touchFile ?? DEFAULT_WATCH_CONFIG.touchFile,
|
|
202
|
-
clearScreen: config.watch?.clearScreen ?? DEFAULT_WATCH_CONFIG.clearScreen,
|
|
203
|
-
},
|
|
204
|
-
};
|
|
82
|
+
return deepmerge(base, overrides, { arrayMerge: replaceArrays });
|
|
205
83
|
}
|
|
206
84
|
/**
|
|
207
|
-
*
|
|
85
|
+
* Get configuration options by merging defaults with user config.
|
|
86
|
+
* Similar to getEnvOptions pattern from @pgpmjs/env.
|
|
208
87
|
*/
|
|
209
|
-
export function
|
|
210
|
-
|
|
211
|
-
return Object.entries(config.targets).map(([name, target]) => ({
|
|
212
|
-
name,
|
|
213
|
-
config: resolveConfig(mergeConfig(defaults, target)),
|
|
214
|
-
}));
|
|
88
|
+
export function getConfigOptions(overrides = {}) {
|
|
89
|
+
return deepmerge(DEFAULT_CONFIG, overrides, { arrayMerge: replaceArrays });
|
|
215
90
|
}
|
package/esm/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/esm/types/index.js
CHANGED
package/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @constructive-io/graphql-codegen
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* GraphQL SDK generator for Constructive databases.
|
|
5
5
|
* Introspects via _meta query and generates typed queries, mutations,
|
|
6
6
|
* and React Query v5 hooks.
|
|
7
7
|
*/
|
|
@@ -10,5 +10,10 @@ export * from './core';
|
|
|
10
10
|
export * from './generators';
|
|
11
11
|
export * from './client';
|
|
12
12
|
export { defineConfig } from './types/config';
|
|
13
|
-
export {
|
|
14
|
-
export type { GenerateOptions, GenerateResult
|
|
13
|
+
export { generate } from './core/generate';
|
|
14
|
+
export type { GenerateOptions, GenerateResult } from './core/generate';
|
|
15
|
+
export { findConfigFile, loadConfigFile } from './core/config';
|
|
16
|
+
export { codegenQuestions, splitCommas, printResult } from './cli/shared';
|
|
17
|
+
export type { CodegenAnswers } from './cli/shared';
|
|
18
|
+
export { buildSchemaFromDatabase, buildSchemaSDLFromDatabase, } from './core/database';
|
|
19
|
+
export type { BuildSchemaFromDatabaseOptions, BuildSchemaFromDatabaseResult, } from './core/database';
|
package/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* @constructive-io/graphql-codegen
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* GraphQL SDK generator for Constructive databases.
|
|
6
6
|
* Introspects via _meta query and generates typed queries, mutations,
|
|
7
7
|
* and React Query v5 hooks.
|
|
8
8
|
*/
|
|
@@ -21,7 +21,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
21
21
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
22
22
|
};
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.
|
|
24
|
+
exports.buildSchemaSDLFromDatabase = exports.buildSchemaFromDatabase = exports.printResult = exports.splitCommas = exports.codegenQuestions = exports.loadConfigFile = exports.findConfigFile = exports.generate = exports.defineConfig = void 0;
|
|
25
25
|
// Core types
|
|
26
26
|
__exportStar(require("./types"), exports);
|
|
27
27
|
// Core query building
|
|
@@ -33,9 +33,19 @@ __exportStar(require("./client"), exports);
|
|
|
33
33
|
// Config definition helper
|
|
34
34
|
var config_1 = require("./types/config");
|
|
35
35
|
Object.defineProperty(exports, "defineConfig", { enumerable: true, get: function () { return config_1.defineConfig; } });
|
|
36
|
-
//
|
|
37
|
-
var
|
|
38
|
-
Object.defineProperty(exports, "
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
Object.defineProperty(exports, "
|
|
36
|
+
// Main generate function (orchestrates the entire pipeline)
|
|
37
|
+
var generate_1 = require("./core/generate");
|
|
38
|
+
Object.defineProperty(exports, "generate", { enumerable: true, get: function () { return generate_1.generate; } });
|
|
39
|
+
// Config utilities
|
|
40
|
+
var config_2 = require("./core/config");
|
|
41
|
+
Object.defineProperty(exports, "findConfigFile", { enumerable: true, get: function () { return config_2.findConfigFile; } });
|
|
42
|
+
Object.defineProperty(exports, "loadConfigFile", { enumerable: true, get: function () { return config_2.loadConfigFile; } });
|
|
43
|
+
// CLI shared utilities (for packages/cli to import)
|
|
44
|
+
var shared_1 = require("./cli/shared");
|
|
45
|
+
Object.defineProperty(exports, "codegenQuestions", { enumerable: true, get: function () { return shared_1.codegenQuestions; } });
|
|
46
|
+
Object.defineProperty(exports, "splitCommas", { enumerable: true, get: function () { return shared_1.splitCommas; } });
|
|
47
|
+
Object.defineProperty(exports, "printResult", { enumerable: true, get: function () { return shared_1.printResult; } });
|
|
48
|
+
// Database schema utilities (re-exported from core for convenience)
|
|
49
|
+
var database_1 = require("./core/database");
|
|
50
|
+
Object.defineProperty(exports, "buildSchemaFromDatabase", { enumerable: true, get: function () { return database_1.buildSchemaFromDatabase; } });
|
|
51
|
+
Object.defineProperty(exports, "buildSchemaSDLFromDatabase", { enumerable: true, get: function () { return database_1.buildSchemaSDLFromDatabase; } });
|