@gqloom/core 0.14.1 → 0.14.3

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.
@@ -0,0 +1,18 @@
1
+ //#region rolldown:runtime
2
+ var __defProp = Object.defineProperty;
3
+ var __export = (all, symbols) => {
4
+ let target = {};
5
+ for (var name in all) {
6
+ __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ }
11
+ if (symbols) {
12
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
13
+ }
14
+ return target;
15
+ };
16
+
17
+ //#endregion
18
+ export { __export as t };
package/dist/context.cjs CHANGED
@@ -1,6 +1,5 @@
1
- const require_parse_resolving_fields = require('./parse-resolving-fields-Czn0O39L.cjs');
1
+ const require_parse_resolving_fields = require('./parse-resolving-fields-k74tX3i9.cjs');
2
2
  let node_async_hooks = require("node:async_hooks");
3
- node_async_hooks = require_parse_resolving_fields.__toESM(node_async_hooks);
4
3
 
5
4
  //#region src/context/async-iterator.ts
6
5
  function bindAsyncIterator(storage, generator) {
@@ -1,4 +1,4 @@
1
- import { Rt as OnlyMemoizationPayload, _n as BaseField, bt as Middleware, fn as ResolverPayload, lt as ResolvingFields } from "./index-DPuy3FIT.cjs";
1
+ import { Ct as Middleware, Vt as OnlyMemoizationPayload, bn as BaseField, hn as ResolverPayload, ut as ResolvingFields } from "./index-DAymluHs.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 { Rt as OnlyMemoizationPayload, _n as BaseField, bt as Middleware, fn as ResolverPayload, lt as ResolvingFields } from "./index-DyGHE5li.js";
1
+ import { Ct as Middleware, Vt as OnlyMemoizationPayload, bn as BaseField, hn as ResolverPayload, ut as ResolvingFields } from "./index-BWCXjTlY.js";
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
 
4
4
  //#region src/context/async-iterator.d.ts
package/dist/context.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as getMemoizationMap, n as getResolvingFields, o as isOnlyMemoryPayload, s as onlyMemoization } from "./parse-resolving-fields-CH8rJgks.js";
1
+ import { a as getMemoizationMap, n as getResolvingFields, o as isOnlyMemoryPayload, s as onlyMemoization } from "./parse-resolving-fields-GAEhHjUw.js";
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
 
4
4
  //#region src/context/async-iterator.ts
@@ -1,4 +1,4 @@
1
- import { GraphQLArgumentConfig, GraphQLFieldConfig, GraphQLFieldConfigArgumentMap, GraphQLFieldExtensions, GraphQLFieldMap, GraphQLInputObjectType, GraphQLInputType, GraphQLInterfaceType, GraphQLInterfaceTypeConfig, GraphQLList, GraphQLNamedType, GraphQLNonNull, GraphQLNullableType, GraphQLObjectType, GraphQLObjectTypeConfig, GraphQLOutputType, GraphQLResolveInfo, GraphQLScalarType, GraphQLSchema, GraphQLSchemaConfig, GraphQLType, GraphQLUnionType } from "graphql";
1
+ import { GraphQLArgument, GraphQLArgumentConfig, GraphQLFieldConfig, GraphQLFieldConfigArgumentMap, GraphQLFieldExtensions, GraphQLFieldMap, GraphQLInputObjectType, GraphQLInputType, GraphQLInterfaceType, GraphQLInterfaceTypeConfig, GraphQLList, GraphQLNamedType, GraphQLNonNull, GraphQLNullableType, GraphQLObjectType, GraphQLObjectTypeConfig, GraphQLOutputType, GraphQLResolveInfo, GraphQLScalarType, GraphQLSchema, GraphQLSchemaConfig, GraphQLType, GraphQLUnionType } from "graphql";
2
2
 
3
3
  //#region ../../node_modules/.pnpm/@standard-schema+spec@1.0.0/node_modules/@standard-schema/spec/dist/index.d.ts
4
4
  /** The Standard Schema interface. */
@@ -471,7 +471,7 @@ interface Resolver {
471
471
  }
472
472
  type Operation = Query<GraphQLSilk, GraphQLSilk | Record<string, GraphQLSilk> | void> | Mutation<GraphQLSilk, GraphQLSilk | Record<string, GraphQLSilk> | void> | Subscription<GraphQLSilk, GraphQLSilk | Record<string, GraphQLSilk> | void, any>;
473
473
  type FieldOrOperation = Field<GraphQLSilk, GraphQLSilk, GraphQLSilk | Record<string, GraphQLSilk> | void, string[] | undefined> | Operation;
474
- type ReSilk<T$1 extends GraphQLSilk> = GraphQLSilk<NonNullable<T$1["~standard"]["types"]>["output"], NonNullable<T$1["~standard"]["types"]>["input"]>;
474
+ type ReSilk<T extends GraphQLSilk> = GraphQLSilk<NonNullable<T["~standard"]["types"]>["output"], NonNullable<T["~standard"]["types"]>["input"]>;
475
475
  //#endregion
476
476
  //#region src/resolver/types.d.ts
