@gqloom/core 0.15.0 → 0.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/context.d.cts +1 -1
- package/dist/context.d.ts +1 -1
- package/dist/{index-BstkglTj.d.cts → index-Baqk6dbm.d.ts} +3 -2
- package/dist/{index-CrKRwsqN.d.ts → index-BerZUcLP.d.cts} +5 -0
- package/dist/index.cjs +17 -10
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17 -10
- package/package.json +1 -1
package/dist/context.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ct as Middleware, Vt as OnlyMemoizationPayload, bn as BaseField, hn as ResolverPayload, ut as ResolvingFields } from "./index-
|
|
1
|
+
import { Ct as Middleware, Vt as OnlyMemoizationPayload, bn as BaseField, hn as ResolverPayload, ut as ResolvingFields } from "./index-BerZUcLP.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-
|
|
1
|
+
import { Ct as Middleware, Vt as OnlyMemoizationPayload, bn as BaseField, hn as ResolverPayload, ut as ResolvingFields } from "./index-Baqk6dbm.js";
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
3
|
|
|
4
4
|
//#region src/context/async-iterator.d.ts
|
|
@@ -1,7 +1,5 @@
|
|
|
1
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
|
-
//#region rolldown:runtime
|
|
4
|
-
//#endregion
|
|
5
3
|
//#region ../../node_modules/.pnpm/@standard-schema+spec@1.1.0/node_modules/@standard-schema/spec/dist/index.d.ts
|
|
6
4
|
/** The Standard Typed interface. This is a base type extended by other specs. */
|
|
7
5
|
interface StandardTypedV1<Input = unknown, Output = Input> {
|
|
@@ -929,6 +927,7 @@ declare function parseInputValue<TSchema extends GraphQLSilk | Record<string, Gr
|
|
|
929
927
|
declare function getStandardValue<T>(result: StandardSchemaV1.Result<T>): T;
|
|
930
928
|
declare function getStandardValue<T>(result?: StandardSchemaV1.Result<T>): T | undefined;
|
|
931
929
|
declare function getStandardValue<T>(result: StandardSchemaV1.Result<T> | null): T | null;
|
|
930
|
+
declare function getStandardValue<T>(result?: StandardSchemaV1.Result<T> | null): T | null | undefined;
|
|
932
931
|
//#endregion
|
|
933
932
|
//#region src/resolver/resolver.d.ts
|
|
934
933
|
/**
|
|
@@ -1102,6 +1101,7 @@ declare function silk<TObject extends GraphQLVariants<GraphQLObjectType>>(type:
|
|
|
1102
1101
|
*/
|
|
1103
1102
|
declare function silk<TOutput$1, TInput$1 = TOutput$1>(type: GraphQLOutputType | (() => GraphQLOutputType), validate?: (value: TInput$1) => StandardSchemaV1.Result<TOutput$1> | Promise<StandardSchemaV1.Result<TOutput$1>>): GraphQLSilk<TOutput$1, TInput$1>;
|
|
1104
1103
|
declare namespace silk {
|
|
1104
|
+
var is: typeof isSilk;
|
|
1105
1105
|
var parse: typeof parseSilk;
|
|
1106
1106
|
var getType: typeof getGraphQLType;
|
|
1107
1107
|
var nonNull: typeof nonNullSilk;
|
|
@@ -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>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
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
|
+
//#region rolldown:runtime
|
|
4
|
+
//#endregion
|
|
3
5
|
//#region ../../node_modules/.pnpm/@standard-schema+spec@1.1.0/node_modules/@standard-schema/spec/dist/index.d.ts
|
|
4
6
|
/** The Standard Typed interface. This is a base type extended by other specs. */
|
|
5
7
|
interface StandardTypedV1<Input = unknown, Output = Input> {
|
|
@@ -927,6 +929,7 @@ declare function parseInputValue<TSchema extends GraphQLSilk | Record<string, Gr
|
|
|
927
929
|
declare function getStandardValue<T>(result: StandardSchemaV1.Result<T>): T;
|
|
928
930
|
declare function getStandardValue<T>(result?: StandardSchemaV1.Result<T>): T | undefined;
|
|
929
931
|
declare function getStandardValue<T>(result: StandardSchemaV1.Result<T> | null): T | null;
|
|
932
|
+
declare function getStandardValue<T>(result?: StandardSchemaV1.Result<T> | null): T | null | undefined;
|
|
930
933
|
//#endregion
|
|
931
934
|
//#region src/resolver/resolver.d.ts
|
|
932
935
|
/**
|
|
@@ -1100,6 +1103,7 @@ declare function silk<TObject extends GraphQLVariants<GraphQLObjectType>>(type:
|
|
|
1100
1103
|
*/
|
|
1101
1104
|
declare function silk<TOutput$1, TInput$1 = TOutput$1>(type: GraphQLOutputType | (() => GraphQLOutputType), validate?: (value: TInput$1) => StandardSchemaV1.Result<TOutput$1> | Promise<StandardSchemaV1.Result<TOutput$1>>): GraphQLSilk<TOutput$1, TInput$1>;
|
|
1102
1105
|
declare namespace silk {
|
|
1106
|
+
var is: typeof isSilk;
|
|
1103
1107
|
var parse: typeof parseSilk;
|
|
1104
1108
|
var getType: typeof getGraphQLType;
|
|
1105
1109
|
var nonNull: typeof nonNullSilk;
|
|
@@ -1289,6 +1293,7 @@ declare class LoomObjectType extends GraphQLObjectType {
|
|
|
1289
1293
|
mergeExtensions(extensions: GraphQLObjectTypeConfig<any, any>["extensions"]): void;
|
|
1290
1294
|
protected collectedFieldNames(): void;
|
|
1291
1295
|
private extraFieldMap?;
|
|
1296
|
+
private _fieldsCache?;
|
|
1292
1297
|
getFields(): GraphQLFieldMap<any, any>;
|
|
1293
1298
|
protected mapToFieldConfig(map: Map<string, BaseField>): Record<string, GraphQLFieldConfig<any, any>>;
|
|
1294
1299
|
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
|
-
|
|
101
|
-
const
|
|
102
|
-
|
|
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
|
|
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)) {
|
|
@@ -240,7 +241,7 @@ function collectName(name, schema) {
|
|
|
240
241
|
//#region src/resolver/silk.ts
|
|
241
242
|
function silk(type, validate = (value) => ({ value: value ?? void 0 })) {
|
|
242
243
|
return {
|
|
243
|
-
[require_parse_resolving_fields.GET_GRAPHQL_TYPE]:
|
|
244
|
+
[require_parse_resolving_fields.GET_GRAPHQL_TYPE]: type,
|
|
244
245
|
"~standard": {
|
|
245
246
|
version: 1,
|
|
246
247
|
vendor: "gqloom.silk",
|
|
@@ -248,6 +249,7 @@ function silk(type, validate = (value) => ({ value: value ?? void 0 })) {
|
|
|
248
249
|
}
|
|
249
250
|
};
|
|
250
251
|
}
|
|
252
|
+
silk.is = isSilk;
|
|
251
253
|
silk.parse = parseSilk;
|
|
252
254
|
silk.getType = getGraphQLType;
|
|
253
255
|
silk.nonNull = nonNullSilk;
|
|
@@ -1461,12 +1463,14 @@ var LoomObjectType = class extends graphql.GraphQLObjectType {
|
|
|
1461
1463
|
}
|
|
1462
1464
|
hideField(name) {
|
|
1463
1465
|
this.hiddenFields.add(name);
|
|
1466
|
+
delete this._fieldsCache;
|
|
1464
1467
|
}
|
|
1465
1468
|
addField(name, field$1, resolver$1) {
|
|
1466
1469
|
const existing = this.extraFields.get(name);
|
|
1467
1470
|
if (existing && existing !== field$1) throw new Error(`Field ${name} already exists in ${this.name}`);
|
|
1468
1471
|
this.extraFields.set(name, field$1);
|
|
1469
1472
|
if (resolver$1) this.resolvers.set(name, resolver$1);
|
|
1473
|
+
delete this._fieldsCache;
|
|
1470
1474
|
}
|
|
1471
1475
|
mergeExtensions(extensions) {
|
|
1472
1476
|
this.extensions = deepMerge(this.extensions, extensions);
|
|
@@ -1476,7 +1480,9 @@ var LoomObjectType = class extends graphql.GraphQLObjectType {
|
|
|
1476
1480
|
Object.entries(fieldsBySuper).forEach(([fieldName, field$1]) => field$1.type = this.getCacheType(field$1.type, fieldName));
|
|
1477
1481
|
}
|
|
1478
1482
|
extraFieldMap;
|
|
1483
|
+
_fieldsCache;
|
|
1479
1484
|
getFields() {
|
|
1485
|
+
if (this._fieldsCache) return this._fieldsCache;
|
|
1480
1486
|
const fieldsBySuper = super.getFields();
|
|
1481
1487
|
this.collectedFieldNames();
|
|
1482
1488
|
const extraFields = provideWeaverContext(() => toFieldMap(this.mapToFieldConfig(this.extraFields)), this.weaverContext);
|
|
@@ -1486,6 +1492,7 @@ var LoomObjectType = class extends graphql.GraphQLObjectType {
|
|
|
1486
1492
|
...this.extraFieldMap
|
|
1487
1493
|
};
|
|
1488
1494
|
for (const fieldName of this.hiddenFields) delete answer[fieldName];
|
|
1495
|
+
this._fieldsCache = answer;
|
|
1489
1496
|
return answer;
|
|
1490
1497
|
}
|
|
1491
1498
|
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-
|
|
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-BerZUcLP.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-
|
|
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-Baqk6dbm.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
|
-
|
|
101
|
-
const
|
|
102
|
-
|
|
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
|
|
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)) {
|
|
@@ -240,7 +241,7 @@ function collectName(name, schema) {
|
|
|
240
241
|
//#region src/resolver/silk.ts
|
|
241
242
|
function silk(type, validate = (value) => ({ value: value ?? void 0 })) {
|
|
242
243
|
return {
|
|
243
|
-
[GET_GRAPHQL_TYPE]:
|
|
244
|
+
[GET_GRAPHQL_TYPE]: type,
|
|
244
245
|
"~standard": {
|
|
245
246
|
version: 1,
|
|
246
247
|
vendor: "gqloom.silk",
|
|
@@ -248,6 +249,7 @@ function silk(type, validate = (value) => ({ value: value ?? void 0 })) {
|
|
|
248
249
|
}
|
|
249
250
|
};
|
|
250
251
|
}
|
|
252
|
+
silk.is = isSilk;
|
|
251
253
|
silk.parse = parseSilk;
|
|
252
254
|
silk.getType = getGraphQLType;
|
|
253
255
|
silk.nonNull = nonNullSilk;
|
|
@@ -1461,12 +1463,14 @@ var LoomObjectType = class extends GraphQLObjectType {
|
|
|
1461
1463
|
}
|
|
1462
1464
|
hideField(name) {
|
|
1463
1465
|
this.hiddenFields.add(name);
|
|
1466
|
+
delete this._fieldsCache;
|
|
1464
1467
|
}
|
|
1465
1468
|
addField(name, field$1, resolver$1) {
|
|
1466
1469
|
const existing = this.extraFields.get(name);
|
|
1467
1470
|
if (existing && existing !== field$1) throw new Error(`Field ${name} already exists in ${this.name}`);
|
|
1468
1471
|
this.extraFields.set(name, field$1);
|
|
1469
1472
|
if (resolver$1) this.resolvers.set(name, resolver$1);
|
|
1473
|
+
delete this._fieldsCache;
|
|
1470
1474
|
}
|
|
1471
1475
|
mergeExtensions(extensions) {
|
|
1472
1476
|
this.extensions = deepMerge(this.extensions, extensions);
|
|
@@ -1476,7 +1480,9 @@ var LoomObjectType = class extends GraphQLObjectType {
|
|
|
1476
1480
|
Object.entries(fieldsBySuper).forEach(([fieldName, field$1]) => field$1.type = this.getCacheType(field$1.type, fieldName));
|
|
1477
1481
|
}
|
|
1478
1482
|
extraFieldMap;
|
|
1483
|
+
_fieldsCache;
|
|
1479
1484
|
getFields() {
|
|
1485
|
+
if (this._fieldsCache) return this._fieldsCache;
|
|
1480
1486
|
const fieldsBySuper = super.getFields();
|
|
1481
1487
|
this.collectedFieldNames();
|
|
1482
1488
|
const extraFields = provideWeaverContext(() => toFieldMap(this.mapToFieldConfig(this.extraFields)), this.weaverContext);
|
|
@@ -1486,6 +1492,7 @@ var LoomObjectType = class extends GraphQLObjectType {
|
|
|
1486
1492
|
...this.extraFieldMap
|
|
1487
1493
|
};
|
|
1488
1494
|
for (const fieldName of this.hiddenFields) delete answer[fieldName];
|
|
1495
|
+
this._fieldsCache = answer;
|
|
1489
1496
|
return answer;
|
|
1490
1497
|
}
|
|
1491
1498
|
mapToFieldConfig(map) {
|