@soda-gql/core 0.8.0 → 0.8.2
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 +1 -1
- package/dist/adapter.d.cts +2 -2
- package/dist/adapter.d.ts +2 -2
- package/dist/adapter.js +1 -1
- package/dist/{index-rBHv6RJz.d.ts → index-CGLXqMlv.d.cts} +386 -28
- package/dist/index-CGLXqMlv.d.cts.map +1 -0
- package/dist/{index-x4fr7bdv.d.cts → index-tyIBKIKa.d.ts} +386 -28
- package/dist/index-tyIBKIKa.d.ts.map +1 -0
- package/dist/index.cjs +244 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +43 -4
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +43 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +244 -12
- package/dist/index.js.map +1 -1
- package/dist/runtime.cjs +16 -10
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.cts +2 -2
- package/dist/runtime.d.ts +2 -2
- package/dist/runtime.js +16 -10
- package/dist/runtime.js.map +1 -1
- package/dist/{schema-CFMmSBhl.d.ts → schema-2qqtKss4.d.ts} +39 -37
- package/dist/schema-2qqtKss4.d.ts.map +1 -0
- package/dist/{schema-BbCrsNkQ.js → schema-BiYcVVvm.js} +86 -1
- package/dist/schema-BiYcVVvm.js.map +1 -0
- package/dist/{schema-C1lnWj-m.d.cts → schema-CPTxQbTv.d.cts} +39 -37
- package/dist/schema-CPTxQbTv.d.cts.map +1 -0
- package/dist/{schema-DuWaRhdp.cjs → schema-D2MW4DOF.cjs} +86 -1
- package/dist/schema-D2MW4DOF.cjs.map +1 -0
- package/dist/schema-builder-BYJd50o2.d.cts +97 -0
- package/dist/schema-builder-BYJd50o2.d.cts.map +1 -0
- package/dist/schema-builder-Dhss2O1I.d.ts +97 -0
- package/dist/schema-builder-Dhss2O1I.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/index-rBHv6RJz.d.ts.map +0 -1
- package/dist/index-x4fr7bdv.d.cts.map +0 -1
- package/dist/schema-BbCrsNkQ.js.map +0 -1
- package/dist/schema-C1lnWj-m.d.cts.map +0 -1
- package/dist/schema-CFMmSBhl.d.ts.map +0 -1
- package/dist/schema-DuWaRhdp.cjs.map +0 -1
- package/dist/schema-builder-CQa-dOw9.d.ts +0 -40
- package/dist/schema-builder-CQa-dOw9.d.ts.map +0 -1
- package/dist/schema-builder-QkY6hZn6.d.cts +0 -40
- package/dist/schema-builder-QkY6hZn6.d.cts.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { C as ObjectTypeProfile, Ct as GetSignature, Et as ConstValue, F as AnyMetadataAdapter, G as FragmentMetadataBuilder, I as DefaultAdapter, L as DefaultMetadataAdapter, N as Adapter, Ot as FieldPath, P as AnyAdapter, R as ExtractAdapterTypes, S as GetModifiedType, St as ApplyTypeModifier, T as TypeProfile, X as AnyVarRef, Z as AnyVarRefBrand, bt as OutputTypenameSpecifier, c as InferOutputProfile, dt as InputTypeSpecifier, et as VarRef, f as ObjectFieldRecord, ft as InputTypeSpecifiers, g as ResolveInputProfileFromMeta, gt as OutputScalarSpecifier, h as PickTypeSpecifierByFieldName, ht as OutputObjectSpecifier, i as AnyTypeName, it as AnyDefaultValue, m as OperationType, mt as OutputInferrableTypeSpecifier, n as AnyFieldName, o as InferInputKind, pt as OutputEnumSpecifier, q as MetadataBuilder, r as AnyGraphqlSchema, s as InferInputProfile, t as AllInputTypeNames, ut as InputTypeKind, vt as OutputTypeSpecifier, w as PrimitiveTypeProfile, wt as TypeModifier, x as GetConstAssignableType, xt as OutputUnionSpecifier, y as UnionMemberName } from "./schema-
|
|
1
|
+
import { C as ObjectTypeProfile, Ct as GetSignature, Et as ConstValue, F as AnyMetadataAdapter, G as FragmentMetadataBuilder, I as DefaultAdapter, L as DefaultMetadataAdapter, N as Adapter, Ot as FieldPath, P as AnyAdapter, R as ExtractAdapterTypes, S as GetModifiedType, St as ApplyTypeModifier, T as TypeProfile, X as AnyVarRef, Z as AnyVarRefBrand, bt as OutputTypenameSpecifier, c as InferOutputProfile, dt as InputTypeSpecifier, et as VarRef, f as ObjectFieldRecord, ft as InputTypeSpecifiers, g as ResolveInputProfileFromMeta, gt as OutputScalarSpecifier, h as PickTypeSpecifierByFieldName, ht as OutputObjectSpecifier, i as AnyTypeName, it as AnyDefaultValue, m as OperationType, mt as OutputInferrableTypeSpecifier, n as AnyFieldName, o as InferInputKind, pt as OutputEnumSpecifier, q as MetadataBuilder, r as AnyGraphqlSchema, s as InferInputProfile, t as AllInputTypeNames, ut as InputTypeKind, vt as OutputTypeSpecifier, w as PrimitiveTypeProfile, wt as TypeModifier, x as GetConstAssignableType, xt as OutputUnionSpecifier, y as UnionMemberName } from "./schema-CPTxQbTv.cjs";
|
|
2
2
|
import { ConstValueNode, NamedTypeNode, OperationTypeNode, TypeNode, ValueNode } from "graphql";
|
|
3
3
|
import { TypedDocumentNode } from "@graphql-typed-document-node/core";
|
|
4
4
|
|
|
5
5
|
//#region packages/core/src/types/type-foundation/type-modifier-extension.generated.d.ts
|
|
6
6
|
type Op_0<T> = T[];
|
|
7
7
|
type Op_1<T> = T[] | null | undefined;
|
|
8
|
-
type Ref<T extends TypeProfile, M$1 extends string> = VarRef<TypeProfile.
|
|
8
|
+
type Ref<T extends TypeProfile, M$1 extends string> = VarRef<TypeProfile.ExpectedVariableType<T, GetSignature<M$1>>>;
|
|
9
9
|
type IsOptionalProfile<TField extends TypeProfile.WithMeta> = TField[1] extends `${string}?` ? true : TField[2] extends TypeProfile.WITH_DEFAULT_INPUT ? true : false;
|
|
10
10
|
type OptionalProfileKeys<TProfileObject extends {
|
|
11
11
|
readonly [key: string]: TypeProfile.WithMeta;
|
|
@@ -83,13 +83,19 @@ type AnyAssigningInput = {
|
|
|
83
83
|
readonly [key: string]: AnyVarRef;
|
|
84
84
|
};
|
|
85
85
|
type IsOptional<TSpecifier$1 extends InputTypeSpecifier> = TSpecifier$1["modifier"] extends `${string}?` ? true : TSpecifier$1["defaultValue"] extends AnyDefaultValue ? true : false;
|
|
86
|
-
type AssignableInput<TSchema extends AnyGraphqlSchema, TSpecifiers extends InputTypeSpecifiers> = { readonly [K in keyof TSpecifiers as IsOptional<TSpecifiers[K]> extends true ? K : never]+?:
|
|
86
|
+
type AssignableInput<TSchema extends AnyGraphqlSchema, TSpecifiers extends InputTypeSpecifiers> = { readonly [K in keyof TSpecifiers as IsOptional<TSpecifiers[K]> extends true ? K : never]+?: FieldArgumentValue<TSchema, TSpecifiers[K]> } & { readonly [K in keyof TSpecifiers as IsOptional<TSpecifiers[K]> extends false ? K : never]-?: FieldArgumentValue<TSchema, TSpecifiers[K]> };
|
|
87
87
|
/**
|
|
88
|
-
*
|
|
88
|
+
* Field argument value type using typeName + kind for VarRef comparison.
|
|
89
89
|
* Uses GetAssignableType which derives typeName + kind from the profile.
|
|
90
|
+
* This name appears in TypeScript error messages when argument types don't match.
|
|
90
91
|
*/
|
|
91
|
-
type
|
|
92
|
-
|
|
92
|
+
type FieldArgumentValue<TSchema extends AnyGraphqlSchema, TSpecifier$1 extends InputTypeSpecifier> = GetAssignableType<InferInputProfile<TSchema, TSpecifier$1>>;
|
|
93
|
+
/**
|
|
94
|
+
* Declared variables record for an operation or fragment.
|
|
95
|
+
* Maps variable names to their VarRef types with proper branding.
|
|
96
|
+
* This name appears in TypeScript error messages when variable access fails.
|
|
97
|
+
*/
|
|
98
|
+
type DeclaredVariables<TSchema extends AnyGraphqlSchema, TSpecifiers extends InputTypeSpecifiers> = { readonly [K in keyof TSpecifiers]-?: VarRef<TypeProfile.DeclaredVariableType<InferInputProfile<TSchema, TSpecifiers[K]>>> };
|
|
93
99
|
type AssignableInputByFieldName<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"], TFieldName$1 extends keyof TSchema["object"][TTypeName$1]["fields"]> = AssignableInput<TSchema, TSchema["object"][TTypeName$1]["fields"][TFieldName$1]["arguments"]>;
|
|
94
100
|
//#endregion
|
|
95
101
|
//#region packages/core/src/types/fragment/directives.d.ts
|
|
@@ -164,10 +170,47 @@ type InferField<TSchema extends AnyGraphqlSchema, TSelection extends AnyFieldSel
|
|
|
164
170
|
} ? GetModifiedType<InferOutputProfile<TSchema, TSpecifier>, TSpecifier["modifier"]> : never);
|
|
165
171
|
//#endregion
|
|
166
172
|
//#region packages/core/src/composer/build-document.d.ts
|
|
173
|
+
/**
|
|
174
|
+
* Converts an assignable input value to a GraphQL AST ValueNode.
|
|
175
|
+
*
|
|
176
|
+
* Handles primitives, arrays, objects, and variable references.
|
|
177
|
+
* Returns null for undefined values (field is omitted).
|
|
178
|
+
*/
|
|
167
179
|
declare const buildArgumentValue: (value: AnyAssignableInputValue) => ValueNode | null;
|
|
180
|
+
/**
|
|
181
|
+
* Converts a constant value to a GraphQL AST ConstValueNode.
|
|
182
|
+
*
|
|
183
|
+
* Unlike `buildArgumentValue`, this only handles literal values
|
|
184
|
+
* (no variable references). Used for default values.
|
|
185
|
+
*/
|
|
168
186
|
declare const buildConstValueNode: (value: ConstValue) => ConstValueNode | null;
|
|
187
|
+
/**
|
|
188
|
+
* Wraps a named type with modifiers (non-null, list).
|
|
189
|
+
*
|
|
190
|
+
* Modifier format: starts with `?` (nullable) or `!` (non-null),
|
|
191
|
+
* followed by `[]?` or `[]!` pairs for lists.
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* - `"!"` → `String!`
|
|
195
|
+
* - `"?"` → `String`
|
|
196
|
+
* - `"![]!"` → `[String!]!`
|
|
197
|
+
* - `"?[]?"` → `[String]`
|
|
198
|
+
*/
|
|
169
199
|
declare const buildWithTypeModifier: (modifier: TypeModifier, buildType: () => NamedTypeNode) => TypeNode;
|
|
200
|
+
/**
|
|
201
|
+
* Converts an operation type string to a GraphQL AST OperationTypeNode.
|
|
202
|
+
*/
|
|
170
203
|
declare const buildOperationTypeNode: (operation: OperationType) => OperationTypeNode;
|
|
204
|
+
/**
|
|
205
|
+
* Builds a TypedDocumentNode from operation options.
|
|
206
|
+
*
|
|
207
|
+
* This is the main entry point for converting field selections into
|
|
208
|
+
* a GraphQL document AST. The result can be used with any GraphQL
|
|
209
|
+
* client that supports TypedDocumentNode.
|
|
210
|
+
*
|
|
211
|
+
* @param options - Operation configuration (name, type, variables, fields)
|
|
212
|
+
* @returns TypedDocumentNode with inferred input/output types
|
|
213
|
+
*/
|
|
171
214
|
declare const buildDocument: <TSchema extends AnyGraphqlSchema, TFields extends AnyFields, TVarDefinitions extends InputTypeSpecifiers>(options: {
|
|
172
215
|
operationName: string;
|
|
173
216
|
operationType: OperationType;
|
|
@@ -220,6 +263,35 @@ type ColocatedFields<TEntries extends ColocatedEntries> = UnionToIntersection<{
|
|
|
220
263
|
declare const createColocateHelper: () => <TEntries extends ColocatedEntries>(entries: TEntries) => ColocatedFields<TEntries>;
|
|
221
264
|
type ColocateHelper = ReturnType<typeof createColocateHelper>;
|
|
222
265
|
//#endregion
|
|
266
|
+
//#region packages/core/src/types/element/attachment-types.d.ts
|
|
267
|
+
/**
|
|
268
|
+
* Shape constraint for attachment objects used in type utilities.
|
|
269
|
+
*/
|
|
270
|
+
type AttachmentShape = {
|
|
271
|
+
name: string;
|
|
272
|
+
createValue: (element: any) => object;
|
|
273
|
+
};
|
|
274
|
+
/**
|
|
275
|
+
* Extracts the property type contribution from a single attachment.
|
|
276
|
+
* Maps GqlElementAttachment<E, N, V> to { [N]: V }
|
|
277
|
+
*/
|
|
278
|
+
type AttachmentToProperty<TAttachment> = TAttachment extends {
|
|
279
|
+
name: infer TName extends string;
|
|
280
|
+
createValue: (element: any) => infer TValue extends object;
|
|
281
|
+
} ? { [K in TName]: TValue } : never;
|
|
282
|
+
/**
|
|
283
|
+
* Recursively maps a tuple of attachments to an intersection of their properties.
|
|
284
|
+
*
|
|
285
|
+
* @example
|
|
286
|
+
* type Attachments = [
|
|
287
|
+
* { name: "a"; createValue: (el: any) => { x: number } },
|
|
288
|
+
* { name: "b"; createValue: (el: any) => { y: string } }
|
|
289
|
+
* ];
|
|
290
|
+
* type Result = AttachmentsTupleToIntersection<Attachments>;
|
|
291
|
+
* // Result: { a: { x: number } } & { b: { y: string } }
|
|
292
|
+
*/
|
|
293
|
+
type AttachmentsTupleToIntersection<TAttachments extends readonly AttachmentShape[]> = TAttachments extends readonly [infer First extends AttachmentShape, ...infer Rest extends readonly AttachmentShape[]] ? AttachmentToProperty<First> & AttachmentsTupleToIntersection<Rest> : unknown;
|
|
294
|
+
//#endregion
|
|
223
295
|
//#region packages/core/src/utils/empty-object.d.ts
|
|
224
296
|
declare const __EMPTY_SYMBOL__: unique symbol;
|
|
225
297
|
type EmptyObject = {
|
|
@@ -245,22 +317,45 @@ declare const empty: () => EmptyObject;
|
|
|
245
317
|
* while preserving the original schema information for inference.
|
|
246
318
|
*/
|
|
247
319
|
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;
|
|
320
|
+
/**
|
|
321
|
+
* Tools provided to field builder callbacks.
|
|
322
|
+
* - `f`: Field selection factories for the current type
|
|
323
|
+
* - `$`: Variable references for the current scope
|
|
324
|
+
*/
|
|
248
325
|
type FieldsBuilderTools<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"] & string, TVariableDefinitions extends InputTypeSpecifiers> = {
|
|
249
326
|
f: FieldSelectionFactories<TSchema, TTypeName$1>;
|
|
250
|
-
$:
|
|
327
|
+
$: DeclaredVariables<TSchema, TVariableDefinitions>;
|
|
251
328
|
};
|
|
252
|
-
/**
|
|
329
|
+
/**
|
|
330
|
+
* Builder for nested object field selections.
|
|
331
|
+
* Used when a field returns an object type requiring sub-selections.
|
|
332
|
+
*/
|
|
253
333
|
type NestedObjectFieldsBuilder<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"] & string, TFields extends AnyNestedObject> = (tools: NoInfer<NestedObjectFieldsBuilderTools<TSchema, TTypeName$1>>) => TFields;
|
|
334
|
+
/**
|
|
335
|
+
* Tools for nested object builders (no variable access).
|
|
336
|
+
* @internal
|
|
337
|
+
*/
|
|
254
338
|
type NestedObjectFieldsBuilderTools<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"] & string> = {
|
|
255
339
|
f: FieldSelectionFactories<TSchema, TTypeName$1>;
|
|
256
340
|
};
|
|
341
|
+
/**
|
|
342
|
+
* Builder for union type selections with per-member field definitions.
|
|
343
|
+
*/
|
|
257
344
|
type NestedUnionFieldsBuilder<TSchema extends AnyGraphqlSchema, TMemberName extends string, TUnionFields extends AnyNestedUnion> = { [TTypename in keyof TUnionFields & TMemberName]?: NestedObjectFieldsBuilder<TSchema, TTypename, NonNullable<TUnionFields[TTypename]>> };
|
|
258
345
|
/** Map each field to a factory capable of emitting fully-typed references. */
|
|
259
346
|
type FieldSelectionFactories<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"] & string> = { [TFieldName in keyof ObjectFieldRecord<TSchema, TTypeName$1>]: TFieldName extends string ? FieldSelectionFactory<TSchema, FieldSelectionTemplateOf<TSchema, TTypeName$1, TFieldName>> : never };
|
|
347
|
+
/**
|
|
348
|
+
* Type-erased field selection factory.
|
|
349
|
+
* @internal
|
|
350
|
+
*/
|
|
260
351
|
type AnyFieldSelectionFactory = <TAlias extends string | null = null>(fieldArgs: AnyAssignableInput | void, extras?: {
|
|
261
352
|
alias?: TAlias;
|
|
262
353
|
directives?: AnyDirectiveAttachments;
|
|
263
354
|
}) => AnyFieldSelectionFactoryReturn<TAlias>;
|
|
355
|
+
/**
|
|
356
|
+
* Factory function for creating a typed field selection.
|
|
357
|
+
* Accepts field arguments and optional alias/directives.
|
|
358
|
+
*/
|
|
264
359
|
type FieldSelectionFactory<TSchema extends AnyGraphqlSchema, TSelection extends AnyFieldSelection> = <TAlias extends string | null = null>(fieldArgs: TSelection["args"] | IfOmittable<TSelection["args"], void | null>, extras?: {
|
|
265
360
|
alias?: TAlias;
|
|
266
361
|
directives?: TSelection["directives"];
|
|
@@ -305,42 +400,138 @@ type LazyEvaluatorContext = {
|
|
|
305
400
|
//#region packages/core/src/types/element/gql-element.d.ts
|
|
306
401
|
declare const GQL_ELEMENT_FACTORY: unique symbol;
|
|
307
402
|
declare const GQL_ELEMENT_CONTEXT: unique symbol;
|
|
403
|
+
/**
|
|
404
|
+
* Context passed to element definition factories, containing the canonical ID.
|
|
405
|
+
*/
|
|
308
406
|
type GqlElementContext = LazyEvaluatorContext;
|
|
407
|
+
/**
|
|
408
|
+
* Factory function that produces the element definition.
|
|
409
|
+
* May be sync or async (async requires async build mode).
|
|
410
|
+
*/
|
|
309
411
|
type GqlElementDefinitionFactory<T> = (context: GqlElementContext | null) => T | Promise<T>;
|
|
310
|
-
|
|
412
|
+
/**
|
|
413
|
+
* Configuration for attaching a computed property to an element.
|
|
414
|
+
*/
|
|
415
|
+
type GqlElementAttachment<TElement extends object, TName$1 extends string, TValue$1 extends object> = {
|
|
311
416
|
name: TName$1;
|
|
312
|
-
createValue: (element: TElement) => TValue;
|
|
417
|
+
createValue: (element: TElement) => TValue$1;
|
|
313
418
|
};
|
|
419
|
+
/**
|
|
420
|
+
* Abstract base class for all GraphQL elements (Fragment, Operation).
|
|
421
|
+
*
|
|
422
|
+
* Uses lazy evaluation with caching - definition is computed on first access.
|
|
423
|
+
* Subclasses should not be instantiated directly; use static `create` methods.
|
|
424
|
+
*
|
|
425
|
+
* @template TDefinition - The shape of the evaluated definition
|
|
426
|
+
* @template TInfer - Type inference metadata (access via `$infer`)
|
|
427
|
+
*/
|
|
314
428
|
declare abstract class GqlElement<TDefinition extends object, TInfer extends object> {
|
|
429
|
+
/**
|
|
430
|
+
* Type-only property for inference. Throws at runtime.
|
|
431
|
+
* Use with `typeof element.$infer` to extract input/output types.
|
|
432
|
+
*/
|
|
315
433
|
readonly $infer: TInfer;
|
|
316
434
|
private [GQL_ELEMENT_FACTORY];
|
|
317
435
|
private [GQL_ELEMENT_CONTEXT];
|
|
318
436
|
protected constructor(define: GqlElementDefinitionFactory<TDefinition>, getDeps?: () => GqlElement<any, any>[]);
|
|
319
|
-
|
|
437
|
+
/**
|
|
438
|
+
* Attaches lazily-computed properties to this element.
|
|
439
|
+
* Properties are computed once on first access after evaluation.
|
|
440
|
+
*
|
|
441
|
+
* @example Single attachment
|
|
442
|
+
* ```typescript
|
|
443
|
+
* const fragment = gql.default(...)
|
|
444
|
+
* .attach({ name: "utils", createValue: (el) => ({ ... }) });
|
|
445
|
+
* ```
|
|
446
|
+
*
|
|
447
|
+
* @example Multiple attachments (use `as const` for full type inference)
|
|
448
|
+
* ```typescript
|
|
449
|
+
* const fragment = gql.default(...)
|
|
450
|
+
* .attach([
|
|
451
|
+
* { name: "a", createValue: () => ({ x: 1 }) },
|
|
452
|
+
* { name: "b", createValue: () => ({ y: 2 }) },
|
|
453
|
+
* ] as const);
|
|
454
|
+
* ```
|
|
455
|
+
*/
|
|
456
|
+
attach<TName$1 extends string, TValue$1 extends object>(attachment: GqlElementAttachment<this, TName$1, TValue$1>): this & { [K in TName$1]: TValue$1 };
|
|
457
|
+
attach<const TAttachments extends readonly AttachmentShape[]>(attachments: TAttachments): this & AttachmentsTupleToIntersection<TAttachments>;
|
|
458
|
+
/**
|
|
459
|
+
* Sets the canonical context for an element. Used by the builder.
|
|
460
|
+
* @internal
|
|
461
|
+
*/
|
|
320
462
|
static setContext<TElement extends GqlElement<any, any>>(element: TElement, context: GqlElementContext): void;
|
|
463
|
+
/**
|
|
464
|
+
* Gets the canonical context of an element, if set.
|
|
465
|
+
* @internal
|
|
466
|
+
*/
|
|
321
467
|
static getContext(element: GqlElement<any, any>): GqlElementContext | null;
|
|
468
|
+
/**
|
|
469
|
+
* Creates a generator for async evaluation. Used by the builder.
|
|
470
|
+
* @internal
|
|
471
|
+
*/
|
|
322
472
|
static createEvaluationGenerator(element: GqlElement<any, any>): Generator<Promise<void>, void, void>;
|
|
323
473
|
private static evaluateInstantly;
|
|
474
|
+
/**
|
|
475
|
+
* Forces synchronous evaluation. Throws if async operation is needed.
|
|
476
|
+
* @internal
|
|
477
|
+
*/
|
|
324
478
|
static evaluateSync(element: GqlElement<any, any>): void;
|
|
325
|
-
|
|
479
|
+
/**
|
|
480
|
+
* Evaluates and returns the element's definition.
|
|
481
|
+
* Throws if async operation is needed.
|
|
482
|
+
* @internal
|
|
483
|
+
*/
|
|
484
|
+
static get<TValue$1 extends object>(element: GqlElement<TValue$1, any>): TValue$1;
|
|
326
485
|
}
|
|
327
486
|
//#endregion
|
|
328
487
|
//#region packages/core/src/types/element/fragment.d.ts
|
|
488
|
+
/**
|
|
489
|
+
* Type alias for any Fragment instance.
|
|
490
|
+
*/
|
|
329
491
|
type AnyFragment = Fragment<string, any, AnyFields, any>;
|
|
492
|
+
/**
|
|
493
|
+
* Type inference metadata for fragments.
|
|
494
|
+
* Access via `typeof fragment.$infer`.
|
|
495
|
+
*/
|
|
330
496
|
type FragmentInferMeta<TVariables, TOutput extends object> = {
|
|
331
497
|
readonly input: TVariables;
|
|
332
498
|
readonly output: TOutput;
|
|
333
499
|
};
|
|
500
|
+
/**
|
|
501
|
+
* Internal artifact shape produced by fragment evaluation.
|
|
502
|
+
* @internal
|
|
503
|
+
*/
|
|
334
504
|
interface FragmentArtifact<TTypeName$1 extends string, TVariables extends Partial<AnyAssignableInput> | void, TFields extends Partial<AnyFields>> {
|
|
335
505
|
readonly typename: TTypeName$1;
|
|
336
506
|
readonly spread: (variables: TVariables) => TFields;
|
|
337
507
|
}
|
|
338
508
|
declare const __FRAGMENT_BRAND__: unique symbol;
|
|
509
|
+
/**
|
|
510
|
+
* Represents a reusable GraphQL field selection on a specific type.
|
|
511
|
+
*
|
|
512
|
+
* Fragments are created via `gql(({ fragment }) => fragment.TypeName({ ... }))`.
|
|
513
|
+
* Use `spread()` to include the fragment's fields in an operation.
|
|
514
|
+
*
|
|
515
|
+
* @template TTypeName - The GraphQL type this fragment selects from
|
|
516
|
+
* @template TVariables - Variables required when spreading
|
|
517
|
+
* @template TFields - The selected fields structure
|
|
518
|
+
* @template TOutput - Inferred output type from selected fields
|
|
519
|
+
*/
|
|
339
520
|
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> {
|
|
340
521
|
private readonly [__FRAGMENT_BRAND__];
|
|
341
522
|
private constructor();
|
|
523
|
+
/** The GraphQL type name this fragment selects from. */
|
|
342
524
|
get typename(): TTypeName$1;
|
|
525
|
+
/**
|
|
526
|
+
* Spreads this fragment's fields into a parent selection.
|
|
527
|
+
* Pass variables if the fragment defines any.
|
|
528
|
+
*/
|
|
343
529
|
get spread(): (variables: TVariables) => TFields;
|
|
530
|
+
/**
|
|
531
|
+
* Creates a new Fragment instance.
|
|
532
|
+
* Prefer using the `gql(({ fragment }) => ...)` API instead.
|
|
533
|
+
* @internal
|
|
534
|
+
*/
|
|
344
535
|
static create<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"] & string, TVariableDefinitions extends InputTypeSpecifiers, TFields extends AnyFields>(define: () => {
|
|
345
536
|
typename: TTypeName$1;
|
|
346
537
|
spread: (variables: OptionalArg<AssignableInput<TSchema, TVariableDefinitions>>) => TFields;
|
|
@@ -352,13 +543,27 @@ declare class Fragment<TTypeName$1 extends string, TVariables extends Partial<An
|
|
|
352
543
|
}
|
|
353
544
|
//#endregion
|
|
354
545
|
//#region packages/core/src/types/element/operation.d.ts
|
|
546
|
+
/**
|
|
547
|
+
* Type alias for any Operation instance.
|
|
548
|
+
*/
|
|
355
549
|
type AnyOperation = AnyOperationOf<"query"> | AnyOperationOf<"mutation"> | AnyOperationOf<"subscription">;
|
|
550
|
+
/**
|
|
551
|
+
* Type alias for an Operation of a specific type.
|
|
552
|
+
*/
|
|
356
553
|
type AnyOperationOf<TOperationType extends OperationType> = Operation<TOperationType, string, string[], any, AnyFields, any>;
|
|
554
|
+
/**
|
|
555
|
+
* Type inference metadata for operations.
|
|
556
|
+
* Access via `typeof operation.$infer`.
|
|
557
|
+
*/
|
|
357
558
|
type OperationInferMeta<TVariables, TData extends object> = {
|
|
358
559
|
readonly input: TVariables;
|
|
359
560
|
readonly output: TData;
|
|
360
561
|
};
|
|
361
562
|
declare const __OPERATION_BRAND__: unique symbol;
|
|
563
|
+
/**
|
|
564
|
+
* Internal artifact shape produced by operation evaluation.
|
|
565
|
+
* @internal
|
|
566
|
+
*/
|
|
362
567
|
type OperationArtifact<TOperationType extends OperationType, TOperationName extends string, TVariableNames extends string[], TVariables extends AnyConstAssignableInput, TFields extends Partial<AnyFields>, TData extends object> = {
|
|
363
568
|
readonly operationType: TOperationType;
|
|
364
569
|
readonly operationName: TOperationName;
|
|
@@ -367,15 +572,42 @@ type OperationArtifact<TOperationType extends OperationType, TOperationName exte
|
|
|
367
572
|
readonly document: TypedDocumentNode<TData, TVariables>;
|
|
368
573
|
readonly metadata?: unknown;
|
|
369
574
|
};
|
|
575
|
+
/**
|
|
576
|
+
* Represents a GraphQL operation (query, mutation, or subscription).
|
|
577
|
+
*
|
|
578
|
+
* Operations are created via `gql(({ query }) => query.operation({ ... }))`.
|
|
579
|
+
* Produces a TypedDocumentNode for type-safe execution with GraphQL clients.
|
|
580
|
+
*
|
|
581
|
+
* @template TOperationType - 'query' | 'mutation' | 'subscription'
|
|
582
|
+
* @template TOperationName - The unique operation name
|
|
583
|
+
* @template TVariableNames - Tuple of variable names
|
|
584
|
+
* @template TVariables - Variable types for the operation
|
|
585
|
+
* @template TFields - Selected fields structure
|
|
586
|
+
* @template TData - Inferred response data type
|
|
587
|
+
*/
|
|
370
588
|
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> {
|
|
371
589
|
private readonly [__OPERATION_BRAND__];
|
|
372
590
|
private constructor();
|
|
591
|
+
/** The operation type: 'query', 'mutation', or 'subscription'. */
|
|
373
592
|
get operationType(): TOperationType;
|
|
593
|
+
/** The unique name of this operation. */
|
|
374
594
|
get operationName(): TOperationName;
|
|
595
|
+
/** List of variable names defined for this operation. */
|
|
375
596
|
get variableNames(): TVariableNames;
|
|
597
|
+
/**
|
|
598
|
+
* Returns the field selections. Used for document reconstruction.
|
|
599
|
+
* @internal
|
|
600
|
+
*/
|
|
376
601
|
get documentSource(): () => TFields;
|
|
602
|
+
/** The TypedDocumentNode for use with GraphQL clients. */
|
|
377
603
|
get document(): TypedDocumentNode<TData, TVariables>;
|
|
604
|
+
/** Custom metadata attached to this operation, if any. */
|
|
378
605
|
get metadata(): unknown;
|
|
606
|
+
/**
|
|
607
|
+
* Creates a new Operation instance.
|
|
608
|
+
* Prefer using the `gql(({ query }) => ...)` API instead.
|
|
609
|
+
* @internal
|
|
610
|
+
*/
|
|
379
611
|
static create<TSchema extends AnyGraphqlSchema, TOperationType extends OperationType, TOperationName extends string, TVariableDefinitions extends InputTypeSpecifiers, TFields extends AnyFields>(define: (context: GqlElementContext | null) => {
|
|
380
612
|
operationType: TOperationType;
|
|
381
613
|
operationName: TOperationName;
|
|
@@ -394,25 +626,70 @@ declare class Operation<TOperationType extends OperationType, TOperationName ext
|
|
|
394
626
|
}
|
|
395
627
|
//#endregion
|
|
396
628
|
//#region packages/core/src/composer/fields-builder.d.ts
|
|
629
|
+
/**
|
|
630
|
+
* Creates field selection factories for a given object type.
|
|
631
|
+
*
|
|
632
|
+
* Returns an object with a factory for each field defined on the type.
|
|
633
|
+
* Factories are cached per schema+type to avoid recreation.
|
|
634
|
+
*
|
|
635
|
+
* @param schema - The GraphQL schema definition
|
|
636
|
+
* @param typeName - The object type name to create factories for
|
|
637
|
+
* @returns Object mapping field names to their selection factories
|
|
638
|
+
*
|
|
639
|
+
* @internal Used by operation and fragment composers
|
|
640
|
+
*/
|
|
397
641
|
declare const createFieldFactories: <TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"] & string>(schema: TSchema, typeName: TTypeName$1) => FieldSelectionFactories<TSchema, TTypeName$1>;
|
|
398
642
|
//#endregion
|
|
399
643
|
//#region packages/core/src/composer/input.d.ts
|
|
400
|
-
|
|
401
|
-
|
|
644
|
+
/**
|
|
645
|
+
* Creates variable assignments from provided values.
|
|
646
|
+
*
|
|
647
|
+
* Maps variable definitions to VarRefs. If a value is provided,
|
|
648
|
+
* wraps it as a nested-value VarRef. If not provided, creates
|
|
649
|
+
* an undefined VarRef (field will be omitted).
|
|
650
|
+
*
|
|
651
|
+
* Used when spreading fragments with partial variable values.
|
|
652
|
+
*
|
|
653
|
+
* @internal
|
|
654
|
+
*/
|
|
655
|
+
declare const createVarAssignments: <TSchema extends AnyGraphqlSchema, TVariableDefinitions extends InputTypeSpecifiers>(definitions: TVariableDefinitions, providedValues: AnyAssignableInput | void) => DeclaredVariables<TSchema, TVariableDefinitions>;
|
|
656
|
+
/**
|
|
657
|
+
* Creates variable references from variable definitions.
|
|
658
|
+
*
|
|
659
|
+
* Maps each variable definition to a VarRef pointing to that variable.
|
|
660
|
+
* Used in operation builders to create the `$` context object.
|
|
661
|
+
*
|
|
662
|
+
* @internal
|
|
663
|
+
*/
|
|
664
|
+
declare const createVarRefs: <TSchema extends AnyGraphqlSchema, TVarDefinitions extends InputTypeSpecifiers>(definitions: TVarDefinitions) => DeclaredVariables<TSchema, TVarDefinitions>;
|
|
402
665
|
//#endregion
|
|
403
666
|
//#region packages/core/src/composer/fragment.d.ts
|
|
404
667
|
/**
|
|
405
668
|
* Type alias for a fragment builder function for a specific object type.
|
|
406
|
-
*
|
|
669
|
+
*
|
|
670
|
+
* Used by codegen to generate explicit fragment builder types instead of
|
|
671
|
+
* expensive mapped types. This improves IDE performance for large schemas.
|
|
407
672
|
*/
|
|
408
673
|
type FragmentBuilderFor<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"] & string, TAdapter extends AnyMetadataAdapter = DefaultMetadataAdapter> = <TFields extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}>(options: {
|
|
409
674
|
variables?: TVarDefinitions;
|
|
410
675
|
metadata?: FragmentMetadataBuilder<ReturnType<typeof createVarRefs<TSchema, TVarDefinitions>>, ExtractAdapterTypes<TAdapter>["fragmentMetadata"]>;
|
|
411
676
|
fields: FieldsBuilder<TSchema, TTypeName$1, TVarDefinitions, TFields>;
|
|
412
677
|
}) => ReturnType<typeof Fragment.create<TSchema, TTypeName$1, TVarDefinitions, TFields>>;
|
|
678
|
+
/**
|
|
679
|
+
* Creates fragment builder functions for all object types in the schema.
|
|
680
|
+
*
|
|
681
|
+
* Returns an object with a builder for each type (e.g., `fragment.User`, `fragment.Post`).
|
|
682
|
+
* Each builder creates a `Fragment` that can be spread into operations.
|
|
683
|
+
*
|
|
684
|
+
* @param schema - The GraphQL schema definition
|
|
685
|
+
* @param _adapter - Optional metadata adapter (for fragment metadata)
|
|
686
|
+
* @returns Object mapping type names to fragment builder functions
|
|
687
|
+
*
|
|
688
|
+
* @internal Used by `createGqlElementComposer`
|
|
689
|
+
*/
|
|
413
690
|
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: {
|
|
414
691
|
variables?: TVarDefinitions | undefined;
|
|
415
|
-
metadata?: FragmentMetadataBuilder<
|
|
692
|
+
metadata?: FragmentMetadataBuilder<DeclaredVariables<TSchema, TVarDefinitions>, ExtractAdapterTypes<TAdapter>["fragmentMetadata"]> | undefined;
|
|
416
693
|
fields: FieldsBuilder<TSchema, TTypeName, TVarDefinitions, TFields>;
|
|
417
694
|
}) => Fragment<TTypeName, OptionalArg<AssignableInput<TSchema, TVarDefinitions>>, TFields & {
|
|
418
695
|
[key: symbol]: never;
|
|
@@ -471,6 +748,18 @@ type PathSegment = string;
|
|
|
471
748
|
* Proxy type that records property accesses.
|
|
472
749
|
*/
|
|
473
750
|
type SelectableProxy<T> = T;
|
|
751
|
+
/**
|
|
752
|
+
* Gets the full path to a variable within a nested structure.
|
|
753
|
+
*
|
|
754
|
+
* Returns path segments starting with `$variableName` followed by
|
|
755
|
+
* property accesses within that variable's value.
|
|
756
|
+
*
|
|
757
|
+
* @example
|
|
758
|
+
* ```typescript
|
|
759
|
+
* getVariablePath($.filter, p => p.user.id)
|
|
760
|
+
* // Returns: ["$filter", "user", "id"]
|
|
761
|
+
* ```
|
|
762
|
+
*/
|
|
474
763
|
declare const getVariablePath: <T, U>(varRef: VarRef<AnyVarRefBrand>, selector: (proxy: SelectableProxy<T>) => U) => readonly PathSegment[];
|
|
475
764
|
//#endregion
|
|
476
765
|
//#region packages/core/src/composer/var-builder.d.ts
|
|
@@ -501,7 +790,9 @@ type AssignableDefaultValue<TSchema extends AnyGraphqlSchema, TKind extends Inpu
|
|
|
501
790
|
};
|
|
502
791
|
}[TKind]>;
|
|
503
792
|
/**
|
|
504
|
-
*
|
|
793
|
+
* Represents a variable definition with its type, modifier, and optional default.
|
|
794
|
+
*
|
|
795
|
+
* Created by `$var.TypeName("modifier", { default?: ... })` calls.
|
|
505
796
|
*/
|
|
506
797
|
type VarSpecifier<TKind extends InputTypeKind, TTypeName$1 extends string, TModifier extends TypeModifier, TDefaultFn extends (() => unknown) | null, TDirectives extends AnyConstDirectiveAttachments> = {
|
|
507
798
|
kind: TKind;
|
|
@@ -559,7 +850,19 @@ type WrappedVarMethod<TVarName extends string, TSchema extends AnyGraphqlSchema,
|
|
|
559
850
|
*/
|
|
560
851
|
type VarBuilderMethods<TVarName extends string, TSchema extends AnyGraphqlSchema> = { [TName in AllInputTypeNames<TSchema>]: WrappedVarMethod<TVarName, TSchema, InferInputKind<TSchema, TName>, TName> };
|
|
561
852
|
/**
|
|
562
|
-
*
|
|
853
|
+
* Variable builder function type.
|
|
854
|
+
*
|
|
855
|
+
* Call with a variable name to get type-specific methods.
|
|
856
|
+
* Also provides utilities for extracting values from VarRefs.
|
|
857
|
+
*
|
|
858
|
+
* @example
|
|
859
|
+
* ```typescript
|
|
860
|
+
* // In operation definition:
|
|
861
|
+
* variables: { userId: $var("userId").ID("!") }
|
|
862
|
+
*
|
|
863
|
+
* // In metadata builder:
|
|
864
|
+
* $var.getValueAt($.userId, p => p)
|
|
865
|
+
* ```
|
|
563
866
|
*/
|
|
564
867
|
type VarBuilder<TSchema extends AnyGraphqlSchema> = {
|
|
565
868
|
<TVarName extends string>(varName: TVarName): VarBuilderMethods<TVarName, TSchema>;
|
|
@@ -585,11 +888,26 @@ type SchemaAwareGetValueAt<TSchema extends AnyGraphqlSchema> = <T extends AnyVar
|
|
|
585
888
|
*/
|
|
586
889
|
type SchemaAwareGetNameAt<TSchema extends AnyGraphqlSchema> = <T extends AnyVarRefBrand, U>(varRef: VarRef<T>, selector: (proxy: ResolveTypeFromMeta<TSchema, T>) => U) => string;
|
|
587
890
|
/**
|
|
588
|
-
* Creates a variable builder
|
|
891
|
+
* Creates a variable builder using injected input type methods.
|
|
892
|
+
*
|
|
893
|
+
* The returned builder provides type-safe variable definition methods
|
|
894
|
+
* for all input types in the schema. Also includes utilities for
|
|
895
|
+
* extracting variable names and values from VarRefs.
|
|
896
|
+
*
|
|
897
|
+
* @param inputTypeMethods - Methods for each input type (from codegen)
|
|
898
|
+
* @returns Variable builder with methods for all input types
|
|
899
|
+
*
|
|
900
|
+
* @internal Used by `createGqlElementComposer`
|
|
589
901
|
*/
|
|
590
902
|
declare const createVarBuilder: <TSchema extends AnyGraphqlSchema>(inputTypeMethods: InputTypeMethods<TSchema>) => VarBuilder<TSchema>;
|
|
591
903
|
//#endregion
|
|
592
904
|
//#region packages/core/src/composer/gql-composer.d.ts
|
|
905
|
+
/**
|
|
906
|
+
* Function signature for composing GraphQL elements (fragments or operations).
|
|
907
|
+
*
|
|
908
|
+
* The composer provides a context with builders for fragments, operations,
|
|
909
|
+
* variables, and colocation helpers.
|
|
910
|
+
*/
|
|
593
911
|
type GqlElementComposer<TContext> = <TResult extends AnyFragment | AnyOperation>(composeElement: (context: TContext) => TResult) => TResult;
|
|
594
912
|
/**
|
|
595
913
|
* Extracts the helpers type from an adapter.
|
|
@@ -607,16 +925,41 @@ type ExtractMetadataAdapter<TAdapter extends AnyAdapter> = TAdapter extends {
|
|
|
607
925
|
* This is the mapped type that's expensive to compute for large schemas.
|
|
608
926
|
*/
|
|
609
927
|
type FragmentBuildersAll<TSchema extends AnyGraphqlSchema, TAdapter extends AnyMetadataAdapter = DefaultMetadataAdapter> = { readonly [TTypeName in keyof TSchema["object"]]: TTypeName extends string ? FragmentBuilderFor<TSchema, TTypeName, TAdapter> : never };
|
|
928
|
+
/**
|
|
929
|
+
* Configuration options for `createGqlElementComposer`.
|
|
930
|
+
*/
|
|
610
931
|
type GqlElementComposerOptions<TSchema extends AnyGraphqlSchema, TAdapter extends AnyAdapter = DefaultAdapter> = {
|
|
932
|
+
/** Optional adapter for custom helpers and metadata handling. */
|
|
611
933
|
adapter?: TAdapter;
|
|
934
|
+
/** Methods for building variable type specifiers. */
|
|
612
935
|
inputTypeMethods: InputTypeMethods<TSchema>;
|
|
613
936
|
};
|
|
614
937
|
/**
|
|
615
938
|
* Creates a GQL element composer for a given schema.
|
|
616
939
|
*
|
|
617
|
-
*
|
|
618
|
-
*
|
|
619
|
-
*
|
|
940
|
+
* This is the main entry point for defining GraphQL operations and fragments.
|
|
941
|
+
* The returned function provides a context with:
|
|
942
|
+
* - `fragment`: Builders for each object type
|
|
943
|
+
* - `query/mutation/subscription`: Operation builders
|
|
944
|
+
* - `$var`: Variable definition helpers
|
|
945
|
+
* - `$colocate`: Fragment colocation utilities
|
|
946
|
+
*
|
|
947
|
+
* @param schema - The GraphQL schema definition
|
|
948
|
+
* @param options - Configuration including input type methods and optional adapter
|
|
949
|
+
* @returns Element composer function
|
|
950
|
+
*
|
|
951
|
+
* @example
|
|
952
|
+
* ```typescript
|
|
953
|
+
* const gql = createGqlElementComposer(schema, { inputTypeMethods });
|
|
954
|
+
*
|
|
955
|
+
* const GetUser = gql(({ query, $var }) =>
|
|
956
|
+
* query.operation({
|
|
957
|
+
* name: "GetUser",
|
|
958
|
+
* variables: { id: $var.ID("!") },
|
|
959
|
+
* fields: ({ f, $ }) => ({ ...f.user({ id: $.id })(...) }),
|
|
960
|
+
* })
|
|
961
|
+
* );
|
|
962
|
+
* ```
|
|
620
963
|
*/
|
|
621
964
|
declare const createGqlElementComposer: <TSchema extends AnyGraphqlSchema, TFragmentBuilders, TAdapter extends AnyAdapter = DefaultAdapter>(schema: NoInfer<TSchema>, options: GqlElementComposerOptions<NoInfer<TSchema>, NoInfer<TAdapter>>) => GqlElementComposer<{
|
|
622
965
|
fragment: TFragmentBuilders;
|
|
@@ -624,7 +967,7 @@ declare const createGqlElementComposer: <TSchema extends AnyGraphqlSchema, TFrag
|
|
|
624
967
|
operation: <TOperationName extends string, TFields extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}, TOperationMetadata = unknown>(options: {
|
|
625
968
|
name: TOperationName;
|
|
626
969
|
variables?: TVarDefinitions | undefined;
|
|
627
|
-
metadata?: MetadataBuilder<
|
|
970
|
+
metadata?: MetadataBuilder<DeclaredVariables<TSchema, TVarDefinitions>, TOperationMetadata, ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["aggregatedFragmentMetadata"], ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["schemaLevel"]> | undefined;
|
|
628
971
|
fields: FieldsBuilder<TSchema, TSchema["operations"]["query"] & keyof TSchema["object"] & string, TVarDefinitions, TFields>;
|
|
629
972
|
}) => Operation<"query", TOperationName, (keyof TVarDefinitions & string)[], ConstAssignableInput<TSchema, TVarDefinitions>, TFields, InferFields<TSchema, TFields>>;
|
|
630
973
|
};
|
|
@@ -632,7 +975,7 @@ declare const createGqlElementComposer: <TSchema extends AnyGraphqlSchema, TFrag
|
|
|
632
975
|
operation: <TOperationName extends string, TFields extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}, TOperationMetadata = unknown>(options: {
|
|
633
976
|
name: TOperationName;
|
|
634
977
|
variables?: TVarDefinitions | undefined;
|
|
635
|
-
metadata?: MetadataBuilder<
|
|
978
|
+
metadata?: MetadataBuilder<DeclaredVariables<TSchema, TVarDefinitions>, TOperationMetadata, ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["aggregatedFragmentMetadata"], ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["schemaLevel"]> | undefined;
|
|
636
979
|
fields: FieldsBuilder<TSchema, TSchema["operations"]["mutation"] & keyof TSchema["object"] & string, TVarDefinitions, TFields>;
|
|
637
980
|
}) => Operation<"mutation", TOperationName, (keyof TVarDefinitions & string)[], ConstAssignableInput<TSchema, TVarDefinitions>, TFields, InferFields<TSchema, TFields>>;
|
|
638
981
|
};
|
|
@@ -640,7 +983,7 @@ declare const createGqlElementComposer: <TSchema extends AnyGraphqlSchema, TFrag
|
|
|
640
983
|
operation: <TOperationName extends string, TFields extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}, TOperationMetadata = unknown>(options: {
|
|
641
984
|
name: TOperationName;
|
|
642
985
|
variables?: TVarDefinitions | undefined;
|
|
643
|
-
metadata?: MetadataBuilder<
|
|
986
|
+
metadata?: MetadataBuilder<DeclaredVariables<TSchema, TVarDefinitions>, TOperationMetadata, ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["aggregatedFragmentMetadata"], ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["schemaLevel"]> | undefined;
|
|
644
987
|
fields: FieldsBuilder<TSchema, TSchema["operations"]["subscription"] & keyof TSchema["object"] & string, TVarDefinitions, TFields>;
|
|
645
988
|
}) => Operation<"subscription", TOperationName, (keyof TVarDefinitions & string)[], ConstAssignableInput<TSchema, TVarDefinitions>, TFields, InferFields<TSchema, TFields>>;
|
|
646
989
|
};
|
|
@@ -649,6 +992,21 @@ declare const createGqlElementComposer: <TSchema extends AnyGraphqlSchema, TFrag
|
|
|
649
992
|
} & ExtractHelpers<TAdapter>>;
|
|
650
993
|
//#endregion
|
|
651
994
|
//#region packages/core/src/composer/operation.d.ts
|
|
995
|
+
/**
|
|
996
|
+
* Creates a factory for composing GraphQL operations.
|
|
997
|
+
*
|
|
998
|
+
* Returns a curried function: first select operation type (query/mutation/subscription),
|
|
999
|
+
* then define the operation with name, variables, and fields.
|
|
1000
|
+
*
|
|
1001
|
+
* Handles metadata aggregation from fragments (sync or async) and builds
|
|
1002
|
+
* the TypedDocumentNode automatically.
|
|
1003
|
+
*
|
|
1004
|
+
* @param schema - The GraphQL schema definition
|
|
1005
|
+
* @param adapter - Optional metadata adapter for custom metadata handling
|
|
1006
|
+
* @returns Operation type selector function
|
|
1007
|
+
*
|
|
1008
|
+
* @internal Used by `createGqlElementComposer`
|
|
1009
|
+
*/
|
|
652
1010
|
declare const createOperationComposerFactory: <TSchema extends AnyGraphqlSchema, TAdapter extends AnyMetadataAdapter = DefaultMetadataAdapter>(schema: NoInfer<TSchema>, adapter?: TAdapter) => <TOperationType extends OperationType>(operationType: TOperationType) => <TOperationName extends string, TFields extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}, TOperationMetadata = unknown>(options: {
|
|
653
1011
|
name: TOperationName;
|
|
654
1012
|
variables?: TVarDefinitions;
|
|
@@ -661,7 +1019,7 @@ declare const hidden: <T>() => (() => T);
|
|
|
661
1019
|
type Hidden<T> = () => T;
|
|
662
1020
|
//#endregion
|
|
663
1021
|
//#region packages/core/src/utils/wrap-by-key.d.ts
|
|
664
|
-
declare function wrapByKey<TName$1 extends string, TValue>(name: TName$1, value: TValue): { [K in TName$1]: TValue };
|
|
1022
|
+
declare function wrapByKey<TName$1 extends string, TValue$1>(name: TName$1, value: TValue$1): { [K in TName$1]: TValue$1 };
|
|
665
1023
|
//#endregion
|
|
666
|
-
export { NestedUnionFieldsBuilder as $, AnyOperationOf as A,
|
|
667
|
-
//# sourceMappingURL=index-
|
|
1024
|
+
export { NestedUnionFieldsBuilder as $, AnyOperationOf as A, AnyAssignableInput as At, AnyFieldSelectionFactory as B, ConstAssignableInput as Bt, withFragmentUsageCollection as C, AnyFields as Ct, createVarRefs as D, InferField as Dt, createVarAssignments as E, FieldSelectionTemplateOf as Et, FragmentInferMeta as F, DeclaredVariables as Ft, FieldSelectionFactoryObjectReturn as G, FieldSelectionFactories as H, GetAssignableType as Ht, GqlElement as I, FieldArgumentValue as It, FieldSelectionFactoryUnionReturn as J, FieldSelectionFactoryPrimitiveReturn as K, GqlElementAttachment as L, AnyConstDirectiveAttachments as Lt, OperationInferMeta as M, AnyAssigningInput as Mt, AnyFragment as N, AssignableInput as Nt, createFieldFactories as O, InferFields as Ot, Fragment as P, AssignableInputByFieldName as Pt, NestedObjectFieldsBuilderTools as Q, GqlElementContext as R, AnyConstAssignableInput as Rt, recordFragmentUsage as S, AnyFieldSelection as St, createGqlFragmentComposers as T, AnyNestedUnion as Tt, FieldSelectionFactory as U, AnyFieldSelectionFactoryReturn as V, ConstAssignableInputValue as Vt, FieldSelectionFactoryFieldArguments as W, FieldsBuilderTools as X, FieldsBuilder as Y, NestedObjectFieldsBuilder as Z, VarSpecifier as _, buildConstValueNode as _t, ExtractMetadataAdapter as a, AttachmentShape as at, createVarMethodFactory as b, buildWithTypeModifier as bt, GqlElementComposerOptions as c, ColocateHelper as ct, InputTypeMethods as d, createColocateHelper as dt, EmptyObject as et, ResolveTypeFromMeta as f, StripFunctions as ft, VarBuilderMethods as g, buildArgumentValue as gt, VarBuilder as h, UnionToIntersection as ht, createOperationComposerFactory as i, empty as it, Operation as j, AnyAssignableInputValue as jt, AnyOperation as k, AnyDirectiveAttachments as kt, createGqlElementComposer as l, ColocatedEntries as lt, SchemaAwareGetValueAt as m, Tuple as mt, Hidden as n, OptionalArg as nt, FragmentBuildersAll as o, AttachmentToProperty as ot, SchemaAwareGetNameAt as p, StripSymbols as pt, FieldSelectionFactoryReturn as q, hidden as r, SwitchIfOmittable as rt, GqlElementComposer as s, AttachmentsTupleToIntersection as st, wrapByKey as t, IfOmittable as tt, InputTypeMethod as u, ColocatedFields as ut, createVarBuilder as v, buildDocument as vt, FragmentBuilderFor as w, AnyNestedObject as wt, FragmentUsageRecord as x, AbstractFieldSelection as xt, createVarMethod as y, buildOperationTypeNode as yt, GqlElementDefinitionFactory as z, AnyConstAssignableInputValue as zt };
|
|
1025
|
+
//# sourceMappingURL=index-CGLXqMlv.d.cts.map
|