@gqloom/core 0.10.1 → 0.11.1

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.
@@ -0,0 +1,1252 @@
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";
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
+ //#region ../../node_modules/.pnpm/@standard-schema+spec@1.0.0/node_modules/@standard-schema/spec/dist/index.d.ts
11
+ /** The Standard Schema interface. */
12
+ interface StandardSchemaV1<Input = unknown, Output = Input> {
13
+ /** The Standard Schema properties. */
14
+ readonly "~standard": StandardSchemaV1.Props<Input, Output>;
15
+ }
16
+ declare namespace StandardSchemaV1 {
17
+ /** The Standard Schema properties interface. */
18
+ export interface Props<Input = unknown, Output = Input> {
19
+ /** The version number of the standard. */
20
+ readonly version: 1;
21
+ /** The vendor name of the schema library. */
22
+ readonly vendor: string;
23
+ /** Validates unknown input values. */
24
+ readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
25
+ /** Inferred types associated with the schema. */
26
+ readonly types?: Types<Input, Output> | undefined;
27
+ }
28
+ /** The result interface of the validate function. */
29
+ export type Result<Output> = SuccessResult<Output> | FailureResult;
30
+ /** The result interface if validation succeeds. */
31
+ export interface SuccessResult<Output> {
32
+ /** The typed output value. */
33
+ readonly value: Output;
34
+ /** The non-existent issues. */
35
+ readonly issues?: undefined;
36
+ }
37
+ /** The result interface if validation fails. */
38
+ export interface FailureResult {
39
+ /** The issues of failed validation. */
40
+ readonly issues: ReadonlyArray<Issue>;
41
+ }
42
+ /** The issue interface of the failure output. */
43
+ export interface Issue {
44
+ /** The error message of the issue. */
45
+ readonly message: string;
46
+ /** The path of the issue, if any. */
47
+ readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
48
+ }
49
+ /** The path segment interface of the issue. */
50
+ export interface PathSegment {
51
+ /** The key representing a path segment. */
52
+ readonly key: PropertyKey;
53
+ }
54
+ /** The Standard Schema types interface. */
55
+ export interface Types<Input = unknown, Output = Input> {
56
+ /** The input type of the schema. */
57
+ readonly input: Input;
58
+ /** The output type of the schema. */
59
+ readonly output: Output;
60
+ }
61
+ /** Infers the input type of a Standard Schema. */
62
+ export type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
63
+ /** Infers the output type of a Standard Schema. */
64
+ export type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
65
+ export {};
66
+ }
67
+ declare namespace symbols_d_exports {
68
+ export { CONTEXT_MAP_KEY, FIELD_HIDDEN, GET_GRAPHQL_TYPE, IS_RESOLVER, RESOLVER_OPTIONS_KEY, WEAVER_CONFIG };
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
+ //#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
+ //#region src/resolver/resolver-chain-factory.d.ts
135
+ /**
136
+ * Interface for chain factory that provides methods to configure GraphQL field options
137
+ * @template TOutput - The output type of the GraphQL field
138
+ * @template TInput - The input type of the GraphQL field, can be a single type or a record of types
139
+ */
140
+ interface IChainFactory<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void> {
141
+ /**
142
+ * Sets the description for the GraphQL field
143
+ * @param description - The description text for the field
144
+ */
145
+ description(description: GraphQLFieldOptions["description"]): this;
146
+ /**
147
+ * Sets the deprecation reason for the GraphQL field
148
+ * @param deprecationReason - The reason why this field is deprecated
149
+ */
150
+ deprecationReason(deprecationReason: GraphQLFieldOptions["deprecationReason"]): this;
151
+ /**
152
+ * Sets custom extensions for the GraphQL field
153
+ * @param extensions - Custom extensions to be added to the field
154
+ */
155
+ extensions(extensions: GraphQLFieldOptions["extensions"]): this;
156
+ /**
157
+ * Sets the output type for the GraphQL field
158
+ * @template TOutputNew - The new output type
159
+ * @param output - The output type definition
160
+ */
161
+ output<TOutputNew extends GraphQLSilk>(output: TOutputNew): IChainFactory<TOutputNew, TInput>;
162
+ /**
163
+ * Sets the input type for the GraphQL field
164
+ * @template TInputNew - The new input type
165
+ * @param input - The input type definition
166
+ */
167
+ input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): IChainFactory<TOutput, TInputNew>;
168
+ }
169
+ /**
170
+ * Options for configuring a chain factory
171
+ */
172
+ interface ChainFactoryOptions extends FieldMeta {
173
+ /** Middleware functions to be applied to the field */
174
+ middlewares?: Middleware[];
175
+ }
176
+ /**
177
+ * Base class for all chain factories
178
+ * @template TField - The type of field being created
179
+ */
180
+ declare abstract class BaseChainFactory<TField extends BaseField = any> {
181
+ protected readonly options?: Partial<ChainFactoryOptions> | undefined;
182
+ /**
183
+ * Returns the available methods for the chain factory
184
+ */
185
+ static methods(): {
186
+ description: (description: GraphQLFieldOptions["description"]) => BaseChainFactory<any>;
187
+ deprecationReason: (deprecationReason: GraphQLFieldOptions["deprecationReason"]) => BaseChainFactory<any>;
188
+ extensions: (extensions: GraphQLFieldOptions["extensions"]) => BaseChainFactory<any>;
189
+ };
190
+ /**
191
+ * Creates a new instance of the chain factory
192
+ * @param options - Configuration options for the factory
193
+ */
194
+ constructor(options?: Partial<ChainFactoryOptions> | undefined);
195
+ /**
196
+ * Creates a clone of the current factory with new options
197
+ * @param options - New options to apply to the clone
198
+ */
199
+ protected abstract clone(options?: Partial<ChainFactoryOptions>): this;
200
+ /**
201
+ * Sets the description for the field
202
+ * @param description - The description text
203
+ */
204
+ description(description: GraphQLFieldOptions["description"]): this;
205
+ /**
206
+ * Sets the deprecation reason for the field
207
+ * @param deprecationReason - The reason for deprecation
208
+ */
209
+ deprecationReason(deprecationReason: GraphQLFieldOptions["deprecationReason"]): this;
210
+ /**
211
+ * Sets custom extensions for the field
212
+ * @param extensions - Custom extensions to add
213
+ */
214
+ extensions(extensions: GraphQLFieldOptions["extensions"]): this;
215
+ /**
216
+ * Adds middleware functions to the field
217
+ * @param middlewares - Middleware functions to add
218
+ */
219
+ use(...middlewares: Middleware<TField>[]): this;
220
+ }
221
+ /**
222
+ * Factory for creating field resolvers with chainable configuration
223
+ * @template TOutput - The output type of the field
224
+ * @template TInput - The input type of the field
225
+ * @template TDependencies - The dependencies of the field
226
+ */
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> {
228
+ /**
229
+ * Returns the available methods for the field chain factory
230
+ */
231
+ static methods(): FieldChainFactory<never, undefined>;
232
+ /**
233
+ * Creates a clone of the current factory with new options
234
+ * @param options - New options to apply to the clone
235
+ */
236
+ protected clone(options?: Partial<ChainFactoryOptions>): this;
237
+ /**
238
+ * Sets the output type for the field
239
+ * @template TOutputNew - The new output type
240
+ * @param output - The output type definition
241
+ */
242
+ output<TOutputNew extends GraphQLSilk>(output: TOutputNew): FieldChainFactory<TOutputNew, TInput, TDependencies>;
243
+ /**
244
+ * Sets the input type for the field
245
+ * @template TInputNew - The new input type
246
+ * @param input - The input type definition
247
+ */
248
+ input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): FieldChainFactory<TOutput, TInputNew, TDependencies>;
249
+ /**
250
+ * Specifies the dependencies for the field
251
+ * @template TDependencies - The dependencies type
252
+ * @param dependencies - The dependencies to add
253
+ */
254
+ derivedFrom<const TDependencies extends string[]>(...dependencies: TDependencies): FieldChainFactory<TOutput, TInput, TDependencies>;
255
+ /**
256
+ * Sets the resolve function for the field
257
+ * @template TParent - The parent type
258
+ * @param resolve - The resolve function
259
+ */
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>;
261
+ /**
262
+ * Creates a field resolver that uses DataLoader for batch loading data.
263
+ * This method is particularly useful for optimizing performance when dealing with multiple data requests
264
+ * by batching them together and handling caching automatically.
265
+ *
266
+ * @template TParent - The parent type that extends GraphQLSilk
267
+ * @param resolve - A function that handles batch loading of data.
268
+ * @returns A GraphQL field resolver that implements batch loading
269
+ */
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>;
271
+ }
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>>;
273
+ /**
274
+ * Factory for creating query resolvers with chainable configuration
275
+ * @template TOutput - The output type of the query
276
+ * @template TInput - The input type of the query
277
+ */
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> {
279
+ /**
280
+ * Returns the available methods for the query chain factory
281
+ * @returns An object containing all available methods
282
+ */
283
+ static methods(): QueryChainFactory<never, void>;
284
+ /**
285
+ * Creates a clone of the current factory with new options
286
+ * @param options - New options to apply to the clone
287
+ * @returns A new instance of QueryChainFactory with the updated options
288
+ */
289
+ protected clone(options?: Partial<ChainFactoryOptions>): this;
290
+ /**
291
+ * Sets the output type for the query
292
+ * @template TOutputNew - The new output type
293
+ * @param output - The output type definition
294
+ * @returns A new QueryChainFactory instance with the updated output type
295
+ */
296
+ output<TOutputNew extends GraphQLSilk>(output: TOutputNew): QueryChainFactory<TOutputNew, TInput>;
297
+ /**
298
+ * Sets the input type for the query
299
+ * @template TInputNew - The new input type
300
+ * @param input - The input type definition
301
+ * @returns A new QueryChainFactory instance with the updated input type
302
+ */
303
+ input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): QueryChainFactory<TOutput, TInputNew>;
304
+ /**
305
+ * Sets the resolve function for the query
306
+ * @param resolve - The resolve function that processes the input and returns the output
307
+ * @returns A GraphQL query resolver
308
+ * @throws {Error} If output type is not set
309
+ */
310
+ resolve(resolve: (input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>): Query<TOutput, TInput>;
311
+ }
312
+ /**
313
+ * Factory for creating mutation resolvers with chainable configuration
314
+ * @template TOutput - The output type of the mutation
315
+ * @template TInput - The input type of the mutation
316
+ */
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> {
318
+ /**
319
+ * Returns the available methods for the mutation chain factory
320
+ * @returns An object containing all available methods
321
+ */
322
+ static methods(): MutationChainFactory<never, undefined>;
323
+ /**
324
+ * Creates a clone of the current factory with new options
325
+ * @param options - New options to apply to the clone
326
+ * @returns A new instance of MutationChainFactory with the updated options
327
+ */
328
+ protected clone(options?: Partial<ChainFactoryOptions>): this;
329
+ /**
330
+ * Sets the output type for the mutation
331
+ * @template TOutputNew - The new output type
332
+ * @param output - The output type definition
333
+ * @returns A new MutationChainFactory instance with the updated output type
334
+ */
335
+ output<TOutputNew extends GraphQLSilk>(output: TOutputNew): MutationChainFactory<TOutputNew, TInput>;
336
+ /**
337
+ * Sets the input type for the mutation
338
+ * @template TInputNew - The new input type
339
+ * @param input - The input type definition
340
+ * @returns A new MutationChainFactory instance with the updated input type
341
+ */
342
+ input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): MutationChainFactory<TOutput, TInputNew>;
343
+ /**
344
+ * Sets the resolve function for the mutation
345
+ * @param resolve - The resolve function that processes the input and returns the output
346
+ * @returns A GraphQL mutation resolver
347
+ * @throws {Error} If output type is not set
348
+ */
349
+ resolve(resolve: (input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>): Mutation<TOutput, TInput>;
350
+ }
351
+ /**
352
+ * Factory for creating subscription resolvers with chainable configuration
353
+ * @template TOutput - The output type of the subscription
354
+ * @template TInput - The input type of the subscription
355
+ */
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> {
357
+ /**
358
+ * Returns the available methods for the subscription chain factory
359
+ * @returns An object containing all available methods
360
+ */
361
+ static methods(): SubscriptionChainFactory<never, undefined>;
362
+ /**
363
+ * Creates a clone of the current factory with new options
364
+ * @param options - New options to apply to the clone
365
+ * @returns A new instance of SubscriptionChainFactory with the updated options
366
+ */
367
+ protected clone(options?: Partial<ChainFactoryOptions>): this;
368
+ /**
369
+ * Sets the output type for the subscription
370
+ * @template TOutputNew - The new output type
371
+ * @param output - The output type definition
372
+ * @returns A new SubscriptionChainFactory instance with the updated output type
373
+ */
374
+ output<TOutputNew extends GraphQLSilk>(output: TOutputNew): SubscriptionChainFactory<TOutputNew, TInput>;
375
+ /**
376
+ * Sets the input type for the subscription
377
+ * @template TInputNew - The new input type
378
+ * @param input - The input type definition
379
+ * @returns A new SubscriptionChainFactory instance with the updated input type
380
+ */
381
+ input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): SubscriptionChainFactory<TOutput, TInputNew>;
382
+ /**
383
+ * Sets the subscribe function for the subscription
384
+ * @template TValue - The value type of the subscription
385
+ * @param subscribe - The subscribe function that returns an AsyncIterator
386
+ * @returns A subscription resolver that can be further configured with a resolve function
387
+ * @throws {Error} If output type is not set
388
+ */
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>;
390
+ }
391
+ /**
392
+ * Interface for a subscription that can be resolved
393
+ * @template TOutput - The output type of the subscription
394
+ * @template TInput - The input type of the subscription
395
+ * @template TValue - The value type of the subscription
396
+ */
397
+ interface ResolvableSubscription<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined, TValue = StandardSchemaV1.InferOutput<TOutput>> extends Subscription<TOutput, TInput, TValue> {
398
+ /**
399
+ * Sets the resolve function for the subscription
400
+ * @param resolve - The resolve function
401
+ */
402
+ resolve(resolve: (value: TValue, input: InferInputO<TInput>, payload: ResolverPayload | undefined) => MayPromise<StandardSchemaV1.InferOutput<TOutput>>): Subscription<TOutput, TInput, TValue>;
403
+ }
404
+ /**
405
+ * A subscription that can not be resolved yet, still needs to be resolved.
406
+ * Interface for a subscription that needs to be resolved
407
+ * @template TOutput - The output type of the subscription
408
+ * @template TInput - The input type of the subscription
409
+ * @template TValue - The value type of the subscription
410
+ */
411
+ interface SubscriptionNeedResolve<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | undefined = undefined, TValue = StandardSchemaV1.InferOutput<TOutput>> {
412
+ /**
413
+ * Sets the resolve function for the subscription
414
+ * @param resolve - The resolve function
415
+ */
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>;
444
+ }
445
+ declare namespace types_loom_d_exports {
446
+ export { BaseField, Field, FieldMeta, FieldOrOperation, Mutation, Operation, Query, Resolver, Subscription };
447
+ }
448
+ interface FieldMeta extends GraphQLFieldOptions {
449
+ operation: "field" | "query" | "mutation" | "subscription";
450
+ output: GraphQLSilk;
451
+ input: GraphQLSilk | Record<string, GraphQLSilk> | void;
452
+ middlewares?: Middleware[];
453
+ dependencies?: string[];
454
+ resolve: (...args: any) => MayPromise<any>;
455
+ }
456
+ interface BaseField {
457
+ readonly "~meta": FieldMeta;
458
+ }
459
+ interface Field<TParent extends GraphQLSilk, TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void, TDependencies extends string[] | undefined = undefined> extends BaseField {
460
+ "~meta": {
461
+ operation: "field";
462
+ output: TOutput;
463
+ input: TInput;
464
+ middlewares?: Middleware[];
465
+ dependencies?: TDependencies;
466
+ types?: {
467
+ parent: ReSilk<TParent>;
468
+ };
469
+ resolve: (parent: StandardSchemaV1.InferOutput<NonNullable<TParent>>, input: InferInputO<TInput>, payload: ResolverPayload | void) => Promise<StandardSchemaV1.InferOutput<TOutput>>;
470
+ } & GraphQLFieldOptions;
471
+ }
472
+ interface Query<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void> extends BaseField {
473
+ "~meta": {
474
+ operation: "query";
475
+ parent?: undefined;
476
+ output: TOutput;
477
+ input: TInput;
478
+ middlewares?: Middleware[];
479
+ resolve: (input: InferInputO<TInput>, payload: ResolverPayload | void) => Promise<StandardSchemaV1.InferOutput<TOutput>>;
480
+ } & GraphQLFieldOptions;
481
+ }
482
+ interface Mutation<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void> extends BaseField {
483
+ "~meta": {
484
+ operation: "mutation";
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 Subscription<TOutput extends GraphQLSilk, TInput extends GraphQLSilk | Record<string, GraphQLSilk> | void = void, TValue = StandardSchemaV1.InferOutput<TOutput>> extends BaseField {
493
+ "~meta": {
494
+ operation: "subscription";
495
+ parent?: undefined;
496
+ output: TOutput;
497
+ input: TInput;
498
+ middlewares?: Middleware[];
499
+ types?: {
500
+ value: TValue;
501
+ } & 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>>;
504
+ } & GraphQLFieldOptions;
505
+ }
506
+ interface Resolver {
507
+ readonly "~meta": {
508
+ [IS_RESOLVER]: true;
509
+ fields: Record<string, BaseField | typeof FIELD_HIDDEN>;
510
+ options?: ResolverOptionsWithExtensions<any>;
511
+ parent?: GraphQLSilk;
512
+ };
513
+ }
514
+ 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
+ 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"]>;
517
+ //#endregion
518
+ //#region src/resolver/types.d.ts
519
+ interface GraphQLSilk<TOutput = any, TInput = any> extends StandardSchemaV1<TInput, TOutput> {
520
+ /**
521
+ * GraphQL type for schema
522
+ */
523
+ [GET_GRAPHQL_TYPE]?: () => GraphQLOutputType;
524
+ }
525
+ interface ResolverOptions<TField extends FieldOrOperation = FieldOrOperation> {
526
+ middlewares?: Middleware<TField>[];
527
+ }
528
+ interface ResolverOptionsWithExtensions<TField extends FieldOrOperation = FieldOrOperation> extends ResolverOptions<TField>, Pick<GraphQLObjectTypeConfig<any, any>, "extensions"> {}
529
+ interface ResolverOptionsWithParent<TField extends FieldOrOperation = FieldOrOperation> extends ResolverOptionsWithExtensions<TField> {
530
+ parent?: TField extends Field<infer TParent, any, any, any> ? TParent : undefined;
531
+ }
532
+ interface ResolvingOptions extends Pick<ResolverOptions, "middlewares"> {
533
+ payload: ResolverPayload | undefined;
534
+ }
535
+ type OperationType = "query" | "mutation" | "subscription";
536
+ type FieldOrOperationType = "field" | OperationType;
537
+ interface GraphQLFieldOptions extends Pick<GraphQLFieldConfig<any, any>, "description" | "deprecationReason" | "extensions"> {}
538
+ type InferFieldInput<TField extends BaseField> = TField["~meta"]["input"];
539
+ type InferFieldOutput<TField extends BaseField> = TField["~meta"]["output"];
540
+ /**
541
+ * Options for creating a GraphQL Query.
542
+ */
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>>;
546
+ }
547
+ /**
548
+ * Options for creating a GraphQL Mutation.
549
+ */
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>>;
553
+ }
554
+ /**
555
+ * Function to create a GraphQL query.
556
+ */
557
+ 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>;
561
+ }
562
+ interface QueryFactoryWithChain extends QueryFactory, QueryChainFactory<never, void> {}
563
+ /**
564
+ * Function to create a GraphQL mutation.
565
+ */
566
+ 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>;
570
+ }
571
+ /**
572
+ * Function to create a GraphQL mutation.
573
+ */
574
+ interface MutationFactoryWithChain extends MutationFactory, MutationChainFactory<never, undefined> {}
575
+ /**
576
+ * Options for External Filed of existing GraphQL Object.
577
+ */
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>>;
582
+ }
583
+ /**
584
+ * Function to create a GraphQL Field.
585
+ */
586
+ 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>;
600
+ }
601
+ interface FieldFactoryWithUtils extends FieldFactory, FieldChainFactory<never, undefined, undefined> {
602
+ /** Set fields to be hidden in GraphQL Schema */
603
+ hidden: typeof FIELD_HIDDEN;
604
+ }
605
+ /**
606
+ * Options for creating a GraphQL Subscription.
607
+ */
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>>;
612
+ }
613
+ /**
614
+ * Function to create a GraphQL subscription.
615
+ */
616
+ 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>;
620
+ }
621
+ interface SubscriptionFactoryWithChain extends SubscriptionFactory, SubscriptionChainFactory<never, undefined> {}
622
+ /**
623
+ * Detailed payload of the current resolver
624
+ */
625
+ interface ResolverPayload<TContext extends object = object, TField extends BaseField = BaseField> {
626
+ /**
627
+ * The previous object, which for a field on the root Query type is often not used.
628
+ */
629
+ readonly root: any;
630
+ /**
631
+ * The arguments provided to the field in the GraphQL query.
632
+ */
633
+ readonly args: Record<string, any>;
634
+ /**
635
+ * The resolved value of the field, or an error.
636
+ */
637
+ readonly context: TContext;
638
+ /**
639
+ * A custom object each resolver can read from/write to.
640
+ */
641
+ readonly info: GraphQLResolveInfo;
642
+ /**
643
+ * The field that is being resolved.
644
+ */
645
+ readonly field: TField;
646
+ }
647
+ //#endregion
648
+ //#region src/utils/args.d.ts
649
+ declare function getOperationOptions(resolveOrOptions: ((...args: any) => any) | FieldOptions<any, any, any, any> | QueryOptions<any, any> | MutationOptions<any, any>): any;
650
+ declare function getSubscriptionOptions(subscribeOrOptions: ((payload: ResolverPayload | undefined) => any) | SubscriptionOptions<any, any, any>): SubscriptionOptions<any, any, any>;
651
+ declare function getFieldOptions({
652
+ description,
653
+ deprecationReason,
654
+ extensions
655
+ }: GraphQLFieldOptions, extraExtensions?: GraphQLFieldExtensions<any, any, any>): GraphQLFieldOptions;
656
+ //#endregion
657
+ //#region src/resolver/silk.d.ts
658
+ /**
659
+ * Create a Silk from Scalar.
660
+ */
661
+ 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>>;
662
+ /**
663
+ * Create a GraphQLSilk Object.
664
+ */
665
+ 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>>;
666
+ /**
667
+ * Create a GraphQLSilk Object.
668
+ */
669
+ declare function silk<TOutput, TInput = TOutput>(type: GraphQLOutputType | (() => GraphQLOutputType), validate?: (value: TInput) => StandardSchemaV1.Result<TOutput> | Promise<StandardSchemaV1.Result<TOutput>>): GraphQLSilk<TOutput, TInput>;
670
+ declare namespace silk {
671
+ var parse: typeof parseSilk;
672
+ var getType: typeof getGraphQLType;
673
+ var nonNull: typeof nonNullSilk;
674
+ var list: typeof listSilk;
675
+ var nullable: typeof nullableSilk;
676
+ }
677
+ type NonNullSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<NonNullable<StandardSchemaV1.InferOutput<TSilk>>, NonNullable<StandardSchemaV1.InferInput<TSilk>>>;
678
+ /**
679
+ * Non-nullable Silk.
680
+ */
681
+ declare function nonNullSilk<TSilk extends GraphQLSilk<any, any>>(origin: TSilk): NonNullSilk<TSilk>;
682
+ type ListSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<Array<StandardSchemaV1.InferOutput<TSilk>>, Array<StandardSchemaV1.InferOutput<TSilk>>>;
683
+ /**
684
+ * List Silk.
685
+ */
686
+ declare function listSilk<TSilk extends GraphQLSilk<any, any>>(origin: TSilk): ListSilk<TSilk>;
687
+ type NullableSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<StandardSchemaV1.InferOutput<TSilk> | null | undefined, StandardSchemaV1.InferInput<TSilk>>;
688
+ /**
689
+ * Nullable Silk.
690
+ */
691
+ declare function nullableSilk<TSilk extends GraphQLSilk<any, any>>(origin: TSilk): NullableSilk<TSilk>;
692
+ /**
693
+ * Get GraphQL Output Type from Silk.
694
+ * @param silk GraphQL Silk
695
+ * @returns GraphQL Output Type
696
+ */
697
+ declare function getGraphQLType(silk: GraphQLSilk): GraphQLOutputType;
698
+ /**
699
+ * Validate and transform input to output
700
+ * @param silk silk GraphQL Silk
701
+ * @param input
702
+ * @returns output
703
+ */
704
+ declare function parseSilk<TSilk extends GraphQLSilk>(silk: TSilk, input: StandardSchemaV1.InferInput<TSilk>): MayPromise<StandardSchemaV1.Result<StandardSchemaV1.InferOutput<TSilk>>>;
705
+ declare function isSilk(target: any): target is GraphQLSilk;
706
+ type GraphQLVariants<TSource extends GraphQLNullableType> = TSource | GraphQLList<TSource> | GraphQLList<GraphQLNonNull<TSource>> | GraphQLNonNull<TSource> | GraphQLNonNull<GraphQLList<TSource>> | GraphQLNonNull<GraphQLList<GraphQLNonNull<TSource>>>;
707
+ type InferScalarInternalByVariants<T extends GraphQLVariants<GraphQLScalarType>> = T extends GraphQLNonNull<infer U> ? U extends GraphQLVariants<GraphQLScalarType> ? NonNullable<InferScalarInternalByVariants<U>> : never : T extends GraphQLList<infer U> ? U extends GraphQLVariants<GraphQLScalarType> ? InferScalarInternalByVariants<U>[] : never : T extends GraphQLScalarType<infer TInternal, any> ? TInternal | null | undefined : never;
708
+ type InferScalarExternalByVariants<T extends GraphQLVariants<GraphQLScalarType>> = T extends GraphQLNonNull<infer U> ? U extends GraphQLVariants<GraphQLScalarType> ? NonNullable<InferScalarExternalByVariants<U>> : never : T extends GraphQLList<infer U> ? U extends GraphQLVariants<GraphQLScalarType> ? InferScalarExternalByVariants<U>[] : never : T extends GraphQLScalarType<any, infer TExternal> ? TExternal | null | undefined : never;
709
+ type InferObjectSourceByVariants<T extends GraphQLVariants<GraphQLObjectType>> = T extends GraphQLNonNull<infer U> ? U extends GraphQLVariants<GraphQLObjectType> ? NonNullable<InferObjectSourceByVariants<U>> : never : T extends GraphQLList<infer U> ? U extends GraphQLVariants<GraphQLObjectType> ? InferObjectSourceByVariants<U>[] : never : T extends GraphQLObjectType<infer TSource> ? TSource | null | undefined : never;
710
+ //#endregion
711
+ //#region src/resolver/resolver.d.ts
712
+ /**
713
+ * Creates a GraphQL query resolver
714
+ * @param output - The output type definition for the query
715
+ * @param resolveOrOptions - Either a resolve function or options object
716
+ * @returns A GraphQL query resolver
717
+ */
718
+ declare const createQuery: (output: GraphQLSilk<any, any>, resolveOrOptions?: ((...args: any) => MayPromise<unknown>) | QueryOptions<any, any>) => Query<any, any> | QueryChainFactory<never, void>;
719
+ /**
720
+ * Factory function for creating GraphQL queries with chainable configuration
721
+ */
722
+ declare const query$1: QueryFactoryWithChain;
723
+ /**
724
+ * Creates a GraphQL mutation resolver
725
+ * @param output - The output type definition for the mutation
726
+ * @param resolveOrOptions - Either a resolve function or options object
727
+ * @returns A GraphQL mutation resolver
728
+ */
729
+ declare const createMutation: (output: GraphQLSilk<any, any>, resolveOrOptions?: (() => MayPromise<unknown>) | MutationOptions<any, any>) => Mutation<any, any> | MutationChainFactory<never, undefined>;
730
+ /**
731
+ * Factory function for creating GraphQL mutations with chainable configuration
732
+ */
733
+ declare const mutation$1: MutationFactoryWithChain;
734
+ /**
735
+ * Creates a GraphQL field resolver
736
+ * @param output - The output type definition for the field
737
+ * @param resolveOrOptions - Either a resolve function or options object
738
+ * @returns A GraphQL field resolver
739
+ */
740
+ declare const createField: (output: GraphQLSilk<any, any>, resolveOrOptions?: (() => unknown) | FieldOptions<GraphQLSilk, GraphQLSilk, GraphQLSilk | Record<string, GraphQLSilk> | void, string[] | undefined>) => Field<any, any, any, any> | FieldChainFactory<never, undefined, undefined>;
741
+ /**
742
+ * Factory function for creating GraphQL fields with chainable configuration
743
+ */
744
+ declare const field: FieldFactoryWithUtils;
745
+ /**
746
+ * Default subscription resolver that returns the source value
747
+ * @param source - The source value to resolve
748
+ */
749
+ declare const defaultSubscriptionResolve: (source: any) => any;
750
+ /**
751
+ * Creates a GraphQL subscription resolver
752
+ * @param output - The output type definition for the subscription
753
+ * @returns A subscription chain factory
754
+ */
755
+ declare function createSubscription(output: GraphQLSilk<any, any>): SubscriptionChainFactory;
756
+ /**
757
+ * Creates a GraphQL subscription resolver with subscribe function
758
+ * @param output - The output type definition for the subscription
759
+ * @param subscribeOrOptions - Either a subscribe function or options object
760
+ * @returns A GraphQL subscription resolver
761
+ */
762
+ declare function createSubscription(output: GraphQLSilk<any, any>, subscribeOrOptions: (() => MayPromise<AsyncIterator<unknown>>) | SubscriptionOptions<any, any, any>): Subscription<any, any, any>;
763
+ /**
764
+ * Factory function for creating GraphQL subscriptions with chainable configuration
765
+ */
766
+ declare const subscription$1: SubscriptionFactoryWithChain;
767
+ declare const resolver: ResolverFactory;
768
+ /**
769
+ * Collection of factory functions for creating GraphQL operations
770
+ */
771
+ declare const loom: {
772
+ query: QueryFactoryWithChain;
773
+ resolver: ResolverFactory;
774
+ field: FieldFactoryWithUtils;
775
+ subscription: SubscriptionFactoryWithChain;
776
+ mutation: MutationFactoryWithChain;
777
+ };
778
+ /**
779
+ * Properties for creating an executor
780
+ */
781
+ interface ToExecutorProps {
782
+ /** WeakMap for memoization */
783
+ memoization?: WeakMap<WeakKey, any>;
784
+ }
785
+ /**
786
+ * Factory interface for creating GraphQL resolvers
787
+ */
788
+ interface ResolverFactory {
789
+ /**
790
+ * Creates a resolver for an object type
791
+ * @template TParent - The parent type
792
+ * @template TFields - The fields of the object type
793
+ * @param parent - The parent type definition
794
+ * @param fields - The fields to resolve
795
+ * @param options - Optional resolver options
796
+ */
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>;
798
+ /**
799
+ * Creates a resolver for operations
800
+ * @template TFields - The operations to resolve
801
+ * @param operations - The operations to resolve
802
+ * @param options - Optional resolver options
803
+ */
804
+ <TFields extends Record<string, Operation>>(operations: TFields, options?: ResolverOptions<ValueOf<TFields>>): ChainResolver<TFields>;
805
+ }
806
+ interface ResolverMeta<TFields extends Record<string, FieldOrOperation | typeof FIELD_HIDDEN>> {
807
+ [IS_RESOLVER]: true;
808
+ fields: TFields;
809
+ options?: ResolverOptionsWithExtensions;
810
+ }
811
+ /**
812
+ * Base class for chain resolvers
813
+ * @template TFields - The fields or operations to resolve
814
+ */
815
+ declare class ChainResolver<TFields extends Record<string, FieldOrOperation | typeof FIELD_HIDDEN>> implements Resolver {
816
+ protected meta: ResolverMeta<TFields>;
817
+ /**
818
+ * Creates a new chain resolver
819
+ * @param fields - The fields or operations to resolve
820
+ * @param options - Optional resolver options
821
+ */
822
+ constructor(fields: TFields, options?: ResolverOptionsWithExtensions<any>);
823
+ /**
824
+ * Gets the metadata for the resolver
825
+ */
826
+ get "~meta"(): ResolverMeta<TFields>;
827
+ /**
828
+ * Adds middleware functions to the resolver
829
+ * @param middlewares - The middleware functions to add
830
+ */
831
+ use(...middlewares: Middleware<OmitInUnion<ValueOf<TFields>, typeof FIELD_HIDDEN>>[]): this;
832
+ toExecutor(...middlewares: Middleware[]): Executor<TFields>;
833
+ protected toExecutorOperation(field: FieldOrOperation | typeof FIELD_HIDDEN, executorMiddlewares: Middleware[]): ((...args: any) => any) | undefined;
834
+ }
835
+ /**
836
+ * Class for resolving object types
837
+ * @template TParent - The parent type
838
+ * @template TFields - The fields to resolve
839
+ */
840
+ declare class ObjectChainResolver<TParent extends GraphQLSilk, TFields extends Record<string, FieldOrOperation | typeof FIELD_HIDDEN>> extends ChainResolver<TFields> {
841
+ protected meta: ResolverMeta<TFields> & {
842
+ parent: TParent;
843
+ };
844
+ /**
845
+ * Creates a new object chain resolver
846
+ * @param parent - The parent type definition
847
+ * @param fields - The fields to resolve
848
+ * @param options - Optional resolver options
849
+ */
850
+ constructor(parent: TParent, fields: TFields, options?: ResolverOptionsWithExtensions<any>);
851
+ /**
852
+ * Gets the metadata for the resolver
853
+ */
854
+ get "~meta"(): ResolverMeta<TFields> & {
855
+ parent: TParent;
856
+ };
857
+ /**
858
+ * Sets custom extensions for the resolver
859
+ * @param extensions - The extensions to add
860
+ */
861
+ extensions(extensions: Pick<GraphQLObjectTypeConfig<any, any>, "extensions">["extensions"]): this;
862
+ }
863
+ /**
864
+ * Type for the executor of a resolver
865
+ * @template TFields - The fields or operations to resolve
866
+ */
867
+ 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
+ //#endregion
869
+ //#region src/utils/middleware.d.ts
870
+ /**
871
+ * The operation of the field:
872
+ * - `field`
873
+ * - `query`
874
+ * - `mutation`
875
+ * - `subscription.resolve`
876
+ * - `subscription.subscribe`
877
+ * - `resolveReference`
878
+ */
879
+ type MiddlewareOperation = "field" | "query" | "mutation" | "subscription.resolve" | "subscription.subscribe" | "resolveReference";
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
910
+ /**
911
+ * Creates an object map with the same keys as `map` and values generated by
912
+ * running each value of `record` thru `fn`.
913
+ */
914
+ declare function mapValue<T, V>(record: Record<string, T>, fn: (value: T, key: string) => V | typeof mapValue.SKIP): Record<string, V>;
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;
921
+ /**
922
+ * Wraps the provided data in an object with a single key `"~meta"`.
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" } }
931
+ */
932
+ declare function meta<T>(data: T): {
933
+ "~meta": T;
934
+ };
935
+ type Maybe<T> = null | undefined | T;
936
+ type ReadOnlyObjMapLike<T> = ReadOnlyObjMap<T> | {
937
+ readonly [key: string]: T;
938
+ };
939
+ interface ReadOnlyObjMap<T> {
940
+ readonly [key: string]: T;
941
+ }
942
+ //#endregion
943
+ //#region src/utils/parse-resolving-fields.d.ts
944
+ /**
945
+ * Represents the state of field resolution in a GraphQL query.
946
+ */
947
+ interface ResolvingFields {
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
+ }
965
+ /**
966
+ * Analyzes and processes field resolution in a GraphQL query deeply.
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
971
+ */
972
+ declare function getDeepResolvingFields(payload: Pick<ResolverPayload, "info">, maxDepth?: number): Map<string, ResolvingFields>;
973
+ /**
974
+ * Analyzes and processes field resolution in a GraphQL query.
975
+ *
976
+ * @param payload - The resolver payload containing the current field resolution context
977
+ * @returns An object containing sets of different field types
978
+ */
979
+ declare function getResolvingFields(payload: Pick<ResolverPayload, "info">): ResolvingFields;
980
+ /**
981
+ * Parses the GraphQL resolve info to extract all requested fields.
982
+ * Returns a Set of field paths where nested fields are represented as 'parent.field'.
983
+ * Supports @include, @skip directives, fragments, and variables.
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
988
+ */
989
+ declare function parseResolvingFields(info: GraphQLResolveInfo, maxDepth?: number): Set<string>;
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;
999
+ /**
1000
+ * mark message with location
1001
+ * @param message origin message
1002
+ * @param locations where error happened
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"
1008
+ */
1009
+ declare function markLocation(message: string, ...locations: string[]): string;
1010
+ //#endregion
1011
+ //#region src/utils/loader.d.ts
1012
+ type BatchLoadFn<TKey, TData> = (keys: TKey[]) => Promise<(TData | Error)[]>;
1013
+ /**
1014
+ * GraphQL Loom built-in data loader.
1015
+ */
1016
+ declare abstract class LoomDataLoader<TKey, TData> {
1017
+ protected abstract batchLoad(keys: TKey[]): Promise<(TData | Error)[]>;
1018
+ protected results: Map<TKey, Promise<TData>>;
1019
+ protected resolvers: Map<TKey, [resolve: (value: TData | PromiseLike<TData>) => void, reject: (reason?: any) => void]>;
1020
+ constructor();
1021
+ /**
1022
+ * Load data for a given key.
1023
+ * @param key - The key to load data for.
1024
+ * @returns A promise that resolves to the loaded data.
1025
+ */
1026
+ load(key: TKey): Promise<TData>;
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>;
1035
+ }
1036
+ declare class EasyDataLoader<TKey, TData> extends LoomDataLoader<TKey, TData> {
1037
+ protected readonly batchLoadFn: BatchLoadFn<TKey, TData>;
1038
+ protected batchLoad(keys: TKey[]): Promise<(TData | Error)[]>;
1039
+ constructor(batchLoadFn: BatchLoadFn<TKey, TData>);
1040
+ }
1041
+ //#endregion
1042
+ //#region src/utils/context.d.ts
1043
+ /**
1044
+ * Empty Resolver Arguments that only store the memoization
1045
+ */
1046
+ interface OnlyMemoizationPayload {
1047
+ memoization: WeakMap<WeakKey, any>;
1048
+ isMemoization: true;
1049
+ }
1050
+ /**
1051
+ * Create an empty memoization payload for the resolver
1052
+ * @returns the empty memoization payload
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>;
1059
+ }
1060
+ declare function assignContextMap(target: ContextMemoryContainer): WeakMap<WeakKey, any>;
1061
+ //#endregion
1062
+ //#region src/schema/schema-weaver.d.ts
1063
+ interface SchemaWeaver {
1064
+ vendor: string;
1065
+ getGraphQLType: (schema: any) => GraphQLOutputType;
1066
+ }
1067
+ declare function isSchemaVendorWeaver(some: any): some is SchemaWeaver;
1068
+ //#endregion
1069
+ //#region src/schema/weaver-context.d.ts
1070
+ interface WeaverContext {
1071
+ id: number;
1072
+ loomObjectMap: Map<GraphQLObjectType, LoomObjectType>;
1073
+ loomUnionMap: Map<GraphQLUnionType, GraphQLUnionType>;
1074
+ inputMap: Map<GraphQLObjectType | GraphQLInterfaceType, GraphQLInputObjectType>;
1075
+ interfaceMap: Map<GraphQLObjectType, GraphQLInterfaceType>;
1076
+ configs: Map<string | symbol, WeaverConfig>;
1077
+ getConfig: <TConfig extends WeaverConfig>(key: TConfig[typeof WEAVER_CONFIG]) => TConfig | undefined;
1078
+ setConfig<TConfig extends WeaverConfig>(config: TConfig): void;
1079
+ deleteConfig: <TConfig extends WeaverConfig>(key: TConfig[typeof WEAVER_CONFIG]) => void;
1080
+ namedTypes: Map<string, GraphQLOutputType>;
1081
+ memoNamedType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(gqlType: TGraphQLType): TGraphQLType;
1082
+ getNamedType<T extends GraphQLOutputType>(name: string): T | undefined;
1083
+ names: WeakMap<object, string>;
1084
+ vendorWeavers: Map<string, SchemaWeaver>;
1085
+ }
1086
+ interface WeaverConfig {
1087
+ [WEAVER_CONFIG]: string | symbol;
1088
+ vendorWeaver?: SchemaWeaver;
1089
+ }
1090
+ declare function initWeaverContext(): WeaverContext;
1091
+ declare namespace initWeaverContext {
1092
+ var increasingID: number;
1093
+ }
1094
+ type GlobalContextRequiredKeys = "names" | "getConfig" | "setConfig" | "deleteConfig" | "getNamedType" | "memoNamedType";
1095
+ interface GlobalWeaverContext extends Partial<Omit<WeaverContext, GlobalContextRequiredKeys>>, Pick<WeaverContext, GlobalContextRequiredKeys> {
1096
+ value?: WeaverContext;
1097
+ useConfig<TConfig extends WeaverConfig, TCallback extends () => any>(config: TConfig, callback: TCallback): ReturnType<TCallback>;
1098
+ GraphQLTypes: WeakMap<object, GraphQLOutputType>;
1099
+ getGraphQLType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(origin: object): TGraphQLType | undefined;
1100
+ memoGraphQLType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(origin: object, gqlType: TGraphQLType): TGraphQLType;
1101
+ }
1102
+ declare const weaverContext: GlobalWeaverContext;
1103
+ declare function provideWeaverContext<T>(func: () => T, value: WeaverContext | undefined): T;
1104
+ declare namespace provideWeaverContext {
1105
+ var inherit: <T>(func: () => T) => () => T;
1106
+ }
1107
+ /**
1108
+ * collect names for schemas
1109
+ * @param namesList - names to collect
1110
+ * @returns namesRecord
1111
+ */
1112
+ declare function collectNames<TRecords extends Record<string, object>[]>(...namesList: TRecords): UnionToIntersection<TRecords[number]>;
1113
+ /**
1114
+ * collect name for schema
1115
+ * @param name - name for
1116
+ * @param schema - schema to be named
1117
+ * @returns schema
1118
+ */
1119
+ declare function collectName<TSchema extends object>(name: string, schema: TSchema): TSchema;
1120
+ type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never;
1121
+ //#endregion
1122
+ //#region src/schema/object.d.ts
1123
+ declare class LoomObjectType extends GraphQLObjectType {
1124
+ protected extraFields: Map<string, BaseField>;
1125
+ protected hiddenFields: Set<string>;
1126
+ static AUTO_ALIASING: "__gqloom_auto_aliasing";
1127
+ protected weaverContext: WeaverContext;
1128
+ protected globalOptions?: ResolverOptions;
1129
+ /**
1130
+ * field name -> resolver
1131
+ */
1132
+ protected resolvers: Map<string, Resolver>;
1133
+ constructor(objectOrGetter: string | GraphQLObjectType | GraphQLObjectTypeConfig<any, any> | (() => GraphQLObjectType | GraphQLObjectTypeConfig<any, any>), options?: {
1134
+ weaverContext?: WeaverContext;
1135
+ globalOptions?: ResolverOptions;
1136
+ });
1137
+ protected hasExplicitName?: boolean;
1138
+ protected _aliases: string[];
1139
+ get aliases(): string[];
1140
+ addAlias(name: string): void;
1141
+ protected renameByAliases(): void;
1142
+ hideField(name: string): void;
1143
+ addField(name: string, field: BaseField, resolver: Resolver | undefined): void;
1144
+ mergeExtensions(extensions: GraphQLObjectTypeConfig<any, any>["extensions"]): void;
1145
+ private extraFieldMap?;
1146
+ getFields(): GraphQLFieldMap<any, any>;
1147
+ protected mapToFieldConfig(map: Map<string, BaseField>): Record<string, GraphQLFieldConfig<any, any>>;
1148
+ toFieldConfig(field: BaseField, fieldName: string): GraphQLFieldConfig<any, any>;
1149
+ protected provideForResolve(field: BaseField, fieldName: string): GraphQLFieldConfig<any, any>["resolve"];
1150
+ protected provideForSubscribe(field: BaseField | Subscription<any, any, any>, fieldName: string): GraphQLFieldConfig<any, any>["subscribe"] | undefined;
1151
+ protected getCacheType(gqlType: GraphQLOutputType, fieldName?: string): GraphQLOutputType;
1152
+ get options(): {
1153
+ resolverOptions: ResolverOptions<FieldOrOperation> | undefined;
1154
+ weaverContext: WeaverContext;
1155
+ };
1156
+ }
1157
+ declare const OPERATION_OBJECT_NAMES: Set<string>;
1158
+ declare function getCacheType(gqlType: GraphQLOutputType, options?: {
1159
+ weaverContext?: WeaverContext;
1160
+ resolverOptions?: ResolverOptions;
1161
+ fieldName?: string;
1162
+ parent?: LoomObjectType;
1163
+ }): GraphQLOutputType;
1164
+ //#endregion
1165
+ //#region src/schema/types.d.ts
1166
+ interface CoreSchemaWeaverConfigOptions extends GraphQLSchemaConfig {
1167
+ getInputObjectName?: (name: string) => string;
1168
+ weaverContext?: WeaverContext;
1169
+ }
1170
+ interface CoreSchemaWeaverConfig extends WeaverConfig, CoreSchemaWeaverConfigOptions {
1171
+ [WEAVER_CONFIG]: "gqloom.core.schema";
1172
+ }
1173
+ //#endregion
1174
+ //#region src/schema/schema-loom.d.ts
1175
+ interface SchemaWeaverParameters extends Partial<Record<"query" | "mutation" | "subscription", LoomObjectType>>, Pick<GraphQLSchemaConfig, "types"> {}
1176
+ declare class GraphQLSchemaLoom {
1177
+ query?: LoomObjectType;
1178
+ mutation?: LoomObjectType;
1179
+ subscription?: LoomObjectType;
1180
+ types: Set<GraphQLNamedType>;
1181
+ context: WeaverContext;
1182
+ resolverOptions?: ResolverOptions;
1183
+ /**
1184
+ * Create a Schema Weaver config object
1185
+ * @param config Schema Weaver config options
1186
+ * @returns a Schema Weaver config object
1187
+ */
1188
+ static config(config: CoreSchemaWeaverConfigOptions): CoreSchemaWeaverConfig;
1189
+ constructor({
1190
+ query,
1191
+ mutation,
1192
+ subscription,
1193
+ types
1194
+ }?: SchemaWeaverParameters, context?: WeaverContext);
1195
+ use(...middlewares: Middleware[]): this;
1196
+ add(resolver: Resolver, modifyParent?: (parent: LoomObjectType) => LoomObjectType): this;
1197
+ addVendor(weaver: SchemaWeaver): this;
1198
+ addType(silk: GraphQLSilk): this;
1199
+ setConfig<TConfig extends WeaverConfig>(config: TConfig): this;
1200
+ weaveGraphQLSchema(): GraphQLSchema;
1201
+ protected addResolver(resolver: Resolver, modifyParent?: (parent: LoomObjectType) => LoomObjectType): this;
1202
+ protected getOperationObject(type: "query" | "mutation" | "subscription"): LoomObjectType;
1203
+ protected get fieldOptions(): ConstructorParameters<typeof LoomObjectType>[1];
1204
+ static optionsFrom(...inputs: (Resolver | Middleware | SchemaWeaver | WeaverConfig | GraphQLSilk)[]): {
1205
+ context: WeaverContext | undefined;
1206
+ configs: Set<WeaverConfig>;
1207
+ middlewares: Set<Middleware<any>>;
1208
+ resolvers: Set<Resolver>;
1209
+ silks: Set<GraphQLSilk<any, any>>;
1210
+ weavers: Set<SchemaWeaver>;
1211
+ };
1212
+ /**
1213
+ * Weave a GraphQL Schema from resolvers
1214
+ * @param inputs Resolvers, Global Middlewares, WeaverConfigs Or SchemaWeaver
1215
+ * @returns GraphQL Schema
1216
+ */
1217
+ static weave(...inputs: (Resolver | Middleware | SchemaWeaver | WeaverConfig | GraphQLSilk)[]): GraphQLSchema;
1218
+ }
1219
+ /**
1220
+ * Weave a GraphQL Schema from resolvers
1221
+ * @param inputs Resolvers, Global Middlewares or WeaverConfigs
1222
+ * @returns GraphQL Schema
1223
+ */
1224
+ declare const weave: typeof GraphQLSchemaLoom.weave;
1225
+ //#endregion
1226
+ //#region src/schema/input.d.ts
1227
+ interface EnsureInputOptions {
1228
+ fieldName?: string;
1229
+ }
1230
+ declare function inputToArgs(input: GraphQLSilk | Record<string, GraphQLSilk> | undefined | void, options: EnsureInputOptions | undefined): GraphQLFieldConfigArgumentMap | undefined;
1231
+ declare function ensureInputType(silkOrType: GraphQLType | GraphQLSilk, options: EnsureInputOptions | undefined): GraphQLInputType;
1232
+ declare function ensureInputObjectType(object: GraphQLObjectType | GraphQLInterfaceType | GraphQLInputObjectType, options: EnsureInputOptions | undefined): GraphQLInputObjectType;
1233
+ //#endregion
1234
+ //#region src/schema/interface.d.ts
1235
+ declare function ensureInterfaceType(gqlType: GraphQLOutputType, interfaceConfig?: Partial<GraphQLInterfaceTypeConfig<any, any>>): GraphQLInterfaceType;
1236
+ //#endregion
1237
+ //#region src/schema/extensions.d.ts
1238
+ interface GQLoomExtensions {
1239
+ defaultValue?: any;
1240
+ gqloom?: GQLoomExtensionAttribute;
1241
+ directives?: DirectiveItem[] | DirectiveRecord;
1242
+ }
1243
+ interface DirectiveItem {
1244
+ name: string;
1245
+ args?: Record<string, any>;
1246
+ }
1247
+ type DirectiveRecord = Record<string, Record<string, any>>;
1248
+ interface GQLoomExtensionAttribute {
1249
+ directives?: string[];
1250
+ }
1251
+ //#endregion
1252
+ export { BaseChainFactory, BaseField, BatchLoadFn, CallableInputParser, CallableMiddlewareOptions, ChainFactoryOptions, ChainResolver, CoreSchemaWeaverConfig, CoreSchemaWeaverConfigOptions, 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 };