@gqloom/core 0.6.0 → 0.7.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.
- package/LICENSE.md +9 -0
- package/README.md +17 -13
- package/dist/index.cjs +287 -12
- package/dist/index.d.cts +113 -10
- package/dist/index.d.ts +113 -10
- package/dist/index.js +281 -12
- package/package.json +9 -7
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import * as graphql from 'graphql';
|
|
1
2
|
import { GraphQLOutputType, GraphQLObjectTypeConfig, GraphQLFieldConfig, GraphQLResolveInfo, GraphQLScalarType, GraphQLObjectType, GraphQLUnionType, GraphQLInterfaceType, GraphQLInputObjectType, GraphQLSchemaConfig, GraphQLFieldMap, GraphQLNamedType, GraphQLSchema, GraphQLFieldConfigArgumentMap, GraphQLType, GraphQLInputType, GraphQLInterfaceTypeConfig } from 'graphql';
|
|
3
|
+
import * as graphql_jsutils_Maybe from 'graphql/jsutils/Maybe';
|
|
2
4
|
import { AsyncLocalStorage } from 'async_hooks';
|
|
3
5
|
|
|
4
6
|
/**
|
|
@@ -181,7 +183,7 @@ interface CallableInputParser<TSchema extends InputSchema<GraphQLSilk>> {
|
|
|
181
183
|
*/
|
|
182
184
|
value: InferInputI<TSchema, GraphQLSilkIO>;
|
|
183
185
|
/**
|
|
184
|
-
* Parse the input and return the
|
|
186
|
+
* Parse the input and return the result
|
|
185
187
|
*/
|
|
186
188
|
(): Promise<StandardSchemaV1.Result<InferInputO<TSchema, GraphQLSilkIO>>>;
|
|
187
189
|
/**
|
|
@@ -195,6 +197,70 @@ declare function getStandardValue<T>(result: StandardSchemaV1.Result<T>): T;
|
|
|
195
197
|
declare function getStandardValue<T>(result?: StandardSchemaV1.Result<T>): T | undefined;
|
|
196
198
|
declare function getStandardValue<T>(result: StandardSchemaV1.Result<T> | null): T | null;
|
|
197
199
|
|
|
200
|
+
interface IChainFactory<TSchemaIO extends AbstractSchemaIO, TOutput extends TSchemaIO[0], TInput extends InputSchema<TSchemaIO[0]> = undefined> {
|
|
201
|
+
description(description: GraphQLFieldOptions["description"]): this;
|
|
202
|
+
deprecationReason(deprecationReason: GraphQLFieldOptions["deprecationReason"]): this;
|
|
203
|
+
extensions(extensions: GraphQLFieldOptions["extensions"]): this;
|
|
204
|
+
output<TOutputNew extends TSchemaIO[0]>(output: TOutputNew): IChainFactory<TSchemaIO, TOutputNew, TInput>;
|
|
205
|
+
input<TInputNew extends InputSchema<TSchemaIO[0]>>(input: TInputNew): IChainFactory<TSchemaIO, TOutput, TInputNew>;
|
|
206
|
+
}
|
|
207
|
+
declare abstract class BaseChainFactory {
|
|
208
|
+
protected readonly options?: Partial<FieldOrOperation<any, any, any, any> & {
|
|
209
|
+
middlewares: Middleware[];
|
|
210
|
+
}> | undefined;
|
|
211
|
+
static methods(): {
|
|
212
|
+
description: (description: graphql_jsutils_Maybe.Maybe<string>) => BaseChainFactory;
|
|
213
|
+
deprecationReason: (deprecationReason: graphql_jsutils_Maybe.Maybe<string>) => BaseChainFactory;
|
|
214
|
+
extensions: (extensions: graphql_jsutils_Maybe.Maybe<Readonly<graphql.GraphQLFieldExtensions<any, any, any>>>) => BaseChainFactory;
|
|
215
|
+
};
|
|
216
|
+
constructor(options?: Partial<FieldOrOperation<any, any, any, any> & {
|
|
217
|
+
middlewares: Middleware[];
|
|
218
|
+
}> | undefined);
|
|
219
|
+
protected abstract clone(options?: Partial<FieldOrOperation<any, any, any, any> & {
|
|
220
|
+
middlewares: Middleware[];
|
|
221
|
+
}>): this;
|
|
222
|
+
description(description: GraphQLFieldOptions["description"]): this;
|
|
223
|
+
deprecationReason(deprecationReason: GraphQLFieldOptions["deprecationReason"]): this;
|
|
224
|
+
extensions(extensions: GraphQLFieldOptions["extensions"]): this;
|
|
225
|
+
use(...middlewares: Middleware[]): this;
|
|
226
|
+
}
|
|
227
|
+
declare class FieldChainFactory<TSchemaIO extends AbstractSchemaIO, TOutput extends TSchemaIO[0] = never, TInput extends InputSchema<TSchemaIO[0]> = undefined> extends BaseChainFactory implements IChainFactory<TSchemaIO, TOutput, TInput> {
|
|
228
|
+
static methods(): FieldChainFactory<any, never, undefined>;
|
|
229
|
+
protected clone(options?: Partial<FieldOrOperation<any, any, any, any>>): this;
|
|
230
|
+
use(...middlewares: Middleware<FieldOrOperation<any, SchemaToSilk<TSchemaIO, TOutput>, InputSchemaToSilk<TSchemaIO, TInput>, "field">>[]): this;
|
|
231
|
+
output<TOutputNew extends TSchemaIO[0]>(output: TOutputNew): FieldChainFactory<TSchemaIO, TOutputNew, TInput>;
|
|
232
|
+
input<TInputNew extends InputSchema<TSchemaIO[0]>>(input: TInputNew): FieldChainFactory<TSchemaIO, TOutput, TInputNew>;
|
|
233
|
+
resolve<TParent extends TSchemaIO[0]>(resolve: (parent: InferSchemaO<TParent, TSchemaIO>, input: InferInputO<TInput, TSchemaIO>) => MayPromise<InferSchemaO<TOutput, TSchemaIO>>): FieldOrOperation<SchemaToSilk<TSchemaIO, TParent>, SchemaToSilk<TSchemaIO, TOutput>, InputSchemaToSilk<TSchemaIO, TInput>, "field">;
|
|
234
|
+
}
|
|
235
|
+
declare class QueryChainFactory<TSchemaIO extends AbstractSchemaIO, TOutput extends TSchemaIO[0] = never, TInput extends InputSchema<TSchemaIO[0]> = undefined> extends BaseChainFactory implements IChainFactory<TSchemaIO, TOutput, TInput> {
|
|
236
|
+
static methods(): QueryChainFactory<any, never, undefined>;
|
|
237
|
+
protected clone(options?: Partial<FieldOrOperation<any, any, any, any>>): this;
|
|
238
|
+
use(...middlewares: Middleware<FieldOrOperation<any, SchemaToSilk<TSchemaIO, TOutput>, InputSchemaToSilk<TSchemaIO, TInput>, "query">>[]): this;
|
|
239
|
+
output<TOutputNew extends TSchemaIO[0]>(output: TOutputNew): QueryChainFactory<TSchemaIO, TOutputNew, TInput>;
|
|
240
|
+
input<TInputNew extends InputSchema<TSchemaIO[0]>>(input: TInputNew): QueryChainFactory<TSchemaIO, TOutput, TInputNew>;
|
|
241
|
+
resolve(resolve: (input: InferInputO<TInput, TSchemaIO>) => MayPromise<InferSchemaO<TOutput, TSchemaIO>>): FieldOrOperation<any, SchemaToSilk<TSchemaIO, TOutput>, InputSchemaToSilk<TSchemaIO, TInput>, "query">;
|
|
242
|
+
}
|
|
243
|
+
declare class MutationChainFactory<TSchemaIO extends AbstractSchemaIO, TOutput extends TSchemaIO[0] = never, TInput extends InputSchema<TSchemaIO[0]> = undefined> extends BaseChainFactory implements IChainFactory<TSchemaIO, TOutput, TInput> {
|
|
244
|
+
static methods(): MutationChainFactory<any, never, undefined>;
|
|
245
|
+
protected clone(options?: Partial<FieldOrOperation<any, any, any, any>>): this;
|
|
246
|
+
use(...middlewares: Middleware<FieldOrOperation<any, SchemaToSilk<TSchemaIO, TOutput>, InputSchemaToSilk<TSchemaIO, TInput>, "mutation">>[]): this;
|
|
247
|
+
output<TOutputNew extends TSchemaIO[0]>(output: TOutputNew): MutationChainFactory<TSchemaIO, TOutputNew, TInput>;
|
|
248
|
+
input<TInputNew extends InputSchema<TSchemaIO[0]>>(input: TInputNew): MutationChainFactory<TSchemaIO, TOutput, TInputNew>;
|
|
249
|
+
resolve(resolve: (input: InferInputO<TInput, TSchemaIO>) => MayPromise<InferSchemaO<TOutput, TSchemaIO>>): FieldOrOperation<any, SchemaToSilk<TSchemaIO, TOutput>, InputSchemaToSilk<TSchemaIO, TInput>, "mutation">;
|
|
250
|
+
}
|
|
251
|
+
declare class SubscriptionChainFactory<TSchemaIO extends AbstractSchemaIO, TOutput extends TSchemaIO[0] = never, TInput extends InputSchema<TSchemaIO[0]> = undefined> extends BaseChainFactory implements IChainFactory<TSchemaIO, TOutput, TInput> {
|
|
252
|
+
static methods(): SubscriptionChainFactory<any, never, undefined>;
|
|
253
|
+
protected clone(options?: Partial<FieldOrOperation<any, any, any, any>>): this;
|
|
254
|
+
use(...middlewares: Middleware<FieldOrOperation<any, SchemaToSilk<TSchemaIO, TOutput>, InputSchemaToSilk<TSchemaIO, TInput>, "subscription">>[]): this;
|
|
255
|
+
output<TOutputNew extends TSchemaIO[0]>(output: TOutputNew): SubscriptionChainFactory<TSchemaIO, TOutputNew, TInput>;
|
|
256
|
+
input<TInputNew extends InputSchema<TSchemaIO[0]>>(input: TInputNew): SubscriptionChainFactory<TSchemaIO, TOutput, TInputNew>;
|
|
257
|
+
subscribe<TValue = InferSchemaO<TOutput, TSchemaIO>>(subscribe: (input: InferInputO<TInput, TSchemaIO>) => MayPromise<AsyncIterator<TValue>>): ResolvableSubscription<TSchemaIO, TOutput, TInput, TValue>;
|
|
258
|
+
}
|
|
259
|
+
interface ResolvableSubscription<TSchemaIO extends AbstractSchemaIO, TOutput extends TSchemaIO[0], TInput extends InputSchema<TSchemaIO[0]> = undefined, TValue = InferSchemaO<TOutput, TSchemaIO>> extends Subscription<SchemaToSilk<TSchemaIO, TOutput>, InputSchemaToSilk<TSchemaIO, TInput>, TValue> {
|
|
260
|
+
resolve(resolve: (value: TValue, input: InferInputO<TInput, TSchemaIO>) => MayPromise<InferSchemaO<TOutput, TSchemaIO>>): Subscription<SchemaToSilk<TSchemaIO, TOutput>, InputSchemaToSilk<TSchemaIO, TInput>, TValue>;
|
|
261
|
+
resolve(value: TValue, input: any): MayPromise<any>;
|
|
262
|
+
}
|
|
263
|
+
|
|
198
264
|
interface GraphQLSilk<TOutput = any, TInput = any> extends StandardSchemaV1<TInput, TOutput> {
|
|
199
265
|
/**
|
|
200
266
|
* GraphQL type for schema
|
|
@@ -254,12 +320,21 @@ interface QueryMutationOptions<TSchemaIO extends AbstractSchemaIO, TOutput exten
|
|
|
254
320
|
*/
|
|
255
321
|
interface QueryFactory<TSchemaIO extends AbstractSchemaIO> {
|
|
256
322
|
<TOutput extends TSchemaIO[0], TInput extends InputSchema<TSchemaIO[0]> = undefined>(output: TOutput, resolveOrOptions: (() => MayPromise<InferSchemaO<TOutput, TSchemaIO>>) | QueryMutationOptions<TSchemaIO, TOutput, TInput>): FieldOrOperation<undefined, SchemaToSilk<TSchemaIO, TOutput>, InputSchemaToSilk<TSchemaIO, TInput>, "query">;
|
|
323
|
+
<TOutput extends TSchemaIO[0]>(output: TOutput): QueryChainFactory<TSchemaIO, TOutput, undefined>;
|
|
324
|
+
}
|
|
325
|
+
interface QueryFactoryWithChain<TSchemaIO extends AbstractSchemaIO> extends QueryFactory<TSchemaIO>, QueryChainFactory<TSchemaIO, never, undefined> {
|
|
257
326
|
}
|
|
258
327
|
/**
|
|
259
328
|
* Function to create a GraphQL mutation.
|
|
260
329
|
*/
|
|
261
330
|
interface MutationFactory<TSchemaIO extends AbstractSchemaIO> {
|
|
262
331
|
<TOutput extends TSchemaIO[0], TInput extends InputSchema<TSchemaIO[0]> = undefined>(output: TOutput, resolveOrOptions: (() => MayPromise<InferSchemaO<TOutput, TSchemaIO>>) | QueryMutationOptions<TSchemaIO, TOutput, TInput>): FieldOrOperation<undefined, SchemaToSilk<TSchemaIO, TOutput>, InputSchemaToSilk<TSchemaIO, TInput>, "mutation">;
|
|
332
|
+
<TOutput extends TSchemaIO[0]>(output: TOutput): MutationChainFactory<TSchemaIO, TOutput, undefined>;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Function to create a GraphQL mutation.
|
|
336
|
+
*/
|
|
337
|
+
interface MutationFactoryWithChain<TSchemaIO extends AbstractSchemaIO> extends MutationFactory<TSchemaIO>, MutationChainFactory<TSchemaIO, never, undefined> {
|
|
263
338
|
}
|
|
264
339
|
/**
|
|
265
340
|
* Options for External Filed of existing GraphQL Object.
|
|
@@ -273,8 +348,9 @@ interface FieldOptions<TSchemaIO extends AbstractSchemaIO, TParent extends TSche
|
|
|
273
348
|
*/
|
|
274
349
|
interface FieldFactory<TSchemaIO extends AbstractSchemaIO> {
|
|
275
350
|
<TParent extends TSchemaIO[0], TOutput extends TSchemaIO[0], TInput extends InputSchema<TSchemaIO[0]> = undefined>(output: TOutput, resolveOrOptions: ((parent: InferSchemaO<TParent, TSchemaIO>) => MayPromise<InferSchemaO<TOutput, TSchemaIO>>) | FieldOptions<TSchemaIO, TParent, TOutput, TInput>): FieldOrOperation<SchemaToSilk<TSchemaIO, TParent>, SchemaToSilk<TSchemaIO, TOutput>, InputSchemaToSilk<TSchemaIO, TInput>, "field">;
|
|
351
|
+
<TOutput extends TSchemaIO[0]>(output: TOutput): FieldChainFactory<TSchemaIO, TOutput, undefined>;
|
|
276
352
|
}
|
|
277
|
-
interface FieldFactoryWithUtils<TSchemaIO extends AbstractSchemaIO> extends FieldFactory<TSchemaIO> {
|
|
353
|
+
interface FieldFactoryWithUtils<TSchemaIO extends AbstractSchemaIO> extends FieldFactory<TSchemaIO>, FieldChainFactory<TSchemaIO, never, undefined> {
|
|
278
354
|
/** Set fields to be hidden in GraphQL Schema */
|
|
279
355
|
hidden: typeof FIELD_HIDDEN;
|
|
280
356
|
}
|
|
@@ -295,6 +371,9 @@ interface Subscription<TOutput extends GraphQLSilk, TInput extends InputSchema<G
|
|
|
295
371
|
*/
|
|
296
372
|
interface SubscriptionFactory<TSchemaIO extends AbstractSchemaIO> {
|
|
297
373
|
<TOutput extends TSchemaIO[0], TInput extends InputSchema<TSchemaIO[0]> = undefined, TValue = InferSchemaO<TOutput, TSchemaIO>>(output: TOutput, subscribeOrOptions: (() => MayPromise<AsyncIterator<InferSchemaO<TOutput, TSchemaIO>>>) | SubscriptionOptions<TSchemaIO, TOutput, TInput, TValue>): Subscription<SchemaToSilk<TSchemaIO, TOutput>, InputSchemaToSilk<TSchemaIO, TInput>, TValue>;
|
|
374
|
+
<TOutput extends TSchemaIO[0]>(output: TOutput): SubscriptionChainFactory<TSchemaIO, TOutput, undefined>;
|
|
375
|
+
}
|
|
376
|
+
interface SubscriptionFactoryWithChain<TSchemaIO extends AbstractSchemaIO> extends SubscriptionFactory<TSchemaIO>, SubscriptionChainFactory<TSchemaIO, never, undefined> {
|
|
298
377
|
}
|
|
299
378
|
interface ResolverFactory<TSchemaIO extends AbstractSchemaIO> {
|
|
300
379
|
of<TParent extends TSchemaIO[0], TOperations extends Record<string, FieldOrOperation<SchemaToSilk<TSchemaIO, TParent>, any, any> | FieldOrOperation<undefined, any, any, OperationType> | typeof FIELD_HIDDEN>>(parent: TParent, operationOrFields: TOperations, options?: ResolverOptionsWithExtensions<OmitInUnion<ValueOf<TOperations>, typeof FIELD_HIDDEN>>): TOperations;
|
|
@@ -451,6 +530,7 @@ interface ReadOnlyObjMap<T> {
|
|
|
451
530
|
}
|
|
452
531
|
|
|
453
532
|
declare function pascalCase(str: string): string;
|
|
533
|
+
declare function capitalize<T extends string>(str: T): Capitalize<T>;
|
|
454
534
|
|
|
455
535
|
declare function markErrorLocation<TError>(error: TError, ...locations: string[]): TError;
|
|
456
536
|
declare function tryIn<T>(func: () => T, ...locations: string[]): T;
|
|
@@ -466,6 +546,25 @@ declare function tryIn<T>(func: () => T, ...locations: string[]): T;
|
|
|
466
546
|
*/
|
|
467
547
|
declare function markLocation(message: string, ...locations: string[]): string;
|
|
468
548
|
|
|
549
|
+
type BatchLoadFn<TKey, TData> = (keys: TKey[]) => Promise<(TData | Error)[]>;
|
|
550
|
+
declare class EasyDataLoader<TKey, TData> {
|
|
551
|
+
protected readonly batchLoadFn: BatchLoadFn<TKey, TData>;
|
|
552
|
+
protected queue: TKey[];
|
|
553
|
+
protected cache: Map<TKey, Promise<TData>>;
|
|
554
|
+
protected resolvers: Map<TKey, [
|
|
555
|
+
resolve: (value: TData | PromiseLike<TData>) => void,
|
|
556
|
+
reject: (reason?: any) => void
|
|
557
|
+
]>;
|
|
558
|
+
constructor(batchLoadFn: BatchLoadFn<TKey, TData>);
|
|
559
|
+
load(key: TKey): Promise<TData>;
|
|
560
|
+
clear(): void;
|
|
561
|
+
clearByKey(key: TKey): void;
|
|
562
|
+
protected executeBatchLoad(): Promise<void>;
|
|
563
|
+
protected nextTickPromise?: Promise<void>;
|
|
564
|
+
protected nextTickBatchLoad(): Promise<void>;
|
|
565
|
+
static nextTick(): Promise<void>;
|
|
566
|
+
}
|
|
567
|
+
|
|
469
568
|
/**
|
|
470
569
|
* Create a Silk from Scalar.
|
|
471
570
|
*/
|
|
@@ -514,20 +613,24 @@ type InferScalarInternal<T extends GraphQLScalarType> = T extends GraphQLScalarT
|
|
|
514
613
|
type InferScalarExternal<T extends GraphQLScalarType> = T extends GraphQLScalarType<any, infer TExternal> ? TExternal : never;
|
|
515
614
|
type EnsureArray<T> = T extends Array<infer U> ? U[] : T[];
|
|
516
615
|
|
|
517
|
-
declare const
|
|
518
|
-
declare const
|
|
616
|
+
declare const createQuery: (output: GraphQLSilk<any, any>, resolveOrOptions?: (() => MayPromise<unknown>) | QueryMutationOptions<GraphQLSilkIO, any, any>) => QueryChainFactory<AbstractSchemaIO, never, undefined> | FieldOrOperation<any, any, any, "query">;
|
|
617
|
+
declare const query: QueryFactoryWithChain<GraphQLSilkIO>;
|
|
618
|
+
declare const createMutation: (output: GraphQLSilk<any, any>, resolveOrOptions?: (() => MayPromise<unknown>) | QueryMutationOptions<GraphQLSilkIO, any, any>) => MutationChainFactory<AbstractSchemaIO, never, undefined> | FieldOrOperation<any, any, any, "mutation">;
|
|
619
|
+
declare const mutation: MutationFactoryWithChain<GraphQLSilkIO>;
|
|
620
|
+
declare const createField: (output: GraphQLSilk<any, any>, resolveOrOptions?: FieldOptions<GraphQLSilkIO, any, any, any> | ((parent: unknown) => unknown) | undefined) => FieldChainFactory<AbstractSchemaIO, never, undefined> | FieldOrOperation<any, any, any, "field">;
|
|
519
621
|
declare const field: FieldFactoryWithUtils<GraphQLSilkIO>;
|
|
520
622
|
declare const defaultSubscriptionResolve: (source: any) => any;
|
|
521
|
-
declare const
|
|
623
|
+
declare const createSubscription: (output: GraphQLSilk<any, any>, subscribeOrOptions?: (() => MayPromise<AsyncIterator<unknown>>) | SubscriptionOptions<GraphQLSilkIO, any, any, any>) => Subscription<any, any, any> | SubscriptionChainFactory<AbstractSchemaIO, never, undefined>;
|
|
624
|
+
declare const subscription: SubscriptionFactoryWithChain<GraphQLSilkIO>;
|
|
522
625
|
declare const ResolverOptionsMap: WeakMap<object, ResolverOptionsWithParent<GenericFieldOrOperation>>;
|
|
523
626
|
declare function baseResolver(operations: Record<string, FieldOrOperation<any, any, any>>, options: ResolverOptionsWithParent | undefined): Record<string, FieldOrOperation<any, any, any, FieldOrOperationType>>;
|
|
524
627
|
declare const resolver: ResolverFactory<GraphQLSilkIO>;
|
|
525
628
|
declare const loom: {
|
|
526
|
-
query:
|
|
629
|
+
query: QueryFactoryWithChain<GraphQLSilkIO>;
|
|
527
630
|
resolver: ResolverFactory<GraphQLSilkIO>;
|
|
528
631
|
field: FieldFactoryWithUtils<GraphQLSilkIO>;
|
|
529
|
-
subscription:
|
|
530
|
-
mutation:
|
|
632
|
+
subscription: SubscriptionFactoryWithChain<GraphQLSilkIO>;
|
|
633
|
+
mutation: MutationFactoryWithChain<GraphQLSilkIO>;
|
|
531
634
|
};
|
|
532
635
|
|
|
533
636
|
declare function createResolverFactory<TSchemaIO extends AbstractSchemaIO>(toSilk: (schema: TSchemaIO[0]) => GraphQLSilk): ResolverFactory<TSchemaIO>;
|
|
@@ -698,7 +801,7 @@ declare class GraphQLSchemaLoom {
|
|
|
698
801
|
/**
|
|
699
802
|
* Weave a GraphQL Schema from resolvers
|
|
700
803
|
* @param inputs Resolvers, Global Middlewares or WeaverConfigs
|
|
701
|
-
* @returns
|
|
804
|
+
* @returns GraphQL Schema
|
|
702
805
|
*/
|
|
703
806
|
declare const weave: typeof GraphQLSchemaLoom.weave;
|
|
704
807
|
|
|
@@ -725,4 +828,4 @@ interface GQLoomExtensionAttribute {
|
|
|
725
828
|
directives?: string[];
|
|
726
829
|
}
|
|
727
830
|
|
|
728
|
-
export { type AbstractSchemaIO, type CallableContextMemoization, type CallableInputParser, type CallableMiddlewareOptions, ContextMemoization, type CoreSchemaWeaverConfig, type CoreSchemaWeaverConfigOptions, type DirectiveItem, type DirectiveRecord, type FieldConvertOptions, type FieldFactory, type FieldFactoryWithUtils, type FieldOptions, type FieldOrOperation, type FieldOrOperationType, type GQLoomExtensionAttribute, type GQLoomExtensions, type GenericFieldOrOperation, type GlobalWeaverContext, type GraphQLFieldOptions, GraphQLSchemaLoom, type GraphQLSilk, type GraphQLSilkIO, type InferFieldInput, type InferFieldOutput, type InferFieldParent, type InferInputI, type InferInputO, type InferPropertyType, type InferSchemaI, type InferSchemaO, type InputSchema, type InputSchemaToSilk, type IsAny, type ListSilk, LoomObjectType, type MayPromise, type Middleware, type MiddlewareOptions, type MutationFactory, type NonNullSilk, type NullableSilk, OPERATION_OBJECT_NAMES, type ObjectOrNever, type OnlyMemoizationPayload, type OperationType, type QueryFactory, type QueryMutationOptions, type ResolverFactory, type ResolverOptions, ResolverOptionsMap, type ResolverOptionsWithExtensions, type ResolverOptionsWithParent, type ResolverPayload, type ResolvingOptions, symbols as SYMBOLS, type SchemaToSilk, type SchemaWeaver, type SilkFieldOrOperation, type SilkResolver, StandardSchemaV1, type Subscription, type SubscriptionFactory, type SubscriptionOptions, type ValueOf, type WeaverConfig, type WeaverContext, type WrapPropertyType, applyMiddlewares, baseResolver, collectName, collectNames, compose, createFieldFactory, createInputParser, createLoom, createMemoization, createMutationFactory, createQueryFactory, createResolverFactory, createSubscriptionFactory, deepMerge, defaultSubscriptionResolve, ensureInputObjectType, ensureInputType, ensureInterfaceType, field, getCacheType, getFieldOptions, getGraphQLType, getOperationOptions, getStandardValue, getSubscriptionOptions, initWeaverContext, inputToArgs, isOnlyMemoryPayload, isSchemaVendorWeaver, isSilk, listSilk, loom, mapValue, markErrorLocation, markLocation, mutation, nonNullSilk, notNullish, nullableSilk, onlyMemoization, parseInputValue, parseSilk, pascalCase, provideWeaverContext, query, resolver, resolverPayloadStorage, silk, subscription, toObjMap, tryIn, useContext, useMemoizationMap, useResolverPayload, weave, weaverContext };
|
|
831
|
+
export { type AbstractSchemaIO, type BatchLoadFn, type CallableContextMemoization, type CallableInputParser, type CallableMiddlewareOptions, ContextMemoization, type CoreSchemaWeaverConfig, type CoreSchemaWeaverConfigOptions, type DirectiveItem, type DirectiveRecord, EasyDataLoader, type FieldConvertOptions, type FieldFactory, type FieldFactoryWithUtils, type FieldOptions, type FieldOrOperation, type FieldOrOperationType, type GQLoomExtensionAttribute, type GQLoomExtensions, type GenericFieldOrOperation, type GlobalWeaverContext, type GraphQLFieldOptions, GraphQLSchemaLoom, type GraphQLSilk, type GraphQLSilkIO, type InferFieldInput, type InferFieldOutput, type InferFieldParent, type InferInputI, type InferInputO, type InferPropertyType, type InferSchemaI, type InferSchemaO, type InputSchema, type InputSchemaToSilk, type IsAny, type ListSilk, LoomObjectType, type MayPromise, type Middleware, type MiddlewareOptions, type MutationFactory, type MutationFactoryWithChain, type NonNullSilk, type NullableSilk, OPERATION_OBJECT_NAMES, type ObjectOrNever, type OnlyMemoizationPayload, type OperationType, type QueryFactory, type QueryFactoryWithChain, type QueryMutationOptions, type ResolverFactory, type ResolverOptions, ResolverOptionsMap, type ResolverOptionsWithExtensions, type ResolverOptionsWithParent, type ResolverPayload, type ResolvingOptions, symbols as SYMBOLS, type SchemaToSilk, type SchemaWeaver, type SilkFieldOrOperation, type SilkResolver, StandardSchemaV1, type Subscription, type SubscriptionFactory, type SubscriptionFactoryWithChain, type SubscriptionOptions, type ValueOf, type WeaverConfig, type WeaverContext, type WrapPropertyType, applyMiddlewares, baseResolver, capitalize, collectName, collectNames, compose, createField, createFieldFactory, createInputParser, createLoom, createMemoization, createMutation, createMutationFactory, createQuery, createQueryFactory, createResolverFactory, createSubscription, createSubscriptionFactory, deepMerge, defaultSubscriptionResolve, ensureInputObjectType, ensureInputType, ensureInterfaceType, field, getCacheType, getFieldOptions, getGraphQLType, getOperationOptions, getStandardValue, getSubscriptionOptions, initWeaverContext, inputToArgs, isOnlyMemoryPayload, isSchemaVendorWeaver, isSilk, listSilk, loom, mapValue, markErrorLocation, markLocation, mutation, nonNullSilk, notNullish, nullableSilk, onlyMemoization, parseInputValue, parseSilk, pascalCase, provideWeaverContext, query, resolver, resolverPayloadStorage, silk, subscription, toObjMap, tryIn, useContext, useMemoizationMap, useResolverPayload, weave, weaverContext };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import * as graphql from 'graphql';
|
|
1
2
|
import { GraphQLOutputType, GraphQLObjectTypeConfig, GraphQLFieldConfig, GraphQLResolveInfo, GraphQLScalarType, GraphQLObjectType, GraphQLUnionType, GraphQLInterfaceType, GraphQLInputObjectType, GraphQLSchemaConfig, GraphQLFieldMap, GraphQLNamedType, GraphQLSchema, GraphQLFieldConfigArgumentMap, GraphQLType, GraphQLInputType, GraphQLInterfaceTypeConfig } from 'graphql';
|
|
3
|
+
import * as graphql_jsutils_Maybe from 'graphql/jsutils/Maybe';
|
|
2
4
|
import { AsyncLocalStorage } from 'async_hooks';
|
|
3
5
|
|
|
4
6
|
/**
|
|
@@ -181,7 +183,7 @@ interface CallableInputParser<TSchema extends InputSchema<GraphQLSilk>> {
|
|
|
181
183
|
*/
|
|
182
184
|
value: InferInputI<TSchema, GraphQLSilkIO>;
|
|
183
185
|
/**
|
|
184
|
-
* Parse the input and return the
|
|
186
|
+
* Parse the input and return the result
|
|
185
187
|
*/
|
|
186
188
|
(): Promise<StandardSchemaV1.Result<InferInputO<TSchema, GraphQLSilkIO>>>;
|
|
187
189
|
/**
|
|
@@ -195,6 +197,70 @@ declare function getStandardValue<T>(result: StandardSchemaV1.Result<T>): T;
|
|
|
195
197
|
declare function getStandardValue<T>(result?: StandardSchemaV1.Result<T>): T | undefined;
|
|
196
198
|
declare function getStandardValue<T>(result: StandardSchemaV1.Result<T> | null): T | null;
|
|
197
199
|
|
|
200
|
+
interface IChainFactory<TSchemaIO extends AbstractSchemaIO, TOutput extends TSchemaIO[0], TInput extends InputSchema<TSchemaIO[0]> = undefined> {
|
|
201
|
+
description(description: GraphQLFieldOptions["description"]): this;
|
|
202
|
+
deprecationReason(deprecationReason: GraphQLFieldOptions["deprecationReason"]): this;
|
|
203
|
+
extensions(extensions: GraphQLFieldOptions["extensions"]): this;
|
|
204
|
+
output<TOutputNew extends TSchemaIO[0]>(output: TOutputNew): IChainFactory<TSchemaIO, TOutputNew, TInput>;
|
|
205
|
+
input<TInputNew extends InputSchema<TSchemaIO[0]>>(input: TInputNew): IChainFactory<TSchemaIO, TOutput, TInputNew>;
|
|
206
|
+
}
|
|
207
|
+
declare abstract class BaseChainFactory {
|
|
208
|
+
protected readonly options?: Partial<FieldOrOperation<any, any, any, any> & {
|
|
209
|
+
middlewares: Middleware[];
|
|
210
|
+
}> | undefined;
|
|
211
|
+
static methods(): {
|
|
212
|
+
description: (description: graphql_jsutils_Maybe.Maybe<string>) => BaseChainFactory;
|
|
213
|
+
deprecationReason: (deprecationReason: graphql_jsutils_Maybe.Maybe<string>) => BaseChainFactory;
|
|
214
|
+
extensions: (extensions: graphql_jsutils_Maybe.Maybe<Readonly<graphql.GraphQLFieldExtensions<any, any, any>>>) => BaseChainFactory;
|
|
215
|
+
};
|
|
216
|
+
constructor(options?: Partial<FieldOrOperation<any, any, any, any> & {
|
|
217
|
+
middlewares: Middleware[];
|
|
218
|
+
}> | undefined);
|
|
219
|
+
protected abstract clone(options?: Partial<FieldOrOperation<any, any, any, any> & {
|
|
220
|
+
middlewares: Middleware[];
|
|
221
|
+
}>): this;
|
|
222
|
+
description(description: GraphQLFieldOptions["description"]): this;
|
|
223
|
+
deprecationReason(deprecationReason: GraphQLFieldOptions["deprecationReason"]): this;
|
|
224
|
+
extensions(extensions: GraphQLFieldOptions["extensions"]): this;
|
|
225
|
+
use(...middlewares: Middleware[]): this;
|
|
226
|
+
}
|
|
227
|
+
declare class FieldChainFactory<TSchemaIO extends AbstractSchemaIO, TOutput extends TSchemaIO[0] = never, TInput extends InputSchema<TSchemaIO[0]> = undefined> extends BaseChainFactory implements IChainFactory<TSchemaIO, TOutput, TInput> {
|
|
228
|
+
static methods(): FieldChainFactory<any, never, undefined>;
|
|
229
|
+
protected clone(options?: Partial<FieldOrOperation<any, any, any, any>>): this;
|
|
230
|
+
use(...middlewares: Middleware<FieldOrOperation<any, SchemaToSilk<TSchemaIO, TOutput>, InputSchemaToSilk<TSchemaIO, TInput>, "field">>[]): this;
|
|
231
|
+
output<TOutputNew extends TSchemaIO[0]>(output: TOutputNew): FieldChainFactory<TSchemaIO, TOutputNew, TInput>;
|
|
232
|
+
input<TInputNew extends InputSchema<TSchemaIO[0]>>(input: TInputNew): FieldChainFactory<TSchemaIO, TOutput, TInputNew>;
|
|
233
|
+
resolve<TParent extends TSchemaIO[0]>(resolve: (parent: InferSchemaO<TParent, TSchemaIO>, input: InferInputO<TInput, TSchemaIO>) => MayPromise<InferSchemaO<TOutput, TSchemaIO>>): FieldOrOperation<SchemaToSilk<TSchemaIO, TParent>, SchemaToSilk<TSchemaIO, TOutput>, InputSchemaToSilk<TSchemaIO, TInput>, "field">;
|
|
234
|
+
}
|
|
235
|
+
declare class QueryChainFactory<TSchemaIO extends AbstractSchemaIO, TOutput extends TSchemaIO[0] = never, TInput extends InputSchema<TSchemaIO[0]> = undefined> extends BaseChainFactory implements IChainFactory<TSchemaIO, TOutput, TInput> {
|
|
236
|
+
static methods(): QueryChainFactory<any, never, undefined>;
|
|
237
|
+
protected clone(options?: Partial<FieldOrOperation<any, any, any, any>>): this;
|
|
238
|
+
use(...middlewares: Middleware<FieldOrOperation<any, SchemaToSilk<TSchemaIO, TOutput>, InputSchemaToSilk<TSchemaIO, TInput>, "query">>[]): this;
|
|
239
|
+
output<TOutputNew extends TSchemaIO[0]>(output: TOutputNew): QueryChainFactory<TSchemaIO, TOutputNew, TInput>;
|
|
240
|
+
input<TInputNew extends InputSchema<TSchemaIO[0]>>(input: TInputNew): QueryChainFactory<TSchemaIO, TOutput, TInputNew>;
|
|
241
|
+
resolve(resolve: (input: InferInputO<TInput, TSchemaIO>) => MayPromise<InferSchemaO<TOutput, TSchemaIO>>): FieldOrOperation<any, SchemaToSilk<TSchemaIO, TOutput>, InputSchemaToSilk<TSchemaIO, TInput>, "query">;
|
|
242
|
+
}
|
|
243
|
+
declare class MutationChainFactory<TSchemaIO extends AbstractSchemaIO, TOutput extends TSchemaIO[0] = never, TInput extends InputSchema<TSchemaIO[0]> = undefined> extends BaseChainFactory implements IChainFactory<TSchemaIO, TOutput, TInput> {
|
|
244
|
+
static methods(): MutationChainFactory<any, never, undefined>;
|
|
245
|
+
protected clone(options?: Partial<FieldOrOperation<any, any, any, any>>): this;
|
|
246
|
+
use(...middlewares: Middleware<FieldOrOperation<any, SchemaToSilk<TSchemaIO, TOutput>, InputSchemaToSilk<TSchemaIO, TInput>, "mutation">>[]): this;
|
|
247
|
+
output<TOutputNew extends TSchemaIO[0]>(output: TOutputNew): MutationChainFactory<TSchemaIO, TOutputNew, TInput>;
|
|
248
|
+
input<TInputNew extends InputSchema<TSchemaIO[0]>>(input: TInputNew): MutationChainFactory<TSchemaIO, TOutput, TInputNew>;
|
|
249
|
+
resolve(resolve: (input: InferInputO<TInput, TSchemaIO>) => MayPromise<InferSchemaO<TOutput, TSchemaIO>>): FieldOrOperation<any, SchemaToSilk<TSchemaIO, TOutput>, InputSchemaToSilk<TSchemaIO, TInput>, "mutation">;
|
|
250
|
+
}
|
|
251
|
+
declare class SubscriptionChainFactory<TSchemaIO extends AbstractSchemaIO, TOutput extends TSchemaIO[0] = never, TInput extends InputSchema<TSchemaIO[0]> = undefined> extends BaseChainFactory implements IChainFactory<TSchemaIO, TOutput, TInput> {
|
|
252
|
+
static methods(): SubscriptionChainFactory<any, never, undefined>;
|
|
253
|
+
protected clone(options?: Partial<FieldOrOperation<any, any, any, any>>): this;
|
|
254
|
+
use(...middlewares: Middleware<FieldOrOperation<any, SchemaToSilk<TSchemaIO, TOutput>, InputSchemaToSilk<TSchemaIO, TInput>, "subscription">>[]): this;
|
|
255
|
+
output<TOutputNew extends TSchemaIO[0]>(output: TOutputNew): SubscriptionChainFactory<TSchemaIO, TOutputNew, TInput>;
|
|
256
|
+
input<TInputNew extends InputSchema<TSchemaIO[0]>>(input: TInputNew): SubscriptionChainFactory<TSchemaIO, TOutput, TInputNew>;
|
|
257
|
+
subscribe<TValue = InferSchemaO<TOutput, TSchemaIO>>(subscribe: (input: InferInputO<TInput, TSchemaIO>) => MayPromise<AsyncIterator<TValue>>): ResolvableSubscription<TSchemaIO, TOutput, TInput, TValue>;
|
|
258
|
+
}
|
|
259
|
+
interface ResolvableSubscription<TSchemaIO extends AbstractSchemaIO, TOutput extends TSchemaIO[0], TInput extends InputSchema<TSchemaIO[0]> = undefined, TValue = InferSchemaO<TOutput, TSchemaIO>> extends Subscription<SchemaToSilk<TSchemaIO, TOutput>, InputSchemaToSilk<TSchemaIO, TInput>, TValue> {
|
|
260
|
+
resolve(resolve: (value: TValue, input: InferInputO<TInput, TSchemaIO>) => MayPromise<InferSchemaO<TOutput, TSchemaIO>>): Subscription<SchemaToSilk<TSchemaIO, TOutput>, InputSchemaToSilk<TSchemaIO, TInput>, TValue>;
|
|
261
|
+
resolve(value: TValue, input: any): MayPromise<any>;
|
|
262
|
+
}
|
|
263
|
+
|
|
198
264
|
interface GraphQLSilk<TOutput = any, TInput = any> extends StandardSchemaV1<TInput, TOutput> {
|
|
199
265
|
/**
|
|
200
266
|
* GraphQL type for schema
|
|
@@ -254,12 +320,21 @@ interface QueryMutationOptions<TSchemaIO extends AbstractSchemaIO, TOutput exten
|
|
|
254
320
|
*/
|
|
255
321
|
interface QueryFactory<TSchemaIO extends AbstractSchemaIO> {
|
|
256
322
|
<TOutput extends TSchemaIO[0], TInput extends InputSchema<TSchemaIO[0]> = undefined>(output: TOutput, resolveOrOptions: (() => MayPromise<InferSchemaO<TOutput, TSchemaIO>>) | QueryMutationOptions<TSchemaIO, TOutput, TInput>): FieldOrOperation<undefined, SchemaToSilk<TSchemaIO, TOutput>, InputSchemaToSilk<TSchemaIO, TInput>, "query">;
|
|
323
|
+
<TOutput extends TSchemaIO[0]>(output: TOutput): QueryChainFactory<TSchemaIO, TOutput, undefined>;
|
|
324
|
+
}
|
|
325
|
+
interface QueryFactoryWithChain<TSchemaIO extends AbstractSchemaIO> extends QueryFactory<TSchemaIO>, QueryChainFactory<TSchemaIO, never, undefined> {
|
|
257
326
|
}
|
|
258
327
|
/**
|
|
259
328
|
* Function to create a GraphQL mutation.
|
|
260
329
|
*/
|
|
261
330
|
interface MutationFactory<TSchemaIO extends AbstractSchemaIO> {
|
|
262
331
|
<TOutput extends TSchemaIO[0], TInput extends InputSchema<TSchemaIO[0]> = undefined>(output: TOutput, resolveOrOptions: (() => MayPromise<InferSchemaO<TOutput, TSchemaIO>>) | QueryMutationOptions<TSchemaIO, TOutput, TInput>): FieldOrOperation<undefined, SchemaToSilk<TSchemaIO, TOutput>, InputSchemaToSilk<TSchemaIO, TInput>, "mutation">;
|
|
332
|
+
<TOutput extends TSchemaIO[0]>(output: TOutput): MutationChainFactory<TSchemaIO, TOutput, undefined>;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Function to create a GraphQL mutation.
|
|
336
|
+
*/
|
|
337
|
+
interface MutationFactoryWithChain<TSchemaIO extends AbstractSchemaIO> extends MutationFactory<TSchemaIO>, MutationChainFactory<TSchemaIO, never, undefined> {
|
|
263
338
|
}
|
|
264
339
|
/**
|
|
265
340
|
* Options for External Filed of existing GraphQL Object.
|
|
@@ -273,8 +348,9 @@ interface FieldOptions<TSchemaIO extends AbstractSchemaIO, TParent extends TSche
|
|
|
273
348
|
*/
|
|
274
349
|
interface FieldFactory<TSchemaIO extends AbstractSchemaIO> {
|
|
275
350
|
<TParent extends TSchemaIO[0], TOutput extends TSchemaIO[0], TInput extends InputSchema<TSchemaIO[0]> = undefined>(output: TOutput, resolveOrOptions: ((parent: InferSchemaO<TParent, TSchemaIO>) => MayPromise<InferSchemaO<TOutput, TSchemaIO>>) | FieldOptions<TSchemaIO, TParent, TOutput, TInput>): FieldOrOperation<SchemaToSilk<TSchemaIO, TParent>, SchemaToSilk<TSchemaIO, TOutput>, InputSchemaToSilk<TSchemaIO, TInput>, "field">;
|
|
351
|
+
<TOutput extends TSchemaIO[0]>(output: TOutput): FieldChainFactory<TSchemaIO, TOutput, undefined>;
|
|
276
352
|
}
|
|
277
|
-
interface FieldFactoryWithUtils<TSchemaIO extends AbstractSchemaIO> extends FieldFactory<TSchemaIO> {
|
|
353
|
+
interface FieldFactoryWithUtils<TSchemaIO extends AbstractSchemaIO> extends FieldFactory<TSchemaIO>, FieldChainFactory<TSchemaIO, never, undefined> {
|
|
278
354
|
/** Set fields to be hidden in GraphQL Schema */
|
|
279
355
|
hidden: typeof FIELD_HIDDEN;
|
|
280
356
|
}
|
|
@@ -295,6 +371,9 @@ interface Subscription<TOutput extends GraphQLSilk, TInput extends InputSchema<G
|
|
|
295
371
|
*/
|
|
296
372
|
interface SubscriptionFactory<TSchemaIO extends AbstractSchemaIO> {
|
|
297
373
|
<TOutput extends TSchemaIO[0], TInput extends InputSchema<TSchemaIO[0]> = undefined, TValue = InferSchemaO<TOutput, TSchemaIO>>(output: TOutput, subscribeOrOptions: (() => MayPromise<AsyncIterator<InferSchemaO<TOutput, TSchemaIO>>>) | SubscriptionOptions<TSchemaIO, TOutput, TInput, TValue>): Subscription<SchemaToSilk<TSchemaIO, TOutput>, InputSchemaToSilk<TSchemaIO, TInput>, TValue>;
|
|
374
|
+
<TOutput extends TSchemaIO[0]>(output: TOutput): SubscriptionChainFactory<TSchemaIO, TOutput, undefined>;
|
|
375
|
+
}
|
|
376
|
+
interface SubscriptionFactoryWithChain<TSchemaIO extends AbstractSchemaIO> extends SubscriptionFactory<TSchemaIO>, SubscriptionChainFactory<TSchemaIO, never, undefined> {
|
|
298
377
|
}
|
|
299
378
|
interface ResolverFactory<TSchemaIO extends AbstractSchemaIO> {
|
|
300
379
|
of<TParent extends TSchemaIO[0], TOperations extends Record<string, FieldOrOperation<SchemaToSilk<TSchemaIO, TParent>, any, any> | FieldOrOperation<undefined, any, any, OperationType> | typeof FIELD_HIDDEN>>(parent: TParent, operationOrFields: TOperations, options?: ResolverOptionsWithExtensions<OmitInUnion<ValueOf<TOperations>, typeof FIELD_HIDDEN>>): TOperations;
|
|
@@ -451,6 +530,7 @@ interface ReadOnlyObjMap<T> {
|
|
|
451
530
|
}
|
|
452
531
|
|
|
453
532
|
declare function pascalCase(str: string): string;
|
|
533
|
+
declare function capitalize<T extends string>(str: T): Capitalize<T>;
|
|
454
534
|
|
|
455
535
|
declare function markErrorLocation<TError>(error: TError, ...locations: string[]): TError;
|
|
456
536
|
declare function tryIn<T>(func: () => T, ...locations: string[]): T;
|
|
@@ -466,6 +546,25 @@ declare function tryIn<T>(func: () => T, ...locations: string[]): T;
|
|
|
466
546
|
*/
|
|
467
547
|
declare function markLocation(message: string, ...locations: string[]): string;
|
|
468
548
|
|
|
549
|
+
type BatchLoadFn<TKey, TData> = (keys: TKey[]) => Promise<(TData | Error)[]>;
|
|
550
|
+
declare class EasyDataLoader<TKey, TData> {
|
|
551
|
+
protected readonly batchLoadFn: BatchLoadFn<TKey, TData>;
|
|
552
|
+
protected queue: TKey[];
|
|
553
|
+
protected cache: Map<TKey, Promise<TData>>;
|
|
554
|
+
protected resolvers: Map<TKey, [
|
|
555
|
+
resolve: (value: TData | PromiseLike<TData>) => void,
|
|
556
|
+
reject: (reason?: any) => void
|
|
557
|
+
]>;
|
|
558
|
+
constructor(batchLoadFn: BatchLoadFn<TKey, TData>);
|
|
559
|
+
load(key: TKey): Promise<TData>;
|
|
560
|
+
clear(): void;
|
|
561
|
+
clearByKey(key: TKey): void;
|
|
562
|
+
protected executeBatchLoad(): Promise<void>;
|
|
563
|
+
protected nextTickPromise?: Promise<void>;
|
|
564
|
+
protected nextTickBatchLoad(): Promise<void>;
|
|
565
|
+
static nextTick(): Promise<void>;
|
|
566
|
+
}
|
|
567
|
+
|
|
469
568
|
/**
|
|
470
569
|
* Create a Silk from Scalar.
|
|
471
570
|
*/
|
|
@@ -514,20 +613,24 @@ type InferScalarInternal<T extends GraphQLScalarType> = T extends GraphQLScalarT
|
|
|
514
613
|
type InferScalarExternal<T extends GraphQLScalarType> = T extends GraphQLScalarType<any, infer TExternal> ? TExternal : never;
|
|
515
614
|
type EnsureArray<T> = T extends Array<infer U> ? U[] : T[];
|
|
516
615
|
|
|
517
|
-
declare const
|
|
518
|
-
declare const
|
|
616
|
+
declare const createQuery: (output: GraphQLSilk<any, any>, resolveOrOptions?: (() => MayPromise<unknown>) | QueryMutationOptions<GraphQLSilkIO, any, any>) => QueryChainFactory<AbstractSchemaIO, never, undefined> | FieldOrOperation<any, any, any, "query">;
|
|
617
|
+
declare const query: QueryFactoryWithChain<GraphQLSilkIO>;
|
|
618
|
+
declare const createMutation: (output: GraphQLSilk<any, any>, resolveOrOptions?: (() => MayPromise<unknown>) | QueryMutationOptions<GraphQLSilkIO, any, any>) => MutationChainFactory<AbstractSchemaIO, never, undefined> | FieldOrOperation<any, any, any, "mutation">;
|
|
619
|
+
declare const mutation: MutationFactoryWithChain<GraphQLSilkIO>;
|
|
620
|
+
declare const createField: (output: GraphQLSilk<any, any>, resolveOrOptions?: FieldOptions<GraphQLSilkIO, any, any, any> | ((parent: unknown) => unknown) | undefined) => FieldChainFactory<AbstractSchemaIO, never, undefined> | FieldOrOperation<any, any, any, "field">;
|
|
519
621
|
declare const field: FieldFactoryWithUtils<GraphQLSilkIO>;
|
|
520
622
|
declare const defaultSubscriptionResolve: (source: any) => any;
|
|
521
|
-
declare const
|
|
623
|
+
declare const createSubscription: (output: GraphQLSilk<any, any>, subscribeOrOptions?: (() => MayPromise<AsyncIterator<unknown>>) | SubscriptionOptions<GraphQLSilkIO, any, any, any>) => Subscription<any, any, any> | SubscriptionChainFactory<AbstractSchemaIO, never, undefined>;
|
|
624
|
+
declare const subscription: SubscriptionFactoryWithChain<GraphQLSilkIO>;
|
|
522
625
|
declare const ResolverOptionsMap: WeakMap<object, ResolverOptionsWithParent<GenericFieldOrOperation>>;
|
|
523
626
|
declare function baseResolver(operations: Record<string, FieldOrOperation<any, any, any>>, options: ResolverOptionsWithParent | undefined): Record<string, FieldOrOperation<any, any, any, FieldOrOperationType>>;
|
|
524
627
|
declare const resolver: ResolverFactory<GraphQLSilkIO>;
|
|
525
628
|
declare const loom: {
|
|
526
|
-
query:
|
|
629
|
+
query: QueryFactoryWithChain<GraphQLSilkIO>;
|
|
527
630
|
resolver: ResolverFactory<GraphQLSilkIO>;
|
|
528
631
|
field: FieldFactoryWithUtils<GraphQLSilkIO>;
|
|
529
|
-
subscription:
|
|
530
|
-
mutation:
|
|
632
|
+
subscription: SubscriptionFactoryWithChain<GraphQLSilkIO>;
|
|
633
|
+
mutation: MutationFactoryWithChain<GraphQLSilkIO>;
|
|
531
634
|
};
|
|
532
635
|
|
|
533
636
|
declare function createResolverFactory<TSchemaIO extends AbstractSchemaIO>(toSilk: (schema: TSchemaIO[0]) => GraphQLSilk): ResolverFactory<TSchemaIO>;
|
|
@@ -698,7 +801,7 @@ declare class GraphQLSchemaLoom {
|
|
|
698
801
|
/**
|
|
699
802
|
* Weave a GraphQL Schema from resolvers
|
|
700
803
|
* @param inputs Resolvers, Global Middlewares or WeaverConfigs
|
|
701
|
-
* @returns
|
|
804
|
+
* @returns GraphQL Schema
|
|
702
805
|
*/
|
|
703
806
|
declare const weave: typeof GraphQLSchemaLoom.weave;
|
|
704
807
|
|
|
@@ -725,4 +828,4 @@ interface GQLoomExtensionAttribute {
|
|
|
725
828
|
directives?: string[];
|
|
726
829
|
}
|
|
727
830
|
|
|
728
|
-
export { type AbstractSchemaIO, type CallableContextMemoization, type CallableInputParser, type CallableMiddlewareOptions, ContextMemoization, type CoreSchemaWeaverConfig, type CoreSchemaWeaverConfigOptions, type DirectiveItem, type DirectiveRecord, type FieldConvertOptions, type FieldFactory, type FieldFactoryWithUtils, type FieldOptions, type FieldOrOperation, type FieldOrOperationType, type GQLoomExtensionAttribute, type GQLoomExtensions, type GenericFieldOrOperation, type GlobalWeaverContext, type GraphQLFieldOptions, GraphQLSchemaLoom, type GraphQLSilk, type GraphQLSilkIO, type InferFieldInput, type InferFieldOutput, type InferFieldParent, type InferInputI, type InferInputO, type InferPropertyType, type InferSchemaI, type InferSchemaO, type InputSchema, type InputSchemaToSilk, type IsAny, type ListSilk, LoomObjectType, type MayPromise, type Middleware, type MiddlewareOptions, type MutationFactory, type NonNullSilk, type NullableSilk, OPERATION_OBJECT_NAMES, type ObjectOrNever, type OnlyMemoizationPayload, type OperationType, type QueryFactory, type QueryMutationOptions, type ResolverFactory, type ResolverOptions, ResolverOptionsMap, type ResolverOptionsWithExtensions, type ResolverOptionsWithParent, type ResolverPayload, type ResolvingOptions, symbols as SYMBOLS, type SchemaToSilk, type SchemaWeaver, type SilkFieldOrOperation, type SilkResolver, StandardSchemaV1, type Subscription, type SubscriptionFactory, type SubscriptionOptions, type ValueOf, type WeaverConfig, type WeaverContext, type WrapPropertyType, applyMiddlewares, baseResolver, collectName, collectNames, compose, createFieldFactory, createInputParser, createLoom, createMemoization, createMutationFactory, createQueryFactory, createResolverFactory, createSubscriptionFactory, deepMerge, defaultSubscriptionResolve, ensureInputObjectType, ensureInputType, ensureInterfaceType, field, getCacheType, getFieldOptions, getGraphQLType, getOperationOptions, getStandardValue, getSubscriptionOptions, initWeaverContext, inputToArgs, isOnlyMemoryPayload, isSchemaVendorWeaver, isSilk, listSilk, loom, mapValue, markErrorLocation, markLocation, mutation, nonNullSilk, notNullish, nullableSilk, onlyMemoization, parseInputValue, parseSilk, pascalCase, provideWeaverContext, query, resolver, resolverPayloadStorage, silk, subscription, toObjMap, tryIn, useContext, useMemoizationMap, useResolverPayload, weave, weaverContext };
|
|
831
|
+
export { type AbstractSchemaIO, type BatchLoadFn, type CallableContextMemoization, type CallableInputParser, type CallableMiddlewareOptions, ContextMemoization, type CoreSchemaWeaverConfig, type CoreSchemaWeaverConfigOptions, type DirectiveItem, type DirectiveRecord, EasyDataLoader, type FieldConvertOptions, type FieldFactory, type FieldFactoryWithUtils, type FieldOptions, type FieldOrOperation, type FieldOrOperationType, type GQLoomExtensionAttribute, type GQLoomExtensions, type GenericFieldOrOperation, type GlobalWeaverContext, type GraphQLFieldOptions, GraphQLSchemaLoom, type GraphQLSilk, type GraphQLSilkIO, type InferFieldInput, type InferFieldOutput, type InferFieldParent, type InferInputI, type InferInputO, type InferPropertyType, type InferSchemaI, type InferSchemaO, type InputSchema, type InputSchemaToSilk, type IsAny, type ListSilk, LoomObjectType, type MayPromise, type Middleware, type MiddlewareOptions, type MutationFactory, type MutationFactoryWithChain, type NonNullSilk, type NullableSilk, OPERATION_OBJECT_NAMES, type ObjectOrNever, type OnlyMemoizationPayload, type OperationType, type QueryFactory, type QueryFactoryWithChain, type QueryMutationOptions, type ResolverFactory, type ResolverOptions, ResolverOptionsMap, type ResolverOptionsWithExtensions, type ResolverOptionsWithParent, type ResolverPayload, type ResolvingOptions, symbols as SYMBOLS, type SchemaToSilk, type SchemaWeaver, type SilkFieldOrOperation, type SilkResolver, StandardSchemaV1, type Subscription, type SubscriptionFactory, type SubscriptionFactoryWithChain, type SubscriptionOptions, type ValueOf, type WeaverConfig, type WeaverContext, type WrapPropertyType, applyMiddlewares, baseResolver, capitalize, collectName, collectNames, compose, createField, createFieldFactory, createInputParser, createLoom, createMemoization, createMutation, createMutationFactory, createQuery, createQueryFactory, createResolverFactory, createSubscription, createSubscriptionFactory, deepMerge, defaultSubscriptionResolve, ensureInputObjectType, ensureInputType, ensureInterfaceType, field, getCacheType, getFieldOptions, getGraphQLType, getOperationOptions, getStandardValue, getSubscriptionOptions, initWeaverContext, inputToArgs, isOnlyMemoryPayload, isSchemaVendorWeaver, isSilk, listSilk, loom, mapValue, markErrorLocation, markLocation, mutation, nonNullSilk, notNullish, nullableSilk, onlyMemoization, parseInputValue, parseSilk, pascalCase, provideWeaverContext, query, resolver, resolverPayloadStorage, silk, subscription, toObjMap, tryIn, useContext, useMemoizationMap, useResolverPayload, weave, weaverContext };
|