@gqloom/core 0.3.0 → 0.4.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,108 @@
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
+ declare namespace v1 {
5
+ /**
6
+ * The Standard Schema interface.
7
+ */
8
+ interface StandardSchema<Input = unknown, Output = Input> {
9
+ /**
10
+ * The Standard Schema properties.
11
+ */
12
+ readonly "~standard": StandardSchemaProps<Input, Output>;
13
+ }
14
+ /**
15
+ * The Standard Schema properties interface.
16
+ */
17
+ interface StandardSchemaProps<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) => StandardResult<Output> | Promise<StandardResult<Output>>;
30
+ /**
31
+ * Inferred types associated with the schema.
32
+ */
33
+ readonly types?: StandardTypes<Input, Output> | undefined;
34
+ }
35
+ /**
36
+ * The result interface of the validate function.
37
+ */
38
+ type StandardResult<Output> = StandardSuccessResult<Output> | StandardFailureResult;
39
+ /**
40
+ * The result interface if validation succeeds.
41
+ */
42
+ interface StandardSuccessResult<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
+ interface StandardFailureResult {
56
+ /**
57
+ * The issues of failed validation.
58
+ */
59
+ readonly issues: ReadonlyArray<StandardIssue>;
60
+ }
61
+ /**
62
+ * The issue interface of the failure output.
63
+ */
64
+ interface StandardIssue {
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 | StandardPathSegment> | undefined;
73
+ }
74
+ /**
75
+ * The path segment interface of the issue.
76
+ */
77
+ interface StandardPathSegment {
78
+ /**
79
+ * The key representing a path segment.
80
+ */
81
+ readonly key: PropertyKey;
82
+ }
83
+ /**
84
+ * The base types interface of Standard Schema.
85
+ */
86
+ interface StandardTypes<Input, Output> {
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
+ type InferInput<Schema extends StandardSchema> = NonNullable<Schema["~standard"]["types"]>["input"];
100
+ /**
101
+ * Infers the output type of a Standard Schema.
102
+ */
103
+ type InferOutput<Schema extends StandardSchema> = NonNullable<Schema["~standard"]["types"]>["output"];
104
+ }
105
+
4
106
  type MayPromise<T> = T | Promise<T>;
5
107
  type IsAny<T> = 0 extends 1 & T ? true : false;
6
108
  /**
@@ -28,45 +130,10 @@ type WrapPropertyType<TKey extends string, TProperty> = TKey extends `${infer TF
28
130
  type ObjectOrNever<T> = T extends object ? T : never;
29
131
  type ValueOf<T extends object> = T[keyof T];
30
132
 
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
133
  /**
63
134
  * The symbol to get GraphQL type for schema
64
135
  */
65
136
  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
137
  /**
71
138
  * The symbol to get and store weaver config
72
139
  */
@@ -87,31 +154,51 @@ declare const FIELD_HIDDEN: unique symbol;
87
154
  declare const symbols_CONTEXT_MEMORY_MAP_KEY: typeof CONTEXT_MEMORY_MAP_KEY;
88
155
  declare const symbols_FIELD_HIDDEN: typeof FIELD_HIDDEN;
89
156
  declare const symbols_GET_GRAPHQL_TYPE: typeof GET_GRAPHQL_TYPE;
90
- declare const symbols_PARSE: typeof PARSE;
91
157
  declare const symbols_RESOLVER_OPTIONS_KEY: typeof RESOLVER_OPTIONS_KEY;
92
158
  declare const symbols_WEAVER_CONFIG: typeof WEAVER_CONFIG;
93
159
  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 };
160
+ 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
161
  }
96
162
 
