@gqloom/core 0.14.0 → 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-C26E_cfW.d.cts → index-BuNcG6Vh.d.cts} +36 -35
- package/dist/{index-BdLdDytD.d.ts → index-DVABcenn.d.ts} +36 -35
- package/dist/index.cjs +100 -57
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +100 -58
- 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";
|
|
@@ -1156,16 +1152,21 @@ declare class WeaverContext {
|
|
|
1156
1152
|
readonly Scalar: "Scalar";
|
|
1157
1153
|
};
|
|
1158
1154
|
protected aliasCounters: Partial<Record<keyof typeof WeaverContext.namedTypes, number>>;
|
|
1159
|
-
|
|
1155
|
+
protected aliasMap: WeakMap<GraphQLNamedType, Set<string>>;
|
|
1156
|
+
setAlias(namedType: GraphQLNamedType, alias: string | undefined): string;
|
|
1160
1157
|
/**
|
|
1161
1158
|
* @returns -1 if a is better than b, 1 if b is better than a, 0 if they are equal
|
|
1162
1159
|
*/
|
|
1163
1160
|
protected static higherPriorityThan(a: string | undefined, b: string | undefined): number;
|
|
1164
|
-
|
|
1161
|
+
protected ensureAliasStore(namedType: GraphQLNamedType): Set<string>;
|
|
1162
|
+
protected pickAlias(namedType: GraphQLNamedType, aliases: Set<string>): string;
|
|
1163
|
+
protected reduceAliases(aliases: Iterable<string>): string | undefined;
|
|
1164
|
+
protected createFallbackAlias(namedType: GraphQLNamedType): string;
|
|
1165
|
+
static provide<T>(func: () => T, value: WeaverContext | undefined): T;
|
|
1165
1166
|
}
|
|
1166
1167
|
declare const initWeaverContext: () => WeaverContext;
|
|
1167
1168
|
declare const provideWeaverContext: typeof WeaverContext.provide & {
|
|
1168
|
-
inherit: <T
|
|
1169
|
+
inherit: <T>(func: () => T) => () => T;
|
|
1169
1170
|
};
|
|
1170
1171
|
interface WeaverConfig {
|
|
1171
1172
|
[WEAVER_CONFIG]: string | symbol;
|
|
@@ -1188,11 +1189,11 @@ declare class GlobalWeaverContext implements Partial<Omit<WeaverContext, GlobalC
|
|
|
1188
1189
|
setConfig(config: WeaverConfig): void;
|
|
1189
1190
|
deleteConfig(key: string | symbol): void;
|
|
1190
1191
|
useConfig<TConfig extends WeaverConfig, TCallback extends () => any>(config: TConfig, callback: TCallback): ReturnType<TCallback>;
|
|
1191
|
-
getNamedType<T
|
|
1192
|
+
getNamedType<T extends GraphQLOutputType>(name: string): T | undefined;
|
|
1192
1193
|
memoNamedType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(gqlType: TGraphQLType): TGraphQLType;
|
|
1193
1194
|
getGraphQLType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(origin: object): TGraphQLType | undefined;
|
|
1194
1195
|
memoGraphQLType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(origin: object, gqlType: TGraphQLType): TGraphQLType;
|
|
1195
|
-
setAlias(namedType: GraphQLNamedType, alias: string | undefined): string
|
|
1196
|
+
setAlias(namedType: GraphQLNamedType, alias: string | undefined): string;
|
|
1196
1197
|
}
|
|
1197
1198
|
declare const weaverContext: GlobalWeaverContext;
|
|
1198
1199
|
/**
|
|
@@ -1310,4 +1311,4 @@ declare class GraphQLSchemaLoom {
|
|
|
1310
1311
|
*/
|
|
1311
1312
|
declare const weave: typeof GraphQLSchemaLoom.weave;
|
|
1312
1313
|
//#endregion
|
|
1313
|
-
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";
|
|
@@ -1154,16 +1150,21 @@ declare class WeaverContext {
|
|
|
1154
1150
|
readonly Scalar: "Scalar";
|
|
1155
1151
|
};
|
|
1156
1152
|
protected aliasCounters: Partial<Record<keyof typeof WeaverContext.namedTypes, number>>;
|
|
1157
|
-
|
|
1153
|
+
protected aliasMap: WeakMap<GraphQLNamedType, Set<string>>;
|
|
1154
|
+
setAlias(namedType: GraphQLNamedType, alias: string | undefined): string;
|
|
1158
1155
|
/**
|
|
1159
1156
|
* @returns -1 if a is better than b, 1 if b is better than a, 0 if they are equal
|
|
1160
1157
|
*/
|
|
1161
1158
|
protected static higherPriorityThan(a: string | undefined, b: string | undefined): number;
|
|
1162
|
-
|
|
1159
|
+
protected ensureAliasStore(namedType: GraphQLNamedType): Set<string>;
|
|
1160
|
+
protected pickAlias(namedType: GraphQLNamedType, aliases: Set<string>): string;
|
|
1161
|
+
protected reduceAliases(aliases: Iterable<string>): string | undefined;
|
|
1162
|
+
protected createFallbackAlias(namedType: GraphQLNamedType): string;
|
|
1163
|
+
static provide<T>(func: () => T, value: WeaverContext | undefined): T;
|
|
1163
1164
|
}
|
|
1164
1165
|
declare const initWeaverContext: () => WeaverContext;
|
|
1165
1166
|
declare const provideWeaverContext: typeof WeaverContext.provide & {
|
|
1166
|
-
inherit: <T
|
|
1167
|
+
inherit: <T>(func: () => T) => () => T;
|
|
1167
1168
|
};
|
|
1168
1169
|
interface WeaverConfig {
|
|
1169
1170
|
[WEAVER_CONFIG]: string | symbol;
|
|
@@ -1186,11 +1187,11 @@ declare class GlobalWeaverContext implements Partial<Omit<WeaverContext, GlobalC
|
|
|
1186
1187
|
setConfig(config: WeaverConfig): void;
|
|
1187
1188
|
deleteConfig(key: string | symbol): void;
|
|
1188
1189
|
useConfig<TConfig extends WeaverConfig, TCallback extends () => any>(config: TConfig, callback: TCallback): ReturnType<TCallback>;
|
|
1189
|
-
getNamedType<T
|
|
1190
|
+
getNamedType<T extends GraphQLOutputType>(name: string): T | undefined;
|
|
1190
1191
|
memoNamedType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(gqlType: TGraphQLType): TGraphQLType;
|
|
1191
1192
|
getGraphQLType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(origin: object): TGraphQLType | undefined;
|
|
1192
1193
|
memoGraphQLType<TGraphQLType extends GraphQLOutputType = GraphQLOutputType>(origin: object, gqlType: TGraphQLType): TGraphQLType;
|
|
1193
|
-
setAlias(namedType: GraphQLNamedType, alias: string | undefined): string
|
|
1194
|
+
setAlias(namedType: GraphQLNamedType, alias: string | undefined): string;
|
|
1194
1195
|
}
|
|
1195
1196
|
declare const weaverContext: GlobalWeaverContext;
|
|
1196
1197
|
/**
|
|
@@ -1308,4 +1309,4 @@ declare class GraphQLSchemaLoom {
|
|
|
1308
1309
|
*/
|
|
1309
1310
|
declare const weave: typeof GraphQLSchemaLoom.weave;
|
|
1310
1311
|
//#endregion
|
|
1311
|
-
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 {
|
|
@@ -55,30 +54,13 @@ var WeaverContext = class WeaverContext {
|
|
|
55
54
|
Scalar: "Scalar"
|
|
56
55
|
};
|
|
57
56
|
aliasCounters = {};
|
|
57
|
+
aliasMap = /* @__PURE__ */ new WeakMap();
|
|
58
58
|
setAlias(namedType, alias) {
|
|
59
59
|
if (namedType.name === require_parse_resolving_fields.AUTO_ALIASING) WeaverContext.autoAliasTypes.add(namedType);
|
|
60
60
|
if (!WeaverContext.autoAliasTypes.has(namedType)) return namedType.name;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if (namedType.name === require_parse_resolving_fields.AUTO_ALIASING) {
|
|
65
|
-
if ((0, graphql.isObjectType)(namedType) || (0, graphql.isInputObjectType)(namedType)) {
|
|
66
|
-
this.aliasCounters["Object"] ??= 0;
|
|
67
|
-
return namedType.name = `Object${++this.aliasCounters["Object"]}`;
|
|
68
|
-
} else if ((0, graphql.isUnionType)(namedType)) {
|
|
69
|
-
this.aliasCounters["Union"] ??= 0;
|
|
70
|
-
return namedType.name = `Union${++this.aliasCounters["Union"]}`;
|
|
71
|
-
} else if ((0, graphql.isEnumType)(namedType)) {
|
|
72
|
-
this.aliasCounters["Enum"] ??= 0;
|
|
73
|
-
return namedType.name = `Enum${++this.aliasCounters["Enum"]}`;
|
|
74
|
-
} else if ((0, graphql.isInterfaceType)(namedType)) {
|
|
75
|
-
this.aliasCounters["Interface"] ??= 0;
|
|
76
|
-
return namedType.name = `Interface${++this.aliasCounters["Interface"]}`;
|
|
77
|
-
} else if ((0, graphql.isScalarType)(namedType)) {
|
|
78
|
-
this.aliasCounters["Scalar"] ??= 0;
|
|
79
|
-
return namedType.name = `Scalar${++this.aliasCounters["Scalar"]}`;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
61
|
+
const aliases = this.ensureAliasStore(namedType);
|
|
62
|
+
if (alias) aliases.add(alias);
|
|
63
|
+
return this.pickAlias(namedType, aliases);
|
|
82
64
|
}
|
|
83
65
|
/**
|
|
84
66
|
* @returns -1 if a is better than b, 1 if b is better than a, 0 if they are equal
|
|
@@ -92,6 +74,56 @@ var WeaverContext = class WeaverContext {
|
|
|
92
74
|
if (compareLocale !== 0) return compareLocale;
|
|
93
75
|
return 0;
|
|
94
76
|
}
|
|
77
|
+
ensureAliasStore(namedType) {
|
|
78
|
+
const existing = this.aliasMap.get(namedType);
|
|
79
|
+
if (existing) return existing;
|
|
80
|
+
const aliases = /* @__PURE__ */ new Set();
|
|
81
|
+
this.aliasMap.set(namedType, aliases);
|
|
82
|
+
Object.defineProperty(namedType, "name", {
|
|
83
|
+
get: () => this.pickAlias(namedType, aliases),
|
|
84
|
+
set: (value) => {
|
|
85
|
+
aliases.add(value);
|
|
86
|
+
},
|
|
87
|
+
enumerable: true,
|
|
88
|
+
configurable: true
|
|
89
|
+
});
|
|
90
|
+
return aliases;
|
|
91
|
+
}
|
|
92
|
+
pickAlias(namedType, aliases) {
|
|
93
|
+
const best = this.reduceAliases(aliases);
|
|
94
|
+
if (best && best !== require_parse_resolving_fields.AUTO_ALIASING) return best;
|
|
95
|
+
const fallback = this.createFallbackAlias(namedType);
|
|
96
|
+
aliases.add(fallback);
|
|
97
|
+
return this.reduceAliases(aliases) ?? fallback;
|
|
98
|
+
}
|
|
99
|
+
reduceAliases(aliases) {
|
|
100
|
+
let best;
|
|
101
|
+
for (const alias of aliases) if (best === void 0 || WeaverContext.higherPriorityThan(alias, best) < 0) best = alias;
|
|
102
|
+
return best;
|
|
103
|
+
}
|
|
104
|
+
createFallbackAlias(namedType) {
|
|
105
|
+
if ((0, graphql.isObjectType)(namedType) || (0, graphql.isInputObjectType)(namedType)) {
|
|
106
|
+
this.aliasCounters["Object"] ??= 0;
|
|
107
|
+
return `Object${++this.aliasCounters["Object"]}`;
|
|
108
|
+
}
|
|
109
|
+
if ((0, graphql.isUnionType)(namedType)) {
|
|
110
|
+
this.aliasCounters["Union"] ??= 0;
|
|
111
|
+
return `Union${++this.aliasCounters["Union"]}`;
|
|
112
|
+
}
|
|
113
|
+
if ((0, graphql.isEnumType)(namedType)) {
|
|
114
|
+
this.aliasCounters["Enum"] ??= 0;
|
|
115
|
+
return `Enum${++this.aliasCounters["Enum"]}`;
|
|
116
|
+
}
|
|
117
|
+
if ((0, graphql.isInterfaceType)(namedType)) {
|
|
118
|
+
this.aliasCounters["Interface"] ??= 0;
|
|
119
|
+
return `Interface${++this.aliasCounters["Interface"]}`;
|
|
120
|
+
}
|
|
121
|
+
if ((0, graphql.isScalarType)(namedType)) {
|
|
122
|
+
this.aliasCounters["Scalar"] ??= 0;
|
|
123
|
+
return `Scalar${++this.aliasCounters["Scalar"]}`;
|
|
124
|
+
}
|
|
125
|
+
return namedType.name;
|
|
126
|
+
}
|
|
95
127
|
static provide(func, value) {
|
|
96
128
|
const lastRef = WeaverContext._ref;
|
|
97
129
|
WeaverContext._ref = value;
|
|
@@ -169,7 +201,7 @@ var GlobalWeaverContext = class {
|
|
|
169
201
|
return gqlType;
|
|
170
202
|
}
|
|
171
203
|
setAlias(namedType, alias) {
|
|
172
|
-
return WeaverContext.ref?.setAlias(namedType, alias);
|
|
204
|
+
return WeaverContext.ref?.setAlias(namedType, alias) ?? namedType.name;
|
|
173
205
|
}
|
|
174
206
|
};
|
|
175
207
|
const weaverContext = new GlobalWeaverContext();
|
|
@@ -540,9 +572,39 @@ function toObjMap(obj) {
|
|
|
540
572
|
for (const [key, value] of Object.entries(obj)) map[key] = value;
|
|
541
573
|
return map;
|
|
542
574
|
}
|
|
575
|
+
/** @deprecated use `x != null` instead */
|
|
543
576
|
function notNullish(x) {
|
|
544
577
|
return x != null;
|
|
545
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
|
+
}
|
|
546
608
|
function deepMerge(...objects) {
|
|
547
609
|
const result = {};
|
|
548
610
|
for (const obj of objects) {
|
|
@@ -1328,7 +1390,7 @@ function ensureInputObjectType(object, options) {
|
|
|
1328
1390
|
if ((0, graphql.isInputObjectType)(object)) return object;
|
|
1329
1391
|
const existing = weaverContext.inputMap?.get(object);
|
|
1330
1392
|
if (existing != null) return existing;
|
|
1331
|
-
const { astNode: _1, extensionASTNodes: _2, fields
|
|
1393
|
+
const { astNode: _1, extensionASTNodes: _2, fields, ...config } = object.toConfig();
|
|
1332
1394
|
let name = object.name;
|
|
1333
1395
|
if (name === require_parse_resolving_fields.AUTO_ALIASING) name = `${pascalCase(options.fieldName)}Input`;
|
|
1334
1396
|
name = (weaverContext.getConfig("gqloom.core.schema")?.getInputObjectName ?? ((n) => n))(name);
|
|
@@ -1340,7 +1402,7 @@ function ensureInputObjectType(object, options) {
|
|
|
1340
1402
|
weaverContext.inputMap?.set(object, input);
|
|
1341
1403
|
return input;
|
|
1342
1404
|
}
|
|
1343
|
-
function toInputFieldConfig({ astNode, resolve
|
|
1405
|
+
function toInputFieldConfig({ astNode, resolve, ...config }, options) {
|
|
1344
1406
|
return {
|
|
1345
1407
|
...config,
|
|
1346
1408
|
type: ensureInputType(config.type, options)
|
|
@@ -1402,7 +1464,7 @@ var LoomObjectType = class extends graphql.GraphQLObjectType {
|
|
|
1402
1464
|
getFields() {
|
|
1403
1465
|
const fieldsBySuper = super.getFields();
|
|
1404
1466
|
this.collectedFieldNames();
|
|
1405
|
-
const extraFields = provideWeaverContext(() =>
|
|
1467
|
+
const extraFields = provideWeaverContext(() => toFieldMap(this.mapToFieldConfig(this.extraFields)), this.weaverContext);
|
|
1406
1468
|
if (Object.keys(this.extraFieldMap ?? {}).join() !== Object.keys(extraFields).join()) this.extraFieldMap = extraFields;
|
|
1407
1469
|
const answer = {
|
|
1408
1470
|
...fieldsBySuper,
|
|
@@ -1540,33 +1602,6 @@ function extract(field$1) {
|
|
|
1540
1602
|
extensions
|
|
1541
1603
|
};
|
|
1542
1604
|
}
|
|
1543
|
-
function defineFieldMap(fields) {
|
|
1544
|
-
return mapValue((0, graphql.resolveObjMapThunk)(fields), (fieldConfig, fieldName) => {
|
|
1545
|
-
const argsConfig = fieldConfig.args ?? {};
|
|
1546
|
-
return {
|
|
1547
|
-
name: (0, graphql.assertName)(fieldName),
|
|
1548
|
-
description: fieldConfig.description,
|
|
1549
|
-
type: fieldConfig.type,
|
|
1550
|
-
args: defineArguments(argsConfig),
|
|
1551
|
-
resolve: fieldConfig.resolve,
|
|
1552
|
-
subscribe: fieldConfig.subscribe,
|
|
1553
|
-
deprecationReason: fieldConfig.deprecationReason,
|
|
1554
|
-
extensions: toObjMap(fieldConfig.extensions),
|
|
1555
|
-
astNode: fieldConfig.astNode
|
|
1556
|
-
};
|
|
1557
|
-
});
|
|
1558
|
-
}
|
|
1559
|
-
function defineArguments(args) {
|
|
1560
|
-
return Object.entries(args).map(([argName, argConfig]) => ({
|
|
1561
|
-
name: (0, graphql.assertName)(argName),
|
|
1562
|
-
description: argConfig.description,
|
|
1563
|
-
type: argConfig.type,
|
|
1564
|
-
defaultValue: argConfig.defaultValue,
|
|
1565
|
-
deprecationReason: argConfig.deprecationReason,
|
|
1566
|
-
extensions: toObjMap(argConfig.extensions),
|
|
1567
|
-
astNode: argConfig.astNode
|
|
1568
|
-
}));
|
|
1569
|
-
}
|
|
1570
1605
|
const OPERATION_OBJECT_NAMES = new Set([
|
|
1571
1606
|
"Query",
|
|
1572
1607
|
"Mutation",
|
|
@@ -1581,7 +1616,10 @@ function getCacheType(gqlType, options = {}) {
|
|
|
1581
1616
|
if (gqlType instanceof LoomObjectType) return gqlType;
|
|
1582
1617
|
if ((0, graphql.isObjectType)(gqlType)) {
|
|
1583
1618
|
const gqlObject = context.loomObjectMap?.get(gqlType);
|
|
1584
|
-
if (gqlObject != null)
|
|
1619
|
+
if (gqlObject != null) {
|
|
1620
|
+
context.setAlias(gqlObject, getAlias());
|
|
1621
|
+
return gqlObject;
|
|
1622
|
+
}
|
|
1585
1623
|
const loomObject = new LoomObjectType(gqlType, options);
|
|
1586
1624
|
context.loomObjectMap?.set(gqlType, loomObject);
|
|
1587
1625
|
context.setAlias(loomObject, getAlias());
|
|
@@ -1590,7 +1628,10 @@ function getCacheType(gqlType, options = {}) {
|
|
|
1590
1628
|
else if ((0, graphql.isNonNullType)(gqlType)) return new graphql.GraphQLNonNull(getCacheType(gqlType.ofType, options));
|
|
1591
1629
|
else if ((0, graphql.isUnionType)(gqlType)) {
|
|
1592
1630
|
const existing = context.loomUnionMap?.get(gqlType);
|
|
1593
|
-
if (existing != null)
|
|
1631
|
+
if (existing != null) {
|
|
1632
|
+
context.setAlias(existing, getAlias());
|
|
1633
|
+
return existing;
|
|
1634
|
+
}
|
|
1594
1635
|
const config = gqlType.toConfig();
|
|
1595
1636
|
const unionType = new graphql.GraphQLUnionType({
|
|
1596
1637
|
...config,
|
|
@@ -1621,7 +1662,7 @@ function ensureInterfaceType(gqlType, interfaceConfig) {
|
|
|
1621
1662
|
const key = gqlType;
|
|
1622
1663
|
const existing = weaverContext.interfaceMap?.get(key);
|
|
1623
1664
|
if (existing != null) return existing;
|
|
1624
|
-
const { astNode: _, extensionASTNodes: _1, fields
|
|
1665
|
+
const { astNode: _, extensionASTNodes: _1, fields, ...config } = gqlType.toConfig();
|
|
1625
1666
|
const interfaceType = new graphql.GraphQLInterfaceType({
|
|
1626
1667
|
...config,
|
|
1627
1668
|
...interfaceConfig,
|
|
@@ -1896,6 +1937,8 @@ exports.resolver = resolver;
|
|
|
1896
1937
|
exports.screamingSnakeCase = screamingSnakeCase;
|
|
1897
1938
|
exports.silk = silk;
|
|
1898
1939
|
exports.subscription = subscription;
|
|
1940
|
+
exports.toArguments = toArguments;
|
|
1941
|
+
exports.toFieldMap = toFieldMap;
|
|
1899
1942
|
exports.toObjMap = toObjMap;
|
|
1900
1943
|
exports.tryIn = tryIn;
|
|
1901
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 {
|
|
@@ -54,30 +54,13 @@ var WeaverContext = class WeaverContext {
|
|
|
54
54
|
Scalar: "Scalar"
|
|
55
55
|
};
|
|
56
56
|
aliasCounters = {};
|
|
57
|
+
aliasMap = /* @__PURE__ */ new WeakMap();
|
|
57
58
|
setAlias(namedType, alias) {
|
|
58
59
|
if (namedType.name === AUTO_ALIASING) WeaverContext.autoAliasTypes.add(namedType);
|
|
59
60
|
if (!WeaverContext.autoAliasTypes.has(namedType)) return namedType.name;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
if (namedType.name === AUTO_ALIASING) {
|
|
64
|
-
if (isObjectType(namedType) || isInputObjectType(namedType)) {
|
|
65
|
-
this.aliasCounters["Object"] ??= 0;
|
|
66
|
-
return namedType.name = `Object${++this.aliasCounters["Object"]}`;
|
|
67
|
-
} else if (isUnionType(namedType)) {
|
|
68
|
-
this.aliasCounters["Union"] ??= 0;
|
|
69
|
-
return namedType.name = `Union${++this.aliasCounters["Union"]}`;
|
|
70
|
-
} else if (isEnumType(namedType)) {
|
|
71
|
-
this.aliasCounters["Enum"] ??= 0;
|
|
72
|
-
return namedType.name = `Enum${++this.aliasCounters["Enum"]}`;
|
|
73
|
-
} else if (isInterfaceType(namedType)) {
|
|
74
|
-
this.aliasCounters["Interface"] ??= 0;
|
|
75
|
-
return namedType.name = `Interface${++this.aliasCounters["Interface"]}`;
|
|
76
|
-
} else if (isScalarType(namedType)) {
|
|
77
|
-
this.aliasCounters["Scalar"] ??= 0;
|
|
78
|
-
return namedType.name = `Scalar${++this.aliasCounters["Scalar"]}`;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
61
|
+
const aliases = this.ensureAliasStore(namedType);
|
|
62
|
+
if (alias) aliases.add(alias);
|
|
63
|
+
return this.pickAlias(namedType, aliases);
|
|
81
64
|
}
|
|
82
65
|
/**
|
|
83
66
|
* @returns -1 if a is better than b, 1 if b is better than a, 0 if they are equal
|
|
@@ -91,6 +74,56 @@ var WeaverContext = class WeaverContext {
|
|
|
91
74
|
if (compareLocale !== 0) return compareLocale;
|
|
92
75
|
return 0;
|
|
93
76
|
}
|
|
77
|
+
ensureAliasStore(namedType) {
|
|
78
|
+
const existing = this.aliasMap.get(namedType);
|
|
79
|
+
if (existing) return existing;
|
|
80
|
+
const aliases = /* @__PURE__ */ new Set();
|
|
81
|
+
this.aliasMap.set(namedType, aliases);
|
|
82
|
+
Object.defineProperty(namedType, "name", {
|
|
83
|
+
get: () => this.pickAlias(namedType, aliases),
|
|
84
|
+
set: (value) => {
|
|
85
|
+
aliases.add(value);
|
|
86
|
+
},
|
|
87
|
+
enumerable: true,
|
|
88
|
+
configurable: true
|
|
89
|
+
});
|
|
90
|
+
return aliases;
|
|
91
|
+
}
|
|
92
|
+
pickAlias(namedType, aliases) {
|
|
93
|
+
const best = this.reduceAliases(aliases);
|
|
94
|
+
if (best && best !== AUTO_ALIASING) return best;
|
|
95
|
+
const fallback = this.createFallbackAlias(namedType);
|
|
96
|
+
aliases.add(fallback);
|
|
97
|
+
return this.reduceAliases(aliases) ?? fallback;
|
|
98
|
+
}
|
|
99
|
+
reduceAliases(aliases) {
|
|
100
|
+
let best;
|
|
101
|
+
for (const alias of aliases) if (best === void 0 || WeaverContext.higherPriorityThan(alias, best) < 0) best = alias;
|
|
102
|
+
return best;
|
|
103
|
+
}
|
|
104
|
+
createFallbackAlias(namedType) {
|
|
105
|
+
if (isObjectType(namedType) || isInputObjectType(namedType)) {
|
|
106
|
+
this.aliasCounters["Object"] ??= 0;
|
|
107
|
+
return `Object${++this.aliasCounters["Object"]}`;
|
|
108
|
+
}
|
|
109
|
+
if (isUnionType(namedType)) {
|
|
110
|
+
this.aliasCounters["Union"] ??= 0;
|
|
111
|
+
return `Union${++this.aliasCounters["Union"]}`;
|
|
112
|
+
}
|
|
113
|
+
if (isEnumType(namedType)) {
|
|
114
|
+
this.aliasCounters["Enum"] ??= 0;
|
|
115
|
+
return `Enum${++this.aliasCounters["Enum"]}`;
|
|
116
|
+
}
|
|
117
|
+
if (isInterfaceType(namedType)) {
|
|
118
|
+
this.aliasCounters["Interface"] ??= 0;
|
|
119
|
+
return `Interface${++this.aliasCounters["Interface"]}`;
|
|
120
|
+
}
|
|
121
|
+
if (isScalarType(namedType)) {
|
|
122
|
+
this.aliasCounters["Scalar"] ??= 0;
|
|
123
|
+
return `Scalar${++this.aliasCounters["Scalar"]}`;
|
|
124
|
+
}
|
|
125
|
+
return namedType.name;
|
|
126
|
+
}
|
|
94
127
|
static provide(func, value) {
|
|
95
128
|
const lastRef = WeaverContext._ref;
|
|
96
129
|
WeaverContext._ref = value;
|
|
@@ -168,7 +201,7 @@ var GlobalWeaverContext = class {
|
|
|
168
201
|
return gqlType;
|
|
169
202
|
}
|
|
170
203
|
setAlias(namedType, alias) {
|
|
171
|
-
return WeaverContext.ref?.setAlias(namedType, alias);
|
|
204
|
+
return WeaverContext.ref?.setAlias(namedType, alias) ?? namedType.name;
|
|
172
205
|
}
|
|
173
206
|
};
|
|
174
207
|
const weaverContext = new GlobalWeaverContext();
|
|
@@ -539,9 +572,39 @@ function toObjMap(obj) {
|
|
|
539
572
|
for (const [key, value] of Object.entries(obj)) map[key] = value;
|
|
540
573
|
return map;
|
|
541
574
|
}
|
|
575
|
+
/** @deprecated use `x != null` instead */
|
|
542
576
|
function notNullish(x) {
|
|
543
577
|
return x != null;
|
|
544
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
|
+
}
|
|
545
608
|
function deepMerge(...objects) {
|
|
546
609
|
const result = {};
|
|
547
610
|
for (const obj of objects) {
|
|
@@ -1327,7 +1390,7 @@ function ensureInputObjectType(object, options) {
|
|
|
1327
1390
|
if (isInputObjectType(object)) return object;
|
|
1328
1391
|
const existing = weaverContext.inputMap?.get(object);
|
|
1329
1392
|
if (existing != null) return existing;
|
|
1330
|
-
const { astNode: _1, extensionASTNodes: _2, fields
|
|
1393
|
+
const { astNode: _1, extensionASTNodes: _2, fields, ...config } = object.toConfig();
|
|
1331
1394
|
let name = object.name;
|
|
1332
1395
|
if (name === AUTO_ALIASING) name = `${pascalCase(options.fieldName)}Input`;
|
|
1333
1396
|
name = (weaverContext.getConfig("gqloom.core.schema")?.getInputObjectName ?? ((n) => n))(name);
|
|
@@ -1339,7 +1402,7 @@ function ensureInputObjectType(object, options) {
|
|
|
1339
1402
|
weaverContext.inputMap?.set(object, input);
|
|
1340
1403
|
return input;
|
|
1341
1404
|
}
|
|
1342
|
-
function toInputFieldConfig({ astNode, resolve
|
|
1405
|
+
function toInputFieldConfig({ astNode, resolve, ...config }, options) {
|
|
1343
1406
|
return {
|
|
1344
1407
|
...config,
|
|
1345
1408
|
type: ensureInputType(config.type, options)
|
|
@@ -1401,7 +1464,7 @@ var LoomObjectType = class extends GraphQLObjectType {
|
|
|
1401
1464
|
getFields() {
|
|
1402
1465
|
const fieldsBySuper = super.getFields();
|
|
1403
1466
|
this.collectedFieldNames();
|
|
1404
|
-
const extraFields = provideWeaverContext(() =>
|
|
1467
|
+
const extraFields = provideWeaverContext(() => toFieldMap(this.mapToFieldConfig(this.extraFields)), this.weaverContext);
|
|
1405
1468
|
if (Object.keys(this.extraFieldMap ?? {}).join() !== Object.keys(extraFields).join()) this.extraFieldMap = extraFields;
|
|
1406
1469
|
const answer = {
|
|
1407
1470
|
...fieldsBySuper,
|
|
@@ -1539,33 +1602,6 @@ function extract(field$1) {
|
|
|
1539
1602
|
extensions
|
|
1540
1603
|
};
|
|
1541
1604
|
}
|
|
1542
|
-
function defineFieldMap(fields) {
|
|
1543
|
-
return mapValue(resolveObjMapThunk(fields), (fieldConfig, fieldName) => {
|
|
1544
|
-
const argsConfig = fieldConfig.args ?? {};
|
|
1545
|
-
return {
|
|
1546
|
-
name: assertName(fieldName),
|
|
1547
|
-
description: fieldConfig.description,
|
|
1548
|
-
type: fieldConfig.type,
|
|
1549
|
-
args: defineArguments(argsConfig),
|
|
1550
|
-
resolve: fieldConfig.resolve,
|
|
1551
|
-
subscribe: fieldConfig.subscribe,
|
|
1552
|
-
deprecationReason: fieldConfig.deprecationReason,
|
|
1553
|
-
extensions: toObjMap(fieldConfig.extensions),
|
|
1554
|
-
astNode: fieldConfig.astNode
|
|
1555
|
-
};
|
|
1556
|
-
});
|
|
1557
|
-
}
|
|
1558
|
-
function defineArguments(args) {
|
|
1559
|
-
return Object.entries(args).map(([argName, argConfig]) => ({
|
|
1560
|
-
name: assertName(argName),
|
|
1561
|
-
description: argConfig.description,
|
|
1562
|
-
type: argConfig.type,
|
|
1563
|
-
defaultValue: argConfig.defaultValue,
|
|
1564
|
-
deprecationReason: argConfig.deprecationReason,
|
|
1565
|
-
extensions: toObjMap(argConfig.extensions),
|
|
1566
|
-
astNode: argConfig.astNode
|
|
1567
|
-
}));
|
|
1568
|
-
}
|
|
1569
1605
|
const OPERATION_OBJECT_NAMES = new Set([
|
|
1570
1606
|
"Query",
|
|
1571
1607
|
"Mutation",
|
|
@@ -1580,7 +1616,10 @@ function getCacheType(gqlType, options = {}) {
|
|
|
1580
1616
|
if (gqlType instanceof LoomObjectType) return gqlType;
|
|
1581
1617
|
if (isObjectType(gqlType)) {
|
|
1582
1618
|
const gqlObject = context.loomObjectMap?.get(gqlType);
|
|
1583
|
-
if (gqlObject != null)
|
|
1619
|
+
if (gqlObject != null) {
|
|
1620
|
+
context.setAlias(gqlObject, getAlias());
|
|
1621
|
+
return gqlObject;
|
|
1622
|
+
}
|
|
1584
1623
|
const loomObject = new LoomObjectType(gqlType, options);
|
|
1585
1624
|
context.loomObjectMap?.set(gqlType, loomObject);
|
|
1586
1625
|
context.setAlias(loomObject, getAlias());
|
|
@@ -1589,7 +1628,10 @@ function getCacheType(gqlType, options = {}) {
|
|
|
1589
1628
|
else if (isNonNullType(gqlType)) return new GraphQLNonNull(getCacheType(gqlType.ofType, options));
|
|
1590
1629
|
else if (isUnionType(gqlType)) {
|
|
1591
1630
|
const existing = context.loomUnionMap?.get(gqlType);
|
|
1592
|
-
if (existing != null)
|
|
1631
|
+
if (existing != null) {
|
|
1632
|
+
context.setAlias(existing, getAlias());
|
|
1633
|
+
return existing;
|
|
1634
|
+
}
|
|
1593
1635
|
const config = gqlType.toConfig();
|
|
1594
1636
|
const unionType = new GraphQLUnionType({
|
|
1595
1637
|
...config,
|
|
@@ -1620,7 +1662,7 @@ function ensureInterfaceType(gqlType, interfaceConfig) {
|
|
|
1620
1662
|
const key = gqlType;
|
|
1621
1663
|
const existing = weaverContext.interfaceMap?.get(key);
|
|
1622
1664
|
if (existing != null) return existing;
|
|
1623
|
-
const { astNode: _, extensionASTNodes: _1, fields
|
|
1665
|
+
const { astNode: _, extensionASTNodes: _1, fields, ...config } = gqlType.toConfig();
|
|
1624
1666
|
const interfaceType = new GraphQLInterfaceType({
|
|
1625
1667
|
...config,
|
|
1626
1668
|
...interfaceConfig,
|
|
@@ -1817,4 +1859,4 @@ var GraphQLSchemaLoom = class GraphQLSchemaLoom {
|
|
|
1817
1859
|
const weave = GraphQLSchemaLoom.weave;
|
|
1818
1860
|
|
|
1819
1861
|
//#endregion
|
|
1820
|
-
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 };
|