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