97
- interface GraphQLSilk<TOutput = any, TInput = any> {
163
+ type InputSchema<TBaseSchema> = TBaseSchema | Record<string, TBaseSchema> | undefined;
164
+ type InputSchemaToSilk<TSchemaIO extends AbstractSchemaIO, TInput extends InputSchema<TSchemaIO[0]>> = TInput extends undefined ? undefined : TInput extends TSchemaIO[0] ? SchemaToSilk<TSchemaIO, TInput> : {
165
+ [K in keyof TInput]: TInput[K] extends TSchemaIO[0] ? SchemaToSilk<TSchemaIO, TInput[K]> : never;
166
+ };
167
+ type InferInputI<TInput extends object | undefined, TSchemaIO extends AbstractSchemaIO> = TInput extends undefined ? undefined : TInput extends TSchemaIO[0] ? ObjectOrNever<InferSchemaI<TInput, TSchemaIO>> : {
168
+ [K in keyof TInput]: InferSchemaI<TInput[K], TSchemaIO>;
169
+ };
170
+ type InferInputO<TInput extends object | undefined, TSchemaIO extends AbstractSchemaIO> = TInput extends undefined ? undefined : TInput extends TSchemaIO[0] ? ObjectOrNever<InferSchemaO<TInput, TSchemaIO>> : {
171
+ [K in keyof TInput]: InferSchemaO<TInput[K], TSchemaIO>;
172
+ };
173
+ interface CallableInputParser<TSchema extends InputSchema<GraphQLSilk>> {
98
174
  /**
99
- * GraphQL type for schema
175
+ * input schema
100
176
  */
101
- [GET_GRAPHQL_TYPE]: () => GraphQLOutputType;
177
+ schema: TSchema;
102
178
  /**
103
- * validate and transform input to output
179
+ * Origin value to parse
104
180
  */
105
- [PARSE]?: (input: TInput) => MayPromise<TOutput>;
181
+ value: InferInputI<TSchema, GraphQLSilkIO>;
106
182
  /**
107
- * Input and output type.
108
- *
109
- * @internal
183
+ * Parse the input and return the
110
184
  */
111
- readonly "~types"?: {
112
- readonly input: TInput;
113
- readonly output: TOutput;
114
- };
185
+ (): Promise<v1.StandardResult<InferInputO<TSchema, GraphQLSilkIO>>>;
186
+ /**
187
+ * Result of parsing. Set it to `undefined` then the parser will run again.
188
+ */
189
+ result: v1.StandardResult<InferInputO<TSchema, GraphQLSilkIO>> | undefined;
190
+ }
191
+ 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<v1.StandardResult<InferInputO<TSchema, GraphQLSilkIO>>>;
193
+ declare function getStandardValue<T>(result: v1.StandardResult<T>): T;
194
+ declare function getStandardValue<T>(result?: v1.StandardResult<T>): T | undefined;
195
+ declare function getStandardValue<T>(result: v1.StandardResult<T> | null): T | null;
196
+
197
+ interface GraphQLSilk<TOutput = any, TInput = any> extends v1.StandardSchema<TInput, TOutput> {
198
+ /**
199
+ * GraphQL type for schema
200
+ */
201
+ [GET_GRAPHQL_TYPE]?: () => GraphQLOutputType;
115
202
  }
116
203
  type AbstractSchemaIO = [
117
204
  baseSchema: object,
@@ -120,11 +207,9 @@ type AbstractSchemaIO = [
120
207
  ];
121
208
  type GraphQLSilkIO = [
122
209
  object: GraphQLSilk,
123
- input: "~types.input",
124
- output: "~types.output"
210
+ input: "~standard.types.input",
211
+ output: "~standard.types.output"
125
212
  ];
126
- type InferSilkI<T extends GraphQLSilk> = NonNullable<T["~types"]>["input"];
127
- type InferSilkO<T extends GraphQLSilk> = NonNullable<T["~types"]>["output"];
128
213
  type InferSchemaI<TSchema, TSchemaIO extends AbstractSchemaIO> = InferPropertyType<TSchema, TSchemaIO[1]>;
129
214
  type InferSchemaO<TSchema, TSchemaIO extends AbstractSchemaIO> = InferPropertyType<TSchema, TSchemaIO[2]>;
130
215
  type SchemaToSilk<TSchemaIO extends AbstractSchemaIO, TSchema extends TSchemaIO[0]> = GraphQLSilk<InferSchemaO<TSchema, TSchemaIO>, InferSchemaI<TSchema, TSchemaIO>>;
@@ -149,7 +234,7 @@ interface FieldOrOperation<TParent extends undefined | GraphQLSilk, TOutput exte
149
234
  type: TType;
150
235
  input: TInput;
151
236
  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>>;
237
+ resolve: TType extends "field" ? (parent: v1.InferOutput<NonNullable<TParent>>, input: InferInputI<TInput, GraphQLSilkIO>, options?: ResolvingOptions) => Promise<v1.InferOutput<TOutput>> : TType extends "subscription" ? (value: any, input: InferInputI<TInput, GraphQLSilkIO>) => Promise<v1.InferOutput<TOutput>> : (input: InferInputI<TInput, GraphQLSilkIO>, options?: ResolvingOptions) => Promise<v1.InferOutput<TOutput>>;
153
238
  subscribe?: TType extends "subscription" ? (input: InferInputI<TInput, GraphQLSilkIO>, options?: ResolvingOptions) => MayPromise<AsyncIterator<any>> : undefined;
154
239
  }
155
240
  type GenericFieldOrOperation = FieldOrOperation<any, any, any, any>;
@@ -200,8 +285,8 @@ interface SubscriptionOptions<TSchemaIO extends AbstractSchemaIO, TOutput extend
200
285
  subscribe: (input: InferInputO<TInput, TSchemaIO>) => MayPromise<AsyncIterator<TValue>>;
201
286
  resolve?: (value: TValue, input: InferInputO<TInput, TSchemaIO>) => MayPromise<InferSchemaO<TOutput, TSchemaIO>>;
202
287
  }
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>>;
288
+ interface Subscription<TOutput extends GraphQLSilk, TInput extends InputSchema<GraphQLSilk> = undefined, TValue = v1.InferOutput<TOutput>> extends FieldOrOperation<undefined, TOutput, TInput, "subscription"> {
289
+ resolve: (value: TValue, input: InferInputI<TInput, GraphQLSilkIO>) => Promise<v1.InferOutput<TOutput>>;
205
290
  subscribe: (input: InferInputI<TInput, GraphQLSilkIO>, options?: ResolvingOptions) => MayPromise<AsyncIterator<TValue>>;
206
291
  }
