@gqlkit-ts/cli 0.1.0 → 0.2.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/dist/auto-type-generator/auto-type-generator.d.ts +19 -3
- package/dist/auto-type-generator/auto-type-generator.d.ts.map +1 -1
- package/dist/auto-type-generator/auto-type-generator.js +236 -49
- package/dist/auto-type-generator/auto-type-generator.js.map +1 -1
- package/dist/auto-type-generator/index.d.ts +1 -1
- package/dist/auto-type-generator/index.d.ts.map +1 -1
- package/dist/auto-type-generator/index.js.map +1 -1
- package/dist/auto-type-generator/inline-enum-collector.d.ts +31 -0
- package/dist/auto-type-generator/inline-enum-collector.d.ts.map +1 -0
- package/dist/auto-type-generator/inline-enum-collector.js +157 -0
- package/dist/auto-type-generator/inline-enum-collector.js.map +1 -0
- package/dist/auto-type-generator/naming-convention.d.ts +4 -0
- package/dist/auto-type-generator/naming-convention.d.ts.map +1 -1
- package/dist/auto-type-generator/naming-convention.js +8 -0
- package/dist/auto-type-generator/naming-convention.js.map +1 -1
- package/dist/gen-orchestrator/orchestrator.d.ts.map +1 -1
- package/dist/gen-orchestrator/orchestrator.js +106 -8
- package/dist/gen-orchestrator/orchestrator.js.map +1 -1
- package/dist/resolver-extractor/extract-resolvers.d.ts +10 -1
- package/dist/resolver-extractor/extract-resolvers.d.ts.map +1 -1
- package/dist/resolver-extractor/extractor/define-api-extractor.d.ts +11 -1
- package/dist/resolver-extractor/extractor/define-api-extractor.d.ts.map +1 -1
- package/dist/resolver-extractor/extractor/define-api-extractor.js +88 -264
- package/dist/resolver-extractor/extractor/define-api-extractor.js.map +1 -1
- package/dist/schema-generator/emitter/code-emitter.d.ts +10 -2
- package/dist/schema-generator/emitter/code-emitter.d.ts.map +1 -1
- package/dist/schema-generator/emitter/code-emitter.js +19 -4
- package/dist/schema-generator/emitter/code-emitter.js.map +1 -1
- package/dist/schema-generator/generate-schema.d.ts.map +1 -1
- package/dist/schema-generator/generate-schema.js +18 -1
- package/dist/schema-generator/generate-schema.js.map +1 -1
- package/dist/schema-generator/integrator/result-integrator.d.ts +20 -0
- package/dist/schema-generator/integrator/result-integrator.d.ts.map +1 -1
- package/dist/schema-generator/integrator/result-integrator.js +42 -0
- package/dist/schema-generator/integrator/result-integrator.js.map +1 -1
- package/dist/shared/constants.d.ts +0 -16
- package/dist/shared/constants.d.ts.map +1 -1
- package/dist/shared/constants.js +0 -19
- package/dist/shared/constants.js.map +1 -1
- package/dist/shared/directive-detector.d.ts.map +1 -1
- package/dist/shared/directive-detector.js +8 -15
- package/dist/shared/directive-detector.js.map +1 -1
- package/dist/shared/file-scanner.d.ts.map +1 -1
- package/dist/shared/file-scanner.js +5 -3
- package/dist/shared/file-scanner.js.map +1 -1
- package/dist/shared/index.d.ts +1 -1
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/index.js +1 -3
- package/dist/shared/index.js.map +1 -1
- package/dist/shared/interface-detector.d.ts +3 -2
- package/dist/shared/interface-detector.d.ts.map +1 -1
- package/dist/shared/interface-detector.js +54 -11
- package/dist/shared/interface-detector.js.map +1 -1
- package/dist/shared/path-utils.d.ts +2 -0
- package/dist/shared/path-utils.d.ts.map +1 -0
- package/dist/shared/path-utils.js +4 -0
- package/dist/shared/path-utils.js.map +1 -0
- package/dist/shared/type-converter.d.ts.map +1 -1
- package/dist/shared/type-converter.js +11 -0
- package/dist/shared/type-converter.js.map +1 -1
- package/dist/shared/typescript-utils.d.ts +34 -7
- package/dist/shared/typescript-utils.d.ts.map +1 -1
- package/dist/shared/typescript-utils.js +72 -24
- package/dist/shared/typescript-utils.js.map +1 -1
- package/dist/type-extractor/collector/scalar-collector.d.ts.map +1 -1
- package/dist/type-extractor/collector/scalar-collector.js +4 -14
- package/dist/type-extractor/collector/scalar-collector.js.map +1 -1
- package/dist/type-extractor/converter/graphql-converter.d.ts.map +1 -1
- package/dist/type-extractor/converter/graphql-converter.js +42 -3
- package/dist/type-extractor/converter/graphql-converter.js.map +1 -1
- package/dist/type-extractor/extractor/field-type-resolver.d.ts +28 -0
- package/dist/type-extractor/extractor/field-type-resolver.d.ts.map +1 -0
- package/dist/type-extractor/extractor/field-type-resolver.js +394 -0
- package/dist/type-extractor/extractor/field-type-resolver.js.map +1 -0
- package/dist/type-extractor/extractor/type-extractor.d.ts +12 -3
- package/dist/type-extractor/extractor/type-extractor.d.ts.map +1 -1
- package/dist/type-extractor/extractor/type-extractor.js +176 -210
- package/dist/type-extractor/extractor/type-extractor.js.map +1 -1
- package/dist/type-extractor/extractor/type-name-collector.d.ts +24 -0
- package/dist/type-extractor/extractor/type-name-collector.d.ts.map +1 -0
- package/dist/type-extractor/extractor/type-name-collector.js +102 -0
- package/dist/type-extractor/extractor/type-name-collector.js.map +1 -0
- package/dist/type-extractor/mapper/scalar-base-type-mapper.d.ts +89 -0
- package/dist/type-extractor/mapper/scalar-base-type-mapper.d.ts.map +1 -0
- package/dist/type-extractor/mapper/scalar-base-type-mapper.js +158 -0
- package/dist/type-extractor/mapper/scalar-base-type-mapper.js.map +1 -0
- package/dist/type-extractor/types/diagnostics.d.ts +1 -1
- package/dist/type-extractor/types/diagnostics.d.ts.map +1 -1
- package/dist/type-extractor/types/graphql.d.ts +2 -0
- package/dist/type-extractor/types/graphql.d.ts.map +1 -1
- package/dist/type-extractor/types/index.d.ts +2 -1
- package/dist/type-extractor/types/index.d.ts.map +1 -1
- package/dist/type-extractor/types/index.js +1 -1
- package/dist/type-extractor/types/index.js.map +1 -1
- package/dist/type-extractor/types/ts-type-reference-factory.d.ts +39 -0
- package/dist/type-extractor/types/ts-type-reference-factory.d.ts.map +1 -0
- package/dist/type-extractor/types/ts-type-reference-factory.js +69 -0
- package/dist/type-extractor/types/ts-type-reference-factory.js.map +1 -0
- package/dist/type-extractor/types/typescript.d.ts +21 -1
- package/dist/type-extractor/types/typescript.d.ts.map +1 -1
- package/dist/type-extractor/validator/type-validator.js +1 -1
- package/dist/type-extractor/validator/type-validator.js.map +1 -1
- package/docs/index.md +1 -0
- package/docs/integration/drizzle.md +191 -0
- package/docs/schema/enums.md +208 -0
- package/docs/schema/fields.md +2 -0
- package/docs/schema/inputs.md +2 -0
- package/docs/schema/objects.md +2 -0
- package/docs/schema/queries-mutations.md +2 -0
- package/package.json +10 -3
- package/src/auto-type-generator/auto-type-generator.ts +925 -0
- package/src/auto-type-generator/index.ts +21 -0
- package/src/auto-type-generator/inline-enum-collector.ts +290 -0
- package/src/auto-type-generator/name-collision-validator.ts +119 -0
- package/src/auto-type-generator/naming-convention.ts +126 -0
- package/src/cli.ts +11 -0
- package/src/commands/gen.ts +141 -0
- package/src/commands/main.ts +5 -0
- package/src/config/define-config.ts +28 -0
- package/src/config/index.ts +7 -0
- package/src/config/types.ts +144 -0
- package/src/config-loader/index.ts +14 -0
- package/src/config-loader/loader.ts +143 -0
- package/src/config-loader/validator.ts +672 -0
- package/src/gen-orchestrator/hook-executor/hook-executor.ts +117 -0
- package/src/gen-orchestrator/orchestrator.ts +784 -0
- package/src/gen-orchestrator/reporter/diagnostic-reporter.ts +44 -0
- package/src/gen-orchestrator/reporter/progress-reporter.ts +61 -0
- package/src/gen-orchestrator/writer/file-writer.ts +38 -0
- package/src/index.ts +2 -0
- package/src/resolver-extractor/extract-resolvers.ts +63 -0
- package/src/resolver-extractor/extractor/define-api-extractor.ts +806 -0
- package/src/resolver-extractor/index.ts +19 -0
- package/src/resolver-extractor/validator/abstract-resolver-validator.ts +251 -0
- package/src/resolver-extractor/validator/only-validator.ts +158 -0
- package/src/schema-generator/builder/ast-builder.ts +706 -0
- package/src/schema-generator/emitter/code-emitter.ts +351 -0
- package/src/schema-generator/emitter/sdl-emitter.ts +13 -0
- package/src/schema-generator/generate-schema.ts +170 -0
- package/src/schema-generator/index.ts +19 -0
- package/src/schema-generator/integrator/result-integrator.ts +690 -0
- package/src/schema-generator/pruner/schema-pruner.ts +112 -0
- package/src/schema-generator/resolver-collector/resolver-collector.ts +123 -0
- package/src/shared/constants.ts +122 -0
- package/src/shared/default-value-detector.ts +172 -0
- package/src/shared/diagnostics.ts +35 -0
- package/src/shared/directive-definition-extractor.ts +564 -0
- package/src/shared/directive-detector.ts +556 -0
- package/src/shared/file-scanner.ts +170 -0
- package/src/shared/index.ts +32 -0
- package/src/shared/inline-object-extractor.ts +102 -0
- package/src/shared/inline-object-utils.ts +23 -0
- package/src/shared/interface-detector.ts +176 -0
- package/src/shared/interface-validator.ts +211 -0
- package/src/shared/metadata-detector.ts +443 -0
- package/src/shared/path-utils.ts +3 -0
- package/src/shared/program-factory.ts +51 -0
- package/src/shared/source-location.ts +27 -0
- package/src/shared/tsconfig-loader.ts +126 -0
- package/src/shared/tsdoc-parser.ts +155 -0
- package/src/shared/type-converter.ts +99 -0
- package/src/shared/typescript-utils.ts +246 -0
- package/src/type-extractor/collector/result-collector.ts +57 -0
- package/src/type-extractor/collector/scalar-collector.ts +254 -0
- package/src/type-extractor/converter/field-eligibility.ts +112 -0
- package/src/type-extractor/converter/graphql-converter.ts +459 -0
- package/src/type-extractor/extract-types.ts +1 -0
- package/src/type-extractor/extractor/field-type-resolver.ts +569 -0
- package/src/type-extractor/extractor/type-extractor.ts +1567 -0
- package/src/type-extractor/extractor/type-name-collector.ts +130 -0
- package/src/type-extractor/index.ts +20 -0
- package/src/type-extractor/mapper/scalar-base-type-mapper.ts +265 -0
- package/src/type-extractor/types/diagnostics.ts +99 -0
- package/src/type-extractor/types/graphql.ts +55 -0
- package/src/type-extractor/types/index.ts +37 -0
- package/src/type-extractor/types/ts-type-reference-factory.ts +137 -0
- package/src/type-extractor/types/typescript.ts +133 -0
- package/src/type-extractor/validator/type-validator.ts +77 -0
- package/dist/auto-type-generator/auto-type-generator.test.d.ts +0 -2
- package/dist/auto-type-generator/auto-type-generator.test.d.ts.map +0 -1
- package/dist/auto-type-generator/auto-type-generator.test.js +0 -613
- package/dist/auto-type-generator/auto-type-generator.test.js.map +0 -1
- package/dist/auto-type-generator/name-collision-validator.test.d.ts +0 -2
- package/dist/auto-type-generator/name-collision-validator.test.d.ts.map +0 -1
- package/dist/auto-type-generator/name-collision-validator.test.js +0 -358
- package/dist/auto-type-generator/name-collision-validator.test.js.map +0 -1
- package/dist/auto-type-generator/naming-convention.test.d.ts +0 -2
- package/dist/auto-type-generator/naming-convention.test.d.ts.map +0 -1
- package/dist/auto-type-generator/naming-convention.test.js +0 -132
- package/dist/auto-type-generator/naming-convention.test.js.map +0 -1
- package/dist/commands/gen.test.d.ts +0 -2
- package/dist/commands/gen.test.d.ts.map +0 -1
- package/dist/commands/gen.test.js +0 -226
- package/dist/commands/gen.test.js.map +0 -1
- package/dist/config-loader/loader.test.d.ts +0 -2
- package/dist/config-loader/loader.test.d.ts.map +0 -1
- package/dist/config-loader/loader.test.js +0 -123
- package/dist/config-loader/loader.test.js.map +0 -1
- package/dist/config-loader/validator.test.d.ts +0 -2
- package/dist/config-loader/validator.test.d.ts.map +0 -1
- package/dist/config-loader/validator.test.js +0 -846
- package/dist/config-loader/validator.test.js.map +0 -1
- package/dist/gen-orchestrator/golden.test.d.ts +0 -2
- package/dist/gen-orchestrator/golden.test.d.ts.map +0 -1
- package/dist/gen-orchestrator/golden.test.js +0 -102
- package/dist/gen-orchestrator/golden.test.js.map +0 -1
- package/dist/gen-orchestrator/hook-executor/hook-executor.test.d.ts +0 -2
- package/dist/gen-orchestrator/hook-executor/hook-executor.test.d.ts.map +0 -1
- package/dist/gen-orchestrator/hook-executor/hook-executor.test.js +0 -167
- package/dist/gen-orchestrator/hook-executor/hook-executor.test.js.map +0 -1
- package/dist/gen-orchestrator/reporter/progress-reporter.test.d.ts +0 -2
- package/dist/gen-orchestrator/reporter/progress-reporter.test.d.ts.map +0 -1
- package/dist/gen-orchestrator/reporter/progress-reporter.test.js +0 -74
- package/dist/gen-orchestrator/reporter/progress-reporter.test.js.map +0 -1
- package/dist/resolver-extractor/validator/only-validator.test.d.ts +0 -8
- package/dist/resolver-extractor/validator/only-validator.test.d.ts.map +0 -1
- package/dist/resolver-extractor/validator/only-validator.test.js +0 -352
- package/dist/resolver-extractor/validator/only-validator.test.js.map +0 -1
- package/dist/schema-generator/builder/ast-builder.test.d.ts +0 -2
- package/dist/schema-generator/builder/ast-builder.test.d.ts.map +0 -1
- package/dist/schema-generator/builder/ast-builder.test.js +0 -469
- package/dist/schema-generator/builder/ast-builder.test.js.map +0 -1
- package/dist/shared/file-scanner.test.d.ts +0 -2
- package/dist/shared/file-scanner.test.d.ts.map +0 -1
- package/dist/shared/file-scanner.test.js +0 -138
- package/dist/shared/file-scanner.test.js.map +0 -1
- package/dist/shared/interface-validator.test.d.ts +0 -2
- package/dist/shared/interface-validator.test.d.ts.map +0 -1
- package/dist/shared/interface-validator.test.js +0 -145
- package/dist/shared/interface-validator.test.js.map +0 -1
- package/dist/type-extractor/types/typescript.test.d.ts +0 -2
- package/dist/type-extractor/types/typescript.test.d.ts.map +0 -1
- package/dist/type-extractor/types/typescript.test.js +0 -287
- package/dist/type-extractor/types/typescript.test.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/type-extractor/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,YAAY,EACV,UAAU,EACV,cAAc,EACd,WAAW,EACX,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,eAAe,GAChB,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,QAAQ,EACR,YAAY,GACb,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/type-extractor/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,YAAY,EACV,UAAU,EACV,cAAc,EACd,WAAW,EACX,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,eAAe,GAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,GAChB,MAAM,gCAAgC,CAAC;AACxC,YAAY,EACV,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,QAAQ,EACR,YAAY,GACb,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export { createArrayType, createInlineObjectType, createLiteralType, createPrimitiveType, createReferenceType, createScalarType, createUnionType, } from "./ts-type-reference-factory.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/type-extractor/types/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/type-extractor/types/index.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,GAChB,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type ts from "typescript";
|
|
2
|
+
import type { InlineEnumMemberInfo, InlineObjectPropertyDef, ScalarTypeInfo, TSTypeReference } from "./typescript.js";
|
|
3
|
+
interface CreateReferenceTypeParams {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly nullable: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare function createReferenceType(params: CreateReferenceTypeParams): TSTypeReference;
|
|
8
|
+
interface CreatePrimitiveTypeParams {
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly nullable: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function createPrimitiveType(params: CreatePrimitiveTypeParams): TSTypeReference;
|
|
13
|
+
export declare function createArrayType(elementType: TSTypeReference): TSTypeReference;
|
|
14
|
+
interface CreateUnionTypeParams {
|
|
15
|
+
readonly members: ReadonlyArray<TSTypeReference>;
|
|
16
|
+
readonly nullable: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function createUnionType(params: CreateUnionTypeParams): TSTypeReference;
|
|
19
|
+
export declare function createInlineObjectType(properties: ReadonlyArray<InlineObjectPropertyDef>): TSTypeReference;
|
|
20
|
+
interface CreateScalarTypeParams {
|
|
21
|
+
readonly name: string;
|
|
22
|
+
readonly scalarInfo: ScalarTypeInfo;
|
|
23
|
+
readonly nullable: boolean;
|
|
24
|
+
}
|
|
25
|
+
export declare function createScalarType(params: CreateScalarTypeParams): TSTypeReference;
|
|
26
|
+
export declare function createLiteralType(name: string): TSTypeReference;
|
|
27
|
+
interface CreateInlineEnumTypeParams {
|
|
28
|
+
readonly members: ReadonlyArray<InlineEnumMemberInfo>;
|
|
29
|
+
readonly nullable: boolean;
|
|
30
|
+
/** External TypeScript enum symbol for deduplication (null for string literal unions) */
|
|
31
|
+
readonly externalEnumSymbol: ts.Symbol | null;
|
|
32
|
+
/** TSDoc description from the external enum type itself (null for string literal unions) */
|
|
33
|
+
readonly externalEnumDescription: string | null;
|
|
34
|
+
/** @deprecated tag from the external enum type itself (null for string literal unions) */
|
|
35
|
+
readonly externalEnumDeprecated: import("../../shared/tsdoc-parser.js").DeprecationInfo | null;
|
|
36
|
+
}
|
|
37
|
+
export declare function createInlineEnumType(params: CreateInlineEnumTypeParams): TSTypeReference;
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=ts-type-reference-factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ts-type-reference-factory.d.ts","sourceRoot":"","sources":["../../../src/type-extractor/types/ts-type-reference-factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,KAAK,EACV,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,eAAe,EAChB,MAAM,iBAAiB,CAAC;AA0BzB,UAAU,yBAAyB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,yBAAyB,GAChC,eAAe,CAKjB;AAED,UAAU,yBAAyB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,yBAAyB,GAChC,eAAe,CAKjB;AAED,wBAAgB,eAAe,CAAC,WAAW,EAAE,eAAe,GAAG,eAAe,CAE7E;AAED,UAAU,qBAAqB;IAC7B,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IACjD,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,qBAAqB,GAC5B,eAAe,CAKjB;AAED,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,aAAa,CAAC,uBAAuB,CAAC,GACjD,eAAe,CAKjB;AAED,UAAU,sBAAsB;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,sBAAsB,GAC7B,eAAe,CASjB;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAE/D;AAED,UAAU,0BAA0B;IAClC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;IACtD,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,yFAAyF;IACzF,QAAQ,CAAC,kBAAkB,EAAE,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC;IAC9C,4FAA4F;IAC5F,QAAQ,CAAC,uBAAuB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChD,0FAA0F;IAC1F,QAAQ,CAAC,sBAAsB,EAC3B,OAAO,8BAA8B,EAAE,eAAe,GACtD,IAAI,CAAC;CACV;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,0BAA0B,GACjC,eAAe,CAWjB"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
function createTSTypeReference(params) {
|
|
2
|
+
return {
|
|
3
|
+
kind: params.kind,
|
|
4
|
+
name: null,
|
|
5
|
+
elementType: null,
|
|
6
|
+
members: null,
|
|
7
|
+
nullable: false,
|
|
8
|
+
scalarInfo: null,
|
|
9
|
+
inlineObjectProperties: null,
|
|
10
|
+
inlineEnumMembers: null,
|
|
11
|
+
externalEnumSymbol: null,
|
|
12
|
+
externalEnumDescription: null,
|
|
13
|
+
externalEnumDeprecated: null,
|
|
14
|
+
...params.overrides,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export function createReferenceType(params) {
|
|
18
|
+
return createTSTypeReference({
|
|
19
|
+
kind: "reference",
|
|
20
|
+
overrides: { name: params.name, nullable: params.nullable },
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export function createPrimitiveType(params) {
|
|
24
|
+
return createTSTypeReference({
|
|
25
|
+
kind: "primitive",
|
|
26
|
+
overrides: { name: params.name, nullable: params.nullable },
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
export function createArrayType(elementType) {
|
|
30
|
+
return createTSTypeReference({ kind: "array", overrides: { elementType } });
|
|
31
|
+
}
|
|
32
|
+
export function createUnionType(params) {
|
|
33
|
+
return createTSTypeReference({
|
|
34
|
+
kind: "union",
|
|
35
|
+
overrides: { members: params.members, nullable: params.nullable },
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
export function createInlineObjectType(properties) {
|
|
39
|
+
return createTSTypeReference({
|
|
40
|
+
kind: "inlineObject",
|
|
41
|
+
overrides: { inlineObjectProperties: properties },
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
export function createScalarType(params) {
|
|
45
|
+
return createTSTypeReference({
|
|
46
|
+
kind: "scalar",
|
|
47
|
+
overrides: {
|
|
48
|
+
name: params.name,
|
|
49
|
+
scalarInfo: params.scalarInfo,
|
|
50
|
+
nullable: params.nullable,
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
export function createLiteralType(name) {
|
|
55
|
+
return createTSTypeReference({ kind: "literal", overrides: { name } });
|
|
56
|
+
}
|
|
57
|
+
export function createInlineEnumType(params) {
|
|
58
|
+
return createTSTypeReference({
|
|
59
|
+
kind: "inlineEnum",
|
|
60
|
+
overrides: {
|
|
61
|
+
inlineEnumMembers: params.members,
|
|
62
|
+
nullable: params.nullable,
|
|
63
|
+
externalEnumSymbol: params.externalEnumSymbol,
|
|
64
|
+
externalEnumDescription: params.externalEnumDescription,
|
|
65
|
+
externalEnumDeprecated: params.externalEnumDeprecated,
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=ts-type-reference-factory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ts-type-reference-factory.js","sourceRoot":"","sources":["../../../src/type-extractor/types/ts-type-reference-factory.ts"],"names":[],"mappings":"AAaA,SAAS,qBAAqB,CAC5B,MAAmC;IAEnC,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,IAAI,EAAE,IAAI;QACV,WAAW,EAAE,I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C,CAAC;AACL,CAAC;AAQD,MAAM,UAAU,gBAAgB,CAC9B,MAA8B;IAE9B,OAAO,qBAAqB,CAAC;QAC3B,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE;YACT,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,QAAQ,EAAE,MAAM,CAAC,QAAQ;SAC1B;KACF,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,OAAO,qBAAqB,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;AACzE,CAAC;AAeD,MAAM,UAAU,oBAAoB,CAClC,MAAkC;IAElC,OAAO,qBAAqB,CAAC;QAC3B,IAAI,EAAE,YAAY;QAClB,SAAS,EAAE;YACT,iBAAiB,EAAE,MAAM,CAAC,OAAO;YACjC,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,kBAAkB,EAAE,MAAM,CAAC,kBAAkB;YAC7C,uBAAuB,EAAE,MAAM,CAAC,uBAAuB;YACvD,sBAAsB,EAAE,MAAM,CAAC,sBAAsB;SACtD;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type ts from "typescript";
|
|
1
2
|
import type { DirectiveArgumentValue, DirectiveInfo } from "../../shared/directive-detector.js";
|
|
2
3
|
import type { DeprecationInfo } from "../../shared/tsdoc-parser.js";
|
|
3
4
|
import type { SourceLocation } from "./diagnostics.js";
|
|
@@ -27,7 +28,18 @@ export interface TypeMetadata {
|
|
|
27
28
|
readonly deprecated: DeprecationInfo | null;
|
|
28
29
|
readonly directives: ReadonlyArray<DirectiveInfo> | null;
|
|
29
30
|
}
|
|
30
|
-
export type TSTypeReferenceKind = "primitive" | "reference" | "array" | "union" | "literal" | "scalar" | "inlineObject";
|
|
31
|
+
export type TSTypeReferenceKind = "primitive" | "reference" | "array" | "union" | "literal" | "scalar" | "inlineObject" | "inlineEnum";
|
|
32
|
+
/**
|
|
33
|
+
* Information about an inline enum member (string literal union value).
|
|
34
|
+
*/
|
|
35
|
+
export interface InlineEnumMemberInfo {
|
|
36
|
+
/** Original value from TypeScript (e.g., "pendingReview") */
|
|
37
|
+
readonly value: string;
|
|
38
|
+
/** Description from TSDoc (if available) */
|
|
39
|
+
readonly description: string | null;
|
|
40
|
+
/** Deprecation info from @deprecated tag */
|
|
41
|
+
readonly deprecated: DeprecationInfo | null;
|
|
42
|
+
}
|
|
31
43
|
export interface TSTypeReference {
|
|
32
44
|
readonly kind: TSTypeReferenceKind;
|
|
33
45
|
readonly name: string | null;
|
|
@@ -36,6 +48,14 @@ export interface TSTypeReference {
|
|
|
36
48
|
readonly nullable: boolean;
|
|
37
49
|
readonly scalarInfo: ScalarTypeInfo | null;
|
|
38
50
|
readonly inlineObjectProperties: ReadonlyArray<InlineObjectPropertyDef> | null;
|
|
51
|
+
/** Inline enum members when kind is "inlineEnum" */
|
|
52
|
+
readonly inlineEnumMembers: ReadonlyArray<InlineEnumMemberInfo> | null;
|
|
53
|
+
/** External TypeScript enum symbol for deduplication (Requirement 5.2) */
|
|
54
|
+
readonly externalEnumSymbol: ts.Symbol | null;
|
|
55
|
+
/** TSDoc description from the external enum type itself (Requirement 6.1) */
|
|
56
|
+
readonly externalEnumDescription: string | null;
|
|
57
|
+
/** @deprecated tag from the external enum type itself (Requirement 6.3) */
|
|
58
|
+
readonly externalEnumDeprecated: DeprecationInfo | null;
|
|
39
59
|
}
|
|
40
60
|
export interface InlineObjectPropertyDef {
|
|
41
61
|
readonly name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../../src/type-extractor/types/typescript.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,aAAa,EACd,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,eAAe,EA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AW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,UAAU,EAAE,eAAe,GAAG,IAAI,CAAC;CAC7C;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,UAAU,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;CAC1D;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IAChD,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IACpD,QAAQ,CAAC,mBAAmB,EAAE,aAAa,CAAC,kBAAkB,CAAC,GAAG,IAAI,CAAC;IACvE,QAAQ,CAAC,WAAW,EAAE,aAAa,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC;IAC3D,QAAQ,CAAC,qBAAqB,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;CAC9D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BUILT_IN_SCALARS } from "../../shared/constants.js";
|
|
2
|
-
const PLACEHOLDER_TYPES = new Set(["__INLINE_OBJECT__"]);
|
|
2
|
+
const PLACEHOLDER_TYPES = new Set(["__INLINE_OBJECT__", "__INLINE_ENUM__"]);
|
|
3
3
|
function isOptionsObject(arg) {
|
|
4
4
|
return !Array.isArray(arg) && "types" in arg;
|
|
5
5
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-validator.js","sourceRoot":"","sources":["../../../src/type-extractor/validator/type-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAY7D,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"type-validator.js","sourceRoot":"","sources":["../../../src/type-extractor/validator/type-validator.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AAC,iBAAiB,CAAC,GAAG,CAAC,QAAQ,CAAC,EAChC,CAAC;oBACD,WAAW,CAAC,IAAI,CAAC;wBACf,IAAI,EAAE,sBAAsB;wBAC5B,OAAO,EAAE,UAAU,KAAK,CAAC,IAAI,iCAAiC,QAAQ,GAAG;wBACzE,QAAQ,EAAE,OAAO;wBACjB,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;qBACxD,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YAC/C,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;gBACvC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;oBACxD,WAAW,CAAC,IAAI,CAAC;wBACf,IAAI,EAAE,sBAAsB;wBAC5B,OAAO,EAAE,UAAU,IAAI,CAAC,IAAI,iCAAiC,MAAM,GAAG;wBACtE,QAAQ,EAAE,OAAO;wBACjB,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;qBACxD,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,KAAK,EAAE,WAAW,CAAC,MAAM,KAAK,CAAC;QAC/B,WAAW;KACZ,CAAC;AACJ,CAAC"}
|
package/docs/index.md
CHANGED
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
|
|
27
27
|
- [graphql-yoga](./integration/yoga.md): [graphql-yoga](https://the-guild.dev/graphql/yoga-server) is a batteries-included GraphQL server that works in any JavaScript runtime.
|
|
28
28
|
- [Apollo Server](./integration/apollo.md): [Apollo Server](https://www.apollographql.com/docs/apollo-server/) is a popular GraphQL server with extensive features and ecosystem.
|
|
29
|
+
- [Drizzle ORM](./integration/drizzle.md): [Drizzle ORM](https://orm.drizzle.team/) is a TypeScript ORM with type-safe schema definitions. gqlkit integrates seamlessly with Drizzle by using `InferSelectModel` and `InferInsertModel` to derive GraphQL types from your table definitions.
|
|
29
30
|
|
|
30
31
|
## Guides
|
|
31
32
|
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# Drizzle ORM
|
|
2
|
+
|
|
3
|
+
[Drizzle ORM](https://orm.drizzle.team/) is a TypeScript ORM with type-safe schema definitions. gqlkit integrates seamlessly with Drizzle by using `InferSelectModel` and `InferInsertModel` to derive GraphQL types from your table definitions.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh filename="npm"
|
|
8
|
+
npm install drizzle-orm postgres
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```sh filename="pnpm"
|
|
12
|
+
pnpm add drizzle-orm postgres
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```sh filename="yarn"
|
|
16
|
+
yarn add drizzle-orm postgres
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Defining Tables
|
|
20
|
+
|
|
21
|
+
Define your database tables with Drizzle:
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
// src/db/schema.ts
|
|
25
|
+
import { pgEnum, pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core";
|
|
26
|
+
|
|
27
|
+
export const userStatusEnum = pgEnum("user_status", [
|
|
28
|
+
"active",
|
|
29
|
+
"inactive",
|
|
30
|
+
"suspended",
|
|
31
|
+
]);
|
|
32
|
+
|
|
33
|
+
export const users = pgTable("users", {
|
|
34
|
+
id: uuid().primaryKey().defaultRandom(),
|
|
35
|
+
name: text().notNull(),
|
|
36
|
+
email: text().notNull().unique(),
|
|
37
|
+
status: userStatusEnum().notNull().default("active"),
|
|
38
|
+
createdAt: timestamp().notNull().defaultNow(),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export const posts = pgTable("posts", {
|
|
42
|
+
id: uuid().primaryKey().defaultRandom(),
|
|
43
|
+
title: text().notNull(),
|
|
44
|
+
content: text(),
|
|
45
|
+
priority: text({ enum: ["low", "medium", "high"] }).notNull().default("medium"),
|
|
46
|
+
authorId: uuid()
|
|
47
|
+
.notNull()
|
|
48
|
+
.references(() => users.id),
|
|
49
|
+
createdAt: timestamp().notNull().defaultNow(),
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Both `pgEnum()` and `text({ enum: [...] })` are supported for defining enum columns. gqlkit automatically generates corresponding GraphQL enum types from these definitions.
|
|
54
|
+
|
|
55
|
+
## Defining Custom Scalars
|
|
56
|
+
|
|
57
|
+
Define custom scalar types using `GqlScalar` for fields like timestamps:
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
// src/gqlkit/schema/scalars.ts
|
|
61
|
+
import type { GqlScalar } from "@gqlkit-ts/runtime";
|
|
62
|
+
|
|
63
|
+
export type DateTime = GqlScalar<"DateTime", Date>;
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Exporting GraphQL Types
|
|
67
|
+
|
|
68
|
+
Use Drizzle's type inference utilities to export GraphQL types from your table definitions:
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
// src/gqlkit/schema/user.ts
|
|
72
|
+
import type { InferSelectModel } from "drizzle-orm";
|
|
73
|
+
import { users as usersTable } from "../../db/schema.js";
|
|
74
|
+
|
|
75
|
+
// Export as GraphQL object type
|
|
76
|
+
export type User = InferSelectModel<typeof usersTable>;
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
This generates the following GraphQL schema:
|
|
80
|
+
|
|
81
|
+
```graphql
|
|
82
|
+
enum UserStatus {
|
|
83
|
+
ACTIVE
|
|
84
|
+
INACTIVE
|
|
85
|
+
SUSPENDED
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
type User {
|
|
89
|
+
id: String!
|
|
90
|
+
name: String!
|
|
91
|
+
email: String!
|
|
92
|
+
status: UserStatus!
|
|
93
|
+
createdAt: DateTime!
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Defining Resolvers
|
|
98
|
+
|
|
99
|
+
Define resolvers that use the derived types:
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
// src/gqlkit/schema/user.ts
|
|
103
|
+
import type { NoArgs } from "@gqlkit-ts/runtime";
|
|
104
|
+
import type { InferInsertModel, InferSelectModel } from "drizzle-orm";
|
|
105
|
+
import { eq } from "drizzle-orm";
|
|
106
|
+
import { posts as postsTable, users as usersTable } from "../../db/schema.js";
|
|
107
|
+
import { defineField, defineMutation, defineQuery } from "../gqlkit.js";
|
|
108
|
+
import type { Post } from "./post.js";
|
|
109
|
+
|
|
110
|
+
export type User = InferSelectModel<typeof usersTable>;
|
|
111
|
+
|
|
112
|
+
export const allUsers = defineQuery<NoArgs, User[]>(
|
|
113
|
+
async (_root, _args, ctx) => {
|
|
114
|
+
return ctx.db.select().from(usersTable);
|
|
115
|
+
},
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
export const user = defineQuery<{ id: string }, User | null>(
|
|
119
|
+
async (_root, args, ctx) => {
|
|
120
|
+
const result = await ctx.db
|
|
121
|
+
.select()
|
|
122
|
+
.from(usersTable)
|
|
123
|
+
.where(eq(usersTable.id, args.id));
|
|
124
|
+
return result[0] ?? null;
|
|
125
|
+
},
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
export const createUser = defineMutation<
|
|
129
|
+
{ input: Omit<InferInsertModel<typeof usersTable>, "id" | "createdAt"> },
|
|
130
|
+
User
|
|
131
|
+
>(async (_root, args, ctx) => {
|
|
132
|
+
const result = await ctx.db.insert(usersTable).values(args.input).returning();
|
|
133
|
+
return result[0]!;
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
export const posts = defineField<User, NoArgs, Post[]>(
|
|
137
|
+
async (parent, _args, ctx) => {
|
|
138
|
+
return ctx.db
|
|
139
|
+
.select()
|
|
140
|
+
.from(postsTable)
|
|
141
|
+
.where(eq(postsTable.authorId, parent.id));
|
|
142
|
+
},
|
|
143
|
+
);
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Context with Database
|
|
147
|
+
|
|
148
|
+
Set up the context type to include your database instance:
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
// src/db/db.ts
|
|
152
|
+
import { drizzle } from "drizzle-orm/postgres-js";
|
|
153
|
+
import postgres from "postgres";
|
|
154
|
+
import * as schema from "./schema.js";
|
|
155
|
+
|
|
156
|
+
const client = postgres(process.env.DATABASE_URL!);
|
|
157
|
+
export const db = drizzle(client, { schema, casing: "snake_case" });
|
|
158
|
+
export type Database = typeof db;
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
```typescript
|
|
162
|
+
// src/gqlkit/context.ts
|
|
163
|
+
import type { Database } from "../db/db.js";
|
|
164
|
+
|
|
165
|
+
export type Context = {
|
|
166
|
+
db: Database;
|
|
167
|
+
};
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
// src/gqlkit/gqlkit.ts
|
|
172
|
+
import { createGqlkitApis } from "@gqlkit-ts/runtime";
|
|
173
|
+
import type { Context } from "./context.js";
|
|
174
|
+
|
|
175
|
+
export const { defineQuery, defineMutation, defineField } =
|
|
176
|
+
createGqlkitApis<Context>();
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Complete Example
|
|
180
|
+
|
|
181
|
+
See the [examples/with-drizzle](https://github.com/gqlkit/gqlkit/tree/main/examples/with-drizzle) directory for a complete working example with:
|
|
182
|
+
|
|
183
|
+
- PostgreSQL tables with DateTime scalar
|
|
184
|
+
- Enum types using both `pgEnum()` and `text({ enum: [...] })`
|
|
185
|
+
- User and Post types with relationships
|
|
186
|
+
- Query, Mutation, and Field resolvers
|
|
187
|
+
|
|
188
|
+
## Further Reading
|
|
189
|
+
|
|
190
|
+
- [Drizzle ORM Documentation](https://orm.drizzle.team/docs/overview)
|
|
191
|
+
- [Drizzle with PostgreSQL](https://orm.drizzle.team/docs/get-started/postgresql-new)
|
package/docs/schema/enums.md
CHANGED
|
@@ -111,6 +111,214 @@ input UpdateUserInput {
|
|
|
111
111
|
}
|
|
112
112
|
```
|
|
113
113
|
|
|
114
|
+
## Inline Enums
|
|
115
|
+
|
|
116
|
+
When you define a string literal union or reference a TypeScript enum **inline** (without exporting it from the schema directory), gqlkit automatically generates a GraphQL enum type. This follows the same pattern as [inline objects](./objects.md#inline-objects).
|
|
117
|
+
|
|
118
|
+
### Inline String Literal Unions
|
|
119
|
+
|
|
120
|
+
String literal unions used directly in field or argument types generate enum types automatically:
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
export type User = {
|
|
124
|
+
id: string;
|
|
125
|
+
name: string;
|
|
126
|
+
/** Current account status */
|
|
127
|
+
status: "active" | "inactive" | "pendingReview";
|
|
128
|
+
};
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Generates:
|
|
132
|
+
|
|
133
|
+
```graphql
|
|
134
|
+
type User {
|
|
135
|
+
id: String!
|
|
136
|
+
name: String!
|
|
137
|
+
"""Current account status"""
|
|
138
|
+
status: UserStatus!
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
enum UserStatus {
|
|
142
|
+
ACTIVE
|
|
143
|
+
INACTIVE
|
|
144
|
+
PENDING_REVIEW
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
The generated enum type name follows the convention `{ParentTypeName}{PascalCaseFieldName}`.
|
|
149
|
+
|
|
150
|
+
### External TypeScript Enums
|
|
151
|
+
|
|
152
|
+
TypeScript enums defined outside the schema directory are also automatically converted:
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
// src/types/order.ts (outside schema directory)
|
|
156
|
+
/**
|
|
157
|
+
* Order status in the system
|
|
158
|
+
*/
|
|
159
|
+
export enum OrderStatus {
|
|
160
|
+
/** Order is pending payment */
|
|
161
|
+
Pending = "pending",
|
|
162
|
+
/** Order is being processed */
|
|
163
|
+
Processing = "processing",
|
|
164
|
+
/** Order has been shipped */
|
|
165
|
+
Shipped = "shipped",
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// src/gqlkit/schema/order.ts
|
|
169
|
+
import { OrderStatus } from "../../types/order.js";
|
|
170
|
+
|
|
171
|
+
export type Order = {
|
|
172
|
+
id: string;
|
|
173
|
+
status: OrderStatus;
|
|
174
|
+
};
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Generates:
|
|
178
|
+
|
|
179
|
+
```graphql
|
|
180
|
+
type Order {
|
|
181
|
+
id: String!
|
|
182
|
+
status: OrderStatus!
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
"""Order status in the system"""
|
|
186
|
+
enum OrderStatus {
|
|
187
|
+
"""Order is pending payment"""
|
|
188
|
+
PENDING
|
|
189
|
+
"""Order is being processed"""
|
|
190
|
+
PROCESSING
|
|
191
|
+
"""Order has been shipped"""
|
|
192
|
+
SHIPPED
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
TSDoc comments on the enum and its values are preserved as GraphQL descriptions. The `@deprecated` tag is also supported.
|
|
197
|
+
|
|
198
|
+
When the same external TypeScript enum is referenced in multiple places, gqlkit generates a single GraphQL enum type and reuses it across all references.
|
|
199
|
+
|
|
200
|
+
### Inline Enum Naming Convention
|
|
201
|
+
|
|
202
|
+
The naming convention for auto-generated enum types matches [inline objects](./objects.md#inline-objects):
|
|
203
|
+
|
|
204
|
+
| Context | Naming Pattern | Example |
|
|
205
|
+
|---------|----------------|---------|
|
|
206
|
+
| Object field | `{ParentTypeName}{PascalCaseFieldName}` | `User.status` → `UserStatus` |
|
|
207
|
+
| Input field | `{ParentTypeNameWithoutInputSuffix}{PascalCaseFieldName}Input` | `CreateUserInput.role` → `CreateUserRoleInput` |
|
|
208
|
+
| Query/Mutation argument | `{PascalCaseFieldName}{PascalCaseArgName}Input` | `searchUsers(status: ...)` → `SearchUsersStatusInput` |
|
|
209
|
+
| Field resolver argument | `{ParentTypeName}{PascalCaseFieldName}{PascalCaseArgName}Input` | `User.posts(filter: ...)` → `UserPostsFilterInput` |
|
|
210
|
+
|
|
211
|
+
### Nullable Inline Enums
|
|
212
|
+
|
|
213
|
+
Nullable inline enums are supported:
|
|
214
|
+
|
|
215
|
+
```typescript
|
|
216
|
+
export type User = {
|
|
217
|
+
id: string;
|
|
218
|
+
status: "active" | "inactive" | null;
|
|
219
|
+
};
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Generates:
|
|
223
|
+
|
|
224
|
+
```graphql
|
|
225
|
+
type User {
|
|
226
|
+
id: String!
|
|
227
|
+
status: UserStatus
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
enum UserStatus {
|
|
231
|
+
ACTIVE
|
|
232
|
+
INACTIVE
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Arrays of Inline Enums
|
|
237
|
+
|
|
238
|
+
Inline enums in array types are also supported:
|
|
239
|
+
|
|
240
|
+
```typescript
|
|
241
|
+
export type User = {
|
|
242
|
+
id: string;
|
|
243
|
+
roles: ("admin" | "editor" | "viewer")[];
|
|
244
|
+
};
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
Generates:
|
|
248
|
+
|
|
249
|
+
```graphql
|
|
250
|
+
type User {
|
|
251
|
+
id: String!
|
|
252
|
+
roles: [UserRoles!]!
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
enum UserRoles {
|
|
256
|
+
ADMIN
|
|
257
|
+
EDITOR
|
|
258
|
+
VIEWER
|
|
259
|
+
}
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### When Enums Are NOT Auto-Generated
|
|
263
|
+
|
|
264
|
+
If you export a type from the schema directory, it is treated as an explicit type declaration and not auto-generated:
|
|
265
|
+
|
|
266
|
+
```typescript
|
|
267
|
+
// Exported from schema - used as-is, not auto-generated
|
|
268
|
+
export type UserStatus = "active" | "inactive" | "pending";
|
|
269
|
+
|
|
270
|
+
export type User = {
|
|
271
|
+
id: string;
|
|
272
|
+
status: UserStatus; // References the exported type
|
|
273
|
+
};
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Automatic Case Conversion
|
|
277
|
+
|
|
278
|
+
gqlkit automatically converts enum values to `SCREAMING_SNAKE_CASE` format, which is the GraphQL convention:
|
|
279
|
+
|
|
280
|
+
```typescript
|
|
281
|
+
export type UserStatus = "active" | "inProgress" | "pending_review" | "on-hold";
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
Generates:
|
|
285
|
+
|
|
286
|
+
```graphql
|
|
287
|
+
enum UserStatus {
|
|
288
|
+
ACTIVE
|
|
289
|
+
IN_PROGRESS
|
|
290
|
+
PENDING_REVIEW
|
|
291
|
+
ON_HOLD
|
|
292
|
+
}
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
When conversion changes the original value, gqlkit generates resolver mappings to translate between GraphQL and TypeScript values:
|
|
296
|
+
|
|
297
|
+
```typescript
|
|
298
|
+
// Generated resolvers.ts
|
|
299
|
+
export function createResolvers() {
|
|
300
|
+
return {
|
|
301
|
+
UserStatus: {
|
|
302
|
+
ACTIVE: "active",
|
|
303
|
+
IN_PROGRESS: "inProgress",
|
|
304
|
+
PENDING_REVIEW: "pending_review",
|
|
305
|
+
ON_HOLD: "on-hold",
|
|
306
|
+
},
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
If values are already in `SCREAMING_SNAKE_CASE`, no resolver mapping is generated.
|
|
312
|
+
|
|
313
|
+
### Duplicate Value Detection
|
|
314
|
+
|
|
315
|
+
If multiple TypeScript values convert to the same GraphQL enum value, gqlkit reports a `DUPLICATE_ENUM_VALUE_AFTER_CONVERSION` error:
|
|
316
|
+
|
|
317
|
+
```typescript
|
|
318
|
+
// Error: 'activeUser' and 'active_user' both convert to ACTIVE_USER
|
|
319
|
+
export type Status = "activeUser" | "active_user" | "pending";
|
|
320
|
+
```
|
|
321
|
+
|
|
114
322
|
## Invalid Enum Values
|
|
115
323
|
|
|
116
324
|
Enum values that are not valid GraphQL identifiers are automatically skipped with a warning. gqlkit converts enum values to `SCREAMING_SNAKE_CASE`, and the converted name must:
|
package/docs/schema/fields.md
CHANGED
|
@@ -120,6 +120,8 @@ input UserPostsFilterInput {
|
|
|
120
120
|
}
|
|
121
121
|
```
|
|
122
122
|
|
|
123
|
+
Inline string literal unions and external TypeScript enums in arguments are also automatically converted to GraphQL enum types. See [Inline Enums](./enums.md#inline-enums) for details.
|
|
124
|
+
|
|
123
125
|
## Default Values in Arguments
|
|
124
126
|
|
|
125
127
|
Default values in Input Objects are applied to resolver arguments:
|
package/docs/schema/inputs.md
CHANGED
|
@@ -58,6 +58,8 @@ input CreateUserProfileInput {
|
|
|
58
58
|
|
|
59
59
|
Nested inline objects generate types with concatenated names (e.g., `UserProfileInput.address` → `UserProfileAddressInput`).
|
|
60
60
|
|
|
61
|
+
Similarly, inline string literal unions and external TypeScript enums are automatically converted to GraphQL enum types. See [Inline Enums](./enums.md#inline-enums) for details.
|
|
62
|
+
|
|
61
63
|
## @oneOf Input Objects
|
|
62
64
|
|
|
63
65
|
Union types with `Input` suffix using inline object literals generate `@oneOf` input objects. Each union member must be an inline object literal with exactly one property. Property values can be scalar types, enum types, or references to Input Object types:
|
package/docs/schema/objects.md
CHANGED
|
@@ -102,6 +102,8 @@ type UserProfile {
|
|
|
102
102
|
|
|
103
103
|
Nested inline objects generate types with concatenated names (e.g., `User.profile.address` → `UserProfileAddress`).
|
|
104
104
|
|
|
105
|
+
Similarly, inline string literal unions and external TypeScript enums are automatically converted to GraphQL enum types. See [Inline Enums](./enums.md#inline-enums) for details.
|
|
106
|
+
|
|
105
107
|
## Implementing Interfaces
|
|
106
108
|
|
|
107
109
|
Use `GqlObject` with the `implements` option to declare that a type implements interfaces:
|
|
@@ -175,6 +175,8 @@ input SearchUsersFilterInput {
|
|
|
175
175
|
}
|
|
176
176
|
```
|
|
177
177
|
|
|
178
|
+
Inline string literal unions and external TypeScript enums in arguments are also automatically converted to GraphQL enum types. See [Inline Enums](./enums.md#inline-enums) for details.
|
|
179
|
+
|
|
178
180
|
See [Field Resolvers](./fields.md) for more details on inline object arguments.
|
|
179
181
|
|
|
180
182
|
## Attaching Directives
|