@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,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Operation, TypeRegistry } from '../../types/schema';
|
|
2
2
|
export interface GeneratedCustomQueryFile {
|
|
3
3
|
fileName: string;
|
|
4
4
|
content: string;
|
|
5
5
|
operationName: string;
|
|
6
6
|
}
|
|
7
7
|
export interface GenerateCustomQueryHookOptions {
|
|
8
|
-
operation:
|
|
8
|
+
operation: Operation;
|
|
9
9
|
typeRegistry: TypeRegistry;
|
|
10
10
|
skipQueryField?: boolean;
|
|
11
11
|
reactQueryEnabled?: boolean;
|
|
@@ -14,7 +14,7 @@ export interface GenerateCustomQueryHookOptions {
|
|
|
14
14
|
}
|
|
15
15
|
export declare function generateCustomQueryHook(options: GenerateCustomQueryHookOptions): GeneratedCustomQueryFile;
|
|
16
16
|
export interface GenerateAllCustomQueryHooksOptions {
|
|
17
|
-
operations:
|
|
17
|
+
operations: Operation[];
|
|
18
18
|
typeRegistry: TypeRegistry;
|
|
19
19
|
skipQueryField?: boolean;
|
|
20
20
|
reactQueryEnabled?: boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DocsConfig } from '../../types/config';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Argument, Field, Operation, Table, TypeRegistry } from '../../types/schema';
|
|
3
3
|
export interface GeneratedDocFile {
|
|
4
4
|
fileName: string;
|
|
5
5
|
content: string;
|
|
@@ -33,15 +33,15 @@ export interface SkillReferenceDefinition {
|
|
|
33
33
|
export declare function getReadmeHeader(title: string): string[];
|
|
34
34
|
export declare function getReadmeFooter(): string[];
|
|
35
35
|
export declare function resolveDocsConfig(docs: DocsConfig | boolean | undefined): DocsConfig;
|
|
36
|
-
export declare function formatArgType(arg:
|
|
37
|
-
export declare function formatTypeRef(t:
|
|
38
|
-
export declare function getEditableFields(table:
|
|
36
|
+
export declare function formatArgType(arg: Operation['args'][number]): string;
|
|
37
|
+
export declare function formatTypeRef(t: Operation['args'][number]['type']): string;
|
|
38
|
+
export declare function getEditableFields(table: Table, typeRegistry?: TypeRegistry): Field[];
|
|
39
39
|
/**
|
|
40
40
|
* Identify search/computed fields on a table — fields present in the GraphQL
|
|
41
41
|
* type but NOT in the create input type. These are plugin-added fields like
|
|
42
42
|
* trgm similarity scores, tsvector ranks, searchScore, etc.
|
|
43
43
|
*/
|
|
44
|
-
export declare function getSearchFields(table:
|
|
44
|
+
export declare function getSearchFields(table: Table, typeRegistry?: TypeRegistry): Field[];
|
|
45
45
|
export interface SpecialFieldGroup {
|
|
46
46
|
/** Category key */
|
|
47
47
|
category: 'geospatial' | 'embedding' | 'search';
|
|
@@ -50,7 +50,7 @@ export interface SpecialFieldGroup {
|
|
|
50
50
|
/** One-line description of this category */
|
|
51
51
|
description: string;
|
|
52
52
|
/** Fields belonging to this category */
|
|
53
|
-
fields:
|
|
53
|
+
fields: Field[];
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
56
|
* Categorize "special" fields on a table into PostGIS, pgvector, and
|
|
@@ -60,7 +60,7 @@ export interface SpecialFieldGroup {
|
|
|
60
60
|
* real columns (geometry, vector, tsvector) are also surfaced with
|
|
61
61
|
* descriptive context in generated docs.
|
|
62
62
|
*/
|
|
63
|
-
export declare function categorizeSpecialFields(table:
|
|
63
|
+
export declare function categorizeSpecialFields(table: Table, typeRegistry?: TypeRegistry): SpecialFieldGroup[];
|
|
64
64
|
/**
|
|
65
65
|
* Build markdown lines describing special fields for README-style docs.
|
|
66
66
|
* Returns empty array when there are no special fields.
|
|
@@ -90,7 +90,7 @@ export interface FlattenedArg {
|
|
|
90
90
|
* e.g. 'ConstructiveInternalTypeEmail' -> 'Email'
|
|
91
91
|
*/
|
|
92
92
|
export declare function cleanTypeName(name: string): string;
|
|
93
|
-
export declare function flattenArgs(args:
|
|
93
|
+
export declare function flattenArgs(args: Argument[], registry?: TypeRegistry): FlattenedArg[];
|
|
94
94
|
/**
|
|
95
95
|
* Build CLI flags string from flattened args.
|
|
96
96
|
* e.g. '--input.email <String> --input.password <String>'
|
|
@@ -100,7 +100,7 @@ export declare function flattenedArgsToFlags(flatArgs: FlattenedArg[]): string;
|
|
|
100
100
|
* Generate a type-aware placeholder for a table field value in code examples.
|
|
101
101
|
* Returns a quoted placeholder string, e.g. `'<UUID>'`, `'<String>'`, `'<Int>'`.
|
|
102
102
|
*/
|
|
103
|
-
export declare function fieldPlaceholder(field:
|
|
103
|
+
export declare function fieldPlaceholder(field: Field): string;
|
|
104
104
|
/**
|
|
105
105
|
* Generate a type-aware placeholder for a primary key value in code examples.
|
|
106
106
|
* PrimaryKeyField has `gqlType` directly (not nested under `.type`).
|
|
@@ -117,7 +117,7 @@ export declare function pkPlaceholder(pk: {
|
|
|
117
117
|
*
|
|
118
118
|
* The result is a ready-to-embed JS expression (quotes included for scalars).
|
|
119
119
|
*/
|
|
120
|
-
export declare function argPlaceholder(arg:
|
|
120
|
+
export declare function argPlaceholder(arg: Argument, registry?: TypeRegistry): string;
|
|
121
121
|
export declare function gqlTypeToJsonSchemaType(gqlType: string): string;
|
|
122
122
|
export declare function buildSkillFile(skill: SkillDefinition, referenceNames?: string[]): string;
|
|
123
123
|
export declare function buildSkillReference(ref: SkillReferenceDefinition): string;
|
|
@@ -261,7 +261,7 @@ function getScalarTypeName(typeRef) {
|
|
|
261
261
|
*/
|
|
262
262
|
/**
|
|
263
263
|
* Resolve inputFields for an INPUT_OBJECT type.
|
|
264
|
-
* Checks the
|
|
264
|
+
* Checks the TypeRef first, then falls back to the TypeRegistry.
|
|
265
265
|
*/
|
|
266
266
|
function resolveInputFields(typeRef, registry) {
|
|
267
267
|
if (typeRef.inputFields && typeRef.inputFields.length > 0) {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* used across queries.ts, mutations.ts, custom-queries.ts, and custom-mutations.ts.
|
|
6
6
|
*/
|
|
7
7
|
import * as t from '@babel/types';
|
|
8
|
-
import type {
|
|
8
|
+
import type { Argument } from '../../types/schema';
|
|
9
9
|
export declare function createImportDeclaration(moduleSpecifier: string, namedImports: string[], typeOnly?: boolean): t.ImportDeclaration;
|
|
10
10
|
export declare function createTypeReExport(names: string[], moduleSpecifier: string): t.ExportNamedDeclaration;
|
|
11
11
|
export declare function typeRef(name: string, params?: t.TSType[]): t.TSTypeReference;
|
|
@@ -68,8 +68,8 @@ export declare function buildFindManyCallExpr(singularName: string, argsIdent: s
|
|
|
68
68
|
export declare function buildFindOneCallExpr(singularName: string, pkFieldName: string, argsIdent: string, paramsIdent?: string): t.CallExpression;
|
|
69
69
|
export declare function generateHookFileCode(headerDescription: string, statements: t.Statement[]): string;
|
|
70
70
|
export declare function scopeTypeLiteral(scopeTypeName: string): t.TSTypeLiteral;
|
|
71
|
-
export declare function wrapInferSelectResultType(typeRefNode:
|
|
72
|
-
export declare function typeRefToTsTypeAST(typeRefNode:
|
|
71
|
+
export declare function wrapInferSelectResultType(typeRefNode: Argument['type'], payloadTypeName: string, selectType: t.TSType): t.TSType;
|
|
72
|
+
export declare function typeRefToTsTypeAST(typeRefNode: Argument['type']): t.TSType;
|
|
73
73
|
export declare function buildSelectionArgsCall(selectType: string | t.TSType): t.VariableDeclaration;
|
|
74
74
|
export declare function buildListSelectionArgsCall(selectTypeName: string, filterTypeName: string, orderByTypeName: string): t.VariableDeclaration;
|
|
75
|
-
export declare function customSelectResultTypeLiteral(opName: string, returnType:
|
|
75
|
+
export declare function customSelectResultTypeLiteral(opName: string, returnType: Argument['type'], payloadTypeName: string, selectType: t.TSType): t.TSTypeLiteral;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Operation, Table, TypeRegistry } from '../../types/schema';
|
|
2
2
|
import type { GeneratedDocFile, McpTool } from './docs-utils';
|
|
3
|
-
export declare function generateHooksReadme(tables:
|
|
4
|
-
export declare function generateHooksAgentsDocs(tables:
|
|
5
|
-
export declare function getHooksMcpTools(tables:
|
|
6
|
-
export declare function generateHooksSkills(tables:
|
|
3
|
+
export declare function generateHooksReadme(tables: Table[], customOperations: Operation[], registry?: TypeRegistry): GeneratedDocFile;
|
|
4
|
+
export declare function generateHooksAgentsDocs(tables: Table[], customOperations: Operation[]): GeneratedDocFile;
|
|
5
|
+
export declare function getHooksMcpTools(tables: Table[], customOperations: Operation[]): McpTool[];
|
|
6
|
+
export declare function generateHooksSkills(tables: Table[], customOperations: Operation[], targetName: string, registry?: TypeRegistry): GeneratedDocFile[];
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
* ...
|
|
24
24
|
*/
|
|
25
25
|
import type { GraphQLSDKConfigTarget } from '../../types/config';
|
|
26
|
-
import type {
|
|
26
|
+
import type { Operation, Table, TypeRegistry } from '../../types/schema';
|
|
27
27
|
export interface GeneratedFile {
|
|
28
28
|
/** Relative path from output directory */
|
|
29
29
|
path: string;
|
|
@@ -43,11 +43,11 @@ export interface GenerateResult {
|
|
|
43
43
|
}
|
|
44
44
|
export interface GenerateOptions {
|
|
45
45
|
/** Tables from GraphQL introspection */
|
|
46
|
-
tables:
|
|
46
|
+
tables: Table[];
|
|
47
47
|
/** Custom operations from __schema introspection */
|
|
48
48
|
customOperations?: {
|
|
49
|
-
queries:
|
|
50
|
-
mutations:
|
|
49
|
+
queries: Operation[];
|
|
50
|
+
mutations: Operation[];
|
|
51
51
|
typeRegistry: TypeRegistry;
|
|
52
52
|
};
|
|
53
53
|
/** Configuration */
|
|
@@ -63,7 +63,7 @@ export interface GenerateOptions {
|
|
|
63
63
|
/**
|
|
64
64
|
* Generate all SDK files for tables only
|
|
65
65
|
*/
|
|
66
|
-
export declare function generateAllFiles(tables:
|
|
66
|
+
export declare function generateAllFiles(tables: Table[], config: GraphQLSDKConfigTarget): GenerateResult;
|
|
67
67
|
/**
|
|
68
68
|
* Generate all SDK files with full support for custom operations
|
|
69
69
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { QueryKeyConfig } from '../../types/config';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Table } from '../../types/schema';
|
|
3
3
|
export interface InvalidationGeneratorOptions {
|
|
4
|
-
tables:
|
|
4
|
+
tables: Table[];
|
|
5
5
|
config: QueryKeyConfig;
|
|
6
6
|
}
|
|
7
7
|
export interface GeneratedInvalidationFile {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { QueryKeyConfig } from '../../types/config';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Operation, Table } from '../../types/schema';
|
|
3
3
|
export interface MutationKeyGeneratorOptions {
|
|
4
|
-
tables:
|
|
5
|
-
customMutations:
|
|
4
|
+
tables: Table[];
|
|
5
|
+
customMutations: Operation[];
|
|
6
6
|
config: QueryKeyConfig;
|
|
7
7
|
}
|
|
8
8
|
export interface GeneratedMutationKeysFile {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Table } from '../../types/schema';
|
|
2
2
|
export interface GeneratedMutationFile {
|
|
3
3
|
fileName: string;
|
|
4
4
|
content: string;
|
|
@@ -7,7 +7,7 @@ export interface MutationGeneratorOptions {
|
|
|
7
7
|
reactQueryEnabled?: boolean;
|
|
8
8
|
useCentralizedKeys?: boolean;
|
|
9
9
|
}
|
|
10
|
-
export declare function generateCreateMutationHook(table:
|
|
11
|
-
export declare function generateUpdateMutationHook(table:
|
|
12
|
-
export declare function generateDeleteMutationHook(table:
|
|
13
|
-
export declare function generateAllMutationHooks(tables:
|
|
10
|
+
export declare function generateCreateMutationHook(table: Table, options?: MutationGeneratorOptions): GeneratedMutationFile | null;
|
|
11
|
+
export declare function generateUpdateMutationHook(table: Table, options?: MutationGeneratorOptions): GeneratedMutationFile | null;
|
|
12
|
+
export declare function generateDeleteMutationHook(table: Table, options?: MutationGeneratorOptions): GeneratedMutationFile | null;
|
|
13
|
+
export declare function generateAllMutationHooks(tables: Table[], options?: MutationGeneratorOptions): GeneratedMutationFile[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Table } from '../../../types/schema';
|
|
2
2
|
export interface GeneratedBarrelFile {
|
|
3
3
|
fileName: string;
|
|
4
4
|
content: string;
|
|
@@ -6,7 +6,7 @@ export interface GeneratedBarrelFile {
|
|
|
6
6
|
/**
|
|
7
7
|
* Generate the models/index.ts barrel file
|
|
8
8
|
*/
|
|
9
|
-
export declare function generateModelsBarrel(tables:
|
|
9
|
+
export declare function generateModelsBarrel(tables: Table[]): GeneratedBarrelFile;
|
|
10
10
|
/**
|
|
11
11
|
* Generate the types.ts file that re-exports all types
|
|
12
12
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Table } from '../../../types/schema';
|
|
2
2
|
export interface GeneratedClientFile {
|
|
3
3
|
fileName: string;
|
|
4
4
|
content: string;
|
|
@@ -25,6 +25,6 @@ export declare function generateSelectTypesFile(): GeneratedClientFile;
|
|
|
25
25
|
/**
|
|
26
26
|
* Generate the main index.ts with createClient factory
|
|
27
27
|
*/
|
|
28
|
-
export declare function generateCreateClientFile(tables:
|
|
28
|
+
export declare function generateCreateClientFile(tables: Table[], hasCustomQueries: boolean, hasCustomMutations: boolean, options?: {
|
|
29
29
|
nodeHttpAdapter?: boolean;
|
|
30
30
|
}): GeneratedClientFile;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Operation } from '../../../types/schema';
|
|
2
2
|
export interface GeneratedCustomOpsFile {
|
|
3
3
|
fileName: string;
|
|
4
4
|
content: string;
|
|
@@ -6,8 +6,8 @@ export interface GeneratedCustomOpsFile {
|
|
|
6
6
|
/**
|
|
7
7
|
* Generate the query/index.ts file for custom query operations
|
|
8
8
|
*/
|
|
9
|
-
export declare function generateCustomQueryOpsFile(operations:
|
|
9
|
+
export declare function generateCustomQueryOpsFile(operations: Operation[], comments?: boolean): GeneratedCustomOpsFile;
|
|
10
10
|
/**
|
|
11
11
|
* Generate the mutation/index.ts file for custom mutation operations
|
|
12
12
|
*/
|
|
13
|
-
export declare function generateCustomMutationOpsFile(operations:
|
|
13
|
+
export declare function generateCustomMutationOpsFile(operations: Operation[], comments?: boolean): GeneratedCustomOpsFile;
|
|
@@ -357,7 +357,7 @@ export function generateCustomMutationOpsFile(operations, comments = true) {
|
|
|
357
357
|
};
|
|
358
358
|
}
|
|
359
359
|
/**
|
|
360
|
-
* Format a
|
|
360
|
+
* Format a TypeRef to GraphQL type string
|
|
361
361
|
*/
|
|
362
362
|
function formatGraphQLType(typeRef) {
|
|
363
363
|
let result = '';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Operation, Table, TypeRegistry } from '../../../types/schema';
|
|
2
2
|
import type { GeneratedDocFile, McpTool } from '../docs-utils';
|
|
3
|
-
export declare function generateOrmReadme(tables:
|
|
4
|
-
export declare function generateOrmAgentsDocs(tables:
|
|
5
|
-
export declare function getOrmMcpTools(tables:
|
|
6
|
-
export declare function generateOrmSkills(tables:
|
|
3
|
+
export declare function generateOrmReadme(tables: Table[], customOperations: Operation[], registry?: TypeRegistry): GeneratedDocFile;
|
|
4
|
+
export declare function generateOrmAgentsDocs(tables: Table[], customOperations: Operation[]): GeneratedDocFile;
|
|
5
|
+
export declare function getOrmMcpTools(tables: Table[], customOperations: Operation[]): McpTool[];
|
|
6
|
+
export declare function generateOrmSkills(tables: Table[], customOperations: Operation[], targetName: string, registry?: TypeRegistry): GeneratedDocFile[];
|
|
@@ -5,16 +5,16 @@
|
|
|
5
5
|
* and produces the complete ORM client output.
|
|
6
6
|
*/
|
|
7
7
|
import type { GraphQLSDKConfigTarget } from '../../../types/config';
|
|
8
|
-
import type {
|
|
8
|
+
import type { Operation, Table, TypeRegistry } from '../../../types/schema';
|
|
9
9
|
export interface GeneratedFile {
|
|
10
10
|
path: string;
|
|
11
11
|
content: string;
|
|
12
12
|
}
|
|
13
13
|
export interface GenerateOrmOptions {
|
|
14
|
-
tables:
|
|
14
|
+
tables: Table[];
|
|
15
15
|
customOperations?: {
|
|
16
|
-
queries:
|
|
17
|
-
mutations:
|
|
16
|
+
queries: Operation[];
|
|
17
|
+
mutations: Operation[];
|
|
18
18
|
typeRegistry?: TypeRegistry;
|
|
19
19
|
};
|
|
20
20
|
config: GraphQLSDKConfigTarget;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Argument, Table, TypeRegistry } from '../../../types/schema';
|
|
2
2
|
export interface GeneratedInputTypesFile {
|
|
3
3
|
fileName: string;
|
|
4
4
|
content: string;
|
|
@@ -7,17 +7,17 @@ export interface GeneratedInputTypesFile {
|
|
|
7
7
|
* Collect all input type names used by operations
|
|
8
8
|
*/
|
|
9
9
|
export declare function collectInputTypeNames(operations: Array<{
|
|
10
|
-
args:
|
|
10
|
+
args: Argument[];
|
|
11
11
|
}>): Set<string>;
|
|
12
12
|
/**
|
|
13
13
|
* Collect all payload type names from operation return types
|
|
14
14
|
*/
|
|
15
15
|
export declare function collectPayloadTypeNames(operations: Array<{
|
|
16
|
-
returnType:
|
|
16
|
+
returnType: Argument['type'];
|
|
17
17
|
}>): Set<string>;
|
|
18
18
|
/**
|
|
19
19
|
* Generate comprehensive input-types.ts file using Babel AST
|
|
20
20
|
*/
|
|
21
|
-
export declare function generateInputTypesFile(typeRegistry: TypeRegistry, usedInputTypes: Set<string>, tables?:
|
|
21
|
+
export declare function generateInputTypesFile(typeRegistry: TypeRegistry, usedInputTypes: Set<string>, tables?: Table[], usedPayloadTypes?: Set<string>, comments?: boolean, options?: {
|
|
22
22
|
condition?: boolean;
|
|
23
23
|
}): GeneratedInputTypesFile;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Table } from '../../../types/schema';
|
|
2
2
|
export interface GeneratedModelFile {
|
|
3
3
|
fileName: string;
|
|
4
4
|
content: string;
|
|
5
5
|
modelName: string;
|
|
6
6
|
tableName: string;
|
|
7
7
|
}
|
|
8
|
-
export declare function generateModelFile(table:
|
|
8
|
+
export declare function generateModelFile(table: Table, _useSharedTypes: boolean, options?: {
|
|
9
9
|
condition?: boolean;
|
|
10
10
|
}): GeneratedModelFile;
|
|
11
|
-
export declare function generateAllModelFiles(tables:
|
|
11
|
+
export declare function generateAllModelFiles(tables: Table[], useSharedTypes: boolean, options?: {
|
|
12
12
|
condition?: boolean;
|
|
13
13
|
}): GeneratedModelFile[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Table } from '../../types/schema';
|
|
2
2
|
export interface GeneratedQueryFile {
|
|
3
3
|
fileName: string;
|
|
4
4
|
content: string;
|
|
@@ -9,6 +9,6 @@ export interface QueryGeneratorOptions {
|
|
|
9
9
|
hasRelationships?: boolean;
|
|
10
10
|
condition?: boolean;
|
|
11
11
|
}
|
|
12
|
-
export declare function generateListQueryHook(table:
|
|
13
|
-
export declare function generateSingleQueryHook(table:
|
|
14
|
-
export declare function generateAllQueryHooks(tables:
|
|
12
|
+
export declare function generateListQueryHook(table: Table, options?: QueryGeneratorOptions): GeneratedQueryFile;
|
|
13
|
+
export declare function generateSingleQueryHook(table: Table, options?: QueryGeneratorOptions): GeneratedQueryFile | null;
|
|
14
|
+
export declare function generateAllQueryHooks(tables: Table[], options?: QueryGeneratorOptions): GeneratedQueryFile[];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { QueryKeyConfig } from '../../types/config';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Operation, Table } from '../../types/schema';
|
|
3
3
|
export interface QueryKeyGeneratorOptions {
|
|
4
|
-
tables:
|
|
5
|
-
customQueries:
|
|
4
|
+
tables: Table[];
|
|
5
|
+
customQueries: Operation[];
|
|
6
6
|
config: QueryKeyConfig;
|
|
7
7
|
}
|
|
8
8
|
export interface GeneratedQueryKeysFile {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Used by custom-queries.ts, custom-mutations.ts, and orm/custom-ops-generator.ts
|
|
5
5
|
*/
|
|
6
|
-
import type {
|
|
6
|
+
import type { Argument } from '../../types/schema';
|
|
7
7
|
/**
|
|
8
8
|
* Types that don't need Select types (scalars + root query/mutation types)
|
|
9
9
|
*/
|
|
@@ -12,8 +12,8 @@ export declare const NON_SELECT_TYPES: Set<string>;
|
|
|
12
12
|
* Get the Select type name for a return type.
|
|
13
13
|
* Returns null for scalar types, Connection types, and root types.
|
|
14
14
|
*/
|
|
15
|
-
export declare function getSelectTypeName(returnType:
|
|
15
|
+
export declare function getSelectTypeName(returnType: Argument['type']): string | null;
|
|
16
16
|
/**
|
|
17
17
|
* Wrap a type reference in InferSelectResult, handling NON_NULL and LIST wrappers.
|
|
18
18
|
*/
|
|
19
|
-
export declare function wrapInferSelectResult(typeRef:
|
|
19
|
+
export declare function wrapInferSelectResult(typeRef: Argument['type'], payloadTypeName: string, selectType?: string): string;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { GraphQLSDKConfigTarget } from '../../../types/config';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Operation, Table, TypeRegistry } from '../../../types/schema';
|
|
3
3
|
export interface GeneratedFile {
|
|
4
4
|
path: string;
|
|
5
5
|
content: string;
|
|
6
6
|
}
|
|
7
7
|
export interface GenerateSharedOptions {
|
|
8
|
-
tables:
|
|
8
|
+
tables: Table[];
|
|
9
9
|
customOperations?: {
|
|
10
|
-
queries:
|
|
11
|
-
mutations:
|
|
10
|
+
queries: Operation[];
|
|
11
|
+
mutations: Operation[];
|
|
12
12
|
typeRegistry: TypeRegistry;
|
|
13
13
|
};
|
|
14
14
|
config: GraphQLSDKConfigTarget;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Type Resolver - Convert GraphQL types to TypeScript
|
|
3
3
|
*
|
|
4
|
-
* Utilities for converting
|
|
4
|
+
* Utilities for converting TypeRef and other GraphQL types
|
|
5
5
|
* into TypeScript type strings and interface definitions.
|
|
6
6
|
*/
|
|
7
|
-
import type {
|
|
7
|
+
import type { TypeRef } from '../../types/schema';
|
|
8
8
|
/**
|
|
9
9
|
* Interface for tracking referenced types during code generation
|
|
10
10
|
*/
|
|
@@ -38,37 +38,37 @@ export declare function createTypeTracker(options?: TypeTrackerOptions): TypeTra
|
|
|
38
38
|
*/
|
|
39
39
|
export declare function scalarToTsType(scalarName: string): string;
|
|
40
40
|
/**
|
|
41
|
-
* Convert a
|
|
41
|
+
* Convert a TypeRef to a TypeScript type string
|
|
42
42
|
* Handles nested LIST and NON_NULL wrappers
|
|
43
43
|
*
|
|
44
44
|
* @param typeRef - The GraphQL type reference
|
|
45
45
|
* @param tracker - Optional TypeTracker to collect referenced types
|
|
46
46
|
*/
|
|
47
|
-
export declare function typeRefToTsType(typeRef:
|
|
47
|
+
export declare function typeRefToTsType(typeRef: TypeRef, tracker?: TypeTracker): string;
|
|
48
48
|
/**
|
|
49
|
-
* Convert a
|
|
49
|
+
* Convert a TypeRef to a nullable TypeScript type string
|
|
50
50
|
* (for optional fields that can be null)
|
|
51
51
|
*
|
|
52
52
|
* @param typeRef - The GraphQL type reference
|
|
53
53
|
* @param tracker - Optional TypeTracker to collect referenced types
|
|
54
54
|
*/
|
|
55
|
-
export declare function typeRefToNullableTsType(typeRef:
|
|
55
|
+
export declare function typeRefToNullableTsType(typeRef: TypeRef, tracker?: TypeTracker): string;
|
|
56
56
|
/**
|
|
57
57
|
* Check if a type reference is required (wrapped in NON_NULL)
|
|
58
58
|
*/
|
|
59
|
-
export declare function isTypeRequired(typeRef:
|
|
59
|
+
export declare function isTypeRequired(typeRef: TypeRef): boolean;
|
|
60
60
|
/**
|
|
61
61
|
* Check if a type reference is a list
|
|
62
62
|
*/
|
|
63
|
-
export declare function isTypeList(typeRef:
|
|
63
|
+
export declare function isTypeList(typeRef: TypeRef): boolean;
|
|
64
64
|
/**
|
|
65
65
|
* Get the base type name from a type reference (unwrapping wrappers)
|
|
66
66
|
*/
|
|
67
|
-
export declare function getTypeBaseName(typeRef:
|
|
67
|
+
export declare function getTypeBaseName(typeRef: TypeRef): string | null;
|
|
68
68
|
/**
|
|
69
69
|
* Get the base type kind (unwrapping LIST and NON_NULL)
|
|
70
70
|
*/
|
|
71
|
-
export declare function getBaseTypeKind(typeRef:
|
|
71
|
+
export declare function getBaseTypeKind(typeRef: TypeRef): TypeRef['kind'];
|
|
72
72
|
/**
|
|
73
73
|
* Check if a field should be skipped in selections
|
|
74
74
|
*/
|
|
@@ -62,10 +62,10 @@ export function scalarToTsType(scalarName) {
|
|
|
62
62
|
return resolveScalarToTs(scalarName, { unknownScalar: 'unknown' });
|
|
63
63
|
}
|
|
64
64
|
// ============================================================================
|
|
65
|
-
//
|
|
65
|
+
// TypeRef to TypeScript
|
|
66
66
|
// ============================================================================
|
|
67
67
|
/**
|
|
68
|
-
* Convert a
|
|
68
|
+
* Convert a TypeRef to a TypeScript type string
|
|
69
69
|
* Handles nested LIST and NON_NULL wrappers
|
|
70
70
|
*
|
|
71
71
|
* @param typeRef - The GraphQL type reference
|
|
@@ -107,7 +107,7 @@ export function typeRefToTsType(typeRef, tracker) {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
/**
|
|
110
|
-
* Convert a
|
|
110
|
+
* Convert a TypeRef to a nullable TypeScript type string
|
|
111
111
|
* (for optional fields that can be null)
|
|
112
112
|
*
|
|
113
113
|
* @param typeRef - The GraphQL type reference
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Table } from '../../types/schema';
|
|
2
2
|
/**
|
|
3
3
|
* Options for generating types.ts
|
|
4
4
|
*/
|
|
@@ -9,4 +9,4 @@ export interface GenerateTypesOptions {
|
|
|
9
9
|
/**
|
|
10
10
|
* Generate types.ts content with all entity interfaces and base filter types
|
|
11
11
|
*/
|
|
12
|
-
export declare function generateTypesFile(tables:
|
|
12
|
+
export declare function generateTypesFile(tables: Table[], options?: GenerateTypesOptions): string;
|