graphql-jit 0.8.9 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -0
- package/dist/cjs/ast.d.ts +89 -0
- package/dist/cjs/ast.js +766 -0
- package/dist/cjs/ast.js.map +1 -0
- package/dist/cjs/compat.d.ts +70 -0
- package/dist/cjs/compat.js +144 -0
- package/dist/cjs/compat.js.map +1 -0
- package/dist/cjs/debug.d.ts +29 -0
- package/dist/cjs/debug.js +46 -0
- package/dist/cjs/debug.js.map +1 -0
- package/dist/cjs/error.d.ts +7 -0
- package/dist/cjs/error.js +58 -0
- package/dist/cjs/error.js.map +1 -0
- package/dist/cjs/execution.d.ts +154 -0
- package/dist/cjs/execution.js +1240 -0
- package/dist/cjs/execution.js.map +1 -0
- package/dist/cjs/generate.d.ts +4 -0
- package/dist/cjs/generate.js +13 -0
- package/dist/cjs/generate.js.map +1 -0
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.js +10 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/inspect.d.ts +5 -0
- package/dist/cjs/inspect.js +110 -0
- package/dist/cjs/inspect.js.map +1 -0
- package/dist/cjs/json.d.ts +9 -0
- package/dist/cjs/json.js +144 -0
- package/dist/cjs/json.js.map +1 -0
- package/dist/cjs/memoize.d.ts +5 -0
- package/dist/cjs/memoize.js +28 -0
- package/dist/cjs/memoize.js.map +1 -0
- package/dist/cjs/non-null.d.ts +9 -0
- package/dist/cjs/non-null.js +205 -0
- package/dist/cjs/non-null.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/{resolve-info.d.ts → cjs/resolve-info.d.ts} +10 -12
- package/dist/cjs/resolve-info.js +232 -0
- package/dist/cjs/resolve-info.js.map +1 -0
- package/dist/cjs/runtime.d.ts +14 -0
- package/dist/cjs/runtime.js +92 -0
- package/dist/cjs/runtime.js.map +1 -0
- package/dist/cjs/types.d.ts +1 -0
- package/dist/cjs/types.js +3 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/cjs/variables.d.ts +20 -0
- package/dist/cjs/variables.js +357 -0
- package/dist/cjs/variables.js.map +1 -0
- package/dist/esm/ast.d.ts +89 -0
- package/dist/esm/ast.js +751 -0
- package/dist/esm/ast.js.map +1 -0
- package/dist/esm/compat.d.ts +70 -0
- package/dist/esm/compat.js +102 -0
- package/dist/esm/compat.js.map +1 -0
- package/dist/esm/debug.d.ts +29 -0
- package/dist/esm/debug.js +40 -0
- package/dist/esm/debug.js.map +1 -0
- package/dist/esm/error.d.ts +7 -0
- package/dist/esm/error.js +55 -0
- package/dist/esm/error.js.map +1 -0
- package/dist/esm/execution.d.ts +154 -0
- package/dist/esm/execution.js +1227 -0
- package/dist/esm/execution.js.map +1 -0
- package/dist/esm/generate.d.ts +4 -0
- package/dist/esm/generate.js +10 -0
- package/dist/esm/generate.js.map +1 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/inspect.d.ts +5 -0
- package/dist/esm/inspect.js +106 -0
- package/dist/esm/inspect.js.map +1 -0
- package/dist/esm/json.d.ts +9 -0
- package/dist/esm/json.js +141 -0
- package/dist/esm/json.js.map +1 -0
- package/dist/esm/memoize.d.ts +5 -0
- package/dist/esm/memoize.js +20 -0
- package/dist/esm/memoize.js.map +1 -0
- package/dist/esm/non-null.d.ts +9 -0
- package/dist/esm/non-null.js +199 -0
- package/dist/esm/non-null.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/{resolve-info.d.mts → esm/resolve-info.d.ts} +10 -12
- package/dist/esm/resolve-info.js +224 -0
- package/dist/esm/resolve-info.js.map +1 -0
- package/dist/esm/runtime.d.ts +14 -0
- package/dist/esm/runtime.js +89 -0
- package/dist/esm/runtime.js.map +1 -0
- package/dist/esm/types.d.ts +1 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/variables.d.ts +20 -0
- package/dist/esm/variables.js +350 -0
- package/dist/esm/variables.js.map +1 -0
- package/package.json +39 -35
- package/dist/ast.d.mts +0 -7
- package/dist/ast.d.ts +0 -7
- package/dist/ast.js +0 -635
- package/dist/ast.js.map +0 -1
- package/dist/ast.mjs +0 -612
- package/dist/ast.mjs.map +0 -1
- package/dist/compat.d.mts +0 -7
- package/dist/compat.d.ts +0 -7
- package/dist/compat.js +0 -113
- package/dist/compat.js.map +0 -1
- package/dist/compat.mjs +0 -75
- package/dist/compat.mjs.map +0 -1
- package/dist/error.d.mts +0 -11
- package/dist/error.d.ts +0 -11
- package/dist/error.js +0 -79
- package/dist/error.js.map +0 -1
- package/dist/error.mjs +0 -57
- package/dist/error.mjs.map +0 -1
- package/dist/execution.d.mts +0 -7
- package/dist/execution.d.ts +0 -7
- package/dist/execution.js +0 -1262
- package/dist/execution.js.map +0 -1
- package/dist/execution.mjs +0 -1248
- package/dist/execution.mjs.map +0 -1
- package/dist/generate.d.mts +0 -6
- package/dist/generate.d.ts +0 -6
- package/dist/generate.js +0 -37
- package/dist/generate.js.map +0 -1
- package/dist/generate.mjs +0 -13
- package/dist/generate.mjs.map +0 -1
- package/dist/index-CeluTkd4.d.mts +0 -329
- package/dist/index-mKv2zpdA.d.ts +0 -329
- package/dist/index.d.mts +0 -7
- package/dist/index.d.ts +0 -7
- package/dist/index.js +0 -36
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -15
- package/dist/index.mjs.map +0 -1
- package/dist/inspect.d.mts +0 -7
- package/dist/inspect.d.ts +0 -7
- package/dist/inspect.js +0 -121
- package/dist/inspect.js.map +0 -1
- package/dist/inspect.mjs +0 -97
- package/dist/inspect.mjs.map +0 -1
- package/dist/json.d.mts +0 -18
- package/dist/json.d.ts +0 -18
- package/dist/json.js +0 -181
- package/dist/json.js.map +0 -1
- package/dist/json.mjs +0 -164
- package/dist/json.mjs.map +0 -1
- package/dist/memoize.d.mts +0 -6
- package/dist/memoize.d.ts +0 -6
- package/dist/memoize.js +0 -67
- package/dist/memoize.js.map +0 -1
- package/dist/memoize.mjs +0 -31
- package/dist/memoize.mjs.map +0 -1
- package/dist/non-null.d.mts +0 -7
- package/dist/non-null.d.ts +0 -7
- package/dist/non-null.js +0 -196
- package/dist/non-null.js.map +0 -1
- package/dist/non-null.mjs +0 -167
- package/dist/non-null.mjs.map +0 -1
- package/dist/resolve-info.js +0 -245
- package/dist/resolve-info.js.map +0 -1
- package/dist/resolve-info.mjs +0 -219
- package/dist/resolve-info.mjs.map +0 -1
- package/dist/runtime.d.mts +0 -7
- package/dist/runtime.d.ts +0 -7
- package/dist/runtime.js +0 -115
- package/dist/runtime.js.map +0 -1
- package/dist/runtime.mjs +0 -91
- package/dist/runtime.mjs.map +0 -1
- package/dist/types.d.mts +0 -3
- package/dist/types.d.ts +0 -3
- package/dist/types.js +0 -17
- package/dist/types.js.map +0 -1
- package/dist/types.mjs +0 -1
- package/dist/types.mjs.map +0 -1
- package/dist/variables.d.mts +0 -17
- package/dist/variables.d.ts +0 -17
- package/dist/variables.js +0 -412
- package/dist/variables.js.map +0 -1
- package/dist/variables.mjs +0 -391
- package/dist/variables.mjs.map +0 -1
package/dist/json.d.mts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Schema } from 'fast-json-stringify';
|
|
2
|
-
import { C as CompilationContext } from './index-CeluTkd4.mjs';
|
|
3
|
-
import '@graphql-typed-document-node/core';
|
|
4
|
-
import 'graphql';
|
|
5
|
-
import './types.mjs';
|
|
6
|
-
import './error.mjs';
|
|
7
|
-
import './resolve-info.mjs';
|
|
8
|
-
import './variables.mjs';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* GQL -> JSON Schema transform
|
|
12
|
-
*
|
|
13
|
-
* @param compilationContext
|
|
14
|
-
* @return {object} A plain JavaScript object which conforms to JSON Schema
|
|
15
|
-
*/
|
|
16
|
-
declare function queryToJSONSchema(compilationContext: CompilationContext): Schema;
|
|
17
|
-
|
|
18
|
-
export { queryToJSONSchema };
|
package/dist/json.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Schema } from 'fast-json-stringify';
|
|
2
|
-
import { C as CompilationContext } from './index-mKv2zpdA.js';
|
|
3
|
-
import '@graphql-typed-document-node/core';
|
|
4
|
-
import 'graphql';
|
|
5
|
-
import './types.js';
|
|
6
|
-
import './error.js';
|
|
7
|
-
import './resolve-info.js';
|
|
8
|
-
import './variables.js';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* GQL -> JSON Schema transform
|
|
12
|
-
*
|
|
13
|
-
* @param compilationContext
|
|
14
|
-
* @return {object} A plain JavaScript object which conforms to JSON Schema
|
|
15
|
-
*/
|
|
16
|
-
declare function queryToJSONSchema(compilationContext: CompilationContext): Schema;
|
|
17
|
-
|
|
18
|
-
export { queryToJSONSchema };
|
package/dist/json.js
DELETED
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var json_exports = {};
|
|
20
|
-
__export(json_exports, {
|
|
21
|
-
queryToJSONSchema: () => queryToJSONSchema
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(json_exports);
|
|
24
|
-
var import_graphql = require("graphql");
|
|
25
|
-
var import_ast = require("./ast.js");
|
|
26
|
-
var import_compat = require("./compat.js");
|
|
27
|
-
const PRIMITIVES = {
|
|
28
|
-
Int: "integer",
|
|
29
|
-
Float: "number",
|
|
30
|
-
String: "string",
|
|
31
|
-
Boolean: "boolean",
|
|
32
|
-
ID: "string"
|
|
33
|
-
};
|
|
34
|
-
function queryToJSONSchema(compilationContext) {
|
|
35
|
-
const type = (0, import_compat.getOperationRootType)(
|
|
36
|
-
compilationContext.schema,
|
|
37
|
-
compilationContext.operation
|
|
38
|
-
);
|
|
39
|
-
const fields = (0, import_ast.collectFields)(
|
|
40
|
-
compilationContext,
|
|
41
|
-
type,
|
|
42
|
-
compilationContext.operation.selectionSet,
|
|
43
|
-
/* @__PURE__ */ Object.create(null),
|
|
44
|
-
/* @__PURE__ */ Object.create(null)
|
|
45
|
-
);
|
|
46
|
-
const fieldProperties = /* @__PURE__ */ Object.create(null);
|
|
47
|
-
for (const responseName of Object.keys(fields)) {
|
|
48
|
-
const fieldType = (0, import_ast.resolveFieldDef)(
|
|
49
|
-
compilationContext,
|
|
50
|
-
type,
|
|
51
|
-
fields[responseName]
|
|
52
|
-
);
|
|
53
|
-
if (!fieldType) {
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
fieldProperties[responseName] = transformNode(
|
|
57
|
-
compilationContext,
|
|
58
|
-
fields[responseName],
|
|
59
|
-
fieldType.type
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
return {
|
|
63
|
-
type: "object",
|
|
64
|
-
properties: {
|
|
65
|
-
data: {
|
|
66
|
-
type: "object",
|
|
67
|
-
properties: fieldProperties,
|
|
68
|
-
nullable: true
|
|
69
|
-
},
|
|
70
|
-
errors: {
|
|
71
|
-
type: "array",
|
|
72
|
-
items: {
|
|
73
|
-
type: "object",
|
|
74
|
-
additionalProperties: true,
|
|
75
|
-
properties: {
|
|
76
|
-
message: {
|
|
77
|
-
type: "string"
|
|
78
|
-
},
|
|
79
|
-
path: {
|
|
80
|
-
type: "array",
|
|
81
|
-
items: {
|
|
82
|
-
type: ["string", "number"]
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
locations: {
|
|
86
|
-
type: "array",
|
|
87
|
-
items: {
|
|
88
|
-
type: "object",
|
|
89
|
-
properties: {
|
|
90
|
-
line: {
|
|
91
|
-
type: "number"
|
|
92
|
-
},
|
|
93
|
-
column: {
|
|
94
|
-
type: "number"
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
function transformNode(compilationContext, fieldNodes, type) {
|
|
106
|
-
if ((0, import_graphql.isObjectType)(type)) {
|
|
107
|
-
const subfields = (0, import_ast.collectSubfields)(compilationContext, type, fieldNodes);
|
|
108
|
-
const properties = /* @__PURE__ */ Object.create(null);
|
|
109
|
-
for (const responseName of Object.keys(subfields)) {
|
|
110
|
-
const fieldType = (0, import_ast.resolveFieldDef)(
|
|
111
|
-
compilationContext,
|
|
112
|
-
type,
|
|
113
|
-
subfields[responseName]
|
|
114
|
-
);
|
|
115
|
-
if (!fieldType) {
|
|
116
|
-
continue;
|
|
117
|
-
}
|
|
118
|
-
properties[responseName] = transformNode(
|
|
119
|
-
compilationContext,
|
|
120
|
-
subfields[responseName],
|
|
121
|
-
fieldType.type
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
return {
|
|
125
|
-
type: "object",
|
|
126
|
-
properties,
|
|
127
|
-
nullable: true
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
if ((0, import_graphql.isListType)(type)) {
|
|
131
|
-
return {
|
|
132
|
-
type: "array",
|
|
133
|
-
items: transformNode(compilationContext, fieldNodes, type.ofType),
|
|
134
|
-
nullable: true
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
if ((0, import_graphql.isNonNullType)(type)) {
|
|
138
|
-
const nullable = transformNode(compilationContext, fieldNodes, type.ofType);
|
|
139
|
-
nullable.nullable = false;
|
|
140
|
-
return nullable;
|
|
141
|
-
}
|
|
142
|
-
if ((0, import_graphql.isEnumType)(type)) {
|
|
143
|
-
return {
|
|
144
|
-
type: "string",
|
|
145
|
-
nullable: true
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
if ((0, import_graphql.isScalarType)(type)) {
|
|
149
|
-
const jsonSchemaType = PRIMITIVES[type.name];
|
|
150
|
-
if (!jsonSchemaType) {
|
|
151
|
-
throw new Error(`Got unexpected PRIMITIVES type: ${type.name}`);
|
|
152
|
-
}
|
|
153
|
-
return {
|
|
154
|
-
type: jsonSchemaType,
|
|
155
|
-
nullable: true
|
|
156
|
-
};
|
|
157
|
-
}
|
|
158
|
-
if ((0, import_graphql.isAbstractType)(type)) {
|
|
159
|
-
return compilationContext.schema.getPossibleTypes(type).reduce(
|
|
160
|
-
(res, t) => {
|
|
161
|
-
const jsonSchema = transformNode(compilationContext, fieldNodes, t);
|
|
162
|
-
res.properties = {
|
|
163
|
-
...res.properties,
|
|
164
|
-
...jsonSchema.properties
|
|
165
|
-
};
|
|
166
|
-
return res;
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
type: "object",
|
|
170
|
-
properties: {},
|
|
171
|
-
nullable: true
|
|
172
|
-
}
|
|
173
|
-
);
|
|
174
|
-
}
|
|
175
|
-
throw new Error(`Got unhandled type: ${type.name}`);
|
|
176
|
-
}
|
|
177
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
178
|
-
0 && (module.exports = {
|
|
179
|
-
queryToJSONSchema
|
|
180
|
-
});
|
|
181
|
-
//# sourceMappingURL=json.js.map
|
package/dist/json.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/json.ts"],"sourcesContent":["/**\n * Mapping between GQL primitive types and JSON Schema property types\n *\n * @type {<type>}\n */\nimport {\n type FieldNode,\n type GraphQLType,\n isAbstractType,\n isEnumType,\n isListType,\n isNonNullType,\n isObjectType,\n isScalarType\n} from \"graphql\";\nimport {\n type BooleanSchema,\n type IntegerSchema,\n type NumberSchema,\n type ObjectSchema,\n type RefSchema,\n type Schema,\n type StringSchema\n} from \"fast-json-stringify\";\nimport { collectFields, collectSubfields, resolveFieldDef } from \"./ast.js\";\nimport { getOperationRootType } from \"./compat.js\";\nimport { type CompilationContext } from \"./execution.js\";\n\nconst PRIMITIVES: {\n [key: string]:\n | IntegerSchema[\"type\"]\n | NumberSchema[\"type\"]\n | StringSchema[\"type\"]\n | BooleanSchema[\"type\"];\n} = {\n Int: \"integer\",\n Float: \"number\",\n String: \"string\",\n Boolean: \"boolean\",\n ID: \"string\"\n};\n\n/**\n * GQL -> JSON Schema transform\n *\n * @param compilationContext\n * @return {object} A plain JavaScript object which conforms to JSON Schema\n */\nexport function queryToJSONSchema(\n compilationContext: CompilationContext\n): Schema {\n const type = getOperationRootType(\n compilationContext.schema,\n compilationContext.operation\n );\n const fields = collectFields(\n compilationContext,\n type,\n compilationContext.operation.selectionSet,\n Object.create(null),\n Object.create(null)\n );\n const fieldProperties = Object.create(null);\n for (const responseName of Object.keys(fields)) {\n const fieldType = resolveFieldDef(\n compilationContext,\n type,\n fields[responseName]\n );\n if (!fieldType) {\n // if field does not exist, it should be ignored for compatibility concerns.\n // Usually, validation would stop it before getting here but this could be an old query\n continue;\n }\n fieldProperties[responseName] = transformNode(\n compilationContext,\n fields[responseName],\n fieldType.type\n );\n }\n return {\n type: \"object\",\n properties: {\n data: {\n type: \"object\",\n properties: fieldProperties,\n nullable: true\n },\n errors: {\n type: \"array\",\n items: {\n type: \"object\",\n additionalProperties: true,\n properties: {\n message: {\n type: \"string\"\n },\n path: {\n type: \"array\",\n items: {\n type: [\"string\", \"number\"]\n }\n },\n locations: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n line: {\n type: \"number\"\n },\n column: {\n type: \"number\"\n }\n }\n }\n }\n }\n }\n }\n }\n };\n}\n\nfunction transformNode(\n compilationContext: CompilationContext,\n fieldNodes: FieldNode[],\n type: GraphQLType\n): Exclude<Schema, RefSchema> {\n if (isObjectType(type)) {\n const subfields = collectSubfields(compilationContext, type, fieldNodes);\n const properties = Object.create(null);\n for (const responseName of Object.keys(subfields)) {\n const fieldType = resolveFieldDef(\n compilationContext,\n type,\n subfields[responseName]\n );\n if (!fieldType) {\n // if field does not exist, it should be ignored for compatibility concerns.\n // Usually, validation would stop it before getting here but this could be an old query\n continue;\n }\n properties[responseName] = transformNode(\n compilationContext,\n subfields[responseName],\n fieldType.type\n );\n }\n return {\n type: \"object\",\n properties,\n nullable: true\n };\n }\n if (isListType(type)) {\n return {\n type: \"array\",\n items: transformNode(compilationContext, fieldNodes, type.ofType),\n nullable: true\n };\n }\n if (isNonNullType(type)) {\n const nullable = transformNode(compilationContext, fieldNodes, type.ofType);\n nullable.nullable = false;\n return nullable;\n }\n if (isEnumType(type)) {\n return {\n type: \"string\",\n nullable: true\n };\n }\n if (isScalarType(type)) {\n const jsonSchemaType = PRIMITIVES[type.name];\n if (!jsonSchemaType) {\n throw new Error(`Got unexpected PRIMITIVES type: ${type.name}`);\n }\n return {\n type: jsonSchemaType,\n nullable: true\n };\n }\n if (isAbstractType(type)) {\n return compilationContext.schema.getPossibleTypes(type).reduce(\n (res, t) => {\n const jsonSchema = transformNode(compilationContext, fieldNodes, t);\n (res as ObjectSchema).properties = {\n ...(res as ObjectSchema).properties,\n ...(jsonSchema as ObjectSchema).properties\n };\n return res;\n },\n {\n type: \"object\",\n properties: {},\n nullable: true\n }\n );\n }\n throw new Error(`Got unhandled type: ${type.name}`);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,qBASO;AAUP,iBAAiE;AAC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B,OAAO,iBAAiB,IAAI,EAAE;AAAA,MACtD,CAAC,KAAK,MAAM;AACV,cAAM,aAAa,cAAc,oBAAoB,YAAY,CAAC;AAClE,QAAC,IAAqB,aAAa;AAAA,UACjC,GAAI,IAAqB;AAAA,UACzB,GAAI,WAA4B;AAAA,QAClC;AACA,eAAO;AAAA,MACT;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,YAAY,CAAC;AAAA,QACb,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AACA,QAAM,IAAI,MAAM,uBAAuB,KAAK,IAAI,EAAE;AACpD;","names":[]}
|
package/dist/json.mjs
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
isAbstractType,
|
|
3
|
-
isEnumType,
|
|
4
|
-
isListType,
|
|
5
|
-
isNonNullType,
|
|
6
|
-
isObjectType,
|
|
7
|
-
isScalarType
|
|
8
|
-
} from "graphql";
|
|
9
|
-
import { collectFields, collectSubfields, resolveFieldDef } from "./ast.js";
|
|
10
|
-
import { getOperationRootType } from "./compat.js";
|
|
11
|
-
const PRIMITIVES = {
|
|
12
|
-
Int: "integer",
|
|
13
|
-
Float: "number",
|
|
14
|
-
String: "string",
|
|
15
|
-
Boolean: "boolean",
|
|
16
|
-
ID: "string"
|
|
17
|
-
};
|
|
18
|
-
function queryToJSONSchema(compilationContext) {
|
|
19
|
-
const type = getOperationRootType(
|
|
20
|
-
compilationContext.schema,
|
|
21
|
-
compilationContext.operation
|
|
22
|
-
);
|
|
23
|
-
const fields = collectFields(
|
|
24
|
-
compilationContext,
|
|
25
|
-
type,
|
|
26
|
-
compilationContext.operation.selectionSet,
|
|
27
|
-
/* @__PURE__ */ Object.create(null),
|
|
28
|
-
/* @__PURE__ */ Object.create(null)
|
|
29
|
-
);
|
|
30
|
-
const fieldProperties = /* @__PURE__ */ Object.create(null);
|
|
31
|
-
for (const responseName of Object.keys(fields)) {
|
|
32
|
-
const fieldType = resolveFieldDef(
|
|
33
|
-
compilationContext,
|
|
34
|
-
type,
|
|
35
|
-
fields[responseName]
|
|
36
|
-
);
|
|
37
|
-
if (!fieldType) {
|
|
38
|
-
continue;
|
|
39
|
-
}
|
|
40
|
-
fieldProperties[responseName] = transformNode(
|
|
41
|
-
compilationContext,
|
|
42
|
-
fields[responseName],
|
|
43
|
-
fieldType.type
|
|
44
|
-
);
|
|
45
|
-
}
|
|
46
|
-
return {
|
|
47
|
-
type: "object",
|
|
48
|
-
properties: {
|
|
49
|
-
data: {
|
|
50
|
-
type: "object",
|
|
51
|
-
properties: fieldProperties,
|
|
52
|
-
nullable: true
|
|
53
|
-
},
|
|
54
|
-
errors: {
|
|
55
|
-
type: "array",
|
|
56
|
-
items: {
|
|
57
|
-
type: "object",
|
|
58
|
-
additionalProperties: true,
|
|
59
|
-
properties: {
|
|
60
|
-
message: {
|
|
61
|
-
type: "string"
|
|
62
|
-
},
|
|
63
|
-
path: {
|
|
64
|
-
type: "array",
|
|
65
|
-
items: {
|
|
66
|
-
type: ["string", "number"]
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
locations: {
|
|
70
|
-
type: "array",
|
|
71
|
-
items: {
|
|
72
|
-
type: "object",
|
|
73
|
-
properties: {
|
|
74
|
-
line: {
|
|
75
|
-
type: "number"
|
|
76
|
-
},
|
|
77
|
-
column: {
|
|
78
|
-
type: "number"
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
function transformNode(compilationContext, fieldNodes, type) {
|
|
90
|
-
if (isObjectType(type)) {
|
|
91
|
-
const subfields = collectSubfields(compilationContext, type, fieldNodes);
|
|
92
|
-
const properties = /* @__PURE__ */ Object.create(null);
|
|
93
|
-
for (const responseName of Object.keys(subfields)) {
|
|
94
|
-
const fieldType = resolveFieldDef(
|
|
95
|
-
compilationContext,
|
|
96
|
-
type,
|
|
97
|
-
subfields[responseName]
|
|
98
|
-
);
|
|
99
|
-
if (!fieldType) {
|
|
100
|
-
continue;
|
|
101
|
-
}
|
|
102
|
-
properties[responseName] = transformNode(
|
|
103
|
-
compilationContext,
|
|
104
|
-
subfields[responseName],
|
|
105
|
-
fieldType.type
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
return {
|
|
109
|
-
type: "object",
|
|
110
|
-
properties,
|
|
111
|
-
nullable: true
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
if (isListType(type)) {
|
|
115
|
-
return {
|
|
116
|
-
type: "array",
|
|
117
|
-
items: transformNode(compilationContext, fieldNodes, type.ofType),
|
|
118
|
-
nullable: true
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
if (isNonNullType(type)) {
|
|
122
|
-
const nullable = transformNode(compilationContext, fieldNodes, type.ofType);
|
|
123
|
-
nullable.nullable = false;
|
|
124
|
-
return nullable;
|
|
125
|
-
}
|
|
126
|
-
if (isEnumType(type)) {
|
|
127
|
-
return {
|
|
128
|
-
type: "string",
|
|
129
|
-
nullable: true
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
if (isScalarType(type)) {
|
|
133
|
-
const jsonSchemaType = PRIMITIVES[type.name];
|
|
134
|
-
if (!jsonSchemaType) {
|
|
135
|
-
throw new Error(`Got unexpected PRIMITIVES type: ${type.name}`);
|
|
136
|
-
}
|
|
137
|
-
return {
|
|
138
|
-
type: jsonSchemaType,
|
|
139
|
-
nullable: true
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
if (isAbstractType(type)) {
|
|
143
|
-
return compilationContext.schema.getPossibleTypes(type).reduce(
|
|
144
|
-
(res, t) => {
|
|
145
|
-
const jsonSchema = transformNode(compilationContext, fieldNodes, t);
|
|
146
|
-
res.properties = {
|
|
147
|
-
...res.properties,
|
|
148
|
-
...jsonSchema.properties
|
|
149
|
-
};
|
|
150
|
-
return res;
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
type: "object",
|
|
154
|
-
properties: {},
|
|
155
|
-
nullable: true
|
|
156
|
-
}
|
|
157
|
-
);
|
|
158
|
-
}
|
|
159
|
-
throw new Error(`Got unhandled type: ${type.name}`);
|
|
160
|
-
}
|
|
161
|
-
export {
|
|
162
|
-
queryToJSONSchema
|
|
163
|
-
};
|
|
164
|
-
//# sourceMappingURL=json.mjs.map
|
package/dist/json.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/json.ts"],"sourcesContent":["/**\n * Mapping between GQL primitive types and JSON Schema property types\n *\n * @type {<type>}\n */\nimport {\n type FieldNode,\n type GraphQLType,\n isAbstractType,\n isEnumType,\n isListType,\n isNonNullType,\n isObjectType,\n isScalarType\n} from \"graphql\";\nimport {\n type BooleanSchema,\n type IntegerSchema,\n type NumberSchema,\n type ObjectSchema,\n type RefSchema,\n type Schema,\n type StringSchema\n} from \"fast-json-stringify\";\nimport { collectFields, collectSubfields, resolveFieldDef } from \"./ast.js\";\nimport { getOperationRootType } from \"./compat.js\";\nimport { type CompilationContext } from \"./execution.js\";\n\nconst PRIMITIVES: {\n [key: string]:\n | IntegerSchema[\"type\"]\n | NumberSchema[\"type\"]\n | StringSchema[\"type\"]\n | BooleanSchema[\"type\"];\n} = {\n Int: \"integer\",\n Float: \"number\",\n String: \"string\",\n Boolean: \"boolean\",\n ID: \"string\"\n};\n\n/**\n * GQL -> JSON Schema transform\n *\n * @param compilationContext\n * @return {object} A plain JavaScript object which conforms to JSON Schema\n */\nexport function queryToJSONSchema(\n compilationContext: CompilationContext\n): Schema {\n const type = getOperationRootType(\n compilationContext.schema,\n compilationContext.operation\n );\n const fields = collectFields(\n compilationContext,\n type,\n compilationContext.operation.selectionSet,\n Object.create(null),\n Object.create(null)\n );\n const fieldProperties = Object.create(null);\n for (const responseName of Object.keys(fields)) {\n const fieldType = resolveFieldDef(\n compilationContext,\n type,\n fields[responseName]\n );\n if (!fieldType) {\n // if field does not exist, it should be ignored for compatibility concerns.\n // Usually, validation would stop it before getting here but this could be an old query\n continue;\n }\n fieldProperties[responseName] = transformNode(\n compilationContext,\n fields[responseName],\n fieldType.type\n );\n }\n return {\n type: \"object\",\n properties: {\n data: {\n type: \"object\",\n properties: fieldProperties,\n nullable: true\n },\n errors: {\n type: \"array\",\n items: {\n type: \"object\",\n additionalProperties: true,\n properties: {\n message: {\n type: \"string\"\n },\n path: {\n type: \"array\",\n items: {\n type: [\"string\", \"number\"]\n }\n },\n locations: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: {\n line: {\n type: \"number\"\n },\n column: {\n type: \"number\"\n }\n }\n }\n }\n }\n }\n }\n }\n };\n}\n\nfunction transformNode(\n compilationContext: CompilationContext,\n fieldNodes: FieldNode[],\n type: GraphQLType\n): Exclude<Schema, RefSchema> {\n if (isObjectType(type)) {\n const subfields = collectSubfields(compilationContext, type, fieldNodes);\n const properties = Object.create(null);\n for (const responseName of Object.keys(subfields)) {\n const fieldType = resolveFieldDef(\n compilationContext,\n type,\n subfields[responseName]\n );\n if (!fieldType) {\n // if field does not exist, it should be ignored for compatibility concerns.\n // Usually, validation would stop it before getting here but this could be an old query\n continue;\n }\n properties[responseName] = transformNode(\n compilationContext,\n subfields[responseName],\n fieldType.type\n );\n }\n return {\n type: \"object\",\n properties,\n nullable: true\n };\n }\n if (isListType(type)) {\n return {\n type: \"array\",\n items: transformNode(compilationContext, fieldNodes, type.ofType),\n nullable: true\n };\n }\n if (isNonNullType(type)) {\n const nullable = transformNode(compilationContext, fieldNodes, type.ofType);\n nullable.nullable = false;\n return nullable;\n }\n if (isEnumType(type)) {\n return {\n type: \"string\",\n nullable: true\n };\n }\n if (isScalarType(type)) {\n const jsonSchemaType = PRIMITIVES[type.name];\n if (!jsonSchemaType) {\n throw new Error(`Got unexpected PRIMITIVES type: ${type.name}`);\n }\n return {\n type: jsonSchemaType,\n nullable: true\n };\n }\n if (isAbstractType(type)) {\n return compilationContext.schema.getPossibleTypes(type).reduce(\n (res, t) => {\n const jsonSchema = transformNode(compilationContext, fieldNodes, t);\n (res as ObjectSchema).properties = {\n ...(res as ObjectSchema).properties,\n ...(jsonSchema as ObjectSchema).properties\n };\n return res;\n },\n {\n type: \"object\",\n properties: {},\n nullable: true\n }\n );\n }\n throw new Error(`Got unhandled type: ${type.name}`);\n}\n"],"mappings":"AAKA;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAUP,SAAS,eAAe,kBAAkB,uBAAuB;AACjE,SAAS,4BAA4B;AAGrC,MAAM,aAMF;AAAA,EACF,KAAK;AAAA,EACL,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,IAAI;AACN;AAQO,SAAS,kBACd,oBACQ;AACR,QAAM,OAAO;AAAA,IACX,mBAAmB;AAAA,IACnB,mBAAmB;AAAA,EACrB;AACA,QAAM,SAAS;AAAA,IACb;AAAA,IACA;AAAA,IACA,mBAAmB,UAAU;AAAA,IAC7B,uBAAO,OAAO,IAAI;AAAA,IAClB,uBAAO,OAAO,IAAI;AAAA,EACpB;AACA,QAAM,kBAAkB,uBAAO,OAAO,IAAI;AAC1C,aAAW,gBAAgB,OAAO,KAAK,MAAM,GAAG;AAC9C,UAAM,YAAY;AAAA,MAChB;AAAA,MACA;AAAA,MACA,OAAO,YAAY;AAAA,IACrB;AACA,QAAI,CAAC,WAAW;AAGd;AAAA,IACF;AACA,oBAAgB,YAAY,IAAI;AAAA,MAC9B;AAAA,MACA,OAAO,YAAY;AAAA,MACnB,UAAU;AAAA,IACZ;AAAA,EACF;AACA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,YAAY;AAAA,MACV,MAAM;AAAA,QACJ,MAAM;AAAA,QACN,YAAY;AAAA,QACZ,UAAU;AAAA,MACZ;AAAA,MACA,QAAQ;AAAA,QACN,MAAM;AAAA,QACN,OAAO;AAAA,UACL,MAAM;AAAA,UACN,sBAAsB;A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,GAAG;AACpB,WAAO;AAAA,MACL,MAAM;AAAA,MACN,UAAU;AAAA,IACZ;AAAA,EACF;AACA,MAAI,aAAa,IAAI,GAAG;AACtB,UAAM,iBAAiB,WAAW,KAAK,IAAI;AAC3C,QAAI,CAAC,gBAAgB;AACnB,YAAM,IAAI,MAAM,mCAAmC,KAAK,IAAI,EAAE;AAAA,IAChE;AACA,WAAO;AAAA,MACL,MAAM;AAAA,MACN,UAAU;AAAA,IACZ;AAAA,EACF;AACA,MAAI,eAAe,IAAI,GAAG;AACxB,WAAO,mBAAmB,OAAO,iBAAiB,IAAI,EAAE;AAAA,MACtD,CAAC,KAAK,MAAM;AACV,cAAM,aAAa,cAAc,oBAAoB,YAAY,CAAC;AAClE,QAAC,IAAqB,aAAa;AAAA,UACjC,GAAI,IAAqB;AAAA,UACzB,GAAI,WAA4B;AAAA,QAClC;AACA,eAAO;AAAA,MACT;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,YAAY,CAAC;AAAA,QACb,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AACA,QAAM,IAAI,MAAM,uBAAuB,KAAK,IAAI,EAAE;AACpD;","names":[]}
|
package/dist/memoize.d.mts
DELETED
package/dist/memoize.d.ts
DELETED
package/dist/memoize.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var memoize_exports = {};
|
|
30
|
-
__export(memoize_exports, {
|
|
31
|
-
memoize2: () => memoize2,
|
|
32
|
-
memoize3: () => memoize3,
|
|
33
|
-
memoize4: () => memoize4
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(memoize_exports);
|
|
36
|
-
var import_lodash = __toESM(require("lodash.memoize"));
|
|
37
|
-
function uncurry2(fn) {
|
|
38
|
-
return (a, b) => fn(a)(b);
|
|
39
|
-
}
|
|
40
|
-
function uncurry3(fn) {
|
|
41
|
-
return (a, b, c) => fn(a)(b)(c);
|
|
42
|
-
}
|
|
43
|
-
function uncurry4(fn) {
|
|
44
|
-
return (a, b, c, d) => fn(a)(b)(c)(d);
|
|
45
|
-
}
|
|
46
|
-
function memoize2(fn) {
|
|
47
|
-
return uncurry2((0, import_lodash.default)((a) => (0, import_lodash.default)((b) => fn(a, b))));
|
|
48
|
-
}
|
|
49
|
-
function memoize3(fn) {
|
|
50
|
-
return uncurry3(
|
|
51
|
-
(0, import_lodash.default)((a) => (0, import_lodash.default)((b) => (0, import_lodash.default)((c) => fn(a, b, c))))
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
function memoize4(fn) {
|
|
55
|
-
return uncurry4(
|
|
56
|
-
(0, import_lodash.default)(
|
|
57
|
-
(a) => (0, import_lodash.default)((b) => (0, import_lodash.default)((c) => (0, import_lodash.default)((d) => fn(a, b, c, d))))
|
|
58
|
-
)
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
62
|
-
0 && (module.exports = {
|
|
63
|
-
memoize2,
|
|
64
|
-
memoize3,
|
|
65
|
-
memoize4
|
|
66
|
-
});
|
|
67
|
-
//# sourceMappingURL=memoize.js.map
|
package/dist/memoize.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/memoize.ts"],"sourcesContent":["import memoize from \"lodash.memoize\";\n\ntype Fn = (...args: any[]) => any;\n\ntype Args2<T> = T extends (a: infer A, b: infer B) => infer R\n ? {\n 0: A;\n 1: B;\n return: R;\n }\n : never;\ntype Args3<T> = T extends (a: infer A, b: infer B, c: infer C) => infer R\n ? {\n 0: A;\n 1: B;\n 2: C;\n return: R;\n }\n : never;\ntype Args4<T> = T extends (\n a: infer A,\n b: infer B,\n c: infer C,\n d: infer D\n) => infer R\n ? {\n 0: A;\n 1: B;\n 2: C;\n 3: D;\n return: R;\n }\n : never;\n\nfunction uncurry2<A, B, R>(fn: (a: A) => (b: B) => R) {\n return (a: A, b: B) => fn(a)(b);\n}\n\nfunction uncurry3<A, B, C, R>(fn: (a: A) => (b: B) => (c: C) => R) {\n return (a: A, b: B, c: C) => fn(a)(b)(c);\n}\n\nfunction uncurry4<A, B, C, D, R>(\n fn: (a: A) => (b: B) => (c: C) => (d: D) => R\n) {\n return (a: A, b: B, c: C, d: D) => fn(a)(b)(c)(d);\n}\n\nexport function memoize2<T extends Fn>(fn: T): T {\n type A = Args2<T>[0];\n type B = Args2<T>[1];\n\n return uncurry2(memoize((a: A) => memoize((b: B) => fn(a, b)))) as T;\n}\n\nexport function memoize3<T extends Fn>(fn: T): T {\n type A = Args3<T>[0];\n type B = Args3<T>[1];\n type C = Args3<T>[2];\n\n return uncurry3(\n memoize((a: A) => memoize((b: B) => memoize((c: C) => fn(a, b, c))))\n ) as T;\n}\n\nexport function memoize4<T extends Fn>(fn: T): T {\n type A = Args4<T>[0];\n type B = Args4<T>[1];\n type C = Args4<T>[2];\n type D = Args4<T>[3];\n\n return uncurry4(\n memoize((a: A) =>\n memoize((b: B) => memoize((c: C) => memoize((d: D) => fn(a, b, c, d))))\n )\n ) as T;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAoB;AAkCpB,SAAS,SAAkB,IAA2B;AACpD,SAAO,CAAC,GAAM,MAAS,GAAG,CAAC,EAAE,CAAC;AAChC;AAEA,SAAS,SAAqB,IAAqC;AACjE,SAAO,CAAC,GAAM,GAAM,MAAS,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;AACzC;AAEA,SAAS,SACP,IACA;AACA,SAAO,CAAC,GAAM,GAAM,GAAM,MAAS,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AAClD;AAEO,SAAS,SAAuB,IAAU;AAI/C,SAAO,aAAS,cAAAA,SAAQ,CAAC,UAAS,cAAAA,SAAQ,CAAC,MAAS,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;AAChE;AAEO,SAAS,SAAuB,IAAU;AAK/C,SAAO;AAAA,QACL,cAAAA,SAAQ,CAAC,UAAS,cAAAA,SAAQ,CAAC,UAAS,cAAAA,SAAQ,CAAC,MAAS,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;AAAA,EACrE;AACF;AAEO,SAAS,SAAuB,IAAU;AAM/C,SAAO;AAAA,QACL,cAAAA;AAAA,MAAQ,CAAC,UACP,cAAAA,SAAQ,CAAC,UAAS,cAAAA,SAAQ,CAAC,UAAS,cAAAA,SAAQ,CAAC,MAAS,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;AAAA,IACxE;AAAA,EACF;AACF;","names":["memoize"]}
|
package/dist/memoize.mjs
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import memoize from "lodash.memoize";
|
|
2
|
-
function uncurry2(fn) {
|
|
3
|
-
return (a, b) => fn(a)(b);
|
|
4
|
-
}
|
|
5
|
-
function uncurry3(fn) {
|
|
6
|
-
return (a, b, c) => fn(a)(b)(c);
|
|
7
|
-
}
|
|
8
|
-
function uncurry4(fn) {
|
|
9
|
-
return (a, b, c, d) => fn(a)(b)(c)(d);
|
|
10
|
-
}
|
|
11
|
-
function memoize2(fn) {
|
|
12
|
-
return uncurry2(memoize((a) => memoize((b) => fn(a, b))));
|
|
13
|
-
}
|
|
14
|
-
function memoize3(fn) {
|
|
15
|
-
return uncurry3(
|
|
16
|
-
memoize((a) => memoize((b) => memoize((c) => fn(a, b, c))))
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
function memoize4(fn) {
|
|
20
|
-
return uncurry4(
|
|
21
|
-
memoize(
|
|
22
|
-
(a) => memoize((b) => memoize((c) => memoize((d) => fn(a, b, c, d))))
|
|
23
|
-
)
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
export {
|
|
27
|
-
memoize2,
|
|
28
|
-
memoize3,
|
|
29
|
-
memoize4
|
|
30
|
-
};
|
|
31
|
-
//# sourceMappingURL=memoize.mjs.map
|
package/dist/memoize.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/memoize.ts"],"sourcesContent":["import memoize from \"lodash.memoize\";\n\ntype Fn = (...args: any[]) => any;\n\ntype Args2<T> = T extends (a: infer A, b: infer B) => infer R\n ? {\n 0: A;\n 1: B;\n return: R;\n }\n : never;\ntype Args3<T> = T extends (a: infer A, b: infer B, c: infer C) => infer R\n ? {\n 0: A;\n 1: B;\n 2: C;\n return: R;\n }\n : never;\ntype Args4<T> = T extends (\n a: infer A,\n b: infer B,\n c: infer C,\n d: infer D\n) => infer R\n ? {\n 0: A;\n 1: B;\n 2: C;\n 3: D;\n return: R;\n }\n : never;\n\nfunction uncurry2<A, B, R>(fn: (a: A) => (b: B) => R) {\n return (a: A, b: B) => fn(a)(b);\n}\n\nfunction uncurry3<A, B, C, R>(fn: (a: A) => (b: B) => (c: C) => R) {\n return (a: A, b: B, c: C) => fn(a)(b)(c);\n}\n\nfunction uncurry4<A, B, C, D, R>(\n fn: (a: A) => (b: B) => (c: C) => (d: D) => R\n) {\n return (a: A, b: B, c: C, d: D) => fn(a)(b)(c)(d);\n}\n\nexport function memoize2<T extends Fn>(fn: T): T {\n type A = Args2<T>[0];\n type B = Args2<T>[1];\n\n return uncurry2(memoize((a: A) => memoize((b: B) => fn(a, b)))) as T;\n}\n\nexport function memoize3<T extends Fn>(fn: T): T {\n type A = Args3<T>[0];\n type B = Args3<T>[1];\n type C = Args3<T>[2];\n\n return uncurry3(\n memoize((a: A) => memoize((b: B) => memoize((c: C) => fn(a, b, c))))\n ) as T;\n}\n\nexport function memoize4<T extends Fn>(fn: T): T {\n type A = Args4<T>[0];\n type B = Args4<T>[1];\n type C = Args4<T>[2];\n type D = Args4<T>[3];\n\n return uncurry4(\n memoize((a: A) =>\n memoize((b: B) => memoize((c: C) => memoize((d: D) => fn(a, b, c, d))))\n )\n ) as T;\n}\n"],"mappings":"AAAA,OAAO,aAAa;AAkCpB,SAAS,SAAkB,IAA2B;AACpD,SAAO,CAAC,GAAM,MAAS,GAAG,CAAC,EAAE,CAAC;AAChC;AAEA,SAAS,SAAqB,IAAqC;AACjE,SAAO,CAAC,GAAM,GAAM,MAAS,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;AACzC;AAEA,SAAS,SACP,IACA;AACA,SAAO,CAAC,GAAM,GAAM,GAAM,MAAS,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AAClD;AAEO,SAAS,SAAuB,IAAU;AAI/C,SAAO,SAAS,QAAQ,CAAC,MAAS,QAAQ,CAAC,MAAS,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;AAChE;AAEO,SAAS,SAAuB,IAAU;AAK/C,SAAO;AAAA,IACL,QAAQ,CAAC,MAAS,QAAQ,CAAC,MAAS,QAAQ,CAAC,MAAS,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;AAAA,EACrE;AACF;AAEO,SAAS,SAAuB,IAAU;AAM/C,SAAO;AAAA,IACL;AAAA,MAAQ,CAAC,MACP,QAAQ,CAAC,MAAS,QAAQ,CAAC,MAAS,QAAQ,CAAC,MAAS,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;AAAA,IACxE;AAAA,EACF;AACF;","names":[]}
|
package/dist/non-null.d.mts
DELETED
package/dist/non-null.d.ts
DELETED