@soda-gql/core 0.9.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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-CHshzPrG.d.cts} +335 -65
- package/dist/index-CHshzPrG.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-BlVgxrXb.d.ts → index-DnLzk2bC.d.cts} +2 -2
- package/dist/index-DnLzk2bC.d.cts.map +1 -0
- package/dist/{index-B_TU5U2U.d.ts → index-J050RXPw.d.ts} +335 -65
- package/dist/index-J050RXPw.d.ts.map +1 -0
- package/dist/index.cjs +378 -52
- 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 +361 -46
- 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/index-zCOsREx0.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
package/dist/adapter.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_schema_builder = require('./schema-builder-D2ay11cE.cjs');
|
|
2
2
|
|
|
3
3
|
//#region packages/core/src/adapter/define-adapter.ts
|
|
4
4
|
/**
|
|
@@ -78,5 +78,5 @@ const defineAdapter = (adapter) => adapter;
|
|
|
78
78
|
|
|
79
79
|
//#endregion
|
|
80
80
|
exports.defineAdapter = defineAdapter;
|
|
81
|
-
exports.defineScalar =
|
|
81
|
+
exports.defineScalar = require_schema_builder.defineScalar;
|
|
82
82
|
//# sourceMappingURL=adapter.cjs.map
|
package/dist/adapter.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as Adapter } from "./index-
|
|
2
|
-
import { r as defineScalar } from "./schema-builder-
|
|
1
|
+
import { t as Adapter } from "./index-DnLzk2bC.cjs";
|
|
2
|
+
import { r as defineScalar } from "./schema-builder-CwRmtxHx.cjs";
|
|
3
3
|
|
|
4
4
|
//#region packages/core/src/adapter/define-adapter.d.ts
|
|
5
5
|
|
package/dist/adapter.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as Adapter } from "./index-
|
|
2
|
-
import { r as defineScalar } from "./schema-builder-
|
|
1
|
+
import { t as Adapter } from "./index-CnQ5XVCf.js";
|
|
2
|
+
import { r as defineScalar } from "./schema-builder-CJe30s_R.js";
|
|
3
3
|
|
|
4
4
|
//#region packages/core/src/adapter/define-adapter.d.ts
|
|
5
5
|
|
package/dist/adapter.js
CHANGED
|
@@ -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
|
/**
|
|
@@ -1137,31 +1158,31 @@ type GqlElementComposerOptions<TSchema extends AnyGraphqlSchema, TDirectiveMetho
|
|
|
1137
1158
|
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>>) => GqlElementComposer<{
|
|
1138
1159
|
fragment: TFragmentBuilders;
|
|
1139
1160
|
query: {
|
|
1140
|
-
operation: <TOperationName extends string, TFields extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}, TOperationMetadata = unknown>(options: {
|
|
1141
|
-
name: TOperationName;
|
|
1161
|
+
operation: <TOperationName$1 extends string, TFields$1 extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}, TOperationMetadata = unknown>(options: {
|
|
1162
|
+
name: TOperationName$1;
|
|
1142
1163
|
variables?: TVarDefinitions | undefined;
|
|
1143
1164
|
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>;
|
|
1165
|
+
fields: FieldsBuilder<TSchema, TSchema["operations"]["query"] & keyof TSchema["object"] & string, TVarDefinitions, TFields$1>;
|
|
1145
1166
|
transformDocument?: OperationDocumentTransformer<TOperationMetadata> | undefined;
|
|
1146
|
-
}) => Operation<"query", TOperationName, (keyof TVarDefinitions & string)[], ConstAssignableInput<TSchema, TVarDefinitions>, TFields, InferFields<TSchema, TFields>>;
|
|
1167
|
+
}) => Operation<"query", TOperationName$1, (keyof TVarDefinitions & string)[], ConstAssignableInput<TSchema, TVarDefinitions>, TFields$1, InferFields<TSchema, TFields$1>>;
|
|
1147
1168
|
};
|
|
1148
1169
|
mutation: {
|
|
1149
|
-
operation: <TOperationName extends string, TFields extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}, TOperationMetadata = unknown>(options: {
|
|
1150
|
-
name: TOperationName;
|
|
1170
|
+
operation: <TOperationName$1 extends string, TFields$1 extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}, TOperationMetadata = unknown>(options: {
|
|
1171
|
+
name: TOperationName$1;
|
|
1151
1172
|
variables?: TVarDefinitions | undefined;
|
|
1152
1173
|
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>;
|
|
1174
|
+
fields: FieldsBuilder<TSchema, TSchema["operations"]["mutation"] & keyof TSchema["object"] & string, TVarDefinitions, TFields$1>;
|
|
1154
1175
|
transformDocument?: OperationDocumentTransformer<TOperationMetadata> | undefined;
|
|
1155
|
-
}) => Operation<"mutation", TOperationName, (keyof TVarDefinitions & string)[], ConstAssignableInput<TSchema, TVarDefinitions>, TFields, InferFields<TSchema, TFields>>;
|
|
1176
|
+
}) => Operation<"mutation", TOperationName$1, (keyof TVarDefinitions & string)[], ConstAssignableInput<TSchema, TVarDefinitions>, TFields$1, InferFields<TSchema, TFields$1>>;
|
|
1156
1177
|
};
|
|
1157
1178
|
subscription: {
|
|
1158
|
-
operation: <TOperationName extends string, TFields extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}, TOperationMetadata = unknown>(options: {
|
|
1159
|
-
name: TOperationName;
|
|
1179
|
+
operation: <TOperationName$1 extends string, TFields$1 extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}, TOperationMetadata = unknown>(options: {
|
|
1180
|
+
name: TOperationName$1;
|
|
1160
1181
|
variables?: TVarDefinitions | undefined;
|
|
1161
1182
|
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>;
|
|
1183
|
+
fields: FieldsBuilder<TSchema, TSchema["operations"]["subscription"] & keyof TSchema["object"] & string, TVarDefinitions, TFields$1>;
|
|
1163
1184
|
transformDocument?: OperationDocumentTransformer<TOperationMetadata> | undefined;
|
|
1164
|
-
}) => Operation<"subscription", TOperationName, (keyof TVarDefinitions & string)[], ConstAssignableInput<TSchema, TVarDefinitions>, TFields, InferFields<TSchema, TFields>>;
|
|
1185
|
+
}) => Operation<"subscription", TOperationName$1, (keyof TVarDefinitions & string)[], ConstAssignableInput<TSchema, TVarDefinitions>, TFields$1, InferFields<TSchema, TFields$1>>;
|
|
1165
1186
|
};
|
|
1166
1187
|
$var: VarBuilder<TSchema>;
|
|
1167
1188
|
$dir: TDirectiveMethods;
|
|
@@ -1185,13 +1206,262 @@ declare const createGqlElementComposer: <TSchema extends AnyGraphqlSchema, TFrag
|
|
|
1185
1206
|
*
|
|
1186
1207
|
* @internal Used by `createGqlElementComposer`
|
|
1187
1208
|
*/
|
|
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;
|
|
1209
|
+
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: {
|
|
1210
|
+
name: TOperationName$1;
|
|
1190
1211
|
variables?: TVarDefinitions;
|
|
1191
1212
|
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>;
|
|
1213
|
+
fields: FieldsBuilder<TSchema, TSchema["operations"][TOperationType$1] & keyof TSchema["object"] & string, TVarDefinitions, TFields$1>;
|
|
1193
1214
|
transformDocument?: OperationDocumentTransformer<TOperationMetadata>;
|
|
1194
|
-
}) => Operation<TOperationType, TOperationName, (keyof TVarDefinitions & string)[], ConstAssignableInput<TSchema, TVarDefinitions>, TFields, InferFields<TSchema, TFields>>;
|
|
1215
|
+
}) => Operation<TOperationType$1, TOperationName$1, (keyof TVarDefinitions & string)[], ConstAssignableInput<TSchema, TVarDefinitions>, TFields$1, InferFields<TSchema, TFields$1>>;
|
|
1216
|
+
//#endregion
|
|
1217
|
+
//#region packages/core/src/prebuilt/types.d.ts
|
|
1218
|
+
/**
|
|
1219
|
+
* Type definitions for prebuilt type system.
|
|
1220
|
+
*
|
|
1221
|
+
* These types enable looking up pre-computed types from a registry
|
|
1222
|
+
* instead of relying on complex type inference that may be lost
|
|
1223
|
+
* when bundling with tools like tsdown.
|
|
1224
|
+
*
|
|
1225
|
+
* @module
|
|
1226
|
+
*/
|
|
1227
|
+
/**
|
|
1228
|
+
* Registry mapping fragment/operation keys to their inferred types.
|
|
1229
|
+
* Generated by the builder and used by prebuilt composers.
|
|
1230
|
+
*/
|
|
1231
|
+
type PrebuiltTypeRegistry = {
|
|
1232
|
+
readonly fragments: {
|
|
1233
|
+
readonly [key: string]: {
|
|
1234
|
+
readonly input: unknown;
|
|
1235
|
+
readonly output: object;
|
|
1236
|
+
};
|
|
1237
|
+
};
|
|
1238
|
+
readonly operations: {
|
|
1239
|
+
readonly [key: string]: {
|
|
1240
|
+
readonly input: object;
|
|
1241
|
+
readonly output: object;
|
|
1242
|
+
};
|
|
1243
|
+
};
|
|
1244
|
+
};
|
|
1245
|
+
/**
|
|
1246
|
+
* Empty registry type for when no prebuilt types are available.
|
|
1247
|
+
*/
|
|
1248
|
+
type EmptyPrebuiltTypeRegistry = {
|
|
1249
|
+
readonly fragments: Record<string, never>;
|
|
1250
|
+
readonly operations: Record<string, never>;
|
|
1251
|
+
};
|
|
1252
|
+
/**
|
|
1253
|
+
* Extract the input type for a fragment from the registry.
|
|
1254
|
+
*/
|
|
1255
|
+
type PrebuiltFragmentInput<TRegistry extends PrebuiltTypeRegistry, TKey$1 extends keyof TRegistry["fragments"] & string> = TRegistry["fragments"][TKey$1]["input"];
|
|
1256
|
+
/**
|
|
1257
|
+
* Extract the output type for a fragment from the registry.
|
|
1258
|
+
*/
|
|
1259
|
+
type PrebuiltFragmentOutput<TRegistry extends PrebuiltTypeRegistry, TKey$1 extends keyof TRegistry["fragments"] & string> = TRegistry["fragments"][TKey$1]["output"];
|
|
1260
|
+
/**
|
|
1261
|
+
* Extract the input type for an operation from the registry.
|
|
1262
|
+
*/
|
|
1263
|
+
type PrebuiltOperationInput<TRegistry extends PrebuiltTypeRegistry, TKey$1 extends keyof TRegistry["operations"] & string> = TRegistry["operations"][TKey$1]["input"];
|
|
1264
|
+
/**
|
|
1265
|
+
* Extract the output type for an operation from the registry.
|
|
1266
|
+
*/
|
|
1267
|
+
type PrebuiltOperationOutput<TRegistry extends PrebuiltTypeRegistry, TKey$1 extends keyof TRegistry["operations"] & string> = TRegistry["operations"][TKey$1]["output"];
|
|
1268
|
+
/**
|
|
1269
|
+
* Check if a key exists in the fragment registry.
|
|
1270
|
+
*/
|
|
1271
|
+
type HasPrebuiltFragment<TRegistry extends PrebuiltTypeRegistry, TKey$1 extends string> = TKey$1 extends keyof TRegistry["fragments"] ? true : false;
|
|
1272
|
+
/**
|
|
1273
|
+
* Check if a key exists in the operation registry.
|
|
1274
|
+
*/
|
|
1275
|
+
type HasPrebuiltOperation<TRegistry extends PrebuiltTypeRegistry, TKey$1 extends string> = TKey$1 extends keyof TRegistry["operations"] ? true : false;
|
|
1276
|
+
//#endregion
|
|
1277
|
+
//#region packages/core/src/composer/prebuilt-composer.d.ts
|
|
1278
|
+
/**
|
|
1279
|
+
* Resolves the output type for a prebuilt element.
|
|
1280
|
+
*
|
|
1281
|
+
* For Operations: Looks up by operation name in the registry
|
|
1282
|
+
* For Fragments: Looks up by fragment key in the registry
|
|
1283
|
+
* Falls back to the element's original type if not found in registry
|
|
1284
|
+
*/
|
|
1285
|
+
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;
|
|
1286
|
+
/**
|
|
1287
|
+
* Prebuilt element composer that resolves types from a registry.
|
|
1288
|
+
*/
|
|
1289
|
+
type PrebuiltGqlElementComposer<TContext, TPrebuilt extends PrebuiltTypeRegistry> = <TResult extends AnyFragment | Operation<OperationType, string, string[], AnyConstAssignableInput, AnyFields, object>>(composeElement: (context: TContext) => TResult) => ResolvePrebuiltElement<TResult, TPrebuilt>;
|
|
1290
|
+
/**
|
|
1291
|
+
* Creates a prebuilt GQL element composer for a given schema.
|
|
1292
|
+
*
|
|
1293
|
+
* This composer has the same runtime behavior as `createGqlElementComposer`,
|
|
1294
|
+
* but the returned elements have their types resolved from the PrebuiltTypeRegistry
|
|
1295
|
+
* instead of using complex type inference.
|
|
1296
|
+
*
|
|
1297
|
+
* Use this when bundling with tools like tsdown that may lose type information.
|
|
1298
|
+
*
|
|
1299
|
+
* @param schema - The GraphQL schema definition
|
|
1300
|
+
* @param options - Configuration including input type methods and optional adapter
|
|
1301
|
+
* @returns Prebuilt element composer function
|
|
1302
|
+
*
|
|
1303
|
+
* @example
|
|
1304
|
+
* ```typescript
|
|
1305
|
+
* // Generated by codegen in prebuilt/index.ts
|
|
1306
|
+
* import type { PrebuiltTypes } from "./types";
|
|
1307
|
+
*
|
|
1308
|
+
* const gql = createPrebuiltGqlElementComposer<
|
|
1309
|
+
* Schema,
|
|
1310
|
+
* PrebuiltTypes,
|
|
1311
|
+
* FragmentBuilders,
|
|
1312
|
+
* DirectiveMethods,
|
|
1313
|
+
* Context
|
|
1314
|
+
* >(schema, { inputTypeMethods });
|
|
1315
|
+
*
|
|
1316
|
+
* // Types are resolved from PrebuiltTypes registry
|
|
1317
|
+
* const GetUser = gql(({ query }) =>
|
|
1318
|
+
* query.operation({
|
|
1319
|
+
* name: "GetUser",
|
|
1320
|
+
* fields: ({ f }) => ({ ...f.user({ id: "1" })(({ f }) => ({ ...f.id() })) }),
|
|
1321
|
+
* })
|
|
1322
|
+
* );
|
|
1323
|
+
* // GetUser.$infer.output is PrebuiltTypes["operations"]["GetUser"]["output"]
|
|
1324
|
+
* ```
|
|
1325
|
+
*/
|
|
1326
|
+
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>>) => PrebuiltGqlElementComposer<TContext, TPrebuilt>;
|
|
1327
|
+
//#endregion
|
|
1328
|
+
//#region packages/core/src/prebuilt/type-calculator.d.ts
|
|
1329
|
+
/**
|
|
1330
|
+
* Formatters for customizing type name output.
|
|
1331
|
+
*
|
|
1332
|
+
* Used by type generation functions to format scalar and input object type names
|
|
1333
|
+
* with custom prefixes or patterns (e.g., schema-specific prefixes).
|
|
1334
|
+
*/
|
|
1335
|
+
type TypeFormatters = {
|
|
1336
|
+
/**
|
|
1337
|
+
* Format a scalar input type name.
|
|
1338
|
+
* Default: `ScalarInput<"Name">`
|
|
1339
|
+
*/
|
|
1340
|
+
readonly scalarInput?: (name: string) => string;
|
|
1341
|
+
/**
|
|
1342
|
+
* Format a scalar output type name.
|
|
1343
|
+
* Default: `ScalarOutput<"Name">`
|
|
1344
|
+
*/
|
|
1345
|
+
readonly scalarOutput?: (name: string) => string;
|
|
1346
|
+
/**
|
|
1347
|
+
* Format an input object type name.
|
|
1348
|
+
* Default: returns the name unchanged
|
|
1349
|
+
*/
|
|
1350
|
+
readonly inputObject?: (name: string) => string;
|
|
1351
|
+
};
|
|
1352
|
+
/**
|
|
1353
|
+
* Apply a type modifier to a base type string.
|
|
1354
|
+
*
|
|
1355
|
+
* Modifier format:
|
|
1356
|
+
* - "!" = required (T)
|
|
1357
|
+
* - "?" = optional (T | null | undefined)
|
|
1358
|
+
* - "![]!" = required array of required items (T[])
|
|
1359
|
+
* - "![]?" = optional array of required items (T[] | null | undefined)
|
|
1360
|
+
* - "?[]!" = required array of optional items ((T | null | undefined)[])
|
|
1361
|
+
* - "?[]?" = optional array of optional items ((T | null | undefined)[] | null | undefined)
|
|
1362
|
+
* - Deeper nesting follows the same pattern
|
|
1363
|
+
*/
|
|
1364
|
+
declare const applyTypeModifier: (baseType: string, modifier: TypeModifier) => string;
|
|
1365
|
+
/**
|
|
1366
|
+
* Get the TypeScript type string for a scalar output type from the schema.
|
|
1367
|
+
*
|
|
1368
|
+
* Returns a `ScalarOutput<"Name">` reference for all scalars in the schema.
|
|
1369
|
+
* The actual type is resolved at compile time from the inject file's scalar definitions.
|
|
1370
|
+
* This allows users to customize even built-in scalars (ID, String, etc.).
|
|
1371
|
+
*/
|
|
1372
|
+
declare const getScalarOutputType: (schema: AnyGraphqlSchema, scalarName: string) => string;
|
|
1373
|
+
/**
|
|
1374
|
+
* Get the TypeScript type string for a scalar input type from the schema.
|
|
1375
|
+
*
|
|
1376
|
+
* Returns a `ScalarInput<"Name">` reference for all scalars in the schema.
|
|
1377
|
+
* Used for input/variable types in operations.
|
|
1378
|
+
*/
|
|
1379
|
+
declare const getScalarInputType: (schema: AnyGraphqlSchema, scalarName: string) => string;
|
|
1380
|
+
/**
|
|
1381
|
+
* Get the TypeScript type string for an enum type from the schema.
|
|
1382
|
+
*/
|
|
1383
|
+
declare const getEnumType: (schema: AnyGraphqlSchema, enumName: string) => string;
|
|
1384
|
+
/**
|
|
1385
|
+
* Options for generating input object types.
|
|
1386
|
+
*/
|
|
1387
|
+
type GenerateInputObjectTypeOptions = {
|
|
1388
|
+
/**
|
|
1389
|
+
* Default depth limit for recursive types.
|
|
1390
|
+
* @default 3
|
|
1391
|
+
*/
|
|
1392
|
+
readonly defaultDepth?: number;
|
|
1393
|
+
/**
|
|
1394
|
+
* Per-type depth overrides.
|
|
1395
|
+
*/
|
|
1396
|
+
readonly depthOverrides?: InputDepthOverrides;
|
|
1397
|
+
/**
|
|
1398
|
+
* Custom formatters for type names.
|
|
1399
|
+
*/
|
|
1400
|
+
readonly formatters?: TypeFormatters;
|
|
1401
|
+
};
|
|
1402
|
+
/**
|
|
1403
|
+
* Generate a TypeScript type string for an input object type.
|
|
1404
|
+
*
|
|
1405
|
+
* Recursively expands fields using ScalarInput for scalars.
|
|
1406
|
+
* Returns `unknown` if depth is exhausted or circular reference is detected.
|
|
1407
|
+
*
|
|
1408
|
+
* @param schema - The GraphQL schema
|
|
1409
|
+
* @param inputName - The input object type name
|
|
1410
|
+
* @param options - Generation options including depth limits
|
|
1411
|
+
* @param seen - Set of already visited input names (for circular reference detection)
|
|
1412
|
+
* @param currentDepth - Current recursion depth
|
|
1413
|
+
*/
|
|
1414
|
+
declare const generateInputObjectType: (schema: AnyGraphqlSchema, inputName: string, options?: GenerateInputObjectTypeOptions, seen?: Set<string>, currentDepth?: number) => string;
|
|
1415
|
+
/**
|
|
1416
|
+
* Calculate the TypeScript type string for a single field selection.
|
|
1417
|
+
*
|
|
1418
|
+
* @param schema - The GraphQL schema
|
|
1419
|
+
* @param selection - The field selection to calculate type for
|
|
1420
|
+
* @param formatters - Optional formatters for customizing type names
|
|
1421
|
+
*/
|
|
1422
|
+
declare const calculateFieldType: (schema: AnyGraphqlSchema, selection: AnyFieldSelection, formatters?: TypeFormatters) => string;
|
|
1423
|
+
/**
|
|
1424
|
+
* Calculate the TypeScript type string for a set of field selections.
|
|
1425
|
+
* This is the main entry point for type calculation.
|
|
1426
|
+
*
|
|
1427
|
+
* @param schema - The GraphQL schema
|
|
1428
|
+
* @param fields - The field selections to calculate types for
|
|
1429
|
+
* @param formatters - Optional formatters for customizing type names
|
|
1430
|
+
*/
|
|
1431
|
+
declare const calculateFieldsType: (schema: AnyGraphqlSchema, fields: AnyFields | AnyNestedObject, formatters?: TypeFormatters) => string;
|
|
1432
|
+
/**
|
|
1433
|
+
* Convert a GraphQL TypeNode to a TypeScript type string for input types.
|
|
1434
|
+
*
|
|
1435
|
+
* Handles NonNullType, ListType, and NamedType recursively.
|
|
1436
|
+
* Uses ScalarInput for scalar types since this is used for input/variable types.
|
|
1437
|
+
*
|
|
1438
|
+
* @param schema - The GraphQL schema
|
|
1439
|
+
* @param typeNode - The GraphQL type node to convert
|
|
1440
|
+
* @param formatters - Optional formatters for customizing type names
|
|
1441
|
+
*/
|
|
1442
|
+
declare const graphqlTypeToTypeScript: (schema: AnyGraphqlSchema, typeNode: TypeNode, formatters?: TypeFormatters) => string;
|
|
1443
|
+
/**
|
|
1444
|
+
* Generate a TypeScript type string for operation input variables.
|
|
1445
|
+
*
|
|
1446
|
+
* Extracts variable types from GraphQL VariableDefinitionNode AST.
|
|
1447
|
+
*
|
|
1448
|
+
* @param schema - The GraphQL schema
|
|
1449
|
+
* @param variableDefinitions - Variable definition nodes from the operation
|
|
1450
|
+
* @param formatters - Optional formatters for customizing type names
|
|
1451
|
+
*/
|
|
1452
|
+
declare const generateInputType: (schema: AnyGraphqlSchema, variableDefinitions: readonly VariableDefinitionNode[], formatters?: TypeFormatters) => string;
|
|
1453
|
+
/**
|
|
1454
|
+
* Generate a TypeScript type string for input variables from InputTypeSpecifiers.
|
|
1455
|
+
*
|
|
1456
|
+
* Unlike generateInputType which works with GraphQL AST VariableDefinitionNode[],
|
|
1457
|
+
* this function works with soda-gql's internal InputTypeSpecifiers format.
|
|
1458
|
+
* Used for generating Fragment input types in prebuilt mode.
|
|
1459
|
+
*
|
|
1460
|
+
* @param schema - The GraphQL schema
|
|
1461
|
+
* @param specifiers - Input type specifiers (variable definitions)
|
|
1462
|
+
* @param options - Generation options including depth limits
|
|
1463
|
+
*/
|
|
1464
|
+
declare const generateInputTypeFromSpecifiers: (schema: AnyGraphqlSchema, specifiers: InputTypeSpecifiers, options?: GenerateInputObjectTypeOptions) => string;
|
|
1195
1465
|
//#endregion
|
|
1196
1466
|
//#region packages/core/src/utils/hidden.d.ts
|
|
1197
1467
|
declare const hidden: <T>() => (() => T);
|
|
@@ -1200,5 +1470,5 @@ type Hidden<T> = () => T;
|
|
|
1200
1470
|
//#region packages/core/src/utils/wrap-by-key.d.ts
|
|
1201
1471
|
declare function wrapByKey<TName$1 extends string, TValue$1>(name: TName$1, value: TValue$1): { [K in TName$1]: TValue$1 };
|
|
1202
1472
|
//#endregion
|
|
1203
|
-
export {
|
|
1204
|
-
//# sourceMappingURL=index-
|
|
1473
|
+
export { AnyOperationOf as $, AbstractFieldSelection as $t, GqlElementComposer as A, AttachmentsTupleToIntersection as At, VarSpecifier as B, ColocateHelper as Bt, PrebuiltFragmentOutput as C, DirectiveLocation as Cn, EmptyObject as Ct, createOperationComposerFactory as D, empty as Dt, PrebuiltTypeRegistry as E, SwitchIfOmittable as Et, ResolveTypeFromMeta as F, StandardDirectives as Ft, recordFragmentUsage as G, StripSymbols as Gt, createVarMethod as H, ColocatedFields as Ht, SchemaAwareGetNameAt as I, createDirectiveBuilder as It, createGqlFragmentComposers as J, buildArgumentValue as Jt, withFragmentUsageCollection as K, Tuple as Kt, SchemaAwareGetValueAt as L, createDirectiveMethod as Lt, createGqlElementComposer as M, DirectiveArgValue as Mt, InputTypeMethod as N, DirectiveBuilder as Nt, ExtractMetadataAdapter as O, AttachmentShape as Ot, InputTypeMethods as P, DirectiveMethod as Pt, AnyOperation as Q, buildWithTypeModifier as Qt, VarBuilder as R, createStandardDirectives as Rt, PrebuiltFragmentInput as S, AnyDirectiveRefBrand as Sn, NestedUnionFieldsBuilder as St, PrebuiltOperationOutput as T, DirectiveRefInner as Tn, OptionalArg as Tt, createVarMethodFactory as U, createColocateHelper as Ut, createVarBuilder as V, ColocatedEntries as Vt, FragmentUsageRecord as W, StripFunctions as Wt, createVarRefs as X, buildDocument as Xt, createVarAssignments as Y, buildConstValueNode as Yt, createFieldFactories as Z, buildOperationTypeNode as Zt, ResolvePrebuiltElement as _, AnyConstAssignableInputValue as _n, FieldSelectionFactoryUnionReturn as _t, TypeFormatters as a, InferField as an, GqlElement as at, HasPrebuiltFragment as b, GetAssignableType as bn, NestedObjectFieldsBuilder as bt, calculateFieldsType as c, AnyAssignableInput as cn, GqlElementDefinitionFactory as ct, generateInputTypeFromSpecifiers as d, AssignableInput as dn, FieldSelectionFactories as dt, AnyFieldSelection as en, Operation as et, getEnumType as f, AssignableInputByFieldName as fn, FieldSelectionFactory as ft, PrebuiltGqlElementComposer as g, AnyConstAssignableInput as gn, FieldSelectionFactoryReturn as gt, graphqlTypeToTypeScript as h, AnyConstDirectiveAttachments as hn, FieldSelectionFactoryPrimitiveReturn as ht, GenerateInputObjectTypeOptions as i, FieldSelectionTemplateOf as in, FragmentInferMeta as it, GqlElementComposerOptions as j, AnyDirectiveMethod as jt, FragmentBuildersAll as k, AttachmentToProperty as kt, generateInputObjectType as l, AnyAssignableInputValue as ln, AnyFieldSelectionFactory as lt, getScalarOutputType as m, FieldArgumentValue as mn, FieldSelectionFactoryObjectReturn as mt, Hidden as n, AnyNestedObject as nn, AnyFragment as nt, applyTypeModifier as o, InferFields as on, GqlElementAttachment as ot, getScalarInputType as p, DeclaredVariables as pn, FieldSelectionFactoryFieldArguments as pt, FragmentBuilderFor as q, UnionToIntersection as qt, hidden as r, AnyNestedUnion as rn, Fragment as rt, calculateFieldType as s, AnyDirectiveAttachments as sn, GqlElementContext as st, wrapByKey as t, AnyFields as tn, OperationInferMeta as tt, generateInputType as u, AnyAssigningInput as un, AnyFieldSelectionFactoryReturn as ut, createPrebuiltGqlElementComposer as v, ConstAssignableInput as vn, FieldsBuilder as vt, PrebuiltOperationInput as w, DirectiveRef as wn, IfOmittable as wt, HasPrebuiltOperation as x, AnyDirectiveRef as xn, NestedObjectFieldsBuilderTools as xt, EmptyPrebuiltTypeRegistry as y, ConstAssignableInputValue as yn, FieldsBuilderTools as yt, VarBuilderMethods as z, isDirectiveRef as zt };
|
|
1474
|
+
//# sourceMappingURL=index-CHshzPrG.d.cts.map
|