diff --git a/flake.nix b/flake.nix index 5915e754..25251c02 100644 --- a/flake.nix +++ b/flake.nix @@ -88,6 +88,9 @@ buildInputs = with pkgs; [ nodejs nodePackages.typescript + nodePackages.ts-node + nodePackages.patch-package + nodePackages.prettier ]; }; } diff --git a/hashes.json b/hashes.json index 574d7295..952016d6 100644 --- a/hashes.json +++ b/hashes.json @@ -1,3 +1,3 @@ { - "npmDepsHash": "sha256-7fRfkqcmoaXtERi+XoPQnxhioMslTxm9PFD7C/5ZGZQ=" + "npmDepsHash": "sha256-iSz+FMfcmTj0STZOooftm0xFGia3Jq23/pzEeXqfbMg=" } diff --git a/package-lock.json b/package-lock.json index b62e96ce..61c5edc5 100644 Binary files a/package-lock.json and b/package-lock.json differ diff --git a/package.json b/package.json index 89c3c63a..fd8e46ce 100644 --- a/package.json +++ b/package.json @@ -39,56 +39,56 @@ "homepage": "https://spacebar.chat", "devDependencies": { "@types/amqplib": "^0.8.2", - "@types/bcrypt": "^5.0.0", - "@types/body-parser": "^1.19.2", - "@types/cookie-parser": "^1.4.3", - "@types/express": "^4.17.17", - "@types/i18next-node-fs-backend": "^2.1.2", - "@types/json-bigint": "^1.0.1", - "@types/jsonwebtoken": "^9.0.2", + "@types/bcrypt": "^5.0.2", + "@types/body-parser": "^1.19.5", + "@types/cookie-parser": "^1.4.7", + "@types/express": "^4.17.21", + "@types/i18next-node-fs-backend": "^2.1.5", + "@types/json-bigint": "^1.0.4", + "@types/jsonwebtoken": "^9.0.7", "@types/module-alias": "^2.0.4", - "@types/morgan": "^1.9.4", - "@types/multer": "^1.4.7", - "@types/murmurhash-js": "^1.0.4", - "@types/node": "^22.7.5", - "@types/node-fetch": "^2.6.4", - "@types/node-os-utils": "^1.3.1", - "@types/nodemailer": "^6.4.9", - "@types/probe-image-size": "^7.2.0", + "@types/morgan": "^1.9.9", + "@types/multer": "^1.4.12", + "@types/murmurhash-js": "^1.0.6", + "@types/node": "^22.8.4", + "@types/node-fetch": "^2.6.11", + "@types/node-os-utils": "^1.3.4", + "@types/nodemailer": "^6.4.16", + "@types/probe-image-size": "^7.2.5", "@types/sharp": "^0.31.1", - "@types/ws": "^8.5.5", + "@types/ws": "^8.5.12", "@typescript-eslint/eslint-plugin": "^6.21.0", "@typescript-eslint/parser": "^6.21.0", - "eslint": "^8.56.0", - "express": "^4.19.2", + "eslint": "^8.57.1", + "express": "^4.21.1", "husky": "^9.1.6", "prettier": "^3.3.3", "pretty-quick": "^4.0.0", "typescript": "^5.6.3" }, "dependencies": { - "@aws-sdk/client-s3": "^3.629.0", + "@aws-sdk/client-s3": "^3.679.0", "@sentry/integrations": "^7.66.0", - "@sentry/node": "^7.66.0", - "ajv": "^8.6.2", + "@sentry/node": "^7.119.2", + "ajv": "^8.17.1", "ajv-formats": "2.1.1", - "amqplib": "^0.10.3", - "bcrypt": "^5.1.0", + "amqplib": "^0.10.4", + "bcrypt": "^5.1.1", "body-parser": "^1.20.3", - "cheerio": "^1.0.0-rc.12", - "cookie-parser": "^1.4.6", - "dotenv": "^16.3.1", - "exif-be-gone": "^1.3.2", + "cheerio": "^1.0.0", + "cookie-parser": "^1.4.7", + "dotenv": "^16.4.5", + "exif-be-gone": "^1.5.1", "fast-zlib": "^2.0.1", - "fido2-lib": "^3.4.1", + "fido2-lib": "^3.5.3", "file-type": "~16.5.4", - "form-data": "^4.0.0", + "form-data": "^4.0.1", "i18next": "^21.10.0", - "i18next-fs-backend": "^2.1.5", - "i18next-http-middleware": "^3.3.2", - "image-size": "^1.0.2", + "i18next-fs-backend": "^2.3.2", + "i18next-http-middleware": "^3.6.0", + "image-size": "^1.1.1", "json-bigint": "^1.0.0", - "jsonwebtoken": "^9.0.1", + "jsonwebtoken": "^9.0.2", "lambert-server": "^1.2.12", "missing-native-js-functions": "^1.4.3", "module-alias": "^2.2.3", @@ -98,17 +98,17 @@ "node-2fa": "^2.0.3", "node-fetch-commonjs": "^3.3.2", "node-os-utils": "^1.3.7", - "nodemailer": "^6.9.14", - "picocolors": "^1.0.0", + "nodemailer": "^6.9.16", + "picocolors": "^1.1.1", "probe-image-size": "^7.2.3", - "proxy-agent": "^6.3.0", - "reflect-metadata": "^0.1.13", - "ts-node": "^10.9.1", - "tslib": "^2.6.1", - "typeorm": "^0.3.17", + "proxy-agent": "^6.4.0", + "reflect-metadata": "^0.1.14", + "ts-node": "^10.9.2", + "tslib": "^2.8.0", + "typeorm": "^0.3.20", "typescript-json-schema": "^0.50.1", - "wretch": "^2.6.0", - "ws": "^8.17.1" + "wretch": "^2.11.0", + "ws": "^8.18.0" }, "_moduleAliases": { "@spacebar/api": "dist/api", @@ -118,13 +118,12 @@ }, "optionalDependencies": { "@yukikaze-bot/erlpack": "^1.0.1", - "erlpack": "^0.1.4", "jimp": "^0.22.12", "mysql": "^2.18.1", "nodemailer-mailgun-transport": "^2.1.5", "nodemailer-mailjet-transport": "github:n0script22/nodemailer-mailjet-transport", "nodemailer-sendgrid-transport": "github:Maria-Golomb/nodemailer-sendgrid-transport", - "pg": "^8.11.3", - "sqlite3": "^5.1.6" + "pg": "^8.13.1", + "sqlite3": "^5.1.7" } } diff --git a/patches/ajv+8.17.1.patch b/patches/ajv+8.17.1.patch new file mode 100644 index 00000000..3bd5dc1d --- /dev/null +++ b/patches/ajv+8.17.1.patch @@ -0,0 +1,892 @@ +diff --git a/node_modules/ajv/dist/compile/jtd/parse.js b/node_modules/ajv/dist/compile/jtd/parse.js +index 8fc94fd..abeeda9 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, (0, 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((0, 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/jtd/parse.js.orig b/node_modules/ajv/dist/compile/jtd/parse.js.orig +new file mode 100644 +index 0000000..8fc94fd +--- /dev/null ++++ b/node_modules/ajv/dist/compile/jtd/parse.js.orig +@@ -0,0 +1,350 @@ ++"use strict"; ++Object.defineProperty(exports, "__esModule", { value: true }); ++const types_1 = require("./types"); ++const __1 = require(".."); ++const codegen_1 = require("../codegen"); ++const ref_error_1 = require("../ref_error"); ++const names_1 = require("../names"); ++const code_1 = require("../../vocabularies/code"); ++const ref_1 = require("../../vocabularies/jtd/ref"); ++const type_1 = require("../../vocabularies/jtd/type"); ++const parseJson_1 = require("../../runtime/parseJson"); ++const util_1 = require("../util"); ++const timestamp_1 = require("../../runtime/timestamp"); ++const genParse = { ++ elements: parseElements, ++ values: parseValues, ++ discriminator: parseDiscriminator, ++ properties: parseProperties, ++ optionalProperties: parseProperties, ++ enum: parseEnum, ++ type: parseType, ++ ref: parseRef, ++}; ++function compileParser(sch, definitions) { ++ const _sch = __1.getCompilingSchema.call(this, sch); ++ if (_sch) ++ return _sch; ++ const { es5, lines } = this.opts.code; ++ const { ownProperties } = this.opts; ++ const gen = new codegen_1.CodeGen(this.scope, { es5, lines, ownProperties }); ++ const parseName = gen.scopeName("parse"); ++ const cxt = { ++ self: this, ++ gen, ++ schema: sch.schema, ++ schemaEnv: sch, ++ definitions, ++ data: names_1.default.data, ++ parseName, ++ char: gen.name("c"), ++ }; ++ let sourceCode; ++ try { ++ this._compilations.add(sch); ++ sch.parseName = parseName; ++ parserFunction(cxt); ++ gen.optimize(this.opts.code.optimize); ++ const parseFuncCode = gen.toString(); ++ sourceCode = `${gen.scopeRefs(names_1.default.scope)}return ${parseFuncCode}`; ++ const makeParse = new Function(`${names_1.default.scope}`, sourceCode); ++ const parse = makeParse(this.scope.get()); ++ this.scope.value(parseName, { ref: parse }); ++ sch.parse = parse; ++ } ++ catch (e) { ++ if (sourceCode) ++ this.logger.error("Error compiling parser, function code:", sourceCode); ++ delete sch.parse; ++ delete sch.parseName; ++ throw e; ++ } ++ finally { ++ this._compilations.delete(sch); ++ } ++ return sch; ++} ++exports.default = compileParser; ++const undef = (0, codegen_1._) `undefined`; ++function parserFunction(cxt) { ++ const { gen, parseName, char } = cxt; ++ gen.func(parseName, (0, codegen_1._) `${names_1.default.json}, ${names_1.default.jsonPos}, ${names_1.default.jsonPart}`, false, () => { ++ gen.let(names_1.default.data); ++ gen.let(char); ++ gen.assign((0, codegen_1._) `${parseName}.message`, undef); ++ gen.assign((0, codegen_1._) `${parseName}.position`, undef); ++ gen.assign(names_1.default.jsonPos, (0, codegen_1._) `${names_1.default.jsonPos} || 0`); ++ gen.const(names_1.default.jsonLen, (0, codegen_1._) `${names_1.default.json}.length`); ++ parseCode(cxt); ++ skipWhitespace(cxt); ++ gen.if(names_1.default.jsonPart, () => { ++ gen.assign((0, codegen_1._) `${parseName}.position`, names_1.default.jsonPos); ++ gen.return(names_1.default.data); ++ }); ++ gen.if((0, codegen_1._) `${names_1.default.jsonPos} === ${names_1.default.jsonLen}`, () => gen.return(names_1.default.data)); ++ jsonSyntaxError(cxt); ++ }); ++} ++function parseCode(cxt) { ++ let form; ++ for (const key of types_1.jtdForms) { ++ if (key in cxt.schema) { ++ form = key; ++ break; ++ } ++ } ++ if (form) ++ parseNullable(cxt, genParse[form]); ++ else ++ parseEmpty(cxt); ++} ++const parseBoolean = parseBooleanToken(true, parseBooleanToken(false, jsonSyntaxError)); ++function parseNullable(cxt, parseForm) { ++ const { gen, schema, data } = cxt; ++ if (!schema.nullable) ++ return parseForm(cxt); ++ tryParseToken(cxt, "null", parseForm, () => gen.assign(data, null)); ++} ++function parseElements(cxt) { ++ const { gen, schema, data } = cxt; ++ parseToken(cxt, "["); ++ const ix = gen.let("i", 0); ++ gen.assign(data, (0, codegen_1._) `[]`); ++ parseItems(cxt, "]", () => { ++ const el = gen.let("el"); ++ parseCode({ ...cxt, schema: schema.elements, data: el }); ++ gen.assign((0, codegen_1._) `${data}[${ix}++]`, el); ++ }); ++} ++function parseValues(cxt) { ++ const { gen, schema, data } = cxt; ++ parseToken(cxt, "{"); ++ gen.assign(data, (0, codegen_1._) `{}`); ++ parseItems(cxt, "}", () => parseKeyValue(cxt, schema.values)); ++} ++function parseItems(cxt, endToken, block) { ++ tryParseItems(cxt, endToken, block); ++ parseToken(cxt, endToken); ++} ++function tryParseItems(cxt, endToken, block) { ++ const { gen } = cxt; ++ gen.for((0, codegen_1._) `;${names_1.default.jsonPos}<${names_1.default.jsonLen} && ${jsonSlice(1)}!==${endToken};`, () => { ++ block(); ++ tryParseToken(cxt, ",", () => gen.break(), hasItem); ++ }); ++ function hasItem() { ++ tryParseToken(cxt, endToken, () => { }, jsonSyntaxError); ++ } ++} ++function parseKeyValue(cxt, schema) { ++ const { gen } = cxt; ++ const key = gen.let("key"); ++ parseString({ ...cxt, data: key }); ++ parseToken(cxt, ":"); ++ parsePropertyValue(cxt, key, schema); ++} ++function parseDiscriminator(cxt) { ++ const { gen, data, schema } = cxt; ++ const { discriminator, mapping } = schema; ++ parseToken(cxt, "{"); ++ gen.assign(data, (0, codegen_1._) `{}`); ++ const startPos = gen.const("pos", names_1.default.jsonPos); ++ const value = gen.let("value"); ++ const tag = gen.let("tag"); ++ tryParseItems(cxt, "}", () => { ++ const key = gen.let("key"); ++ parseString({ ...cxt, data: key }); ++ parseToken(cxt, ":"); ++ gen.if((0, codegen_1._) `${key} === ${discriminator}`, () => { ++ parseString({ ...cxt, data: tag }); ++ gen.assign((0, codegen_1._) `${data}[${key}]`, tag); ++ gen.break(); ++ }, () => parseEmpty({ ...cxt, data: value }) // can be discarded/skipped ++ ); ++ }); ++ gen.assign(names_1.default.jsonPos, startPos); ++ gen.if((0, codegen_1._) `${tag} === undefined`); ++ parsingError(cxt, (0, codegen_1.str) `discriminator tag not found`); ++ for (const tagValue in mapping) { ++ gen.elseIf((0, codegen_1._) `${tag} === ${tagValue}`); ++ parseSchemaProperties({ ...cxt, schema: mapping[tagValue] }, discriminator); ++ } ++ gen.else(); ++ parsingError(cxt, (0, codegen_1.str) `discriminator value not in schema`); ++ gen.endIf(); ++} ++function parseProperties(cxt) { ++ const { gen, data } = cxt; ++ parseToken(cxt, "{"); ++ gen.assign(data, (0, codegen_1._) `{}`); ++ parseSchemaProperties(cxt); ++} ++function parseSchemaProperties(cxt, discriminator) { ++ const { gen, schema, data } = cxt; ++ const { properties, optionalProperties, additionalProperties } = schema; ++ parseItems(cxt, "}", () => { ++ const key = gen.let("key"); ++ parseString({ ...cxt, data: key }); ++ parseToken(cxt, ":"); ++ gen.if(false); ++ parseDefinedProperty(cxt, key, properties); ++ parseDefinedProperty(cxt, key, optionalProperties); ++ if (discriminator) { ++ gen.elseIf((0, codegen_1._) `${key} === ${discriminator}`); ++ const tag = gen.let("tag"); ++ parseString({ ...cxt, data: tag }); // can be discarded, it is already assigned ++ } ++ gen.else(); ++ if (additionalProperties) { ++ parseEmpty({ ...cxt, data: (0, codegen_1._) `${data}[${key}]` }); ++ } ++ else { ++ parsingError(cxt, (0, codegen_1.str) `property ${key} not allowed`); ++ } ++ gen.endIf(); ++ }); ++ if (properties) { ++ const hasProp = (0, code_1.hasPropFunc)(gen); ++ const allProps = (0, codegen_1.and)(...Object.keys(properties).map((p) => (0, codegen_1._) `${hasProp}.call(${data}, ${p})`)); ++ gen.if((0, codegen_1.not)(allProps), () => parsingError(cxt, (0, codegen_1.str) `missing required properties`)); ++ } ++} ++function parseDefinedProperty(cxt, key, schemas = {}) { ++ const { gen } = cxt; ++ for (const prop in schemas) { ++ gen.elseIf((0, codegen_1._) `${key} === ${prop}`); ++ parsePropertyValue(cxt, key, schemas[prop]); ++ } ++} ++function parsePropertyValue(cxt, key, schema) { ++ parseCode({ ...cxt, schema, data: (0, codegen_1._) `${cxt.data}[${key}]` }); ++} ++function parseType(cxt) { ++ const { gen, schema, data, self } = cxt; ++ switch (schema.type) { ++ case "boolean": ++ parseBoolean(cxt); ++ break; ++ case "string": ++ parseString(cxt); ++ break; ++ case "timestamp": { ++ parseString(cxt); ++ const vts = (0, util_1.useFunc)(gen, timestamp_1.default); ++ const { allowDate, parseDate } = self.opts; ++ const notValid = allowDate ? (0, codegen_1._) `!${vts}(${data}, true)` : (0, codegen_1._) `!${vts}(${data})`; ++ const fail = parseDate ++ ? (0, codegen_1.or)(notValid, (0, codegen_1._) `(${data} = new Date(${data}), false)`, (0, codegen_1._) `isNaN(${data}.valueOf())`) ++ : notValid; ++ gen.if(fail, () => parsingError(cxt, (0, codegen_1.str) `invalid timestamp`)); ++ break; ++ } ++ case "float32": ++ case "float64": ++ parseNumber(cxt); ++ break; ++ default: { ++ const t = schema.type; ++ if (!self.opts.int32range && (t === "int32" || t === "uint32")) { ++ parseNumber(cxt, 16); // 2 ** 53 - max safe integer ++ if (t === "uint32") { ++ gen.if((0, codegen_1._) `${data} < 0`, () => parsingError(cxt, (0, codegen_1.str) `integer out of range`)); ++ } ++ } ++ else { ++ const [min, max, maxDigits] = type_1.intRange[t]; ++ parseNumber(cxt, maxDigits); ++ gen.if((0, codegen_1._) `${data} < ${min} || ${data} > ${max}`, () => parsingError(cxt, (0, codegen_1.str) `integer out of range`)); ++ } ++ } ++ } ++} ++function parseString(cxt) { ++ parseToken(cxt, '"'); ++ parseWith(cxt, parseJson_1.parseJsonString); ++} ++function parseEnum(cxt) { ++ const { gen, data, schema } = cxt; ++ const enumSch = schema.enum; ++ parseToken(cxt, '"'); ++ // TODO loopEnum ++ gen.if(false); ++ for (const value of enumSch) { ++ const valueStr = JSON.stringify(value).slice(1); // remove starting quote ++ gen.elseIf((0, codegen_1._) `${jsonSlice(valueStr.length)} === ${valueStr}`); ++ gen.assign(data, (0, codegen_1.str) `${value}`); ++ gen.add(names_1.default.jsonPos, valueStr.length); ++ } ++ gen.else(); ++ jsonSyntaxError(cxt); ++ gen.endIf(); ++} ++function parseNumber(cxt, maxDigits) { ++ const { gen } = cxt; ++ skipWhitespace(cxt); ++ gen.if((0, codegen_1._) `"-0123456789".indexOf(${jsonSlice(1)}) < 0`, () => jsonSyntaxError(cxt), () => parseWith(cxt, parseJson_1.parseJsonNumber, maxDigits)); ++} ++function parseBooleanToken(bool, fail) { ++ return (cxt) => { ++ const { gen, data } = cxt; ++ tryParseToken(cxt, `${bool}`, () => fail(cxt), () => gen.assign(data, bool)); ++ }; ++} ++function parseRef(cxt) { ++ const { gen, self, definitions, schema, schemaEnv } = cxt; ++ const { ref } = schema; ++ const refSchema = definitions[ref]; ++ if (!refSchema) ++ throw new ref_error_1.default(self.opts.uriResolver, "", ref, `No definition ${ref}`); ++ if (!(0, ref_1.hasRef)(refSchema)) ++ return parseCode({ ...cxt, schema: refSchema }); ++ const { root } = schemaEnv; ++ const sch = compileParser.call(self, new __1.SchemaEnv({ schema: refSchema, root }), definitions); ++ partialParse(cxt, getParser(gen, sch), true); ++} ++function getParser(gen, sch) { ++ return sch.parse ++ ? gen.scopeValue("parse", { ref: sch.parse }) ++ : (0, codegen_1._) `${gen.scopeValue("wrapper", { ref: sch })}.parse`; ++} ++function parseEmpty(cxt) { ++ parseWith(cxt, parseJson_1.parseJson); ++} ++function parseWith(cxt, parseFunc, args) { ++ partialParse(cxt, (0, util_1.useFunc)(cxt.gen, parseFunc), args); ++} ++function partialParse(cxt, parseFunc, args) { ++ const { gen, data } = cxt; ++ gen.assign(data, (0, codegen_1._) `${parseFunc}(${names_1.default.json}, ${names_1.default.jsonPos}${args ? (0, codegen_1._) `, ${args}` : codegen_1.nil})`); ++ gen.assign(names_1.default.jsonPos, (0, codegen_1._) `${parseFunc}.position`); ++ gen.if((0, codegen_1._) `${data} === undefined`, () => parsingError(cxt, (0, codegen_1._) `${parseFunc}.message`)); ++} ++function parseToken(cxt, tok) { ++ tryParseToken(cxt, tok, jsonSyntaxError); ++} ++function tryParseToken(cxt, tok, fail, success) { ++ const { gen } = cxt; ++ const n = tok.length; ++ skipWhitespace(cxt); ++ gen.if((0, codegen_1._) `${jsonSlice(n)} === ${tok}`, () => { ++ gen.add(names_1.default.jsonPos, n); ++ success === null || success === void 0 ? void 0 : success(cxt); ++ }, () => fail(cxt)); ++} ++function skipWhitespace({ gen, char: c }) { ++ gen.code((0, codegen_1._) `while((${c}=${names_1.default.json}[${names_1.default.jsonPos}],${c}===" "||${c}==="\\n"||${c}==="\\r"||${c}==="\\t"))${names_1.default.jsonPos}++;`); ++} ++function jsonSlice(len) { ++ return len === 1 ++ ? (0, codegen_1._) `${names_1.default.json}[${names_1.default.jsonPos}]` ++ : (0, codegen_1._) `${names_1.default.json}.slice(${names_1.default.jsonPos}, ${names_1.default.jsonPos}+${len})`; ++} ++function jsonSyntaxError(cxt) { ++ parsingError(cxt, (0, codegen_1._) `"unexpected token " + ${names_1.default.json}[${names_1.default.jsonPos}]`); ++} ++function parsingError({ gen, parseName }, msg) { ++ gen.assign((0, codegen_1._) `${parseName}.message`, msg); ++ gen.assign((0, codegen_1._) `${parseName}.position`, names_1.default.jsonPos); ++ gen.return(undef); ++} ++//# sourceMappingURL=parse.js.map +\ No newline at end of file +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 6d03e0d..a35a428 100644 +--- a/node_modules/ajv/dist/compile/validate/dataType.js ++++ b/node_modules/ajv/dist/compile/validate/dataType.js +@@ -53,7 +53,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")) +@@ -84,6 +84,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((0, codegen_1._) `${dataType} == "number" || ${dataType} == "boolean"`) +@@ -144,6 +152,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 (0, codegen_1._) `typeof ${data} ${EQ} ${dataType}`; + } +diff --git a/node_modules/ajv/dist/compile/validate/dataType.js.orig b/node_modules/ajv/dist/compile/validate/dataType.js.orig +new file mode 100644 +index 0000000..6d03e0d +--- /dev/null ++++ b/node_modules/ajv/dist/compile/validate/dataType.js.orig +@@ -0,0 +1,203 @@ ++"use strict"; ++Object.defineProperty(exports, "__esModule", { value: true }); ++exports.reportTypeError = exports.checkDataTypes = exports.checkDataType = exports.coerceAndCheckDataType = exports.getJSONTypes = exports.getSchemaTypes = exports.DataType = void 0; ++const rules_1 = require("../rules"); ++const applicability_1 = require("./applicability"); ++const errors_1 = require("../errors"); ++const codegen_1 = require("../codegen"); ++const util_1 = require("../util"); ++var DataType; ++(function (DataType) { ++ DataType[DataType["Correct"] = 0] = "Correct"; ++ DataType[DataType["Wrong"] = 1] = "Wrong"; ++})(DataType || (exports.DataType = DataType = {})); ++function getSchemaTypes(schema) { ++ const types = getJSONTypes(schema.type); ++ const hasNull = types.includes("null"); ++ if (hasNull) { ++ if (schema.nullable === false) ++ throw new Error("type: null contradicts nullable: false"); ++ } ++ else { ++ if (!types.length && schema.nullable !== undefined) { ++ throw new Error('"nullable" cannot be used without "type"'); ++ } ++ if (schema.nullable === true) ++ types.push("null"); ++ } ++ return types; ++} ++exports.getSchemaTypes = getSchemaTypes; ++// eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents ++function getJSONTypes(ts) { ++ const types = Array.isArray(ts) ? ts : ts ? [ts] : []; ++ if (types.every(rules_1.isJSONType)) ++ return types; ++ throw new Error("type must be JSONType or JSONType[]: " + types.join(",")); ++} ++exports.getJSONTypes = getJSONTypes; ++function coerceAndCheckDataType(it, types) { ++ const { gen, data, opts } = it; ++ const coerceTo = coerceToTypes(types, opts.coerceTypes); ++ const checkTypes = types.length > 0 && ++ !(coerceTo.length === 0 && types.length === 1 && (0, applicability_1.schemaHasRulesForType)(it, types[0])); ++ if (checkTypes) { ++ const wrongType = checkDataTypes(types, data, opts.strictNumbers, DataType.Wrong); ++ gen.if(wrongType, () => { ++ if (coerceTo.length) ++ coerceData(it, types, coerceTo); ++ else ++ reportTypeError(it); ++ }); ++ } ++ return checkTypes; ++} ++exports.coerceAndCheckDataType = coerceAndCheckDataType; ++const COERCIBLE = new Set(["string", "number", "integer", "boolean", "null"]); ++function coerceToTypes(types, coerceTypes) { ++ return coerceTypes ++ ? types.filter((t) => COERCIBLE.has(t) || (coerceTypes === "array" && t === "array")) ++ : []; ++} ++function coerceData(it, types, coerceTo) { ++ const { gen, data, opts } = it; ++ const dataType = gen.let("dataType", (0, codegen_1._) `typeof ${data}`); ++ const coerced = gen.let("coerced", (0, codegen_1._) `undefined`); ++ if (opts.coerceTypes === "array") { ++ gen.if((0, codegen_1._) `${dataType} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => gen ++ .assign(data, (0, codegen_1._) `${data}[0]`) ++ .assign(dataType, (0, codegen_1._) `typeof ${data}`) ++ .if(checkDataTypes(types, data, opts.strictNumbers), () => gen.assign(coerced, data))); ++ } ++ gen.if((0, codegen_1._) `${coerced} !== undefined`); ++ for (const t of coerceTo) { ++ if (COERCIBLE.has(t) || (t === "array" && opts.coerceTypes === "array")) { ++ coerceSpecificType(t); ++ } ++ } ++ gen.else(); ++ reportTypeError(it); ++ gen.endIf(); ++ gen.if((0, codegen_1._) `${coerced} !== undefined`, () => { ++ gen.assign(data, coerced); ++ assignParentData(it, coerced); ++ }); ++ function coerceSpecificType(t) { ++ switch (t) { ++ case "string": ++ gen ++ .elseIf((0, codegen_1._) `${dataType} == "number" || ${dataType} == "boolean"`) ++ .assign(coerced, (0, codegen_1._) `"" + ${data}`) ++ .elseIf((0, codegen_1._) `${data} === null`) ++ .assign(coerced, (0, codegen_1._) `""`); ++ return; ++ case "number": ++ gen ++ .elseIf((0, codegen_1._) `${dataType} == "boolean" || ${data} === null ++ || (${dataType} == "string" && ${data} && ${data} == +${data})`) ++ .assign(coerced, (0, codegen_1._) `+${data}`); ++ return; ++ case "integer": ++ gen ++ .elseIf((0, codegen_1._) `${dataType} === "boolean" || ${data} === null ++ || (${dataType} === "string" && ${data} && ${data} == +${data} && !(${data} % 1))`) ++ .assign(coerced, (0, codegen_1._) `+${data}`); ++ return; ++ case "boolean": ++ gen ++ .elseIf((0, codegen_1._) `${data} === "false" || ${data} === 0 || ${data} === null`) ++ .assign(coerced, false) ++ .elseIf((0, codegen_1._) `${data} === "true" || ${data} === 1`) ++ .assign(coerced, true); ++ return; ++ case "null": ++ gen.elseIf((0, codegen_1._) `${data} === "" || ${data} === 0 || ${data} === false`); ++ gen.assign(coerced, null); ++ return; ++ case "array": ++ gen ++ .elseIf((0, codegen_1._) `${dataType} === "string" || ${dataType} === "number" ++ || ${dataType} === "boolean" || ${data} === null`) ++ .assign(coerced, (0, codegen_1._) `[${data}]`); ++ } ++ } ++} ++function assignParentData({ gen, parentData, parentDataProperty }, expr) { ++ // TODO use gen.property ++ gen.if((0, codegen_1._) `${parentData} !== undefined`, () => gen.assign((0, codegen_1._) `${parentData}[${parentDataProperty}]`, expr)); ++} ++function checkDataType(dataType, data, strictNums, correct = DataType.Correct) { ++ const EQ = correct === DataType.Correct ? codegen_1.operators.EQ : codegen_1.operators.NEQ; ++ let cond; ++ switch (dataType) { ++ case "null": ++ return (0, codegen_1._) `${data} ${EQ} null`; ++ case "array": ++ cond = (0, codegen_1._) `Array.isArray(${data})`; ++ break; ++ case "object": ++ cond = (0, codegen_1._) `${data} && typeof ${data} == "object" && !Array.isArray(${data})`; ++ break; ++ case "integer": ++ cond = numCond((0, codegen_1._) `!(${data} % 1) && !isNaN(${data})`); ++ break; ++ case "number": ++ cond = numCond(); ++ break; ++ default: ++ return (0, codegen_1._) `typeof ${data} ${EQ} ${dataType}`; ++ } ++ return correct === DataType.Correct ? cond : (0, codegen_1.not)(cond); ++ function numCond(_cond = codegen_1.nil) { ++ return (0, codegen_1.and)((0, codegen_1._) `typeof ${data} == "number"`, _cond, strictNums ? (0, codegen_1._) `isFinite(${data})` : codegen_1.nil); ++ } ++} ++exports.checkDataType = checkDataType; ++function checkDataTypes(dataTypes, data, strictNums, correct) { ++ if (dataTypes.length === 1) { ++ return checkDataType(dataTypes[0], data, strictNums, correct); ++ } ++ let cond; ++ const types = (0, util_1.toHash)(dataTypes); ++ if (types.array && types.object) { ++ const notObj = (0, codegen_1._) `typeof ${data} != "object"`; ++ cond = types.null ? notObj : (0, codegen_1._) `!${data} || ${notObj}`; ++ delete types.null; ++ delete types.array; ++ delete types.object; ++ } ++ else { ++ cond = codegen_1.nil; ++ } ++ if (types.number) ++ delete types.integer; ++ for (const t in types) ++ cond = (0, codegen_1.and)(cond, checkDataType(t, data, strictNums, correct)); ++ return cond; ++} ++exports.checkDataTypes = checkDataTypes; ++const typeError = { ++ message: ({ schema }) => `must be ${schema}`, ++ params: ({ schema, schemaValue }) => typeof schema == "string" ? (0, codegen_1._) `{type: ${schema}}` : (0, codegen_1._) `{type: ${schemaValue}}`, ++}; ++function reportTypeError(it) { ++ const cxt = getTypeErrorContext(it); ++ (0, errors_1.reportError)(cxt, typeError); ++} ++exports.reportTypeError = reportTypeError; ++function getTypeErrorContext(it) { ++ const { gen, data, schema } = it; ++ const schemaCode = (0, util_1.schemaRefOrVal)(it, schema, "type"); ++ return { ++ gen, ++ keyword: "type", ++ data, ++ schema: schema.type, ++ schemaCode, ++ schemaValue: schemaCode, ++ parentSchema: schema, ++ params: {}, ++ it, ++ }; ++} ++//# sourceMappingURL=dataType.js.map +\ No newline at end of file +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 eaa2838..02ad708 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 17a0b51..bc54aad 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 = (0, codegen_1._) `typeof ${data} == "number"`; +diff --git a/node_modules/ajv/dist/vocabularies/jtd/type.js.orig b/node_modules/ajv/dist/vocabularies/jtd/type.js.orig +new file mode 100644 +index 0000000..17a0b51 +--- /dev/null ++++ b/node_modules/ajv/dist/vocabularies/jtd/type.js.orig +@@ -0,0 +1,69 @@ ++"use strict"; ++Object.defineProperty(exports, "__esModule", { value: true }); ++exports.intRange = void 0; ++const codegen_1 = require("../../compile/codegen"); ++const timestamp_1 = require("../../runtime/timestamp"); ++const util_1 = require("../../compile/util"); ++const metadata_1 = require("./metadata"); ++const error_1 = require("./error"); ++exports.intRange = { ++ int8: [-128, 127, 3], ++ uint8: [0, 255, 3], ++ int16: [-32768, 32767, 5], ++ uint16: [0, 65535, 5], ++ int32: [-2147483648, 2147483647, 10], ++ uint32: [0, 4294967295, 10], ++}; ++const error = { ++ message: (cxt) => (0, error_1.typeErrorMessage)(cxt, cxt.schema), ++ params: (cxt) => (0, error_1.typeErrorParams)(cxt, cxt.schema), ++}; ++function timestampCode(cxt) { ++ const { gen, data, it } = cxt; ++ const { timestamp, allowDate } = it.opts; ++ if (timestamp === "date") ++ return (0, codegen_1._) `${data} instanceof Date `; ++ const vts = (0, util_1.useFunc)(gen, timestamp_1.default); ++ const allowDateArg = allowDate ? (0, codegen_1._) `, true` : codegen_1.nil; ++ const validString = (0, codegen_1._) `typeof ${data} == "string" && ${vts}(${data}${allowDateArg})`; ++ return timestamp === "string" ? validString : (0, codegen_1.or)((0, codegen_1._) `${data} instanceof Date`, validString); ++} ++const def = { ++ keyword: "type", ++ schemaType: "string", ++ error, ++ code(cxt) { ++ (0, metadata_1.checkMetadata)(cxt); ++ const { data, schema, parentSchema, it } = cxt; ++ let cond; ++ switch (schema) { ++ case "boolean": ++ case "string": ++ cond = (0, codegen_1._) `typeof ${data} == ${schema}`; ++ break; ++ case "timestamp": { ++ cond = timestampCode(cxt); ++ break; ++ } ++ case "float32": ++ case "float64": ++ cond = (0, codegen_1._) `typeof ${data} == "number"`; ++ break; ++ default: { ++ const sch = schema; ++ cond = (0, codegen_1._) `typeof ${data} == "number" && isFinite(${data}) && !(${data} % 1)`; ++ if (!it.opts.int32range && (sch === "int32" || sch === "uint32")) { ++ if (sch === "uint32") ++ cond = (0, codegen_1._) `${cond} && ${data} >= 0`; ++ } ++ else { ++ const [min, max] = exports.intRange[sch]; ++ cond = (0, codegen_1._) `${cond} && ${data} >= ${min} && ${data} <= ${max}`; ++ } ++ } ++ } ++ cxt.pass(parentSchema.nullable ? (0, codegen_1.or)((0, codegen_1._) `${data} === null`, cond) : cond); ++ }, ++}; ++exports.default = def; ++//# sourceMappingURL=type.js.map +\ No newline at end of file diff --git a/patches/ajv+8.6.2.patch b/patches/ajv+8.6.2.patch deleted file mode 100644 index 3f54881b..00000000 --- a/patches/ajv+8.6.2.patch +++ /dev/null @@ -1,249 +0,0 @@ -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"`; \ No newline at end of file