@gqloom/core 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,109 @@
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
+ /**
5
+ * The Standard Schema interface.
6
+ */
7
+ type StandardSchemaV1<Input = unknown, Output = Input> = {
8
+ /**
9
+ * The Standard Schema properties.
10
+ */
11
+ readonly "~standard": StandardSchemaV1.Props<Input, Output>;
12
+ };
13
+ declare namespace StandardSchemaV1 {
14
+ /**
15
+ * The Standard Schema properties interface.
16
+ */
17
+ export interface Props<Input = unknown, Output = Input> {
18
+ /**
19
+ * The version number of the standard.
20
+ */
21
+ readonly version: 1;
22
+ /**
23
+ * The vendor name of the schema library.
24
+ */
25
+ readonly vendor: string;
26
+ /**
27
+ * Validates unknown input values.
28
+ */
29
+ readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
30
+ /**
31
+ * Inferred types associated with the schema.
32
+ */
33
+ readonly types?: Types<Input, Output> | undefined;
34
+ }
35
+ /**
36
+ * The result interface of the validate function.
37
+ */
38
+ export type Result<Output> = SuccessResult<Output> | FailureResult;
39
+ /**
40
+ * The result interface if validation succeeds.
41
+ */
42
+ export interface SuccessResult<Output> {
43
+ /**
44
+ * The typed output value.
45
+ */
46
+ readonly value: Output;
47
+ /**
48
+ * The non-existent issues.
49
+ */
50
+ readonly issues?: undefined;
51
+ }
52
+ /**
53
+ * The result interface if validation fails.
54
+ */
55
+ export interface FailureResult {
56
+ /**
57
+ * The issues of failed validation.
58
+ */
59
+ readonly issues: ReadonlyArray<Issue>;
60
+ }
61
+ /**
62
+ * The issue interface of the failure output.
63
+ */
64
+ export interface Issue {
65
+ /**
66
+ * The error message of the issue.
67
+ */
68
+ readonly message: string;
69
+ /**
70
+ * The path of the issue, if any.
71
+ */
72
+ readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
73
+ }
74
+ /**
75
+ * The path segment interface of the issue.
76
+ */
77
+ export interface PathSegment {
78
+ /**
79
+ * The key representing a path segment.
80
+ */
81
+ readonly key: PropertyKey;
82
+ }
83
+ /**
84
+ * The Standard Schema types interface.
85
+ */
86
+ export interface Types<Input = unknown, Output = Input> {
87
+ /**
88
+ * The input type of the schema.
89
+ */
90
+ readonly input: Input;
91
+ /**
92
+ * The output type of the schema.
93
+ */
94
+ readonly output: Output;
95
+ }
96
+ /**
97
+ * Infers the input type of a Standard Schema.
98
+ */
99
+ export type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["input"];
100
+ /**
101
+ * Infers the output type of a Standard Schema.
102
+ */
103
+ export type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema["~standard"]["types"]>["output"];
104
+ export { };
105
+ }
106
+
4
107
  type MayPromise<T> = T | Promise<T>;
5
108
  type IsAny<T> = 0 extends 1 & T ? true : false;
