@soda-gql/core 0.10.2 → 0.11.1
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/README.md +1 -1
- package/dist/{index-Cbo0WJHs.d.ts → index-DPtgl2f4.d.ts} +231 -228
- package/dist/index-DPtgl2f4.d.ts.map +1 -0
- package/dist/{index-gHe-Lwi7.d.cts → index-IMOOkvQf.d.cts} +231 -228
- package/dist/index-IMOOkvQf.d.cts.map +1 -0
- package/dist/index.cjs +113 -87
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +113 -87
- package/dist/index.js.map +1 -1
- package/dist/runtime.d.cts +1 -1
- package/dist/runtime.d.ts +1 -1
- package/package.json +1 -1
- package/dist/index-Cbo0WJHs.d.ts.map +0 -1
- package/dist/index-gHe-Lwi7.d.cts.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { $ as InputInferrableTypeSpecifier, A as InputDefinition, At as ConstValue, B as UnionMemberName, C as AnyFieldName, Ct as DecrementDepth, D as InferInputKind, Dt as InputDepthOverrides, E as EnumDefinition, Et as GetInputTypeDepth, F as OperationType, Ft as getCurrentFieldPath, G as NestedValueElement, H as AnyVarRef, I as PickTypeSpecifierByFieldName, It as isListType, J as createVarRefFromNestedValue, K as VarRef, L as ResolveInputProfileFromMeta, Lt as withFieldPath, M as ObjectDefinition, Mt as FieldPath, N as ObjectFieldRecord, Nt as FieldPathSegment, O as InferInputProfile, Ot as IsDepthExhausted, P as OperationRoots, Pt as appendToPath, Q as InputEnumSpecifier, R as ScalarDefinition, S as AllInputTypeNames, St as ValidTypeModifier, T as AnyTypeName, Tt as DepthCounter, U as AnyVarRefBrand, V as UnionTypeRecord, W as NestedValue, X as AnyDefaultValue, Y as createVarRefFromVariable, Z as AnyTypeSpecifier, _ as FragmentMetadataBuilder, _t as PrimitiveTypeProfile, a as DefaultMetadataAdapter, at as OutputEnumSpecifier, b as MetadataBuilderTools, bt as GetSignature, c as ExtractAdapterTypes, ct as OutputScalarSpecifier, d as MetadataAdapter, dt as OutputTypeSpecifiers, et as InputInputObjectSpecifier, f as OperationDocumentTransformArgs, ft as OutputTypenameSpecifier, g as ExtractMetadata, gt as ObjectTypeProfile, h as defaultMetadataAdapter, ht as GetModifiedType, i as DefaultAdapter, it as InputTypeSpecifiers, j as InputFieldRecord, jt as ConstValues, k as InferOutputProfile, kt as NumberToDepth, l as ExtractUnifiedAdapterTypes, lt as OutputTypeKind, m as createDefaultAdapter, mt as GetConstAssignableType, n as AnyAdapter, nt as InputTypeKind, o as DocumentTransformArgs, ot as OutputInferrableTypeSpecifier, p as OperationDocumentTransformer, pt as OutputUnionSpecifier, q as VarRefInner, r as AnyMetadataAdapter, rt as InputTypeSpecifier, s as DocumentTransformer, st as OutputObjectSpecifier, t as Adapter, tt as InputScalarSpecifier, u as FragmentMetaInfo, ut as OutputTypeSpecifier, v as FragmentMetadataBuilderTools, vt as TypeProfile, w as AnyGraphqlSchema, wt as DefaultDepth, x as OperationMetadata, xt as TypeModifier, y as MetadataBuilder, yt as ApplyTypeModifier, z as UnionDefinition } from "./index-Bj60NxMb.cjs";
|
|
2
|
-
import { $ as
|
|
2
|
+
import { $ as AnyOperation, $t as buildConstValueNode, A as GqlElementComposer, An as DirectiveRefInner, At as AttachmentToProperty, B as VarBuilderMethods, Bt as createStandardDirectives, C as getScalarInputType, Cn as ConstAssignableInputValue, Ct as NestedUnionFieldsBuilder, D as AnyGqlContext, Dn as DirectiveArgumentSpecifier, Dt as SwitchIfOmittable, E as createOperationComposerFactory, En as AnyDirectiveRefBrand, Et as OptionalArg, F as InputTypeMethods, Ft as DirectiveBuilder, G as FragmentUsageRecord, Gt as ColocatedFields, H as createVarBuilder, Ht as isDirectiveRef, I as ResolveTypeFromMeta, It as DirectiveMethod, J as FragmentBuilderFor, Jt as StripSymbols, K as recordFragmentUsage, Kt as createColocateHelper, L as SchemaAwareGetNameAt, Lt as StandardDirectives, M as GqlElementComposerWithSchema, Mn as TypeSystemDirectiveLocation, Mt as AnyDirectiveMethod, N as createGqlElementComposer, Nt as DirectiveArgValue, O as ExtractMetadataAdapter, On as DirectiveLocation, Ot as empty, P as InputTypeMethod, Pt as DirectiveArgumentSpecifiers, Q as createFieldFactories, Qt as buildArgumentValue, R as SchemaAwareGetValueAt, Rt as createDirectiveBuilder, S as getEnumType, Sn as ConstAssignableInput, St as NestedObjectFieldsBuilderTools, T as graphqlTypeToTypeScript, Tn as AnyDirectiveRef, Tt as IfOmittable, U as createVarMethod, Ut as ColocateHelper, V as VarSpecifier, Vt as createTypedDirectiveMethod, W as createVarMethodFactory, Wt as ColocatedEntries, X as createVarAssignments, Xt as UnionToIntersection, Y as createGqlFragmentComposers, Yt as Tuple, Z as createVarRefs, Zt as EnumLookup, _ as calculateFieldType, _n as DeclaredVariables, _t as FieldSelectionFactoryReturn, a as HasPrebuiltFragment, an as AnyFields, at as FragmentInferMeta, b as generateInputType, bn as AnyConstAssignableInput, bt as FieldsBuilderTools, c as PrebuiltFragmentInput, cn as FieldSelectionTemplateOf, ct as GqlElementContext, d as PrebuiltOperationOutput, dn as AnyDirectiveAttachments, dt as AnyFieldSelectionFactoryReturn, en as buildDocument, et as AnyOperationOf, f as PrebuiltTypeRegistry, fn as AnyAssignableInput, ft as FieldSelectionFactories, g as applyTypeModifier, gn as AssignableInputByFieldName, gt as FieldSelectionFactoryPrimitiveReturn, h as TypeFormatters, hn as AssignableInput, ht as FieldSelectionFactoryObjectReturn, i as EmptyPrebuiltTypeRegistry, in as AnyFieldSelection, it as Fragment, j as GqlElementComposerOptions, jn as ExecutableDirectiveLocation, jt as AttachmentsTupleToIntersection, k as FragmentBuildersAll, kn as DirectiveRef, kt as AttachmentShape, l as PrebuiltFragmentOutput, ln as InferField, lt as GqlElementDefinitionFactory, m as GenerateInputObjectTypeOptions, mn as AnyAssigningInput, mt as FieldSelectionFactoryFieldArguments, n as Hidden, nn as buildWithTypeModifier, nt as OperationInferMeta, o as HasPrebuiltOperation, on as AnyNestedObject, ot as GqlElement, p as PrebuiltUnknownElement, pn as AnyAssignableInputValue, pt as FieldSelectionFactory, q as withFragmentUsageCollection, qt as StripFunctions, r as hidden, rn as AbstractFieldSelection, rt as AnyFragment, s as PrebuiltEntryNotFound, sn as AnyNestedUnion, st as GqlElementAttachment, t as wrapByKey, tn as buildOperationTypeNode, tt as Operation, u as PrebuiltOperationInput, un as InferFields, ut as AnyFieldSelectionFactory, v as calculateFieldsType, vn as FieldArgumentValue, vt as FieldSelectionFactoryUnionReturn, w as getScalarOutputType, wn as GetAssignableType, wt as EmptyObject, x as generateInputTypeFromSpecifiers, xn as AnyConstAssignableInputValue, xt as NestedObjectFieldsBuilder, y as generateInputObjectType, yn as AnyConstDirectiveAttachments, yt as FieldsBuilder, z as VarBuilder, zt as createDirectiveMethod } from "./index-IMOOkvQf.cjs";
|
|
3
3
|
import { n as defineOperationRoots, r as defineScalar, t as defineEnum } from "./schema-builder-YC3vPw7X.cjs";
|
|
4
4
|
|
|
5
5
|
//#region packages/core/src/types/type-foundation/modified-type-name.d.ts
|
|
@@ -11,5 +11,5 @@ declare function parseModifiedTypeName<TNameCandidate extends [string], TName ex
|
|
|
11
11
|
modifier: TModifier;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
14
|
-
export { AbstractFieldSelection, Adapter, AllInputTypeNames, AnyAdapter, AnyAssignableInput, AnyAssignableInputValue, AnyAssigningInput, AnyConstAssignableInput, AnyConstAssignableInputValue, AnyConstDirectiveAttachments, AnyDefaultValue, AnyDirectiveAttachments, AnyDirectiveMethod, AnyDirectiveRef, AnyDirectiveRefBrand, AnyFieldName, AnyFieldSelection, AnyFieldSelectionFactory, AnyFieldSelectionFactoryReturn, AnyFields, AnyFragment, AnyGqlContext, AnyGraphqlSchema, AnyMetadataAdapter, AnyNestedObject, AnyNestedUnion, AnyOperation, AnyOperationOf, AnyTypeName, AnyTypeSpecifier, AnyVarRef, AnyVarRefBrand, ApplyTypeModifier, AssignableInput, AssignableInputByFieldName, AttachmentShape, AttachmentToProperty, AttachmentsTupleToIntersection, ColocateHelper, ColocatedEntries, ColocatedFields, ConstAssignableInput, ConstAssignableInputValue, ConstValue, ConstValues, DeclaredVariables, DecrementDepth, DefaultAdapter, DefaultDepth, DefaultMetadataAdapter, DepthCounter, DirectiveArgValue, DirectiveBuilder, DirectiveLocation, DirectiveMethod, DirectiveRef, DirectiveRefInner, DocumentTransformArgs, DocumentTransformer, EmptyObject, EmptyPrebuiltTypeRegistry, EnumDefinition, ExtractAdapterTypes, ExtractMetadata, ExtractMetadataAdapter, ExtractUnifiedAdapterTypes, FieldArgumentValue, FieldPath, FieldPathSegment, FieldSelectionFactories, FieldSelectionFactory, FieldSelectionFactoryFieldArguments, FieldSelectionFactoryObjectReturn, FieldSelectionFactoryPrimitiveReturn, FieldSelectionFactoryReturn, FieldSelectionFactoryUnionReturn, FieldSelectionTemplateOf, FieldsBuilder, FieldsBuilderTools, Fragment, FragmentBuilderFor, FragmentBuildersAll, FragmentInferMeta, FragmentMetaInfo, FragmentMetadataBuilder, FragmentMetadataBuilderTools, FragmentUsageRecord, GenerateInputObjectTypeOptions, GetAssignableType, GetConstAssignableType, GetInputTypeDepth, GetModifiedType, GetSignature, GqlElement, GqlElementAttachment, GqlElementComposer, GqlElementComposerOptions, GqlElementComposerWithSchema, GqlElementContext, GqlElementDefinitionFactory, HasPrebuiltFragment, HasPrebuiltOperation, Hidden, IfOmittable, InferField, InferFields, InferInputKind, InferInputProfile, InferOutputProfile, InputDefinition, InputDepthOverrides, InputEnumSpecifier, InputFieldRecord, InputInferrableTypeSpecifier, InputInputObjectSpecifier, InputScalarSpecifier, InputTypeKind, InputTypeMethod, InputTypeMethods, InputTypeSpecifier, InputTypeSpecifiers, IsDepthExhausted, MetadataAdapter, MetadataBuilder, MetadataBuilderTools, ModifiedTypeName, NestedObjectFieldsBuilder, NestedObjectFieldsBuilderTools, NestedUnionFieldsBuilder, NestedValue, NestedValueElement, NumberToDepth, ObjectDefinition, ObjectFieldRecord, ObjectTypeProfile, Operation, OperationDocumentTransformArgs, OperationDocumentTransformer, OperationInferMeta, OperationMetadata, OperationRoots, OperationType, OptionalArg, OutputEnumSpecifier, OutputInferrableTypeSpecifier, OutputObjectSpecifier, OutputScalarSpecifier, OutputTypeKind, OutputTypeSpecifier, OutputTypeSpecifiers, OutputTypenameSpecifier, OutputUnionSpecifier, PickTypeSpecifierByFieldName, PrebuiltEntryNotFound, PrebuiltFragmentInput, PrebuiltFragmentOutput,
|
|
14
|
+
export { AbstractFieldSelection, Adapter, AllInputTypeNames, AnyAdapter, AnyAssignableInput, AnyAssignableInputValue, AnyAssigningInput, AnyConstAssignableInput, AnyConstAssignableInputValue, AnyConstDirectiveAttachments, AnyDefaultValue, AnyDirectiveAttachments, AnyDirectiveMethod, AnyDirectiveRef, AnyDirectiveRefBrand, AnyFieldName, AnyFieldSelection, AnyFieldSelectionFactory, AnyFieldSelectionFactoryReturn, AnyFields, AnyFragment, AnyGqlContext, AnyGraphqlSchema, AnyMetadataAdapter, AnyNestedObject, AnyNestedUnion, AnyOperation, AnyOperationOf, AnyTypeName, AnyTypeSpecifier, AnyVarRef, AnyVarRefBrand, ApplyTypeModifier, AssignableInput, AssignableInputByFieldName, AttachmentShape, AttachmentToProperty, AttachmentsTupleToIntersection, ColocateHelper, ColocatedEntries, ColocatedFields, ConstAssignableInput, ConstAssignableInputValue, ConstValue, ConstValues, DeclaredVariables, DecrementDepth, DefaultAdapter, DefaultDepth, DefaultMetadataAdapter, DepthCounter, DirectiveArgValue, DirectiveArgumentSpecifier, DirectiveArgumentSpecifiers, DirectiveBuilder, DirectiveLocation, DirectiveMethod, DirectiveRef, DirectiveRefInner, DocumentTransformArgs, DocumentTransformer, EmptyObject, EmptyPrebuiltTypeRegistry, EnumDefinition, EnumLookup, ExecutableDirectiveLocation, ExtractAdapterTypes, ExtractMetadata, ExtractMetadataAdapter, ExtractUnifiedAdapterTypes, FieldArgumentValue, FieldPath, FieldPathSegment, FieldSelectionFactories, FieldSelectionFactory, FieldSelectionFactoryFieldArguments, FieldSelectionFactoryObjectReturn, FieldSelectionFactoryPrimitiveReturn, FieldSelectionFactoryReturn, FieldSelectionFactoryUnionReturn, FieldSelectionTemplateOf, FieldsBuilder, FieldsBuilderTools, Fragment, FragmentBuilderFor, FragmentBuildersAll, FragmentInferMeta, FragmentMetaInfo, FragmentMetadataBuilder, FragmentMetadataBuilderTools, FragmentUsageRecord, GenerateInputObjectTypeOptions, GetAssignableType, GetConstAssignableType, GetInputTypeDepth, GetModifiedType, GetSignature, GqlElement, GqlElementAttachment, GqlElementComposer, GqlElementComposerOptions, GqlElementComposerWithSchema, GqlElementContext, GqlElementDefinitionFactory, HasPrebuiltFragment, HasPrebuiltOperation, Hidden, IfOmittable, InferField, InferFields, InferInputKind, InferInputProfile, InferOutputProfile, InputDefinition, InputDepthOverrides, InputEnumSpecifier, InputFieldRecord, InputInferrableTypeSpecifier, InputInputObjectSpecifier, InputScalarSpecifier, InputTypeKind, InputTypeMethod, InputTypeMethods, InputTypeSpecifier, InputTypeSpecifiers, IsDepthExhausted, MetadataAdapter, MetadataBuilder, MetadataBuilderTools, ModifiedTypeName, NestedObjectFieldsBuilder, NestedObjectFieldsBuilderTools, NestedUnionFieldsBuilder, NestedValue, NestedValueElement, NumberToDepth, ObjectDefinition, ObjectFieldRecord, ObjectTypeProfile, Operation, OperationDocumentTransformArgs, OperationDocumentTransformer, OperationInferMeta, OperationMetadata, OperationRoots, OperationType, OptionalArg, OutputEnumSpecifier, OutputInferrableTypeSpecifier, OutputObjectSpecifier, OutputScalarSpecifier, OutputTypeKind, OutputTypeSpecifier, OutputTypeSpecifiers, OutputTypenameSpecifier, OutputUnionSpecifier, PickTypeSpecifierByFieldName, PrebuiltEntryNotFound, PrebuiltFragmentInput, PrebuiltFragmentOutput, PrebuiltOperationInput, PrebuiltOperationOutput, PrebuiltTypeRegistry, PrebuiltUnknownElement, PrimitiveTypeProfile, ResolveInputProfileFromMeta, ResolveTypeFromMeta, ScalarDefinition, SchemaAwareGetNameAt, SchemaAwareGetValueAt, StandardDirectives, StripFunctions, StripSymbols, SwitchIfOmittable, Tuple, TypeFormatters, TypeModifier, TypeProfile, TypeSystemDirectiveLocation, UnionDefinition, UnionMemberName, UnionToIntersection, UnionTypeRecord, ValidTypeModifier, VarBuilder, VarBuilderMethods, VarRef, VarRefInner, VarSpecifier, appendToPath, applyTypeModifier, buildArgumentValue, buildConstValueNode, buildDocument, buildOperationTypeNode, buildWithTypeModifier, calculateFieldType, calculateFieldsType, createColocateHelper, createDefaultAdapter, createDirectiveBuilder, createDirectiveMethod, createFieldFactories, createGqlElementComposer, createGqlFragmentComposers, createOperationComposerFactory, createStandardDirectives, createTypedDirectiveMethod, createVarAssignments, createVarBuilder, createVarMethod, createVarMethodFactory, createVarRefFromNestedValue, createVarRefFromVariable, createVarRefs, defaultMetadataAdapter, defineEnum, defineOperationRoots, defineScalar, empty, generateInputObjectType, generateInputType, generateInputTypeFromSpecifiers, getCurrentFieldPath, getEnumType, getScalarInputType, getScalarOutputType, graphqlTypeToTypeScript, hidden, isDirectiveRef, isListType, parseModifiedTypeName, recordFragmentUsage, withFieldPath, withFragmentUsageCollection, wrapByKey };
|
|
15
15
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { $ as InputInferrableTypeSpecifier, A as InputDefinition, At as ConstValue, B as UnionMemberName, C as AnyFieldName, Ct as DecrementDepth, D as InferInputKind, Dt as InputDepthOverrides, E as EnumDefinition, Et as GetInputTypeDepth, F as OperationType, Ft as getCurrentFieldPath, G as NestedValueElement, H as AnyVarRef, I as PickTypeSpecifierByFieldName, It as isListType, J as createVarRefFromNestedValue, K as VarRef, L as ResolveInputProfileFromMeta, Lt as withFieldPath, M as ObjectDefinition, Mt as FieldPath, N as ObjectFieldRecord, Nt as FieldPathSegment, O as InferInputProfile, Ot as IsDepthExhausted, P as OperationRoots, Pt as appendToPath, Q as InputEnumSpecifier, R as ScalarDefinition, S as AllInputTypeNames, St as ValidTypeModifier, T as AnyTypeName, Tt as DepthCounter, U as AnyVarRefBrand, V as UnionTypeRecord, W as NestedValue, X as AnyDefaultValue, Y as createVarRefFromVariable, Z as AnyTypeSpecifier, _ as FragmentMetadataBuilder, _t as PrimitiveTypeProfile, a as DefaultMetadataAdapter, at as OutputEnumSpecifier, b as MetadataBuilderTools, bt as GetSignature, c as ExtractAdapterTypes, ct as OutputScalarSpecifier, d as MetadataAdapter, dt as OutputTypeSpecifiers, et as InputInputObjectSpecifier, f as OperationDocumentTransformArgs, ft as OutputTypenameSpecifier, g as ExtractMetadata, gt as ObjectTypeProfile, h as defaultMetadataAdapter, ht as GetModifiedType, i as DefaultAdapter, it as InputTypeSpecifiers, j as InputFieldRecord, jt as ConstValues, k as InferOutputProfile, kt as NumberToDepth, l as ExtractUnifiedAdapterTypes, lt as OutputTypeKind, m as createDefaultAdapter, mt as GetConstAssignableType, n as AnyAdapter, nt as InputTypeKind, o as DocumentTransformArgs, ot as OutputInferrableTypeSpecifier, p as OperationDocumentTransformer, pt as OutputUnionSpecifier, q as VarRefInner, r as AnyMetadataAdapter, rt as InputTypeSpecifier, s as DocumentTransformer, st as OutputObjectSpecifier, t as Adapter, tt as InputScalarSpecifier, u as FragmentMetaInfo, ut as OutputTypeSpecifier, v as FragmentMetadataBuilderTools, vt as TypeProfile, w as AnyGraphqlSchema, wt as DefaultDepth, x as OperationMetadata, xt as TypeModifier, y as MetadataBuilder, yt as ApplyTypeModifier, z as UnionDefinition } from "./index-DbANHktR.js";
|
|
2
|
-
import { $ as
|
|
2
|
+
import { $ as AnyOperation, $t as buildConstValueNode, A as GqlElementComposer, An as DirectiveRefInner, At as AttachmentToProperty, B as VarBuilderMethods, Bt as createStandardDirectives, C as getScalarInputType, Cn as ConstAssignableInputValue, Ct as NestedUnionFieldsBuilder, D as AnyGqlContext, Dn as DirectiveArgumentSpecifier, Dt as SwitchIfOmittable, E as createOperationComposerFactory, En as AnyDirectiveRefBrand, Et as OptionalArg, F as InputTypeMethods, Ft as DirectiveBuilder, G as FragmentUsageRecord, Gt as ColocatedFields, H as createVarBuilder, Ht as isDirectiveRef, I as ResolveTypeFromMeta, It as DirectiveMethod, J as FragmentBuilderFor, Jt as StripSymbols, K as recordFragmentUsage, Kt as createColocateHelper, L as SchemaAwareGetNameAt, Lt as StandardDirectives, M as GqlElementComposerWithSchema, Mn as TypeSystemDirectiveLocation, Mt as AnyDirectiveMethod, N as createGqlElementComposer, Nt as DirectiveArgValue, O as ExtractMetadataAdapter, On as DirectiveLocation, Ot as empty, P as InputTypeMethod, Pt as DirectiveArgumentSpecifiers, Q as createFieldFactories, Qt as buildArgumentValue, R as SchemaAwareGetValueAt, Rt as createDirectiveBuilder, S as getEnumType, Sn as ConstAssignableInput, St as NestedObjectFieldsBuilderTools, T as graphqlTypeToTypeScript, Tn as AnyDirectiveRef, Tt as IfOmittable, U as createVarMethod, Ut as ColocateHelper, V as VarSpecifier, Vt as createTypedDirectiveMethod, W as createVarMethodFactory, Wt as ColocatedEntries, X as createVarAssignments, Xt as UnionToIntersection, Y as createGqlFragmentComposers, Yt as Tuple, Z as createVarRefs, Zt as EnumLookup, _ as calculateFieldType, _n as DeclaredVariables, _t as FieldSelectionFactoryReturn, a as HasPrebuiltFragment, an as AnyFields, at as FragmentInferMeta, b as generateInputType, bn as AnyConstAssignableInput, bt as FieldsBuilderTools, c as PrebuiltFragmentInput, cn as FieldSelectionTemplateOf, ct as GqlElementContext, d as PrebuiltOperationOutput, dn as AnyDirectiveAttachments, dt as AnyFieldSelectionFactoryReturn, en as buildDocument, et as AnyOperationOf, f as PrebuiltTypeRegistry, fn as AnyAssignableInput, ft as FieldSelectionFactories, g as applyTypeModifier, gn as AssignableInputByFieldName, gt as FieldSelectionFactoryPrimitiveReturn, h as TypeFormatters, hn as AssignableInput, ht as FieldSelectionFactoryObjectReturn, i as EmptyPrebuiltTypeRegistry, in as AnyFieldSelection, it as Fragment, j as GqlElementComposerOptions, jn as ExecutableDirectiveLocation, jt as AttachmentsTupleToIntersection, k as FragmentBuildersAll, kn as DirectiveRef, kt as AttachmentShape, l as PrebuiltFragmentOutput, ln as InferField, lt as GqlElementDefinitionFactory, m as GenerateInputObjectTypeOptions, mn as AnyAssigningInput, mt as FieldSelectionFactoryFieldArguments, n as Hidden, nn as buildWithTypeModifier, nt as OperationInferMeta, o as HasPrebuiltOperation, on as AnyNestedObject, ot as GqlElement, p as PrebuiltUnknownElement, pn as AnyAssignableInputValue, pt as FieldSelectionFactory, q as withFragmentUsageCollection, qt as StripFunctions, r as hidden, rn as AbstractFieldSelection, rt as AnyFragment, s as PrebuiltEntryNotFound, sn as AnyNestedUnion, st as GqlElementAttachment, t as wrapByKey, tn as buildOperationTypeNode, tt as Operation, u as PrebuiltOperationInput, un as InferFields, ut as AnyFieldSelectionFactory, v as calculateFieldsType, vn as FieldArgumentValue, vt as FieldSelectionFactoryUnionReturn, w as getScalarOutputType, wn as GetAssignableType, wt as EmptyObject, x as generateInputTypeFromSpecifiers, xn as AnyConstAssignableInputValue, xt as NestedObjectFieldsBuilder, y as generateInputObjectType, yn as AnyConstDirectiveAttachments, yt as FieldsBuilder, z as VarBuilder, zt as createDirectiveMethod } from "./index-DPtgl2f4.js";
|
|
3
3
|
import { n as defineOperationRoots, r as defineScalar, t as defineEnum } from "./schema-builder-B5zSZzZO.js";
|
|
4
4
|
|
|
5
5
|
//#region packages/core/src/types/type-foundation/modified-type-name.d.ts
|
|
@@ -11,5 +11,5 @@ declare function parseModifiedTypeName<TNameCandidate extends [string], TName ex
|
|
|
11
11
|
modifier: TModifier;
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
14
|
-
export { AbstractFieldSelection, Adapter, AllInputTypeNames, AnyAdapter, AnyAssignableInput, AnyAssignableInputValue, AnyAssigningInput, AnyConstAssignableInput, AnyConstAssignableInputValue, AnyConstDirectiveAttachments, AnyDefaultValue, AnyDirectiveAttachments, AnyDirectiveMethod, AnyDirectiveRef, AnyDirectiveRefBrand, AnyFieldName, AnyFieldSelection, AnyFieldSelectionFactory, AnyFieldSelectionFactoryReturn, AnyFields, AnyFragment, AnyGqlContext, AnyGraphqlSchema, AnyMetadataAdapter, AnyNestedObject, AnyNestedUnion, AnyOperation, AnyOperationOf, AnyTypeName, AnyTypeSpecifier, AnyVarRef, AnyVarRefBrand, ApplyTypeModifier, AssignableInput, AssignableInputByFieldName, AttachmentShape, AttachmentToProperty, AttachmentsTupleToIntersection, ColocateHelper, ColocatedEntries, ColocatedFields, ConstAssignableInput, ConstAssignableInputValue, ConstValue, ConstValues, DeclaredVariables, DecrementDepth, DefaultAdapter, DefaultDepth, DefaultMetadataAdapter, DepthCounter, DirectiveArgValue, DirectiveBuilder, DirectiveLocation, DirectiveMethod, DirectiveRef, DirectiveRefInner, DocumentTransformArgs, DocumentTransformer, EmptyObject, EmptyPrebuiltTypeRegistry, EnumDefinition, ExtractAdapterTypes, ExtractMetadata, ExtractMetadataAdapter, ExtractUnifiedAdapterTypes, FieldArgumentValue, FieldPath, FieldPathSegment, FieldSelectionFactories, FieldSelectionFactory, FieldSelectionFactoryFieldArguments, FieldSelectionFactoryObjectReturn, FieldSelectionFactoryPrimitiveReturn, FieldSelectionFactoryReturn, FieldSelectionFactoryUnionReturn, FieldSelectionTemplateOf, FieldsBuilder, FieldsBuilderTools, Fragment, FragmentBuilderFor, FragmentBuildersAll, FragmentInferMeta, FragmentMetaInfo, FragmentMetadataBuilder, FragmentMetadataBuilderTools, FragmentUsageRecord, GenerateInputObjectTypeOptions, GetAssignableType, GetConstAssignableType, GetInputTypeDepth, GetModifiedType, GetSignature, GqlElement, GqlElementAttachment, GqlElementComposer, GqlElementComposerOptions, GqlElementComposerWithSchema, GqlElementContext, GqlElementDefinitionFactory, HasPrebuiltFragment, HasPrebuiltOperation, Hidden, IfOmittable, InferField, InferFields, InferInputKind, InferInputProfile, InferOutputProfile, InputDefinition, InputDepthOverrides, InputEnumSpecifier, InputFieldRecord, InputInferrableTypeSpecifier, InputInputObjectSpecifier, InputScalarSpecifier, InputTypeKind, InputTypeMethod, InputTypeMethods, InputTypeSpecifier, InputTypeSpecifiers, IsDepthExhausted, MetadataAdapter, MetadataBuilder, MetadataBuilderTools, ModifiedTypeName, NestedObjectFieldsBuilder, NestedObjectFieldsBuilderTools, NestedUnionFieldsBuilder, NestedValue, NestedValueElement, NumberToDepth, ObjectDefinition, ObjectFieldRecord, ObjectTypeProfile, Operation, OperationDocumentTransformArgs, OperationDocumentTransformer, OperationInferMeta, OperationMetadata, OperationRoots, OperationType, OptionalArg, OutputEnumSpecifier, OutputInferrableTypeSpecifier, OutputObjectSpecifier, OutputScalarSpecifier, OutputTypeKind, OutputTypeSpecifier, OutputTypeSpecifiers, OutputTypenameSpecifier, OutputUnionSpecifier, PickTypeSpecifierByFieldName, PrebuiltEntryNotFound, PrebuiltFragmentInput, PrebuiltFragmentOutput,
|
|
14
|
+
export { AbstractFieldSelection, Adapter, AllInputTypeNames, AnyAdapter, AnyAssignableInput, AnyAssignableInputValue, AnyAssigningInput, AnyConstAssignableInput, AnyConstAssignableInputValue, AnyConstDirectiveAttachments, AnyDefaultValue, AnyDirectiveAttachments, AnyDirectiveMethod, AnyDirectiveRef, AnyDirectiveRefBrand, AnyFieldName, AnyFieldSelection, AnyFieldSelectionFactory, AnyFieldSelectionFactoryReturn, AnyFields, AnyFragment, AnyGqlContext, AnyGraphqlSchema, AnyMetadataAdapter, AnyNestedObject, AnyNestedUnion, AnyOperation, AnyOperationOf, AnyTypeName, AnyTypeSpecifier, AnyVarRef, AnyVarRefBrand, ApplyTypeModifier, AssignableInput, AssignableInputByFieldName, AttachmentShape, AttachmentToProperty, AttachmentsTupleToIntersection, ColocateHelper, ColocatedEntries, ColocatedFields, ConstAssignableInput, ConstAssignableInputValue, ConstValue, ConstValues, DeclaredVariables, DecrementDepth, DefaultAdapter, DefaultDepth, DefaultMetadataAdapter, DepthCounter, DirectiveArgValue, DirectiveArgumentSpecifier, DirectiveArgumentSpecifiers, DirectiveBuilder, DirectiveLocation, DirectiveMethod, DirectiveRef, DirectiveRefInner, DocumentTransformArgs, DocumentTransformer, EmptyObject, EmptyPrebuiltTypeRegistry, EnumDefinition, EnumLookup, ExecutableDirectiveLocation, ExtractAdapterTypes, ExtractMetadata, ExtractMetadataAdapter, ExtractUnifiedAdapterTypes, FieldArgumentValue, FieldPath, FieldPathSegment, FieldSelectionFactories, FieldSelectionFactory, FieldSelectionFactoryFieldArguments, FieldSelectionFactoryObjectReturn, FieldSelectionFactoryPrimitiveReturn, FieldSelectionFactoryReturn, FieldSelectionFactoryUnionReturn, FieldSelectionTemplateOf, FieldsBuilder, FieldsBuilderTools, Fragment, FragmentBuilderFor, FragmentBuildersAll, FragmentInferMeta, FragmentMetaInfo, FragmentMetadataBuilder, FragmentMetadataBuilderTools, FragmentUsageRecord, GenerateInputObjectTypeOptions, GetAssignableType, GetConstAssignableType, GetInputTypeDepth, GetModifiedType, GetSignature, GqlElement, GqlElementAttachment, GqlElementComposer, GqlElementComposerOptions, GqlElementComposerWithSchema, GqlElementContext, GqlElementDefinitionFactory, HasPrebuiltFragment, HasPrebuiltOperation, Hidden, IfOmittable, InferField, InferFields, InferInputKind, InferInputProfile, InferOutputProfile, InputDefinition, InputDepthOverrides, InputEnumSpecifier, InputFieldRecord, InputInferrableTypeSpecifier, InputInputObjectSpecifier, InputScalarSpecifier, InputTypeKind, InputTypeMethod, InputTypeMethods, InputTypeSpecifier, InputTypeSpecifiers, IsDepthExhausted, MetadataAdapter, MetadataBuilder, MetadataBuilderTools, ModifiedTypeName, NestedObjectFieldsBuilder, NestedObjectFieldsBuilderTools, NestedUnionFieldsBuilder, NestedValue, NestedValueElement, NumberToDepth, ObjectDefinition, ObjectFieldRecord, ObjectTypeProfile, Operation, OperationDocumentTransformArgs, OperationDocumentTransformer, OperationInferMeta, OperationMetadata, OperationRoots, OperationType, OptionalArg, OutputEnumSpecifier, OutputInferrableTypeSpecifier, OutputObjectSpecifier, OutputScalarSpecifier, OutputTypeKind, OutputTypeSpecifier, OutputTypeSpecifiers, OutputTypenameSpecifier, OutputUnionSpecifier, PickTypeSpecifierByFieldName, PrebuiltEntryNotFound, PrebuiltFragmentInput, PrebuiltFragmentOutput, PrebuiltOperationInput, PrebuiltOperationOutput, PrebuiltTypeRegistry, PrebuiltUnknownElement, PrimitiveTypeProfile, ResolveInputProfileFromMeta, ResolveTypeFromMeta, ScalarDefinition, SchemaAwareGetNameAt, SchemaAwareGetValueAt, StandardDirectives, StripFunctions, StripSymbols, SwitchIfOmittable, Tuple, TypeFormatters, TypeModifier, TypeProfile, TypeSystemDirectiveLocation, UnionDefinition, UnionMemberName, UnionToIntersection, UnionTypeRecord, ValidTypeModifier, VarBuilder, VarBuilderMethods, VarRef, VarRefInner, VarSpecifier, appendToPath, applyTypeModifier, buildArgumentValue, buildConstValueNode, buildDocument, buildOperationTypeNode, buildWithTypeModifier, calculateFieldType, calculateFieldsType, createColocateHelper, createDefaultAdapter, createDirectiveBuilder, createDirectiveMethod, createFieldFactories, createGqlElementComposer, createGqlFragmentComposers, createOperationComposerFactory, createStandardDirectives, createTypedDirectiveMethod, createVarAssignments, createVarBuilder, createVarMethod, createVarMethodFactory, createVarRefFromNestedValue, createVarRefFromVariable, createVarRefs, defaultMetadataAdapter, defineEnum, defineOperationRoots, defineScalar, empty, generateInputObjectType, generateInputType, generateInputTypeFromSpecifiers, getCurrentFieldPath, getEnumType, getScalarInputType, getScalarOutputType, graphqlTypeToTypeScript, hidden, isDirectiveRef, isListType, parseModifiedTypeName, recordFragmentUsage, withFieldPath, withFragmentUsageCollection, wrapByKey };
|
|
15
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -70,8 +70,12 @@ var DirectiveRef = class {
|
|
|
70
70
|
*
|
|
71
71
|
* Handles primitives, arrays, objects, and variable references.
|
|
72
72
|
* Returns null for undefined values (field is omitted).
|
|
73
|
+
*
|
|
74
|
+
* @param value - The value to convert
|
|
75
|
+
* @param enumLookup - Context for enum detection. String values will be output
|
|
76
|
+
* as Kind.ENUM if typeSpecifier indicates an enum type.
|
|
73
77
|
*/
|
|
74
|
-
const buildArgumentValue = (value) => {
|
|
78
|
+
const buildArgumentValue = (value, enumLookup) => {
|
|
75
79
|
if (value === void 0) return null;
|
|
76
80
|
if (value === null) return { kind: Kind.NULL };
|
|
77
81
|
if (value instanceof VarRef) {
|
|
@@ -83,17 +87,22 @@ const buildArgumentValue = (value) => {
|
|
|
83
87
|
value: inner.name
|
|
84
88
|
}
|
|
85
89
|
};
|
|
86
|
-
if (inner.type === "nested-value") return buildArgumentValue(inner.value);
|
|
90
|
+
if (inner.type === "nested-value") return buildArgumentValue(inner.value, enumLookup);
|
|
87
91
|
throw new Error(`Unknown var ref type: ${inner}`);
|
|
88
92
|
}
|
|
89
93
|
if (Array.isArray(value)) return {
|
|
90
94
|
kind: Kind.LIST,
|
|
91
|
-
values: value.map((item) => buildArgumentValue(item)).filter((item) => item !== null)
|
|
95
|
+
values: value.map((item) => buildArgumentValue(item, enumLookup)).filter((item) => item !== null)
|
|
92
96
|
};
|
|
93
97
|
if (typeof value === "object") return {
|
|
94
98
|
kind: Kind.OBJECT,
|
|
95
|
-
fields: Object.entries(value).map(([key,
|
|
96
|
-
|
|
99
|
+
fields: Object.entries(value).map(([key, fieldValue]) => {
|
|
100
|
+
let fieldTypeSpecifier = null;
|
|
101
|
+
if (enumLookup.typeSpecifier?.kind === "input") fieldTypeSpecifier = enumLookup.schema.input[enumLookup.typeSpecifier.name]?.fields[key] ?? null;
|
|
102
|
+
const valueNode = buildArgumentValue(fieldValue, {
|
|
103
|
+
schema: enumLookup.schema,
|
|
104
|
+
typeSpecifier: fieldTypeSpecifier
|
|
105
|
+
});
|
|
97
106
|
return valueNode ? {
|
|
98
107
|
kind: Kind.OBJECT_FIELD,
|
|
99
108
|
name: {
|
|
@@ -104,10 +113,16 @@ const buildArgumentValue = (value) => {
|
|
|
104
113
|
} : null;
|
|
105
114
|
}).filter((item) => item !== null)
|
|
106
115
|
};
|
|
107
|
-
if (typeof value === "string")
|
|
108
|
-
kind
|
|
109
|
-
|
|
110
|
-
|
|
116
|
+
if (typeof value === "string") {
|
|
117
|
+
if (enumLookup.typeSpecifier?.kind === "enum") return {
|
|
118
|
+
kind: Kind.ENUM,
|
|
119
|
+
value
|
|
120
|
+
};
|
|
121
|
+
return {
|
|
122
|
+
kind: Kind.STRING,
|
|
123
|
+
value
|
|
124
|
+
};
|
|
125
|
+
}
|
|
111
126
|
if (typeof value === "number") return {
|
|
112
127
|
kind: !Number.isInteger(value) || value.toString().includes(".") ? Kind.FLOAT : Kind.INT,
|
|
113
128
|
value: value.toString()
|
|
@@ -118,8 +133,11 @@ const buildArgumentValue = (value) => {
|
|
|
118
133
|
};
|
|
119
134
|
throw new Error(`Unknown value type: ${typeof value}`);
|
|
120
135
|
};
|
|
121
|
-
const buildArguments = (args) => Object.entries(args ?? {}).map(([name, value]) => {
|
|
122
|
-
const valueNode = buildArgumentValue(value
|
|
136
|
+
const buildArguments = (args, argumentSpecifiers, schema) => Object.entries(args ?? {}).map(([name, value]) => {
|
|
137
|
+
const valueNode = buildArgumentValue(value, {
|
|
138
|
+
schema,
|
|
139
|
+
typeSpecifier: argumentSpecifiers[name] ?? null
|
|
140
|
+
});
|
|
123
141
|
return valueNode ? {
|
|
124
142
|
kind: Kind.ARGUMENT,
|
|
125
143
|
name: {
|
|
@@ -148,23 +166,28 @@ const validateDirectiveLocation = (directive, expectedLocation) => {
|
|
|
148
166
|
*
|
|
149
167
|
* @param directives - Array of directive references (or unknown values)
|
|
150
168
|
* @param location - The location context for validation
|
|
169
|
+
* @param schema - The schema for type lookups
|
|
151
170
|
* @returns Array of DirectiveNode for the GraphQL AST
|
|
171
|
+
*
|
|
172
|
+
* Uses argument specifiers from DirectiveRef (when available via createTypedDirectiveMethod)
|
|
173
|
+
* to properly output enum arguments as Kind.ENUM instead of Kind.STRING.
|
|
152
174
|
*/
|
|
153
|
-
const buildDirectives = (directives, location) => {
|
|
175
|
+
const buildDirectives = (directives, location, schema) => {
|
|
154
176
|
return directives.filter((d) => d instanceof DirectiveRef).map((directive) => {
|
|
155
177
|
validateDirectiveLocation(directive, location);
|
|
156
178
|
const inner = DirectiveRef.getInner(directive);
|
|
179
|
+
const argumentSpecifiers = inner.argumentSpecs ?? {};
|
|
157
180
|
return {
|
|
158
181
|
kind: Kind.DIRECTIVE,
|
|
159
182
|
name: {
|
|
160
183
|
kind: Kind.NAME,
|
|
161
184
|
value: inner.name
|
|
162
185
|
},
|
|
163
|
-
arguments: buildArguments(inner.arguments)
|
|
186
|
+
arguments: buildArguments(inner.arguments, argumentSpecifiers, schema)
|
|
164
187
|
};
|
|
165
188
|
});
|
|
166
189
|
};
|
|
167
|
-
const buildUnionSelection = (union) => Object.entries(union).map(([typeName, object]) => {
|
|
190
|
+
const buildUnionSelection = (union, schema) => Object.entries(union).map(([typeName, object]) => {
|
|
168
191
|
return object ? {
|
|
169
192
|
kind: Kind.INLINE_FRAGMENT,
|
|
170
193
|
typeCondition: {
|
|
@@ -176,12 +199,12 @@ const buildUnionSelection = (union) => Object.entries(union).map(([typeName, obj
|
|
|
176
199
|
},
|
|
177
200
|
selectionSet: {
|
|
178
201
|
kind: Kind.SELECTION_SET,
|
|
179
|
-
selections: buildField(object)
|
|
202
|
+
selections: buildField(object, schema)
|
|
180
203
|
}
|
|
181
204
|
} : null;
|
|
182
205
|
}).filter((item) => item !== null);
|
|
183
|
-
const buildField = (field) => Object.entries(field).map(([alias, { args, field: field$1, object, union, directives }]) => {
|
|
184
|
-
const builtDirectives = buildDirectives(directives, "FIELD");
|
|
206
|
+
const buildField = (field, schema) => Object.entries(field).map(([alias, { args, field: field$1, object, union, directives, type }]) => {
|
|
207
|
+
const builtDirectives = buildDirectives(directives, "FIELD", schema);
|
|
185
208
|
return {
|
|
186
209
|
kind: Kind.FIELD,
|
|
187
210
|
name: {
|
|
@@ -192,14 +215,14 @@ const buildField = (field) => Object.entries(field).map(([alias, { args, field:
|
|
|
192
215
|
kind: Kind.NAME,
|
|
193
216
|
value: alias
|
|
194
217
|
} : void 0,
|
|
195
|
-
arguments: buildArguments(args),
|
|
218
|
+
arguments: buildArguments(args, type.arguments, schema),
|
|
196
219
|
directives: builtDirectives.length > 0 ? builtDirectives : void 0,
|
|
197
220
|
selectionSet: object ? {
|
|
198
221
|
kind: Kind.SELECTION_SET,
|
|
199
|
-
selections: buildField(object)
|
|
222
|
+
selections: buildField(object, schema)
|
|
200
223
|
} : union ? {
|
|
201
224
|
kind: Kind.SELECTION_SET,
|
|
202
|
-
selections: buildUnionSelection(union)
|
|
225
|
+
selections: buildUnionSelection(union, schema)
|
|
203
226
|
} : void 0
|
|
204
227
|
};
|
|
205
228
|
});
|
|
@@ -208,30 +231,27 @@ const buildField = (field) => Object.entries(field).map(([alias, { args, field:
|
|
|
208
231
|
*
|
|
209
232
|
* Unlike `buildArgumentValue`, this only handles literal values
|
|
210
233
|
* (no variable references). Used for default values.
|
|
234
|
+
*
|
|
235
|
+
* @param value - The constant value to convert
|
|
236
|
+
* @param enumLookup - Context for enum detection. String values will be output
|
|
237
|
+
* as Kind.ENUM if typeSpecifier indicates an enum type.
|
|
211
238
|
*/
|
|
212
|
-
const buildConstValueNode = (value) => {
|
|
239
|
+
const buildConstValueNode = (value, enumLookup) => {
|
|
213
240
|
if (value === void 0) return null;
|
|
214
241
|
if (value === null) return { kind: Kind.NULL };
|
|
215
|
-
if (typeof value === "string") return {
|
|
216
|
-
kind: Kind.STRING,
|
|
217
|
-
value
|
|
218
|
-
};
|
|
219
|
-
if (typeof value === "boolean") return {
|
|
220
|
-
kind: Kind.BOOLEAN,
|
|
221
|
-
value
|
|
222
|
-
};
|
|
223
|
-
if (typeof value === "number") return {
|
|
224
|
-
kind: !Number.isInteger(value) || value.toString().includes(".") ? Kind.FLOAT : Kind.INT,
|
|
225
|
-
value: value.toString()
|
|
226
|
-
};
|
|
227
242
|
if (Array.isArray(value)) return {
|
|
228
243
|
kind: Kind.LIST,
|
|
229
|
-
values: value.map((item) => buildConstValueNode(item)).filter((item) => item !== null)
|
|
244
|
+
values: value.map((item) => buildConstValueNode(item, enumLookup)).filter((item) => item !== null)
|
|
230
245
|
};
|
|
231
246
|
if (typeof value === "object") return {
|
|
232
247
|
kind: Kind.OBJECT,
|
|
233
|
-
fields: Object.entries(value).map(([key,
|
|
234
|
-
|
|
248
|
+
fields: Object.entries(value).map(([key, fieldValue]) => {
|
|
249
|
+
let fieldTypeSpecifier = null;
|
|
250
|
+
if (enumLookup.typeSpecifier?.kind === "input") fieldTypeSpecifier = enumLookup.schema.input[enumLookup.typeSpecifier.name]?.fields[key] ?? null;
|
|
251
|
+
const valueNode = buildConstValueNode(fieldValue, {
|
|
252
|
+
schema: enumLookup.schema,
|
|
253
|
+
typeSpecifier: fieldTypeSpecifier
|
|
254
|
+
});
|
|
235
255
|
return valueNode ? {
|
|
236
256
|
kind: Kind.OBJECT_FIELD,
|
|
237
257
|
name: {
|
|
@@ -242,6 +262,24 @@ const buildConstValueNode = (value) => {
|
|
|
242
262
|
} : null;
|
|
243
263
|
}).filter((item) => item !== null)
|
|
244
264
|
};
|
|
265
|
+
if (typeof value === "string") {
|
|
266
|
+
if (enumLookup.typeSpecifier?.kind === "enum") return {
|
|
267
|
+
kind: Kind.ENUM,
|
|
268
|
+
value
|
|
269
|
+
};
|
|
270
|
+
return {
|
|
271
|
+
kind: Kind.STRING,
|
|
272
|
+
value
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
if (typeof value === "boolean") return {
|
|
276
|
+
kind: Kind.BOOLEAN,
|
|
277
|
+
value
|
|
278
|
+
};
|
|
279
|
+
if (typeof value === "number") return {
|
|
280
|
+
kind: !Number.isInteger(value) || value.toString().includes(".") ? Kind.FLOAT : Kind.INT,
|
|
281
|
+
value: value.toString()
|
|
282
|
+
};
|
|
245
283
|
throw new Error(`Unknown value type: ${typeof value}`);
|
|
246
284
|
};
|
|
247
285
|
/**
|
|
@@ -313,7 +351,7 @@ const buildWithTypeModifier = (modifier, buildType) => {
|
|
|
313
351
|
}
|
|
314
352
|
return curr.type;
|
|
315
353
|
};
|
|
316
|
-
const buildVariables = (variables) => {
|
|
354
|
+
const buildVariables = (variables, schema) => {
|
|
317
355
|
return Object.entries(variables).map(([name, ref]) => ({
|
|
318
356
|
kind: Kind.VARIABLE_DEFINITION,
|
|
319
357
|
variable: {
|
|
@@ -323,7 +361,10 @@ const buildVariables = (variables) => {
|
|
|
323
361
|
value: name
|
|
324
362
|
}
|
|
325
363
|
},
|
|
326
|
-
defaultValue: ref.defaultValue && buildConstValueNode(ref.defaultValue.default
|
|
364
|
+
defaultValue: ref.defaultValue && buildConstValueNode(ref.defaultValue.default, {
|
|
365
|
+
schema,
|
|
366
|
+
typeSpecifier: ref
|
|
367
|
+
}) || void 0,
|
|
327
368
|
type: buildWithTypeModifier(ref.modifier, () => ({
|
|
328
369
|
kind: Kind.NAMED_TYPE,
|
|
329
370
|
name: {
|
|
@@ -351,11 +392,11 @@ const buildOperationTypeNode = (operation) => {
|
|
|
351
392
|
* a GraphQL document AST. The result can be used with any GraphQL
|
|
352
393
|
* client that supports TypedDocumentNode.
|
|
353
394
|
*
|
|
354
|
-
* @param options - Operation configuration (name, type, variables, fields)
|
|
395
|
+
* @param options - Operation configuration (name, type, variables, fields, schema)
|
|
355
396
|
* @returns TypedDocumentNode with inferred input/output types
|
|
356
397
|
*/
|
|
357
398
|
const buildDocument = (options) => {
|
|
358
|
-
const { operationName, operationType, variables, fields } = options;
|
|
399
|
+
const { operationName, operationType, variables, fields, schema } = options;
|
|
359
400
|
return {
|
|
360
401
|
kind: Kind.DOCUMENT,
|
|
361
402
|
definitions: [{
|
|
@@ -365,10 +406,10 @@ const buildDocument = (options) => {
|
|
|
365
406
|
kind: Kind.NAME,
|
|
366
407
|
value: operationName
|
|
367
408
|
},
|
|
368
|
-
variableDefinitions: buildVariables(variables),
|
|
409
|
+
variableDefinitions: buildVariables(variables, schema),
|
|
369
410
|
selectionSet: {
|
|
370
411
|
kind: Kind.SELECTION_SET,
|
|
371
|
-
selections: buildField(fields)
|
|
412
|
+
selections: buildField(fields, schema)
|
|
372
413
|
}
|
|
373
414
|
}]
|
|
374
415
|
};
|
|
@@ -444,6 +485,33 @@ const createDirectiveMethod = (name, locations) => {
|
|
|
444
485
|
});
|
|
445
486
|
};
|
|
446
487
|
/**
|
|
488
|
+
* Creates a typed directive method with argument type specifiers.
|
|
489
|
+
* Enables enum value output in directive arguments.
|
|
490
|
+
*
|
|
491
|
+
* @param name - The directive name (without @)
|
|
492
|
+
* @param locations - Valid locations where the directive can be applied
|
|
493
|
+
* @param argSpecs - Type specifiers for directive arguments
|
|
494
|
+
* @returns A function that creates DirectiveRef instances with argument type info
|
|
495
|
+
*
|
|
496
|
+
* @example
|
|
497
|
+
* ```typescript
|
|
498
|
+
* const authMethod = createTypedDirectiveMethod(
|
|
499
|
+
* "auth",
|
|
500
|
+
* ["FIELD"] as const,
|
|
501
|
+
* { role: { kind: "enum", name: "Role", modifier: "!" } }
|
|
502
|
+
* );
|
|
503
|
+
* const authDirective = authMethod({ role: "ADMIN" });
|
|
504
|
+
* ```
|
|
505
|
+
*/
|
|
506
|
+
const createTypedDirectiveMethod = (name, locations, argSpecs) => {
|
|
507
|
+
return (args) => new DirectiveRef({
|
|
508
|
+
name,
|
|
509
|
+
arguments: args,
|
|
510
|
+
locations,
|
|
511
|
+
argumentSpecs: argSpecs
|
|
512
|
+
});
|
|
513
|
+
};
|
|
514
|
+
/**
|
|
447
515
|
* Standard directive locations for @skip and @include.
|
|
448
516
|
*/
|
|
449
517
|
const CONDITIONAL_DIRECTIVE_LOCATIONS = [
|
|
@@ -793,7 +861,6 @@ var GqlElement = class GqlElement {
|
|
|
793
861
|
* @template TVariables - Variables required when spreading
|
|
794
862
|
* @template TFields - The selected fields structure
|
|
795
863
|
* @template TOutput - Inferred output type from selected fields
|
|
796
|
-
* @template TKey - Optional unique key for prebuilt type lookup
|
|
797
864
|
*/
|
|
798
865
|
var Fragment = class Fragment extends GqlElement {
|
|
799
866
|
constructor(define) {
|
|
@@ -1063,7 +1130,8 @@ const createOperationComposerFactory = (schema, adapter, transformDocument) => {
|
|
|
1063
1130
|
operationName,
|
|
1064
1131
|
operationType,
|
|
1065
1132
|
variables,
|
|
1066
|
-
fields
|
|
1133
|
+
fields,
|
|
1134
|
+
schema
|
|
1067
1135
|
});
|
|
1068
1136
|
const variableNames = Object.keys(variables);
|
|
1069
1137
|
if (!fragmentUsages.some((u) => u.metadataBuilder) && !options.metadata && !transformDocument && !options.transformDocument) return {
|
|
@@ -1407,48 +1475,6 @@ const createGqlElementComposer = (schema, options) => {
|
|
|
1407
1475
|
return composerWithSchema;
|
|
1408
1476
|
};
|
|
1409
1477
|
|
|
1410
|
-
//#endregion
|
|
1411
|
-
//#region packages/core/src/composer/prebuilt-composer.ts
|
|
1412
|
-
/**
|
|
1413
|
-
* Creates a prebuilt GQL element composer for a given schema.
|
|
1414
|
-
*
|
|
1415
|
-
* This composer has the same runtime behavior as `createGqlElementComposer`,
|
|
1416
|
-
* but the returned elements have their types resolved from the PrebuiltTypeRegistry
|
|
1417
|
-
* instead of using complex type inference.
|
|
1418
|
-
*
|
|
1419
|
-
* Use this when bundling with tools like tsdown that may lose type information.
|
|
1420
|
-
*
|
|
1421
|
-
* @param schema - The GraphQL schema definition
|
|
1422
|
-
* @param options - Configuration including input type methods and optional adapter
|
|
1423
|
-
* @returns Prebuilt element composer function
|
|
1424
|
-
*
|
|
1425
|
-
* @example
|
|
1426
|
-
* ```typescript
|
|
1427
|
-
* // Generated by codegen in prebuilt/index.ts
|
|
1428
|
-
* import type { PrebuiltTypes } from "./types";
|
|
1429
|
-
*
|
|
1430
|
-
* const gql = createPrebuiltGqlElementComposer<
|
|
1431
|
-
* Schema,
|
|
1432
|
-
* PrebuiltTypes,
|
|
1433
|
-
* FragmentBuilders,
|
|
1434
|
-
* DirectiveMethods,
|
|
1435
|
-
* Context
|
|
1436
|
-
* >(schema, { inputTypeMethods });
|
|
1437
|
-
*
|
|
1438
|
-
* // Types are resolved from PrebuiltTypes registry
|
|
1439
|
-
* const GetUser = gql(({ query }) =>
|
|
1440
|
-
* query.operation({
|
|
1441
|
-
* name: "GetUser",
|
|
1442
|
-
* fields: ({ f }) => ({ ...f.user({ id: "1" })(({ f }) => ({ ...f.id() })) }),
|
|
1443
|
-
* })
|
|
1444
|
-
* );
|
|
1445
|
-
* // GetUser.$infer.output is PrebuiltTypes["operations"]["GetUser"]["output"]
|
|
1446
|
-
* ```
|
|
1447
|
-
*/
|
|
1448
|
-
const createPrebuiltGqlElementComposer = (schema, options) => {
|
|
1449
|
-
return createGqlElementComposer(schema, options);
|
|
1450
|
-
};
|
|
1451
|
-
|
|
1452
1478
|
//#endregion
|
|
1453
1479
|
//#region packages/core/src/prebuilt/type-calculator.ts
|
|
1454
1480
|
/**
|
|
@@ -1701,5 +1727,5 @@ const generateInputTypeFromSpecifiers = (schema, specifiers, options = {}) => {
|
|
|
1701
1727
|
};
|
|
1702
1728
|
|
|
1703
1729
|
//#endregion
|
|
1704
|
-
export { Fragment, GqlElement, Operation, VarRef, appendToPath, applyTypeModifier, buildArgumentValue, buildConstValueNode, buildDocument, buildOperationTypeNode, buildWithTypeModifier, calculateFieldType, calculateFieldsType, createColocateHelper, createDefaultAdapter, createDirectiveBuilder, createDirectiveMethod, createFieldFactories, createGqlElementComposer, createGqlFragmentComposers, createOperationComposerFactory,
|
|
1730
|
+
export { Fragment, GqlElement, Operation, VarRef, appendToPath, applyTypeModifier, buildArgumentValue, buildConstValueNode, buildDocument, buildOperationTypeNode, buildWithTypeModifier, calculateFieldType, calculateFieldsType, createColocateHelper, createDefaultAdapter, createDirectiveBuilder, createDirectiveMethod, createFieldFactories, createGqlElementComposer, createGqlFragmentComposers, createOperationComposerFactory, createStandardDirectives, createTypedDirectiveMethod, createVarAssignments, createVarBuilder, createVarMethod, createVarMethodFactory, createVarRefFromVariable, createVarRefs, defaultMetadataAdapter, defineEnum, defineOperationRoots, defineScalar, generateInputObjectType, generateInputType, generateInputTypeFromSpecifiers, getCurrentFieldPath, getEnumType, getScalarInputType, getScalarOutputType, graphqlTypeToTypeScript, isDirectiveRef, isListType, recordFragmentUsage, withFieldPath, withFragmentUsageCollection };
|
|
1705
1731
|
//# sourceMappingURL=index.js.map
|