@gqloom/core 0.15.0 → 0.15.1

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.
@@ -1,4 +1,4 @@
1
- import { Ct as Middleware, Vt as OnlyMemoizationPayload, bn as BaseField, hn as ResolverPayload, ut as ResolvingFields } from "./index-BstkglTj.cjs";
1
+ import { Ct as Middleware, Vt as OnlyMemoizationPayload, bn as BaseField, hn as ResolverPayload, ut as ResolvingFields } from "./index-fddenU-d.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 { Ct as Middleware, Vt as OnlyMemoizationPayload, bn as BaseField, hn as ResolverPayload, ut as ResolvingFields } from "./index-CrKRwsqN.js";
1
+ import { Ct as Middleware, Vt as OnlyMemoizationPayload, bn as BaseField, hn as ResolverPayload, ut as ResolvingFields } from "./index-DkwSGzwy.js";
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
 
4
4
  //#region src/context/async-iterator.d.ts
@@ -1236,7 +1236,7 @@ declare class GlobalWeaverContext implements Partial<Omit<WeaverContext, GlobalC
1236
1236
  get id(): number | undefined;
1237
1237
  get loomObjectMap(): Map<GraphQLObjectType<any, any>, LoomObjectType> | undefined;
1238
1238
  get loomUnionMap(): Map<GraphQLUnionType, GraphQLUnionType> | undefined;
1239
- get inputMap(): Map<GraphQLInterfaceType | GraphQLObjectType<any, any>, GraphQLInputObjectType> | undefined;
1239
+ get inputMap(): Map<GraphQLObjectType<any, any> | GraphQLInterfaceType, GraphQLInputObjectType> | undefined;
1240
1240
  get interfaceMap(): Map<GraphQLObjectType<any, any>, GraphQLInterfaceType> | undefined;
1241
1241
  get configs(): Map<string | symbol, WeaverConfig> | undefined;
1242
1242
  get vendorWeavers(): Map<string, SchemaWeaver> | undefined;
@@ -1289,6 +1289,7 @@ declare class LoomObjectType extends GraphQLObjectType {
1289
1289
  mergeExtensions(extensions: GraphQLObjectTypeConfig<any, any>["extensions"]): void;
1290
1290
  protected collectedFieldNames(): void;
1291
1291
  private extraFieldMap?;
1292
+ private _fieldsCache?;
1292
1293
  getFields(): GraphQLFieldMap<any, any>;
1293
1294
  protected mapToFieldConfig(map: Map<string, BaseField>): Record<string, GraphQLFieldConfig<any, any>>;
1294
1295
  toFieldConfig(field: BaseField, fieldName: string): GraphQLFieldConfig<any, any>;
@@ -1238,7 +1238,7 @@ declare class GlobalWeaverContext implements Partial<Omit<WeaverContext, GlobalC
1238
1238
  get id(): number | undefined;
1239
1239
  get loomObjectMap(): Map<GraphQLObjectType<any, any>, LoomObjectType> | undefined;
1240
1240
  get loomUnionMap(): Map<GraphQLUnionType, GraphQLUnionType> | undefined;
1241
- get inputMap(): Map<GraphQLInterfaceType | GraphQLObjectType<any, any>, GraphQLInputObjectType> | undefined;
1241
+ get inputMap(): Map<GraphQLObjectType<any, any> | GraphQLInterfaceType, GraphQLInputObjectType> | undefined;
1242
1242
  get interfaceMap(): Map<GraphQLObjectType<any, any>, GraphQLInterfaceType> | undefined;
1243
1243
  get configs(): Map<string | symbol, WeaverConfig> | undefined;
1244
1244
  get vendorWeavers(): Map<string, SchemaWeaver> | undefined;
@@ -1291,6 +1291,7 @@ declare class LoomObjectType extends GraphQLObjectType {
1291
1291
  mergeExtensions(extensions: GraphQLObjectTypeConfig<any, any>["extensions"]): void;
1292
1292
  protected collectedFieldNames(): void;
1293
1293
  private extraFieldMap?;
1294
+ private _fieldsCache?;
1294
1295
  getFields(): GraphQLFieldMap<any, any>;
1295
1296
  protected mapToFieldConfig(map: Map<string, BaseField>): Record<string, GraphQLFieldConfig<any, any>>;
1296
1297
  toFieldConfig(field: BaseField, fieldName: string): GraphQLFieldConfig<any, any>;
package/dist/index.cjs CHANGED
@@ -97,16 +97,17 @@ var WeaverContext = class WeaverContext {
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));
102
- let best;
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;
100
+ let bestString;
101
+ for (const alias of aliases) if (typeof alias === "string") {
102
+ if (bestString === void 0 || WeaverContext.higherPriorityThan(alias, bestString) < 0) bestString = alias;
108
103
  }
109
- return best;
104
+ if (bestString !== void 0) return bestString;
105
+ let bestTuple;
106
+ for (const alias of aliases) if (Array.isArray(alias)) {
107
+ const current = alias[1].name + alias[0];
108
+ if (bestTuple === void 0 || WeaverContext.higherPriorityThan(current, bestTuple) < 0) bestTuple = current;
109
+ }
110
+ return bestTuple;
110
111
  }