6
109
  /**
@@ -28,45 +131,10 @@ type WrapPropertyType<TKey extends string, TProperty> = TKey extends `${infer TF
28
131
  type ObjectOrNever<T> = T extends object ? T : never;
29
132
  type ValueOf<T extends object> = T[keyof T];
30
133
 
31
- type InputSchema<TBaseSchema> = TBaseSchema | Record<string, TBaseSchema> | undefined;
32
- type InputSchemaToSilk<TSchemaIO extends AbstractSchemaIO, TInput extends InputSchema<TSchemaIO[0]>> = TInput extends undefined ? undefined : TInput extends TSchemaIO[0] ? SchemaToSilk<TSchemaIO, TInput> : {
33
- [K in keyof TInput]: TInput[K] extends TSchemaIO[0] ? SchemaToSilk<TSchemaIO, TInput[K]> : never;
34
- };
35
- type InferInputI<TInput extends object | undefined, TSchemaIO extends AbstractSchemaIO> = TInput extends undefined ? undefined : TInput extends TSchemaIO[0] ? ObjectOrNever<InferSchemaI<TInput, TSchemaIO>> : {
36
- [K in keyof TInput]: InferSchemaI<TInput[K], TSchemaIO>;
37
- };
38
- type InferInputO<TInput extends object | undefined, TSchemaIO extends AbstractSchemaIO> = TInput extends undefined ? undefined : TInput extends TSchemaIO[0] ? ObjectOrNever<InferSchemaO<TInput, TSchemaIO>> : {
39
- [K in keyof TInput]: InferSchemaO<TInput[K], TSchemaIO>;
40
- };
41
- interface CallableInputParser<TSchema extends InputSchema<GraphQLSilk>> {
42
- /**
43
- * input schema
44
- */
45
- schema: TSchema;
46
- /**
47
- * Origin value to parse
48
- */
49
- value: InferInputI<TSchema, GraphQLSilkIO>;
50
- /**
51
- * Parse the input and return the
52
- */
53
- (): Promise<InferInputO<TSchema, GraphQLSilkIO>>;
54
- /**
55
- * Result of parsing. Set it to `undefined` then the parser will run again.
56
- */
57
- result: InferInputO<TSchema, GraphQLSilkIO> | undefined;
58
- }
59
- declare function createInputParser<TSchema extends InputSchema<GraphQLSilk> | undefined>(schema: TSchema, value: InferInputI<TSchema, GraphQLSilkIO>): CallableInputParser<TSchema>;
60
- declare function parseInputValue<TSchema extends InputSchema<GraphQLSilk> | undefined>(inputSchema: TSchema, input: any): MayPromise<InferInputO<TSchema, GraphQLSilkIO>>;
61
-
62
134
  /**
63
135
  * The symbol to get GraphQL type for schema
64
136
  */
65
137
  declare const GET_GRAPHQL_TYPE: unique symbol;
66
- /**
67
- * The symbol to validate and transform input to output
68
- */
69
- declare const PARSE: unique symbol;
70
138
  /**
71
139
  * The symbol to get and store weaver config
72
140
  */
@@ -87,31 +155,51 @@ declare const FIELD_HIDDEN: unique symbol;
87
155
  declare const symbols_CONTEXT_MEMORY_MAP_KEY: typeof CONTEXT_MEMORY_MAP_KEY;
88
156
  declare const symbols_FIELD_HIDDEN: typeof FIELD_HIDDEN;
89
157
  declare const symbols_GET_GRAPHQL_TYPE: typeof GET_GRAPHQL_TYPE;
90
- declare const symbols_PARSE: typeof PARSE;
91
158
  declare const symbols_RESOLVER_OPTIONS_KEY: typeof RESOLVER_OPTIONS_KEY;
92
159
  declare const symbols_WEAVER_CONFIG: typeof WEAVER_CONFIG;
93
160
  declare namespace symbols {
94
- export { symbols_CONTEXT_MEMORY_MAP_KEY as CONTEXT_MEMORY_MAP_KEY, symbols_FIELD_HIDDEN as FIELD_HIDDEN, symbols_GET_GRAPHQL_TYPE as GET_GRAPHQL_TYPE, symbols_PARSE as PARSE, symbols_RESOLVER_OPTIONS_KEY as RESOLVER_OPTIONS_KEY, symbols_WEAVER_CONFIG as WEAVER_CONFIG };
161
+ export { symbols_CONTEXT_MEMORY_MAP_KEY as CONTEXT_MEMORY_MAP_KEY, symbols_FIELD_HIDDEN as FIELD_HIDDEN, symbols_GET_GRAPHQL_TYPE as GET_GRAPHQL_TYPE, symbols_RESOLVER_OPTIONS_KEY as RESOLVER_OPTIONS_KEY, symbols_WEAVER_CONFIG as WEAVER_CONFIG };
95
162
  }
