summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-04 11:32:11 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-04 11:32:11 +0200
commitbb76b07f6d51f18c876d94a843f3ceb76841f51d (patch)
tree1aa39a268e54c1b4a20d0dd7b25cc98ac5077def
parentMerge branch 'master' of https://github.com/fosscord/fosscord-api (diff)
downloadserver-bb76b07f6d51f18c876d94a843f3ceb76841f51d.tar.xz
:bug: fix patch-package
-rw-r--r--api/package.json1
-rw-r--r--util/package.json3
-rw-r--r--util/patches/ajv+8.6.2.patch249
-rw-r--r--util/patches/typescript-json-schema+0.50.1.patch14
4 files changed, 2 insertions, 265 deletions
diff --git a/api/package.json b/api/package.json
index 497065cb..79b548e7 100644
--- a/api/package.json
+++ b/api/package.json
@@ -5,6 +5,7 @@
 	"main": "dist/Server.js",
 	"types": "dist/Server.d.ts",
 	"scripts": {
+		"preinstall": "npm i -g patch-package",
 		"test": "npm run build && jest --coverage --verbose --forceExit ./tests",
 		"test:watch": "jest --watch",
 		"start": "npm run build && node dist/start",
diff --git a/util/package.json b/util/package.json
index 6490d754..07623f7a 100644
--- a/util/package.json
+++ b/util/package.json
@@ -6,9 +6,8 @@
 	"types": "dist/index.d.ts",
 	"scripts": {
 		"start": "npm run build && node dist/",
-		"patch": "patch-package",
 		"test": "npm run build && jest",
-		"postinstall": "npm run patch && npm run build",
+		"postinstall": "npm run build",
 		"build": "npx tsc -b ."
 	},
 	"repository": {
diff --git a/util/patches/ajv+8.6.2.patch b/util/patches/ajv+8.6.2.patch
deleted file mode 100644
index e7556179..00000000
--- a/util/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"`;
diff --git a/util/patches/typescript-json-schema+0.50.1.patch b/util/patches/typescript-json-schema+0.50.1.patch
deleted file mode 100644
index a0d479de..00000000
--- a/util/patches/typescript-json-schema+0.50.1.patch
+++ /dev/null
@@ -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";
-             }