@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,12 +1,5 @@
|
|
|
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
|
-
//#region src/utils/types.d.ts
|
|
4
|
-
type MayPromise<T> = T | Promise<T>;
|
|
5
|
-
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
6
|
-
type ValueOf<T extends object> = T[keyof T];
|
|
7
|
-
type OmitInUnion<TUnion, TOmit> = TUnion extends infer T ? T extends TOmit ? never : T : never;
|
|
8
|
-
type RequireKeys<T, TKey extends string | number | symbol> = { [P in keyof T as P extends TKey ? P : never]-?: T[P] } & { [P in keyof T as P extends TKey ? never : P]: T[P] };
|
|
9
|
-
//#endregion
|
|
10
3
|
//#region ../../node_modules/.pnpm/@standard-schema+spec@1.0.0/node_modules/@standard-schema/spec/dist/index.d.ts
|
|
11
4
|
/** The Standard Schema interface. */
|
|
12
5
|
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
@@ -65,12 +58,16 @@ declare namespace StandardSchemaV1 {
|
|
|
65
58
|
export {};
|
|
66
59
|
}
|
|
67
60
|
declare namespace symbols_d_exports {
|
|
68
|
-
export { CONTEXT_MAP_KEY, FIELD_HIDDEN, GET_GRAPHQL_TYPE, IS_RESOLVER, RESOLVER_OPTIONS_KEY, WEAVER_CONFIG };
|
|
61
|
+
export { CONTEXT_MAP_KEY, FIELD_HIDDEN, GET_GRAPHQL_ARGUMENT_CONFIG, GET_GRAPHQL_TYPE, IS_RESOLVER, RESOLVER_OPTIONS_KEY, WEAVER_CONFIG };
|
|
69
62
|
}
|
|
70
63
|
/**
|
|
71
64
|
* The symbol to get GraphQL type for schema
|
|
72
65
|
*/
|
|
73
66
|
declare const GET_GRAPHQL_TYPE: unique symbol;
|
|
67
|
+
/**
|
|
68
|
+
* The symbol to get GraphQL argument config for schema
|
|
69
|
+
*/
|
|
70
|
+
declare const GET_GRAPHQL_ARGUMENT_CONFIG: unique symbol;
|
|
74
71
|
/**
|
|
75
72
|
* The symbol to get and store weaver config
|
|
76
73
|
*/
|
|
@@ -92,52 +89,13 @@ declare const CONTEXT_MAP_KEY: unique symbol;
|
|
|
92
89
|
*/
|
|
93
90
|
declare const FIELD_HIDDEN = false;
|
|
94
91
|
//#endregion
|
|
95
|
-
//#region src/resolver/input.d.ts
|
|
96
|
-
type InferInputI<TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void> = TInput extends void ? void : TInput extends GraphQLSilk ? StandardSchemaV1.InferInput<TInput> : TInput extends Record<string, GraphQLSilk> ? { [K in keyof TInput]: StandardSchemaV1.InferInput<TInput[K]> } : void;
|
|
97
|
-
type InferInputO<TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void> = TInput extends void ? void : TInput extends GraphQLSilk ? StandardSchemaV1.InferOutput<TInput> : TInput extends Record<string, GraphQLSilk> ? { [K in keyof TInput]: StandardSchemaV1.InferOutput<TInput[K]> } : never;
|
|
98
|
-
interface CallableInputParser<TSchema extends GraphQLSilk | Record<string, GraphQLSilk> | void> {
|
|
99
|
-
/**
|
|
100
|
-
* input schema
|
|
101
|
-
*/
|
|
102
|
-
schema: TSchema;
|
|
103
|
-
/**
|
|
104
|
-
* Origin value to parse
|
|
105
|
-
*/
|
|
106
|
-
value: InferInputI<TSchema>;
|
|
107
|
-
/**
|
|
108
|
-
* Parse the input and return the standard result
|
|
109
|
-
*/
|
|
110
|
-
(): Promise<StandardSchemaV1.Result<InferInputO<TSchema>>>;
|
|
111
|
-
/**
|
|
112
|
-
* Result of parsing. Set it to `undefined` then the parser will run again.
|
|
113
|
-
*/
|
|
114
|
-
result: StandardSchemaV1.Result<InferInputO<TSchema>> | undefined;
|
|
115
|
-
/**
|
|
116
|
-
* Parse the input and return the result
|
|
117
|
-
*/
|
|
118
|
-
getResult(): Promise<InferInputO<TSchema>>;
|
|
119
|
-
/**
|
|
120
|
-
* Set the result's value of parsing
|
|
121
|
-
*/
|
|
122
|
-
setResult(value: InferInputO<TSchema>): void;
|
|
123
|
-
/**
|
|
124
|
-
* Clear the result of parsing, the parser will run again to get the result.
|
|
125
|
-
*/
|
|
126
|
-
clearResult(): void;
|
|
127
|
-
}
|
|
128
|
-
declare function createInputParser<TSchema extends GraphQLSilk | Record<string, GraphQLSilk> | void>(schema: TSchema, value: InferInputI<TSchema>): CallableInputParser<TSchema>;
|
|
129
|
-
declare function parseInputValue<TSchema extends GraphQLSilk | Record<string, GraphQLSilk> | void>(inputSchema: TSchema, input: any): MayPromise<StandardSchemaV1.Result<InferInputO<TSchema>>>;
|
|
130
|
-
declare function getStandardValue<T>(result: StandardSchemaV1.Result<T>): T;
|
|
131
|
-
declare function getStandardValue<T>(result?: StandardSchemaV1.Result<T>): T | undefined;
|
|
132
|
-
declare function getStandardValue<T>(result: StandardSchemaV1.Result<T> | null): T | null;
|
|
133
|
-
//#endregion
|
|
134
92
|
//#region src/resolver/resolver-chain-factory.d.ts
|
|
135
93
|
/**
|
|
136
94
|
* Interface for chain factory that provides methods to configure GraphQL field options
|
|
137
95
|
* @template TOutput - The output type of the GraphQL field
|
|
138
96
|
* @template TInput - The input type of the GraphQL field, can be a single type or a record of types
|
|
139
97
|
*/
|
|
140
|
-
interface IChainFactory<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void> {
|
|
98
|
+
interface IChainFactory<TOutput$1 extends GraphQLSilk, TInput$1 extends GraphQLSilk | Record<string, GraphQLSilk> | void = void> {
|
|
141
99
|
/**
|
|
142
100
|
* Sets the description for the GraphQL field
|
|
143
101
|
* @param description - The description text for the field
|
|
@@ -158,13 +116,13 @@ interface IChainFactory<TOutput extends GraphQLSilk, TInput extends GraphQLSilk
|
|
|
158
116
|
* @template TOutputNew - The new output type
|
|
159
117
|
* @param output - The output type definition
|
|
160
118
|
*/
|
|
161
|
-
output<TOutputNew extends GraphQLSilk>(output: TOutputNew): IChainFactory<TOutputNew, TInput>;
|
|
119
|
+
output<TOutputNew extends GraphQLSilk>(output: TOutputNew): IChainFactory<TOutputNew, TInput$1>;
|
|
162
120
|
/**
|
|
163
121
|
* Sets the input type for the GraphQL field
|
|
164
122
|
* @template TInputNew - The new input type
|
|
165
123
|
* @param input - The input type definition
|
|
166
124
|
*/
|
|
167
|
-
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): IChainFactory<TOutput, TInputNew>;
|
|
125
|
+
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): IChainFactory<TOutput$1, TInputNew>;
|
|
168
126
|
}
|
|
169
127
|
/**
|
|
170
128
|
* Options for configuring a chain factory
|
|
@@ -224,7 +182,7 @@ declare abstract class BaseChainFactory<TField extends BaseField = any> {
|
|
|
224
182
|
* @template TInput - The input type of the field
|
|
225
183
|
* @template TDependencies - The dependencies of the field
|
|
226
184
|
*/
|
|
227
|
-
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> {
|
|
185
|
+
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> {
|
|
228
186
|
/**
|
|
229
187
|
* Returns the available methods for the field chain factory
|
|
230
188
|
*/
|
|
@@ -239,25 +197,25 @@ declare class FieldChainFactory<TOutput extends GraphQLSilk = never, TInput exte
|
|
|
239
197
|
* @template TOutputNew - The new output type
|
|
240
198
|
* @param output - The output type definition
|
|
241
199
|
*/
|
|
242
|
-
output<TOutputNew extends GraphQLSilk>(output: TOutputNew): FieldChainFactory<TOutputNew, TInput, TDependencies>;
|
|
200
|
+
output<TOutputNew extends GraphQLSilk>(output: TOutputNew): FieldChainFactory<TOutputNew, TInput$1, TDependencies$1>;
|
|
243
201
|
/**
|
|
244
202
|
* Sets the input type for the field
|
|
245
203
|
* @template TInputNew - The new input type
|
|
246
204
|
* @param input - The input type definition
|
|
247
205
|
*/
|
|
248
|
-
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): FieldChainFactory<TOutput, TInputNew, TDependencies>;
|
|
206
|
+
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): FieldChainFactory<TOutput$1, TInputNew, TDependencies$1>;
|
|
249
207
|
/**
|
|
250
208
|
* Specifies the dependencies for the field
|
|
251
209
|
* @template TDependencies - The dependencies type
|
|
252
210
|
* @param dependencies - The dependencies to add
|
|
253
211
|
*/
|
|
254
|
-
derivedFrom<const TDependencies extends string[]>(...dependencies: TDependencies): FieldChainFactory<TOutput, TInput, TDependencies>;
|
|
212
|
+
derivedFrom<const TDependencies$1 extends string[]>(...dependencies: TDependencies$1): FieldChainFactory<TOutput$1, TInput$1, TDependencies$1>;
|
|
255
213
|
/**
|
|
256
214
|
* Sets the resolve function for the field
|
|
257
215
|
* @template TParent - The parent type
|
|
258
216
|
* @param resolve - The resolve function
|
|
259
217
|
*/
|
|
260
|
-
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>;
|
|
218
|
+
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>;
|
|
261
219
|
/**
|
|
262
220
|
* Creates a field resolver that uses DataLoader for batch loading data.
|
|
263
221
|
* This method is particularly useful for optimizing performance when dealing with multiple data requests
|
|
@@ -267,15 +225,15 @@ declare class FieldChainFactory<TOutput extends GraphQLSilk = never, TInput exte
|
|
|
267
225
|
* @param resolve - A function that handles batch loading of data.
|
|
268
226
|
* @returns A GraphQL field resolver that implements batch loading
|
|
269
227
|
*/
|
|
270
|
-
load<TParent extends GraphQLSilk>(resolve: (parents: InferParent<TParent, TDependencies>[], input: InferInputO<TInput>, payloads: (ResolverPayload | undefined)[]) => MayPromise<StandardSchemaV1.InferOutput<TOutput>[]>): Field<TParent, TOutput, TInput, TDependencies>;
|
|
228
|
+
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>;
|
|
271
229
|
}
|
|
272
|
-
type InferParent<TParent extends GraphQLSilk, TDependencies extends string[] | undefined = undefined> = TDependencies extends string[] ? RequireKeys<NonNullable<StandardSchemaV1.InferOutput<TParent>>, TDependencies[number]> : NonNullable<StandardSchemaV1.InferOutput<TParent>>;
|
|
230
|
+
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>>;
|
|
273
231
|
/**
|
|
274
232
|
* Factory for creating query resolvers with chainable configuration
|
|
275
233
|
* @template TOutput - The output type of the query
|
|
276
234
|
* @template TInput - The input type of the query
|
|
277
235
|
*/
|
|
278
|
-
declare class QueryChainFactory<TOutput extends GraphQLSilk = never, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void> extends BaseChainFactory<Query<TOutput, TInput>> implements IChainFactory<TOutput, TInput> {
|
|
236
|
+
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> {
|
|
279
237
|
/**
|
|
280
238
|
* Returns the available methods for the query chain factory
|
|
281
239
|
* @returns An object containing all available methods
|
|
@@ -293,28 +251,28 @@ declare class QueryChainFactory<TOutput extends GraphQLSilk = never, TInput exte
|
|
|
293
251
|
* @param output - The output type definition
|
|
294
252
|
* @returns A new QueryChainFactory instance with the updated output type
|
|
295
253
|
*/
|
|
296
|
-
output<TOutputNew extends GraphQLSilk>(output: TOutputNew): QueryChainFactory<TOutputNew, TInput>;
|
|
254
|
+
output<TOutputNew extends GraphQLSilk>(output: TOutputNew): QueryChainFactory<TOutputNew, TInput$1>;
|
|
297
255
|
/**
|
|
298
256
|
* Sets the input type for the query
|
|
299
257
|
* @template TInputNew - The new input type
|
|
300
258
|
* @param input - The input type definition
|
|
301
259
|
* @returns A new QueryChainFactory instance with the updated input type
|
|
302
260
|
*/
|
|
303
|
-
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): QueryChainFactory<TOutput, TInputNew>;
|
|
261
|
+
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): QueryChainFactory<TOutput$1, TInputNew>;
|
|
304
262
|
/**
|
|
305
263
|
* Sets the resolve function for the query
|
|
306
264
|
* @param resolve - The resolve function that processes the input and returns the output
|
|
307
265
|
* @returns A GraphQL query resolver
|
|
308
266
|
* @throws {Error} If output type is not set
|
|
309
267
|
*/
|
|
310
|
-
resolve(resolve: (input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>): Query<TOutput, TInput>;
|
|
268
|
+
resolve(resolve: (input: InferInputO<TInput$1>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput$1>>): Query<TOutput$1, TInput$1>;
|
|
311
269
|
}
|
|
312
270
|
/**
|
|
313
271
|
* Factory for creating mutation resolvers with chainable configuration
|
|
314
272
|
* @template TOutput - The output type of the mutation
|
|
315
273
|
* @template TInput - The input type of the mutation
|
|
316
274
|
*/
|
|
317
|
-
declare class MutationChainFactory<TOutput extends GraphQLSilk = never, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined> extends BaseChainFactory<Mutation<TOutput, TInput>> implements IChainFactory<TOutput, TInput> {
|
|
275
|
+
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> {
|
|
318
276
|
/**
|
|
319
277
|
* Returns the available methods for the mutation chain factory
|
|
320
278
|
* @returns An object containing all available methods
|
|
@@ -332,28 +290,28 @@ declare class MutationChainFactory<TOutput extends GraphQLSilk = never, TInput e
|
|
|
332
290
|
* @param output - The output type definition
|
|
333
291
|
* @returns A new MutationChainFactory instance with the updated output type
|
|
334
292
|
*/
|
|
335
|
-
output<TOutputNew extends GraphQLSilk>(output: TOutputNew): MutationChainFactory<TOutputNew, TInput>;
|
|
293
|
+
output<TOutputNew extends GraphQLSilk>(output: TOutputNew): MutationChainFactory<TOutputNew, TInput$1>;
|
|
336
294
|
/**
|
|
337
295
|
* Sets the input type for the mutation
|
|
338
296
|
* @template TInputNew - The new input type
|
|
339
297
|
* @param input - The input type definition
|
|
340
298
|
* @returns A new MutationChainFactory instance with the updated input type
|
|
341
299
|
*/
|
|
342
|
-
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): MutationChainFactory<TOutput, TInputNew>;
|
|
300
|
+
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): MutationChainFactory<TOutput$1, TInputNew>;
|
|
343
301
|
/**
|
|
344
302
|
* Sets the resolve function for the mutation
|
|
345
303
|
* @param resolve - The resolve function that processes the input and returns the output
|
|
346
304
|
* @returns A GraphQL mutation resolver
|
|
347
305
|
* @throws {Error} If output type is not set
|
|
348
306
|
*/
|
|
349
|
-
resolve(resolve: (input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>): Mutation<TOutput, TInput>;
|
|
307
|
+
resolve(resolve: (input: InferInputO<TInput$1>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput$1>>): Mutation<TOutput$1, TInput$1>;
|
|
350
308
|
}
|
|
351
309
|
/**
|
|
352
310
|
* Factory for creating subscription resolvers with chainable configuration
|
|
353
311
|
* @template TOutput - The output type of the subscription
|
|
354
312
|
* @template TInput - The input type of the subscription
|
|
355
313
|
*/
|
|
356
|
-
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> {
|
|
314
|
+
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> {
|
|
357
315
|
/**
|
|
358
316
|
* Returns the available methods for the subscription chain factory
|
|
359
317
|
* @returns An object containing all available methods
|
|
@@ -371,14 +329,14 @@ declare class SubscriptionChainFactory<TOutput extends GraphQLSilk = never, TInp
|
|
|
371
329
|
* @param output - The output type definition
|
|
372
330
|
* @returns A new SubscriptionChainFactory instance with the updated output type
|
|
373
331
|
*/
|
|
374
|
-
output<TOutputNew extends GraphQLSilk>(output: TOutputNew): SubscriptionChainFactory<TOutputNew, TInput>;
|
|
332
|
+
output<TOutputNew extends GraphQLSilk>(output: TOutputNew): SubscriptionChainFactory<TOutputNew, TInput$1>;
|
|
375
333
|
/**
|
|
376
334
|
* Sets the input type for the subscription
|
|
377
335
|
* @template TInputNew - The new input type
|
|
378
336
|
* @param input - The input type definition
|
|
379
337
|
* @returns A new SubscriptionChainFactory instance with the updated input type
|
|
380
338
|
*/
|
|
381
|
-
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): SubscriptionChainFactory<TOutput, TInputNew>;
|
|
339
|
+
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): SubscriptionChainFactory<TOutput$1, TInputNew>;
|
|
382
340
|
/**
|
|
383
341
|
* Sets the subscribe function for the subscription
|
|
384
342
|
* @template TValue - The value type of the subscription
|
|
@@ -386,7 +344,7 @@ declare class SubscriptionChainFactory<TOutput extends GraphQLSilk = never, TInp
|
|
|
386
344
|
* @returns A subscription resolver that can be further configured with a resolve function
|
|
387
345
|
* @throws {Error} If output type is not set
|
|
388
346
|
*/
|
|
389
|
-
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>;
|
|
347
|
+
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>;
|
|
390
348
|
}
|
|
391
349
|
/**
|
|
392
350
|
* Interface for a subscription that can be resolved
|
|
@@ -394,12 +352,12 @@ declare class SubscriptionChainFactory<TOutput extends GraphQLSilk = never, TInp
|
|
|
394
352
|
* @template TInput - The input type of the subscription
|
|
395
353
|
* @template TValue - The value type of the subscription
|
|
396
354
|
*/
|
|
397
|
-
interface ResolvableSubscription<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined, TValue = StandardSchemaV1.InferOutput<TOutput>> extends Subscription<TOutput, TInput, TValue> {
|
|
355
|
+
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> {
|
|
398
356
|
/**
|
|
399
357
|
* Sets the resolve function for the subscription
|
|
400
358
|
* @param resolve - The resolve function
|
|
401
359
|
*/
|
|
402
|
-
resolve(resolve: (value: TValue, input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>): Subscription<TOutput, TInput, TValue>;
|
|
360
|
+
resolve(resolve: (value: TValue, input: InferInputO<TInput$1>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput$1>>): Subscription<TOutput$1, TInput$1, TValue>;
|
|
403
361
|
}
|
|
404
362
|
/**
|
|
405
363
|
* A subscription that can not be resolved yet, still needs to be resolved.
|
|
@@ -408,39 +366,39 @@ interface ResolvableSubscription<TOutput extends GraphQLSilk, TInput extends Gra
|
|
|
408
366
|
* @template TInput - The input type of the subscription
|
|
409
367
|
* @template TValue - The value type of the subscription
|
|
410
368
|
*/
|
|
411
|
-
interface SubscriptionNeedResolve<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined, TValue = StandardSchemaV1.InferOutput<TOutput>> {
|
|
369
|
+
interface SubscriptionNeedResolve<TOutput$1 extends GraphQLSilk, TInput$1 extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined, TValue = StandardSchemaV1.InferOutput<TOutput$1>> {
|
|
412
370
|
/**
|
|
413
371
|
* Sets the resolve function for the subscription
|
|
414
372
|
* @param resolve - The resolve function
|
|
415
373
|
*/
|
|
416
|
-
resolve(resolve: (value: TValue, input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>): Subscription<TOutput, TInput, TValue>;
|
|
417
|
-
}
|
|
418
|
-
declare class QueryFactoryWithResolve<TInputO, TOutput extends GraphQLSilk, TInput extends GraphQLSilk<TInputO>> extends BaseChainFactory<Query<TOutput, TInput>> implements Query<TOutput, TInput> {
|
|
419
|
-
protected outputSilk: TOutput;
|
|
420
|
-
protected readonly options: QueryOptions<TOutput, TInput>;
|
|
421
|
-
get "~meta"(): Query<TOutput, TInput>["~meta"];
|
|
422
|
-
constructor(outputSilk: TOutput, options: QueryOptions<TOutput, TInput>);
|
|
423
|
-
protected clone(options?: Partial<QueryOptions<TOutput, TInput>> | undefined): this;
|
|
424
|
-
input<TInputNew extends GraphQLSilk<TInputO>>(input: TInputNew): QueryFactoryWithResolve<TInputO, TOutput, TInputNew>;
|
|
425
|
-
output<TOutputNew extends GraphQLSilk>(output: TOutputNew, transform: (output: StandardSchemaV1.InferOutput<TOutput>) => MayPromise<StandardSchemaV1.InferOutput<TOutputNew>>): QueryFactoryWithResolve<TInputO, TOutputNew, TInput>;
|
|
426
|
-
}
|
|
427
|
-
declare class MutationFactoryWithResolve<TInputO, TOutput extends GraphQLSilk, TInput extends GraphQLSilk<TInputO>> extends BaseChainFactory<Query<TOutput, TInput>> implements Mutation<TOutput, TInput> {
|
|
428
|
-
protected outputSilk: TOutput;
|
|
429
|
-
protected readonly options: MutationOptions<TOutput, TInput>;
|
|
430
|
-
get "~meta"(): Mutation<TOutput, TInput>["~meta"];
|
|
431
|
-
constructor(outputSilk: TOutput, options: MutationOptions<TOutput, TInput>);
|
|
432
|
-
protected clone(options?: Partial<MutationOptions<TOutput, TInput>> | undefined): this;
|
|
433
|
-
input<TInputNew extends GraphQLSilk<TInputO>>(input: TInputNew): MutationFactoryWithResolve<TInputO, TOutput, TInputNew>;
|
|
434
|
-
output<TOutputNew extends GraphQLSilk>(output: TOutputNew, transform: (output: StandardSchemaV1.InferOutput<TOutput>) => MayPromise<StandardSchemaV1.InferOutput<TOutputNew>>): MutationFactoryWithResolve<TInputO, TOutputNew, TInput>;
|
|
435
|
-
}
|
|
436
|
-
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>> {
|
|
437
|
-
protected outputSilk: TOutput;
|
|
438
|
-
protected readonly options: FieldOptions<TParent, TOutput, TInput, string[] | undefined>;
|
|
439
|
-
get "~meta"(): Field<TParent, TOutput, TInput, string[] | undefined>["~meta"];
|
|
440
|
-
constructor(outputSilk: TOutput, options: FieldOptions<TParent, TOutput, TInput, string[] | undefined>);
|
|
441
|
-
protected clone(options?: Partial<FieldOptions<TParent, TOutput, TInput, string[] | undefined>> | undefined): this;
|
|
442
|
-
input<TInputNew extends GraphQLSilk<TInputO>>(input: TInputNew): FieldFactoryWithResolve<TParent, TOutput, TInputO, TInputNew>;
|
|
443
|
-
output<TOutputNew extends GraphQLSilk>(output: TOutputNew, transform: (output: StandardSchemaV1.InferOutput<TOutput>) => MayPromise<StandardSchemaV1.InferOutput<TOutputNew>>): FieldFactoryWithResolve<TParent, TOutputNew, TInputO, TInput>;
|
|
374
|
+
resolve(resolve: (value: TValue, input: InferInputO<TInput$1>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput$1>>): Subscription<TOutput$1, TInput$1, TValue>;
|
|
375
|
+
}
|
|
376
|
+
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> {
|
|
377
|
+
protected outputSilk: TOutput$1;
|
|
378
|
+
protected readonly options: QueryOptions<TOutput$1, TInput$1>;
|
|
379
|
+
get "~meta"(): Query<TOutput$1, TInput$1>["~meta"];
|
|
380
|
+
constructor(outputSilk: TOutput$1, options: QueryOptions<TOutput$1, TInput$1>);
|
|
381
|
+
protected clone(options?: Partial<QueryOptions<TOutput$1, TInput$1>> | undefined): this;
|
|
382
|
+
input<TInputNew extends GraphQLSilk<TInputO>>(input: TInputNew): QueryFactoryWithResolve<TInputO, TOutput$1, TInputNew>;
|
|
383
|
+
output<TOutputNew extends GraphQLSilk>(output: TOutputNew, transform: (output: StandardSchemaV1.InferOutput<TOutput$1>) => MayPromise<StandardSchemaV1.InferOutput<TOutputNew>>): QueryFactoryWithResolve<TInputO, TOutputNew, TInput$1>;
|
|
384
|
+
}
|
|
385
|
+
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> {
|
|
386
|
+
protected outputSilk: TOutput$1;
|
|
387
|
+
protected readonly options: MutationOptions<TOutput$1, TInput$1>;
|
|
388
|
+
get "~meta"(): Mutation<TOutput$1, TInput$1>["~meta"];
|
|
389
|
+
constructor(outputSilk: TOutput$1, options: MutationOptions<TOutput$1, TInput$1>);
|
|
390
|
+
protected clone(options?: Partial<MutationOptions<TOutput$1, TInput$1>> | undefined): this;
|
|
391
|
+
input<TInputNew extends GraphQLSilk<TInputO>>(input: TInputNew): MutationFactoryWithResolve<TInputO, TOutput$1, TInputNew>;
|
|
392
|
+
output<TOutputNew extends GraphQLSilk>(output: TOutputNew, transform: (output: StandardSchemaV1.InferOutput<TOutput$1>) => MayPromise<StandardSchemaV1.InferOutput<TOutputNew>>): MutationFactoryWithResolve<TInputO, TOutputNew, TInput$1>;
|
|
393
|
+
}
|
|
394
|
+
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>> {
|
|
395
|
+
protected outputSilk: TOutput$1;
|
|
396
|
+
protected readonly options: FieldOptions<TParent$1, TOutput$1, TInput$1, string[] | undefined>;
|
|
397
|
+
get "~meta"(): Field<TParent$1, TOutput$1, TInput$1, string[] | undefined>["~meta"];
|
|
398
|
+
constructor(outputSilk: TOutput$1, options: FieldOptions<TParent$1, TOutput$1, TInput$1, string[] | undefined>);
|
|
399
|
+
protected clone(options?: Partial<FieldOptions<TParent$1, TOutput$1, TInput$1, string[] | undefined>> | undefined): this;
|
|
400
|
+
input<TInputNew extends GraphQLSilk<TInputO>>(input: TInputNew): FieldFactoryWithResolve<TParent$1, TOutput$1, TInputO, TInputNew>;
|
|
401
|
+
output<TOutputNew extends GraphQLSilk>(output: TOutputNew, transform: (output: StandardSchemaV1.InferOutput<TOutput$1>) => MayPromise<StandardSchemaV1.InferOutput<TOutputNew>>): FieldFactoryWithResolve<TParent$1, TOutputNew, TInputO, TInput$1>;
|
|
444
402
|
}
|
|
445
403
|
declare namespace types_loom_d_exports {
|
|
446
404
|
export { BaseField, Field, FieldMeta, FieldOrOperation, Mutation, Operation, Query, Resolver, Subscription };
|
|
@@ -456,51 +414,51 @@ interface FieldMeta extends GraphQLFieldOptions {
|
|
|
456
414
|
interface BaseField {
|
|
457
415
|
readonly "~meta": FieldMeta;
|
|
458
416
|
}
|
|
459
|
-
interface Field<TParent extends GraphQLSilk, TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void, TDependencies extends string[] | undefined = undefined> extends BaseField {
|
|
417
|
+
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 {
|
|
460
418
|
"~meta": {
|
|
461
419
|
operation: "field";
|
|
462
|
-
output: TOutput;
|
|
463
|
-
input: TInput;
|
|
420
|
+
output: TOutput$1;
|
|
421
|
+
input: TInput$1;
|
|
464
422
|
middlewares?: Middleware[];
|
|
465
|
-
dependencies?: TDependencies;
|
|
423
|
+
dependencies?: TDependencies$1;
|
|
466
424
|
types?: {
|
|
467
|
-
parent: ReSilk<TParent>;
|
|
425
|
+
parent: ReSilk<TParent$1>;
|
|
468
426
|
};
|
|
469
|
-
resolve: (parent: StandardSchemaV1.InferOutput<NonNullable<TParent>>, input: InferInputO<TInput>, payload: ResolverPayload | void) => Promise<StandardSchemaV1.InferOutput<TOutput>>;
|
|
427
|
+
resolve: (parent: StandardSchemaV1.InferOutput<NonNullable<TParent$1>>, input: InferInputO<TInput$1>, payload: ResolverPayload | void) => Promise<StandardSchemaV1.InferOutput<TOutput$1>>;
|
|
470
428
|
} & GraphQLFieldOptions;
|
|
471
429
|
}
|
|
472
|
-
interface Query<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void> extends BaseField {
|
|
430
|
+
interface Query<TOutput$1 extends GraphQLSilk, TInput$1 extends GraphQLSilk | Record<string, GraphQLSilk> | void = void> extends BaseField {
|
|
473
431
|
"~meta": {
|
|
474
432
|
operation: "query";
|
|
475
433
|
parent?: undefined;
|
|
476
|
-
output: TOutput;
|
|
477
|
-
input: TInput;
|
|
434
|
+
output: TOutput$1;
|
|
435
|
+
input: TInput$1;
|
|
478
436
|
middlewares?: Middleware[];
|
|
479
|
-
resolve: (input: InferInputO<TInput>, payload: ResolverPayload | void) => Promise<StandardSchemaV1.InferOutput<TOutput>>;
|
|
437
|
+
resolve: (input: InferInputO<TInput$1>, payload: ResolverPayload | void) => Promise<StandardSchemaV1.InferOutput<TOutput$1>>;
|
|
480
438
|
} & GraphQLFieldOptions;
|
|
481
439
|
}
|
|
482
|
-
interface Mutation<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void> extends BaseField {
|
|
440
|
+
interface Mutation<TOutput$1 extends GraphQLSilk, TInput$1 extends GraphQLSilk | Record<string, GraphQLSilk> | void = void> extends BaseField {
|
|
483
441
|
"~meta": {
|
|
484
442
|
operation: "mutation";
|
|
485
443
|
parent?: undefined;
|
|
486
|
-
output: TOutput;
|
|
487
|
-
input: TInput;
|
|
444
|
+
output: TOutput$1;
|
|
445
|
+
input: TInput$1;
|
|
488
446
|
middlewares?: Middleware[];
|
|
489
|
-
resolve: (input: InferInputO<TInput>, payload: ResolverPayload | void) => Promise<StandardSchemaV1.InferOutput<TOutput>>;
|
|
447
|
+
resolve: (input: InferInputO<TInput$1>, payload: ResolverPayload | void) => Promise<StandardSchemaV1.InferOutput<TOutput$1>>;
|
|
490
448
|
} & GraphQLFieldOptions;
|
|
491
449
|
}
|
|
492
|
-
interface Subscription<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void, TValue = StandardSchemaV1.InferOutput<TOutput>> extends BaseField {
|
|
450
|
+
interface Subscription<TOutput$1 extends GraphQLSilk, TInput$1 extends GraphQLSilk | Record<string, GraphQLSilk> | void = void, TValue = StandardSchemaV1.InferOutput<TOutput$1>> extends BaseField {
|
|
493
451
|
"~meta": {
|
|
494
452
|
operation: "subscription";
|
|
495
453
|
parent?: undefined;
|
|
496
|
-
output: TOutput;
|
|
497
|
-
input: TInput;
|
|
454
|
+
output: TOutput$1;
|
|
455
|
+
input: TInput$1;
|
|
498
456
|
middlewares?: Middleware[];
|
|
499
457
|
types?: {
|
|
500
458
|
value: TValue;
|
|
501
459
|
} & GraphQLFieldOptions;
|
|
502
|
-
resolve: (value: TValue, input: InferInputO<TInput>, payload: ResolverPayload | void) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>;
|
|
503
|
-
subscribe: (input: InferInputO<TInput>, payload: ResolverPayload | void) => MayPromise<AsyncIterator<TValue>>;
|
|
460
|
+
resolve: (value: TValue, input: InferInputO<TInput$1>, payload: ResolverPayload | void) => MayPromise<StandardSchemaV1.InferOutput<TOutput$1>>;
|
|
461
|
+
subscribe: (input: InferInputO<TInput$1>, payload: ResolverPayload | void) => MayPromise<AsyncIterator<TValue>>;
|
|
504
462
|
} & GraphQLFieldOptions;
|
|
505
463
|
}
|
|
506
464
|
interface Resolver {
|
|
@@ -513,14 +471,18 @@ interface Resolver {
|
|
|
513
471
|
}
|
|
514
472
|
type Operation = Query<GraphQLSilk, GraphQLSilk | Record<string, GraphQLSilk> | void> | Mutation<GraphQLSilk, GraphQLSilk | Record<string, GraphQLSilk> | void> | Subscription<GraphQLSilk, GraphQLSilk | Record<string, GraphQLSilk> | void, any>;
|
|
515
473
|
type FieldOrOperation = Field<GraphQLSilk, GraphQLSilk, GraphQLSilk | Record<string, GraphQLSilk> | void, string[] | undefined> | Operation;
|
|
516
|
-
type ReSilk<T extends GraphQLSilk> = GraphQLSilk<NonNullable<T["~standard"]["types"]>["output"], NonNullable<T["~standard"]["types"]>["input"]>;
|
|
474
|
+
type ReSilk<T$1 extends GraphQLSilk> = GraphQLSilk<NonNullable<T$1["~standard"]["types"]>["output"], NonNullable<T$1["~standard"]["types"]>["input"]>;
|
|
517
475
|
//#endregion
|
|
518
476
|
//#region src/resolver/types.d.ts
|
|
519
|
-
interface GraphQLSilk<TOutput = any, TInput = any> extends StandardSchemaV1<TInput, TOutput> {
|
|
477
|
+
interface GraphQLSilk<TOutput$1 = any, TInput$1 = any> extends StandardSchemaV1<TInput$1, TOutput$1> {
|
|
520
478
|
/**
|
|
521
479
|
* GraphQL type for schema
|
|
522
480
|
*/
|
|
523
|
-
[GET_GRAPHQL_TYPE]?:
|
|
481
|
+
[GET_GRAPHQL_TYPE]?: MayGetter<GraphQLOutputType>;
|
|
482
|
+
/**
|
|
483
|
+
* GraphQL argument config for schema
|
|
484
|
+
*/
|
|
485
|
+
[GET_GRAPHQL_ARGUMENT_CONFIG]?: MayGetter<Omit<GraphQLArgumentConfig, "type" | "astNode"> | undefined>;
|
|
524
486
|
}
|
|
525
487
|
interface ResolverOptions<TField extends FieldOrOperation = FieldOrOperation> {
|
|
526
488
|
middlewares?: Middleware<TField>[];
|
|
@@ -540,33 +502,33 @@ type InferFieldOutput<TField extends BaseField> = TField["~meta"]["output"];
|
|
|
540
502
|
/**
|
|
541
503
|
* Options for creating a GraphQL Query.
|
|
542
504
|
*/
|
|
543
|
-
interface QueryOptions<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void> extends ResolverOptions<Query<TOutput, TInput>>, GraphQLFieldOptions {
|
|
544
|
-
input?: TInput;
|
|
545
|
-
resolve: (input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>;
|
|
505
|
+
interface QueryOptions<TOutput$1 extends GraphQLSilk, TInput$1 extends GraphQLSilk | Record<string, GraphQLSilk> | void = void> extends ResolverOptions<Query<TOutput$1, TInput$1>>, GraphQLFieldOptions {
|
|
506
|
+
input?: TInput$1;
|
|
507
|
+
resolve: (input: InferInputO<TInput$1>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput$1>>;
|
|
546
508
|
}
|
|
547
509
|
/**
|
|
548
510
|
* Options for creating a GraphQL Mutation.
|
|
549
511
|
*/
|
|
550
|
-
interface MutationOptions<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined> extends ResolverOptions<Mutation<TOutput, TInput>>, GraphQLFieldOptions {
|
|
551
|
-
input?: TInput;
|
|
552
|
-
resolve: (input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>;
|
|
512
|
+
interface MutationOptions<TOutput$1 extends GraphQLSilk, TInput$1 extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined> extends ResolverOptions<Mutation<TOutput$1, TInput$1>>, GraphQLFieldOptions {
|
|
513
|
+
input?: TInput$1;
|
|
514
|
+
resolve: (input: InferInputO<TInput$1>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput$1>>;
|
|
553
515
|
}
|
|
554
516
|
/**
|
|
555
517
|
* Function to create a GraphQL query.
|
|
556
518
|
*/
|
|
557
519
|
interface QueryFactory {
|
|
558
|
-
<TOutput extends GraphQLSilk>(output: TOutput, resolve: (input: void, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>): Query<TOutput, void>;
|
|
559
|
-
<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void>(output: TOutput, options: QueryOptions<TOutput, TInput>): Query<TOutput, TInput>;
|
|
560
|
-
<TOutput extends GraphQLSilk>(output: TOutput): QueryChainFactory<TOutput, void>;
|
|
520
|
+
<TOutput$1 extends GraphQLSilk>(output: TOutput$1, resolve: (input: void, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput$1>>): Query<TOutput$1, void>;
|
|
521
|
+
<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>;
|
|
522
|
+
<TOutput$1 extends GraphQLSilk>(output: TOutput$1): QueryChainFactory<TOutput$1, void>;
|
|
561
523
|
}
|
|
562
524
|
interface QueryFactoryWithChain extends QueryFactory, QueryChainFactory<never, void> {}
|
|
563
525
|
/**
|
|
564
526
|
* Function to create a GraphQL mutation.
|
|
565
527
|
*/
|
|
566
528
|
interface MutationFactory {
|
|
567
|
-
<TOutput extends GraphQLSilk>(output: TOutput, resolve: (input: void, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>): Mutation<TOutput, undefined>;
|
|
568
|
-
<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined>(output: TOutput, options: MutationOptions<TOutput, TInput>): Mutation<TOutput, TInput>;
|
|
569
|
-
<TOutput extends GraphQLSilk>(output: TOutput): MutationChainFactory<TOutput, undefined>;
|
|
529
|
+
<TOutput$1 extends GraphQLSilk>(output: TOutput$1, resolve: (input: void, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput$1>>): Mutation<TOutput$1, undefined>;
|
|
530
|
+
<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>;
|
|
531
|
+
<TOutput$1 extends GraphQLSilk>(output: TOutput$1): MutationChainFactory<TOutput$1, undefined>;
|
|
570
532
|
}
|
|
571
533
|
/**
|
|
572
534
|
* Function to create a GraphQL mutation.
|
|
@@ -575,28 +537,28 @@ interface MutationFactoryWithChain extends MutationFactory, MutationChainFactory
|
|
|
575
537
|
/**
|
|
576
538
|
* Options for External Filed of existing GraphQL Object.
|
|
577
539
|
*/
|
|
578
|
-
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 {
|
|
579
|
-
input?: TInput;
|
|
580
|
-
dependencies?: TDependencies;
|
|
581
|
-
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>>;
|
|
540
|
+
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 {
|
|
541
|
+
input?: TInput$1;
|
|
542
|
+
dependencies?: TDependencies$1;
|
|
543
|
+
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>>;
|
|
582
544
|
}
|
|
583
545
|
/**
|
|
584
546
|
* Function to create a GraphQL Field.
|
|
585
547
|
*/
|
|
586
548
|
interface FieldFactory {
|
|
587
|
-
<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>;
|
|
588
|
-
<TParent extends GraphQLSilk, TOutput extends GraphQLSilk>(output: TOutput, options: FieldOptions<TParent, TOutput, undefined, undefined>): Field<TParent, TOutput, undefined, undefined>;
|
|
589
|
-
<TParent extends GraphQLSilk, TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | undefined>(output: TOutput, options: FieldOptions<TParent, TOutput, TInput, undefined> & {
|
|
590
|
-
input: TInput;
|
|
591
|
-
}): Field<TParent, TOutput, TInput, undefined>;
|
|
592
|
-
<TParent extends GraphQLSilk, TOutput extends GraphQLSilk, const TDependencies extends string[] | undefined>(output: TOutput, options: FieldOptions<TParent, TOutput, undefined, TDependencies> & {
|
|
593
|
-
dependencies: TDependencies;
|
|
594
|
-
}): Field<TParent, TOutput, undefined, TDependencies>;
|
|
595
|
-
<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> & {
|
|
596
|
-
input: TInput;
|
|
597
|
-
dependencies: TDependencies;
|
|
598
|
-
}): Field<TParent, TOutput, TInput, TDependencies>;
|
|
599
|
-
<TOutput extends GraphQLSilk>(output: TOutput): FieldChainFactory<TOutput, undefined, undefined>;
|
|
549
|
+
<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>;
|
|
550
|
+
<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>;
|
|
551
|
+
<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> & {
|
|
552
|
+
input: TInput$1;
|
|
553
|
+
}): Field<TParent$1, TOutput$1, TInput$1, undefined>;
|
|
554
|
+
<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> & {
|
|
555
|
+
dependencies: TDependencies$1;
|
|
556
|
+
}): Field<TParent$1, TOutput$1, undefined, TDependencies$1>;
|
|
557
|
+
<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> & {
|
|
558
|
+
input: TInput$1;
|
|
559
|
+
dependencies: TDependencies$1;
|
|
560
|
+
}): Field<TParent$1, TOutput$1, TInput$1, TDependencies$1>;
|
|
561
|
+
<TOutput$1 extends GraphQLSilk>(output: TOutput$1): FieldChainFactory<TOutput$1, undefined, undefined>;
|
|
600
562
|
}
|
|
601
563
|
interface FieldFactoryWithUtils extends FieldFactory, FieldChainFactory<never, undefined, undefined> {
|
|
602
564
|
/** Set fields to be hidden in GraphQL Schema */
|
|
@@ -605,18 +567,18 @@ interface FieldFactoryWithUtils extends FieldFactory, FieldChainFactory<never, u
|
|
|
605
567
|
/**
|
|
606
568
|
* Options for creating a GraphQL Subscription.
|
|
607
569
|
*/
|
|
608
|
-
interface SubscriptionOptions<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined, TValue = StandardSchemaV1.InferOutput<TOutput>> extends ResolverOptions<Subscription<TOutput, TInput, TValue>>, GraphQLFieldOptions {
|
|
609
|
-
input?: TInput;
|
|
610
|
-
subscribe: (input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<AsyncIterator<TValue>>;
|
|
611
|
-
resolve?: (value: TValue, input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>;
|
|
570
|
+
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 {
|
|
571
|
+
input?: TInput$1;
|
|
572
|
+
subscribe: (input: InferInputO<TInput$1>, payload: ResolverPayload | undefined) => MayPromise<AsyncIterator<TValue>>;
|
|
573
|
+
resolve?: (value: TValue, input: InferInputO<TInput$1>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput$1>>;
|
|
612
574
|
}
|
|
613
575
|
/**
|
|
614
576
|
* Function to create a GraphQL subscription.
|
|
615
577
|
*/
|
|
616
578
|
interface SubscriptionFactory {
|
|
617
|
-
<TOutput extends GraphQLSilk, TValue = StandardSchemaV1.InferOutput<TOutput>>(output: TOutput, subscribe: (payload: ResolverPayload | undefined) => MayPromise<AsyncIterator<StandardSchemaV1.InferOutput<TOutput>>>): Subscription<TOutput, undefined, TValue>;
|
|
618
|
-
<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>;
|
|
619
|
-
<TOutput extends GraphQLSilk>(output: TOutput): SubscriptionChainFactory<TOutput, undefined>;
|
|
579
|
+
<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>;
|
|
580
|
+
<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>;
|
|
581
|
+
<TOutput$1 extends GraphQLSilk>(output: TOutput$1): SubscriptionChainFactory<TOutput$1, undefined>;
|
|
620
582
|
}
|
|
621
583
|
interface SubscriptionFactoryWithChain extends SubscriptionFactory, SubscriptionChainFactory<never, undefined> {}
|
|
622
584
|
/**
|
|
@@ -654,59 +616,262 @@ declare function getFieldOptions({
|
|
|
654
616
|
extensions
|
|
655
617
|
}: GraphQLFieldOptions, extraExtensions?: GraphQLFieldExtensions<any, any, any>): GraphQLFieldOptions;
|
|
656
618
|
//#endregion
|
|
657
|
-
//#region src/
|
|
619
|
+
//#region src/utils/constants.d.ts
|
|
620
|
+
declare const DERIVED_DEPENDENCIES = "loom.derived-from-dependencies";
|
|
621
|
+
declare const AUTO_ALIASING = "__gqloom_auto_aliasing";
|
|
622
|
+
//#endregion
|
|
623
|
+
//#region src/utils/context.d.ts
|
|
658
624
|
/**
|
|
659
|
-
*
|
|
625
|
+
* Empty Resolver Arguments that only store the memoization
|
|
660
626
|
*/
|
|
661
|
-
|
|
627
|
+
interface OnlyMemoizationPayload {
|
|
628
|
+
memoization: WeakMap<WeakKey, any>;
|
|
629
|
+
isMemoization: true;
|
|
630
|
+
}
|
|
662
631
|
/**
|
|
663
|
-
* Create
|
|
632
|
+
* Create an empty memoization payload for the resolver
|
|
633
|
+
* @returns the empty memoization payload
|
|
664
634
|
*/
|
|
665
|
-
declare function
|
|
635
|
+
declare function onlyMemoization(): OnlyMemoizationPayload;
|
|
636
|
+
declare function isOnlyMemoryPayload(payload: OnlyMemoizationPayload | Pick<ResolverPayload, "context">): payload is OnlyMemoizationPayload;
|
|
637
|
+
declare function getMemoizationMap(payload: OnlyMemoizationPayload | Pick<ResolverPayload, "context">): WeakMap<WeakKey, any>;
|
|
638
|
+
interface ContextMemoryContainer {
|
|
639
|
+
[CONTEXT_MAP_KEY]?: WeakMap<WeakKey, any>;
|
|
640
|
+
}
|
|
641
|
+
declare function assignContextMap(target: ContextMemoryContainer): WeakMap<WeakKey, any>;
|
|
642
|
+
//#endregion
|
|
643
|
+
//#region src/utils/error.d.ts
|
|
644
|
+
declare function markErrorLocation<TError>(error: TError, ...locations: string[]): TError;
|
|
645
|
+
declare function tryIn<T$1>(func: () => T$1, ...locations: string[]): T$1;
|
|
666
646
|
/**
|
|
667
|
-
*
|
|
647
|
+
* mark message with location
|
|
648
|
+
* @param message origin message
|
|
649
|
+
* @param locations where error happened
|
|
650
|
+
* @returns message with location
|
|
651
|
+
* @example markLocation("error", "banana") // "[banana] hello"
|
|
652
|
+
* @example markLocation("error", fruit, banana) // "[fruit.banana] error"
|
|
653
|
+
* @example markLocation("[banana] error", "fruit") // "[fruit.banana] error"
|
|
654
|
+
* @example markLocation("[fruit.banana] error", "favorite") // "[favorite.fruit.banana] error"
|
|
668
655
|
*/
|
|
669
|
-
declare function
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
656
|
+
declare function markLocation(message: string, ...locations: string[]): string;
|
|
657
|
+
//#endregion
|
|
658
|
+
//#region src/utils/loader.d.ts
|
|
659
|
+
type BatchLoadFn<TKey, TData> = (keys: TKey[]) => Promise<(TData | Error)[]>;
|
|
660
|
+
/**
|
|
661
|
+
* GraphQL Loom built-in data loader.
|
|
662
|
+
*/
|
|
663
|
+
declare abstract class LoomDataLoader<TKey, TData> {
|
|
664
|
+
protected abstract batchLoad(keys: TKey[]): Promise<(TData | Error)[]>;
|
|
665
|
+
protected results: Map<TKey, Promise<TData>>;
|
|
666
|
+
protected resolvers: Map<TKey, [resolve: (value: TData | PromiseLike<TData>) => void, reject: (reason?: any) => void]>;
|
|
667
|
+
constructor();
|
|
668
|
+
/**
|
|
669
|
+
* Load data for a given key.
|
|
670
|
+
* @param key - The key to load data for.
|
|
671
|
+
* @returns A promise that resolves to the loaded data.
|
|
672
|
+
*/
|
|
673
|
+
load(key: TKey): Promise<TData>;
|
|
674
|
+
/**
|
|
675
|
+
* Clear the cache and reset the loader.
|
|
676
|
+
*/
|
|
677
|
+
clear(): void;
|
|
678
|
+
protected executeBatchLoad(): Promise<void>;
|
|
679
|
+
protected nextTickPromise?: Promise<void>;
|
|
680
|
+
protected nextTickBatchLoad(): Promise<void>;
|
|
681
|
+
static nextTick(): Promise<void>;
|
|
676
682
|
}
|
|
677
|
-
|
|
683
|
+
declare class EasyDataLoader<TKey, TData> extends LoomDataLoader<TKey, TData> {
|
|
684
|
+
protected readonly batchLoadFn: BatchLoadFn<TKey, TData>;
|
|
685
|
+
protected batchLoad(keys: TKey[]): Promise<(TData | Error)[]>;
|
|
686
|
+
constructor(batchLoadFn: BatchLoadFn<TKey, TData>);
|
|
687
|
+
}
|
|
688
|
+
//#endregion
|
|
689
|
+
//#region src/utils/types.d.ts
|
|
690
|
+
type MayPromise<T$1> = T$1 | Promise<T$1>;
|
|
691
|
+
type IsAny<T$1> = 0 extends 1 & T$1 ? true : false;
|
|
692
|
+
type ValueOf<T$1 extends object> = T$1[keyof T$1];
|
|
693
|
+
type OmitInUnion<TUnion, TOmit> = TUnion extends infer T ? T extends TOmit ? never : T : never;
|
|
694
|
+
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] };
|
|
695
|
+
type MayGetter<T$1> = T$1 | (() => T$1);
|
|
696
|
+
//#endregion
|
|
697
|
+
//#region src/utils/middleware.d.ts
|
|
678
698
|
/**
|
|
679
|
-
*
|
|
699
|
+
* The operation of the field:
|
|
700
|
+
* - `field`
|
|
701
|
+
* - `query`
|
|
702
|
+
* - `mutation`
|
|
703
|
+
* - `subscription.resolve`
|
|
704
|
+
* - `subscription.subscribe`
|
|
705
|
+
* - `resolveReference`
|
|
680
706
|
*/
|
|
681
|
-
|
|
682
|
-
|
|
707
|
+
type MiddlewareOperation = "field" | "query" | "mutation" | "subscription.resolve" | "subscription.subscribe" | "resolveReference";
|
|
708
|
+
interface MiddlewareOptions<TField extends BaseField = BaseField> {
|
|
709
|
+
/** The Output Silk */
|
|
710
|
+
outputSilk: StandardSchemaV1.InferOutput<InferFieldOutput<TField>>;
|
|
711
|
+
/** The previous object. */
|
|
712
|
+
parent: InferFieldParent<TField>;
|
|
713
|
+
/** A function to parse the input */
|
|
714
|
+
parseInput: CallableInputParser<TField["~meta"]["input"]>;
|
|
715
|
+
/** The executing operation */
|
|
716
|
+
operation: MiddlewareOperation;
|
|
717
|
+
/** The payload of the resolver */
|
|
718
|
+
payload: ResolverPayload | undefined;
|
|
719
|
+
}
|
|
720
|
+
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;
|
|
721
|
+
interface CallableMiddlewareOptions<TField extends BaseField = BaseField> extends MiddlewareOptions<TField> {
|
|
722
|
+
/** The function to call next in the middleware chain. */
|
|
723
|
+
next: () => MayPromise<StandardSchemaV1.InferOutput<InferFieldOutput<TField>>>;
|
|
724
|
+
/** The function to call next in the middleware chain. */
|
|
725
|
+
(): MayPromise<StandardSchemaV1.InferOutput<InferFieldOutput<TField>>>;
|
|
726
|
+
}
|
|
727
|
+
interface MiddlewareConfig {
|
|
728
|
+
/** The operations to apply the middleware to. */
|
|
729
|
+
operations?: MiddlewareOperation[];
|
|
730
|
+
}
|
|
731
|
+
interface Middleware<TField extends BaseField = any> extends Partial<MiddlewareConfig> {
|
|
732
|
+
(options: CallableMiddlewareOptions<TField>): MayPromise<StandardSchemaV1.InferOutput<InferFieldOutput<TField>>>;
|
|
733
|
+
}
|
|
734
|
+
declare function applyMiddlewares<TField extends BaseField = BaseField>(options: MiddlewareOptions<TField>, resolveFunction: () => MayPromise<StandardSchemaV1.InferOutput<InferFieldOutput<TField>>>, middlewares: Middleware[]): Promise<StandardSchemaV1.InferOutput<InferFieldOutput<TField>>>;
|
|
735
|
+
declare function filterMiddlewares(operation: MiddlewareOperation, ...middlewareList: (Middleware | Iterable<Middleware> | undefined | null)[]): Middleware[];
|
|
736
|
+
//#endregion
|
|
737
|
+
//#region src/utils/object.d.ts
|
|
683
738
|
/**
|
|
684
|
-
*
|
|
739
|
+
* Creates an object map with the same keys as `map` and values generated by
|
|
740
|
+
* running each value of `record` thru `fn`.
|
|
685
741
|
*/
|
|
686
|
-
declare function
|
|
687
|
-
|
|
742
|
+
declare function mapValue<T$1, V>(record: Record<string, T$1>, fn: (value: T$1, key: string) => V | typeof mapValue.SKIP): Record<string, V>;
|
|
743
|
+
declare namespace mapValue {
|
|
744
|
+
var SKIP: unique symbol;
|
|
745
|
+
}
|
|
746
|
+
declare function toObjMap<T$1>(obj: Maybe<ReadOnlyObjMapLike<T$1>>): ReadOnlyObjMap<T$1>;
|
|
747
|
+
declare function notNullish<T$1>(x: T$1 | undefined | null): x is T$1;
|
|
748
|
+
declare function deepMerge<T$1 extends Record<string, any>>(...objects: (T$1 | null | undefined)[]): T$1;
|
|
688
749
|
/**
|
|
689
|
-
*
|
|
750
|
+
* Wraps the provided data in an object with a single key `"~meta"`.
|
|
751
|
+
*
|
|
752
|
+
* @template T - The type of the data to be wrapped.
|
|
753
|
+
* @param {T} data - The data to be wrapped.
|
|
754
|
+
* @returns {{ "~meta": T }} - An object with a single key `"~meta"` containing the provided data.
|
|
755
|
+
* @example
|
|
756
|
+
* const originalData = { key: "value" };
|
|
757
|
+
* const metaData = meta(originalData);
|
|
758
|
+
* console.log(metaData); // Output: { "~meta": { key: "value" } }
|
|
690
759
|
*/
|
|
691
|
-
declare function
|
|
760
|
+
declare function meta<T$1>(data: T$1): {
|
|
761
|
+
"~meta": T$1;
|
|
762
|
+
};
|
|
763
|
+
type Maybe<T$1> = null | undefined | T$1;
|
|
764
|
+
type ReadOnlyObjMapLike<T$1> = ReadOnlyObjMap<T$1> | {
|
|
765
|
+
readonly [key: string]: T$1;
|
|
766
|
+
};
|
|
767
|
+
interface ReadOnlyObjMap<T$1> {
|
|
768
|
+
readonly [key: string]: T$1;
|
|
769
|
+
}
|
|
770
|
+
//#endregion
|
|
771
|
+
//#region src/utils/parse-resolving-fields.d.ts
|
|
692
772
|
/**
|
|
693
|
-
*
|
|
694
|
-
* @param silk GraphQL Silk
|
|
695
|
-
* @returns GraphQL Output Type
|
|
773
|
+
* Represents the state of field resolution in a GraphQL query.
|
|
696
774
|
*/
|
|
697
|
-
|
|
775
|
+
interface ResolvingFields {
|
|
776
|
+
/**
|
|
777
|
+
* Fields explicitly requested in the GraphQL query
|
|
778
|
+
*/
|
|
779
|
+
requestedFields: ReadonlySet<string>;
|
|
780
|
+
/**
|
|
781
|
+
* Fields that are derived from other fields (computed fields)
|
|
782
|
+
*/
|
|
783
|
+
derivedFields: ReadonlySet<string>;
|
|
784
|
+
/**
|
|
785
|
+
* Fields that derived fields depend on
|
|
786
|
+
*/
|
|
787
|
+
derivedDependencies: ReadonlySet<string>;
|
|
788
|
+
/**
|
|
789
|
+
* Final set of fields that need to be resolved, after processing derived fields
|
|
790
|
+
*/
|
|
791
|
+
selectedFields: ReadonlySet<string>;
|
|
792
|
+
}
|
|
793
|
+
interface ResolvingFieldsOptions {
|
|
794
|
+
/**
|
|
795
|
+
* Whether to include GraphQL introspection/meta fields (names starting with "__").
|
|
796
|
+
* Default: false (filtered out).
|
|
797
|
+
*/
|
|
798
|
+
includeIntrospection?: boolean;
|
|
799
|
+
/**
|
|
800
|
+
* Maximum depth of nested fields to parse.
|
|
801
|
+
* Default: Infinity for deep helpers; default is handled per caller.
|
|
802
|
+
*/
|
|
803
|
+
maxDepth?: number;
|
|
804
|
+
}
|
|
698
805
|
/**
|
|
699
|
-
*
|
|
700
|
-
*
|
|
701
|
-
* @param
|
|
702
|
-
* @
|
|
806
|
+
* Analyzes and processes field resolution in a GraphQL query deeply.
|
|
807
|
+
*
|
|
808
|
+
* @param payload - The resolver payload containing the current field resolution context
|
|
809
|
+
* @param options - Additional parsing options (e.g., includeIntrospection, maxDepth; default maxDepth = Infinity)
|
|
810
|
+
* @returns A map of field paths to their resolving fields
|
|
703
811
|
*/
|
|
704
|
-
declare function
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
812
|
+
declare function getDeepResolvingFields(payload: Pick<ResolverPayload, "info">, options?: ResolvingFieldsOptions): Map<string, ResolvingFields>;
|
|
813
|
+
/**
|
|
814
|
+
* Analyzes and processes field resolution in a GraphQL query.
|
|
815
|
+
*
|
|
816
|
+
* @param payload - The resolver payload containing the current field resolution context
|
|
817
|
+
* @param options - Additional parsing options (e.g., includeIntrospection; fixed maxDepth = 1)
|
|
818
|
+
* @returns An object containing sets of different field types
|
|
819
|
+
*/
|
|
820
|
+
declare function getResolvingFields(payload: Pick<ResolverPayload, "info">, options?: Omit<ResolvingFieldsOptions, "maxDepth">): ResolvingFields;
|
|
821
|
+
/**
|
|
822
|
+
* Parses the GraphQL resolve info to extract all requested fields.
|
|
823
|
+
* Returns a Set of field paths where nested fields are represented as 'parent.field'.
|
|
824
|
+
* Supports @include, @skip directives, fragments, and variables.
|
|
825
|
+
*
|
|
826
|
+
* @param info - The GraphQL resolve info object containing the query information
|
|
827
|
+
* @param options - Additional parsing options (e.g., includeIntrospection, maxDepth; default maxDepth = 1)
|
|
828
|
+
* @returns A Set of field paths
|
|
829
|
+
*/
|
|
830
|
+
declare function parseResolvingFields(info: GraphQLResolveInfo, options?: ResolvingFieldsOptions): Set<string>;
|
|
831
|
+
//#endregion
|
|
832
|
+
//#region src/utils/string.d.ts
|
|
833
|
+
declare function pascalCase(str: string): string;
|
|
834
|
+
declare function capitalize<T$1 extends string>(str: T$1): Capitalize<T$1>;
|
|
835
|
+
declare function screamingSnakeCase(str: string): string;
|
|
836
|
+
//#endregion
|
|
837
|
+
//#region src/resolver/input.d.ts
|
|
838
|
+
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;
|
|
839
|
+
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;
|
|
840
|
+
interface CallableInputParser<TSchema extends GraphQLSilk | Record<string, GraphQLSilk> | void> {
|
|
841
|
+
/**
|
|
842
|
+
* input schema
|
|
843
|
+
*/
|
|
844
|
+
schema: TSchema;
|
|
845
|
+
/**
|
|
846
|
+
* Origin value to parse
|
|
847
|
+
*/
|
|
848
|
+
value: InferInputI<TSchema>;
|
|
849
|
+
/**
|
|
850
|
+
* Parse the input and return the standard result
|
|
851
|
+
*/
|
|
852
|
+
(): Promise<StandardSchemaV1.Result<InferInputO<TSchema>>>;
|
|
853
|
+
/**
|
|
854
|
+
* Result of parsing. Set it to `undefined` then the parser will run again.
|
|
855
|
+
*/
|
|
856
|
+
result: StandardSchemaV1.Result<InferInputO<TSchema>> | undefined;
|
|
857
|
+
/**
|
|
858
|
+
* Parse the input and return the result
|
|
859
|
+
*/
|
|
860
|
+
getResult(): Promise<InferInputO<TSchema>>;
|
|
861
|
+
/**
|
|
862
|
+
* Set the result's value of parsing
|
|
863
|
+
*/
|
|
864
|
+
setResult(value: InferInputO<TSchema>): void;
|
|
865
|
+
/**
|
|
866
|
+
* Clear the result of parsing, the parser will run again to get the result.
|
|
867
|
+
*/
|
|
868
|
+
clearResult(): void;
|
|
869
|
+
}
|
|
870
|
+
declare function createInputParser<TSchema extends GraphQLSilk | Record<string, GraphQLSilk> | void>(schema: TSchema, value: InferInputI<TSchema>): CallableInputParser<TSchema>;
|
|
871
|
+
declare function parseInputValue<TSchema extends GraphQLSilk | Record<string, GraphQLSilk> | void>(inputSchema: TSchema, input: any): MayPromise<StandardSchemaV1.Result<InferInputO<TSchema>>>;
|
|
872
|
+
declare function getStandardValue<T$1>(result: StandardSchemaV1.Result<T$1>): T$1;
|
|
873
|
+
declare function getStandardValue<T$1>(result?: StandardSchemaV1.Result<T$1>): T$1 | undefined;
|
|
874
|
+
declare function getStandardValue<T$1>(result: StandardSchemaV1.Result<T$1> | null): T$1 | null;
|
|
710
875
|
//#endregion
|
|
711
876
|
//#region src/resolver/resolver.d.ts
|
|
712
877
|
/**
|
|
@@ -794,7 +959,7 @@ interface ResolverFactory {
|
|
|
794
959
|
* @param fields - The fields to resolve
|
|
795
960
|
* @param options - Optional resolver options
|
|
796
961
|
*/
|
|
797
|
-
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>;
|
|
962
|
+
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>;
|
|
798
963
|
/**
|
|
799
964
|
* Creates a resolver for operations
|
|
800
965
|
* @template TFields - The operations to resolve
|
|
@@ -837,9 +1002,9 @@ declare class ChainResolver<TFields extends Record<string, FieldOrOperation | ty
|
|
|
837
1002
|
* @template TParent - The parent type
|
|
838
1003
|
* @template TFields - The fields to resolve
|
|
839
1004
|
*/
|
|
840
|
-
declare class ObjectChainResolver<TParent extends GraphQLSilk, TFields extends Record<string, FieldOrOperation | typeof FIELD_HIDDEN>> extends ChainResolver<TFields> {
|
|
1005
|
+
declare class ObjectChainResolver<TParent$1 extends GraphQLSilk, TFields extends Record<string, FieldOrOperation | typeof FIELD_HIDDEN>> extends ChainResolver<TFields> {
|
|
841
1006
|
protected meta: ResolverMeta<TFields> & {
|
|
842
|
-
parent: TParent;
|
|
1007
|
+
parent: TParent$1;
|
|
843
1008
|
};
|
|
844
1009
|
/**
|
|
845
1010
|
* Creates a new object chain resolver
|
|
@@ -847,12 +1012,12 @@ declare class ObjectChainResolver<TParent extends GraphQLSilk, TFields extends R
|
|
|
847
1012
|
* @param fields - The fields to resolve
|
|
848
1013
|
* @param options - Optional resolver options
|
|
849
1014
|
*/
|
|
850
|
-
constructor(parent: TParent, fields: TFields, options?: ResolverOptionsWithExtensions<any>);
|
|
1015
|
+
constructor(parent: TParent$1, fields: TFields, options?: ResolverOptionsWithExtensions<any>);
|
|
851
1016
|
/**
|
|
852
1017
|
* Gets the metadata for the resolver
|
|
853
1018
|
*/
|
|
854
1019
|
get "~meta"(): ResolverMeta<TFields> & {
|
|
855
|
-
parent: TParent;
|
|
1020
|
+
parent: TParent$1;
|
|
856
1021
|
};
|
|
857
1022
|
/**
|
|
858
1023
|
* Sets custom extensions for the resolver
|
|
@@ -866,207 +1031,97 @@ declare class ObjectChainResolver<TParent extends GraphQLSilk, TFields extends R
|
|
|
866
1031
|
*/
|
|
867
1032
|
type Executor<TFields extends Record<string, FieldOrOperation | typeof FIELD_HIDDEN>> = { [K in keyof TFields]: TFields[K] extends Field<infer TParent, infer TOutput, infer TInput, string[] | undefined> ? (parent: StandardSchemaV1.InferOutput<TParent>, args: InferInputI<TInput>, payload: ResolverPayload | void) => Promise<StandardSchemaV1.InferOutput<TOutput>> : TFields[K] extends Query<infer TOutput, infer TInput> ? (args: InferInputI<TInput>, payload: ResolverPayload | void) => Promise<StandardSchemaV1.InferOutput<TOutput>> : TFields[K] extends Mutation<infer TOutput, infer TInput> ? (args: InferInputI<TInput>, payload: ResolverPayload | void) => Promise<StandardSchemaV1.InferOutput<TOutput>> : never };
|
|
868
1033
|
//#endregion
|
|
869
|
-
//#region src/
|
|
1034
|
+
//#region src/resolver/silk.d.ts
|
|
870
1035
|
/**
|
|
871
|
-
*
|
|
872
|
-
* - `field`
|
|
873
|
-
* - `query`
|
|
874
|
-
* - `mutation`
|
|
875
|
-
* - `subscription.resolve`
|
|
876
|
-
* - `subscription.subscribe`
|
|
877
|
-
* - `resolveReference`
|
|
1036
|
+
* Create a Silk from Scalar.
|
|
878
1037
|
*/
|
|
879
|
-
|
|
880
|
-
interface MiddlewareOptions<TField extends BaseField = BaseField> {
|
|
881
|
-
/** The Output Silk */
|
|
882
|
-
outputSilk: StandardSchemaV1.InferOutput<InferFieldOutput<TField>>;
|
|
883
|
-
/** The previous object. */
|
|
884
|
-
parent: InferFieldParent<TField>;
|
|
885
|
-
/** A function to parse the input */
|
|
886
|
-
parseInput: CallableInputParser<TField["~meta"]["input"]>;
|
|
887
|
-
/** The executing operation */
|
|
888
|
-
operation: MiddlewareOperation;
|
|
889
|
-
/** The payload of the resolver */
|
|
890
|
-
payload: ResolverPayload | undefined;
|
|
891
|
-
}
|
|
892
|
-
type InferFieldParent<TField extends BaseField> = TField extends Field<infer TParent, any, any, infer TDependencies> ? TDependencies extends string[] ? RequireKeys<NonNullable<StandardSchemaV1.InferOutput<TParent>>, TDependencies[number]> : NonNullable<StandardSchemaV1.InferOutput<TParent>> : undefined;
|
|
893
|
-
interface CallableMiddlewareOptions<TField extends BaseField = BaseField> extends MiddlewareOptions<TField> {
|
|
894
|
-
/** The function to call next in the middleware chain. */
|
|
895
|
-
next: () => MayPromise<StandardSchemaV1.InferOutput<InferFieldOutput<TField>>>;
|
|
896
|
-
/** The function to call next in the middleware chain. */
|
|
897
|
-
(): MayPromise<StandardSchemaV1.InferOutput<InferFieldOutput<TField>>>;
|
|
898
|
-
}
|
|
899
|
-
interface MiddlewareConfig {
|
|
900
|
-
/** The operations to apply the middleware to. */
|
|
901
|
-
operations?: MiddlewareOperation[];
|
|
902
|
-
}
|
|
903
|
-
interface Middleware<TField extends BaseField = any> extends Partial<MiddlewareConfig> {
|
|
904
|
-
(options: CallableMiddlewareOptions<TField>): MayPromise<StandardSchemaV1.InferOutput<InferFieldOutput<TField>>>;
|
|
905
|
-
}
|
|
906
|
-
declare function applyMiddlewares<TField extends BaseField = BaseField>(options: MiddlewareOptions<TField>, resolveFunction: () => MayPromise<StandardSchemaV1.InferOutput<InferFieldOutput<TField>>>, middlewares: Middleware[]): Promise<StandardSchemaV1.InferOutput<InferFieldOutput<TField>>>;
|
|
907
|
-
declare function filterMiddlewares(operation: MiddlewareOperation, ...middlewareList: (Middleware | Iterable<Middleware> | undefined | null)[]): Middleware[];
|
|
908
|
-
//#endregion
|
|
909
|
-
//#region src/utils/object.d.ts
|
|
1038
|
+
declare function silk<TScalar extends GraphQLVariants<GraphQLScalarType>>(type: TScalar | (() => TScalar), validate?: (value: InferScalarExternalByVariants<TScalar>) => StandardSchemaV1.Result<InferScalarExternalByVariants<TScalar>> | Promise<StandardSchemaV1.Result<InferScalarInternalByVariants<TScalar>>>): GraphQLSilk<InferScalarInternalByVariants<TScalar>, InferScalarInternalByVariants<TScalar>>;
|
|
910
1039
|
/**
|
|
911
|
-
*
|
|
912
|
-
* running each value of `record` thru `fn`.
|
|
1040
|
+
* Create a GraphQLSilk Object.
|
|
913
1041
|
*/
|
|
914
|
-
declare function
|
|
915
|
-
declare namespace mapValue {
|
|
916
|
-
var SKIP: unique symbol;
|
|
917
|
-
}
|
|
918
|
-
declare function toObjMap<T>(obj: Maybe<ReadOnlyObjMapLike<T>>): ReadOnlyObjMap<T>;
|
|
919
|
-
declare function notNullish<T>(x: T | undefined | null): x is T;
|
|
920
|
-
declare function deepMerge<T extends Record<string, any>>(...objects: (T | null | undefined)[]): T;
|
|
1042
|
+
declare function silk<TObject extends GraphQLVariants<GraphQLObjectType>>(type: TObject | (() => TObject), validate?: (value: InferObjectSourceByVariants<TObject>) => StandardSchemaV1.Result<InferObjectSourceByVariants<TObject>> | Promise<StandardSchemaV1.Result<InferObjectSourceByVariants<TObject>>>): GraphQLSilk<InferObjectSourceByVariants<TObject>, InferObjectSourceByVariants<TObject>>;
|
|
921
1043
|
/**
|
|
922
|
-
*
|
|
923
|
-
*
|
|
924
|
-
* @template T - The type of the data to be wrapped.
|
|
925
|
-
* @param {T} data - The data to be wrapped.
|
|
926
|
-
* @returns {{ "~meta": T }} - An object with a single key `"~meta"` containing the provided data.
|
|
927
|
-
* @example
|
|
928
|
-
* const originalData = { key: "value" };
|
|
929
|
-
* const metaData = meta(originalData);
|
|
930
|
-
* console.log(metaData); // Output: { "~meta": { key: "value" } }
|
|
1044
|
+
* Create a GraphQLSilk Object.
|
|
931
1045
|
*/
|
|
932
|
-
declare function
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
interface ReadOnlyObjMap<T> {
|
|
940
|
-
readonly [key: string]: T;
|
|
1046
|
+
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>;
|
|
1047
|
+
declare namespace silk {
|
|
1048
|
+
var parse: typeof parseSilk;
|
|
1049
|
+
var getType: typeof getGraphQLType;
|
|
1050
|
+
var nonNull: typeof nonNullSilk;
|
|
1051
|
+
var list: typeof listSilk;
|
|
1052
|
+
var nullable: typeof nullableSilk;
|
|
941
1053
|
}
|
|
942
|
-
|
|
943
|
-
//#region src/utils/parse-resolving-fields.d.ts
|
|
1054
|
+
type NonNullSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<NonNullable<StandardSchemaV1.InferOutput<TSilk>>, NonNullable<StandardSchemaV1.InferInput<TSilk>>>;
|
|
944
1055
|
/**
|
|
945
|
-
*
|
|
1056
|
+
* Non-nullable Silk.
|
|
946
1057
|
*/
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
* Fields explicitly requested in the GraphQL query
|
|
950
|
-
*/
|
|
951
|
-
requestedFields: ReadonlySet<string>;
|
|
952
|
-
/**
|
|
953
|
-
* Fields that are derived from other fields (computed fields)
|
|
954
|
-
*/
|
|
955
|
-
derivedFields: ReadonlySet<string>;
|
|
956
|
-
/**
|
|
957
|
-
* Fields that derived fields depend on
|
|
958
|
-
*/
|
|
959
|
-
derivedDependencies: ReadonlySet<string>;
|
|
960
|
-
/**
|
|
961
|
-
* Final set of fields that need to be resolved, after processing derived fields
|
|
962
|
-
*/
|
|
963
|
-
selectedFields: ReadonlySet<string>;
|
|
964
|
-
}
|
|
1058
|
+
declare function nonNullSilk<TSilk extends GraphQLSilk<any, any>>(origin: TSilk): NonNullSilk<TSilk>;
|
|
1059
|
+
type ListSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<Array<StandardSchemaV1.InferOutput<TSilk>>, Array<StandardSchemaV1.InferOutput<TSilk>>>;
|
|
965
1060
|
/**
|
|
966
|
-
*
|
|
967
|
-
*
|
|
968
|
-
* @param payload - The resolver payload containing the current field resolution context
|
|
969
|
-
* @param [maxDepth=Infinity] - Maximum depth of nested fields to parse
|
|
970
|
-
* @returns A map of field paths to their resolving fields
|
|
1061
|
+
* List Silk.
|
|
971
1062
|
*/
|
|
972
|
-
declare function
|
|
1063
|
+
declare function listSilk<TSilk extends GraphQLSilk<any, any>>(origin: TSilk): ListSilk<TSilk>;
|
|
1064
|
+
type NullableSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<StandardSchemaV1.InferOutput<TSilk> | null | undefined, StandardSchemaV1.InferInput<TSilk>>;
|
|
973
1065
|
/**
|
|
974
|
-
*
|
|
975
|
-
*
|
|
976
|
-
* @param payload - The resolver payload containing the current field resolution context
|
|
977
|
-
* @returns An object containing sets of different field types
|
|
1066
|
+
* Nullable Silk.
|
|
978
1067
|
*/
|
|
979
|
-
declare function
|
|
1068
|
+
declare function nullableSilk<TSilk extends GraphQLSilk<any, any>>(origin: TSilk): NullableSilk<TSilk>;
|
|
980
1069
|
/**
|
|
981
|
-
*
|
|
982
|
-
*
|
|
983
|
-
*
|
|
984
|
-
*
|
|
985
|
-
* @param info - The GraphQL resolve info object containing the query information
|
|
986
|
-
* @param maxDepth - Maximum depth of nested fields to parse (default: 1)
|
|
987
|
-
* @returns A Set of field paths
|
|
1070
|
+
* Get GraphQL Output Type from Silk.
|
|
1071
|
+
* @param silk GraphQL Silk
|
|
1072
|
+
* @returns GraphQL Output Type
|
|
988
1073
|
*/
|
|
989
|
-
declare function
|
|
990
|
-
//#endregion
|
|
991
|
-
//#region src/utils/string.d.ts
|
|
992
|
-
declare function pascalCase(str: string): string;
|
|
993
|
-
declare function capitalize<T extends string>(str: T): Capitalize<T>;
|
|
994
|
-
declare function screamingSnakeCase(str: string): string;
|
|
995
|
-
//#endregion
|
|
996
|
-
//#region src/utils/error.d.ts
|
|
997
|
-
declare function markErrorLocation<TError>(error: TError, ...locations: string[]): TError;
|
|
998
|
-
declare function tryIn<T>(func: () => T, ...locations: string[]): T;
|
|
1074
|
+
declare function getGraphQLType(silk: GraphQLSilk): GraphQLOutputType;
|
|
999
1075
|
/**
|
|
1000
|
-
*
|
|
1001
|
-
* @param
|
|
1002
|
-
* @
|
|
1003
|
-
* @returns message with location
|
|
1004
|
-
* @example markLocation("error", "banana") // "[banana] hello"
|
|
1005
|
-
* @example markLocation("error", fruit, banana) // "[fruit.banana] error"
|
|
1006
|
-
* @example markLocation("[banana] error", "fruit") // "[fruit.banana] error"
|
|
1007
|
-
* @example markLocation("[fruit.banana] error", "favorite") // "[favorite.fruit.banana] error"
|
|
1076
|
+
* Get GraphQL Argument Config from Silk.
|
|
1077
|
+
* @param silk GraphQL Silk
|
|
1078
|
+
* @returns GraphQL Argument Config
|
|
1008
1079
|
*/
|
|
1009
|
-
declare function
|
|
1010
|
-
//#endregion
|
|
1011
|
-
//#region src/utils/loader.d.ts
|
|
1012
|
-
type BatchLoadFn<TKey, TData> = (keys: TKey[]) => Promise<(TData | Error)[]>;
|
|
1080
|
+
declare function getGraphQLArgumentConfig(silk: GraphQLSilk): Omit<GraphQLArgumentConfig, "type" | "astNode"> | undefined;
|
|
1013
1081
|
/**
|
|
1014
|
-
*
|
|
1082
|
+
* Validate and transform input to output
|
|
1083
|
+
* @param silk silk GraphQL Silk
|
|
1084
|
+
* @param input
|
|
1085
|
+
* @returns output
|
|
1015
1086
|
*/
|
|
1016
|
-
declare
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
* Clear the cache and reset the loader.
|
|
1029
|
-
*/
|
|
1030
|
-
clear(): void;
|
|
1031
|
-
protected executeBatchLoad(): Promise<void>;
|
|
1032
|
-
protected nextTickPromise?: Promise<void>;
|
|
1033
|
-
protected nextTickBatchLoad(): Promise<void>;
|
|
1034
|
-
static nextTick(): Promise<void>;
|
|
1087
|
+
declare function parseSilk<TSilk extends GraphQLSilk>(silk: TSilk, input: StandardSchemaV1.InferInput<TSilk>): MayPromise<StandardSchemaV1.Result<StandardSchemaV1.InferOutput<TSilk>>>;
|
|
1088
|
+
declare function isSilk(target: any): target is GraphQLSilk;
|
|
1089
|
+
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>>>;
|
|
1090
|
+
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;
|
|
1091
|
+
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;
|
|
1092
|
+
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;
|
|
1093
|
+
//#endregion
|
|
1094
|
+
//#region src/schema/extensions.d.ts
|
|
1095
|
+
interface GQLoomExtensions {
|
|
1096
|
+
defaultValue?: any;
|
|
1097
|
+
gqloom?: GQLoomExtensionAttribute;
|
|
1098
|
+
directives?: DirectiveItem[] | DirectiveRecord;
|
|
1035
1099
|
}
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
constructor(batchLoadFn: BatchLoadFn<TKey, TData>);
|
|
1100
|
+
interface DirectiveItem {
|
|
1101
|
+
name: string;
|
|
1102
|
+
args?: Record<string, any>;
|
|
1040
1103
|
}
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
* Empty Resolver Arguments that only store the memoization
|
|
1045
|
-
*/
|
|
1046
|
-
interface OnlyMemoizationPayload {
|
|
1047
|
-
memoization: WeakMap<WeakKey, any>;
|
|
1048
|
-
isMemoization: true;
|
|
1104
|
+
type DirectiveRecord = Record<string, Record<string, any>>;
|
|
1105
|
+
interface GQLoomExtensionAttribute {
|
|
1106
|
+
directives?: string[];
|
|
1049
1107
|
}
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
declare function onlyMemoization(): OnlyMemoizationPayload;
|
|
1055
|
-
declare function isOnlyMemoryPayload(payload: OnlyMemoizationPayload | Pick<ResolverPayload, "context">): payload is OnlyMemoizationPayload;
|
|
1056
|
-
declare function getMemoizationMap(payload: OnlyMemoizationPayload | Pick<ResolverPayload, "context">): WeakMap<WeakKey, any>;
|
|
1057
|
-
interface ContextMemoryContainer {
|
|
1058
|
-
[CONTEXT_MAP_KEY]?: WeakMap<WeakKey, any>;
|
|
1108
|
+
//#endregion
|
|
1109
|
+
//#region src/schema/input.d.ts
|
|
1110
|
+
interface EnsureInputOptions {
|
|
1111
|
+
fieldName: string;
|
|
1059
1112
|
}
|
|
1060
|
-
declare function
|
|
1113
|
+
declare function inputToArgs(input: GraphQLSilk | Record<string, GraphQLSilk> | undefined | void, options: EnsureInputOptions): GraphQLFieldConfigArgumentMap | undefined;
|
|
1114
|
+
declare function ensureInputType(silkOrType: GraphQLType | GraphQLSilk, options: EnsureInputOptions): GraphQLInputType;
|
|
1115
|
+
declare function ensureInputObjectType(object: GraphQLObjectType | GraphQLInterfaceType | GraphQLInputObjectType, options: EnsureInputOptions): GraphQLInputObjectType;
|
|
1061
1116
|
//#endregion
|
|
1062
|
-
//#region src/
|
|
1063
|
-
declare
|
|
1064
|
-
declare const AUTO_ALIASING = "__gqloom_auto_aliasing";
|
|
1117
|
+
//#region src/schema/interface.d.ts
|
|
1118
|
+
declare function ensureInterfaceType(gqlType: GraphQLOutputType, interfaceConfig?: Partial<GraphQLInterfaceTypeConfig<any, any>>): GraphQLInterfaceType;
|
|
1065
1119
|
//#endregion
|
|
1066
1120
|
//#region src/schema/schema-weaver.d.ts
|
|
1067
1121
|
interface SchemaWeaver {
|
|
1068
1122
|
vendor: string;
|
|
1069
1123
|
getGraphQLType: (schema: any) => GraphQLOutputType;
|
|
1124
|
+
getGraphQLArgumentConfig?: (schema: any) => Omit<GraphQLArgumentConfig, "type" | "astNode"> | undefined;
|
|
1070
1125
|
}
|
|
1071
1126
|
declare function isSchemaVendorWeaver(some: any): some is SchemaWeaver;
|
|
1072
1127
|
//#endregion
|
|
@@ -1090,7 +1145,7 @@ declare class WeaverContext {
|
|
|
1090
1145
|
setConfig<TConfig extends WeaverConfig>(config: TConfig): void;
|
|
1091
1146
|
deleteConfig<TConfig extends WeaverConfig>(key: TConfig[typeof WEAVER_CONFIG]): void;
|
|
1092
1147
|
memoNamedType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(gqlTypeValue: TGraphQLType): TGraphQLType;
|
|
1093
|
-
getNamedType<T extends GraphQLOutputType>(name: string): T | undefined;
|
|
1148
|
+
getNamedType<T$1 extends GraphQLOutputType>(name: string): T$1 | undefined;
|
|
1094
1149
|
protected static readonly namedTypes: {
|
|
1095
1150
|
readonly Object: "Object";
|
|
1096
1151
|
readonly Union: "Union";
|
|
@@ -1104,11 +1159,11 @@ declare class WeaverContext {
|
|
|
1104
1159
|
* @returns -1 if a is better than b, 1 if b is better than a, 0 if they are equal
|
|
1105
1160
|
*/
|
|
1106
1161
|
protected static higherPriorityThan(a: string | undefined, b: string | undefined): number;
|
|
1107
|
-
static provide<T>(func: () => T, value: WeaverContext | undefined): T;
|
|
1162
|
+
static provide<T$1>(func: () => T$1, value: WeaverContext | undefined): T$1;
|
|
1108
1163
|
}
|
|
1109
1164
|
declare const initWeaverContext: () => WeaverContext;
|
|
1110
1165
|
declare const provideWeaverContext: typeof WeaverContext.provide & {
|
|
1111
|
-
inherit: <T>(func: () => T) => () => T;
|
|
1166
|
+
inherit: <T$1>(func: () => T$1) => () => T$1;
|
|
1112
1167
|
};
|
|
1113
1168
|
interface WeaverConfig {
|
|
1114
1169
|
[WEAVER_CONFIG]: string | symbol;
|
|
@@ -1131,7 +1186,7 @@ declare class GlobalWeaverContext implements Partial<Omit<WeaverContext, GlobalC
|
|
|
1131
1186
|
setConfig(config: WeaverConfig): void;
|
|
1132
1187
|
deleteConfig(key: string | symbol): void;
|
|
1133
1188
|
useConfig<TConfig extends WeaverConfig, TCallback extends () => any>(config: TConfig, callback: TCallback): ReturnType<TCallback>;
|
|
1134
|
-
getNamedType<T extends GraphQLOutputType>(name: string): T | undefined;
|
|
1189
|
+
getNamedType<T$1 extends GraphQLOutputType>(name: string): T$1 | undefined;
|
|
1135
1190
|
memoNamedType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(gqlType: TGraphQLType): TGraphQLType;
|
|
1136
1191
|
getGraphQLType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(origin: object): TGraphQLType | undefined;
|
|
1137
1192
|
memoGraphQLType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(origin: object, gqlType: TGraphQLType): TGraphQLType;
|
|
@@ -1151,7 +1206,7 @@ declare function collectNames<TRecords extends Record<string, object>[]>(...name
|
|
|
1151
1206
|
* @returns schema
|
|
1152
1207
|
*/
|
|
1153
1208
|
declare function collectName<TSchema extends object>(name: string, schema: TSchema): TSchema;
|
|
1154
|
-
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
|
|
1209
|
+
type UnionToIntersection<U$1> = (U$1 extends any ? (k: U$1) => void : never) extends ((k: infer I) => void) ? I : never;
|
|
1155
1210
|
//#endregion
|
|
1156
1211
|
//#region src/schema/object.d.ts
|
|
1157
1212
|
declare class LoomObjectType extends GraphQLObjectType {
|
|
@@ -1253,30 +1308,4 @@ declare class GraphQLSchemaLoom {
|
|
|
1253
1308
|
*/
|
|
1254
1309
|
declare const weave: typeof GraphQLSchemaLoom.weave;
|
|
1255
1310
|
//#endregion
|
|
1256
|
-
|
|
1257
|
-
interface EnsureInputOptions {
|
|
1258
|
-
fieldName: string;
|
|
1259
|
-
}
|
|
1260
|
-
declare function inputToArgs(input: GraphQLSilk | Record<string, GraphQLSilk> | undefined | void, options: EnsureInputOptions): GraphQLFieldConfigArgumentMap | undefined;
|
|
1261
|
-
declare function ensureInputType(silkOrType: GraphQLType | GraphQLSilk, options: EnsureInputOptions): GraphQLInputType;
|
|
1262
|
-
declare function ensureInputObjectType(object: GraphQLObjectType | GraphQLInterfaceType | GraphQLInputObjectType, options: EnsureInputOptions): GraphQLInputObjectType;
|
|
1263
|
-
//#endregion
|
|
1264
|
-
//#region src/schema/interface.d.ts
|
|
1265
|
-
declare function ensureInterfaceType(gqlType: GraphQLOutputType, interfaceConfig?: Partial<GraphQLInterfaceTypeConfig<any, any>>): GraphQLInterfaceType;
|
|
1266
|
-
//#endregion
|
|
1267
|
-
//#region src/schema/extensions.d.ts
|
|
1268
|
-
interface GQLoomExtensions {
|
|
1269
|
-
defaultValue?: any;
|
|
1270
|
-
gqloom?: GQLoomExtensionAttribute;
|
|
1271
|
-
directives?: DirectiveItem[] | DirectiveRecord;
|
|
1272
|
-
}
|
|
1273
|
-
interface DirectiveItem {
|
|
1274
|
-
name: string;
|
|
1275
|
-
args?: Record<string, any>;
|
|
1276
|
-
}
|
|
1277
|
-
type DirectiveRecord = Record<string, Record<string, any>>;
|
|
1278
|
-
interface GQLoomExtensionAttribute {
|
|
1279
|
-
directives?: string[];
|
|
1280
|
-
}
|
|
1281
|
-
//#endregion
|
|
1282
|
-
export { AUTO_ALIASING, BaseChainFactory, BaseField, BatchLoadFn, CallableInputParser, CallableMiddlewareOptions, ChainFactoryOptions, ChainResolver, CoreSchemaWeaverConfig, CoreSchemaWeaverConfigOptions, DERIVED_DEPENDENCIES, DirectiveItem, DirectiveRecord, EasyDataLoader, Executor, Field, FieldChainFactory, FieldFactory, FieldFactoryWithResolve, FieldFactoryWithUtils, FieldMeta, FieldOptions, FieldOrOperation, FieldOrOperationType, GQLoomExtensionAttribute, GQLoomExtensions, GlobalWeaverContext, GraphQLFieldOptions, GraphQLSchemaLoom, GraphQLSilk, IChainFactory, InferFieldInput, InferFieldOutput, InferInputI, InferInputO, IsAny, ListSilk, LoomDataLoader, LoomObjectType, MayPromise, Middleware, MiddlewareConfig, MiddlewareOperation, MiddlewareOptions, Mutation, MutationChainFactory, MutationFactory, MutationFactoryWithChain, MutationFactoryWithResolve, MutationOptions, NonNullSilk, NullableSilk, OPERATION_OBJECT_NAMES, ObjectChainResolver, OmitInUnion, OnlyMemoizationPayload, Operation, OperationType, Query, QueryChainFactory, QueryFactory, QueryFactoryWithChain, QueryFactoryWithResolve, QueryOptions, RequireKeys, ResolvableSubscription, Resolver, ResolverFactory, ResolverMeta, ResolverOptions, ResolverOptionsWithExtensions, ResolverOptionsWithParent, ResolverPayload, ResolvingFields, ResolvingOptions, SchemaWeaver, StandardSchemaV1, Subscription, SubscriptionChainFactory, SubscriptionFactory, SubscriptionFactoryWithChain, SubscriptionNeedResolve, SubscriptionOptions, ToExecutorProps, ValueOf, WeaverConfig, WeaverContext, applyMiddlewares, assignContextMap, capitalize, collectName, collectNames, createField, createInputParser, createMutation, createQuery, createSubscription, deepMerge, defaultSubscriptionResolve, ensureInputObjectType, ensureInputType, ensureInterfaceType, field, filterMiddlewares, getCacheType, getDeepResolvingFields, getFieldOptions, getGraphQLType, getMemoizationMap, getOperationOptions, getResolvingFields, getStandardValue, getSubscriptionOptions, initWeaverContext, inputToArgs, isOnlyMemoryPayload, isSchemaVendorWeaver, isSilk, listSilk, loom, mapValue, markErrorLocation, markLocation, meta, mutation$1 as mutation, nonNullSilk, notNullish, nullableSilk, onlyMemoization, parseInputValue, parseResolvingFields, parseSilk, pascalCase, provideWeaverContext, query$1 as query, resolver, screamingSnakeCase, silk, subscription$1 as subscription, symbols_d_exports, toObjMap, tryIn, types_loom_d_exports, weave, weaverContext };
|
|
1311
|
+
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 };
|