mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-05 10:22:31 +01:00
249 lines
9.6 KiB
Diff
249 lines
9.6 KiB
Diff
diff --git a/node_modules/ajv/dist/compile/jtd/parse.js b/node_modules/ajv/dist/compile/jtd/parse.js
|
|
index 1eeb1be..7684121 100644
|
|
--- a/node_modules/ajv/dist/compile/jtd/parse.js
|
|
+++ b/node_modules/ajv/dist/compile/jtd/parse.js
|
|
@@ -239,6 +239,9 @@ function parseType(cxt) {
|
|
gen.if(fail, () => parsingError(cxt, codegen_1.str `invalid timestamp`));
|
|
break;
|
|
}
|
|
+ case "bigint":
|
|
+ parseBigInt(cxt);
|
|
+ break
|
|
case "float32":
|
|
case "float64":
|
|
parseNumber(cxt);
|
|
@@ -284,6 +287,15 @@ function parseNumber(cxt, maxDigits) {
|
|
skipWhitespace(cxt);
|
|
gen.if(codegen_1._ `"-0123456789".indexOf(${jsonSlice(1)}) < 0`, () => jsonSyntaxError(cxt), () => parseWith(cxt, parseJson_1.parseJsonNumber, maxDigits));
|
|
}
|
|
+function parseBigInt(cxt, maxDigits) {
|
|
+ const {gen} = cxt
|
|
+ skipWhitespace(cxt)
|
|
+ gen.if(
|
|
+ _`"-0123456789".indexOf(${jsonSlice(1)}) < 0`,
|
|
+ () => jsonSyntaxError(cxt),
|
|
+ () => parseWith(cxt, parseJson_1.parseJsonBigInt, maxDigits)
|
|
+ )
|
|
+}
|
|
function parseBooleanToken(bool, fail) {
|
|
return (cxt) => {
|
|
const { gen, data } = cxt;
|
|
diff --git a/node_modules/ajv/dist/compile/rules.js b/node_modules/ajv/dist/compile/rules.js
|
|
index 82a591f..1ebd8fe 100644
|
|
--- a/node_modules/ajv/dist/compile/rules.js
|
|
+++ b/node_modules/ajv/dist/compile/rules.js
|
|
@@ -1,7 +1,7 @@
|
|
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.getRules = exports.isJSONType = void 0;
|
|
-const _jsonTypes = ["string", "number", "integer", "boolean", "null", "object", "array"];
|
|
+const _jsonTypes = ["string", "number", "integer", "boolean", "null", "object", "array","bigint"];
|
|
const jsonTypes = new Set(_jsonTypes);
|
|
function isJSONType(x) {
|
|
return typeof x == "string" && jsonTypes.has(x);
|
|
@@ -13,10 +13,11 @@ function getRules() {
|
|
string: { type: "string", rules: [] },
|
|
array: { type: "array", rules: [] },
|
|
object: { type: "object", rules: [] },
|
|
+ bigint: {type: "bigint", rules: []}
|
|
};
|
|
return {
|
|
- types: { ...groups, integer: true, boolean: true, null: true },
|
|
- rules: [{ rules: [] }, groups.number, groups.string, groups.array, groups.object],
|
|
+ types: { ...groups, integer: true, boolean: true, null: true, bigint: true },
|
|
+ rules: [{ rules: [] }, groups.number, groups.string, groups.array, groups.object, groups.bigint],
|
|
post: { rules: [] },
|
|
all: {},
|
|
keywords: {},
|
|
diff --git a/node_modules/ajv/dist/compile/validate/dataType.js b/node_modules/ajv/dist/compile/validate/dataType.js
|
|
index 6319e76..8b50b4c 100644
|
|
--- a/node_modules/ajv/dist/compile/validate/dataType.js
|
|
+++ b/node_modules/ajv/dist/compile/validate/dataType.js
|
|
@@ -52,7 +52,7 @@ function coerceAndCheckDataType(it, types) {
|
|
return checkTypes;
|
|
}
|
|
exports.coerceAndCheckDataType = coerceAndCheckDataType;
|
|
-const COERCIBLE = new Set(["string", "number", "integer", "boolean", "null"]);
|
|
+const COERCIBLE = new Set(["string", "number", "integer", "boolean", "null","bigint"]);
|
|
function coerceToTypes(types, coerceTypes) {
|
|
return coerceTypes
|
|
? types.filter((t) => COERCIBLE.has(t) || (coerceTypes === "array" && t === "array"))
|
|
@@ -83,6 +83,14 @@ function coerceData(it, types, coerceTo) {
|
|
});
|
|
function coerceSpecificType(t) {
|
|
switch (t) {
|
|
+ case "bigint":
|
|
+ gen
|
|
+ .elseIf(
|
|
+ codegen_1._`${dataType} == "boolean" || ${data} === null
|
|
+ || (${dataType} == "string" && ${data} && ${data} == BigInt(${data}))`
|
|
+ )
|
|
+ .assign(coerced, codegen_1._`BigInt(${data})`)
|
|
+ return
|
|
case "string":
|
|
gen
|
|
.elseIf(codegen_1._ `${dataType} == "number" || ${dataType} == "boolean"`)
|
|
@@ -143,6 +151,9 @@ function checkDataType(dataType, data, strictNums, correct = DataType.Correct) {
|
|
case "number":
|
|
cond = numCond();
|
|
break;
|
|
+ case "bigint":
|
|
+ cond = codegen_1._`typeof ${data} == "bigint" && isFinite(${data})`
|
|
+ break
|
|
default:
|
|
return codegen_1._ `typeof ${data} ${EQ} ${dataType}`;
|
|
}
|
|
diff --git a/node_modules/ajv/dist/refs/json-schema-2019-09/meta/validation.json b/node_modules/ajv/dist/refs/json-schema-2019-09/meta/validation.json
|
|
index 7027a12..25679c8 100644
|
|
--- a/node_modules/ajv/dist/refs/json-schema-2019-09/meta/validation.json
|
|
+++ b/node_modules/ajv/dist/refs/json-schema-2019-09/meta/validation.json
|
|
@@ -78,7 +78,7 @@
|
|
"default": 0
|
|
},
|
|
"simpleTypes": {
|
|
- "enum": ["array", "boolean", "integer", "null", "number", "object", "string"]
|
|
+ "enum": ["array", "boolean", "integer", "null", "number", "object", "string","bigint"]
|
|
},
|
|
"stringArray": {
|
|
"type": "array",
|
|
diff --git a/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json b/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json
|
|
index e0ae13d..57c9036 100644
|
|
--- a/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json
|
|
+++ b/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json
|
|
@@ -78,7 +78,7 @@
|
|
"default": 0
|
|
},
|
|
"simpleTypes": {
|
|
- "enum": ["array", "boolean", "integer", "null", "number", "object", "string"]
|
|
+ "enum": ["array", "boolean", "integer", "null", "number", "object", "string","bigint"]
|
|
},
|
|
"stringArray": {
|
|
"type": "array",
|
|
diff --git a/node_modules/ajv/dist/refs/json-schema-draft-06.json b/node_modules/ajv/dist/refs/json-schema-draft-06.json
|
|
index 5410064..774435b 100644
|
|
--- a/node_modules/ajv/dist/refs/json-schema-draft-06.json
|
|
+++ b/node_modules/ajv/dist/refs/json-schema-draft-06.json
|
|
@@ -16,7 +16,7 @@
|
|
"allOf": [{"$ref": "#/definitions/nonNegativeInteger"}, {"default": 0}]
|
|
},
|
|
"simpleTypes": {
|
|
- "enum": ["array", "boolean", "integer", "null", "number", "object", "string"]
|
|
+ "enum": ["array", "boolean", "integer", "null", "number", "object", "string","bigint"]
|
|
},
|
|
"stringArray": {
|
|
"type": "array",
|
|
diff --git a/node_modules/ajv/dist/refs/json-schema-draft-07.json b/node_modules/ajv/dist/refs/json-schema-draft-07.json
|
|
index 6a74851..fc6dd7d 100644
|
|
--- a/node_modules/ajv/dist/refs/json-schema-draft-07.json
|
|
+++ b/node_modules/ajv/dist/refs/json-schema-draft-07.json
|
|
@@ -16,7 +16,7 @@
|
|
"allOf": [{"$ref": "#/definitions/nonNegativeInteger"}, {"default": 0}]
|
|
},
|
|
"simpleTypes": {
|
|
- "enum": ["array", "boolean", "integer", "null", "number", "object", "string"]
|
|
+ "enum": ["array", "boolean", "integer", "null", "number", "object", "string","bigint"]
|
|
},
|
|
"stringArray": {
|
|
"type": "array",
|
|
diff --git a/node_modules/ajv/dist/refs/jtd-schema.js b/node_modules/ajv/dist/refs/jtd-schema.js
|
|
index 1ee940a..1148887 100644
|
|
--- a/node_modules/ajv/dist/refs/jtd-schema.js
|
|
+++ b/node_modules/ajv/dist/refs/jtd-schema.js
|
|
@@ -38,6 +38,7 @@ const typeForm = (root) => ({
|
|
"uint16",
|
|
"int32",
|
|
"uint32",
|
|
+ "bigint",
|
|
],
|
|
},
|
|
},
|
|
diff --git a/node_modules/ajv/dist/runtime/parseJson.js b/node_modules/ajv/dist/runtime/parseJson.js
|
|
index 2576a6e..e7447b1 100644
|
|
--- a/node_modules/ajv/dist/runtime/parseJson.js
|
|
+++ b/node_modules/ajv/dist/runtime/parseJson.js
|
|
@@ -97,6 +97,71 @@ exports.parseJsonNumber = parseJsonNumber;
|
|
parseJsonNumber.message = undefined;
|
|
parseJsonNumber.position = 0;
|
|
parseJsonNumber.code = 'require("ajv/dist/runtime/parseJson").parseJsonNumber';
|
|
+
|
|
+function parseJsonBigInt(s, pos, maxDigits) {
|
|
+ let numStr = "";
|
|
+ let c;
|
|
+ parseJsonBigInt.message = undefined;
|
|
+ if (s[pos] === "-") {
|
|
+ numStr += "-";
|
|
+ pos++;
|
|
+ }
|
|
+ if (s[pos] === "0") {
|
|
+ numStr += "0";
|
|
+ pos++;
|
|
+ }
|
|
+ else {
|
|
+ if (!parseDigits(maxDigits)) {
|
|
+ errorMessage();
|
|
+ return undefined;
|
|
+ }
|
|
+ }
|
|
+ if (maxDigits) {
|
|
+ parseJsonBigInt.position = pos;
|
|
+ return BigInt(numStr);
|
|
+ }
|
|
+ if (s[pos] === ".") {
|
|
+ numStr += ".";
|
|
+ pos++;
|
|
+ if (!parseDigits()) {
|
|
+ errorMessage();
|
|
+ return undefined;
|
|
+ }
|
|
+ }
|
|
+ if (((c = s[pos]), c === "e" || c === "E")) {
|
|
+ numStr += "e";
|
|
+ pos++;
|
|
+ if (((c = s[pos]), c === "+" || c === "-")) {
|
|
+ numStr += c;
|
|
+ pos++;
|
|
+ }
|
|
+ if (!parseDigits()) {
|
|
+ errorMessage();
|
|
+ return undefined;
|
|
+ }
|
|
+ }
|
|
+ parseJsonBigInt.position = pos;
|
|
+ return BigInt(numStr);
|
|
+ function parseDigits(maxLen) {
|
|
+ let digit = false;
|
|
+ while (((c = s[pos]), c >= "0" && c <= "9" && (maxLen === undefined || maxLen-- > 0))) {
|
|
+ digit = true;
|
|
+ numStr += c;
|
|
+ pos++;
|
|
+ }
|
|
+ return digit;
|
|
+ }
|
|
+ function errorMessage() {
|
|
+ parseJsonBigInt.position = pos;
|
|
+ parseJsonBigInt.message = pos < s.length ? `unexpected token ${s[pos]}` : "unexpected end";
|
|
+ }
|
|
+}
|
|
+exports.parseJsonBigInt = parseJsonBigInt;
|
|
+parseJsonBigInt.message = undefined;
|
|
+parseJsonBigInt.position = 0;
|
|
+parseJsonBigInt.code = 'require("ajv/dist/runtime/parseJson").parseJsonBigInt';
|
|
+
|
|
+
|
|
const escapedChars = {
|
|
b: "\b",
|
|
f: "\f",
|
|
diff --git a/node_modules/ajv/dist/vocabularies/jtd/type.js b/node_modules/ajv/dist/vocabularies/jtd/type.js
|
|
index 428bddb..fbc3070 100644
|
|
--- a/node_modules/ajv/dist/vocabularies/jtd/type.js
|
|
+++ b/node_modules/ajv/dist/vocabularies/jtd/type.js
|
|
@@ -45,6 +45,9 @@ const def = {
|
|
cond = timestampCode(cxt);
|
|
break;
|
|
}
|
|
+ case "bigint":
|
|
+ cond = codegen_1._`typeof ${data} == "bigint" || typeof ${data} == "string"`
|
|
+ break
|
|
case "float32":
|
|
case "float64":
|
|
cond = codegen_1._ `typeof ${data} == "number"`;
|