@gqloom/core 0.14.5 → 0.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-BL09k0x-.js → chunk-CXurZ27M.js} +2 -2
- package/dist/context.cjs +1 -1
- package/dist/context.d.cts +1 -1
- package/dist/context.d.ts +1 -1
- package/dist/context.js +1 -1
- package/dist/{index-B3y48ybK.d.ts → index-DkwSGzwy.d.ts} +87 -27
- package/dist/{index-DLEFTLoS.d.cts → index-fddenU-d.d.cts} +87 -27
- package/dist/index.cjs +31 -17
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +31 -17
- package/dist/{parse-resolving-fields-GAEhHjUw.js → parse-resolving-fields-B9xSmxNH.js} +2 -2
- package/dist/{parse-resolving-fields-k74tX3i9.cjs → parse-resolving-fields-CJw_nGJ2.cjs} +2 -2
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region rolldown:runtime
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var
|
|
3
|
+
var __exportAll = (all, symbols) => {
|
|
4
4
|
let target = {};
|
|
5
5
|
for (var name in all) {
|
|
6
6
|
__defProp(target, name, {
|
|
@@ -15,4 +15,4 @@ var __export = (all, symbols) => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
//#endregion
|
|
18
|
-
export {
|
|
18
|
+
export { __exportAll as t };
|
package/dist/context.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_parse_resolving_fields = require('./parse-resolving-fields-
|
|
1
|
+
const require_parse_resolving_fields = require('./parse-resolving-fields-CJw_nGJ2.cjs');
|
|
2
2
|
let node_async_hooks = require("node:async_hooks");
|
|
3
3
|
|
|
4
4
|
//#region src/context/async-iterator.ts
|
package/dist/context.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ct as Middleware, Vt as OnlyMemoizationPayload, bn as BaseField, hn as ResolverPayload, ut as ResolvingFields } from "./index-
|
|
1
|
+
import { Ct as Middleware, Vt as OnlyMemoizationPayload, bn as BaseField, hn as ResolverPayload, ut as ResolvingFields } from "./index-fddenU-d.cjs";
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
3
|
|
|
4
4
|
//#region src/context/async-iterator.d.ts
|
package/dist/context.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ct as Middleware, Vt as OnlyMemoizationPayload, bn as BaseField, hn as ResolverPayload, ut as ResolvingFields } from "./index-
|
|
1
|
+
import { Ct as Middleware, Vt as OnlyMemoizationPayload, bn as BaseField, hn as ResolverPayload, ut as ResolvingFields } from "./index-DkwSGzwy.js";
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
3
|
|
|
4
4
|
//#region src/context/async-iterator.d.ts
|
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-B9xSmxNH.js";
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
3
|
|
|
4
4
|
//#region src/context/async-iterator.ts
|
|
@@ -1,6 +1,33 @@
|
|
|
1
1
|
import { GraphQLArgument, GraphQLArgumentConfig, GraphQLFieldConfig, GraphQLFieldConfigArgumentMap, GraphQLFieldExtensions, GraphQLFieldMap, GraphQLInputObjectType, GraphQLInputType, GraphQLInterfaceType, GraphQLInterfaceTypeConfig, GraphQLList, GraphQLNamedType, GraphQLNonNull, GraphQLNullableType, GraphQLObjectType, GraphQLObjectTypeConfig, GraphQLOutputType, GraphQLResolveInfo, GraphQLScalarType, GraphQLSchema, GraphQLSchemaConfig, GraphQLType, GraphQLUnionType } from "graphql";
|
|
2
2
|
|
|
3
|
-
//#region ../../node_modules/.pnpm/@standard-schema+spec@1.
|
|
3
|
+
//#region ../../node_modules/.pnpm/@standard-schema+spec@1.1.0/node_modules/@standard-schema/spec/dist/index.d.ts
|
|
4
|
+
/** The Standard Typed interface. This is a base type extended by other specs. */
|
|
5
|
+
interface StandardTypedV1<Input = unknown, Output = Input> {
|
|
6
|
+
/** The Standard properties. */
|
|
7
|
+
readonly "~standard": StandardTypedV1.Props<Input, Output>;
|
|
8
|
+
}
|
|
9
|
+
declare namespace StandardTypedV1 {
|
|
10
|
+
/** The Standard Typed properties interface. */
|
|
11
|
+
interface Props<Input = unknown, Output = Input> {
|
|
12
|
+
/** The version number of the standard. */
|
|
13
|
+
readonly version: 1;
|
|
14
|
+
/** The vendor name of the schema library. */
|
|
15
|
+
readonly vendor: string;
|
|
16
|
+
/** Inferred types associated with the schema. */
|
|
17
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
18
|
+
}
|
|
19
|
+
/** The Standard Typed types interface. */
|
|
20
|
+
interface Types<Input = unknown, Output = Input> {
|
|
21
|
+
/** The input type of the schema. */
|
|
22
|
+
readonly input: Input;
|
|
23
|
+
/** The output type of the schema. */
|
|
24
|
+
readonly output: Output;
|
|
25
|
+
}
|
|
26
|
+
/** Infers the input type of a Standard Typed. */
|
|
27
|
+
type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
28
|
+
/** Infers the output type of a Standard Typed. */
|
|
29
|
+
type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
30
|
+
}
|
|
4
31
|
/** The Standard Schema interface. */
|
|
5
32
|
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
6
33
|
/** The Standard Schema properties. */
|
|
@@ -8,54 +35,86 @@ interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
|
8
35
|
}
|
|
9
36
|
declare namespace StandardSchemaV1 {
|
|
10
37
|
/** The Standard Schema properties interface. */
|
|
11
|
-
|
|
12
|
-
/** The version number of the standard. */
|
|
13
|
-
readonly version: 1;
|
|
14
|
-
/** The vendor name of the schema library. */
|
|
15
|
-
readonly vendor: string;
|
|
38
|
+
interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
|
|
16
39
|
/** Validates unknown input values. */
|
|
17
|
-
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
|
18
|
-
/** Inferred types associated with the schema. */
|
|
19
|
-
readonly types?: Types<Input, Output> | undefined;
|
|
40
|
+
readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
|
|
20
41
|
}
|
|
21
42
|
/** The result interface of the validate function. */
|
|
22
|
-
|
|
43
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
23
44
|
/** The result interface if validation succeeds. */
|
|
24
|
-
|
|
45
|
+
interface SuccessResult<Output> {
|
|
25
46
|
/** The typed output value. */
|
|
26
47
|
readonly value: Output;
|
|
27
|
-
/**
|
|
48
|
+
/** A falsy value for `issues` indicates success. */
|
|
28
49
|
readonly issues?: undefined;
|
|
29
50
|
}
|
|
51
|
+
interface Options {
|
|
52
|
+
/** Explicit support for additional vendor-specific parameters, if needed. */
|
|
53
|
+
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
54
|
+
}
|
|
30
55
|
/** The result interface if validation fails. */
|
|
31
|
-
|
|
56
|
+
interface FailureResult {
|
|
32
57
|
/** The issues of failed validation. */
|
|
33
58
|
readonly issues: ReadonlyArray<Issue>;
|
|
34
59
|
}
|
|
35
60
|
/** The issue interface of the failure output. */
|
|
36
|
-
|
|
61
|
+
interface Issue {
|
|
37
62
|
/** The error message of the issue. */
|
|
38
63
|
readonly message: string;
|
|
39
64
|
/** The path of the issue, if any. */
|
|
40
65
|
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
41
66
|
}
|
|
42
67
|
/** The path segment interface of the issue. */
|
|
43
|
-
|
|
68
|
+
interface PathSegment {
|
|
44
69
|
/** The key representing a path segment. */
|
|
45
70
|
readonly key: PropertyKey;
|
|
46
71
|
}
|
|
47
|
-
/** The Standard
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
72
|
+
/** The Standard types interface. */
|
|
73
|
+
interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {}
|
|
74
|
+
/** Infers the input type of a Standard. */
|
|
75
|
+
type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
|
|
76
|
+
/** Infers the output type of a Standard. */
|
|
77
|
+
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
78
|
+
}
|
|
79
|
+
/** The Standard JSON Schema interface. */
|
|
80
|
+
interface StandardJSONSchemaV1<Input = unknown, Output = Input> {
|
|
81
|
+
/** The Standard JSON Schema properties. */
|
|
82
|
+
readonly "~standard": StandardJSONSchemaV1.Props<Input, Output>;
|
|
83
|
+
}
|
|
84
|
+
declare namespace StandardJSONSchemaV1 {
|
|
85
|
+
/** The Standard JSON Schema properties interface. */
|
|
86
|
+
interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
|
|
87
|
+
/** Methods for generating the input/output JSON Schema. */
|
|
88
|
+
readonly jsonSchema: StandardJSONSchemaV1.Converter;
|
|
89
|
+
}
|
|
90
|
+
/** The Standard JSON Schema converter interface. */
|
|
91
|
+
interface Converter {
|
|
92
|
+
/** Converts the input type to JSON Schema. May throw if conversion is not supported. */
|
|
93
|
+
readonly input: (options: StandardJSONSchemaV1.Options) => Record<string, unknown>;
|
|
94
|
+
/** Converts the output type to JSON Schema. May throw if conversion is not supported. */
|
|
95
|
+
readonly output: (options: StandardJSONSchemaV1.Options) => Record<string, unknown>;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The target version of the generated JSON Schema.
|
|
99
|
+
*
|
|
100
|
+
* It is *strongly recommended* that implementers support `"draft-2020-12"` and `"draft-07"`, as they are both in wide use. All other targets can be implemented on a best-effort basis. Libraries should throw if they don't support a specified target.
|
|
101
|
+
*
|
|
102
|
+
* The `"openapi-3.0"` target is intended as a standardized specifier for OpenAPI 3.0 which is a superset of JSON Schema `"draft-04"`.
|
|
103
|
+
*/
|
|
104
|
+
type Target = "draft-2020-12" | "draft-07" | "openapi-3.0" | ({} & string);
|
|
105
|
+
/** The options for the input/output methods. */
|
|
106
|
+
interface Options {
|
|
107
|
+
/** Specifies the target version of the generated JSON Schema. Support for all versions is on a best-effort basis. If a given version is not supported, the library should throw. */
|
|
108
|
+
readonly target: Target;
|
|
109
|
+
/** Explicit support for additional vendor-specific parameters, if needed. */
|
|
110
|
+
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
53
111
|
}
|
|
54
|
-
/**
|
|
55
|
-
|
|
56
|
-
/** Infers the
|
|
57
|
-
|
|
58
|
-
|
|
112
|
+
/** The Standard types interface. */
|
|
113
|
+
interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {}
|
|
114
|
+
/** Infers the input type of a Standard. */
|
|
115
|
+
type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
|
|
116
|
+
/** Infers the output type of a Standard. */
|
|
117
|
+
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
59
118
|
}
|
|
60
119
|
declare namespace symbols_d_exports {
|
|
61
120
|
export { CONTEXT_MAP_KEY, FIELD_HIDDEN, GET_GRAPHQL_ARGUMENT_CONFIG, GET_GRAPHQL_TYPE, IS_RESOLVER, RESOLVER_OPTIONS_KEY, WEAVER_CONFIG };
|
|
@@ -1230,6 +1289,7 @@ declare class LoomObjectType extends GraphQLObjectType {
|
|
|
1230
1289
|
mergeExtensions(extensions: GraphQLObjectTypeConfig<any, any>["extensions"]): void;
|
|
1231
1290
|
protected collectedFieldNames(): void;
|
|
1232
1291
|
private extraFieldMap?;
|
|
1292
|
+
private _fieldsCache?;
|
|
1233
1293
|
getFields(): GraphQLFieldMap<any, any>;
|
|
1234
1294
|
protected mapToFieldConfig(map: Map<string, BaseField>): Record<string, GraphQLFieldConfig<any, any>>;
|
|
1235
1295
|
toFieldConfig(field: BaseField, fieldName: string): GraphQLFieldConfig<any, any>;
|
|
@@ -1310,4 +1370,4 @@ declare class GraphQLSchemaLoom {
|
|
|
1310
1370
|
*/
|
|
1311
1371
|
declare const weave: typeof GraphQLSchemaLoom.weave;
|
|
1312
1372
|
//#endregion
|
|
1313
|
-
export { resolver as $, FieldOptions as $t, getGraphQLArgumentConfig as A, BaseChainFactory as An, MayGetter as At, ObjectChainResolver as B, SubscriptionChainFactory as Bn, tryIn as Bt, DirectiveItem as C, FieldOrOperation as Cn, Middleware as Ct, ListSilk as D, Resolver as Dn, applyMiddlewares as Dt, GQLoomExtensions as E, Query as En, MiddlewareOptions as Et, nullableSilk as F, MutationChainFactory as Fn, BatchLoadFn as Ft, createMutation as G, onlyMemoization as Gt, ResolverMeta as H, symbols_d_exports as Hn, assignContextMap as Ht, parseSilk as I, MutationFactoryWithResolve as In, EasyDataLoader as It, defaultSubscriptionResolve as J, getFieldOptions as Jt, createQuery as K, AUTO_ALIASING as Kt, silk as L, QueryChainFactory as Ln, LoomDataLoader as Lt, isSilk as M, FieldChainFactory as Mn, OmitInUnion as Mt, listSilk as N, FieldFactoryWithResolve as Nn, RequireKeys as Nt, NonNullSilk as O, Subscription as On, filterMiddlewares as Ot, nonNullSilk as P, IChainFactory as Pn, ValueOf as Pt, query$1 as Q, FieldFactoryWithUtils as Qt, ChainResolver as R, QueryFactoryWithResolve as Rn, markErrorLocation as Rt, inputToArgs as S, FieldMeta as Sn, CallableMiddlewareOptions as St, GQLoomExtensionAttribute as T, Operation as Tn, MiddlewareOperation as Tt, ToExecutorProps as U,
|
|
1373
|
+
export { resolver as $, FieldOptions as $t, getGraphQLArgumentConfig as A, BaseChainFactory as An, MayGetter as At, ObjectChainResolver as B, SubscriptionChainFactory as Bn, tryIn as Bt, DirectiveItem as C, FieldOrOperation as Cn, Middleware as Ct, ListSilk as D, Resolver as Dn, applyMiddlewares as Dt, GQLoomExtensions as E, Query as En, MiddlewareOptions as Et, nullableSilk as F, MutationChainFactory as Fn, BatchLoadFn as Ft, createMutation as G, StandardTypedV1 as Gn, onlyMemoization as Gt, ResolverMeta as H, symbols_d_exports as Hn, assignContextMap as Ht, parseSilk as I, MutationFactoryWithResolve as In, EasyDataLoader as It, defaultSubscriptionResolve as J, getFieldOptions as Jt, createQuery as K, AUTO_ALIASING as Kt, silk as L, QueryChainFactory as Ln, LoomDataLoader as Lt, isSilk as M, FieldChainFactory as Mn, OmitInUnion as Mt, listSilk as N, FieldFactoryWithResolve as Nn, RequireKeys as Nt, NonNullSilk as O, Subscription as On, filterMiddlewares as Ot, nonNullSilk as P, IChainFactory as Pn, ValueOf as Pt, query$1 as Q, FieldFactoryWithUtils as Qt, ChainResolver as R, QueryFactoryWithResolve as Rn, markErrorLocation as Rt, inputToArgs as S, FieldMeta as Sn, CallableMiddlewareOptions as St, GQLoomExtensionAttribute as T, Operation as Tn, MiddlewareOperation as Tt, ToExecutorProps as U, StandardJSONSchemaV1 as Un, getMemoizationMap as Ut, ResolverFactory as V, SubscriptionNeedResolve as Vn, OnlyMemoizationPayload as Vt, createField as W, StandardSchemaV1 as Wn, isOnlyMemoryPayload as Wt, loom as X, getSubscriptionOptions as Xt, field as Y, getOperationOptions as Yt, mutation$1 as Z, FieldFactory as Zt, SchemaWeaver as _, SubscriptionFactory as _n, meta as _t, LoomObjectType as a, MutationFactory as an, getStandardValue as at, ensureInputObjectType as b, BaseField as bn, toFieldMap as bt, AliasList as c, OperationType as cn, pascalCase as ct, WeaverContext as d, QueryOptions as dn, ResolvingFieldsOptions as dt, FieldOrOperationType as en, subscription$1 as et, collectName as f, ResolverOptions as fn, getDeepResolvingFields as ft, weaverContext as g, ResolvingOptions as gn, mapValue as gt, provideWeaverContext as h, ResolverPayload as hn, deepMerge as ht, CoreSchemaWeaverConfigOptions as i, InferFieldOutput as in, createInputParser as it, getGraphQLType as j, ChainFactoryOptions as jn, MayPromise as jt, NullableSilk as k, types_loom_d_exports as kn, IsAny as kt, GlobalWeaverContext as l, QueryFactory as ln, screamingSnakeCase as lt, initWeaverContext as m, ResolverOptionsWithParent as mn, parseResolvingFields as mt, weave as n, GraphQLSilk as nn, InferInputI as nt, OPERATION_OBJECT_NAMES as o, MutationFactoryWithChain as on, parseInputValue as ot, collectNames as p, ResolverOptionsWithExtensions as pn, getResolvingFields as pt, createSubscription as q, DERIVED_DEPENDENCIES as qt, CoreSchemaWeaverConfig as r, InferFieldInput as rn, InferInputO as rt, getCacheType as s, MutationOptions as sn, capitalize as st, GraphQLSchemaLoom as t, GraphQLFieldOptions as tn, CallableInputParser as tt, WeaverConfig as u, QueryFactoryWithChain as un, ResolvingFields as ut, isSchemaVendorWeaver as v, SubscriptionFactoryWithChain as vn, notNullish as vt, DirectiveRecord as w, Mutation as wn, MiddlewareConfig as wt, ensureInputType as x, Field as xn, toObjMap as xt, ensureInterfaceType as y, SubscriptionOptions as yn, toArguments as yt, Executor as z, ResolvableSubscription as zn, markLocation as zt };
|
|
@@ -2,7 +2,34 @@ import { GraphQLArgument, GraphQLArgumentConfig, GraphQLFieldConfig, GraphQLFiel
|
|
|
2
2
|
|
|
3
3
|
//#region rolldown:runtime
|
|
4
4
|
//#endregion
|
|
5
|
-
//#region ../../node_modules/.pnpm/@standard-schema+spec@1.
|
|
5
|
+
//#region ../../node_modules/.pnpm/@standard-schema+spec@1.1.0/node_modules/@standard-schema/spec/dist/index.d.ts
|
|
6
|
+
/** The Standard Typed interface. This is a base type extended by other specs. */
|
|
7
|
+
interface StandardTypedV1<Input = unknown, Output = Input> {
|
|
8
|
+
/** The Standard properties. */
|
|
9
|
+
readonly "~standard": StandardTypedV1.Props<Input, Output>;
|
|
10
|
+
}
|
|
11
|
+
declare namespace StandardTypedV1 {
|
|
12
|
+
/** The Standard Typed properties interface. */
|
|
13
|
+
interface Props<Input = unknown, Output = Input> {
|
|
14
|
+
/** The version number of the standard. */
|
|
15
|
+
readonly version: 1;
|
|
16
|
+
/** The vendor name of the schema library. */
|
|
17
|
+
readonly vendor: string;
|
|
18
|
+
/** Inferred types associated with the schema. */
|
|
19
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
20
|
+
}
|
|
21
|
+
/** The Standard Typed types interface. */
|
|
22
|
+
interface Types<Input = unknown, Output = Input> {
|
|
23
|
+
/** The input type of the schema. */
|
|
24
|
+
readonly input: Input;
|
|
25
|
+
/** The output type of the schema. */
|
|
26
|
+
readonly output: Output;
|
|
27
|
+
}
|
|
28
|
+
/** Infers the input type of a Standard Typed. */
|
|
29
|
+
type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["input"];
|
|
30
|
+
/** Infers the output type of a Standard Typed. */
|
|
31
|
+
type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema["~standard"]["types"]>["output"];
|
|
32
|
+
}
|
|
6
33
|
/** The Standard Schema interface. */
|
|
7
34
|
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
8
35
|
/** The Standard Schema properties. */
|
|
@@ -10,54 +37,86 @@ interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
|
10
37
|
}
|
|
11
38
|
declare namespace StandardSchemaV1 {
|
|
12
39
|
/** The Standard Schema properties interface. */
|
|
13
|
-
|
|
14
|
-
/** The version number of the standard. */
|
|
15
|
-
readonly version: 1;
|
|
16
|
-
/** The vendor name of the schema library. */
|
|
17
|
-
readonly vendor: string;
|
|
40
|
+
interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
|
|
18
41
|
/** Validates unknown input values. */
|
|
19
|
-
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
|
20
|
-
/** Inferred types associated with the schema. */
|
|
21
|
-
readonly types?: Types<Input, Output> | undefined;
|
|
42
|
+
readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result<Output> | Promise<Result<Output>>;
|
|
22
43
|
}
|
|
23
44
|
/** The result interface of the validate function. */
|
|
24
|
-
|
|
45
|
+
type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
25
46
|
/** The result interface if validation succeeds. */
|
|
26
|
-
|
|
47
|
+
interface SuccessResult<Output> {
|
|
27
48
|
/** The typed output value. */
|
|
28
49
|
readonly value: Output;
|
|
29
|
-
/**
|
|
50
|
+
/** A falsy value for `issues` indicates success. */
|
|
30
51
|
readonly issues?: undefined;
|
|
31
52
|
}
|
|
53
|
+
interface Options {
|
|
54
|
+
/** Explicit support for additional vendor-specific parameters, if needed. */
|
|
55
|
+
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
56
|
+
}
|
|
32
57
|
/** The result interface if validation fails. */
|
|
33
|
-
|
|
58
|
+
interface FailureResult {
|
|
34
59
|
/** The issues of failed validation. */
|
|
35
60
|
readonly issues: ReadonlyArray<Issue>;
|
|
36
61
|
}
|
|
37
62
|
/** The issue interface of the failure output. */
|
|
38
|
-
|
|
63
|
+
interface Issue {
|
|
39
64
|
/** The error message of the issue. */
|
|
40
65
|
readonly message: string;
|
|
41
66
|
/** The path of the issue, if any. */
|
|
42
67
|
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
43
68
|
}
|
|
44
69
|
/** The path segment interface of the issue. */
|
|
45
|
-
|
|
70
|
+
interface PathSegment {
|
|
46
71
|
/** The key representing a path segment. */
|
|
47
72
|
readonly key: PropertyKey;
|
|
48
73
|
}
|
|
49
|
-
/** The Standard
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
74
|
+
/** The Standard types interface. */
|
|
75
|
+
interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {}
|
|
76
|
+
/** Infers the input type of a Standard. */
|
|
77
|
+
type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
|
|
78
|
+
/** Infers the output type of a Standard. */
|
|
79
|
+
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
80
|
+
}
|
|
81
|
+
/** The Standard JSON Schema interface. */
|
|
82
|
+
interface StandardJSONSchemaV1<Input = unknown, Output = Input> {
|
|
83
|
+
/** The Standard JSON Schema properties. */
|
|
84
|
+
readonly "~standard": StandardJSONSchemaV1.Props<Input, Output>;
|
|
85
|
+
}
|
|
86
|
+
declare namespace StandardJSONSchemaV1 {
|
|
87
|
+
/** The Standard JSON Schema properties interface. */
|
|
88
|
+
interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
|
|
89
|
+
/** Methods for generating the input/output JSON Schema. */
|
|
90
|
+
readonly jsonSchema: StandardJSONSchemaV1.Converter;
|
|
91
|
+
}
|
|
92
|
+
/** The Standard JSON Schema converter interface. */
|
|
93
|
+
interface Converter {
|
|
94
|
+
/** Converts the input type to JSON Schema. May throw if conversion is not supported. */
|
|
95
|
+
readonly input: (options: StandardJSONSchemaV1.Options) => Record<string, unknown>;
|
|
96
|
+
/** Converts the output type to JSON Schema. May throw if conversion is not supported. */
|
|
97
|
+
readonly output: (options: StandardJSONSchemaV1.Options) => Record<string, unknown>;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The target version of the generated JSON Schema.
|
|
101
|
+
*
|
|
102
|
+
* It is *strongly recommended* that implementers support `"draft-2020-12"` and `"draft-07"`, as they are both in wide use. All other targets can be implemented on a best-effort basis. Libraries should throw if they don't support a specified target.
|
|
103
|
+
*
|
|
104
|
+
* The `"openapi-3.0"` target is intended as a standardized specifier for OpenAPI 3.0 which is a superset of JSON Schema `"draft-04"`.
|
|
105
|
+
*/
|
|
106
|
+
type Target = "draft-2020-12" | "draft-07" | "openapi-3.0" | ({} & string);
|
|
107
|
+
/** The options for the input/output methods. */
|
|
108
|
+
interface Options {
|
|
109
|
+
/** Specifies the target version of the generated JSON Schema. Support for all versions is on a best-effort basis. If a given version is not supported, the library should throw. */
|
|
110
|
+
readonly target: Target;
|
|
111
|
+
/** Explicit support for additional vendor-specific parameters, if needed. */
|
|
112
|
+
readonly libraryOptions?: Record<string, unknown> | undefined;
|
|
55
113
|
}
|
|
56
|
-
/**
|
|
57
|
-
|
|
58
|
-
/** Infers the
|
|
59
|
-
|
|
60
|
-
|
|
114
|
+
/** The Standard types interface. */
|
|
115
|
+
interface Types<Input = unknown, Output = Input> extends StandardTypedV1.Types<Input, Output> {}
|
|
116
|
+
/** Infers the input type of a Standard. */
|
|
117
|
+
type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
|
|
118
|
+
/** Infers the output type of a Standard. */
|
|
119
|
+
type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
|
|
61
120
|
}
|
|
62
121
|
declare namespace symbols_d_exports {
|
|
63
122
|
export { CONTEXT_MAP_KEY, FIELD_HIDDEN, GET_GRAPHQL_ARGUMENT_CONFIG, GET_GRAPHQL_TYPE, IS_RESOLVER, RESOLVER_OPTIONS_KEY, WEAVER_CONFIG };
|
|
@@ -1232,6 +1291,7 @@ declare class LoomObjectType extends GraphQLObjectType {
|
|
|
1232
1291
|
mergeExtensions(extensions: GraphQLObjectTypeConfig<any, any>["extensions"]): void;
|
|
1233
1292
|
protected collectedFieldNames(): void;
|
|
1234
1293
|
private extraFieldMap?;
|
|
1294
|
+
private _fieldsCache?;
|
|
1235
1295
|
getFields(): GraphQLFieldMap<any, any>;
|
|
1236
1296
|
protected mapToFieldConfig(map: Map<string, BaseField>): Record<string, GraphQLFieldConfig<any, any>>;
|
|
1237
1297
|
toFieldConfig(field: BaseField, fieldName: string): GraphQLFieldConfig<any, any>;
|
|
@@ -1312,4 +1372,4 @@ declare class GraphQLSchemaLoom {
|
|
|
1312
1372
|
*/
|
|
1313
1373
|
declare const weave: typeof GraphQLSchemaLoom.weave;
|
|
1314
1374
|
//#endregion
|
|
1315
|
-
export { resolver as $, FieldOptions as $t, getGraphQLArgumentConfig as A, BaseChainFactory as An, MayGetter as At, ObjectChainResolver as B, SubscriptionChainFactory as Bn, tryIn as Bt, DirectiveItem as C, FieldOrOperation as Cn, Middleware as Ct, ListSilk as D, Resolver as Dn, applyMiddlewares as Dt, GQLoomExtensions as E, Query as En, MiddlewareOptions as Et, nullableSilk as F, MutationChainFactory as Fn, BatchLoadFn as Ft, createMutation as G, onlyMemoization as Gt, ResolverMeta as H, symbols_d_exports as Hn, assignContextMap as Ht, parseSilk as I, MutationFactoryWithResolve as In, EasyDataLoader as It, defaultSubscriptionResolve as J, getFieldOptions as Jt, createQuery as K, AUTO_ALIASING as Kt, silk as L, QueryChainFactory as Ln, LoomDataLoader as Lt, isSilk as M, FieldChainFactory as Mn, OmitInUnion as Mt, listSilk as N, FieldFactoryWithResolve as Nn, RequireKeys as Nt, NonNullSilk as O, Subscription as On, filterMiddlewares as Ot, nonNullSilk as P, IChainFactory as Pn, ValueOf as Pt, query$1 as Q, FieldFactoryWithUtils as Qt, ChainResolver as R, QueryFactoryWithResolve as Rn, markErrorLocation as Rt, inputToArgs as S, FieldMeta as Sn, CallableMiddlewareOptions as St, GQLoomExtensionAttribute as T, Operation as Tn, MiddlewareOperation as Tt, ToExecutorProps as U,
|
|
1375
|
+
export { resolver as $, FieldOptions as $t, getGraphQLArgumentConfig as A, BaseChainFactory as An, MayGetter as At, ObjectChainResolver as B, SubscriptionChainFactory as Bn, tryIn as Bt, DirectiveItem as C, FieldOrOperation as Cn, Middleware as Ct, ListSilk as D, Resolver as Dn, applyMiddlewares as Dt, GQLoomExtensions as E, Query as En, MiddlewareOptions as Et, nullableSilk as F, MutationChainFactory as Fn, BatchLoadFn as Ft, createMutation as G, StandardTypedV1 as Gn, onlyMemoization as Gt, ResolverMeta as H, symbols_d_exports as Hn, assignContextMap as Ht, parseSilk as I, MutationFactoryWithResolve as In, EasyDataLoader as It, defaultSubscriptionResolve as J, getFieldOptions as Jt, createQuery as K, AUTO_ALIASING as Kt, silk as L, QueryChainFactory as Ln, LoomDataLoader as Lt, isSilk as M, FieldChainFactory as Mn, OmitInUnion as Mt, listSilk as N, FieldFactoryWithResolve as Nn, RequireKeys as Nt, NonNullSilk as O, Subscription as On, filterMiddlewares as Ot, nonNullSilk as P, IChainFactory as Pn, ValueOf as Pt, query$1 as Q, FieldFactoryWithUtils as Qt, ChainResolver as R, QueryFactoryWithResolve as Rn, markErrorLocation as Rt, inputToArgs as S, FieldMeta as Sn, CallableMiddlewareOptions as St, GQLoomExtensionAttribute as T, Operation as Tn, MiddlewareOperation as Tt, ToExecutorProps as U, StandardJSONSchemaV1 as Un, getMemoizationMap as Ut, ResolverFactory as V, SubscriptionNeedResolve as Vn, OnlyMemoizationPayload as Vt, createField as W, StandardSchemaV1 as Wn, isOnlyMemoryPayload as Wt, loom as X, getSubscriptionOptions as Xt, field as Y, getOperationOptions as Yt, mutation$1 as Z, FieldFactory as Zt, SchemaWeaver as _, SubscriptionFactory as _n, meta as _t, LoomObjectType as a, MutationFactory as an, getStandardValue as at, ensureInputObjectType as b, BaseField as bn, toFieldMap as bt, AliasList as c, OperationType as cn, pascalCase as ct, WeaverContext as d, QueryOptions as dn, ResolvingFieldsOptions as dt, FieldOrOperationType as en, subscription$1 as et, collectName as f, ResolverOptions as fn, getDeepResolvingFields as ft, weaverContext as g, ResolvingOptions as gn, mapValue as gt, provideWeaverContext as h, ResolverPayload as hn, deepMerge as ht, CoreSchemaWeaverConfigOptions as i, InferFieldOutput as in, createInputParser as it, getGraphQLType as j, ChainFactoryOptions as jn, MayPromise as jt, NullableSilk as k, types_loom_d_exports as kn, IsAny as kt, GlobalWeaverContext as l, QueryFactory as ln, screamingSnakeCase as lt, initWeaverContext as m, ResolverOptionsWithParent as mn, parseResolvingFields as mt, weave as n, GraphQLSilk as nn, InferInputI as nt, OPERATION_OBJECT_NAMES as o, MutationFactoryWithChain as on, parseInputValue as ot, collectNames as p, ResolverOptionsWithExtensions as pn, getResolvingFields as pt, createSubscription as q, DERIVED_DEPENDENCIES as qt, CoreSchemaWeaverConfig as r, InferFieldInput as rn, InferInputO as rt, getCacheType as s, MutationOptions as sn, capitalize as st, GraphQLSchemaLoom as t, GraphQLFieldOptions as tn, CallableInputParser as tt, WeaverConfig as u, QueryFactoryWithChain as un, ResolvingFields as ut, isSchemaVendorWeaver as v, SubscriptionFactoryWithChain as vn, notNullish as vt, DirectiveRecord as w, Mutation as wn, MiddlewareConfig as wt, ensureInputType as x, Field as xn, toObjMap as xt, ensureInterfaceType as y, SubscriptionOptions as yn, toArguments as yt, Executor as z, ResolvableSubscription as zn, markLocation as zt };
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_parse_resolving_fields = require('./parse-resolving-fields-
|
|
1
|
+
const require_parse_resolving_fields = require('./parse-resolving-fields-CJw_nGJ2.cjs');
|
|
2
2
|
let graphql = require("graphql");
|
|
3
3
|
|
|
4
4
|
//#region src/schema/weaver-context.ts
|
|
@@ -97,16 +97,17 @@ var WeaverContext = class WeaverContext {
|
|
|
97
97
|
return this.reduceAliases(aliases) ?? fallback;
|
|
98
98
|
}
|
|
99
99
|
reduceAliases(aliases) {
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
for (const alias of stringAliases) if (best === void 0 || WeaverContext.higherPriorityThan(alias, best) < 0) best = alias;
|
|
104
|
-
if (typeof best === "string") return best;
|
|
105
|
-
for (const [fieldName, parent] of tupleAliases) {
|
|
106
|
-
const alias = parent.name + fieldName;
|
|
107
|
-
if (best === void 0 || WeaverContext.higherPriorityThan(alias, best) < 0) best = alias;
|
|
100
|
+
let bestString;
|
|
101
|
+
for (const alias of aliases) if (typeof alias === "string") {
|
|
102
|
+
if (bestString === void 0 || WeaverContext.higherPriorityThan(alias, bestString) < 0) bestString = alias;
|
|
108
103
|
}
|
|
109
|
-
return
|
|
104
|
+
if (bestString !== void 0) return bestString;
|
|
105
|
+
let bestTuple;
|
|
106
|
+
for (const alias of aliases) if (Array.isArray(alias)) {
|
|
107
|
+
const current = alias[1].name + alias[0];
|
|
108
|
+
if (bestTuple === void 0 || WeaverContext.higherPriorityThan(current, bestTuple) < 0) bestTuple = current;
|
|
109
|
+
}
|
|
110
|
+
return bestTuple;
|
|
110
111
|
}
|
|
111
112
|
createFallbackAlias(namedType) {
|
|
112
113
|
if ((0, graphql.isObjectType)(namedType) || (0, graphql.isInputObjectType)(namedType)) {
|
|
@@ -302,9 +303,14 @@ function getGraphQLType(silk$1) {
|
|
|
302
303
|
if (require_parse_resolving_fields.GET_GRAPHQL_TYPE in silk$1 && silk$1[require_parse_resolving_fields.GET_GRAPHQL_TYPE] != null) return typeof silk$1[require_parse_resolving_fields.GET_GRAPHQL_TYPE] === "function" ? silk$1[require_parse_resolving_fields.GET_GRAPHQL_TYPE]() : silk$1[require_parse_resolving_fields.GET_GRAPHQL_TYPE];
|
|
303
304
|
const vendorWeavers = weaverContext.vendorWeavers;
|
|
304
305
|
if (vendorWeavers == null) throw new Error("Schema Weaver is not initialized");
|
|
305
|
-
const
|
|
306
|
-
|
|
307
|
-
return weaver.getGraphQLType(silk$1);
|
|
306
|
+
const vendor = silk$1["~standard"]?.vendor;
|
|
307
|
+
const weaver = vendor ? vendorWeavers.get(vendor) : void 0;
|
|
308
|
+
if (weaver != null) return weaver.getGraphQLType(silk$1);
|
|
309
|
+
if (silk$1["~standard"] && "jsonSchema" in silk$1["~standard"]) {
|
|
310
|
+
const jsonWeaver = vendorWeavers.get("json");
|
|
311
|
+
if (jsonWeaver != null) return jsonWeaver.getGraphQLType(silk$1);
|
|
312
|
+
}
|
|
313
|
+
throw new Error(`Schema Weaver for ${vendor} is not found`);
|
|
308
314
|
}
|
|
309
315
|
/**
|
|
310
316
|
* Get GraphQL Argument Config from Silk.
|
|
@@ -315,10 +321,13 @@ function getGraphQLArgumentConfig(silk$1) {
|
|
|
315
321
|
if (require_parse_resolving_fields.GET_GRAPHQL_ARGUMENT_CONFIG in silk$1 && silk$1[require_parse_resolving_fields.GET_GRAPHQL_ARGUMENT_CONFIG] != null) return typeof silk$1[require_parse_resolving_fields.GET_GRAPHQL_ARGUMENT_CONFIG] === "function" ? silk$1[require_parse_resolving_fields.GET_GRAPHQL_ARGUMENT_CONFIG]() : silk$1[require_parse_resolving_fields.GET_GRAPHQL_ARGUMENT_CONFIG];
|
|
316
322
|
const vendorWeavers = weaverContext.vendorWeavers;
|
|
317
323
|
if (vendorWeavers == null) return void 0;
|
|
318
|
-
const
|
|
319
|
-
|
|
320
|
-
if (weaver
|
|
321
|
-
|
|
324
|
+
const vendor = silk$1["~standard"]?.vendor;
|
|
325
|
+
const weaver = vendor ? vendorWeavers.get(vendor) : void 0;
|
|
326
|
+
if (weaver?.getGraphQLArgumentConfig != null) return weaver.getGraphQLArgumentConfig(silk$1);
|
|
327
|
+
if (silk$1["~standard"] && "jsonSchema" in silk$1["~standard"]) {
|
|
328
|
+
const jsonWeaver = vendorWeavers.get("json");
|
|
329
|
+
if (jsonWeaver?.getGraphQLArgumentConfig != null) return jsonWeaver.getGraphQLArgumentConfig(silk$1);
|
|
330
|
+
}
|
|
322
331
|
}
|
|
323
332
|
/**
|
|
324
333
|
* Validate and transform input to output
|
|
@@ -1453,12 +1462,14 @@ var LoomObjectType = class extends graphql.GraphQLObjectType {
|
|
|
1453
1462
|
}
|
|
1454
1463
|
hideField(name) {
|
|
1455
1464
|
this.hiddenFields.add(name);
|
|
1465
|
+
delete this._fieldsCache;
|
|
1456
1466
|
}
|
|
1457
1467
|
addField(name, field$1, resolver$1) {
|
|
1458
1468
|
const existing = this.extraFields.get(name);
|
|
1459
1469
|
if (existing && existing !== field$1) throw new Error(`Field ${name} already exists in ${this.name}`);
|
|
1460
1470
|
this.extraFields.set(name, field$1);
|
|
1461
1471
|
if (resolver$1) this.resolvers.set(name, resolver$1);
|
|
1472
|
+
delete this._fieldsCache;
|
|
1462
1473
|
}
|
|
1463
1474
|
mergeExtensions(extensions) {
|
|
1464
1475
|
this.extensions = deepMerge(this.extensions, extensions);
|
|
@@ -1468,7 +1479,9 @@ var LoomObjectType = class extends graphql.GraphQLObjectType {
|
|
|
1468
1479
|
Object.entries(fieldsBySuper).forEach(([fieldName, field$1]) => field$1.type = this.getCacheType(field$1.type, fieldName));
|
|
1469
1480
|
}
|
|
1470
1481
|
extraFieldMap;
|
|
1482
|
+
_fieldsCache;
|
|
1471
1483
|
getFields() {
|
|
1484
|
+
if (this._fieldsCache) return this._fieldsCache;
|
|
1472
1485
|
const fieldsBySuper = super.getFields();
|
|
1473
1486
|
this.collectedFieldNames();
|
|
1474
1487
|
const extraFields = provideWeaverContext(() => toFieldMap(this.mapToFieldConfig(this.extraFields)), this.weaverContext);
|
|
@@ -1478,6 +1491,7 @@ var LoomObjectType = class extends graphql.GraphQLObjectType {
|
|
|
1478
1491
|
...this.extraFieldMap
|
|
1479
1492
|
};
|
|
1480
1493
|
for (const fieldName of this.hiddenFields) delete answer[fieldName];
|
|
1494
|
+
this._fieldsCache = answer;
|
|
1481
1495
|
return answer;
|
|
1482
1496
|
}
|
|
1483
1497
|
mapToFieldConfig(map) {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as resolver, $t as FieldOptions, A as getGraphQLArgumentConfig, An as BaseChainFactory, At as MayGetter, B as ObjectChainResolver, Bn as SubscriptionChainFactory, Bt as tryIn, C as DirectiveItem, Cn as FieldOrOperation, Ct as Middleware, D as ListSilk, Dn as Resolver, Dt as applyMiddlewares, E as GQLoomExtensions, En as Query, Et as MiddlewareOptions, F as nullableSilk, Fn as MutationChainFactory, Ft as BatchLoadFn, G as createMutation, Gt as onlyMemoization, H as ResolverMeta, Hn as symbols_d_exports, Ht as assignContextMap, I as parseSilk, In as MutationFactoryWithResolve, It as EasyDataLoader, J as defaultSubscriptionResolve, Jt as getFieldOptions, K as createQuery, Kt as AUTO_ALIASING, L as silk, Ln as QueryChainFactory, Lt as LoomDataLoader, M as isSilk, Mn as FieldChainFactory, Mt as OmitInUnion, N as listSilk, Nn as FieldFactoryWithResolve, Nt as RequireKeys, O as NonNullSilk, On as Subscription, Ot as filterMiddlewares, P as nonNullSilk, Pn as IChainFactory, Pt as ValueOf, Q as query, Qt as FieldFactoryWithUtils, R as ChainResolver, Rn as QueryFactoryWithResolve, Rt as markErrorLocation, S as inputToArgs, Sn as FieldMeta, St as CallableMiddlewareOptions, T as GQLoomExtensionAttribute, Tn as Operation, Tt as MiddlewareOperation, U as ToExecutorProps, Un as
|
|
2
|
-
export { AUTO_ALIASING, AliasList, BaseChainFactory, BaseField, BatchLoadFn, CallableInputParser, CallableMiddlewareOptions, ChainFactoryOptions, ChainResolver, CoreSchemaWeaverConfig, CoreSchemaWeaverConfigOptions, DERIVED_DEPENDENCIES, DirectiveItem, DirectiveRecord, EasyDataLoader, Executor, Field, FieldChainFactory, FieldFactory, FieldFactoryWithResolve, FieldFactoryWithUtils, FieldMeta, FieldOptions, FieldOrOperation, FieldOrOperationType, GQLoomExtensionAttribute, GQLoomExtensions, GlobalWeaverContext, GraphQLFieldOptions, GraphQLSchemaLoom, GraphQLSilk, IChainFactory, InferFieldInput, InferFieldOutput, InferInputI, InferInputO, IsAny, ListSilk, types_loom_d_exports as Loom, LoomDataLoader, LoomObjectType, MayGetter, MayPromise, Middleware, MiddlewareConfig, MiddlewareOperation, MiddlewareOptions, Mutation, MutationChainFactory, MutationFactory, MutationFactoryWithChain, MutationFactoryWithResolve, MutationOptions, NonNullSilk, NullableSilk, OPERATION_OBJECT_NAMES, ObjectChainResolver, OmitInUnion, OnlyMemoizationPayload, Operation, OperationType, Query, QueryChainFactory, QueryFactory, QueryFactoryWithChain, QueryFactoryWithResolve, QueryOptions, RequireKeys, ResolvableSubscription, Resolver, ResolverFactory, ResolverMeta, ResolverOptions, ResolverOptionsWithExtensions, ResolverOptionsWithParent, ResolverPayload, ResolvingFields, ResolvingFieldsOptions, ResolvingOptions, symbols_d_exports as SYMBOLS, SchemaWeaver, 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 };
|
|
1
|
+
import { $ as resolver, $t as FieldOptions, A as getGraphQLArgumentConfig, An as BaseChainFactory, At as MayGetter, B as ObjectChainResolver, Bn as SubscriptionChainFactory, Bt as tryIn, C as DirectiveItem, Cn as FieldOrOperation, Ct as Middleware, D as ListSilk, Dn as Resolver, Dt as applyMiddlewares, E as GQLoomExtensions, En as Query, Et as MiddlewareOptions, F as nullableSilk, Fn as MutationChainFactory, Ft as BatchLoadFn, G as createMutation, Gn as StandardTypedV1, Gt as onlyMemoization, H as ResolverMeta, Hn as symbols_d_exports, Ht as assignContextMap, I as parseSilk, In as MutationFactoryWithResolve, It as EasyDataLoader, J as defaultSubscriptionResolve, Jt as getFieldOptions, K as createQuery, Kt as AUTO_ALIASING, L as silk, Ln as QueryChainFactory, Lt as LoomDataLoader, M as isSilk, Mn as FieldChainFactory, Mt as OmitInUnion, N as listSilk, Nn as FieldFactoryWithResolve, Nt as RequireKeys, O as NonNullSilk, On as Subscription, Ot as filterMiddlewares, P as nonNullSilk, Pn as IChainFactory, Pt as ValueOf, Q as query, Qt as FieldFactoryWithUtils, R as ChainResolver, Rn as QueryFactoryWithResolve, Rt as markErrorLocation, S as inputToArgs, Sn as FieldMeta, St as CallableMiddlewareOptions, T as GQLoomExtensionAttribute, Tn as Operation, Tt as MiddlewareOperation, U as ToExecutorProps, Un as StandardJSONSchemaV1, Ut as getMemoizationMap, V as ResolverFactory, Vn as SubscriptionNeedResolve, Vt as OnlyMemoizationPayload, W as createField, Wn as StandardSchemaV1, Wt as isOnlyMemoryPayload, X as loom, Xt as getSubscriptionOptions, Y as field, Yt as getOperationOptions, Z as mutation, Zt as FieldFactory, _ as SchemaWeaver, _n as SubscriptionFactory, _t as meta, a as LoomObjectType, an as MutationFactory, at as getStandardValue, b as ensureInputObjectType, bn as BaseField, bt as toFieldMap, c as AliasList, cn as OperationType, ct as pascalCase, d as WeaverContext, dn as QueryOptions, dt as ResolvingFieldsOptions, en as FieldOrOperationType, et as subscription, f as collectName, fn as ResolverOptions, ft as getDeepResolvingFields, g as weaverContext, gn as ResolvingOptions, gt as mapValue, h as provideWeaverContext, hn as ResolverPayload, ht as deepMerge, i as CoreSchemaWeaverConfigOptions, in as InferFieldOutput, it as createInputParser, j as getGraphQLType, jn as ChainFactoryOptions, jt as MayPromise, k as NullableSilk, kn as types_loom_d_exports, kt as IsAny, l as GlobalWeaverContext, ln as QueryFactory, lt as screamingSnakeCase, m as initWeaverContext, mn as ResolverOptionsWithParent, mt as parseResolvingFields, n as weave, nn as GraphQLSilk, nt as InferInputI, o as OPERATION_OBJECT_NAMES, on as MutationFactoryWithChain, ot as parseInputValue, p as collectNames, pn as ResolverOptionsWithExtensions, pt as getResolvingFields, q as createSubscription, qt as DERIVED_DEPENDENCIES, r as CoreSchemaWeaverConfig, rn as InferFieldInput, rt as InferInputO, s as getCacheType, sn as MutationOptions, st as capitalize, t as GraphQLSchemaLoom, tn as GraphQLFieldOptions, tt as CallableInputParser, u as WeaverConfig, un as QueryFactoryWithChain, ut as ResolvingFields, v as isSchemaVendorWeaver, vn as SubscriptionFactoryWithChain, vt as notNullish, w as DirectiveRecord, wn as Mutation, wt as MiddlewareConfig, x as ensureInputType, xn as Field, xt as toObjMap, y as ensureInterfaceType, yn as SubscriptionOptions, yt as toArguments, z as Executor, zn as ResolvableSubscription, zt as markLocation } from "./index-fddenU-d.cjs";
|
|
2
|
+
export { AUTO_ALIASING, AliasList, BaseChainFactory, BaseField, BatchLoadFn, CallableInputParser, CallableMiddlewareOptions, ChainFactoryOptions, ChainResolver, CoreSchemaWeaverConfig, CoreSchemaWeaverConfigOptions, DERIVED_DEPENDENCIES, DirectiveItem, DirectiveRecord, EasyDataLoader, Executor, Field, FieldChainFactory, FieldFactory, FieldFactoryWithResolve, FieldFactoryWithUtils, FieldMeta, FieldOptions, FieldOrOperation, FieldOrOperationType, GQLoomExtensionAttribute, GQLoomExtensions, GlobalWeaverContext, GraphQLFieldOptions, GraphQLSchemaLoom, GraphQLSilk, IChainFactory, InferFieldInput, InferFieldOutput, InferInputI, InferInputO, IsAny, ListSilk, types_loom_d_exports as Loom, LoomDataLoader, LoomObjectType, MayGetter, MayPromise, Middleware, MiddlewareConfig, MiddlewareOperation, MiddlewareOptions, Mutation, MutationChainFactory, MutationFactory, MutationFactoryWithChain, MutationFactoryWithResolve, MutationOptions, NonNullSilk, NullableSilk, OPERATION_OBJECT_NAMES, ObjectChainResolver, OmitInUnion, OnlyMemoizationPayload, Operation, OperationType, Query, QueryChainFactory, QueryFactory, QueryFactoryWithChain, QueryFactoryWithResolve, QueryOptions, RequireKeys, ResolvableSubscription, Resolver, ResolverFactory, ResolverMeta, ResolverOptions, ResolverOptionsWithExtensions, ResolverOptionsWithParent, ResolverPayload, ResolvingFields, ResolvingFieldsOptions, ResolvingOptions, symbols_d_exports as SYMBOLS, SchemaWeaver, StandardJSONSchemaV1, StandardSchemaV1, StandardTypedV1, Subscription, SubscriptionChainFactory, SubscriptionFactory, SubscriptionFactoryWithChain, SubscriptionNeedResolve, SubscriptionOptions, ToExecutorProps, ValueOf, WeaverConfig, WeaverContext, applyMiddlewares, assignContextMap, capitalize, collectName, collectNames, createField, createInputParser, createMutation, createQuery, createSubscription, deepMerge, defaultSubscriptionResolve, ensureInputObjectType, ensureInputType, ensureInterfaceType, field, filterMiddlewares, getCacheType, getDeepResolvingFields, getFieldOptions, getGraphQLArgumentConfig, getGraphQLType, getMemoizationMap, getOperationOptions, getResolvingFields, getStandardValue, getSubscriptionOptions, initWeaverContext, inputToArgs, isOnlyMemoryPayload, isSchemaVendorWeaver, isSilk, listSilk, loom, mapValue, markErrorLocation, markLocation, meta, mutation, nonNullSilk, notNullish, nullableSilk, onlyMemoization, parseInputValue, parseResolvingFields, parseSilk, pascalCase, provideWeaverContext, query, resolver, screamingSnakeCase, silk, subscription, toArguments, toFieldMap, toObjMap, tryIn, weave, weaverContext };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as resolver, $t as FieldOptions, A as getGraphQLArgumentConfig, An as BaseChainFactory, At as MayGetter, B as ObjectChainResolver, Bn as SubscriptionChainFactory, Bt as tryIn, C as DirectiveItem, Cn as FieldOrOperation, Ct as Middleware, D as ListSilk, Dn as Resolver, Dt as applyMiddlewares, E as GQLoomExtensions, En as Query, Et as MiddlewareOptions, F as nullableSilk, Fn as MutationChainFactory, Ft as BatchLoadFn, G as createMutation, Gt as onlyMemoization, H as ResolverMeta, Hn as symbols_d_exports, Ht as assignContextMap, I as parseSilk, In as MutationFactoryWithResolve, It as EasyDataLoader, J as defaultSubscriptionResolve, Jt as getFieldOptions, K as createQuery, Kt as AUTO_ALIASING, L as silk, Ln as QueryChainFactory, Lt as LoomDataLoader, M as isSilk, Mn as FieldChainFactory, Mt as OmitInUnion, N as listSilk, Nn as FieldFactoryWithResolve, Nt as RequireKeys, O as NonNullSilk, On as Subscription, Ot as filterMiddlewares, P as nonNullSilk, Pn as IChainFactory, Pt as ValueOf, Q as query, Qt as FieldFactoryWithUtils, R as ChainResolver, Rn as QueryFactoryWithResolve, Rt as markErrorLocation, S as inputToArgs, Sn as FieldMeta, St as CallableMiddlewareOptions, T as GQLoomExtensionAttribute, Tn as Operation, Tt as MiddlewareOperation, U as ToExecutorProps, Un as
|
|
2
|
-
export { AUTO_ALIASING, AliasList, BaseChainFactory, BaseField, BatchLoadFn, CallableInputParser, CallableMiddlewareOptions, ChainFactoryOptions, ChainResolver, CoreSchemaWeaverConfig, CoreSchemaWeaverConfigOptions, DERIVED_DEPENDENCIES, DirectiveItem, DirectiveRecord, EasyDataLoader, Executor, Field, FieldChainFactory, FieldFactory, FieldFactoryWithResolve, FieldFactoryWithUtils, FieldMeta, FieldOptions, FieldOrOperation, FieldOrOperationType, GQLoomExtensionAttribute, GQLoomExtensions, GlobalWeaverContext, GraphQLFieldOptions, GraphQLSchemaLoom, GraphQLSilk, IChainFactory, InferFieldInput, InferFieldOutput, InferInputI, InferInputO, IsAny, ListSilk, types_loom_d_exports as Loom, LoomDataLoader, LoomObjectType, MayGetter, MayPromise, Middleware, MiddlewareConfig, MiddlewareOperation, MiddlewareOptions, Mutation, MutationChainFactory, MutationFactory, MutationFactoryWithChain, MutationFactoryWithResolve, MutationOptions, NonNullSilk, NullableSilk, OPERATION_OBJECT_NAMES, ObjectChainResolver, OmitInUnion, OnlyMemoizationPayload, Operation, OperationType, Query, QueryChainFactory, QueryFactory, QueryFactoryWithChain, QueryFactoryWithResolve, QueryOptions, RequireKeys, ResolvableSubscription, Resolver, ResolverFactory, ResolverMeta, ResolverOptions, ResolverOptionsWithExtensions, ResolverOptionsWithParent, ResolverPayload, ResolvingFields, ResolvingFieldsOptions, ResolvingOptions, symbols_d_exports as SYMBOLS, SchemaWeaver, 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 };
|
|
1
|
+
import { $ as resolver, $t as FieldOptions, A as getGraphQLArgumentConfig, An as BaseChainFactory, At as MayGetter, B as ObjectChainResolver, Bn as SubscriptionChainFactory, Bt as tryIn, C as DirectiveItem, Cn as FieldOrOperation, Ct as Middleware, D as ListSilk, Dn as Resolver, Dt as applyMiddlewares, E as GQLoomExtensions, En as Query, Et as MiddlewareOptions, F as nullableSilk, Fn as MutationChainFactory, Ft as BatchLoadFn, G as createMutation, Gn as StandardTypedV1, Gt as onlyMemoization, H as ResolverMeta, Hn as symbols_d_exports, Ht as assignContextMap, I as parseSilk, In as MutationFactoryWithResolve, It as EasyDataLoader, J as defaultSubscriptionResolve, Jt as getFieldOptions, K as createQuery, Kt as AUTO_ALIASING, L as silk, Ln as QueryChainFactory, Lt as LoomDataLoader, M as isSilk, Mn as FieldChainFactory, Mt as OmitInUnion, N as listSilk, Nn as FieldFactoryWithResolve, Nt as RequireKeys, O as NonNullSilk, On as Subscription, Ot as filterMiddlewares, P as nonNullSilk, Pn as IChainFactory, Pt as ValueOf, Q as query, Qt as FieldFactoryWithUtils, R as ChainResolver, Rn as QueryFactoryWithResolve, Rt as markErrorLocation, S as inputToArgs, Sn as FieldMeta, St as CallableMiddlewareOptions, T as GQLoomExtensionAttribute, Tn as Operation, Tt as MiddlewareOperation, U as ToExecutorProps, Un as StandardJSONSchemaV1, Ut as getMemoizationMap, V as ResolverFactory, Vn as SubscriptionNeedResolve, Vt as OnlyMemoizationPayload, W as createField, Wn as StandardSchemaV1, Wt as isOnlyMemoryPayload, X as loom, Xt as getSubscriptionOptions, Y as field, Yt as getOperationOptions, Z as mutation, Zt as FieldFactory, _ as SchemaWeaver, _n as SubscriptionFactory, _t as meta, a as LoomObjectType, an as MutationFactory, at as getStandardValue, b as ensureInputObjectType, bn as BaseField, bt as toFieldMap, c as AliasList, cn as OperationType, ct as pascalCase, d as WeaverContext, dn as QueryOptions, dt as ResolvingFieldsOptions, en as FieldOrOperationType, et as subscription, f as collectName, fn as ResolverOptions, ft as getDeepResolvingFields, g as weaverContext, gn as ResolvingOptions, gt as mapValue, h as provideWeaverContext, hn as ResolverPayload, ht as deepMerge, i as CoreSchemaWeaverConfigOptions, in as InferFieldOutput, it as createInputParser, j as getGraphQLType, jn as ChainFactoryOptions, jt as MayPromise, k as NullableSilk, kn as types_loom_d_exports, kt as IsAny, l as GlobalWeaverContext, ln as QueryFactory, lt as screamingSnakeCase, m as initWeaverContext, mn as ResolverOptionsWithParent, mt as parseResolvingFields, n as weave, nn as GraphQLSilk, nt as InferInputI, o as OPERATION_OBJECT_NAMES, on as MutationFactoryWithChain, ot as parseInputValue, p as collectNames, pn as ResolverOptionsWithExtensions, pt as getResolvingFields, q as createSubscription, qt as DERIVED_DEPENDENCIES, r as CoreSchemaWeaverConfig, rn as InferFieldInput, rt as InferInputO, s as getCacheType, sn as MutationOptions, st as capitalize, t as GraphQLSchemaLoom, tn as GraphQLFieldOptions, tt as CallableInputParser, u as WeaverConfig, un as QueryFactoryWithChain, ut as ResolvingFields, v as isSchemaVendorWeaver, vn as SubscriptionFactoryWithChain, vt as notNullish, w as DirectiveRecord, wn as Mutation, wt as MiddlewareConfig, x as ensureInputType, xn as Field, xt as toObjMap, y as ensureInterfaceType, yn as SubscriptionOptions, yt as toArguments, z as Executor, zn as ResolvableSubscription, zt as markLocation } from "./index-DkwSGzwy.js";
|
|
2
|
+
export { AUTO_ALIASING, AliasList, BaseChainFactory, BaseField, BatchLoadFn, CallableInputParser, CallableMiddlewareOptions, ChainFactoryOptions, ChainResolver, CoreSchemaWeaverConfig, CoreSchemaWeaverConfigOptions, DERIVED_DEPENDENCIES, DirectiveItem, DirectiveRecord, EasyDataLoader, Executor, Field, FieldChainFactory, FieldFactory, FieldFactoryWithResolve, FieldFactoryWithUtils, FieldMeta, FieldOptions, FieldOrOperation, FieldOrOperationType, GQLoomExtensionAttribute, GQLoomExtensions, GlobalWeaverContext, GraphQLFieldOptions, GraphQLSchemaLoom, GraphQLSilk, IChainFactory, InferFieldInput, InferFieldOutput, InferInputI, InferInputO, IsAny, ListSilk, types_loom_d_exports as Loom, LoomDataLoader, LoomObjectType, MayGetter, MayPromise, Middleware, MiddlewareConfig, MiddlewareOperation, MiddlewareOptions, Mutation, MutationChainFactory, MutationFactory, MutationFactoryWithChain, MutationFactoryWithResolve, MutationOptions, NonNullSilk, NullableSilk, OPERATION_OBJECT_NAMES, ObjectChainResolver, OmitInUnion, OnlyMemoizationPayload, Operation, OperationType, Query, QueryChainFactory, QueryFactory, QueryFactoryWithChain, QueryFactoryWithResolve, QueryOptions, RequireKeys, ResolvableSubscription, Resolver, ResolverFactory, ResolverMeta, ResolverOptions, ResolverOptionsWithExtensions, ResolverOptionsWithParent, ResolverPayload, ResolvingFields, ResolvingFieldsOptions, ResolvingOptions, symbols_d_exports as SYMBOLS, SchemaWeaver, StandardJSONSchemaV1, StandardSchemaV1, StandardTypedV1, Subscription, SubscriptionChainFactory, SubscriptionFactory, SubscriptionFactoryWithChain, SubscriptionNeedResolve, SubscriptionOptions, ToExecutorProps, ValueOf, WeaverConfig, WeaverContext, applyMiddlewares, assignContextMap, capitalize, collectName, collectNames, createField, createInputParser, createMutation, createQuery, createSubscription, deepMerge, defaultSubscriptionResolve, ensureInputObjectType, ensureInputType, ensureInterfaceType, field, filterMiddlewares, getCacheType, getDeepResolvingFields, getFieldOptions, getGraphQLArgumentConfig, getGraphQLType, getMemoizationMap, getOperationOptions, getResolvingFields, getStandardValue, getSubscriptionOptions, initWeaverContext, inputToArgs, isOnlyMemoryPayload, isSchemaVendorWeaver, isSilk, listSilk, loom, mapValue, markErrorLocation, markLocation, meta, mutation, nonNullSilk, notNullish, nullableSilk, onlyMemoization, parseInputValue, parseResolvingFields, parseSilk, pascalCase, provideWeaverContext, query, resolver, screamingSnakeCase, silk, subscription, toArguments, toFieldMap, toObjMap, tryIn, weave, weaverContext };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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-
|
|
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-B9xSmxNH.js";
|
|
2
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
|
|
@@ -97,16 +97,17 @@ var WeaverContext = class WeaverContext {
|
|
|
97
97
|
return this.reduceAliases(aliases) ?? fallback;
|
|
98
98
|
}
|
|
99
99
|
reduceAliases(aliases) {
|
|
100
|
-
|
|
101
|
-
const
|
|
102
|
-
|
|
103
|
-
for (const alias of stringAliases) if (best === void 0 || WeaverContext.higherPriorityThan(alias, best) < 0) best = alias;
|
|
104
|
-
if (typeof best === "string") return best;
|
|
105
|
-
for (const [fieldName, parent] of tupleAliases) {
|
|
106
|
-
const alias = parent.name + fieldName;
|
|
107
|
-
if (best === void 0 || WeaverContext.higherPriorityThan(alias, best) < 0) best = alias;
|
|
100
|
+
let bestString;
|
|
101
|
+
for (const alias of aliases) if (typeof alias === "string") {
|
|
102
|
+
if (bestString === void 0 || WeaverContext.higherPriorityThan(alias, bestString) < 0) bestString = alias;
|
|
108
103
|
}
|
|
109
|
-
return
|
|
104
|
+
if (bestString !== void 0) return bestString;
|
|
105
|
+
let bestTuple;
|
|
106
|
+
for (const alias of aliases) if (Array.isArray(alias)) {
|
|
107
|
+
const current = alias[1].name + alias[0];
|
|
108
|
+
if (bestTuple === void 0 || WeaverContext.higherPriorityThan(current, bestTuple) < 0) bestTuple = current;
|
|
109
|
+
}
|
|
110
|
+
return bestTuple;
|
|
110
111
|
}
|
|
111
112
|
createFallbackAlias(namedType) {
|
|
112
113
|
if (isObjectType(namedType) || isInputObjectType(namedType)) {
|
|
@@ -302,9 +303,14 @@ function getGraphQLType(silk$1) {
|
|
|
302
303
|
if (GET_GRAPHQL_TYPE in silk$1 && silk$1[GET_GRAPHQL_TYPE] != null) return typeof silk$1[GET_GRAPHQL_TYPE] === "function" ? silk$1[GET_GRAPHQL_TYPE]() : silk$1[GET_GRAPHQL_TYPE];
|
|
303
304
|
const vendorWeavers = weaverContext.vendorWeavers;
|
|
304
305
|
if (vendorWeavers == null) throw new Error("Schema Weaver is not initialized");
|
|
305
|
-
const
|
|
306
|
-
|
|
307
|
-
return weaver.getGraphQLType(silk$1);
|
|
306
|
+
const vendor = silk$1["~standard"]?.vendor;
|
|
307
|
+
const weaver = vendor ? vendorWeavers.get(vendor) : void 0;
|
|
308
|
+
if (weaver != null) return weaver.getGraphQLType(silk$1);
|
|
309
|
+
if (silk$1["~standard"] && "jsonSchema" in silk$1["~standard"]) {
|
|
310
|
+
const jsonWeaver = vendorWeavers.get("json");
|
|
311
|
+
if (jsonWeaver != null) return jsonWeaver.getGraphQLType(silk$1);
|
|
312
|
+
}
|
|
313
|
+
throw new Error(`Schema Weaver for ${vendor} is not found`);
|
|
308
314
|
}
|
|
309
315
|
/**
|
|
310
316
|
* Get GraphQL Argument Config from Silk.
|
|
@@ -315,10 +321,13 @@ function getGraphQLArgumentConfig(silk$1) {
|
|
|
315
321
|
if (GET_GRAPHQL_ARGUMENT_CONFIG in silk$1 && silk$1[GET_GRAPHQL_ARGUMENT_CONFIG] != null) return typeof silk$1[GET_GRAPHQL_ARGUMENT_CONFIG] === "function" ? silk$1[GET_GRAPHQL_ARGUMENT_CONFIG]() : silk$1[GET_GRAPHQL_ARGUMENT_CONFIG];
|
|
316
322
|
const vendorWeavers = weaverContext.vendorWeavers;
|
|
317
323
|
if (vendorWeavers == null) return void 0;
|
|
318
|
-
const
|
|
319
|
-
|
|
320
|
-
if (weaver
|
|
321
|
-
|
|
324
|
+
const vendor = silk$1["~standard"]?.vendor;
|
|
325
|
+
const weaver = vendor ? vendorWeavers.get(vendor) : void 0;
|
|
326
|
+
if (weaver?.getGraphQLArgumentConfig != null) return weaver.getGraphQLArgumentConfig(silk$1);
|
|
327
|
+
if (silk$1["~standard"] && "jsonSchema" in silk$1["~standard"]) {
|
|
328
|
+
const jsonWeaver = vendorWeavers.get("json");
|
|
329
|
+
if (jsonWeaver?.getGraphQLArgumentConfig != null) return jsonWeaver.getGraphQLArgumentConfig(silk$1);
|
|
330
|
+
}
|
|
322
331
|
}
|
|
323
332
|
/**
|
|
324
333
|
* Validate and transform input to output
|
|
@@ -1453,12 +1462,14 @@ var LoomObjectType = class extends GraphQLObjectType {
|
|
|
1453
1462
|
}
|
|
1454
1463
|
hideField(name) {
|
|
1455
1464
|
this.hiddenFields.add(name);
|
|
1465
|
+
delete this._fieldsCache;
|
|
1456
1466
|
}
|
|
1457
1467
|
addField(name, field$1, resolver$1) {
|
|
1458
1468
|
const existing = this.extraFields.get(name);
|
|
1459
1469
|
if (existing && existing !== field$1) throw new Error(`Field ${name} already exists in ${this.name}`);
|
|
1460
1470
|
this.extraFields.set(name, field$1);
|
|
1461
1471
|
if (resolver$1) this.resolvers.set(name, resolver$1);
|
|
1472
|
+
delete this._fieldsCache;
|
|
1462
1473
|
}
|
|
1463
1474
|
mergeExtensions(extensions) {
|
|
1464
1475
|
this.extensions = deepMerge(this.extensions, extensions);
|
|
@@ -1468,7 +1479,9 @@ var LoomObjectType = class extends GraphQLObjectType {
|
|
|
1468
1479
|
Object.entries(fieldsBySuper).forEach(([fieldName, field$1]) => field$1.type = this.getCacheType(field$1.type, fieldName));
|
|
1469
1480
|
}
|
|
1470
1481
|
extraFieldMap;
|
|
1482
|
+
_fieldsCache;
|
|
1471
1483
|
getFields() {
|
|
1484
|
+
if (this._fieldsCache) return this._fieldsCache;
|
|
1472
1485
|
const fieldsBySuper = super.getFields();
|
|
1473
1486
|
this.collectedFieldNames();
|
|
1474
1487
|
const extraFields = provideWeaverContext(() => toFieldMap(this.mapToFieldConfig(this.extraFields)), this.weaverContext);
|
|
@@ -1478,6 +1491,7 @@ var LoomObjectType = class extends GraphQLObjectType {
|
|
|
1478
1491
|
...this.extraFieldMap
|
|
1479
1492
|
};
|
|
1480
1493
|
for (const fieldName of this.hiddenFields) delete answer[fieldName];
|
|
1494
|
+
this._fieldsCache = answer;
|
|
1481
1495
|
return answer;
|
|
1482
1496
|
}
|
|
1483
1497
|
mapToFieldConfig(map) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as
|
|
1
|
+
import { t as __exportAll } from "./chunk-CXurZ27M.js";
|
|
2
2
|
import { Kind, isInterfaceType, isListType, isNonNullType, isObjectType } from "graphql";
|
|
3
3
|
|
|
4
4
|
//#region src/utils/constants.ts
|
|
@@ -7,7 +7,7 @@ const AUTO_ALIASING = "__gqloom_auto_aliasing";
|
|
|
7
7
|
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/utils/symbols.ts
|
|
10
|
-
var symbols_exports = /* @__PURE__ */
|
|
10
|
+
var symbols_exports = /* @__PURE__ */ __exportAll({
|
|
11
11
|
CONTEXT_MAP_KEY: () => CONTEXT_MAP_KEY,
|
|
12
12
|
FIELD_HIDDEN: () => FIELD_HIDDEN,
|
|
13
13
|
GET_GRAPHQL_ARGUMENT_CONFIG: () => GET_GRAPHQL_ARGUMENT_CONFIG,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region rolldown:runtime
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var
|
|
3
|
+
var __exportAll = (all, symbols) => {
|
|
4
4
|
let target = {};
|
|
5
5
|
for (var name in all) {
|
|
6
6
|
__defProp(target, name, {
|
|
@@ -23,7 +23,7 @@ const AUTO_ALIASING = "__gqloom_auto_aliasing";
|
|
|
23
23
|
|
|
24
24
|
//#endregion
|
|
25
25
|
//#region src/utils/symbols.ts
|
|
26
|
-
var symbols_exports = /* @__PURE__ */
|
|
26
|
+
var symbols_exports = /* @__PURE__ */ __exportAll({
|
|
27
27
|
CONTEXT_MAP_KEY: () => CONTEXT_MAP_KEY,
|
|
28
28
|
FIELD_HIDDEN: () => FIELD_HIDDEN,
|
|
29
29
|
GET_GRAPHQL_ARGUMENT_CONFIG: () => GET_GRAPHQL_ARGUMENT_CONFIG,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gqloom/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.1",
|
|
4
4
|
"description": "Create GraphQL schema and resolvers with TypeScript.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"access": "public"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
|
-
"@standard-schema/spec": "1.
|
|
65
|
+
"@standard-schema/spec": "1.1.0"
|
|
66
66
|
},
|
|
67
67
|
"scripts": {
|
|
68
68
|
"build": "tsdown",
|