@soda-gql/core 0.10.2 → 0.11.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/README.md +1 -1
- package/dist/{index-Cbo0WJHs.d.ts → index-BcA2XPEk.d.ts} +175 -224
- package/dist/index-BcA2XPEk.d.ts.map +1 -0
- package/dist/index-Bj60NxMb.d.cts.map +1 -1
- package/dist/{index-gHe-Lwi7.d.cts → index-CatAewXz.d.cts} +175 -224
- package/dist/index-CatAewXz.d.cts.map +1 -0
- package/dist/index-DbANHktR.d.ts.map +1 -1
- package/dist/index.cjs +86 -87
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +87 -87
- package/dist/index.js.map +1 -1
- package/dist/runtime.d.cts +1 -1
- package/dist/runtime.d.cts.map +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/index-Cbo0WJHs.d.ts.map +0 -1
- package/dist/index-gHe-Lwi7.d.cts.map +0 -1
|
@@ -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
|
|
228
|
+
type InferFields<TSchema extends AnyGraphqlSchema, TFields extends AnyFields> = { [_ in TSchema["label"]]: { [TAliasName in keyof TFields]: InferField<TSchema, TFields[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;
|
|
@@ -238,20 +238,37 @@ type InferField<TSchema extends AnyGraphqlSchema, TSelection extends AnyFieldSel
|
|
|
238
238
|
} ? GetModifiedType<InferOutputProfile<TSchema, TSpecifier>, TSpecifier["modifier"]> : never);
|
|
239
239
|
//#endregion
|
|
240
240
|
//#region packages/core/src/composer/build-document.d.ts
|
|
241
|
+
/**
|
|
242
|
+
* Context for determining if a value should be output as an enum.
|
|
243
|
+
* Contains the schema for looking up nested input types and the current type specifier.
|
|
244
|
+
*/
|
|
245
|
+
type EnumLookup = {
|
|
246
|
+
schema: AnyGraphqlSchema;
|
|
247
|
+
/** Type specifier for the current value. null means enum detection is skipped. */
|
|
248
|
+
typeSpecifier: InputTypeSpecifier | null;
|
|
249
|
+
};
|
|
241
250
|
/**
|
|
242
251
|
* Converts an assignable input value to a GraphQL AST ValueNode.
|
|
243
252
|
*
|
|
244
253
|
* Handles primitives, arrays, objects, and variable references.
|
|
245
254
|
* Returns null for undefined values (field is omitted).
|
|
255
|
+
*
|
|
256
|
+
* @param value - The value to convert
|
|
257
|
+
* @param enumLookup - Context for enum detection. String values will be output
|
|
258
|
+
* as Kind.ENUM if typeSpecifier indicates an enum type.
|
|
246
259
|
*/
|
|
247
|
-
declare const buildArgumentValue: (value: AnyAssignableInputValue) => ValueNode | null;
|
|
260
|
+
declare const buildArgumentValue: (value: AnyAssignableInputValue, enumLookup: EnumLookup) => ValueNode | null;
|
|
248
261
|
/**
|
|
249
262
|
* Converts a constant value to a GraphQL AST ConstValueNode.
|
|
250
263
|
*
|
|
251
264
|
* Unlike `buildArgumentValue`, this only handles literal values
|
|
252
265
|
* (no variable references). Used for default values.
|
|
266
|
+
*
|
|
267
|
+
* @param value - The constant value to convert
|
|
268
|
+
* @param enumLookup - Context for enum detection. String values will be output
|
|
269
|
+
* as Kind.ENUM if typeSpecifier indicates an enum type.
|
|
253
270
|
*/
|
|
254
|
-
declare const buildConstValueNode: (value: ConstValue) => ConstValueNode | null;
|
|
271
|
+
declare const buildConstValueNode: (value: ConstValue, enumLookup: EnumLookup) => ConstValueNode | null;
|
|
255
272
|
/**
|
|
256
273
|
* Wraps a named type with modifiers (non-null, list).
|
|
257
274
|
*
|
|
@@ -276,15 +293,16 @@ declare const buildOperationTypeNode: (operation: OperationType) => OperationTyp
|
|
|
276
293
|
* a GraphQL document AST. The result can be used with any GraphQL
|
|
277
294
|
* client that supports TypedDocumentNode.
|
|
278
295
|
*
|
|
279
|
-
* @param options - Operation configuration (name, type, variables, fields)
|
|
296
|
+
* @param options - Operation configuration (name, type, variables, fields, schema)
|
|
280
297
|
* @returns TypedDocumentNode with inferred input/output types
|
|
281
298
|
*/
|
|
282
|
-
declare const buildDocument: <TSchema extends AnyGraphqlSchema, TFields
|
|
299
|
+
declare const buildDocument: <TSchema extends AnyGraphqlSchema, TFields extends AnyFields, TVarDefinitions extends InputTypeSpecifiers>(options: {
|
|
283
300
|
operationName: string;
|
|
284
301
|
operationType: OperationType;
|
|
285
302
|
variables: TVarDefinitions;
|
|
286
|
-
fields: TFields
|
|
287
|
-
|
|
303
|
+
fields: TFields;
|
|
304
|
+
schema: TSchema;
|
|
305
|
+
}) => TypedDocumentNode<InferFields<TSchema, TFields>, ConstAssignableInput<TSchema, TVarDefinitions>>;
|
|
288
306
|
//#endregion
|
|
289
307
|
//#region packages/core/src/utils/type-utils.d.ts
|
|
290
308
|
type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends ((x: infer I) => void) ? I : never;
|
|
@@ -479,7 +497,7 @@ declare const empty: () => EmptyObject;
|
|
|
479
497
|
* tooling `f`/`fields`/`_` aliases provide ergonomic access to GraphQL fields
|
|
480
498
|
* while preserving the original schema information for inference.
|
|
481
499
|
*/
|
|
482
|
-
type FieldsBuilder<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"] & string, TVariableDefinitions extends InputTypeSpecifiers, TFields
|
|
500
|
+
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;
|
|
483
501
|
/**
|
|
484
502
|
* Tools provided to field builder callbacks.
|
|
485
503
|
* - `f`: Field selection factories for the current type
|
|
@@ -493,7 +511,7 @@ type FieldsBuilderTools<TSchema extends AnyGraphqlSchema, TTypeName$1 extends ke
|
|
|
493
511
|
* Builder for nested object field selections.
|
|
494
512
|
* Used when a field returns an object type requiring sub-selections.
|
|
495
513
|
*/
|
|
496
|
-
type NestedObjectFieldsBuilder<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"] & string, TFields
|
|
514
|
+
type NestedObjectFieldsBuilder<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"] & string, TFields extends AnyNestedObject> = (tools: NoInfer<NestedObjectFieldsBuilderTools<TSchema, TTypeName$1>>) => TFields;
|
|
497
515
|
/**
|
|
498
516
|
* Tools for nested object builders (no variable access).
|
|
499
517
|
* @internal
|
|
@@ -651,7 +669,7 @@ declare abstract class GqlElement<TDefinition extends object, TInfer extends obj
|
|
|
651
669
|
/**
|
|
652
670
|
* Type alias for any Fragment instance.
|
|
653
671
|
*/
|
|
654
|
-
type AnyFragment = Fragment<string, any, AnyFields, any
|
|
672
|
+
type AnyFragment = Fragment<string, any, AnyFields, any>;
|
|
655
673
|
/**
|
|
656
674
|
* Type inference metadata for fragments.
|
|
657
675
|
* Access via `typeof fragment.$infer`.
|
|
@@ -664,12 +682,12 @@ type FragmentInferMeta<TVariables, TOutput extends object> = {
|
|
|
664
682
|
* Internal artifact shape produced by fragment evaluation.
|
|
665
683
|
* @internal
|
|
666
684
|
*/
|
|
667
|
-
interface FragmentArtifact<TTypeName$1 extends string, TVariables extends Partial<AnyAssignableInput> | void, TFields
|
|
685
|
+
interface FragmentArtifact<TTypeName$1 extends string, TVariables extends Partial<AnyAssignableInput> | void, TFields extends Partial<AnyFields>> {
|
|
668
686
|
readonly typename: TTypeName$1;
|
|
669
|
-
readonly key:
|
|
687
|
+
readonly key: string | undefined;
|
|
670
688
|
readonly schemaLabel: string;
|
|
671
689
|
readonly variableDefinitions: InputTypeSpecifiers;
|
|
672
|
-
readonly spread: (variables: TVariables) => TFields
|
|
690
|
+
readonly spread: (variables: TVariables) => TFields;
|
|
673
691
|
}
|
|
674
692
|
declare const __FRAGMENT_BRAND__: unique symbol;
|
|
675
693
|
/**
|
|
@@ -682,15 +700,14 @@ declare const __FRAGMENT_BRAND__: unique symbol;
|
|
|
682
700
|
* @template TVariables - Variables required when spreading
|
|
683
701
|
* @template TFields - The selected fields structure
|
|
684
702
|
* @template TOutput - Inferred output type from selected fields
|
|
685
|
-
* @template TKey - Optional unique key for prebuilt type lookup
|
|
686
703
|
*/
|
|
687
|
-
declare class Fragment<TTypeName$1 extends string, TVariables extends Partial<AnyAssignableInput> | void, TFields
|
|
704
|
+
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> {
|
|
688
705
|
private readonly [__FRAGMENT_BRAND__];
|
|
689
706
|
private constructor();
|
|
690
707
|
/** The GraphQL type name this fragment selects from. */
|
|
691
708
|
get typename(): TTypeName$1;
|
|
692
709
|
/** Optional unique key for prebuilt type lookup. */
|
|
693
|
-
get key():
|
|
710
|
+
get key(): string | undefined;
|
|
694
711
|
/** The schema label this fragment belongs to. */
|
|
695
712
|
get schemaLabel(): string;
|
|
696
713
|
/** Variable definitions for this fragment. */
|
|
@@ -699,23 +716,23 @@ declare class Fragment<TTypeName$1 extends string, TVariables extends Partial<An
|
|
|
699
716
|
* Spreads this fragment's fields into a parent selection.
|
|
700
717
|
* Pass variables if the fragment defines any.
|
|
701
718
|
*/
|
|
702
|
-
get spread(): (variables: TVariables) => TFields
|
|
719
|
+
get spread(): (variables: TVariables) => TFields;
|
|
703
720
|
/**
|
|
704
721
|
* Creates a new Fragment instance.
|
|
705
722
|
* Prefer using the `gql(({ fragment }) => ...)` API instead.
|
|
706
723
|
* @internal
|
|
707
724
|
*/
|
|
708
|
-
static create<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"] & string, TVariableDefinitions extends InputTypeSpecifiers, TFields
|
|
725
|
+
static create<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"] & string, TVariableDefinitions extends InputTypeSpecifiers, TFields extends AnyFields>(define: () => {
|
|
709
726
|
typename: TTypeName$1;
|
|
710
|
-
key:
|
|
727
|
+
key: string | undefined;
|
|
711
728
|
schemaLabel: TSchema["label"];
|
|
712
729
|
variableDefinitions: TVariableDefinitions;
|
|
713
|
-
spread: (variables: OptionalArg<AssignableInput<TSchema, TVariableDefinitions>>) => TFields
|
|
714
|
-
}): Fragment<TTypeName$1, OptionalArg<AssignableInput<TSchema, TVariableDefinitions>>, TFields
|
|
730
|
+
spread: (variables: OptionalArg<AssignableInput<TSchema, TVariableDefinitions>>) => TFields;
|
|
731
|
+
}): Fragment<TTypeName$1, OptionalArg<AssignableInput<TSchema, TVariableDefinitions>>, TFields & {
|
|
715
732
|
[key: symbol]: never;
|
|
716
|
-
}, InferFields<TSchema, TFields
|
|
733
|
+
}, InferFields<TSchema, TFields> & {
|
|
717
734
|
[key: symbol]: never;
|
|
718
|
-
}
|
|
735
|
+
}>;
|
|
719
736
|
}
|
|
720
737
|
//#endregion
|
|
721
738
|
//#region packages/core/src/types/element/operation.d.ts
|
|
@@ -726,7 +743,7 @@ type AnyOperation = AnyOperationOf<"query"> | AnyOperationOf<"mutation"> | AnyOp
|
|
|
726
743
|
/**
|
|
727
744
|
* Type alias for an Operation of a specific type.
|
|
728
745
|
*/
|
|
729
|
-
type AnyOperationOf<TOperationType
|
|
746
|
+
type AnyOperationOf<TOperationType extends OperationType> = Operation<TOperationType, string, string[], any, AnyFields, any>;
|
|
730
747
|
/**
|
|
731
748
|
* Type inference metadata for operations.
|
|
732
749
|
* Access via `typeof operation.$infer`.
|
|
@@ -740,12 +757,12 @@ declare const __OPERATION_BRAND__: unique symbol;
|
|
|
740
757
|
* Internal artifact shape produced by operation evaluation.
|
|
741
758
|
* @internal
|
|
742
759
|
*/
|
|
743
|
-
type OperationArtifact<TOperationType
|
|
744
|
-
readonly operationType: TOperationType
|
|
745
|
-
readonly operationName: TOperationName
|
|
760
|
+
type OperationArtifact<TOperationType extends OperationType, TOperationName extends string, TVariableNames extends string[], TVariables extends AnyConstAssignableInput, TFields extends Partial<AnyFields>, TData extends object> = {
|
|
761
|
+
readonly operationType: TOperationType;
|
|
762
|
+
readonly operationName: TOperationName;
|
|
746
763
|
readonly schemaLabel: string;
|
|
747
|
-
readonly variableNames: TVariableNames
|
|
748
|
-
readonly documentSource: () => TFields
|
|
764
|
+
readonly variableNames: TVariableNames;
|
|
765
|
+
readonly documentSource: () => TFields;
|
|
749
766
|
readonly document: TypedDocumentNode<TData, TVariables>;
|
|
750
767
|
readonly metadata?: unknown;
|
|
751
768
|
};
|
|
@@ -762,22 +779,22 @@ type OperationArtifact<TOperationType$1 extends OperationType, TOperationName$1
|
|
|
762
779
|
* @template TFields - Selected fields structure
|
|
763
780
|
* @template TData - Inferred response data type
|
|
764
781
|
*/
|
|
765
|
-
declare class Operation<TOperationType
|
|
782
|
+
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> {
|
|
766
783
|
private readonly [__OPERATION_BRAND__];
|
|
767
784
|
private constructor();
|
|
768
785
|
/** The operation type: 'query', 'mutation', or 'subscription'. */
|
|
769
|
-
get operationType(): TOperationType
|
|
786
|
+
get operationType(): TOperationType;
|
|
770
787
|
/** The unique name of this operation. */
|
|
771
|
-
get operationName(): TOperationName
|
|
788
|
+
get operationName(): TOperationName;
|
|
772
789
|
/** The schema label this operation belongs to. */
|
|
773
790
|
get schemaLabel(): string;
|
|
774
791
|
/** List of variable names defined for this operation. */
|
|
775
|
-
get variableNames(): TVariableNames
|
|
792
|
+
get variableNames(): TVariableNames;
|
|
776
793
|
/**
|
|
777
794
|
* Returns the field selections. Used for document reconstruction.
|
|
778
795
|
* @internal
|
|
779
796
|
*/
|
|
780
|
-
get documentSource(): () => TFields
|
|
797
|
+
get documentSource(): () => TFields;
|
|
781
798
|
/** The TypedDocumentNode for use with GraphQL clients. */
|
|
782
799
|
get document(): TypedDocumentNode<TData, TVariables>;
|
|
783
800
|
/** Custom metadata attached to this operation, if any. */
|
|
@@ -787,23 +804,23 @@ declare class Operation<TOperationType$1 extends OperationType, TOperationName$1
|
|
|
787
804
|
* Prefer using the `gql(({ query }) => ...)` API instead.
|
|
788
805
|
* @internal
|
|
789
806
|
*/
|
|
790
|
-
static create<TSchema extends AnyGraphqlSchema, TOperationType
|
|
791
|
-
operationType: TOperationType
|
|
792
|
-
operationName: TOperationName
|
|
807
|
+
static create<TSchema extends AnyGraphqlSchema, TOperationType extends OperationType, TOperationName extends string, TVariableDefinitions extends InputTypeSpecifiers, TFields extends AnyFields>(define: (context: GqlElementContext | null) => {
|
|
808
|
+
operationType: TOperationType;
|
|
809
|
+
operationName: TOperationName;
|
|
793
810
|
schemaLabel: TSchema["label"];
|
|
794
811
|
variableNames: (keyof TVariableDefinitions & string)[];
|
|
795
|
-
documentSource: () => TFields
|
|
796
|
-
document: TypedDocumentNode<InferFields<TSchema, TFields
|
|
812
|
+
documentSource: () => TFields;
|
|
813
|
+
document: TypedDocumentNode<InferFields<TSchema, TFields>, ConstAssignableInput<TSchema, TVariableDefinitions>>;
|
|
797
814
|
metadata?: unknown;
|
|
798
815
|
} | Promise<{
|
|
799
|
-
operationType: TOperationType
|
|
800
|
-
operationName: TOperationName
|
|
816
|
+
operationType: TOperationType;
|
|
817
|
+
operationName: TOperationName;
|
|
801
818
|
schemaLabel: TSchema["label"];
|
|
802
819
|
variableNames: (keyof TVariableDefinitions & string)[];
|
|
803
|
-
documentSource: () => TFields
|
|
804
|
-
document: TypedDocumentNode<InferFields<TSchema, TFields
|
|
820
|
+
documentSource: () => TFields;
|
|
821
|
+
document: TypedDocumentNode<InferFields<TSchema, TFields>, ConstAssignableInput<TSchema, TVariableDefinitions>>;
|
|
805
822
|
metadata?: unknown;
|
|
806
|
-
}>): Operation<TOperationType
|
|
823
|
+
}>): Operation<TOperationType, TOperationName, (keyof TVariableDefinitions & string)[], ConstAssignableInput<TSchema, TVariableDefinitions>, TFields, InferFields<TSchema, TFields>>;
|
|
807
824
|
}
|
|
808
825
|
//#endregion
|
|
809
826
|
//#region packages/core/src/composer/fields-builder.d.ts
|
|
@@ -851,13 +868,13 @@ declare const createVarRefs: <TSchema extends AnyGraphqlSchema, TVarDefinitions
|
|
|
851
868
|
* Used by codegen to generate explicit fragment builder types instead of
|
|
852
869
|
* expensive mapped types. This improves IDE performance for large schemas.
|
|
853
870
|
*/
|
|
854
|
-
type FragmentBuilderFor<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"] & string, TAdapter extends AnyMetadataAdapter = DefaultMetadataAdapter> = <TFields
|
|
871
|
+
type FragmentBuilderFor<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"] & string, TAdapter extends AnyMetadataAdapter = DefaultMetadataAdapter> = <TFields extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}>(options: {
|
|
855
872
|
/** Optional unique key for prebuilt type lookup. */
|
|
856
|
-
key?:
|
|
873
|
+
key?: string;
|
|
857
874
|
variables?: TVarDefinitions;
|
|
858
875
|
metadata?: FragmentMetadataBuilder<ReturnType<typeof createVarRefs<TSchema, TVarDefinitions>>, ExtractAdapterTypes<TAdapter>["fragmentMetadata"]>;
|
|
859
|
-
fields: FieldsBuilder<TSchema, TTypeName$1, TVarDefinitions, TFields
|
|
860
|
-
}) => ReturnType<typeof Fragment.create<TSchema, TTypeName$1, TVarDefinitions, TFields
|
|
876
|
+
fields: FieldsBuilder<TSchema, TTypeName$1, TVarDefinitions, TFields>;
|
|
877
|
+
}) => ReturnType<typeof Fragment.create<TSchema, TTypeName$1, TVarDefinitions, TFields>>;
|
|
861
878
|
/**
|
|
862
879
|
* Creates fragment builder functions for all object types in the schema.
|
|
863
880
|
*
|
|
@@ -870,16 +887,16 @@ type FragmentBuilderFor<TSchema extends AnyGraphqlSchema, TTypeName$1 extends ke
|
|
|
870
887
|
*
|
|
871
888
|
* @internal Used by `createGqlElementComposer`
|
|
872
889
|
*/
|
|
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
|
|
874
|
-
key?:
|
|
890
|
+
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: {
|
|
891
|
+
key?: string;
|
|
875
892
|
variables?: TVarDefinitions | undefined;
|
|
876
893
|
metadata?: FragmentMetadataBuilder<DeclaredVariables<TSchema, TVarDefinitions>, ExtractAdapterTypes<TAdapter>["fragmentMetadata"]> | undefined;
|
|
877
|
-
fields: FieldsBuilder<TSchema, TTypeName, TVarDefinitions, TFields
|
|
878
|
-
}) => Fragment<TTypeName, OptionalArg<AssignableInput<TSchema, TVarDefinitions>>, TFields
|
|
894
|
+
fields: FieldsBuilder<TSchema, TTypeName, TVarDefinitions, TFields>;
|
|
895
|
+
}) => Fragment<TTypeName, OptionalArg<AssignableInput<TSchema, TVarDefinitions>>, TFields & {
|
|
879
896
|
[key: symbol]: never;
|
|
880
|
-
}, InferFields<TSchema, TFields
|
|
897
|
+
}, InferFields<TSchema, TFields> & {
|
|
881
898
|
[key: symbol]: never;
|
|
882
|
-
}
|
|
899
|
+
}> : never };
|
|
883
900
|
//#endregion
|
|
884
901
|
//#region packages/core/src/composer/fragment-usage-context.d.ts
|
|
885
902
|
/**
|
|
@@ -1174,31 +1191,31 @@ type GqlElementComposerOptions<TSchema extends AnyGraphqlSchema, TDirectiveMetho
|
|
|
1174
1191
|
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<{
|
|
1175
1192
|
fragment: TFragmentBuilders;
|
|
1176
1193
|
query: {
|
|
1177
|
-
operation: <TOperationName
|
|
1178
|
-
name: TOperationName
|
|
1194
|
+
operation: <TOperationName extends string, TFields extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}, TOperationMetadata = unknown>(options: {
|
|
1195
|
+
name: TOperationName;
|
|
1179
1196
|
variables?: TVarDefinitions | undefined;
|
|
1180
1197
|
metadata?: MetadataBuilder<DeclaredVariables<TSchema, TVarDefinitions>, TOperationMetadata, ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["aggregatedFragmentMetadata"], ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["schemaLevel"]> | undefined;
|
|
1181
|
-
fields: FieldsBuilder<TSchema, TSchema["operations"]["query"] & keyof TSchema["object"] & string, TVarDefinitions, TFields
|
|
1198
|
+
fields: FieldsBuilder<TSchema, TSchema["operations"]["query"] & keyof TSchema["object"] & string, TVarDefinitions, TFields>;
|
|
1182
1199
|
transformDocument?: OperationDocumentTransformer<TOperationMetadata> | undefined;
|
|
1183
|
-
}) => Operation<"query", TOperationName
|
|
1200
|
+
}) => Operation<"query", TOperationName, (keyof TVarDefinitions & string)[], ConstAssignableInput<TSchema, TVarDefinitions>, TFields, InferFields<TSchema, TFields>>;
|
|
1184
1201
|
};
|
|
1185
1202
|
mutation: {
|
|
1186
|
-
operation: <TOperationName
|
|
1187
|
-
name: TOperationName
|
|
1203
|
+
operation: <TOperationName extends string, TFields extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}, TOperationMetadata = unknown>(options: {
|
|
1204
|
+
name: TOperationName;
|
|
1188
1205
|
variables?: TVarDefinitions | undefined;
|
|
1189
1206
|
metadata?: MetadataBuilder<DeclaredVariables<TSchema, TVarDefinitions>, TOperationMetadata, ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["aggregatedFragmentMetadata"], ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["schemaLevel"]> | undefined;
|
|
1190
|
-
fields: FieldsBuilder<TSchema, TSchema["operations"]["mutation"] & keyof TSchema["object"] & string, TVarDefinitions, TFields
|
|
1207
|
+
fields: FieldsBuilder<TSchema, TSchema["operations"]["mutation"] & keyof TSchema["object"] & string, TVarDefinitions, TFields>;
|
|
1191
1208
|
transformDocument?: OperationDocumentTransformer<TOperationMetadata> | undefined;
|
|
1192
|
-
}) => Operation<"mutation", TOperationName
|
|
1209
|
+
}) => Operation<"mutation", TOperationName, (keyof TVarDefinitions & string)[], ConstAssignableInput<TSchema, TVarDefinitions>, TFields, InferFields<TSchema, TFields>>;
|
|
1193
1210
|
};
|
|
1194
1211
|
subscription: {
|
|
1195
|
-
operation: <TOperationName
|
|
1196
|
-
name: TOperationName
|
|
1212
|
+
operation: <TOperationName extends string, TFields extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}, TOperationMetadata = unknown>(options: {
|
|
1213
|
+
name: TOperationName;
|
|
1197
1214
|
variables?: TVarDefinitions | undefined;
|
|
1198
1215
|
metadata?: MetadataBuilder<DeclaredVariables<TSchema, TVarDefinitions>, TOperationMetadata, ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["aggregatedFragmentMetadata"], ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["schemaLevel"]> | undefined;
|
|
1199
|
-
fields: FieldsBuilder<TSchema, TSchema["operations"]["subscription"] & keyof TSchema["object"] & string, TVarDefinitions, TFields
|
|
1216
|
+
fields: FieldsBuilder<TSchema, TSchema["operations"]["subscription"] & keyof TSchema["object"] & string, TVarDefinitions, TFields>;
|
|
1200
1217
|
transformDocument?: OperationDocumentTransformer<TOperationMetadata> | undefined;
|
|
1201
|
-
}) => Operation<"subscription", TOperationName
|
|
1218
|
+
}) => Operation<"subscription", TOperationName, (keyof TVarDefinitions & string)[], ConstAssignableInput<TSchema, TVarDefinitions>, TFields, InferFields<TSchema, TFields>>;
|
|
1202
1219
|
};
|
|
1203
1220
|
$var: VarBuilder<TSchema>;
|
|
1204
1221
|
$dir: TDirectiveMethods;
|
|
@@ -1247,165 +1264,13 @@ type AnyGqlContext = {
|
|
|
1247
1264
|
*
|
|
1248
1265
|
* @internal Used by `createGqlElementComposer`
|
|
1249
1266
|
*/
|
|
1250
|
-
declare const createOperationComposerFactory: <TSchema extends AnyGraphqlSchema, TAdapter extends AnyMetadataAdapter = DefaultMetadataAdapter>(schema: NoInfer<TSchema>, adapter?: TAdapter, transformDocument?: DocumentTransformer<ExtractAdapterTypes<TAdapter>["schemaLevel"], ExtractAdapterTypes<TAdapter>["aggregatedFragmentMetadata"]>) => <TOperationType
|
|
1251
|
-
name: TOperationName
|
|
1267
|
+
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: {
|
|
1268
|
+
name: TOperationName;
|
|
1252
1269
|
variables?: TVarDefinitions;
|
|
1253
1270
|
metadata?: MetadataBuilder<ReturnType<typeof createVarRefs<TSchema, TVarDefinitions>>, TOperationMetadata, ExtractAdapterTypes<TAdapter>["aggregatedFragmentMetadata"], ExtractAdapterTypes<TAdapter>["schemaLevel"]>;
|
|
1254
|
-
fields: FieldsBuilder<TSchema, TSchema["operations"][TOperationType
|
|
1271
|
+
fields: FieldsBuilder<TSchema, TSchema["operations"][TOperationType] & keyof TSchema["object"] & string, TVarDefinitions, TFields>;
|
|
1255
1272
|
transformDocument?: OperationDocumentTransformer<TOperationMetadata>;
|
|
1256
|
-
}) => Operation<TOperationType
|
|
1257
|
-
//#endregion
|
|
1258
|
-
//#region packages/core/src/prebuilt/types.d.ts
|
|
1259
|
-
/**
|
|
1260
|
-
* Type definitions for prebuilt type system.
|
|
1261
|
-
*
|
|
1262
|
-
* These types enable looking up pre-computed types from a registry
|
|
1263
|
-
* instead of relying on complex type inference that may be lost
|
|
1264
|
-
* when bundling with tools like tsdown.
|
|
1265
|
-
*
|
|
1266
|
-
* @module
|
|
1267
|
-
*/
|
|
1268
|
-
/**
|
|
1269
|
-
* Registry mapping fragment/operation keys to their inferred types.
|
|
1270
|
-
* Generated by the builder and used by prebuilt composers.
|
|
1271
|
-
*/
|
|
1272
|
-
type PrebuiltTypeRegistry = {
|
|
1273
|
-
readonly fragments: {
|
|
1274
|
-
readonly [key: string]: {
|
|
1275
|
-
readonly input: unknown;
|
|
1276
|
-
readonly output: object;
|
|
1277
|
-
};
|
|
1278
|
-
};
|
|
1279
|
-
readonly operations: {
|
|
1280
|
-
readonly [key: string]: {
|
|
1281
|
-
readonly input: object;
|
|
1282
|
-
readonly output: object;
|
|
1283
|
-
};
|
|
1284
|
-
};
|
|
1285
|
-
};
|
|
1286
|
-
/**
|
|
1287
|
-
* Empty registry type for when no prebuilt types are available.
|
|
1288
|
-
*/
|
|
1289
|
-
type EmptyPrebuiltTypeRegistry = {
|
|
1290
|
-
readonly fragments: Record<string, never>;
|
|
1291
|
-
readonly operations: Record<string, never>;
|
|
1292
|
-
};
|
|
1293
|
-
/**
|
|
1294
|
-
* Extract the input type for a fragment from the registry.
|
|
1295
|
-
*/
|
|
1296
|
-
type PrebuiltFragmentInput<TRegistry extends PrebuiltTypeRegistry, TKey$1 extends keyof TRegistry["fragments"] & string> = TRegistry["fragments"][TKey$1]["input"];
|
|
1297
|
-
/**
|
|
1298
|
-
* Extract the output type for a fragment from the registry.
|
|
1299
|
-
*/
|
|
1300
|
-
type PrebuiltFragmentOutput<TRegistry extends PrebuiltTypeRegistry, TKey$1 extends keyof TRegistry["fragments"] & string> = TRegistry["fragments"][TKey$1]["output"];
|
|
1301
|
-
/**
|
|
1302
|
-
* Extract the input type for an operation from the registry.
|
|
1303
|
-
*/
|
|
1304
|
-
type PrebuiltOperationInput<TRegistry extends PrebuiltTypeRegistry, TKey$1 extends keyof TRegistry["operations"] & string> = TRegistry["operations"][TKey$1]["input"];
|
|
1305
|
-
/**
|
|
1306
|
-
* Extract the output type for an operation from the registry.
|
|
1307
|
-
*/
|
|
1308
|
-
type PrebuiltOperationOutput<TRegistry extends PrebuiltTypeRegistry, TKey$1 extends keyof TRegistry["operations"] & string> = TRegistry["operations"][TKey$1]["output"];
|
|
1309
|
-
/**
|
|
1310
|
-
* Check if a key exists in the fragment registry.
|
|
1311
|
-
*/
|
|
1312
|
-
type HasPrebuiltFragment<TRegistry extends PrebuiltTypeRegistry, TKey$1 extends string> = TKey$1 extends keyof TRegistry["fragments"] ? true : false;
|
|
1313
|
-
/**
|
|
1314
|
-
* Check if a key exists in the operation registry.
|
|
1315
|
-
*/
|
|
1316
|
-
type HasPrebuiltOperation<TRegistry extends PrebuiltTypeRegistry, TKey$1 extends string> = TKey$1 extends keyof TRegistry["operations"] ? true : false;
|
|
1317
|
-
/**
|
|
1318
|
-
* Branded error type for missing prebuilt registry entries.
|
|
1319
|
-
*
|
|
1320
|
-
* This type intentionally produces a clear error message at compile time
|
|
1321
|
-
* when an operation or fragment is not found in the PrebuiltTypeRegistry.
|
|
1322
|
-
* Instead of silently falling back to inferred types, this forces users
|
|
1323
|
-
* to ensure all elements are properly registered via typegen.
|
|
1324
|
-
*/
|
|
1325
|
-
type PrebuiltEntryNotFound<TKey$1 extends string, TKind extends "fragment" | "operation"> = {
|
|
1326
|
-
readonly __error: "PREBUILT_ENTRY_NOT_FOUND";
|
|
1327
|
-
readonly __message: `${TKind} "${TKey$1}" not found in PrebuiltTypeRegistry. Run 'soda-gql typegen' to generate prebuilt types.`;
|
|
1328
|
-
readonly __key: TKey$1;
|
|
1329
|
-
readonly __kind: TKind;
|
|
1330
|
-
};
|
|
1331
|
-
/**
|
|
1332
|
-
* Branded error type for unrecognized element types in prebuilt resolution.
|
|
1333
|
-
*
|
|
1334
|
-
* This type is returned when ResolvePrebuiltElement receives a type that
|
|
1335
|
-
* is neither Operation nor Fragment. This should not happen in normal usage,
|
|
1336
|
-
* but provides a clear error message for debugging if it does.
|
|
1337
|
-
*/
|
|
1338
|
-
type PrebuiltUnknownElement<TElement> = {
|
|
1339
|
-
readonly __error: "PREBUILT_UNKNOWN_ELEMENT";
|
|
1340
|
-
readonly __message: "Element type not recognized. Expected Operation or Fragment.";
|
|
1341
|
-
readonly __element: TElement;
|
|
1342
|
-
};
|
|
1343
|
-
//#endregion
|
|
1344
|
-
//#region packages/core/src/composer/prebuilt-composer.d.ts
|
|
1345
|
-
/**
|
|
1346
|
-
* Resolves the output type for a prebuilt element (strict mode).
|
|
1347
|
-
*
|
|
1348
|
-
* For Operations: Looks up by operation name in the registry
|
|
1349
|
-
* For Fragments: Looks up by fragment key in the registry
|
|
1350
|
-
*
|
|
1351
|
-
* Returns `PrebuiltEntryNotFound` error type if the element is not found
|
|
1352
|
-
* in the registry, forcing users to ensure all elements are properly
|
|
1353
|
-
* registered via typegen.
|
|
1354
|
-
*/
|
|
1355
|
-
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> : Operation<TOperationType, TOperationName, TVariableNames, PrebuiltEntryNotFound<TOperationName, "operation">, TFields, PrebuiltEntryNotFound<TOperationName, "operation">> : TElement extends Fragment<infer TTypeName extends string, any, infer TFields extends Partial<AnyFields>, any, infer TKey extends string | undefined> ? TKey extends string ? 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> : Fragment<TTypeName, PrebuiltEntryNotFound<TKey, "fragment">, TFields, PrebuiltEntryNotFound<TKey, "fragment">, TKey> : Fragment<TTypeName, PrebuiltEntryNotFound<"(undefined)", "fragment">, TFields, PrebuiltEntryNotFound<"(undefined)", "fragment">, TKey> : PrebuiltUnknownElement<TElement>;
|
|
1356
|
-
/**
|
|
1357
|
-
* Prebuilt element composer that resolves types from a registry.
|
|
1358
|
-
*/
|
|
1359
|
-
type PrebuiltGqlElementComposer<TContext, TPrebuilt extends PrebuiltTypeRegistry> = <TResult extends AnyFragment | Operation<OperationType, string, string[], AnyConstAssignableInput, AnyFields, object>>(composeElement: (context: TContext) => TResult) => ResolvePrebuiltElement<TResult, TPrebuilt>;
|
|
1360
|
-
/**
|
|
1361
|
-
* Prebuilt element composer with schema access.
|
|
1362
|
-
*
|
|
1363
|
-
* Extends the prebuilt composer function with a `$schema` property that provides
|
|
1364
|
-
* runtime access to the schema definition.
|
|
1365
|
-
*/
|
|
1366
|
-
type PrebuiltGqlElementComposerWithSchema<TContext, TPrebuilt extends PrebuiltTypeRegistry, TSchema extends AnyGraphqlSchema> = PrebuiltGqlElementComposer<TContext, TPrebuilt> & {
|
|
1367
|
-
/**
|
|
1368
|
-
* The GraphQL schema definition used by this composer.
|
|
1369
|
-
*/
|
|
1370
|
-
readonly $schema: TSchema;
|
|
1371
|
-
};
|
|
1372
|
-
/**
|
|
1373
|
-
* Creates a prebuilt GQL element composer for a given schema.
|
|
1374
|
-
*
|
|
1375
|
-
* This composer has the same runtime behavior as `createGqlElementComposer`,
|
|
1376
|
-
* but the returned elements have their types resolved from the PrebuiltTypeRegistry
|
|
1377
|
-
* instead of using complex type inference.
|
|
1378
|
-
*
|
|
1379
|
-
* Use this when bundling with tools like tsdown that may lose type information.
|
|
1380
|
-
*
|
|
1381
|
-
* @param schema - The GraphQL schema definition
|
|
1382
|
-
* @param options - Configuration including input type methods and optional adapter
|
|
1383
|
-
* @returns Prebuilt element composer function
|
|
1384
|
-
*
|
|
1385
|
-
* @example
|
|
1386
|
-
* ```typescript
|
|
1387
|
-
* // Generated by codegen in prebuilt/index.ts
|
|
1388
|
-
* import type { PrebuiltTypes } from "./types";
|
|
1389
|
-
*
|
|
1390
|
-
* const gql = createPrebuiltGqlElementComposer<
|
|
1391
|
-
* Schema,
|
|
1392
|
-
* PrebuiltTypes,
|
|
1393
|
-
* FragmentBuilders,
|
|
1394
|
-
* DirectiveMethods,
|
|
1395
|
-
* Context
|
|
1396
|
-
* >(schema, { inputTypeMethods });
|
|
1397
|
-
*
|
|
1398
|
-
* // Types are resolved from PrebuiltTypes registry
|
|
1399
|
-
* const GetUser = gql(({ query }) =>
|
|
1400
|
-
* query.operation({
|
|
1401
|
-
* name: "GetUser",
|
|
1402
|
-
* fields: ({ f }) => ({ ...f.user({ id: "1" })(({ f }) => ({ ...f.id() })) }),
|
|
1403
|
-
* })
|
|
1404
|
-
* );
|
|
1405
|
-
* // GetUser.$infer.output is PrebuiltTypes["operations"]["GetUser"]["output"]
|
|
1406
|
-
* ```
|
|
1407
|
-
*/
|
|
1408
|
-
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>;
|
|
1273
|
+
}) => Operation<TOperationType, TOperationName, (keyof TVarDefinitions & string)[], ConstAssignableInput<TSchema, TVarDefinitions>, TFields, InferFields<TSchema, TFields>>;
|
|
1409
1274
|
//#endregion
|
|
1410
1275
|
//#region packages/core/src/prebuilt/type-calculator.d.ts
|
|
1411
1276
|
/**
|
|
@@ -1545,6 +1410,92 @@ declare const generateInputType: (schema: AnyGraphqlSchema, variableDefinitions:
|
|
|
1545
1410
|
*/
|
|
1546
1411
|
declare const generateInputTypeFromSpecifiers: (schema: AnyGraphqlSchema, specifiers: InputTypeSpecifiers, options?: GenerateInputObjectTypeOptions) => string;
|
|
1547
1412
|
//#endregion
|
|
1413
|
+
//#region packages/core/src/prebuilt/types.d.ts
|
|
1414
|
+
/**
|
|
1415
|
+
* Type definitions for prebuilt type system.
|
|
1416
|
+
*
|
|
1417
|
+
* These types enable looking up pre-computed types from a registry
|
|
1418
|
+
* instead of relying on complex type inference that may be lost
|
|
1419
|
+
* when bundling with tools like tsdown.
|
|
1420
|
+
*
|
|
1421
|
+
* @module
|
|
1422
|
+
*/
|
|
1423
|
+
/**
|
|
1424
|
+
* Registry mapping fragment/operation keys to their inferred types.
|
|
1425
|
+
* Generated by the builder and used by prebuilt composers.
|
|
1426
|
+
*/
|
|
1427
|
+
type PrebuiltTypeRegistry = {
|
|
1428
|
+
readonly fragments: {
|
|
1429
|
+
readonly [key: string]: {
|
|
1430
|
+
readonly input: unknown;
|
|
1431
|
+
readonly output: object;
|
|
1432
|
+
};
|
|
1433
|
+
};
|
|
1434
|
+
readonly operations: {
|
|
1435
|
+
readonly [key: string]: {
|
|
1436
|
+
readonly input: object;
|
|
1437
|
+
readonly output: object;
|
|
1438
|
+
};
|
|
1439
|
+
};
|
|
1440
|
+
};
|
|
1441
|
+
/**
|
|
1442
|
+
* Empty registry type for when no prebuilt types are available.
|
|
1443
|
+
*/
|
|
1444
|
+
type EmptyPrebuiltTypeRegistry = {
|
|
1445
|
+
readonly fragments: Record<string, never>;
|
|
1446
|
+
readonly operations: Record<string, never>;
|
|
1447
|
+
};
|
|
1448
|
+
/**
|
|
1449
|
+
* Extract the input type for a fragment from the registry.
|
|
1450
|
+
*/
|
|
1451
|
+
type PrebuiltFragmentInput<TRegistry extends PrebuiltTypeRegistry, TKey extends keyof TRegistry["fragments"] & string> = TRegistry["fragments"][TKey]["input"];
|
|
1452
|
+
/**
|
|
1453
|
+
* Extract the output type for a fragment from the registry.
|
|
1454
|
+
*/
|
|
1455
|
+
type PrebuiltFragmentOutput<TRegistry extends PrebuiltTypeRegistry, TKey extends keyof TRegistry["fragments"] & string> = TRegistry["fragments"][TKey]["output"];
|
|
1456
|
+
/**
|
|
1457
|
+
* Extract the input type for an operation from the registry.
|
|
1458
|
+
*/
|
|
1459
|
+
type PrebuiltOperationInput<TRegistry extends PrebuiltTypeRegistry, TKey extends keyof TRegistry["operations"] & string> = TRegistry["operations"][TKey]["input"];
|
|
1460
|
+
/**
|
|
1461
|
+
* Extract the output type for an operation from the registry.
|
|
1462
|
+
*/
|
|
1463
|
+
type PrebuiltOperationOutput<TRegistry extends PrebuiltTypeRegistry, TKey extends keyof TRegistry["operations"] & string> = TRegistry["operations"][TKey]["output"];
|
|
1464
|
+
/**
|
|
1465
|
+
* Check if a key exists in the fragment registry.
|
|
1466
|
+
*/
|
|
1467
|
+
type HasPrebuiltFragment<TRegistry extends PrebuiltTypeRegistry, TKey extends string> = TKey extends keyof TRegistry["fragments"] ? true : false;
|
|
1468
|
+
/**
|
|
1469
|
+
* Check if a key exists in the operation registry.
|
|
1470
|
+
*/
|
|
1471
|
+
type HasPrebuiltOperation<TRegistry extends PrebuiltTypeRegistry, TKey extends string> = TKey extends keyof TRegistry["operations"] ? true : false;
|
|
1472
|
+
/**
|
|
1473
|
+
* Branded error type for missing prebuilt registry entries.
|
|
1474
|
+
*
|
|
1475
|
+
* This type intentionally produces a clear error message at compile time
|
|
1476
|
+
* when an operation or fragment is not found in the PrebuiltTypeRegistry.
|
|
1477
|
+
* Instead of silently falling back to inferred types, this forces users
|
|
1478
|
+
* to ensure all elements are properly registered via typegen.
|
|
1479
|
+
*/
|
|
1480
|
+
type PrebuiltEntryNotFound<TKey extends string, TKind extends "fragment" | "operation"> = {
|
|
1481
|
+
readonly __error: "PREBUILT_ENTRY_NOT_FOUND";
|
|
1482
|
+
readonly __message: `${TKind} "${TKey}" not found in PrebuiltTypeRegistry. Run 'soda-gql typegen' to generate prebuilt types.`;
|
|
1483
|
+
readonly __key: TKey;
|
|
1484
|
+
readonly __kind: TKind;
|
|
1485
|
+
};
|
|
1486
|
+
/**
|
|
1487
|
+
* Branded error type for unrecognized element types in prebuilt resolution.
|
|
1488
|
+
*
|
|
1489
|
+
* This type is returned when ResolvePrebuiltElement receives a type that
|
|
1490
|
+
* is neither Operation nor Fragment. This should not happen in normal usage,
|
|
1491
|
+
* but provides a clear error message for debugging if it does.
|
|
1492
|
+
*/
|
|
1493
|
+
type PrebuiltUnknownElement<TElement> = {
|
|
1494
|
+
readonly __error: "PREBUILT_UNKNOWN_ELEMENT";
|
|
1495
|
+
readonly __message: "Element type not recognized. Expected Operation or Fragment.";
|
|
1496
|
+
readonly __element: TElement;
|
|
1497
|
+
};
|
|
1498
|
+
//#endregion
|
|
1548
1499
|
//#region packages/core/src/utils/hidden.d.ts
|
|
1549
1500
|
declare const hidden: <T>() => (() => T);
|
|
1550
1501
|
type Hidden<T> = () => T;
|
|
@@ -1552,5 +1503,5 @@ type Hidden<T> = () => T;
|
|
|
1552
1503
|
//#region packages/core/src/utils/wrap-by-key.d.ts
|
|
1553
1504
|
declare function wrapByKey<TName$1 extends string, TValue$1>(name: TName$1, value: TValue$1): { [K in TName$1]: TValue$1 };
|
|
1554
1505
|
//#endregion
|
|
1555
|
-
export {
|
|
1556
|
-
//# sourceMappingURL=index-
|
|
1506
|
+
export { AnyOperation as $, buildOperationTypeNode as $t, GqlElementComposer as A, AttachmentToProperty as At, VarBuilderMethods as B, isDirectiveRef as Bt, getScalarInputType as C, AnyDirectiveRef as Cn, NestedUnionFieldsBuilder as Ct, AnyGqlContext as D, DirectiveRefInner as Dn, SwitchIfOmittable as Dt, createOperationComposerFactory as E, DirectiveRef as En, OptionalArg as Et, InputTypeMethods as F, DirectiveMethod as Ft, FragmentUsageRecord as G, StripFunctions as Gt, createVarBuilder as H, ColocatedEntries as Ht, ResolveTypeFromMeta as I, StandardDirectives as It, FragmentBuilderFor as J, UnionToIntersection as Jt, recordFragmentUsage as K, StripSymbols as Kt, SchemaAwareGetNameAt as L, createDirectiveBuilder as Lt, GqlElementComposerWithSchema as M, AnyDirectiveMethod as Mt, createGqlElementComposer as N, DirectiveArgValue as Nt, ExtractMetadataAdapter as O, empty as Ot, InputTypeMethod as P, DirectiveBuilder as Pt, createFieldFactories as Q, buildDocument as Qt, SchemaAwareGetValueAt as R, createDirectiveMethod as Rt, getEnumType as S, GetAssignableType as Sn, NestedObjectFieldsBuilderTools as St, graphqlTypeToTypeScript as T, DirectiveLocation as Tn, IfOmittable as Tt, createVarMethod as U, ColocatedFields as Ut, VarSpecifier as V, ColocateHelper as Vt, createVarMethodFactory as W, createColocateHelper as Wt, createVarAssignments as X, buildArgumentValue as Xt, createGqlFragmentComposers as Y, EnumLookup as Yt, createVarRefs as Z, buildConstValueNode as Zt, calculateFieldType as _, AnyConstDirectiveAttachments as _n, FieldSelectionFactoryReturn as _t, HasPrebuiltFragment as a, AnyNestedUnion as an, FragmentInferMeta as at, generateInputType as b, ConstAssignableInput as bn, FieldsBuilderTools as bt, PrebuiltFragmentInput as c, InferFields as cn, GqlElementContext as ct, PrebuiltOperationOutput as d, AnyAssignableInputValue as dn, AnyFieldSelectionFactoryReturn as dt, buildWithTypeModifier as en, AnyOperationOf as et, PrebuiltTypeRegistry as f, AnyAssigningInput as fn, FieldSelectionFactories as ft, applyTypeModifier as g, FieldArgumentValue as gn, FieldSelectionFactoryPrimitiveReturn as gt, TypeFormatters as h, DeclaredVariables as hn, FieldSelectionFactoryObjectReturn as ht, EmptyPrebuiltTypeRegistry as i, AnyNestedObject as in, Fragment as it, GqlElementComposerOptions as j, AttachmentsTupleToIntersection as jt, FragmentBuildersAll as k, AttachmentShape as kt, PrebuiltFragmentOutput as l, AnyDirectiveAttachments as ln, GqlElementDefinitionFactory as lt, GenerateInputObjectTypeOptions as m, AssignableInputByFieldName as mn, FieldSelectionFactoryFieldArguments as mt, Hidden as n, AnyFieldSelection as nn, OperationInferMeta as nt, HasPrebuiltOperation as o, FieldSelectionTemplateOf as on, GqlElement as ot, PrebuiltUnknownElement as p, AssignableInput as pn, FieldSelectionFactory as pt, withFragmentUsageCollection as q, Tuple as qt, hidden as r, AnyFields as rn, AnyFragment as rt, PrebuiltEntryNotFound as s, InferField as sn, GqlElementAttachment as st, wrapByKey as t, AbstractFieldSelection as tn, Operation as tt, PrebuiltOperationInput as u, AnyAssignableInput as un, AnyFieldSelectionFactory as ut, calculateFieldsType as v, AnyConstAssignableInput as vn, FieldSelectionFactoryUnionReturn as vt, getScalarOutputType as w, AnyDirectiveRefBrand as wn, EmptyObject as wt, generateInputTypeFromSpecifiers as x, ConstAssignableInputValue as xn, NestedObjectFieldsBuilder as xt, generateInputObjectType as y, AnyConstAssignableInputValue as yn, FieldsBuilder as yt, VarBuilder as z, createStandardDirectives as zt };
|
|
1507
|
+
//# sourceMappingURL=index-CatAewXz.d.cts.map
|