207
292
  /**
@@ -222,16 +307,16 @@ declare function getFieldOptions({ description, deprecationReason, extensions, }
222
307
 
223
308
  interface MiddlewarePayload<TField extends GenericFieldOrOperation = FieldOrOperation<any, any, any, any>> {
224
309
  /** The Output Silk of the field */
225
- outputSilk: InferSilkO<InferFieldOutput<TField>>;
310
+ outputSilk: v1.InferOutput<InferFieldOutput<TField>>;
226
311
  /** 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;
312
+ parent: TField extends FieldOrOperation<infer TParent, any, any, any> ? TParent extends undefined ? undefined : v1.InferOutput<NonNullable<TParent>> : never;
228
313
  /** A function to parse the input of the field */
229
314
  parseInput: TField extends FieldOrOperation<any, any, infer TInput, any> ? CallableInputParser<TInput> : undefined;
230
315
  /** The type of the field: `query`, `mutation`, `subscription` or `field` */
231
316
  type: FieldOrOperationType;
232
317
  }
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>>>;
318
+ type Middleware<TField extends GenericFieldOrOperation = FieldOrOperation<any, any, any, any>> = (next: () => MayPromise<v1.InferOutput<InferFieldOutput<TField>>>, payload: MiddlewarePayload<TField>) => MayPromise<v1.InferOutput<InferFieldOutput<TField>>>;
319
+ declare function applyMiddlewares<TField extends GenericFieldOrOperation = FieldOrOperation<any, any, any, any>>(middlewares: Middleware[], resolveFunction: () => MayPromise<v1.InferOutput<InferFieldOutput<TField>>>, payload: MiddlewarePayload<TField>): Promise<v1.InferOutput<InferFieldOutput<TField>>>;
235
320
  declare function compose<T>(...lists: (T[] | undefined)[]): T[];
236
321
 
237
322
  /**
@@ -375,11 +460,11 @@ declare function markLocation(message: string, ...locations: string[]): string;
375
460
  /**
376
461
  * Create a Silk from Scalar.
377
462
  */
