@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
package/core/codegen/barrel.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Table } from '../../types/schema';
|
|
2
2
|
/**
|
|
3
3
|
* Generate the queries/index.ts barrel file
|
|
4
4
|
*/
|
|
5
|
-
export declare function generateQueriesBarrel(tables:
|
|
5
|
+
export declare function generateQueriesBarrel(tables: Table[]): string;
|
|
6
6
|
/**
|
|
7
7
|
* Generate the mutations/index.ts barrel file
|
|
8
8
|
*/
|
|
9
|
-
export declare function generateMutationsBarrel(tables:
|
|
9
|
+
export declare function generateMutationsBarrel(tables: Table[]): string;
|
|
10
10
|
/**
|
|
11
11
|
* Generate the main index.ts barrel file
|
|
12
12
|
*
|
|
@@ -22,7 +22,7 @@ export interface MainBarrelOptions {
|
|
|
22
22
|
/** Whether invalidation.ts was generated */
|
|
23
23
|
hasInvalidation?: boolean;
|
|
24
24
|
}
|
|
25
|
-
export declare function generateMainBarrel(tables:
|
|
25
|
+
export declare function generateMainBarrel(tables: Table[], options?: MainBarrelOptions): string;
|
|
26
26
|
export interface RootBarrelOptions {
|
|
27
27
|
hasTypes?: boolean;
|
|
28
28
|
hasHooks?: boolean;
|
|
@@ -37,8 +37,8 @@ export declare function generateRootBarrel(options?: RootBarrelOptions): string;
|
|
|
37
37
|
/**
|
|
38
38
|
* Generate queries barrel including custom query operations
|
|
39
39
|
*/
|
|
40
|
-
export declare function generateCustomQueriesBarrel(tables:
|
|
40
|
+
export declare function generateCustomQueriesBarrel(tables: Table[], customQueryNames: string[]): string;
|
|
41
41
|
/**
|
|
42
42
|
* Generate mutations barrel including custom mutation operations
|
|
43
43
|
*/
|
|
44
|
-
export declare function generateCustomMutationsBarrel(tables:
|
|
44
|
+
export declare function generateCustomMutationsBarrel(tables: Table[], customMutationNames: string[]): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import * as t from '@babel/types';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function buildQuestionObject(arg:
|
|
4
|
-
export declare function buildQuestionsArray(args:
|
|
2
|
+
import type { Argument } from '../../../types/schema';
|
|
3
|
+
export declare function buildQuestionObject(arg: Argument, namePrefix?: string): t.ObjectExpression;
|
|
4
|
+
export declare function buildQuestionsArray(args: Argument[]): t.ArrayExpression;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Table, Operation } from '../../../types/schema';
|
|
2
2
|
import type { GeneratedFile } from './executor-generator';
|
|
3
|
-
export declare function generateCommandMap(tables:
|
|
3
|
+
export declare function generateCommandMap(tables: Table[], customOperations: Operation[], toolName: string): GeneratedFile;
|
|
4
4
|
export interface MultiTargetCommandMapInput {
|
|
5
5
|
toolName: string;
|
|
6
6
|
builtinNames: {
|
|
@@ -10,8 +10,8 @@ export interface MultiTargetCommandMapInput {
|
|
|
10
10
|
};
|
|
11
11
|
targets: Array<{
|
|
12
12
|
name: string;
|
|
13
|
-
tables:
|
|
14
|
-
customOperations:
|
|
13
|
+
tables: Table[];
|
|
14
|
+
customOperations: Operation[];
|
|
15
15
|
}>;
|
|
16
16
|
}
|
|
17
17
|
export declare function generateMultiTargetCommandMap(input: MultiTargetCommandMapInput): GeneratedFile;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Operation } from '../../../types/schema';
|
|
2
2
|
import type { GeneratedFile } from './executor-generator';
|
|
3
3
|
export interface CustomCommandOptions {
|
|
4
4
|
targetName?: string;
|
|
5
5
|
executorImportPath?: string;
|
|
6
6
|
saveToken?: boolean;
|
|
7
7
|
}
|
|
8
|
-
export declare function generateCustomCommand(op:
|
|
8
|
+
export declare function generateCustomCommand(op: Operation, options?: CustomCommandOptions): GeneratedFile;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Table, Operation, TypeRegistry } from '../../../types/schema';
|
|
2
2
|
import type { GeneratedDocFile, McpTool } from '../docs-utils';
|
|
3
3
|
export { resolveDocsConfig } from '../docs-utils';
|
|
4
4
|
export type { GeneratedDocFile, McpTool } from '../docs-utils';
|
|
5
|
-
export declare function generateReadme(tables:
|
|
6
|
-
export declare function generateAgentsDocs(tables:
|
|
7
|
-
export declare function getCliMcpTools(tables:
|
|
8
|
-
export declare function generateSkills(tables:
|
|
5
|
+
export declare function generateReadme(tables: Table[], customOperations: Operation[], toolName: string, registry?: TypeRegistry): GeneratedDocFile;
|
|
6
|
+
export declare function generateAgentsDocs(tables: Table[], customOperations: Operation[], toolName: string, _registry?: TypeRegistry): GeneratedDocFile;
|
|
7
|
+
export declare function getCliMcpTools(tables: Table[], customOperations: Operation[], toolName: string, registry?: TypeRegistry): McpTool[];
|
|
8
|
+
export declare function generateSkills(tables: Table[], customOperations: Operation[], toolName: string, targetName: string, registry?: TypeRegistry): GeneratedDocFile[];
|
|
9
9
|
export interface MultiTargetDocsInput {
|
|
10
10
|
toolName: string;
|
|
11
11
|
builtinNames: {
|
|
@@ -17,8 +17,8 @@ export interface MultiTargetDocsInput {
|
|
|
17
17
|
targets: Array<{
|
|
18
18
|
name: string;
|
|
19
19
|
endpoint: string;
|
|
20
|
-
tables:
|
|
21
|
-
customOperations:
|
|
20
|
+
tables: Table[];
|
|
21
|
+
customOperations: Operation[];
|
|
22
22
|
isAuthTarget?: boolean;
|
|
23
23
|
}>;
|
|
24
24
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { BuiltinNames, GraphQLSDKConfigTarget } from '../../../types/config';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Operation, Table, TypeRegistry } from '../../../types/schema';
|
|
3
3
|
import type { GeneratedFile } from './executor-generator';
|
|
4
4
|
export interface GenerateCliOptions {
|
|
5
|
-
tables:
|
|
5
|
+
tables: Table[];
|
|
6
6
|
customOperations?: {
|
|
7
|
-
queries:
|
|
8
|
-
mutations:
|
|
7
|
+
queries: Operation[];
|
|
8
|
+
mutations: Operation[];
|
|
9
9
|
};
|
|
10
10
|
config: GraphQLSDKConfigTarget;
|
|
11
11
|
/** TypeRegistry from introspection, used to check field defaults */
|
|
@@ -26,10 +26,10 @@ export interface MultiTargetCliTarget {
|
|
|
26
26
|
name: string;
|
|
27
27
|
endpoint: string;
|
|
28
28
|
ormImportPath: string;
|
|
29
|
-
tables:
|
|
29
|
+
tables: Table[];
|
|
30
30
|
customOperations: {
|
|
31
|
-
queries:
|
|
32
|
-
mutations:
|
|
31
|
+
queries: Operation[];
|
|
32
|
+
mutations: Operation[];
|
|
33
33
|
};
|
|
34
34
|
isAuthTarget?: boolean;
|
|
35
35
|
/** TypeRegistry from introspection, used to check field defaults */
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Table, TypeRegistry } from '../../../types/schema';
|
|
2
2
|
import type { GeneratedFile } from './executor-generator';
|
|
3
|
-
export declare function getFieldsWithDefaults(table:
|
|
3
|
+
export declare function getFieldsWithDefaults(table: Table, typeRegistry?: TypeRegistry): Set<string>;
|
|
4
4
|
export interface TableCommandOptions {
|
|
5
5
|
targetName?: string;
|
|
6
6
|
executorImportPath?: string;
|
|
7
7
|
/** TypeRegistry from introspection, used to check field defaults */
|
|
8
8
|
typeRegistry?: TypeRegistry;
|
|
9
9
|
}
|
|
10
|
-
export declare function generateTableCommand(table:
|
|
10
|
+
export declare function generateTableCommand(table: Table, options?: TableCommandOptions): GeneratedFile;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Operation, TypeRegistry } from '../../types/schema';
|
|
2
2
|
export interface GeneratedCustomMutationFile {
|
|
3
3
|
fileName: string;
|
|
4
4
|
content: string;
|
|
5
5
|
operationName: string;
|
|
6
6
|
}
|
|
7
7
|
export interface GenerateCustomMutationHookOptions {
|
|
8
|
-
operation:
|
|
8
|
+
operation: Operation;
|
|
9
9
|
typeRegistry: TypeRegistry;
|
|
10
10
|
skipQueryField?: boolean;
|
|
11
11
|
reactQueryEnabled?: boolean;
|
|
@@ -14,7 +14,7 @@ export interface GenerateCustomMutationHookOptions {
|
|
|
14
14
|
}
|
|
15
15
|
export declare function generateCustomMutationHook(options: GenerateCustomMutationHookOptions): GeneratedCustomMutationFile | null;
|
|
16
16
|
export interface GenerateAllCustomMutationHooksOptions {
|
|
17
|
-
operations:
|
|
17
|
+
operations: Operation[];
|
|
18
18
|
typeRegistry: TypeRegistry;
|
|
19
19
|
skipQueryField?: boolean;
|
|
20
20
|
reactQueryEnabled?: boolean;
|
|
@@ -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;
|
|
@@ -282,7 +282,7 @@ function getScalarTypeName(typeRef) {
|
|
|
282
282
|
*/
|
|
283
283
|
/**
|
|
284
284
|
* Resolve inputFields for an INPUT_OBJECT type.
|
|
285
|
-
* Checks the
|
|
285
|
+
* Checks the TypeRef first, then falls back to the TypeRegistry.
|
|
286
286
|
*/
|
|
287
287
|
function resolveInputFields(typeRef, registry) {
|
|
288
288
|
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[];
|
package/core/codegen/index.d.ts
CHANGED
|
@@ -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;
|
|
@@ -394,7 +394,7 @@ function generateCustomMutationOpsFile(operations, comments = true) {
|
|
|
394
394
|
};
|
|
395
395
|
}
|
|
396
396
|
/**
|
|
397
|
-
* Format a
|
|
397
|
+
* Format a TypeRef to GraphQL type string
|
|
398
398
|
*/
|
|
399
399
|
function formatGraphQLType(typeRef) {
|
|
400
400
|
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;
|