@gqloom/core 0.14.2 → 0.14.4
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/context.d.cts +1 -1
- package/dist/context.d.ts +1 -1
- package/dist/{index-BuNcG6Vh.d.cts → index-BW7_Sr0t.d.cts} +14 -13
- package/dist/{index-DVABcenn.d.ts → index-CFo2-jU-.d.ts} +14 -13
- package/dist/index.cjs +25 -19
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +25 -19
- package/package.json +1 -1
package/dist/context.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ct as Middleware, Vt as OnlyMemoizationPayload, bn as BaseField, hn as ResolverPayload, ut as ResolvingFields } from "./index-BW7_Sr0t.cjs";
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
3
|
|
|
4
4
|
//#region src/context/async-iterator.d.ts
|
package/dist/context.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ct as Middleware, Vt as OnlyMemoizationPayload, bn as BaseField, hn as ResolverPayload, ut as ResolvingFields } from "./index-CFo2-jU-.js";
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
3
|
|
|
4
4
|
//#region src/context/async-iterator.d.ts
|
|
@@ -205,7 +205,7 @@ declare class FieldChainFactory<TOutput$1 extends GraphQLSilk = never, TInput$1
|
|
|
205
205
|
* @template TInputNew - The new input type
|
|
206
206
|
* @param input - The input type definition
|
|
207
207
|
*/
|
|
208
|
-
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): FieldChainFactory<TOutput$1, TInputNew, TDependencies$1>;
|
|
208
|
+
input<TInputNew extends GraphQLSilk<any, Record<string, any>> | Record<string, GraphQLSilk>>(input: TInputNew): FieldChainFactory<TOutput$1, TInputNew, TDependencies$1>;
|
|
209
209
|
/**
|
|
210
210
|
* Specifies the dependencies for the field
|
|
211
211
|
* @template TDependencies - The dependencies type
|
|
@@ -260,7 +260,7 @@ declare class QueryChainFactory<TOutput$1 extends GraphQLSilk = never, TInput$1
|
|
|
260
260
|
* @param input - The input type definition
|
|
261
261
|
* @returns A new QueryChainFactory instance with the updated input type
|
|
262
262
|
*/
|
|
263
|
-
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): QueryChainFactory<TOutput$1, TInputNew>;
|
|
263
|
+
input<TInputNew extends GraphQLSilk<any, Record<string, any>> | Record<string, GraphQLSilk>>(input: TInputNew): QueryChainFactory<TOutput$1, TInputNew>;
|
|
264
264
|
/**
|
|
265
265
|
* Sets the resolve function for the query
|
|
266
266
|
* @param resolve - The resolve function that processes the input and returns the output
|
|
@@ -299,7 +299,7 @@ declare class MutationChainFactory<TOutput$1 extends GraphQLSilk = never, TInput
|
|
|
299
299
|
* @param input - The input type definition
|
|
300
300
|
* @returns A new MutationChainFactory instance with the updated input type
|
|
301
301
|
*/
|
|
302
|
-
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): MutationChainFactory<TOutput$1, TInputNew>;
|
|
302
|
+
input<TInputNew extends GraphQLSilk<any, Record<string, any>> | Record<string, GraphQLSilk>>(input: TInputNew): MutationChainFactory<TOutput$1, TInputNew>;
|
|
303
303
|
/**
|
|
304
304
|
* Sets the resolve function for the mutation
|
|
305
305
|
* @param resolve - The resolve function that processes the input and returns the output
|
|
@@ -338,7 +338,7 @@ declare class SubscriptionChainFactory<TOutput$1 extends GraphQLSilk = never, TI
|
|
|
338
338
|
* @param input - The input type definition
|
|
339
339
|
* @returns A new SubscriptionChainFactory instance with the updated input type
|
|
340
340
|
*/
|
|
341
|
-
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): SubscriptionChainFactory<TOutput$1, TInputNew>;
|
|
341
|
+
input<TInputNew extends GraphQLSilk<any, Record<string, any>> | Record<string, GraphQLSilk>>(input: TInputNew): SubscriptionChainFactory<TOutput$1, TInputNew>;
|
|
342
342
|
/**
|
|
343
343
|
* Sets the subscribe function for the subscription
|
|
344
344
|
* @template TValue - The value type of the subscription
|
|
@@ -381,7 +381,7 @@ declare class QueryFactoryWithResolve<TInputO, TOutput$1 extends GraphQLSilk, TI
|
|
|
381
381
|
get "~meta"(): Query<TOutput$1, TInput$1>["~meta"];
|
|
382
382
|
constructor(outputSilk: TOutput$1, options: QueryOptions<TOutput$1, TInput$1>);
|
|
383
383
|
protected clone(options?: Partial<QueryOptions<TOutput$1, TInput$1>> | undefined): this;
|
|
384
|
-
input<TInputNew extends GraphQLSilk<TInputO
|
|
384
|
+
input<TInputNew extends GraphQLSilk<TInputO, Record<string, any>>>(input: TInputNew): QueryFactoryWithResolve<TInputO, TOutput$1, TInputNew>;
|
|
385
385
|
output<TOutputNew extends GraphQLSilk>(output: TOutputNew, transform: (output: StandardSchemaV1.InferOutput<TOutput$1>) => MayPromise<StandardSchemaV1.InferOutput<TOutputNew>>): QueryFactoryWithResolve<TInputO, TOutputNew, TInput$1>;
|
|
386
386
|
}
|
|
387
387
|
declare class MutationFactoryWithResolve<TInputO, TOutput$1 extends GraphQLSilk, TInput$1 extends GraphQLSilk<TInputO>> extends BaseChainFactory<Query<TOutput$1, TInput$1>> implements Mutation<TOutput$1, TInput$1> {
|
|
@@ -390,7 +390,7 @@ declare class MutationFactoryWithResolve<TInputO, TOutput$1 extends GraphQLSilk,
|
|
|
390
390
|
get "~meta"(): Mutation<TOutput$1, TInput$1>["~meta"];
|
|
391
391
|
constructor(outputSilk: TOutput$1, options: MutationOptions<TOutput$1, TInput$1>);
|
|
392
392
|
protected clone(options?: Partial<MutationOptions<TOutput$1, TInput$1>> | undefined): this;
|
|
393
|
-
input<TInputNew extends GraphQLSilk<TInputO
|
|
393
|
+
input<TInputNew extends GraphQLSilk<TInputO, Record<string, any>>>(input: TInputNew): MutationFactoryWithResolve<TInputO, TOutput$1, TInputNew>;
|
|
394
394
|
output<TOutputNew extends GraphQLSilk>(output: TOutputNew, transform: (output: StandardSchemaV1.InferOutput<TOutput$1>) => MayPromise<StandardSchemaV1.InferOutput<TOutputNew>>): MutationFactoryWithResolve<TInputO, TOutputNew, TInput$1>;
|
|
395
395
|
}
|
|
396
396
|
declare class FieldFactoryWithResolve<TParent$1 extends GraphQLSilk, TOutput$1 extends GraphQLSilk, TInputO = never, TInput$1 extends GraphQLSilk<TInputO> | void = void> extends BaseChainFactory<Field<TParent$1, TOutput$1, TInput$1, string[] | undefined>> {
|
|
@@ -399,7 +399,7 @@ declare class FieldFactoryWithResolve<TParent$1 extends GraphQLSilk, TOutput$1 e
|
|
|
399
399
|
get "~meta"(): Field<TParent$1, TOutput$1, TInput$1, string[] | undefined>["~meta"];
|
|
400
400
|
constructor(outputSilk: TOutput$1, options: FieldOptions<TParent$1, TOutput$1, TInput$1, string[] | undefined>);
|
|
401
401
|
protected clone(options?: Partial<FieldOptions<TParent$1, TOutput$1, TInput$1, string[] | undefined>> | undefined): this;
|
|
402
|
-
input<TInputNew extends GraphQLSilk<TInputO
|
|
402
|
+
input<TInputNew extends GraphQLSilk<TInputO, Record<string, any>>>(input: TInputNew): FieldFactoryWithResolve<TParent$1, TOutput$1, TInputO, TInputNew>;
|
|
403
403
|
output<TOutputNew extends GraphQLSilk>(output: TOutputNew, transform: (output: StandardSchemaV1.InferOutput<TOutput$1>) => MayPromise<StandardSchemaV1.InferOutput<TOutputNew>>): FieldFactoryWithResolve<TParent$1, TOutputNew, TInputO, TInput$1>;
|
|
404
404
|
}
|
|
405
405
|
declare namespace types_loom_d_exports {
|
|
@@ -1152,18 +1152,19 @@ declare class WeaverContext {
|
|
|
1152
1152
|
readonly Scalar: "Scalar";
|
|
1153
1153
|
};
|
|
1154
1154
|
protected aliasCounters: Partial<Record<keyof typeof WeaverContext.namedTypes, number>>;
|
|
1155
|
-
protected aliasMap: WeakMap<GraphQLNamedType,
|
|
1156
|
-
setAlias(namedType: GraphQLNamedType,
|
|
1155
|
+
protected aliasMap: WeakMap<GraphQLNamedType, AliasList>;
|
|
1156
|
+
setAlias(namedType: GraphQLNamedType, fieldName: string | undefined, parent?: GraphQLNamedType): string;
|
|
1157
1157
|
/**
|
|
1158
1158
|
* @returns -1 if a is better than b, 1 if b is better than a, 0 if they are equal
|
|
1159
1159
|
*/
|
|
1160
1160
|
protected static higherPriorityThan(a: string | undefined, b: string | undefined): number;
|
|
1161
|
-
protected ensureAliasStore(namedType: GraphQLNamedType):
|
|
1162
|
-
protected pickAlias(namedType: GraphQLNamedType, aliases:
|
|
1163
|
-
protected reduceAliases(aliases:
|
|
1161
|
+
protected ensureAliasStore(namedType: GraphQLNamedType): AliasList;
|
|
1162
|
+
protected pickAlias(namedType: GraphQLNamedType, aliases: AliasList): string;
|
|
1163
|
+
protected reduceAliases(aliases: AliasList): string | undefined;
|
|
1164
1164
|
protected createFallbackAlias(namedType: GraphQLNamedType): string;
|
|
1165
1165
|
static provide<T>(func: () => T, value: WeaverContext | undefined): T;
|
|
1166
1166
|
}
|
|
1167
|
+
type AliasList = (string | [fieldName: string, parent: GraphQLNamedType])[];
|
|
1167
1168
|
declare const initWeaverContext: () => WeaverContext;
|
|
1168
1169
|
declare const provideWeaverContext: typeof WeaverContext.provide & {
|
|
1169
1170
|
inherit: <T>(func: () => T) => () => T;
|
|
@@ -1311,4 +1312,4 @@ declare class GraphQLSchemaLoom {
|
|
|
1311
1312
|
*/
|
|
1312
1313
|
declare const weave: typeof GraphQLSchemaLoom.weave;
|
|
1313
1314
|
//#endregion
|
|
1314
|
-
export {
|
|
1315
|
+
export { resolver as $, FieldOptions as $t, getGraphQLArgumentConfig as A, BaseChainFactory as An, MayGetter as At, ObjectChainResolver as B, SubscriptionChainFactory as Bn, tryIn as Bt, DirectiveItem as C, FieldOrOperation as Cn, Middleware as Ct, ListSilk as D, Resolver as Dn, applyMiddlewares as Dt, GQLoomExtensions as E, Query as En, MiddlewareOptions as Et, nullableSilk as F, MutationChainFactory as Fn, BatchLoadFn as Ft, createMutation as G, onlyMemoization as Gt, ResolverMeta as H, symbols_d_exports as Hn, assignContextMap as Ht, parseSilk as I, MutationFactoryWithResolve as In, EasyDataLoader as It, defaultSubscriptionResolve as J, getFieldOptions as Jt, createQuery as K, AUTO_ALIASING as Kt, silk as L, QueryChainFactory as Ln, LoomDataLoader as Lt, isSilk as M, FieldChainFactory as Mn, OmitInUnion as Mt, listSilk as N, FieldFactoryWithResolve as Nn, RequireKeys as Nt, NonNullSilk as O, Subscription as On, filterMiddlewares as Ot, nonNullSilk as P, IChainFactory as Pn, ValueOf as Pt, query$1 as Q, FieldFactoryWithUtils as Qt, ChainResolver as R, QueryFactoryWithResolve as Rn, markErrorLocation as Rt, inputToArgs as S, FieldMeta as Sn, CallableMiddlewareOptions as St, GQLoomExtensionAttribute as T, Operation as Tn, MiddlewareOperation as Tt, ToExecutorProps as U, StandardSchemaV1 as Un, getMemoizationMap as Ut, ResolverFactory as V, SubscriptionNeedResolve as Vn, OnlyMemoizationPayload as Vt, createField as W, isOnlyMemoryPayload as Wt, loom as X, getSubscriptionOptions as Xt, field as Y, getOperationOptions as Yt, mutation$1 as Z, FieldFactory as Zt, SchemaWeaver as _, SubscriptionFactory as _n, meta as _t, LoomObjectType as a, MutationFactory as an, getStandardValue as at, ensureInputObjectType as b, BaseField as bn, toFieldMap as bt, AliasList as c, OperationType as cn, pascalCase as ct, WeaverContext as d, QueryOptions as dn, ResolvingFieldsOptions as dt, FieldOrOperationType as en, subscription$1 as et, collectName as f, ResolverOptions as fn, getDeepResolvingFields as ft, weaverContext as g, ResolvingOptions as gn, mapValue as gt, provideWeaverContext as h, ResolverPayload as hn, deepMerge as ht, CoreSchemaWeaverConfigOptions as i, InferFieldOutput as in, createInputParser as it, getGraphQLType as j, ChainFactoryOptions as jn, MayPromise as jt, NullableSilk as k, types_loom_d_exports as kn, IsAny as kt, GlobalWeaverContext as l, QueryFactory as ln, screamingSnakeCase as lt, initWeaverContext as m, ResolverOptionsWithParent as mn, parseResolvingFields as mt, weave as n, GraphQLSilk as nn, InferInputI as nt, OPERATION_OBJECT_NAMES as o, MutationFactoryWithChain as on, parseInputValue as ot, collectNames as p, ResolverOptionsWithExtensions as pn, getResolvingFields as pt, createSubscription as q, DERIVED_DEPENDENCIES as qt, CoreSchemaWeaverConfig as r, InferFieldInput as rn, InferInputO as rt, getCacheType as s, MutationOptions as sn, capitalize as st, GraphQLSchemaLoom as t, GraphQLFieldOptions as tn, CallableInputParser as tt, WeaverConfig as u, QueryFactoryWithChain as un, ResolvingFields as ut, isSchemaVendorWeaver as v, SubscriptionFactoryWithChain as vn, notNullish as vt, DirectiveRecord as w, Mutation as wn, MiddlewareConfig as wt, ensureInputType as x, Field as xn, toObjMap as xt, ensureInterfaceType as y, SubscriptionOptions as yn, toArguments as yt, Executor as z, ResolvableSubscription as zn, markLocation as zt };
|
|
@@ -203,7 +203,7 @@ declare class FieldChainFactory<TOutput$1 extends GraphQLSilk = never, TInput$1
|
|
|
203
203
|
* @template TInputNew - The new input type
|
|
204
204
|
* @param input - The input type definition
|
|
205
205
|
*/
|
|
206
|
-
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): FieldChainFactory<TOutput$1, TInputNew, TDependencies$1>;
|
|
206
|
+
input<TInputNew extends GraphQLSilk<any, Record<string, any>> | Record<string, GraphQLSilk>>(input: TInputNew): FieldChainFactory<TOutput$1, TInputNew, TDependencies$1>;
|
|
207
207
|
/**
|
|
208
208
|
* Specifies the dependencies for the field
|
|
209
209
|
* @template TDependencies - The dependencies type
|
|
@@ -258,7 +258,7 @@ declare class QueryChainFactory<TOutput$1 extends GraphQLSilk = never, TInput$1
|
|
|
258
258
|
* @param input - The input type definition
|
|
259
259
|
* @returns A new QueryChainFactory instance with the updated input type
|
|
260
260
|
*/
|
|
261
|
-
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): QueryChainFactory<TOutput$1, TInputNew>;
|
|
261
|
+
input<TInputNew extends GraphQLSilk<any, Record<string, any>> | Record<string, GraphQLSilk>>(input: TInputNew): QueryChainFactory<TOutput$1, TInputNew>;
|
|
262
262
|
/**
|
|
263
263
|
* Sets the resolve function for the query
|
|
264
264
|
* @param resolve - The resolve function that processes the input and returns the output
|
|
@@ -297,7 +297,7 @@ declare class MutationChainFactory<TOutput$1 extends GraphQLSilk = never, TInput
|
|
|
297
297
|
* @param input - The input type definition
|
|
298
298
|
* @returns A new MutationChainFactory instance with the updated input type
|
|
299
299
|
*/
|
|
300
|
-
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): MutationChainFactory<TOutput$1, TInputNew>;
|
|
300
|
+
input<TInputNew extends GraphQLSilk<any, Record<string, any>> | Record<string, GraphQLSilk>>(input: TInputNew): MutationChainFactory<TOutput$1, TInputNew>;
|
|
301
301
|
/**
|
|
302
302
|
* Sets the resolve function for the mutation
|
|
303
303
|
* @param resolve - The resolve function that processes the input and returns the output
|
|
@@ -336,7 +336,7 @@ declare class SubscriptionChainFactory<TOutput$1 extends GraphQLSilk = never, TI
|
|
|
336
336
|
* @param input - The input type definition
|
|
337
337
|
* @returns A new SubscriptionChainFactory instance with the updated input type
|
|
338
338
|
*/
|
|
339
|
-
input<TInputNew extends GraphQLSilk | Record<string, GraphQLSilk>>(input: TInputNew): SubscriptionChainFactory<TOutput$1, TInputNew>;
|
|
339
|
+
input<TInputNew extends GraphQLSilk<any, Record<string, any>> | Record<string, GraphQLSilk>>(input: TInputNew): SubscriptionChainFactory<TOutput$1, TInputNew>;
|
|
340
340
|
/**
|
|
341
341
|
* Sets the subscribe function for the subscription
|
|
342
342
|
* @template TValue - The value type of the subscription
|
|
@@ -379,7 +379,7 @@ declare class QueryFactoryWithResolve<TInputO, TOutput$1 extends GraphQLSilk, TI
|
|
|
379
379
|
get "~meta"(): Query<TOutput$1, TInput$1>["~meta"];
|
|
380
380
|
constructor(outputSilk: TOutput$1, options: QueryOptions<TOutput$1, TInput$1>);
|
|
381
381
|
protected clone(options?: Partial<QueryOptions<TOutput$1, TInput$1>> | undefined): this;
|
|
382
|
-
input<TInputNew extends GraphQLSilk<TInputO
|
|
382
|
+
input<TInputNew extends GraphQLSilk<TInputO, Record<string, any>>>(input: TInputNew): QueryFactoryWithResolve<TInputO, TOutput$1, TInputNew>;
|
|
383
383
|
output<TOutputNew extends GraphQLSilk>(output: TOutputNew, transform: (output: StandardSchemaV1.InferOutput<TOutput$1>) => MayPromise<StandardSchemaV1.InferOutput<TOutputNew>>): QueryFactoryWithResolve<TInputO, TOutputNew, TInput$1>;
|
|
384
384
|
}
|
|
385
385
|
declare class MutationFactoryWithResolve<TInputO, TOutput$1 extends GraphQLSilk, TInput$1 extends GraphQLSilk<TInputO>> extends BaseChainFactory<Query<TOutput$1, TInput$1>> implements Mutation<TOutput$1, TInput$1> {
|
|
@@ -388,7 +388,7 @@ declare class MutationFactoryWithResolve<TInputO, TOutput$1 extends GraphQLSilk,
|
|
|
388
388
|
get "~meta"(): Mutation<TOutput$1, TInput$1>["~meta"];
|
|
389
389
|
constructor(outputSilk: TOutput$1, options: MutationOptions<TOutput$1, TInput$1>);
|
|
390
390
|
protected clone(options?: Partial<MutationOptions<TOutput$1, TInput$1>> | undefined): this;
|
|
391
|
-
input<TInputNew extends GraphQLSilk<TInputO
|
|
391
|
+
input<TInputNew extends GraphQLSilk<TInputO, Record<string, any>>>(input: TInputNew): MutationFactoryWithResolve<TInputO, TOutput$1, TInputNew>;
|
|
392
392
|
output<TOutputNew extends GraphQLSilk>(output: TOutputNew, transform: (output: StandardSchemaV1.InferOutput<TOutput$1>) => MayPromise<StandardSchemaV1.InferOutput<TOutputNew>>): MutationFactoryWithResolve<TInputO, TOutputNew, TInput$1>;
|
|
393
393
|
}
|
|
394
394
|
declare class FieldFactoryWithResolve<TParent$1 extends GraphQLSilk, TOutput$1 extends GraphQLSilk, TInputO = never, TInput$1 extends GraphQLSilk<TInputO> | void = void> extends BaseChainFactory<Field<TParent$1, TOutput$1, TInput$1, string[] | undefined>> {
|
|
@@ -397,7 +397,7 @@ declare class FieldFactoryWithResolve<TParent$1 extends GraphQLSilk, TOutput$1 e
|
|
|
397
397
|
get "~meta"(): Field<TParent$1, TOutput$1, TInput$1, string[] | undefined>["~meta"];
|
|
398
398
|
constructor(outputSilk: TOutput$1, options: FieldOptions<TParent$1, TOutput$1, TInput$1, string[] | undefined>);
|
|
399
399
|
protected clone(options?: Partial<FieldOptions<TParent$1, TOutput$1, TInput$1, string[] | undefined>> | undefined): this;
|
|
400
|
-
input<TInputNew extends GraphQLSilk<TInputO
|
|
400
|
+
input<TInputNew extends GraphQLSilk<TInputO, Record<string, any>>>(input: TInputNew): FieldFactoryWithResolve<TParent$1, TOutput$1, TInputO, TInputNew>;
|
|
401
401
|
output<TOutputNew extends GraphQLSilk>(output: TOutputNew, transform: (output: StandardSchemaV1.InferOutput<TOutput$1>) => MayPromise<StandardSchemaV1.InferOutput<TOutputNew>>): FieldFactoryWithResolve<TParent$1, TOutputNew, TInputO, TInput$1>;
|
|
402
402
|
}
|
|
403
403
|
declare namespace types_loom_d_exports {
|
|
@@ -1150,18 +1150,19 @@ declare class WeaverContext {
|
|
|
1150
1150
|
readonly Scalar: "Scalar";
|
|
1151
1151
|
};
|
|
1152
1152
|
protected aliasCounters: Partial<Record<keyof typeof WeaverContext.namedTypes, number>>;
|
|
1153
|
-
protected aliasMap: WeakMap<GraphQLNamedType,
|
|
1154
|
-
setAlias(namedType: GraphQLNamedType,
|
|
1153
|
+
protected aliasMap: WeakMap<GraphQLNamedType, AliasList>;
|
|
1154
|
+
setAlias(namedType: GraphQLNamedType, fieldName: string | undefined, parent?: GraphQLNamedType): string;
|
|
1155
1155
|
/**
|
|
1156
1156
|
* @returns -1 if a is better than b, 1 if b is better than a, 0 if they are equal
|
|
1157
1157
|
*/
|
|
1158
1158
|
protected static higherPriorityThan(a: string | undefined, b: string | undefined): number;
|
|
1159
|
-
protected ensureAliasStore(namedType: GraphQLNamedType):
|
|
1160
|
-
protected pickAlias(namedType: GraphQLNamedType, aliases:
|
|
1161
|
-
protected reduceAliases(aliases:
|
|
1159
|
+
protected ensureAliasStore(namedType: GraphQLNamedType): AliasList;
|
|
1160
|
+
protected pickAlias(namedType: GraphQLNamedType, aliases: AliasList): string;
|
|
1161
|
+
protected reduceAliases(aliases: AliasList): string | undefined;
|
|
1162
1162
|
protected createFallbackAlias(namedType: GraphQLNamedType): string;
|
|
1163
1163
|
static provide<T>(func: () => T, value: WeaverContext | undefined): T;
|
|
1164
1164
|
}
|
|
1165
|
+
type AliasList = (string | [fieldName: string, parent: GraphQLNamedType])[];
|
|
1165
1166
|
declare const initWeaverContext: () => WeaverContext;
|
|
1166
1167
|
declare const provideWeaverContext: typeof WeaverContext.provide & {
|
|
1167
1168
|
inherit: <T>(func: () => T) => () => T;
|
|
@@ -1309,4 +1310,4 @@ declare class GraphQLSchemaLoom {
|
|
|
1309
1310
|
*/
|
|
1310
1311
|
declare const weave: typeof GraphQLSchemaLoom.weave;
|
|
1311
1312
|
//#endregion
|
|
1312
|
-
export {
|
|
1313
|
+
export { resolver as $, FieldOptions as $t, getGraphQLArgumentConfig as A, BaseChainFactory as An, MayGetter as At, ObjectChainResolver as B, SubscriptionChainFactory as Bn, tryIn as Bt, DirectiveItem as C, FieldOrOperation as Cn, Middleware as Ct, ListSilk as D, Resolver as Dn, applyMiddlewares as Dt, GQLoomExtensions as E, Query as En, MiddlewareOptions as Et, nullableSilk as F, MutationChainFactory as Fn, BatchLoadFn as Ft, createMutation as G, onlyMemoization as Gt, ResolverMeta as H, symbols_d_exports as Hn, assignContextMap as Ht, parseSilk as I, MutationFactoryWithResolve as In, EasyDataLoader as It, defaultSubscriptionResolve as J, getFieldOptions as Jt, createQuery as K, AUTO_ALIASING as Kt, silk as L, QueryChainFactory as Ln, LoomDataLoader as Lt, isSilk as M, FieldChainFactory as Mn, OmitInUnion as Mt, listSilk as N, FieldFactoryWithResolve as Nn, RequireKeys as Nt, NonNullSilk as O, Subscription as On, filterMiddlewares as Ot, nonNullSilk as P, IChainFactory as Pn, ValueOf as Pt, query$1 as Q, FieldFactoryWithUtils as Qt, ChainResolver as R, QueryFactoryWithResolve as Rn, markErrorLocation as Rt, inputToArgs as S, FieldMeta as Sn, CallableMiddlewareOptions as St, GQLoomExtensionAttribute as T, Operation as Tn, MiddlewareOperation as Tt, ToExecutorProps as U, StandardSchemaV1 as Un, getMemoizationMap as Ut, ResolverFactory as V, SubscriptionNeedResolve as Vn, OnlyMemoizationPayload as Vt, createField as W, isOnlyMemoryPayload as Wt, loom as X, getSubscriptionOptions as Xt, field as Y, getOperationOptions as Yt, mutation$1 as Z, FieldFactory as Zt, SchemaWeaver as _, SubscriptionFactory as _n, meta as _t, LoomObjectType as a, MutationFactory as an, getStandardValue as at, ensureInputObjectType as b, BaseField as bn, toFieldMap as bt, AliasList as c, OperationType as cn, pascalCase as ct, WeaverContext as d, QueryOptions as dn, ResolvingFieldsOptions as dt, FieldOrOperationType as en, subscription$1 as et, collectName as f, ResolverOptions as fn, getDeepResolvingFields as ft, weaverContext as g, ResolvingOptions as gn, mapValue as gt, provideWeaverContext as h, ResolverPayload as hn, deepMerge as ht, CoreSchemaWeaverConfigOptions as i, InferFieldOutput as in, createInputParser as it, getGraphQLType as j, ChainFactoryOptions as jn, MayPromise as jt, NullableSilk as k, types_loom_d_exports as kn, IsAny as kt, GlobalWeaverContext as l, QueryFactory as ln, screamingSnakeCase as lt, initWeaverContext as m, ResolverOptionsWithParent as mn, parseResolvingFields as mt, weave as n, GraphQLSilk as nn, InferInputI as nt, OPERATION_OBJECT_NAMES as o, MutationFactoryWithChain as on, parseInputValue as ot, collectNames as p, ResolverOptionsWithExtensions as pn, getResolvingFields as pt, createSubscription as q, DERIVED_DEPENDENCIES as qt, CoreSchemaWeaverConfig as r, InferFieldInput as rn, InferInputO as rt, getCacheType as s, MutationOptions as sn, capitalize as st, GraphQLSchemaLoom as t, GraphQLFieldOptions as tn, CallableInputParser as tt, WeaverConfig as u, QueryFactoryWithChain as un, ResolvingFields as ut, isSchemaVendorWeaver as v, SubscriptionFactoryWithChain as vn, notNullish as vt, DirectiveRecord as w, Mutation as wn, MiddlewareConfig as wt, ensureInputType as x, Field as xn, toObjMap as xt, ensureInterfaceType as y, SubscriptionOptions as yn, toArguments as yt, Executor as z, ResolvableSubscription as zn, markLocation as zt };
|
package/dist/index.cjs
CHANGED
|
@@ -55,11 +55,11 @@ var WeaverContext = class WeaverContext {
|
|
|
55
55
|
};
|
|
56
56
|
aliasCounters = {};
|
|
57
57
|
aliasMap = /* @__PURE__ */ new WeakMap();
|
|
58
|
-
setAlias(namedType,
|
|
58
|
+
setAlias(namedType, fieldName, parent) {
|
|
59
59
|
if (namedType.name === require_parse_resolving_fields.AUTO_ALIASING) WeaverContext.autoAliasTypes.add(namedType);
|
|
60
60
|
if (!WeaverContext.autoAliasTypes.has(namedType)) return namedType.name;
|
|
61
61
|
const aliases = this.ensureAliasStore(namedType);
|
|
62
|
-
if (
|
|
62
|
+
if (fieldName) parent ? aliases.push([fieldName, parent]) : aliases.push(fieldName);
|
|
63
63
|
return this.pickAlias(namedType, aliases);
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
@@ -77,12 +77,12 @@ var WeaverContext = class WeaverContext {
|
|
|
77
77
|
ensureAliasStore(namedType) {
|
|
78
78
|
const existing = this.aliasMap.get(namedType);
|
|
79
79
|
if (existing) return existing;
|
|
80
|
-
const aliases =
|
|
80
|
+
const aliases = [];
|
|
81
81
|
this.aliasMap.set(namedType, aliases);
|
|
82
82
|
Object.defineProperty(namedType, "name", {
|
|
83
83
|
get: () => this.pickAlias(namedType, aliases),
|
|
84
84
|
set: (value) => {
|
|
85
|
-
aliases.
|
|
85
|
+
aliases.push(value);
|
|
86
86
|
},
|
|
87
87
|
enumerable: true,
|
|
88
88
|
configurable: true
|
|
@@ -93,12 +93,19 @@ var WeaverContext = class WeaverContext {
|
|
|
93
93
|
const best = this.reduceAliases(aliases);
|
|
94
94
|
if (best && best !== require_parse_resolving_fields.AUTO_ALIASING) return best;
|
|
95
95
|
const fallback = this.createFallbackAlias(namedType);
|
|
96
|
-
aliases.
|
|
96
|
+
aliases.push(fallback);
|
|
97
97
|
return this.reduceAliases(aliases) ?? fallback;
|
|
98
98
|
}
|
|
99
99
|
reduceAliases(aliases) {
|
|
100
|
+
const stringAliases = aliases.filter((alias) => typeof alias === "string");
|
|
101
|
+
const tupleAliases = aliases.filter((alias) => Array.isArray(alias));
|
|
100
102
|
let best;
|
|
101
|
-
for (const alias of
|
|
103
|
+
for (const alias of stringAliases) if (best === void 0 || WeaverContext.higherPriorityThan(alias, best) < 0) best = alias;
|
|
104
|
+
if (typeof best === "string") return best;
|
|
105
|
+
for (const [fieldName, parent] of tupleAliases) {
|
|
106
|
+
const alias = parent.name + fieldName;
|
|
107
|
+
if (best === void 0 || WeaverContext.higherPriorityThan(alias, best) < 0) best = alias;
|
|
108
|
+
}
|
|
102
109
|
return best;
|
|
103
110
|
}
|
|
104
111
|
createFallbackAlias(namedType) {
|
|
@@ -1485,7 +1492,7 @@ var LoomObjectType = class extends graphql.GraphQLObjectType {
|
|
|
1485
1492
|
return {
|
|
1486
1493
|
...extract(field$1),
|
|
1487
1494
|
type: outputType,
|
|
1488
|
-
args: inputToArgs(field$1["~meta"].input, { fieldName
|
|
1495
|
+
args: inputToArgs(field$1["~meta"].input, { fieldName }),
|
|
1489
1496
|
resolve,
|
|
1490
1497
|
...subscribe ? { subscribe } : {}
|
|
1491
1498
|
};
|
|
@@ -1609,27 +1616,25 @@ const OPERATION_OBJECT_NAMES = new Set([
|
|
|
1609
1616
|
]);
|
|
1610
1617
|
function getCacheType(gqlType, options = {}) {
|
|
1611
1618
|
const context = options.weaverContext ?? weaverContext;
|
|
1612
|
-
const getAlias = () => {
|
|
1613
|
-
if (!options.fieldName || !options.parent) return;
|
|
1614
|
-
return parentName(options.parent.name) + pascalCase(options.fieldName);
|
|
1615
|
-
};
|
|
1616
1619
|
if (gqlType instanceof LoomObjectType) return gqlType;
|
|
1620
|
+
const parent = excludeOperationObject(options.parent);
|
|
1621
|
+
const fieldName = options.fieldName ? pascalCase(options.fieldName) : void 0;
|
|
1617
1622
|
if ((0, graphql.isObjectType)(gqlType)) {
|
|
1618
1623
|
const gqlObject = context.loomObjectMap?.get(gqlType);
|
|
1619
1624
|
if (gqlObject != null) {
|
|
1620
|
-
context.setAlias(gqlObject,
|
|
1625
|
+
context.setAlias(gqlObject, fieldName, parent);
|
|
1621
1626
|
return gqlObject;
|
|
1622
1627
|
}
|
|
1623
1628
|
const loomObject = new LoomObjectType(gqlType, options);
|
|
1624
1629
|
context.loomObjectMap?.set(gqlType, loomObject);
|
|
1625
|
-
context.setAlias(loomObject,
|
|
1630
|
+
context.setAlias(loomObject, fieldName, parent);
|
|
1626
1631
|
return loomObject;
|
|
1627
1632
|
} else if ((0, graphql.isListType)(gqlType)) return new graphql.GraphQLList(getCacheType(gqlType.ofType, options));
|
|
1628
1633
|
else if ((0, graphql.isNonNullType)(gqlType)) return new graphql.GraphQLNonNull(getCacheType(gqlType.ofType, options));
|
|
1629
1634
|
else if ((0, graphql.isUnionType)(gqlType)) {
|
|
1630
1635
|
const existing = context.loomUnionMap?.get(gqlType);
|
|
1631
1636
|
if (existing != null) {
|
|
1632
|
-
context.setAlias(existing,
|
|
1637
|
+
context.setAlias(existing, fieldName, parent);
|
|
1633
1638
|
return existing;
|
|
1634
1639
|
}
|
|
1635
1640
|
const config = gqlType.toConfig();
|
|
@@ -1641,17 +1646,18 @@ function getCacheType(gqlType, options = {}) {
|
|
|
1641
1646
|
}))
|
|
1642
1647
|
});
|
|
1643
1648
|
context.loomUnionMap?.set(gqlType, unionType);
|
|
1644
|
-
context.setAlias(unionType,
|
|
1649
|
+
context.setAlias(unionType, fieldName, parent);
|
|
1645
1650
|
return unionType;
|
|
1646
1651
|
} else if ((0, graphql.isEnumType)(gqlType) || (0, graphql.isInterfaceType)(gqlType) || (0, graphql.isScalarType)(gqlType)) {
|
|
1647
|
-
context.setAlias(gqlType,
|
|
1652
|
+
context.setAlias(gqlType, fieldName, parent);
|
|
1648
1653
|
return gqlType;
|
|
1649
1654
|
}
|
|
1650
1655
|
return gqlType;
|
|
1651
1656
|
}
|
|
1652
|
-
function
|
|
1653
|
-
if (
|
|
1654
|
-
return
|
|
1657
|
+
function excludeOperationObject(object) {
|
|
1658
|
+
if (object == null) return void 0;
|
|
1659
|
+
if (OPERATION_OBJECT_NAMES.has(object.name)) return void 0;
|
|
1660
|
+
return object;
|
|
1655
1661
|
}
|
|
1656
1662
|
|
|
1657
1663
|
//#endregion
|
package/dist/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { AUTO_ALIASING, BaseChainFactory, BaseField, BatchLoadFn, CallableInputParser, CallableMiddlewareOptions, ChainFactoryOptions, ChainResolver, CoreSchemaWeaverConfig, CoreSchemaWeaverConfigOptions, DERIVED_DEPENDENCIES, 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, MayGetter, 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, ResolvingFieldsOptions, 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, getGraphQLArgumentConfig, 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, toArguments, toFieldMap, toObjMap, tryIn, weave, weaverContext };
|
|
1
|
+
import { $ as resolver, $t as FieldOptions, A as getGraphQLArgumentConfig, An as BaseChainFactory, At as MayGetter, B as ObjectChainResolver, Bn as SubscriptionChainFactory, Bt as tryIn, C as DirectiveItem, Cn as FieldOrOperation, Ct as Middleware, D as ListSilk, Dn as Resolver, Dt as applyMiddlewares, E as GQLoomExtensions, En as Query, Et as MiddlewareOptions, F as nullableSilk, Fn as MutationChainFactory, Ft as BatchLoadFn, G as createMutation, Gt as onlyMemoization, H as ResolverMeta, Hn as symbols_d_exports, Ht as assignContextMap, I as parseSilk, In as MutationFactoryWithResolve, It as EasyDataLoader, J as defaultSubscriptionResolve, Jt as getFieldOptions, K as createQuery, Kt as AUTO_ALIASING, L as silk, Ln as QueryChainFactory, Lt as LoomDataLoader, M as isSilk, Mn as FieldChainFactory, Mt as OmitInUnion, N as listSilk, Nn as FieldFactoryWithResolve, Nt as RequireKeys, O as NonNullSilk, On as Subscription, Ot as filterMiddlewares, P as nonNullSilk, Pn as IChainFactory, Pt as ValueOf, Q as query, Qt as FieldFactoryWithUtils, R as ChainResolver, Rn as QueryFactoryWithResolve, Rt as markErrorLocation, S as inputToArgs, Sn as FieldMeta, St as CallableMiddlewareOptions, T as GQLoomExtensionAttribute, Tn as Operation, Tt as MiddlewareOperation, U as ToExecutorProps, Un as StandardSchemaV1, Ut as getMemoizationMap, V as ResolverFactory, Vn as SubscriptionNeedResolve, Vt as OnlyMemoizationPayload, W as createField, Wt as isOnlyMemoryPayload, X as loom, Xt as getSubscriptionOptions, Y as field, Yt as getOperationOptions, Z as mutation, Zt as FieldFactory, _ as SchemaWeaver, _n as SubscriptionFactory, _t as meta, a as LoomObjectType, an as MutationFactory, at as getStandardValue, b as ensureInputObjectType, bn as BaseField, bt as toFieldMap, c as AliasList, cn as OperationType, ct as pascalCase, d as WeaverContext, dn as QueryOptions, dt as ResolvingFieldsOptions, en as FieldOrOperationType, et as subscription, f as collectName, fn as ResolverOptions, ft as getDeepResolvingFields, g as weaverContext, gn as ResolvingOptions, gt as mapValue, h as provideWeaverContext, hn as ResolverPayload, ht as deepMerge, i as CoreSchemaWeaverConfigOptions, in as InferFieldOutput, it as createInputParser, j as getGraphQLType, jn as ChainFactoryOptions, jt as MayPromise, k as NullableSilk, kn as types_loom_d_exports, kt as IsAny, l as GlobalWeaverContext, ln as QueryFactory, lt as screamingSnakeCase, m as initWeaverContext, mn as ResolverOptionsWithParent, mt as parseResolvingFields, n as weave, nn as GraphQLSilk, nt as InferInputI, o as OPERATION_OBJECT_NAMES, on as MutationFactoryWithChain, ot as parseInputValue, p as collectNames, pn as ResolverOptionsWithExtensions, pt as getResolvingFields, q as createSubscription, qt as DERIVED_DEPENDENCIES, r as CoreSchemaWeaverConfig, rn as InferFieldInput, rt as InferInputO, s as getCacheType, sn as MutationOptions, st as capitalize, t as GraphQLSchemaLoom, tn as GraphQLFieldOptions, tt as CallableInputParser, u as WeaverConfig, un as QueryFactoryWithChain, ut as ResolvingFields, v as isSchemaVendorWeaver, vn as SubscriptionFactoryWithChain, vt as notNullish, w as DirectiveRecord, wn as Mutation, wt as MiddlewareConfig, x as ensureInputType, xn as Field, xt as toObjMap, y as ensureInterfaceType, yn as SubscriptionOptions, yt as toArguments, z as Executor, zn as ResolvableSubscription, zt as markLocation } from "./index-BW7_Sr0t.cjs";
|
|
2
|
+
export { AUTO_ALIASING, AliasList, BaseChainFactory, BaseField, BatchLoadFn, CallableInputParser, CallableMiddlewareOptions, ChainFactoryOptions, ChainResolver, CoreSchemaWeaverConfig, CoreSchemaWeaverConfigOptions, DERIVED_DEPENDENCIES, 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, MayGetter, 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, ResolvingFieldsOptions, 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, getGraphQLArgumentConfig, 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, toArguments, toFieldMap, toObjMap, tryIn, weave, weaverContext };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { AUTO_ALIASING, BaseChainFactory, BaseField, BatchLoadFn, CallableInputParser, CallableMiddlewareOptions, ChainFactoryOptions, ChainResolver, CoreSchemaWeaverConfig, CoreSchemaWeaverConfigOptions, DERIVED_DEPENDENCIES, 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, MayGetter, 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, ResolvingFieldsOptions, 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, getGraphQLArgumentConfig, 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, toArguments, toFieldMap, toObjMap, tryIn, weave, weaverContext };
|
|
1
|
+
import { $ as resolver, $t as FieldOptions, A as getGraphQLArgumentConfig, An as BaseChainFactory, At as MayGetter, B as ObjectChainResolver, Bn as SubscriptionChainFactory, Bt as tryIn, C as DirectiveItem, Cn as FieldOrOperation, Ct as Middleware, D as ListSilk, Dn as Resolver, Dt as applyMiddlewares, E as GQLoomExtensions, En as Query, Et as MiddlewareOptions, F as nullableSilk, Fn as MutationChainFactory, Ft as BatchLoadFn, G as createMutation, Gt as onlyMemoization, H as ResolverMeta, Hn as symbols_d_exports, Ht as assignContextMap, I as parseSilk, In as MutationFactoryWithResolve, It as EasyDataLoader, J as defaultSubscriptionResolve, Jt as getFieldOptions, K as createQuery, Kt as AUTO_ALIASING, L as silk, Ln as QueryChainFactory, Lt as LoomDataLoader, M as isSilk, Mn as FieldChainFactory, Mt as OmitInUnion, N as listSilk, Nn as FieldFactoryWithResolve, Nt as RequireKeys, O as NonNullSilk, On as Subscription, Ot as filterMiddlewares, P as nonNullSilk, Pn as IChainFactory, Pt as ValueOf, Q as query, Qt as FieldFactoryWithUtils, R as ChainResolver, Rn as QueryFactoryWithResolve, Rt as markErrorLocation, S as inputToArgs, Sn as FieldMeta, St as CallableMiddlewareOptions, T as GQLoomExtensionAttribute, Tn as Operation, Tt as MiddlewareOperation, U as ToExecutorProps, Un as StandardSchemaV1, Ut as getMemoizationMap, V as ResolverFactory, Vn as SubscriptionNeedResolve, Vt as OnlyMemoizationPayload, W as createField, Wt as isOnlyMemoryPayload, X as loom, Xt as getSubscriptionOptions, Y as field, Yt as getOperationOptions, Z as mutation, Zt as FieldFactory, _ as SchemaWeaver, _n as SubscriptionFactory, _t as meta, a as LoomObjectType, an as MutationFactory, at as getStandardValue, b as ensureInputObjectType, bn as BaseField, bt as toFieldMap, c as AliasList, cn as OperationType, ct as pascalCase, d as WeaverContext, dn as QueryOptions, dt as ResolvingFieldsOptions, en as FieldOrOperationType, et as subscription, f as collectName, fn as ResolverOptions, ft as getDeepResolvingFields, g as weaverContext, gn as ResolvingOptions, gt as mapValue, h as provideWeaverContext, hn as ResolverPayload, ht as deepMerge, i as CoreSchemaWeaverConfigOptions, in as InferFieldOutput, it as createInputParser, j as getGraphQLType, jn as ChainFactoryOptions, jt as MayPromise, k as NullableSilk, kn as types_loom_d_exports, kt as IsAny, l as GlobalWeaverContext, ln as QueryFactory, lt as screamingSnakeCase, m as initWeaverContext, mn as ResolverOptionsWithParent, mt as parseResolvingFields, n as weave, nn as GraphQLSilk, nt as InferInputI, o as OPERATION_OBJECT_NAMES, on as MutationFactoryWithChain, ot as parseInputValue, p as collectNames, pn as ResolverOptionsWithExtensions, pt as getResolvingFields, q as createSubscription, qt as DERIVED_DEPENDENCIES, r as CoreSchemaWeaverConfig, rn as InferFieldInput, rt as InferInputO, s as getCacheType, sn as MutationOptions, st as capitalize, t as GraphQLSchemaLoom, tn as GraphQLFieldOptions, tt as CallableInputParser, u as WeaverConfig, un as QueryFactoryWithChain, ut as ResolvingFields, v as isSchemaVendorWeaver, vn as SubscriptionFactoryWithChain, vt as notNullish, w as DirectiveRecord, wn as Mutation, wt as MiddlewareConfig, x as ensureInputType, xn as Field, xt as toObjMap, y as ensureInterfaceType, yn as SubscriptionOptions, yt as toArguments, z as Executor, zn as ResolvableSubscription, zt as markLocation } from "./index-CFo2-jU-.js";
|
|
2
|
+
export { AUTO_ALIASING, AliasList, BaseChainFactory, BaseField, BatchLoadFn, CallableInputParser, CallableMiddlewareOptions, ChainFactoryOptions, ChainResolver, CoreSchemaWeaverConfig, CoreSchemaWeaverConfigOptions, DERIVED_DEPENDENCIES, 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, MayGetter, 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, ResolvingFieldsOptions, 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, getGraphQLArgumentConfig, 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, toArguments, toFieldMap, toObjMap, tryIn, weave, weaverContext };
|
package/dist/index.js
CHANGED
|
@@ -55,11 +55,11 @@ var WeaverContext = class WeaverContext {
|
|
|
55
55
|
};
|
|
56
56
|
aliasCounters = {};
|
|
57
57
|
aliasMap = /* @__PURE__ */ new WeakMap();
|
|
58
|
-
setAlias(namedType,
|
|
58
|
+
setAlias(namedType, fieldName, parent) {
|
|
59
59
|
if (namedType.name === AUTO_ALIASING) WeaverContext.autoAliasTypes.add(namedType);
|
|
60
60
|
if (!WeaverContext.autoAliasTypes.has(namedType)) return namedType.name;
|
|
61
61
|
const aliases = this.ensureAliasStore(namedType);
|
|
62
|
-
if (
|
|
62
|
+
if (fieldName) parent ? aliases.push([fieldName, parent]) : aliases.push(fieldName);
|
|
63
63
|
return this.pickAlias(namedType, aliases);
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
@@ -77,12 +77,12 @@ var WeaverContext = class WeaverContext {
|
|
|
77
77
|
ensureAliasStore(namedType) {
|
|
78
78
|
const existing = this.aliasMap.get(namedType);
|
|
79
79
|
if (existing) return existing;
|
|
80
|
-
const aliases =
|
|
80
|
+
const aliases = [];
|
|
81
81
|
this.aliasMap.set(namedType, aliases);
|
|
82
82
|
Object.defineProperty(namedType, "name", {
|
|
83
83
|
get: () => this.pickAlias(namedType, aliases),
|
|
84
84
|
set: (value) => {
|
|
85
|
-
aliases.
|
|
85
|
+
aliases.push(value);
|
|
86
86
|
},
|
|
87
87
|
enumerable: true,
|
|
88
88
|
configurable: true
|
|
@@ -93,12 +93,19 @@ var WeaverContext = class WeaverContext {
|
|
|
93
93
|
const best = this.reduceAliases(aliases);
|
|
94
94
|
if (best && best !== AUTO_ALIASING) return best;
|
|
95
95
|
const fallback = this.createFallbackAlias(namedType);
|
|
96
|
-
aliases.
|
|
96
|
+
aliases.push(fallback);
|
|
97
97
|
return this.reduceAliases(aliases) ?? fallback;
|
|
98
98
|
}
|
|
99
99
|
reduceAliases(aliases) {
|
|
100
|
+
const stringAliases = aliases.filter((alias) => typeof alias === "string");
|
|
101
|
+
const tupleAliases = aliases.filter((alias) => Array.isArray(alias));
|
|
100
102
|
let best;
|
|
101
|
-
for (const alias of
|
|
103
|
+
for (const alias of stringAliases) if (best === void 0 || WeaverContext.higherPriorityThan(alias, best) < 0) best = alias;
|
|
104
|
+
if (typeof best === "string") return best;
|
|
105
|
+
for (const [fieldName, parent] of tupleAliases) {
|
|
106
|
+
const alias = parent.name + fieldName;
|
|
107
|
+
if (best === void 0 || WeaverContext.higherPriorityThan(alias, best) < 0) best = alias;
|
|
108
|
+
}
|
|
102
109
|
return best;
|
|
103
110
|
}
|
|
104
111
|
createFallbackAlias(namedType) {
|
|
@@ -1485,7 +1492,7 @@ var LoomObjectType = class extends GraphQLObjectType {
|
|
|
1485
1492
|
return {
|
|
1486
1493
|
...extract(field$1),
|
|
1487
1494
|
type: outputType,
|
|
1488
|
-
args: inputToArgs(field$1["~meta"].input, { fieldName
|
|
1495
|
+
args: inputToArgs(field$1["~meta"].input, { fieldName }),
|
|
1489
1496
|
resolve,
|
|
1490
1497
|
...subscribe ? { subscribe } : {}
|
|
1491
1498
|
};
|
|
@@ -1609,27 +1616,25 @@ const OPERATION_OBJECT_NAMES = new Set([
|
|
|
1609
1616
|
]);
|
|
1610
1617
|
function getCacheType(gqlType, options = {}) {
|
|
1611
1618
|
const context = options.weaverContext ?? weaverContext;
|
|
1612
|
-
const getAlias = () => {
|
|
1613
|
-
if (!options.fieldName || !options.parent) return;
|
|
1614
|
-
return parentName(options.parent.name) + pascalCase(options.fieldName);
|
|
1615
|
-
};
|
|
1616
1619
|
if (gqlType instanceof LoomObjectType) return gqlType;
|
|
1620
|
+
const parent = excludeOperationObject(options.parent);
|
|
1621
|
+
const fieldName = options.fieldName ? pascalCase(options.fieldName) : void 0;
|
|
1617
1622
|
if (isObjectType(gqlType)) {
|
|
1618
1623
|
const gqlObject = context.loomObjectMap?.get(gqlType);
|
|
1619
1624
|
if (gqlObject != null) {
|
|
1620
|
-
context.setAlias(gqlObject,
|
|
1625
|
+
context.setAlias(gqlObject, fieldName, parent);
|
|
1621
1626
|
return gqlObject;
|
|
1622
1627
|
}
|
|
1623
1628
|
const loomObject = new LoomObjectType(gqlType, options);
|
|
1624
1629
|
context.loomObjectMap?.set(gqlType, loomObject);
|
|
1625
|
-
context.setAlias(loomObject,
|
|
1630
|
+
context.setAlias(loomObject, fieldName, parent);
|
|
1626
1631
|
return loomObject;
|
|
1627
1632
|
} else if (isListType(gqlType)) return new GraphQLList(getCacheType(gqlType.ofType, options));
|
|
1628
1633
|
else if (isNonNullType(gqlType)) return new GraphQLNonNull(getCacheType(gqlType.ofType, options));
|
|
1629
1634
|
else if (isUnionType(gqlType)) {
|
|
1630
1635
|
const existing = context.loomUnionMap?.get(gqlType);
|
|
1631
1636
|
if (existing != null) {
|
|
1632
|
-
context.setAlias(existing,
|
|
1637
|
+
context.setAlias(existing, fieldName, parent);
|
|
1633
1638
|
return existing;
|
|
1634
1639
|
}
|
|
1635
1640
|
const config = gqlType.toConfig();
|
|
@@ -1641,17 +1646,18 @@ function getCacheType(gqlType, options = {}) {
|
|
|
1641
1646
|
}))
|
|
1642
1647
|
});
|
|
1643
1648
|
context.loomUnionMap?.set(gqlType, unionType);
|
|
1644
|
-
context.setAlias(unionType,
|
|
1649
|
+
context.setAlias(unionType, fieldName, parent);
|
|
1645
1650
|
return unionType;
|
|
1646
1651
|
} else if (isEnumType(gqlType) || isInterfaceType(gqlType) || isScalarType(gqlType)) {
|
|
1647
|
-
context.setAlias(gqlType,
|
|
1652
|
+
context.setAlias(gqlType, fieldName, parent);
|
|
1648
1653
|
return gqlType;
|
|
1649
1654
|
}
|
|
1650
1655
|
return gqlType;
|
|
1651
1656
|
}
|
|
1652
|
-
function
|
|
1653
|
-
if (
|
|
1654
|
-
return
|
|
1657
|
+
function excludeOperationObject(object) {
|
|
1658
|
+
if (object == null) return void 0;
|
|
1659
|
+
if (OPERATION_OBJECT_NAMES.has(object.name)) return void 0;
|
|
1660
|
+
return object;
|
|
1655
1661
|
}
|
|
1656
1662
|
|
|
1657
1663
|
//#endregion
|