@gqloom/core 0.12.1 → 0.14.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-sGKC4BRu.d.ts → index-BdLdDytD.d.ts} +433 -404
- package/dist/{index-BxqR3YsC.d.cts → index-C26E_cfW.d.cts} +433 -404
- 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-CH8rJgks.js} +102 -79
- package/dist/{context-DshDoxiE.cjs → parse-resolving-fields-Czn0O39L.cjs} +106 -77
- 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,52 +91,13 @@ 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
|
|
139
97
|
* @template TOutput - The output type of the GraphQL field
|
|
140
98
|
* @template TInput - The input type of the GraphQL field, can be a single type or a record of types
|
|
141
99
|
*/
|
|
142
|
-
interface IChainFactory<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void> {
|
|
100
|
+
interface IChainFactory<TOutput$1 extends GraphQLSilk, TInput$1 extends GraphQLSilk | Record<string, GraphQLSilk> | void = void> {
|
|
143
101
|
/**
|
|
144
102
|
* Sets the description for the GraphQL field
|
|
145
103
|
* @param description - The description text for the field
|
|
@@ -160,13 +118,13 @@ interface IChainFactory<TOutput extends GraphQLSilk, TInput extends GraphQLSilk
|
|
|
160
118
|
* @template TOutputNew - The new output type
|
|
161
119
|
* @param output - The output type definition
|
|
162
120
|
*/
|
|
163
|
-
output<TOutputNew extends GraphQLSilk>(output: TOutputNew): IChainFactory<TOutputNew, TInput>;
|
|
121
|
+
output<TOutputNew extends GraphQLSilk>(output: TOutputNew): IChainFactory<TOutputNew, TInput$1>;
|
|
164
122
|
/**
|
|
165
123
|
* Sets the input type for the GraphQL field
|
|
166
124
|
* @template TInputNew - The new input type
|
|
167
125
|
* @param input - The input type definition
|
|
168
126
|
*/
|
|
169
|
-
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): IChainFactory<TOutput, TInputNew>;
|
|
127
|
+
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): IChainFactory<TOutput$1, TInputNew>;
|
|
170
128
|
}
|
|
171
129
|
/**
|
|
172
130
|
* Options for configuring a chain factory
|
|
@@ -226,7 +184,7 @@ declare abstract class BaseChainFactory<TField extends BaseField = any> {
|
|
|
226
184
|
* @template TInput - The input type of the field
|
|
227
185
|
* @template TDependencies - The dependencies of the field
|
|
228
186
|
*/
|
|
229
|
-
declare class FieldChainFactory<TOutput extends GraphQLSilk = never, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined, TDependencies extends string[] | undefined = undefined> extends BaseChainFactory<Field<any, TOutput, TInput, TDependencies>> implements IChainFactory<TOutput, TInput> {
|
|
187
|
+
declare class FieldChainFactory<TOutput$1 extends GraphQLSilk = never, TInput$1 extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined, TDependencies$1 extends string[] | undefined = undefined> extends BaseChainFactory<Field<any, TOutput$1, TInput$1, TDependencies$1>> implements IChainFactory<TOutput$1, TInput$1> {
|
|
230
188
|
/**
|
|
231
189
|
* Returns the available methods for the field chain factory
|
|
232
190
|
*/
|
|
@@ -241,25 +199,25 @@ declare class FieldChainFactory<TOutput extends GraphQLSilk = never, TInput exte
|
|
|
241
199
|
* @template TOutputNew - The new output type
|
|
242
200
|
* @param output - The output type definition
|
|
243
201
|
*/
|
|
244
|
-
output<TOutputNew extends GraphQLSilk>(output: TOutputNew): FieldChainFactory<TOutputNew, TInput, TDependencies>;
|
|
202
|
+
output<TOutputNew extends GraphQLSilk>(output: TOutputNew): FieldChainFactory<TOutputNew, TInput$1, TDependencies$1>;
|
|
245
203
|
/**
|
|
246
204
|
* Sets the input type for the field
|
|
247
205
|
* @template TInputNew - The new input type
|
|
248
206
|
* @param input - The input type definition
|
|
249
207
|
*/
|
|
250
|
-
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): FieldChainFactory<TOutput, TInputNew, TDependencies>;
|
|
208
|
+
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): FieldChainFactory<TOutput$1, TInputNew, TDependencies$1>;
|
|
251
209
|
/**
|
|
252
210
|
* Specifies the dependencies for the field
|
|
253
211
|
* @template TDependencies - The dependencies type
|
|
254
212
|
* @param dependencies - The dependencies to add
|
|
255
213
|
*/
|
|
256
|
-
derivedFrom<const TDependencies extends string[]>(...dependencies: TDependencies): FieldChainFactory<TOutput, TInput, TDependencies>;
|
|
214
|
+
derivedFrom<const TDependencies$1 extends string[]>(...dependencies: TDependencies$1): FieldChainFactory<TOutput$1, TInput$1, TDependencies$1>;
|
|
257
215
|
/**
|
|
258
216
|
* Sets the resolve function for the field
|
|
259
217
|
* @template TParent - The parent type
|
|
260
218
|
* @param resolve - The resolve function
|
|
261
219
|
*/
|
|
262
|
-
resolve<TParent extends GraphQLSilk>(resolve: (parent: TDependencies extends string[] ? RequireKeys<NonNullable<StandardSchemaV1.InferOutput<TParent>>, TDependencies[number]> : NonNullable<StandardSchemaV1.InferOutput<TParent>>, input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>): Field<TParent, TOutput, TInput, TDependencies>;
|
|
220
|
+
resolve<TParent$1 extends GraphQLSilk>(resolve: (parent: TDependencies$1 extends string[] ? RequireKeys<NonNullable<StandardSchemaV1.InferOutput<TParent$1>>, TDependencies$1[number]> : NonNullable<StandardSchemaV1.InferOutput<TParent$1>>, input: InferInputO<TInput$1>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput$1>>): Field<TParent$1, TOutput$1, TInput$1, TDependencies$1>;
|
|
263
221
|
/**
|
|
264
222
|
* Creates a field resolver that uses DataLoader for batch loading data.
|
|
265
223
|
* This method is particularly useful for optimizing performance when dealing with multiple data requests
|
|
@@ -269,15 +227,15 @@ declare class FieldChainFactory<TOutput extends GraphQLSilk = never, TInput exte
|
|
|
269
227
|
* @param resolve - A function that handles batch loading of data.
|
|
270
228
|
* @returns A GraphQL field resolver that implements batch loading
|
|
271
229
|
*/
|
|
272
|
-
load<TParent extends GraphQLSilk>(resolve: (parents: InferParent<TParent, TDependencies>[], input: InferInputO<TInput>, payloads: (ResolverPayload | undefined)[]) => MayPromise<StandardSchemaV1.InferOutput<TOutput>[]>): Field<TParent, TOutput, TInput, TDependencies>;
|
|
230
|
+
load<TParent$1 extends GraphQLSilk>(resolve: (parents: InferParent<TParent$1, TDependencies$1>[], input: InferInputO<TInput$1>, payloads: (ResolverPayload | undefined)[]) => MayPromise<StandardSchemaV1.InferOutput<TOutput$1>[]>): Field<TParent$1, TOutput$1, TInput$1, TDependencies$1>;
|
|
273
231
|
}
|
|
274
|
-
type InferParent<TParent extends GraphQLSilk, TDependencies extends string[] | undefined = undefined> = TDependencies extends string[] ? RequireKeys<NonNullable<StandardSchemaV1.InferOutput<TParent>>, TDependencies[number]> : NonNullable<StandardSchemaV1.InferOutput<TParent>>;
|
|
232
|
+
type InferParent<TParent$1 extends GraphQLSilk, TDependencies$1 extends string[] | undefined = undefined> = TDependencies$1 extends string[] ? RequireKeys<NonNullable<StandardSchemaV1.InferOutput<TParent$1>>, TDependencies$1[number]> : NonNullable<StandardSchemaV1.InferOutput<TParent$1>>;
|
|
275
233
|
/**
|
|
276
234
|
* Factory for creating query resolvers with chainable configuration
|
|
277
235
|
* @template TOutput - The output type of the query
|
|
278
236
|
* @template TInput - The input type of the query
|
|
279
237
|
*/
|
|
280
|
-
declare class QueryChainFactory<TOutput extends GraphQLSilk = never, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void> extends BaseChainFactory<Query<TOutput, TInput>> implements IChainFactory<TOutput, TInput> {
|
|
238
|
+
declare class QueryChainFactory<TOutput$1 extends GraphQLSilk = never, TInput$1 extends GraphQLSilk | Record<string, GraphQLSilk> | void = void> extends BaseChainFactory<Query<TOutput$1, TInput$1>> implements IChainFactory<TOutput$1, TInput$1> {
|
|
281
239
|
/**
|
|
282
240
|
* Returns the available methods for the query chain factory
|
|
283
241
|
* @returns An object containing all available methods
|
|
@@ -295,28 +253,28 @@ declare class QueryChainFactory<TOutput extends GraphQLSilk = never, TInput exte
|
|
|
295
253
|
* @param output - The output type definition
|
|
296
254
|
* @returns A new QueryChainFactory instance with the updated output type
|
|
297
255
|
*/
|
|
298
|
-
output<TOutputNew extends GraphQLSilk>(output: TOutputNew): QueryChainFactory<TOutputNew, TInput>;
|
|
256
|
+
output<TOutputNew extends GraphQLSilk>(output: TOutputNew): QueryChainFactory<TOutputNew, TInput$1>;
|
|
299
257
|
/**
|
|
300
258
|
* Sets the input type for the query
|
|
301
259
|
* @template TInputNew - The new input type
|
|
302
260
|
* @param input - The input type definition
|
|
303
261
|
* @returns A new QueryChainFactory instance with the updated input type
|
|
304
262
|
*/
|
|
305
|
-
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): QueryChainFactory<TOutput, TInputNew>;
|
|
263
|
+
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): QueryChainFactory<TOutput$1, TInputNew>;
|
|
306
264
|
/**
|
|
307
265
|
* Sets the resolve function for the query
|
|
308
266
|
* @param resolve - The resolve function that processes the input and returns the output
|
|
309
267
|
* @returns A GraphQL query resolver
|
|
310
268
|
* @throws {Error} If output type is not set
|
|
311
269
|
*/
|
|
312
|
-
resolve(resolve: (input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>): Query<TOutput, TInput>;
|
|
270
|
+
resolve(resolve: (input: InferInputO<TInput$1>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput$1>>): Query<TOutput$1, TInput$1>;
|
|
313
271
|
}
|
|
314
272
|
/**
|
|
315
273
|
* Factory for creating mutation resolvers with chainable configuration
|
|
316
274
|
* @template TOutput - The output type of the mutation
|
|
317
275
|
* @template TInput - The input type of the mutation
|
|
318
276
|
*/
|
|
319
|
-
declare class MutationChainFactory<TOutput extends GraphQLSilk = never, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined> extends BaseChainFactory<Mutation<TOutput, TInput>> implements IChainFactory<TOutput, TInput> {
|
|
277
|
+
declare class MutationChainFactory<TOutput$1 extends GraphQLSilk = never, TInput$1 extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined> extends BaseChainFactory<Mutation<TOutput$1, TInput$1>> implements IChainFactory<TOutput$1, TInput$1> {
|
|
320
278
|
/**
|
|
321
279
|
* Returns the available methods for the mutation chain factory
|
|
322
280
|
* @returns An object containing all available methods
|
|
@@ -334,28 +292,28 @@ declare class MutationChainFactory<TOutput extends GraphQLSilk = never, TInput e
|
|
|
334
292
|
* @param output - The output type definition
|
|
335
293
|
* @returns A new MutationChainFactory instance with the updated output type
|
|
336
294
|
*/
|
|
337
|
-
output<TOutputNew extends GraphQLSilk>(output: TOutputNew): MutationChainFactory<TOutputNew, TInput>;
|
|
295
|
+
output<TOutputNew extends GraphQLSilk>(output: TOutputNew): MutationChainFactory<TOutputNew, TInput$1>;
|
|
338
296
|
/**
|
|
339
297
|
* Sets the input type for the mutation
|
|
340
298
|
* @template TInputNew - The new input type
|
|
341
299
|
* @param input - The input type definition
|
|
342
300
|
* @returns A new MutationChainFactory instance with the updated input type
|
|
343
301
|
*/
|
|
344
|
-
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): MutationChainFactory<TOutput, TInputNew>;
|
|
302
|
+
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): MutationChainFactory<TOutput$1, TInputNew>;
|
|
345
303
|
/**
|
|
346
304
|
* Sets the resolve function for the mutation
|
|
347
305
|
* @param resolve - The resolve function that processes the input and returns the output
|
|
348
306
|
* @returns A GraphQL mutation resolver
|
|
349
307
|
* @throws {Error} If output type is not set
|
|
350
308
|
*/
|
|
351
|
-
resolve(resolve: (input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>): Mutation<TOutput, TInput>;
|
|
309
|
+
resolve(resolve: (input: InferInputO<TInput$1>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput$1>>): Mutation<TOutput$1, TInput$1>;
|
|
352
310
|
}
|
|
353
311
|
/**
|
|
354
312
|
* Factory for creating subscription resolvers with chainable configuration
|
|
355
313
|
* @template TOutput - The output type of the subscription
|
|
356
314
|
* @template TInput - The input type of the subscription
|
|
357
315
|
*/
|
|
358
|
-
declare class SubscriptionChainFactory<TOutput extends GraphQLSilk = never, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined> extends BaseChainFactory<Subscription<TOutput, TInput, any>> implements IChainFactory<TOutput, TInput> {
|
|
316
|
+
declare class SubscriptionChainFactory<TOutput$1 extends GraphQLSilk = never, TInput$1 extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined> extends BaseChainFactory<Subscription<TOutput$1, TInput$1, any>> implements IChainFactory<TOutput$1, TInput$1> {
|
|
359
317
|
/**
|
|
360
318
|
* Returns the available methods for the subscription chain factory
|
|
361
319
|
* @returns An object containing all available methods
|
|
@@ -373,14 +331,14 @@ declare class SubscriptionChainFactory<TOutput extends GraphQLSilk = never, TInp
|
|
|
373
331
|
* @param output - The output type definition
|
|
374
332
|
* @returns A new SubscriptionChainFactory instance with the updated output type
|
|
375
333
|
*/
|
|
376
|
-
output<TOutputNew extends GraphQLSilk>(output: TOutputNew): SubscriptionChainFactory<TOutputNew, TInput>;
|
|
334
|
+
output<TOutputNew extends GraphQLSilk>(output: TOutputNew): SubscriptionChainFactory<TOutputNew, TInput$1>;
|
|
377
335
|
/**
|
|
378
336
|
* Sets the input type for the subscription
|
|
379
337
|
* @template TInputNew - The new input type
|
|
380
338
|
* @param input - The input type definition
|
|
381
339
|
* @returns A new SubscriptionChainFactory instance with the updated input type
|
|
382
340
|
*/
|
|
383
|
-
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): SubscriptionChainFactory<TOutput, TInputNew>;
|
|
341
|
+
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): SubscriptionChainFactory<TOutput$1, TInputNew>;
|
|
384
342
|
/**
|
|
385
343
|
* Sets the subscribe function for the subscription
|
|
386
344
|
* @template TValue - The value type of the subscription
|
|
@@ -388,7 +346,7 @@ declare class SubscriptionChainFactory<TOutput extends GraphQLSilk = never, TInp
|
|
|
388
346
|
* @returns A subscription resolver that can be further configured with a resolve function
|
|
389
347
|
* @throws {Error} If output type is not set
|
|
390
348
|
*/
|
|
391
|
-
subscribe<TValue = StandardSchemaV1.InferOutput<TOutput>>(subscribe: (input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<AsyncIterator<TValue>>): TValue extends StandardSchemaV1.InferOutput<TOutput> ? ResolvableSubscription<TOutput, TInput, TValue> : SubscriptionNeedResolve<TOutput, TInput, TValue>;
|
|
349
|
+
subscribe<TValue = StandardSchemaV1.InferOutput<TOutput$1>>(subscribe: (input: InferInputO<TInput$1>, payload: ResolverPayload | undefined) => MayPromise<AsyncIterator<TValue>>): TValue extends StandardSchemaV1.InferOutput<TOutput$1> ? ResolvableSubscription<TOutput$1, TInput$1, TValue> : SubscriptionNeedResolve<TOutput$1, TInput$1, TValue>;
|
|
392
350
|
}
|
|
393
351
|
/**
|
|
394
352
|
* Interface for a subscription that can be resolved
|
|
@@ -396,12 +354,12 @@ declare class SubscriptionChainFactory<TOutput extends GraphQLSilk = never, TInp
|
|
|
396
354
|
* @template TInput - The input type of the subscription
|
|
397
355
|
* @template TValue - The value type of the subscription
|
|
398
356
|
*/
|
|
399
|
-
interface ResolvableSubscription<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined, TValue = StandardSchemaV1.InferOutput<TOutput>> extends Subscription<TOutput, TInput, TValue> {
|
|
357
|
+
interface ResolvableSubscription<TOutput$1 extends GraphQLSilk, TInput$1 extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined, TValue = StandardSchemaV1.InferOutput<TOutput$1>> extends Subscription<TOutput$1, TInput$1, TValue> {
|
|
400
358
|
/**
|
|
401
359
|
* Sets the resolve function for the subscription
|
|
402
360
|
* @param resolve - The resolve function
|
|
403
361
|
*/
|
|
404
|
-
resolve(resolve: (value: TValue, input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>): Subscription<TOutput, TInput, TValue>;
|
|
362
|
+
resolve(resolve: (value: TValue, input: InferInputO<TInput$1>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput$1>>): Subscription<TOutput$1, TInput$1, TValue>;
|
|
405
363
|
}
|
|
406
364
|
/**
|
|
407
365
|
* A subscription that can not be resolved yet, still needs to be resolved.
|
|
@@ -410,39 +368,39 @@ interface ResolvableSubscription<TOutput extends GraphQLSilk, TInput extends Gra
|
|
|
410
368
|
* @template TInput - The input type of the subscription
|
|
411
369
|
* @template TValue - The value type of the subscription
|
|
412
370
|
*/
|
|
413
|
-
interface SubscriptionNeedResolve<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined, TValue = StandardSchemaV1.InferOutput<TOutput>> {
|
|
371
|
+
interface SubscriptionNeedResolve<TOutput$1 extends GraphQLSilk, TInput$1 extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined, TValue = StandardSchemaV1.InferOutput<TOutput$1>> {
|
|
414
372
|
/**
|
|
415
373
|
* Sets the resolve function for the subscription
|
|
416
374
|
* @param resolve - The resolve function
|
|
417
375
|
*/
|
|
418
|
-
resolve(resolve: (value: TValue, input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>): Subscription<TOutput, TInput, TValue>;
|
|
419
|
-
}
|
|
420
|
-
declare class QueryFactoryWithResolve<TInputO, TOutput extends GraphQLSilk, TInput extends GraphQLSilk<TInputO>> extends BaseChainFactory<Query<TOutput, TInput>> implements Query<TOutput, TInput> {
|
|
421
|
-
protected outputSilk: TOutput;
|
|
422
|
-
protected readonly options: QueryOptions<TOutput, TInput>;
|
|
423
|
-
get "~meta"(): Query<TOutput, TInput>["~meta"];
|
|
424
|
-
constructor(outputSilk: TOutput, options: QueryOptions<TOutput, TInput>);
|
|
425
|
-
protected clone(options?: Partial<QueryOptions<TOutput, TInput>> | undefined): this;
|
|
426
|
-
input<TInputNew extends GraphQLSilk<TInputO>>(input: TInputNew): QueryFactoryWithResolve<TInputO, TOutput, TInputNew>;
|
|
427
|
-
output<TOutputNew extends GraphQLSilk>(output: TOutputNew, transform: (output: StandardSchemaV1.InferOutput<TOutput>) => MayPromise<StandardSchemaV1.InferOutput<TOutputNew>>): QueryFactoryWithResolve<TInputO, TOutputNew, TInput>;
|
|
428
|
-
}
|
|
429
|
-
declare class MutationFactoryWithResolve<TInputO, TOutput extends GraphQLSilk, TInput extends GraphQLSilk<TInputO>> extends BaseChainFactory<Query<TOutput, TInput>> implements Mutation<TOutput, TInput> {
|
|
430
|
-
protected outputSilk: TOutput;
|
|
431
|
-
protected readonly options: MutationOptions<TOutput, TInput>;
|
|
432
|
-
get "~meta"(): Mutation<TOutput, TInput>["~meta"];
|
|
433
|
-
constructor(outputSilk: TOutput, options: MutationOptions<TOutput, TInput>);
|
|
434
|
-
protected clone(options?: Partial<MutationOptions<TOutput, TInput>> | undefined): this;
|
|
435
|
-
input<TInputNew extends GraphQLSilk<TInputO>>(input: TInputNew): MutationFactoryWithResolve<TInputO, TOutput, TInputNew>;
|
|
436
|
-
output<TOutputNew extends GraphQLSilk>(output: TOutputNew, transform: (output: StandardSchemaV1.InferOutput<TOutput>) => MayPromise<StandardSchemaV1.InferOutput<TOutputNew>>): MutationFactoryWithResolve<TInputO, TOutputNew, TInput>;
|
|
437
|
-
}
|
|
438
|
-
declare class FieldFactoryWithResolve<TParent extends GraphQLSilk, TOutput extends GraphQLSilk, TInputO = never, TInput extends GraphQLSilk<TInputO> | void = void> extends BaseChainFactory<Field<TParent, TOutput, TInput, string[] | undefined>> {
|
|
439
|
-
protected outputSilk: TOutput;
|
|
440
|
-
protected readonly options: FieldOptions<TParent, TOutput, TInput, string[] | undefined>;
|
|
441
|
-
get "~meta"(): Field<TParent, TOutput, TInput, string[] | undefined>["~meta"];
|
|
442
|
-
constructor(outputSilk: TOutput, options: FieldOptions<TParent, TOutput, TInput, string[] | undefined>);
|
|
443
|
-
protected clone(options?: Partial<FieldOptions<TParent, TOutput, TInput, string[] | undefined>> | undefined): this;
|
|
444
|
-
input<TInputNew extends GraphQLSilk<TInputO>>(input: TInputNew): FieldFactoryWithResolve<TParent, TOutput, TInputO, TInputNew>;
|
|
445
|
-
output<TOutputNew extends GraphQLSilk>(output: TOutputNew, transform: (output: StandardSchemaV1.InferOutput<TOutput>) => MayPromise<StandardSchemaV1.InferOutput<TOutputNew>>): FieldFactoryWithResolve<TParent, TOutputNew, TInputO, TInput>;
|
|
376
|
+
resolve(resolve: (value: TValue, input: InferInputO<TInput$1>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput$1>>): Subscription<TOutput$1, TInput$1, TValue>;
|
|
377
|
+
}
|
|
378
|
+
declare class QueryFactoryWithResolve<TInputO, TOutput$1 extends GraphQLSilk, TInput$1 extends GraphQLSilk<TInputO>> extends BaseChainFactory<Query<TOutput$1, TInput$1>> implements Query<TOutput$1, TInput$1> {
|
|
379
|
+
protected outputSilk: TOutput$1;
|
|
380
|
+
protected readonly options: QueryOptions<TOutput$1, TInput$1>;
|
|
381
|
+
get "~meta"(): Query<TOutput$1, TInput$1>["~meta"];
|
|
382
|
+
constructor(outputSilk: TOutput$1, options: QueryOptions<TOutput$1, TInput$1>);
|
|
383
|
+
protected clone(options?: Partial<QueryOptions<TOutput$1, TInput$1>> | undefined): this;
|
|
384
|
+
input<TInputNew extends GraphQLSilk<TInputO>>(input: TInputNew): QueryFactoryWithResolve<TInputO, TOutput$1, TInputNew>;
|
|
385
|
+
output<TOutputNew extends GraphQLSilk>(output: TOutputNew, transform: (output: StandardSchemaV1.InferOutput<TOutput$1>) => MayPromise<StandardSchemaV1.InferOutput<TOutputNew>>): QueryFactoryWithResolve<TInputO, TOutputNew, TInput$1>;
|
|
386
|
+
}
|
|
387
|
+
declare class MutationFactoryWithResolve<TInputO, TOutput$1 extends GraphQLSilk, TInput$1 extends GraphQLSilk<TInputO>> extends BaseChainFactory<Query<TOutput$1, TInput$1>> implements Mutation<TOutput$1, TInput$1> {
|
|
388
|
+
protected outputSilk: TOutput$1;
|
|
389
|
+
protected readonly options: MutationOptions<TOutput$1, TInput$1>;
|
|
390
|
+
get "~meta"(): Mutation<TOutput$1, TInput$1>["~meta"];
|
|
391
|
+
constructor(outputSilk: TOutput$1, options: MutationOptions<TOutput$1, TInput$1>);
|
|
392
|
+
protected clone(options?: Partial<MutationOptions<TOutput$1, TInput$1>> | undefined): this;
|
|
393
|
+
input<TInputNew extends GraphQLSilk<TInputO>>(input: TInputNew): MutationFactoryWithResolve<TInputO, TOutput$1, TInputNew>;
|
|
394
|
+
output<TOutputNew extends GraphQLSilk>(output: TOutputNew, transform: (output: StandardSchemaV1.InferOutput<TOutput$1>) => MayPromise<StandardSchemaV1.InferOutput<TOutputNew>>): MutationFactoryWithResolve<TInputO, TOutputNew, TInput$1>;
|
|
395
|
+
}
|
|
396
|
+
declare class FieldFactoryWithResolve<TParent$1 extends GraphQLSilk, TOutput$1 extends GraphQLSilk, TInputO = never, TInput$1 extends GraphQLSilk<TInputO> | void = void> extends BaseChainFactory<Field<TParent$1, TOutput$1, TInput$1, string[] | undefined>> {
|
|
397
|
+
protected outputSilk: TOutput$1;
|
|
398
|
+
protected readonly options: FieldOptions<TParent$1, TOutput$1, TInput$1, string[] | undefined>;
|
|
399
|
+
get "~meta"(): Field<TParent$1, TOutput$1, TInput$1, string[] | undefined>["~meta"];
|
|
400
|
+
constructor(outputSilk: TOutput$1, options: FieldOptions<TParent$1, TOutput$1, TInput$1, string[] | undefined>);
|
|
401
|
+
protected clone(options?: Partial<FieldOptions<TParent$1, TOutput$1, TInput$1, string[] | undefined>> | undefined): this;
|
|
402
|
+
input<TInputNew extends GraphQLSilk<TInputO>>(input: TInputNew): FieldFactoryWithResolve<TParent$1, TOutput$1, TInputO, TInputNew>;
|
|
403
|
+
output<TOutputNew extends GraphQLSilk>(output: TOutputNew, transform: (output: StandardSchemaV1.InferOutput<TOutput$1>) => MayPromise<StandardSchemaV1.InferOutput<TOutputNew>>): FieldFactoryWithResolve<TParent$1, TOutputNew, TInputO, TInput$1>;
|
|
446
404
|
}
|
|
447
405
|
declare namespace types_loom_d_exports {
|
|
448
406
|
export { BaseField, Field, FieldMeta, FieldOrOperation, Mutation, Operation, Query, Resolver, Subscription };
|
|
@@ -458,51 +416,51 @@ interface FieldMeta extends GraphQLFieldOptions {
|
|
|
458
416
|
interface BaseField {
|
|
459
417
|
readonly "~meta": FieldMeta;
|
|
460
418
|
}
|
|
461
|
-
interface Field<TParent extends GraphQLSilk, TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void, TDependencies extends string[] | undefined = undefined> extends BaseField {
|
|
419
|
+
interface Field<TParent$1 extends GraphQLSilk, TOutput$1 extends GraphQLSilk, TInput$1 extends GraphQLSilk | Record<string, GraphQLSilk> | void = void, TDependencies$1 extends string[] | undefined = undefined> extends BaseField {
|
|
462
420
|
"~meta": {
|
|
463
421
|
operation: "field";
|
|
464
|
-
output: TOutput;
|
|
465
|
-
input: TInput;
|
|
422
|
+
output: TOutput$1;
|
|
423
|
+
input: TInput$1;
|
|
466
424
|
middlewares?: Middleware[];
|
|
467
|
-
dependencies?: TDependencies;
|
|
425
|
+
dependencies?: TDependencies$1;
|
|
468
426
|
types?: {
|
|
469
|
-
parent: ReSilk<TParent>;
|
|
427
|
+
parent: ReSilk<TParent$1>;
|
|
470
428
|
};
|
|
471
|
-
resolve: (parent: StandardSchemaV1.InferOutput<NonNullable<TParent>>, input: InferInputO<TInput>, payload: ResolverPayload | void) => Promise<StandardSchemaV1.InferOutput<TOutput>>;
|
|
429
|
+
resolve: (parent: StandardSchemaV1.InferOutput<NonNullable<TParent$1>>, input: InferInputO<TInput$1>, payload: ResolverPayload | void) => Promise<StandardSchemaV1.InferOutput<TOutput$1>>;
|
|
472
430
|
} & GraphQLFieldOptions;
|
|
473
431
|
}
|
|
474
|
-
interface Query<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void> extends BaseField {
|
|
432
|
+
interface Query<TOutput$1 extends GraphQLSilk, TInput$1 extends GraphQLSilk | Record<string, GraphQLSilk> | void = void> extends BaseField {
|
|
475
433
|
"~meta": {
|
|
476
434
|
operation: "query";
|
|
477
435
|
parent?: undefined;
|
|
478
|
-
output: TOutput;
|
|
479
|
-
input: TInput;
|
|
436
|
+
output: TOutput$1;
|
|
437
|
+
input: TInput$1;
|
|
480
438
|
middlewares?: Middleware[];
|
|
481
|
-
resolve: (input: InferInputO<TInput>, payload: ResolverPayload | void) => Promise<StandardSchemaV1.InferOutput<TOutput>>;
|
|
439
|
+
resolve: (input: InferInputO<TInput$1>, payload: ResolverPayload | void) => Promise<StandardSchemaV1.InferOutput<TOutput$1>>;
|
|
482
440
|
} & GraphQLFieldOptions;
|
|
483
441
|
}
|
|
484
|
-
interface Mutation<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void> extends BaseField {
|
|
442
|
+
interface Mutation<TOutput$1 extends GraphQLSilk, TInput$1 extends GraphQLSilk | Record<string, GraphQLSilk> | void = void> extends BaseField {
|
|
485
443
|
"~meta": {
|
|
486
444
|
operation: "mutation";
|
|
487
445
|
parent?: undefined;
|
|
488
|
-
output: TOutput;
|
|
489
|
-
input: TInput;
|
|
446
|
+
output: TOutput$1;
|
|
447
|
+
input: TInput$1;
|
|
490
448
|
middlewares?: Middleware[];
|
|
491
|
-
resolve: (input: InferInputO<TInput>, payload: ResolverPayload | void) => Promise<StandardSchemaV1.InferOutput<TOutput>>;
|
|
449
|
+
resolve: (input: InferInputO<TInput$1>, payload: ResolverPayload | void) => Promise<StandardSchemaV1.InferOutput<TOutput$1>>;
|
|
492
450
|
} & GraphQLFieldOptions;
|
|
493
451
|
}
|
|
494
|
-
interface Subscription<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void, TValue = StandardSchemaV1.InferOutput<TOutput>> extends BaseField {
|
|
452
|
+
interface Subscription<TOutput$1 extends GraphQLSilk, TInput$1 extends GraphQLSilk | Record<string, GraphQLSilk> | void = void, TValue = StandardSchemaV1.InferOutput<TOutput$1>> extends BaseField {
|
|
495
453
|
"~meta": {
|
|
496
454
|
operation: "subscription";
|
|
497
455
|
parent?: undefined;
|
|
498
|
-
output: TOutput;
|
|
499
|
-
input: TInput;
|
|
456
|
+
output: TOutput$1;
|
|
457
|
+
input: TInput$1;
|
|
500
458
|
middlewares?: Middleware[];
|
|
501
459
|
types?: {
|
|
502
460
|
value: TValue;
|
|
503
461
|
} & GraphQLFieldOptions;
|
|
504
|
-
resolve: (value: TValue, input: InferInputO<TInput>, payload: ResolverPayload | void) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>;
|
|
505
|
-
subscribe: (input: InferInputO<TInput>, payload: ResolverPayload | void) => MayPromise<AsyncIterator<TValue>>;
|
|
462
|
+
resolve: (value: TValue, input: InferInputO<TInput$1>, payload: ResolverPayload | void) => MayPromise<StandardSchemaV1.InferOutput<TOutput$1>>;
|
|
463
|
+
subscribe: (input: InferInputO<TInput$1>, payload: ResolverPayload | void) => MayPromise<AsyncIterator<TValue>>;
|
|
506
464
|
} & GraphQLFieldOptions;
|
|
507
465
|
}
|
|
508
466
|
interface Resolver {
|
|
@@ -515,14 +473,18 @@ interface Resolver {
|
|
|
515
473
|
}
|
|
516
474
|
type Operation = Query<GraphQLSilk, GraphQLSilk | Record<string, GraphQLSilk> | void> | Mutation<GraphQLSilk, GraphQLSilk | Record<string, GraphQLSilk> | void> | Subscription<GraphQLSilk, GraphQLSilk | Record<string, GraphQLSilk> | void, any>;
|
|
517
475
|
type FieldOrOperation = Field<GraphQLSilk, GraphQLSilk, GraphQLSilk | Record<string, GraphQLSilk> | void, string[] | undefined> | Operation;
|
|
518
|
-
type ReSilk<T extends GraphQLSilk> = GraphQLSilk<NonNullable<T["~standard"]["types"]>["output"], NonNullable<T["~standard"]["types"]>["input"]>;
|
|
476
|
+
type ReSilk<T$1 extends GraphQLSilk> = GraphQLSilk<NonNullable<T$1["~standard"]["types"]>["output"], NonNullable<T$1["~standard"]["types"]>["input"]>;
|
|
519
477
|
//#endregion
|
|
520
478
|
//#region src/resolver/types.d.ts
|
|
521
|
-
interface GraphQLSilk<TOutput = any, TInput = any> extends StandardSchemaV1<TInput, TOutput> {
|
|
479
|
+
interface GraphQLSilk<TOutput$1 = any, TInput$1 = any> extends StandardSchemaV1<TInput$1, TOutput$1> {
|
|
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>[];
|
|
@@ -542,33 +504,33 @@ type InferFieldOutput<TField extends BaseField> = TField["~meta"]["output"];
|
|
|
542
504
|
/**
|
|
543
505
|
* Options for creating a GraphQL Query.
|
|
544
506
|
*/
|
|
545
|
-
interface QueryOptions<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void> extends ResolverOptions<Query<TOutput, TInput>>, GraphQLFieldOptions {
|
|
546
|
-
input?: TInput;
|
|
547
|
-
resolve: (input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>;
|
|
507
|
+
interface QueryOptions<TOutput$1 extends GraphQLSilk, TInput$1 extends GraphQLSilk | Record<string, GraphQLSilk> | void = void> extends ResolverOptions<Query<TOutput$1, TInput$1>>, GraphQLFieldOptions {
|
|
508
|
+
input?: TInput$1;
|
|
509
|
+
resolve: (input: InferInputO<TInput$1>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput$1>>;
|
|
548
510
|
}
|
|
549
511
|
/**
|
|
550
512
|
* Options for creating a GraphQL Mutation.
|
|
551
513
|
*/
|
|
552
|
-
interface MutationOptions<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined> extends ResolverOptions<Mutation<TOutput, TInput>>, GraphQLFieldOptions {
|
|
553
|
-
input?: TInput;
|
|
554
|
-
resolve: (input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>;
|
|
514
|
+
interface MutationOptions<TOutput$1 extends GraphQLSilk, TInput$1 extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined> extends ResolverOptions<Mutation<TOutput$1, TInput$1>>, GraphQLFieldOptions {
|
|
515
|
+
input?: TInput$1;
|
|
516
|
+
resolve: (input: InferInputO<TInput$1>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput$1>>;
|
|
555
517
|
}
|
|
556
518
|
/**
|
|
557
519
|
* Function to create a GraphQL query.
|
|
558
520
|
*/
|
|
559
521
|
interface QueryFactory {
|
|
560
|
-
<TOutput extends GraphQLSilk>(output: TOutput, resolve: (input: void, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>): Query<TOutput, void>;
|
|
561
|
-
<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void>(output: TOutput, options: QueryOptions<TOutput, TInput>): Query<TOutput, TInput>;
|
|
562
|
-
<TOutput extends GraphQLSilk>(output: TOutput): QueryChainFactory<TOutput, void>;
|
|
522
|
+
<TOutput$1 extends GraphQLSilk>(output: TOutput$1, resolve: (input: void, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput$1>>): Query<TOutput$1, void>;
|
|
523
|
+
<TOutput$1 extends GraphQLSilk, TInput$1 extends GraphQLSilk | Record<string, GraphQLSilk> | void = void>(output: TOutput$1, options: QueryOptions<TOutput$1, TInput$1>): Query<TOutput$1, TInput$1>;
|
|
524
|
+
<TOutput$1 extends GraphQLSilk>(output: TOutput$1): QueryChainFactory<TOutput$1, void>;
|
|
563
525
|
}
|
|
564
526
|
interface QueryFactoryWithChain extends QueryFactory, QueryChainFactory<never, void> {}
|
|
565
527
|
/**
|
|
566
528
|
* Function to create a GraphQL mutation.
|
|
567
529
|
*/
|
|
568
530
|
interface MutationFactory {
|
|
569
|
-
<TOutput extends GraphQLSilk>(output: TOutput, resolve: (input: void, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>): Mutation<TOutput, undefined>;
|
|
570
|
-
<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined>(output: TOutput, options: MutationOptions<TOutput, TInput>): Mutation<TOutput, TInput>;
|
|
571
|
-
<TOutput extends GraphQLSilk>(output: TOutput): MutationChainFactory<TOutput, undefined>;
|
|
531
|
+
<TOutput$1 extends GraphQLSilk>(output: TOutput$1, resolve: (input: void, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput$1>>): Mutation<TOutput$1, undefined>;
|
|
532
|
+
<TOutput$1 extends GraphQLSilk, TInput$1 extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined>(output: TOutput$1, options: MutationOptions<TOutput$1, TInput$1>): Mutation<TOutput$1, TInput$1>;
|
|
533
|
+
<TOutput$1 extends GraphQLSilk>(output: TOutput$1): MutationChainFactory<TOutput$1, undefined>;
|
|
572
534
|
}
|
|
573
535
|
/**
|
|
574
536
|
* Function to create a GraphQL mutation.
|
|
@@ -577,28 +539,28 @@ interface MutationFactoryWithChain extends MutationFactory, MutationChainFactory
|
|
|
577
539
|
/**
|
|
578
540
|
* Options for External Filed of existing GraphQL Object.
|
|
579
541
|
*/
|
|
580
|
-
interface FieldOptions<TParent extends GraphQLSilk, TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void, TDependencies extends string[] | undefined = undefined> extends ResolverOptions<Field<TParent, TOutput, TInput, TDependencies>>, GraphQLFieldOptions {
|
|
581
|
-
input?: TInput;
|
|
582
|
-
dependencies?: TDependencies;
|
|
583
|
-
resolve: (parent: TDependencies extends string[] ? RequireKeys<NonNullable<StandardSchemaV1.InferOutput<TParent>>, TDependencies[number]> : NonNullable<StandardSchemaV1.InferOutput<TParent>>, input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>;
|
|
542
|
+
interface FieldOptions<TParent$1 extends GraphQLSilk, TOutput$1 extends GraphQLSilk, TInput$1 extends GraphQLSilk | Record<string, GraphQLSilk> | void = void, TDependencies$1 extends string[] | undefined = undefined> extends ResolverOptions<Field<TParent$1, TOutput$1, TInput$1, TDependencies$1>>, GraphQLFieldOptions {
|
|
543
|
+
input?: TInput$1;
|
|
544
|
+
dependencies?: TDependencies$1;
|
|
545
|
+
resolve: (parent: TDependencies$1 extends string[] ? RequireKeys<NonNullable<StandardSchemaV1.InferOutput<TParent$1>>, TDependencies$1[number]> : NonNullable<StandardSchemaV1.InferOutput<TParent$1>>, input: InferInputO<TInput$1>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput$1>>;
|
|
584
546
|
}
|
|
585
547
|
/**
|
|
586
548
|
* Function to create a GraphQL Field.
|
|
587
549
|
*/
|
|
588
550
|
interface FieldFactory {
|
|
589
|
-
<TParent extends GraphQLSilk, TOutput extends GraphQLSilk>(output: TOutput, resolve: (parent: StandardSchemaV1.InferOutput<TParent>, input: void, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>): Field<TParent, TOutput, undefined, undefined>;
|
|
590
|
-
<TParent extends GraphQLSilk, TOutput extends GraphQLSilk>(output: TOutput, options: FieldOptions<TParent, TOutput, undefined, undefined>): Field<TParent, TOutput, undefined, undefined>;
|
|
591
|
-
<TParent extends GraphQLSilk, TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | undefined>(output: TOutput, options: FieldOptions<TParent, TOutput, TInput, undefined> & {
|
|
592
|
-
input: TInput;
|
|
593
|
-
}): Field<TParent, TOutput, TInput, undefined>;
|
|
594
|
-
<TParent extends GraphQLSilk, TOutput extends GraphQLSilk, const TDependencies extends string[] | undefined>(output: TOutput, options: FieldOptions<TParent, TOutput, undefined, TDependencies> & {
|
|
595
|
-
dependencies: TDependencies;
|
|
596
|
-
}): Field<TParent, TOutput, undefined, TDependencies>;
|
|
597
|
-
<TParent extends GraphQLSilk, TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | undefined, TDependencies extends string[] | undefined>(output: TOutput, options: FieldOptions<TParent, TOutput, TInput, TDependencies> & {
|
|
598
|
-
input: TInput;
|
|
599
|
-
dependencies: TDependencies;
|
|
600
|
-
}): Field<TParent, TOutput, TInput, TDependencies>;
|
|
601
|
-
<TOutput extends GraphQLSilk>(output: TOutput): FieldChainFactory<TOutput, undefined, undefined>;
|
|
551
|
+
<TParent$1 extends GraphQLSilk, TOutput$1 extends GraphQLSilk>(output: TOutput$1, resolve: (parent: StandardSchemaV1.InferOutput<TParent$1>, input: void, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput$1>>): Field<TParent$1, TOutput$1, undefined, undefined>;
|
|
552
|
+
<TParent$1 extends GraphQLSilk, TOutput$1 extends GraphQLSilk>(output: TOutput$1, options: FieldOptions<TParent$1, TOutput$1, undefined, undefined>): Field<TParent$1, TOutput$1, undefined, undefined>;
|
|
553
|
+
<TParent$1 extends GraphQLSilk, TOutput$1 extends GraphQLSilk, TInput$1 extends GraphQLSilk | Record<string, GraphQLSilk> | undefined>(output: TOutput$1, options: FieldOptions<TParent$1, TOutput$1, TInput$1, undefined> & {
|
|
554
|
+
input: TInput$1;
|
|
555
|
+
}): Field<TParent$1, TOutput$1, TInput$1, undefined>;
|
|
556
|
+
<TParent$1 extends GraphQLSilk, TOutput$1 extends GraphQLSilk, const TDependencies$1 extends string[] | undefined>(output: TOutput$1, options: FieldOptions<TParent$1, TOutput$1, undefined, TDependencies$1> & {
|
|
557
|
+
dependencies: TDependencies$1;
|
|
558
|
+
}): Field<TParent$1, TOutput$1, undefined, TDependencies$1>;
|
|
559
|
+
<TParent$1 extends GraphQLSilk, TOutput$1 extends GraphQLSilk, TInput$1 extends GraphQLSilk | Record<string, GraphQLSilk> | undefined, TDependencies$1 extends string[] | undefined>(output: TOutput$1, options: FieldOptions<TParent$1, TOutput$1, TInput$1, TDependencies$1> & {
|
|
560
|
+
input: TInput$1;
|
|
561
|
+
dependencies: TDependencies$1;
|
|
562
|
+
}): Field<TParent$1, TOutput$1, TInput$1, TDependencies$1>;
|
|
563
|
+
<TOutput$1 extends GraphQLSilk>(output: TOutput$1): FieldChainFactory<TOutput$1, undefined, undefined>;
|
|
602
564
|
}
|
|
603
565
|
interface FieldFactoryWithUtils extends FieldFactory, FieldChainFactory<never, undefined, undefined> {
|
|
604
566
|
/** Set fields to be hidden in GraphQL Schema */
|
|
@@ -607,18 +569,18 @@ interface FieldFactoryWithUtils extends FieldFactory, FieldChainFactory<never, u
|
|
|
607
569
|
/**
|
|
608
570
|
* Options for creating a GraphQL Subscription.
|
|
609
571
|
*/
|
|
610
|
-
interface SubscriptionOptions<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined, TValue = StandardSchemaV1.InferOutput<TOutput>> extends ResolverOptions<Subscription<TOutput, TInput, TValue>>, GraphQLFieldOptions {
|
|
611
|
-
input?: TInput;
|
|
612
|
-
subscribe: (input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<AsyncIterator<TValue>>;
|
|
613
|
-
resolve?: (value: TValue, input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>;
|
|
572
|
+
interface SubscriptionOptions<TOutput$1 extends GraphQLSilk, TInput$1 extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined, TValue = StandardSchemaV1.InferOutput<TOutput$1>> extends ResolverOptions<Subscription<TOutput$1, TInput$1, TValue>>, GraphQLFieldOptions {
|
|
573
|
+
input?: TInput$1;
|
|
574
|
+
subscribe: (input: InferInputO<TInput$1>, payload: ResolverPayload | undefined) => MayPromise<AsyncIterator<TValue>>;
|
|
575
|
+
resolve?: (value: TValue, input: InferInputO<TInput$1>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput$1>>;
|
|
614
576
|
}
|
|
615
577
|
/**
|
|
616
578
|
* Function to create a GraphQL subscription.
|
|
617
579
|
*/
|
|
618
580
|
interface SubscriptionFactory {
|
|
619
|
-
<TOutput extends GraphQLSilk, TValue = StandardSchemaV1.InferOutput<TOutput>>(output: TOutput, subscribe: (payload: ResolverPayload | undefined) => MayPromise<AsyncIterator<StandardSchemaV1.InferOutput<TOutput>>>): Subscription<TOutput, undefined, TValue>;
|
|
620
|
-
<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined, TValue = StandardSchemaV1.InferOutput<TOutput>>(output: TOutput, options: SubscriptionOptions<TOutput, TInput, TValue>): Subscription<TOutput, TInput, TValue>;
|
|
621
|
-
<TOutput extends GraphQLSilk>(output: TOutput): SubscriptionChainFactory<TOutput, undefined>;
|
|
581
|
+
<TOutput$1 extends GraphQLSilk, TValue = StandardSchemaV1.InferOutput<TOutput$1>>(output: TOutput$1, subscribe: (payload: ResolverPayload | undefined) => MayPromise<AsyncIterator<StandardSchemaV1.InferOutput<TOutput$1>>>): Subscription<TOutput$1, undefined, TValue>;
|
|
582
|
+
<TOutput$1 extends GraphQLSilk, TInput$1 extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined, TValue = StandardSchemaV1.InferOutput<TOutput$1>>(output: TOutput$1, options: SubscriptionOptions<TOutput$1, TInput$1, TValue>): Subscription<TOutput$1, TInput$1, TValue>;
|
|
583
|
+
<TOutput$1 extends GraphQLSilk>(output: TOutput$1): SubscriptionChainFactory<TOutput$1, undefined>;
|
|
622
584
|
}
|
|
623
585
|
interface SubscriptionFactoryWithChain extends SubscriptionFactory, SubscriptionChainFactory<never, undefined> {}
|
|
624
586
|
/**
|
|
@@ -656,59 +618,262 @@ declare function getFieldOptions({
|
|
|
656
618
|
extensions
|
|
657
619
|
}: GraphQLFieldOptions, extraExtensions?: GraphQLFieldExtensions<any, any, any>): GraphQLFieldOptions;
|
|
658
620
|
//#endregion
|
|
659
|
-
//#region src/
|
|
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
|
|
660
626
|
/**
|
|
661
|
-
*
|
|
627
|
+
* Empty Resolver Arguments that only store the memoization
|
|
662
628
|
*/
|
|
663
|
-
|
|
629
|
+
interface OnlyMemoizationPayload {
|
|
630
|
+
memoization: WeakMap<WeakKey, any>;
|
|
631
|
+
isMemoization: true;
|
|
632
|
+
}
|
|
664
633
|
/**
|
|
665
|
-
* Create
|
|
634
|
+
* Create an empty memoization payload for the resolver
|
|
635
|
+
* @returns the empty memoization payload
|
|
666
636
|
*/
|
|
667
|
-
declare function
|
|
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>;
|
|
642
|
+
}
|
|
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$1>(func: () => T$1, ...locations: string[]): T$1;
|
|
668
648
|
/**
|
|
669
|
-
*
|
|
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"
|
|
670
657
|
*/
|
|
671
|
-
declare function
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
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)[]>;
|
|
662
|
+
/**
|
|
663
|
+
* GraphQL Loom built-in data loader.
|
|
664
|
+
*/
|
|
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>;
|
|
678
684
|
}
|
|
679
|
-
|
|
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$1> = T$1 | Promise<T$1>;
|
|
693
|
+
type IsAny<T$1> = 0 extends 1 & T$1 ? true : false;
|
|
694
|
+
type ValueOf<T$1 extends object> = T$1[keyof T$1];
|
|
695
|
+
type OmitInUnion<TUnion, TOmit> = TUnion extends infer T ? T extends TOmit ? never : T : never;
|
|
696
|
+
type RequireKeys<T$1, TKey extends string | number | symbol> = { [P in keyof T$1 as P extends TKey ? P : never]-?: T$1[P] } & { [P in keyof T$1 as P extends TKey ? never : P]: T$1[P] };
|
|
697
|
+
type MayGetter<T$1> = T$1 | (() => T$1);
|
|
698
|
+
//#endregion
|
|
699
|
+
//#region src/utils/middleware.d.ts
|
|
680
700
|
/**
|
|
681
|
-
*
|
|
701
|
+
* The operation of the field:
|
|
702
|
+
* - `field`
|
|
703
|
+
* - `query`
|
|
704
|
+
* - `mutation`
|
|
705
|
+
* - `subscription.resolve`
|
|
706
|
+
* - `subscription.subscribe`
|
|
707
|
+
* - `resolveReference`
|
|
682
708
|
*/
|
|
683
|
-
|
|
684
|
-
|
|
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
|
|
685
740
|
/**
|
|
686
|
-
*
|
|
741
|
+
* Creates an object map with the same keys as `map` and values generated by
|
|
742
|
+
* running each value of `record` thru `fn`.
|
|
687
743
|
*/
|
|
688
|
-
declare function
|
|
689
|
-
|
|
744
|
+
declare function mapValue<T$1, V>(record: Record<string, T$1>, fn: (value: T$1, key: string) => V | typeof mapValue.SKIP): Record<string, V>;
|
|
745
|
+
declare namespace mapValue {
|
|
746
|
+
var SKIP: unique symbol;
|
|
747
|
+
}
|
|
748
|
+
declare function toObjMap<T$1>(obj: Maybe<ReadOnlyObjMapLike<T$1>>): ReadOnlyObjMap<T$1>;
|
|
749
|
+
declare function notNullish<T$1>(x: T$1 | undefined | null): x is T$1;
|
|
750
|
+
declare function deepMerge<T$1 extends Record<string, any>>(...objects: (T$1 | null | undefined)[]): T$1;
|
|
690
751
|
/**
|
|
691
|
-
*
|
|
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" } }
|
|
692
761
|
*/
|
|
693
|
-
declare function
|
|
762
|
+
declare function meta<T$1>(data: T$1): {
|
|
763
|
+
"~meta": T$1;
|
|
764
|
+
};
|
|
765
|
+
type Maybe<T$1> = null | undefined | T$1;
|
|
766
|
+
type ReadOnlyObjMapLike<T$1> = ReadOnlyObjMap<T$1> | {
|
|
767
|
+
readonly [key: string]: T$1;
|
|
768
|
+
};
|
|
769
|
+
interface ReadOnlyObjMap<T$1> {
|
|
770
|
+
readonly [key: string]: T$1;
|
|
771
|
+
}
|
|
772
|
+
//#endregion
|
|
773
|
+
//#region src/utils/parse-resolving-fields.d.ts
|
|
694
774
|
/**
|
|
695
|
-
*
|
|
696
|
-
* @param silk GraphQL Silk
|
|
697
|
-
* @returns GraphQL Output Type
|
|
775
|
+
* Represents the state of field resolution in a GraphQL query.
|
|
698
776
|
*/
|
|
699
|
-
|
|
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
|
+
}
|
|
795
|
+
interface ResolvingFieldsOptions {
|
|
796
|
+
/**
|
|
797
|
+
* Whether to include GraphQL introspection/meta fields (names starting with "__").
|
|
798
|
+
* Default: false (filtered out).
|
|
799
|
+
*/
|
|
800
|
+
includeIntrospection?: boolean;
|
|
801
|
+
/**
|
|
802
|
+
* Maximum depth of nested fields to parse.
|
|
803
|
+
* Default: Infinity for deep helpers; default is handled per caller.
|
|
804
|
+
*/
|
|
805
|
+
maxDepth?: number;
|
|
806
|
+
}
|
|
700
807
|
/**
|
|
701
|
-
*
|
|
702
|
-
*
|
|
703
|
-
* @param
|
|
704
|
-
* @
|
|
808
|
+
* Analyzes and processes field resolution in a GraphQL query deeply.
|
|
809
|
+
*
|
|
810
|
+
* @param payload - The resolver payload containing the current field resolution context
|
|
811
|
+
* @param options - Additional parsing options (e.g., includeIntrospection, maxDepth; default maxDepth = Infinity)
|
|
812
|
+
* @returns A map of field paths to their resolving fields
|
|
705
813
|
*/
|
|
706
|
-
declare function
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
814
|
+
declare function getDeepResolvingFields(payload: Pick<ResolverPayload, "info">, options?: ResolvingFieldsOptions): Map<string, ResolvingFields>;
|
|
815
|
+
/**
|
|
816
|
+
* Analyzes and processes field resolution in a GraphQL query.
|
|
817
|
+
*
|
|
818
|
+
* @param payload - The resolver payload containing the current field resolution context
|
|
819
|
+
* @param options - Additional parsing options (e.g., includeIntrospection; fixed maxDepth = 1)
|
|
820
|
+
* @returns An object containing sets of different field types
|
|
821
|
+
*/
|
|
822
|
+
declare function getResolvingFields(payload: Pick<ResolverPayload, "info">, options?: Omit<ResolvingFieldsOptions, "maxDepth">): ResolvingFields;
|
|
823
|
+
/**
|
|
824
|
+
* Parses the GraphQL resolve info to extract all requested fields.
|
|
825
|
+
* Returns a Set of field paths where nested fields are represented as 'parent.field'.
|
|
826
|
+
* Supports @include, @skip directives, fragments, and variables.
|
|
827
|
+
*
|
|
828
|
+
* @param info - The GraphQL resolve info object containing the query information
|
|
829
|
+
* @param options - Additional parsing options (e.g., includeIntrospection, maxDepth; default maxDepth = 1)
|
|
830
|
+
* @returns A Set of field paths
|
|
831
|
+
*/
|
|
832
|
+
declare function parseResolvingFields(info: GraphQLResolveInfo, options?: ResolvingFieldsOptions): Set<string>;
|
|
833
|
+
//#endregion
|
|
834
|
+
//#region src/utils/string.d.ts
|
|
835
|
+
declare function pascalCase(str: string): string;
|
|
836
|
+
declare function capitalize<T$1 extends string>(str: T$1): Capitalize<T$1>;
|
|
837
|
+
declare function screamingSnakeCase(str: string): string;
|
|
838
|
+
//#endregion
|
|
839
|
+
//#region src/resolver/input.d.ts
|
|
840
|
+
type InferInputI<TInput$1 extends GraphQLSilk | Record<string, GraphQLSilk> | void> = TInput$1 extends void ? void : TInput$1 extends GraphQLSilk ? StandardSchemaV1.InferInput<TInput$1> : TInput$1 extends Record<string, GraphQLSilk> ? { [K in keyof TInput$1]: StandardSchemaV1.InferInput<TInput$1[K]> } : void;
|
|
841
|
+
type InferInputO<TInput$1 extends GraphQLSilk | Record<string, GraphQLSilk> | void> = TInput$1 extends void ? void : TInput$1 extends GraphQLSilk ? StandardSchemaV1.InferOutput<TInput$1> : TInput$1 extends Record<string, GraphQLSilk> ? { [K in keyof TInput$1]: StandardSchemaV1.InferOutput<TInput$1[K]> } : never;
|
|
842
|
+
interface CallableInputParser<TSchema extends GraphQLSilk | Record<string, GraphQLSilk> | void> {
|
|
843
|
+
/**
|
|
844
|
+
* input schema
|
|
845
|
+
*/
|
|
846
|
+
schema: TSchema;
|
|
847
|
+
/**
|
|
848
|
+
* Origin value to parse
|
|
849
|
+
*/
|
|
850
|
+
value: InferInputI<TSchema>;
|
|
851
|
+
/**
|
|
852
|
+
* Parse the input and return the standard result
|
|
853
|
+
*/
|
|
854
|
+
(): Promise<StandardSchemaV1.Result<InferInputO<TSchema>>>;
|
|
855
|
+
/**
|
|
856
|
+
* Result of parsing. Set it to `undefined` then the parser will run again.
|
|
857
|
+
*/
|
|
858
|
+
result: StandardSchemaV1.Result<InferInputO<TSchema>> | undefined;
|
|
859
|
+
/**
|
|
860
|
+
* Parse the input and return the result
|
|
861
|
+
*/
|
|
862
|
+
getResult(): Promise<InferInputO<TSchema>>;
|
|
863
|
+
/**
|
|
864
|
+
* Set the result's value of parsing
|
|
865
|
+
*/
|
|
866
|
+
setResult(value: InferInputO<TSchema>): void;
|
|
867
|
+
/**
|
|
868
|
+
* Clear the result of parsing, the parser will run again to get the result.
|
|
869
|
+
*/
|
|
870
|
+
clearResult(): void;
|
|
871
|
+
}
|
|
872
|
+
declare function createInputParser<TSchema extends GraphQLSilk | Record<string, GraphQLSilk> | void>(schema: TSchema, value: InferInputI<TSchema>): CallableInputParser<TSchema>;
|
|
873
|
+
declare function parseInputValue<TSchema extends GraphQLSilk | Record<string, GraphQLSilk> | void>(inputSchema: TSchema, input: any): MayPromise<StandardSchemaV1.Result<InferInputO<TSchema>>>;
|
|
874
|
+
declare function getStandardValue<T$1>(result: StandardSchemaV1.Result<T$1>): T$1;
|
|
875
|
+
declare function getStandardValue<T$1>(result?: StandardSchemaV1.Result<T$1>): T$1 | undefined;
|
|
876
|
+
declare function getStandardValue<T$1>(result: StandardSchemaV1.Result<T$1> | null): T$1 | null;
|
|
712
877
|
//#endregion
|
|
713
878
|
//#region src/resolver/resolver.d.ts
|
|
714
879
|
/**
|
|
@@ -796,7 +961,7 @@ interface ResolverFactory {
|
|
|
796
961
|
* @param fields - The fields to resolve
|
|
797
962
|
* @param options - Optional resolver options
|
|
798
963
|
*/
|
|
799
|
-
of<TParent extends GraphQLSilk, TFields extends Record<string, Field<TParent, any, any, any> | Operation | typeof FIELD_HIDDEN>>(parent: TParent, fields: TFields, options?: ResolverOptionsWithExtensions<OmitInUnion<ValueOf<TFields>, typeof FIELD_HIDDEN>>): ObjectChainResolver<TParent, TFields>;
|
|
964
|
+
of<TParent$1 extends GraphQLSilk, TFields extends Record<string, Field<TParent$1, any, any, any> | Operation | typeof FIELD_HIDDEN>>(parent: TParent$1, fields: TFields, options?: ResolverOptionsWithExtensions<OmitInUnion<ValueOf<TFields>, typeof FIELD_HIDDEN>>): ObjectChainResolver<TParent$1, TFields>;
|
|
800
965
|
/**
|
|
801
966
|
* Creates a resolver for operations
|
|
802
967
|
* @template TFields - The operations to resolve
|
|
@@ -839,9 +1004,9 @@ declare class ChainResolver<TFields extends Record<string, FieldOrOperation | ty
|
|
|
839
1004
|
* @template TParent - The parent type
|
|
840
1005
|
* @template TFields - The fields to resolve
|
|
841
1006
|
*/
|
|
842
|
-
declare class ObjectChainResolver<TParent extends GraphQLSilk, TFields extends Record<string, FieldOrOperation | typeof FIELD_HIDDEN>> extends ChainResolver<TFields> {
|
|
1007
|
+
declare class ObjectChainResolver<TParent$1 extends GraphQLSilk, TFields extends Record<string, FieldOrOperation | typeof FIELD_HIDDEN>> extends ChainResolver<TFields> {
|
|
843
1008
|
protected meta: ResolverMeta<TFields> & {
|
|
844
|
-
parent: TParent;
|
|
1009
|
+
parent: TParent$1;
|
|
845
1010
|
};
|
|
846
1011
|
/**
|
|
847
1012
|
* Creates a new object chain resolver
|
|
@@ -849,12 +1014,12 @@ declare class ObjectChainResolver<TParent extends GraphQLSilk, TFields extends R
|
|
|
849
1014
|
* @param fields - The fields to resolve
|
|
850
1015
|
* @param options - Optional resolver options
|
|
851
1016
|
*/
|
|
852
|
-
constructor(parent: TParent, fields: TFields, options?: ResolverOptionsWithExtensions<any>);
|
|
1017
|
+
constructor(parent: TParent$1, fields: TFields, options?: ResolverOptionsWithExtensions<any>);
|
|
853
1018
|
/**
|
|
854
1019
|
* Gets the metadata for the resolver
|
|
855
1020
|
*/
|
|
856
1021
|
get "~meta"(): ResolverMeta<TFields> & {
|
|
857
|
-
parent: TParent;
|
|
1022
|
+
parent: TParent$1;
|
|
858
1023
|
};
|
|
859
1024
|
/**
|
|
860
1025
|
* Sets custom extensions for the resolver
|
|
@@ -868,207 +1033,97 @@ declare class ObjectChainResolver<TParent extends GraphQLSilk, TFields extends R
|
|
|
868
1033
|
*/
|
|
869
1034
|
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
1035
|
//#endregion
|
|
871
|
-
//#region src/
|
|
1036
|
+
//#region src/resolver/silk.d.ts
|
|
872
1037
|
/**
|
|
873
|
-
*
|
|
874
|
-
* - `field`
|
|
875
|
-
* - `query`
|
|
876
|
-
* - `mutation`
|
|
877
|
-
* - `subscription.resolve`
|
|
878
|
-
* - `subscription.subscribe`
|
|
879
|
-
* - `resolveReference`
|
|
1038
|
+
* Create a Silk from Scalar.
|
|
880
1039
|
*/
|
|
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
|
|
1040
|
+
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
1041
|
/**
|
|
913
|
-
*
|
|
914
|
-
* running each value of `record` thru `fn`.
|
|
1042
|
+
* Create a GraphQLSilk Object.
|
|
915
1043
|
*/
|
|
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;
|
|
1044
|
+
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
1045
|
/**
|
|
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" } }
|
|
1046
|
+
* Create a GraphQLSilk Object.
|
|
933
1047
|
*/
|
|
934
|
-
declare function
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
interface ReadOnlyObjMap<T> {
|
|
942
|
-
readonly [key: string]: T;
|
|
1048
|
+
declare function silk<TOutput$1, TInput$1 = TOutput$1>(type: GraphQLOutputType | (() => GraphQLOutputType), validate?: (value: TInput$1) => StandardSchemaV1.Result<TOutput$1> | Promise<StandardSchemaV1.Result<TOutput$1>>): GraphQLSilk<TOutput$1, TInput$1>;
|
|
1049
|
+
declare namespace silk {
|
|
1050
|
+
var parse: typeof parseSilk;
|
|
1051
|
+
var getType: typeof getGraphQLType;
|
|
1052
|
+
var nonNull: typeof nonNullSilk;
|
|
1053
|
+
var list: typeof listSilk;
|
|
1054
|
+
var nullable: typeof nullableSilk;
|
|
943
1055
|
}
|
|
944
|
-
|
|
945
|
-
//#region src/utils/parse-resolving-fields.d.ts
|
|
1056
|
+
type NonNullSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<NonNullable<StandardSchemaV1.InferOutput<TSilk>>, NonNullable<StandardSchemaV1.InferInput<TSilk>>>;
|
|
946
1057
|
/**
|
|
947
|
-
*
|
|
1058
|
+
* Non-nullable Silk.
|
|
948
1059
|
*/
|
|
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
|
-
}
|
|
1060
|
+
declare function nonNullSilk<TSilk extends GraphQLSilk<any, any>>(origin: TSilk): NonNullSilk<TSilk>;
|
|
1061
|
+
type ListSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<Array<StandardSchemaV1.InferOutput<TSilk>>, Array<StandardSchemaV1.InferOutput<TSilk>>>;
|
|
967
1062
|
/**
|
|
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
|
|
1063
|
+
* List Silk.
|
|
973
1064
|
*/
|
|
974
|
-
declare function
|
|
1065
|
+
declare function listSilk<TSilk extends GraphQLSilk<any, any>>(origin: TSilk): ListSilk<TSilk>;
|
|
1066
|
+
type NullableSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<StandardSchemaV1.InferOutput<TSilk> | null | undefined, StandardSchemaV1.InferInput<TSilk>>;
|
|
975
1067
|
/**
|
|
976
|
-
*
|
|
977
|
-
*
|
|
978
|
-
* @param payload - The resolver payload containing the current field resolution context
|
|
979
|
-
* @returns An object containing sets of different field types
|
|
1068
|
+
* Nullable Silk.
|
|
980
1069
|
*/
|
|
981
|
-
declare function
|
|
1070
|
+
declare function nullableSilk<TSilk extends GraphQLSilk<any, any>>(origin: TSilk): NullableSilk<TSilk>;
|
|
982
1071
|
/**
|
|
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
|
|
1072
|
+
* Get GraphQL Output Type from Silk.
|
|
1073
|
+
* @param silk GraphQL Silk
|
|
1074
|
+
* @returns GraphQL Output Type
|
|
990
1075
|
*/
|
|
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;
|
|
1076
|
+
declare function getGraphQLType(silk: GraphQLSilk): GraphQLOutputType;
|
|
1001
1077
|
/**
|
|
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"
|
|
1078
|
+
* Get GraphQL Argument Config from Silk.
|
|
1079
|
+
* @param silk GraphQL Silk
|
|
1080
|
+
* @returns GraphQL Argument Config
|
|
1010
1081
|
*/
|
|
1011
|
-
declare function
|
|
1012
|
-
//#endregion
|
|
1013
|
-
//#region src/utils/loader.d.ts
|
|
1014
|
-
type BatchLoadFn<TKey, TData> = (keys: TKey[]) => Promise<(TData | Error)[]>;
|
|
1082
|
+
declare function getGraphQLArgumentConfig(silk: GraphQLSilk): Omit<GraphQLArgumentConfig, "type" | "astNode"> | undefined;
|
|
1015
1083
|
/**
|
|
1016
|
-
*
|
|
1084
|
+
* Validate and transform input to output
|
|
1085
|
+
* @param silk silk GraphQL Silk
|
|
1086
|
+
* @param input
|
|
1087
|
+
* @returns output
|
|
1017
1088
|
*/
|
|
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>;
|
|
1089
|
+
declare function parseSilk<TSilk extends GraphQLSilk>(silk: TSilk, input: StandardSchemaV1.InferInput<TSilk>): MayPromise<StandardSchemaV1.Result<StandardSchemaV1.InferOutput<TSilk>>>;
|
|
1090
|
+
declare function isSilk(target: any): target is GraphQLSilk;
|
|
1091
|
+
type GraphQLVariants<TSource$1 extends GraphQLNullableType> = TSource$1 | GraphQLList<TSource$1> | GraphQLList<GraphQLNonNull<TSource$1>> | GraphQLNonNull<TSource$1> | GraphQLNonNull<GraphQLList<TSource$1>> | GraphQLNonNull<GraphQLList<GraphQLNonNull<TSource$1>>>;
|
|
1092
|
+
type InferScalarInternalByVariants<T$1 extends GraphQLVariants<GraphQLScalarType>> = T$1 extends GraphQLNonNull<infer U> ? U extends GraphQLVariants<GraphQLScalarType> ? NonNullable<InferScalarInternalByVariants<U>> : never : T$1 extends GraphQLList<infer U> ? U extends GraphQLVariants<GraphQLScalarType> ? InferScalarInternalByVariants<U>[] : never : T$1 extends GraphQLScalarType<infer TInternal, any> ? TInternal | null | undefined : never;
|
|
1093
|
+
type InferScalarExternalByVariants<T$1 extends GraphQLVariants<GraphQLScalarType>> = T$1 extends GraphQLNonNull<infer U> ? U extends GraphQLVariants<GraphQLScalarType> ? NonNullable<InferScalarExternalByVariants<U>> : never : T$1 extends GraphQLList<infer U> ? U extends GraphQLVariants<GraphQLScalarType> ? InferScalarExternalByVariants<U>[] : never : T$1 extends GraphQLScalarType<any, infer TExternal> ? TExternal | null | undefined : never;
|
|
1094
|
+
type InferObjectSourceByVariants<T$1 extends GraphQLVariants<GraphQLObjectType>> = T$1 extends GraphQLNonNull<infer U> ? U extends GraphQLVariants<GraphQLObjectType> ? NonNullable<InferObjectSourceByVariants<U>> : never : T$1 extends GraphQLList<infer U> ? U extends GraphQLVariants<GraphQLObjectType> ? InferObjectSourceByVariants<U>[] : never : T$1 extends GraphQLObjectType<infer TSource> ? TSource | null | undefined : never;
|
|
1095
|
+
//#endregion
|
|
1096
|
+
//#region src/schema/extensions.d.ts
|
|
1097
|
+
interface GQLoomExtensions {
|
|
1098
|
+
defaultValue?: any;
|
|
1099
|
+
gqloom?: GQLoomExtensionAttribute;
|
|
1100
|
+
directives?: DirectiveItem[] | DirectiveRecord;
|
|
1037
1101
|
}
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
constructor(batchLoadFn: BatchLoadFn<TKey, TData>);
|
|
1102
|
+
interface DirectiveItem {
|
|
1103
|
+
name: string;
|
|
1104
|
+
args?: Record<string, any>;
|
|
1042
1105
|
}
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
* Empty Resolver Arguments that only store the memoization
|
|
1047
|
-
*/
|
|
1048
|
-
interface OnlyMemoizationPayload {
|
|
1049
|
-
memoization: WeakMap<WeakKey, any>;
|
|
1050
|
-
isMemoization: true;
|
|
1106
|
+
type DirectiveRecord = Record<string, Record<string, any>>;
|
|
1107
|
+
interface GQLoomExtensionAttribute {
|
|
1108
|
+
directives?: string[];
|
|
1051
1109
|
}
|
|
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>;
|
|
1110
|
+
//#endregion
|
|
1111
|
+
//#region src/schema/input.d.ts
|
|
1112
|
+
interface EnsureInputOptions {
|
|
1113
|
+
fieldName: string;
|
|
1061
1114
|
}
|
|
1062
|
-
declare function
|
|
1115
|
+
declare function inputToArgs(input: GraphQLSilk | Record<string, GraphQLSilk> | undefined | void, options: EnsureInputOptions): GraphQLFieldConfigArgumentMap | undefined;
|
|
1116
|
+
declare function ensureInputType(silkOrType: GraphQLType | GraphQLSilk, options: EnsureInputOptions): GraphQLInputType;
|
|
1117
|
+
declare function ensureInputObjectType(object: GraphQLObjectType | GraphQLInterfaceType | GraphQLInputObjectType, options: EnsureInputOptions): GraphQLInputObjectType;
|
|
1063
1118
|
//#endregion
|
|
1064
|
-
//#region src/
|
|
1065
|
-
declare
|
|
1066
|
-
declare const AUTO_ALIASING = "__gqloom_auto_aliasing";
|
|
1119
|
+
//#region src/schema/interface.d.ts
|
|
1120
|
+
declare function ensureInterfaceType(gqlType: GraphQLOutputType, interfaceConfig?: Partial<GraphQLInterfaceTypeConfig<any, any>>): GraphQLInterfaceType;
|
|
1067
1121
|
//#endregion
|
|
1068
1122
|
//#region src/schema/schema-weaver.d.ts
|
|
1069
1123
|
interface SchemaWeaver {
|
|
1070
1124
|
vendor: string;
|
|
1071
1125
|
getGraphQLType: (schema: any) => GraphQLOutputType;
|
|
1126
|
+
getGraphQLArgumentConfig?: (schema: any) => Omit<GraphQLArgumentConfig, "type" | "astNode"> | undefined;
|
|
1072
1127
|
}
|
|
1073
1128
|
declare function isSchemaVendorWeaver(some: any): some is SchemaWeaver;
|
|
1074
1129
|
//#endregion
|
|
@@ -1092,7 +1147,7 @@ declare class WeaverContext {
|
|
|
1092
1147
|
setConfig<TConfig extends WeaverConfig>(config: TConfig): void;
|
|
1093
1148
|
deleteConfig<TConfig extends WeaverConfig>(key: TConfig[typeof WEAVER_CONFIG]): void;
|
|
1094
1149
|
memoNamedType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(gqlTypeValue: TGraphQLType): TGraphQLType;
|
|
1095
|
-
getNamedType<T extends GraphQLOutputType>(name: string): T | undefined;
|
|
1150
|
+
getNamedType<T$1 extends GraphQLOutputType>(name: string): T$1 | undefined;
|
|
1096
1151
|
protected static readonly namedTypes: {
|
|
1097
1152
|
readonly Object: "Object";
|
|
1098
1153
|
readonly Union: "Union";
|
|
@@ -1106,11 +1161,11 @@ declare class WeaverContext {
|
|
|
1106
1161
|
* @returns -1 if a is better than b, 1 if b is better than a, 0 if they are equal
|
|
1107
1162
|
*/
|
|
1108
1163
|
protected static higherPriorityThan(a: string | undefined, b: string | undefined): number;
|
|
1109
|
-
static provide<T>(func: () => T, value: WeaverContext | undefined): T;
|
|
1164
|
+
static provide<T$1>(func: () => T$1, value: WeaverContext | undefined): T$1;
|
|
1110
1165
|
}
|
|
1111
1166
|
declare const initWeaverContext: () => WeaverContext;
|
|
1112
1167
|
declare const provideWeaverContext: typeof WeaverContext.provide & {
|
|
1113
|
-
inherit: <T>(func: () => T) => () => T;
|
|
1168
|
+
inherit: <T$1>(func: () => T$1) => () => T$1;
|
|
1114
1169
|
};
|
|
1115
1170
|
interface WeaverConfig {
|
|
1116
1171
|
[WEAVER_CONFIG]: string | symbol;
|
|
@@ -1133,7 +1188,7 @@ declare class GlobalWeaverContext implements Partial<Omit<WeaverContext, GlobalC
|
|
|
1133
1188
|
setConfig(config: WeaverConfig): void;
|
|
1134
1189
|
deleteConfig(key: string | symbol): void;
|
|
1135
1190
|
useConfig<TConfig extends WeaverConfig, TCallback extends () => any>(config: TConfig, callback: TCallback): ReturnType<TCallback>;
|
|
1136
|
-
getNamedType<T extends GraphQLOutputType>(name: string): T | undefined;
|
|
1191
|
+
getNamedType<T$1 extends GraphQLOutputType>(name: string): T$1 | undefined;
|
|
1137
1192
|
memoNamedType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(gqlType: TGraphQLType): TGraphQLType;
|
|
1138
1193
|
getGraphQLType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(origin: object): TGraphQLType | undefined;
|
|
1139
1194
|
memoGraphQLType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(origin: object, gqlType: TGraphQLType): TGraphQLType;
|
|
@@ -1153,7 +1208,7 @@ declare function collectNames<TRecords extends Record<string, object>[]>(...name
|
|
|
1153
1208
|
* @returns schema
|
|
1154
1209
|
*/
|
|
1155
1210
|
declare function collectName<TSchema extends object>(name: string, schema: TSchema): TSchema;
|
|
1156
|
-
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
|
|
1211
|
+
type UnionToIntersection<U$1> = (U$1 extends any ? (k: U$1) => void : never) extends ((k: infer I) => void) ? I : never;
|
|
1157
1212
|
//#endregion
|
|
1158
1213
|
//#region src/schema/object.d.ts
|
|
1159
1214
|
declare class LoomObjectType extends GraphQLObjectType {
|
|
@@ -1255,30 +1310,4 @@ declare class GraphQLSchemaLoom {
|
|
|
1255
1310
|
*/
|
|
1256
1311
|
declare const weave: typeof GraphQLSchemaLoom.weave;
|
|
1257
1312
|
//#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 };
|
|
1313
|
+
export { subscription$1 as $, GraphQLSilk as $t, getGraphQLType as A, FieldFactoryWithResolve as An, RequireKeys as At, ResolverFactory as B, StandardSchemaV1 as Bn, getMemoizationMap as Bt, DirectiveRecord as C, Query as Cn, MiddlewareOptions as Ct, NonNullSilk as D, BaseChainFactory as Dn, MayGetter as Dt, ListSilk as E, types_loom_d_exports as En, IsAny as Et, parseSilk as F, QueryFactoryWithResolve as Fn, markErrorLocation as Ft, createQuery as G, getFieldOptions as Gt, ToExecutorProps as H, onlyMemoization as Ht, silk as I, ResolvableSubscription as In, markLocation as It, field as J, FieldFactory as Jt, createSubscription as K, getOperationOptions as Kt, ChainResolver as L, SubscriptionChainFactory as Ln, tryIn as Lt, listSilk as M, MutationChainFactory as Mn, BatchLoadFn as Mt, nonNullSilk as N, MutationFactoryWithResolve as Nn, EasyDataLoader as Nt, NullableSilk as O, ChainFactoryOptions as On, MayPromise as Ot, nullableSilk as P, QueryChainFactory as Pn, LoomDataLoader as Pt, resolver as Q, GraphQLFieldOptions as Qt, Executor as R, SubscriptionNeedResolve as Rn, OnlyMemoizationPayload as Rt, DirectiveItem as S, Operation as Sn, MiddlewareOperation as St, GQLoomExtensions as T, Subscription as Tn, filterMiddlewares as Tt, createField as U, AUTO_ALIASING as Ut, ResolverMeta as V, isOnlyMemoryPayload as Vt, createMutation as W, DERIVED_DEPENDENCIES as Wt, mutation$1 as X, FieldOptions as Xt, loom as Y, FieldFactoryWithUtils as Yt, query$1 as Z, FieldOrOperationType as Zt, isSchemaVendorWeaver as _, BaseField as _n, notNullish as _t, LoomObjectType as a, OperationType as an, parseInputValue as at, ensureInputType as b, FieldOrOperation as bn, Middleware as bt, GlobalWeaverContext as c, QueryOptions as cn, screamingSnakeCase as ct, collectName as d, ResolverOptionsWithParent as dn, getDeepResolvingFields as dt, InferFieldInput as en, CallableInputParser as et, collectNames as f, ResolverPayload as fn, getResolvingFields as ft, SchemaWeaver as g, SubscriptionOptions as gn, meta as gt, weaverContext as h, SubscriptionFactoryWithChain as hn, mapValue as ht, CoreSchemaWeaverConfigOptions as i, MutationOptions as in, getStandardValue as it, isSilk as j, IChainFactory as jn, ValueOf as jt, getGraphQLArgumentConfig as k, FieldChainFactory as kn, OmitInUnion as kt, WeaverConfig as l, ResolverOptions as ln, ResolvingFields as lt, provideWeaverContext as m, SubscriptionFactory as mn, deepMerge as mt, weave as n, MutationFactory as nn, InferInputO as nt, OPERATION_OBJECT_NAMES as o, QueryFactory as on, capitalize as ot, initWeaverContext as p, ResolvingOptions as pn, parseResolvingFields as pt, defaultSubscriptionResolve as q, getSubscriptionOptions as qt, CoreSchemaWeaverConfig as r, MutationFactoryWithChain as rn, createInputParser as rt, getCacheType as s, QueryFactoryWithChain as sn, pascalCase as st, GraphQLSchemaLoom as t, InferFieldOutput as tn, InferInputI as tt, WeaverContext as u, ResolverOptionsWithExtensions as un, ResolvingFieldsOptions as ut, ensureInterfaceType as v, Field as vn, toObjMap as vt, GQLoomExtensionAttribute as w, Resolver as wn, applyMiddlewares as wt, inputToArgs as x, Mutation as xn, MiddlewareConfig as xt, ensureInputObjectType as y, FieldMeta as yn, CallableMiddlewareOptions as yt, ObjectChainResolver as z, symbols_d_exports as zn, assignContextMap as zt };
|