477
477
  interface GraphQLSilk<TOutput$1 = any, TInput$1 = any> extends StandardSchemaV1<TInput$1, TOutput$1> {
@@ -642,7 +642,7 @@ declare function assignContextMap(target: ContextMemoryContainer): WeakMap<WeakK
642
642
  //#endregion
643
643
  //#region src/utils/error.d.ts
644
644
  declare function markErrorLocation<TError>(error: TError, ...locations: string[]): TError;
645
- declare function tryIn<T$1>(func: () => T$1, ...locations: string[]): T$1;
645
+ declare function tryIn<T>(func: () => T, ...locations: string[]): T;
646
646
  /**
647
647
  * mark message with location
648
648
  * @param message origin message
@@ -687,12 +687,12 @@ declare class EasyDataLoader<TKey, TData> extends LoomDataLoader<TKey, TData> {
687
687
  }
688
688
  //#endregion
689
689
  //#region src/utils/types.d.ts
690
- type MayPromise<T$1> = T$1 | Promise<T$1>;
691
- type IsAny<T$1> = 0 extends 1 & T$1 ? true : false;
692
- type ValueOf<T$1 extends object> = T$1[keyof T$1];
690
+ type MayPromise<T> = T | Promise<T>;
691
+ type IsAny<T> = 0 extends 1 & T ? true : false;
692
+ type ValueOf<T extends object> = T[keyof T];
693
693
  type OmitInUnion<TUnion, TOmit> = TUnion extends infer T ? T extends TOmit ? never : T : never;
694
- type RequireKeys<T$1, TKey extends string | number | symbol> = { [P in keyof T$1 as P extends TKey ? P : never]-?: T$1[P] } & { [P in keyof T$1 as P extends TKey ? never : P]: T$1[P] };
695
- type MayGetter<T$1> = T$1 | (() => T$1);
694
+ type RequireKeys<T, TKey extends string | number | symbol> = { [P in keyof T as P extends TKey ? P : never]-?: T[P] } & { [P in keyof T as P extends TKey ? never : P]: T[P] };
695
+ type MayGetter<T> = T | (() => T);
696
696
  //#endregion
697
697
  //#region src/utils/middleware.d.ts
698
698
  /**
@@ -739,13 +739,16 @@ declare function filterMiddlewares(operation: MiddlewareOperation, ...middleware
739
739
  * Creates an object map with the same keys as `map` and values generated by
740
740
  * running each value of `record` thru `fn`.
741
741
  */
742
- declare function mapValue<T$1, V>(record: Record<string, T$1>, fn: (value: T$1, key: string) => V | typeof mapValue.SKIP): Record<string, V>;
742
+ declare function mapValue<T, V>(record: Record<string, T>, fn: (value: T, key: string) => V | typeof mapValue.SKIP): Record<string, V>;
743
743
  declare namespace mapValue {
744
744
  var SKIP: unique symbol;
745
745
  }
746
- declare function toObjMap<T$1>(obj: Maybe<ReadOnlyObjMapLike<T$1>>): ReadOnlyObjMap<T$1>;
747
- declare function notNullish<T$1>(x: T$1 | undefined | null): x is T$1;
748
- declare function deepMerge<T$1 extends Record<string, any>>(...objects: (T$1 | null | undefined)[]): T$1;
746
+ declare function toObjMap<T>(obj: Readonly<Record<string, T>> | null | undefined): Record<string, T>;
747
+ /** @deprecated use `x != null` instead */
748
+ declare function notNullish<T>(x: T | undefined | null): x is T;
749
+ declare function toArguments(map: Record<string, GraphQLArgumentConfig>): ReadonlyArray<GraphQLArgument>;
750
+ declare function toFieldMap(fields: Record<string, GraphQLFieldConfig<any, any>>): GraphQLFieldMap<any, any>;
751
+ declare function deepMerge<T extends Record<string, any>>(...objects: (T | null | undefined)[]): T;
749
752
  /**
750
753
  * Wraps the provided data in an object with a single key `"~meta"`.
751
754
  *
@@ -757,16 +760,9 @@ declare function deepMerge<T$1 extends Record<string, any>>(...objects: (T$1 | n
757
760
  * const metaData = meta(originalData);
758
761
  * console.log(metaData); // Output: { "~meta": { key: "value" } }
759
762
  */
760
- declare function meta<T$1>(data: T$1): {
761
- "~meta": T$1;
763
+ declare function meta<T>(data: T): {
764
+ "~meta": T;
762
765
  };
763
- type Maybe<T$1> = null | undefined | T$1;
764
- type ReadOnlyObjMapLike<T$1> = ReadOnlyObjMap<T$1> | {
765
- readonly [key: string]: T$1;
766
- };
767
- interface ReadOnlyObjMap<T$1> {
768
- readonly [key: string]: T$1;
769
- }
770
766
  //#endregion
771
767
  //#region src/utils/parse-resolving-fields.d.ts
772
768
  /**
@@ -831,7 +827,7 @@ declare function parseResolvingFields(info: GraphQLResolveInfo, options?: Resolv
831
827
  //#endregion
832
828
  //#region src/utils/string.d.ts
833
829
  declare function pascalCase(str: string): string;
834
- declare function capitalize<T$1 extends string>(str: T$1): Capitalize<T$1>;
830
+ declare function capitalize<T extends string>(str: T): Capitalize<T>;
835
831
  declare function screamingSnakeCase(str: string): string;
836
832
  //#endregion
837
833
  //#region src/resolver/input.d.ts
@@ -869,9 +865,9 @@ interface CallableInputParser<TSchema extends GraphQLSilk | Record<string, Graph
869
865
  }
870
866
  declare function createInputParser<TSchema extends GraphQLSilk | Record<string, GraphQLSilk> | void>(schema: TSchema, value: InferInputI<TSchema>): CallableInputParser<TSchema>;
871
867
  declare function parseInputValue<TSchema extends GraphQLSilk | Record<string, GraphQLSilk> | void>(inputSchema: TSchema, input: any): MayPromise<StandardSchemaV1.Result<InferInputO<TSchema>>>;
872
- declare function getStandardValue<T$1>(result: StandardSchemaV1.Result<T$1>): T$1;
873
- declare function getStandardValue<T$1>(result?: StandardSchemaV1.Result<T$1>): T$1 | undefined;
874
- declare function getStandardValue<T$1>(result: StandardSchemaV1.Result<T$1> | null): T$1 | null;
868
+ declare function getStandardValue<T>(result: StandardSchemaV1.Result<T>): T;
869
+ declare function getStandardValue<T>(result?: StandardSchemaV1.Result<T>): T | undefined;
870
+ declare function getStandardValue<T>(result: StandardSchemaV1.Result<T> | null): T | null;
875
871
  //#endregion
876
872
  //#region src/resolver/resolver.d.ts
877
873
  /**
@@ -1087,9 +1083,9 @@ declare function getGraphQLArgumentConfig(silk: GraphQLSilk): Omit<GraphQLArgume
1087
1083
  declare function parseSilk<TSilk extends GraphQLSilk>(silk: TSilk, input: StandardSchemaV1.InferInput<TSilk>): MayPromise<StandardSchemaV1.Result<StandardSchemaV1.InferOutput<TSilk>>>;
1088
1084
  declare function isSilk(target: any): target is GraphQLSilk;
1089
1085
  type GraphQLVariants<TSource$1 extends GraphQLNullableType> = TSource$1 | GraphQLList<TSource$1> | GraphQLList<GraphQLNonNull<TSource$1>> | GraphQLNonNull<TSource$1> | GraphQLNonNull<GraphQLList<TSource$1>> | GraphQLNonNull<GraphQLList<GraphQLNonNull<TSource$1>>>;
1090
- type InferScalarInternalByVariants<T$1 extends GraphQLVariants<GraphQLScalarType>> = T$1 extends GraphQLNonNull<infer U> ? U extends GraphQLVariants<GraphQLScalarType> ? NonNullable<InferScalarInternalByVariants<U>> : never : T$1 extends GraphQLList<infer U> ? U extends GraphQLVariants<GraphQLScalarType> ? InferScalarInternalByVariants<U>[] : never : T$1 extends GraphQLScalarType<infer TInternal, any> ? TInternal | null | undefined : never;
1091
- type InferScalarExternalByVariants<T$1 extends GraphQLVariants<GraphQLScalarType>> = T$1 extends GraphQLNonNull<infer U> ? U extends GraphQLVariants<GraphQLScalarType> ? NonNullable<InferScalarExternalByVariants<U>> : never : T$1 extends GraphQLList<infer U> ? U extends GraphQLVariants<GraphQLScalarType> ? InferScalarExternalByVariants<U>[] : never : T$1 extends GraphQLScalarType<any, infer TExternal> ? TExternal | null | undefined : never;
1092
- type InferObjectSourceByVariants<T$1 extends GraphQLVariants<GraphQLObjectType>> = T$1 extends GraphQLNonNull<infer U> ? U extends GraphQLVariants<GraphQLObjectType> ? NonNullable<InferObjectSourceByVariants<U>> : never : T$1 extends GraphQLList<infer U> ? U extends GraphQLVariants<GraphQLObjectType> ? InferObjectSourceByVariants<U>[] : never : T$1 extends GraphQLObjectType<infer TSource> ? TSource | null | undefined : never;
1086
+ 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;
1087
+ 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;
1088
+ 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;
1093
1089
  //#endregion
1094
1090
  //#region src/schema/extensions.d.ts
1095
1091
  interface GQLoomExtensions {
@@ -1145,7 +1141,7 @@ declare class WeaverContext {
1145
1141
  setConfig<TConfig extends WeaverConfig>(config: TConfig): void;
1146
1142
  deleteConfig<TConfig extends WeaverConfig>(key: TConfig[typeof WEAVER_CONFIG]): void;
1147
1143
  memoNamedType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(gqlTypeValue: TGraphQLType): TGraphQLType;
1148
- getNamedType<T$1 extends GraphQLOutputType>(name: string): T$1 | undefined;
1144
+ getNamedType<T extends GraphQLOutputType>(name: string): T | undefined;
1149
1145
  protected static readonly namedTypes: {
1150
1146
  readonly Object: "Object";
1151
1147
  readonly Union: "Union";
@@ -1154,21 +1150,22 @@ declare class WeaverContext {
1154
1150
  readonly Scalar: "Scalar";
1155
1151
  };
1156
1152
  protected aliasCounters: Partial<Record<keyof typeof WeaverContext.namedTypes, number>>;
1157
- protected aliasMap: WeakMap<GraphQLNamedType, Set<string>>;
1158
- setAlias(namedType: GraphQLNamedType, alias: string | undefined): string;
1153
+ protected aliasMap: WeakMap<GraphQLNamedType, AliasList>;
1154
+ setAlias(namedType: GraphQLNamedType, fieldName: string | undefined, parent?: GraphQLNamedType): string;
1159
1155
  /**
1160
1156
  * @returns -1 if a is better than b, 1 if b is better than a, 0 if they are equal
1161
1157
  */
1162
1158
  protected static higherPriorityThan(a: string | undefined, b: string | undefined): number;
1163
- protected ensureAliasStore(namedType: GraphQLNamedType): Set<string>;
1164
- protected pickAlias(namedType: GraphQLNamedType, aliases: Set<string>): string;
1165
- protected reduceAliases(aliases: Iterable<string>): string | undefined;
1159
+ protected ensureAliasStore(namedType: GraphQLNamedType): AliasList;
1160
+ protected pickAlias(namedType: GraphQLNamedType, aliases: AliasList): string;
1161
+ protected reduceAliases(aliases: AliasList): string | undefined;
1166
1162
  protected createFallbackAlias(namedType: GraphQLNamedType): string;
1167
- static provide<T$1>(func: () => T$1, value: WeaverContext | undefined): T$1;
1163
+ static provide<T>(func: () => T, value: WeaverContext | undefined): T;
1168
1164
  }
1165
+ type AliasList = (string | [fieldName: string, parent: GraphQLNamedType])[];
1169
1166
  declare const initWeaverContext: () => WeaverContext;
1170
1167
  declare const provideWeaverContext: typeof WeaverContext.provide & {
1171
- inherit: <T$1>(func: () => T$1) => () => T$1;
1168
+ inherit: <T>(func: () => T) => () => T;
1172
1169
  };
1173
1170
  interface WeaverConfig {
1174
1171
  [WEAVER_CONFIG]: string | symbol;
@@ -1191,7 +1188,7 @@ declare class GlobalWeaverContext implements Partial<Omit<WeaverContext, GlobalC
1191
1188
  setConfig(config: WeaverConfig): void;
1192
1189
  deleteConfig(key: string | symbol): void;
1193
1190
  useConfig<TConfig extends WeaverConfig, TCallback extends () => any>(config: TConfig, callback: TCallback): ReturnType<TCallback>;
1194
- getNamedType<T$1 extends GraphQLOutputType>(name: string): T$1 | undefined;
1191
+ getNamedType<T extends GraphQLOutputType>(name: string): T | undefined;
1195
1192
  memoNamedType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(gqlType: TGraphQLType): TGraphQLType;
1196
1193
  getGraphQLType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(origin: object): TGraphQLType | undefined;
1197
1194
  memoGraphQLType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(origin: object, gqlType: TGraphQLType): TGraphQLType;
@@ -1313,4 +1310,4 @@ declare class GraphQLSchemaLoom {
1313
1310
  */
1314
1311
  declare const weave: typeof GraphQLSchemaLoom.weave;
1315
1312
  //#endregion
1316
- export { subscription$1 as $, GraphQLSilk as $t, getGraphQLType as A, FieldFactoryWithResolve as An, RequireKeys as At, ResolverFactory as B, StandardSchemaV1 as Bn, getMemoizationMap as Bt, DirectiveRecord as C, Query as Cn, MiddlewareOptions as Ct, NonNullSilk as D, BaseChainFactory as Dn, MayGetter as Dt, ListSilk as E, types_loom_d_exports as En, IsAny as Et, parseSilk as F, QueryFactoryWithResolve as Fn, markErrorLocation as Ft, createQuery as G, getFieldOptions as Gt, ToExecutorProps as H, onlyMemoization as Ht, silk as I, ResolvableSubscription as In, markLocation as It, field as J, FieldFactory as Jt, createSubscription as K, getOperationOptions as Kt, ChainResolver as L, SubscriptionChainFactory as Ln, tryIn as Lt, listSilk as M, MutationChainFactory as Mn, BatchLoadFn as Mt, nonNullSilk as N, MutationFactoryWithResolve as Nn, EasyDataLoader as Nt, NullableSilk as O, ChainFactoryOptions as On, MayPromise as Ot, nullableSilk as P, QueryChainFactory as Pn, LoomDataLoader as Pt, resolver as Q, GraphQLFieldOptions as Qt, Executor as R, SubscriptionNeedResolve as Rn, OnlyMemoizationPayload as Rt, DirectiveItem as S, Operation as Sn, MiddlewareOperation as St, GQLoomExtensions as T, Subscription as Tn, filterMiddlewares as Tt, createField as U, AUTO_ALIASING as Ut, ResolverMeta as V, isOnlyMemoryPayload as Vt, createMutation as W, DERIVED_DEPENDENCIES as Wt, mutation$1 as X, FieldOptions as Xt, loom as Y, FieldFactoryWithUtils as Yt, query$1 as Z, FieldOrOperationType as Zt, isSchemaVendorWeaver as _, BaseField as _n, notNullish as _t, LoomObjectType as a, OperationType as an, parseInputValue as at, ensureInputType as b, FieldOrOperation as bn, Middleware as bt, GlobalWeaverContext as c, QueryOptions as cn, screamingSnakeCase as ct, collectName as d, ResolverOptionsWithParent as dn, getDeepResolvingFields as dt, InferFieldInput as en, CallableInputParser as et, collectNames as f, ResolverPayload as fn, getResolvingFields as ft, SchemaWeaver as g, SubscriptionOptions as gn, meta as gt, weaverContext as h, SubscriptionFactoryWithChain as hn, mapValue as ht, CoreSchemaWeaverConfigOptions as i, MutationOptions as in, getStandardValue as it, isSilk as j, IChainFactory as jn, ValueOf as jt, getGraphQLArgumentConfig as k, FieldChainFactory as kn, OmitInUnion as kt, WeaverConfig as l, ResolverOptions as ln, ResolvingFields as lt, provideWeaverContext as m, SubscriptionFactory as mn, deepMerge as mt, weave as n, MutationFactory as nn, InferInputO as nt, OPERATION_OBJECT_NAMES as o, QueryFactory as on, capitalize as ot, initWeaverContext as p, ResolvingOptions as pn, parseResolvingFields as pt, defaultSubscriptionResolve as q, getSubscriptionOptions as qt, CoreSchemaWeaverConfig as r, MutationFactoryWithChain as rn, createInputParser as rt, getCacheType as s, QueryFactoryWithChain as sn, pascalCase as st, GraphQLSchemaLoom as t, InferFieldOutput as tn, InferInputI as tt, WeaverContext as u, ResolverOptionsWithExtensions as un, ResolvingFieldsOptions as ut, ensureInterfaceType as v, Field as vn, toObjMap as vt, GQLoomExtensionAttribute as w, Resolver as wn, applyMiddlewares as wt, inputToArgs as x, Mutation as xn, MiddlewareConfig as xt, ensureInputObjectType as y, FieldMeta as yn, CallableMiddlewareOptions as yt, ObjectChainResolver as z, symbols_d_exports as zn, assignContextMap as zt };
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 };
@@ -1,4 +1,4 @@
1
- import { GraphQLArgumentConfig, GraphQLFieldConfig, GraphQLFieldConfigArgumentMap, GraphQLFieldExtensions, GraphQLFieldMap, GraphQLInputObjectType, GraphQLInputType, GraphQLInterfaceType, GraphQLInterfaceTypeConfig, GraphQLList, GraphQLNamedType, GraphQLNonNull, GraphQLNullableType, GraphQLObjectType, GraphQLObjectTypeConfig, GraphQLOutputType, GraphQLResolveInfo, GraphQLScalarType, GraphQLSchema, GraphQLSchemaConfig, GraphQLType, GraphQLUnionType } from "graphql";
1
+ import { GraphQLArgument, GraphQLArgumentConfig, GraphQLFieldConfig, GraphQLFieldConfigArgumentMap, GraphQLFieldExtensions, GraphQLFieldMap, GraphQLInputObjectType, GraphQLInputType, GraphQLInterfaceType, GraphQLInterfaceTypeConfig, GraphQLList, GraphQLNamedType, GraphQLNonNull, GraphQLNullableType, GraphQLObjectType, GraphQLObjectTypeConfig, GraphQLOutputType, GraphQLResolveInfo, GraphQLScalarType, GraphQLSchema, GraphQLSchemaConfig, GraphQLType, GraphQLUnionType } from "graphql";
2
2
 
3
3
  //#region rolldown:runtime
4
4
  //#endregion
@@ -473,7 +473,7 @@ interface Resolver {
473
473
  }
474
474
  type Operation = Query<GraphQLSilk, GraphQLSilk | Record<string, GraphQLSilk> | void> | Mutation<GraphQLSilk, GraphQLSilk | Record<string, GraphQLSilk> | void> | Subscription<GraphQLSilk, GraphQLSilk | Record<string, GraphQLSilk> | void, any>;
475
475
  type FieldOrOperation = Field<GraphQLSilk, GraphQLSilk, GraphQLSilk | Record<string, GraphQLSilk> | void, string[] | undefined> | Operation;
476
- type ReSilk<T$1 extends GraphQLSilk> = GraphQLSilk<NonNullable<T$1["~standard"]["types"]>["output"], NonNullable<T$1["~standard"]["types"]>["input"]>;
476
+ type ReSilk<T extends GraphQLSilk> = GraphQLSilk<NonNullable<T["~standard"]["types"]>["output"], NonNullable<T["~standard"]["types"]>["input"]>;
477
477
  //#endregion
478
478
  //#region src/resolver/types.d.ts
479
479
  interface GraphQLSilk<TOutput$1 = any, TInput$1 = any> extends StandardSchemaV1<TInput$1, TOutput$1> {
@@ -644,7 +644,7 @@ declare function assignContextMap(target: ContextMemoryContainer): WeakMap<WeakK
644
644
  //#endregion
645
645
  //#region src/utils/error.d.ts
646
646
  declare function markErrorLocation<TError>(error: TError, ...locations: string[]): TError;
647
- declare function tryIn<T$1>(func: () => T$1, ...locations: string[]): T$1;
647
+ declare function tryIn<T>(func: () => T, ...locations: string[]): T;
648
648
  /**
649
649
  * mark message with location
650
650
  * @param message origin message
@@ -689,12 +689,12 @@ declare class EasyDataLoader<TKey, TData> extends LoomDataLoader<TKey, TData> {
689
689
  }
690
690
  //#endregion
691
691
  //#region src/utils/types.d.ts
692
- type MayPromise<T$1> = T$1 | Promise<T$1>;
693
- type IsAny<T$1> = 0 extends 1 & T$1 ? true : false;
694
- type ValueOf<T$1 extends object> = T$1[keyof T$1];
692
+ type MayPromise<T> = T | Promise<T>;
693
+ type IsAny<T> = 0 extends 1 & T ? true : false;
694
+ type ValueOf<T extends object> = T[keyof T];
695
695
  type OmitInUnion<TUnion, TOmit> = TUnion extends infer T ? T extends TOmit ? never : T : never;
696
- type RequireKeys<T$1, TKey extends string | number | symbol> = { [P in keyof T$1 as P extends TKey ? P : never]-?: T$1[P] } & { [P in keyof T$1 as P extends TKey ? never : P]: T$1[P] };
697
- type MayGetter<T$1> = T$1 | (() => T$1);
696
+ type RequireKeys<T, TKey extends string | number | symbol> = { [P in keyof T as P extends TKey ? P : never]-?: T[P] } & { [P in keyof T as P extends TKey ? never : P]: T[P] };
697
+ type MayGetter<T> = T | (() => T);
698
698
  //#endregion
699
699
  //#region src/utils/middleware.d.ts
700
700
  /**
@@ -741,13 +741,16 @@ declare function filterMiddlewares(operation: MiddlewareOperation, ...middleware
741
741
  * Creates an object map with the same keys as `map` and values generated by
742
742
  * running each value of `record` thru `fn`.
743
743
  */
744
- declare function mapValue<T$1, V>(record: Record<string, T$1>, fn: (value: T$1, key: string) => V | typeof mapValue.SKIP): Record<string, V>;
744
+ declare function mapValue<T, V>(record: Record<string, T>, fn: (value: T, key: string) => V | typeof mapValue.SKIP): Record<string, V>;
745
745
  declare namespace mapValue {
746
746
  var SKIP: unique symbol;
747
747
  }
748
- declare function toObjMap<T$1>(obj: Maybe<ReadOnlyObjMapLike<T$1>>): ReadOnlyObjMap<T$1>;
749
- declare function notNullish<T$1>(x: T$1 | undefined | null): x is T$1;
750
- declare function deepMerge<T$1 extends Record<string, any>>(...objects: (T$1 | null | undefined)[]): T$1;
748
+ declare function toObjMap<T>(obj: Readonly<Record<string, T>> | null | undefined): Record<string, T>;
749
+ /** @deprecated use `x != null` instead */
750
+ declare function notNullish<T>(x: T | undefined | null): x is T;
751
+ declare function toArguments(map: Record<string, GraphQLArgumentConfig>): ReadonlyArray<GraphQLArgument>;
752
+ declare function toFieldMap(fields: Record<string, GraphQLFieldConfig<any, any>>): GraphQLFieldMap<any, any>;
753
+ declare function deepMerge<T extends Record<string, any>>(...objects: (T | null | undefined)[]): T;
751
754
  /**
752
755
  * Wraps the provided data in an object with a single key `"~meta"`.
753
756
  *
@@ -759,16 +762,9 @@ declare function deepMerge<T$1 extends Record<string, any>>(...objects: (T$1 | n
759
762
  * const metaData = meta(originalData);
760
763
  * console.log(metaData); // Output: { "~meta": { key: "value" } }
761
764
  */
762
- declare function meta<T$1>(data: T$1): {
763
- "~meta": T$1;
765
+ declare function meta<T>(data: T): {
766
+ "~meta": T;
764
767
  };
765
- type Maybe<T$1> = null | undefined | T$1;
766
- type ReadOnlyObjMapLike<T$1> = ReadOnlyObjMap<T$1> | {
767
- readonly [key: string]: T$1;
768
- };
769
- interface ReadOnlyObjMap<T$1> {
770
- readonly [key: string]: T$1;
771
- }
772
768
  //#endregion
773
769
  //#region src/utils/parse-resolving-fields.d.ts
774
770
  /**
@@ -833,7 +829,7 @@ declare function parseResolvingFields(info: GraphQLResolveInfo, options?: Resolv
833
829
  //#endregion
834
830
  //#region src/utils/string.d.ts
835
831
  declare function pascalCase(str: string): string;
836
- declare function capitalize<T$1 extends string>(str: T$1): Capitalize<T$1>;
832
+ declare function capitalize<T extends string>(str: T): Capitalize<T>;
837
833
  declare function screamingSnakeCase(str: string): string;
838
834
  //#endregion
839
835
  //#region src/resolver/input.d.ts
@@ -871,9 +867,9 @@ interface CallableInputParser<TSchema extends GraphQLSilk | Record<string, Graph
871
867
  }
872
868
  declare function createInputParser<TSchema extends GraphQLSilk | Record<string, GraphQLSilk> | void>(schema: TSchema, value: InferInputI<TSchema>): CallableInputParser<TSchema>;
873
869
  declare function parseInputValue<TSchema extends GraphQLSilk | Record<string, GraphQLSilk> | void>(inputSchema: TSchema, input: any): MayPromise<StandardSchemaV1.Result<InferInputO<TSchema>>>;
874
- declare function getStandardValue<T$1>(result: StandardSchemaV1.Result<T$1>): T$1;
875
- declare function getStandardValue<T$1>(result?: StandardSchemaV1.Result<T$1>): T$1 | undefined;
876
- declare function getStandardValue<T$1>(result: StandardSchemaV1.Result<T$1> | null): T$1 | null;
870
+ declare function getStandardValue<T>(result: StandardSchemaV1.Result<T>): T;
871
+ declare function getStandardValue<T>(result?: StandardSchemaV1.Result<T>): T | undefined;
872
+ declare function getStandardValue<T>(result: StandardSchemaV1.Result<T> | null): T | null;
877
873
  //#endregion
878
874
  //#region src/resolver/resolver.d.ts
879
875
  /**
@@ -1089,9 +1085,9 @@ declare function getGraphQLArgumentConfig(silk: GraphQLSilk): Omit<GraphQLArgume
1089
1085
  declare function parseSilk<TSilk extends GraphQLSilk>(silk: TSilk, input: StandardSchemaV1.InferInput<TSilk>): MayPromise<StandardSchemaV1.Result<StandardSchemaV1.InferOutput<TSilk>>>;
1090
1086
  declare function isSilk(target: any): target is GraphQLSilk;
1091
1087
  type GraphQLVariants<TSource$1 extends GraphQLNullableType> = TSource$1 | GraphQLList<TSource$1> | GraphQLList<GraphQLNonNull<TSource$1>> | GraphQLNonNull<TSource$1> | GraphQLNonNull<GraphQLList<TSource$1>> | GraphQLNonNull<GraphQLList<GraphQLNonNull<TSource$1>>>;
1092
- type InferScalarInternalByVariants<T$1 extends GraphQLVariants<GraphQLScalarType>> = T$1 extends GraphQLNonNull<infer U> ? U extends GraphQLVariants<GraphQLScalarType> ? NonNullable<InferScalarInternalByVariants<U>> : never : T$1 extends GraphQLList<infer U> ? U extends GraphQLVariants<GraphQLScalarType> ? InferScalarInternalByVariants<U>[] : never : T$1 extends GraphQLScalarType<infer TInternal, any> ? TInternal | null | undefined : never;
1093
- type InferScalarExternalByVariants<T$1 extends GraphQLVariants<GraphQLScalarType>> = T$1 extends GraphQLNonNull<infer U> ? U extends GraphQLVariants<GraphQLScalarType> ? NonNullable<InferScalarExternalByVariants<U>> : never : T$1 extends GraphQLList<infer U> ? U extends GraphQLVariants<GraphQLScalarType> ? InferScalarExternalByVariants<U>[] : never : T$1 extends GraphQLScalarType<any, infer TExternal> ? TExternal | null | undefined : never;
1094
- type InferObjectSourceByVariants<T$1 extends GraphQLVariants<GraphQLObjectType>> = T$1 extends GraphQLNonNull<infer U> ? U extends GraphQLVariants<GraphQLObjectType> ? NonNullable<InferObjectSourceByVariants<U>> : never : T$1 extends GraphQLList<infer U> ? U extends GraphQLVariants<GraphQLObjectType> ? InferObjectSourceByVariants<U>[] : never : T$1 extends GraphQLObjectType<infer TSource> ? TSource | null | undefined : never;
1088
+ 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;
1089
+ 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;
1090
+ 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;
1095
1091
  //#endregion
1096
1092
  //#region src/schema/extensions.d.ts
1097
1093
  interface GQLoomExtensions {
@@ -1147,7 +1143,7 @@ declare class WeaverContext {
1147
1143
  setConfig<TConfig extends WeaverConfig>(config: TConfig): void;
1148
1144
  deleteConfig<TConfig extends WeaverConfig>(key: TConfig[typeof WEAVER_CONFIG]): void;
1149
1145
  memoNamedType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(gqlTypeValue: TGraphQLType): TGraphQLType;
1150
- getNamedType<T$1 extends GraphQLOutputType>(name: string): T$1 | undefined;
1146
+ getNamedType<T extends GraphQLOutputType>(name: string): T | undefined;
1151
1147
  protected static readonly namedTypes: {
1152
1148
  readonly Object: "Object";
1153
1149
  readonly Union: "Union";
@@ -1156,21 +1152,22 @@ declare class WeaverContext {
1156
1152
  readonly Scalar: "Scalar";
1157
1153
  };
1158
1154
  protected aliasCounters: Partial<Record<keyof typeof WeaverContext.namedTypes, number>>;
1159
- protected aliasMap: WeakMap<GraphQLNamedType, Set<string>>;
1160
- setAlias(namedType: GraphQLNamedType, alias: string | undefined): string;
1155
+ protected aliasMap: WeakMap<GraphQLNamedType, AliasList>;
1156
+ setAlias(namedType: GraphQLNamedType, fieldName: string | undefined, parent?: GraphQLNamedType): string;
1161
1157
  /**
1162
1158
  * @returns -1 if a is better than b, 1 if b is better than a, 0 if they are equal
1163
1159
  */
1164
1160
  protected static higherPriorityThan(a: string | undefined, b: string | undefined): number;
1165
- protected ensureAliasStore(namedType: GraphQLNamedType): Set<string>;
1166
- protected pickAlias(namedType: GraphQLNamedType, aliases: Set<string>): string;
1167
- protected reduceAliases(aliases: Iterable<string>): string | undefined;
1161
+ protected ensureAliasStore(namedType: GraphQLNamedType): AliasList;
1162
+ protected pickAlias(namedType: GraphQLNamedType, aliases: AliasList): string;
1163
+ protected reduceAliases(aliases: AliasList): string | undefined;
1168
1164
  protected createFallbackAlias(namedType: GraphQLNamedType): string;
1169
- static provide<T$1>(func: () => T$1, value: WeaverContext | undefined): T$1;
1165
+ static provide<T>(func: () => T, value: WeaverContext | undefined): T;
1170
1166
  }
1167
+ type AliasList = (string | [fieldName: string, parent: GraphQLNamedType])[];
1171
1168
  declare const initWeaverContext: () => WeaverContext;
1172
1169
  declare const provideWeaverContext: typeof WeaverContext.provide & {
1173
- inherit: <T$1>(func: () => T$1) => () => T$1;
1170
+ inherit: <T>(func: () => T) => () => T;
1174
1171
  };
1175
1172
  interface WeaverConfig {
1176
1173
  [WEAVER_CONFIG]: string | symbol;
@@ -1193,7 +1190,7 @@ declare class GlobalWeaverContext implements Partial<Omit<WeaverContext, GlobalC
1193
1190
  setConfig(config: WeaverConfig): void;
1194
1191
  deleteConfig(key: string | symbol): void;
1195
1192
  useConfig<TConfig extends WeaverConfig, TCallback extends () => any>(config: TConfig, callback: TCallback): ReturnType<TCallback>;
1196
- getNamedType<T$1 extends GraphQLOutputType>(name: string): T$1 | undefined;
1193
+ getNamedType<T extends GraphQLOutputType>(name: string): T | undefined;
1197
1194
  memoNamedType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(gqlType: TGraphQLType): TGraphQLType;
1198
1195
  getGraphQLType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(origin: object): TGraphQLType | undefined;
1199
1196
  memoGraphQLType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(origin: object, gqlType: TGraphQLType): TGraphQLType;
@@ -1315,4 +1312,4 @@ declare class GraphQLSchemaLoom {
1315
1312
  */
1316
1313
  declare const weave: typeof GraphQLSchemaLoom.weave;
1317
1314
  //#endregion
1318
- export { subscription$1 as $, GraphQLSilk as $t, getGraphQLType as A, FieldFactoryWithResolve as An, RequireKeys as At, ResolverFactory as B, StandardSchemaV1 as Bn, getMemoizationMap as Bt, DirectiveRecord as C, Query as Cn, MiddlewareOptions as Ct, NonNullSilk as D, BaseChainFactory as Dn, MayGetter as Dt, ListSilk as E, types_loom_d_exports as En, IsAny as Et, parseSilk as F, QueryFactoryWithResolve as Fn, markErrorLocation as Ft, createQuery as G, getFieldOptions as Gt, ToExecutorProps as H, onlyMemoization as Ht, silk as I, ResolvableSubscription as In, markLocation as It, field as J, FieldFactory as Jt, createSubscription as K, getOperationOptions as Kt, ChainResolver as L, SubscriptionChainFactory as Ln, tryIn as Lt, listSilk as M, MutationChainFactory as Mn, BatchLoadFn as Mt, nonNullSilk as N, MutationFactoryWithResolve as Nn, EasyDataLoader as Nt, NullableSilk as O, ChainFactoryOptions as On, MayPromise as Ot, nullableSilk as P, QueryChainFactory as Pn, LoomDataLoader as Pt, resolver as Q, GraphQLFieldOptions as Qt, Executor as R, SubscriptionNeedResolve as Rn, OnlyMemoizationPayload as Rt, DirectiveItem as S, Operation as Sn, MiddlewareOperation as St, GQLoomExtensions as T, Subscription as Tn, filterMiddlewares as Tt, createField as U, AUTO_ALIASING as Ut, ResolverMeta as V, isOnlyMemoryPayload as Vt, createMutation as W, DERIVED_DEPENDENCIES as Wt, mutation$1 as X, FieldOptions as Xt, loom as Y, FieldFactoryWithUtils as Yt, query$1 as Z, FieldOrOperationType as Zt, isSchemaVendorWeaver as _, BaseField as _n, notNullish as _t, LoomObjectType as a, OperationType as an, parseInputValue as at, ensureInputType as b, FieldOrOperation as bn, Middleware as bt, GlobalWeaverContext as c, QueryOptions as cn, screamingSnakeCase as ct, collectName as d, ResolverOptionsWithParent as dn, getDeepResolvingFields as dt, InferFieldInput as en, CallableInputParser as et, collectNames as f, ResolverPayload as fn, getResolvingFields as ft, SchemaWeaver as g, SubscriptionOptions as gn, meta as gt, weaverContext as h, SubscriptionFactoryWithChain as hn, mapValue as ht, CoreSchemaWeaverConfigOptions as i, MutationOptions as in, getStandardValue as it, isSilk as j, IChainFactory as jn, ValueOf as jt, getGraphQLArgumentConfig as k, FieldChainFactory as kn, OmitInUnion as kt, WeaverConfig as l, ResolverOptions as ln, ResolvingFields as lt, provideWeaverContext as m, SubscriptionFactory as mn, deepMerge as mt, weave as n, MutationFactory as nn, InferInputO as nt, OPERATION_OBJECT_NAMES as o, QueryFactory as on, capitalize as ot, initWeaverContext as p, ResolvingOptions as pn, parseResolvingFields as pt, defaultSubscriptionResolve as q, getSubscriptionOptions as qt, CoreSchemaWeaverConfig as r, MutationFactoryWithChain as rn, createInputParser as rt, getCacheType as s, QueryFactoryWithChain as sn, pascalCase as st, GraphQLSchemaLoom as t, InferFieldOutput as tn, InferInputI as tt, WeaverContext as u, ResolverOptionsWithExtensions as un, ResolvingFieldsOptions as ut, ensureInterfaceType as v, Field as vn, toObjMap as vt, GQLoomExtensionAttribute as w, Resolver as wn, applyMiddlewares as wt, inputToArgs as x, Mutation as xn, MiddlewareConfig as xt, ensureInputObjectType as y, FieldMeta as yn, CallableMiddlewareOptions as yt, ObjectChainResolver as z, symbols_d_exports as zn, assignContextMap as zt };
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 };
package/dist/index.cjs CHANGED
@@ -1,6 +1,5 @@
1
- const require_parse_resolving_fields = require('./parse-resolving-fields-Czn0O39L.cjs');
1
+ const require_parse_resolving_fields = require('./parse-resolving-fields-k74tX3i9.cjs');
2
2
  let graphql = require("graphql");
3
- graphql = require_parse_resolving_fields.__toESM(graphql);
4
3
 
5
4
  //#region src/schema/weaver-context.ts
6
5
  var WeaverContext = class WeaverContext {
@@ -56,11 +55,11 @@ var WeaverContext = class WeaverContext {
56
55
  };
57
56
  aliasCounters = {};
58
57
  aliasMap = /* @__PURE__ */ new WeakMap();
59
- setAlias(namedType, alias) {
58
+ setAlias(namedType, fieldName, parent) {
60
59
  if (namedType.name === require_parse_resolving_fields.AUTO_ALIASING) WeaverContext.autoAliasTypes.add(namedType);
61
60
  if (!WeaverContext.autoAliasTypes.has(namedType)) return namedType.name;
62
61
  const aliases = this.ensureAliasStore(namedType);
63
- if (alias) aliases.add(alias);
62
+ if (fieldName) parent ? aliases.push([fieldName, parent]) : aliases.push(fieldName);
64
63
  return this.pickAlias(namedType, aliases);
65
64
  }
66
65
  /**
@@ -78,12 +77,12 @@ var WeaverContext = class WeaverContext {
78
77
  ensureAliasStore(namedType) {
79
78
  const existing = this.aliasMap.get(namedType);
80
79
  if (existing) return existing;
81
- const aliases = /* @__PURE__ */ new Set();
80
+ const aliases = [];
82
81
  this.aliasMap.set(namedType, aliases);
83
82
  Object.defineProperty(namedType, "name", {
84
83
  get: () => this.pickAlias(namedType, aliases),
85
84
  set: (value) => {
86
- aliases.add(value);
85
+ aliases.push(value);
87
86
  },
88
87
  enumerable: true,
89
88
  configurable: true
@@ -94,12 +93,19 @@ var WeaverContext = class WeaverContext {
94
93
  const best = this.reduceAliases(aliases);
95
94
  if (best && best !== require_parse_resolving_fields.AUTO_ALIASING) return best;
96
95
  const fallback = this.createFallbackAlias(namedType);
97
- aliases.add(fallback);
96
+ aliases.push(fallback);
98
97
  return this.reduceAliases(aliases) ?? fallback;
99
98
  }
100
99
  reduceAliases(aliases) {
100
+ const stringAliases = aliases.filter((alias) => typeof alias === "string");
101
+ const tupleAliases = aliases.filter((alias) => Array.isArray(alias));
101
102
  let best;
102
- for (const alias of aliases) if (best === void 0 || WeaverContext.higherPriorityThan(alias, best) < 0) best = alias;
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
+ }
103
109
  return best;
104
110
  }
105
111
  createFallbackAlias(namedType) {
@@ -573,9 +579,39 @@ function toObjMap(obj) {
573
579
  for (const [key, value] of Object.entries(obj)) map[key] = value;
574
580
  return map;
575
581
  }
582
+ /** @deprecated use `x != null` instead */
576
583
  function notNullish(x) {
577
584
  return x != null;
578
585
  }
586
+ function toArguments(map) {
587
+ return Object.entries(map).map(([name, argConfig]) => ({
588
+ name,
589
+ description: argConfig.description,
590
+ type: argConfig.type,
591
+ defaultValue: argConfig.defaultValue,
592
+ deprecationReason: argConfig.deprecationReason,
593
+ extensions: toObjMap(argConfig.extensions),
594
+ astNode: argConfig.astNode
595
+ }));
596
+ }
597
+ function toFieldMap(fields) {
598
+ const result = Object.create(null);
599
+ for (const [fieldName, fieldConfig] of Object.entries(fields)) {
600
+ const argsConfig = fieldConfig.args ?? {};
601
+ result[fieldName] = {
602
+ name: fieldName,
603
+ description: fieldConfig.description,
604
+ type: fieldConfig.type,
605
+ args: toArguments(argsConfig),
606
+ resolve: fieldConfig.resolve,
607
+ subscribe: fieldConfig.subscribe,
608
+ deprecationReason: fieldConfig.deprecationReason,
609
+ extensions: toObjMap(fieldConfig.extensions),
610
+ astNode: fieldConfig.astNode
611
+ };
612
+ }
613
+ return result;
614
+ }
579
615
  function deepMerge(...objects) {
580
616
  const result = {};
581
617
  for (const obj of objects) {
@@ -1361,7 +1397,7 @@ function ensureInputObjectType(object, options) {
1361
1397
  if ((0, graphql.isInputObjectType)(object)) return object;
1362
1398
  const existing = weaverContext.inputMap?.get(object);
1363
1399
  if (existing != null) return existing;
1364
- const { astNode: _1, extensionASTNodes: _2, fields,...config } = object.toConfig();
1400
+ const { astNode: _1, extensionASTNodes: _2, fields, ...config } = object.toConfig();
1365
1401
  let name = object.name;
1366
1402
  if (name === require_parse_resolving_fields.AUTO_ALIASING) name = `${pascalCase(options.fieldName)}Input`;
1367
1403
  name = (weaverContext.getConfig("gqloom.core.schema")?.getInputObjectName ?? ((n) => n))(name);
@@ -1373,7 +1409,7 @@ function ensureInputObjectType(object, options) {
1373
1409
  weaverContext.inputMap?.set(object, input);
1374
1410
  return input;
1375
1411
  }
1376
- function toInputFieldConfig({ astNode, resolve,...config }, options) {
1412
+ function toInputFieldConfig({ astNode, resolve, ...config }, options) {
1377
1413
  return {
1378
1414
  ...config,
1379
1415
  type: ensureInputType(config.type, options)
@@ -1435,7 +1471,7 @@ var LoomObjectType = class extends graphql.GraphQLObjectType {
1435
1471
  getFields() {
1436
1472
  const fieldsBySuper = super.getFields();
1437
1473
  this.collectedFieldNames();
1438
- const extraFields = provideWeaverContext(() => defineFieldMap(this.mapToFieldConfig(this.extraFields)), this.weaverContext);
1474
+ const extraFields = provideWeaverContext(() => toFieldMap(this.mapToFieldConfig(this.extraFields)), this.weaverContext);
1439
1475
  if (Object.keys(this.extraFieldMap ?? {}).join() !== Object.keys(extraFields).join()) this.extraFieldMap = extraFields;
1440
1476
  const answer = {
1441
1477
  ...fieldsBySuper,
@@ -1456,7 +1492,7 @@ var LoomObjectType = class extends graphql.GraphQLObjectType {
1456
1492
  return {
1457
1493
  ...extract(field$1),
1458
1494
  type: outputType,
1459
- args: inputToArgs(field$1["~meta"].input, { fieldName: parentName(this.name) + fieldName }),
1495
+ args: inputToArgs(field$1["~meta"].input, { fieldName }),
1460
1496
  resolve,
1461
1497
  ...subscribe ? { subscribe } : {}
1462
1498
  };
@@ -1573,33 +1609,6 @@ function extract(field$1) {
1573
1609
  extensions
1574
1610
  };
1575
1611
  }
1576
- function defineFieldMap(fields) {
1577
- return mapValue((0, graphql.resolveObjMapThunk)(fields), (fieldConfig, fieldName) => {
1578
- const argsConfig = fieldConfig.args ?? {};
1579
- return {
1580
- name: (0, graphql.assertName)(fieldName),
1581
- description: fieldConfig.description,
1582
- type: fieldConfig.type,
1583
- args: defineArguments(argsConfig),
1584
- resolve: fieldConfig.resolve,
1585
- subscribe: fieldConfig.subscribe,
1586
- deprecationReason: fieldConfig.deprecationReason,
1587
- extensions: toObjMap(fieldConfig.extensions),
1588
- astNode: fieldConfig.astNode
1589
- };
1590
- });
1591
- }
1592
- function defineArguments(args) {
1593
- return Object.entries(args).map(([argName, argConfig]) => ({
1594
- name: (0, graphql.assertName)(argName),
1595
- description: argConfig.description,
1596
- type: argConfig.type,
1597
- defaultValue: argConfig.defaultValue,
1598
- deprecationReason: argConfig.deprecationReason,
1599
- extensions: toObjMap(argConfig.extensions),
1600
- astNode: argConfig.astNode
1601
- }));
1602
- }
1603
1612
  const OPERATION_OBJECT_NAMES = new Set([
1604
1613
  "Query",
1605
1614
  "Mutation",
@@ -1607,27 +1616,25 @@ const OPERATION_OBJECT_NAMES = new Set([
1607
1616
  ]);
1608
1617
  function getCacheType(gqlType, options = {}) {
1609
1618
  const context = options.weaverContext ?? weaverContext;
1610
- const getAlias = () => {
1611
- if (!options.fieldName || !options.parent) return;
1612
- return parentName(options.parent.name) + pascalCase(options.fieldName);
1613
- };
1614
1619
  if (gqlType instanceof LoomObjectType) return gqlType;
1620
+ const parent = excludeOperationObject(options.parent);
1621
+ const fieldName = options.fieldName ? pascalCase(options.fieldName) : void 0;
1615
1622
  if ((0, graphql.isObjectType)(gqlType)) {
1616
1623
  const gqlObject = context.loomObjectMap?.get(gqlType);
1617
1624
  if (gqlObject != null) {
1618
- context.setAlias(gqlObject, getAlias());
1625
+ context.setAlias(gqlObject, fieldName, parent);
1619
1626
  return gqlObject;
1620
1627
  }
1621
1628
  const loomObject = new LoomObjectType(gqlType, options);
1622
1629
  context.loomObjectMap?.set(gqlType, loomObject);
1623
- context.setAlias(loomObject, getAlias());
1630
+ context.setAlias(loomObject, fieldName, parent);
1624
1631
  return loomObject;
1625
1632
  } else if ((0, graphql.isListType)(gqlType)) return new graphql.GraphQLList(getCacheType(gqlType.ofType, options));
1626
1633
  else if ((0, graphql.isNonNullType)(gqlType)) return new graphql.GraphQLNonNull(getCacheType(gqlType.ofType, options));
1627
1634
  else if ((0, graphql.isUnionType)(gqlType)) {
1628
1635
  const existing = context.loomUnionMap?.get(gqlType);
1629
1636
  if (existing != null) {
1630
- context.setAlias(existing, getAlias());
1637
+ context.setAlias(existing, fieldName, parent);
1631
1638
  return existing;
1632
1639
  }
1633
1640
  const config = gqlType.toConfig();
@@ -1639,17 +1646,18 @@ function getCacheType(gqlType, options = {}) {
1639
1646
  }))
1640
1647
  });
1641
1648
  context.loomUnionMap?.set(gqlType, unionType);
1642
- context.setAlias(unionType, getAlias());
1649
+ context.setAlias(unionType, fieldName, parent);
1643
1650
  return unionType;
1644
1651
  } else if ((0, graphql.isEnumType)(gqlType) || (0, graphql.isInterfaceType)(gqlType) || (0, graphql.isScalarType)(gqlType)) {
1645
- context.setAlias(gqlType, getAlias());
1652
+ context.setAlias(gqlType, fieldName, parent);
1646
1653
  return gqlType;
1647
1654
  }
1648
1655
  return gqlType;
1649
1656
  }
1650
- function parentName(name) {
1651
- if (OPERATION_OBJECT_NAMES.has(name)) name = "";
1652
- return name;
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;
1653
1661
  }
1654
1662
 
1655
1663
  //#endregion
@@ -1660,7 +1668,7 @@ function ensureInterfaceType(gqlType, interfaceConfig) {
1660
1668
  const key = gqlType;
1661
1669
  const existing = weaverContext.interfaceMap?.get(key);
1662
1670
  if (existing != null) return existing;
1663
- const { astNode: _, extensionASTNodes: _1, fields,...config } = gqlType.toConfig();
1671
+ const { astNode: _, extensionASTNodes: _1, fields, ...config } = gqlType.toConfig();
1664
1672
  const interfaceType = new graphql.GraphQLInterfaceType({
1665
1673
  ...config,
1666
1674
  ...interfaceConfig,
@@ -1935,6 +1943,8 @@ exports.resolver = resolver;
1935
1943
  exports.screamingSnakeCase = screamingSnakeCase;
1936
1944
  exports.silk = silk;
1937
1945
  exports.subscription = subscription;
1946
+ exports.toArguments = toArguments;
1947
+ exports.toFieldMap = toFieldMap;
1938
1948
  exports.toObjMap = toObjMap;
1939
1949
  exports.tryIn = tryIn;
1940
1950
  exports.weave = weave;
package/dist/index.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as subscription, $t as GraphQLSilk, A as getGraphQLType, An as FieldFactoryWithResolve, At as RequireKeys, B as ResolverFactory, Bn as StandardSchemaV1, Bt as getMemoizationMap, C as DirectiveRecord, Cn as Query, Ct as MiddlewareOptions, D as NonNullSilk, Dn as BaseChainFactory, Dt as MayGetter, E as ListSilk, En as types_loom_d_exports, Et as IsAny, F as parseSilk, Fn as QueryFactoryWithResolve, Ft as markErrorLocation, G as createQuery, Gt as getFieldOptions, H as ToExecutorProps, Ht as onlyMemoization, I as silk, In as ResolvableSubscription, It as markLocation, J as field, Jt as FieldFactory, K as createSubscription, Kt as getOperationOptions, L as ChainResolver, Ln as SubscriptionChainFactory, Lt as tryIn, M as listSilk, Mn as MutationChainFactory, Mt as BatchLoadFn, N as nonNullSilk, Nn as MutationFactoryWithResolve, Nt as EasyDataLoader, O as NullableSilk, On as ChainFactoryOptions, Ot as MayPromise, P as nullableSilk, Pn as QueryChainFactory, Pt as LoomDataLoader, Q as resolver, Qt as GraphQLFieldOptions, R as Executor, Rn as SubscriptionNeedResolve, Rt as OnlyMemoizationPayload, S as DirectiveItem, Sn as Operation, St as MiddlewareOperation, T as GQLoomExtensions, Tn as Subscription, Tt as filterMiddlewares, U as createField, Ut as AUTO_ALIASING, V as ResolverMeta, Vt as isOnlyMemoryPayload, W as createMutation, Wt as DERIVED_DEPENDENCIES, X as mutation, Xt as FieldOptions, Y as loom, Yt as FieldFactoryWithUtils, Z as query, Zt as FieldOrOperationType, _ as isSchemaVendorWeaver, _n as BaseField, _t as notNullish, a as LoomObjectType, an as OperationType, at as parseInputValue, b as ensureInputType, bn as FieldOrOperation, bt as Middleware, c as GlobalWeaverContext, cn as QueryOptions, ct as screamingSnakeCase, d as collectName, dn as ResolverOptionsWithParent, dt as getDeepResolvingFields, en as InferFieldInput, et as CallableInputParser, f as collectNames, fn as ResolverPayload, ft as getResolvingFields, g as SchemaWeaver, gn as SubscriptionOptions, gt as meta, h as weaverContext, hn as SubscriptionFactoryWithChain, ht as mapValue, i as CoreSchemaWeaverConfigOptions, in as MutationOptions, it as getStandardValue, j as isSilk, jn as IChainFactory, jt as ValueOf, k as getGraphQLArgumentConfig, kn as FieldChainFactory, kt as OmitInUnion, l as WeaverConfig, ln as ResolverOptions, lt as ResolvingFields, m as provideWeaverContext, mn as SubscriptionFactory, mt as deepMerge, n as weave, nn as MutationFactory, nt as InferInputO, o as OPERATION_OBJECT_NAMES, on as QueryFactory, ot as capitalize, p as initWeaverContext, pn as ResolvingOptions, pt as parseResolvingFields, q as defaultSubscriptionResolve, qt as getSubscriptionOptions, r as CoreSchemaWeaverConfig, rn as MutationFactoryWithChain, rt as createInputParser, s as getCacheType, sn as QueryFactoryWithChain, st as pascalCase, t as GraphQLSchemaLoom, tn as InferFieldOutput, tt as InferInputI, u as WeaverContext, un as ResolverOptionsWithExtensions, ut as ResolvingFieldsOptions, v as ensureInterfaceType, vn as Field, vt as toObjMap, w as GQLoomExtensionAttribute, wn as Resolver, wt as applyMiddlewares, x as inputToArgs, xn as Mutation, xt as MiddlewareConfig, y as ensureInputObjectType, yn as FieldMeta, yt as CallableMiddlewareOptions, z as ObjectChainResolver, zn as symbols_d_exports, zt as assignContextMap } from "./index-DPuy3FIT.cjs";
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, 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-DAymluHs.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 subscription, $t as GraphQLSilk, A as getGraphQLType, An as FieldFactoryWithResolve, At as RequireKeys, B as ResolverFactory, Bn as StandardSchemaV1, Bt as getMemoizationMap, C as DirectiveRecord, Cn as Query, Ct as MiddlewareOptions, D as NonNullSilk, Dn as BaseChainFactory, Dt as MayGetter, E as ListSilk, En as types_loom_d_exports, Et as IsAny, F as parseSilk, Fn as QueryFactoryWithResolve, Ft as markErrorLocation, G as createQuery, Gt as getFieldOptions, H as ToExecutorProps, Ht as onlyMemoization, I as silk, In as ResolvableSubscription, It as markLocation, J as field, Jt as FieldFactory, K as createSubscription, Kt as getOperationOptions, L as ChainResolver, Ln as SubscriptionChainFactory, Lt as tryIn, M as listSilk, Mn as MutationChainFactory, Mt as BatchLoadFn, N as nonNullSilk, Nn as MutationFactoryWithResolve, Nt as EasyDataLoader, O as NullableSilk, On as ChainFactoryOptions, Ot as MayPromise, P as nullableSilk, Pn as QueryChainFactory, Pt as LoomDataLoader, Q as resolver, Qt as GraphQLFieldOptions, R as Executor, Rn as SubscriptionNeedResolve, Rt as OnlyMemoizationPayload, S as DirectiveItem, Sn as Operation, St as MiddlewareOperation, T as GQLoomExtensions, Tn as Subscription, Tt as filterMiddlewares, U as createField, Ut as AUTO_ALIASING, V as ResolverMeta, Vt as isOnlyMemoryPayload, W as createMutation, Wt as DERIVED_DEPENDENCIES, X as mutation, Xt as FieldOptions, Y as loom, Yt as FieldFactoryWithUtils, Z as query, Zt as FieldOrOperationType, _ as isSchemaVendorWeaver, _n as BaseField, _t as notNullish, a as LoomObjectType, an as OperationType, at as parseInputValue, b as ensureInputType, bn as FieldOrOperation, bt as Middleware, c as GlobalWeaverContext, cn as QueryOptions, ct as screamingSnakeCase, d as collectName, dn as ResolverOptionsWithParent, dt as getDeepResolvingFields, en as InferFieldInput, et as CallableInputParser, f as collectNames, fn as ResolverPayload, ft as getResolvingFields, g as SchemaWeaver, gn as SubscriptionOptions, gt as meta, h as weaverContext, hn as SubscriptionFactoryWithChain, ht as mapValue, i as CoreSchemaWeaverConfigOptions, in as MutationOptions, it as getStandardValue, j as isSilk, jn as IChainFactory, jt as ValueOf, k as getGraphQLArgumentConfig, kn as FieldChainFactory, kt as OmitInUnion, l as WeaverConfig, ln as ResolverOptions, lt as ResolvingFields, m as provideWeaverContext, mn as SubscriptionFactory, mt as deepMerge, n as weave, nn as MutationFactory, nt as InferInputO, o as OPERATION_OBJECT_NAMES, on as QueryFactory, ot as capitalize, p as initWeaverContext, pn as ResolvingOptions, pt as parseResolvingFields, q as defaultSubscriptionResolve, qt as getSubscriptionOptions, r as CoreSchemaWeaverConfig, rn as MutationFactoryWithChain, rt as createInputParser, s as getCacheType, sn as QueryFactoryWithChain, st as pascalCase, t as GraphQLSchemaLoom, tn as InferFieldOutput, tt as InferInputI, u as WeaverContext, un as ResolverOptionsWithExtensions, ut as ResolvingFieldsOptions, v as ensureInterfaceType, vn as Field, vt as toObjMap, w as GQLoomExtensionAttribute, wn as Resolver, wt as applyMiddlewares, x as inputToArgs, xn as Mutation, xt as MiddlewareConfig, y as ensureInputObjectType, yn as FieldMeta, yt as CallableMiddlewareOptions, z as ObjectChainResolver, zn as symbols_d_exports, zt as assignContextMap } from "./index-DyGHE5li.js";
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, 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-BWCXjTlY.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
@@ -1,5 +1,5 @@
1
- import { a as getMemoizationMap, c as FIELD_HIDDEN, d as IS_RESOLVER, f as WEAVER_CONFIG, h as DERIVED_DEPENDENCIES, i as assignContextMap, l as GET_GRAPHQL_ARGUMENT_CONFIG, m as AUTO_ALIASING, n as getResolvingFields, o as isOnlyMemoryPayload, p as symbols_exports, r as parseResolvingFields, s as onlyMemoization, t as getDeepResolvingFields, u as GET_GRAPHQL_TYPE } from "./parse-resolving-fields-CH8rJgks.js";
2
- import { GraphQLError, GraphQLInputObjectType, GraphQLInterfaceType, GraphQLList, GraphQLNonNull, GraphQLObjectType, GraphQLSchema, GraphQLUnionType, assertName, isEnumType, isInputObjectType, isInterfaceType, isListType, isNonNullType, isObjectType, isScalarType, isUnionType, resolveObjMapThunk } from "graphql";
1
+ import { a as getMemoizationMap, c as FIELD_HIDDEN, d as IS_RESOLVER, f as WEAVER_CONFIG, h as DERIVED_DEPENDENCIES, i as assignContextMap, l as GET_GRAPHQL_ARGUMENT_CONFIG, m as AUTO_ALIASING, n as getResolvingFields, o as isOnlyMemoryPayload, p as symbols_exports, r as parseResolvingFields, s as onlyMemoization, t as getDeepResolvingFields, u as GET_GRAPHQL_TYPE } from "./parse-resolving-fields-GAEhHjUw.js";
2
+ import { GraphQLError, GraphQLInputObjectType, GraphQLInterfaceType, GraphQLList, GraphQLNonNull, GraphQLObjectType, GraphQLSchema, GraphQLUnionType, isEnumType, isInputObjectType, isInterfaceType, isListType, isNonNullType, isObjectType, isScalarType, isUnionType } from "graphql";
3
3
 
4
4
  //#region src/schema/weaver-context.ts
5
5
  var WeaverContext = class WeaverContext {
@@ -55,11 +55,11 @@ var WeaverContext = class WeaverContext {
55
55
  };
56
56
  aliasCounters = {};
57
57
  aliasMap = /* @__PURE__ */ new WeakMap();
58
- setAlias(namedType, alias) {
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 (alias) aliases.add(alias);
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 = /* @__PURE__ */ new Set();
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.add(value);
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.add(fallback);
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 aliases) if (best === void 0 || WeaverContext.higherPriorityThan(alias, best) < 0) best = alias;
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) {
@@ -572,9 +579,39 @@ function toObjMap(obj) {
572
579
  for (const [key, value] of Object.entries(obj)) map[key] = value;
573
580
  return map;
574
581
  }
582
+ /** @deprecated use `x != null` instead */
575
583
  function notNullish(x) {
576
584
  return x != null;
577
585
  }
586
+ function toArguments(map) {
587
+ return Object.entries(map).map(([name, argConfig]) => ({
588
+ name,
589
+ description: argConfig.description,
590
+ type: argConfig.type,
591
+ defaultValue: argConfig.defaultValue,
592
+ deprecationReason: argConfig.deprecationReason,
593
+ extensions: toObjMap(argConfig.extensions),
594
+ astNode: argConfig.astNode
595
+ }));
596
+ }
597
+ function toFieldMap(fields) {
598
+ const result = Object.create(null);
599
+ for (const [fieldName, fieldConfig] of Object.entries(fields)) {
600
+ const argsConfig = fieldConfig.args ?? {};
601
+ result[fieldName] = {
602
+ name: fieldName,
603
+ description: fieldConfig.description,
604
+ type: fieldConfig.type,
605
+ args: toArguments(argsConfig),
606
+ resolve: fieldConfig.resolve,
607
+ subscribe: fieldConfig.subscribe,
608
+ deprecationReason: fieldConfig.deprecationReason,
609
+ extensions: toObjMap(fieldConfig.extensions),
610
+ astNode: fieldConfig.astNode
611
+ };
612
+ }
613
+ return result;
614
+ }
578
615
  function deepMerge(...objects) {
579
616
  const result = {};
580
617
  for (const obj of objects) {
@@ -1360,7 +1397,7 @@ function ensureInputObjectType(object, options) {
1360
1397
  if (isInputObjectType(object)) return object;
1361
1398
  const existing = weaverContext.inputMap?.get(object);
1362
1399
  if (existing != null) return existing;
1363
- const { astNode: _1, extensionASTNodes: _2, fields,...config } = object.toConfig();
1400
+ const { astNode: _1, extensionASTNodes: _2, fields, ...config } = object.toConfig();
1364
1401
  let name = object.name;
1365
1402
  if (name === AUTO_ALIASING) name = `${pascalCase(options.fieldName)}Input`;
1366
1403
  name = (weaverContext.getConfig("gqloom.core.schema")?.getInputObjectName ?? ((n) => n))(name);
@@ -1372,7 +1409,7 @@ function ensureInputObjectType(object, options) {
1372
1409
  weaverContext.inputMap?.set(object, input);
1373
1410
  return input;
1374
1411
  }
1375
- function toInputFieldConfig({ astNode, resolve,...config }, options) {
1412
+ function toInputFieldConfig({ astNode, resolve, ...config }, options) {
1376
1413
  return {
1377
1414
  ...config,
1378
1415
  type: ensureInputType(config.type, options)
@@ -1434,7 +1471,7 @@ var LoomObjectType = class extends GraphQLObjectType {
1434
1471
  getFields() {
1435
1472
  const fieldsBySuper = super.getFields();
1436
1473
  this.collectedFieldNames();
1437
- const extraFields = provideWeaverContext(() => defineFieldMap(this.mapToFieldConfig(this.extraFields)), this.weaverContext);
1474
+ const extraFields = provideWeaverContext(() => toFieldMap(this.mapToFieldConfig(this.extraFields)), this.weaverContext);
1438
1475
  if (Object.keys(this.extraFieldMap ?? {}).join() !== Object.keys(extraFields).join()) this.extraFieldMap = extraFields;
1439
1476
  const answer = {
1440
1477
  ...fieldsBySuper,
@@ -1455,7 +1492,7 @@ var LoomObjectType = class extends GraphQLObjectType {
1455
1492
  return {
1456
1493
  ...extract(field$1),
1457
1494
  type: outputType,
1458
- args: inputToArgs(field$1["~meta"].input, { fieldName: parentName(this.name) + fieldName }),
1495
+ args: inputToArgs(field$1["~meta"].input, { fieldName }),
1459
1496
  resolve,
1460
1497
  ...subscribe ? { subscribe } : {}
1461
1498
  };
@@ -1572,33 +1609,6 @@ function extract(field$1) {
1572
1609
  extensions
1573
1610
  };
1574
1611
  }
1575
- function defineFieldMap(fields) {
1576
- return mapValue(resolveObjMapThunk(fields), (fieldConfig, fieldName) => {
1577
- const argsConfig = fieldConfig.args ?? {};
1578
- return {
1579
- name: assertName(fieldName),
1580
- description: fieldConfig.description,
1581
- type: fieldConfig.type,
1582
- args: defineArguments(argsConfig),
1583
- resolve: fieldConfig.resolve,
1584
- subscribe: fieldConfig.subscribe,
1585
- deprecationReason: fieldConfig.deprecationReason,
1586
- extensions: toObjMap(fieldConfig.extensions),
1587
- astNode: fieldConfig.astNode
1588
- };
1589
- });
1590
- }
1591
- function defineArguments(args) {
1592
- return Object.entries(args).map(([argName, argConfig]) => ({
1593
- name: assertName(argName),
1594
- description: argConfig.description,
1595
- type: argConfig.type,
1596
- defaultValue: argConfig.defaultValue,
1597
- deprecationReason: argConfig.deprecationReason,
1598
- extensions: toObjMap(argConfig.extensions),
1599
- astNode: argConfig.astNode
1600
- }));
1601
- }
1602
1612
  const OPERATION_OBJECT_NAMES = new Set([
1603
1613
  "Query",
1604
1614
  "Mutation",
@@ -1606,27 +1616,25 @@ const OPERATION_OBJECT_NAMES = new Set([
1606
1616
  ]);
1607
1617
  function getCacheType(gqlType, options = {}) {
1608
1618
  const context = options.weaverContext ?? weaverContext;
1609
- const getAlias = () => {
1610
- if (!options.fieldName || !options.parent) return;
1611
- return parentName(options.parent.name) + pascalCase(options.fieldName);
1612
- };
1613
1619
  if (gqlType instanceof LoomObjectType) return gqlType;
1620
+ const parent = excludeOperationObject(options.parent);
1621
+ const fieldName = options.fieldName ? pascalCase(options.fieldName) : void 0;
1614
1622
  if (isObjectType(gqlType)) {
1615
1623
  const gqlObject = context.loomObjectMap?.get(gqlType);
1616
1624
  if (gqlObject != null) {
1617
- context.setAlias(gqlObject, getAlias());
1625
+ context.setAlias(gqlObject, fieldName, parent);
1618
1626
  return gqlObject;
1619
1627
  }
1620
1628
  const loomObject = new LoomObjectType(gqlType, options);
1621
1629
  context.loomObjectMap?.set(gqlType, loomObject);
1622
- context.setAlias(loomObject, getAlias());
1630
+ context.setAlias(loomObject, fieldName, parent);
1623
1631
  return loomObject;
1624
1632
  } else if (isListType(gqlType)) return new GraphQLList(getCacheType(gqlType.ofType, options));
1625
1633
  else if (isNonNullType(gqlType)) return new GraphQLNonNull(getCacheType(gqlType.ofType, options));
1626
1634
  else if (isUnionType(gqlType)) {
1627
1635
  const existing = context.loomUnionMap?.get(gqlType);
1628
1636
  if (existing != null) {
1629
- context.setAlias(existing, getAlias());
1637
+ context.setAlias(existing, fieldName, parent);
1630
1638
  return existing;
1631
1639
  }
1632
1640
  const config = gqlType.toConfig();
@@ -1638,17 +1646,18 @@ function getCacheType(gqlType, options = {}) {
1638
1646
  }))
1639
1647
  });
1640
1648
  context.loomUnionMap?.set(gqlType, unionType);
1641
- context.setAlias(unionType, getAlias());
1649
+ context.setAlias(unionType, fieldName, parent);
1642
1650
  return unionType;
1643
1651
  } else if (isEnumType(gqlType) || isInterfaceType(gqlType) || isScalarType(gqlType)) {
1644
- context.setAlias(gqlType, getAlias());
1652
+ context.setAlias(gqlType, fieldName, parent);
1645
1653
  return gqlType;
1646
1654
  }
1647
1655
  return gqlType;
1648
1656
  }
1649
- function parentName(name) {
1650
- if (OPERATION_OBJECT_NAMES.has(name)) name = "";
1651
- return name;
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;
1652
1661
  }
1653
1662
 
1654
1663
  //#endregion
@@ -1659,7 +1668,7 @@ function ensureInterfaceType(gqlType, interfaceConfig) {
1659
1668
  const key = gqlType;
1660
1669
  const existing = weaverContext.interfaceMap?.get(key);
1661
1670
  if (existing != null) return existing;
1662
- const { astNode: _, extensionASTNodes: _1, fields,...config } = gqlType.toConfig();
1671
+ const { astNode: _, extensionASTNodes: _1, fields, ...config } = gqlType.toConfig();
1663
1672
  const interfaceType = new GraphQLInterfaceType({
1664
1673
  ...config,
1665
1674
  ...interfaceConfig,
@@ -1856,4 +1865,4 @@ var GraphQLSchemaLoom = class GraphQLSchemaLoom {
1856
1865
  const weave = GraphQLSchemaLoom.weave;
1857
1866
 
1858
1867
  //#endregion
1859
- export { AUTO_ALIASING, BaseChainFactory, ChainResolver, DERIVED_DEPENDENCIES, EasyDataLoader, FieldChainFactory, FieldFactoryWithResolve, GlobalWeaverContext, GraphQLSchemaLoom, LoomDataLoader, LoomObjectType, MutationChainFactory, MutationFactoryWithResolve, OPERATION_OBJECT_NAMES, ObjectChainResolver, QueryChainFactory, QueryFactoryWithResolve, symbols_exports as SYMBOLS, SubscriptionChainFactory, 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, toObjMap, tryIn, weave, weaverContext };
1868
+ export { AUTO_ALIASING, BaseChainFactory, ChainResolver, DERIVED_DEPENDENCIES, EasyDataLoader, FieldChainFactory, FieldFactoryWithResolve, GlobalWeaverContext, GraphQLSchemaLoom, LoomDataLoader, LoomObjectType, MutationChainFactory, MutationFactoryWithResolve, OPERATION_OBJECT_NAMES, ObjectChainResolver, QueryChainFactory, QueryFactoryWithResolve, symbols_exports as SYMBOLS, SubscriptionChainFactory, 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,4 +1,4 @@
1
- import { t as __export } from "./chunk-Bp6m_JJh.js";
1
+ import { t as __export } from "./chunk-BL09k0x-.js";
2
2
  import { Kind, isInterfaceType, isListType, isNonNullType, isObjectType } from "graphql";
3
3
 
4
4
  //#region src/utils/constants.ts
@@ -1,36 +1,21 @@
1
1
  //#region rolldown:runtime
2
- var __create = Object.create;
3
2
  var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (all) => {
3
+ var __export = (all, symbols) => {
9
4
  let target = {};
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: true
13
- });
14
- return target;
15
- };
16
- var __copyProps = (to, from, except, desc) => {
17
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
18
- key = keys[i];
19
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
20
- get: ((k) => from[k]).bind(null, key),
21
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
5
+ for (var name in all) {
6
+ __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
22
9
  });
23
10
  }
24
- return to;
11
+ if (symbols) {
12
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
13
+ }
14
+ return target;
25
15
  };
26
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
27
- value: mod,
28
- enumerable: true
29
- }) : target, mod));
30
16
 
31
17
  //#endregion
32
18
  let graphql = require("graphql");
33
- graphql = __toESM(graphql);
34
19
 
35
20
  //#region src/utils/constants.ts
36
21
  const DERIVED_DEPENDENCIES = "loom.derived-from-dependencies";
@@ -395,12 +380,6 @@ Object.defineProperty(exports, 'WEAVER_CONFIG', {
395
380
  return WEAVER_CONFIG;
396
381
  }
397
382
  });
398
- Object.defineProperty(exports, '__toESM', {
399
- enumerable: true,
400
- get: function () {
401
- return __toESM;
402
- }
403
- });
404
383
  Object.defineProperty(exports, 'assignContextMap', {
405
384
  enumerable: true,
406
385
  get: function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gqloom/core",
3
- "version": "0.14.1",
3
+ "version": "0.14.3",
4
4
  "description": "Create GraphQL schema and resolvers with TypeScript.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,13 +0,0 @@
1
- //#region rolldown:runtime
2
- var __defProp = Object.defineProperty;
3
- var __export = (all) => {
4
- let target = {};
5
- for (var name in all) __defProp(target, name, {
6
- get: all[name],
7
- enumerable: true
8
- });
9
- return target;
10
- };
11
-
12
- //#endregion
13
- export { __export as t };