@soda-gql/core 0.11.10 → 0.11.12
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/index-Bj60NxMb.d.cts.map +1 -1
- package/dist/{index-DPtgl2f4.d.ts → index-CULnRHFI.d.ts} +487 -257
- package/dist/index-CULnRHFI.d.ts.map +1 -0
- package/dist/{index-IMOOkvQf.d.cts → index-DT6mTMaZ.d.cts} +487 -257
- package/dist/index-DT6mTMaZ.d.cts.map +1 -0
- package/dist/index-DbANHktR.d.ts.map +1 -1
- package/dist/index.cjs +717 -535
- 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 +714 -536
- package/dist/index.js.map +1 -1
- package/dist/runtime.d.cts +1 -1
- package/dist/runtime.d.ts +1 -1
- package/package.json +1 -1
- package/dist/index-DPtgl2f4.d.ts.map +0 -1
- package/dist/index-IMOOkvQf.d.cts.map +0 -1
|
@@ -152,8 +152,8 @@ type AnyConstAssignableInput = {
|
|
|
152
152
|
readonly [key: string]: AnyConstAssignableInputValue;
|
|
153
153
|
};
|
|
154
154
|
type IsOptional$1<TSpecifier$1 extends InputTypeSpecifier> = TSpecifier$1["modifier"] extends `${string}?` ? true : TSpecifier$1["defaultValue"] extends AnyDefaultValue ? true : false;
|
|
155
|
-
type ConstAssignableInput<TSchema extends AnyGraphqlSchema, TSpecifiers extends InputTypeSpecifiers> = { readonly [K in keyof TSpecifiers as IsOptional$1<TSpecifiers[K]> extends true ? K : never]+?: ConstAssignableInputValue<TSchema, TSpecifiers[K]> } & { readonly [K in keyof TSpecifiers as IsOptional$1<TSpecifiers[K]> extends false ? K : never]-?: ConstAssignableInputValue<TSchema, TSpecifiers[K]> };
|
|
156
|
-
type ConstAssignableInputValue<TSchema extends AnyGraphqlSchema, TSpecifier$1 extends InputTypeSpecifier> = GetConstAssignableType<InferInputProfile<TSchema, TSpecifier$1>> & {};
|
|
155
|
+
type ConstAssignableInput<TSchema$1 extends AnyGraphqlSchema, TSpecifiers extends InputTypeSpecifiers> = { readonly [K in keyof TSpecifiers as IsOptional$1<TSpecifiers[K]> extends true ? K : never]+?: ConstAssignableInputValue<TSchema$1, TSpecifiers[K]> } & { readonly [K in keyof TSpecifiers as IsOptional$1<TSpecifiers[K]> extends false ? K : never]-?: ConstAssignableInputValue<TSchema$1, TSpecifiers[K]> };
|
|
156
|
+
type ConstAssignableInputValue<TSchema$1 extends AnyGraphqlSchema, TSpecifier$1 extends InputTypeSpecifier> = GetConstAssignableType<InferInputProfile<TSchema$1, TSpecifier$1>> & {};
|
|
157
157
|
//#endregion
|
|
158
158
|
//#region packages/core/src/types/schema/const-directives.d.ts
|
|
159
159
|
type AnyConstDirectiveAttachments = {
|
|
@@ -171,20 +171,20 @@ type AnyAssigningInput = {
|
|
|
171
171
|
readonly [key: string]: AnyVarRef;
|
|
172
172
|
};
|
|
173
173
|
type IsOptional<TSpecifier$1 extends InputTypeSpecifier> = TSpecifier$1["modifier"] extends `${string}?` ? true : TSpecifier$1["defaultValue"] extends AnyDefaultValue ? true : false;
|
|
174
|
-
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]> };
|
|
174
|
+
type AssignableInput<TSchema$1 extends AnyGraphqlSchema, TSpecifiers extends InputTypeSpecifiers> = { readonly [K in keyof TSpecifiers as IsOptional<TSpecifiers[K]> extends true ? K : never]+?: FieldArgumentValue<TSchema$1, TSpecifiers[K]> } & { readonly [K in keyof TSpecifiers as IsOptional<TSpecifiers[K]> extends false ? K : never]-?: FieldArgumentValue<TSchema$1, TSpecifiers[K]> };
|
|
175
175
|
/**
|
|
176
176
|
* Field argument value type using typeName + kind for VarRef comparison.
|
|
177
177
|
* Uses GetAssignableType which derives typeName + kind from the profile.
|
|
178
178
|
* This name appears in TypeScript error messages when argument types don't match.
|
|
179
179
|
*/
|
|
180
|
-
type FieldArgumentValue<TSchema extends AnyGraphqlSchema, TSpecifier$1 extends InputTypeSpecifier> = GetAssignableType<InferInputProfile<TSchema, TSpecifier$1>>;
|
|
180
|
+
type FieldArgumentValue<TSchema$1 extends AnyGraphqlSchema, TSpecifier$1 extends InputTypeSpecifier> = GetAssignableType<InferInputProfile<TSchema$1, TSpecifier$1>>;
|
|
181
181
|
/**
|
|
182
182
|
* Declared variables record for an operation or fragment.
|
|
183
183
|
* Maps variable names to their VarRef types with proper branding.
|
|
184
184
|
* This name appears in TypeScript error messages when variable access fails.
|
|
185
185
|
*/
|
|
186
|
-
type DeclaredVariables<TSchema extends AnyGraphqlSchema, TSpecifiers extends InputTypeSpecifiers> = { readonly [K in keyof TSpecifiers]-?: VarRef<TypeProfile.DeclaredVariableType<InferInputProfile<TSchema, TSpecifiers[K]>>> };
|
|
187
|
-
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"]>;
|
|
186
|
+
type DeclaredVariables<TSchema$1 extends AnyGraphqlSchema, TSpecifiers extends InputTypeSpecifiers> = { readonly [K in keyof TSpecifiers]-?: VarRef<TypeProfile.DeclaredVariableType<InferInputProfile<TSchema$1, TSpecifiers[K]>>> };
|
|
187
|
+
type AssignableInputByFieldName<TSchema$1 extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema$1["object"], TFieldName$1 extends keyof TSchema$1["object"][TTypeName$1]["fields"]> = AssignableInput<TSchema$1, TSchema$1["object"][TTypeName$1]["fields"][TFieldName$1]["arguments"]>;
|
|
188
188
|
//#endregion
|
|
189
189
|
//#region packages/core/src/types/fragment/directives.d.ts
|
|
190
190
|
/**
|
|
@@ -241,23 +241,23 @@ type AbstractFieldSelection<TTypeName$1 extends AnyTypeName, TFieldName$1 extend
|
|
|
241
241
|
} ? TUnion : null;
|
|
242
242
|
};
|
|
243
243
|
/** Convenience alias to obtain a typed field reference from the schema. */
|
|
244
|
-
type FieldSelectionTemplateOf<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"] & string, TFieldName$1 extends keyof TSchema["object"][TTypeName$1]["fields"] & string> = PickTypeSpecifierByFieldName<TSchema, TTypeName$1, TFieldName$1> extends infer TRef extends OutputTypeSpecifier ? AbstractFieldSelection<TTypeName$1, TFieldName$1, TRef, AssignableInputByFieldName<TSchema, TTypeName$1, TFieldName$1>, AnyDirectiveAttachments, (TRef extends OutputObjectSpecifier ? {
|
|
244
|
+
type FieldSelectionTemplateOf<TSchema$1 extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema$1["object"] & string, TFieldName$1 extends keyof TSchema$1["object"][TTypeName$1]["fields"] & string> = PickTypeSpecifierByFieldName<TSchema$1, TTypeName$1, TFieldName$1> extends infer TRef extends OutputTypeSpecifier ? AbstractFieldSelection<TTypeName$1, TFieldName$1, TRef, AssignableInputByFieldName<TSchema$1, TTypeName$1, TFieldName$1>, AnyDirectiveAttachments, (TRef extends OutputObjectSpecifier ? {
|
|
245
245
|
object: AnyNestedObject;
|
|
246
246
|
} : never) | (TRef extends OutputUnionSpecifier ? {
|
|
247
247
|
union: AnyNestedUnion;
|
|
248
248
|
} : never)> : never;
|
|
249
249
|
/** Resolve the data shape produced by a set of field selections. */
|
|
250
|
-
type InferFields<TSchema extends AnyGraphqlSchema, TFields extends AnyFields> = { [_ in TSchema["label"]]: { [TAliasName in keyof TFields]: InferField<TSchema, TFields[TAliasName]> } & {} }[TSchema["label"]];
|
|
250
|
+
type InferFields<TSchema$1 extends AnyGraphqlSchema, TFields$1 extends AnyFields> = { [_ in TSchema$1["label"]]: { [TAliasName in keyof TFields$1]: InferField<TSchema$1, TFields$1[TAliasName]> } & {} }[TSchema$1["label"]];
|
|
251
251
|
/** Resolve the data shape for a single field reference, including nested objects/unions. */
|
|
252
|
-
type InferField<TSchema extends AnyGraphqlSchema, TSelection extends AnyFieldSelection> = (TSelection extends {
|
|
252
|
+
type InferField<TSchema$1 extends AnyGraphqlSchema, TSelection extends AnyFieldSelection> = (TSelection extends {
|
|
253
253
|
type: infer TSpecifier extends OutputObjectSpecifier;
|
|
254
254
|
object: infer TNested extends AnyNestedObject;
|
|
255
|
-
} ? ApplyTypeModifier<InferFields<TSchema, TNested>, TSpecifier["modifier"]> : never) | (TSelection extends {
|
|
255
|
+
} ? ApplyTypeModifier<InferFields<TSchema$1, TNested>, TSpecifier["modifier"]> : never) | (TSelection extends {
|
|
256
256
|
type: infer TSpecifier extends OutputUnionSpecifier;
|
|
257
257
|
union: infer TNested extends AnyNestedUnion;
|
|
258
|
-
} ? ApplyTypeModifier<{ [TTypename in keyof TNested]: undefined extends TNested[TTypename] ? never : InferFields<TSchema, NonNullable<TNested[TTypename]>> }[keyof TNested], TSpecifier["modifier"]> : never) | (TSelection extends {
|
|
258
|
+
} ? ApplyTypeModifier<{ [TTypename in keyof TNested]: undefined extends TNested[TTypename] ? never : InferFields<TSchema$1, NonNullable<TNested[TTypename]>> }[keyof TNested], TSpecifier["modifier"]> : never) | (TSelection extends {
|
|
259
259
|
type: infer TSpecifier extends OutputInferrableTypeSpecifier;
|
|
260
|
-
} ? GetModifiedType<InferOutputProfile<TSchema, TSpecifier>, TSpecifier["modifier"]> : never);
|
|
260
|
+
} ? GetModifiedType<InferOutputProfile<TSchema$1, TSpecifier>, TSpecifier["modifier"]> : never);
|
|
261
261
|
//#endregion
|
|
262
262
|
//#region packages/core/src/composer/build-document.d.ts
|
|
263
263
|
/**
|
|
@@ -318,13 +318,13 @@ declare const buildOperationTypeNode: (operation: OperationType) => OperationTyp
|
|
|
318
318
|
* @param options - Operation configuration (name, type, variables, fields, schema)
|
|
319
319
|
* @returns TypedDocumentNode with inferred input/output types
|
|
320
320
|
*/
|
|
321
|
-
declare const buildDocument: <TSchema extends AnyGraphqlSchema, TFields extends AnyFields, TVarDefinitions extends InputTypeSpecifiers>(options: {
|
|
321
|
+
declare const buildDocument: <TSchema$1 extends AnyGraphqlSchema, TFields$1 extends AnyFields, TVarDefinitions$1 extends InputTypeSpecifiers>(options: {
|
|
322
322
|
operationName: string;
|
|
323
323
|
operationType: OperationType;
|
|
324
|
-
variables: TVarDefinitions;
|
|
325
|
-
fields: TFields;
|
|
326
|
-
schema: TSchema;
|
|
327
|
-
}) => TypedDocumentNode<InferFields<TSchema, TFields>, ConstAssignableInput<TSchema, TVarDefinitions>>;
|
|
324
|
+
variables: TVarDefinitions$1;
|
|
325
|
+
fields: TFields$1;
|
|
326
|
+
schema: TSchema$1;
|
|
327
|
+
}) => TypedDocumentNode<InferFields<TSchema$1, TFields$1>, ConstAssignableInput<TSchema$1, TVarDefinitions$1>>;
|
|
328
328
|
//#endregion
|
|
329
329
|
//#region packages/core/src/utils/type-utils.d.ts
|
|
330
330
|
type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends ((x: infer I) => void) ? I : never;
|
|
@@ -371,131 +371,6 @@ type ColocatedFields<TEntries extends ColocatedEntries> = UnionToIntersection<{
|
|
|
371
371
|
declare const createColocateHelper: () => <TEntries extends ColocatedEntries>(entries: TEntries) => ColocatedFields<TEntries>;
|
|
372
372
|
type ColocateHelper = ReturnType<typeof createColocateHelper>;
|
|
373
373
|
//#endregion
|
|
374
|
-
//#region packages/core/src/composer/directive-builder.d.ts
|
|
375
|
-
/**
|
|
376
|
-
* A method that creates a DirectiveRef with specific type information.
|
|
377
|
-
* The TArgs type defines the expected argument shape for the directive.
|
|
378
|
-
*/
|
|
379
|
-
type DirectiveMethod<TDirectiveName extends string, TLocations extends readonly DirectiveLocation[], TArgs> = (args: TArgs) => DirectiveRef<{
|
|
380
|
-
directiveName: TDirectiveName;
|
|
381
|
-
locations: TLocations;
|
|
382
|
-
}>;
|
|
383
|
-
/**
|
|
384
|
-
* Type for directive arguments that can include VarRef values.
|
|
385
|
-
* This allows using variables in directive arguments like `{ if: $.shouldSkip }`.
|
|
386
|
-
*/
|
|
387
|
-
type DirectiveArgValue = boolean | string | number | null | AnyVarRef;
|
|
388
|
-
/**
|
|
389
|
-
* Standard GraphQL directives that are always available.
|
|
390
|
-
*/
|
|
391
|
-
type StandardDirectives = {
|
|
392
|
-
/**
|
|
393
|
-
* @skip directive - conditionally skip a field.
|
|
394
|
-
* @example
|
|
395
|
-
* ```typescript
|
|
396
|
-
* f.email({}, { directives: [$dir.skip({ if: $.hideEmail })] })
|
|
397
|
-
* ```
|
|
398
|
-
*/
|
|
399
|
-
skip: DirectiveMethod<"skip", readonly ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"], {
|
|
400
|
-
if: DirectiveArgValue;
|
|
401
|
-
}>;
|
|
402
|
-
/**
|
|
403
|
-
* @include directive - conditionally include a field.
|
|
404
|
-
* @example
|
|
405
|
-
* ```typescript
|
|
406
|
-
* f.email({}, { directives: [$dir.include({ if: $.showEmail })] })
|
|
407
|
-
* ```
|
|
408
|
-
*/
|
|
409
|
-
include: DirectiveMethod<"include", readonly ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"], {
|
|
410
|
-
if: DirectiveArgValue;
|
|
411
|
-
}>;
|
|
412
|
-
};
|
|
413
|
-
/**
|
|
414
|
-
* Creates a directive method factory for a specific directive.
|
|
415
|
-
*
|
|
416
|
-
* @param name - The directive name (without @)
|
|
417
|
-
* @param locations - Valid locations where the directive can be applied
|
|
418
|
-
* @returns A function that creates DirectiveRef instances
|
|
419
|
-
*
|
|
420
|
-
* @example
|
|
421
|
-
* ```typescript
|
|
422
|
-
* const skipMethod = createDirectiveMethod("skip", ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"] as const);
|
|
423
|
-
* const skipDirective = skipMethod({ if: true });
|
|
424
|
-
* ```
|
|
425
|
-
*/
|
|
426
|
-
declare const createDirectiveMethod: <TDirectiveName extends string, const TLocations extends readonly DirectiveLocation[]>(name: TDirectiveName, locations: TLocations) => (<TArgs extends Record<string, unknown>>(args: TArgs) => DirectiveRef<{
|
|
427
|
-
directiveName: TDirectiveName;
|
|
428
|
-
locations: TLocations;
|
|
429
|
-
}>);
|
|
430
|
-
/**
|
|
431
|
-
* Type for directive argument specifiers.
|
|
432
|
-
* Maps argument names to their type information.
|
|
433
|
-
*/
|
|
434
|
-
type DirectiveArgumentSpecifiers = {
|
|
435
|
-
readonly [argName: string]: DirectiveArgumentSpecifier;
|
|
436
|
-
};
|
|
437
|
-
/**
|
|
438
|
-
* Creates a typed directive method with argument type specifiers.
|
|
439
|
-
* Enables enum value output in directive arguments.
|
|
440
|
-
*
|
|
441
|
-
* @param name - The directive name (without @)
|
|
442
|
-
* @param locations - Valid locations where the directive can be applied
|
|
443
|
-
* @param argSpecs - Type specifiers for directive arguments
|
|
444
|
-
* @returns A function that creates DirectiveRef instances with argument type info
|
|
445
|
-
*
|
|
446
|
-
* @example
|
|
447
|
-
* ```typescript
|
|
448
|
-
* const authMethod = createTypedDirectiveMethod(
|
|
449
|
-
* "auth",
|
|
450
|
-
* ["FIELD"] as const,
|
|
451
|
-
* { role: { kind: "enum", name: "Role", modifier: "!" } }
|
|
452
|
-
* );
|
|
453
|
-
* const authDirective = authMethod({ role: "ADMIN" });
|
|
454
|
-
* ```
|
|
455
|
-
*/
|
|
456
|
-
declare const createTypedDirectiveMethod: <TDirectiveName extends string, const TLocations extends readonly DirectiveLocation[], const TArgSpecs extends DirectiveArgumentSpecifiers>(name: TDirectiveName, locations: TLocations, argSpecs: TArgSpecs) => (<TArgs extends Record<string, unknown>>(args: TArgs) => DirectiveRef<{
|
|
457
|
-
directiveName: TDirectiveName;
|
|
458
|
-
locations: TLocations;
|
|
459
|
-
}>);
|
|
460
|
-
/**
|
|
461
|
-
* Creates the standard GraphQL directives (@skip, @include).
|
|
462
|
-
* These are always available regardless of schema definition.
|
|
463
|
-
*
|
|
464
|
-
* @returns Object containing skip and include directive methods
|
|
465
|
-
*
|
|
466
|
-
* @example
|
|
467
|
-
* ```typescript
|
|
468
|
-
* const $dir = createStandardDirectives();
|
|
469
|
-
* const skipDirective = $dir.skip({ if: true });
|
|
470
|
-
* ```
|
|
471
|
-
*/
|
|
472
|
-
declare const createStandardDirectives: () => StandardDirectives;
|
|
473
|
-
/**
|
|
474
|
-
* Type for any directive method (type-erased).
|
|
475
|
-
*/
|
|
476
|
-
type AnyDirectiveMethod = (args: any) => AnyDirectiveRef;
|
|
477
|
-
/**
|
|
478
|
-
* Type for the directive builder that includes standard directives
|
|
479
|
-
* and can be extended with schema-specific directives.
|
|
480
|
-
*/
|
|
481
|
-
type DirectiveBuilder<TCustomDirectives extends Record<string, AnyDirectiveMethod> = {}> = StandardDirectives & TCustomDirectives;
|
|
482
|
-
/**
|
|
483
|
-
* Creates a directive builder with standard directives and optional custom directives.
|
|
484
|
-
*
|
|
485
|
-
* @param customDirectives - Additional directive methods from schema (generated by codegen)
|
|
486
|
-
* @returns Combined directive builder with all available directives
|
|
487
|
-
*
|
|
488
|
-
* @internal Used by codegen to create schema-specific directive builders
|
|
489
|
-
*/
|
|
490
|
-
declare const createDirectiveBuilder: <TCustomDirectives extends Record<string, AnyDirectiveMethod> = {}>(customDirectives?: TCustomDirectives) => DirectiveBuilder<TCustomDirectives>;
|
|
491
|
-
/**
|
|
492
|
-
* Type guard to check if a value is a DirectiveRef.
|
|
493
|
-
*
|
|
494
|
-
* @param value - Value to check
|
|
495
|
-
* @returns True if value is a DirectiveRef instance
|
|
496
|
-
*/
|
|
497
|
-
declare const isDirectiveRef: (value: unknown) => value is AnyDirectiveRef;
|
|
498
|
-
//#endregion
|
|
499
374
|
//#region packages/core/src/types/element/attachment-types.d.ts
|
|
500
375
|
/**
|
|
501
376
|
* Shape constraint for attachment objects used in type utilities.
|
|
@@ -549,34 +424,34 @@ declare const empty: () => EmptyObject;
|
|
|
549
424
|
* tooling `f`/`fields`/`_` aliases provide ergonomic access to GraphQL fields
|
|
550
425
|
* while preserving the original schema information for inference.
|
|
551
426
|
*/
|
|
552
|
-
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;
|
|
427
|
+
type FieldsBuilder<TSchema$1 extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema$1["object"] & string, TVariableDefinitions extends InputTypeSpecifiers, TFields$1 extends AnyFields> = (tools: NoInfer<FieldsBuilderTools<TSchema$1, TTypeName$1, TVariableDefinitions>>) => TFields$1;
|
|
553
428
|
/**
|
|
554
429
|
* Tools provided to field builder callbacks.
|
|
555
430
|
* - `f`: Field selection factories for the current type
|
|
556
431
|
* - `$`: Variable references for the current scope
|
|
557
432
|
*/
|
|
558
|
-
type FieldsBuilderTools<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"] & string, TVariableDefinitions extends InputTypeSpecifiers> = {
|
|
559
|
-
f: FieldSelectionFactories<TSchema, TTypeName$1>;
|
|
560
|
-
$: DeclaredVariables<TSchema, TVariableDefinitions>;
|
|
433
|
+
type FieldsBuilderTools<TSchema$1 extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema$1["object"] & string, TVariableDefinitions extends InputTypeSpecifiers> = {
|
|
434
|
+
f: FieldSelectionFactories<TSchema$1, TTypeName$1>;
|
|
435
|
+
$: DeclaredVariables<TSchema$1, TVariableDefinitions>;
|
|
561
436
|
};
|
|
562
437
|
/**
|
|
563
438
|
* Builder for nested object field selections.
|
|
564
439
|
* Used when a field returns an object type requiring sub-selections.
|
|
565
440
|
*/
|
|
566
|
-
type NestedObjectFieldsBuilder<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"] & string, TFields extends AnyNestedObject> = (tools: NoInfer<NestedObjectFieldsBuilderTools<TSchema, TTypeName$1>>) => TFields;
|
|
441
|
+
type NestedObjectFieldsBuilder<TSchema$1 extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema$1["object"] & string, TFields$1 extends AnyNestedObject> = (tools: NoInfer<NestedObjectFieldsBuilderTools<TSchema$1, TTypeName$1>>) => TFields$1;
|
|
567
442
|
/**
|
|
568
443
|
* Tools for nested object builders (no variable access).
|
|
569
444
|
* @internal
|
|
570
445
|
*/
|
|
571
|
-
type NestedObjectFieldsBuilderTools<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"] & string> = {
|
|
572
|
-
f: FieldSelectionFactories<TSchema, TTypeName$1>;
|
|
446
|
+
type NestedObjectFieldsBuilderTools<TSchema$1 extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema$1["object"] & string> = {
|
|
447
|
+
f: FieldSelectionFactories<TSchema$1, TTypeName$1>;
|
|
573
448
|
};
|
|
574
449
|
/**
|
|
575
450
|
* Builder for union type selections with per-member field definitions.
|
|
576
451
|
*/
|
|
577
|
-
type NestedUnionFieldsBuilder<TSchema extends AnyGraphqlSchema, TMemberName extends string, TUnionFields extends AnyNestedUnion> = { [TTypename in keyof TUnionFields & TMemberName]?: NestedObjectFieldsBuilder<TSchema, TTypename, NonNullable<TUnionFields[TTypename]>> };
|
|
452
|
+
type NestedUnionFieldsBuilder<TSchema$1 extends AnyGraphqlSchema, TMemberName extends string, TUnionFields extends AnyNestedUnion> = { [TTypename in keyof TUnionFields & TMemberName]?: NestedObjectFieldsBuilder<TSchema$1, TTypename, NonNullable<TUnionFields[TTypename]>> };
|
|
578
453
|
/** Map each field to a factory capable of emitting fully-typed references. */
|
|
579
|
-
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 };
|
|
454
|
+
type FieldSelectionFactories<TSchema$1 extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema$1["object"] & string> = { [TFieldName in keyof ObjectFieldRecord<TSchema$1, TTypeName$1>]: TFieldName extends string ? FieldSelectionFactory<TSchema$1, FieldSelectionTemplateOf<TSchema$1, TTypeName$1, TFieldName>> : never };
|
|
580
455
|
/**
|
|
581
456
|
* Type-erased field selection factory.
|
|
582
457
|
* @internal
|
|
@@ -589,10 +464,10 @@ type AnyFieldSelectionFactory = <TAlias extends string | null = null>(fieldArgs:
|
|
|
589
464
|
* Factory function for creating a typed field selection.
|
|
590
465
|
* Accepts field arguments and optional alias/directives.
|
|
591
466
|
*/
|
|
592
|
-
type FieldSelectionFactory<TSchema extends AnyGraphqlSchema, TSelection extends AnyFieldSelection> = <TAlias extends string | null = null>(fieldArgs: TSelection["args"] | IfOmittable<TSelection["args"], void | null>, extras?: {
|
|
467
|
+
type FieldSelectionFactory<TSchema$1 extends AnyGraphqlSchema, TSelection extends AnyFieldSelection> = <TAlias extends string | null = null>(fieldArgs: TSelection["args"] | IfOmittable<TSelection["args"], void | null>, extras?: {
|
|
593
468
|
alias?: TAlias;
|
|
594
469
|
directives?: AnyDirectiveRef[];
|
|
595
|
-
}) => FieldSelectionFactoryReturn<TSchema, TSelection, TAlias>;
|
|
470
|
+
}) => FieldSelectionFactoryReturn<TSchema$1, TSelection, TAlias>;
|
|
596
471
|
type AnyFieldSelectionFactoryReturn<TAlias extends string | null> = FieldSelectionFactoryReturn<AnyGraphqlSchema, AnyFieldSelection & {
|
|
597
472
|
type: OutputObjectSpecifier;
|
|
598
473
|
}, TAlias> | FieldSelectionFactoryReturn<AnyGraphqlSchema, AnyFieldSelection & {
|
|
@@ -600,21 +475,21 @@ type AnyFieldSelectionFactoryReturn<TAlias extends string | null> = FieldSelecti
|
|
|
600
475
|
}, TAlias> | FieldSelectionFactoryReturn<AnyGraphqlSchema, AnyFieldSelection & {
|
|
601
476
|
type: OutputTypenameSpecifier | OutputScalarSpecifier | OutputEnumSpecifier;
|
|
602
477
|
}, TAlias>;
|
|
603
|
-
type FieldSelectionFactoryReturn<TSchema extends AnyGraphqlSchema, TSelection extends AnyFieldSelection, TAlias extends string | null> = TSelection extends {
|
|
478
|
+
type FieldSelectionFactoryReturn<TSchema$1 extends AnyGraphqlSchema, TSelection extends AnyFieldSelection, TAlias extends string | null> = TSelection extends {
|
|
604
479
|
type: OutputObjectSpecifier;
|
|
605
|
-
} ? FieldSelectionFactoryObjectReturn<TSchema, TSelection, TAlias> : TSelection extends {
|
|
480
|
+
} ? FieldSelectionFactoryObjectReturn<TSchema$1, TSelection, TAlias> : TSelection extends {
|
|
606
481
|
type: OutputUnionSpecifier;
|
|
607
|
-
} ? FieldSelectionFactoryUnionReturn<TSchema, TSelection, TAlias> : TSelection extends {
|
|
482
|
+
} ? FieldSelectionFactoryUnionReturn<TSchema$1, TSelection, TAlias> : TSelection extends {
|
|
608
483
|
type: OutputTypenameSpecifier | OutputScalarSpecifier | OutputEnumSpecifier;
|
|
609
484
|
} ? FieldSelectionFactoryPrimitiveReturn<TSelection, TAlias> : never;
|
|
610
|
-
type FieldSelectionFactoryObjectReturn<TSchema extends AnyGraphqlSchema, TSelection extends AnyFieldSelection & {
|
|
485
|
+
type FieldSelectionFactoryObjectReturn<TSchema$1 extends AnyGraphqlSchema, TSelection extends AnyFieldSelection & {
|
|
611
486
|
type: OutputObjectSpecifier;
|
|
612
|
-
}, TAlias extends string | null> = <TNested$1 extends AnyNestedObject>(nest: NestedObjectFieldsBuilder<TSchema, TSelection["type"]["name"], TNested$1>) => { [_ in TAlias extends null ? TSelection["field"] : TAlias]: AbstractFieldSelection<TSelection["parent"], TSelection["field"], TSelection["type"], TSelection["args"], TSelection["directives"], {
|
|
487
|
+
}, TAlias extends string | null> = <TNested$1 extends AnyNestedObject>(nest: NestedObjectFieldsBuilder<TSchema$1, TSelection["type"]["name"], TNested$1>) => { [_ in TAlias extends null ? TSelection["field"] : TAlias]: AbstractFieldSelection<TSelection["parent"], TSelection["field"], TSelection["type"], TSelection["args"], TSelection["directives"], {
|
|
613
488
|
object: TNested$1;
|
|
614
489
|
}> };
|
|
615
|
-
type FieldSelectionFactoryUnionReturn<TSchema extends AnyGraphqlSchema, TSelection extends AnyFieldSelection & {
|
|
490
|
+
type FieldSelectionFactoryUnionReturn<TSchema$1 extends AnyGraphqlSchema, TSelection extends AnyFieldSelection & {
|
|
616
491
|
type: OutputUnionSpecifier;
|
|
617
|
-
}, TAlias extends string | null> = <TNested$1 extends AnyNestedUnion>(nest: NestedUnionFieldsBuilder<TSchema, UnionMemberName<TSchema, TSelection["type"]>, TNested$1>) => { [_ in TAlias extends null ? TSelection["field"] : TAlias]: AbstractFieldSelection<TSelection["parent"], TSelection["field"], TSelection["type"], TSelection["args"], TSelection["directives"], {
|
|
492
|
+
}, TAlias extends string | null> = <TNested$1 extends AnyNestedUnion>(nest: NestedUnionFieldsBuilder<TSchema$1, UnionMemberName<TSchema$1, TSelection["type"]>, TNested$1>) => { [_ in TAlias extends null ? TSelection["field"] : TAlias]: AbstractFieldSelection<TSelection["parent"], TSelection["field"], TSelection["type"], TSelection["args"], TSelection["directives"], {
|
|
618
493
|
union: TNested$1;
|
|
619
494
|
}> };
|
|
620
495
|
type FieldSelectionFactoryPrimitiveReturn<TSelection extends AnyFieldSelection & {
|
|
@@ -622,6 +497,55 @@ type FieldSelectionFactoryPrimitiveReturn<TSelection extends AnyFieldSelection &
|
|
|
622
497
|
}, TAlias extends string | null> = { [_ in TAlias extends null ? TSelection["field"] : TAlias]: AbstractFieldSelection<TSelection["parent"], TSelection["field"], TSelection["type"], TSelection["args"], TSelection["directives"], {}> };
|
|
623
498
|
type FieldSelectionFactoryFieldArguments<TFieldSelectionTemplate extends AnyFieldSelection> = TFieldSelectionTemplate["args"] | IfOmittable<TFieldSelectionTemplate["args"], void | null>;
|
|
624
499
|
//#endregion
|
|
500
|
+
//#region packages/core/src/types/element/compat-spec.d.ts
|
|
501
|
+
/**
|
|
502
|
+
* Specification for a compat operation, storing unevaluated fieldsBuilder.
|
|
503
|
+
* Created by `query.compat()`, `mutation.compat()`, `subscription.compat()`.
|
|
504
|
+
*
|
|
505
|
+
* The fieldsBuilder is stored unevaluated and will be evaluated when
|
|
506
|
+
* `extend()` is called to create the final Operation.
|
|
507
|
+
*
|
|
508
|
+
* @template TSchema - The GraphQL schema type
|
|
509
|
+
* @template TOperationType - The operation type ('query' | 'mutation' | 'subscription')
|
|
510
|
+
* @template TOperationName - The operation name literal type
|
|
511
|
+
* @template TVarDefinitions - The variable definitions type
|
|
512
|
+
* @template TFields - The fields type returned by the fieldsBuilder
|
|
513
|
+
*
|
|
514
|
+
* @example
|
|
515
|
+
* ```typescript
|
|
516
|
+
* // This is created internally by query.compat()
|
|
517
|
+
* const spec: CompatSpec<Schema, 'query', 'GetUser', { userId: VarSpec }, Fields> = {
|
|
518
|
+
* schema,
|
|
519
|
+
* operationType: 'query',
|
|
520
|
+
* operationName: 'GetUser',
|
|
521
|
+
* variables: { userId: varSpec },
|
|
522
|
+
* fieldsBuilder: ({ f, $ }) => ({ ...f.user({ id: $.userId })(...) }),
|
|
523
|
+
* };
|
|
524
|
+
* ```
|
|
525
|
+
*/
|
|
526
|
+
type CompatSpec<TSchema$1 extends AnyGraphqlSchema, TOperationType$1 extends OperationType, TOperationName$1 extends string, TVarDefinitions$1 extends InputTypeSpecifiers, TFields$1 extends AnyFields> = {
|
|
527
|
+
readonly schema: TSchema$1;
|
|
528
|
+
readonly operationType: TOperationType$1;
|
|
529
|
+
readonly operationName: TOperationName$1;
|
|
530
|
+
readonly variables: TVarDefinitions$1;
|
|
531
|
+
readonly fieldsBuilder: FieldsBuilder<TSchema$1, TSchema$1["operations"][TOperationType$1] & keyof TSchema$1["object"] & string, TVarDefinitions$1, TFields$1>;
|
|
532
|
+
};
|
|
533
|
+
/**
|
|
534
|
+
* Type alias for any CompatSpec instance.
|
|
535
|
+
*/
|
|
536
|
+
type AnyCompatSpec = CompatSpec<AnyGraphqlSchema, OperationType, string, InputTypeSpecifiers, AnyFields>;
|
|
537
|
+
/**
|
|
538
|
+
* Extracts type information from a CompatSpec.
|
|
539
|
+
* Used by extend() to infer types from the compat operation.
|
|
540
|
+
*/
|
|
541
|
+
type ExtractCompatSpec<T> = T extends CompatSpec<infer TSchema, infer TOperationType, infer TOperationName, infer TVarDefinitions, infer TFields> ? {
|
|
542
|
+
schema: TSchema;
|
|
543
|
+
operationType: TOperationType;
|
|
544
|
+
operationName: TOperationName;
|
|
545
|
+
variables: TVarDefinitions;
|
|
546
|
+
fields: TFields;
|
|
547
|
+
} : never;
|
|
548
|
+
//#endregion
|
|
625
549
|
//#region packages/core/src/types/element/lazy-evaluator.d.ts
|
|
626
550
|
/**
|
|
627
551
|
* Context passed to the definition factory during evaluation.
|
|
@@ -717,6 +641,79 @@ declare abstract class GqlElement<TDefinition extends object, TInfer extends obj
|
|
|
717
641
|
static get<TValue$1 extends object>(element: GqlElement<TValue$1, any>): TValue$1;
|
|
718
642
|
}
|
|
719
643
|
//#endregion
|
|
644
|
+
//#region packages/core/src/types/element/define.d.ts
|
|
645
|
+
/**
|
|
646
|
+
* Type alias for any GqlDefine instance.
|
|
647
|
+
*/
|
|
648
|
+
type AnyGqlDefine = GqlDefine<unknown>;
|
|
649
|
+
/**
|
|
650
|
+
* Type inference metadata for define elements.
|
|
651
|
+
* Access via `typeof defineElement.$infer`.
|
|
652
|
+
*/
|
|
653
|
+
type DefineInferMeta<TValue$1> = {
|
|
654
|
+
readonly value: TValue$1;
|
|
655
|
+
};
|
|
656
|
+
declare const __DEFINE_BRAND__: unique symbol;
|
|
657
|
+
/**
|
|
658
|
+
* Internal artifact shape produced by define evaluation.
|
|
659
|
+
* @internal
|
|
660
|
+
*/
|
|
661
|
+
type DefineArtifact<TValue$1> = {
|
|
662
|
+
readonly factoryResult: TValue$1;
|
|
663
|
+
};
|
|
664
|
+
/**
|
|
665
|
+
* Represents a factory-based value definition.
|
|
666
|
+
*
|
|
667
|
+
* Define elements are created via `gql(({ define }) => define(() => value))`.
|
|
668
|
+
* The factory is evaluated lazily and the result is cached.
|
|
669
|
+
*
|
|
670
|
+
* @template TValue - The type of value produced by the factory
|
|
671
|
+
*
|
|
672
|
+
* @example
|
|
673
|
+
* ```typescript
|
|
674
|
+
* // Store a primitive value
|
|
675
|
+
* const myNumber = gql.default(({ define }) => define(() => 42));
|
|
676
|
+
* console.log(myNumber.value); // 42
|
|
677
|
+
*
|
|
678
|
+
* // Store a plain object
|
|
679
|
+
* const myConfig = gql.default(({ define }) => define(() => ({
|
|
680
|
+
* apiUrl: "https://api.example.com",
|
|
681
|
+
* timeout: 5000,
|
|
682
|
+
* })));
|
|
683
|
+
* console.log(myConfig.value.apiUrl); // "https://api.example.com"
|
|
684
|
+
* ```
|
|
685
|
+
*/
|
|
686
|
+
declare class GqlDefine<TValue$1> extends GqlElement<DefineArtifact<TValue$1>, DefineInferMeta<TValue$1>> {
|
|
687
|
+
private readonly [__DEFINE_BRAND__];
|
|
688
|
+
private constructor();
|
|
689
|
+
/**
|
|
690
|
+
* The evaluated value from the factory.
|
|
691
|
+
* Triggers lazy evaluation on first access.
|
|
692
|
+
*/
|
|
693
|
+
get value(): TValue$1;
|
|
694
|
+
/**
|
|
695
|
+
* Creates a new GqlDefine instance.
|
|
696
|
+
*
|
|
697
|
+
* Prefer using the `gql(({ define }) => define(() => value))` API instead.
|
|
698
|
+
*
|
|
699
|
+
* @param factory - Function that produces the value. Can be sync or async.
|
|
700
|
+
* @returns A new GqlDefine instance wrapping the factory result.
|
|
701
|
+
*
|
|
702
|
+
* @example
|
|
703
|
+
* ```typescript
|
|
704
|
+
* // Sync factory
|
|
705
|
+
* const syncDefine = GqlDefine.create(() => 42);
|
|
706
|
+
*
|
|
707
|
+
* // Async factory
|
|
708
|
+
* const asyncDefine = GqlDefine.create(async () => {
|
|
709
|
+
* const data = await fetch('/api/config');
|
|
710
|
+
* return data.json();
|
|
711
|
+
* });
|
|
712
|
+
* ```
|
|
713
|
+
*/
|
|
714
|
+
static create<TValue$1>(factory: () => TValue$1 | Promise<TValue$1>): GqlDefine<TValue$1>;
|
|
715
|
+
}
|
|
716
|
+
//#endregion
|
|
720
717
|
//#region packages/core/src/types/element/fragment.d.ts
|
|
721
718
|
/**
|
|
722
719
|
* Type alias for any Fragment instance.
|
|
@@ -734,12 +731,12 @@ type FragmentInferMeta<TVariables, TOutput extends object> = {
|
|
|
734
731
|
* Internal artifact shape produced by fragment evaluation.
|
|
735
732
|
* @internal
|
|
736
733
|
*/
|
|
737
|
-
interface FragmentArtifact<TTypeName$1 extends string, TVariables extends Partial<AnyAssignableInput> | void, TFields extends Partial<AnyFields>> {
|
|
734
|
+
interface FragmentArtifact<TTypeName$1 extends string, TVariables extends Partial<AnyAssignableInput> | void, TFields$1 extends Partial<AnyFields>> {
|
|
738
735
|
readonly typename: TTypeName$1;
|
|
739
736
|
readonly key: string | undefined;
|
|
740
737
|
readonly schemaLabel: string;
|
|
741
738
|
readonly variableDefinitions: InputTypeSpecifiers;
|
|
742
|
-
readonly spread: (variables: TVariables) => TFields;
|
|
739
|
+
readonly spread: (variables: TVariables) => TFields$1;
|
|
743
740
|
}
|
|
744
741
|
declare const __FRAGMENT_BRAND__: unique symbol;
|
|
745
742
|
/**
|
|
@@ -753,7 +750,7 @@ declare const __FRAGMENT_BRAND__: unique symbol;
|
|
|
753
750
|
* @template TFields - The selected fields structure
|
|
754
751
|
* @template TOutput - Inferred output type from selected fields
|
|
755
752
|
*/
|
|
756
|
-
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> {
|
|
753
|
+
declare class Fragment<TTypeName$1 extends string, TVariables extends Partial<AnyAssignableInput> | void, TFields$1 extends Partial<AnyFields>, TOutput extends object> extends GqlElement<FragmentArtifact<TTypeName$1, TVariables, TFields$1>, FragmentInferMeta<TVariables, TOutput>> implements FragmentArtifact<TTypeName$1, TVariables, TFields$1> {
|
|
757
754
|
private readonly [__FRAGMENT_BRAND__];
|
|
758
755
|
private constructor();
|
|
759
756
|
/** The GraphQL type name this fragment selects from. */
|
|
@@ -768,21 +765,21 @@ declare class Fragment<TTypeName$1 extends string, TVariables extends Partial<An
|
|
|
768
765
|
* Spreads this fragment's fields into a parent selection.
|
|
769
766
|
* Pass variables if the fragment defines any.
|
|
770
767
|
*/
|
|
771
|
-
get spread(): (variables: TVariables) => TFields;
|
|
768
|
+
get spread(): (variables: TVariables) => TFields$1;
|
|
772
769
|
/**
|
|
773
770
|
* Creates a new Fragment instance.
|
|
774
771
|
* Prefer using the `gql(({ fragment }) => ...)` API instead.
|
|
775
772
|
* @internal
|
|
776
773
|
*/
|
|
777
|
-
static create<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"] & string, TVariableDefinitions extends InputTypeSpecifiers, TFields extends AnyFields>(define: () => {
|
|
774
|
+
static create<TSchema$1 extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema$1["object"] & string, TVariableDefinitions extends InputTypeSpecifiers, TFields$1 extends AnyFields>(define: () => {
|
|
778
775
|
typename: TTypeName$1;
|
|
779
776
|
key: string | undefined;
|
|
780
|
-
schemaLabel: TSchema["label"];
|
|
777
|
+
schemaLabel: TSchema$1["label"];
|
|
781
778
|
variableDefinitions: TVariableDefinitions;
|
|
782
|
-
spread: (variables: OptionalArg<AssignableInput<TSchema, TVariableDefinitions>>) => TFields;
|
|
783
|
-
}): Fragment<TTypeName$1, OptionalArg<AssignableInput<TSchema, TVariableDefinitions>>, TFields & {
|
|
779
|
+
spread: (variables: OptionalArg<AssignableInput<TSchema$1, TVariableDefinitions>>) => TFields$1;
|
|
780
|
+
}): Fragment<TTypeName$1, OptionalArg<AssignableInput<TSchema$1, TVariableDefinitions>>, TFields$1 & {
|
|
784
781
|
[key: symbol]: never;
|
|
785
|
-
}, InferFields<TSchema, TFields> & {
|
|
782
|
+
}, InferFields<TSchema$1, TFields$1> & {
|
|
786
783
|
[key: symbol]: never;
|
|
787
784
|
}>;
|
|
788
785
|
}
|
|
@@ -795,7 +792,7 @@ type AnyOperation = AnyOperationOf<"query"> | AnyOperationOf<"mutation"> | AnyOp
|
|
|
795
792
|
/**
|
|
796
793
|
* Type alias for an Operation of a specific type.
|
|
797
794
|
*/
|
|
798
|
-
type AnyOperationOf<TOperationType extends OperationType> = Operation<TOperationType, string, string[], any, AnyFields, any>;
|
|
795
|
+
type AnyOperationOf<TOperationType$1 extends OperationType> = Operation<TOperationType$1, string, string[], any, AnyFields, any>;
|
|
799
796
|
/**
|
|
800
797
|
* Type inference metadata for operations.
|
|
801
798
|
* Access via `typeof operation.$infer`.
|
|
@@ -809,12 +806,12 @@ declare const __OPERATION_BRAND__: unique symbol;
|
|
|
809
806
|
* Internal artifact shape produced by operation evaluation.
|
|
810
807
|
* @internal
|
|
811
808
|
*/
|
|
812
|
-
type OperationArtifact<TOperationType extends OperationType, TOperationName extends string, TVariableNames extends string[], TVariables extends AnyConstAssignableInput, TFields extends Partial<AnyFields>, TData extends object> = {
|
|
813
|
-
readonly operationType: TOperationType;
|
|
814
|
-
readonly operationName: TOperationName;
|
|
809
|
+
type OperationArtifact<TOperationType$1 extends OperationType, TOperationName$1 extends string, TVariableNames extends string[], TVariables extends AnyConstAssignableInput, TFields$1 extends Partial<AnyFields>, TData extends object> = {
|
|
810
|
+
readonly operationType: TOperationType$1;
|
|
811
|
+
readonly operationName: TOperationName$1;
|
|
815
812
|
readonly schemaLabel: string;
|
|
816
813
|
readonly variableNames: TVariableNames;
|
|
817
|
-
readonly documentSource: () => TFields;
|
|
814
|
+
readonly documentSource: () => TFields$1;
|
|
818
815
|
readonly document: TypedDocumentNode<TData, TVariables>;
|
|
819
816
|
readonly metadata?: unknown;
|
|
820
817
|
};
|
|
@@ -831,13 +828,13 @@ type OperationArtifact<TOperationType extends OperationType, TOperationName exte
|
|
|
831
828
|
* @template TFields - Selected fields structure
|
|
832
829
|
* @template TData - Inferred response data type
|
|
833
830
|
*/
|
|
834
|
-
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> {
|
|
831
|
+
declare class Operation<TOperationType$1 extends OperationType, TOperationName$1 extends string, TVariableNames extends string[], TVariables extends AnyConstAssignableInput, TFields$1 extends Partial<AnyFields>, TData extends object> extends GqlElement<OperationArtifact<TOperationType$1, TOperationName$1, TVariableNames, TVariables, TFields$1, TData>, OperationInferMeta<TVariables, TData>> implements OperationArtifact<TOperationType$1, TOperationName$1, TVariableNames, TVariables, TFields$1, TData> {
|
|
835
832
|
private readonly [__OPERATION_BRAND__];
|
|
836
833
|
private constructor();
|
|
837
834
|
/** The operation type: 'query', 'mutation', or 'subscription'. */
|
|
838
|
-
get operationType(): TOperationType;
|
|
835
|
+
get operationType(): TOperationType$1;
|
|
839
836
|
/** The unique name of this operation. */
|
|
840
|
-
get operationName(): TOperationName;
|
|
837
|
+
get operationName(): TOperationName$1;
|
|
841
838
|
/** The schema label this operation belongs to. */
|
|
842
839
|
get schemaLabel(): string;
|
|
843
840
|
/** List of variable names defined for this operation. */
|
|
@@ -846,7 +843,7 @@ declare class Operation<TOperationType extends OperationType, TOperationName ext
|
|
|
846
843
|
* Returns the field selections. Used for document reconstruction.
|
|
847
844
|
* @internal
|
|
848
845
|
*/
|
|
849
|
-
get documentSource(): () => TFields;
|
|
846
|
+
get documentSource(): () => TFields$1;
|
|
850
847
|
/** The TypedDocumentNode for use with GraphQL clients. */
|
|
851
848
|
get document(): TypedDocumentNode<TData, TVariables>;
|
|
852
849
|
/** Custom metadata attached to this operation, if any. */
|
|
@@ -856,25 +853,201 @@ declare class Operation<TOperationType extends OperationType, TOperationName ext
|
|
|
856
853
|
* Prefer using the `gql(({ query }) => ...)` API instead.
|
|
857
854
|
* @internal
|
|
858
855
|
*/
|
|
859
|
-
static create<TSchema extends AnyGraphqlSchema, TOperationType extends OperationType, TOperationName extends string, TVariableDefinitions extends InputTypeSpecifiers, TFields extends AnyFields>(define: (context: GqlElementContext | null) => {
|
|
860
|
-
operationType: TOperationType;
|
|
861
|
-
operationName: TOperationName;
|
|
862
|
-
schemaLabel: TSchema["label"];
|
|
856
|
+
static create<TSchema$1 extends AnyGraphqlSchema, TOperationType$1 extends OperationType, TOperationName$1 extends string, TVariableDefinitions extends InputTypeSpecifiers, TFields$1 extends AnyFields>(define: (context: GqlElementContext | null) => {
|
|
857
|
+
operationType: TOperationType$1;
|
|
858
|
+
operationName: TOperationName$1;
|
|
859
|
+
schemaLabel: TSchema$1["label"];
|
|
863
860
|
variableNames: (keyof TVariableDefinitions & string)[];
|
|
864
|
-
documentSource: () => TFields;
|
|
865
|
-
document: TypedDocumentNode<InferFields<TSchema, TFields>, ConstAssignableInput<TSchema, TVariableDefinitions>>;
|
|
861
|
+
documentSource: () => TFields$1;
|
|
862
|
+
document: TypedDocumentNode<InferFields<TSchema$1, TFields$1>, ConstAssignableInput<TSchema$1, TVariableDefinitions>>;
|
|
866
863
|
metadata?: unknown;
|
|
867
864
|
} | Promise<{
|
|
868
|
-
operationType: TOperationType;
|
|
869
|
-
operationName: TOperationName;
|
|
870
|
-
schemaLabel: TSchema["label"];
|
|
865
|
+
operationType: TOperationType$1;
|
|
866
|
+
operationName: TOperationName$1;
|
|
867
|
+
schemaLabel: TSchema$1["label"];
|
|
871
868
|
variableNames: (keyof TVariableDefinitions & string)[];
|
|
872
|
-
documentSource: () => TFields;
|
|
873
|
-
document: TypedDocumentNode<InferFields<TSchema, TFields>, ConstAssignableInput<TSchema, TVariableDefinitions>>;
|
|
869
|
+
documentSource: () => TFields$1;
|
|
870
|
+
document: TypedDocumentNode<InferFields<TSchema$1, TFields$1>, ConstAssignableInput<TSchema$1, TVariableDefinitions>>;
|
|
874
871
|
metadata?: unknown;
|
|
875
|
-
}>): Operation<TOperationType, TOperationName, (keyof TVariableDefinitions & string)[], ConstAssignableInput<TSchema, TVariableDefinitions>, TFields, InferFields<TSchema, TFields>>;
|
|
872
|
+
}>): Operation<TOperationType$1, TOperationName$1, (keyof TVariableDefinitions & string)[], ConstAssignableInput<TSchema$1, TVariableDefinitions>, TFields$1, InferFields<TSchema$1, TFields$1>>;
|
|
876
873
|
}
|
|
877
874
|
//#endregion
|
|
875
|
+
//#region packages/core/src/composer/compat.d.ts
|
|
876
|
+
/**
|
|
877
|
+
* Options for creating a compat operation specification.
|
|
878
|
+
*/
|
|
879
|
+
type CompatOptions<TSchema$1 extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema$1["object"] & string, TOperationName$1 extends string, TVarDefinitions$1 extends InputTypeSpecifiers, TFields$1 extends AnyFields> = {
|
|
880
|
+
/** The operation name */
|
|
881
|
+
name: TOperationName$1;
|
|
882
|
+
/** Optional variable definitions */
|
|
883
|
+
variables?: TVarDefinitions$1;
|
|
884
|
+
/** Field selection builder */
|
|
885
|
+
fields: FieldsBuilder<TSchema$1, TTypeName$1, TVarDefinitions$1, TFields$1>;
|
|
886
|
+
};
|
|
887
|
+
/**
|
|
888
|
+
* Creates a factory for composing compat operation specifications.
|
|
889
|
+
*
|
|
890
|
+
* Returns a function that creates a `GqlDefine<CompatSpec<...>>` storing
|
|
891
|
+
* the operation specification with unevaluated fieldsBuilder.
|
|
892
|
+
*
|
|
893
|
+
* @param schema - The GraphQL schema definition
|
|
894
|
+
* @param operationType - The operation type ('query' | 'mutation' | 'subscription')
|
|
895
|
+
* @returns Compat operation composer function
|
|
896
|
+
*
|
|
897
|
+
* @internal Used by `createGqlElementComposer`
|
|
898
|
+
*/
|
|
899
|
+
declare const createCompatComposer: <TSchema$1 extends AnyGraphqlSchema, TOperationType$1 extends OperationType>(schema: NoInfer<TSchema$1>, operationType: TOperationType$1) => <TOperationName$1 extends string, TFields$1 extends AnyFields, TVarDefinitions$1 extends InputTypeSpecifiers = {}>(options: CompatOptions<TSchema$1, TSchema$1["operations"][TOperationType$1] & keyof TSchema$1["object"] & string, TOperationName$1, TVarDefinitions$1, TFields$1>) => GqlDefine<CompatSpec<TSchema$1, TOperationType$1, TOperationName$1, TVarDefinitions$1, TFields$1>>;
|
|
900
|
+
//#endregion
|
|
901
|
+
//#region packages/core/src/composer/directive-builder.d.ts
|
|
902
|
+
/**
|
|
903
|
+
* A method that creates a DirectiveRef with specific type information.
|
|
904
|
+
* The TArgs type defines the expected argument shape for the directive.
|
|
905
|
+
*/
|
|
906
|
+
type DirectiveMethod<TDirectiveName extends string, TLocations extends readonly DirectiveLocation[], TArgs> = (args: TArgs) => DirectiveRef<{
|
|
907
|
+
directiveName: TDirectiveName;
|
|
908
|
+
locations: TLocations;
|
|
909
|
+
}>;
|
|
910
|
+
/**
|
|
911
|
+
* Type for directive arguments that can include VarRef values.
|
|
912
|
+
* This allows using variables in directive arguments like `{ if: $.shouldSkip }`.
|
|
913
|
+
*/
|
|
914
|
+
type DirectiveArgValue = boolean | string | number | null | AnyVarRef;
|
|
915
|
+
/**
|
|
916
|
+
* Standard GraphQL directives that are always available.
|
|
917
|
+
*/
|
|
918
|
+
type StandardDirectives = {
|
|
919
|
+
/**
|
|
920
|
+
* @skip directive - conditionally skip a field.
|
|
921
|
+
* @example
|
|
922
|
+
* ```typescript
|
|
923
|
+
* f.email({}, { directives: [$dir.skip({ if: $.hideEmail })] })
|
|
924
|
+
* ```
|
|
925
|
+
*/
|
|
926
|
+
skip: DirectiveMethod<"skip", readonly ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"], {
|
|
927
|
+
if: DirectiveArgValue;
|
|
928
|
+
}>;
|
|
929
|
+
/**
|
|
930
|
+
* @include directive - conditionally include a field.
|
|
931
|
+
* @example
|
|
932
|
+
* ```typescript
|
|
933
|
+
* f.email({}, { directives: [$dir.include({ if: $.showEmail })] })
|
|
934
|
+
* ```
|
|
935
|
+
*/
|
|
936
|
+
include: DirectiveMethod<"include", readonly ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"], {
|
|
937
|
+
if: DirectiveArgValue;
|
|
938
|
+
}>;
|
|
939
|
+
};
|
|
940
|
+
/**
|
|
941
|
+
* Creates a directive method factory for a specific directive.
|
|
942
|
+
*
|
|
943
|
+
* @param name - The directive name (without @)
|
|
944
|
+
* @param locations - Valid locations where the directive can be applied
|
|
945
|
+
* @returns A function that creates DirectiveRef instances
|
|
946
|
+
*
|
|
947
|
+
* @example
|
|
948
|
+
* ```typescript
|
|
949
|
+
* const skipMethod = createDirectiveMethod("skip", ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"] as const);
|
|
950
|
+
* const skipDirective = skipMethod({ if: true });
|
|
951
|
+
* ```
|
|
952
|
+
*/
|
|
953
|
+
declare const createDirectiveMethod: <TDirectiveName extends string, const TLocations extends readonly DirectiveLocation[]>(name: TDirectiveName, locations: TLocations) => (<TArgs extends Record<string, unknown>>(args: TArgs) => DirectiveRef<{
|
|
954
|
+
directiveName: TDirectiveName;
|
|
955
|
+
locations: TLocations;
|
|
956
|
+
}>);
|
|
957
|
+
/**
|
|
958
|
+
* Type for directive argument specifiers.
|
|
959
|
+
* Maps argument names to their type information.
|
|
960
|
+
*/
|
|
961
|
+
type DirectiveArgumentSpecifiers = {
|
|
962
|
+
readonly [argName: string]: DirectiveArgumentSpecifier;
|
|
963
|
+
};
|
|
964
|
+
/**
|
|
965
|
+
* Creates a typed directive method with argument type specifiers.
|
|
966
|
+
* Enables enum value output in directive arguments.
|
|
967
|
+
*
|
|
968
|
+
* @param name - The directive name (without @)
|
|
969
|
+
* @param locations - Valid locations where the directive can be applied
|
|
970
|
+
* @param argSpecs - Type specifiers for directive arguments
|
|
971
|
+
* @returns A function that creates DirectiveRef instances with argument type info
|
|
972
|
+
*
|
|
973
|
+
* @example
|
|
974
|
+
* ```typescript
|
|
975
|
+
* const authMethod = createTypedDirectiveMethod(
|
|
976
|
+
* "auth",
|
|
977
|
+
* ["FIELD"] as const,
|
|
978
|
+
* { role: { kind: "enum", name: "Role", modifier: "!" } }
|
|
979
|
+
* );
|
|
980
|
+
* const authDirective = authMethod({ role: "ADMIN" });
|
|
981
|
+
* ```
|
|
982
|
+
*/
|
|
983
|
+
declare const createTypedDirectiveMethod: <TDirectiveName extends string, const TLocations extends readonly DirectiveLocation[], const TArgSpecs extends DirectiveArgumentSpecifiers>(name: TDirectiveName, locations: TLocations, argSpecs: TArgSpecs) => (<TArgs extends Record<string, unknown>>(args: TArgs) => DirectiveRef<{
|
|
984
|
+
directiveName: TDirectiveName;
|
|
985
|
+
locations: TLocations;
|
|
986
|
+
}>);
|
|
987
|
+
/**
|
|
988
|
+
* Creates the standard GraphQL directives (@skip, @include).
|
|
989
|
+
* These are always available regardless of schema definition.
|
|
990
|
+
*
|
|
991
|
+
* @returns Object containing skip and include directive methods
|
|
992
|
+
*
|
|
993
|
+
* @example
|
|
994
|
+
* ```typescript
|
|
995
|
+
* const $dir = createStandardDirectives();
|
|
996
|
+
* const skipDirective = $dir.skip({ if: true });
|
|
997
|
+
* ```
|
|
998
|
+
*/
|
|
999
|
+
declare const createStandardDirectives: () => StandardDirectives;
|
|
1000
|
+
/**
|
|
1001
|
+
* Type for any directive method (type-erased).
|
|
1002
|
+
*/
|
|
1003
|
+
type AnyDirectiveMethod = (args: any) => AnyDirectiveRef;
|
|
1004
|
+
/**
|
|
1005
|
+
* Type for the directive builder that includes standard directives
|
|
1006
|
+
* and can be extended with schema-specific directives.
|
|
1007
|
+
*/
|
|
1008
|
+
type DirectiveBuilder<TCustomDirectives extends Record<string, AnyDirectiveMethod> = {}> = StandardDirectives & TCustomDirectives;
|
|
1009
|
+
/**
|
|
1010
|
+
* Creates a directive builder with standard directives and optional custom directives.
|
|
1011
|
+
*
|
|
1012
|
+
* @param customDirectives - Additional directive methods from schema (generated by codegen)
|
|
1013
|
+
* @returns Combined directive builder with all available directives
|
|
1014
|
+
*
|
|
1015
|
+
* @internal Used by codegen to create schema-specific directive builders
|
|
1016
|
+
*/
|
|
1017
|
+
declare const createDirectiveBuilder: <TCustomDirectives extends Record<string, AnyDirectiveMethod> = {}>(customDirectives?: TCustomDirectives) => DirectiveBuilder<TCustomDirectives>;
|
|
1018
|
+
/**
|
|
1019
|
+
* Type guard to check if a value is a DirectiveRef.
|
|
1020
|
+
*
|
|
1021
|
+
* @param value - Value to check
|
|
1022
|
+
* @returns True if value is a DirectiveRef instance
|
|
1023
|
+
*/
|
|
1024
|
+
declare const isDirectiveRef: (value: unknown) => value is AnyDirectiveRef;
|
|
1025
|
+
//#endregion
|
|
1026
|
+
//#region packages/core/src/composer/extend.d.ts
|
|
1027
|
+
/**
|
|
1028
|
+
* Options for extending a compat spec into a full operation.
|
|
1029
|
+
*/
|
|
1030
|
+
type ExtendOptions<TSchema$1 extends AnyGraphqlSchema, TVarDefinitions$1 extends InputTypeSpecifiers, TOperationMetadata, TAggregatedFragmentMetadata, TSchemaLevel> = {
|
|
1031
|
+
/** Optional metadata builder */
|
|
1032
|
+
metadata?: MetadataBuilder<DeclaredVariables<TSchema$1, TVarDefinitions$1>, TOperationMetadata, TAggregatedFragmentMetadata, TSchemaLevel>;
|
|
1033
|
+
/** Optional document transformer */
|
|
1034
|
+
transformDocument?: OperationDocumentTransformer<TOperationMetadata>;
|
|
1035
|
+
};
|
|
1036
|
+
/**
|
|
1037
|
+
* Creates a factory for extending compat specs into full operations.
|
|
1038
|
+
*
|
|
1039
|
+
* The extend function takes a compat spec (created by `query.compat()`) and
|
|
1040
|
+
* optional metadata/transformDocument options, then creates a full Operation.
|
|
1041
|
+
*
|
|
1042
|
+
* @param schema - The GraphQL schema definition
|
|
1043
|
+
* @param adapter - Optional metadata adapter for custom metadata handling
|
|
1044
|
+
* @param transformDocument - Optional document transformer
|
|
1045
|
+
* @returns Extend composer function
|
|
1046
|
+
*
|
|
1047
|
+
* @internal Used by `createGqlElementComposer`
|
|
1048
|
+
*/
|
|
1049
|
+
declare const createExtendComposer: <TSchema$1 extends AnyGraphqlSchema, TAdapter extends AnyMetadataAdapter = DefaultMetadataAdapter>(schema: NoInfer<TSchema$1>, adapter?: TAdapter, transformDocument?: DocumentTransformer<ExtractAdapterTypes<TAdapter>["schemaLevel"], ExtractAdapterTypes<TAdapter>["aggregatedFragmentMetadata"]>) => <TOperationType$1 extends OperationType, TOperationName$1 extends string, TVarDefinitions$1 extends InputTypeSpecifiers, TFields$1 extends AnyFields, TOperationMetadata = unknown>(compat: GqlDefine<CompatSpec<TSchema$1, TOperationType$1, TOperationName$1, TVarDefinitions$1, TFields$1>>, options?: ExtendOptions<TSchema$1, TVarDefinitions$1, TOperationMetadata, ExtractAdapterTypes<TAdapter>["aggregatedFragmentMetadata"], ExtractAdapterTypes<TAdapter>["schemaLevel"]>) => Operation<TOperationType$1, TOperationName$1, (keyof TVarDefinitions$1 & string)[], ConstAssignableInput<TSchema$1, TVarDefinitions$1>, TFields$1, InferFields<TSchema$1, TFields$1>>;
|
|
1050
|
+
//#endregion
|
|
878
1051
|
//#region packages/core/src/composer/fields-builder.d.ts
|
|
879
1052
|
/**
|
|
880
1053
|
* Creates field selection factories for a given object type.
|
|
@@ -888,7 +1061,7 @@ declare class Operation<TOperationType extends OperationType, TOperationName ext
|
|
|
888
1061
|
*
|
|
889
1062
|
* @internal Used by operation and fragment composers
|
|
890
1063
|
*/
|
|
891
|
-
declare const createFieldFactories: <TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"] & string>(schema: TSchema, typeName: TTypeName$1) => FieldSelectionFactories<TSchema, TTypeName$1>;
|
|
1064
|
+
declare const createFieldFactories: <TSchema$1 extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema$1["object"] & string>(schema: TSchema$1, typeName: TTypeName$1) => FieldSelectionFactories<TSchema$1, TTypeName$1>;
|
|
892
1065
|
//#endregion
|
|
893
1066
|
//#region packages/core/src/composer/input.d.ts
|
|
894
1067
|
/**
|
|
@@ -902,7 +1075,7 @@ declare const createFieldFactories: <TSchema extends AnyGraphqlSchema, TTypeName
|
|
|
902
1075
|
*
|
|
903
1076
|
* @internal
|
|
904
1077
|
*/
|
|
905
|
-
declare const createVarAssignments: <TSchema extends AnyGraphqlSchema, TVariableDefinitions extends InputTypeSpecifiers>(definitions: TVariableDefinitions, providedValues: AnyAssignableInput | void) => DeclaredVariables<TSchema, TVariableDefinitions>;
|
|
1078
|
+
declare const createVarAssignments: <TSchema$1 extends AnyGraphqlSchema, TVariableDefinitions extends InputTypeSpecifiers>(definitions: TVariableDefinitions, providedValues: AnyAssignableInput | void) => DeclaredVariables<TSchema$1, TVariableDefinitions>;
|
|
906
1079
|
/**
|
|
907
1080
|
* Creates variable references from variable definitions.
|
|
908
1081
|
*
|
|
@@ -911,7 +1084,7 @@ declare const createVarAssignments: <TSchema extends AnyGraphqlSchema, TVariable
|
|
|
911
1084
|
*
|
|
912
1085
|
* @internal
|
|
913
1086
|
*/
|
|
914
|
-
declare const createVarRefs: <TSchema extends AnyGraphqlSchema, TVarDefinitions extends InputTypeSpecifiers>(definitions: TVarDefinitions) => DeclaredVariables<TSchema, TVarDefinitions>;
|
|
1087
|
+
declare const createVarRefs: <TSchema$1 extends AnyGraphqlSchema, TVarDefinitions$1 extends InputTypeSpecifiers>(definitions: TVarDefinitions$1) => DeclaredVariables<TSchema$1, TVarDefinitions$1>;
|
|
915
1088
|
//#endregion
|
|
916
1089
|
//#region packages/core/src/composer/fragment.d.ts
|
|
917
1090
|
/**
|
|
@@ -920,13 +1093,13 @@ declare const createVarRefs: <TSchema extends AnyGraphqlSchema, TVarDefinitions
|
|
|
920
1093
|
* Used by codegen to generate explicit fragment builder types instead of
|
|
921
1094
|
* expensive mapped types. This improves IDE performance for large schemas.
|
|
922
1095
|
*/
|
|
923
|
-
type FragmentBuilderFor<TSchema extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema["object"] & string, TAdapter extends AnyMetadataAdapter = DefaultMetadataAdapter> = <TFields extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}>(options: {
|
|
1096
|
+
type FragmentBuilderFor<TSchema$1 extends AnyGraphqlSchema, TTypeName$1 extends keyof TSchema$1["object"] & string, TAdapter extends AnyMetadataAdapter = DefaultMetadataAdapter> = <TFields$1 extends AnyFields, TVarDefinitions$1 extends InputTypeSpecifiers = {}>(options: {
|
|
924
1097
|
/** Optional unique key for prebuilt type lookup. */
|
|
925
1098
|
key?: string;
|
|
926
|
-
variables?: TVarDefinitions;
|
|
927
|
-
metadata?: FragmentMetadataBuilder<ReturnType<typeof createVarRefs<TSchema, TVarDefinitions>>, ExtractAdapterTypes<TAdapter>["fragmentMetadata"]>;
|
|
928
|
-
fields: FieldsBuilder<TSchema, TTypeName$1, TVarDefinitions, TFields>;
|
|
929
|
-
}) => ReturnType<typeof Fragment.create<TSchema, TTypeName$1, TVarDefinitions, TFields>>;
|
|
1099
|
+
variables?: TVarDefinitions$1;
|
|
1100
|
+
metadata?: FragmentMetadataBuilder<ReturnType<typeof createVarRefs<TSchema$1, TVarDefinitions$1>>, ExtractAdapterTypes<TAdapter>["fragmentMetadata"]>;
|
|
1101
|
+
fields: FieldsBuilder<TSchema$1, TTypeName$1, TVarDefinitions$1, TFields$1>;
|
|
1102
|
+
}) => ReturnType<typeof Fragment.create<TSchema$1, TTypeName$1, TVarDefinitions$1, TFields$1>>;
|
|
930
1103
|
/**
|
|
931
1104
|
* Creates fragment builder functions for all object types in the schema.
|
|
932
1105
|
*
|
|
@@ -939,14 +1112,14 @@ type FragmentBuilderFor<TSchema extends AnyGraphqlSchema, TTypeName$1 extends ke
|
|
|
939
1112
|
*
|
|
940
1113
|
* @internal Used by `createGqlElementComposer`
|
|
941
1114
|
*/
|
|
942
|
-
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: {
|
|
1115
|
+
declare const createGqlFragmentComposers: <TSchema$1 extends AnyGraphqlSchema, TAdapter extends AnyMetadataAdapter = DefaultMetadataAdapter>(schema: NoInfer<TSchema$1>, _adapter?: TAdapter) => { readonly [TTypeName in keyof TSchema$1["object"]]: TTypeName extends string ? <TFields$1 extends AnyFields, TVarDefinitions$1 extends InputTypeSpecifiers = {}>(options: {
|
|
943
1116
|
key?: string;
|
|
944
|
-
variables?: TVarDefinitions | undefined;
|
|
945
|
-
metadata?: FragmentMetadataBuilder<DeclaredVariables<TSchema, TVarDefinitions>, ExtractAdapterTypes<TAdapter>["fragmentMetadata"]> | undefined;
|
|
946
|
-
fields: FieldsBuilder<TSchema, TTypeName, TVarDefinitions, TFields>;
|
|
947
|
-
}) => Fragment<TTypeName, OptionalArg<AssignableInput<TSchema, TVarDefinitions>>, TFields & {
|
|
1117
|
+
variables?: TVarDefinitions$1 | undefined;
|
|
1118
|
+
metadata?: FragmentMetadataBuilder<DeclaredVariables<TSchema$1, TVarDefinitions$1>, ExtractAdapterTypes<TAdapter>["fragmentMetadata"]> | undefined;
|
|
1119
|
+
fields: FieldsBuilder<TSchema$1, TTypeName, TVarDefinitions$1, TFields$1>;
|
|
1120
|
+
}) => Fragment<TTypeName, OptionalArg<AssignableInput<TSchema$1, TVarDefinitions$1>>, TFields$1 & {
|
|
948
1121
|
[key: symbol]: never;
|
|
949
|
-
}, InferFields<TSchema, TFields> & {
|
|
1122
|
+
}, InferFields<TSchema$1, TFields$1> & {
|
|
950
1123
|
[key: symbol]: never;
|
|
951
1124
|
}> : never };
|
|
952
1125
|
//#endregion
|
|
@@ -1019,7 +1192,7 @@ declare const getVariablePath: <T, U>(varRef: VarRef<AnyVarRefBrand>, selector:
|
|
|
1019
1192
|
/**
|
|
1020
1193
|
* Type for the default value function for a variable.
|
|
1021
1194
|
*/
|
|
1022
|
-
type AssignableDefaultValue<TSchema extends AnyGraphqlSchema, TKind extends InputTypeKind, TName$1 extends string, TModifier extends TypeModifier> = ConstAssignableInputValue<TSchema, {
|
|
1195
|
+
type AssignableDefaultValue<TSchema$1 extends AnyGraphqlSchema, TKind extends InputTypeKind, TName$1 extends string, TModifier extends TypeModifier> = ConstAssignableInputValue<TSchema$1, {
|
|
1023
1196
|
scalar: {
|
|
1024
1197
|
kind: "scalar";
|
|
1025
1198
|
name: TName$1;
|
|
@@ -1062,8 +1235,8 @@ type VarSpecifier<TKind extends InputTypeKind, TTypeName$1 extends string, TModi
|
|
|
1062
1235
|
*
|
|
1063
1236
|
* @deprecated Use createVarMethodFactory instead for proper type inference with nested input objects.
|
|
1064
1237
|
*/
|
|
1065
|
-
declare const createVarMethod: <TKind extends InputTypeKind, TTypeName$1 extends string>(kind: TKind, typeName: TTypeName$1) => <TSchema extends AnyGraphqlSchema, const TModifier extends TypeModifier, const TDefaultFn extends (() => AssignableDefaultValue<TSchema, TKind, TTypeName$1, TModifier>) | null = null, const TDirectives extends AnyConstDirectiveAttachments = {}>(modifier: TModifier, extras?: {
|
|
1066
|
-
default?: TDefaultFn & (() => AssignableDefaultValue<TSchema, TKind, TTypeName$1, TModifier>);
|
|
1238
|
+
declare const createVarMethod: <TKind extends InputTypeKind, TTypeName$1 extends string>(kind: TKind, typeName: TTypeName$1) => <TSchema$1 extends AnyGraphqlSchema, const TModifier extends TypeModifier, const TDefaultFn extends (() => AssignableDefaultValue<TSchema$1, TKind, TTypeName$1, TModifier>) | null = null, const TDirectives extends AnyConstDirectiveAttachments = {}>(modifier: TModifier, extras?: {
|
|
1239
|
+
default?: TDefaultFn & (() => AssignableDefaultValue<TSchema$1, TKind, TTypeName$1, TModifier>);
|
|
1067
1240
|
directives?: TDirectives;
|
|
1068
1241
|
}) => VarSpecifier<TKind, TTypeName$1, TModifier, TDefaultFn, TDirectives>;
|
|
1069
1242
|
/**
|
|
@@ -1079,29 +1252,29 @@ declare const createVarMethod: <TKind extends InputTypeKind, TTypeName$1 extends
|
|
|
1079
1252
|
* } satisfies InputTypeMethods<typeof schema>;
|
|
1080
1253
|
* ```
|
|
1081
1254
|
*/
|
|
1082
|
-
declare const createVarMethodFactory: <TSchema extends AnyGraphqlSchema>() => <TKind extends InputTypeKind, TTypeName$1 extends AllInputTypeNames<TSchema>>(kind: TKind, typeName: TTypeName$1) => InputTypeMethod<TSchema, TKind, TTypeName$1>;
|
|
1255
|
+
declare const createVarMethodFactory: <TSchema$1 extends AnyGraphqlSchema>() => <TKind extends InputTypeKind, TTypeName$1 extends AllInputTypeNames<TSchema$1>>(kind: TKind, typeName: TTypeName$1) => InputTypeMethod<TSchema$1, TKind, TTypeName$1>;
|
|
1083
1256
|
/**
|
|
1084
1257
|
* Type for a single input type method.
|
|
1085
1258
|
*/
|
|
1086
|
-
type InputTypeMethod<TSchema extends AnyGraphqlSchema, TKind extends InputTypeKind, TTypeName$1 extends string> = <const TModifier extends TypeModifier, const TDefaultFn extends (() => AssignableDefaultValue<TSchema, TKind, TTypeName$1, TModifier>) | null = null, const TDirectives extends AnyConstDirectiveAttachments = {}>(modifier: TModifier, extras?: {
|
|
1087
|
-
default?: TDefaultFn & (() => AssignableDefaultValue<TSchema, TKind, TTypeName$1, TModifier>);
|
|
1259
|
+
type InputTypeMethod<TSchema$1 extends AnyGraphqlSchema, TKind extends InputTypeKind, TTypeName$1 extends string> = <const TModifier extends TypeModifier, const TDefaultFn extends (() => AssignableDefaultValue<TSchema$1, TKind, TTypeName$1, TModifier>) | null = null, const TDirectives extends AnyConstDirectiveAttachments = {}>(modifier: TModifier, extras?: {
|
|
1260
|
+
default?: TDefaultFn & (() => AssignableDefaultValue<TSchema$1, TKind, TTypeName$1, TModifier>);
|
|
1088
1261
|
directives?: TDirectives;
|
|
1089
1262
|
}) => VarSpecifier<TKind, TTypeName$1, TModifier, TDefaultFn, TDirectives>;
|
|
1090
1263
|
/**
|
|
1091
1264
|
* Type for all input type methods in a schema.
|
|
1092
1265
|
*/
|
|
1093
|
-
type InputTypeMethods<TSchema extends AnyGraphqlSchema> = { [TName in AllInputTypeNames<TSchema>]: InputTypeMethod<TSchema, InferInputKind<TSchema, TName>, TName> };
|
|
1266
|
+
type InputTypeMethods<TSchema$1 extends AnyGraphqlSchema> = { [TName in AllInputTypeNames<TSchema$1>]: InputTypeMethod<TSchema$1, InferInputKind<TSchema$1, TName>, TName> };
|
|
1094
1267
|
/**
|
|
1095
1268
|
* Type for a wrapped variable method that includes the variable name in the result.
|
|
1096
1269
|
*/
|
|
1097
|
-
type WrappedVarMethod<TVarName extends string, TSchema extends AnyGraphqlSchema, TKind extends InputTypeKind, TTypeName$1 extends string> = <const TModifier extends TypeModifier, const TDefaultFn extends (() => AssignableDefaultValue<TSchema, TKind, TTypeName$1, TModifier>) | null = null, const TDirectives extends AnyConstDirectiveAttachments = {}>(modifier: TModifier, extras?: {
|
|
1098
|
-
default?: TDefaultFn & (() => AssignableDefaultValue<TSchema, TKind, TTypeName$1, TModifier>);
|
|
1270
|
+
type WrappedVarMethod<TVarName extends string, TSchema$1 extends AnyGraphqlSchema, TKind extends InputTypeKind, TTypeName$1 extends string> = <const TModifier extends TypeModifier, const TDefaultFn extends (() => AssignableDefaultValue<TSchema$1, TKind, TTypeName$1, TModifier>) | null = null, const TDirectives extends AnyConstDirectiveAttachments = {}>(modifier: TModifier, extras?: {
|
|
1271
|
+
default?: TDefaultFn & (() => AssignableDefaultValue<TSchema$1, TKind, TTypeName$1, TModifier>);
|
|
1099
1272
|
directives?: TDirectives;
|
|
1100
1273
|
}) => { [K in TVarName]: VarSpecifier<TKind, TTypeName$1, TModifier, TDefaultFn, TDirectives> };
|
|
1101
1274
|
/**
|
|
1102
1275
|
* Type for the variable builder methods for a specific variable name.
|
|
1103
1276
|
*/
|
|
1104
|
-
type VarBuilderMethods<TVarName extends string, TSchema extends AnyGraphqlSchema> = { [TName in AllInputTypeNames<TSchema>]: WrappedVarMethod<TVarName, TSchema, InferInputKind<TSchema, TName>, TName> };
|
|
1277
|
+
type VarBuilderMethods<TVarName extends string, TSchema$1 extends AnyGraphqlSchema> = { [TName in AllInputTypeNames<TSchema$1>]: WrappedVarMethod<TVarName, TSchema$1, InferInputKind<TSchema$1, TName>, TName> };
|
|
1105
1278
|
/**
|
|
1106
1279
|
* Variable builder function type.
|
|
1107
1280
|
*
|
|
@@ -1117,29 +1290,29 @@ type VarBuilderMethods<TVarName extends string, TSchema extends AnyGraphqlSchema
|
|
|
1117
1290
|
* $var.getValueAt($.userId, p => p)
|
|
1118
1291
|
* ```
|
|
1119
1292
|
*/
|
|
1120
|
-
type VarBuilder<TSchema extends AnyGraphqlSchema> = {
|
|
1121
|
-
<TVarName extends string>(varName: TVarName): VarBuilderMethods<TVarName, TSchema>;
|
|
1293
|
+
type VarBuilder<TSchema$1 extends AnyGraphqlSchema> = {
|
|
1294
|
+
<TVarName extends string>(varName: TVarName): VarBuilderMethods<TVarName, TSchema$1>;
|
|
1122
1295
|
getName: typeof getVarRefName;
|
|
1123
1296
|
getValue: typeof getVarRefValue;
|
|
1124
|
-
getNameAt: SchemaAwareGetNameAt<TSchema>;
|
|
1125
|
-
getValueAt: SchemaAwareGetValueAt<TSchema>;
|
|
1297
|
+
getNameAt: SchemaAwareGetNameAt<TSchema$1>;
|
|
1298
|
+
getValueAt: SchemaAwareGetValueAt<TSchema$1>;
|
|
1126
1299
|
getVariablePath: typeof getVariablePath;
|
|
1127
1300
|
};
|
|
1128
1301
|
/**
|
|
1129
1302
|
* Resolves the TypeScript type from VarRef meta using schema.
|
|
1130
1303
|
* This is used for getValueAt/getNameAt with type structure resolution.
|
|
1131
1304
|
*/
|
|
1132
|
-
type ResolveTypeFromMeta<TSchema extends AnyGraphqlSchema, TMeta extends AnyVarRefBrand> = TypeProfile.Type<ResolveInputProfileFromMeta<TSchema, TMeta["typeName"], TMeta["kind"], "!">>;
|
|
1305
|
+
type ResolveTypeFromMeta<TSchema$1 extends AnyGraphqlSchema, TMeta extends AnyVarRefBrand> = TypeProfile.Type<ResolveInputProfileFromMeta<TSchema$1, TMeta["typeName"], TMeta["kind"], "!">>;
|
|
1133
1306
|
/**
|
|
1134
1307
|
* Schema-aware getValueAt type.
|
|
1135
1308
|
* Resolves type structure from schema using typeName + kind.
|
|
1136
1309
|
*/
|
|
1137
|
-
type SchemaAwareGetValueAt<TSchema extends AnyGraphqlSchema> = <T extends AnyVarRefBrand, U>(varRef: VarRef<T>, selector: (proxy: SelectableProxy<ResolveTypeFromMeta<TSchema, T>>) => U) => U;
|
|
1310
|
+
type SchemaAwareGetValueAt<TSchema$1 extends AnyGraphqlSchema> = <T extends AnyVarRefBrand, U>(varRef: VarRef<T>, selector: (proxy: SelectableProxy<ResolveTypeFromMeta<TSchema$1, T>>) => U) => U;
|
|
1138
1311
|
/**
|
|
1139
1312
|
* Schema-aware getNameAt type.
|
|
1140
1313
|
* Resolves type structure from schema using typeName + kind.
|
|
1141
1314
|
*/
|
|
1142
|
-
type SchemaAwareGetNameAt<TSchema extends AnyGraphqlSchema> = <T extends AnyVarRefBrand, U>(varRef: VarRef<T>, selector: (proxy: ResolveTypeFromMeta<TSchema, T>) => U) => string;
|
|
1315
|
+
type SchemaAwareGetNameAt<TSchema$1 extends AnyGraphqlSchema> = <T extends AnyVarRefBrand, U>(varRef: VarRef<T>, selector: (proxy: ResolveTypeFromMeta<TSchema$1, T>) => U) => string;
|
|
1143
1316
|
/**
|
|
1144
1317
|
* Creates a variable builder using injected input type methods.
|
|
1145
1318
|
*
|
|
@@ -1152,7 +1325,7 @@ type SchemaAwareGetNameAt<TSchema extends AnyGraphqlSchema> = <T extends AnyVarR
|
|
|
1152
1325
|
*
|
|
1153
1326
|
* @internal Used by `createGqlElementComposer`
|
|
1154
1327
|
*/
|
|
1155
|
-
declare const createVarBuilder: <TSchema extends AnyGraphqlSchema>(inputTypeMethods: InputTypeMethods<TSchema>) => VarBuilder<TSchema>;
|
|
1328
|
+
declare const createVarBuilder: <TSchema$1 extends AnyGraphqlSchema>(inputTypeMethods: InputTypeMethods<TSchema$1>) => VarBuilder<TSchema$1>;
|
|
1156
1329
|
//#endregion
|
|
1157
1330
|
//#region packages/core/src/composer/gql-composer.d.ts
|
|
1158
1331
|
/**
|
|
@@ -1161,7 +1334,7 @@ declare const createVarBuilder: <TSchema extends AnyGraphqlSchema>(inputTypeMeth
|
|
|
1161
1334
|
* The composer provides a context with builders for fragments, operations,
|
|
1162
1335
|
* variables, and colocation helpers.
|
|
1163
1336
|
*/
|
|
1164
|
-
type GqlElementComposer<TContext> = <TResult extends AnyFragment | AnyOperation>(composeElement: (context: TContext) => TResult) => TResult;
|
|
1337
|
+
type GqlElementComposer<TContext> = <TResult extends AnyFragment | AnyOperation | AnyGqlDefine>(composeElement: (context: TContext) => TResult) => TResult;
|
|
1165
1338
|
/**
|
|
1166
1339
|
* GQL element composer with schema access.
|
|
1167
1340
|
*
|
|
@@ -1171,12 +1344,12 @@ type GqlElementComposer<TContext> = <TResult extends AnyFragment | AnyOperation>
|
|
|
1171
1344
|
* - Runtime schema introspection
|
|
1172
1345
|
* - Debugging and tooling
|
|
1173
1346
|
*/
|
|
1174
|
-
type GqlElementComposerWithSchema<TContext, TSchema extends AnyGraphqlSchema> = GqlElementComposer<TContext> & {
|
|
1347
|
+
type GqlElementComposerWithSchema<TContext, TSchema$1 extends AnyGraphqlSchema> = GqlElementComposer<TContext> & {
|
|
1175
1348
|
/**
|
|
1176
1349
|
* The GraphQL schema definition used by this composer.
|
|
1177
1350
|
* Provides runtime access to schema types, operations, and metadata.
|
|
1178
1351
|
*/
|
|
1179
|
-
readonly $schema: TSchema;
|
|
1352
|
+
readonly $schema: TSchema$1;
|
|
1180
1353
|
};
|
|
1181
1354
|
/**
|
|
1182
1355
|
* Extracts the helpers type from an adapter.
|
|
@@ -1195,15 +1368,15 @@ type ExtractMetadataAdapter<TAdapter extends AnyAdapter> = TAdapter extends {
|
|
|
1195
1368
|
* Default fragment builders type computed from schema.
|
|
1196
1369
|
* This is the mapped type that's expensive to compute for large schemas.
|
|
1197
1370
|
*/
|
|
1198
|
-
type FragmentBuildersAll<TSchema extends AnyGraphqlSchema, TAdapter extends AnyMetadataAdapter = DefaultMetadataAdapter> = { readonly [TTypeName in keyof TSchema["object"]]: TTypeName extends string ? FragmentBuilderFor<TSchema, TTypeName, TAdapter> : never };
|
|
1371
|
+
type FragmentBuildersAll<TSchema$1 extends AnyGraphqlSchema, TAdapter extends AnyMetadataAdapter = DefaultMetadataAdapter> = { readonly [TTypeName in keyof TSchema$1["object"]]: TTypeName extends string ? FragmentBuilderFor<TSchema$1, TTypeName, TAdapter> : never };
|
|
1199
1372
|
/**
|
|
1200
1373
|
* Configuration options for `createGqlElementComposer`.
|
|
1201
1374
|
*/
|
|
1202
|
-
type GqlElementComposerOptions<TSchema extends AnyGraphqlSchema, TDirectiveMethods extends StandardDirectives, TAdapter extends AnyAdapter = DefaultAdapter> = {
|
|
1375
|
+
type GqlElementComposerOptions<TSchema$1 extends AnyGraphqlSchema, TDirectiveMethods extends StandardDirectives, TAdapter extends AnyAdapter = DefaultAdapter> = {
|
|
1203
1376
|
/** Optional adapter for custom helpers and metadata handling. */
|
|
1204
1377
|
adapter?: TAdapter;
|
|
1205
1378
|
/** Methods for building variable type specifiers. */
|
|
1206
|
-
inputTypeMethods: InputTypeMethods<TSchema>;
|
|
1379
|
+
inputTypeMethods: InputTypeMethods<TSchema$1>;
|
|
1207
1380
|
/** Optional custom directive methods (including schema-defined directives). */
|
|
1208
1381
|
directiveMethods?: TDirectiveMethods;
|
|
1209
1382
|
};
|
|
@@ -1240,39 +1413,44 @@ type GqlElementComposerOptions<TSchema extends AnyGraphqlSchema, TDirectiveMetho
|
|
|
1240
1413
|
* );
|
|
1241
1414
|
* ```
|
|
1242
1415
|
*/
|
|
1243
|
-
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<{
|
|
1416
|
+
declare const createGqlElementComposer: <TSchema$1 extends AnyGraphqlSchema, TFragmentBuilders, TDirectiveMethods extends StandardDirectives, TAdapter extends AnyAdapter = DefaultAdapter>(schema: NoInfer<TSchema$1>, options: GqlElementComposerOptions<NoInfer<TSchema$1>, NoInfer<TDirectiveMethods>, NoInfer<TAdapter>>) => GqlElementComposerWithSchema<{
|
|
1244
1417
|
fragment: TFragmentBuilders;
|
|
1245
1418
|
query: {
|
|
1246
|
-
operation: <TOperationName extends string, TFields extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}, TOperationMetadata = unknown>(options: {
|
|
1247
|
-
name: TOperationName;
|
|
1248
|
-
variables?: TVarDefinitions | undefined;
|
|
1249
|
-
metadata?: MetadataBuilder<DeclaredVariables<TSchema, TVarDefinitions>, TOperationMetadata, ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["aggregatedFragmentMetadata"], ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["schemaLevel"]> | undefined;
|
|
1250
|
-
fields: FieldsBuilder<TSchema, TSchema["operations"]["query"] & keyof TSchema["object"] & string, TVarDefinitions, TFields>;
|
|
1419
|
+
operation: <TOperationName$1 extends string, TFields$1 extends AnyFields, TVarDefinitions$1 extends InputTypeSpecifiers = {}, TOperationMetadata = unknown>(options: {
|
|
1420
|
+
name: TOperationName$1;
|
|
1421
|
+
variables?: TVarDefinitions$1 | undefined;
|
|
1422
|
+
metadata?: MetadataBuilder<DeclaredVariables<TSchema$1, TVarDefinitions$1>, TOperationMetadata, ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["aggregatedFragmentMetadata"], ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["schemaLevel"]> | undefined;
|
|
1423
|
+
fields: FieldsBuilder<TSchema$1, TSchema$1["operations"]["query"] & keyof TSchema$1["object"] & string, TVarDefinitions$1, TFields$1>;
|
|
1251
1424
|
transformDocument?: OperationDocumentTransformer<TOperationMetadata> | undefined;
|
|
1252
|
-
}) => Operation<"query", TOperationName, (keyof TVarDefinitions & string)[], ConstAssignableInput<TSchema, TVarDefinitions>, TFields, InferFields<TSchema, TFields>>;
|
|
1425
|
+
}) => Operation<"query", TOperationName$1, (keyof TVarDefinitions$1 & string)[], ConstAssignableInput<TSchema$1, TVarDefinitions$1>, TFields$1, InferFields<TSchema$1, TFields$1>>;
|
|
1426
|
+
compat: <TOperationName$1 extends string, TFields_1 extends AnyFields, TVarDefinitions_1 extends InputTypeSpecifiers = {}>(options: CompatOptions<TSchema$1, TSchema$1["operations"]["query"] & keyof TSchema$1["object"] & string, TOperationName$1, TVarDefinitions_1, TFields_1>) => GqlDefine<CompatSpec<TSchema$1, "query", TOperationName$1, TVarDefinitions_1, TFields_1>>;
|
|
1253
1427
|
};
|
|
1254
1428
|
mutation: {
|
|
1255
|
-
operation: <TOperationName extends string, TFields extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}, TOperationMetadata = unknown>(options: {
|
|
1256
|
-
name: TOperationName;
|
|
1257
|
-
variables?: TVarDefinitions | undefined;
|
|
1258
|
-
metadata?: MetadataBuilder<DeclaredVariables<TSchema, TVarDefinitions>, TOperationMetadata, ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["aggregatedFragmentMetadata"], ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["schemaLevel"]> | undefined;
|
|
1259
|
-
fields: FieldsBuilder<TSchema, TSchema["operations"]["mutation"] & keyof TSchema["object"] & string, TVarDefinitions, TFields>;
|
|
1429
|
+
operation: <TOperationName$1 extends string, TFields$1 extends AnyFields, TVarDefinitions$1 extends InputTypeSpecifiers = {}, TOperationMetadata = unknown>(options: {
|
|
1430
|
+
name: TOperationName$1;
|
|
1431
|
+
variables?: TVarDefinitions$1 | undefined;
|
|
1432
|
+
metadata?: MetadataBuilder<DeclaredVariables<TSchema$1, TVarDefinitions$1>, TOperationMetadata, ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["aggregatedFragmentMetadata"], ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["schemaLevel"]> | undefined;
|
|
1433
|
+
fields: FieldsBuilder<TSchema$1, TSchema$1["operations"]["mutation"] & keyof TSchema$1["object"] & string, TVarDefinitions$1, TFields$1>;
|
|
1260
1434
|
transformDocument?: OperationDocumentTransformer<TOperationMetadata> | undefined;
|
|
1261
|
-
}) => Operation<"mutation", TOperationName, (keyof TVarDefinitions & string)[], ConstAssignableInput<TSchema, TVarDefinitions>, TFields, InferFields<TSchema, TFields>>;
|
|
1435
|
+
}) => Operation<"mutation", TOperationName$1, (keyof TVarDefinitions$1 & string)[], ConstAssignableInput<TSchema$1, TVarDefinitions$1>, TFields$1, InferFields<TSchema$1, TFields$1>>;
|
|
1436
|
+
compat: <TOperationName$1 extends string, TFields_1 extends AnyFields, TVarDefinitions_1 extends InputTypeSpecifiers = {}>(options: CompatOptions<TSchema$1, TSchema$1["operations"]["mutation"] & keyof TSchema$1["object"] & string, TOperationName$1, TVarDefinitions_1, TFields_1>) => GqlDefine<CompatSpec<TSchema$1, "mutation", TOperationName$1, TVarDefinitions_1, TFields_1>>;
|
|
1262
1437
|
};
|
|
1263
1438
|
subscription: {
|
|
1264
|
-
operation: <TOperationName extends string, TFields extends AnyFields, TVarDefinitions extends InputTypeSpecifiers = {}, TOperationMetadata = unknown>(options: {
|
|
1265
|
-
name: TOperationName;
|
|
1266
|
-
variables?: TVarDefinitions | undefined;
|
|
1267
|
-
metadata?: MetadataBuilder<DeclaredVariables<TSchema, TVarDefinitions>, TOperationMetadata, ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["aggregatedFragmentMetadata"], ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["schemaLevel"]> | undefined;
|
|
1268
|
-
fields: FieldsBuilder<TSchema, TSchema["operations"]["subscription"] & keyof TSchema["object"] & string, TVarDefinitions, TFields>;
|
|
1439
|
+
operation: <TOperationName$1 extends string, TFields$1 extends AnyFields, TVarDefinitions$1 extends InputTypeSpecifiers = {}, TOperationMetadata = unknown>(options: {
|
|
1440
|
+
name: TOperationName$1;
|
|
1441
|
+
variables?: TVarDefinitions$1 | undefined;
|
|
1442
|
+
metadata?: MetadataBuilder<DeclaredVariables<TSchema$1, TVarDefinitions$1>, TOperationMetadata, ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["aggregatedFragmentMetadata"], ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["schemaLevel"]> | undefined;
|
|
1443
|
+
fields: FieldsBuilder<TSchema$1, TSchema$1["operations"]["subscription"] & keyof TSchema$1["object"] & string, TVarDefinitions$1, TFields$1>;
|
|
1269
1444
|
transformDocument?: OperationDocumentTransformer<TOperationMetadata> | undefined;
|
|
1270
|
-
}) => Operation<"subscription", TOperationName, (keyof TVarDefinitions & string)[], ConstAssignableInput<TSchema, TVarDefinitions>, TFields, InferFields<TSchema, TFields>>;
|
|
1445
|
+
}) => Operation<"subscription", TOperationName$1, (keyof TVarDefinitions$1 & string)[], ConstAssignableInput<TSchema$1, TVarDefinitions$1>, TFields$1, InferFields<TSchema$1, TFields$1>>;
|
|
1446
|
+
compat: <TOperationName$1 extends string, TFields_1 extends AnyFields, TVarDefinitions_1 extends InputTypeSpecifiers = {}>(options: CompatOptions<TSchema$1, TSchema$1["operations"]["subscription"] & keyof TSchema$1["object"] & string, TOperationName$1, TVarDefinitions_1, TFields_1>) => GqlDefine<CompatSpec<TSchema$1, "subscription", TOperationName$1, TVarDefinitions_1, TFields_1>>;
|
|
1271
1447
|
};
|
|
1272
|
-
$
|
|
1448
|
+
define: <TValue$1>(factory: () => TValue$1 | Promise<TValue$1>) => GqlDefine<TValue$1>;
|
|
1449
|
+
extend: <TOperationType$1 extends OperationType, TOperationName$1 extends string, TVarDefinitions_2 extends InputTypeSpecifiers, TFields_2 extends AnyFields, TOperationMetadata_1 = unknown>(compat: GqlDefine<CompatSpec<TSchema$1, TOperationType$1, TOperationName$1, TVarDefinitions_2, TFields_2>>, options?: ExtendOptions<TSchema$1, TVarDefinitions_2, TOperationMetadata_1, ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["aggregatedFragmentMetadata"], ExtractAdapterTypes<ExtractMetadataAdapter<TAdapter>>["schemaLevel"]> | undefined) => Operation<TOperationType$1, TOperationName$1, (keyof TVarDefinitions_2 & string)[], ConstAssignableInput<TSchema$1, TVarDefinitions_2>, TFields_2, InferFields<TSchema$1, TFields_2>>;
|
|
1450
|
+
$var: VarBuilder<TSchema$1>;
|
|
1273
1451
|
$dir: TDirectiveMethods;
|
|
1274
1452
|
$colocate: <TEntries extends ColocatedEntries>(entries: TEntries) => ColocatedFields<TEntries>;
|
|
1275
|
-
} & ExtractHelpers<TAdapter>, TSchema>;
|
|
1453
|
+
} & ExtractHelpers<TAdapter>, TSchema$1>;
|
|
1276
1454
|
/**
|
|
1277
1455
|
* Abstract Context type for prebuilt composers.
|
|
1278
1456
|
*
|
|
@@ -1286,13 +1464,18 @@ type AnyGqlContext = {
|
|
|
1286
1464
|
readonly fragment: Record<string, unknown>;
|
|
1287
1465
|
readonly query: {
|
|
1288
1466
|
operation: (...args: unknown[]) => AnyOperation;
|
|
1467
|
+
compat: (...args: unknown[]) => AnyGqlDefine;
|
|
1289
1468
|
};
|
|
1290
1469
|
readonly mutation: {
|
|
1291
1470
|
operation: (...args: unknown[]) => AnyOperation;
|
|
1471
|
+
compat: (...args: unknown[]) => AnyGqlDefine;
|
|
1292
1472
|
};
|
|
1293
1473
|
readonly subscription: {
|
|
1294
1474
|
operation: (...args: unknown[]) => AnyOperation;
|
|
1475
|
+
compat: (...args: unknown[]) => AnyGqlDefine;
|
|
1295
1476
|
};
|
|
1477
|
+
readonly define: <TValue$1>(factory: () => TValue$1 | Promise<TValue$1>) => GqlDefine<TValue$1>;
|
|
1478
|
+
readonly extend: (...args: unknown[]) => AnyOperation;
|
|
1296
1479
|
readonly $var: unknown;
|
|
1297
1480
|
readonly $dir: StandardDirectives;
|
|
1298
1481
|
readonly $colocate: unknown;
|
|
@@ -1316,13 +1499,60 @@ type AnyGqlContext = {
|
|
|
1316
1499
|
*
|
|
1317
1500
|
* @internal Used by `createGqlElementComposer`
|
|
1318
1501
|
*/
|
|
1319
|
-
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: {
|
|
1320
|
-
name: TOperationName;
|
|
1321
|
-
variables?: TVarDefinitions;
|
|
1322
|
-
metadata?: MetadataBuilder<ReturnType<typeof createVarRefs<TSchema, TVarDefinitions>>, TOperationMetadata, ExtractAdapterTypes<TAdapter>["aggregatedFragmentMetadata"], ExtractAdapterTypes<TAdapter>["schemaLevel"]>;
|
|
1323
|
-
fields: FieldsBuilder<TSchema, TSchema["operations"][TOperationType] & keyof TSchema["object"] & string, TVarDefinitions, TFields>;
|
|
1502
|
+
declare const createOperationComposerFactory: <TSchema$1 extends AnyGraphqlSchema, TAdapter extends AnyMetadataAdapter = DefaultMetadataAdapter>(schema: NoInfer<TSchema$1>, adapter?: TAdapter, transformDocument?: DocumentTransformer<ExtractAdapterTypes<TAdapter>["schemaLevel"], ExtractAdapterTypes<TAdapter>["aggregatedFragmentMetadata"]>) => <TOperationType$1 extends OperationType>(operationType: TOperationType$1) => <TOperationName$1 extends string, TFields$1 extends AnyFields, TVarDefinitions$1 extends InputTypeSpecifiers = {}, TOperationMetadata = unknown>(options: {
|
|
1503
|
+
name: TOperationName$1;
|
|
1504
|
+
variables?: TVarDefinitions$1;
|
|
1505
|
+
metadata?: MetadataBuilder<ReturnType<typeof createVarRefs<TSchema$1, TVarDefinitions$1>>, TOperationMetadata, ExtractAdapterTypes<TAdapter>["aggregatedFragmentMetadata"], ExtractAdapterTypes<TAdapter>["schemaLevel"]>;
|
|
1506
|
+
fields: FieldsBuilder<TSchema$1, TSchema$1["operations"][TOperationType$1] & keyof TSchema$1["object"] & string, TVarDefinitions$1, TFields$1>;
|
|
1324
1507
|
transformDocument?: OperationDocumentTransformer<TOperationMetadata>;
|
|
1325
|
-
}) => Operation<TOperationType, TOperationName, (keyof TVarDefinitions & string)[], ConstAssignableInput<TSchema, TVarDefinitions>, TFields, InferFields<TSchema, TFields>>;
|
|
1508
|
+
}) => Operation<TOperationType$1, TOperationName$1, (keyof TVarDefinitions$1 & string)[], ConstAssignableInput<TSchema$1, TVarDefinitions$1>, TFields$1, InferFields<TSchema$1, TFields$1>>;
|
|
1509
|
+
//#endregion
|
|
1510
|
+
//#region packages/core/src/composer/operation-core.d.ts
|
|
1511
|
+
/**
|
|
1512
|
+
* Parameters for building an operation artifact.
|
|
1513
|
+
* Used by both operation and extend composers.
|
|
1514
|
+
*/
|
|
1515
|
+
type OperationCoreParams<TSchema$1 extends AnyGraphqlSchema, TOperationType$1 extends OperationType, TOperationName$1 extends string, TVarDefinitions$1 extends InputTypeSpecifiers, TFields$1 extends AnyFields, TOperationMetadata, TAdapter extends AnyMetadataAdapter> = {
|
|
1516
|
+
readonly schema: TSchema$1;
|
|
1517
|
+
readonly operationType: TOperationType$1;
|
|
1518
|
+
readonly operationTypeName: TSchema$1["operations"][TOperationType$1] & keyof TSchema$1["object"] & string;
|
|
1519
|
+
readonly operationName: TOperationName$1;
|
|
1520
|
+
readonly variables: TVarDefinitions$1;
|
|
1521
|
+
readonly fieldsFactory: FieldsBuilder<TSchema$1, TSchema$1["operations"][TOperationType$1] & keyof TSchema$1["object"] & string, TVarDefinitions$1, TFields$1>;
|
|
1522
|
+
readonly adapter: TAdapter;
|
|
1523
|
+
readonly metadata?: MetadataBuilder<DeclaredVariables<TSchema$1, TVarDefinitions$1>, TOperationMetadata, ExtractAdapterTypes<TAdapter>["aggregatedFragmentMetadata"], ExtractAdapterTypes<TAdapter>["schemaLevel"]>;
|
|
1524
|
+
readonly transformDocument?: OperationDocumentTransformer<TOperationMetadata>;
|
|
1525
|
+
readonly adapterTransformDocument?: DocumentTransformer<ExtractAdapterTypes<TAdapter>["schemaLevel"], ExtractAdapterTypes<TAdapter>["aggregatedFragmentMetadata"]>;
|
|
1526
|
+
};
|
|
1527
|
+
/**
|
|
1528
|
+
* Result type from buildOperationArtifact.
|
|
1529
|
+
* Matches the artifact shape expected by Operation.create().
|
|
1530
|
+
*/
|
|
1531
|
+
type OperationArtifactResult<TOperationType$1 extends OperationType, TOperationName$1 extends string, TVarDefinitions$1 extends InputTypeSpecifiers, TFields$1 extends AnyFields, TOperationMetadata> = {
|
|
1532
|
+
readonly operationType: TOperationType$1;
|
|
1533
|
+
readonly operationName: TOperationName$1;
|
|
1534
|
+
readonly schemaLabel: string;
|
|
1535
|
+
readonly variableNames: (keyof TVarDefinitions$1 & string)[];
|
|
1536
|
+
readonly documentSource: () => TFields$1;
|
|
1537
|
+
readonly document: ReturnType<typeof buildDocument>;
|
|
1538
|
+
readonly metadata: TOperationMetadata | undefined;
|
|
1539
|
+
};
|
|
1540
|
+
/**
|
|
1541
|
+
* Builds an operation artifact from the provided parameters.
|
|
1542
|
+
*
|
|
1543
|
+
* This function contains the core logic for:
|
|
1544
|
+
* - Creating variable refs and field factories
|
|
1545
|
+
* - Evaluating fields with fragment usage tracking
|
|
1546
|
+
* - Building the document
|
|
1547
|
+
* - Handling metadata (sync and async)
|
|
1548
|
+
* - Applying document transformations
|
|
1549
|
+
*
|
|
1550
|
+
* @param params - Operation building parameters
|
|
1551
|
+
* @returns Operation artifact or Promise of artifact (if async metadata)
|
|
1552
|
+
*
|
|
1553
|
+
* @internal Used by operation.ts and extend.ts
|
|
1554
|
+
*/
|
|
1555
|
+
declare const buildOperationArtifact: <TSchema$1 extends AnyGraphqlSchema, TOperationType$1 extends OperationType, TOperationName$1 extends string, TVarDefinitions$1 extends InputTypeSpecifiers, TFields$1 extends AnyFields, TOperationMetadata, TAdapter extends AnyMetadataAdapter>(params: OperationCoreParams<TSchema$1, TOperationType$1, TOperationName$1, TVarDefinitions$1, TFields$1, TOperationMetadata, TAdapter>) => OperationArtifactResult<TOperationType$1, TOperationName$1, TVarDefinitions$1, TFields$1, TOperationMetadata> | Promise<OperationArtifactResult<TOperationType$1, TOperationName$1, TVarDefinitions$1, TFields$1, TOperationMetadata>>;
|
|
1326
1556
|
//#endregion
|
|
1327
1557
|
//#region packages/core/src/prebuilt/type-calculator.d.ts
|
|
1328
1558
|
/**
|
|
@@ -1555,5 +1785,5 @@ type Hidden<T> = () => T;
|
|
|
1555
1785
|
//#region packages/core/src/utils/wrap-by-key.d.ts
|
|
1556
1786
|
declare function wrapByKey<TName$1 extends string, TValue$1>(name: TName$1, value: TValue$1): { [K in TName$1]: TValue$1 };
|
|
1557
1787
|
//#endregion
|
|
1558
|
-
export {
|
|
1559
|
-
//# sourceMappingURL=index-
|
|
1788
|
+
export { createVarAssignments as $, AttachmentShape as $t, AnyGqlContext as A, DeclaredVariables as An, GqlElementDefinitionFactory as At, SchemaAwareGetNameAt as B, DirectiveArgumentSpecifier as Bn, FieldSelectionFactoryPrimitiveReturn as Bt, getScalarInputType as C, InferFields as Cn, FragmentInferMeta as Ct, OperationCoreParams as D, AnyAssigningInput as Dn, GqlElement as Dt, OperationArtifactResult as E, AnyAssignableInputValue as En, GqlDefine as Et, GqlElementComposerWithSchema as F, ConstAssignableInput as Fn, AnyFieldSelectionFactoryReturn as Ft, createVarBuilder as G, TypeSystemDirectiveLocation as Gn, NestedObjectFieldsBuilder as Gt, VarBuilder as H, DirectiveRef as Hn, FieldSelectionFactoryUnionReturn as Ht, createGqlElementComposer as I, ConstAssignableInputValue as In, FieldSelectionFactories as It, FragmentUsageRecord as J, EmptyObject as Jt, createVarMethod as K, NestedObjectFieldsBuilderTools as Kt, InputTypeMethod as L, GetAssignableType as Ln, FieldSelectionFactory as Lt, FragmentBuildersAll as M, AnyConstDirectiveAttachments as Mn, CompatSpec as Mt, GqlElementComposer as N, AnyConstAssignableInput as Nn, ExtractCompatSpec as Nt, buildOperationArtifact as O, AssignableInput as On, GqlElementAttachment as Ot, GqlElementComposerOptions as P, AnyConstAssignableInputValue as Pn, AnyFieldSelectionFactory as Pt, createGqlFragmentComposers as Q, empty as Qt, InputTypeMethods as R, AnyDirectiveRef as Rn, FieldSelectionFactoryFieldArguments as Rt, getEnumType as S, InferField as Sn, Fragment as St, graphqlTypeToTypeScript as T, AnyAssignableInput as Tn, DefineInferMeta as Tt, VarBuilderMethods as U, DirectiveRefInner as Un, FieldsBuilder as Ut, SchemaAwareGetValueAt as V, DirectiveLocation as Vn, FieldSelectionFactoryReturn as Vt, VarSpecifier as W, ExecutableDirectiveLocation as Wn, FieldsBuilderTools as Wt, withFragmentUsageCollection as X, OptionalArg as Xt, recordFragmentUsage as Y, IfOmittable as Yt, FragmentBuilderFor as Z, SwitchIfOmittable as Zt, calculateFieldType as _, AnyFieldSelection as _n, AnyOperation as _t, HasPrebuiltFragment as a, createColocateHelper as an, DirectiveArgValue as at, generateInputType as b, AnyNestedUnion as bn, OperationInferMeta as bt, PrebuiltFragmentInput as c, Tuple as cn, DirectiveMethod as ct, PrebuiltOperationOutput as d, buildArgumentValue as dn, createDirectiveMethod as dt, AttachmentToProperty as en, createVarRefs as et, PrebuiltTypeRegistry as f, buildConstValueNode as fn, createStandardDirectives as ft, applyTypeModifier as g, AbstractFieldSelection as gn, createCompatComposer as gt, TypeFormatters as h, buildWithTypeModifier as hn, CompatOptions as ht, EmptyPrebuiltTypeRegistry as i, ColocatedFields as in, AnyDirectiveMethod as it, ExtractMetadataAdapter as j, FieldArgumentValue as jn, AnyCompatSpec as jt, createOperationComposerFactory as k, AssignableInputByFieldName as kn, GqlElementContext as kt, PrebuiltFragmentOutput as l, UnionToIntersection as ln, StandardDirectives as lt, GenerateInputObjectTypeOptions as m, buildOperationTypeNode as mn, isDirectiveRef as mt, Hidden as n, ColocateHelper as nn, ExtendOptions as nt, HasPrebuiltOperation as o, StripFunctions as on, DirectiveArgumentSpecifiers as ot, PrebuiltUnknownElement as p, buildDocument as pn, createTypedDirectiveMethod as pt, createVarMethodFactory as q, NestedUnionFieldsBuilder as qt, hidden as r, ColocatedEntries as rn, createExtendComposer as rt, PrebuiltEntryNotFound as s, StripSymbols as sn, DirectiveBuilder as st, wrapByKey as t, AttachmentsTupleToIntersection as tn, createFieldFactories as tt, PrebuiltOperationInput as u, EnumLookup as un, createDirectiveBuilder as ut, calculateFieldsType as v, AnyFields as vn, AnyOperationOf as vt, getScalarOutputType as w, AnyDirectiveAttachments as wn, AnyGqlDefine as wt, generateInputTypeFromSpecifiers as x, FieldSelectionTemplateOf as xn, AnyFragment as xt, generateInputObjectType as y, AnyNestedObject as yn, Operation as yt, ResolveTypeFromMeta as z, AnyDirectiveRefBrand as zn, FieldSelectionFactoryObjectReturn as zt };
|
|
1789
|
+
//# sourceMappingURL=index-CULnRHFI.d.ts.map
|