@gqloom/core 0.15.1 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/context.d.cts +1 -1
- package/dist/context.d.ts +1 -1
- package/dist/{index-fddenU-d.d.cts → index-BIH1zioK.d.cts} +4 -2
- package/dist/{index-DkwSGzwy.d.ts → index-BbqXqIY1.d.ts} +4 -2
- package/dist/index.cjs +35 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +35 -1
- 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-BIH1zioK.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-BbqXqIY1.js";
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
3
|
|
|
4
4
|
//#region src/context/async-iterator.d.ts
|
|
@@ -929,6 +929,7 @@ declare function parseInputValue<TSchema extends GraphQLSilk | Record<string, Gr
|
|
|
929
929
|
declare function getStandardValue<T>(result: StandardSchemaV1.Result<T>): T;
|
|
930
930
|
declare function getStandardValue<T>(result?: StandardSchemaV1.Result<T>): T | undefined;
|
|
931
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;
|
|
932
933
|
//#endregion
|
|
933
934
|
//#region src/resolver/resolver.d.ts
|
|
934
935
|
/**
|
|
@@ -1102,6 +1103,7 @@ declare function silk<TObject extends GraphQLVariants<GraphQLObjectType>>(type:
|
|
|
1102
1103
|
*/
|
|
1103
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>;
|
|
1104
1105
|
declare namespace silk {
|
|
1106
|
+
var is: typeof isSilk;
|
|
1105
1107
|
var parse: typeof parseSilk;
|
|
1106
1108
|
var getType: typeof getGraphQLType;
|
|
1107
1109
|
var nonNull: typeof nonNullSilk;
|
|
@@ -1141,7 +1143,7 @@ declare function getGraphQLArgumentConfig(silk: GraphQLSilk): Omit<GraphQLArgume
|
|
|
1141
1143
|
* @param input
|
|
1142
1144
|
* @returns output
|
|
1143
1145
|
*/
|
|
1144
|
-
declare function parseSilk<TSilk extends GraphQLSilk>(silk: TSilk, input:
|
|
1146
|
+
declare function parseSilk<TSilk extends GraphQLSilk>(silk: TSilk, input: unknown): MayPromise<StandardSchemaV1.Result<StandardSchemaV1.InferOutput<TSilk>>>;
|
|
1145
1147
|
declare function isSilk(target: any): target is GraphQLSilk;
|
|
1146
1148
|
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>>>;
|
|
1147
1149
|
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;
|
|
@@ -1238,7 +1240,7 @@ declare class GlobalWeaverContext implements Partial<Omit<WeaverContext, GlobalC
|
|
|
1238
1240
|
get id(): number | undefined;
|
|
1239
1241
|
get loomObjectMap(): Map<GraphQLObjectType<any, any>, LoomObjectType> | undefined;
|
|
1240
1242
|
get loomUnionMap(): Map<GraphQLUnionType, GraphQLUnionType> | undefined;
|
|
1241
|
-
get inputMap(): Map<GraphQLObjectType<any, any
|
|
1243
|
+
get inputMap(): Map<GraphQLInterfaceType | GraphQLObjectType<any, any>, GraphQLInputObjectType> | undefined;
|
|
1242
1244
|
get interfaceMap(): Map<GraphQLObjectType<any, any>, GraphQLInterfaceType> | undefined;
|
|
1243
1245
|
get configs(): Map<string | symbol, WeaverConfig> | undefined;
|
|
1244
1246
|
get vendorWeavers(): Map<string, SchemaWeaver> | undefined;
|
|
@@ -927,6 +927,7 @@ declare function parseInputValue<TSchema extends GraphQLSilk | Record<string, Gr
|
|
|
927
927
|
declare function getStandardValue<T>(result: StandardSchemaV1.Result<T>): T;
|
|
928
928
|
declare function getStandardValue<T>(result?: StandardSchemaV1.Result<T>): T | undefined;
|
|
929
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;
|
|
930
931
|
//#endregion
|
|
931
932
|
//#region src/resolver/resolver.d.ts
|
|
932
933
|
/**
|
|
@@ -1100,6 +1101,7 @@ declare function silk<TObject extends GraphQLVariants<GraphQLObjectType>>(type:
|
|
|
1100
1101
|
*/
|
|
1101
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>;
|
|
1102
1103
|
declare namespace silk {
|
|
1104
|
+
var is: typeof isSilk;
|
|
1103
1105
|
var parse: typeof parseSilk;
|
|
1104
1106
|
var getType: typeof getGraphQLType;
|
|
1105
1107
|
var nonNull: typeof nonNullSilk;
|
|
@@ -1139,7 +1141,7 @@ declare function getGraphQLArgumentConfig(silk: GraphQLSilk): Omit<GraphQLArgume
|
|
|
1139
1141
|
* @param input
|
|
1140
1142
|
* @returns output
|
|
1141
1143
|
*/
|
|
1142
|
-
declare function parseSilk<TSilk extends GraphQLSilk>(silk: TSilk, input:
|
|
1144
|
+
declare function parseSilk<TSilk extends GraphQLSilk>(silk: TSilk, input: unknown): MayPromise<StandardSchemaV1.Result<StandardSchemaV1.InferOutput<TSilk>>>;
|
|
1143
1145
|
declare function isSilk(target: any): target is GraphQLSilk;
|
|
1144
1146
|
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>>>;
|
|
1145
1147
|
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;
|
|
@@ -1236,7 +1238,7 @@ declare class GlobalWeaverContext implements Partial<Omit<WeaverContext, GlobalC
|
|
|
1236
1238
|
get id(): number | undefined;
|
|
1237
1239
|
get loomObjectMap(): Map<GraphQLObjectType<any, any>, LoomObjectType> | undefined;
|
|
1238
1240
|
get loomUnionMap(): Map<GraphQLUnionType, GraphQLUnionType> | undefined;
|
|
1239
|
-
get inputMap(): Map<GraphQLObjectType<any, any
|
|
1241
|
+
get inputMap(): Map<GraphQLInterfaceType | GraphQLObjectType<any, any>, GraphQLInputObjectType> | undefined;
|
|
1240
1242
|
get interfaceMap(): Map<GraphQLObjectType<any, any>, GraphQLInterfaceType> | undefined;
|
|
1241
1243
|
get configs(): Map<string | symbol, WeaverConfig> | undefined;
|
|
1242
1244
|
get vendorWeavers(): Map<string, SchemaWeaver> | undefined;
|
package/dist/index.cjs
CHANGED
|
@@ -241,7 +241,7 @@ function collectName(name, schema) {
|
|
|
241
241
|
//#region src/resolver/silk.ts
|
|
242
242
|
function silk(type, validate = (value) => ({ value: value ?? void 0 })) {
|
|
243
243
|
return {
|
|
244
|
-
[require_parse_resolving_fields.GET_GRAPHQL_TYPE]:
|
|
244
|
+
[require_parse_resolving_fields.GET_GRAPHQL_TYPE]: type,
|
|
245
245
|
"~standard": {
|
|
246
246
|
version: 1,
|
|
247
247
|
vendor: "gqloom.silk",
|
|
@@ -249,6 +249,7 @@ function silk(type, validate = (value) => ({ value: value ?? void 0 })) {
|
|
|
249
249
|
}
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
|
+
silk.is = isSilk;
|
|
252
253
|
silk.parse = parseSilk;
|
|
253
254
|
silk.getType = getGraphQLType;
|
|
254
255
|
silk.nonNull = nonNullSilk;
|
|
@@ -264,6 +265,13 @@ function nonNullSilk(origin) {
|
|
|
264
265
|
const originType = getGraphQLType(origin);
|
|
265
266
|
if (originType instanceof graphql.GraphQLNonNull) return originType;
|
|
266
267
|
else return new graphql.GraphQLNonNull(originType);
|
|
268
|
+
},
|
|
269
|
+
"~standard": {
|
|
270
|
+
...origin["~standard"],
|
|
271
|
+
validate: (value) => {
|
|
272
|
+
if (value == null) return { issues: [{ message: "Value must not be null or undefined" }] };
|
|
273
|
+
return origin["~standard"].validate(value);
|
|
274
|
+
}
|
|
267
275
|
}
|
|
268
276
|
};
|
|
269
277
|
}
|
|
@@ -278,6 +286,25 @@ function listSilk(origin) {
|
|
|
278
286
|
if (originType instanceof graphql.GraphQLNonNull && originType.ofType instanceof graphql.GraphQLList) originType = originType.ofType.ofType;
|
|
279
287
|
if (originType instanceof graphql.GraphQLList) originType = originType.ofType;
|
|
280
288
|
return new graphql.GraphQLNonNull(new graphql.GraphQLList(originType));
|
|
289
|
+
},
|
|
290
|
+
"~standard": {
|
|
291
|
+
...origin["~standard"],
|
|
292
|
+
validate: async (value) => {
|
|
293
|
+
if (!Array.isArray(value)) return { issues: [{ message: "Value must be an array" }] };
|
|
294
|
+
const results = await Promise.all(value.map((item) => origin["~standard"].validate(item)));
|
|
295
|
+
const issues = [];
|
|
296
|
+
const outputValues = [];
|
|
297
|
+
for (let i = 0; i < results.length; i++) {
|
|
298
|
+
const res = results[i];
|
|
299
|
+
if (res.issues) for (const issue of res.issues) issues.push({
|
|
300
|
+
...issue,
|
|
301
|
+
path: [i, ...issue.path ?? []]
|
|
302
|
+
});
|
|
303
|
+
if ("value" in res) outputValues.push(res.value);
|
|
304
|
+
}
|
|
305
|
+
if (issues.length > 0) return { issues };
|
|
306
|
+
return { value: outputValues };
|
|
307
|
+
}
|
|
281
308
|
}
|
|
282
309
|
};
|
|
283
310
|
}
|
|
@@ -291,6 +318,13 @@ function nullableSilk(origin) {
|
|
|
291
318
|
const originType = getGraphQLType(origin);
|
|
292
319
|
if (originType instanceof graphql.GraphQLNonNull) return originType.ofType;
|
|
293
320
|
else return originType;
|
|
321
|
+
},
|
|
322
|
+
"~standard": {
|
|
323
|
+
...origin["~standard"],
|
|
324
|
+
validate: (value) => {
|
|
325
|
+
if (value == null) return { value };
|
|
326
|
+
return origin["~standard"].validate(value);
|
|
327
|
+
}
|
|
294
328
|
}
|
|
295
329
|
};
|
|
296
330
|
}
|
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-BIH1zioK.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-BbqXqIY1.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
|
@@ -241,7 +241,7 @@ function collectName(name, schema) {
|
|
|
241
241
|
//#region src/resolver/silk.ts
|
|
242
242
|
function silk(type, validate = (value) => ({ value: value ?? void 0 })) {
|
|
243
243
|
return {
|
|
244
|
-
[GET_GRAPHQL_TYPE]:
|
|
244
|
+
[GET_GRAPHQL_TYPE]: type,
|
|
245
245
|
"~standard": {
|
|
246
246
|
version: 1,
|
|
247
247
|
vendor: "gqloom.silk",
|
|
@@ -249,6 +249,7 @@ function silk(type, validate = (value) => ({ value: value ?? void 0 })) {
|
|
|
249
249
|
}
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
|
+
silk.is = isSilk;
|
|
252
253
|
silk.parse = parseSilk;
|
|
253
254
|
silk.getType = getGraphQLType;
|
|
254
255
|
silk.nonNull = nonNullSilk;
|
|
@@ -264,6 +265,13 @@ function nonNullSilk(origin) {
|
|
|
264
265
|
const originType = getGraphQLType(origin);
|
|
265
266
|
if (originType instanceof GraphQLNonNull) return originType;
|
|
266
267
|
else return new GraphQLNonNull(originType);
|
|
268
|
+
},
|
|
269
|
+
"~standard": {
|
|
270
|
+
...origin["~standard"],
|
|
271
|
+
validate: (value) => {
|
|
272
|
+
if (value == null) return { issues: [{ message: "Value must not be null or undefined" }] };
|
|
273
|
+
return origin["~standard"].validate(value);
|
|
274
|
+
}
|
|
267
275
|
}
|
|
268
276
|
};
|
|
269
277
|
}
|
|
@@ -278,6 +286,25 @@ function listSilk(origin) {
|
|
|
278
286
|
if (originType instanceof GraphQLNonNull && originType.ofType instanceof GraphQLList) originType = originType.ofType.ofType;
|
|
279
287
|
if (originType instanceof GraphQLList) originType = originType.ofType;
|
|
280
288
|
return new GraphQLNonNull(new GraphQLList(originType));
|
|
289
|
+
},
|
|
290
|
+
"~standard": {
|
|
291
|
+
...origin["~standard"],
|
|
292
|
+
validate: async (value) => {
|
|
293
|
+
if (!Array.isArray(value)) return { issues: [{ message: "Value must be an array" }] };
|
|
294
|
+
const results = await Promise.all(value.map((item) => origin["~standard"].validate(item)));
|
|
295
|
+
const issues = [];
|
|
296
|
+
const outputValues = [];
|
|
297
|
+
for (let i = 0; i < results.length; i++) {
|
|
298
|
+
const res = results[i];
|
|
299
|
+
if (res.issues) for (const issue of res.issues) issues.push({
|
|
300
|
+
...issue,
|
|
301
|
+
path: [i, ...issue.path ?? []]
|
|
302
|
+
});
|
|
303
|
+
if ("value" in res) outputValues.push(res.value);
|
|
304
|
+
}
|
|
305
|
+
if (issues.length > 0) return { issues };
|
|
306
|
+
return { value: outputValues };
|
|
307
|
+
}
|
|
281
308
|
}
|
|
282
309
|
};
|
|
283
310
|
}
|
|
@@ -291,6 +318,13 @@ function nullableSilk(origin) {
|
|
|
291
318
|
const originType = getGraphQLType(origin);
|
|
292
319
|
if (originType instanceof GraphQLNonNull) return originType.ofType;
|
|
293
320
|
else return originType;
|
|
321
|
+
},
|
|
322
|
+
"~standard": {
|
|
323
|
+
...origin["~standard"],
|
|
324
|
+
validate: (value) => {
|
|
325
|
+
if (value == null) return { value };
|
|
326
|
+
return origin["~standard"].validate(value);
|
|
327
|
+
}
|
|
294
328
|
}
|
|
295
329
|
};
|
|
296
330
|
}
|