@gqloom/core 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/dist/index.cjs +133 -60
- package/dist/index.d.cts +83 -62
- package/dist/index.d.ts +83 -62
- package/dist/index.js +130 -59
- package/package.json +6 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { GraphQLOutputType, GraphQLObjectTypeConfig, GraphQLFieldConfig, GraphQLResolveInfo, GraphQLScalarType, GraphQLObjectType, GraphQLUnionType, GraphQLInterfaceType, GraphQLInputObjectType, GraphQLSchemaConfig, GraphQLFieldMap, GraphQLNamedType, GraphQLSchema, GraphQLFieldConfigArgumentMap, GraphQLType, GraphQLInputType, GraphQLInterfaceTypeConfig } from 'graphql';
|
|
2
2
|
import { AsyncLocalStorage } from 'async_hooks';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The Standard Schema interface.
|
|
6
|
+
*/
|
|
7
|
+
type StandardSchemaV1<Input = unknown, Output = Input> = {
|
|
5
8
|
/**
|
|
6
|
-
* The Standard Schema
|
|
9
|
+
* The Standard Schema properties.
|
|
7
10
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*/
|
|
12
|
-
readonly "~standard": StandardSchemaProps<Input, Output>;
|
|
13
|
-
}
|
|
11
|
+
readonly "~standard": StandardSchemaV1.Props<Input, Output>;
|
|
12
|
+
};
|
|
13
|
+
declare namespace StandardSchemaV1 {
|
|
14
14
|
/**
|
|
15
15
|
* The Standard Schema properties interface.
|
|
16
16
|
*/
|
|
17
|
-
interface
|
|
17
|
+
export interface Props<Input = unknown, Output = Input> {
|
|
18
18
|
/**
|
|
19
19
|
* The version number of the standard.
|
|
20
20
|
*/
|
|
@@ -26,20 +26,20 @@ declare namespace v1 {
|
|
|
26
26
|
/**
|
|
27
27
|
* Validates unknown input values.
|
|
28
28
|
*/
|
|
29
|
-
readonly validate: (value: unknown) =>
|
|
29
|
+
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
|
30
30
|
/**
|
|
31
31
|
* Inferred types associated with the schema.
|
|
32
32
|
*/
|
|
33
|
-
readonly types?:
|
|
33
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
* The result interface of the validate function.
|
|
37
37
|
*/
|
|
38
|
-
type
|
|
38
|
+
export type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
39
39
|
/**
|
|
40
40
|
* The result interface if validation succeeds.
|
|
41
41
|
*/
|
|
42
|
-
interface
|
|
42
|
+
export interface SuccessResult<Output> {
|
|
43
43
|
/**
|
|
44
44
|
* The typed output value.
|
|
45
45
|
*/
|
|
@@ -52,16 +52,16 @@ declare namespace v1 {
|
|
|
52
52
|
/**
|
|
53
53
|
* The result interface if validation fails.
|
|
54
54
|
*/
|
|
55
|
-
interface
|
|
55
|
+
export interface FailureResult {
|
|
56
56
|
/**
|
|
57
57
|
* The issues of failed validation.
|
|
58
58
|
*/
|
|
59
|
-
readonly issues: ReadonlyArray<
|
|
59
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
62
|
* The issue interface of the failure output.
|
|
63
63
|
*/
|
|
64
|
-
interface
|
|
64
|
+
export interface Issue {
|
|
65
65
|
/**
|
|
66
66
|
* The error message of the issue.
|
|
67
67
|
*/
|
|
@@ -69,21 +69,21 @@ declare namespace v1 {
|
|
|
69
69
|
/**
|
|
70
70
|
* The path of the issue, if any.
|
|
71
71
|
*/
|
|
72
|
-
readonly path?: ReadonlyArray<PropertyKey |
|
|
72
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* The path segment interface of the issue.
|
|
76
76
|
*/
|
|
77
|
-
interface
|
|
77
|
+
export interface PathSegment {
|
|
78
78
|
/**
|
|
79
79
|
* The key representing a path segment.
|
|
80
80
|
*/
|
|
81
81
|
readonly key: PropertyKey;
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
84
|
-
* The
|
|
84
|
+
* The Standard Schema types interface.
|
|
85
85
|
*/
|
|
86
|
-
interface
|
|
86
|
+
export interface Types<Input = unknown, Output = Input> {
|
|
87
87
|
/**
|
|
88
88
|
* The input type of the schema.
|
|
89
89
|
*/
|
|
@@ -96,11 +96,12 @@ declare namespace v1 {
|
|
|
96
96
|
/**
|
|
97
97
|
* Infers the input type of a Standard Schema.
|
|
98
98
|
*/
|
|
99
|
-
type InferInput<Schema extends
|
|
99
|
+
export type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
100
100
|
/**
|
|
101
101
|
* Infers the output type of a Standard Schema.
|
|
102
102
|
*/
|
|
103
|
-
type InferOutput<Schema extends
|
|
103
|
+
export type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
104
|
+
export { };
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
type MayPromise<T> = T | Promise<T>;
|
|
@@ -182,19 +183,19 @@ interface CallableInputParser<TSchema extends InputSchema<GraphQLSilk>> {
|
|
|
182
183
|
/**
|
|
183
184
|
* Parse the input and return the
|
|
184
185
|
*/
|
|
185
|
-
(): Promise<
|
|
186
|
+
(): Promise<StandardSchemaV1.Result<InferInputO<TSchema, GraphQLSilkIO>>>;
|
|
186
187
|
/**
|
|
187
188
|
* Result of parsing. Set it to `undefined` then the parser will run again.
|
|
188
189
|
*/
|
|
189
|
-
result:
|
|
190
|
+
result: StandardSchemaV1.Result<InferInputO<TSchema, GraphQLSilkIO>> | undefined;
|
|
190
191
|
}
|
|
191
192
|
declare function createInputParser<TSchema extends InputSchema<GraphQLSilk> | undefined>(schema: TSchema, value: InferInputI<TSchema, GraphQLSilkIO>): CallableInputParser<TSchema>;
|
|
192
|
-
declare function parseInputValue<TSchema extends InputSchema<GraphQLSilk> | undefined>(inputSchema: TSchema, input: any): MayPromise<
|
|
193
|
-
declare function getStandardValue<T>(result:
|
|
194
|
-
declare function getStandardValue<T>(result?:
|
|
195
|
-
declare function getStandardValue<T>(result:
|
|
193
|
+
declare function parseInputValue<TSchema extends InputSchema<GraphQLSilk> | undefined>(inputSchema: TSchema, input: any): MayPromise<StandardSchemaV1.Result<InferInputO<TSchema, GraphQLSilkIO>>>;
|
|
194
|
+
declare function getStandardValue<T>(result: StandardSchemaV1.Result<T>): T;
|
|
195
|
+
declare function getStandardValue<T>(result?: StandardSchemaV1.Result<T>): T | undefined;
|
|
196
|
+
declare function getStandardValue<T>(result: StandardSchemaV1.Result<T> | null): T | null;
|
|
196
197
|
|
|
197
|
-
interface GraphQLSilk<TOutput = any, TInput = any> extends
|
|
198
|
+
interface GraphQLSilk<TOutput = any, TInput = any> extends StandardSchemaV1<TInput, TOutput> {
|
|
198
199
|
/**
|
|
199
200
|
* GraphQL type for schema
|
|
200
201
|
*/
|
|
@@ -234,7 +235,7 @@ interface FieldOrOperation<TParent extends undefined | GraphQLSilk, TOutput exte
|
|
|
234
235
|
type: TType;
|
|
235
236
|
input: TInput;
|
|
236
237
|
output: TOutput;
|
|
237
|
-
resolve: TType extends "field" ? (parent:
|
|
238
|
+
resolve: TType extends "field" ? (parent: StandardSchemaV1.InferOutput<NonNullable<TParent>>, input: InferInputI<TInput, GraphQLSilkIO>, options?: ResolvingOptions) => Promise<StandardSchemaV1.InferOutput<TOutput>> : TType extends "subscription" ? (value: any, input: InferInputI<TInput, GraphQLSilkIO>) => Promise<StandardSchemaV1.InferOutput<TOutput>> : (input: InferInputI<TInput, GraphQLSilkIO>, options?: ResolvingOptions) => Promise<StandardSchemaV1.InferOutput<TOutput>>;
|
|
238
239
|
subscribe?: TType extends "subscription" ? (input: InferInputI<TInput, GraphQLSilkIO>, options?: ResolvingOptions) => MayPromise<AsyncIterator<any>> : undefined;
|
|
239
240
|
}
|
|
240
241
|
type GenericFieldOrOperation = FieldOrOperation<any, any, any, any>;
|
|
@@ -285,8 +286,8 @@ interface SubscriptionOptions<TSchemaIO extends AbstractSchemaIO, TOutput extend
|
|
|
285
286
|
subscribe: (input: InferInputO<TInput, TSchemaIO>) => MayPromise<AsyncIterator<TValue>>;
|
|
286
287
|
resolve?: (value: TValue, input: InferInputO<TInput, TSchemaIO>) => MayPromise<InferSchemaO<TOutput, TSchemaIO>>;
|
|
287
288
|
}
|
|
288
|
-
interface Subscription<TOutput extends GraphQLSilk, TInput extends InputSchema<GraphQLSilk> = undefined, TValue =
|
|
289
|
-
resolve: (value: TValue, input: InferInputI<TInput, GraphQLSilkIO>) => Promise<
|
|
289
|
+
interface Subscription<TOutput extends GraphQLSilk, TInput extends InputSchema<GraphQLSilk> = undefined, TValue = StandardSchemaV1.InferOutput<TOutput>> extends FieldOrOperation<undefined, TOutput, TInput, "subscription"> {
|
|
290
|
+
resolve: (value: TValue, input: InferInputI<TInput, GraphQLSilkIO>) => Promise<StandardSchemaV1.InferOutput<TOutput>>;
|
|
290
291
|
subscribe: (input: InferInputI<TInput, GraphQLSilkIO>, options?: ResolvingOptions) => MayPromise<AsyncIterator<TValue>>;
|
|
291
292
|
}
|
|
292
293
|
/**
|
|
@@ -305,18 +306,24 @@ declare function getOperationOptions<T extends FieldOrOperationType = OperationT
|
|
|
305
306
|
declare function getSubscriptionOptions(subscribeOrOptions: (() => any) | SubscriptionOptions<any, any, any, any>): SubscriptionOptions<any, any, any, any>;
|
|
306
307
|
declare function getFieldOptions({ description, deprecationReason, extensions, }: GraphQLFieldOptions): GraphQLFieldOptions;
|
|
307
308
|
|
|
308
|
-
interface
|
|
309
|
+
interface MiddlewareOptions<TField extends GenericFieldOrOperation = FieldOrOperation<any, any, any, any>> {
|
|
309
310
|
/** The Output Silk of the field */
|
|
310
|
-
outputSilk:
|
|
311
|
+
outputSilk: StandardSchemaV1.InferOutput<InferFieldOutput<TField>>;
|
|
311
312
|
/** The previous object, which for a field on the root Query type is often not used. */
|
|
312
|
-
parent: TField extends FieldOrOperation<infer TParent, any, any, any> ? TParent extends undefined ? undefined :
|
|
313
|
+
parent: TField extends FieldOrOperation<infer TParent, any, any, any> ? TParent extends undefined ? undefined : StandardSchemaV1.InferOutput<NonNullable<TParent>> : never;
|
|
313
314
|
/** A function to parse the input of the field */
|
|
314
315
|
parseInput: TField extends FieldOrOperation<any, any, infer TInput, any> ? CallableInputParser<TInput> : undefined;
|
|
315
316
|
/** The type of the field: `query`, `mutation`, `subscription` or `field` */
|
|
316
317
|
type: FieldOrOperationType;
|
|
317
318
|
}
|
|
318
|
-
|
|
319
|
-
|
|
319
|
+
interface CallableMiddlewareOptions<TField extends GenericFieldOrOperation = FieldOrOperation<any, any, any, any>> extends MiddlewareOptions<TField> {
|
|
320
|
+
/** The function to call next in the middleware chain. */
|
|
321
|
+
next: () => MayPromise<StandardSchemaV1.InferOutput<InferFieldOutput<TField>>>;
|
|
322
|
+
/** The function to call next in the middleware chain. */
|
|
323
|
+
(): MayPromise<StandardSchemaV1.InferOutput<InferFieldOutput<TField>>>;
|
|
324
|
+
}
|
|
325
|
+
type Middleware<TField extends GenericFieldOrOperation = FieldOrOperation<any, any, any, any>> = (options: CallableMiddlewareOptions<TField>) => MayPromise<StandardSchemaV1.InferOutput<InferFieldOutput<TField>>>;
|
|
326
|
+
declare function applyMiddlewares<TField extends GenericFieldOrOperation = FieldOrOperation<any, any, any, any>>(middlewares: Middleware[], resolveFunction: () => MayPromise<StandardSchemaV1.InferOutput<InferFieldOutput<TField>>>, options: MiddlewareOptions<TField>): Promise<StandardSchemaV1.InferOutput<InferFieldOutput<TField>>>;
|
|
320
327
|
declare function compose<T>(...lists: (T[] | undefined)[]): T[];
|
|
321
328
|
|
|
322
329
|
/**
|
|
@@ -443,6 +450,8 @@ interface ReadOnlyObjMap<T> {
|
|
|
443
450
|
readonly [key: string]: T;
|
|
444
451
|
}
|
|
445
452
|
|
|
453
|
+
declare function pascalCase(str: string): string;
|
|
454
|
+
|
|
446
455
|
declare function markErrorLocation<TError>(error: TError, ...locations: string[]): TError;
|
|
447
456
|
declare function tryIn<T>(func: () => T, ...locations: string[]): T;
|
|
448
457
|
/**
|
|
@@ -460,11 +469,11 @@ declare function markLocation(message: string, ...locations: string[]): string;
|
|
|
460
469
|
/**
|
|
461
470
|
* Create a Silk from Scalar.
|
|
462
471
|
*/
|
|
463
|
-
declare function silk<TScalar extends GraphQLScalarType>(type: TScalar | (() => TScalar), parse?: (value: InferScalarExternal<TScalar>) =>
|
|
472
|
+
declare function silk<TScalar extends GraphQLScalarType>(type: TScalar | (() => TScalar), parse?: (value: InferScalarExternal<TScalar>) => StandardSchemaV1.Result<InferScalarExternal<TScalar>> | Promise<StandardSchemaV1.Result<InferScalarInternal<TScalar>>>): GraphQLSilk<InferScalarInternal<TScalar> | undefined, InferScalarInternal<TScalar> | undefined>;
|
|
464
473
|
/**
|
|
465
474
|
* Create a GraphQLSilk Object.
|
|
466
475
|
*/
|
|
467
|
-
declare function silk<TOutput, TInput = TOutput>(type: GraphQLOutputType | (() => GraphQLOutputType), validate?: (value: TInput) =>
|
|
476
|
+
declare function silk<TOutput, TInput = TOutput>(type: GraphQLOutputType | (() => GraphQLOutputType), validate?: (value: TInput) => StandardSchemaV1.Result<TOutput> | Promise<StandardSchemaV1.Result<TOutput>>): GraphQLSilk<TOutput, TInput>;
|
|
468
477
|
declare namespace silk {
|
|
469
478
|
var parse: typeof parseSilk;
|
|
470
479
|
var getType: typeof getGraphQLType;
|
|
@@ -472,17 +481,17 @@ declare namespace silk {
|
|
|
472
481
|
var list: typeof listSilk;
|
|
473
482
|
var nullable: typeof nullableSilk;
|
|
474
483
|
}
|
|
475
|
-
type NonNullSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<NonNullable<
|
|
484
|
+
type NonNullSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<NonNullable<StandardSchemaV1.InferOutput<TSilk>>, NonNullable<StandardSchemaV1.InferInput<TSilk>>>;
|
|
476
485
|
/**
|
|
477
486
|
* Non-nullable Silk.
|
|
478
487
|
*/
|
|
479
488
|
declare function nonNullSilk<TSilk extends GraphQLSilk<any, any>>(origin: TSilk): NonNullSilk<TSilk>;
|
|
480
|
-
type ListSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<EnsureArray<
|
|
489
|
+
type ListSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<EnsureArray<StandardSchemaV1.InferOutput<TSilk>>, EnsureArray<StandardSchemaV1.InferOutput<TSilk>>>;
|
|
481
490
|
/**
|
|
482
491
|
* List Silk.
|
|
483
492
|
*/
|
|
484
493
|
declare function listSilk<TSilk extends GraphQLSilk<any, any>>(origin: TSilk): ListSilk<TSilk>;
|
|
485
|
-
type NullableSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<
|
|
494
|
+
type NullableSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<StandardSchemaV1.InferOutput<TSilk> | null | undefined, StandardSchemaV1.InferInput<TSilk>>;
|
|
486
495
|
/**
|
|
487
496
|
* Nullable Silk.
|
|
488
497
|
*/
|
|
@@ -499,7 +508,7 @@ declare function getGraphQLType(silk: GraphQLSilk): GraphQLOutputType;
|
|
|
499
508
|
* @param input
|
|
500
509
|
* @returns output
|
|
501
510
|
*/
|
|
502
|
-
declare function parseSilk<TSilk extends GraphQLSilk>(silk: TSilk, input:
|
|
511
|
+
declare function parseSilk<TSilk extends GraphQLSilk>(silk: TSilk, input: StandardSchemaV1.InferInput<TSilk>): MayPromise<StandardSchemaV1.Result<StandardSchemaV1.InferOutput<TSilk>>>;
|
|
503
512
|
declare function isSilk(target: any): target is GraphQLSilk;
|
|
504
513
|
type InferScalarInternal<T extends GraphQLScalarType> = T extends GraphQLScalarType<infer TInternal> ? TInternal : never;
|
|
505
514
|
type InferScalarExternal<T extends GraphQLScalarType> = T extends GraphQLScalarType<any, infer TExternal> ? TExternal : never;
|
|
@@ -534,11 +543,11 @@ declare function createLoom<TSchemaIO extends AbstractSchemaIO>(toSilk: (schema:
|
|
|
534
543
|
subscription: SubscriptionFactory<TSchemaIO>;
|
|
535
544
|
};
|
|
536
545
|
|
|
537
|
-
interface
|
|
546
|
+
interface SchemaWeaver {
|
|
538
547
|
vendor: string;
|
|
539
548
|
getGraphQLType: (schema: any) => GraphQLOutputType;
|
|
540
549
|
}
|
|
541
|
-
declare function isSchemaVendorWeaver(some: any): some is
|
|
550
|
+
declare function isSchemaVendorWeaver(some: any): some is SchemaWeaver;
|
|
542
551
|
|
|
543
552
|
interface WeaverContext {
|
|
544
553
|
id: number;
|
|
@@ -554,11 +563,11 @@ interface WeaverContext {
|
|
|
554
563
|
memoNamedType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(gqlType: TGraphQLType): TGraphQLType;
|
|
555
564
|
getNamedType<T extends GraphQLOutputType>(name: string): T | undefined;
|
|
556
565
|
names: WeakMap<object, string>;
|
|
557
|
-
vendorWeavers: Map<string,
|
|
566
|
+
vendorWeavers: Map<string, SchemaWeaver>;
|
|
558
567
|
}
|
|
559
568
|
interface WeaverConfig {
|
|
560
569
|
[WEAVER_CONFIG]: string | symbol;
|
|
561
|
-
vendorWeaver?:
|
|
570
|
+
vendorWeaver?: SchemaWeaver;
|
|
562
571
|
}
|
|
563
572
|
declare function initWeaverContext(): WeaverContext;
|
|
564
573
|
declare namespace initWeaverContext {
|
|
@@ -608,39 +617,48 @@ interface CoreSchemaWeaverConfig extends WeaverConfig, CoreSchemaWeaverConfigOpt
|
|
|
608
617
|
declare class LoomObjectType extends GraphQLObjectType {
|
|
609
618
|
protected extraFields: Map<string, SilkFieldOrOperation>;
|
|
610
619
|
protected hiddenFields: Set<string>;
|
|
620
|
+
static AUTO_ALIASING: "__gqloom_auto_aliasing";
|
|
611
621
|
protected weaverContext: WeaverContext;
|
|
612
622
|
protected resolverOptions?: ResolvingOptions;
|
|
613
623
|
constructor(objectOrGetter: string | GraphQLObjectType | GraphQLObjectTypeConfig<any, any> | (() => GraphQLObjectType | GraphQLObjectTypeConfig<any, any>), options?: {
|
|
614
624
|
weaverContext?: WeaverContext;
|
|
615
625
|
resolverOptions?: ResolvingOptions;
|
|
616
626
|
});
|
|
627
|
+
protected hasExplicitName?: boolean;
|
|
628
|
+
protected _aliases: string[];
|
|
629
|
+
get aliases(): string[];
|
|
630
|
+
addAlias(name: string): void;
|
|
631
|
+
protected renameByAliases(): void;
|
|
617
632
|
hideField(name: string): void;
|
|
618
633
|
addField(name: string, resolver: SilkFieldOrOperation): void;
|
|
619
634
|
mergeExtensions(extensions: GraphQLObjectTypeConfig<any, any>["extensions"]): void;
|
|
620
635
|
private extraFieldMap?;
|
|
621
636
|
getFields(): GraphQLFieldMap<any, any>;
|
|
622
637
|
protected mapToFieldConfig(map: Map<string, SilkFieldOrOperation>): Record<string, GraphQLFieldConfig<any, any>>;
|
|
623
|
-
toFieldConfig(field: SilkFieldOrOperation): GraphQLFieldConfig<any, any>;
|
|
638
|
+
toFieldConfig(field: SilkFieldOrOperation, fieldName?: string): GraphQLFieldConfig<any, any>;
|
|
624
639
|
protected provideForResolve(field: SilkFieldOrOperation): Pick<GraphQLFieldConfig<any, any>, "resolve"> | undefined;
|
|
625
640
|
protected provideForSubscribe(field: SilkFieldOrOperation): Pick<GraphQLFieldConfig<any, any>, "subscribe"> | undefined;
|
|
626
|
-
protected getCacheType(gqlType: GraphQLOutputType): GraphQLOutputType;
|
|
641
|
+
protected getCacheType(gqlType: GraphQLOutputType, fieldName?: string): GraphQLOutputType;
|
|
627
642
|
get options(): {
|
|
628
643
|
resolverOptions: ResolvingOptions | undefined;
|
|
629
644
|
weaverContext: WeaverContext;
|
|
630
645
|
};
|
|
631
646
|
}
|
|
647
|
+
declare const OPERATION_OBJECT_NAMES: Set<string>;
|
|
632
648
|
declare function getCacheType(gqlType: GraphQLOutputType, options?: {
|
|
633
649
|
weaverContext?: WeaverContext;
|
|
634
650
|
resolverOptions?: ResolvingOptions;
|
|
651
|
+
fieldName?: string;
|
|
652
|
+
parent?: LoomObjectType;
|
|
635
653
|
}): GraphQLOutputType;
|
|
636
654
|
|
|
637
655
|
interface SchemaWeaverParameters extends Partial<Record<"query" | "mutation" | "subscription", LoomObjectType>>, Pick<GraphQLSchemaConfig, "types"> {
|
|
638
656
|
}
|
|
639
|
-
declare class
|
|
657
|
+
declare class GraphQLSchemaLoom {
|
|
640
658
|
query?: LoomObjectType;
|
|
641
659
|
mutation?: LoomObjectType;
|
|
642
660
|
subscription?: LoomObjectType;
|
|
643
|
-
types
|
|
661
|
+
types: Set<GraphQLNamedType>;
|
|
644
662
|
context: WeaverContext;
|
|
645
663
|
resolverOptions?: ResolvingOptions;
|
|
646
664
|
/**
|
|
@@ -652,7 +670,7 @@ declare class SchemaWeaver {
|
|
|
652
670
|
constructor({ query, mutation, subscription, types }?: SchemaWeaverParameters, context?: WeaverContext);
|
|
653
671
|
use(...middlewares: Middleware[]): this;
|
|
654
672
|
add(resolver: SilkResolver): this;
|
|
655
|
-
addVendor(weaver:
|
|
673
|
+
addVendor(weaver: SchemaWeaver): this;
|
|
656
674
|
addType(silk: GraphQLSilk): this;
|
|
657
675
|
setConfig<TConfig extends WeaverConfig>(config: TConfig): this;
|
|
658
676
|
weaveGraphQLSchema(): GraphQLSchema;
|
|
@@ -662,31 +680,34 @@ declare class SchemaWeaver {
|
|
|
662
680
|
resolverOptions: ResolvingOptions | undefined;
|
|
663
681
|
weaverContext: WeaverContext;
|
|
664
682
|
};
|
|
665
|
-
static optionsFrom(...inputs: (SilkResolver | Middleware |
|
|
683
|
+
static optionsFrom(...inputs: (SilkResolver | Middleware | SchemaWeaver | WeaverConfig | GraphQLSilk)[]): {
|
|
666
684
|
context: WeaverContext | undefined;
|
|
667
685
|
configs: Set<WeaverConfig>;
|
|
668
686
|
middlewares: Set<Middleware>;
|
|
669
687
|
resolvers: Set<SilkResolver>;
|
|
670
688
|
silks: Set<GraphQLSilk<any, any>>;
|
|
671
|
-
weavers: Set<
|
|
689
|
+
weavers: Set<SchemaWeaver>;
|
|
672
690
|
};
|
|
673
691
|
/**
|
|
674
692
|
* Weave a GraphQL Schema from resolvers
|
|
675
|
-
* @param inputs Resolvers, Global Middlewares
|
|
676
|
-
* @returns
|
|
693
|
+
* @param inputs Resolvers, Global Middlewares, WeaverConfigs Or SchemaWeaver
|
|
694
|
+
* @returns GraphQL Schema
|
|
677
695
|
*/
|
|
678
|
-
static weave(...inputs: (SilkResolver | Middleware |
|
|
696
|
+
static weave(...inputs: (SilkResolver | Middleware | SchemaWeaver | WeaverConfig | GraphQLSilk)[]): GraphQLSchema;
|
|
679
697
|
}
|
|
680
698
|
/**
|
|
681
699
|
* Weave a GraphQL Schema from resolvers
|
|
682
700
|
* @param inputs Resolvers, Global Middlewares or WeaverConfigs
|
|
683
701
|
* @returns GraphQ LSchema
|
|
684
702
|
*/
|
|
685
|
-
declare const weave: typeof
|
|
703
|
+
declare const weave: typeof GraphQLSchemaLoom.weave;
|
|
686
704
|
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
705
|
+
interface EnsureInputOptions {
|
|
706
|
+
fieldName?: string;
|
|
707
|
+
}
|
|
708
|
+
declare function inputToArgs(input: InputSchema<GraphQLSilk>, options: EnsureInputOptions | undefined): GraphQLFieldConfigArgumentMap | undefined;
|
|
709
|
+
declare function ensureInputType(silkOrType: GraphQLType | GraphQLSilk, options: EnsureInputOptions | undefined): GraphQLInputType;
|
|
710
|
+
declare function ensureInputObjectType(object: GraphQLObjectType | GraphQLInterfaceType | GraphQLInputObjectType, options: EnsureInputOptions | undefined): GraphQLInputObjectType;
|
|
690
711
|
|
|
691
712
|
declare function ensureInterfaceType(gqlType: GraphQLOutputType, interfaceConfig?: Partial<GraphQLInterfaceTypeConfig<any, any>>): GraphQLInterfaceType;
|
|
692
713
|
|
|
@@ -704,4 +725,4 @@ interface GQLoomExtensionAttribute {
|
|
|
704
725
|
directives?: string[];
|
|
705
726
|
}
|
|
706
727
|
|
|
707
|
-
export { type AbstractSchemaIO, type CallableContextMemoization, type CallableInputParser, 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, 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
|
|
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 };
|