@soda-gql/core 0.9.1 → 0.10.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/dist/adapter.cjs +2 -2
- package/dist/adapter.d.cts +2 -2
- package/dist/adapter.d.ts +2 -2
- package/dist/adapter.js +1 -1
- package/dist/{index-_6fYTfcA.d.cts → index-ChwPP6wc.d.cts} +365 -67
- package/dist/index-ChwPP6wc.d.cts.map +1 -0
- package/dist/{index-zCOsREx0.d.cts → index-CnQ5XVCf.d.ts} +2 -2
- package/dist/{index-BlVgxrXb.d.ts.map → index-CnQ5XVCf.d.ts.map} +1 -1
- package/dist/{index-B_TU5U2U.d.ts → index-DaREzuQm.d.ts} +365 -67
- package/dist/index-DaREzuQm.d.ts.map +1 -0
- package/dist/{index-BlVgxrXb.d.ts → index-DnLzk2bC.d.cts} +2 -2
- package/dist/{index-zCOsREx0.d.cts.map → index-DnLzk2bC.d.cts.map} +1 -1
- package/dist/index.cjs +386 -53
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -125
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +4 -125
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +369 -47
- package/dist/index.js.map +1 -1
- package/dist/runtime.cjs +4 -0
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +13 -3
- package/dist/runtime.d.cts.map +1 -1
- package/dist/runtime.d.ts +13 -3
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +4 -0
- package/dist/runtime.js.map +1 -1
- package/dist/schema-builder-C9Qj5zQg.js +58 -0
- package/dist/schema-builder-C9Qj5zQg.js.map +1 -0
- package/dist/schema-builder-CJe30s_R.d.ts +63 -0
- package/dist/schema-builder-CJe30s_R.d.ts.map +1 -0
- package/dist/schema-builder-CwRmtxHx.d.cts +63 -0
- package/dist/schema-builder-CwRmtxHx.d.cts.map +1 -0
- package/dist/schema-builder-D2ay11cE.cjs +82 -0
- package/dist/schema-builder-D2ay11cE.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/index-B_TU5U2U.d.ts.map +0 -1
- package/dist/index-_6fYTfcA.d.cts.map +0 -1
- package/dist/schema-BiYcVVvm.js +0 -171
- package/dist/schema-BiYcVVvm.js.map +0 -1
- package/dist/schema-D2MW4DOF.cjs +0 -207
- package/dist/schema-D2MW4DOF.cjs.map +0 -1
- package/dist/schema-builder-BI5PQkH7.d.cts +0 -97
- package/dist/schema-builder-BI5PQkH7.d.cts.map +0 -1
- package/dist/schema-builder-CF_AwsOM.d.ts +0 -97
- package/dist/schema-builder-CF_AwsOM.d.ts.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { At as ConstValue, B as UnionMemberName, C as AnyFieldName, D as InferInputKind, F as OperationType, H as AnyVarRef, I as PickTypeSpecifierByFieldName, K as VarRef, L as ResolveInputProfileFromMeta, Mt as FieldPath, N as ObjectFieldRecord, O as InferInputProfile, S as AllInputTypeNames, T as AnyTypeName, U as AnyVarRefBrand, X as AnyDefaultValue, _ as FragmentMetadataBuilder, _t as PrimitiveTypeProfile, a as DefaultMetadataAdapter, at as OutputEnumSpecifier, bt as GetSignature, c as ExtractAdapterTypes, ct as OutputScalarSpecifier, ft as OutputTypenameSpecifier, gt as ObjectTypeProfile, ht as GetModifiedType, i as DefaultAdapter, it as InputTypeSpecifiers, k as InferOutputProfile, mt as GetConstAssignableType, n as AnyAdapter, nt as InputTypeKind, ot as OutputInferrableTypeSpecifier, p as OperationDocumentTransformer, pt as OutputUnionSpecifier, r as AnyMetadataAdapter, rt as InputTypeSpecifier, s as DocumentTransformer, st as OutputObjectSpecifier, t as Adapter, ut as OutputTypeSpecifier, vt as TypeProfile, w as AnyGraphqlSchema, xt as TypeModifier, y as MetadataBuilder, yt as ApplyTypeModifier } from "./index-
|
|
2
|
-
import { ConstValueNode, NamedTypeNode, OperationTypeNode, TypeNode, ValueNode } from "graphql";
|
|
1
|
+
import { At as ConstValue, B as UnionMemberName, C as AnyFieldName, D as InferInputKind, Dt as InputDepthOverrides, F as OperationType, H as AnyVarRef, I as PickTypeSpecifierByFieldName, K as VarRef, L as ResolveInputProfileFromMeta, Mt as FieldPath, N as ObjectFieldRecord, O as InferInputProfile, S as AllInputTypeNames, T as AnyTypeName, U as AnyVarRefBrand, X as AnyDefaultValue, _ as FragmentMetadataBuilder, _t as PrimitiveTypeProfile, a as DefaultMetadataAdapter, at as OutputEnumSpecifier, bt as GetSignature, c as ExtractAdapterTypes, ct as OutputScalarSpecifier, ft as OutputTypenameSpecifier, gt as ObjectTypeProfile, ht as GetModifiedType, i as DefaultAdapter, it as InputTypeSpecifiers, k as InferOutputProfile, mt as GetConstAssignableType, n as AnyAdapter, nt as InputTypeKind, ot as OutputInferrableTypeSpecifier, p as OperationDocumentTransformer, pt as OutputUnionSpecifier, r as AnyMetadataAdapter, rt as InputTypeSpecifier, s as DocumentTransformer, st as OutputObjectSpecifier, t as Adapter, ut as OutputTypeSpecifier, vt as TypeProfile, w as AnyGraphqlSchema, xt as TypeModifier, y as MetadataBuilder, yt as ApplyTypeModifier } from "./index-DnLzk2bC.cjs";
|
|
2
|
+
import { ConstValueNode, NamedTypeNode, OperationTypeNode, TypeNode, ValueNode, VariableDefinitionNode } from "graphql";
|
|
3
3
|
import { TypedDocumentNode } from "@graphql-typed-document-node/core";
|
|
4
4
|
|
|
5
5
|
//#region packages/core/src/types/type-foundation/directive-ref.d.ts
|
|
@@ -225,7 +225,7 @@ type FieldSelectionTemplateOf<TSchema extends AnyGraphqlSchema, TTypeName$1 exte
|
|
|
225
225
|
union: AnyNestedUnion;
|
|
226
226
|
} : never)> : never;
|
|
227
227
|
/** Resolve the data shape produced by a set of field selections. */
|
|
228
|
-
type InferFields<TSchema extends AnyGraphqlSchema, TFields extends AnyFields> = { [_ in TSchema["label"]]: { [TAliasName in keyof TFields]: InferField<TSchema, TFields[TAliasName]> } & {} }[TSchema["label"]];
|
|
228
|
+
type InferFields<TSchema extends AnyGraphqlSchema, TFields$1 extends AnyFields> = { [_ in TSchema["label"]]: { [TAliasName in keyof TFields$1]: InferField<TSchema, TFields$1[TAliasName]> } & {} }[TSchema["label"]];
|
|
229
229
|
/** Resolve the data shape for a single field reference, including nested objects/unions. */
|
|
230
230
|
type InferField<TSchema extends AnyGraphqlSchema, TSelection extends AnyFieldSelection> = (TSelection extends {
|
|
231
231
|
type: infer TSpecifier extends OutputObjectSpecifier;
|
|
@@ -279,12 +279,12 @@ declare const buildOperationTypeNode: (operation: OperationType) => OperationTyp
|
|
|
279
279
|
* @param options - Operation configuration (name, type, variables, fields)
|
|
280
280
|
* @returns TypedDocumentNode with inferred input/output types
|
|
281
281
|
*/
|
|
282
|
-
declare const buildDocument: <TSchema extends AnyGraphqlSchema, TFields extends AnyFields, TVarDefinitions extends InputTypeSpecifiers>(options: {
|
|
282
|
+
declare const buildDocument: <TSchema extends AnyGraphqlSchema, TFields$1 extends AnyFields, TVarDefinitions extends InputTypeSpecifiers>(options: {
|
|
283
283
|
operationName: string;
|
|
284
284
|
operationType: OperationType;
|
|
285
285
|
variables: TVarDefinitions;
|
|
286
|
-
fields: TFields;
|
|
287
|
-
}) => TypedDocumentNode<InferFields<TSchema, TFields>, ConstAssignableInput<TSchema, TVarDefinitions>>;
|
|
286
|
+
fields: TFields$1;
|
|
287
|
+
}) => TypedDocumentNode<InferFields<TSchema, TFields$1>, ConstAssignableInput<TSchema, TVarDefinitions>>;
|
|
288
288
|
//#endregion
|
|
289
289
|
//#region packages/core/src/utils/type-utils.d.ts
|
|
290
290
|
type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends ((x: infer I) => void) ? I : never;
|
|
@@ -479,7 +479,7 @@ declare const empty: () => EmptyObject;
|
|
|
479
479
|
* tooling `f`/`fields`/`_` aliases provide ergonomic access to GraphQL fields
|
|
480
480
|
* while preserving the original schema information for inference.
|
|
481
481
|
*/
|
|
482
|
-
type FieldsBuilder<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"] & string, TVariableDefinitions extends InputTypeSpecifiers, TFields extends AnyFields> = (tools: NoInfer<FieldsBuilderTools<TSchema, TTypeName$1, TVariableDefinitions>>) => TFields;
|
|
482
|
+
type FieldsBuilder<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"] & string, TVariableDefinitions extends InputTypeSpecifiers, TFields$1 extends AnyFields> = (tools: NoInfer<FieldsBuilderTools<TSchema, TTypeName$1, TVariableDefinitions>>) => TFields$1;
|
|
483
483
|
/**
|
|
484
484
|
* Tools provided to field builder callbacks.
|
|
485
485
|
* - `f`: Field selection factories for the current type
|
|
@@ -493,7 +493,7 @@ type FieldsBuilderTools<TSchema extends AnyGraphqlSchema, TTypeName$1 extends ke
|
|
|
493
493
|
* Builder for nested object field selections.
|
|
494
494
|
* Used when a field returns an object type requiring sub-selections.
|
|
495
495
|
*/
|
|
496
|
-
type NestedObjectFieldsBuilder<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"] & string, TFields extends AnyNestedObject> = (tools: NoInfer<NestedObjectFieldsBuilderTools<TSchema, TTypeName$1>>) => TFields;
|
|
496
|
+
type NestedObjectFieldsBuilder<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"] & string, TFields$1 extends AnyNestedObject> = (tools: NoInfer<NestedObjectFieldsBuilderTools<TSchema, TTypeName$1>>) => TFields$1;
|
|
497
497
|
/**
|
|
498
498
|
* Tools for nested object builders (no variable access).
|
|
499
499
|
* @internal
|
|
@@ -651,7 +651,7 @@ declare abstract class GqlElement<TDefinition extends object, TInfer extends obj
|
|
|
651
651
|
/**
|
|
652
652
|
* Type alias for any Fragment instance.
|
|
653
653
|
*/
|
|
654
|
-
type AnyFragment = Fragment<string, any, AnyFields, any>;
|
|
654
|
+
type AnyFragment = Fragment<string, any, AnyFields, any, string | undefined>;
|
|
655
655
|
/**
|
|
656
656
|
* Type inference metadata for fragments.
|
|
657
657
|
* Access via `typeof fragment.$infer`.
|
|
@@ -664,9 +664,12 @@ type FragmentInferMeta<TVariables, TOutput extends object> = {
|
|
|
664
664
|
* Internal artifact shape produced by fragment evaluation.
|
|
665
665
|
* @internal
|
|
666
666
|
*/
|
|
667
|
-
interface FragmentArtifact<TTypeName$1 extends string, TVariables extends Partial<AnyAssignableInput> | void, TFields extends Partial<AnyFields
|
|
667
|
+
interface FragmentArtifact<TTypeName$1 extends string, TVariables extends Partial<AnyAssignableInput> | void, TFields$1 extends Partial<AnyFields>, TKey$1 extends string | undefined = undefined> {
|
|
668
668
|
readonly typename: TTypeName$1;
|
|
669
|
-
readonly
|
|
669
|
+
readonly key: TKey$1;
|
|
670
|
+
readonly schemaLabel: string;
|
|
671
|
+
readonly variableDefinitions: InputTypeSpecifiers;
|
|
672
|
+
readonly spread: (variables: TVariables) => TFields$1;
|
|
670
673
|
}
|
|
671
674
|
declare const __FRAGMENT_BRAND__: unique symbol;
|
|
672
675
|
/**
|
|
@@ -679,30 +682,40 @@ declare const __FRAGMENT_BRAND__: unique symbol;
|
|
|
679
682
|
* @template TVariables - Variables required when spreading
|
|
680
683
|
* @template TFields - The selected fields structure
|
|
681
684
|
* @template TOutput - Inferred output type from selected fields
|
|
685
|
+
* @template TKey - Optional unique key for prebuilt type lookup
|
|
682
686
|
*/
|
|
683
|
-
declare class Fragment<TTypeName$1 extends string, TVariables extends Partial<AnyAssignableInput> | void, TFields extends Partial<AnyFields>, TOutput extends object> extends GqlElement<FragmentArtifact<TTypeName$1, TVariables, TFields>, FragmentInferMeta<TVariables, TOutput>> implements FragmentArtifact<TTypeName$1, TVariables, TFields> {
|
|
687
|
+
declare class Fragment<TTypeName$1 extends string, TVariables extends Partial<AnyAssignableInput> | void, TFields$1 extends Partial<AnyFields>, TOutput extends object, TKey$1 extends string | undefined = undefined> extends GqlElement<FragmentArtifact<TTypeName$1, TVariables, TFields$1, TKey$1>, FragmentInferMeta<TVariables, TOutput>> implements FragmentArtifact<TTypeName$1, TVariables, TFields$1, TKey$1> {
|
|
684
688
|
private readonly [__FRAGMENT_BRAND__];
|
|
685
689
|
private constructor();
|
|
686
690
|
/** The GraphQL type name this fragment selects from. */
|
|
687
691
|
get typename(): TTypeName$1;
|
|
692
|
+
/** Optional unique key for prebuilt type lookup. */
|
|
693
|
+
get key(): TKey$1;
|
|
694
|
+
/** The schema label this fragment belongs to. */
|
|
695
|
+
get schemaLabel(): string;
|
|
696
|
+
/** Variable definitions for this fragment. */
|
|
697
|
+
get variableDefinitions(): InputTypeSpecifiers;
|
|
688
698
|
/**
|
|
689
699
|
* Spreads this fragment's fields into a parent selection.
|
|
690
700
|
* Pass variables if the fragment defines any.
|
|
691
701
|
*/
|
|
692
|
-
get spread(): (variables: TVariables) => TFields;
|
|
702
|
+
get spread(): (variables: TVariables) => TFields$1;
|
|
693
703
|
/**
|
|
694
704
|
* Creates a new Fragment instance.
|
|
695
705
|
* Prefer using the `gql(({ fragment }) => ...)` API instead.
|
|
696
706
|
* @internal
|
|
697
707
|
*/
|
|
698
|
-
static create<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"] & string, TVariableDefinitions extends InputTypeSpecifiers, TFields extends AnyFields>(define: () => {
|
|
708
|
+
static create<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"] & string, TVariableDefinitions extends InputTypeSpecifiers, TFields$1 extends AnyFields, TKey$1 extends string | undefined = undefined>(define: () => {
|
|
699
709
|
typename: TTypeName$1;
|
|
700
|
-
|
|
701
|
-
|
|
710
|
+
key: TKey$1;
|
|
711
|
+
schemaLabel: TSchema["label"];
|
|
712
|
+
variableDefinitions: TVariableDefinitions;
|
|
713
|
+
spread: (variables: OptionalArg<AssignableInput<TSchema, TVariableDefinitions>>) => TFields$1;
|
|
714
|
+
}): Fragment<TTypeName$1, OptionalArg<AssignableInput<TSchema, TVariableDefinitions>>, TFields$1 & {
|
|
702
715
|
[key: symbol]: never;
|
|
703
|
-
}, InferFields<TSchema, TFields> & {
|
|
716
|
+
}, InferFields<TSchema, TFields$1> & {
|
|
704
717
|
[key: symbol]: never;
|
|
705
|
-
}>;
|
|
718
|
+
}, TKey$1>;
|
|
706
719
|
}
|
|
707
720
|
//#endregion
|
|
708
721
|
//#region packages/core/src/types/element/operation.d.ts
|
|
@@ -713,7 +726,7 @@ type AnyOperation = AnyOperationOf<"query"> | AnyOperationOf<"mutation"> | AnyOp
|
|
|
713
726
|
/**
|
|
714
727
|
* Type alias for an Operation of a specific type.
|
|
715
728
|
*/
|
|
716
|
-
type AnyOperationOf<TOperationType extends OperationType> = Operation<TOperationType, string, string[], any, AnyFields, any>;
|
|
729
|
+
type AnyOperationOf<TOperationType$1 extends OperationType> = Operation<TOperationType$1, string, string[], any, AnyFields, any>;
|
|
717
730
|
/**
|
|
718
731
|
* Type inference metadata for operations.
|
|
719
732
|
* Access via `typeof operation.$infer`.
|
|
@@ -727,11 +740,12 @@ declare const __OPERATION_BRAND__: unique symbol;
|
|
|
727
740
|
* Internal artifact shape produced by operation evaluation.
|
|
728
741
|
* @internal
|
|
729
742
|
*/
|
|
730
|
-
type OperationArtifact<TOperationType extends OperationType, TOperationName extends string, TVariableNames extends string[], TVariables extends AnyConstAssignableInput, TFields extends Partial<AnyFields>, TData extends object> = {
|
|
731
|
-
readonly operationType: TOperationType;
|
|
732
|
-
readonly operationName: TOperationName;
|
|
733
|
-
readonly
|
|
734
|
-
readonly
|
|
743
|
+
type OperationArtifact<TOperationType$1 extends OperationType, TOperationName$1 extends string, TVariableNames$1 extends string[], TVariables extends AnyConstAssignableInput, TFields$1 extends Partial<AnyFields>, TData extends object> = {
|
|
744
|
+
readonly operationType: TOperationType$1;
|
|
745
|
+
readonly operationName: TOperationName$1;
|
|
746
|
+
readonly schemaLabel: string;
|
|
747
|
+
readonly variableNames: TVariableNames$1;
|
|
748
|
+
readonly documentSource: () => TFields$1;
|
|
735
749
|
readonly document: TypedDocumentNode<TData, TVariables>;
|
|
736
750
|
readonly metadata?: unknown;
|
|
737
751
|
};
|
|
@@ -748,20 +762,22 @@ type OperationArtifact<TOperationType extends OperationType, TOperationName exte
|
|
|
748
762
|
* @template TFields - Selected fields structure
|
|
749
763
|
* @template TData - Inferred response data type
|
|
750
764
|
*/
|
|
751
|
-
declare class Operation<TOperationType extends OperationType, TOperationName extends string, TVariableNames extends string[], TVariables extends AnyConstAssignableInput, TFields extends Partial<AnyFields>, TData extends object> extends GqlElement<OperationArtifact<TOperationType, TOperationName, TVariableNames, TVariables, TFields, TData>, OperationInferMeta<TVariables, TData>> implements OperationArtifact<TOperationType, TOperationName, TVariableNames, TVariables, TFields, TData> {
|
|
765
|
+
declare class Operation<TOperationType$1 extends OperationType, TOperationName$1 extends string, TVariableNames$1 extends string[], TVariables extends AnyConstAssignableInput, TFields$1 extends Partial<AnyFields>, TData extends object> extends GqlElement<OperationArtifact<TOperationType$1, TOperationName$1, TVariableNames$1, TVariables, TFields$1, TData>, OperationInferMeta<TVariables, TData>> implements OperationArtifact<TOperationType$1, TOperationName$1, TVariableNames$1, TVariables, TFields$1, TData> {
|
|
752
766
|
private readonly [__OPERATION_BRAND__];
|
|
753
767
|
private constructor();
|
|
754
768
|
/** The operation type: 'query', 'mutation', or 'subscription'. */
|
|
755
|
-
get operationType(): TOperationType;
|
|
769
|
+
get operationType(): TOperationType$1;
|
|
756
770
|
/** The unique name of this operation. */
|
|
757
|
-
get operationName(): TOperationName;
|
|
771
|
+
get operationName(): TOperationName$1;
|
|
772
|
+
/** The schema label this operation belongs to. */
|
|
773
|
+
get schemaLabel(): string;
|
|
758
774
|
/** List of variable names defined for this operation. */
|
|
759
|
-
get variableNames(): TVariableNames;
|
|
775
|
+
get variableNames(): TVariableNames$1;
|
|
760
776
|
/**
|
|
761
777
|
* Returns the field selections. Used for document reconstruction.
|
|
762
778
|
* @internal
|
|
763
779
|
*/
|
|
764
|
-
get documentSource(): () => TFields;
|
|
780
|
+
get documentSource(): () => TFields$1;
|
|
765
781
|
/** The TypedDocumentNode for use with GraphQL clients. */
|
|
766
782
|
get document(): TypedDocumentNode<TData, TVariables>;
|
|
767
783
|
/** Custom metadata attached to this operation, if any. */
|
|
@@ -771,21 +787,23 @@ declare class Operation<TOperationType extends OperationType, TOperationName ext
|
|
|
771
787
|
* Prefer using the `gql(({ query }) => ...)` API instead.
|
|
772
788
|
* @internal
|
|
773
789
|
*/
|
|
774
|
-
static create<TSchema extends AnyGraphqlSchema, TOperationType extends OperationType, TOperationName extends string, TVariableDefinitions extends InputTypeSpecifiers, TFields extends AnyFields>(define: (context: GqlElementContext | null) => {
|
|
775
|
-
operationType: TOperationType;
|
|
776
|
-
operationName: TOperationName;
|
|
790
|
+
static create<TSchema extends AnyGraphqlSchema, TOperationType$1 extends OperationType, TOperationName$1 extends string, TVariableDefinitions extends InputTypeSpecifiers, TFields$1 extends AnyFields>(define: (context: GqlElementContext | null) => {
|
|
791
|
+
operationType: TOperationType$1;
|
|
792
|
+
operationName: TOperationName$1;
|
|
793
|
+
schemaLabel: TSchema["label"];
|
|
777
794
|
variableNames: (keyof TVariableDefinitions & string)[];
|
|
778
|
-
documentSource: () => TFields;
|
|
779
|
-
document: TypedDocumentNode<InferFields<TSchema, TFields>, ConstAssignableInput<TSchema, TVariableDefinitions>>;
|
|
795
|
+
documentSource: () => TFields$1;
|
|
796
|
+
document: TypedDocumentNode<InferFields<TSchema, TFields$1>, ConstAssignableInput<TSchema, TVariableDefinitions>>;
|
|
780
797
|
metadata?: unknown;
|
|
781
798
|
} | Promise<{
|
|
782
|
-
operationType: TOperationType;
|
|
783
|
-
operationName: TOperationName;
|
|
799
|
+
operationType: TOperationType$1;
|
|
800
|
+
operationName: TOperationName$1;
|
|
801
|
+
schemaLabel: TSchema["label"];
|
|
784
802
|
variableNames: (keyof TVariableDefinitions & string)[];
|
|
785
|
-
documentSource: () => TFields;
|
|
786
|
-
document: TypedDocumentNode<InferFields<TSchema, TFields>, ConstAssignableInput<TSchema, TVariableDefinitions>>;
|
|
803
|
+
documentSource: () => TFields$1;
|
|
804
|
+
document: TypedDocumentNode<InferFields<TSchema, TFields$1>, ConstAssignableInput<TSchema, TVariableDefinitions>>;
|
|
787
805
|
metadata?: unknown;
|
|
788
|
-
}>): Operation<TOperationType, TOperationName, (keyof TVariableDefinitions & string)[], ConstAssignableInput<TSchema, TVariableDefinitions>, TFields, InferFields<TSchema, TFields>>;
|
|
806
|
+
}>): Operation<TOperationType$1, TOperationName$1, (keyof TVariableDefinitions & string)[], ConstAssignableInput<TSchema, TVariableDefinitions>, TFields$1, InferFields<TSchema, TFields$1>>;
|
|
789
807
|
}
|
|
790
808
|
//#endregion
|
|
791
809
|
//#region packages/core/src/composer/fields-builder.d.ts
|
|
@@ -833,11 +851,13 @@ declare const createVarRefs: <TSchema extends AnyGraphqlSchema, TVarDefinitions
|
|
|
833
851
|
* Used by codegen to generate explicit fragment builder types instead of
|
|
834
852
|
* expensive mapped types. This improves IDE performance for large schemas.
|
|
835
853
|
*/
|
|
836
|
-
type FragmentBuilderFor<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"] & string, TAdapter extends AnyMetadataAdapter = DefaultMetadataAdapter> = <TFields extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}>(options: {
|
|
854
|
+
type FragmentBuilderFor<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"] & string, TAdapter extends AnyMetadataAdapter = DefaultMetadataAdapter> = <TFields$1 extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}, TKey$1 extends string | undefined = undefined>(options: {
|
|
855
|
+
/** Optional unique key for prebuilt type lookup. */
|
|
856
|
+
key?: TKey$1;
|
|
837
857
|
variables?: TVarDefinitions;
|
|
838
858
|
metadata?: FragmentMetadataBuilder<ReturnType<typeof createVarRefs<TSchema, TVarDefinitions>>, ExtractAdapterTypes<TAdapter>["fragmentMetadata"]>;
|
|
839
|
-
fields: FieldsBuilder<TSchema, TTypeName$1, TVarDefinitions, TFields>;
|
|
840
|
-
}) => ReturnType<typeof Fragment.create<TSchema, TTypeName$1, TVarDefinitions, TFields>>;
|
|
859
|
+
fields: FieldsBuilder<TSchema, TTypeName$1, TVarDefinitions, TFields$1>;
|
|
860
|
+
}) => ReturnType<typeof Fragment.create<TSchema, TTypeName$1, TVarDefinitions, TFields$1, TKey$1>>;
|
|
841
861
|
/**
|
|
842
862
|
* Creates fragment builder functions for all object types in the schema.
|
|
843
863
|
*
|
|
@@ -850,15 +870,16 @@ type FragmentBuilderFor<TSchema extends AnyGraphqlSchema, TTypeName$1 extends ke
|
|
|
850
870
|
*
|
|
851
871
|
* @internal Used by `createGqlElementComposer`
|
|
852
872
|
*/
|
|
853
|
-
declare const createGqlFragmentComposers: <TSchema extends AnyGraphqlSchema, TAdapter extends AnyMetadataAdapter = DefaultMetadataAdapter>(schema: NoInfer<TSchema>, _adapter?: TAdapter) => { readonly [TTypeName in keyof TSchema["object"]]: TTypeName extends string ? <TFields extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}>(options: {
|
|
873
|
+
declare const createGqlFragmentComposers: <TSchema extends AnyGraphqlSchema, TAdapter extends AnyMetadataAdapter = DefaultMetadataAdapter>(schema: NoInfer<TSchema>, _adapter?: TAdapter) => { readonly [TTypeName in keyof TSchema["object"]]: TTypeName extends string ? <TFields$1 extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}, TKey$1 extends string | undefined = undefined>(options: {
|
|
874
|
+
key?: TKey$1 | undefined;
|
|
854
875
|
variables?: TVarDefinitions | undefined;
|
|
855
876
|
metadata?: FragmentMetadataBuilder<DeclaredVariables<TSchema, TVarDefinitions>, ExtractAdapterTypes<TAdapter>["fragmentMetadata"]> | undefined;
|
|
856
|
-
fields: FieldsBuilder<TSchema, TTypeName, TVarDefinitions, TFields>;
|
|
857
|
-
}) => Fragment<TTypeName, OptionalArg<AssignableInput<TSchema, TVarDefinitions>>, TFields & {
|
|
877
|
+
fields: FieldsBuilder<TSchema, TTypeName, TVarDefinitions, TFields$1>;
|
|
878
|
+
}) => Fragment<TTypeName, OptionalArg<AssignableInput<TSchema, TVarDefinitions>>, TFields$1 & {
|
|
858
879
|
[key: symbol]: never;
|
|
859
|
-
}, InferFields<TSchema, TFields> & {
|
|
880
|
+
}, InferFields<TSchema, TFields$1> & {
|
|
860
881
|
[key: symbol]: never;
|
|
861
|
-
}> : never };
|
|
882
|
+
}, TKey$1> : never };
|
|
862
883
|
//#endregion
|
|
863
884
|
//#region packages/core/src/composer/fragment-usage-context.d.ts
|
|
864
885
|
/**
|
|
@@ -1072,6 +1093,22 @@ declare const createVarBuilder: <TSchema extends AnyGraphqlSchema>(inputTypeMeth
|
|
|
1072
1093
|
* variables, and colocation helpers.
|
|
1073
1094
|
*/
|
|
1074
1095
|
type GqlElementComposer<TContext> = <TResult extends AnyFragment | AnyOperation>(composeElement: (context: TContext) => TResult) => TResult;
|
|
1096
|
+
/**
|
|
1097
|
+
* GQL element composer with schema access.
|
|
1098
|
+
*
|
|
1099
|
+
* Extends the base composer function with a `$schema` property that provides
|
|
1100
|
+
* runtime access to the schema definition. This is useful for:
|
|
1101
|
+
* - Type generation tools (typegen)
|
|
1102
|
+
* - Runtime schema introspection
|
|
1103
|
+
* - Debugging and tooling
|
|
1104
|
+
*/
|
|
1105
|
+
type GqlElementComposerWithSchema<TContext, TSchema extends AnyGraphqlSchema> = GqlElementComposer<TContext> & {
|
|
1106
|
+
/**
|
|
1107
|
+
* The GraphQL schema definition used by this composer.
|
|
1108
|
+
* Provides runtime access to schema types, operations, and metadata.
|
|
1109
|
+
*/
|
|
1110
|
+
readonly $schema: TSchema;
|
|
1111
|
+
};
|
|
1075
1112
|
/**
|
|
1076
1113
|
* Extracts the helpers type from an adapter.
|
|
1077
1114
|
* Uses `any` for non-target type parameters to avoid contravariance issues
|
|
@@ -1134,39 +1171,39 @@ type GqlElementComposerOptions<TSchema extends AnyGraphqlSchema, TDirectiveMetho
|
|
|
1134
1171
|
* );
|
|
1135
1172
|
* ```
|
|
1136
1173
|
*/
|
|
1137
|
-
declare const createGqlElementComposer: <TSchema extends AnyGraphqlSchema, TFragmentBuilders, TDirectiveMethods extends StandardDirectives, TAdapter extends AnyAdapter = DefaultAdapter>(schema: NoInfer<TSchema>, options: GqlElementComposerOptions<NoInfer<TSchema>, NoInfer<TDirectiveMethods>, NoInfer<TAdapter>>) =>
|
|
1174
|
+
declare const createGqlElementComposer: <TSchema extends AnyGraphqlSchema, TFragmentBuilders, TDirectiveMethods extends StandardDirectives, TAdapter extends AnyAdapter = DefaultAdapter>(schema: NoInfer<TSchema>, options: GqlElementComposerOptions<NoInfer<TSchema>, NoInfer<TDirectiveMethods>, NoInfer<TAdapter>>) => GqlElementComposerWithSchema<{
|
|
1138
1175
|
fragment: TFragmentBuilders;
|
|
1139
1176
|
query: {
|
|
1140
|
-
operation: <TOperationName extends string, TFields extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}, TOperationMetadata = unknown>(options: {
|
|
1141
|
-
name: TOperationName;
|
|
1177
|
+
operation: <TOperationName$1 extends string, TFields$1 extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}, TOperationMetadata = unknown>(options: {
|
|
1178
|
+
name: TOperationName$1;
|
|
1142
1179
|
variables?: TVarDefinitions | undefined;
|
|
1143
1180
|
metadata?: MetadataBuilder<DeclaredVariables<TSchema, TVarDefinitions>, TOperationMetadata, ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["aggregatedFragmentMetadata"], ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["schemaLevel"]> | undefined;
|
|
1144
|
-
fields: FieldsBuilder<TSchema, TSchema["operations"]["query"] & keyof TSchema["object"] & string, TVarDefinitions, TFields>;
|
|
1181
|
+
fields: FieldsBuilder<TSchema, TSchema["operations"]["query"] & keyof TSchema["object"] & string, TVarDefinitions, TFields$1>;
|
|
1145
1182
|
transformDocument?: OperationDocumentTransformer<TOperationMetadata> | undefined;
|
|
1146
|
-
}) => Operation<"query", TOperationName, (keyof TVarDefinitions & string)[], ConstAssignableInput<TSchema, TVarDefinitions>, TFields, InferFields<TSchema, TFields>>;
|
|
1183
|
+
}) => Operation<"query", TOperationName$1, (keyof TVarDefinitions & string)[], ConstAssignableInput<TSchema, TVarDefinitions>, TFields$1, InferFields<TSchema, TFields$1>>;
|
|
1147
1184
|
};
|
|
1148
1185
|
mutation: {
|
|
1149
|
-
operation: <TOperationName extends string, TFields extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}, TOperationMetadata = unknown>(options: {
|
|
1150
|
-
name: TOperationName;
|
|
1186
|
+
operation: <TOperationName$1 extends string, TFields$1 extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}, TOperationMetadata = unknown>(options: {
|
|
1187
|
+
name: TOperationName$1;
|
|
1151
1188
|
variables?: TVarDefinitions | undefined;
|
|
1152
1189
|
metadata?: MetadataBuilder<DeclaredVariables<TSchema, TVarDefinitions>, TOperationMetadata, ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["aggregatedFragmentMetadata"], ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["schemaLevel"]> | undefined;
|
|
1153
|
-
fields: FieldsBuilder<TSchema, TSchema["operations"]["mutation"] & keyof TSchema["object"] & string, TVarDefinitions, TFields>;
|
|
1190
|
+
fields: FieldsBuilder<TSchema, TSchema["operations"]["mutation"] & keyof TSchema["object"] & string, TVarDefinitions, TFields$1>;
|
|
1154
1191
|
transformDocument?: OperationDocumentTransformer<TOperationMetadata> | undefined;
|
|
1155
|
-
}) => Operation<"mutation", TOperationName, (keyof TVarDefinitions & string)[], ConstAssignableInput<TSchema, TVarDefinitions>, TFields, InferFields<TSchema, TFields>>;
|
|
1192
|
+
}) => Operation<"mutation", TOperationName$1, (keyof TVarDefinitions & string)[], ConstAssignableInput<TSchema, TVarDefinitions>, TFields$1, InferFields<TSchema, TFields$1>>;
|
|
1156
1193
|
};
|
|
1157
1194
|
subscription: {
|
|
1158
|
-
operation: <TOperationName extends string, TFields extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}, TOperationMetadata = unknown>(options: {
|
|
1159
|
-
name: TOperationName;
|
|
1195
|
+
operation: <TOperationName$1 extends string, TFields$1 extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}, TOperationMetadata = unknown>(options: {
|
|
1196
|
+
name: TOperationName$1;
|
|
1160
1197
|
variables?: TVarDefinitions | undefined;
|
|
1161
1198
|
metadata?: MetadataBuilder<DeclaredVariables<TSchema, TVarDefinitions>, TOperationMetadata, ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["aggregatedFragmentMetadata"], ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["schemaLevel"]> | undefined;
|
|
1162
|
-
fields: FieldsBuilder<TSchema, TSchema["operations"]["subscription"] & keyof TSchema["object"] & string, TVarDefinitions, TFields>;
|
|
1199
|
+
fields: FieldsBuilder<TSchema, TSchema["operations"]["subscription"] & keyof TSchema["object"] & string, TVarDefinitions, TFields$1>;
|
|
1163
1200
|
transformDocument?: OperationDocumentTransformer<TOperationMetadata> | undefined;
|
|
1164
|
-
}) => Operation<"subscription", TOperationName, (keyof TVarDefinitions & string)[], ConstAssignableInput<TSchema, TVarDefinitions>, TFields, InferFields<TSchema, TFields>>;
|
|
1201
|
+
}) => Operation<"subscription", TOperationName$1, (keyof TVarDefinitions & string)[], ConstAssignableInput<TSchema, TVarDefinitions>, TFields$1, InferFields<TSchema, TFields$1>>;
|
|
1165
1202
|
};
|
|
1166
1203
|
$var: VarBuilder<TSchema>;
|
|
1167
1204
|
$dir: TDirectiveMethods;
|
|
1168
1205
|
$colocate: <TEntries extends ColocatedEntries>(entries: TEntries) => ColocatedFields<TEntries>;
|
|
1169
|
-
} & ExtractHelpers<TAdapter
|
|
1206
|
+
} & ExtractHelpers<TAdapter>, TSchema>;
|
|
1170
1207
|
//#endregion
|
|
1171
1208
|
//#region packages/core/src/composer/operation.d.ts
|
|
1172
1209
|
/**
|
|
@@ -1185,13 +1222,274 @@ declare const createGqlElementComposer: <TSchema extends AnyGraphqlSchema, TFrag
|
|
|
1185
1222
|
*
|
|
1186
1223
|
* @internal Used by `createGqlElementComposer`
|
|
1187
1224
|
*/
|
|
1188
|
-
declare const createOperationComposerFactory: <TSchema extends AnyGraphqlSchema, TAdapter extends AnyMetadataAdapter = DefaultMetadataAdapter>(schema: NoInfer<TSchema>, adapter?: TAdapter, transformDocument?: DocumentTransformer<ExtractAdapterTypes<TAdapter>["schemaLevel"], ExtractAdapterTypes<TAdapter>["aggregatedFragmentMetadata"]>) => <TOperationType extends OperationType>(operationType: TOperationType) => <TOperationName extends string, TFields extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}, TOperationMetadata = unknown>(options: {
|
|
1189
|
-
name: TOperationName;
|
|
1225
|
+
declare const createOperationComposerFactory: <TSchema extends AnyGraphqlSchema, TAdapter extends AnyMetadataAdapter = DefaultMetadataAdapter>(schema: NoInfer<TSchema>, adapter?: TAdapter, transformDocument?: DocumentTransformer<ExtractAdapterTypes<TAdapter>["schemaLevel"], ExtractAdapterTypes<TAdapter>["aggregatedFragmentMetadata"]>) => <TOperationType$1 extends OperationType>(operationType: TOperationType$1) => <TOperationName$1 extends string, TFields$1 extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}, TOperationMetadata = unknown>(options: {
|
|
1226
|
+
name: TOperationName$1;
|
|
1190
1227
|
variables?: TVarDefinitions;
|
|
1191
1228
|
metadata?: MetadataBuilder<ReturnType<typeof createVarRefs<TSchema, TVarDefinitions>>, TOperationMetadata, ExtractAdapterTypes<TAdapter>["aggregatedFragmentMetadata"], ExtractAdapterTypes<TAdapter>["schemaLevel"]>;
|
|
1192
|
-
fields: FieldsBuilder<TSchema, TSchema["operations"][TOperationType] & keyof TSchema["object"] & string, TVarDefinitions, TFields>;
|
|
1229
|
+
fields: FieldsBuilder<TSchema, TSchema["operations"][TOperationType$1] & keyof TSchema["object"] & string, TVarDefinitions, TFields$1>;
|
|
1193
1230
|
transformDocument?: OperationDocumentTransformer<TOperationMetadata>;
|
|
1194
|
-
}) => Operation<TOperationType, TOperationName, (keyof TVarDefinitions & string)[], ConstAssignableInput<TSchema, TVarDefinitions>, TFields, InferFields<TSchema, TFields>>;
|
|
1231
|
+
}) => Operation<TOperationType$1, TOperationName$1, (keyof TVarDefinitions & string)[], ConstAssignableInput<TSchema, TVarDefinitions>, TFields$1, InferFields<TSchema, TFields$1>>;
|
|
1232
|
+
//#endregion
|
|
1233
|
+
//#region packages/core/src/prebuilt/types.d.ts
|
|
1234
|
+
/**
|
|
1235
|
+
* Type definitions for prebuilt type system.
|
|
1236
|
+
*
|
|
1237
|
+
* These types enable looking up pre-computed types from a registry
|
|
1238
|
+
* instead of relying on complex type inference that may be lost
|
|
1239
|
+
* when bundling with tools like tsdown.
|
|
1240
|
+
*
|
|
1241
|
+
* @module
|
|
1242
|
+
*/
|
|
1243
|
+
/**
|
|
1244
|
+
* Registry mapping fragment/operation keys to their inferred types.
|
|
1245
|
+
* Generated by the builder and used by prebuilt composers.
|
|
1246
|
+
*/
|
|
1247
|
+
type PrebuiltTypeRegistry = {
|
|
1248
|
+
readonly fragments: {
|
|
1249
|
+
readonly [key: string]: {
|
|
1250
|
+
readonly input: unknown;
|
|
1251
|
+
readonly output: object;
|
|
1252
|
+
};
|
|
1253
|
+
};
|
|
1254
|
+
readonly operations: {
|
|
1255
|
+
readonly [key: string]: {
|
|
1256
|
+
readonly input: object;
|
|
1257
|
+
readonly output: object;
|
|
1258
|
+
};
|
|
1259
|
+
};
|
|
1260
|
+
};
|
|
1261
|
+
/**
|
|
1262
|
+
* Empty registry type for when no prebuilt types are available.
|
|
1263
|
+
*/
|
|
1264
|
+
type EmptyPrebuiltTypeRegistry = {
|
|
1265
|
+
readonly fragments: Record<string, never>;
|
|
1266
|
+
readonly operations: Record<string, never>;
|
|
1267
|
+
};
|
|
1268
|
+
/**
|
|
1269
|
+
* Extract the input type for a fragment from the registry.
|
|
1270
|
+
*/
|
|
1271
|
+
type PrebuiltFragmentInput<TRegistry extends PrebuiltTypeRegistry, TKey$1 extends keyof TRegistry["fragments"] & string> = TRegistry["fragments"][TKey$1]["input"];
|
|
1272
|
+
/**
|
|
1273
|
+
* Extract the output type for a fragment from the registry.
|
|
1274
|
+
*/
|
|
1275
|
+
type PrebuiltFragmentOutput<TRegistry extends PrebuiltTypeRegistry, TKey$1 extends keyof TRegistry["fragments"] & string> = TRegistry["fragments"][TKey$1]["output"];
|
|
1276
|
+
/**
|
|
1277
|
+
* Extract the input type for an operation from the registry.
|
|
1278
|
+
*/
|
|
1279
|
+
type PrebuiltOperationInput<TRegistry extends PrebuiltTypeRegistry, TKey$1 extends keyof TRegistry["operations"] & string> = TRegistry["operations"][TKey$1]["input"];
|
|
1280
|
+
/**
|
|
1281
|
+
* Extract the output type for an operation from the registry.
|
|
1282
|
+
*/
|
|
1283
|
+
type PrebuiltOperationOutput<TRegistry extends PrebuiltTypeRegistry, TKey$1 extends keyof TRegistry["operations"] & string> = TRegistry["operations"][TKey$1]["output"];
|
|
1284
|
+
/**
|
|
1285
|
+
* Check if a key exists in the fragment registry.
|
|
1286
|
+
*/
|
|
1287
|
+
type HasPrebuiltFragment<TRegistry extends PrebuiltTypeRegistry, TKey$1 extends string> = TKey$1 extends keyof TRegistry["fragments"] ? true : false;
|
|
1288
|
+
/**
|
|
1289
|
+
* Check if a key exists in the operation registry.
|
|
1290
|
+
*/
|
|
1291
|
+
type HasPrebuiltOperation<TRegistry extends PrebuiltTypeRegistry, TKey$1 extends string> = TKey$1 extends keyof TRegistry["operations"] ? true : false;
|
|
1292
|
+
//#endregion
|
|
1293
|
+
//#region packages/core/src/composer/prebuilt-composer.d.ts
|
|
1294
|
+
/**
|
|
1295
|
+
* Resolves the output type for a prebuilt element.
|
|
1296
|
+
*
|
|
1297
|
+
* For Operations: Looks up by operation name in the registry
|
|
1298
|
+
* For Fragments: Looks up by fragment key in the registry
|
|
1299
|
+
* Falls back to the element's original type if not found in registry
|
|
1300
|
+
*/
|
|
1301
|
+
type ResolvePrebuiltElement<TElement, TPrebuilt extends PrebuiltTypeRegistry> = TElement extends Operation<infer TOperationType extends OperationType, infer TOperationName extends string, infer TVariableNames extends string[], any, infer TFields extends Partial<AnyFields>, any> ? TOperationName extends keyof TPrebuilt["operations"] ? Operation<TOperationType, TOperationName, TVariableNames, TPrebuilt["operations"][TOperationName]["input"] & AnyConstAssignableInput, TFields, TPrebuilt["operations"][TOperationName]["output"] & object> : TElement : TElement extends Fragment<infer TTypeName extends string, any, infer TFields extends Partial<AnyFields>, any, infer TKey extends string | undefined> ? TKey extends keyof TPrebuilt["fragments"] ? Fragment<TTypeName, TPrebuilt["fragments"][TKey]["input"] extends infer TInput ? TInput extends AnyAssignableInput ? Partial<TInput> : void : void, TFields, TPrebuilt["fragments"][TKey]["output"] & object, TKey> : TElement : TElement;
|
|
1302
|
+
/**
|
|
1303
|
+
* Prebuilt element composer that resolves types from a registry.
|
|
1304
|
+
*/
|
|
1305
|
+
type PrebuiltGqlElementComposer<TContext, TPrebuilt extends PrebuiltTypeRegistry> = <TResult extends AnyFragment | Operation<OperationType, string, string[], AnyConstAssignableInput, AnyFields, object>>(composeElement: (context: TContext) => TResult) => ResolvePrebuiltElement<TResult, TPrebuilt>;
|
|
1306
|
+
/**
|
|
1307
|
+
* Prebuilt element composer with schema access.
|
|
1308
|
+
*
|
|
1309
|
+
* Extends the prebuilt composer function with a `$schema` property that provides
|
|
1310
|
+
* runtime access to the schema definition.
|
|
1311
|
+
*/
|
|
1312
|
+
type PrebuiltGqlElementComposerWithSchema<TContext, TPrebuilt extends PrebuiltTypeRegistry, TSchema extends AnyGraphqlSchema> = PrebuiltGqlElementComposer<TContext, TPrebuilt> & {
|
|
1313
|
+
/**
|
|
1314
|
+
* The GraphQL schema definition used by this composer.
|
|
1315
|
+
*/
|
|
1316
|
+
readonly $schema: TSchema;
|
|
1317
|
+
};
|
|
1318
|
+
/**
|
|
1319
|
+
* Creates a prebuilt GQL element composer for a given schema.
|
|
1320
|
+
*
|
|
1321
|
+
* This composer has the same runtime behavior as `createGqlElementComposer`,
|
|
1322
|
+
* but the returned elements have their types resolved from the PrebuiltTypeRegistry
|
|
1323
|
+
* instead of using complex type inference.
|
|
1324
|
+
*
|
|
1325
|
+
* Use this when bundling with tools like tsdown that may lose type information.
|
|
1326
|
+
*
|
|
1327
|
+
* @param schema - The GraphQL schema definition
|
|
1328
|
+
* @param options - Configuration including input type methods and optional adapter
|
|
1329
|
+
* @returns Prebuilt element composer function
|
|
1330
|
+
*
|
|
1331
|
+
* @example
|
|
1332
|
+
* ```typescript
|
|
1333
|
+
* // Generated by codegen in prebuilt/index.ts
|
|
1334
|
+
* import type { PrebuiltTypes } from "./types";
|
|
1335
|
+
*
|
|
1336
|
+
* const gql = createPrebuiltGqlElementComposer<
|
|
1337
|
+
* Schema,
|
|
1338
|
+
* PrebuiltTypes,
|
|
1339
|
+
* FragmentBuilders,
|
|
1340
|
+
* DirectiveMethods,
|
|
1341
|
+
* Context
|
|
1342
|
+
* >(schema, { inputTypeMethods });
|
|
1343
|
+
*
|
|
1344
|
+
* // Types are resolved from PrebuiltTypes registry
|
|
1345
|
+
* const GetUser = gql(({ query }) =>
|
|
1346
|
+
* query.operation({
|
|
1347
|
+
* name: "GetUser",
|
|
1348
|
+
* fields: ({ f }) => ({ ...f.user({ id: "1" })(({ f }) => ({ ...f.id() })) }),
|
|
1349
|
+
* })
|
|
1350
|
+
* );
|
|
1351
|
+
* // GetUser.$infer.output is PrebuiltTypes["operations"]["GetUser"]["output"]
|
|
1352
|
+
* ```
|
|
1353
|
+
*/
|
|
1354
|
+
declare const createPrebuiltGqlElementComposer: <TSchema extends AnyGraphqlSchema, TPrebuilt extends PrebuiltTypeRegistry, TFragmentBuilders, TDirectiveMethods extends StandardDirectives, TContext, TAdapter extends AnyAdapter = DefaultAdapter>(schema: NoInfer<TSchema>, options: GqlElementComposerOptions<NoInfer<TSchema>, NoInfer<TDirectiveMethods>, NoInfer<TAdapter>>) => PrebuiltGqlElementComposerWithSchema<TContext, TPrebuilt, TSchema>;
|
|
1355
|
+
//#endregion
|
|
1356
|
+
//#region packages/core/src/prebuilt/type-calculator.d.ts
|
|
1357
|
+
/**
|
|
1358
|
+
* Formatters for customizing type name output.
|
|
1359
|
+
*
|
|
1360
|
+
* Used by type generation functions to format scalar and input object type names
|
|
1361
|
+
* with custom prefixes or patterns (e.g., schema-specific prefixes).
|
|
1362
|
+
*/
|
|
1363
|
+
type TypeFormatters = {
|
|
1364
|
+
/**
|
|
1365
|
+
* Format a scalar input type name.
|
|
1366
|
+
* Default: `ScalarInput<"Name">`
|
|
1367
|
+
*/
|
|
1368
|
+
readonly scalarInput?: (name: string) => string;
|
|
1369
|
+
/**
|
|
1370
|
+
* Format a scalar output type name.
|
|
1371
|
+
* Default: `ScalarOutput<"Name">`
|
|
1372
|
+
*/
|
|
1373
|
+
readonly scalarOutput?: (name: string) => string;
|
|
1374
|
+
/**
|
|
1375
|
+
* Format an input object type name.
|
|
1376
|
+
* Default: returns the name unchanged
|
|
1377
|
+
*/
|
|
1378
|
+
readonly inputObject?: (name: string) => string;
|
|
1379
|
+
};
|
|
1380
|
+
/**
|
|
1381
|
+
* Apply a type modifier to a base type string.
|
|
1382
|
+
*
|
|
1383
|
+
* Modifier format:
|
|
1384
|
+
* - "!" = required (T)
|
|
1385
|
+
* - "?" = optional (T | null | undefined)
|
|
1386
|
+
* - "![]!" = required array of required items (T[])
|
|
1387
|
+
* - "![]?" = optional array of required items (T[] | null | undefined)
|
|
1388
|
+
* - "?[]!" = required array of optional items ((T | null | undefined)[])
|
|
1389
|
+
* - "?[]?" = optional array of optional items ((T | null | undefined)[] | null | undefined)
|
|
1390
|
+
* - Deeper nesting follows the same pattern
|
|
1391
|
+
*/
|
|
1392
|
+
declare const applyTypeModifier: (baseType: string, modifier: TypeModifier) => string;
|
|
1393
|
+
/**
|
|
1394
|
+
* Get the TypeScript type string for a scalar output type from the schema.
|
|
1395
|
+
*
|
|
1396
|
+
* Returns a `ScalarOutput<"Name">` reference for all scalars in the schema.
|
|
1397
|
+
* The actual type is resolved at compile time from the inject file's scalar definitions.
|
|
1398
|
+
* This allows users to customize even built-in scalars (ID, String, etc.).
|
|
1399
|
+
*/
|
|
1400
|
+
declare const getScalarOutputType: (schema: AnyGraphqlSchema, scalarName: string) => string;
|
|
1401
|
+
/**
|
|
1402
|
+
* Get the TypeScript type string for a scalar input type from the schema.
|
|
1403
|
+
*
|
|
1404
|
+
* Returns a `ScalarInput<"Name">` reference for all scalars in the schema.
|
|
1405
|
+
* Used for input/variable types in operations.
|
|
1406
|
+
*/
|
|
1407
|
+
declare const getScalarInputType: (schema: AnyGraphqlSchema, scalarName: string) => string;
|
|
1408
|
+
/**
|
|
1409
|
+
* Get the TypeScript type string for an enum type from the schema.
|
|
1410
|
+
*/
|
|
1411
|
+
declare const getEnumType: (schema: AnyGraphqlSchema, enumName: string) => string;
|
|
1412
|
+
/**
|
|
1413
|
+
* Options for generating input object types.
|
|
1414
|
+
*/
|
|
1415
|
+
type GenerateInputObjectTypeOptions = {
|
|
1416
|
+
/**
|
|
1417
|
+
* Default depth limit for recursive types.
|
|
1418
|
+
* @default 3
|
|
1419
|
+
*/
|
|
1420
|
+
readonly defaultDepth?: number;
|
|
1421
|
+
/**
|
|
1422
|
+
* Per-type depth overrides.
|
|
1423
|
+
*/
|
|
1424
|
+
readonly depthOverrides?: InputDepthOverrides;
|
|
1425
|
+
/**
|
|
1426
|
+
* Custom formatters for type names.
|
|
1427
|
+
*/
|
|
1428
|
+
readonly formatters?: TypeFormatters;
|
|
1429
|
+
};
|
|
1430
|
+
/**
|
|
1431
|
+
* Generate a TypeScript type string for an input object type.
|
|
1432
|
+
*
|
|
1433
|
+
* Recursively expands fields using ScalarInput for scalars.
|
|
1434
|
+
* Returns `unknown` if depth is exhausted or circular reference is detected.
|
|
1435
|
+
*
|
|
1436
|
+
* @param schema - The GraphQL schema
|
|
1437
|
+
* @param inputName - The input object type name
|
|
1438
|
+
* @param options - Generation options including depth limits
|
|
1439
|
+
* @param seen - Set of already visited input names (for circular reference detection)
|
|
1440
|
+
* @param currentDepth - Current recursion depth
|
|
1441
|
+
*/
|
|
1442
|
+
declare const generateInputObjectType: (schema: AnyGraphqlSchema, inputName: string, options?: GenerateInputObjectTypeOptions, seen?: Set<string>, currentDepth?: number) => string;
|
|
1443
|
+
/**
|
|
1444
|
+
* Calculate the TypeScript type string for a single field selection.
|
|
1445
|
+
*
|
|
1446
|
+
* @param schema - The GraphQL schema
|
|
1447
|
+
* @param selection - The field selection to calculate type for
|
|
1448
|
+
* @param formatters - Optional formatters for customizing type names
|
|
1449
|
+
*/
|
|
1450
|
+
declare const calculateFieldType: (schema: AnyGraphqlSchema, selection: AnyFieldSelection, formatters?: TypeFormatters) => string;
|
|
1451
|
+
/**
|
|
1452
|
+
* Calculate the TypeScript type string for a set of field selections.
|
|
1453
|
+
* This is the main entry point for type calculation.
|
|
1454
|
+
*
|
|
1455
|
+
* @param schema - The GraphQL schema
|
|
1456
|
+
* @param fields - The field selections to calculate types for
|
|
1457
|
+
* @param formatters - Optional formatters for customizing type names
|
|
1458
|
+
*/
|
|
1459
|
+
declare const calculateFieldsType: (schema: AnyGraphqlSchema, fields: AnyFields | AnyNestedObject, formatters?: TypeFormatters) => string;
|
|
1460
|
+
/**
|
|
1461
|
+
* Convert a GraphQL TypeNode to a TypeScript type string for input types.
|
|
1462
|
+
*
|
|
1463
|
+
* Handles NonNullType, ListType, and NamedType recursively.
|
|
1464
|
+
* Uses ScalarInput for scalar types since this is used for input/variable types.
|
|
1465
|
+
*
|
|
1466
|
+
* @param schema - The GraphQL schema
|
|
1467
|
+
* @param typeNode - The GraphQL type node to convert
|
|
1468
|
+
* @param formatters - Optional formatters for customizing type names
|
|
1469
|
+
*/
|
|
1470
|
+
declare const graphqlTypeToTypeScript: (schema: AnyGraphqlSchema, typeNode: TypeNode, formatters?: TypeFormatters) => string;
|
|
1471
|
+
/**
|
|
1472
|
+
* Generate a TypeScript type string for operation input variables.
|
|
1473
|
+
*
|
|
1474
|
+
* Extracts variable types from GraphQL VariableDefinitionNode AST.
|
|
1475
|
+
*
|
|
1476
|
+
* @param schema - The GraphQL schema
|
|
1477
|
+
* @param variableDefinitions - Variable definition nodes from the operation
|
|
1478
|
+
* @param formatters - Optional formatters for customizing type names
|
|
1479
|
+
*/
|
|
1480
|
+
declare const generateInputType: (schema: AnyGraphqlSchema, variableDefinitions: readonly VariableDefinitionNode[], formatters?: TypeFormatters) => string;
|
|
1481
|
+
/**
|
|
1482
|
+
* Generate a TypeScript type string for input variables from InputTypeSpecifiers.
|
|
1483
|
+
*
|
|
1484
|
+
* Unlike generateInputType which works with GraphQL AST VariableDefinitionNode[],
|
|
1485
|
+
* this function works with soda-gql's internal InputTypeSpecifiers format.
|
|
1486
|
+
* Used for generating Fragment input types in prebuilt mode.
|
|
1487
|
+
*
|
|
1488
|
+
* @param schema - The GraphQL schema
|
|
1489
|
+
* @param specifiers - Input type specifiers (variable definitions)
|
|
1490
|
+
* @param options - Generation options including depth limits
|
|
1491
|
+
*/
|
|
1492
|
+
declare const generateInputTypeFromSpecifiers: (schema: AnyGraphqlSchema, specifiers: InputTypeSpecifiers, options?: GenerateInputObjectTypeOptions) => string;
|
|
1195
1493
|
//#endregion
|
|
1196
1494
|
//#region packages/core/src/utils/hidden.d.ts
|
|
1197
1495
|
declare const hidden: <T>() => (() => T);
|
|
@@ -1200,5 +1498,5 @@ type Hidden<T> = () => T;
|
|
|
1200
1498
|
//#region packages/core/src/utils/wrap-by-key.d.ts
|
|
1201
1499
|
declare function wrapByKey<TName$1 extends string, TValue$1>(name: TName$1, value: TValue$1): { [K in TName$1]: TValue$1 };
|
|
1202
1500
|
//#endregion
|
|
1203
|
-
export {
|
|
1204
|
-
//# sourceMappingURL=index-
|
|
1501
|
+
export { createFieldFactories as $, buildOperationTypeNode as $t, FragmentBuildersAll as A, AttachmentShape as At, VarBuilder as B, createStandardDirectives as Bt, PrebuiltFragmentInput as C, AnyDirectiveRef as Cn, NestedObjectFieldsBuilderTools as Ct, PrebuiltTypeRegistry as D, DirectiveRefInner as Dn, OptionalArg as Dt, PrebuiltOperationOutput as E, DirectiveRef as En, IfOmittable as Et, InputTypeMethod as F, DirectiveBuilder as Ft, createVarMethodFactory as G, createColocateHelper as Gt, VarSpecifier as H, ColocateHelper as Ht, InputTypeMethods as I, DirectiveMethod as It, withFragmentUsageCollection as J, Tuple as Jt, FragmentUsageRecord as K, StripFunctions as Kt, ResolveTypeFromMeta as L, StandardDirectives as Lt, GqlElementComposerOptions as M, AttachmentsTupleToIntersection as Mt, GqlElementComposerWithSchema as N, AnyDirectiveMethod as Nt, createOperationComposerFactory as O, SwitchIfOmittable as Ot, createGqlElementComposer as P, DirectiveArgValue as Pt, createVarRefs as Q, buildDocument as Qt, SchemaAwareGetNameAt as R, createDirectiveBuilder as Rt, HasPrebuiltOperation as S, GetAssignableType as Sn, NestedObjectFieldsBuilder as St, PrebuiltOperationInput as T, DirectiveLocation as Tn, EmptyObject as Tt, createVarBuilder as U, ColocatedEntries as Ut, VarBuilderMethods as V, isDirectiveRef as Vt, createVarMethod as W, ColocatedFields as Wt, createGqlFragmentComposers as X, buildArgumentValue as Xt, FragmentBuilderFor as Y, UnionToIntersection as Yt, createVarAssignments as Z, buildConstValueNode as Zt, PrebuiltGqlElementComposerWithSchema as _, AnyConstDirectiveAttachments as _n, FieldSelectionFactoryPrimitiveReturn as _t, TypeFormatters as a, AnyNestedUnion as an, Fragment as at, EmptyPrebuiltTypeRegistry as b, ConstAssignableInput as bn, FieldsBuilder as bt, calculateFieldsType as c, InferFields as cn, GqlElementAttachment as ct, generateInputTypeFromSpecifiers as d, AnyAssignableInputValue as dn, AnyFieldSelectionFactory as dt, buildWithTypeModifier as en, AnyOperation as et, getEnumType as f, AnyAssigningInput as fn, AnyFieldSelectionFactoryReturn as ft, PrebuiltGqlElementComposer as g, FieldArgumentValue as gn, FieldSelectionFactoryObjectReturn as gt, graphqlTypeToTypeScript as h, DeclaredVariables as hn, FieldSelectionFactoryFieldArguments as ht, GenerateInputObjectTypeOptions as i, AnyNestedObject as in, AnyFragment as it, GqlElementComposer as j, AttachmentToProperty as jt, ExtractMetadataAdapter as k, empty as kt, generateInputObjectType as l, AnyDirectiveAttachments as ln, GqlElementContext as lt, getScalarOutputType as m, AssignableInputByFieldName as mn, FieldSelectionFactory as mt, Hidden as n, AnyFieldSelection as nn, Operation as nt, applyTypeModifier as o, FieldSelectionTemplateOf as on, FragmentInferMeta as ot, getScalarInputType as p, AssignableInput as pn, FieldSelectionFactories as pt, recordFragmentUsage as q, StripSymbols as qt, hidden as r, AnyFields as rn, OperationInferMeta as rt, calculateFieldType as s, InferField as sn, GqlElement as st, wrapByKey as t, AbstractFieldSelection as tn, AnyOperationOf as tt, generateInputType as u, AnyAssignableInput as un, GqlElementDefinitionFactory as ut, ResolvePrebuiltElement as v, AnyConstAssignableInput as vn, FieldSelectionFactoryReturn as vt, PrebuiltFragmentOutput as w, AnyDirectiveRefBrand as wn, NestedUnionFieldsBuilder as wt, HasPrebuiltFragment as x, ConstAssignableInputValue as xn, FieldsBuilderTools as xt, createPrebuiltGqlElementComposer as y, AnyConstAssignableInputValue as yn, FieldSelectionFactoryUnionReturn as yt, SchemaAwareGetValueAt as z, createDirectiveMethod as zt };
|
|
1502
|
+
//# sourceMappingURL=index-ChwPP6wc.d.cts.map
|