@constructive-io/graphql-codegen 4.17.1 → 4.19.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/core/codegen/barrel.d.ts +6 -6
- package/core/codegen/cli/arg-mapper.d.ts +3 -3
- package/core/codegen/cli/command-map-generator.d.ts +4 -4
- package/core/codegen/cli/custom-command-generator.d.ts +2 -2
- package/core/codegen/cli/docs-generator.d.ts +7 -7
- package/core/codegen/cli/index.d.ts +7 -7
- package/core/codegen/cli/table-command-generator.d.ts +3 -3
- package/core/codegen/custom-mutations.d.ts +3 -3
- package/core/codegen/custom-queries.d.ts +3 -3
- package/core/codegen/docs-utils.d.ts +10 -10
- package/core/codegen/docs-utils.js +1 -1
- package/core/codegen/hooks-ast.d.ts +4 -4
- package/core/codegen/hooks-docs-generator.d.ts +5 -5
- package/core/codegen/index.d.ts +5 -5
- package/core/codegen/invalidation.d.ts +2 -2
- package/core/codegen/mutation-keys.d.ts +3 -3
- package/core/codegen/mutations.d.ts +5 -5
- package/core/codegen/orm/barrel.d.ts +2 -2
- package/core/codegen/orm/client-generator.d.ts +2 -2
- package/core/codegen/orm/custom-ops-generator.d.ts +3 -3
- package/core/codegen/orm/custom-ops-generator.js +1 -1
- package/core/codegen/orm/docs-generator.d.ts +5 -5
- package/core/codegen/orm/index.d.ts +4 -4
- package/core/codegen/orm/input-types-generator.d.ts +4 -4
- package/core/codegen/orm/input-types-generator.js +1 -1
- package/core/codegen/orm/model-generator.d.ts +3 -3
- package/core/codegen/queries.d.ts +4 -4
- package/core/codegen/query-keys.d.ts +3 -3
- package/core/codegen/select-helpers.d.ts +3 -3
- package/core/codegen/shared/index.d.ts +4 -4
- package/core/codegen/type-resolver.d.ts +10 -10
- package/core/codegen/type-resolver.js +3 -3
- package/core/codegen/types.d.ts +2 -2
- package/core/codegen/utils.d.ts +34 -34
- package/core/codegen/utils.js +1 -1
- package/core/generate.d.ts +4 -4
- package/core/generate.js +1 -1
- package/core/introspect/index.d.ts +1 -1
- package/core/introspect/source/database.js +6 -2
- package/core/introspect/source/types.d.ts +37 -0
- package/core/pipeline/index.d.ts +5 -5
- package/esm/core/codegen/barrel.d.ts +6 -6
- package/esm/core/codegen/cli/arg-mapper.d.ts +3 -3
- package/esm/core/codegen/cli/command-map-generator.d.ts +4 -4
- package/esm/core/codegen/cli/custom-command-generator.d.ts +2 -2
- package/esm/core/codegen/cli/docs-generator.d.ts +7 -7
- package/esm/core/codegen/cli/index.d.ts +7 -7
- package/esm/core/codegen/cli/table-command-generator.d.ts +3 -3
- package/esm/core/codegen/custom-mutations.d.ts +3 -3
- package/esm/core/codegen/custom-queries.d.ts +3 -3
- package/esm/core/codegen/docs-utils.d.ts +10 -10
- package/esm/core/codegen/docs-utils.js +1 -1
- package/esm/core/codegen/hooks-ast.d.ts +4 -4
- package/esm/core/codegen/hooks-docs-generator.d.ts +5 -5
- package/esm/core/codegen/index.d.ts +5 -5
- package/esm/core/codegen/invalidation.d.ts +2 -2
- package/esm/core/codegen/mutation-keys.d.ts +3 -3
- package/esm/core/codegen/mutations.d.ts +5 -5
- package/esm/core/codegen/orm/barrel.d.ts +2 -2
- package/esm/core/codegen/orm/client-generator.d.ts +2 -2
- package/esm/core/codegen/orm/custom-ops-generator.d.ts +3 -3
- package/esm/core/codegen/orm/custom-ops-generator.js +1 -1
- package/esm/core/codegen/orm/docs-generator.d.ts +5 -5
- package/esm/core/codegen/orm/index.d.ts +4 -4
- package/esm/core/codegen/orm/input-types-generator.d.ts +4 -4
- package/esm/core/codegen/orm/input-types-generator.js +1 -1
- package/esm/core/codegen/orm/model-generator.d.ts +3 -3
- package/esm/core/codegen/queries.d.ts +4 -4
- package/esm/core/codegen/query-keys.d.ts +3 -3
- package/esm/core/codegen/select-helpers.d.ts +3 -3
- package/esm/core/codegen/shared/index.d.ts +4 -4
- package/esm/core/codegen/type-resolver.d.ts +10 -10
- package/esm/core/codegen/type-resolver.js +3 -3
- package/esm/core/codegen/types.d.ts +2 -2
- package/esm/core/codegen/utils.d.ts +34 -34
- package/esm/core/codegen/utils.js +1 -1
- package/esm/core/generate.d.ts +4 -4
- package/esm/core/generate.js +1 -1
- package/esm/core/introspect/index.d.ts +1 -1
- package/esm/core/introspect/source/database.js +7 -3
- package/esm/core/introspect/source/types.d.ts +37 -0
- package/esm/core/pipeline/index.d.ts +5 -5
- package/esm/types/config.d.ts +1 -1
- package/esm/types/index.d.ts +1 -1
- package/esm/types/schema.d.ts +41 -33
- package/package.json +4 -4
- package/types/config.d.ts +1 -1
- package/types/index.d.ts +1 -1
- package/types/schema.d.ts +41 -33
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Field, FieldType, Table, TypeRegistry } from '../../types/schema';
|
|
2
2
|
/** Lowercase first character */
|
|
3
3
|
export declare function lcFirst(str: string): string;
|
|
4
4
|
/** Uppercase first character */
|
|
@@ -22,118 +22,118 @@ export interface TableNames {
|
|
|
22
22
|
/**
|
|
23
23
|
* Derive all naming variants from a table
|
|
24
24
|
*/
|
|
25
|
-
export declare function getTableNames(table:
|
|
25
|
+
export declare function getTableNames(table: Table): TableNames;
|
|
26
26
|
/**
|
|
27
27
|
* Generate hook function name for list query
|
|
28
28
|
* e.g., "useCarsQuery"
|
|
29
29
|
*/
|
|
30
|
-
export declare function getListQueryHookName(table:
|
|
30
|
+
export declare function getListQueryHookName(table: Table): string;
|
|
31
31
|
/**
|
|
32
32
|
* Generate hook function name for single item query
|
|
33
33
|
* e.g., "useCarQuery"
|
|
34
34
|
*/
|
|
35
|
-
export declare function getSingleQueryHookName(table:
|
|
35
|
+
export declare function getSingleQueryHookName(table: Table): string;
|
|
36
36
|
/**
|
|
37
37
|
* Generate hook function name for create mutation
|
|
38
38
|
* e.g., "useCreateCarMutation"
|
|
39
39
|
*/
|
|
40
|
-
export declare function getCreateMutationHookName(table:
|
|
40
|
+
export declare function getCreateMutationHookName(table: Table): string;
|
|
41
41
|
/**
|
|
42
42
|
* Generate hook function name for update mutation
|
|
43
43
|
* e.g., "useUpdateCarMutation"
|
|
44
44
|
*/
|
|
45
|
-
export declare function getUpdateMutationHookName(table:
|
|
45
|
+
export declare function getUpdateMutationHookName(table: Table): string;
|
|
46
46
|
/**
|
|
47
47
|
* Generate hook function name for delete mutation
|
|
48
48
|
* e.g., "useDeleteCarMutation"
|
|
49
49
|
*/
|
|
50
|
-
export declare function getDeleteMutationHookName(table:
|
|
50
|
+
export declare function getDeleteMutationHookName(table: Table): string;
|
|
51
51
|
/**
|
|
52
52
|
* Generate file name for list query hook
|
|
53
53
|
* e.g., "useCarsQuery.ts"
|
|
54
54
|
*/
|
|
55
|
-
export declare function getListQueryFileName(table:
|
|
55
|
+
export declare function getListQueryFileName(table: Table): string;
|
|
56
56
|
/**
|
|
57
57
|
* Generate file name for single query hook
|
|
58
58
|
* e.g., "useCarQuery.ts"
|
|
59
59
|
*/
|
|
60
|
-
export declare function getSingleQueryFileName(table:
|
|
60
|
+
export declare function getSingleQueryFileName(table: Table): string;
|
|
61
61
|
/**
|
|
62
62
|
* Generate file name for create mutation hook
|
|
63
63
|
*/
|
|
64
|
-
export declare function getCreateMutationFileName(table:
|
|
64
|
+
export declare function getCreateMutationFileName(table: Table): string;
|
|
65
65
|
/**
|
|
66
66
|
* Generate file name for update mutation hook
|
|
67
67
|
*/
|
|
68
|
-
export declare function getUpdateMutationFileName(table:
|
|
68
|
+
export declare function getUpdateMutationFileName(table: Table): string;
|
|
69
69
|
/**
|
|
70
70
|
* Generate file name for delete mutation hook
|
|
71
71
|
*/
|
|
72
|
-
export declare function getDeleteMutationFileName(table:
|
|
72
|
+
export declare function getDeleteMutationFileName(table: Table): string;
|
|
73
73
|
/**
|
|
74
74
|
* Get the GraphQL query name for fetching all rows
|
|
75
75
|
* Uses inflection from introspection, falls back to convention
|
|
76
76
|
*/
|
|
77
|
-
export declare function getAllRowsQueryName(table:
|
|
77
|
+
export declare function getAllRowsQueryName(table: Table): string;
|
|
78
78
|
/**
|
|
79
79
|
* Get the GraphQL query name for fetching single row
|
|
80
80
|
*/
|
|
81
|
-
export declare function getSingleRowQueryName(table:
|
|
81
|
+
export declare function getSingleRowQueryName(table: Table): string;
|
|
82
82
|
/**
|
|
83
83
|
* Get the GraphQL mutation name for creating
|
|
84
84
|
*/
|
|
85
|
-
export declare function getCreateMutationName(table:
|
|
85
|
+
export declare function getCreateMutationName(table: Table): string;
|
|
86
86
|
/**
|
|
87
87
|
* Get the GraphQL mutation name for updating
|
|
88
88
|
*/
|
|
89
|
-
export declare function getUpdateMutationName(table:
|
|
89
|
+
export declare function getUpdateMutationName(table: Table): string;
|
|
90
90
|
/**
|
|
91
91
|
* Get the GraphQL mutation name for deleting
|
|
92
92
|
*/
|
|
93
|
-
export declare function getDeleteMutationName(table:
|
|
93
|
+
export declare function getDeleteMutationName(table: Table): string;
|
|
94
94
|
/**
|
|
95
95
|
* Get PostGraphile filter type name
|
|
96
96
|
* e.g., "CarFilter"
|
|
97
97
|
*/
|
|
98
|
-
export declare function getFilterTypeName(table:
|
|
98
|
+
export declare function getFilterTypeName(table: Table): string;
|
|
99
99
|
/**
|
|
100
100
|
* Get PostGraphile OrderBy enum type name
|
|
101
101
|
* e.g., "CarsOrderBy", "AddressesOrderBy"
|
|
102
102
|
*/
|
|
103
|
-
export declare function getOrderByTypeName(table:
|
|
103
|
+
export declare function getOrderByTypeName(table: Table): string;
|
|
104
104
|
/**
|
|
105
105
|
* Get PostGraphile Condition type name (simple equality filter)
|
|
106
106
|
* e.g., "CarCondition", "AddressCondition"
|
|
107
107
|
*/
|
|
108
|
-
export declare function getConditionTypeName(table:
|
|
108
|
+
export declare function getConditionTypeName(table: Table): string;
|
|
109
109
|
/**
|
|
110
110
|
* Get PostGraphile create input type name
|
|
111
111
|
* e.g., "CreateCarInput"
|
|
112
112
|
*/
|
|
113
|
-
export declare function getCreateInputTypeName(table:
|
|
113
|
+
export declare function getCreateInputTypeName(table: Table): string;
|
|
114
114
|
/**
|
|
115
115
|
* Get PostGraphile patch type name for updates
|
|
116
116
|
* e.g., "CarPatch"
|
|
117
117
|
*/
|
|
118
|
-
export declare function getPatchTypeName(table:
|
|
118
|
+
export declare function getPatchTypeName(table: Table): string;
|
|
119
119
|
/**
|
|
120
120
|
* Get PostGraphile update input type name
|
|
121
121
|
* e.g., "UpdateCarInput"
|
|
122
122
|
*/
|
|
123
|
-
export declare function getUpdateInputTypeName(table:
|
|
123
|
+
export declare function getUpdateInputTypeName(table: Table): string;
|
|
124
124
|
/**
|
|
125
125
|
* Get PostGraphile delete input type name
|
|
126
126
|
* e.g., "DeleteCarInput"
|
|
127
127
|
*/
|
|
128
|
-
export declare function getDeleteInputTypeName(table:
|
|
128
|
+
export declare function getDeleteInputTypeName(table: Table): string;
|
|
129
129
|
/**
|
|
130
130
|
* Convert GraphQL type to TypeScript type
|
|
131
131
|
*/
|
|
132
132
|
export declare function gqlTypeToTs(gqlType: string, isArray?: boolean): string;
|
|
133
133
|
/**
|
|
134
|
-
* Convert
|
|
134
|
+
* Convert FieldType to TypeScript type string
|
|
135
135
|
*/
|
|
136
|
-
export declare function fieldTypeToTs(fieldType:
|
|
136
|
+
export declare function fieldTypeToTs(fieldType: FieldType): string;
|
|
137
137
|
/**
|
|
138
138
|
* Get the PostGraphile filter type for a GraphQL scalar
|
|
139
139
|
* @param gqlType - The GraphQL type string (e.g., "String", "UUID")
|
|
@@ -143,11 +143,11 @@ export declare function getScalarFilterType(gqlType: string, isArray?: boolean):
|
|
|
143
143
|
/**
|
|
144
144
|
* Check if a field is a relation field (not a scalar)
|
|
145
145
|
*/
|
|
146
|
-
export declare function isRelationField(fieldName: string, table:
|
|
146
|
+
export declare function isRelationField(fieldName: string, table: Table): boolean;
|
|
147
147
|
/**
|
|
148
148
|
* Get only scalar fields (non-relation fields)
|
|
149
149
|
*/
|
|
150
|
-
export declare function getScalarFields(table:
|
|
150
|
+
export declare function getScalarFields(table: Table): Field[];
|
|
151
151
|
/**
|
|
152
152
|
* Resolve the inner input type from a CreateXInput.
|
|
153
153
|
* PostGraphile create inputs wrap the actual field definitions in an inner type
|
|
@@ -164,7 +164,7 @@ export declare function resolveInnerInputType(inputTypeName: string, typeRegistr
|
|
|
164
164
|
* are plugin-added computed fields that don't correspond to real database columns.
|
|
165
165
|
* Returns null when no typeRegistry is provided (caller should treat as "no filtering").
|
|
166
166
|
*/
|
|
167
|
-
export declare function getWritableFieldNames(table:
|
|
167
|
+
export declare function getWritableFieldNames(table: Table, typeRegistry?: TypeRegistry): Set<string> | null;
|
|
168
168
|
/**
|
|
169
169
|
* Get scalar fields that represent actual database columns (not computed/plugin-added).
|
|
170
170
|
* When a TypeRegistry is provided, filters out fields that don't exist in the
|
|
@@ -172,7 +172,7 @@ export declare function getWritableFieldNames(table: CleanTable, typeRegistry?:
|
|
|
172
172
|
* hash UUIDs) that aren't real columns and shouldn't appear in default selections.
|
|
173
173
|
* Without a TypeRegistry, falls back to all scalar fields.
|
|
174
174
|
*/
|
|
175
|
-
export declare function getSelectableScalarFields(table:
|
|
175
|
+
export declare function getSelectableScalarFields(table: Table, typeRegistry?: TypeRegistry): Field[];
|
|
176
176
|
/**
|
|
177
177
|
* Primary key field information
|
|
178
178
|
*/
|
|
@@ -188,22 +188,22 @@ export interface PrimaryKeyField {
|
|
|
188
188
|
* Get primary key field information from table constraints
|
|
189
189
|
* Returns array to support composite primary keys
|
|
190
190
|
*/
|
|
191
|
-
export declare function getPrimaryKeyInfo(table:
|
|
191
|
+
export declare function getPrimaryKeyInfo(table: Table): PrimaryKeyField[];
|
|
192
192
|
/**
|
|
193
193
|
* Get primary key field names (convenience wrapper)
|
|
194
194
|
*/
|
|
195
|
-
export declare function getPrimaryKeyFields(table:
|
|
195
|
+
export declare function getPrimaryKeyFields(table: Table): string[];
|
|
196
196
|
/**
|
|
197
197
|
* Check if table has a valid single-field primary key
|
|
198
198
|
* Used to determine if a single query hook can be generated
|
|
199
199
|
* Tables with composite keys return false (handled as custom queries)
|
|
200
200
|
*/
|
|
201
|
-
export declare function hasValidPrimaryKey(table:
|
|
201
|
+
export declare function hasValidPrimaryKey(table: Table): boolean;
|
|
202
202
|
/**
|
|
203
203
|
* Generate query key prefix for a table
|
|
204
204
|
* e.g., "cars" for list queries, "car" for detail queries
|
|
205
205
|
*/
|
|
206
|
-
export declare function getQueryKeyPrefix(table:
|
|
206
|
+
export declare function getQueryKeyPrefix(table: Table): string;
|
|
207
207
|
/**
|
|
208
208
|
* Strip PostGraphile smart comments and boilerplate from a description string.
|
|
209
209
|
*
|
|
@@ -225,7 +225,7 @@ export function gqlTypeToTs(gqlType, isArray = false) {
|
|
|
225
225
|
return isArray ? `${tsType}[]` : tsType;
|
|
226
226
|
}
|
|
227
227
|
/**
|
|
228
|
-
* Convert
|
|
228
|
+
* Convert FieldType to TypeScript type string
|
|
229
229
|
*/
|
|
230
230
|
export function fieldTypeToTs(fieldType) {
|
|
231
231
|
return gqlTypeToTs(fieldType.gqlType, fieldType.isArray);
|
package/esm/core/generate.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CliConfig, GraphQLSDKConfigTarget, SchemaConfig } from '../types/config';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Operation, Table, TypeRegistry } from '../types/schema';
|
|
3
3
|
export interface GenerateOptions extends GraphQLSDKConfigTarget {
|
|
4
4
|
authorization?: string;
|
|
5
5
|
verbose?: boolean;
|
|
@@ -14,10 +14,10 @@ export interface GenerateResult {
|
|
|
14
14
|
filesWritten?: string[];
|
|
15
15
|
errors?: string[];
|
|
16
16
|
pipelineData?: {
|
|
17
|
-
tables:
|
|
17
|
+
tables: Table[];
|
|
18
18
|
customOperations: {
|
|
19
|
-
queries:
|
|
20
|
-
mutations:
|
|
19
|
+
queries: Operation[];
|
|
20
|
+
mutations: Operation[];
|
|
21
21
|
typeRegistry?: TypeRegistry;
|
|
22
22
|
};
|
|
23
23
|
};
|
package/esm/core/generate.js
CHANGED
|
@@ -35,7 +35,7 @@ function resolveSkillsOutputDir(config, outputRoot) {
|
|
|
35
35
|
? config.skillsPath
|
|
36
36
|
: path.resolve(workspaceRoot, config.skillsPath);
|
|
37
37
|
}
|
|
38
|
-
return path.resolve(workspaceRoot, 'skills');
|
|
38
|
+
return path.resolve(workspaceRoot, '.agents/skills');
|
|
39
39
|
}
|
|
40
40
|
export async function generate(options = {}, internalOptions) {
|
|
41
41
|
// Apply defaults to get resolved config
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
export type { InferTablesOptions } from './infer-tables';
|
|
5
5
|
export { inferTablesFromIntrospection } from './infer-tables';
|
|
6
6
|
export { pluralize, singularize } from 'inflekt';
|
|
7
|
-
export type { CreateSchemaSourceOptions, SchemaSource, SchemaSourceResult, } from './source';
|
|
7
|
+
export type { CreateSchemaSourceOptions, MetaTableInfo, SchemaSource, SchemaSourceResult, } from './source';
|
|
8
8
|
export { createSchemaSource, EndpointSchemaSource, FileSchemaSource, SchemaSourceError, validateSourceOptions, } from './source';
|
|
9
9
|
export type { FetchSchemaOptions, FetchSchemaResult } from './fetch-schema';
|
|
10
10
|
export { fetchSchema } from './fetch-schema';
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Loads GraphQL schema directly from a PostgreSQL database using PostGraphile
|
|
5
5
|
* introspection and converts it to introspection format.
|
|
6
|
+
* Also returns _meta table metadata when available (via MetaSchemaPlugin cache).
|
|
6
7
|
*/
|
|
7
8
|
import { buildSchema, introspectionFromSchema } from 'graphql';
|
|
8
|
-
import { buildSchemaSDL } from 'graphile-schema';
|
|
9
|
+
import { buildSchemaSDL, _cachedTablesMeta } from 'graphile-schema';
|
|
9
10
|
import { createDatabasePool, resolveApiSchemas, validateServicesSchemas, } from './api-schemas';
|
|
10
11
|
import { SchemaSourceError } from './types';
|
|
11
12
|
/**
|
|
@@ -42,7 +43,7 @@ export class DatabaseSchemaSource {
|
|
|
42
43
|
else {
|
|
43
44
|
schemas = this.options.schemas ?? ['public'];
|
|
44
45
|
}
|
|
45
|
-
// Build SDL from database
|
|
46
|
+
// Build SDL from database (MetaSchemaPlugin populates _cachedTablesMeta as a side-effect)
|
|
46
47
|
let sdl;
|
|
47
48
|
try {
|
|
48
49
|
sdl = await buildSchemaSDL({
|
|
@@ -75,7 +76,10 @@ export class DatabaseSchemaSource {
|
|
|
75
76
|
}
|
|
76
77
|
// Convert graphql-js introspection result to our mutable type
|
|
77
78
|
const introspection = JSON.parse(JSON.stringify(introspectionResult));
|
|
78
|
-
return {
|
|
79
|
+
return {
|
|
80
|
+
introspection,
|
|
81
|
+
tablesMeta: [..._cachedTablesMeta],
|
|
82
|
+
};
|
|
79
83
|
}
|
|
80
84
|
describe() {
|
|
81
85
|
const { database, schemas, apiNames } = this.options;
|
|
@@ -5,6 +5,38 @@
|
|
|
5
5
|
* to work with both live GraphQL endpoints and static schema files.
|
|
6
6
|
*/
|
|
7
7
|
import type { IntrospectionQueryResponse } from '../../../types/introspection';
|
|
8
|
+
/**
|
|
9
|
+
* Minimal table metadata from the _meta query, used to enrich M:N relations
|
|
10
|
+
* with junction key field information that isn't available from introspection alone.
|
|
11
|
+
*/
|
|
12
|
+
export interface MetaTableInfo {
|
|
13
|
+
name: string;
|
|
14
|
+
schemaName: string;
|
|
15
|
+
relations: {
|
|
16
|
+
manyToMany: Array<{
|
|
17
|
+
fieldName: string | null;
|
|
18
|
+
type: string | null;
|
|
19
|
+
junctionTable: {
|
|
20
|
+
name: string;
|
|
21
|
+
};
|
|
22
|
+
junctionLeftKeyAttributes: Array<{
|
|
23
|
+
name: string;
|
|
24
|
+
}>;
|
|
25
|
+
junctionRightKeyAttributes: Array<{
|
|
26
|
+
name: string;
|
|
27
|
+
}>;
|
|
28
|
+
leftKeyAttributes: Array<{
|
|
29
|
+
name: string;
|
|
30
|
+
}>;
|
|
31
|
+
rightKeyAttributes: Array<{
|
|
32
|
+
name: string;
|
|
33
|
+
}>;
|
|
34
|
+
rightTable: {
|
|
35
|
+
name: string;
|
|
36
|
+
};
|
|
37
|
+
}>;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
8
40
|
/**
|
|
9
41
|
* Result from fetching a schema source
|
|
10
42
|
*/
|
|
@@ -13,6 +45,11 @@ export interface SchemaSourceResult {
|
|
|
13
45
|
* The GraphQL introspection data
|
|
14
46
|
*/
|
|
15
47
|
introspection: IntrospectionQueryResponse;
|
|
48
|
+
/**
|
|
49
|
+
* Optional table metadata from _meta query (provides M:N junction key details).
|
|
50
|
+
* Present when the source supports _meta (database mode or endpoints with MetaSchemaPlugin).
|
|
51
|
+
*/
|
|
52
|
+
tablesMeta?: MetaTableInfo[];
|
|
16
53
|
}
|
|
17
54
|
/**
|
|
18
55
|
* Abstract interface for schema sources
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* - Filtering
|
|
10
10
|
*/
|
|
11
11
|
import type { GraphQLSDKConfigTarget } from '../../types/config';
|
|
12
|
-
import type {
|
|
12
|
+
import type { Operation, Table, TypeRegistry } from '../../types/schema';
|
|
13
13
|
import type { SchemaSource } from '../introspect/source';
|
|
14
14
|
export type { SchemaSource } from '../introspect/source';
|
|
15
15
|
export { createSchemaSource, validateSourceOptions, } from '../introspect/source';
|
|
@@ -35,13 +35,13 @@ export interface CodegenPipelineResult {
|
|
|
35
35
|
/**
|
|
36
36
|
* Inferred table metadata
|
|
37
37
|
*/
|
|
38
|
-
tables:
|
|
38
|
+
tables: Table[];
|
|
39
39
|
/**
|
|
40
40
|
* Custom operations (queries and mutations not covered by tables)
|
|
41
41
|
*/
|
|
42
42
|
customOperations: {
|
|
43
|
-
queries:
|
|
44
|
-
mutations:
|
|
43
|
+
queries: Operation[];
|
|
44
|
+
mutations: Operation[];
|
|
45
45
|
typeRegistry: TypeRegistry;
|
|
46
46
|
};
|
|
47
47
|
/**
|
|
@@ -70,7 +70,7 @@ export declare function runCodegenPipeline(options: CodegenPipelineOptions): Pro
|
|
|
70
70
|
/**
|
|
71
71
|
* Validate that tables were found
|
|
72
72
|
*/
|
|
73
|
-
export declare function validateTablesFound(tables:
|
|
73
|
+
export declare function validateTablesFound(tables: Table[]): {
|
|
74
74
|
valid: boolean;
|
|
75
75
|
error?: string;
|
|
76
76
|
};
|
package/esm/types/config.d.ts
CHANGED
|
@@ -372,7 +372,7 @@ export interface GraphQLSDKConfigTarget {
|
|
|
372
372
|
/**
|
|
373
373
|
* Custom path for generated skill files.
|
|
374
374
|
* When set, skills are written to this directory.
|
|
375
|
-
* When undefined (default), skills are written to {workspaceRoot}/skills/
|
|
375
|
+
* When undefined (default), skills are written to {workspaceRoot}/.agents/skills/
|
|
376
376
|
* where workspaceRoot is auto-detected by walking up from the output directory
|
|
377
377
|
* looking for pnpm-workspace.yaml, lerna.json, or package.json with workspaces.
|
|
378
378
|
*/
|
package/esm/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Type exports for @constructive-io/graphql-codegen
|
|
3
3
|
*/
|
|
4
|
-
export type {
|
|
4
|
+
export type { BelongsToRelation, Field, FieldType, HasManyRelation, HasOneRelation, ManyToManyRelation, Relations, Table, ConstraintInfo, ForeignKeyConstraint, TableConstraints, TableInflection, TableQueryNames, } from './schema';
|
|
5
5
|
export type { ConnectionResult, FieldFilter, Filter, FilterOperator, OrderByItem, PageInfo, QueryOptions, RelationalFilter, } from './query';
|
|
6
6
|
export type { CreateInput, DeleteInput, MutationOptions, MutationResult, UpdateInput, } from './mutation';
|
|
7
7
|
export type { FieldSelection, FieldSelectionPreset, SelectionOptions, SimpleFieldSelection, } from './selection';
|
package/esm/types/schema.d.ts
CHANGED
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* Represents a database table with its fields and relations
|
|
7
7
|
*/
|
|
8
|
-
export interface
|
|
8
|
+
export interface Table {
|
|
9
9
|
name: string;
|
|
10
10
|
/** Description from PostgreSQL COMMENT (smart comments stripped) */
|
|
11
11
|
description?: string;
|
|
12
|
-
fields:
|
|
13
|
-
relations:
|
|
12
|
+
fields: Field[];
|
|
13
|
+
relations: Relations;
|
|
14
14
|
/** PostGraphile inflection rules for this table */
|
|
15
15
|
inflection?: TableInflection;
|
|
16
16
|
/** Query operation names from introspection */
|
|
@@ -94,20 +94,20 @@ export interface TableConstraints {
|
|
|
94
94
|
}
|
|
95
95
|
export interface ConstraintInfo {
|
|
96
96
|
name: string;
|
|
97
|
-
fields:
|
|
97
|
+
fields: Field[];
|
|
98
98
|
}
|
|
99
99
|
export interface ForeignKeyConstraint extends ConstraintInfo {
|
|
100
100
|
refTable: string;
|
|
101
|
-
refFields:
|
|
101
|
+
refFields: Field[];
|
|
102
102
|
}
|
|
103
103
|
/**
|
|
104
104
|
* Represents a field/column in a table
|
|
105
105
|
*/
|
|
106
|
-
export interface
|
|
106
|
+
export interface Field {
|
|
107
107
|
name: string;
|
|
108
108
|
/** Description from PostgreSQL COMMENT (smart comments stripped) */
|
|
109
109
|
description?: string;
|
|
110
|
-
type:
|
|
110
|
+
type: FieldType;
|
|
111
111
|
/** Whether the column has a NOT NULL constraint (inferred from NON_NULL wrapper on entity type field) */
|
|
112
112
|
isNotNull?: boolean | null;
|
|
113
113
|
/** Whether the column has a DEFAULT value (inferred by comparing entity vs CreateInput field nullability) */
|
|
@@ -116,7 +116,7 @@ export interface CleanField {
|
|
|
116
116
|
/**
|
|
117
117
|
* Field type information from PostGraphile introspection
|
|
118
118
|
*/
|
|
119
|
-
export interface
|
|
119
|
+
export interface FieldType {
|
|
120
120
|
/** GraphQL type name (e.g., "String", "UUID", "Int") */
|
|
121
121
|
gqlType: string;
|
|
122
122
|
/** Whether this is an array type */
|
|
@@ -135,64 +135,72 @@ export interface CleanFieldType {
|
|
|
135
135
|
/**
|
|
136
136
|
* All relation types for a table
|
|
137
137
|
*/
|
|
138
|
-
export interface
|
|
139
|
-
belongsTo:
|
|
140
|
-
hasOne:
|
|
141
|
-
hasMany:
|
|
142
|
-
manyToMany:
|
|
138
|
+
export interface Relations {
|
|
139
|
+
belongsTo: BelongsToRelation[];
|
|
140
|
+
hasOne: HasOneRelation[];
|
|
141
|
+
hasMany: HasManyRelation[];
|
|
142
|
+
manyToMany: ManyToManyRelation[];
|
|
143
143
|
}
|
|
144
144
|
/**
|
|
145
145
|
* BelongsTo relation (foreign key on this table)
|
|
146
146
|
*/
|
|
147
|
-
export interface
|
|
147
|
+
export interface BelongsToRelation {
|
|
148
148
|
fieldName: string | null;
|
|
149
149
|
isUnique: boolean;
|
|
150
150
|
referencesTable: string;
|
|
151
151
|
type: string | null;
|
|
152
|
-
keys:
|
|
152
|
+
keys: Field[];
|
|
153
153
|
}
|
|
154
154
|
/**
|
|
155
155
|
* HasOne relation (foreign key on other table, unique)
|
|
156
156
|
*/
|
|
157
|
-
export interface
|
|
157
|
+
export interface HasOneRelation {
|
|
158
158
|
fieldName: string | null;
|
|
159
159
|
isUnique: boolean;
|
|
160
160
|
referencedByTable: string;
|
|
161
161
|
type: string | null;
|
|
162
|
-
keys:
|
|
162
|
+
keys: Field[];
|
|
163
163
|
}
|
|
164
164
|
/**
|
|
165
165
|
* HasMany relation (foreign key on other table, not unique)
|
|
166
166
|
*/
|
|
167
|
-
export interface
|
|
167
|
+
export interface HasManyRelation {
|
|
168
168
|
fieldName: string | null;
|
|
169
169
|
isUnique: boolean;
|
|
170
170
|
referencedByTable: string;
|
|
171
171
|
type: string | null;
|
|
172
|
-
keys:
|
|
172
|
+
keys: Field[];
|
|
173
173
|
}
|
|
174
174
|
/**
|
|
175
175
|
* ManyToMany relation (through junction table)
|
|
176
176
|
*/
|
|
177
|
-
export interface
|
|
177
|
+
export interface ManyToManyRelation {
|
|
178
178
|
fieldName: string | null;
|
|
179
179
|
rightTable: string;
|
|
180
180
|
junctionTable: string;
|
|
181
181
|
type: string | null;
|
|
182
|
+
/** Junction FK field names pointing to the left table */
|
|
183
|
+
junctionLeftKeyFields?: string[];
|
|
184
|
+
/** Junction FK field names pointing to the right table */
|
|
185
|
+
junctionRightKeyFields?: string[];
|
|
186
|
+
/** Left table key fields (usually just 'id') */
|
|
187
|
+
leftKeyFields?: string[];
|
|
188
|
+
/** Right table key fields (usually just 'id') */
|
|
189
|
+
rightKeyFields?: string[];
|
|
182
190
|
}
|
|
183
191
|
/**
|
|
184
192
|
* Clean representation of a GraphQL operation (query or mutation)
|
|
185
193
|
* Derived from introspection data
|
|
186
194
|
*/
|
|
187
|
-
export interface
|
|
195
|
+
export interface Operation {
|
|
188
196
|
/** Operation name (e.g., "login", "currentUser", "cars") */
|
|
189
197
|
name: string;
|
|
190
198
|
/** Operation kind */
|
|
191
199
|
kind: 'query' | 'mutation';
|
|
192
200
|
/** Arguments/variables for the operation */
|
|
193
|
-
args:
|
|
201
|
+
args: Argument[];
|
|
194
202
|
/** Return type */
|
|
195
|
-
returnType:
|
|
203
|
+
returnType: TypeRef;
|
|
196
204
|
/** Description from schema */
|
|
197
205
|
description?: string;
|
|
198
206
|
/** Whether this is deprecated */
|
|
@@ -203,11 +211,11 @@ export interface CleanOperation {
|
|
|
203
211
|
/**
|
|
204
212
|
* Clean representation of an operation argument
|
|
205
213
|
*/
|
|
206
|
-
export interface
|
|
214
|
+
export interface Argument {
|
|
207
215
|
/** Argument name */
|
|
208
216
|
name: string;
|
|
209
217
|
/** Argument type */
|
|
210
|
-
type:
|
|
218
|
+
type: TypeRef;
|
|
211
219
|
/** Default value (as string) */
|
|
212
220
|
defaultValue?: string;
|
|
213
221
|
/** Description from schema */
|
|
@@ -216,30 +224,30 @@ export interface CleanArgument {
|
|
|
216
224
|
/**
|
|
217
225
|
* Clean type reference - simplified from introspection TypeRef
|
|
218
226
|
*/
|
|
219
|
-
export interface
|
|
227
|
+
export interface TypeRef {
|
|
220
228
|
/** Type kind */
|
|
221
229
|
kind: 'SCALAR' | 'OBJECT' | 'INPUT_OBJECT' | 'ENUM' | 'LIST' | 'NON_NULL';
|
|
222
230
|
/** Type name (null for LIST and NON_NULL wrappers) */
|
|
223
231
|
name: string | null;
|
|
224
232
|
/** Inner type for LIST and NON_NULL wrappers */
|
|
225
|
-
ofType?:
|
|
233
|
+
ofType?: TypeRef;
|
|
226
234
|
/** Resolved TypeScript type string */
|
|
227
235
|
tsType?: string;
|
|
228
236
|
/** Fields for OBJECT types */
|
|
229
|
-
fields?:
|
|
237
|
+
fields?: ObjectField[];
|
|
230
238
|
/** Input fields for INPUT_OBJECT types */
|
|
231
|
-
inputFields?:
|
|
239
|
+
inputFields?: Argument[];
|
|
232
240
|
/** Values for ENUM types */
|
|
233
241
|
enumValues?: string[];
|
|
234
242
|
}
|
|
235
243
|
/**
|
|
236
244
|
* Field on an object type
|
|
237
245
|
*/
|
|
238
|
-
export interface
|
|
246
|
+
export interface ObjectField {
|
|
239
247
|
/** Field name */
|
|
240
248
|
name: string;
|
|
241
249
|
/** Field type */
|
|
242
|
-
type:
|
|
250
|
+
type: TypeRef;
|
|
243
251
|
/** Description */
|
|
244
252
|
description?: string;
|
|
245
253
|
}
|
|
@@ -255,9 +263,9 @@ export interface ResolvedType {
|
|
|
255
263
|
name: string;
|
|
256
264
|
description?: string;
|
|
257
265
|
/** Fields for OBJECT types */
|
|
258
|
-
fields?:
|
|
266
|
+
fields?: ObjectField[];
|
|
259
267
|
/** Input fields for INPUT_OBJECT types */
|
|
260
|
-
inputFields?:
|
|
268
|
+
inputFields?: Argument[];
|
|
261
269
|
/** Values for ENUM types */
|
|
262
270
|
enumValues?: string[];
|
|
263
271
|
/** Possible types for UNION types */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@constructive-io/graphql-codegen",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.19.0",
|
|
4
4
|
"description": "GraphQL SDK generator for Constructive databases with React Query hooks",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"graphql",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@0no-co/graphql.web": "^1.1.2",
|
|
57
57
|
"@babel/generator": "^7.29.1",
|
|
58
58
|
"@babel/types": "^7.29.0",
|
|
59
|
-
"@constructive-io/graphql-query": "^3.
|
|
59
|
+
"@constructive-io/graphql-query": "^3.8.0",
|
|
60
60
|
"@constructive-io/graphql-types": "^3.3.4",
|
|
61
61
|
"@inquirerer/utils": "^3.3.4",
|
|
62
62
|
"@pgpmjs/core": "^6.8.0",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"deepmerge": "^4.3.1",
|
|
65
65
|
"find-and-require-package-json": "^0.9.1",
|
|
66
66
|
"gql-ast": "^3.3.3",
|
|
67
|
-
"graphile-schema": "^1.
|
|
67
|
+
"graphile-schema": "^1.8.0",
|
|
68
68
|
"graphql": "16.13.0",
|
|
69
69
|
"inflekt": "^0.3.3",
|
|
70
70
|
"inquirerer": "^4.7.0",
|
|
@@ -101,5 +101,5 @@
|
|
|
101
101
|
"tsx": "^4.21.0",
|
|
102
102
|
"typescript": "^5.9.3"
|
|
103
103
|
},
|
|
104
|
-
"gitHead": "
|
|
104
|
+
"gitHead": "3ca5054c7471ffa8deaea5a369edf46a4f0a5313"
|
|
105
105
|
}
|
package/types/config.d.ts
CHANGED
|
@@ -372,7 +372,7 @@ export interface GraphQLSDKConfigTarget {
|
|
|
372
372
|
/**
|
|
373
373
|
* Custom path for generated skill files.
|
|
374
374
|
* When set, skills are written to this directory.
|
|
375
|
-
* When undefined (default), skills are written to {workspaceRoot}/skills/
|
|
375
|
+
* When undefined (default), skills are written to {workspaceRoot}/.agents/skills/
|
|
376
376
|
* where workspaceRoot is auto-detected by walking up from the output directory
|
|
377
377
|
* looking for pnpm-workspace.yaml, lerna.json, or package.json with workspaces.
|
|
378
378
|
*/
|
package/types/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Type exports for @constructive-io/graphql-codegen
|
|
3
3
|
*/
|
|
4
|
-
export type {
|
|
4
|
+
export type { BelongsToRelation, Field, FieldType, HasManyRelation, HasOneRelation, ManyToManyRelation, Relations, Table, ConstraintInfo, ForeignKeyConstraint, TableConstraints, TableInflection, TableQueryNames, } from './schema';
|
|
5
5
|
export type { ConnectionResult, FieldFilter, Filter, FilterOperator, OrderByItem, PageInfo, QueryOptions, RelationalFilter, } from './query';
|
|
6
6
|
export type { CreateInput, DeleteInput, MutationOptions, MutationResult, UpdateInput, } from './mutation';
|
|
7
7
|
export type { FieldSelection, FieldSelectionPreset, SelectionOptions, SimpleFieldSelection, } from './selection';
|