@soda-gql/core 0.11.13 → 0.11.15
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/adapter.d.cts +2 -2
- package/dist/adapter.d.ts +2 -2
- package/dist/{index-CULnRHFI.d.ts → index-Bp47e62s.d.cts} +116 -54
- package/dist/index-Bp47e62s.d.cts.map +1 -0
- package/dist/{index-Bj60NxMb.d.cts → index-ByiZ8zW7.d.ts} +12 -7
- package/dist/{index-DbANHktR.d.ts.map → index-ByiZ8zW7.d.ts.map} +1 -1
- package/dist/{index-DbANHktR.d.ts → index-VL5qHoc7.d.cts} +12 -7
- package/dist/{index-Bj60NxMb.d.cts.map → index-VL5qHoc7.d.cts.map} +1 -1
- package/dist/{index-DT6mTMaZ.d.cts → index-cM-IJSAr.d.ts} +116 -54
- package/dist/index-cM-IJSAr.d.ts.map +1 -0
- package/dist/index.cjs +86 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +86 -12
- package/dist/index.js.map +1 -1
- package/dist/runtime.d.cts +2 -2
- package/dist/runtime.d.ts +2 -2
- package/dist/{schema-builder-YC3vPw7X.d.cts → schema-builder-BWRKX1z0.d.cts} +2 -2
- package/dist/{schema-builder-YC3vPw7X.d.cts.map → schema-builder-BWRKX1z0.d.cts.map} +1 -1
- package/dist/{schema-builder-B5zSZzZO.d.ts → schema-builder-DapSlk1_.d.ts} +2 -2
- package/dist/{schema-builder-B5zSZzZO.d.ts.map → schema-builder-DapSlk1_.d.ts.map} +1 -1
- package/package.json +1 -1
- package/dist/index-CULnRHFI.d.ts.map +0 -1
- package/dist/index-DT6mTMaZ.d.cts.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { $ as createVarAssignments, $t as AttachmentShape, A as AnyGqlContext, An as
|
|
3
|
-
import { n as defineOperationRoots, r as defineScalar, t as defineEnum } from "./schema-builder-
|
|
1
|
+
import { $ as CreatableOutputTypeKind, A as InputDefinition, At as GetInputTypeDepth, B as UnionMemberName, Bt as isListType, C as AnyFieldName, Ct as ApplyTypeModifier, D as InferInputKind, Dt as DecrementDepth, E as EnumDefinition, Et as ValidTypeModifier, F as OperationType, Ft as ConstValues, G as NestedValueElement, H as AnyVarRef, I as PickTypeSpecifierByFieldName, It as FieldPath, J as createVarRefFromNestedValue, K as VarRef, L as ResolveInputProfileFromMeta, Lt as FieldPathSegment, M as ObjectDefinition, Mt as IsDepthExhausted, N as ObjectFieldRecord, Nt as NumberToDepth, O as InferInputProfile, Ot as DefaultDepth, P as OperationRoots, Pt as ConstValue, Q as CreatableInputTypeKind, R as ScalarDefinition, Rt as appendToPath, S as AllInputTypeNames, St as TypeProfile, T as AnyTypeName, Tt as TypeModifier, U as AnyVarRefBrand, V as UnionTypeRecord, Vt as withFieldPath, W as NestedValue, X as AnyDefaultValue, Y as createVarRefFromVariable, Z as AnyTypeSpecifier, _ as FragmentMetadataBuilder, _t as OutputUnionSpecifier, a as DefaultMetadataAdapter, at as InputTypeKind, b as MetadataBuilderTools, bt as ObjectTypeProfile, c as ExtractAdapterTypes, ct as OutputEnumSpecifier, d as MetadataAdapter, dt as OutputObjectSpecifier, et as InputEnumSpecifier, f as OperationDocumentTransformArgs, ft as OutputScalarSpecifier, g as ExtractMetadata, gt as OutputTypenameSpecifier, h as defaultMetadataAdapter, ht as OutputTypeSpecifiers, i as DefaultAdapter, it as InputScalarSpecifier, j as InputFieldRecord, jt as InputDepthOverrides, k as InferOutputProfile, kt as DepthCounter, l as ExtractUnifiedAdapterTypes, lt as OutputExcludedSpecifier, m as createDefaultAdapter, mt as OutputTypeSpecifier, n as AnyAdapter, nt as InputInferrableTypeSpecifier, o as DocumentTransformArgs, ot as InputTypeSpecifier, p as OperationDocumentTransformer, pt as OutputTypeKind, q as VarRefInner, r as AnyMetadataAdapter, rt as InputInputObjectSpecifier, s as DocumentTransformer, st as InputTypeSpecifiers, t as Adapter, tt as InputExcludedSpecifier, u as FragmentMetaInfo, ut as OutputInferrableTypeSpecifier, v as FragmentMetadataBuilderTools, vt as GetConstAssignableType, w as AnyGraphqlSchema, wt as GetSignature, x as OperationMetadata, xt as PrimitiveTypeProfile, y as MetadataBuilder, yt as GetModifiedType, z as UnionDefinition, zt as getCurrentFieldPath } from "./index-VL5qHoc7.cjs";
|
|
2
|
+
import { $ as createVarAssignments, $t as AttachmentShape, A as AnyGqlContext, An as AnyAssignableInput, At as GqlElementDefinitionFactory, B as SchemaAwareGetNameAt, Bn as ConstAssignableInput, Bt as FieldSelectionFactoryPrimitiveReturn, C as getScalarInputType, Cn as AnyNestedUnion, Ct as FragmentInferMeta, D as OperationCoreParams, Dn as InferFieldsExtended, Dt as GqlElement, E as OperationArtifactResult, En as InferFields, Et as GqlDefine, F as GqlElementComposerWithSchema, Fn as DeclaredVariables, Ft as AnyFieldSelectionFactoryReturn, G as createVarBuilder, Gn as DirectiveArgumentSpecifier, Gt as NestedObjectFieldsBuilder, H as VarBuilder, Hn as GetAssignableType, Ht as FieldSelectionFactoryUnionReturn, I as createGqlElementComposer, In as FieldArgumentValue, It as FieldSelectionFactories, J as FragmentUsageRecord, Jn as DirectiveRefInner, Jt as EmptyObject, K as createVarMethod, Kn as DirectiveLocation, Kt as NestedObjectFieldsBuilderTools, L as InputTypeMethod, Ln as AnyConstDirectiveAttachments, Lt as FieldSelectionFactory, M as FragmentBuildersAll, Mn as AnyAssigningInput, Mt as CompatSpec, N as GqlElementComposer, Nn as AssignableInput, Nt as ExtractCompatSpec, O as buildOperationArtifact, On as ScalarShorthand, Ot as GqlElementAttachment, P as GqlElementComposerOptions, Pn as AssignableInputByFieldName, Pt as AnyFieldSelectionFactory, Q as createGqlFragmentComposers, Qt as empty, R as InputTypeMethods, Rn as AnyConstAssignableInput, Rt as FieldSelectionFactoryFieldArguments, S as getEnumType, Sn as AnyNestedObjectExtended, St as Fragment, T as graphqlTypeToTypeScript, Tn as InferField, Tt as DefineInferMeta, U as VarBuilderMethods, Un as AnyDirectiveRef, Ut as FieldsBuilder, V as SchemaAwareGetValueAt, Vn as ConstAssignableInputValue, Vt as FieldSelectionFactoryReturn, W as VarSpecifier, Wn as AnyDirectiveRefBrand, Wt as FieldsBuilderTools, X as withFragmentUsageCollection, Xn as TypeSystemDirectiveLocation, Xt as OptionalArg, Y as recordFragmentUsage, Yn as ExecutableDirectiveLocation, Yt as IfOmittable, Z as FragmentBuilderFor, Zt as SwitchIfOmittable, _ as calculateFieldType, _n as AnyFieldSelection, _t as AnyOperation, a as HasPrebuiltFragment, an as createColocateHelper, at as DirectiveArgValue, b as generateInputType, bn as AnyFieldsExtended, bt as OperationInferMeta, c as PrebuiltFragmentInput, cn as Tuple, ct as DirectiveMethod, d as PrebuiltOperationOutput, dn as buildArgumentValue, dt as createDirectiveMethod, en as AttachmentToProperty, et as createVarRefs, f as PrebuiltTypeRegistry, fn as buildConstValueNode, ft as createStandardDirectives, g as applyTypeModifier, gn as AbstractFieldSelection, gt as createCompatComposer, h as TypeFormatters, hn as buildWithTypeModifier, ht as CompatOptions, i as EmptyPrebuiltTypeRegistry, in as ColocatedFields, it as AnyDirectiveMethod, j as ExtractMetadataAdapter, jn as AnyAssignableInputValue, jt as AnyCompatSpec, k as createOperationComposerFactory, kn as AnyDirectiveAttachments, kt as GqlElementContext, l as PrebuiltFragmentOutput, ln as UnionToIntersection, lt as StandardDirectives, m as GenerateInputObjectTypeOptions, mn as buildOperationTypeNode, mt as isDirectiveRef, n as Hidden, nn as ColocateHelper, nt as ExtendOptions, o as HasPrebuiltOperation, on as StripFunctions, ot as DirectiveArgumentSpecifiers, p as PrebuiltUnknownElement, pn as buildDocument, pt as createTypedDirectiveMethod, q as createVarMethodFactory, qn as DirectiveRef, qt as NestedUnionFieldsBuilder, r as hidden, rn as ColocatedEntries, rt as createExtendComposer, s as PrebuiltEntryNotFound, sn as StripSymbols, st as DirectiveBuilder, t as wrapByKey, tn as AttachmentsTupleToIntersection, tt as createFieldFactories, u as PrebuiltOperationInput, un as EnumLookup, ut as createDirectiveBuilder, v as calculateFieldsType, vn as AnyFieldValue, vt as AnyOperationOf, w as getScalarOutputType, wn as FieldSelectionTemplateOf, wt as AnyGqlDefine, x as generateInputTypeFromSpecifiers, xn as AnyNestedObject, xt as AnyFragment, y as generateInputObjectType, yn as AnyFields, yt as Operation, z as ResolveTypeFromMeta, zn as AnyConstAssignableInputValue, zt as FieldSelectionFactoryObjectReturn } from "./index-Bp47e62s.cjs";
|
|
3
|
+
import { n as defineOperationRoots, r as defineScalar, t as defineEnum } from "./schema-builder-BWRKX1z0.cjs";
|
|
4
4
|
|
|
5
5
|
//#region packages/core/src/types/type-foundation/modified-type-name.d.ts
|
|
6
6
|
type ModifiedTypeName<TNameCandidate extends [string], TName extends TNameCandidate[0], TModifier extends TypeModifier> = [string] extends TNameCandidate ? `${TName}:${TModifier}` : TNameCandidate extends [TName] ?
|
|
@@ -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, AnyCompatSpec, AnyConstAssignableInput, AnyConstAssignableInputValue, AnyConstDirectiveAttachments, AnyDefaultValue, AnyDirectiveAttachments, AnyDirectiveMethod, AnyDirectiveRef, AnyDirectiveRefBrand, AnyFieldName, AnyFieldSelection, AnyFieldSelectionFactory, AnyFieldSelectionFactoryReturn, AnyFields, AnyFragment, AnyGqlContext, AnyGqlDefine, AnyGraphqlSchema, AnyMetadataAdapter, AnyNestedObject, AnyNestedUnion, AnyOperation, AnyOperationOf, AnyTypeName, AnyTypeSpecifier, AnyVarRef, AnyVarRefBrand, ApplyTypeModifier, AssignableInput, AssignableInputByFieldName, AttachmentShape, AttachmentToProperty, AttachmentsTupleToIntersection, ColocateHelper, ColocatedEntries, ColocatedFields, CompatOptions, CompatSpec, ConstAssignableInput, ConstAssignableInputValue, ConstValue, ConstValues, DeclaredVariables, DecrementDepth, DefaultAdapter, DefaultDepth, DefaultMetadataAdapter, DefineInferMeta, DepthCounter, DirectiveArgValue, DirectiveArgumentSpecifier, DirectiveArgumentSpecifiers, DirectiveBuilder, DirectiveLocation, DirectiveMethod, DirectiveRef, DirectiveRefInner, DocumentTransformArgs, DocumentTransformer, EmptyObject, EmptyPrebuiltTypeRegistry, EnumDefinition, EnumLookup, ExecutableDirectiveLocation, ExtendOptions, ExtractAdapterTypes, ExtractCompatSpec, 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, GqlDefine, 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, OperationArtifactResult, OperationCoreParams, 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, buildOperationArtifact, buildOperationTypeNode, buildWithTypeModifier, calculateFieldType, calculateFieldsType, createColocateHelper, createCompatComposer, createDefaultAdapter, createDirectiveBuilder, createDirectiveMethod, createExtendComposer, 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 };
|
|
14
|
+
export { AbstractFieldSelection, Adapter, AllInputTypeNames, AnyAdapter, AnyAssignableInput, AnyAssignableInputValue, AnyAssigningInput, AnyCompatSpec, AnyConstAssignableInput, AnyConstAssignableInputValue, AnyConstDirectiveAttachments, AnyDefaultValue, AnyDirectiveAttachments, AnyDirectiveMethod, AnyDirectiveRef, AnyDirectiveRefBrand, AnyFieldName, AnyFieldSelection, AnyFieldSelectionFactory, AnyFieldSelectionFactoryReturn, AnyFieldValue, AnyFields, AnyFieldsExtended, AnyFragment, AnyGqlContext, AnyGqlDefine, AnyGraphqlSchema, AnyMetadataAdapter, AnyNestedObject, AnyNestedObjectExtended, AnyNestedUnion, AnyOperation, AnyOperationOf, AnyTypeName, AnyTypeSpecifier, AnyVarRef, AnyVarRefBrand, ApplyTypeModifier, AssignableInput, AssignableInputByFieldName, AttachmentShape, AttachmentToProperty, AttachmentsTupleToIntersection, ColocateHelper, ColocatedEntries, ColocatedFields, CompatOptions, CompatSpec, ConstAssignableInput, ConstAssignableInputValue, ConstValue, ConstValues, CreatableInputTypeKind, CreatableOutputTypeKind, DeclaredVariables, DecrementDepth, DefaultAdapter, DefaultDepth, DefaultMetadataAdapter, DefineInferMeta, DepthCounter, DirectiveArgValue, DirectiveArgumentSpecifier, DirectiveArgumentSpecifiers, DirectiveBuilder, DirectiveLocation, DirectiveMethod, DirectiveRef, DirectiveRefInner, DocumentTransformArgs, DocumentTransformer, EmptyObject, EmptyPrebuiltTypeRegistry, EnumDefinition, EnumLookup, ExecutableDirectiveLocation, ExtendOptions, ExtractAdapterTypes, ExtractCompatSpec, 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, GqlDefine, GqlElement, GqlElementAttachment, GqlElementComposer, GqlElementComposerOptions, GqlElementComposerWithSchema, GqlElementContext, GqlElementDefinitionFactory, HasPrebuiltFragment, HasPrebuiltOperation, Hidden, IfOmittable, InferField, InferFields, InferFieldsExtended, InferInputKind, InferInputProfile, InferOutputProfile, InputDefinition, InputDepthOverrides, InputEnumSpecifier, InputExcludedSpecifier, InputFieldRecord, InputInferrableTypeSpecifier, InputInputObjectSpecifier, InputScalarSpecifier, InputTypeKind, InputTypeMethod, InputTypeMethods, InputTypeSpecifier, InputTypeSpecifiers, IsDepthExhausted, MetadataAdapter, MetadataBuilder, MetadataBuilderTools, ModifiedTypeName, NestedObjectFieldsBuilder, NestedObjectFieldsBuilderTools, NestedUnionFieldsBuilder, NestedValue, NestedValueElement, NumberToDepth, ObjectDefinition, ObjectFieldRecord, ObjectTypeProfile, Operation, OperationArtifactResult, OperationCoreParams, OperationDocumentTransformArgs, OperationDocumentTransformer, OperationInferMeta, OperationMetadata, OperationRoots, OperationType, OptionalArg, OutputEnumSpecifier, OutputExcludedSpecifier, OutputInferrableTypeSpecifier, OutputObjectSpecifier, OutputScalarSpecifier, OutputTypeKind, OutputTypeSpecifier, OutputTypeSpecifiers, OutputTypenameSpecifier, OutputUnionSpecifier, PickTypeSpecifierByFieldName, PrebuiltEntryNotFound, PrebuiltFragmentInput, PrebuiltFragmentOutput, PrebuiltOperationInput, PrebuiltOperationOutput, PrebuiltTypeRegistry, PrebuiltUnknownElement, PrimitiveTypeProfile, ResolveInputProfileFromMeta, ResolveTypeFromMeta, ScalarDefinition, ScalarShorthand, 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, buildOperationArtifact, buildOperationTypeNode, buildWithTypeModifier, calculateFieldType, calculateFieldsType, createColocateHelper, createCompatComposer, createDefaultAdapter, createDirectiveBuilder, createDirectiveMethod, createExtendComposer, 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,6 +1,6 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { $ as createVarAssignments, $t as AttachmentShape, A as AnyGqlContext, An as
|
|
3
|
-
import { n as defineOperationRoots, r as defineScalar, t as defineEnum } from "./schema-builder-
|
|
1
|
+
import { $ as CreatableOutputTypeKind, A as InputDefinition, At as GetInputTypeDepth, B as UnionMemberName, Bt as isListType, C as AnyFieldName, Ct as ApplyTypeModifier, D as InferInputKind, Dt as DecrementDepth, E as EnumDefinition, Et as ValidTypeModifier, F as OperationType, Ft as ConstValues, G as NestedValueElement, H as AnyVarRef, I as PickTypeSpecifierByFieldName, It as FieldPath, J as createVarRefFromNestedValue, K as VarRef, L as ResolveInputProfileFromMeta, Lt as FieldPathSegment, M as ObjectDefinition, Mt as IsDepthExhausted, N as ObjectFieldRecord, Nt as NumberToDepth, O as InferInputProfile, Ot as DefaultDepth, P as OperationRoots, Pt as ConstValue, Q as CreatableInputTypeKind, R as ScalarDefinition, Rt as appendToPath, S as AllInputTypeNames, St as TypeProfile, T as AnyTypeName, Tt as TypeModifier, U as AnyVarRefBrand, V as UnionTypeRecord, Vt as withFieldPath, W as NestedValue, X as AnyDefaultValue, Y as createVarRefFromVariable, Z as AnyTypeSpecifier, _ as FragmentMetadataBuilder, _t as OutputUnionSpecifier, a as DefaultMetadataAdapter, at as InputTypeKind, b as MetadataBuilderTools, bt as ObjectTypeProfile, c as ExtractAdapterTypes, ct as OutputEnumSpecifier, d as MetadataAdapter, dt as OutputObjectSpecifier, et as InputEnumSpecifier, f as OperationDocumentTransformArgs, ft as OutputScalarSpecifier, g as ExtractMetadata, gt as OutputTypenameSpecifier, h as defaultMetadataAdapter, ht as OutputTypeSpecifiers, i as DefaultAdapter, it as InputScalarSpecifier, j as InputFieldRecord, jt as InputDepthOverrides, k as InferOutputProfile, kt as DepthCounter, l as ExtractUnifiedAdapterTypes, lt as OutputExcludedSpecifier, m as createDefaultAdapter, mt as OutputTypeSpecifier, n as AnyAdapter, nt as InputInferrableTypeSpecifier, o as DocumentTransformArgs, ot as InputTypeSpecifier, p as OperationDocumentTransformer, pt as OutputTypeKind, q as VarRefInner, r as AnyMetadataAdapter, rt as InputInputObjectSpecifier, s as DocumentTransformer, st as InputTypeSpecifiers, t as Adapter, tt as InputExcludedSpecifier, u as FragmentMetaInfo, ut as OutputInferrableTypeSpecifier, v as FragmentMetadataBuilderTools, vt as GetConstAssignableType, w as AnyGraphqlSchema, wt as GetSignature, x as OperationMetadata, xt as PrimitiveTypeProfile, y as MetadataBuilder, yt as GetModifiedType, z as UnionDefinition, zt as getCurrentFieldPath } from "./index-ByiZ8zW7.js";
|
|
2
|
+
import { $ as createVarAssignments, $t as AttachmentShape, A as AnyGqlContext, An as AnyAssignableInput, At as GqlElementDefinitionFactory, B as SchemaAwareGetNameAt, Bn as ConstAssignableInput, Bt as FieldSelectionFactoryPrimitiveReturn, C as getScalarInputType, Cn as AnyNestedUnion, Ct as FragmentInferMeta, D as OperationCoreParams, Dn as InferFieldsExtended, Dt as GqlElement, E as OperationArtifactResult, En as InferFields, Et as GqlDefine, F as GqlElementComposerWithSchema, Fn as DeclaredVariables, Ft as AnyFieldSelectionFactoryReturn, G as createVarBuilder, Gn as DirectiveArgumentSpecifier, Gt as NestedObjectFieldsBuilder, H as VarBuilder, Hn as GetAssignableType, Ht as FieldSelectionFactoryUnionReturn, I as createGqlElementComposer, In as FieldArgumentValue, It as FieldSelectionFactories, J as FragmentUsageRecord, Jn as DirectiveRefInner, Jt as EmptyObject, K as createVarMethod, Kn as DirectiveLocation, Kt as NestedObjectFieldsBuilderTools, L as InputTypeMethod, Ln as AnyConstDirectiveAttachments, Lt as FieldSelectionFactory, M as FragmentBuildersAll, Mn as AnyAssigningInput, Mt as CompatSpec, N as GqlElementComposer, Nn as AssignableInput, Nt as ExtractCompatSpec, O as buildOperationArtifact, On as ScalarShorthand, Ot as GqlElementAttachment, P as GqlElementComposerOptions, Pn as AssignableInputByFieldName, Pt as AnyFieldSelectionFactory, Q as createGqlFragmentComposers, Qt as empty, R as InputTypeMethods, Rn as AnyConstAssignableInput, Rt as FieldSelectionFactoryFieldArguments, S as getEnumType, Sn as AnyNestedObjectExtended, St as Fragment, T as graphqlTypeToTypeScript, Tn as InferField, Tt as DefineInferMeta, U as VarBuilderMethods, Un as AnyDirectiveRef, Ut as FieldsBuilder, V as SchemaAwareGetValueAt, Vn as ConstAssignableInputValue, Vt as FieldSelectionFactoryReturn, W as VarSpecifier, Wn as AnyDirectiveRefBrand, Wt as FieldsBuilderTools, X as withFragmentUsageCollection, Xn as TypeSystemDirectiveLocation, Xt as OptionalArg, Y as recordFragmentUsage, Yn as ExecutableDirectiveLocation, Yt as IfOmittable, Z as FragmentBuilderFor, Zt as SwitchIfOmittable, _ as calculateFieldType, _n as AnyFieldSelection, _t as AnyOperation, a as HasPrebuiltFragment, an as createColocateHelper, at as DirectiveArgValue, b as generateInputType, bn as AnyFieldsExtended, bt as OperationInferMeta, c as PrebuiltFragmentInput, cn as Tuple, ct as DirectiveMethod, d as PrebuiltOperationOutput, dn as buildArgumentValue, dt as createDirectiveMethod, en as AttachmentToProperty, et as createVarRefs, f as PrebuiltTypeRegistry, fn as buildConstValueNode, ft as createStandardDirectives, g as applyTypeModifier, gn as AbstractFieldSelection, gt as createCompatComposer, h as TypeFormatters, hn as buildWithTypeModifier, ht as CompatOptions, i as EmptyPrebuiltTypeRegistry, in as ColocatedFields, it as AnyDirectiveMethod, j as ExtractMetadataAdapter, jn as AnyAssignableInputValue, jt as AnyCompatSpec, k as createOperationComposerFactory, kn as AnyDirectiveAttachments, kt as GqlElementContext, l as PrebuiltFragmentOutput, ln as UnionToIntersection, lt as StandardDirectives, m as GenerateInputObjectTypeOptions, mn as buildOperationTypeNode, mt as isDirectiveRef, n as Hidden, nn as ColocateHelper, nt as ExtendOptions, o as HasPrebuiltOperation, on as StripFunctions, ot as DirectiveArgumentSpecifiers, p as PrebuiltUnknownElement, pn as buildDocument, pt as createTypedDirectiveMethod, q as createVarMethodFactory, qn as DirectiveRef, qt as NestedUnionFieldsBuilder, r as hidden, rn as ColocatedEntries, rt as createExtendComposer, s as PrebuiltEntryNotFound, sn as StripSymbols, st as DirectiveBuilder, t as wrapByKey, tn as AttachmentsTupleToIntersection, tt as createFieldFactories, u as PrebuiltOperationInput, un as EnumLookup, ut as createDirectiveBuilder, v as calculateFieldsType, vn as AnyFieldValue, vt as AnyOperationOf, w as getScalarOutputType, wn as FieldSelectionTemplateOf, wt as AnyGqlDefine, x as generateInputTypeFromSpecifiers, xn as AnyNestedObject, xt as AnyFragment, y as generateInputObjectType, yn as AnyFields, yt as Operation, z as ResolveTypeFromMeta, zn as AnyConstAssignableInputValue, zt as FieldSelectionFactoryObjectReturn } from "./index-cM-IJSAr.js";
|
|
3
|
+
import { n as defineOperationRoots, r as defineScalar, t as defineEnum } from "./schema-builder-DapSlk1_.js";
|
|
4
4
|
|
|
5
5
|
//#region packages/core/src/types/type-foundation/modified-type-name.d.ts
|
|
6
6
|
type ModifiedTypeName<TNameCandidate extends [string], TName extends TNameCandidate[0], TModifier extends TypeModifier> = [string] extends TNameCandidate ? `${TName}:${TModifier}` : TNameCandidate extends [TName] ?
|
|
@@ -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, AnyCompatSpec, AnyConstAssignableInput, AnyConstAssignableInputValue, AnyConstDirectiveAttachments, AnyDefaultValue, AnyDirectiveAttachments, AnyDirectiveMethod, AnyDirectiveRef, AnyDirectiveRefBrand, AnyFieldName, AnyFieldSelection, AnyFieldSelectionFactory, AnyFieldSelectionFactoryReturn, AnyFields, AnyFragment, AnyGqlContext, AnyGqlDefine, AnyGraphqlSchema, AnyMetadataAdapter, AnyNestedObject, AnyNestedUnion, AnyOperation, AnyOperationOf, AnyTypeName, AnyTypeSpecifier, AnyVarRef, AnyVarRefBrand, ApplyTypeModifier, AssignableInput, AssignableInputByFieldName, AttachmentShape, AttachmentToProperty, AttachmentsTupleToIntersection, ColocateHelper, ColocatedEntries, ColocatedFields, CompatOptions, CompatSpec, ConstAssignableInput, ConstAssignableInputValue, ConstValue, ConstValues, DeclaredVariables, DecrementDepth, DefaultAdapter, DefaultDepth, DefaultMetadataAdapter, DefineInferMeta, DepthCounter, DirectiveArgValue, DirectiveArgumentSpecifier, DirectiveArgumentSpecifiers, DirectiveBuilder, DirectiveLocation, DirectiveMethod, DirectiveRef, DirectiveRefInner, DocumentTransformArgs, DocumentTransformer, EmptyObject, EmptyPrebuiltTypeRegistry, EnumDefinition, EnumLookup, ExecutableDirectiveLocation, ExtendOptions, ExtractAdapterTypes, ExtractCompatSpec, 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, GqlDefine, 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, OperationArtifactResult, OperationCoreParams, 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, buildOperationArtifact, buildOperationTypeNode, buildWithTypeModifier, calculateFieldType, calculateFieldsType, createColocateHelper, createCompatComposer, createDefaultAdapter, createDirectiveBuilder, createDirectiveMethod, createExtendComposer, 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 };
|
|
14
|
+
export { AbstractFieldSelection, Adapter, AllInputTypeNames, AnyAdapter, AnyAssignableInput, AnyAssignableInputValue, AnyAssigningInput, AnyCompatSpec, AnyConstAssignableInput, AnyConstAssignableInputValue, AnyConstDirectiveAttachments, AnyDefaultValue, AnyDirectiveAttachments, AnyDirectiveMethod, AnyDirectiveRef, AnyDirectiveRefBrand, AnyFieldName, AnyFieldSelection, AnyFieldSelectionFactory, AnyFieldSelectionFactoryReturn, AnyFieldValue, AnyFields, AnyFieldsExtended, AnyFragment, AnyGqlContext, AnyGqlDefine, AnyGraphqlSchema, AnyMetadataAdapter, AnyNestedObject, AnyNestedObjectExtended, AnyNestedUnion, AnyOperation, AnyOperationOf, AnyTypeName, AnyTypeSpecifier, AnyVarRef, AnyVarRefBrand, ApplyTypeModifier, AssignableInput, AssignableInputByFieldName, AttachmentShape, AttachmentToProperty, AttachmentsTupleToIntersection, ColocateHelper, ColocatedEntries, ColocatedFields, CompatOptions, CompatSpec, ConstAssignableInput, ConstAssignableInputValue, ConstValue, ConstValues, CreatableInputTypeKind, CreatableOutputTypeKind, DeclaredVariables, DecrementDepth, DefaultAdapter, DefaultDepth, DefaultMetadataAdapter, DefineInferMeta, DepthCounter, DirectiveArgValue, DirectiveArgumentSpecifier, DirectiveArgumentSpecifiers, DirectiveBuilder, DirectiveLocation, DirectiveMethod, DirectiveRef, DirectiveRefInner, DocumentTransformArgs, DocumentTransformer, EmptyObject, EmptyPrebuiltTypeRegistry, EnumDefinition, EnumLookup, ExecutableDirectiveLocation, ExtendOptions, ExtractAdapterTypes, ExtractCompatSpec, 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, GqlDefine, GqlElement, GqlElementAttachment, GqlElementComposer, GqlElementComposerOptions, GqlElementComposerWithSchema, GqlElementContext, GqlElementDefinitionFactory, HasPrebuiltFragment, HasPrebuiltOperation, Hidden, IfOmittable, InferField, InferFields, InferFieldsExtended, InferInputKind, InferInputProfile, InferOutputProfile, InputDefinition, InputDepthOverrides, InputEnumSpecifier, InputExcludedSpecifier, InputFieldRecord, InputInferrableTypeSpecifier, InputInputObjectSpecifier, InputScalarSpecifier, InputTypeKind, InputTypeMethod, InputTypeMethods, InputTypeSpecifier, InputTypeSpecifiers, IsDepthExhausted, MetadataAdapter, MetadataBuilder, MetadataBuilderTools, ModifiedTypeName, NestedObjectFieldsBuilder, NestedObjectFieldsBuilderTools, NestedUnionFieldsBuilder, NestedValue, NestedValueElement, NumberToDepth, ObjectDefinition, ObjectFieldRecord, ObjectTypeProfile, Operation, OperationArtifactResult, OperationCoreParams, OperationDocumentTransformArgs, OperationDocumentTransformer, OperationInferMeta, OperationMetadata, OperationRoots, OperationType, OptionalArg, OutputEnumSpecifier, OutputExcludedSpecifier, OutputInferrableTypeSpecifier, OutputObjectSpecifier, OutputScalarSpecifier, OutputTypeKind, OutputTypeSpecifier, OutputTypeSpecifiers, OutputTypenameSpecifier, OutputUnionSpecifier, PickTypeSpecifierByFieldName, PrebuiltEntryNotFound, PrebuiltFragmentInput, PrebuiltFragmentOutput, PrebuiltOperationInput, PrebuiltOperationOutput, PrebuiltTypeRegistry, PrebuiltUnknownElement, PrimitiveTypeProfile, ResolveInputProfileFromMeta, ResolveTypeFromMeta, ScalarDefinition, ScalarShorthand, 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, buildOperationArtifact, buildOperationTypeNode, buildWithTypeModifier, calculateFieldType, calculateFieldsType, createColocateHelper, createCompatComposer, createDefaultAdapter, createDirectiveBuilder, createDirectiveMethod, createExtendComposer, 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
|
@@ -187,6 +187,36 @@ const buildDirectives = (directives, location, schema) => {
|
|
|
187
187
|
};
|
|
188
188
|
});
|
|
189
189
|
};
|
|
190
|
+
/**
|
|
191
|
+
* Check if value is shorthand (true) vs factory return (AnyFieldSelection).
|
|
192
|
+
* Used for field selection shorthand syntax support.
|
|
193
|
+
*/
|
|
194
|
+
const isShorthand = (value) => {
|
|
195
|
+
return value === true;
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* Expand shorthand to AnyFieldSelection using schema type info.
|
|
199
|
+
* Used at document build time to convert `true` to full field selection.
|
|
200
|
+
*
|
|
201
|
+
* @param schema - The GraphQL schema
|
|
202
|
+
* @param typeName - The parent object type name
|
|
203
|
+
* @param fieldName - The field name to select
|
|
204
|
+
*/
|
|
205
|
+
const expandShorthand = (schema, typeName, fieldName) => {
|
|
206
|
+
const typeDef = schema.object[typeName];
|
|
207
|
+
if (!typeDef) throw new Error(`Type "${typeName}" not found in schema`);
|
|
208
|
+
const fieldSpec = typeDef.fields[fieldName];
|
|
209
|
+
if (!fieldSpec) throw new Error(`Field "${fieldName}" not found on type "${typeName}"`);
|
|
210
|
+
return {
|
|
211
|
+
parent: typeName,
|
|
212
|
+
field: fieldName,
|
|
213
|
+
type: fieldSpec,
|
|
214
|
+
args: {},
|
|
215
|
+
directives: [],
|
|
216
|
+
object: null,
|
|
217
|
+
union: null
|
|
218
|
+
};
|
|
219
|
+
};
|
|
190
220
|
const buildUnionSelection = (union, schema) => Object.entries(union).map(([typeName, object]) => {
|
|
191
221
|
return object ? {
|
|
192
222
|
kind: Kind.INLINE_FRAGMENT,
|
|
@@ -199,19 +229,28 @@ const buildUnionSelection = (union, schema) => Object.entries(union).map(([typeN
|
|
|
199
229
|
},
|
|
200
230
|
selectionSet: {
|
|
201
231
|
kind: Kind.SELECTION_SET,
|
|
202
|
-
selections: buildField(object, schema)
|
|
232
|
+
selections: buildField(object, schema, typeName)
|
|
203
233
|
}
|
|
204
234
|
} : null;
|
|
205
235
|
}).filter((item) => item !== null);
|
|
206
|
-
|
|
236
|
+
/**
|
|
237
|
+
* Builds field nodes from extended fields map.
|
|
238
|
+
* Supports both shorthand (true) and factory (AnyFieldSelection) syntax.
|
|
239
|
+
*
|
|
240
|
+
* @param fields - Field selections (shorthand or factory)
|
|
241
|
+
* @param schema - The GraphQL schema
|
|
242
|
+
* @param typeName - Parent type name (required for shorthand expansion)
|
|
243
|
+
*/
|
|
244
|
+
const buildField = (fields, schema, typeName) => Object.entries(fields).map(([alias, value]) => {
|
|
245
|
+
const { args, field, object, union, directives, type } = isShorthand(value) ? expandShorthand(schema, typeName, alias) : value;
|
|
207
246
|
const builtDirectives = buildDirectives(directives, "FIELD", schema);
|
|
208
247
|
return {
|
|
209
248
|
kind: Kind.FIELD,
|
|
210
249
|
name: {
|
|
211
250
|
kind: Kind.NAME,
|
|
212
|
-
value: field
|
|
251
|
+
value: field
|
|
213
252
|
},
|
|
214
|
-
alias: alias !== field
|
|
253
|
+
alias: alias !== field ? {
|
|
215
254
|
kind: Kind.NAME,
|
|
216
255
|
value: alias
|
|
217
256
|
} : void 0,
|
|
@@ -219,7 +258,7 @@ const buildField = (field, schema) => Object.entries(field).map(([alias, { args,
|
|
|
219
258
|
directives: builtDirectives.length > 0 ? builtDirectives : void 0,
|
|
220
259
|
selectionSet: object ? {
|
|
221
260
|
kind: Kind.SELECTION_SET,
|
|
222
|
-
selections: buildField(object, schema)
|
|
261
|
+
selections: buildField(object, schema, type.name)
|
|
223
262
|
} : union ? {
|
|
224
263
|
kind: Kind.SELECTION_SET,
|
|
225
264
|
selections: buildUnionSelection(union, schema)
|
|
@@ -396,7 +435,7 @@ const buildOperationTypeNode = (operation) => {
|
|
|
396
435
|
* @returns TypedDocumentNode with inferred input/output types
|
|
397
436
|
*/
|
|
398
437
|
const buildDocument = (options) => {
|
|
399
|
-
const { operationName, operationType, variables, fields, schema } = options;
|
|
438
|
+
const { operationName, operationType, operationTypeName, variables, fields, schema } = options;
|
|
400
439
|
return {
|
|
401
440
|
kind: Kind.DOCUMENT,
|
|
402
441
|
definitions: [{
|
|
@@ -409,7 +448,7 @@ const buildDocument = (options) => {
|
|
|
409
448
|
variableDefinitions: buildVariables(variables, schema),
|
|
410
449
|
selectionSet: {
|
|
411
450
|
kind: Kind.SELECTION_SET,
|
|
412
|
-
selections: buildField(fields, schema)
|
|
451
|
+
selections: buildField(fields, schema, operationTypeName)
|
|
413
452
|
}
|
|
414
453
|
}]
|
|
415
454
|
};
|
|
@@ -1095,6 +1134,7 @@ const createFieldFactoriesInner = (schema, typeName) => {
|
|
|
1095
1134
|
object: null,
|
|
1096
1135
|
union: null
|
|
1097
1136
|
});
|
|
1137
|
+
if (type.kind === "excluded") throw new Error(`Field "${fieldName}" references excluded type "${type.name}"`);
|
|
1098
1138
|
throw new Error(`Unsupported field type: ${type}`);
|
|
1099
1139
|
};
|
|
1100
1140
|
return [fieldName, factory];
|
|
@@ -1202,6 +1242,7 @@ const buildOperationArtifact = (params) => {
|
|
|
1202
1242
|
const document = buildDocument({
|
|
1203
1243
|
operationName,
|
|
1204
1244
|
operationType,
|
|
1245
|
+
operationTypeName,
|
|
1205
1246
|
variables,
|
|
1206
1247
|
fields,
|
|
1207
1248
|
schema
|
|
@@ -1818,7 +1859,7 @@ const generateInputFieldType = (schema, specifier, options, seen, depth) => {
|
|
|
1818
1859
|
*/
|
|
1819
1860
|
const calculateFieldType = (schema, selection, formatters) => {
|
|
1820
1861
|
const { type } = selection;
|
|
1821
|
-
if (type.kind === "object" && selection.object) return applyTypeModifier(calculateFieldsType(schema, selection.object, formatters), type.modifier);
|
|
1862
|
+
if (type.kind === "object" && selection.object) return applyTypeModifier(calculateFieldsType(schema, selection.object, formatters, type.name), type.modifier);
|
|
1822
1863
|
if (type.kind === "union" && selection.union) return applyTypeModifier(calculateUnionType(schema, selection.union, formatters), type.modifier);
|
|
1823
1864
|
if (type.kind === "typename") return applyTypeModifier(`"${type.name}"`, type.modifier);
|
|
1824
1865
|
if (type.kind === "scalar") return applyTypeModifier(formatters?.scalarOutput?.(type.name) ?? getScalarOutputType(schema, type.name), type.modifier);
|
|
@@ -1830,25 +1871,58 @@ const calculateFieldType = (schema, selection, formatters) => {
|
|
|
1830
1871
|
*/
|
|
1831
1872
|
const calculateUnionType = (schema, union, formatters) => {
|
|
1832
1873
|
const memberTypes = [];
|
|
1833
|
-
for (const [
|
|
1834
|
-
const memberType = calculateFieldsType(schema, fields, formatters);
|
|
1874
|
+
for (const [typeName, fields] of Object.entries(union)) if (fields) {
|
|
1875
|
+
const memberType = calculateFieldsType(schema, fields, formatters, typeName);
|
|
1835
1876
|
memberTypes.push(memberType);
|
|
1836
1877
|
}
|
|
1837
1878
|
if (memberTypes.length === 0) return "never";
|
|
1838
1879
|
return memberTypes.join(" | ");
|
|
1839
1880
|
};
|
|
1840
1881
|
/**
|
|
1882
|
+
* Check if a field value is shorthand (true) vs factory return (AnyFieldSelection).
|
|
1883
|
+
*/
|
|
1884
|
+
const isShorthandValue = (value) => value === true;
|
|
1885
|
+
/**
|
|
1886
|
+
* Expand shorthand to AnyFieldSelection using schema type info.
|
|
1887
|
+
* Used at prebuilt type generation time to convert `true` to full field selection.
|
|
1888
|
+
*
|
|
1889
|
+
* @param schema - The GraphQL schema
|
|
1890
|
+
* @param typeName - The parent object type name
|
|
1891
|
+
* @param fieldName - The field name to select
|
|
1892
|
+
*/
|
|
1893
|
+
const expandShorthandForType = (schema, typeName, fieldName) => {
|
|
1894
|
+
const typeDef = schema.object[typeName];
|
|
1895
|
+
if (!typeDef) throw new Error(`Type "${typeName}" not found in schema`);
|
|
1896
|
+
const fieldSpec = typeDef.fields[fieldName];
|
|
1897
|
+
if (!fieldSpec) throw new Error(`Field "${fieldName}" not found on type "${typeName}"`);
|
|
1898
|
+
return {
|
|
1899
|
+
parent: typeName,
|
|
1900
|
+
field: fieldName,
|
|
1901
|
+
type: fieldSpec,
|
|
1902
|
+
args: {},
|
|
1903
|
+
directives: [],
|
|
1904
|
+
object: null,
|
|
1905
|
+
union: null
|
|
1906
|
+
};
|
|
1907
|
+
};
|
|
1908
|
+
/**
|
|
1841
1909
|
* Calculate the TypeScript type string for a set of field selections.
|
|
1842
1910
|
* This is the main entry point for type calculation.
|
|
1843
1911
|
*
|
|
1844
1912
|
* @param schema - The GraphQL schema
|
|
1845
1913
|
* @param fields - The field selections to calculate types for
|
|
1846
1914
|
* @param formatters - Optional formatters for customizing type names
|
|
1915
|
+
* @param typeName - Parent type name for shorthand expansion
|
|
1847
1916
|
*/
|
|
1848
|
-
const calculateFieldsType = (schema, fields, formatters) => {
|
|
1917
|
+
const calculateFieldsType = (schema, fields, formatters, typeName) => {
|
|
1849
1918
|
const entries = Object.entries(fields);
|
|
1850
1919
|
if (entries.length === 0) return "{}";
|
|
1851
|
-
return `{ ${entries.map(([alias,
|
|
1920
|
+
return `{ ${entries.map(([alias, value]) => {
|
|
1921
|
+
let selection;
|
|
1922
|
+
if (isShorthandValue(value)) {
|
|
1923
|
+
if (!typeName) throw new Error(`Shorthand syntax (${alias}: true) requires type context. This is an internal error - type name should be provided.`);
|
|
1924
|
+
selection = expandShorthandForType(schema, typeName, alias);
|
|
1925
|
+
} else selection = value;
|
|
1852
1926
|
return `readonly ${alias}: ${calculateFieldType(schema, selection, formatters)}`;
|
|
1853
1927
|
}).join("; ")} }`;
|
|
1854
1928
|
};
|