@gqloom/core 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,484 +1,2 @@
1
- import { F as FieldOptions, Q as QueryOptions, M as MutationOptions, R as ResolverPayload, S as SubscriptionOptions, G as GraphQLFieldOptions, a as StandardSchemaV1, b as GraphQLSilk, c as MayPromise, d as Query, e as QueryChainFactory, f as QueryFactoryWithChain, g as Mutation, h as MutationChainFactory, i as MutationFactoryWithChain, j as Field, k as FieldChainFactory, l as FieldFactoryWithUtils, m as SubscriptionChainFactory, n as Subscription, o as SubscriptionFactoryWithChain, O as Operation, p as FIELD_HIDDEN, q as ResolverOptionsWithExtensions, r as OmitInUnion, V as ValueOf, s as ResolverOptions, t as FieldOrOperation, u as Resolver, I as IS_RESOLVER, v as Middleware, w as InferInputI, W as WEAVER_CONFIG, B as BaseField } from './context-uzUlbx3r.cjs';
2
- export { $ as BaseChainFactory, ai as CallableInputParser, D as CallableMiddlewareOptions, _ as ChainFactoryOptions, ae as FieldFactory, a4 as FieldFactoryWithResolve, ag as FieldMeta, a9 as FieldOrOperationType, Z as IChainFactory, aa as InferFieldInput, ab as InferFieldOutput, ah as InferInputO, y as IsAny, a5 as Loom, E as MiddlewareConfig, A as MiddlewareOperation, C as MiddlewareOptions, ad as MutationFactory, a3 as MutationFactoryWithResolve, P as OnlyMemoizationPayload, a8 as OperationType, ac as QueryFactory, a2 as QueryFactoryWithResolve, z as RequireKeys, a0 as ResolvableSubscription, a6 as ResolverOptionsWithParent, K as ResolvingFields, a7 as ResolvingOptions, x as SYMBOLS, af as SubscriptionFactory, a1 as SubscriptionNeedResolve, H as applyMiddlewares, Y as assignContextMap, aj as createInputParser, J as filterMiddlewares, X as getMemoizationMap, L as getResolvingFields, al as getStandardValue, U as isOnlyMemoryPayload, T as onlyMemoization, ak as parseInputValue, N as parseResolvingFields } from './context-uzUlbx3r.cjs';
3
- import { GraphQLFieldExtensions, GraphQLScalarType, GraphQLObjectType, GraphQLOutputType, GraphQLNullableType, GraphQLList, GraphQLNonNull, GraphQLObjectTypeConfig, GraphQLUnionType, GraphQLInterfaceType, GraphQLInputObjectType, GraphQLFieldMap, GraphQLFieldConfig, GraphQLSchemaConfig, GraphQLNamedType, GraphQLSchema, GraphQLFieldConfigArgumentMap, GraphQLType, GraphQLInputType, GraphQLInterfaceTypeConfig } from 'graphql';
4
-
5
- declare function getOperationOptions(resolveOrOptions: ((...args: any) => any) | FieldOptions<any, any, any, any> | QueryOptions<any, any> | MutationOptions<any, any>): any;
6
- declare function getSubscriptionOptions(subscribeOrOptions: ((payload: ResolverPayload | undefined) => any) | SubscriptionOptions<any, any, any>): SubscriptionOptions<any, any, any>;
7
- declare function getFieldOptions({ description, deprecationReason, extensions }: GraphQLFieldOptions, extraExtensions?: GraphQLFieldExtensions<any, any, any>): GraphQLFieldOptions;
8
-
9
- /**
10
- * Create a Silk from Scalar.
11
- */
12
- declare function silk<TScalar extends GraphQLVariants<GraphQLScalarType>>(type: TScalar | (() => TScalar), validate?: (value: InferScalarExternalByVariants<TScalar>) => StandardSchemaV1.Result<InferScalarExternalByVariants<TScalar>> | Promise<StandardSchemaV1.Result<InferScalarInternalByVariants<TScalar>>>): GraphQLSilk<InferScalarInternalByVariants<TScalar>, InferScalarInternalByVariants<TScalar>>;
13
- /**
14
- * Create a GraphQLSilk Object.
15
- */
16
- declare function silk<TObject extends GraphQLVariants<GraphQLObjectType>>(type: TObject | (() => TObject), validate?: (value: InferObjectSourceByVariants<TObject>) => StandardSchemaV1.Result<InferObjectSourceByVariants<TObject>> | Promise<StandardSchemaV1.Result<InferObjectSourceByVariants<TObject>>>): GraphQLSilk<InferObjectSourceByVariants<TObject>, InferObjectSourceByVariants<TObject>>;
17
- /**
18
- * Create a GraphQLSilk Object.
19
- */
20
- declare function silk<TOutput, TInput = TOutput>(type: GraphQLOutputType | (() => GraphQLOutputType), validate?: (value: TInput) => StandardSchemaV1.Result<TOutput> | Promise<StandardSchemaV1.Result<TOutput>>): GraphQLSilk<TOutput, TInput>;
21
- declare namespace silk {
22
- var parse: typeof parseSilk;
23
- var getType: typeof getGraphQLType;
24
- var nonNull: typeof nonNullSilk;
25
- var list: typeof listSilk;
26
- var nullable: typeof nullableSilk;
27
- }
28
- type NonNullSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<NonNullable<StandardSchemaV1.InferOutput<TSilk>>, NonNullable<StandardSchemaV1.InferInput<TSilk>>>;
29
- /**
30
- * Non-nullable Silk.
31
- */
32
- declare function nonNullSilk<TSilk extends GraphQLSilk<any, any>>(origin: TSilk): NonNullSilk<TSilk>;
33
- type ListSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<EnsureArray<StandardSchemaV1.InferOutput<TSilk>>, EnsureArray<StandardSchemaV1.InferOutput<TSilk>>>;
34
- /**
35
- * List Silk.
36
- */
37
- declare function listSilk<TSilk extends GraphQLSilk<any, any>>(origin: TSilk): ListSilk<TSilk>;
38
- type NullableSilk<TSilk extends GraphQLSilk<any, any>> = GraphQLSilk<StandardSchemaV1.InferOutput<TSilk> | null | undefined, StandardSchemaV1.InferInput<TSilk>>;
39
- /**
40
- * Nullable Silk.
41
- */
42
- declare function nullableSilk<TSilk extends GraphQLSilk<any, any>>(origin: TSilk): NullableSilk<TSilk>;
43
- /**
44
- * Get GraphQL Output Type from Silk.
45
- * @param silk GraphQL Silk
46
- * @returns GraphQL Output Type
47
- */
48
- declare function getGraphQLType(silk: GraphQLSilk): GraphQLOutputType;
49
- /**
50
- * Validate and transform input to output
51
- * @param silk silk GraphQL Silk
52
- * @param input
53
- * @returns output
54
- */
55
- declare function parseSilk<TSilk extends GraphQLSilk>(silk: TSilk, input: StandardSchemaV1.InferInput<TSilk>): MayPromise<StandardSchemaV1.Result<StandardSchemaV1.InferOutput<TSilk>>>;
56
- declare function isSilk(target: any): target is GraphQLSilk;
57
- type GraphQLVariants<TSource extends GraphQLNullableType> = TSource | GraphQLList<TSource> | GraphQLList<GraphQLNonNull<TSource>> | GraphQLNonNull<TSource> | GraphQLNonNull<GraphQLList<TSource>> | GraphQLNonNull<GraphQLList<GraphQLNonNull<TSource>>>;
58
- type InferScalarInternalByVariants<T extends GraphQLVariants<GraphQLScalarType>> = T extends GraphQLNonNull<infer U> ? U extends GraphQLVariants<GraphQLScalarType> ? NonNullable<InferScalarInternalByVariants<U>> : never : T extends GraphQLList<infer U> ? U extends GraphQLVariants<GraphQLScalarType> ? InferScalarInternalByVariants<U>[] : never : T extends GraphQLScalarType<infer TInternal, any> ? TInternal | null | undefined : never;
59
- type InferScalarExternalByVariants<T extends GraphQLVariants<GraphQLScalarType>> = T extends GraphQLNonNull<infer U> ? U extends GraphQLVariants<GraphQLScalarType> ? NonNullable<InferScalarExternalByVariants<U>> : never : T extends GraphQLList<infer U> ? U extends GraphQLVariants<GraphQLScalarType> ? InferScalarExternalByVariants<U>[] : never : T extends GraphQLScalarType<any, infer TExternal> ? TExternal | null | undefined : never;
60
- type InferObjectSourceByVariants<T extends GraphQLVariants<GraphQLObjectType>> = T extends GraphQLNonNull<infer U> ? U extends GraphQLVariants<GraphQLObjectType> ? NonNullable<InferObjectSourceByVariants<U>> : never : T extends GraphQLList<infer U> ? U extends GraphQLVariants<GraphQLObjectType> ? InferObjectSourceByVariants<U>[] : never : T extends GraphQLObjectType<infer TSource> ? TSource | null | undefined : never;
61
- type EnsureArray<T> = T extends Array<infer U> ? U[] : T[];
62
-
63
- /**
64
- * Creates a GraphQL query resolver
65
- * @param output - The output type definition for the query
66
- * @param resolveOrOptions - Either a resolve function or options object
67
- * @returns A GraphQL query resolver
68
- */
69
- declare const createQuery: (output: GraphQLSilk<any, any>, resolveOrOptions?: ((...args: any) => MayPromise<unknown>) | QueryOptions<any, any>) => Query<any, any> | QueryChainFactory<never, void>;
70
- /**
71
- * Factory function for creating GraphQL queries with chainable configuration
72
- */
73
- declare const query: QueryFactoryWithChain;
74
- /**
75
- * Creates a GraphQL mutation resolver
76
- * @param output - The output type definition for the mutation
77
- * @param resolveOrOptions - Either a resolve function or options object
78
- * @returns A GraphQL mutation resolver
79
- */
80
- declare const createMutation: (output: GraphQLSilk<any, any>, resolveOrOptions?: (() => MayPromise<unknown>) | MutationOptions<any, any>) => Mutation<any, any> | MutationChainFactory<never, undefined>;
81
- /**
82
- * Factory function for creating GraphQL mutations with chainable configuration
83
- */
84
- declare const mutation: MutationFactoryWithChain;
85
- /**
86
- * Creates a GraphQL field resolver
87
- * @param output - The output type definition for the field
88
- * @param resolveOrOptions - Either a resolve function or options object
89
- * @returns A GraphQL field resolver
90
- */
91
- declare const createField: (output: GraphQLSilk<any, any>, resolveOrOptions?: (() => unknown) | FieldOptions<GraphQLSilk, GraphQLSilk, GraphQLSilk | Record<string, GraphQLSilk> | void, string[] | undefined>) => Field<any, any, any, any> | FieldChainFactory<never, undefined, undefined>;
92
- /**
93
- * Factory function for creating GraphQL fields with chainable configuration
94
- */
95
- declare const field: FieldFactoryWithUtils;
96
- /**
97
- * Default subscription resolver that returns the source value
98
- * @param source - The source value to resolve
99
- */
100
- declare const defaultSubscriptionResolve: (source: any) => any;
101
- /**
102
- * Creates a GraphQL subscription resolver
103
- * @param output - The output type definition for the subscription
104
- * @returns A subscription chain factory
105
- */
106
- declare function createSubscription(output: GraphQLSilk<any, any>): SubscriptionChainFactory;
107
- /**
108
- * Creates a GraphQL subscription resolver with subscribe function
109
- * @param output - The output type definition for the subscription
110
- * @param subscribeOrOptions - Either a subscribe function or options object
111
- * @returns A GraphQL subscription resolver
112
- */
113
- declare function createSubscription(output: GraphQLSilk<any, any>, subscribeOrOptions: (() => MayPromise<AsyncIterator<unknown>>) | SubscriptionOptions<any, any, any>): Subscription<any, any, any>;
114
- /**
115
- * Factory function for creating GraphQL subscriptions with chainable configuration
116
- */
117
- declare const subscription: SubscriptionFactoryWithChain;
118
- declare const resolver: ResolverFactory;
119
- /**
120
- * Collection of factory functions for creating GraphQL operations
121
- */
122
- declare const loom: {
123
- query: QueryFactoryWithChain;
124
- resolver: ResolverFactory;
125
- field: FieldFactoryWithUtils;
126
- subscription: SubscriptionFactoryWithChain;
127
- mutation: MutationFactoryWithChain;
128
- };
129
- /**
130
- * Properties for creating an executor
131
- */
132
- interface ToExecutorProps {
133
- /** WeakMap for memoization */
134
- memoization?: WeakMap<WeakKey, any>;
135
- }
136
- /**
137
- * Factory interface for creating GraphQL resolvers
138
- */
139
- interface ResolverFactory {
140
- /**
141
- * Creates a resolver for an object type
142
- * @template TParent - The parent type
143
- * @template TFields - The fields of the object type
144
- * @param parent - The parent type definition
145
- * @param fields - The fields to resolve
146
- * @param options - Optional resolver options
147
- */
148
- of<TParent extends GraphQLSilk, TFields extends Record<string, Field<TParent, any, any, any> | Operation | typeof FIELD_HIDDEN>>(parent: TParent, fields: TFields, options?: ResolverOptionsWithExtensions<OmitInUnion<ValueOf<TFields>, typeof FIELD_HIDDEN>>): ObjectChainResolver<TParent, TFields>;
149
- /**
150
- * Creates a resolver for operations
151
- * @template TFields - The operations to resolve
152
- * @param operations - The operations to resolve
153
- * @param options - Optional resolver options
154
- */
155
- <TFields extends Record<string, Operation>>(operations: TFields, options?: ResolverOptions<ValueOf<TFields>>): ChainResolver<TFields>;
156
- }
157
- /**
158
- * Base class for chain resolvers
159
- * @template TFields - The fields or operations to resolve
160
- */
161
- declare class ChainResolver<TFields extends Record<string, FieldOrOperation | typeof FIELD_HIDDEN>> implements Resolver {
162
- protected meta: {
163
- [IS_RESOLVER]: true;
164
- fields: TFields;
165
- options?: ResolverOptionsWithExtensions;
166
- };
167
- /**
168
- * Creates a new chain resolver
169
- * @param fields - The fields or operations to resolve
170
- * @param options - Optional resolver options
171
- */
172
- constructor(fields: TFields, options?: ResolverOptionsWithExtensions<any>);
173
- /**
174
- * Gets the metadata for the resolver
175
- */
176
- get "~meta"(): typeof this.meta;
177
- /**
178
- * Adds middleware functions to the resolver
179
- * @param middlewares - The middleware functions to add
180
- */
181
- use(...middlewares: Middleware<OmitInUnion<ValueOf<TFields>, typeof FIELD_HIDDEN>>[]): this;
182
- toExecutor(...middlewares: Middleware[]): Executor<TFields>;
183
- protected toExecutorOperation(field: FieldOrOperation | typeof FIELD_HIDDEN, executorMiddlewares: Middleware[]): ((...args: any) => any) | undefined;
184
- }
185
- /**
186
- * Class for resolving object types
187
- * @template TParent - The parent type
188
- * @template TFields - The fields to resolve
189
- */
190
- declare class ObjectChainResolver<TParent extends GraphQLSilk, TFields extends Record<string, FieldOrOperation | typeof FIELD_HIDDEN>> extends ChainResolver<TFields> {
191
- protected meta: {
192
- [IS_RESOLVER]: true;
193
- fields: TFields;
194
- parent: TParent;
195
- options?: ResolverOptionsWithExtensions;
196
- };
197
- /**
198
- * Creates a new object chain resolver
199
- * @param parent - The parent type definition
200
- * @param fields - The fields to resolve
201
- * @param options - Optional resolver options
202
- */
203
- constructor(parent: TParent, fields: TFields, options?: ResolverOptionsWithExtensions<any>);
204
- /**
205
- * Gets the metadata for the resolver
206
- */
207
- get "~meta"(): typeof this.meta;
208
- /**
209
- * Sets custom extensions for the resolver
210
- * @param extensions - The extensions to add
211
- */
212
- extensions(extensions: Pick<GraphQLObjectTypeConfig<any, any>, "extensions">["extensions"]): this;
213
- }
214
- /**
215
- * Type for the executor of a resolver
216
- * @template TFields - The fields or operations to resolve
217
- */
218
- type Executor<TFields extends Record<string, FieldOrOperation | typeof FIELD_HIDDEN>> = {
219
- [K in keyof TFields]: TFields[K] extends Field<infer TParent, infer TOutput, infer TInput, string[] | undefined> ? (parent: StandardSchemaV1.InferOutput<TParent>, args: InferInputI<TInput>, payload: ResolverPayload | void) => Promise<StandardSchemaV1.InferOutput<TOutput>> : TFields[K] extends Query<infer TOutput, infer TInput> ? (args: InferInputI<TInput>, payload: ResolverPayload | void) => Promise<StandardSchemaV1.InferOutput<TOutput>> : TFields[K] extends Mutation<infer TOutput, infer TInput> ? (args: InferInputI<TInput>, payload: ResolverPayload | void) => Promise<StandardSchemaV1.InferOutput<TOutput>> : never;
220
- };
221
-
222
- /**
223
- * Creates an object map with the same keys as `map` and values generated by
224
- * running each value of `record` thru `fn`.
225
- */
226
- declare function mapValue<T, V>(record: Record<string, T>, fn: (value: T, key: string) => V | typeof mapValue.SKIP): Record<string, V>;
227
- declare namespace mapValue {
228
- var SKIP: unique symbol;
229
- }
230
- declare function toObjMap<T>(obj: Maybe<ReadOnlyObjMapLike<T>>): ReadOnlyObjMap<T>;
231
- declare function notNullish<T>(x: T | undefined | null): x is T;
232
- declare function deepMerge<T extends Record<string, any>>(...objects: (T | null | undefined)[]): T;
233
- /**
234
- * Wraps the provided data in an object with a single key `"~meta"`.
235
- *
236
- * @template T - The type of the data to be wrapped.
237
- * @param {T} data - The data to be wrapped.
238
- * @returns {{ "~meta": T }} - An object with a single key `"~meta"` containing the provided data.
239
- * @example
240
- * const originalData = { key: "value" };
241
- * const metaData = meta(originalData);
242
- * console.log(metaData); // Output: { "~meta": { key: "value" } }
243
- */
244
- declare function meta<T>(data: T): {
245
- "~meta": T;
246
- };
247
- type Maybe<T> = null | undefined | T;
248
- type ReadOnlyObjMapLike<T> = ReadOnlyObjMap<T> | {
249
- readonly [key: string]: T;
250
- };
251
- interface ReadOnlyObjMap<T> {
252
- readonly [key: string]: T;
253
- }
254
-
255
- declare function pascalCase(str: string): string;
256
- declare function capitalize<T extends string>(str: T): Capitalize<T>;
257
- declare function screamingSnakeCase(str: string): string;
258
-
259
- declare function markErrorLocation<TError>(error: TError, ...locations: string[]): TError;
260
- declare function tryIn<T>(func: () => T, ...locations: string[]): T;
261
- /**
262
- * mark message with location
263
- * @param message origin message
264
- * @param locations where error happened
265
- * @returns message with location
266
- * @example markLocation("error", "banana") // "[banana] hello"
267
- * @example markLocation("error", fruit, banana) // "[fruit.banana] error"
268
- * @example markLocation("[banana] error", "fruit") // "[fruit.banana] error"
269
- * @example markLocation("[fruit.banana] error", "favorite") // "[favorite.fruit.banana] error"
270
- */
271
- declare function markLocation(message: string, ...locations: string[]): string;
272
-
273
- type BatchLoadFn<TKey, TData> = (keys: TKey[]) => Promise<(TData | Error)[]>;
274
- /**
275
- * GraphQL Loom built-in data loader.
276
- */
277
- declare abstract class LoomDataLoader<TKey, TData> {
278
- protected abstract batchLoad(keys: TKey[]): Promise<(TData | Error)[]>;
279
- protected results: Map<TKey, Promise<TData>>;
280
- protected resolvers: Map<TKey, [
281
- resolve: (value: TData | PromiseLike<TData>) => void,
282
- reject: (reason?: any) => void
283
- ]>;
284
- constructor();
285
- /**
286
- * Load data for a given key.
287
- * @param key - The key to load data for.
288
- * @returns A promise that resolves to the loaded data.
289
- */
290
- load(key: TKey): Promise<TData>;
291
- /**
292
- * Clear the cache and reset the loader.
293
- */
294
- clear(): void;
295
- protected executeBatchLoad(): Promise<void>;
296
- protected nextTickPromise?: Promise<void>;
297
- protected nextTickBatchLoad(): Promise<void>;
298
- static nextTick(): Promise<void>;
299
- }
300
- declare class EasyDataLoader<TKey, TData> extends LoomDataLoader<TKey, TData> {
301
- protected readonly batchLoadFn: BatchLoadFn<TKey, TData>;
302
- protected batchLoad(keys: TKey[]): Promise<(TData | Error)[]>;
303
- constructor(batchLoadFn: BatchLoadFn<TKey, TData>);
304
- }
305
-
306
- interface SchemaWeaver {
307
- vendor: string;
308
- getGraphQLType: (schema: any) => GraphQLOutputType;
309
- }
310
- declare function isSchemaVendorWeaver(some: any): some is SchemaWeaver;
311
-
312
- interface WeaverContext {
313
- id: number;
314
- loomObjectMap: Map<GraphQLObjectType, LoomObjectType>;
315
- loomUnionMap: Map<GraphQLUnionType, GraphQLUnionType>;
316
- inputMap: Map<GraphQLObjectType | GraphQLInterfaceType, GraphQLInputObjectType>;
317
- interfaceMap: Map<GraphQLObjectType, GraphQLInterfaceType>;
318
- configs: Map<string | symbol, WeaverConfig>;
319
- getConfig: <TConfig extends WeaverConfig>(key: TConfig[typeof WEAVER_CONFIG]) => TConfig | undefined;
320
- setConfig<TConfig extends WeaverConfig>(config: TConfig): void;
321
- deleteConfig: <TConfig extends WeaverConfig>(key: TConfig[typeof WEAVER_CONFIG]) => void;
322
- namedTypes: Map<string, GraphQLOutputType>;
323
- memoNamedType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(gqlType: TGraphQLType): TGraphQLType;
324
- getNamedType<T extends GraphQLOutputType>(name: string): T | undefined;
325
- names: WeakMap<object, string>;
326
- vendorWeavers: Map<string, SchemaWeaver>;
327
- }
328
- interface WeaverConfig {
329
- [WEAVER_CONFIG]: string | symbol;
330
- vendorWeaver?: SchemaWeaver;
331
- }
332
- declare function initWeaverContext(): WeaverContext;
333
- declare namespace initWeaverContext {
334
- var increasingID: number;
335
- }
336
- type GlobalContextRequiredKeys = "names" | "getConfig" | "setConfig" | "deleteConfig" | "getNamedType" | "memoNamedType";
337
- interface GlobalWeaverContext extends Partial<Omit<WeaverContext, GlobalContextRequiredKeys>>, Pick<WeaverContext, GlobalContextRequiredKeys> {
338
- value?: WeaverContext;
339
- useConfig<TConfig extends WeaverConfig, TCallback extends () => any>(config: TConfig, callback: TCallback): ReturnType<TCallback>;
340
- GraphQLTypes: WeakMap<object, GraphQLOutputType>;
341
- getGraphQLType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(origin: object): TGraphQLType | undefined;
342
- memoGraphQLType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(origin: object, gqlType: TGraphQLType): TGraphQLType;
343
- }
344
- declare const weaverContext: GlobalWeaverContext;
345
- declare function provideWeaverContext<T>(func: () => T, value: WeaverContext | undefined): T;
346
- declare namespace provideWeaverContext {
347
- var inherit: <T>(func: () => T) => () => T;
348
- }
349
- /**
350
- * collect names for schemas
351
- * @param namesList - names to collect
352
- * @returns namesRecord
353
- */
354
- declare function collectNames<TRecords extends Record<string, object>[]>(...namesList: TRecords): UnionToIntersection<TRecords[number]>;
355
- /**
356
- * collect name for schema
357
- * @param name - name for
358
- * @param schema - schema to be named
359
- * @returns schema
360
- */
361
- declare function collectName<TSchema extends object>(name: string, schema: TSchema): TSchema;
362
- type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
363
-
364
- declare class LoomObjectType extends GraphQLObjectType {
365
- protected extraFields: Map<string, BaseField>;
366
- protected hiddenFields: Set<string>;
367
- static AUTO_ALIASING: "__gqloom_auto_aliasing";
368
- protected weaverContext: WeaverContext;
369
- protected globalOptions?: ResolverOptions;
370
- /**
371
- * field name -> resolver
372
- */
373
- protected resolvers: Map<string, Resolver>;
374
- constructor(objectOrGetter: string | GraphQLObjectType | GraphQLObjectTypeConfig<any, any> | (() => GraphQLObjectType | GraphQLObjectTypeConfig<any, any>), options?: {
375
- weaverContext?: WeaverContext;
376
- globalOptions?: ResolverOptions;
377
- });
378
- protected hasExplicitName?: boolean;
379
- protected _aliases: string[];
380
- get aliases(): string[];
381
- addAlias(name: string): void;
382
- protected renameByAliases(): void;
383
- hideField(name: string): void;
384
- addField(name: string, field: BaseField, resolver: Resolver | undefined): void;
385
- mergeExtensions(extensions: GraphQLObjectTypeConfig<any, any>["extensions"]): void;
386
- private extraFieldMap?;
387
- getFields(): GraphQLFieldMap<any, any>;
388
- protected mapToFieldConfig(map: Map<string, BaseField>): Record<string, GraphQLFieldConfig<any, any>>;
389
- toFieldConfig(field: BaseField, fieldName: string): GraphQLFieldConfig<any, any>;
390
- protected provideForResolve(field: BaseField, fieldName: string): GraphQLFieldConfig<any, any>["resolve"];
391
- protected provideForSubscribe(field: BaseField | Subscription<any, any, any>, fieldName: string): GraphQLFieldConfig<any, any>["subscribe"] | undefined;
392
- protected getCacheType(gqlType: GraphQLOutputType, fieldName?: string): GraphQLOutputType;
393
- get options(): {
394
- resolverOptions: ResolverOptions<FieldOrOperation> | undefined;
395
- weaverContext: WeaverContext;
396
- };
397
- }
398
- declare const OPERATION_OBJECT_NAMES: Set<string>;
399
- declare function getCacheType(gqlType: GraphQLOutputType, options?: {
400
- weaverContext?: WeaverContext;
401
- resolverOptions?: ResolverOptions;
402
- fieldName?: string;
403
- parent?: LoomObjectType;
404
- }): GraphQLOutputType;
405
-
406
- interface CoreSchemaWeaverConfigOptions extends GraphQLSchemaConfig {
407
- getInputObjectName?: (name: string) => string;
408
- weaverContext?: WeaverContext;
409
- }
410
- interface CoreSchemaWeaverConfig extends WeaverConfig, CoreSchemaWeaverConfigOptions {
411
- [WEAVER_CONFIG]: "gqloom.core.schema";
412
- }
413
-
414
- interface SchemaWeaverParameters extends Partial<Record<"query" | "mutation" | "subscription", LoomObjectType>>, Pick<GraphQLSchemaConfig, "types"> {
415
- }
416
- declare class GraphQLSchemaLoom {
417
- query?: LoomObjectType;
418
- mutation?: LoomObjectType;
419
- subscription?: LoomObjectType;
420
- types: Set<GraphQLNamedType>;
421
- context: WeaverContext;
422
- resolverOptions?: ResolverOptions;
423
- /**
424
- * Create a Schema Weaver config object
425
- * @param config Schema Weaver config options
426
- * @returns a Schema Weaver config object
427
- */
428
- static config(config: CoreSchemaWeaverConfigOptions): CoreSchemaWeaverConfig;
429
- constructor({ query, mutation, subscription, types }?: SchemaWeaverParameters, context?: WeaverContext);
430
- use(...middlewares: Middleware[]): this;
431
- add(resolver: Resolver, modifyParent?: (parent: LoomObjectType) => LoomObjectType): this;
432
- addVendor(weaver: SchemaWeaver): this;
433
- addType(silk: GraphQLSilk): this;
434
- setConfig<TConfig extends WeaverConfig>(config: TConfig): this;
435
- weaveGraphQLSchema(): GraphQLSchema;
436
- protected addResolver(resolver: Resolver, modifyParent?: (parent: LoomObjectType) => LoomObjectType): this;
437
- protected getOperationObject(type: "query" | "mutation" | "subscription"): LoomObjectType;
438
- protected get fieldOptions(): ConstructorParameters<typeof LoomObjectType>[1];
439
- static optionsFrom(...inputs: (Resolver | Middleware | SchemaWeaver | WeaverConfig | GraphQLSilk)[]): {
440
- context: WeaverContext | undefined;
441
- configs: Set<WeaverConfig>;
442
- middlewares: Set<Middleware<any>>;
443
- resolvers: Set<Resolver>;
444
- silks: Set<GraphQLSilk<any, any>>;
445
- weavers: Set<SchemaWeaver>;
446
- };
447
- /**
448
- * Weave a GraphQL Schema from resolvers
449
- * @param inputs Resolvers, Global Middlewares, WeaverConfigs Or SchemaWeaver
450
- * @returns GraphQL Schema
451
- */
452
- static weave(...inputs: (Resolver | Middleware | SchemaWeaver | WeaverConfig | GraphQLSilk)[]): GraphQLSchema;
453
- }
454
- /**
455
- * Weave a GraphQL Schema from resolvers
456
- * @param inputs Resolvers, Global Middlewares or WeaverConfigs
457
- * @returns GraphQL Schema
458
- */
459
- declare const weave: typeof GraphQLSchemaLoom.weave;
460
-
461
- interface EnsureInputOptions {
462
- fieldName?: string;
463
- }
464
- declare function inputToArgs(input: GraphQLSilk | Record<string, GraphQLSilk> | undefined | void, options: EnsureInputOptions | undefined): GraphQLFieldConfigArgumentMap | undefined;
465
- declare function ensureInputType(silkOrType: GraphQLType | GraphQLSilk, options: EnsureInputOptions | undefined): GraphQLInputType;
466
- declare function ensureInputObjectType(object: GraphQLObjectType | GraphQLInterfaceType | GraphQLInputObjectType, options: EnsureInputOptions | undefined): GraphQLInputObjectType;
467
-
468
- declare function ensureInterfaceType(gqlType: GraphQLOutputType, interfaceConfig?: Partial<GraphQLInterfaceTypeConfig<any, any>>): GraphQLInterfaceType;
469
-
470
- interface GQLoomExtensions {
471
- defaultValue?: any;
472
- gqloom?: GQLoomExtensionAttribute;
473
- directives?: DirectiveItem[] | DirectiveRecord;
474
- }
475
- interface DirectiveItem {
476
- name: string;
477
- args?: Record<string, any>;
478
- }
479
- type DirectiveRecord = Record<string, Record<string, any>>;
480
- interface GQLoomExtensionAttribute {
481
- directives?: string[];
482
- }
483
-
484
- export { BaseField, type BatchLoadFn, ChainResolver, type CoreSchemaWeaverConfig, type CoreSchemaWeaverConfigOptions, type DirectiveItem, type DirectiveRecord, EasyDataLoader, type Executor, Field, FieldChainFactory, FieldFactoryWithUtils, FieldOptions, FieldOrOperation, type GQLoomExtensionAttribute, type GQLoomExtensions, type GlobalWeaverContext, GraphQLFieldOptions, GraphQLSchemaLoom, GraphQLSilk, InferInputI, type ListSilk, LoomDataLoader, LoomObjectType, MayPromise, Middleware, Mutation, MutationChainFactory, MutationFactoryWithChain, MutationOptions, type NonNullSilk, type NullableSilk, OPERATION_OBJECT_NAMES, ObjectChainResolver, OmitInUnion, Operation, Query, QueryChainFactory, QueryFactoryWithChain, QueryOptions, Resolver, type ResolverFactory, ResolverOptions, ResolverOptionsWithExtensions, ResolverPayload, type SchemaWeaver, StandardSchemaV1, Subscription, SubscriptionChainFactory, SubscriptionFactoryWithChain, SubscriptionOptions, type ToExecutorProps, ValueOf, type WeaverConfig, type WeaverContext, capitalize, collectName, collectNames, createField, createMutation, createQuery, createSubscription, deepMerge, defaultSubscriptionResolve, ensureInputObjectType, ensureInputType, ensureInterfaceType, field, getCacheType, getFieldOptions, getGraphQLType, getOperationOptions, getSubscriptionOptions, initWeaverContext, inputToArgs, isSchemaVendorWeaver, isSilk, listSilk, loom, mapValue, markErrorLocation, markLocation, meta, mutation, nonNullSilk, notNullish, nullableSilk, parseSilk, pascalCase, provideWeaverContext, query, resolver, screamingSnakeCase, silk, subscription, toObjMap, tryIn, weave, weaverContext };
1
+ import { BaseChainFactory, BaseField, BatchLoadFn, CallableInputParser, CallableMiddlewareOptions, ChainFactoryOptions, ChainResolver, CoreSchemaWeaverConfig, CoreSchemaWeaverConfigOptions, DirectiveItem, DirectiveRecord, EasyDataLoader, Executor, Field, FieldChainFactory, FieldFactory, FieldFactoryWithResolve, FieldFactoryWithUtils, FieldMeta, FieldOptions, FieldOrOperation, FieldOrOperationType, GQLoomExtensionAttribute, GQLoomExtensions, GlobalWeaverContext, GraphQLFieldOptions, GraphQLSchemaLoom, GraphQLSilk, IChainFactory, InferFieldInput, InferFieldOutput, InferInputI, InferInputO, IsAny, ListSilk, LoomDataLoader, LoomObjectType, MayPromise, Middleware, MiddlewareConfig, MiddlewareOperation, MiddlewareOptions, Mutation, MutationChainFactory, MutationFactory, MutationFactoryWithChain, MutationFactoryWithResolve, MutationOptions, NonNullSilk, NullableSilk, OPERATION_OBJECT_NAMES, ObjectChainResolver, OmitInUnion, OnlyMemoizationPayload, Operation, OperationType, Query, QueryChainFactory, QueryFactory, QueryFactoryWithChain, QueryFactoryWithResolve, QueryOptions, RequireKeys, ResolvableSubscription, Resolver, ResolverFactory, ResolverMeta, ResolverOptions, ResolverOptionsWithExtensions, ResolverOptionsWithParent, ResolverPayload, ResolvingFields, ResolvingOptions, SchemaWeaver, StandardSchemaV1, Subscription, SubscriptionChainFactory, SubscriptionFactory, SubscriptionFactoryWithChain, SubscriptionNeedResolve, SubscriptionOptions, ToExecutorProps, ValueOf, WeaverConfig, WeaverContext, applyMiddlewares, assignContextMap, capitalize, collectName, collectNames, createField, createInputParser, createMutation, createQuery, createSubscription, deepMerge, defaultSubscriptionResolve, ensureInputObjectType, ensureInputType, ensureInterfaceType, field, filterMiddlewares, getCacheType, getDeepResolvingFields, getFieldOptions, getGraphQLType, getMemoizationMap, getOperationOptions, getResolvingFields, getStandardValue, getSubscriptionOptions, initWeaverContext, inputToArgs, isOnlyMemoryPayload, isSchemaVendorWeaver, isSilk, listSilk, loom, mapValue, markErrorLocation, markLocation, meta, mutation, nonNullSilk, notNullish, nullableSilk, onlyMemoization, parseInputValue, parseResolvingFields, parseSilk, pascalCase, provideWeaverContext, query, resolver, screamingSnakeCase, silk, subscription, symbols_d_exports, toObjMap, tryIn, types_loom_d_exports, weave, weaverContext } from "./index-DUqXX1Tm.cjs";
2
+ export { BaseChainFactory, BaseField, BatchLoadFn, CallableInputParser, CallableMiddlewareOptions, ChainFactoryOptions, ChainResolver, CoreSchemaWeaverConfig, CoreSchemaWeaverConfigOptions, DirectiveItem, DirectiveRecord, EasyDataLoader, Executor, Field, FieldChainFactory, FieldFactory, FieldFactoryWithResolve, FieldFactoryWithUtils, FieldMeta, FieldOptions, FieldOrOperation, FieldOrOperationType, GQLoomExtensionAttribute, GQLoomExtensions, GlobalWeaverContext, GraphQLFieldOptions, GraphQLSchemaLoom, GraphQLSilk, IChainFactory, InferFieldInput, InferFieldOutput, InferInputI, InferInputO, IsAny, ListSilk, types_loom_d_exports as Loom, LoomDataLoader, LoomObjectType, MayPromise, Middleware, MiddlewareConfig, MiddlewareOperation, MiddlewareOptions, Mutation, MutationChainFactory, MutationFactory, MutationFactoryWithChain, MutationFactoryWithResolve, MutationOptions, NonNullSilk, NullableSilk, OPERATION_OBJECT_NAMES, ObjectChainResolver, OmitInUnion, OnlyMemoizationPayload, Operation, OperationType, Query, QueryChainFactory, QueryFactory, QueryFactoryWithChain, QueryFactoryWithResolve, QueryOptions, RequireKeys, ResolvableSubscription, Resolver, ResolverFactory, ResolverMeta, ResolverOptions, ResolverOptionsWithExtensions, ResolverOptionsWithParent, ResolverPayload, ResolvingFields, ResolvingOptions, symbols_d_exports as SYMBOLS, SchemaWeaver, StandardSchemaV1, Subscription, SubscriptionChainFactory, SubscriptionFactory, SubscriptionFactoryWithChain, SubscriptionNeedResolve, SubscriptionOptions, ToExecutorProps, ValueOf, WeaverConfig, WeaverContext, applyMiddlewares, assignContextMap, capitalize, collectName, collectNames, createField, createInputParser, createMutation, createQuery, createSubscription, deepMerge, defaultSubscriptionResolve, ensureInputObjectType, ensureInputType, ensureInterfaceType, field, filterMiddlewares, getCacheType, getDeepResolvingFields, getFieldOptions, getGraphQLType, getMemoizationMap, getOperationOptions, getResolvingFields, getStandardValue, getSubscriptionOptions, initWeaverContext, inputToArgs, isOnlyMemoryPayload, isSchemaVendorWeaver, isSilk, listSilk, loom, mapValue, markErrorLocation, markLocation, meta, mutation, nonNullSilk, notNullish, nullableSilk, onlyMemoization, parseInputValue, parseResolvingFields, parseSilk, pascalCase, provideWeaverContext, query, resolver, screamingSnakeCase, silk, subscription, toObjMap, tryIn, weave, weaverContext };