graphql-jit 0.8.9 → 0.8.10
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/ast.d.mts +1 -1
- package/dist/ast.d.ts +1 -1
- package/dist/compat.d.mts +1 -1
- package/dist/compat.d.ts +1 -1
- package/dist/execution.d.mts +1 -1
- package/dist/execution.d.ts +1 -1
- package/dist/execution.js +80 -20
- package/dist/execution.js.map +1 -1
- package/dist/execution.mjs +80 -20
- package/dist/execution.mjs.map +1 -1
- package/dist/{index-mKv2zpdA.d.ts → index-CZg-2UMZ.d.ts} +6 -0
- package/dist/{index-CeluTkd4.d.mts → index-DtKZ-jVv.d.mts} +6 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/json.d.mts +1 -1
- package/dist/json.d.ts +1 -1
- package/dist/non-null.d.mts +1 -1
- package/dist/non-null.d.ts +1 -1
- package/dist/runtime.d.mts +1 -1
- package/dist/runtime.d.ts +1 -1
- package/package.json +1 -1
package/dist/ast.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'graphql';
|
|
2
|
-
export { A as Arguments, F as FieldsAndNodes, t as JitFieldNode, O as ObjectPath, z as addPath, u as collectFields, v as collectSubfields, y as computeLocations, B as flattenPath, w as getArgumentDefs, H as joinSkipIncludePath, r as resolveFieldDef, D as serializeObjectPathForSkipInclude, x as valueFromAST } from './index-
|
|
2
|
+
export { A as Arguments, F as FieldsAndNodes, t as JitFieldNode, O as ObjectPath, z as addPath, u as collectFields, v as collectSubfields, y as computeLocations, B as flattenPath, w as getArgumentDefs, H as joinSkipIncludePath, r as resolveFieldDef, D as serializeObjectPathForSkipInclude, x as valueFromAST } from './index-DtKZ-jVv.mjs';
|
|
3
3
|
import '@graphql-typed-document-node/core';
|
|
4
4
|
import './types.mjs';
|
|
5
5
|
import './error.mjs';
|
package/dist/ast.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'graphql';
|
|
2
|
-
export { A as Arguments, F as FieldsAndNodes, t as JitFieldNode, O as ObjectPath, z as addPath, u as collectFields, v as collectSubfields, y as computeLocations, B as flattenPath, w as getArgumentDefs, H as joinSkipIncludePath, r as resolveFieldDef, D as serializeObjectPathForSkipInclude, x as valueFromAST } from './index-
|
|
2
|
+
export { A as Arguments, F as FieldsAndNodes, t as JitFieldNode, O as ObjectPath, z as addPath, u as collectFields, v as collectSubfields, y as computeLocations, B as flattenPath, w as getArgumentDefs, H as joinSkipIncludePath, r as resolveFieldDef, D as serializeObjectPathForSkipInclude, x as valueFromAST } from './index-CZg-2UMZ.js';
|
|
3
3
|
import '@graphql-typed-document-node/core';
|
|
4
4
|
import './types.js';
|
|
5
5
|
import './error.js';
|
package/dist/compat.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'graphql';
|
|
2
2
|
import './types.mjs';
|
|
3
|
-
export { E as ExecutionContext, c as coerceInputLiteral, f as formatError, b as getDefaultValue, a as getGraphQLErrorOptions, g as getOperationRootType, h as hasDefaultValue, r as resolveFieldDef } from './index-
|
|
3
|
+
export { E as ExecutionContext, c as coerceInputLiteral, f as formatError, b as getDefaultValue, a as getGraphQLErrorOptions, g as getOperationRootType, h as hasDefaultValue, r as resolveFieldDef } from './index-DtKZ-jVv.mjs';
|
|
4
4
|
import '@graphql-typed-document-node/core';
|
|
5
5
|
import './error.mjs';
|
|
6
6
|
import './resolve-info.mjs';
|
package/dist/compat.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'graphql';
|
|
2
2
|
import './types.js';
|
|
3
|
-
export { E as ExecutionContext, c as coerceInputLiteral, f as formatError, b as getDefaultValue, a as getGraphQLErrorOptions, g as getOperationRootType, h as hasDefaultValue, r as resolveFieldDef } from './index-
|
|
3
|
+
export { E as ExecutionContext, c as coerceInputLiteral, f as formatError, b as getDefaultValue, a as getGraphQLErrorOptions, g as getOperationRootType, h as hasDefaultValue, r as resolveFieldDef } from './index-CZg-2UMZ.js';
|
|
4
4
|
import '@graphql-typed-document-node/core';
|
|
5
5
|
import './error.js';
|
|
6
6
|
import './resolve-info.js';
|
package/dist/execution.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '@graphql-typed-document-node/core';
|
|
2
|
-
export { C as CompilationContext, k as CompiledQuery, e as CompilerOptions, i as ExecutionContext, G as GLOBAL_VARIABLES_NAME, q as buildCompilationContext, l as compileQuery, n as createBoundQuery, s as isAsyncIterable, m as isCompiledQuery, o as isPromise, p as isPromiseInliner } from './index-
|
|
2
|
+
export { C as CompilationContext, k as CompiledQuery, e as CompilerOptions, i as ExecutionContext, G as GLOBAL_VARIABLES_NAME, q as buildCompilationContext, l as compileQuery, n as createBoundQuery, s as isAsyncIterable, m as isCompiledQuery, o as isPromise, p as isPromiseInliner } from './index-DtKZ-jVv.mjs';
|
|
3
3
|
import 'graphql';
|
|
4
4
|
import './error.mjs';
|
|
5
5
|
import './resolve-info.mjs';
|
package/dist/execution.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import '@graphql-typed-document-node/core';
|
|
2
|
-
export { C as CompilationContext, k as CompiledQuery, e as CompilerOptions, i as ExecutionContext, G as GLOBAL_VARIABLES_NAME, q as buildCompilationContext, l as compileQuery, n as createBoundQuery, s as isAsyncIterable, m as isCompiledQuery, o as isPromise, p as isPromiseInliner } from './index-
|
|
2
|
+
export { C as CompilationContext, k as CompiledQuery, e as CompilerOptions, i as ExecutionContext, G as GLOBAL_VARIABLES_NAME, q as buildCompilationContext, l as compileQuery, n as createBoundQuery, s as isAsyncIterable, m as isCompiledQuery, o as isPromise, p as isPromiseInliner } from './index-CZg-2UMZ.js';
|
|
3
3
|
import 'graphql';
|
|
4
4
|
import './error.js';
|
|
5
5
|
import './resolve-info.js';
|
package/dist/execution.js
CHANGED
|
@@ -152,7 +152,14 @@ function isCompiledQuery(query) {
|
|
|
152
152
|
return "query" in query && typeof query.query === "function";
|
|
153
153
|
}
|
|
154
154
|
function createBoundQuery(compilationContext, document, func, getVariableValues, operationName) {
|
|
155
|
-
const {
|
|
155
|
+
const {
|
|
156
|
+
resolvers,
|
|
157
|
+
typeResolvers,
|
|
158
|
+
isTypeOfs,
|
|
159
|
+
serializers,
|
|
160
|
+
resolveInfos,
|
|
161
|
+
literals
|
|
162
|
+
} = compilationContext;
|
|
156
163
|
const trimmer = (0, import_non_null.createNullTrimmer)(compilationContext);
|
|
157
164
|
const fnName = operationName || "query";
|
|
158
165
|
const ret = {
|
|
@@ -172,6 +179,7 @@ function createBoundQuery(compilationContext, document, func, getVariableValues,
|
|
|
172
179
|
isTypeOfs,
|
|
173
180
|
serializers,
|
|
174
181
|
resolveInfos,
|
|
182
|
+
literals,
|
|
175
183
|
trimmer,
|
|
176
184
|
rt: import_runtime.jitRuntime,
|
|
177
185
|
promiseCounter: 0,
|
|
@@ -807,27 +815,66 @@ function compileListType(context, parentType, type, fieldNodes, originalObjectPa
|
|
|
807
815
|
return `(typeof ${name} === "string" || typeof ${name}[Symbol.iterator] !== "function") ? ${errorCase} :
|
|
808
816
|
${GLOBAL_SAFE_MAP_NAME}(${GLOBAL_EXECUTION_CONTEXT}, ${name}, ${safeMapHandler}, ${parentIndexes})`;
|
|
809
817
|
}
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
function
|
|
815
|
-
|
|
816
|
-
|
|
818
|
+
function isUnserializable(value) {
|
|
819
|
+
switch (typeof value) {
|
|
820
|
+
case "bigint":
|
|
821
|
+
case "symbol":
|
|
822
|
+
case "function":
|
|
823
|
+
return true;
|
|
824
|
+
case "object": {
|
|
825
|
+
if (value === null) {
|
|
826
|
+
return false;
|
|
827
|
+
}
|
|
828
|
+
const proto = Object.getPrototypeOf(value);
|
|
829
|
+
if (Array.isArray(value)) {
|
|
830
|
+
return proto !== Array.prototype;
|
|
831
|
+
}
|
|
832
|
+
if (value instanceof Date) {
|
|
833
|
+
return proto !== Date.prototype;
|
|
834
|
+
}
|
|
835
|
+
return proto !== null && proto !== Object.prototype;
|
|
836
|
+
}
|
|
837
|
+
default:
|
|
838
|
+
return false;
|
|
817
839
|
}
|
|
818
|
-
|
|
819
|
-
|
|
840
|
+
}
|
|
841
|
+
function objectStringify(val, hoist) {
|
|
842
|
+
if (isUnserializable(val)) {
|
|
843
|
+
return `${GLOBAL_EXECUTION_CONTEXT}.literals.${hoist(val)}`;
|
|
844
|
+
}
|
|
845
|
+
if (typeof val === "number") {
|
|
846
|
+
return Number.isFinite(val) ? JSON.stringify(val) : String(val);
|
|
820
847
|
}
|
|
821
|
-
if (
|
|
822
|
-
return
|
|
848
|
+
if (val === void 0) {
|
|
849
|
+
return "undefined";
|
|
823
850
|
}
|
|
824
|
-
if (
|
|
825
|
-
return
|
|
851
|
+
if (val === null || typeof val !== "object") {
|
|
852
|
+
return JSON.stringify(val);
|
|
826
853
|
}
|
|
827
|
-
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
|
|
854
|
+
if (val instanceof Date) {
|
|
855
|
+
return `new Date(${val.getTime()})`;
|
|
856
|
+
}
|
|
857
|
+
if (Array.isArray(val)) {
|
|
858
|
+
const items = [];
|
|
859
|
+
for (let i = 0; i < val.length; ++i) {
|
|
860
|
+
items.push(i in val ? objectStringify(val[i], hoist) : "null");
|
|
861
|
+
}
|
|
862
|
+
return `[${items.join(",")}]`;
|
|
863
|
+
}
|
|
864
|
+
const props = [];
|
|
865
|
+
for (const key of Object.keys(val)) {
|
|
866
|
+
if (val[key] === void 0) {
|
|
867
|
+
continue;
|
|
868
|
+
}
|
|
869
|
+
const name = JSON.stringify(key);
|
|
870
|
+
props.push(
|
|
871
|
+
`${key === "__proto__" ? `[${name}]` : name}:${objectStringify(
|
|
872
|
+
val[key],
|
|
873
|
+
hoist
|
|
874
|
+
)}`
|
|
875
|
+
);
|
|
876
|
+
}
|
|
877
|
+
return `{${props.join(",")}}`;
|
|
831
878
|
}
|
|
832
879
|
function getExecutionInfo(context, parentType, fieldType, fieldName, fieldNodes, responsePath) {
|
|
833
880
|
const resolveInfoName = createResolveInfoName(responsePath);
|
|
@@ -872,7 +919,11 @@ function objectPath(topLevel, path) {
|
|
|
872
919
|
function compileArguments(context, args, topLevelArg, validArgs, returnType, path) {
|
|
873
920
|
let body = `
|
|
874
921
|
let ${validArgs} = true;
|
|
875
|
-
const ${topLevelArg} = ${objectStringify(args.values)
|
|
922
|
+
const ${topLevelArg} = ${objectStringify(args.values, (value) => {
|
|
923
|
+
const key = `literal${Object.keys(context.literals).length}`;
|
|
924
|
+
context.literals[key] = value;
|
|
925
|
+
return key;
|
|
926
|
+
})};
|
|
876
927
|
`;
|
|
877
928
|
const errorDestination = getErrorDestination(returnType);
|
|
878
929
|
for (const variable of args.missing) {
|
|
@@ -1042,6 +1093,7 @@ function buildCompilationContext(schema, document, options, operationName) {
|
|
|
1042
1093
|
typeResolvers: {},
|
|
1043
1094
|
isTypeOfs: {},
|
|
1044
1095
|
resolveInfos: {},
|
|
1096
|
+
literals: {},
|
|
1045
1097
|
hoistedFunctions: [],
|
|
1046
1098
|
hoistedFunctionNames: /* @__PURE__ */ new Map(),
|
|
1047
1099
|
leafErrHandlerCache: /* @__PURE__ */ new Map(),
|
|
@@ -1177,7 +1229,14 @@ function compileSubscriptionOperation(context, type, fieldMap, queryFn) {
|
|
|
1177
1229
|
};
|
|
1178
1230
|
}
|
|
1179
1231
|
function createBoundSubscribe(compilationContext, document, func, getVariableValues, operationName) {
|
|
1180
|
-
const {
|
|
1232
|
+
const {
|
|
1233
|
+
resolvers,
|
|
1234
|
+
typeResolvers,
|
|
1235
|
+
isTypeOfs,
|
|
1236
|
+
serializers,
|
|
1237
|
+
resolveInfos,
|
|
1238
|
+
literals
|
|
1239
|
+
} = compilationContext;
|
|
1181
1240
|
const trimmer = (0, import_non_null.createNullTrimmer)(compilationContext);
|
|
1182
1241
|
const fnName = operationName || "subscribe";
|
|
1183
1242
|
const ret = {
|
|
@@ -1197,6 +1256,7 @@ function createBoundSubscribe(compilationContext, document, func, getVariableVal
|
|
|
1197
1256
|
isTypeOfs,
|
|
1198
1257
|
serializers,
|
|
1199
1258
|
resolveInfos,
|
|
1259
|
+
literals,
|
|
1200
1260
|
trimmer,
|
|
1201
1261
|
rt: import_runtime.jitRuntime,
|
|
1202
1262
|
promiseCounter: 0,
|