@gqloom/core 0.12.1 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-CTAAG5j7.js → chunk-Bp6m_JJh.js} +1 -1
- package/dist/context.cjs +9 -9
- package/dist/context.d.cts +5 -6
- package/dist/context.d.ts +5 -6
- package/dist/context.js +1 -1
- package/dist/{index-BxqR3YsC.d.cts → index-DBqGrLn7.d.cts} +313 -297
- package/dist/{index-sGKC4BRu.d.ts → index-DWjUYc0-.d.ts} +314 -297
- package/dist/index.cjs +440 -429
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +409 -399
- package/dist/{context-BxqO4Eg9.js → parse-resolving-fields-BS_BL7I_.js} +67 -62
- package/dist/{context-DshDoxiE.cjs → parse-resolving-fields-BXQG_2Z-.cjs} +71 -60
- package/package.json +1 -1
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as __export } from "./chunk-Bp6m_JJh.js";
|
|
2
|
+
import { GraphQLArgumentConfig, GraphQLFieldConfig, GraphQLFieldConfigArgumentMap, GraphQLFieldExtensions, GraphQLFieldMap, GraphQLInputObjectType, GraphQLInputType, GraphQLInterfaceType, GraphQLInterfaceTypeConfig, GraphQLList, GraphQLNamedType, GraphQLNonNull, GraphQLNullableType, GraphQLObjectType, GraphQLObjectTypeConfig, GraphQLOutputType, GraphQLResolveInfo, GraphQLScalarType, GraphQLSchema, GraphQLSchemaConfig, GraphQLType, GraphQLUnionType } from "graphql";
|
|
2
3
|
|
|
3
|
-
//#region src/utils/types.d.ts
|
|
4
|
-
type MayPromise<T> = T | Promise<T>;
|
|
5
|
-
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
6
|
-
type ValueOf<T extends object> = T[keyof T];
|
|
7
|
-
type OmitInUnion<TUnion, TOmit> = TUnion extends infer T ? T extends TOmit ? never : T : never;
|
|
8
|
-
type RequireKeys<T, TKey extends string | number | symbol> = { [P in keyof T as P extends TKey ? P : never]-?: T[P] } & { [P in keyof T as P extends TKey ? never : P]: T[P] };
|
|
9
|
-
//#endregion
|
|
10
4
|
//#region ../../node_modules/.pnpm/@standard-schema+spec@1.0.0/node_modules/@standard-schema/spec/dist/index.d.ts
|
|
11
5
|
/** The Standard Schema interface. */
|
|
12
6
|
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
@@ -65,12 +59,16 @@ declare namespace StandardSchemaV1 {
|
|
|
65
59
|
export {};
|
|
66
60
|
}
|
|
67
61
|
declare namespace symbols_d_exports {
|
|
68
|
-
export { CONTEXT_MAP_KEY, FIELD_HIDDEN, GET_GRAPHQL_TYPE, IS_RESOLVER, RESOLVER_OPTIONS_KEY, WEAVER_CONFIG };
|
|
62
|
+
export { CONTEXT_MAP_KEY, FIELD_HIDDEN, GET_GRAPHQL_ARGUMENT_CONFIG, GET_GRAPHQL_TYPE, IS_RESOLVER, RESOLVER_OPTIONS_KEY, WEAVER_CONFIG };
|
|
69
63
|
}
|
|
70
64
|
/**
|
|
71
65
|
* The symbol to get GraphQL type for schema
|
|
72
66
|
*/
|
|
73
67
|
declare const GET_GRAPHQL_TYPE: unique symbol;
|
|
68
|
+
/**
|
|
69
|
+
* The symbol to get GraphQL argument config for schema
|
|
70
|
+
*/
|
|
71
|
+
declare const GET_GRAPHQL_ARGUMENT_CONFIG: unique symbol;
|
|
74
72
|
/**
|
|
75
73
|
* The symbol to get and store weaver config
|
|
76
74
|
*/
|
|
@@ -92,45 +90,6 @@ declare const CONTEXT_MAP_KEY: unique symbol;
|
|
|
92
90
|
*/
|
|
93
91
|
declare const FIELD_HIDDEN = false;
|
|
94
92
|
//#endregion
|
|
95
|
-
//#region src/resolver/input.d.ts
|
|
96
|
-
type InferInputI<TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void> = TInput extends void ? void : TInput extends GraphQLSilk ? StandardSchemaV1.InferInput<TInput> : TInput extends Record<string, GraphQLSilk> ? { [K in keyof TInput]: StandardSchemaV1.InferInput<TInput[K]> } : void;
|
|
97
|
-
type InferInputO<TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void> = TInput extends void ? void : TInput extends GraphQLSilk ? StandardSchemaV1.InferOutput<TInput> : TInput extends Record<string, GraphQLSilk> ? { [K in keyof TInput]: StandardSchemaV1.InferOutput<TInput[K]> } : never;
|
|
98
|
-
interface CallableInputParser<TSchema extends GraphQLSilk | Record<string, GraphQLSilk> | void> {
|
|
99
|
-
/**
|
|
100
|
-
* input schema
|
|
101
|
-
*/
|
|
102
|
-
schema: TSchema;
|
|
103
|
-
/**
|
|
104
|
-
* Origin value to parse
|
|
105
|
-
*/
|
|
106
|
-
value: InferInputI<TSchema>;
|
|
107
|
-
/**
|
|
108
|
-
* Parse the input and return the standard result
|
|
109
|
-
*/
|
|
110
|
-
(): Promise<StandardSchemaV1.Result<InferInputO<TSchema>>>;
|
|
111
|
-
/**
|
|
112
|
-
* Result of parsing. Set it to `undefined` then the parser will run again.
|
|
113
|
-
*/
|
|
114
|
-
result: StandardSchemaV1.Result<InferInputO<TSchema>> | undefined;
|
|
115
|
-
/**
|
|
116
|
-
* Parse the input and return the result
|
|
117
|
-
*/
|
|
118
|
-
getResult(): Promise<InferInputO<TSchema>>;
|
|
119
|
-
/**
|
|
120
|
-
* Set the result's value of parsing
|
|
121
|
-
*/
|
|
122
|
-
setResult(value: InferInputO<TSchema>): void;
|
|
123
|
-
/**
|
|
124
|
-
* Clear the result of parsing, the parser will run again to get the result.
|
|
125
|
-
*/
|
|
126
|
-
clearResult(): void;
|
|
127
|
-
}
|
|
128
|
-
declare function createInputParser<TSchema extends GraphQLSilk | Record<string, GraphQLSilk> | void>(schema: TSchema, value: InferInputI<TSchema>): CallableInputParser<TSchema>;
|
|
129
|
-
declare function parseInputValue<TSchema extends GraphQLSilk | Record<string, GraphQLSilk> | void>(inputSchema: TSchema, input: any): MayPromise<StandardSchemaV1.Result<InferInputO<TSchema>>>;
|
|
130
|
-
declare function getStandardValue<T>(result: StandardSchemaV1.Result<T>): T;
|
|
131
|
-
declare function getStandardValue<T>(result?: StandardSchemaV1.Result<T>): T | undefined;
|
|
132
|
-
declare function getStandardValue<T>(result: StandardSchemaV1.Result<T> | null): T | null;
|
|
133
|
-
//#endregion
|
|
134
93
|
//#region src/resolver/resolver-chain-factory.d.ts
|
|
135
94
|
/**
|
|
136
95
|
* Interface for chain factory that provides methods to configure GraphQL field options
|
|
@@ -520,7 +479,11 @@ interface GraphQLSilk<TOutput = any, TInput = any> extends StandardSchemaV1<TInp
|
|
|
520
479
|
/**
|
|
521
480
|
* GraphQL type for schema
|
|
522
481
|
*/
|
|
523
|
-
[GET_GRAPHQL_TYPE]?:
|
|
482
|
+
[GET_GRAPHQL_TYPE]?: MayGetter<GraphQLOutputType>;
|
|
483
|
+
/**
|
|
484
|
+
* GraphQL argument config for schema
|
|
485
|
+
*/
|
|
486
|
+
[GET_GRAPHQL_ARGUMENT_CONFIG]?: MayGetter<Omit<GraphQLArgumentConfig, "type" | "astNode"> | undefined>;
|
|
524
487
|
}
|
|
525
488
|
interface ResolverOptions<TField extends FieldOrOperation = FieldOrOperation> {
|
|
526
489
|
middlewares?: Middleware<TField>[];
|
|
@@ -654,79 +617,269 @@ declare function getFieldOptions({
|
|
|
654
617
|
extensions
|
|
655
618
|
}: GraphQLFieldOptions, extraExtensions?: GraphQLFieldExtensions<any, any, any>): GraphQLFieldOptions;
|
|
656
619
|
//#endregion
|
|
657
|
-
//#region src/
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
620
|
+
//#region src/utils/constants.d.ts
|
|
621
|
+
declare const DERIVED_DEPENDENCIES = "loom.derived-from-dependencies";
|
|
622
|
+
declare const AUTO_ALIASING = "__gqloom_auto_aliasing";
|
|
623
|
+
//#endregion
|
|
624
|
+
//#region src/utils/context.d.ts
|
|
662
625
|
/**
|
|
663
|
-
*
|
|
626
|
+
* Empty Resolver Arguments that only store the memoization
|
|
664
627
|
*/
|
|
665
|
-
|
|
628
|
+
interface OnlyMemoizationPayload {
|
|
629
|
+
memoization: WeakMap<WeakKey, any>;
|
|
630
|
+
isMemoization: true;
|
|
631
|
+
}
|
|
666
632
|
/**
|
|
667
|
-
* Create
|
|
633
|
+
* Create an empty memoization payload for the resolver
|
|
634
|
+
* @returns the empty memoization payload
|
|
668
635
|
*/
|
|
669
|
-
declare function
|
|
670
|
-
declare
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
var list: typeof listSilk;
|
|
675
|
-
var nullable: typeof nullableSilk;
|
|
636
|
+
declare function onlyMemoization(): OnlyMemoizationPayload;
|
|
637
|
+
declare function isOnlyMemoryPayload(payload: OnlyMemoizationPayload | Pick<ResolverPayload, "context">): payload is OnlyMemoizationPayload;
|
|
638
|
+
declare function getMemoizationMap(payload: OnlyMemoizationPayload | Pick<ResolverPayload, "context">): WeakMap<WeakKey, any>;
|
|
639
|
+
interface ContextMemoryContainer {
|
|
640
|
+
[CONTEXT_MAP_KEY]?: WeakMap<WeakKey, any>;
|
|
676
641
|
}
|
|
677
|
-
|
|
642
|
+
declare function assignContextMap(target: ContextMemoryContainer): WeakMap<WeakKey, any>;
|
|
643
|
+
//#endregion
|
|
644
|
+
//#region src/utils/error.d.ts
|
|
645
|
+
declare function markErrorLocation<TError>(error: TError, ...locations: string[]): TError;
|
|
646
|
+
declare function tryIn<T>(func: () => T, ...locations: string[]): T;
|
|
678
647
|
/**
|
|
679
|
-
*
|
|
648
|
+
* mark message with location
|
|
649
|
+
* @param message origin message
|
|
650
|
+
* @param locations where error happened
|
|
651
|
+
* @returns message with location
|
|
652
|
+
* @example markLocation("error", "banana") // "[banana] hello"
|
|
653
|
+
* @example markLocation("error", fruit, banana) // "[fruit.banana] error"
|
|
654
|
+
* @example markLocation("[banana] error", "fruit") // "[fruit.banana] error"
|
|
655
|
+
* @example markLocation("[fruit.banana] error", "favorite") // "[favorite.fruit.banana] error"
|
|
680
656
|
*/
|
|
681
|
-
declare function
|
|
682
|
-
|
|
657
|
+
declare function markLocation(message: string, ...locations: string[]): string;
|
|
658
|
+
//#endregion
|
|
659
|
+
//#region src/utils/loader.d.ts
|
|
660
|
+
type BatchLoadFn<TKey, TData> = (keys: TKey[]) => Promise<(TData | Error)[]>;
|
|
683
661
|
/**
|
|
684
|
-
*
|
|
662
|
+
* GraphQL Loom built-in data loader.
|
|
685
663
|
*/
|
|
686
|
-
declare
|
|
687
|
-
|
|
664
|
+
declare abstract class LoomDataLoader<TKey, TData> {
|
|
665
|
+
protected abstract batchLoad(keys: TKey[]): Promise<(TData | Error)[]>;
|
|
666
|
+
protected results: Map<TKey, Promise<TData>>;
|
|
667
|
+
protected resolvers: Map<TKey, [resolve: (value: TData | PromiseLike<TData>) => void, reject: (reason?: any) => void]>;
|
|
668
|
+
constructor();
|
|
669
|
+
/**
|
|
670
|
+
* Load data for a given key.
|
|
671
|
+
* @param key - The key to load data for.
|
|
672
|
+
* @returns A promise that resolves to the loaded data.
|
|
673
|
+
*/
|
|
674
|
+
load(key: TKey): Promise<TData>;
|
|
675
|
+
/**
|
|
676
|
+
* Clear the cache and reset the loader.
|
|
677
|
+
*/
|
|
678
|
+
clear(): void;
|
|
679
|
+
protected executeBatchLoad(): Promise<void>;
|
|
680
|
+
protected nextTickPromise?: Promise<void>;
|
|
681
|
+
protected nextTickBatchLoad(): Promise<void>;
|
|
682
|
+
static nextTick(): Promise<void>;
|
|
683
|
+
}
|
|
684
|
+
declare class EasyDataLoader<TKey, TData> extends LoomDataLoader<TKey, TData> {
|
|
685
|
+
protected readonly batchLoadFn: BatchLoadFn<TKey, TData>;
|
|
686
|
+
protected batchLoad(keys: TKey[]): Promise<(TData | Error)[]>;
|
|
687
|
+
constructor(batchLoadFn: BatchLoadFn<TKey, TData>);
|
|
688
|
+
}
|
|
689
|
+
//#endregion
|
|
690
|
+
//#region src/utils/types.d.ts
|
|
691
|
+
type MayPromise<T> = T | Promise<T>;
|
|
692
|
+
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
693
|
+
type ValueOf<T extends object> = T[keyof T];
|
|
694
|
+
type OmitInUnion<TUnion, TOmit> = TUnion extends infer T ? T extends TOmit ? never : T : never;
|
|
695
|
+
type RequireKeys<T, TKey extends string | number | symbol> = { [P in keyof T as P extends TKey ? P : never]-?: T[P] } & { [P in keyof T as P extends TKey ? never : P]: T[P] };
|
|
696
|
+
type MayGetter<T> = T | (() => T);
|
|
697
|
+
//#endregion
|
|
698
|
+
//#region src/utils/middleware.d.ts
|
|
688
699
|
/**
|
|
689
|
-
*
|
|
700
|
+
* The operation of the field:
|
|
701
|
+
* - `field`
|
|
702
|
+
* - `query`
|
|
703
|
+
* - `mutation`
|
|
704
|
+
* - `subscription.resolve`
|
|
705
|
+
* - `subscription.subscribe`
|
|
706
|
+
* - `resolveReference`
|
|
690
707
|
*/
|
|
691
|
-
|
|
708
|
+
type MiddlewareOperation = "field" | "query" | "mutation" | "subscription.resolve" | "subscription.subscribe" | "resolveReference";
|
|
709
|
+
interface MiddlewareOptions<TField extends BaseField = BaseField> {
|
|
710
|
+
/** The Output Silk */
|
|
711
|
+
outputSilk: StandardSchemaV1.InferOutput<InferFieldOutput<TField>>;
|
|
712
|
+
/** The previous object. */
|
|
713
|
+
parent: InferFieldParent<TField>;
|
|
714
|
+
/** A function to parse the input */
|
|
715
|
+
parseInput: CallableInputParser<TField["~meta"]["input"]>;
|
|
716
|
+
/** The executing operation */
|
|
717
|
+
operation: MiddlewareOperation;
|
|
718
|
+
/** The payload of the resolver */
|
|
719
|
+
payload: ResolverPayload | undefined;
|
|
720
|
+
}
|
|
721
|
+
type InferFieldParent<TField extends BaseField> = TField extends Field<infer TParent, any, any, infer TDependencies> ? TDependencies extends string[] ? RequireKeys<NonNullable<StandardSchemaV1.InferOutput<TParent>>, TDependencies[number]> : NonNullable<StandardSchemaV1.InferOutput<TParent>> : undefined;
|
|
722
|
+
interface CallableMiddlewareOptions<TField extends BaseField = BaseField> extends MiddlewareOptions<TField> {
|
|
723
|
+
/** The function to call next in the middleware chain. */
|
|
724
|
+
next: () => MayPromise<StandardSchemaV1.InferOutput<InferFieldOutput<TField>>>;
|
|
725
|
+
/** The function to call next in the middleware chain. */
|
|
726
|
+
(): MayPromise<StandardSchemaV1.InferOutput<InferFieldOutput<TField>>>;
|
|
727
|
+
}
|
|
728
|
+
interface MiddlewareConfig {
|
|
729
|
+
/** The operations to apply the middleware to. */
|
|
730
|
+
operations?: MiddlewareOperation[];
|
|
731
|
+
}
|
|
732
|
+
interface Middleware<TField extends BaseField = any> extends Partial<MiddlewareConfig> {
|
|
733
|
+
(options: CallableMiddlewareOptions<TField>): MayPromise<StandardSchemaV1.InferOutput<InferFieldOutput<TField>>>;
|
|
734
|
+
}
|
|
735
|
+
declare function applyMiddlewares<TField extends BaseField = BaseField>(options: MiddlewareOptions<TField>, resolveFunction: () => MayPromise<StandardSchemaV1.InferOutput<InferFieldOutput<TField>>>, middlewares: Middleware[]): Promise<StandardSchemaV1.InferOutput<InferFieldOutput<TField>>>;
|
|
736
|
+
declare function filterMiddlewares(operation: MiddlewareOperation, ...middlewareList: (Middleware | Iterable<Middleware> | undefined | null)[]): Middleware[];
|
|
737
|
+
//#endregion
|
|
738
|
+
//#region src/utils/object.d.ts
|
|
692
739
|
/**
|
|
693
|
-
*
|
|
694
|
-
*
|
|
695
|
-
* @returns GraphQL Output Type
|
|
740
|
+
* Creates an object map with the same keys as `map` and values generated by
|
|
741
|
+
* running each value of `record` thru `fn`.
|
|
696
742
|
*/
|
|
697
|
-
declare function
|
|
743
|
+
declare function mapValue<T, V>(record: Record<string, T>, fn: (value: T, key: string) => V | typeof mapValue.SKIP): Record<string, V>;
|
|
744
|
+
declare namespace mapValue {
|
|
745
|
+
var SKIP: unique symbol;
|
|
746
|
+
}
|
|
747
|
+
declare function toObjMap<T>(obj: Maybe<ReadOnlyObjMapLike<T>>): ReadOnlyObjMap<T>;
|
|
748
|
+
declare function notNullish<T>(x: T | undefined | null): x is T;
|
|
749
|
+
declare function deepMerge<T extends Record<string, any>>(...objects: (T | null | undefined)[]): T;
|
|
698
750
|
/**
|
|
699
|
-
*
|
|
700
|
-
*
|
|
701
|
-
* @
|
|
702
|
-
* @
|
|
751
|
+
* Wraps the provided data in an object with a single key `"~meta"`.
|
|
752
|
+
*
|
|
753
|
+
* @template T - The type of the data to be wrapped.
|
|
754
|
+
* @param {T} data - The data to be wrapped.
|
|
755
|
+
* @returns {{ "~meta": T }} - An object with a single key `"~meta"` containing the provided data.
|
|
756
|
+
* @example
|
|
757
|
+
* const originalData = { key: "value" };
|
|
758
|
+
* const metaData = meta(originalData);
|
|
759
|
+
* console.log(metaData); // Output: { "~meta": { key: "value" } }
|
|
703
760
|
*/
|
|
704
|
-
declare function
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
type
|
|
708
|
-
type
|
|
709
|
-
|
|
761
|
+
declare function meta<T>(data: T): {
|
|
762
|
+
"~meta": T;
|
|
763
|
+
};
|
|
764
|
+
type Maybe<T> = null | undefined | T;
|
|
765
|
+
type ReadOnlyObjMapLike<T> = ReadOnlyObjMap<T> | {
|
|
766
|
+
readonly [key: string]: T;
|
|
767
|
+
};
|
|
768
|
+
interface ReadOnlyObjMap<T> {
|
|
769
|
+
readonly [key: string]: T;
|
|
770
|
+
}
|
|
710
771
|
//#endregion
|
|
711
|
-
//#region src/
|
|
772
|
+
//#region src/utils/parse-resolving-fields.d.ts
|
|
712
773
|
/**
|
|
713
|
-
*
|
|
714
|
-
* @param output - The output type definition for the query
|
|
715
|
-
* @param resolveOrOptions - Either a resolve function or options object
|
|
716
|
-
* @returns A GraphQL query resolver
|
|
774
|
+
* Represents the state of field resolution in a GraphQL query.
|
|
717
775
|
*/
|
|
718
|
-
|
|
776
|
+
interface ResolvingFields {
|
|
777
|
+
/**
|
|
778
|
+
* Fields explicitly requested in the GraphQL query
|
|
779
|
+
*/
|
|
780
|
+
requestedFields: ReadonlySet<string>;
|
|
781
|
+
/**
|
|
782
|
+
* Fields that are derived from other fields (computed fields)
|
|
783
|
+
*/
|
|
784
|
+
derivedFields: ReadonlySet<string>;
|
|
785
|
+
/**
|
|
786
|
+
* Fields that derived fields depend on
|
|
787
|
+
*/
|
|
788
|
+
derivedDependencies: ReadonlySet<string>;
|
|
789
|
+
/**
|
|
790
|
+
* Final set of fields that need to be resolved, after processing derived fields
|
|
791
|
+
*/
|
|
792
|
+
selectedFields: ReadonlySet<string>;
|
|
793
|
+
}
|
|
719
794
|
/**
|
|
720
|
-
*
|
|
795
|
+
* Analyzes and processes field resolution in a GraphQL query deeply.
|
|
796
|
+
*
|
|
797
|
+
* @param payload - The resolver payload containing the current field resolution context
|
|
798
|
+
* @param [maxDepth=Infinity] - Maximum depth of nested fields to parse
|
|
799
|
+
* @returns A map of field paths to their resolving fields
|
|
721
800
|
*/
|
|
722
|
-
declare
|
|
801
|
+
declare function getDeepResolvingFields(payload: Pick<ResolverPayload, "info">, maxDepth?: number): Map<string, ResolvingFields>;
|
|
802
|
+
/**
|
|
803
|
+
* Analyzes and processes field resolution in a GraphQL query.
|
|
804
|
+
*
|
|
805
|
+
* @param payload - The resolver payload containing the current field resolution context
|
|
806
|
+
* @returns An object containing sets of different field types
|
|
807
|
+
*/
|
|
808
|
+
declare function getResolvingFields(payload: Pick<ResolverPayload, "info">): ResolvingFields;
|
|
809
|
+
/**
|
|
810
|
+
* Parses the GraphQL resolve info to extract all requested fields.
|
|
811
|
+
* Returns a Set of field paths where nested fields are represented as 'parent.field'.
|
|
812
|
+
* Supports @include, @skip directives, fragments, and variables.
|
|
813
|
+
*
|
|
814
|
+
* @param info - The GraphQL resolve info object containing the query information
|
|
815
|
+
* @param maxDepth - Maximum depth of nested fields to parse (default: 1)
|
|
816
|
+
* @returns A Set of field paths
|
|
817
|
+
*/
|
|
818
|
+
declare function parseResolvingFields(info: GraphQLResolveInfo, maxDepth?: number): Set<string>;
|
|
819
|
+
//#endregion
|
|
820
|
+
//#region src/utils/string.d.ts
|
|
821
|
+
declare function pascalCase(str: string): string;
|
|
822
|
+
declare function capitalize<T extends string>(str: T): Capitalize<T>;
|
|
823
|
+
declare function screamingSnakeCase(str: string): string;
|
|
824
|
+
//#endregion
|
|
825
|
+
//#region src/resolver/input.d.ts
|
|
826
|
+
type InferInputI<TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void> = TInput extends void ? void : TInput extends GraphQLSilk ? StandardSchemaV1.InferInput<TInput> : TInput extends Record<string, GraphQLSilk> ? { [K in keyof TInput]: StandardSchemaV1.InferInput<TInput[K]> } : void;
|
|
827
|
+
type InferInputO<TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void> = TInput extends void ? void : TInput extends GraphQLSilk ? StandardSchemaV1.InferOutput<TInput> : TInput extends Record<string, GraphQLSilk> ? { [K in keyof TInput]: StandardSchemaV1.InferOutput<TInput[K]> } : never;
|
|
828
|
+
interface CallableInputParser<TSchema extends GraphQLSilk | Record<string, GraphQLSilk> | void> {
|
|
829
|
+
/**
|
|
830
|
+
* input schema
|
|
831
|
+
*/
|
|
832
|
+
schema: TSchema;
|
|
833
|
+
/**
|
|
834
|
+
* Origin value to parse
|
|
835
|
+
*/
|
|
836
|
+
value: InferInputI<TSchema>;
|
|
837
|
+
/**
|
|
838
|
+
* Parse the input and return the standard result
|
|
839
|
+
*/
|
|
840
|
+
(): Promise<StandardSchemaV1.Result<InferInputO<TSchema>>>;
|
|
841
|
+
/**
|
|
842
|
+
* Result of parsing. Set it to `undefined` then the parser will run again.
|
|
843
|
+
*/
|
|
844
|
+
result: StandardSchemaV1.Result<InferInputO<TSchema>> | undefined;
|
|
845
|
+
/**
|
|
846
|
+
* Parse the input and return the result
|
|
847
|
+
*/
|
|
848
|
+
getResult(): Promise<InferInputO<TSchema>>;
|
|
849
|
+
/**
|
|
850
|
+
* Set the result's value of parsing
|
|
851
|
+
*/
|
|
852
|
+
setResult(value: InferInputO<TSchema>): void;
|
|
853
|
+
/**
|
|
854
|
+
* Clear the result of parsing, the parser will run again to get the result.
|
|
855
|
+
*/
|
|
856
|
+
clearResult(): void;
|
|
857
|
+
}
|
|
858
|
+
declare function createInputParser<TSchema extends GraphQLSilk | Record<string, GraphQLSilk> | void>(schema: TSchema, value: InferInputI<TSchema>): CallableInputParser<TSchema>;
|
|
859
|
+
declare function parseInputValue<TSchema extends GraphQLSilk | Record<string, GraphQLSilk> | void>(inputSchema: TSchema, input: any): MayPromise<StandardSchemaV1.Result<InferInputO<TSchema>>>;
|
|
860
|
+
declare function getStandardValue<T>(result: StandardSchemaV1.Result<T>): T;
|
|
861
|
+
declare function getStandardValue<T>(result?: StandardSchemaV1.Result<T>): T | undefined;
|
|
862
|
+
declare function getStandardValue<T>(result: StandardSchemaV1.Result<T> | null): T | null;
|
|
863
|
+
//#endregion
|
|
864
|
+
//#region src/resolver/resolver.d.ts
|
|
865
|
+
/**
|
|
866
|
+
* Creates a GraphQL query resolver
|
|
867
|
+
* @param output - The output type definition for the query
|
|
868
|
+
* @param resolveOrOptions - Either a resolve function or options object
|
|
869
|
+
* @returns A GraphQL query resolver
|
|
870
|
+
*/
|
|
871
|
+
declare const createQuery: (output: GraphQLSilk<any, any>, resolveOrOptions?: ((...args: any) => MayPromise<unknown>) | QueryOptions<any, any>) => QueryChainFactory<never, void> | Query<any, any>;
|
|
872
|
+
/**
|
|
873
|
+
* Factory function for creating GraphQL queries with chainable configuration
|
|
874
|
+
*/
|
|
875
|
+
declare const query$1: QueryFactoryWithChain;
|
|
723
876
|
/**
|
|
724
877
|
* Creates a GraphQL mutation resolver
|
|
725
878
|
* @param output - The output type definition for the mutation
|
|
726
879
|
* @param resolveOrOptions - Either a resolve function or options object
|
|
727
880
|
* @returns A GraphQL mutation resolver
|
|
728
881
|
*/
|
|
729
|
-
declare const createMutation: (output: GraphQLSilk<any, any>, resolveOrOptions?: (() => MayPromise<unknown>) | MutationOptions<any, any>) =>
|
|
882
|
+
declare const createMutation: (output: GraphQLSilk<any, any>, resolveOrOptions?: (() => MayPromise<unknown>) | MutationOptions<any, any>) => MutationChainFactory<never, undefined> | Mutation<any, any>;
|
|
730
883
|
/**
|
|
731
884
|
* Factory function for creating GraphQL mutations with chainable configuration
|
|
732
885
|
*/
|
|
@@ -737,7 +890,7 @@ declare const mutation$1: MutationFactoryWithChain;
|
|
|
737
890
|
* @param resolveOrOptions - Either a resolve function or options object
|
|
738
891
|
* @returns A GraphQL field resolver
|
|
739
892
|
*/
|
|
740
|
-
declare const createField: (output: GraphQLSilk<any, any>, resolveOrOptions?: (() => unknown) | FieldOptions<GraphQLSilk, GraphQLSilk, GraphQLSilk | Record<string, GraphQLSilk> | void, string[] | undefined>) =>
|
|
893
|
+
declare const createField: (output: GraphQLSilk<any, any>, resolveOrOptions?: (() => unknown) | FieldOptions<GraphQLSilk, GraphQLSilk, GraphQLSilk | Record<string, GraphQLSilk> | void, string[] | undefined>) => FieldChainFactory<never, undefined, undefined> | Field<any, any, any, any>;
|
|
741
894
|
/**
|
|
742
895
|
* Factory function for creating GraphQL fields with chainable configuration
|
|
743
896
|
*/
|
|
@@ -866,207 +1019,97 @@ declare class ObjectChainResolver<TParent extends GraphQLSilk, TFields extends R
|
|
|
866
1019
|
*/
|
|
867
1020
|
type Executor<TFields extends Record<string, FieldOrOperation | typeof FIELD_HIDDEN>> = { [K in keyof TFields]: TFields[K] extends Field<infer TParent, infer TOutput, infer TInput, string[] | undefined> ? (parent: StandardSchemaV1.InferOutput<TParent>, args: InferInputI<TInput>, payload: ResolverPayload | void) => Promise<StandardSchemaV1.InferOutput<TOutput>> : TFields[K] extends Query<infer TOutput, infer TInput> ? (args: InferInputI<TInput>, payload: ResolverPayload | void) => Promise<StandardSchemaV1.InferOutput<TOutput>> : TFields[K] extends Mutation<infer TOutput, infer TInput> ? (args: InferInputI<TInput>, payload: ResolverPayload | void) => Promise<StandardSchemaV1.InferOutput<TOutput>> : never };
|
|
868
1021
|
//#endregion
|
|
869
|
-
//#region src/
|
|
1022
|
+
//#region src/resolver/silk.d.ts
|
|
870
1023
|
/**
|
|
871
|
-
*
|
|
872
|
-
* - `field`
|
|
873
|
-
* - `query`
|
|
874
|
-
* - `mutation`
|
|
875
|
-
* - `subscription.resolve`
|
|
876
|
-
* - `subscription.subscribe`
|
|
877
|
-
* - `resolveReference`
|
|
1024
|
+
* Create a Silk from Scalar.
|
|
878
1025
|
*/
|
|
879
|
-
|
|
880
|
-
interface MiddlewareOptions<TField extends BaseField = BaseField> {
|
|
881
|
-
/** The Output Silk */
|
|
882
|
-
outputSilk: StandardSchemaV1.InferOutput<InferFieldOutput<TField>>;
|
|
883
|
-
/** The previous object. */
|
|
884
|
-
parent: InferFieldParent<TField>;
|
|
885
|
-
/** A function to parse the input */
|
|
886
|
-
parseInput: CallableInputParser<TField["~meta"]["input"]>;
|
|
887
|
-
/** The executing operation */
|
|
888
|
-
operation: MiddlewareOperation;
|
|
889
|
-
/** The payload of the resolver */
|
|
890
|
-
payload: ResolverPayload | undefined;
|
|
891
|
-
}
|
|
892
|
-
type InferFieldParent<TField extends BaseField> = TField extends Field<infer TParent, any, any, infer TDependencies> ? TDependencies extends string[] ? RequireKeys<NonNullable<StandardSchemaV1.InferOutput<TParent>>, TDependencies[number]> : NonNullable<StandardSchemaV1.InferOutput<TParent>> : undefined;
|
|
893
|
-
interface CallableMiddlewareOptions<TField extends BaseField = BaseField> extends MiddlewareOptions<TField> {
|
|
894
|
-
/** The function to call next in the middleware chain. */
|
|
895
|
-
next: () => MayPromise<StandardSchemaV1.InferOutput<InferFieldOutput<TField>>>;
|
|
896
|
-
/** The function to call next in the middleware chain. */
|
|
897
|
-
(): MayPromise<StandardSchemaV1.InferOutput<InferFieldOutput<TField>>>;
|
|
898
|
-
}
|
|
899
|
-
interface MiddlewareConfig {
|
|
900
|
-
/** The operations to apply the middleware to. */
|
|
901
|
-
operations?: MiddlewareOperation[];
|
|
902
|
-
}
|
|
903
|
-
interface Middleware<TField extends BaseField = any> extends Partial<MiddlewareConfig> {
|
|
904
|
-
(options: CallableMiddlewareOptions<TField>): MayPromise<StandardSchemaV1.InferOutput<InferFieldOutput<TField>>>;
|
|
905
|
-
}
|
|
906
|
-
declare function applyMiddlewares<TField extends BaseField = BaseField>(options: MiddlewareOptions<TField>, resolveFunction: () => MayPromise<StandardSchemaV1.InferOutput<InferFieldOutput<TField>>>, middlewares: Middleware[]): Promise<StandardSchemaV1.InferOutput<InferFieldOutput<TField>>>;
|
|
907
|
-
declare function filterMiddlewares(operation: MiddlewareOperation, ...middlewareList: (Middleware | Iterable<Middleware> | undefined | null)[]): Middleware[];
|
|
908
|
-
//#endregion
|
|
909
|
-
//#region src/utils/object.d.ts
|
|
1026
|
+
declare function silk<TScalar extends GraphQLVariants<GraphQLScalarType>>(type: TScalar | (() => TScalar), validate?: (value: InferScalarExternalByVariants<TScalar>) => StandardSchemaV1.Result<InferScalarExternalByVariants<TScalar>> | Promise<StandardSchemaV1.Result<InferScalarInternalByVariants<TScalar>>>): GraphQLSilk<InferScalarInternalByVariants<TScalar>, InferScalarInternalByVariants<TScalar>>;
|
|
910
1027
|
/**
|
|
911
|
-
*
|
|
912
|
-
* running each value of `record` thru `fn`.
|
|
1028
|
+
* Create a GraphQLSilk Object.
|
|
913
1029
|
*/
|
|
914
|
-
declare function
|
|
915
|
-
declare namespace mapValue {
|
|
916
|
-
var SKIP: unique symbol;
|
|
917
|
-
}
|
|
918
|
-
declare function toObjMap<T>(obj: Maybe<ReadOnlyObjMapLike<T>>): ReadOnlyObjMap<T>;
|
|
919
|
-
declare function notNullish<T>(x: T | undefined | null): x is T;
|
|
920
|
-
declare function deepMerge<T extends Record<string, any>>(...objects: (T | null | undefined)[]): T;
|
|
1030
|
+
declare function silk<TObject extends GraphQLVariants<GraphQLObjectType>>(type: TObject | (() => TObject), validate?: (value: InferObjectSourceByVariants<TObject>) => StandardSchemaV1.Result<InferObjectSourceByVariants<TObject>> | Promise<StandardSchemaV1.Result<InferObjectSourceByVariants<TObject>>>): GraphQLSilk<InferObjectSourceByVariants<TObject>, InferObjectSourceByVariants<TObject>>;
|
|
921
1031
|
/**
|
|
922
|
-
*
|
|
923
|
-
*
|
|
924
|
-
* @template T - The type of the data to be wrapped.
|
|
925
|
-
* @param {T} data - The data to be wrapped.
|
|
926
|
-
* @returns {{ "~meta": T }} - An object with a single key `"~meta"` containing the provided data.
|
|
927
|
-
* @example
|
|
928
|
-
* const originalData = { key: "value" };
|
|
929
|
-
* const metaData = meta(originalData);
|
|
930
|
-
* console.log(metaData); // Output: { "~meta": { key: "value" } }
|
|
1032
|
+
* Create a GraphQLSilk Object.
|
|
931
1033
|
*/
|
|
932
|
-
declare function
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
interface ReadOnlyObjMap<T> {
|
|
940
|
-
readonly [key: string]: T;
|
|
1034
|
+
declare function silk<TOutput, TInput = TOutput>(type: GraphQLOutputType | (() => GraphQLOutputType), validate?: (value: TInput) => StandardSchemaV1.Result<TOutput> | Promise<StandardSchemaV1.Result<TOutput>>): GraphQLSilk<TOutput, TInput>;
|
|
1035
|
+
declare namespace silk {
|
|
1036
|
+
var parse: typeof parseSilk;
|
|
1037
|
+
var getType: typeof getGraphQLType;
|
|
1038
|
+
var nonNull: typeof nonNullSilk;
|
|
1039
|
+
var list: typeof listSilk;
|
|
1040
|
+
var nullable: typeof nullableSilk;
|
|
941
1041
|
}
|
|
942
|
-
|
|
943
|
-
//#region src/utils/parse-resolving-fields.d.ts
|
|
1042
|
+
type NonNullSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<NonNullable<StandardSchemaV1.InferOutput<TSilk>>, NonNullable<StandardSchemaV1.InferInput<TSilk>>>;
|
|
944
1043
|
/**
|
|
945
|
-
*
|
|
1044
|
+
* Non-nullable Silk.
|
|
946
1045
|
*/
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
* Fields explicitly requested in the GraphQL query
|
|
950
|
-
*/
|
|
951
|
-
requestedFields: ReadonlySet<string>;
|
|
952
|
-
/**
|
|
953
|
-
* Fields that are derived from other fields (computed fields)
|
|
954
|
-
*/
|
|
955
|
-
derivedFields: ReadonlySet<string>;
|
|
956
|
-
/**
|
|
957
|
-
* Fields that derived fields depend on
|
|
958
|
-
*/
|
|
959
|
-
derivedDependencies: ReadonlySet<string>;
|
|
960
|
-
/**
|
|
961
|
-
* Final set of fields that need to be resolved, after processing derived fields
|
|
962
|
-
*/
|
|
963
|
-
selectedFields: ReadonlySet<string>;
|
|
964
|
-
}
|
|
1046
|
+
declare function nonNullSilk<TSilk extends GraphQLSilk<any, any>>(origin: TSilk): NonNullSilk<TSilk>;
|
|
1047
|
+
type ListSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<Array<StandardSchemaV1.InferOutput<TSilk>>, Array<StandardSchemaV1.InferOutput<TSilk>>>;
|
|
965
1048
|
/**
|
|
966
|
-
*
|
|
967
|
-
*
|
|
968
|
-
* @param payload - The resolver payload containing the current field resolution context
|
|
969
|
-
* @param [maxDepth=Infinity] - Maximum depth of nested fields to parse
|
|
970
|
-
* @returns A map of field paths to their resolving fields
|
|
1049
|
+
* List Silk.
|
|
971
1050
|
*/
|
|
972
|
-
declare function
|
|
1051
|
+
declare function listSilk<TSilk extends GraphQLSilk<any, any>>(origin: TSilk): ListSilk<TSilk>;
|
|
1052
|
+
type NullableSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<StandardSchemaV1.InferOutput<TSilk> | null | undefined, StandardSchemaV1.InferInput<TSilk>>;
|
|
973
1053
|
/**
|
|
974
|
-
*
|
|
975
|
-
*
|
|
976
|
-
* @param payload - The resolver payload containing the current field resolution context
|
|
977
|
-
* @returns An object containing sets of different field types
|
|
1054
|
+
* Nullable Silk.
|
|
978
1055
|
*/
|
|
979
|
-
declare function
|
|
1056
|
+
declare function nullableSilk<TSilk extends GraphQLSilk<any, any>>(origin: TSilk): NullableSilk<TSilk>;
|
|
980
1057
|
/**
|
|
981
|
-
*
|
|
982
|
-
*
|
|
983
|
-
*
|
|
984
|
-
*
|
|
985
|
-
* @param info - The GraphQL resolve info object containing the query information
|
|
986
|
-
* @param maxDepth - Maximum depth of nested fields to parse (default: 1)
|
|
987
|
-
* @returns A Set of field paths
|
|
1058
|
+
* Get GraphQL Output Type from Silk.
|
|
1059
|
+
* @param silk GraphQL Silk
|
|
1060
|
+
* @returns GraphQL Output Type
|
|
988
1061
|
*/
|
|
989
|
-
declare function
|
|
990
|
-
//#endregion
|
|
991
|
-
//#region src/utils/string.d.ts
|
|
992
|
-
declare function pascalCase(str: string): string;
|
|
993
|
-
declare function capitalize<T extends string>(str: T): Capitalize<T>;
|
|
994
|
-
declare function screamingSnakeCase(str: string): string;
|
|
995
|
-
//#endregion
|
|
996
|
-
//#region src/utils/error.d.ts
|
|
997
|
-
declare function markErrorLocation<TError>(error: TError, ...locations: string[]): TError;
|
|
998
|
-
declare function tryIn<T>(func: () => T, ...locations: string[]): T;
|
|
1062
|
+
declare function getGraphQLType(silk: GraphQLSilk): GraphQLOutputType;
|
|
999
1063
|
/**
|
|
1000
|
-
*
|
|
1001
|
-
* @param
|
|
1002
|
-
* @
|
|
1003
|
-
* @returns message with location
|
|
1004
|
-
* @example markLocation("error", "banana") // "[banana] hello"
|
|
1005
|
-
* @example markLocation("error", fruit, banana) // "[fruit.banana] error"
|
|
1006
|
-
* @example markLocation("[banana] error", "fruit") // "[fruit.banana] error"
|
|
1007
|
-
* @example markLocation("[fruit.banana] error", "favorite") // "[favorite.fruit.banana] error"
|
|
1064
|
+
* Get GraphQL Argument Config from Silk.
|
|
1065
|
+
* @param silk GraphQL Silk
|
|
1066
|
+
* @returns GraphQL Argument Config
|
|
1008
1067
|
*/
|
|
1009
|
-
declare function
|
|
1010
|
-
//#endregion
|
|
1011
|
-
//#region src/utils/loader.d.ts
|
|
1012
|
-
type BatchLoadFn<TKey, TData> = (keys: TKey[]) => Promise<(TData | Error)[]>;
|
|
1068
|
+
declare function getGraphQLArgumentConfig(silk: GraphQLSilk): Omit<GraphQLArgumentConfig, "type" | "astNode"> | undefined;
|
|
1013
1069
|
/**
|
|
1014
|
-
*
|
|
1070
|
+
* Validate and transform input to output
|
|
1071
|
+
* @param silk silk GraphQL Silk
|
|
1072
|
+
* @param input
|
|
1073
|
+
* @returns output
|
|
1015
1074
|
*/
|
|
1016
|
-
declare
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
* Clear the cache and reset the loader.
|
|
1029
|
-
*/
|
|
1030
|
-
clear(): void;
|
|
1031
|
-
protected executeBatchLoad(): Promise<void>;
|
|
1032
|
-
protected nextTickPromise?: Promise<void>;
|
|
1033
|
-
protected nextTickBatchLoad(): Promise<void>;
|
|
1034
|
-
static nextTick(): Promise<void>;
|
|
1075
|
+
declare function parseSilk<TSilk extends GraphQLSilk>(silk: TSilk, input: StandardSchemaV1.InferInput<TSilk>): MayPromise<StandardSchemaV1.Result<StandardSchemaV1.InferOutput<TSilk>>>;
|
|
1076
|
+
declare function isSilk(target: any): target is GraphQLSilk;
|
|
1077
|
+
type GraphQLVariants<TSource extends GraphQLNullableType> = TSource | GraphQLList<TSource> | GraphQLList<GraphQLNonNull<TSource>> | GraphQLNonNull<TSource> | GraphQLNonNull<GraphQLList<TSource>> | GraphQLNonNull<GraphQLList<GraphQLNonNull<TSource>>>;
|
|
1078
|
+
type InferScalarInternalByVariants<T extends GraphQLVariants<GraphQLScalarType>> = T extends GraphQLNonNull<infer U> ? U extends GraphQLVariants<GraphQLScalarType> ? NonNullable<InferScalarInternalByVariants<U>> : never : T extends GraphQLList<infer U> ? U extends GraphQLVariants<GraphQLScalarType> ? InferScalarInternalByVariants<U>[] : never : T extends GraphQLScalarType<infer TInternal, any> ? TInternal | null | undefined : never;
|
|
1079
|
+
type InferScalarExternalByVariants<T extends GraphQLVariants<GraphQLScalarType>> = T extends GraphQLNonNull<infer U> ? U extends GraphQLVariants<GraphQLScalarType> ? NonNullable<InferScalarExternalByVariants<U>> : never : T extends GraphQLList<infer U> ? U extends GraphQLVariants<GraphQLScalarType> ? InferScalarExternalByVariants<U>[] : never : T extends GraphQLScalarType<any, infer TExternal> ? TExternal | null | undefined : never;
|
|
1080
|
+
type InferObjectSourceByVariants<T extends GraphQLVariants<GraphQLObjectType>> = T extends GraphQLNonNull<infer U> ? U extends GraphQLVariants<GraphQLObjectType> ? NonNullable<InferObjectSourceByVariants<U>> : never : T extends GraphQLList<infer U> ? U extends GraphQLVariants<GraphQLObjectType> ? InferObjectSourceByVariants<U>[] : never : T extends GraphQLObjectType<infer TSource> ? TSource | null | undefined : never;
|
|
1081
|
+
//#endregion
|
|
1082
|
+
//#region src/schema/extensions.d.ts
|
|
1083
|
+
interface GQLoomExtensions {
|
|
1084
|
+
defaultValue?: any;
|
|
1085
|
+
gqloom?: GQLoomExtensionAttribute;
|
|
1086
|
+
directives?: DirectiveItem[] | DirectiveRecord;
|
|
1035
1087
|
}
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
constructor(batchLoadFn: BatchLoadFn<TKey, TData>);
|
|
1088
|
+
interface DirectiveItem {
|
|
1089
|
+
name: string;
|
|
1090
|
+
args?: Record<string, any>;
|
|
1040
1091
|
}
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
* Empty Resolver Arguments that only store the memoization
|
|
1045
|
-
*/
|
|
1046
|
-
interface OnlyMemoizationPayload {
|
|
1047
|
-
memoization: WeakMap<WeakKey, any>;
|
|
1048
|
-
isMemoization: true;
|
|
1092
|
+
type DirectiveRecord = Record<string, Record<string, any>>;
|
|
1093
|
+
interface GQLoomExtensionAttribute {
|
|
1094
|
+
directives?: string[];
|
|
1049
1095
|
}
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
declare function onlyMemoization(): OnlyMemoizationPayload;
|
|
1055
|
-
declare function isOnlyMemoryPayload(payload: OnlyMemoizationPayload | Pick<ResolverPayload, "context">): payload is OnlyMemoizationPayload;
|
|
1056
|
-
declare function getMemoizationMap(payload: OnlyMemoizationPayload | Pick<ResolverPayload, "context">): WeakMap<WeakKey, any>;
|
|
1057
|
-
interface ContextMemoryContainer {
|
|
1058
|
-
[CONTEXT_MAP_KEY]?: WeakMap<WeakKey, any>;
|
|
1096
|
+
//#endregion
|
|
1097
|
+
//#region src/schema/input.d.ts
|
|
1098
|
+
interface EnsureInputOptions {
|
|
1099
|
+
fieldName: string;
|
|
1059
1100
|
}
|
|
1060
|
-
declare function
|
|
1101
|
+
declare function inputToArgs(input: GraphQLSilk | Record<string, GraphQLSilk> | undefined | void, options: EnsureInputOptions): GraphQLFieldConfigArgumentMap | undefined;
|
|
1102
|
+
declare function ensureInputType(silkOrType: GraphQLType | GraphQLSilk, options: EnsureInputOptions): GraphQLInputType;
|
|
1103
|
+
declare function ensureInputObjectType(object: GraphQLObjectType | GraphQLInterfaceType | GraphQLInputObjectType, options: EnsureInputOptions): GraphQLInputObjectType;
|
|
1061
1104
|
//#endregion
|
|
1062
|
-
//#region src/
|
|
1063
|
-
declare
|
|
1064
|
-
declare const AUTO_ALIASING = "__gqloom_auto_aliasing";
|
|
1105
|
+
//#region src/schema/interface.d.ts
|
|
1106
|
+
declare function ensureInterfaceType(gqlType: GraphQLOutputType, interfaceConfig?: Partial<GraphQLInterfaceTypeConfig<any, any>>): GraphQLInterfaceType;
|
|
1065
1107
|
//#endregion
|
|
1066
1108
|
//#region src/schema/schema-weaver.d.ts
|
|
1067
1109
|
interface SchemaWeaver {
|
|
1068
1110
|
vendor: string;
|
|
1069
1111
|
getGraphQLType: (schema: any) => GraphQLOutputType;
|
|
1112
|
+
getGraphQLArgumentConfig?: (schema: any) => Omit<GraphQLArgumentConfig, "type" | "astNode"> | undefined;
|
|
1070
1113
|
}
|
|
1071
1114
|
declare function isSchemaVendorWeaver(some: any): some is SchemaWeaver;
|
|
1072
1115
|
//#endregion
|
|
@@ -1120,7 +1163,7 @@ declare class GlobalWeaverContext implements Partial<Omit<WeaverContext, GlobalC
|
|
|
1120
1163
|
get id(): number | undefined;
|
|
1121
1164
|
get loomObjectMap(): Map<GraphQLObjectType<any, any>, LoomObjectType> | undefined;
|
|
1122
1165
|
get loomUnionMap(): Map<GraphQLUnionType, GraphQLUnionType> | undefined;
|
|
1123
|
-
get inputMap(): Map<
|
|
1166
|
+
get inputMap(): Map<GraphQLObjectType<any, any> | GraphQLInterfaceType, GraphQLInputObjectType> | undefined;
|
|
1124
1167
|
get interfaceMap(): Map<GraphQLObjectType<any, any>, GraphQLInterfaceType> | undefined;
|
|
1125
1168
|
get configs(): Map<string | symbol, WeaverConfig> | undefined;
|
|
1126
1169
|
get vendorWeavers(): Map<string, SchemaWeaver> | undefined;
|
|
@@ -1253,30 +1296,4 @@ declare class GraphQLSchemaLoom {
|
|
|
1253
1296
|
*/
|
|
1254
1297
|
declare const weave: typeof GraphQLSchemaLoom.weave;
|
|
1255
1298
|
//#endregion
|
|
1256
|
-
|
|
1257
|
-
interface EnsureInputOptions {
|
|
1258
|
-
fieldName: string;
|
|
1259
|
-
}
|
|
1260
|
-
declare function inputToArgs(input: GraphQLSilk | Record<string, GraphQLSilk> | undefined | void, options: EnsureInputOptions): GraphQLFieldConfigArgumentMap | undefined;
|
|
1261
|
-
declare function ensureInputType(silkOrType: GraphQLType | GraphQLSilk, options: EnsureInputOptions): GraphQLInputType;
|
|
1262
|
-
declare function ensureInputObjectType(object: GraphQLObjectType | GraphQLInterfaceType | GraphQLInputObjectType, options: EnsureInputOptions): GraphQLInputObjectType;
|
|
1263
|
-
//#endregion
|
|
1264
|
-
//#region src/schema/interface.d.ts
|
|
1265
|
-
declare function ensureInterfaceType(gqlType: GraphQLOutputType, interfaceConfig?: Partial<GraphQLInterfaceTypeConfig<any, any>>): GraphQLInterfaceType;
|
|
1266
|
-
//#endregion
|
|
1267
|
-
//#region src/schema/extensions.d.ts
|
|
1268
|
-
interface GQLoomExtensions {
|
|
1269
|
-
defaultValue?: any;
|
|
1270
|
-
gqloom?: GQLoomExtensionAttribute;
|
|
1271
|
-
directives?: DirectiveItem[] | DirectiveRecord;
|
|
1272
|
-
}
|
|
1273
|
-
interface DirectiveItem {
|
|
1274
|
-
name: string;
|
|
1275
|
-
args?: Record<string, any>;
|
|
1276
|
-
}
|
|
1277
|
-
type DirectiveRecord = Record<string, Record<string, any>>;
|
|
1278
|
-
interface GQLoomExtensionAttribute {
|
|
1279
|
-
directives?: string[];
|
|
1280
|
-
}
|
|
1281
|
-
//#endregion
|
|
1282
|
-
export { AUTO_ALIASING, BaseChainFactory, BaseField, BatchLoadFn, CallableInputParser, CallableMiddlewareOptions, ChainFactoryOptions, ChainResolver, CoreSchemaWeaverConfig, CoreSchemaWeaverConfigOptions, DERIVED_DEPENDENCIES, DirectiveItem, DirectiveRecord, EasyDataLoader, Executor, Field, FieldChainFactory, FieldFactory, FieldFactoryWithResolve, FieldFactoryWithUtils, FieldMeta, FieldOptions, FieldOrOperation, FieldOrOperationType, GQLoomExtensionAttribute, GQLoomExtensions, GlobalWeaverContext, GraphQLFieldOptions, GraphQLSchemaLoom, GraphQLSilk, IChainFactory, InferFieldInput, InferFieldOutput, InferInputI, InferInputO, IsAny, ListSilk, LoomDataLoader, LoomObjectType, MayPromise, Middleware, MiddlewareConfig, MiddlewareOperation, MiddlewareOptions, Mutation, MutationChainFactory, MutationFactory, MutationFactoryWithChain, MutationFactoryWithResolve, MutationOptions, NonNullSilk, NullableSilk, OPERATION_OBJECT_NAMES, ObjectChainResolver, OmitInUnion, OnlyMemoizationPayload, Operation, OperationType, Query, QueryChainFactory, QueryFactory, QueryFactoryWithChain, QueryFactoryWithResolve, QueryOptions, RequireKeys, ResolvableSubscription, Resolver, ResolverFactory, ResolverMeta, ResolverOptions, ResolverOptionsWithExtensions, ResolverOptionsWithParent, ResolverPayload, ResolvingFields, ResolvingOptions, SchemaWeaver, StandardSchemaV1, Subscription, SubscriptionChainFactory, SubscriptionFactory, SubscriptionFactoryWithChain, SubscriptionNeedResolve, SubscriptionOptions, ToExecutorProps, ValueOf, WeaverConfig, WeaverContext, applyMiddlewares, assignContextMap, capitalize, collectName, collectNames, createField, createInputParser, createMutation, createQuery, createSubscription, deepMerge, defaultSubscriptionResolve, ensureInputObjectType, ensureInputType, ensureInterfaceType, field, filterMiddlewares, getCacheType, getDeepResolvingFields, getFieldOptions, getGraphQLType, getMemoizationMap, getOperationOptions, getResolvingFields, getStandardValue, getSubscriptionOptions, initWeaverContext, inputToArgs, isOnlyMemoryPayload, isSchemaVendorWeaver, isSilk, listSilk, loom, mapValue, markErrorLocation, markLocation, meta, mutation$1 as mutation, nonNullSilk, notNullish, nullableSilk, onlyMemoization, parseInputValue, parseResolvingFields, parseSilk, pascalCase, provideWeaverContext, query$1 as query, resolver, screamingSnakeCase, silk, subscription$1 as subscription, symbols_d_exports, toObjMap, tryIn, types_loom_d_exports, weave, weaverContext };
|
|
1299
|
+
export { subscription$1 as $, InferFieldInput as $t, getGraphQLType as A, IChainFactory as An, ValueOf as At, ResolverFactory as B, isOnlyMemoryPayload as Bt, DirectiveRecord as C, Resolver as Cn, applyMiddlewares as Ct, NonNullSilk as D, ChainFactoryOptions as Dn, MayPromise as Dt, ListSilk as E, BaseChainFactory as En, MayGetter as Et, parseSilk as F, ResolvableSubscription as Fn, markLocation as Ft, createQuery as G, getOperationOptions as Gt, ToExecutorProps as H, AUTO_ALIASING as Ht, silk as I, SubscriptionChainFactory as In, tryIn as It, field as J, FieldFactoryWithUtils as Jt, createSubscription as K, getSubscriptionOptions as Kt, ChainResolver as L, SubscriptionNeedResolve as Ln, OnlyMemoizationPayload as Lt, listSilk as M, MutationFactoryWithResolve as Mn, EasyDataLoader as Mt, nonNullSilk as N, QueryChainFactory as Nn, LoomDataLoader as Nt, NullableSilk as O, FieldChainFactory as On, OmitInUnion as Ot, nullableSilk as P, QueryFactoryWithResolve as Pn, markErrorLocation as Pt, resolver as Q, GraphQLSilk as Qt, Executor as R, symbols_d_exports as Rn, assignContextMap as Rt, DirectiveItem as S, Query as Sn, MiddlewareOptions as St, GQLoomExtensions as T, types_loom_d_exports as Tn, IsAny as Tt, createField as U, DERIVED_DEPENDENCIES as Ut, ResolverMeta as V, onlyMemoization as Vt, createMutation as W, getFieldOptions as Wt, mutation$1 as X, FieldOrOperationType as Xt, loom as Y, FieldOptions as Yt, query$1 as Z, GraphQLFieldOptions as Zt, isSchemaVendorWeaver as _, Field as _n, toObjMap as _t, LoomObjectType as a, QueryFactory as an, parseInputValue as at, ensureInputType as b, Mutation as bn, MiddlewareConfig as bt, GlobalWeaverContext as c, ResolverOptions as cn, screamingSnakeCase as ct, collectName as d, ResolverPayload as dn, getResolvingFields as dt, InferFieldOutput as en, CallableInputParser as et, collectNames as f, ResolvingOptions as fn, parseResolvingFields as ft, SchemaWeaver as g, BaseField as gn, notNullish as gt, weaverContext as h, SubscriptionOptions as hn, meta as ht, CoreSchemaWeaverConfigOptions as i, OperationType as in, getStandardValue as it, isSilk as j, MutationChainFactory as jn, BatchLoadFn as jt, getGraphQLArgumentConfig as k, FieldFactoryWithResolve as kn, RequireKeys as kt, WeaverConfig as l, ResolverOptionsWithExtensions as ln, ResolvingFields as lt, provideWeaverContext as m, SubscriptionFactoryWithChain as mn, mapValue as mt, weave as n, MutationFactoryWithChain as nn, InferInputO as nt, OPERATION_OBJECT_NAMES as o, QueryFactoryWithChain as on, capitalize as ot, initWeaverContext as p, SubscriptionFactory as pn, deepMerge as pt, defaultSubscriptionResolve as q, FieldFactory as qt, CoreSchemaWeaverConfig as r, MutationOptions as rn, createInputParser as rt, getCacheType as s, QueryOptions as sn, pascalCase as st, GraphQLSchemaLoom as t, MutationFactory as tn, InferInputI as tt, WeaverContext as u, ResolverOptionsWithParent as un, getDeepResolvingFields as ut, ensureInterfaceType as v, FieldMeta as vn, CallableMiddlewareOptions as vt, GQLoomExtensionAttribute as w, Subscription as wn, filterMiddlewares as wt, inputToArgs as x, Operation as xn, MiddlewareOperation as xt, ensureInputObjectType as y, FieldOrOperation as yn, Middleware as yt, ObjectChainResolver as z, StandardSchemaV1 as zn, getMemoizationMap as zt };
|