mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-09 20:22:47 +01:00
most patches arent needed anymore
This commit is contained in:
parent
421290f91a
commit
aaaf019d7e
@ -3,7 +3,7 @@
|
||||
"version": "1.0.0",
|
||||
"description": "A Spacebar server written in Node.js",
|
||||
"scripts": {
|
||||
"prepare": "husky install",
|
||||
"prepare": "husky",
|
||||
"postinstall": "npx patch-package",
|
||||
"start": "node dist/bundle/start.js",
|
||||
"start:api": "node dist/api/start.js",
|
||||
|
@ -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"`;
|
@ -1,39 +0,0 @@
|
||||
diff --git a/node_modules/body-parser/lib/types/json.js b/node_modules/body-parser/lib/types/json.js
|
||||
index c2745be..17c2cfe 100644
|
||||
--- a/node_modules/body-parser/lib/types/json.js
|
||||
+++ b/node_modules/body-parser/lib/types/json.js
|
||||
@@ -18,6 +18,7 @@ var createError = require('http-errors')
|
||||
var debug = require('debug')('body-parser:json')
|
||||
var read = require('../read')
|
||||
var typeis = require('type-is')
|
||||
+var JSONbig = require("json-bigint");
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
@@ -86,7 +87,7 @@ function json (options) {
|
||||
|
||||
try {
|
||||
debug('parse json')
|
||||
- return JSON.parse(body, reviver)
|
||||
+ return JSONbig.parse(body, reviver)
|
||||
} catch (e) {
|
||||
throw normalizeJsonSyntaxError(e, {
|
||||
message: e.message,
|
||||
@@ -157,7 +158,7 @@ function createStrictSyntaxError (str, char) {
|
||||
: ''
|
||||
|
||||
try {
|
||||
- JSON.parse(partial); /* istanbul ignore next */ throw new SyntaxError('strict violation')
|
||||
+ JSONbig.parse(partial); /* istanbul ignore next */ throw new SyntaxError('strict violation')
|
||||
} catch (e) {
|
||||
return normalizeJsonSyntaxError(e, {
|
||||
message: e.message.replace('#', char),
|
||||
@@ -216,7 +217,7 @@ function normalizeJsonSyntaxError (error, obj) {
|
||||
}
|
||||
|
||||
// replace stack before message for Node.js 0.10 and below
|
||||
- error.stack = obj.stack.replace(error.message, obj.message)
|
||||
+ error.stack = obj.stack?.replace(error.message, obj.message)
|
||||
error.message = obj.message
|
||||
|
||||
return error
|
@ -1,55 +0,0 @@
|
||||
diff --git a/node_modules/express/lib/response.js b/node_modules/express/lib/response.js
|
||||
index dd7b3c8..a339896 100644
|
||||
--- a/node_modules/express/lib/response.js
|
||||
+++ b/node_modules/express/lib/response.js
|
||||
@@ -27,7 +27,6 @@ var merge = require('utils-merge');
|
||||
var sign = require('cookie-signature').sign;
|
||||
var normalizeType = require('./utils').normalizeType;
|
||||
var normalizeTypes = require('./utils').normalizeTypes;
|
||||
-var setCharset = require('./utils').setCharset;
|
||||
var cookie = require('cookie');
|
||||
var send = require('send');
|
||||
var extname = path.extname;
|
||||
@@ -54,7 +53,6 @@ module.exports = res
|
||||
* @private
|
||||
*/
|
||||
|
||||
-var charsetRegExp = /;\s*charset\s*=/;
|
||||
var schemaAndHostRegExp = /^(?:[a-zA-Z][a-zA-Z0-9+.-]*:)?\/\/[^\\\/\?]+/;
|
||||
|
||||
/**
|
||||
@@ -165,16 +163,6 @@ res.send = function send(body) {
|
||||
break;
|
||||
}
|
||||
|
||||
- // write strings in utf-8
|
||||
- if (typeof chunk === 'string') {
|
||||
- encoding = 'utf8';
|
||||
- type = this.get('Content-Type');
|
||||
-
|
||||
- // reflect this in content-type
|
||||
- if (typeof type === 'string') {
|
||||
- this.set('Content-Type', setCharset(type, 'utf-8'));
|
||||
- }
|
||||
- }
|
||||
|
||||
// determine if ETag should be generated
|
||||
var etagFn = app.get('etag fn')
|
||||
@@ -781,17 +769,6 @@ res.header = function header(field, val) {
|
||||
? val.map(String)
|
||||
: String(val);
|
||||
|
||||
- // add charset to content-type
|
||||
- if (field.toLowerCase() === 'content-type') {
|
||||
- if (Array.isArray(value)) {
|
||||
- throw new TypeError('Content-Type cannot be set to an Array');
|
||||
- }
|
||||
- if (!charsetRegExp.test(value)) {
|
||||
- var charset = mime.charsets.lookup(value.split(';')[0]);
|
||||
- if (charset) value += '; charset=' + charset.toLowerCase();
|
||||
- }
|
||||
- }
|
||||
-
|
||||
this.setHeader(field, value);
|
||||
} else {
|
||||
for (var key in field) {
|
@ -1,14 +0,0 @@
|
||||
diff --git a/node_modules/typescript-json-schema/dist/typescript-json-schema.js b/node_modules/typescript-json-schema/dist/typescript-json-schema.js
|
||||
index 47e1598..8397b9d 100644
|
||||
--- a/node_modules/typescript-json-schema/dist/typescript-json-schema.js
|
||||
+++ b/node_modules/typescript-json-schema/dist/typescript-json-schema.js
|
||||
@@ -432,6 +432,9 @@ var JsonSchemaGenerator = (function () {
|
||||
else if (flags & ts.TypeFlags.Boolean) {
|
||||
definition.type = "boolean";
|
||||
}
|
||||
+ else if (flags & ts.TypeFlags.BigInt) {
|
||||
+ definition.type = "bigint";
|
||||
+ }
|
||||
else if (flags & ts.TypeFlags.Null) {
|
||||
definition.type = "null";
|
||||
}
|
Loading…
Reference in New Issue
Block a user