@gqlkit-ts/cli 0.1.0 → 0.3.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 +26 -4
- package/dist/auto-type-generator/auto-type-generator.d.ts.map +1 -1
- package/dist/auto-type-generator/auto-type-generator.js +846 -152
- package/dist/auto-type-generator/auto-type-generator.js.map +1 -1
- package/dist/auto-type-generator/index.d.ts +9 -2
- package/dist/auto-type-generator/index.d.ts.map +1 -1
- package/dist/auto-type-generator/index.js +3 -0
- package/dist/auto-type-generator/index.js.map +1 -1
- package/dist/auto-type-generator/inline-enum-collector.d.ts +39 -0
- package/dist/auto-type-generator/inline-enum-collector.d.ts.map +1 -0
- package/dist/auto-type-generator/inline-enum-collector.js +193 -0
- package/dist/auto-type-generator/inline-enum-collector.js.map +1 -0
- package/dist/auto-type-generator/inline-object-traverser.d.ts +20 -0
- package/dist/auto-type-generator/inline-object-traverser.d.ts.map +1 -0
- package/dist/auto-type-generator/inline-object-traverser.js +22 -0
- package/dist/auto-type-generator/inline-object-traverser.js.map +1 -0
- package/dist/auto-type-generator/inline-union-collector.d.ts +29 -0
- package/dist/auto-type-generator/inline-union-collector.d.ts.map +1 -0
- package/dist/auto-type-generator/inline-union-collector.js +216 -0
- package/dist/auto-type-generator/inline-union-collector.js.map +1 -0
- package/dist/auto-type-generator/inline-union-types.d.ts +29 -0
- package/dist/auto-type-generator/inline-union-types.d.ts.map +1 -0
- package/dist/auto-type-generator/inline-union-types.js +2 -0
- package/dist/auto-type-generator/inline-union-types.js.map +1 -0
- package/dist/auto-type-generator/inline-union-validator.d.ts +76 -0
- package/dist/auto-type-generator/inline-union-validator.d.ts.map +1 -0
- package/dist/auto-type-generator/inline-union-validator.js +329 -0
- package/dist/auto-type-generator/inline-union-validator.js.map +1 -0
- package/dist/auto-type-generator/naming-convention.d.ts +22 -1
- package/dist/auto-type-generator/naming-convention.d.ts.map +1 -1
- package/dist/auto-type-generator/naming-convention.js +24 -0
- package/dist/auto-type-generator/naming-convention.js.map +1 -1
- package/dist/auto-type-generator/resolve-type-generator.d.ts +20 -0
- package/dist/auto-type-generator/resolve-type-generator.d.ts.map +1 -0
- package/dist/auto-type-generator/resolve-type-generator.js +2 -0
- package/dist/auto-type-generator/resolve-type-generator.js.map +1 -0
- package/dist/auto-type-generator/resolver-field-iterator.d.ts +13 -0
- package/dist/auto-type-generator/resolver-field-iterator.d.ts.map +1 -0
- package/dist/auto-type-generator/resolver-field-iterator.js +22 -0
- package/dist/auto-type-generator/resolver-field-iterator.js.map +1 -0
- package/dist/auto-type-generator/typename-extractor.d.ts +26 -0
- package/dist/auto-type-generator/typename-extractor.d.ts.map +1 -0
- package/dist/auto-type-generator/typename-extractor.js +142 -0
- package/dist/auto-type-generator/typename-extractor.js.map +1 -0
- package/dist/auto-type-generator/typename-resolve-type-generator.d.ts +35 -0
- package/dist/auto-type-generator/typename-resolve-type-generator.d.ts.map +1 -0
- package/dist/auto-type-generator/typename-resolve-type-generator.js +177 -0
- package/dist/auto-type-generator/typename-resolve-type-generator.js.map +1 -0
- package/dist/auto-type-generator/typename-types.d.ts +43 -0
- package/dist/auto-type-generator/typename-types.d.ts.map +1 -0
- package/dist/auto-type-generator/typename-types.js +37 -0
- package/dist/auto-type-generator/typename-types.js.map +1 -0
- package/dist/auto-type-generator/typename-validator.d.ts +37 -0
- package/dist/auto-type-generator/typename-validator.d.ts.map +1 -0
- package/dist/auto-type-generator/typename-validator.js +206 -0
- package/dist/auto-type-generator/typename-validator.js.map +1 -0
- package/dist/cli.js +2 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/docs.d.ts +51 -0
- package/dist/commands/docs.d.ts.map +1 -0
- package/dist/commands/docs.js +154 -0
- package/dist/commands/docs.js.map +1 -0
- package/dist/gen-orchestrator/orchestrator.d.ts.map +1 -1
- package/dist/gen-orchestrator/orchestrator.js +119 -14
- package/dist/gen-orchestrator/orchestrator.js.map +1 -1
- package/dist/resolver-extractor/extract-resolvers.d.ts +28 -1
- package/dist/resolver-extractor/extract-resolvers.d.ts.map +1 -1
- package/dist/resolver-extractor/extractor/define-api-extractor.d.ts +16 -1
- package/dist/resolver-extractor/extractor/define-api-extractor.d.ts.map +1 -1
- package/dist/resolver-extractor/extractor/define-api-extractor.js +86 -309
- package/dist/resolver-extractor/extractor/define-api-extractor.js.map +1 -1
- package/dist/resolver-extractor/index.d.ts +0 -1
- package/dist/resolver-extractor/index.d.ts.map +1 -1
- package/dist/resolver-extractor/validator/abstract-resolver-validator.d.ts +1 -0
- package/dist/resolver-extractor/validator/abstract-resolver-validator.d.ts.map +1 -1
- package/dist/resolver-extractor/validator/abstract-resolver-validator.js +9 -5
- package/dist/resolver-extractor/validator/abstract-resolver-validator.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 +39 -4
- package/dist/schema-generator/emitter/code-emitter.js.map +1 -1
- package/dist/schema-generator/generate-schema.d.ts +1 -0
- package/dist/schema-generator/generate-schema.d.ts.map +1 -1
- package/dist/schema-generator/generate-schema.js +90 -4
- package/dist/schema-generator/generate-schema.js.map +1 -1
- package/dist/schema-generator/integrator/result-integrator.d.ts +34 -2
- package/dist/schema-generator/integrator/result-integrator.d.ts.map +1 -1
- package/dist/schema-generator/integrator/result-integrator.js +96 -1
- package/dist/schema-generator/integrator/result-integrator.js.map +1 -1
- package/dist/schema-generator/resolver-collector/resolver-collector.d.ts +2 -0
- package/dist/schema-generator/resolver-collector/resolver-collector.d.ts.map +1 -1
- package/dist/schema-generator/resolver-collector/resolver-collector.js +22 -0
- package/dist/schema-generator/resolver-collector/resolver-collector.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/enum-prefix-detector.d.ts +63 -0
- package/dist/shared/enum-prefix-detector.d.ts.map +1 -0
- package/dist/shared/enum-prefix-detector.js +80 -0
- package/dist/shared/enum-prefix-detector.js.map +1 -0
- 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/ignore-fields-detector.d.ts +26 -0
- package/dist/shared/ignore-fields-detector.d.ts.map +1 -0
- package/dist/shared/ignore-fields-detector.js +83 -0
- package/dist/shared/ignore-fields-detector.js.map +1 -0
- package/dist/shared/ignore-fields-validator.d.ts +29 -0
- package/dist/shared/ignore-fields-validator.d.ts.map +1 -0
- package/dist/shared/ignore-fields-validator.js +43 -0
- package/dist/shared/ignore-fields-validator.js.map +1 -0
- package/dist/shared/index.d.ts +3 -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/source-location.d.ts +5 -0
- package/dist/shared/source-location.d.ts.map +1 -1
- package/dist/shared/source-location.js +7 -0
- package/dist/shared/source-location.js.map +1 -1
- 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 +57 -4
- 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 +433 -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 +260 -229
- 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 +47 -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 +75 -0
- package/dist/type-extractor/types/ts-type-reference-factory.js.map +1 -0
- package/dist/type-extractor/types/typescript.d.ts +25 -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/coding-agents.md +64 -0
- package/docs/configuration.md +6 -20
- package/docs/getting-started.md +15 -12
- package/docs/index.md +36 -21
- package/docs/integration/apollo.md +8 -40
- package/docs/integration/drizzle.md +187 -0
- package/docs/integration/prisma.md +196 -0
- package/docs/integration/yoga.md +8 -40
- package/docs/schema/abstract-resolvers.md +117 -0
- package/docs/schema/directives.md +5 -0
- package/docs/schema/documentation.md +5 -0
- package/docs/schema/enums.md +307 -0
- package/docs/schema/fields.md +66 -0
- package/docs/schema/index.md +21 -0
- package/docs/schema/inputs.md +117 -15
- package/docs/schema/interfaces.md +31 -1
- package/docs/schema/objects.md +42 -0
- package/docs/schema/queries-mutations.md +138 -22
- package/docs/schema/scalars.md +5 -0
- package/docs/schema/unions.md +208 -1
- package/docs/what-is-gqlkit.md +13 -8
- package/package.json +14 -5
- package/src/auto-type-generator/auto-type-generator.ts +1670 -0
- package/src/auto-type-generator/index.ts +63 -0
- package/src/auto-type-generator/inline-enum-collector.ts +338 -0
- package/src/auto-type-generator/inline-object-traverser.ts +49 -0
- package/src/auto-type-generator/inline-union-collector.ts +402 -0
- package/src/auto-type-generator/inline-union-types.ts +33 -0
- package/src/auto-type-generator/inline-union-validator.ts +482 -0
- package/src/auto-type-generator/name-collision-validator.ts +119 -0
- package/src/auto-type-generator/naming-convention.ts +163 -0
- package/src/auto-type-generator/resolve-type-generator.ts +21 -0
- package/src/auto-type-generator/resolver-field-iterator.ts +39 -0
- package/src/auto-type-generator/typename-extractor.ts +230 -0
- package/src/auto-type-generator/typename-resolve-type-generator.ts +281 -0
- package/src/auto-type-generator/typename-types.ts +66 -0
- package/src/auto-type-generator/typename-validator.ts +326 -0
- package/src/cli.ts +13 -0
- package/src/commands/docs.ts +211 -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 +798 -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 +82 -0
- package/src/resolver-extractor/extractor/define-api-extractor.ts +740 -0
- package/src/resolver-extractor/index.ts +13 -0
- package/src/resolver-extractor/validator/abstract-resolver-validator.ts +259 -0
- package/src/schema-generator/builder/ast-builder.ts +706 -0
- package/src/schema-generator/emitter/code-emitter.ts +385 -0
- package/src/schema-generator/emitter/sdl-emitter.ts +13 -0
- package/src/schema-generator/generate-schema.ts +267 -0
- package/src/schema-generator/index.ts +19 -0
- package/src/schema-generator/integrator/result-integrator.ts +759 -0
- package/src/schema-generator/pruner/schema-pruner.ts +112 -0
- package/src/schema-generator/resolver-collector/resolver-collector.ts +157 -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/enum-prefix-detector.ts +99 -0
- package/src/shared/file-scanner.ts +170 -0
- package/src/shared/ignore-fields-detector.ts +109 -0
- package/src/shared/ignore-fields-validator.ts +66 -0
- package/src/shared/index.ts +34 -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 +38 -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 +483 -0
- package/src/type-extractor/extract-types.ts +1 -0
- package/src/type-extractor/extractor/field-type-resolver.ts +614 -0
- package/src/type-extractor/extractor/type-extractor.ts +1644 -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 +109 -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 +150 -0
- package/src/type-extractor/types/typescript.ts +137 -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.d.ts +0 -61
- package/dist/resolver-extractor/validator/only-validator.d.ts.map +0 -1
- package/dist/resolver-extractor/validator/only-validator.js +0 -76
- package/dist/resolver-extractor/validator/only-validator.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,5 +1,6 @@
|
|
|
1
1
|
export type { DeprecationInfo } from "../../shared/tsdoc-parser.js";
|
|
2
2
|
export type { Diagnostic, DiagnosticCode, Diagnostics, SourceLocation, } from "./diagnostics.js";
|
|
3
3
|
export type { EnumValueInfo, FieldInfo, GraphQLFieldType, GraphQLTypeInfo, GraphQLTypeKind, } from "./graphql.js";
|
|
4
|
-
export
|
|
4
|
+
export { createArrayType, createInlineObjectType, createLiteralType, createPrimitiveType, createReferenceType, createScalarType, createUnionType, } from "./ts-type-reference-factory.js";
|
|
5
|
+
export type { EnumMemberInfo, ExtractedTypeInfo, FieldDefinition, InlineEnumMemberInfo, InlineObjectMember, InlineObjectProperty, InlineObjectPropertyDef, ScalarTypeInfo, TSTypeReference, TSTypeReferenceKind, TypeKind, TypeMetadata, } from "./typescript.js";
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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,47 @@
|
|
|
1
|
+
import type ts from "typescript";
|
|
2
|
+
import type { DeprecationInfo } from "../../shared/tsdoc-parser.js";
|
|
3
|
+
import type { InlineEnumMemberInfo, InlineObjectPropertyDef, ScalarTypeInfo, TSTypeReference } from "./typescript.js";
|
|
4
|
+
interface CreateReferenceTypeParams {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly nullable: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function createReferenceType(params: CreateReferenceTypeParams): TSTypeReference;
|
|
9
|
+
interface CreatePrimitiveTypeParams {
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly nullable: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function createPrimitiveType(params: CreatePrimitiveTypeParams): TSTypeReference;
|
|
14
|
+
export declare function createArrayType(elementType: TSTypeReference): TSTypeReference;
|
|
15
|
+
interface CreateUnionTypeParams {
|
|
16
|
+
readonly members: ReadonlyArray<TSTypeReference>;
|
|
17
|
+
readonly nullable: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare function createUnionType(params: CreateUnionTypeParams): TSTypeReference;
|
|
20
|
+
interface CreateInlineObjectTypeParams {
|
|
21
|
+
readonly properties: ReadonlyArray<InlineObjectPropertyDef>;
|
|
22
|
+
/** TSDoc description from the type alias (null for true inline objects) */
|
|
23
|
+
readonly description: string | null;
|
|
24
|
+
/** @deprecated tag from the type alias (null for true inline objects) */
|
|
25
|
+
readonly deprecated: DeprecationInfo | null;
|
|
26
|
+
}
|
|
27
|
+
export declare function createInlineObjectType(params: CreateInlineObjectTypeParams): TSTypeReference;
|
|
28
|
+
interface CreateScalarTypeParams {
|
|
29
|
+
readonly name: string;
|
|
30
|
+
readonly scalarInfo: ScalarTypeInfo;
|
|
31
|
+
readonly nullable: boolean;
|
|
32
|
+
}
|
|
33
|
+
export declare function createScalarType(params: CreateScalarTypeParams): TSTypeReference;
|
|
34
|
+
export declare function createLiteralType(name: string): TSTypeReference;
|
|
35
|
+
interface CreateInlineEnumTypeParams {
|
|
36
|
+
readonly members: ReadonlyArray<InlineEnumMemberInfo>;
|
|
37
|
+
readonly nullable: boolean;
|
|
38
|
+
/** External TypeScript enum symbol for deduplication (null for string literal unions) */
|
|
39
|
+
readonly externalEnumSymbol: ts.Symbol | null;
|
|
40
|
+
/** TSDoc description from the external enum type itself (null for string literal unions) */
|
|
41
|
+
readonly externalEnumDescription: string | null;
|
|
42
|
+
/** @deprecated tag from the external enum type itself (null for string literal unions) */
|
|
43
|
+
readonly externalEnumDeprecated: DeprecationInfo | null;
|
|
44
|
+
}
|
|
45
|
+
export declare function createInlineEnumType(params: CreateInlineEnumTypeParams): TSTypeReference;
|
|
46
|
+
export {};
|
|
47
|
+
//# 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,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,KAAK,EACV,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,eAAe,EAChB,MAAM,iBAAiB,CAAC;AA4BzB,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,Q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AA4F;IAC5F,QAAQ,CAAC,uBAAuB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChD,0FAA0F;IAC1F,QAAQ,CAAC,sBAAsB,EAAE,eAAe,GAAG,IAAI,CAAC;CACzD;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,0BAA0B,GACjC,eAAe,CAWjB"}
|
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
inlineObjectDescription: null,
|
|
11
|
+
inlineObjectDeprecated: null,
|
|
12
|
+
inlineEnumMembers: null,
|
|
13
|
+
externalEnumSymbol: null,
|
|
14
|
+
externalEnumDescription: null,
|
|
15
|
+
externalEnumDeprecated: null,
|
|
16
|
+
...params.overrides,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export function createReferenceType(params) {
|
|
20
|
+
return createTSTypeReference({
|
|
21
|
+
kind: "reference",
|
|
22
|
+
overrides: { name: params.name, nullable: params.nullable },
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
export function createPrimitiveType(params) {
|
|
26
|
+
return createTSTypeReference({
|
|
27
|
+
kind: "primitive",
|
|
28
|
+
overrides: { name: params.name, nullable: params.nullable },
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
export function createArrayType(elementType) {
|
|
32
|
+
return createTSTypeReference({ kind: "array", overrides: { elementType } });
|
|
33
|
+
}
|
|
34
|
+
export function createUnionType(params) {
|
|
35
|
+
return createTSTypeReference({
|
|
36
|
+
kind: "union",
|
|
37
|
+
overrides: { members: params.members, nullable: params.nullable },
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
export function createInlineObjectType(params) {
|
|
41
|
+
return createTSTypeReference({
|
|
42
|
+
kind: "inlineObject",
|
|
43
|
+
overrides: {
|
|
44
|
+
inlineObjectProperties: params.properties,
|
|
45
|
+
inlineObjectDescription: params.description,
|
|
46
|
+
inlineObjectDeprecated: params.deprecated,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
export function createScalarType(params) {
|
|
51
|
+
return createTSTypeReference({
|
|
52
|
+
kind: "scalar",
|
|
53
|
+
overrides: {
|
|
54
|
+
name: params.name,
|
|
55
|
+
scalarInfo: params.scalarInfo,
|
|
56
|
+
nullable: params.nullable,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
export function createLiteralType(name) {
|
|
61
|
+
return createTSTypeReference({ kind: "literal", overrides: { name } });
|
|
62
|
+
}
|
|
63
|
+
export function createInlineEnumType(params) {
|
|
64
|
+
return createTSTypeReference({
|
|
65
|
+
kind: "inlineEnum",
|
|
66
|
+
overrides: {
|
|
67
|
+
inlineEnumMembers: params.members,
|
|
68
|
+
nullable: params.nullable,
|
|
69
|
+
externalEnumSymbol: params.externalEnumSymbol,
|
|
70
|
+
externalEnumDescription: params.externalEnumDescription,
|
|
71
|
+
externalEnumDeprecated: params.externalEnumDeprecated,
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
//# 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":"AAcA,SAAS,qBAAqB,CAC5B,MAAmC;IAEnC,OAAO;QACL,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,IAAI,EAAE,IAAI;QACV,WAAW,EAAE,IAAI;QACjB,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,KAAK;QACf,UAAU,EAAE,IAAI;QAChB,sBAAsB,EAAE,IAAI;QAC5B,uBAAuB,EAAE,IAAI;QAC7B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C;KACF,CAAC,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;AAaD,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,18 @@ export interface TSTypeReference {
|
|
|
36
48
|
readonly nullable: boolean;
|
|
37
49
|
readonly scalarInfo: ScalarTypeInfo | null;
|
|
38
50
|
readonly inlineObjectProperties: ReadonlyArray<InlineObjectPropertyDef> | null;
|
|
51
|
+
/** TSDoc description from the inline object type alias (Requirement 7.2) */
|
|
52
|
+
readonly inlineObjectDescription: string | null;
|
|
53
|
+
/** @deprecated tag from the inline object type alias (Requirement 7.3) */
|
|
54
|
+
readonly inlineObjectDeprecated: DeprecationInfo | null;
|
|
55
|
+
/** Inline enum members when kind is "inlineEnum" */
|
|
56
|
+
readonly inlineEnumMembers: ReadonlyArray<InlineEnumMemberInfo> | null;
|
|
57
|
+
/** External TypeScript enum symbol for deduplication (Requirement 5.2) */
|
|
58
|
+
readonly externalEnumSymbol: ts.Symbol | null;
|
|
59
|
+
/** TSDoc description from the external enum type itself (Requirement 6.1) */
|
|
60
|
+
readonly externalEnumDescription: string | null;
|
|
61
|
+
/** @deprecated tag from the external enum type itself (Requirement 6.3) */
|
|
62
|
+
readonly externalEnumDeprecated: DeprecationInfo | null;
|
|
39
63
|
}
|
|
40
64
|
export interface InlineObjectPropertyDef {
|
|
41
65
|
readonly name: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
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M,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,UAAU,EAAE,eAAe,GAAG,IAAI,CAAC;IAC5C,QAAQ,CAAC,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;CAChD;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,eAAe,CAAC;IACvC,QAAQ,CAAC,WAAW,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.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAY7D,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,CAAC,CAAC;AAE5E,SAAS,eAAe,CACtB,GAA0D;IAE1D,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,OAAO,IAAI,GAAG,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,aAAa,CAC3B,cAAqE;IAErE,MAAM,KAAK,GAAG,eAAe,CAAC,cAAc,CAAC;QAC3C,CAAC,CAAC,cAAc,CAAC,KAAK;QACtB,CAAC,CAAC,cAAc,CAAC;IACnB,MAAM,iBAAiB,GAAG,eAAe,CAAC,cAAc,CAAC;QACvD,CAAC,CAAC,cAAc,CAAC,iBAAiB;QAClC,CAAC,CAAC,SAAS,CAAC;IAEd,MAAM,WAAW,GAAiB,EAAE,CAAC;IAErC,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACpD,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;QAC3B,GAAG,gBAAgB;QACnB,GAAG,CAAC,iBAAiB,IAAI,EAAE,CAAC;KAC7B,CAAC,CAAC;IAEH,KAAK,MAAM,IAAI,IAAI,KAAK,EAA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BACL,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,KAAK,EAAE,WAAW,CAAC,MAAM,KAAK,CAAC;QAC/B,WAAW;KACZ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Coding Agents
|
|
3
|
+
description: Set up AI coding agents like Claude Code and Codex to understand gqlkit conventions. (skip if reading via `gqlkit-guide` skill)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Coding Agents
|
|
7
|
+
|
|
8
|
+
gqlkit provides built-in support for AI coding agents like [Claude Code](https://claude.ai/code) and [OpenAI Codex](https://openai.com/index/openai-codex/). The `gqlkit docs` command generates skill files that help these tools understand gqlkit conventions and provide better assistance.
|
|
9
|
+
|
|
10
|
+
## Setup
|
|
11
|
+
|
|
12
|
+
Run the following command in your project root:
|
|
13
|
+
|
|
14
|
+
```sh filename="npm"
|
|
15
|
+
npm exec gqlkit docs
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
```sh filename="pnpm"
|
|
19
|
+
pnpm gqlkit docs
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```sh filename="yarn"
|
|
23
|
+
yarn gqlkit docs
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The command auto-detects your environment based on existing files (`CLAUDE.md`, `.claude/`, `AGENTS.md`, `.codex/`) and generates the appropriate files.
|
|
27
|
+
|
|
28
|
+
## Generated Files
|
|
29
|
+
|
|
30
|
+
### Claude Code
|
|
31
|
+
|
|
32
|
+
When Claude Code environment is detected (or `--claude` flag is used):
|
|
33
|
+
|
|
34
|
+
- `.claude/skills/gqlkit-guide/SKILL.md` - Skill definition with gqlkit documentation
|
|
35
|
+
- `.claude/skills/gqlkit-guide/references/` - Symlink to detailed documentation
|
|
36
|
+
- `CLAUDE.md` - Updated with gqlkit section (created if not exists)
|
|
37
|
+
|
|
38
|
+
### OpenAI Codex
|
|
39
|
+
|
|
40
|
+
When Codex environment is detected (or `--codex` flag is used):
|
|
41
|
+
|
|
42
|
+
- `.codex/skills/gqlkit-guide/SKILL.md` - Skill definition with gqlkit documentation
|
|
43
|
+
- `.codex/skills/gqlkit-guide/references/` - Symlink to detailed documentation
|
|
44
|
+
- `AGENTS.md` - Updated with gqlkit section (created if not exists)
|
|
45
|
+
|
|
46
|
+
## Options
|
|
47
|
+
|
|
48
|
+
| Option | Description |
|
|
49
|
+
|--------|-------------|
|
|
50
|
+
| `--output <dir>` | Output directory (default: current directory) |
|
|
51
|
+
| `--claude` | Generate Claude Code files explicitly |
|
|
52
|
+
| `--codex` | Generate Codex files explicitly |
|
|
53
|
+
|
|
54
|
+
## How It Works
|
|
55
|
+
|
|
56
|
+
The generated skill files follow the [Agent Skills](https://agentskills.io/) specification. When you ask the coding agent about gqlkit, it will:
|
|
57
|
+
|
|
58
|
+
1. Recognize gqlkit-related questions from the skill description
|
|
59
|
+
2. Read the bundled documentation to understand gqlkit conventions
|
|
60
|
+
3. Provide accurate guidance based on the latest documentation
|
|
61
|
+
|
|
62
|
+
## Keeping Skills Updated
|
|
63
|
+
|
|
64
|
+
Re-run `gqlkit docs` after updating gqlkit to ensure the skill files reflect the latest documentation.
|
package/docs/configuration.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Configuration
|
|
3
|
+
description: Configure gqlkit via gqlkit.config.ts in your project root.
|
|
4
|
+
---
|
|
5
|
+
|
|
1
6
|
# Configuration
|
|
2
7
|
|
|
3
8
|
gqlkit can be configured via `gqlkit.config.ts` in your project root.
|
|
@@ -49,7 +54,7 @@ export default defineConfig({
|
|
|
49
54
|
|
|
50
55
|
## Custom Scalar Types
|
|
51
56
|
|
|
52
|
-
Map TypeScript types to GraphQL custom scalars via config
|
|
57
|
+
Map TypeScript types to GraphQL custom scalars via config. See [Scalars](./schema/scalars) for complete documentation including the `GqlScalar` approach.
|
|
53
58
|
|
|
54
59
|
```ts
|
|
55
60
|
export default defineConfig({
|
|
@@ -59,29 +64,10 @@ export default defineConfig({
|
|
|
59
64
|
tsType: { from: "./src/gqlkit/schema/scalars", name: "DateTime" },
|
|
60
65
|
description: "ISO 8601 datetime string",
|
|
61
66
|
},
|
|
62
|
-
{
|
|
63
|
-
name: "UUID",
|
|
64
|
-
tsType: { name: "string" },
|
|
65
|
-
only: "input", // Input-only scalar
|
|
66
|
-
},
|
|
67
67
|
],
|
|
68
68
|
});
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
-
### Scalar Options
|
|
72
|
-
|
|
73
|
-
| Option | Type | Description |
|
|
74
|
-
|--------|------|-------------|
|
|
75
|
-
| `name` | `string` | The GraphQL scalar name |
|
|
76
|
-
| `tsType.name` | `string` | The TypeScript type name |
|
|
77
|
-
| `tsType.from` | `string` (optional) | Import path for the type (omit for global types) |
|
|
78
|
-
| `description` | `string` (optional) | Description for the GraphQL schema |
|
|
79
|
-
| `only` | `"input"` \| `"output"` (optional) | Restrict scalar to input or output positions |
|
|
80
|
-
|
|
81
|
-
> [!TIP]
|
|
82
|
-
>
|
|
83
|
-
> You can also define custom scalars using the `GqlScalar` utility type directly in your schema files. See [Scalars](/schema/scalars) for more details.
|
|
84
|
-
|
|
85
71
|
## Output Paths
|
|
86
72
|
|
|
87
73
|
Customize output file locations or disable specific outputs:
|
package/docs/getting-started.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Getting Started
|
|
3
|
+
description: Install gqlkit and create your first GraphQL schema from TypeScript.
|
|
4
|
+
---
|
|
5
|
+
|
|
1
6
|
# Getting Started
|
|
2
7
|
|
|
3
8
|
## Installation
|
|
@@ -17,6 +22,10 @@ yarn add @gqlkit-ts/runtime @graphql-tools/schema graphql
|
|
|
17
22
|
yarn add -D @gqlkit-ts/cli
|
|
18
23
|
```
|
|
19
24
|
|
|
25
|
+
> [!TIP]
|
|
26
|
+
>
|
|
27
|
+
> If you use AI coding agents like Claude Code or Codex, run `gqlkit docs` to set up gqlkit skills. See [Coding Agents](./coding-agents) for details.
|
|
28
|
+
|
|
20
29
|
## Project Structure
|
|
21
30
|
|
|
22
31
|
gqlkit expects your types and resolvers to be in `src/gqlkit/schema/`:
|
|
@@ -52,27 +61,21 @@ export const { defineQuery, defineMutation, defineField } =
|
|
|
52
61
|
createGqlkitApis<Context>();
|
|
53
62
|
```
|
|
54
63
|
|
|
55
|
-
## Define Your First Type
|
|
64
|
+
## Define Your First Type and Query
|
|
56
65
|
|
|
57
|
-
Create a simple User type in `src/gqlkit/schema/user.ts`:
|
|
66
|
+
Create a simple User type and query in `src/gqlkit/schema/user.ts`:
|
|
58
67
|
|
|
59
68
|
```typescript
|
|
69
|
+
import { defineQuery } from "../gqlkit";
|
|
70
|
+
import type { NoArgs } from "@gqlkit-ts/runtime";
|
|
71
|
+
|
|
60
72
|
export type User = {
|
|
61
73
|
id: string;
|
|
62
74
|
name: string;
|
|
63
75
|
email: string | null;
|
|
64
76
|
};
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
## Define a Query
|
|
68
|
-
|
|
69
|
-
Create a query resolver in `src/gqlkit/schema/query.ts`:
|
|
70
|
-
|
|
71
|
-
```typescript
|
|
72
|
-
import { defineQuery } from "../gqlkit";
|
|
73
|
-
import type { NoArgs } from "@gqlkit-ts/runtime";
|
|
74
|
-
import type { User } from "./user";
|
|
75
77
|
|
|
78
|
+
// NoArgs indicates this query takes no arguments
|
|
76
79
|
export const me = defineQuery<NoArgs, User | null>(
|
|
77
80
|
(_root, _args, ctx) => ctx.currentUser
|
|
78
81
|
);
|
package/docs/index.md
CHANGED
|
@@ -1,32 +1,47 @@
|
|
|
1
1
|
# gqlkit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
gqlkit generates GraphQL schema and resolver maps from TypeScript types and functions.
|
|
4
|
+
|
|
5
|
+
## How it works
|
|
6
|
+
|
|
7
|
+
1. Write TypeScript types in `src/gqlkit/schema/` → become GraphQL types
|
|
8
|
+
2. Write resolver functions using `defineQuery`, `defineMutation`, `defineField` → become GraphQL resolvers
|
|
9
|
+
3. Run `gqlkit gen` → outputs `typeDefs` and `resolvers` to `src/gqlkit/__generated__/`
|
|
10
|
+
|
|
11
|
+
## Design principles
|
|
12
|
+
|
|
13
|
+
- **Implement first**: Write types and resolvers, generate schema when ready. No edit-regenerate-implement loops.
|
|
14
|
+
- **Just types and functions**: Plain TypeScript with a thin API. No decorators, no complex generics.
|
|
15
|
+
- **Type-safe**: TypeScript types become GraphQL types. Resolver signatures checked at compile time.
|
|
4
16
|
|
|
5
17
|
## Documentation
|
|
6
18
|
|
|
7
|
-
- [What is gqlkit?](./what-is-gqlkit.md):
|
|
8
|
-
- [Getting Started](./getting-started.md): gqlkit
|
|
19
|
+
- [What is gqlkit?](./what-is-gqlkit.md): Just types and functions — write TypeScript, generate GraphQL.
|
|
20
|
+
- [Getting Started](./getting-started.md): Install gqlkit and create your first GraphQL schema from TypeScript.
|
|
21
|
+
- [Coding Agents](./coding-agents.md): Set up AI coding agents like Claude Code and Codex to understand gqlkit conventions. (skip if reading via `gqlkit-guide` skill)
|
|
9
22
|
|
|
10
|
-
##
|
|
23
|
+
## CLI
|
|
11
24
|
|
|
12
|
-
- [
|
|
13
|
-
- [Object Types](./schema/objects.md): Plain TypeScript type exports become GraphQL Object types.
|
|
14
|
-
- [Input Types](./schema/inputs.md): TypeScript types with `Input` suffix are treated as GraphQL input types.
|
|
15
|
-
- [Queries & Mutations](./schema/queries-mutations.md): Define Query and Mutation fields using the `@gqlkit-ts/runtime` API.
|
|
16
|
-
- [Field Resolvers](./schema/fields.md): Add computed fields to object types using `defineField`. Define them alongside the type.
|
|
17
|
-
- [Scalar Types](./schema/scalars.md): gqlkit provides built-in scalar types and supports custom scalar definitions.
|
|
18
|
-
- [Enum Types](./schema/enums.md): gqlkit converts TypeScript string literal unions and enums to GraphQL enum types.
|
|
19
|
-
- [Union Types](./schema/unions.md): TypeScript union types of object types are converted to GraphQL union types.
|
|
20
|
-
- [Interface Types](./schema/interfaces.md): Define GraphQL interface types using the `GqlInterface` utility type.
|
|
21
|
-
- [Abstract Type Resolution](./schema/abstract-resolvers.md): GraphQL abstract types (unions and interfaces) require runtime type resolution to determine the concrete type of returned values. gqlkit provides `defineResolveType` and `defineIsTypeOf` to handle this.
|
|
22
|
-
- [Documentation](./schema/documentation.md): gqlkit extracts TSDoc/JSDoc comments and converts them to GraphQL descriptions.
|
|
23
|
-
- [Custom Directives](./schema/directives.md): Define custom directives using the `GqlDirective` utility type and attach them using `GqlField` or `GqlObject`.
|
|
25
|
+
- [Configuration](./configuration.md): Configure gqlkit via gqlkit.config.ts in your project root.
|
|
24
26
|
|
|
25
|
-
##
|
|
27
|
+
## Schema Definition
|
|
26
28
|
|
|
27
|
-
- [
|
|
28
|
-
- [
|
|
29
|
+
- [Schema Definition](./schema.md): gqlkit generates GraphQL schema from your TypeScript types.
|
|
30
|
+
- [Defining Object Types](./schema/objects.md): Plain TypeScript type exports become GraphQL Object types.
|
|
31
|
+
- [Defining Input Types](./schema/inputs.md): TypeScript types with Input suffix are treated as GraphQL input types.
|
|
32
|
+
- [Defining Queries and Mutations](./schema/queries-mutations.md): Define Query and Mutation fields using the @gqlkit-ts/runtime API.
|
|
33
|
+
- [Defining Field Resolvers](./schema/fields.md): Add computed fields to object types using defineField.
|
|
34
|
+
- [Defining Scalar Types](./schema/scalars.md): gqlkit provides built-in scalar types and supports custom scalar definitions.
|
|
35
|
+
- [Defining Enum Types](./schema/enums.md): gqlkit converts TypeScript string literal unions and enums to GraphQL enum types.
|
|
36
|
+
- [Defining Union Types](./schema/unions.md): TypeScript union types of object types are converted to GraphQL union types.
|
|
37
|
+
- [Defining Interface Types](./schema/interfaces.md): Define GraphQL interface types using the GqlInterface utility type.
|
|
38
|
+
- [Resolving Abstract Types](./schema/abstract-resolvers.md): Handle runtime type resolution for GraphQL unions and interfaces.
|
|
39
|
+
- [Adding Documentation to Schema](./schema/documentation.md): gqlkit extracts TSDoc/JSDoc comments and converts them to GraphQL descriptions.
|
|
40
|
+
- [Defining Custom Directives](./schema/directives.md): Define custom directives using the GqlDirective utility type.
|
|
29
41
|
|
|
30
|
-
##
|
|
42
|
+
## Integration
|
|
31
43
|
|
|
32
|
-
- [
|
|
44
|
+
- [Integration with graphql-yoga](./integration/yoga.md): Use gqlkit with graphql-yoga, a batteries-included GraphQL server.
|
|
45
|
+
- [Integration with Apollo Server](./integration/apollo.md): Use gqlkit with Apollo Server, a popular GraphQL server.
|
|
46
|
+
- [Integration with Drizzle ORM](./integration/drizzle.md): Derive GraphQL types from Drizzle table definitions.
|
|
47
|
+
- [Integration with Prisma](./integration/prisma.md): Derive GraphQL types from Prisma model types.
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Integration with Apollo Server
|
|
3
|
+
description: Use gqlkit with Apollo Server, a popular GraphQL server.
|
|
4
|
+
---
|
|
5
|
+
|
|
1
6
|
# Apollo Server
|
|
2
7
|
|
|
3
8
|
[Apollo Server](https://www.apollographql.com/docs/apollo-server/) is a popular GraphQL server with extensive features and ecosystem.
|
|
@@ -16,18 +21,9 @@ pnpm add @apollo/server
|
|
|
16
21
|
yarn add @apollo/server
|
|
17
22
|
```
|
|
18
23
|
|
|
19
|
-
##
|
|
20
|
-
|
|
21
|
-
First, create an executable schema using `makeExecutableSchema`:
|
|
22
|
-
|
|
23
|
-
```typescript
|
|
24
|
-
// src/schema.ts
|
|
25
|
-
import { makeExecutableSchema } from "@graphql-tools/schema";
|
|
26
|
-
import { typeDefs } from "./gqlkit/__generated__/schema";
|
|
27
|
-
import { resolvers } from "./gqlkit/__generated__/resolvers";
|
|
24
|
+
## Prerequisites
|
|
28
25
|
|
|
29
|
-
|
|
30
|
-
```
|
|
26
|
+
Create an executable schema following the [Getting Started guide](../getting-started.md#create-graphql-schema).
|
|
31
27
|
|
|
32
28
|
## Basic Server
|
|
33
29
|
|
|
@@ -50,35 +46,7 @@ console.log(`Server is running on ${url}`);
|
|
|
50
46
|
|
|
51
47
|
## With Context
|
|
52
48
|
|
|
53
|
-
If your resolvers use a context type, provide a context factory:
|
|
54
|
-
|
|
55
|
-
```typescript
|
|
56
|
-
// src/gqlkit/context.ts
|
|
57
|
-
export type Context = {
|
|
58
|
-
currentUser: User | null;
|
|
59
|
-
db: Database;
|
|
60
|
-
};
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
```typescript
|
|
64
|
-
// src/gqlkit/gqlkit.ts
|
|
65
|
-
import { createGqlkitApis } from "@gqlkit-ts/runtime";
|
|
66
|
-
import type { Context } from "./context";
|
|
67
|
-
|
|
68
|
-
export const { defineQuery, defineMutation, defineField } =
|
|
69
|
-
createGqlkitApis<Context>();
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
```typescript
|
|
73
|
-
// src/gqlkit/schema/query.ts
|
|
74
|
-
import { defineQuery } from "../gqlkit";
|
|
75
|
-
import type { NoArgs } from "@gqlkit-ts/runtime";
|
|
76
|
-
import type { User } from "./user";
|
|
77
|
-
|
|
78
|
-
export const me = defineQuery<NoArgs, User | null>(
|
|
79
|
-
(_root, _args, ctx) => ctx.currentUser
|
|
80
|
-
);
|
|
81
|
-
```
|
|
49
|
+
If your resolvers use a context type, first [set up context and resolver factories](../getting-started.md#set-up-context-and-resolver-factories), then provide a context factory to your server:
|
|
82
50
|
|
|
83
51
|
```typescript
|
|
84
52
|
// src/server.ts
|