378
- declare function silk<TScalar extends GraphQLScalarType>(type: TScalar | (() => TScalar), parse?: (input: InferScalarExternal<TScalar>) => MayPromise<InferScalarInternal<TScalar>>): GraphQLSilk<InferScalarInternal<TScalar> | undefined, InferScalarInternal<TScalar> | undefined>;
463
+ declare function silk<TScalar extends GraphQLScalarType>(type: TScalar | (() => TScalar), parse?: (value: InferScalarExternal<TScalar>) => v1.StandardResult<InferScalarExternal<TScalar>> | Promise<v1.StandardResult<InferScalarInternal<TScalar>>>): GraphQLSilk<InferScalarInternal<TScalar> | undefined, InferScalarInternal<TScalar> | undefined>;
379
464
  /**
380
465
  * Create a GraphQLSilk Object.
381
466
  */
382
- declare function silk<TOutput, TInput = TOutput>(type: GraphQLOutputType | (() => GraphQLOutputType), parse?: (input: TInput) => MayPromise<TOutput>): GraphQLSilk<TOutput, TInput>;
467
+ declare function silk<TOutput, TInput = TOutput>(type: GraphQLOutputType | (() => GraphQLOutputType), validate?: (value: TInput) => v1.StandardResult<TOutput> | Promise<v1.StandardResult<TOutput>>): GraphQLSilk<TOutput, TInput>;
383
468
  declare namespace silk {
384
469
  var parse: typeof parseSilk;
385
470
  var getType: typeof getGraphQLType;
@@ -387,17 +472,17 @@ declare namespace silk {
387
472
  var list: typeof listSilk;
388
473
  var nullable: typeof nullableSilk;
389
474
  }
390
- type NonNullSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<NonNullable<InferSilkO<TSilk>>, NonNullable<InferSilkI<TSilk>>>;
475
+ type NonNullSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<NonNullable<v1.InferOutput<TSilk>>, NonNullable<v1.InferInput<TSilk>>>;
391
476
  /**
392
477
  * Non-nullable Silk.
393
478
  */
394
479
  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>>>;
480
+ type ListSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<EnsureArray<v1.InferOutput<TSilk>>, EnsureArray<v1.InferOutput<TSilk>>>;
396
481
  /**
397
482
  * List Silk.
398
483
  */
399
484
  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>>;
485
+ type NullableSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<v1.InferOutput<TSilk> | null | undefined, v1.InferInput<TSilk>>;
401
486
  /**
402
487
  * Nullable Silk.
403
488
  */
@@ -414,20 +499,20 @@ declare function getGraphQLType(silk: GraphQLSilk): GraphQLOutputType;
414
499
  * @param input
415
500
  * @returns output
416
501
  */
417
- declare function parseSilk<TSilk extends GraphQLSilk>(silk: TSilk, input: InferSilkI<TSilk>): MayPromise<InferSilkO<TSilk>>;
502
+ declare function parseSilk<TSilk extends GraphQLSilk>(silk: TSilk, input: v1.InferInput<TSilk>): MayPromise<v1.StandardResult<v1.InferOutput<TSilk>>>;
418
503
  declare function isSilk(target: any): target is GraphQLSilk;
419
504
  type InferScalarInternal<T extends GraphQLScalarType> = T extends GraphQLScalarType<infer TInternal> ? TInternal : never;
420
505
  type InferScalarExternal<T extends GraphQLScalarType> = T extends GraphQLScalarType<any, infer TExternal> ? TExternal : never;
421
506
  type EnsureArray<T> = T extends Array<infer U> ? U[] : T[];
422
507
 
423
- declare const silkQuery: QueryFactory<GraphQLSilkIO>;
424
- declare const silkMutation: MutationFactory<GraphQLSilkIO>;
425
- declare const silkField: FieldFactoryWithUtils<GraphQLSilkIO>;
508
+ declare const query: QueryFactory<GraphQLSilkIO>;
509
+ declare const mutation: MutationFactory<GraphQLSilkIO>;
510
+ declare const field: FieldFactoryWithUtils<GraphQLSilkIO>;
426
511
  declare const defaultSubscriptionResolve: (source: any) => any;
427
- declare const silkSubscription: SubscriptionFactory<GraphQLSilkIO>;
512
+ declare const subscription: SubscriptionFactory<GraphQLSilkIO>;
428
513
  declare const ResolverOptionsMap: WeakMap<object, ResolverOptionsWithParent<GenericFieldOrOperation>>;
429
514
  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>;
515
+ declare const resolver: ResolverFactory<GraphQLSilkIO>;
431
516
  declare const loom: {
432
517
  query: QueryFactory<GraphQLSilkIO>;
433
518
  resolver: ResolverFactory<GraphQLSilkIO>;
@@ -449,6 +534,12 @@ declare function createLoom<TSchemaIO extends AbstractSchemaIO>(toSilk: (schema:
449
534
  subscription: SubscriptionFactory<TSchemaIO>;
450
535
  };
451
536
 
537
+ interface SchemaVendorWeaver {
538
+ vendor: string;
539
+ getGraphQLType: (schema: any) => GraphQLOutputType;
540
+ }
541
+ declare function isSchemaVendorWeaver(some: any): some is SchemaVendorWeaver;
542
+
452
543
  interface WeaverContext {
453
544
  id: number;
454
545
  loomObjectMap: Map<GraphQLObjectType, LoomObjectType>;
@@ -463,9 +554,11 @@ interface WeaverContext {
463
554
  memoNamedType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(gqlType: TGraphQLType): TGraphQLType;
464
555
  getNamedType<T extends GraphQLOutputType>(name: string): T | undefined;
465
556
  names: WeakMap<object, string>;
557
+ vendorWeavers: Map<string, SchemaVendorWeaver>;
466
558
  }
467
559
  interface WeaverConfig {
468
560
  [WEAVER_CONFIG]: string | symbol;
561
+ vendorWeaver?: SchemaVendorWeaver;
469
562
  }
470
563
  declare function initWeaverContext(): WeaverContext;
471
564
  declare namespace initWeaverContext {
@@ -559,6 +652,7 @@ declare class SchemaWeaver {
559
652
  constructor({ query, mutation, subscription, types }?: SchemaWeaverParameters, context?: WeaverContext);
560
653
  use(...middlewares: Middleware[]): this;
561
654
  add(resolver: SilkResolver): this;
655
+ addVendor(weaver: SchemaVendorWeaver): this;
562
656
  addType(silk: GraphQLSilk): this;
563
657
  setConfig<TConfig extends WeaverConfig>(config: TConfig): this;
564
658
  weaveGraphQLSchema(): GraphQLSchema;
@@ -568,19 +662,20 @@ declare class SchemaWeaver {
568
662
  resolverOptions: ResolvingOptions | undefined;
569
663
  weaverContext: WeaverContext;
570
664
  };
571
- static optionsFrom(...inputs: (SilkResolver | Middleware | WeaverConfig | GraphQLSilk)[]): {
665
+ static optionsFrom(...inputs: (SilkResolver | Middleware | SchemaVendorWeaver | WeaverConfig | GraphQLSilk)[]): {
572
666
  context: WeaverContext | undefined;
573
667
  configs: Set<WeaverConfig>;
574
668
  middlewares: Set<Middleware>;
575
669
  resolvers: Set<SilkResolver>;
576
670
  silks: Set<GraphQLSilk<any, any>>;
671
+ weavers: Set<SchemaVendorWeaver>;
577
672
  };
578
673
  /**
579
674
  * Weave a GraphQL Schema from resolvers
580
675
  * @param inputs Resolvers, Global Middlewares or WeaverConfigs
581
676
  * @returns GraphQ LSchema
582
677
  */
583
- static weave(...inputs: (SilkResolver | Middleware | WeaverConfig | GraphQLSilk)[]): GraphQLSchema;
678
+ static weave(...inputs: (SilkResolver | Middleware | SchemaVendorWeaver | WeaverConfig | GraphQLSilk)[]): GraphQLSchema;
584
679
  }
585
680
  /**
586
681
  * Weave a GraphQL Schema from resolvers
@@ -609,4 +704,4 @@ interface GQLoomExtensionAttribute {
609
704
  directives?: string[];
610
705
  }
611
706
 
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 };
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 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, type SchemaVendorWeaver, 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, 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, v1, weave, weaverContext };