96
163
 
97
- interface GraphQLSilk<TOutput = any, TInput = any> {
164
+ type InputSchema<TBaseSchema> = TBaseSchema | Record<string, TBaseSchema> | undefined;
165
+ type InputSchemaToSilk<TSchemaIO extends AbstractSchemaIO, TInput extends InputSchema<TSchemaIO[0]>> = TInput extends undefined ? undefined : TInput extends TSchemaIO[0] ? SchemaToSilk<TSchemaIO, TInput> : {
166
+ [K in keyof TInput]: TInput[K] extends TSchemaIO[0] ? SchemaToSilk<TSchemaIO, TInput[K]> : never;
167
+ };
168
+ type InferInputI<TInput extends object | undefined, TSchemaIO extends AbstractSchemaIO> = TInput extends undefined ? undefined : TInput extends TSchemaIO[0] ? ObjectOrNever<InferSchemaI<TInput, TSchemaIO>> : {
169
+ [K in keyof TInput]: InferSchemaI<TInput[K], TSchemaIO>;
170
+ };
171
+ type InferInputO<TInput extends object | undefined, TSchemaIO extends AbstractSchemaIO> = TInput extends undefined ? undefined : TInput extends TSchemaIO[0] ? ObjectOrNever<InferSchemaO<TInput, TSchemaIO>> : {
172
+ [K in keyof TInput]: InferSchemaO<TInput[K], TSchemaIO>;
173
+ };
174
+ interface CallableInputParser<TSchema extends InputSchema<GraphQLSilk>> {
98
175
  /**
99
- * GraphQL type for schema
176
+ * input schema
100
177
  */
101
- [GET_GRAPHQL_TYPE]: () => GraphQLOutputType;
178
+ schema: TSchema;
102
179
  /**
103
- * validate and transform input to output
180
+ * Origin value to parse
104
181
  */
105
- [PARSE]?: (input: TInput) => MayPromise<TOutput>;
182
+ value: InferInputI<TSchema, GraphQLSilkIO>;
106
183
  /**
107
- * Input and output type.
108
- *
109
- * @internal
184
+ * Parse the input and return the
110
185
  */
111
- readonly "~types"?: {
112
- readonly input: TInput;
113
- readonly output: TOutput;
114
- };
186
+ (): Promise<StandardSchemaV1.Result<InferInputO<TSchema, GraphQLSilkIO>>>;
187
+ /**
188
+ * Result of parsing. Set it to `undefined` then the parser will run again.
189
+ */
190
+ result: StandardSchemaV1.Result<InferInputO<TSchema, GraphQLSilkIO>> | undefined;
191
+ }
192
+ declare function createInputParser<TSchema extends InputSchema<GraphQLSilk> | undefined>(schema: TSchema, value: InferInputI<TSchema, GraphQLSilkIO>): CallableInputParser<TSchema>;
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;
197
+
198
+ interface GraphQLSilk<TOutput = any, TInput = any> extends StandardSchemaV1<TInput, TOutput> {
199
+ /**
200
+ * GraphQL type for schema
201
+ */
202
+ [GET_GRAPHQL_TYPE]?: () => GraphQLOutputType;
115
203
  }
116
204
  type AbstractSchemaIO = [
117
205
  baseSchema: object,
@@ -120,11 +208,9 @@ type AbstractSchemaIO = [
120
208
  ];
121
209
  type GraphQLSilkIO = [
122
210
  object: GraphQLSilk,
123
- input: "~types.input",
124
- output: "~types.output"
211
+ input: "~standard.types.input",
212
+ output: "~standard.types.output"
125
213
  ];
126
- type InferSilkI<T extends GraphQLSilk> = NonNullable<T["~types"]>["input"];
127
- type InferSilkO<T extends GraphQLSilk> = NonNullable<T["~types"]>["output"];
128
214
  type InferSchemaI<TSchema, TSchemaIO extends AbstractSchemaIO> = InferPropertyType<TSchema, TSchemaIO[1]>;
129
215
  type InferSchemaO<TSchema, TSchemaIO extends AbstractSchemaIO> = InferPropertyType<TSchema, TSchemaIO[2]>;
130
216
  type SchemaToSilk<TSchemaIO extends AbstractSchemaIO, TSchema extends TSchemaIO[0]> = GraphQLSilk<InferSchemaO<TSchema, TSchemaIO>, InferSchemaI<TSchema, TSchemaIO>>;
@@ -149,7 +235,7 @@ interface FieldOrOperation<TParent extends undefined | GraphQLSilk, TOutput exte
149
235
  type: TType;
150
236
  input: TInput;
151
237
  output: TOutput;
152
- resolve: TType extends "field" ? (parent: InferSilkO<NonNullable<TParent>>, input: InferInputI<TInput, GraphQLSilkIO>, options?: ResolvingOptions) => Promise<InferSilkO<TOutput>> : TType extends "subscription" ? (value: any, input: InferInputI<TInput, GraphQLSilkIO>) => Promise<InferSilkO<TOutput>> : (input: InferInputI<TInput, GraphQLSilkIO>, options?: ResolvingOptions) => Promise<InferSilkO<TOutput>>;
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>>;
153
239
  subscribe?: TType extends "subscription" ? (input: InferInputI<TInput, GraphQLSilkIO>, options?: ResolvingOptions) => MayPromise<AsyncIterator<any>> : undefined;
154
240
  }
155
241
  type GenericFieldOrOperation = FieldOrOperation<any, any, any, any>;
@@ -200,8 +286,8 @@ interface SubscriptionOptions<TSchemaIO extends AbstractSchemaIO, TOutput extend
200
286
  subscribe: (input: InferInputO<TInput, TSchemaIO>) => MayPromise<AsyncIterator<TValue>>;
201
287
  resolve?: (value: TValue, input: InferInputO<TInput, TSchemaIO>) => MayPromise<InferSchemaO<TOutput, TSchemaIO>>;
202
288
  }
