@gqloom/core 0.10.0 → 0.11.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-Cl8Af3a2.js +11 -0
- package/dist/context-3UlS1xGQ.cjs +417 -0
- package/dist/context-CpbCknos.js +305 -0
- package/dist/context.cjs +236 -437
- package/dist/context.d.cts +114 -111
- package/dist/context.d.ts +114 -111
- package/dist/context.js +224 -219
- package/dist/index-DUqXX1Tm.d.cts +1255 -0
- package/dist/index-GSWAHvDy.d.ts +1253 -0
- package/dist/index.cjs +1694 -2019
- package/dist/index.d.cts +2 -484
- package/dist/index.d.ts +2 -484
- package/dist/index.js +1618 -1780
- package/package.json +11 -11
- package/dist/chunk-JWAIAFGL.js +0 -220
- package/dist/context-uzUlbx3r.d.cts +0 -772
- package/dist/context-uzUlbx3r.d.ts +0 -772
|
@@ -1,772 +0,0 @@
|
|
|
1
|
-
import { GraphQLOutputType, GraphQLObjectTypeConfig, GraphQLFieldConfig, GraphQLResolveInfo } from 'graphql';
|
|
2
|
-
|
|
3
|
-
type MayPromise<T> = T | Promise<T>;
|
|
4
|
-
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
5
|
-
type ValueOf<T extends object> = T[keyof T];
|
|
6
|
-
type OmitInUnion<TUnion, TOmit> = TUnion extends infer T ? T extends TOmit ? never : T : never;
|
|
7
|
-
type RequireKeys<T, TKey extends string | number | symbol> = {
|
|
8
|
-
[P in keyof T as P extends TKey ? P : never]-?: T[P];
|
|
9
|
-
} & {
|
|
10
|
-
[P in keyof T as P extends TKey ? never : P]: T[P];
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
/** The Standard Schema interface. */
|
|
14
|
-
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
15
|
-
/** The Standard Schema properties. */
|
|
16
|
-
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
17
|
-
}
|
|
18
|
-
declare namespace StandardSchemaV1 {
|
|
19
|
-
/** The Standard Schema properties interface. */
|
|
20
|
-
export interface Props<Input = unknown, Output = Input> {
|
|
21
|
-
/** The version number of the standard. */
|
|
22
|
-
readonly version: 1;
|
|
23
|
-
/** The vendor name of the schema library. */
|
|
24
|
-
readonly vendor: string;
|
|
25
|
-
/** Validates unknown input values. */
|
|
26
|
-
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
|
27
|
-
/** Inferred types associated with the schema. */
|
|
28
|
-
readonly types?: Types<Input, Output> | undefined;
|
|
29
|
-
}
|
|
30
|
-
/** The result interface of the validate function. */
|
|
31
|
-
export type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
32
|
-
/** The result interface if validation succeeds. */
|
|
33
|
-
export interface SuccessResult<Output> {
|
|
34
|
-
/** The typed output value. */
|
|
35
|
-
readonly value: Output;
|
|
36
|
-
/** The non-existent issues. */
|
|
37
|
-
readonly issues?: undefined;
|
|
38
|
-
}
|
|
39
|
-
/** The result interface if validation fails. */
|
|
40
|
-
export interface FailureResult {
|
|
41
|
-
/** The issues of failed validation. */
|
|
42
|
-
readonly issues: ReadonlyArray<Issue>;
|
|
43
|
-
}
|
|
44
|
-
/** The issue interface of the failure output. */
|
|
45
|
-
export interface Issue {
|
|
46
|
-
/** The error message of the issue. */
|
|
47
|
-
readonly message: string;
|
|
48
|
-
/** The path of the issue, if any. */
|
|
49
|
-
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
50
|
-
}
|
|
51
|
-
/** The path segment interface of the issue. */
|
|
52
|
-
export interface PathSegment {
|
|
53
|
-
/** The key representing a path segment. */
|
|
54
|
-
readonly key: PropertyKey;
|
|
55
|
-
}
|
|
56
|
-
/** The Standard Schema types interface. */
|
|
57
|
-
export interface Types<Input = unknown, Output = Input> {
|
|
58
|
-
/** The input type of the schema. */
|
|
59
|
-
readonly input: Input;
|
|
60
|
-
/** The output type of the schema. */
|
|
61
|
-
readonly output: Output;
|
|
62
|
-
}
|
|
63
|
-
/** Infers the input type of a Standard Schema. */
|
|
64
|
-
export type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
65
|
-
/** Infers the output type of a Standard Schema. */
|
|
66
|
-
export type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
67
|
-
export { };
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* The symbol to get GraphQL type for schema
|
|
72
|
-
*/
|
|
73
|
-
declare const GET_GRAPHQL_TYPE: unique symbol;
|
|
74
|
-
/**
|
|
75
|
-
* The symbol to get and store weaver config
|
|
76
|
-
*/
|
|
77
|
-
declare const WEAVER_CONFIG: unique symbol;
|
|
78
|
-
/**
|
|
79
|
-
* The symbol to get resolver options
|
|
80
|
-
*/
|
|
81
|
-
declare const RESOLVER_OPTIONS_KEY: unique symbol;
|
|
82
|
-
/**
|
|
83
|
-
* The symbol to check if an object is a resolver
|
|
84
|
-
*/
|
|
85
|
-
declare const IS_RESOLVER: unique symbol;
|
|
86
|
-
/**
|
|
87
|
-
* The symbol to assign a WeakMap to an object
|
|
88
|
-
*/
|
|
89
|
-
declare const CONTEXT_MAP_KEY: unique symbol;
|
|
90
|
-
/**
|
|
91
|
-
* Set fields to be hidden
|
|
92
|
-
*/
|
|
93
|
-
declare const FIELD_HIDDEN = false;
|
|
94
|
-
|
|
95
|
-
declare const symbols_CONTEXT_MAP_KEY: typeof CONTEXT_MAP_KEY;
|
|
96
|
-
declare const symbols_FIELD_HIDDEN: typeof FIELD_HIDDEN;
|
|
97
|
-
declare const symbols_GET_GRAPHQL_TYPE: typeof GET_GRAPHQL_TYPE;
|
|
98
|
-
declare const symbols_IS_RESOLVER: typeof IS_RESOLVER;
|
|
99
|
-
declare const symbols_RESOLVER_OPTIONS_KEY: typeof RESOLVER_OPTIONS_KEY;
|
|
100
|
-
declare const symbols_WEAVER_CONFIG: typeof WEAVER_CONFIG;
|
|
101
|
-
declare namespace symbols {
|
|
102
|
-
export { symbols_CONTEXT_MAP_KEY as CONTEXT_MAP_KEY, symbols_FIELD_HIDDEN as FIELD_HIDDEN, symbols_GET_GRAPHQL_TYPE as GET_GRAPHQL_TYPE, symbols_IS_RESOLVER as IS_RESOLVER, symbols_RESOLVER_OPTIONS_KEY as RESOLVER_OPTIONS_KEY, symbols_WEAVER_CONFIG as WEAVER_CONFIG };
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
type InferInputI<TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void> = TInput extends void ? void : TInput extends GraphQLSilk ? StandardSchemaV1.InferInput<TInput> : TInput extends Record<string, GraphQLSilk> ? {
|
|
106
|
-
[K in keyof TInput]: StandardSchemaV1.InferInput<TInput[K]>;
|
|
107
|
-
} : void;
|
|
108
|
-
type InferInputO<TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void> = TInput extends void ? void : TInput extends GraphQLSilk ? StandardSchemaV1.InferOutput<TInput> : TInput extends Record<string, GraphQLSilk> ? {
|
|
109
|
-
[K in keyof TInput]: StandardSchemaV1.InferOutput<TInput[K]>;
|
|
110
|
-
} : never;
|
|
111
|
-
interface CallableInputParser<TSchema extends GraphQLSilk | Record<string, GraphQLSilk> | void> {
|
|
112
|
-
/**
|
|
113
|
-
* input schema
|
|
114
|
-
*/
|
|
115
|
-
schema: TSchema;
|
|
116
|
-
/**
|
|
117
|
-
* Origin value to parse
|
|
118
|
-
*/
|
|
119
|
-
value: InferInputI<TSchema>;
|
|
120
|
-
/**
|
|
121
|
-
* Parse the input and return the standard result
|
|
122
|
-
*/
|
|
123
|
-
(): Promise<StandardSchemaV1.Result<InferInputO<TSchema>>>;
|
|
124
|
-
/**
|
|
125
|
-
* Result of parsing. Set it to `undefined` then the parser will run again.
|
|
126
|
-
*/
|
|
127
|
-
result: StandardSchemaV1.Result<InferInputO<TSchema>> | undefined;
|
|
128
|
-
/**
|
|
129
|
-
* Parse the input and return the result
|
|
130
|
-
*/
|
|
131
|
-
getResult(): Promise<InferInputO<TSchema>>;
|
|
132
|
-
/**
|
|
133
|
-
* Set the result's value of parsing
|
|
134
|
-
*/
|
|
135
|
-
setResult(value: InferInputO<TSchema>): void;
|
|
136
|
-
/**
|
|
137
|
-
* Clear the result of parsing, the parser will run again to get the result.
|
|
138
|
-
*/
|
|
139
|
-
clearResult(): void;
|
|
140
|
-
}
|
|
141
|
-
declare function createInputParser<TSchema extends GraphQLSilk | Record<string, GraphQLSilk> | void>(schema: TSchema, value: InferInputI<TSchema>): CallableInputParser<TSchema>;
|
|
142
|
-
declare function parseInputValue<TSchema extends GraphQLSilk | Record<string, GraphQLSilk> | void>(inputSchema: TSchema, input: any): MayPromise<StandardSchemaV1.Result<InferInputO<TSchema>>>;
|
|
143
|
-
declare function getStandardValue<T>(result: StandardSchemaV1.Result<T>): T;
|
|
144
|
-
declare function getStandardValue<T>(result?: StandardSchemaV1.Result<T>): T | undefined;
|
|
145
|
-
declare function getStandardValue<T>(result: StandardSchemaV1.Result<T> | null): T | null;
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Interface for chain factory that provides methods to configure GraphQL field options
|
|
149
|
-
* @template TOutput - The output type of the GraphQL field
|
|
150
|
-
* @template TInput - The input type of the GraphQL field, can be a single type or a record of types
|
|
151
|
-
*/
|
|
152
|
-
interface IChainFactory<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void> {
|
|
153
|
-
/**
|
|
154
|
-
* Sets the description for the GraphQL field
|
|
155
|
-
* @param description - The description text for the field
|
|
156
|
-
*/
|
|
157
|
-
description(description: GraphQLFieldOptions["description"]): this;
|
|
158
|
-
/**
|
|
159
|
-
* Sets the deprecation reason for the GraphQL field
|
|
160
|
-
* @param deprecationReason - The reason why this field is deprecated
|
|
161
|
-
*/
|
|
162
|
-
deprecationReason(deprecationReason: GraphQLFieldOptions["deprecationReason"]): this;
|
|
163
|
-
/**
|
|
164
|
-
* Sets custom extensions for the GraphQL field
|
|
165
|
-
* @param extensions - Custom extensions to be added to the field
|
|
166
|
-
*/
|
|
167
|
-
extensions(extensions: GraphQLFieldOptions["extensions"]): this;
|
|
168
|
-
/**
|
|
169
|
-
* Sets the output type for the GraphQL field
|
|
170
|
-
* @template TOutputNew - The new output type
|
|
171
|
-
* @param output - The output type definition
|
|
172
|
-
*/
|
|
173
|
-
output<TOutputNew extends GraphQLSilk>(output: TOutputNew): IChainFactory<TOutputNew, TInput>;
|
|
174
|
-
/**
|
|
175
|
-
* Sets the input type for the GraphQL field
|
|
176
|
-
* @template TInputNew - The new input type
|
|
177
|
-
* @param input - The input type definition
|
|
178
|
-
*/
|
|
179
|
-
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): IChainFactory<TOutput, TInputNew>;
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Options for configuring a chain factory
|
|
183
|
-
*/
|
|
184
|
-
interface ChainFactoryOptions extends FieldMeta {
|
|
185
|
-
/** Middleware functions to be applied to the field */
|
|
186
|
-
middlewares?: Middleware[];
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Base class for all chain factories
|
|
190
|
-
* @template TField - The type of field being created
|
|
191
|
-
*/
|
|
192
|
-
declare abstract class BaseChainFactory<TField extends BaseField = any> {
|
|
193
|
-
protected readonly options?: Partial<ChainFactoryOptions> | undefined;
|
|
194
|
-
/**
|
|
195
|
-
* Returns the available methods for the chain factory
|
|
196
|
-
*/
|
|
197
|
-
static methods(): {
|
|
198
|
-
description: (description: GraphQLFieldOptions["description"]) => BaseChainFactory<any>;
|
|
199
|
-
deprecationReason: (deprecationReason: GraphQLFieldOptions["deprecationReason"]) => BaseChainFactory<any>;
|
|
200
|
-
extensions: (extensions: GraphQLFieldOptions["extensions"]) => BaseChainFactory<any>;
|
|
201
|
-
};
|
|
202
|
-
/**
|
|
203
|
-
* Creates a new instance of the chain factory
|
|
204
|
-
* @param options - Configuration options for the factory
|
|
205
|
-
*/
|
|
206
|
-
constructor(options?: Partial<ChainFactoryOptions> | undefined);
|
|
207
|
-
/**
|
|
208
|
-
* Creates a clone of the current factory with new options
|
|
209
|
-
* @param options - New options to apply to the clone
|
|
210
|
-
*/
|
|
211
|
-
protected abstract clone(options?: Partial<ChainFactoryOptions>): this;
|
|
212
|
-
/**
|
|
213
|
-
* Sets the description for the field
|
|
214
|
-
* @param description - The description text
|
|
215
|
-
*/
|
|
216
|
-
description(description: GraphQLFieldOptions["description"]): this;
|
|
217
|
-
/**
|
|
218
|
-
* Sets the deprecation reason for the field
|
|
219
|
-
* @param deprecationReason - The reason for deprecation
|
|
220
|
-
*/
|
|
221
|
-
deprecationReason(deprecationReason: GraphQLFieldOptions["deprecationReason"]): this;
|
|
222
|
-
/**
|
|
223
|
-
* Sets custom extensions for the field
|
|
224
|
-
* @param extensions - Custom extensions to add
|
|
225
|
-
*/
|
|
226
|
-
extensions(extensions: GraphQLFieldOptions["extensions"]): this;
|
|
227
|
-
/**
|
|
228
|
-
* Adds middleware functions to the field
|
|
229
|
-
* @param middlewares - Middleware functions to add
|
|
230
|
-
*/
|
|
231
|
-
use(...middlewares: Middleware<TField>[]): this;
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Factory for creating field resolvers with chainable configuration
|
|
235
|
-
* @template TOutput - The output type of the field
|
|
236
|
-
* @template TInput - The input type of the field
|
|
237
|
-
* @template TDependencies - The dependencies of the field
|
|
238
|
-
*/
|
|
239
|
-
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> {
|
|
240
|
-
/**
|
|
241
|
-
* Returns the available methods for the field chain factory
|
|
242
|
-
*/
|
|
243
|
-
static methods(): FieldChainFactory<never, undefined>;
|
|
244
|
-
/**
|
|
245
|
-
* Creates a clone of the current factory with new options
|
|
246
|
-
* @param options - New options to apply to the clone
|
|
247
|
-
*/
|
|
248
|
-
protected clone(options?: Partial<ChainFactoryOptions>): this;
|
|
249
|
-
/**
|
|
250
|
-
* Sets the output type for the field
|
|
251
|
-
* @template TOutputNew - The new output type
|
|
252
|
-
* @param output - The output type definition
|
|
253
|
-
*/
|
|
254
|
-
output<TOutputNew extends GraphQLSilk>(output: TOutputNew): FieldChainFactory<TOutputNew, TInput, TDependencies>;
|
|
255
|
-
/**
|
|
256
|
-
* Sets the input type for the field
|
|
257
|
-
* @template TInputNew - The new input type
|
|
258
|
-
* @param input - The input type definition
|
|
259
|
-
*/
|
|
260
|
-
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): FieldChainFactory<TOutput, TInputNew, TDependencies>;
|
|
261
|
-
/**
|
|
262
|
-
* Specifies the dependencies for the field
|
|
263
|
-
* @template TDependencies - The dependencies type
|
|
264
|
-
* @param dependencies - The dependencies to add
|
|
265
|
-
*/
|
|
266
|
-
derivedFrom<const TDependencies extends string[]>(...dependencies: TDependencies): FieldChainFactory<TOutput, TInput, TDependencies>;
|
|
267
|
-
/**
|
|
268
|
-
* Sets the resolve function for the field
|
|
269
|
-
* @template TParent - The parent type
|
|
270
|
-
* @param resolve - The resolve function
|
|
271
|
-
*/
|
|
272
|
-
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>;
|
|
273
|
-
/**
|
|
274
|
-
* Creates a field resolver that uses DataLoader for batch loading data.
|
|
275
|
-
* This method is particularly useful for optimizing performance when dealing with multiple data requests
|
|
276
|
-
* by batching them together and handling caching automatically.
|
|
277
|
-
*
|
|
278
|
-
* @template TParent - The parent type that extends GraphQLSilk
|
|
279
|
-
* @param resolve - A function that handles batch loading of data.
|
|
280
|
-
* @returns A GraphQL field resolver that implements batch loading
|
|
281
|
-
*/
|
|
282
|
-
load<TParent extends GraphQLSilk>(resolve: (parents: InferParent<TParent, TDependencies>[], input: InferInputO<TInput>, payloads: (ResolverPayload | undefined)[]) => MayPromise<StandardSchemaV1.InferOutput<TOutput>[]>): Field<TParent, TOutput, TInput, TDependencies>;
|
|
283
|
-
}
|
|
284
|
-
type InferParent<TParent extends GraphQLSilk, TDependencies extends string[] | undefined = undefined> = TDependencies extends string[] ? RequireKeys<NonNullable<StandardSchemaV1.InferOutput<TParent>>, TDependencies[number]> : NonNullable<StandardSchemaV1.InferOutput<TParent>>;
|
|
285
|
-
/**
|
|
286
|
-
* Factory for creating query resolvers with chainable configuration
|
|
287
|
-
* @template TOutput - The output type of the query
|
|
288
|
-
* @template TInput - The input type of the query
|
|
289
|
-
*/
|
|
290
|
-
declare class QueryChainFactory<TOutput extends GraphQLSilk = never, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void> extends BaseChainFactory<Query<TOutput, TInput>> implements IChainFactory<TOutput, TInput> {
|
|
291
|
-
/**
|
|
292
|
-
* Returns the available methods for the query chain factory
|
|
293
|
-
* @returns An object containing all available methods
|
|
294
|
-
*/
|
|
295
|
-
static methods(): QueryChainFactory<never, void>;
|
|
296
|
-
/**
|
|
297
|
-
* Creates a clone of the current factory with new options
|
|
298
|
-
* @param options - New options to apply to the clone
|
|
299
|
-
* @returns A new instance of QueryChainFactory with the updated options
|
|
300
|
-
*/
|
|
301
|
-
protected clone(options?: Partial<ChainFactoryOptions>): this;
|
|
302
|
-
/**
|
|
303
|
-
* Sets the output type for the query
|
|
304
|
-
* @template TOutputNew - The new output type
|
|
305
|
-
* @param output - The output type definition
|
|
306
|
-
* @returns A new QueryChainFactory instance with the updated output type
|
|
307
|
-
*/
|
|
308
|
-
output<TOutputNew extends GraphQLSilk>(output: TOutputNew): QueryChainFactory<TOutputNew, TInput>;
|
|
309
|
-
/**
|
|
310
|
-
* Sets the input type for the query
|
|
311
|
-
* @template TInputNew - The new input type
|
|
312
|
-
* @param input - The input type definition
|
|
313
|
-
* @returns A new QueryChainFactory instance with the updated input type
|
|
314
|
-
*/
|
|
315
|
-
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): QueryChainFactory<TOutput, TInputNew>;
|
|
316
|
-
/**
|
|
317
|
-
* Sets the resolve function for the query
|
|
318
|
-
* @param resolve - The resolve function that processes the input and returns the output
|
|
319
|
-
* @returns A GraphQL query resolver
|
|
320
|
-
* @throws {Error} If output type is not set
|
|
321
|
-
*/
|
|
322
|
-
resolve(resolve: (input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>): Query<TOutput, TInput>;
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* Factory for creating mutation resolvers with chainable configuration
|
|
326
|
-
* @template TOutput - The output type of the mutation
|
|
327
|
-
* @template TInput - The input type of the mutation
|
|
328
|
-
*/
|
|
329
|
-
declare class MutationChainFactory<TOutput extends GraphQLSilk = never, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined> extends BaseChainFactory<Mutation<TOutput, TInput>> implements IChainFactory<TOutput, TInput> {
|
|
330
|
-
/**
|
|
331
|
-
* Returns the available methods for the mutation chain factory
|
|
332
|
-
* @returns An object containing all available methods
|
|
333
|
-
*/
|
|
334
|
-
static methods(): MutationChainFactory<never, undefined>;
|
|
335
|
-
/**
|
|
336
|
-
* Creates a clone of the current factory with new options
|
|
337
|
-
* @param options - New options to apply to the clone
|
|
338
|
-
* @returns A new instance of MutationChainFactory with the updated options
|
|
339
|
-
*/
|
|
340
|
-
protected clone(options?: Partial<ChainFactoryOptions>): this;
|
|
341
|
-
/**
|
|
342
|
-
* Sets the output type for the mutation
|
|
343
|
-
* @template TOutputNew - The new output type
|
|
344
|
-
* @param output - The output type definition
|
|
345
|
-
* @returns A new MutationChainFactory instance with the updated output type
|
|
346
|
-
*/
|
|
347
|
-
output<TOutputNew extends GraphQLSilk>(output: TOutputNew): MutationChainFactory<TOutputNew, TInput>;
|
|
348
|
-
/**
|
|
349
|
-
* Sets the input type for the mutation
|
|
350
|
-
* @template TInputNew - The new input type
|
|
351
|
-
* @param input - The input type definition
|
|
352
|
-
* @returns A new MutationChainFactory instance with the updated input type
|
|
353
|
-
*/
|
|
354
|
-
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): MutationChainFactory<TOutput, TInputNew>;
|
|
355
|
-
/**
|
|
356
|
-
* Sets the resolve function for the mutation
|
|
357
|
-
* @param resolve - The resolve function that processes the input and returns the output
|
|
358
|
-
* @returns A GraphQL mutation resolver
|
|
359
|
-
* @throws {Error} If output type is not set
|
|
360
|
-
*/
|
|
361
|
-
resolve(resolve: (input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>): Mutation<TOutput, TInput>;
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* Factory for creating subscription resolvers with chainable configuration
|
|
365
|
-
* @template TOutput - The output type of the subscription
|
|
366
|
-
* @template TInput - The input type of the subscription
|
|
367
|
-
*/
|
|
368
|
-
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> {
|
|
369
|
-
/**
|
|
370
|
-
* Returns the available methods for the subscription chain factory
|
|
371
|
-
* @returns An object containing all available methods
|
|
372
|
-
*/
|
|
373
|
-
static methods(): SubscriptionChainFactory<never, undefined>;
|
|
374
|
-
/**
|
|
375
|
-
* Creates a clone of the current factory with new options
|
|
376
|
-
* @param options - New options to apply to the clone
|
|
377
|
-
* @returns A new instance of SubscriptionChainFactory with the updated options
|
|
378
|
-
*/
|
|
379
|
-
protected clone(options?: Partial<ChainFactoryOptions>): this;
|
|
380
|
-
/**
|
|
381
|
-
* Sets the output type for the subscription
|
|
382
|
-
* @template TOutputNew - The new output type
|
|
383
|
-
* @param output - The output type definition
|
|
384
|
-
* @returns A new SubscriptionChainFactory instance with the updated output type
|
|
385
|
-
*/
|
|
386
|
-
output<TOutputNew extends GraphQLSilk>(output: TOutputNew): SubscriptionChainFactory<TOutputNew, TInput>;
|
|
387
|
-
/**
|
|
388
|
-
* Sets the input type for the subscription
|
|
389
|
-
* @template TInputNew - The new input type
|
|
390
|
-
* @param input - The input type definition
|
|
391
|
-
* @returns A new SubscriptionChainFactory instance with the updated input type
|
|
392
|
-
*/
|
|
393
|
-
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): SubscriptionChainFactory<TOutput, TInputNew>;
|
|
394
|
-
/**
|
|
395
|
-
* Sets the subscribe function for the subscription
|
|
396
|
-
* @template TValue - The value type of the subscription
|
|
397
|
-
* @param subscribe - The subscribe function that returns an AsyncIterator
|
|
398
|
-
* @returns A subscription resolver that can be further configured with a resolve function
|
|
399
|
-
* @throws {Error} If output type is not set
|
|
400
|
-
*/
|
|
401
|
-
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>;
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* Interface for a subscription that can be resolved
|
|
405
|
-
* @template TOutput - The output type of the subscription
|
|
406
|
-
* @template TInput - The input type of the subscription
|
|
407
|
-
* @template TValue - The value type of the subscription
|
|
408
|
-
*/
|
|
409
|
-
interface ResolvableSubscription<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined, TValue = StandardSchemaV1.InferOutput<TOutput>> extends Subscription<TOutput, TInput, TValue> {
|
|
410
|
-
/**
|
|
411
|
-
* Sets the resolve function for the subscription
|
|
412
|
-
* @param resolve - The resolve function
|
|
413
|
-
*/
|
|
414
|
-
resolve(resolve: (value: TValue, input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>): Subscription<TOutput, TInput, TValue>;
|
|
415
|
-
}
|
|
416
|
-
/**
|
|
417
|
-
* A subscription that can not be resolved yet, still needs to be resolved.
|
|
418
|
-
* Interface for a subscription that needs to be resolved
|
|
419
|
-
* @template TOutput - The output type of the subscription
|
|
420
|
-
* @template TInput - The input type of the subscription
|
|
421
|
-
* @template TValue - The value type of the subscription
|
|
422
|
-
*/
|
|
423
|
-
interface SubscriptionNeedResolve<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined, TValue = StandardSchemaV1.InferOutput<TOutput>> {
|
|
424
|
-
/**
|
|
425
|
-
* Sets the resolve function for the subscription
|
|
426
|
-
* @param resolve - The resolve function
|
|
427
|
-
*/
|
|
428
|
-
resolve(resolve: (value: TValue, input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>): Subscription<TOutput, TInput, TValue>;
|
|
429
|
-
}
|
|
430
|
-
declare class QueryFactoryWithResolve<TInputO, TOutput extends GraphQLSilk, TInput extends GraphQLSilk<TInputO>> extends BaseChainFactory<Query<TOutput, TInput>> implements Query<TOutput, TInput> {
|
|
431
|
-
protected outputSilk: TOutput;
|
|
432
|
-
protected readonly options: QueryOptions<TOutput, TInput>;
|
|
433
|
-
get "~meta"(): Query<TOutput, TInput>["~meta"];
|
|
434
|
-
constructor(outputSilk: TOutput, options: QueryOptions<TOutput, TInput>);
|
|
435
|
-
protected clone(options?: Partial<typeof this.options> | undefined): this;
|
|
436
|
-
input<TInputNew extends GraphQLSilk<TInputO>>(input: TInputNew): QueryFactoryWithResolve<TInputO, TOutput, TInputNew>;
|
|
437
|
-
output<TOutputNew extends GraphQLSilk>(output: TOutputNew, transform: (output: StandardSchemaV1.InferOutput<TOutput>) => MayPromise<StandardSchemaV1.InferOutput<TOutputNew>>): QueryFactoryWithResolve<TInputO, TOutputNew, TInput>;
|
|
438
|
-
}
|
|
439
|
-
declare class MutationFactoryWithResolve<TInputO, TOutput extends GraphQLSilk, TInput extends GraphQLSilk<TInputO>> extends BaseChainFactory<Query<TOutput, TInput>> implements Mutation<TOutput, TInput> {
|
|
440
|
-
protected outputSilk: TOutput;
|
|
441
|
-
protected readonly options: MutationOptions<TOutput, TInput>;
|
|
442
|
-
get "~meta"(): Mutation<TOutput, TInput>["~meta"];
|
|
443
|
-
constructor(outputSilk: TOutput, options: MutationOptions<TOutput, TInput>);
|
|
444
|
-
protected clone(options?: Partial<typeof this.options> | undefined): this;
|
|
445
|
-
input<TInputNew extends GraphQLSilk<TInputO>>(input: TInputNew): MutationFactoryWithResolve<TInputO, TOutput, TInputNew>;
|
|
446
|
-
output<TOutputNew extends GraphQLSilk>(output: TOutputNew, transform: (output: StandardSchemaV1.InferOutput<TOutput>) => MayPromise<StandardSchemaV1.InferOutput<TOutputNew>>): MutationFactoryWithResolve<TInputO, TOutputNew, TInput>;
|
|
447
|
-
}
|
|
448
|
-
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>> {
|
|
449
|
-
protected outputSilk: TOutput;
|
|
450
|
-
protected readonly options: FieldOptions<TParent, TOutput, TInput, string[] | undefined>;
|
|
451
|
-
get "~meta"(): Field<TParent, TOutput, TInput, string[] | undefined>["~meta"];
|
|
452
|
-
constructor(outputSilk: TOutput, options: FieldOptions<TParent, TOutput, TInput, string[] | undefined>);
|
|
453
|
-
protected clone(options?: Partial<typeof this.options> | undefined): this;
|
|
454
|
-
input<TInputNew extends GraphQLSilk<TInputO>>(input: TInputNew): FieldFactoryWithResolve<TParent, TOutput, TInputO, TInputNew>;
|
|
455
|
-
output<TOutputNew extends GraphQLSilk>(output: TOutputNew, transform: (output: StandardSchemaV1.InferOutput<TOutput>) => MayPromise<StandardSchemaV1.InferOutput<TOutputNew>>): FieldFactoryWithResolve<TParent, TOutputNew, TInputO, TInput>;
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
interface FieldMeta extends GraphQLFieldOptions {
|
|
459
|
-
operation: "field" | "query" | "mutation" | "subscription";
|
|
460
|
-
output: GraphQLSilk;
|
|
461
|
-
input: GraphQLSilk | Record<string, GraphQLSilk> | void;
|
|
462
|
-
middlewares?: Middleware[];
|
|
463
|
-
dependencies?: string[];
|
|
464
|
-
resolve: (...args: any) => MayPromise<any>;
|
|
465
|
-
}
|
|
466
|
-
interface BaseField {
|
|
467
|
-
readonly "~meta": FieldMeta;
|
|
468
|
-
}
|
|
469
|
-
interface Field<TParent extends GraphQLSilk, TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void, TDependencies extends string[] | undefined = undefined> extends BaseField {
|
|
470
|
-
"~meta": {
|
|
471
|
-
operation: "field";
|
|
472
|
-
output: TOutput;
|
|
473
|
-
input: TInput;
|
|
474
|
-
middlewares?: Middleware[];
|
|
475
|
-
dependencies?: TDependencies;
|
|
476
|
-
types?: {
|
|
477
|
-
parent: ReSilk<TParent>;
|
|
478
|
-
};
|
|
479
|
-
resolve: (parent: StandardSchemaV1.InferOutput<NonNullable<TParent>>, input: InferInputO<TInput>, payload: ResolverPayload | void) => Promise<StandardSchemaV1.InferOutput<TOutput>>;
|
|
480
|
-
} & GraphQLFieldOptions;
|
|
481
|
-
}
|
|
482
|
-
interface Query<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void> extends BaseField {
|
|
483
|
-
"~meta": {
|
|
484
|
-
operation: "query";
|
|
485
|
-
parent?: undefined;
|
|
486
|
-
output: TOutput;
|
|
487
|
-
input: TInput;
|
|
488
|
-
middlewares?: Middleware[];
|
|
489
|
-
resolve: (input: InferInputO<TInput>, payload: ResolverPayload | void) => Promise<StandardSchemaV1.InferOutput<TOutput>>;
|
|
490
|
-
} & GraphQLFieldOptions;
|
|
491
|
-
}
|
|
492
|
-
interface Mutation<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void> extends BaseField {
|
|
493
|
-
"~meta": {
|
|
494
|
-
operation: "mutation";
|
|
495
|
-
parent?: undefined;
|
|
496
|
-
output: TOutput;
|
|
497
|
-
input: TInput;
|
|
498
|
-
middlewares?: Middleware[];
|
|
499
|
-
resolve: (input: InferInputO<TInput>, payload: ResolverPayload | void) => Promise<StandardSchemaV1.InferOutput<TOutput>>;
|
|
500
|
-
} & GraphQLFieldOptions;
|
|
501
|
-
}
|
|
502
|
-
interface Subscription<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void, TValue = StandardSchemaV1.InferOutput<TOutput>> extends BaseField {
|
|
503
|
-
"~meta": {
|
|
504
|
-
operation: "subscription";
|
|
505
|
-
parent?: undefined;
|
|
506
|
-
output: TOutput;
|
|
507
|
-
input: TInput;
|
|
508
|
-
middlewares?: Middleware[];
|
|
509
|
-
types?: {
|
|
510
|
-
value: TValue;
|
|
511
|
-
} & GraphQLFieldOptions;
|
|
512
|
-
resolve: (value: TValue, input: InferInputO<TInput>, payload: ResolverPayload | void) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>;
|
|
513
|
-
subscribe: (input: InferInputO<TInput>, payload: ResolverPayload | void) => MayPromise<AsyncIterator<TValue>>;
|
|
514
|
-
} & GraphQLFieldOptions;
|
|
515
|
-
}
|
|
516
|
-
interface Resolver {
|
|
517
|
-
readonly "~meta": {
|
|
518
|
-
[IS_RESOLVER]: true;
|
|
519
|
-
fields: Record<string, BaseField | typeof FIELD_HIDDEN>;
|
|
520
|
-
options?: ResolverOptionsWithExtensions<any>;
|
|
521
|
-
parent?: GraphQLSilk;
|
|
522
|
-
};
|
|
523
|
-
}
|
|
524
|
-
type Operation = Query<GraphQLSilk, GraphQLSilk | Record<string, GraphQLSilk> | void> | Mutation<GraphQLSilk, GraphQLSilk | Record<string, GraphQLSilk> | void> | Subscription<GraphQLSilk, GraphQLSilk | Record<string, GraphQLSilk> | void, any>;
|
|
525
|
-
type FieldOrOperation = Field<GraphQLSilk, GraphQLSilk, GraphQLSilk | Record<string, GraphQLSilk> | void, string[] | undefined> | Operation;
|
|
526
|
-
type ReSilk<T extends GraphQLSilk> = GraphQLSilk<NonNullable<T["~standard"]["types"]>["output"], NonNullable<T["~standard"]["types"]>["input"]>;
|
|
527
|
-
|
|
528
|
-
type typesLoom_BaseField = BaseField;
|
|
529
|
-
type typesLoom_Field<TParent extends GraphQLSilk, TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void, TDependencies extends string[] | undefined = undefined> = Field<TParent, TOutput, TInput, TDependencies>;
|
|
530
|
-
type typesLoom_FieldMeta = FieldMeta;
|
|
531
|
-
type typesLoom_FieldOrOperation = FieldOrOperation;
|
|
532
|
-
type typesLoom_Mutation<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void> = Mutation<TOutput, TInput>;
|
|
533
|
-
type typesLoom_Operation = Operation;
|
|
534
|
-
type typesLoom_Query<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void> = Query<TOutput, TInput>;
|
|
535
|
-
type typesLoom_Resolver = Resolver;
|
|
536
|
-
type typesLoom_Subscription<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void, TValue = StandardSchemaV1.InferOutput<TOutput>> = Subscription<TOutput, TInput, TValue>;
|
|
537
|
-
declare namespace typesLoom {
|
|
538
|
-
export type { typesLoom_BaseField as BaseField, typesLoom_Field as Field, typesLoom_FieldMeta as FieldMeta, typesLoom_FieldOrOperation as FieldOrOperation, typesLoom_Mutation as Mutation, typesLoom_Operation as Operation, typesLoom_Query as Query, typesLoom_Resolver as Resolver, typesLoom_Subscription as Subscription };
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
interface GraphQLSilk<TOutput = any, TInput = any> extends StandardSchemaV1<TInput, TOutput> {
|
|
542
|
-
/**
|
|
543
|
-
* GraphQL type for schema
|
|
544
|
-
*/
|
|
545
|
-
[GET_GRAPHQL_TYPE]?: () => GraphQLOutputType;
|
|
546
|
-
}
|
|
547
|
-
interface ResolverOptions<TField extends FieldOrOperation = FieldOrOperation> {
|
|
548
|
-
middlewares?: Middleware<TField>[];
|
|
549
|
-
}
|
|
550
|
-
interface ResolverOptionsWithExtensions<TField extends FieldOrOperation = FieldOrOperation> extends ResolverOptions<TField>, Pick<GraphQLObjectTypeConfig<any, any>, "extensions"> {
|
|
551
|
-
}
|
|
552
|
-
interface ResolverOptionsWithParent<TField extends FieldOrOperation = FieldOrOperation> extends ResolverOptionsWithExtensions<TField> {
|
|
553
|
-
parent?: TField extends Field<infer TParent, any, any, any> ? TParent : undefined;
|
|
554
|
-
}
|
|
555
|
-
interface ResolvingOptions extends Pick<ResolverOptions, "middlewares"> {
|
|
556
|
-
payload: ResolverPayload | undefined;
|
|
557
|
-
}
|
|
558
|
-
type OperationType = "query" | "mutation" | "subscription";
|
|
559
|
-
type FieldOrOperationType = "field" | OperationType;
|
|
560
|
-
interface GraphQLFieldOptions extends Pick<GraphQLFieldConfig<any, any>, "description" | "deprecationReason" | "extensions"> {
|
|
561
|
-
}
|
|
562
|
-
type InferFieldInput<TField extends BaseField> = TField["~meta"]["input"];
|
|
563
|
-
type InferFieldOutput<TField extends BaseField> = TField["~meta"]["output"];
|
|
564
|
-
/**
|
|
565
|
-
* Options for creating a GraphQL Query.
|
|
566
|
-
*/
|
|
567
|
-
interface QueryOptions<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void> extends ResolverOptions<Query<TOutput, TInput>>, GraphQLFieldOptions {
|
|
568
|
-
input?: TInput;
|
|
569
|
-
resolve: (input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>;
|
|
570
|
-
}
|
|
571
|
-
/**
|
|
572
|
-
* Options for creating a GraphQL Mutation.
|
|
573
|
-
*/
|
|
574
|
-
interface MutationOptions<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined> extends ResolverOptions<Mutation<TOutput, TInput>>, GraphQLFieldOptions {
|
|
575
|
-
input?: TInput;
|
|
576
|
-
resolve: (input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>;
|
|
577
|
-
}
|
|
578
|
-
/**
|
|
579
|
-
* Function to create a GraphQL query.
|
|
580
|
-
*/
|
|
581
|
-
interface QueryFactory {
|
|
582
|
-
<TOutput extends GraphQLSilk>(output: TOutput, resolve: (input: void, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>): Query<TOutput, void>;
|
|
583
|
-
<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void>(output: TOutput, options: QueryOptions<TOutput, TInput>): Query<TOutput, TInput>;
|
|
584
|
-
<TOutput extends GraphQLSilk>(output: TOutput): QueryChainFactory<TOutput, void>;
|
|
585
|
-
}
|
|
586
|
-
interface QueryFactoryWithChain extends QueryFactory, QueryChainFactory<never, void> {
|
|
587
|
-
}
|
|
588
|
-
/**
|
|
589
|
-
* Function to create a GraphQL mutation.
|
|
590
|
-
*/
|
|
591
|
-
interface MutationFactory {
|
|
592
|
-
<TOutput extends GraphQLSilk>(output: TOutput, resolve: (input: void, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>): Mutation<TOutput, undefined>;
|
|
593
|
-
<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined>(output: TOutput, options: MutationOptions<TOutput, TInput>): Mutation<TOutput, TInput>;
|
|
594
|
-
<TOutput extends GraphQLSilk>(output: TOutput): MutationChainFactory<TOutput, undefined>;
|
|
595
|
-
}
|
|
596
|
-
/**
|
|
597
|
-
* Function to create a GraphQL mutation.
|
|
598
|
-
*/
|
|
599
|
-
interface MutationFactoryWithChain extends MutationFactory, MutationChainFactory<never, undefined> {
|
|
600
|
-
}
|
|
601
|
-
/**
|
|
602
|
-
* Options for External Filed of existing GraphQL Object.
|
|
603
|
-
*/
|
|
604
|
-
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 {
|
|
605
|
-
input?: TInput;
|
|
606
|
-
dependencies?: TDependencies;
|
|
607
|
-
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>>;
|
|
608
|
-
}
|
|
609
|
-
/**
|
|
610
|
-
* Function to create a GraphQL Field.
|
|
611
|
-
*/
|
|
612
|
-
interface FieldFactory {
|
|
613
|
-
<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>;
|
|
614
|
-
<TParent extends GraphQLSilk, TOutput extends GraphQLSilk>(output: TOutput, options: FieldOptions<TParent, TOutput, undefined, undefined>): Field<TParent, TOutput, undefined, undefined>;
|
|
615
|
-
<TParent extends GraphQLSilk, TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | undefined>(output: TOutput, options: FieldOptions<TParent, TOutput, TInput, undefined> & {
|
|
616
|
-
input: TInput;
|
|
617
|
-
}): Field<TParent, TOutput, TInput, undefined>;
|
|
618
|
-
<TParent extends GraphQLSilk, TOutput extends GraphQLSilk, const TDependencies extends string[] | undefined>(output: TOutput, options: FieldOptions<TParent, TOutput, undefined, TDependencies> & {
|
|
619
|
-
dependencies: TDependencies;
|
|
620
|
-
}): Field<TParent, TOutput, undefined, TDependencies>;
|
|
621
|
-
<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> & {
|
|
622
|
-
input: TInput;
|
|
623
|
-
dependencies: TDependencies;
|
|
624
|
-
}): Field<TParent, TOutput, TInput, TDependencies>;
|
|
625
|
-
<TOutput extends GraphQLSilk>(output: TOutput): FieldChainFactory<TOutput, undefined, undefined>;
|
|
626
|
-
}
|
|
627
|
-
interface FieldFactoryWithUtils extends FieldFactory, FieldChainFactory<never, undefined, undefined> {
|
|
628
|
-
/** Set fields to be hidden in GraphQL Schema */
|
|
629
|
-
hidden: typeof FIELD_HIDDEN;
|
|
630
|
-
}
|
|
631
|
-
/**
|
|
632
|
-
* Options for creating a GraphQL Subscription.
|
|
633
|
-
*/
|
|
634
|
-
interface SubscriptionOptions<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined, TValue = StandardSchemaV1.InferOutput<TOutput>> extends ResolverOptions<Subscription<TOutput, TInput, TValue>>, GraphQLFieldOptions {
|
|
635
|
-
input?: TInput;
|
|
636
|
-
subscribe: (input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<AsyncIterator<TValue>>;
|
|
637
|
-
resolve?: (value: TValue, input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>;
|
|
638
|
-
}
|
|
639
|
-
/**
|
|
640
|
-
* Function to create a GraphQL subscription.
|
|
641
|
-
*/
|
|
642
|
-
interface SubscriptionFactory {
|
|
643
|
-
<TOutput extends GraphQLSilk, TValue = StandardSchemaV1.InferOutput<TOutput>>(output: TOutput, subscribe: (payload: ResolverPayload | undefined) => MayPromise<AsyncIterator<StandardSchemaV1.InferOutput<TOutput>>>): Subscription<TOutput, undefined, TValue>;
|
|
644
|
-
<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>;
|
|
645
|
-
<TOutput extends GraphQLSilk>(output: TOutput): SubscriptionChainFactory<TOutput, undefined>;
|
|
646
|
-
}
|
|
647
|
-
interface SubscriptionFactoryWithChain extends SubscriptionFactory, SubscriptionChainFactory<never, undefined> {
|
|
648
|
-
}
|
|
649
|
-
/**
|
|
650
|
-
* Detailed payload of the current resolver
|
|
651
|
-
*/
|
|
652
|
-
interface ResolverPayload<TContext extends object = object, TField extends BaseField = BaseField> {
|
|
653
|
-
/**
|
|
654
|
-
* The previous object, which for a field on the root Query type is often not used.
|
|
655
|
-
*/
|
|
656
|
-
readonly root: any;
|
|
657
|
-
/**
|
|
658
|
-
* The arguments provided to the field in the GraphQL query.
|
|
659
|
-
*/
|
|
660
|
-
readonly args: Record<string, any>;
|
|
661
|
-
/**
|
|
662
|
-
* The resolved value of the field, or an error.
|
|
663
|
-
*/
|
|
664
|
-
readonly context: TContext;
|
|
665
|
-
/**
|
|
666
|
-
* A custom object each resolver can read from/write to.
|
|
667
|
-
*/
|
|
668
|
-
readonly info: GraphQLResolveInfo;
|
|
669
|
-
/**
|
|
670
|
-
* The field that is being resolved.
|
|
671
|
-
*/
|
|
672
|
-
readonly field: TField;
|
|
673
|
-
}
|
|
674
|
-
|
|
675
|
-
/**
|
|
676
|
-
* The operation of the field:
|
|
677
|
-
* - `field`
|
|
678
|
-
* - `query`
|
|
679
|
-
* - `mutation`
|
|
680
|
-
* - `subscription.resolve`
|
|
681
|
-
* - `subscription.subscribe`
|
|
682
|
-
* - `resolveReference`
|
|
683
|
-
*/
|
|
684
|
-
type MiddlewareOperation = "field" | "query" | "mutation" | "subscription.resolve" | "subscription.subscribe" | "resolveReference";
|
|
685
|
-
interface MiddlewareOptions<TField extends BaseField = BaseField> {
|
|
686
|
-
/** The Output Silk */
|
|
687
|
-
outputSilk: StandardSchemaV1.InferOutput<InferFieldOutput<TField>>;
|
|
688
|
-
/** The previous object. */
|
|
689
|
-
parent: InferFieldParent<TField>;
|
|
690
|
-
/** A function to parse the input */
|
|
691
|
-
parseInput: CallableInputParser<TField["~meta"]["input"]>;
|
|
692
|
-
/** The executing operation */
|
|
693
|
-
operation: MiddlewareOperation;
|
|
694
|
-
/** The payload of the resolver */
|
|
695
|
-
payload: ResolverPayload | undefined;
|
|
696
|
-
}
|
|
697
|
-
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;
|
|
698
|
-
interface CallableMiddlewareOptions<TField extends BaseField = BaseField> extends MiddlewareOptions<TField> {
|
|
699
|
-
/** The function to call next in the middleware chain. */
|
|
700
|
-
next: () => MayPromise<StandardSchemaV1.InferOutput<InferFieldOutput<TField>>>;
|
|
701
|
-
/** The function to call next in the middleware chain. */
|
|
702
|
-
(): MayPromise<StandardSchemaV1.InferOutput<InferFieldOutput<TField>>>;
|
|
703
|
-
}
|
|
704
|
-
interface MiddlewareConfig {
|
|
705
|
-
/** The operations to apply the middleware to. */
|
|
706
|
-
operations?: MiddlewareOperation[];
|
|
707
|
-
}
|
|
708
|
-
interface Middleware<TField extends BaseField = any> extends Partial<MiddlewareConfig> {
|
|
709
|
-
(options: CallableMiddlewareOptions<TField>): MayPromise<StandardSchemaV1.InferOutput<InferFieldOutput<TField>>>;
|
|
710
|
-
}
|
|
711
|
-
declare function applyMiddlewares<TField extends BaseField = BaseField>(options: MiddlewareOptions<TField>, resolveFunction: () => MayPromise<StandardSchemaV1.InferOutput<InferFieldOutput<TField>>>, middlewares: Middleware[]): Promise<StandardSchemaV1.InferOutput<InferFieldOutput<TField>>>;
|
|
712
|
-
declare function filterMiddlewares(operation: MiddlewareOperation, ...middlewareList: (Middleware | Iterable<Middleware> | undefined | null)[]): Middleware[];
|
|
713
|
-
|
|
714
|
-
/**
|
|
715
|
-
* Represents the state of field resolution in a GraphQL query.
|
|
716
|
-
*/
|
|
717
|
-
interface ResolvingFields {
|
|
718
|
-
/**
|
|
719
|
-
* Fields explicitly requested in the GraphQL query
|
|
720
|
-
*/
|
|
721
|
-
requestedFields: Set<string>;
|
|
722
|
-
/**
|
|
723
|
-
* Fields that are derived from other fields (computed fields)
|
|
724
|
-
*/
|
|
725
|
-
derivedFields: Set<string>;
|
|
726
|
-
/**
|
|
727
|
-
* Fields that derived fields depend on
|
|
728
|
-
*/
|
|
729
|
-
derivedDependencies: Set<string>;
|
|
730
|
-
/**
|
|
731
|
-
* Final set of fields that need to be resolved, after processing derived fields
|
|
732
|
-
*/
|
|
733
|
-
selectedFields: Set<string>;
|
|
734
|
-
}
|
|
735
|
-
/**
|
|
736
|
-
* Analyzes and processes field resolution in a GraphQL query.
|
|
737
|
-
*
|
|
738
|
-
* @param payload - The resolver payload containing the current field resolution context
|
|
739
|
-
* @returns An object containing sets of different field types
|
|
740
|
-
*/
|
|
741
|
-
declare function getResolvingFields(payload: Pick<ResolverPayload, "info">): ResolvingFields;
|
|
742
|
-
/**
|
|
743
|
-
* Parses the GraphQL resolve info to extract all requested fields.
|
|
744
|
-
* Returns a Set of field paths where nested fields are represented as 'parent.field'.
|
|
745
|
-
* Supports @include, @skip directives, fragments, and variables.
|
|
746
|
-
*
|
|
747
|
-
* @param info - The GraphQL resolve info object containing the query information
|
|
748
|
-
* @param maxDepth - Maximum depth of nested fields to parse (default: 1)
|
|
749
|
-
* @returns A Set of field paths
|
|
750
|
-
*/
|
|
751
|
-
declare function parseResolvingFields(info: GraphQLResolveInfo, maxDepth?: number): Set<string>;
|
|
752
|
-
|
|
753
|
-
/**
|
|
754
|
-
* Empty Resolver Arguments that only store the memoization
|
|
755
|
-
*/
|
|
756
|
-
interface OnlyMemoizationPayload {
|
|
757
|
-
memoization: WeakMap<WeakKey, any>;
|
|
758
|
-
isMemoization: true;
|
|
759
|
-
}
|
|
760
|
-
/**
|
|
761
|
-
* Create an empty memoization payload for the resolver
|
|
762
|
-
* @returns the empty memoization payload
|
|
763
|
-
*/
|
|
764
|
-
declare function onlyMemoization(): OnlyMemoizationPayload;
|
|
765
|
-
declare function isOnlyMemoryPayload(payload: OnlyMemoizationPayload | Pick<ResolverPayload, "context">): payload is OnlyMemoizationPayload;
|
|
766
|
-
declare function getMemoizationMap(payload: OnlyMemoizationPayload | Pick<ResolverPayload, "context">): WeakMap<WeakKey, any>;
|
|
767
|
-
interface ContextMemoryContainer {
|
|
768
|
-
[CONTEXT_MAP_KEY]?: WeakMap<WeakKey, any>;
|
|
769
|
-
}
|
|
770
|
-
declare function assignContextMap(target: ContextMemoryContainer): WeakMap<WeakKey, any>;
|
|
771
|
-
|
|
772
|
-
export { BaseChainFactory as $, type MiddlewareOperation as A, type BaseField as B, type MiddlewareOptions as C, type CallableMiddlewareOptions as D, type MiddlewareConfig as E, type FieldOptions as F, type GraphQLFieldOptions as G, applyMiddlewares as H, IS_RESOLVER as I, filterMiddlewares as J, type ResolvingFields as K, getResolvingFields as L, type MutationOptions as M, parseResolvingFields as N, type Operation as O, type OnlyMemoizationPayload as P, type QueryOptions as Q, type ResolverPayload as R, type SubscriptionOptions as S, onlyMemoization as T, isOnlyMemoryPayload as U, type ValueOf as V, WEAVER_CONFIG as W, getMemoizationMap as X, assignContextMap as Y, type IChainFactory as Z, type ChainFactoryOptions as _, StandardSchemaV1 as a, type ResolvableSubscription as a0, type SubscriptionNeedResolve as a1, QueryFactoryWithResolve as a2, MutationFactoryWithResolve as a3, FieldFactoryWithResolve as a4, typesLoom as a5, type ResolverOptionsWithParent as a6, type ResolvingOptions as a7, type OperationType as a8, type FieldOrOperationType as a9, type InferFieldInput as aa, type InferFieldOutput as ab, type QueryFactory as ac, type MutationFactory as ad, type FieldFactory as ae, type SubscriptionFactory as af, type FieldMeta as ag, type InferInputO as ah, type CallableInputParser as ai, createInputParser as aj, parseInputValue as ak, getStandardValue as al, type GraphQLSilk as b, type MayPromise as c, type Query as d, QueryChainFactory as e, type QueryFactoryWithChain as f, type Mutation as g, MutationChainFactory as h, type MutationFactoryWithChain as i, type Field as j, FieldChainFactory as k, type FieldFactoryWithUtils as l, SubscriptionChainFactory as m, type Subscription as n, type SubscriptionFactoryWithChain as o, FIELD_HIDDEN as p, type ResolverOptionsWithExtensions as q, type OmitInUnion as r, type ResolverOptions as s, type FieldOrOperation as t, type Resolver as u, type Middleware as v, type InferInputI as w, symbols as x, type IsAny as y, type RequireKeys as z };
|