diff --git a/.idea/runConfigurations/Start_Gateway.xml b/.idea/runConfigurations/Start_Gateway.xml
index 884158b..e3590fa 100644
--- a/.idea/runConfigurations/Start_Gateway.xml
+++ b/.idea/runConfigurations/Start_Gateway.xml
@@ -5,7 +5,7 @@
-
+
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 8bf9617..3358505 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -111,6 +111,7 @@
@@ -118,7 +119,7 @@
-
+
diff --git a/package-lock.json b/package-lock.json
index bd4bc74..f166d7e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -11,6 +11,7 @@
"license": "AGPL-3.0-only",
"dependencies": {
"@aws-sdk/client-s3": "^3.911.0",
+ "@toondepauw/node-zstd": "^1.2.0",
"ajv": "^8.17.1",
"ajv-formats": "^3.0.1",
"amqplib": "^0.10.9",
@@ -41,10 +42,12 @@
"murmurhash-js": "^1.0.0",
"node-2fa": "^2.0.3",
"node-fetch-commonjs": "^3.3.2",
+ "pg": "^8.16.3",
"picocolors": "^1.1.1",
"probe-image-size": "^7.2.3",
"proxy-agent": "^6.5.0",
"reflect-metadata": "^0.2.2",
+ "sqlite3": "^5.1.7",
"tslib": "^2.8.1",
"typeorm": "^0.3.27",
"typescript-json-schema": "^0.65.1",
@@ -89,9 +92,7 @@
"jimp": "^1.6.0",
"mailgun.js": "^12.1.1",
"node-mailjet": "^6.0.9",
- "nodemailer": "^7.0.9",
- "pg": "^8.16.3",
- "sqlite3": "^5.1.7"
+ "nodemailer": "^7.0.9"
}
},
"node_modules/@aws-crypto/crc32": {
@@ -2945,6 +2946,153 @@
"integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==",
"license": "MIT"
},
+ "node_modules/@toondepauw/node-zstd": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/@toondepauw/node-zstd/-/node-zstd-1.2.0.tgz",
+ "integrity": "sha512-vVDvPUstF9gKEX+Kqp654bL+4UNus6pkmY8mlcJQpIw/Sn6sO9fl1PEwxB0d0unH5PmVfBUicf1lOXu74OLrCg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 14"
+ },
+ "optionalDependencies": {
+ "@toondepauw/node-zstd-darwin-arm64": "1.2.0",
+ "@toondepauw/node-zstd-darwin-x64": "1.2.0",
+ "@toondepauw/node-zstd-freebsd-x64": "1.2.0",
+ "@toondepauw/node-zstd-linux-arm64-gnu": "1.2.0",
+ "@toondepauw/node-zstd-linux-arm64-musl": "1.2.0",
+ "@toondepauw/node-zstd-linux-x64-gnu": "1.2.0",
+ "@toondepauw/node-zstd-linux-x64-musl": "1.2.0",
+ "@toondepauw/node-zstd-win32-x64-msvc": "1.2.0"
+ }
+ },
+ "node_modules/@toondepauw/node-zstd-darwin-arm64": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/@toondepauw/node-zstd-darwin-arm64/-/node-zstd-darwin-arm64-1.2.0.tgz",
+ "integrity": "sha512-fdBGlRSrf19M1+IJ98aJCLK6/HKQRnRlhE5i6EZ7kVfD2r6h5Bq9NqHAmQ5MgwtmfB9VMmiIrQAMIxKVeT54pg==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">= 14"
+ }
+ },
+ "node_modules/@toondepauw/node-zstd-darwin-x64": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/@toondepauw/node-zstd-darwin-x64/-/node-zstd-darwin-x64-1.2.0.tgz",
+ "integrity": "sha512-ZVu4zkQUgCQ8z1lLd7/LZzIYDKL48tPguIN8L4SRfLuWWlTq2/4OT6AmchztDbe5soLCDuw64t5X5otDvgsGJA==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">= 14"
+ }
+ },
+ "node_modules/@toondepauw/node-zstd-freebsd-x64": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/@toondepauw/node-zstd-freebsd-x64/-/node-zstd-freebsd-x64-1.2.0.tgz",
+ "integrity": "sha512-kDK+l3uP7htiWvM/klY32siEGIBk3K5Da4/DcXV2q/Vp+Ph86FWpQRzC46wJIpJB60xEU67pxFGLBH/8/RB02g==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">= 14"
+ }
+ },
+ "node_modules/@toondepauw/node-zstd-linux-arm64-gnu": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/@toondepauw/node-zstd-linux-arm64-gnu/-/node-zstd-linux-arm64-gnu-1.2.0.tgz",
+ "integrity": "sha512-KteUWam7McA0moNiRgu7KSgPu3FE+KXuh3ObqWoco5JK53Sp4Pgr/q1IYsdN6TYYbgJMkJpof62NIbyi6tnVfg==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 14"
+ }
+ },
+ "node_modules/@toondepauw/node-zstd-linux-arm64-musl": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/@toondepauw/node-zstd-linux-arm64-musl/-/node-zstd-linux-arm64-musl-1.2.0.tgz",
+ "integrity": "sha512-KjbGOXvPmorhWGD4kEVjdBz/gJgUOw1Eu0xziBwsq03URrI0XSDAY6YiJZpZtGnSjm7XonEpnBZcVwXH1HZz3Q==",
+ "cpu": [
+ "arm64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 14"
+ }
+ },
+ "node_modules/@toondepauw/node-zstd-linux-x64-gnu": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/@toondepauw/node-zstd-linux-x64-gnu/-/node-zstd-linux-x64-gnu-1.2.0.tgz",
+ "integrity": "sha512-qNJDZGd/jplK/1J+8V87dYdrviAxNt1iwI/SQ0JR3HTz5Jdbu+BnVB9oMklCc/bGWa8zTkiZkl/EwA3gtbpo+Q==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 14"
+ }
+ },
+ "node_modules/@toondepauw/node-zstd-linux-x64-musl": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/@toondepauw/node-zstd-linux-x64-musl/-/node-zstd-linux-x64-musl-1.2.0.tgz",
+ "integrity": "sha512-Cw1qnMXde8caitDMbk0vWrqnVHTSK+JB/Dp3XnZghQjBrD7JLj2qNzh0eTkxNFa+nijbo8HyyslWGswCugYZCw==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 14"
+ }
+ },
+ "node_modules/@toondepauw/node-zstd-win32-x64-msvc": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/@toondepauw/node-zstd-win32-x64-msvc/-/node-zstd-win32-x64-msvc-1.2.0.tgz",
+ "integrity": "sha512-7cD2/R7DLZHMxHTsQNtOX3vJCT4qd74a3nWjYYthJ89gqXwwEoC8BwttQxvHd0qCZ3S/cZ/BYoTikXMwMNmCEg==",
+ "cpu": [
+ "x64"
+ ],
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 14"
+ }
+ },
"node_modules/@tootallnate/once": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz",
@@ -3049,6 +3197,7 @@
"integrity": "sha512-wGA0NX93b19/dZC1J18tKWVIYWyyF2ZjT9vin/NRu0qzzvfVzWjs04iq2rQ3H65vCTQYlRqs3YHfY7zjdV+9Kw==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"@types/body-parser": "*",
"@types/express-serve-static-core": "^5.0.0",
@@ -3172,6 +3321,7 @@
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.7.2.tgz",
"integrity": "sha512-/NbVmcGTP+lj5oa4yiYxxeBjRivKQ5Ns1eSZeB99ExsEQ6rX5XYU1Zy/gGxY/ilqtD4Etx9mKyrPxZRetiahhA==",
"license": "MIT",
+ "peer": true,
"dependencies": {
"undici-types": "~7.14.0"
}
@@ -3331,6 +3481,7 @@
"integrity": "sha512-6JSSaBZmsKvEkbRUkf7Zj7dru/8ZCrJxAqArcLaVMee5907JdtEbKGsZ7zNiIm/UAkpGUkaSMZEXShnN2D1HZA==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"@typescript-eslint/scope-manager": "8.46.1",
"@typescript-eslint/types": "8.46.1",
@@ -3606,6 +3757,7 @@
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz",
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
"license": "MIT",
+ "peer": true,
"bin": {
"acorn": "bin/acorn"
},
@@ -3977,7 +4129,6 @@
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
"integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
"license": "MIT",
- "optional": true,
"dependencies": {
"file-uri-to-path": "1.0.0"
}
@@ -3987,7 +4138,6 @@
"resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
"integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
"license": "MIT",
- "optional": true,
"dependencies": {
"buffer": "^5.5.0",
"inherits": "^2.0.4",
@@ -4075,7 +4225,6 @@
}
],
"license": "MIT",
- "optional": true,
"dependencies": {
"base64-js": "^1.3.1",
"ieee754": "^1.1.13"
@@ -4331,7 +4480,6 @@
"resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz",
"integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==",
"license": "ISC",
- "optional": true,
"engines": {
"node": ">=10"
}
@@ -4562,7 +4710,6 @@
"resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz",
"integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==",
"license": "MIT",
- "optional": true,
"dependencies": {
"mimic-response": "^3.1.0"
},
@@ -4592,7 +4739,6 @@
"resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
"integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
"license": "MIT",
- "optional": true,
"engines": {
"node": ">=4.0.0"
}
@@ -4675,7 +4821,6 @@
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
"integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
"license": "Apache-2.0",
- "optional": true,
"engines": {
"node": ">=8"
}
@@ -4824,6 +4969,16 @@
"node": ">= 0.8"
}
},
+ "node_modules/encoding": {
+ "version": "0.1.13",
+ "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz",
+ "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==",
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "iconv-lite": "^0.6.2"
+ }
+ },
"node_modules/encoding-sniffer": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/encoding-sniffer/-/encoding-sniffer-0.2.1.tgz",
@@ -4842,7 +4997,6 @@
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz",
"integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==",
"license": "MIT",
- "optional": true,
"dependencies": {
"once": "^1.4.0"
}
@@ -4976,6 +5130,7 @@
"integrity": "sha512-XyLmROnACWqSxiGYArdef1fItQd47weqB7iwtfr9JHwRrqIXZdcFMvvEcL9xHCmL0SNsOvF0c42lWyM1U5dgig==",
"dev": true,
"license": "MIT",
+ "peer": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.8.0",
"@eslint-community/regexpp": "^4.12.1",
@@ -5252,7 +5407,6 @@
"resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz",
"integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==",
"license": "(MIT OR WTFPL)",
- "optional": true,
"engines": {
"node": ">=6"
}
@@ -5472,8 +5626,7 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
- "license": "MIT",
- "optional": true
+ "license": "MIT"
},
"node_modules/fill-range": {
"version": "7.1.1",
@@ -5666,15 +5819,13 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
"integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==",
- "license": "MIT",
- "optional": true
+ "license": "MIT"
},
"node_modules/fs-minipass": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz",
"integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==",
"license": "ISC",
- "optional": true,
"dependencies": {
"minipass": "^3.0.0"
},
@@ -5794,8 +5945,7 @@
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz",
"integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==",
- "license": "MIT",
- "optional": true
+ "license": "MIT"
},
"node_modules/glob": {
"version": "7.2.3",
@@ -6242,8 +6392,7 @@
"version": "1.3.8",
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==",
- "license": "ISC",
- "optional": true
+ "license": "ISC"
},
"node_modules/ip-address": {
"version": "10.0.1",
@@ -6830,7 +6979,6 @@
"resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz",
"integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==",
"license": "MIT",
- "optional": true,
"engines": {
"node": ">=10"
},
@@ -6864,7 +7012,6 @@
"resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
"integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
"license": "ISC",
- "optional": true,
"dependencies": {
"yallist": "^4.0.0"
},
@@ -6947,7 +7094,6 @@
"resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz",
"integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==",
"license": "MIT",
- "optional": true,
"dependencies": {
"minipass": "^3.0.0",
"yallist": "^4.0.0"
@@ -6972,8 +7118,7 @@
"version": "0.5.3",
"resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
"integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==",
- "license": "MIT",
- "optional": true
+ "license": "MIT"
},
"node_modules/module-alias": {
"version": "2.2.3",
@@ -7111,8 +7256,7 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-2.0.0.tgz",
"integrity": "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA==",
- "license": "MIT",
- "optional": true
+ "license": "MIT"
},
"node_modules/natural-compare": {
"version": "1.4.0",
@@ -7194,7 +7338,6 @@
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.78.0.tgz",
"integrity": "sha512-E2wEyrgX/CqvicaQYU3Ze1PFGjc4QYPGsjUrlYkqAE0WjHEZwgOsGMPMzkMse4LjJbDmaEuDX3CM036j5K2DSQ==",
"license": "MIT",
- "optional": true,
"dependencies": {
"semver": "^7.3.5"
},
@@ -7828,7 +7971,7 @@
"resolved": "https://registry.npmjs.org/pg/-/pg-8.16.3.tgz",
"integrity": "sha512-enxc1h0jA/aq5oSDMvqyW3q89ra6XIIDZgCX9vkMrnz5DFTw/Ny3Li2lFQ+pt3L6MCgm/5o2o8HW9hiJji+xvw==",
"license": "MIT",
- "optional": true,
+ "peer": true,
"dependencies": {
"pg-connection-string": "^2.9.1",
"pg-pool": "^3.10.1",
@@ -7862,15 +8005,13 @@
"version": "2.9.1",
"resolved": "https://registry.npmjs.org/pg-connection-string/-/pg-connection-string-2.9.1.tgz",
"integrity": "sha512-nkc6NpDcvPVpZXxrreI/FOtX3XemeLl8E0qFr6F2Lrm/I8WOnaWNhIPK2Z7OHpw7gh5XJThi6j6ppgNoaT1w4w==",
- "license": "MIT",
- "optional": true
+ "license": "MIT"
},
"node_modules/pg-int8": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/pg-int8/-/pg-int8-1.0.1.tgz",
"integrity": "sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==",
"license": "ISC",
- "optional": true,
"engines": {
"node": ">=4.0.0"
}
@@ -7880,7 +8021,6 @@
"resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.10.1.tgz",
"integrity": "sha512-Tu8jMlcX+9d8+QVzKIvM/uJtp07PKr82IUOYEphaWcoBhIYkoHpLXN3qO59nAI11ripznDsEzEv8nUxBVWajGg==",
"license": "MIT",
- "optional": true,
"peerDependencies": {
"pg": ">=8.0"
}
@@ -7889,15 +8029,13 @@
"version": "1.10.3",
"resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.10.3.tgz",
"integrity": "sha512-6DIBgBQaTKDJyxnXaLiLR8wBpQQcGWuAESkRBX/t6OwA8YsqP+iVSiond2EDy6Y/dsGk8rh/jtax3js5NeV7JQ==",
- "license": "MIT",
- "optional": true
+ "license": "MIT"
},
"node_modules/pg-types": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/pg-types/-/pg-types-2.2.0.tgz",
"integrity": "sha512-qTAAlrEsl8s4OiEQY69wDvcMIdQN6wdz5ojQiOy6YRMuynxenON0O5oCpJI6lshc6scgAY8qvJ2On/p+CXY0GA==",
"license": "MIT",
- "optional": true,
"dependencies": {
"pg-int8": "1.0.1",
"postgres-array": "~2.0.0",
@@ -7914,7 +8052,6 @@
"resolved": "https://registry.npmjs.org/pgpass/-/pgpass-1.0.5.tgz",
"integrity": "sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==",
"license": "MIT",
- "optional": true,
"dependencies": {
"split2": "^4.1.0"
}
@@ -8001,7 +8138,6 @@
"resolved": "https://registry.npmjs.org/postgres-array/-/postgres-array-2.0.0.tgz",
"integrity": "sha512-VpZrUqU5A69eQyW2c5CA1jtLecCsN2U/bD6VilrFDWq5+5UIEVO7nazS3TEcHf1zuPYO/sqGvUvW62g86RXZuA==",
"license": "MIT",
- "optional": true,
"engines": {
"node": ">=4"
}
@@ -8011,7 +8147,6 @@
"resolved": "https://registry.npmjs.org/postgres-bytea/-/postgres-bytea-1.0.0.tgz",
"integrity": "sha512-xy3pmLuQqRBZBXDULy7KbaitYqLcmxigw14Q5sj8QBVLqEwXfeybIKVWiqAXTlcvdvb0+xkOtDbfQMOf4lST1w==",
"license": "MIT",
- "optional": true,
"engines": {
"node": ">=0.10.0"
}
@@ -8021,7 +8156,6 @@
"resolved": "https://registry.npmjs.org/postgres-date/-/postgres-date-1.0.7.tgz",
"integrity": "sha512-suDmjLVQg78nMK2UZ454hAG+OAW+HQPZ6n++TNDUX+L0+uUlLywnoxJKDou51Zm+zTCjrCl0Nq6J9C5hP9vK/Q==",
"license": "MIT",
- "optional": true,
"engines": {
"node": ">=0.10.0"
}
@@ -8031,7 +8165,6 @@
"resolved": "https://registry.npmjs.org/postgres-interval/-/postgres-interval-1.2.0.tgz",
"integrity": "sha512-9ZhXKM/rw350N1ovuWHbGxnGh/SNJ4cnxHiM0rxE4VN41wsg8P8zWn9hv/buK00RP4WvlOyr/RBDiptyxVbkZQ==",
"license": "MIT",
- "optional": true,
"dependencies": {
"xtend": "^4.0.0"
},
@@ -8044,7 +8177,6 @@
"resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.3.tgz",
"integrity": "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==",
"license": "MIT",
- "optional": true,
"dependencies": {
"detect-libc": "^2.0.0",
"expand-template": "^2.0.3",
@@ -8082,6 +8214,7 @@
"integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==",
"dev": true,
"license": "MIT",
+ "peer": true,
"bin": {
"prettier": "bin/prettier.cjs"
},
@@ -8250,7 +8383,6 @@
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.3.tgz",
"integrity": "sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==",
"license": "MIT",
- "optional": true,
"dependencies": {
"end-of-stream": "^1.1.0",
"once": "^1.3.1"
@@ -8380,7 +8512,6 @@
"resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
"integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==",
"license": "(BSD-2-Clause OR MIT OR Apache-2.0)",
- "optional": true,
"dependencies": {
"deep-extend": "^0.6.0",
"ini": "~1.3.0",
@@ -8396,7 +8527,6 @@
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
"integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==",
"license": "MIT",
- "optional": true,
"engines": {
"node": ">=0.10.0"
}
@@ -8478,7 +8608,8 @@
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz",
"integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==",
- "license": "Apache-2.0"
+ "license": "Apache-2.0",
+ "peer": true
},
"node_modules/require-directory": {
"version": "2.1.1",
@@ -8850,8 +8981,7 @@
"url": "https://feross.org/support"
}
],
- "license": "MIT",
- "optional": true
+ "license": "MIT"
},
"node_modules/simple-get": {
"version": "4.0.1",
@@ -8872,7 +9002,6 @@
}
],
"license": "MIT",
- "optional": true,
"dependencies": {
"decompress-response": "^6.0.0",
"once": "^1.3.1",
@@ -8951,7 +9080,6 @@
"resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz",
"integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==",
"license": "ISC",
- "optional": true,
"engines": {
"node": ">= 10.x"
}
@@ -8978,7 +9106,6 @@
"integrity": "sha512-GGIyOiFaG+TUra3JIfkI/zGP8yZYLPQ0pl1bH+ODjiX57sPhrLU5sQJn1y9bDKZUFYkX1crlrPfSYt0BKKdkog==",
"hasInstallScript": true,
"license": "BSD-3-Clause",
- "optional": true,
"dependencies": {
"bindings": "^1.5.0",
"node-addon-api": "^7.0.0",
@@ -9001,8 +9128,7 @@
"version": "7.1.1",
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz",
"integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==",
- "license": "MIT",
- "optional": true
+ "license": "MIT"
},
"node_modules/ssri": {
"version": "8.0.1",
@@ -9180,7 +9306,6 @@
"resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz",
"integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==",
"license": "ISC",
- "optional": true,
"dependencies": {
"chownr": "^2.0.0",
"fs-minipass": "^2.0.0",
@@ -9198,7 +9323,6 @@
"resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.4.tgz",
"integrity": "sha512-mDAjwmZdh7LTT6pNleZ05Yt65HC3E+NiQzl672vQG38jIrehtJk/J3mNwIg+vShQPcLF/LV7CMnDW6vjj6sfYQ==",
"license": "MIT",
- "optional": true,
"dependencies": {
"chownr": "^1.1.1",
"mkdirp-classic": "^0.5.2",
@@ -9210,15 +9334,13 @@
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz",
"integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==",
- "license": "ISC",
- "optional": true
+ "license": "ISC"
},
"node_modules/tar-stream": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz",
"integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==",
"license": "MIT",
- "optional": true,
"dependencies": {
"bl": "^4.0.3",
"end-of-stream": "^1.4.1",
@@ -9235,7 +9357,6 @@
"resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz",
"integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==",
"license": "ISC",
- "optional": true,
"engines": {
"node": ">=8"
}
@@ -9245,7 +9366,6 @@
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
"license": "MIT",
- "optional": true,
"bin": {
"mkdirp": "bin/cmd.js"
},
@@ -9372,6 +9492,7 @@
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz",
"integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==",
"license": "MIT",
+ "peer": true,
"dependencies": {
"@cspotcode/source-map-support": "^0.8.0",
"@tsconfig/node10": "^1.0.7",
@@ -9421,7 +9542,6 @@
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
"integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==",
"license": "Apache-2.0",
- "optional": true,
"dependencies": {
"safe-buffer": "^5.0.1"
},
@@ -9672,6 +9792,7 @@
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
"license": "Apache-2.0",
+ "peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
@@ -10095,8 +10216,7 @@
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
- "license": "ISC",
- "optional": true
+ "license": "ISC"
},
"node_modules/yargs": {
"version": "17.7.2",
diff --git a/package.json b/package.json
index 008d500..f9a4a58 100644
--- a/package.json
+++ b/package.json
@@ -72,6 +72,7 @@
},
"dependencies": {
"@aws-sdk/client-s3": "^3.911.0",
+ "@toondepauw/node-zstd": "^1.2.0",
"ajv": "^8.17.1",
"ajv-formats": "^3.0.1",
"amqplib": "^0.10.9",
@@ -102,10 +103,12 @@
"murmurhash-js": "^1.0.0",
"node-2fa": "^2.0.3",
"node-fetch-commonjs": "^3.3.2",
+ "pg": "^8.16.3",
"picocolors": "^1.1.1",
"probe-image-size": "^7.2.3",
"proxy-agent": "^6.5.0",
"reflect-metadata": "^0.2.2",
+ "sqlite3": "^5.1.7",
"tslib": "^2.8.1",
"typeorm": "^0.3.27",
"typescript-json-schema": "^0.65.1",
@@ -127,8 +130,6 @@
"jimp": "^1.6.0",
"mailgun.js": "^12.1.1",
"node-mailjet": "^6.0.9",
- "nodemailer": "^7.0.9",
- "pg": "^8.16.3",
- "sqlite3": "^5.1.7"
+ "nodemailer": "^7.0.9"
}
}
diff --git a/src/gateway/events/Connection.ts b/src/gateway/events/Connection.ts
index b187019..bc74dee 100644
--- a/src/gateway/events/Connection.ts
+++ b/src/gateway/events/Connection.ts
@@ -28,7 +28,8 @@
import { Deflate, Inflate } from "fast-zlib";
import { URL } from "url";
import { Config, ErlpackType } from "@spacebar/util";
-// import zlib from "node:zlib";
+import zlib from "node:zlib";
+import { Decoder, Encoder } from "@toondepauw/node-zstd";
let erlpack: ErlpackType | null = null;
try {
@@ -108,7 +109,7 @@
return socket.close(CLOSECODES.Decode_error);
if (socket.encoding === "etf" && !erlpack)
- throw new Error("Erlpack is not installed: 'npm i erlpack'");
+ throw new Error("Erlpack is not installed: 'npm i @yukikaze-bot/erlpack'");
socket.version = Number(searchParams.get("version")) || 8;
if (socket.version != 8)
@@ -121,11 +122,8 @@
socket.deflate = new Deflate();
socket.inflate = new Inflate();
} else if (socket.compress === "zstd-stream") {
- // TODO
- return socket.close(
- CLOSECODES.Decode_error
- );
-
+ socket.zstdEncoder = new Encoder(6);
+ socket.zstdDecoder = new Decoder();
} else {
return socket.close(CLOSECODES.Decode_error);
}
diff --git a/src/gateway/events/Message.ts b/src/gateway/events/Message.ts
index 6fb222b..2987f46 100644
--- a/src/gateway/events/Message.ts
+++ b/src/gateway/events/Message.ts
@@ -45,9 +45,15 @@
) {
data = bigIntJson.parse(buffer.toString());
} else if (this.encoding === "json" && buffer instanceof Buffer) {
- if (this.inflate) {
+ if (this.compress === "zlib-stream") {
try {
- buffer = this.inflate.process(buffer);
+ buffer = this.inflate!.process(buffer);
+ } catch {
+ buffer = buffer.toString();
+ }
+ } else if (this.compress === "zstd-stream") {
+ try {
+ buffer = await this.zstdDecoder!.decode(buffer);
} catch {
buffer = buffer.toString();
}
diff --git a/src/gateway/util/Send.ts b/src/gateway/util/Send.ts
index 9b1eef6..cee3aa8 100644
--- a/src/gateway/util/Send.ts
+++ b/src/gateway/util/Send.ts
@@ -43,22 +43,20 @@
return json;
};
-export function Send(socket: WebSocket, data: Payload) {
+export async function Send(socket: WebSocket, data: Payload) {
if (process.env.WS_VERBOSE)
console.log(`[Websocket] Outgoing message: ${JSON.stringify(data)}`);
if (process.env.WS_DUMP) {
const id = socket.session_id || "unknown";
- (async () => {
- await fs.mkdir(path.join("dump", id), {
- recursive: true,
- });
- await fs.writeFile(
- path.join("dump", id, `${Date.now()}.out.json`),
- JSON.stringify(data, null, 2),
- );
- })();
+ await fs.mkdir(path.join("dump", id), {
+ recursive: true,
+ });
+ await fs.writeFile(
+ path.join("dump", id, `${Date.now()}.out.json`),
+ JSON.stringify(data, null, 2),
+ );
}
let buffer: Buffer | string;
@@ -71,9 +69,15 @@
else if (socket.encoding === "json")
buffer = JSON.stringify(data, JSONReplacer);
else return;
+
// TODO: compression
- if (socket.deflate) {
- buffer = socket.deflate.process(buffer) as Buffer;
+ if (socket.compress === "zlib-stream") {
+ buffer = socket.deflate!.process(buffer) as Buffer;
+ } else if (socket.compress === "zstd-stream") {
+ if (typeof(buffer) === "string")
+ buffer = Buffer.from(buffer as string);
+
+ buffer = await socket.zstdEncoder!.encode(buffer as Buffer) as Buffer;
}
return new Promise((res, rej) => {
diff --git a/src/gateway/util/WebSocket.ts b/src/gateway/util/WebSocket.ts
index 2f8fa7c..09bae2d 100644
--- a/src/gateway/util/WebSocket.ts
+++ b/src/gateway/util/WebSocket.ts
@@ -20,19 +20,24 @@
import WS from "ws";
import { Deflate, Inflate } from "fast-zlib";
import { Capabilities } from "./Capabilities";
+import { ZstdCompress } from "zlib";
+import { ZstdDecompress } from "node:zlib";
+import { Decoder, Encoder } from "@toondepauw/node-zstd";
export interface WebSocket extends WS {
version: number;
user_id: string;
session_id: string;
encoding: "etf" | "json";
- compress?: "zlib-stream";
+ compress?: "zlib-stream" | "zstd-stream";
ipAddress?: string;
userAgent?: string; // for cdn request signing
shard_count?: bigint;
shard_id?: bigint;
deflate?: Deflate;
inflate?: Inflate;
+ zstdEncoder?: Encoder;
+ zstdDecoder?: Decoder;
heartbeatTimeout: NodeJS.Timeout;
readyTimeout: NodeJS.Timeout;
intents: Intents;