111
112
  createFallbackAlias(namedType) {
112
113
  if ((0, graphql.isObjectType)(namedType) || (0, graphql.isInputObjectType)(namedType)) {
@@ -1461,12 +1462,14 @@ var LoomObjectType = class extends graphql.GraphQLObjectType {
1461
1462
  }
1462
1463
  hideField(name) {
1463
1464
  this.hiddenFields.add(name);
1465
+ delete this._fieldsCache;
1464
1466
  }
1465
1467
  addField(name, field$1, resolver$1) {
1466
1468
  const existing = this.extraFields.get(name);
1467
1469
  if (existing && existing !== field$1) throw new Error(`Field ${name} already exists in ${this.name}`);
1468
1470
  this.extraFields.set(name, field$1);
1469
1471
  if (resolver$1) this.resolvers.set(name, resolver$1);
1472
+ delete this._fieldsCache;
1470
1473
  }
1471
1474
  mergeExtensions(extensions) {
1472
1475
  this.extensions = deepMerge(this.extensions, extensions);
@@ -1476,7 +1479,9 @@ var LoomObjectType = class extends graphql.GraphQLObjectType {
1476
1479
  Object.entries(fieldsBySuper).forEach(([fieldName, field$1]) => field$1.type = this.getCacheType(field$1.type, fieldName));
1477
1480
  }
1478
1481
  extraFieldMap;
1482
+ _fieldsCache;
1479
1483
  getFields() {
1484
+ if (this._fieldsCache) return this._fieldsCache;
1480
1485
  const fieldsBySuper = super.getFields();
1481
1486
  this.collectedFieldNames();
1482
1487
  const extraFields = provideWeaverContext(() => toFieldMap(this.mapToFieldConfig(this.extraFields)), this.weaverContext);
@@ -1486,6 +1491,7 @@ var LoomObjectType = class extends graphql.GraphQLObjectType {
1486
1491
  ...this.extraFieldMap
1487
1492
  };
1488
1493
  for (const fieldName of this.hiddenFields) delete answer[fieldName];
1494
+ this._fieldsCache = answer;
1489
1495
  return answer;
1490
1496
  }
1491
1497
  mapToFieldConfig(map) {
package/dist/index.d.cts CHANGED
@@ -1,2 +1,2 @@
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, Gn as StandardTypedV1, 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 StandardJSONSchemaV1, Ut as getMemoizationMap, V as ResolverFactory, Vn as SubscriptionNeedResolve, Vt as OnlyMemoizationPayload, W as createField, Wn as StandardSchemaV1, 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-BstkglTj.cjs";
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, Gn as StandardTypedV1, 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 StandardJSONSchemaV1, Ut as getMemoizationMap, V as ResolverFactory, Vn as SubscriptionNeedResolve, Vt as OnlyMemoizationPayload, W as createField, Wn as StandardSchemaV1, 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-fddenU-d.cjs";
2
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, StandardJSONSchemaV1, StandardSchemaV1, StandardTypedV1, 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 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, Gn as StandardTypedV1, 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 StandardJSONSchemaV1, Ut as getMemoizationMap, V as ResolverFactory, Vn as SubscriptionNeedResolve, Vt as OnlyMemoizationPayload, W as createField, Wn as StandardSchemaV1, 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-CrKRwsqN.js";
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, Gn as StandardTypedV1, 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 StandardJSONSchemaV1, Ut as getMemoizationMap, V as ResolverFactory, Vn as SubscriptionNeedResolve, Vt as OnlyMemoizationPayload, W as createField, Wn as StandardSchemaV1, 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-DkwSGzwy.js";
2
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, StandardJSONSchemaV1, StandardSchemaV1, StandardTypedV1, 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
@@ -97,16 +97,17 @@ var WeaverContext = class WeaverContext {
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));
102
- let best;
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;
100
+ let bestString;
101
+ for (const alias of aliases) if (typeof alias === "string") {
102
+ if (bestString === void 0 || WeaverContext.higherPriorityThan(alias, bestString) < 0) bestString = alias;
108
103
  }
109
- return best;
104
+ if (bestString !== void 0) return bestString;
105
+ let bestTuple;
106
+ for (const alias of aliases) if (Array.isArray(alias)) {
107
+ const current = alias[1].name + alias[0];
108
+ if (bestTuple === void 0 || WeaverContext.higherPriorityThan(current, bestTuple) < 0) bestTuple = current;
109
+ }
110
+ return bestTuple;
110
111
  }
111
112
  createFallbackAlias(namedType) {
112
113
  if (isObjectType(namedType) || isInputObjectType(namedType)) {
@@ -1461,12 +1462,14 @@ var LoomObjectType = class extends GraphQLObjectType {
1461
1462
  }
1462
1463
  hideField(name) {
1463
1464
  this.hiddenFields.add(name);
1465
+ delete this._fieldsCache;
1464
1466
  }
1465
1467
  addField(name, field$1, resolver$1) {
1466
1468
  const existing = this.extraFields.get(name);
1467
1469
  if (existing && existing !== field$1) throw new Error(`Field ${name} already exists in ${this.name}`);
1468
1470
  this.extraFields.set(name, field$1);
1469
1471
  if (resolver$1) this.resolvers.set(name, resolver$1);
1472
+ delete this._fieldsCache;
1470
1473
  }
1471
1474
  mergeExtensions(extensions) {
1472
1475
  this.extensions = deepMerge(this.extensions, extensions);
@@ -1476,7 +1479,9 @@ var LoomObjectType = class extends GraphQLObjectType {
1476
1479
  Object.entries(fieldsBySuper).forEach(([fieldName, field$1]) => field$1.type = this.getCacheType(field$1.type, fieldName));
1477
1480
  }
1478
1481
  extraFieldMap;
1482
+ _fieldsCache;
1479
1483
  getFields() {
1484
+ if (this._fieldsCache) return this._fieldsCache;
1480
1485
  const fieldsBySuper = super.getFields();
1481
1486
  this.collectedFieldNames();
1482
1487
  const extraFields = provideWeaverContext(() => toFieldMap(this.mapToFieldConfig(this.extraFields)), this.weaverContext);
@@ -1486,6 +1491,7 @@ var LoomObjectType = class extends GraphQLObjectType {
1486
1491
  ...this.extraFieldMap
1487
1492
  };
1488
1493
  for (const fieldName of this.hiddenFields) delete answer[fieldName];
1494
+ this._fieldsCache = answer;
1489
1495
  return answer;
1490
1496
  }
1491
1497
  mapToFieldConfig(map) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gqloom/core",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "description": "Create GraphQL schema and resolvers with TypeScript.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",