203
- interface Subscription<TOutput extends GraphQLSilk, TInput extends InputSchema<GraphQLSilk> = undefined, TValue = InferSilkO<TOutput>> extends FieldOrOperation<undefined, TOutput, TInput, "subscription"> {
204
- resolve: (value: TValue, input: InferInputI<TInput, GraphQLSilkIO>) => Promise<InferSilkO<TOutput>>;
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>>;
205
291
  subscribe: (input: InferInputI<TInput, GraphQLSilkIO>, options?: ResolvingOptions) => MayPromise<AsyncIterator<TValue>>;
206
292
  }
207
293
  /**
@@ -220,18 +306,24 @@ declare function getOperationOptions<T extends FieldOrOperationType = OperationT
220
306
  declare function getSubscriptionOptions(subscribeOrOptions: (() => any) | SubscriptionOptions<any, any, any, any>): SubscriptionOptions<any, any, any, any>;
221
307
  declare function getFieldOptions({ description, deprecationReason, extensions, }: GraphQLFieldOptions): GraphQLFieldOptions;
222
308
 
223
- interface MiddlewarePayload<TField extends GenericFieldOrOperation = FieldOrOperation<any, any, any, any>> {
309
+ interface MiddlewareOptions<TField extends GenericFieldOrOperation = FieldOrOperation<any, any, any, any>> {
224
310
  /** The Output Silk of the field */
225
- outputSilk: InferSilkO<InferFieldOutput<TField>>;
311
+ outputSilk: StandardSchemaV1.InferOutput<InferFieldOutput<TField>>;
226
312
  /** The previous object, which for a field on the root Query type is often not used. */
227
- parent: TField extends FieldOrOperation<infer TParent, any, any, any> ? TParent extends undefined ? undefined : InferSilkO<NonNullable<TParent>> : never;
313
+ parent: TField extends FieldOrOperation<infer TParent, any, any, any> ? TParent extends undefined ? undefined : StandardSchemaV1.InferOutput<NonNullable<TParent>> : never;
228
314
  /** A function to parse the input of the field */
