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