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