229
315
  parseInput: TField extends FieldOrOperation<any, any, infer TInput, any> ? CallableInputParser<TInput> : undefined;
230
316
  /** The type of the field: `query`, `mutation`, `subscription` or `field` */
231
317
  type: FieldOrOperationType;
232
318
  }
233
- type Middleware<TField extends GenericFieldOrOperation = FieldOrOperation<any, any, any, any>> = (next: () => MayPromise<InferSilkO<InferFieldOutput<TField>>>, payload: MiddlewarePayload<TField>) => MayPromise<InferSilkO<InferFieldOutput<TField>>>;
234
- declare function applyMiddlewares<TField extends GenericFieldOrOperation = FieldOrOperation<any, any, any, any>>(middlewares: Middleware[], resolveFunction: () => MayPromise<InferSilkO<InferFieldOutput<TField>>>, payload: MiddlewarePayload<TField>): Promise<InferSilkO<InferFieldOutput<TField>>>;
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>>>;
235
327
  declare function compose<T>(...lists: (T[] | undefined)[]): T[];
236
328
 
237
329
  /**
@@ -375,11 +467,11 @@ declare function markLocation(message: string, ...locations: string[]): string;
375
467
  /**
376
468
  * Create a Silk from Scalar.
377
469
  */
378
- declare function silk<TScalar extends GraphQLScalarType>(type: TScalar | (() => TScalar), parse?: (input: InferScalarExternal<TScalar>) => MayPromise<InferScalarInternal<TScalar>>): GraphQLSilk<InferScalarInternal<TScalar> | undefined, InferScalarInternal<TScalar> | undefined>;
470
+ 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>;
379
471
  /**
380
472
  * Create a GraphQLSilk Object.
381
473
  */
382
- declare function silk<TOutput, TInput = TOutput>(type: GraphQLOutputType | (() => GraphQLOutputType), parse?: (input: TInput) => MayPromise<TOutput>): GraphQLSilk<TOutput, TInput>;
474
+ declare function silk<TOutput, TInput = TOutput>(type: GraphQLOutputType | (() => GraphQLOutputType), validate?: (value: TInput) => StandardSchemaV1.Result<TOutput> | Promise<StandardSchemaV1.Result<TOutput>>): GraphQLSilk<TOutput, TInput>;
383
475
  declare namespace silk {
384
476
  var parse: typeof parseSilk;
385
477
  var getType: typeof getGraphQLType;
@@ -387,17 +479,17 @@ declare namespace silk {
387
479
  var list: typeof listSilk;
388
480
  var nullable: typeof nullableSilk;
389
481
  }
390
- type NonNullSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<NonNullable<InferSilkO<TSilk>>, NonNullable<InferSilkI<TSilk>>>;
482
+ type NonNullSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<NonNullable<StandardSchemaV1.InferOutput<TSilk>>, NonNullable<StandardSchemaV1.InferInput<TSilk>>>;
391
483
  /**
392
484
  * Non-nullable Silk.
393
485
  */
394
486
  declare function nonNullSilk<TSilk extends GraphQLSilk<any, any>>(origin: TSilk): NonNullSilk<TSilk>;
395
- type ListSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<EnsureArray<InferSilkO<TSilk>>, EnsureArray<InferSilkO<TSilk>>>;
487
+ type ListSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<EnsureArray<StandardSchemaV1.InferOutput<TSilk>>, EnsureArray<StandardSchemaV1.InferOutput<TSilk>>>;
396
488
  /**
397
489
  * List Silk.
398
490
  */
399
491
  declare function listSilk<TSilk extends GraphQLSilk<any, any>>(origin: TSilk): ListSilk<TSilk>;
400
- type NullableSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<InferSilkO<TSilk> | null | undefined, InferSilkI<TSilk>>;
492
+ type NullableSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<StandardSchemaV1.InferOutput<TSilk> | null | undefined, StandardSchemaV1.InferInput<TSilk>>;
401
493
  /**
402
494
  * Nullable Silk.
403
495
  */
@@ -414,20 +506,20 @@ declare function getGraphQLType(silk: GraphQLSilk): GraphQLOutputType;
414
506
  * @param input
415
507
  * @returns output
416
508
  */
417
- declare function parseSilk<TSilk extends GraphQLSilk>(silk: TSilk, input: InferSilkI<TSilk>): MayPromise<InferSilkO<TSilk>>;
509
+ declare function parseSilk<TSilk extends GraphQLSilk>(silk: TSilk, input: StandardSchemaV1.InferInput<TSilk>): MayPromise<StandardSchemaV1.Result<StandardSchemaV1.InferOutput<TSilk>>>;
418
510
  declare function isSilk(target: any): target is GraphQLSilk;
419
511
  type InferScalarInternal<T extends GraphQLScalarType> = T extends GraphQLScalarType<infer TInternal> ? TInternal : never;
420
512
  type InferScalarExternal<T extends GraphQLScalarType> = T extends GraphQLScalarType<any, infer TExternal> ? TExternal : never;
421
513
  type EnsureArray<T> = T extends Array<infer U> ? U[] : T[];
422
514
 
423
- declare const silkQuery: QueryFactory<GraphQLSilkIO>;
424
- declare const silkMutation: MutationFactory<GraphQLSilkIO>;
425
- declare const silkField: FieldFactoryWithUtils<GraphQLSilkIO>;
515
+ declare const query: QueryFactory<GraphQLSilkIO>;
516
+ declare const mutation: MutationFactory<GraphQLSilkIO>;
517
+ declare const field: FieldFactoryWithUtils<GraphQLSilkIO>;
426
518
  declare const defaultSubscriptionResolve: (source: any) => any;
427
- declare const silkSubscription: SubscriptionFactory<GraphQLSilkIO>;
519
+ declare const subscription: SubscriptionFactory<GraphQLSilkIO>;
428
520
  declare const ResolverOptionsMap: WeakMap<object, ResolverOptionsWithParent<GenericFieldOrOperation>>;
429
521
  declare function baseResolver(operations: Record<string, FieldOrOperation<any, any, any>>, options: ResolverOptionsWithParent | undefined): Record<string, FieldOrOperation<any, any, any, FieldOrOperationType>>;
430
- declare const silkResolver: ResolverFactory<GraphQLSilkIO>;
522
+ declare const resolver: ResolverFactory<GraphQLSilkIO>;
431
523
  declare const loom: {
432
524
  query: QueryFactory<GraphQLSilkIO>;
433
525
  resolver: ResolverFactory<GraphQLSilkIO>;
@@ -449,6 +541,12 @@ declare function createLoom<TSchemaIO extends AbstractSchemaIO>(toSilk: (schema:
449
541
  subscription: SubscriptionFactory<TSchemaIO>;
450
542
  };
451
543
 
544
+ interface SchemaVendorWeaver {
545
+ vendor: string;
546
+ getGraphQLType: (schema: any) => GraphQLOutputType;
547
+ }
548
+ declare function isSchemaVendorWeaver(some: any): some is SchemaVendorWeaver;
549
+
452
550
  interface WeaverContext {
453
551
  id: number;
454
552
  loomObjectMap: Map<GraphQLObjectType, LoomObjectType>;
@@ -463,9 +561,11 @@ interface WeaverContext {
463
561
  memoNamedType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(gqlType: TGraphQLType): TGraphQLType;
464
562
  getNamedType<T extends GraphQLOutputType>(name: string): T | undefined;
465
563
  names: WeakMap<object, string>;
564
+ vendorWeavers: Map<string, SchemaVendorWeaver>;
466
565
  }
467
566
  interface WeaverConfig {
468
567
  [WEAVER_CONFIG]: string | symbol;
568
+ vendorWeaver?: SchemaVendorWeaver;
469
569
  }
470
570
  declare function initWeaverContext(): WeaverContext;
471
571
  declare namespace initWeaverContext {
@@ -547,7 +647,7 @@ declare class SchemaWeaver {
547
647
  query?: LoomObjectType;
548
648
  mutation?: LoomObjectType;
549
649
  subscription?: LoomObjectType;
550
- types?: GraphQLNamedType[] | null;
650
+ types: Set<GraphQLNamedType>;
551
651
  context: WeaverContext;
552
652
  resolverOptions?: ResolvingOptions;
553
653
  /**
@@ -559,6 +659,7 @@ declare class SchemaWeaver {
559
659
  constructor({ query, mutation, subscription, types }?: SchemaWeaverParameters, context?: WeaverContext);
560
660
  use(...middlewares: Middleware[]): this;
561
661
  add(resolver: SilkResolver): this;
662
+ addVendor(weaver: SchemaVendorWeaver): this;
562
663
  addType(silk: GraphQLSilk): this;
563
664
  setConfig<TConfig extends WeaverConfig>(config: TConfig): this;
564
665
  weaveGraphQLSchema(): GraphQLSchema;
@@ -568,19 +669,20 @@ declare class SchemaWeaver {
568
669
  resolverOptions: ResolvingOptions | undefined;
569
670
  weaverContext: WeaverContext;
570
671
  };
571
- static optionsFrom(...inputs: (SilkResolver | Middleware | WeaverConfig | GraphQLSilk)[]): {
672
+ static optionsFrom(...inputs: (SilkResolver | Middleware | SchemaVendorWeaver | WeaverConfig | GraphQLSilk)[]): {
572
673
  context: WeaverContext | undefined;
573
674
  configs: Set<WeaverConfig>;
574
675
  middlewares: Set<Middleware>;
575
676
  resolvers: Set<SilkResolver>;
576
677
  silks: Set<GraphQLSilk<any, any>>;
678
+ weavers: Set<SchemaVendorWeaver>;
577
679
  };
578
680
  /**
579
681
  * Weave a GraphQL Schema from resolvers
580
682
  * @param inputs Resolvers, Global Middlewares or WeaverConfigs
581
683
  * @returns GraphQ LSchema
582
684
  */
583
- static weave(...inputs: (SilkResolver | Middleware | WeaverConfig | GraphQLSilk)[]): GraphQLSchema;
685
+ static weave(...inputs: (SilkResolver | Middleware | SchemaVendorWeaver | WeaverConfig | GraphQLSilk)[]): GraphQLSchema;
584
686
  }
585
687
  /**
586
688
  * Weave a GraphQL Schema from resolvers
@@ -609,4 +711,4 @@ interface GQLoomExtensionAttribute {
609
711
  directives?: string[];
610
712
  }
611
713
 
612
- 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 InferSilkI, type InferSilkO, type InputSchema, type InputSchemaToSilk, type IsAny, type ListSilk, LoomObjectType, type MayPromise, type Middleware, type MiddlewarePayload, type MutationFactory, type NonNullSilk, type NullableSilk, 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, SchemaWeaver, type SilkFieldOrOperation, type SilkResolver, 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, getCacheType, getFieldOptions, getGraphQLType, getOperationOptions, getSubscriptionOptions, initWeaverContext, inputToArgs, isOnlyMemoryPayload, isSilk, listSilk, loom, mapValue, markErrorLocation, markLocation, nonNullSilk, notNullish, nullableSilk, onlyMemoization, parseInputValue, parseSilk, provideWeaverContext, resolverPayloadStorage, silk, silkField, silkMutation, silkQuery, silkResolver, silkSubscription, toObjMap, tryIn, useContext, useMemoizationMap, useResolverPayload, weave, weaverContext };
714
+ 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, 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, 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 SchemaVendorWeaver, 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, provideWeaverContext, query, resolver, resolverPayloadStorage, silk, subscription, toObjMap, tryIn, useContext, useMemoizationMap, useResolverPayload, weave, weaverContext };