diff --git a/packages/eslint-config-custom/package.json b/packages/eslint-config-custom/package.json index 1047d01c..342edef9 100644 --- a/packages/eslint-config-custom/package.json +++ b/packages/eslint-config-custom/package.json @@ -10,10 +10,10 @@ }, "dependencies": { "@typescript-eslint/eslint-plugin": "^5.62.0", - "@typescript-eslint/parser": "^6.5.0", + "@typescript-eslint/parser": "^6.13.1", "eslint": "^8.48.0", "eslint-config-prettier": "^8.10.0", - "eslint-config-turbo": "^1.10.13", + "eslint-config-turbo": "^1.10.16", "eslint-plugin-prettier": "^4.2.1", "prettier": "^2.8.8" }, diff --git a/packages/file-store/package.json b/packages/file-store/package.json index 894a9c0a..2d31d3a9 100644 --- a/packages/file-store/package.json +++ b/packages/file-store/package.json @@ -27,7 +27,7 @@ "@tus/server": "workspace:^", "@types/debug": "^4.1.8", "@types/mocha": "^10.0.1", - "@types/node": "^20.5.7", + "@types/node": "^20.10.4", "eslint": "^8.48.0", "eslint-config-custom": "workspace:*", "mocha": "^10.2.0", diff --git a/packages/gcs-store/package.json b/packages/gcs-store/package.json index 336a6f4d..d641559a 100644 --- a/packages/gcs-store/package.json +++ b/packages/gcs-store/package.json @@ -28,7 +28,7 @@ "@tus/server": "workspace:^", "@types/debug": "^4.1.8", "@types/mocha": "^10.0.1", - "@types/node": "^20.5.7", + "@types/node": "^20.10.4", "eslint": "^8.48.0", "eslint-config-custom": "workspace:*", "mocha": "^10.2.0", diff --git a/packages/s3-store/package.json b/packages/s3-store/package.json index c7b14218..a7b2ff5f 100644 --- a/packages/s3-store/package.json +++ b/packages/s3-store/package.json @@ -28,7 +28,7 @@ "@tus/server": "workspace:^", "@types/debug": "^4.1.8", "@types/mocha": "^10.0.1", - "@types/node": "^20.5.7", + "@types/node": "^20.10.4", "eslint": "^8.48.0", "eslint-config-custom": "workspace:*", "mocha": "^10.2.0", diff --git a/packages/server/README.md b/packages/server/README.md index 62872cf1..4498de0f 100644 --- a/packages/server/README.md +++ b/packages/server/README.md @@ -361,18 +361,18 @@ const server = new Server({ const token = req.headers.authorization; if (!token) { - throw { status_code: 401, body: 'Unauthorized' }) + throw { status_code: 401, body: 'Unauthorized' } } try { const decodedToken = await jwt.verify(token, 'your_secret_key') req.user = decodedToken } catch (error) { - throw { status_code: 401, body: 'Invalid token' }) + throw { status_code: 401, body: 'Invalid token' } } if (req.user.role !== 'admin') { - throw { status_code: 403, body: 'Access denied' }) + throw { status_code: 403, body: 'Access denied' } } }, }); diff --git a/packages/server/package.json b/packages/server/package.json index ae9f0db7..d0d2c95b 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -26,7 +26,7 @@ "devDependencies": { "@types/debug": "^4.1.8", "@types/mocha": "^10.0.1", - "@types/node": "^20.5.7", + "@types/node": "^20.10.4", "@types/sinon": "^10.0.16", "@types/supertest": "^2.0.12", "eslint": "^8.48.0", diff --git a/packages/server/src/handlers/PatchHandler.ts b/packages/server/src/handlers/PatchHandler.ts index 93f8f2e2..a2237103 100644 --- a/packages/server/src/handlers/PatchHandler.ts +++ b/packages/server/src/handlers/PatchHandler.ts @@ -36,6 +36,10 @@ export class PatchHandler extends BaseHandler { throw ERRORS.INVALID_CONTENT_TYPE } + if (this.options.onIncomingRequest) { + await this.options.onIncomingRequest(req, res, id) + } + const lock = await this.acquireLock(req, id, context) let upload: Upload diff --git a/test/package.json b/test/package.json index 422792ec..ba13a060 100644 --- a/test/package.json +++ b/test/package.json @@ -14,7 +14,7 @@ }, "devDependencies": { "@types/mocha": "^10.0.1", - "@types/node": "^20.5.7", + "@types/node": "^20.10.4", "@types/rimraf": "^3.0.2", "@types/sinon": "^10.0.16", "@types/supertest": "^2.0.12", diff --git a/yarn.lock b/yarn.lock index fd8bb4bc..728a1135 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1495,7 +1495,7 @@ __metadata: "@tus/server": "workspace:^" "@types/debug": ^4.1.8 "@types/mocha": ^10.0.1 - "@types/node": ^20.5.7 + "@types/node": ^20.10.4 debug: ^4.3.4 eslint: ^8.48.0 eslint-config-custom: "workspace:*" @@ -1518,7 +1518,7 @@ __metadata: "@tus/server": "workspace:^" "@types/debug": ^4.1.8 "@types/mocha": ^10.0.1 - "@types/node": ^20.5.7 + "@types/node": ^20.10.4 debug: ^4.3.4 eslint: ^8.48.0 eslint-config-custom: "workspace:*" @@ -1539,7 +1539,7 @@ __metadata: "@tus/server": "workspace:^" "@types/debug": ^4.1.8 "@types/mocha": ^10.0.1 - "@types/node": ^20.5.7 + "@types/node": ^20.10.4 debug: ^4.3.4 eslint: ^8.48.0 eslint-config-custom: "workspace:*" @@ -1557,7 +1557,7 @@ __metadata: dependencies: "@types/debug": ^4.1.8 "@types/mocha": ^10.0.1 - "@types/node": ^20.5.7 + "@types/node": ^20.10.4 "@types/sinon": ^10.0.16 "@types/supertest": ^2.0.12 debug: ^4.3.4 @@ -1652,10 +1652,12 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:^20.5.7": - version: 20.5.7 - resolution: "@types/node@npm:20.5.7" - checksum: fc284c8e16ddc04569730d58e87eae349eb1c3dd9020cb79a1862d9d9add6f04e7367a236f3252db8db2572f90278e250f4cd43d27d264972b54394eaba1ed76 +"@types/node@npm:^20.10.4": + version: 20.10.4 + resolution: "@types/node@npm:20.10.4" + dependencies: + undici-types: ~5.26.4 + checksum: 054b296417e771ab524bea63cf3289559c6bdf290d45428f7cc68e9b00030ff7a0ece47b8c99a26b4f47a443919813bcf42beadff2f0bea7d8125fa541d92eb0 languageName: node linkType: hard @@ -1751,21 +1753,21 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/parser@npm:^6.5.0": - version: 6.5.0 - resolution: "@typescript-eslint/parser@npm:6.5.0" +"@typescript-eslint/parser@npm:^6.13.1": + version: 6.13.1 + resolution: "@typescript-eslint/parser@npm:6.13.1" dependencies: - "@typescript-eslint/scope-manager": 6.5.0 - "@typescript-eslint/types": 6.5.0 - "@typescript-eslint/typescript-estree": 6.5.0 - "@typescript-eslint/visitor-keys": 6.5.0 + "@typescript-eslint/scope-manager": 6.13.1 + "@typescript-eslint/types": 6.13.1 + "@typescript-eslint/typescript-estree": 6.13.1 + "@typescript-eslint/visitor-keys": 6.13.1 debug: ^4.3.4 peerDependencies: eslint: ^7.0.0 || ^8.0.0 peerDependenciesMeta: typescript: optional: true - checksum: e9a70886ec2660aee5c77cdff67ba11651eb855b7ecd3ad1e70837fce997d6e6db9dfe1e1eab46a9b2147cbc034ae9c109951f3bc24ce54e78cae669b6bc9c95 + checksum: 58b7fef6f2d02c8f4737f9908a8d335a20bee20dba648233a69f28e7b39237791d2b9fbb818e628dcc053ddf16507b161ace7f1139e093d72365f1270c426de3 languageName: node linkType: hard @@ -1779,13 +1781,13 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:6.5.0": - version: 6.5.0 - resolution: "@typescript-eslint/scope-manager@npm:6.5.0" +"@typescript-eslint/scope-manager@npm:6.13.1": + version: 6.13.1 + resolution: "@typescript-eslint/scope-manager@npm:6.13.1" dependencies: - "@typescript-eslint/types": 6.5.0 - "@typescript-eslint/visitor-keys": 6.5.0 - checksum: 30d78143f68e07d6bd15a147f64cc16830f8a8c8409b37aa7c7d205d7585f3648ec1c5365b3f177b7561971b407f773f6dba83b3b78fa63091045f2d6bbc6b9f + "@typescript-eslint/types": 6.13.1 + "@typescript-eslint/visitor-keys": 6.13.1 + checksum: 109a213f82719e10f8c6a0168f2e105dc1369c7e0c075c1f30af137030fc866a3a585a77ff78a9a3538afc213061c8aedbb4462a91f26cbd90eefbab8b89ea10 languageName: node linkType: hard @@ -1813,10 +1815,10 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/types@npm:6.5.0": - version: 6.5.0 - resolution: "@typescript-eslint/types@npm:6.5.0" - checksum: 950ec16991d71494d10cb752535bbc4395295e3f03a716d53ec55bbb0aaff487aa774cc5002f775ffcc80b9f0e16ac53ecebf7cac1444ca4f7a847b0859ffbfb +"@typescript-eslint/types@npm:6.13.1": + version: 6.13.1 + resolution: "@typescript-eslint/types@npm:6.13.1" + checksum: bb1d52f1646bab9acd3ec874567ffbaaaf7fe4a5f79845bdacbfea46d15698e58d45797da05b08c23f9496a17229b7f2c1363d000fd89ce4e79874fd57ba1d4a languageName: node linkType: hard @@ -1838,12 +1840,12 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:6.5.0": - version: 6.5.0 - resolution: "@typescript-eslint/typescript-estree@npm:6.5.0" +"@typescript-eslint/typescript-estree@npm:6.13.1": + version: 6.13.1 + resolution: "@typescript-eslint/typescript-estree@npm:6.13.1" dependencies: - "@typescript-eslint/types": 6.5.0 - "@typescript-eslint/visitor-keys": 6.5.0 + "@typescript-eslint/types": 6.13.1 + "@typescript-eslint/visitor-keys": 6.13.1 debug: ^4.3.4 globby: ^11.1.0 is-glob: ^4.0.3 @@ -1852,7 +1854,7 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 05717fa1f2609fa5669803191cf309a379c815aaf4fff6850f40560eec8749759c36b288f05cecffd5c1d0be8de1fe414ecfee6ecf99b6ae521baa48c8b58455 + checksum: 09aa0f5cbd60e84df4f58f3d479be352549600b24dbefe75c686ea89252526c52c1c06ce1ae56c0405dd7337002e741c2ba02b71fb1caa3b94a740a70fcc8699 languageName: node linkType: hard @@ -1884,13 +1886,13 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:6.5.0": - version: 6.5.0 - resolution: "@typescript-eslint/visitor-keys@npm:6.5.0" +"@typescript-eslint/visitor-keys@npm:6.13.1": + version: 6.13.1 + resolution: "@typescript-eslint/visitor-keys@npm:6.13.1" dependencies: - "@typescript-eslint/types": 6.5.0 + "@typescript-eslint/types": 6.13.1 eslint-visitor-keys: ^3.4.1 - checksum: 768a02dd0d8aae45708646bb0c51e67da09e71dc101bb0a0e55d7e0c8eadfea2f531acd3035d1ec34bf2380b66188f3fc47c6bef0201eae36b2dcc48d1934442 + checksum: d15d362203a2fe995ea62a59d5b44c15c8fb1fb30ff59dd1542a980f75b3b62035303dfb781d83709921613f6ac8cc5bf57b70f6e20d820aec8b7911f07152e9 languageName: node linkType: hard @@ -2662,10 +2664,10 @@ __metadata: "@types/eslint": ^8.44.2 "@types/prettier": ^2.7.3 "@typescript-eslint/eslint-plugin": ^5.62.0 - "@typescript-eslint/parser": ^6.5.0 + "@typescript-eslint/parser": ^6.13.1 eslint: ^8.48.0 eslint-config-prettier: ^8.10.0 - eslint-config-turbo: ^1.10.13 + eslint-config-turbo: ^1.10.16 eslint-plugin-prettier: ^4.2.1 prettier: ^2.8.8 languageName: unknown @@ -2682,14 +2684,14 @@ __metadata: languageName: node linkType: hard -"eslint-config-turbo@npm:^1.10.13": - version: 1.10.13 - resolution: "eslint-config-turbo@npm:1.10.13" +"eslint-config-turbo@npm:^1.10.16": + version: 1.10.16 + resolution: "eslint-config-turbo@npm:1.10.16" dependencies: - eslint-plugin-turbo: 1.10.13 + eslint-plugin-turbo: 1.10.16 peerDependencies: eslint: ">6.6.0" - checksum: 008f362d361c2d4631f725a412043c122c4f52c392c7209ba57117d34f8aa596c0941dd04b7eb860cb252e4263c6e3ae9e1ee134aef8c4f43c66e2a84fc376d4 + checksum: e5a6ec6d04f21c162f59bd2f3e7e25a311943d94d8130d7d5a7fdea375fa5acfd62918aa34467a5e56ab0f3ca087ea8e117354a5ff631bb38f1fe8a35444ae4b languageName: node linkType: hard @@ -2708,14 +2710,14 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-turbo@npm:1.10.13": - version: 1.10.13 - resolution: "eslint-plugin-turbo@npm:1.10.13" +"eslint-plugin-turbo@npm:1.10.16": + version: 1.10.16 + resolution: "eslint-plugin-turbo@npm:1.10.16" dependencies: dotenv: 16.0.3 peerDependencies: eslint: ">6.6.0" - checksum: 39649fc71e5e1d8169a81a28adcd4850b595bbef01744159ffa32c0dcc211cb6f1dea25d4eef73aa4b57b8064b7c6661b048369046a40b19eaca051f507e5dfb + checksum: 00fdbd2cb956b3e9972c84169bb190bafaa274418989508bf52a5d1b5f7df0e850eb60fc702fedbc34477dcebc3e06450de0b81d8e30b56e061ced850e8cb8e3 languageName: node linkType: hard @@ -4901,7 +4903,7 @@ __metadata: "@tus/s3-store": "workspace:^" "@tus/server": "workspace:^" "@types/mocha": ^10.0.1 - "@types/node": ^20.5.7 + "@types/node": ^20.10.4 "@types/rimraf": ^3.0.2 "@types/sinon": ^10.0.16 "@types/supertest": ^2.0.12 @@ -5168,6 +5170,13 @@ __metadata: languageName: node linkType: hard +"undici-types@npm:~5.26.4": + version: 5.26.5 + resolution: "undici-types@npm:5.26.5" + checksum: 3192ef6f3fd5df652f2dc1cd782b49d6ff14dc98e5dced492aa8a8c65425227da5da6aafe22523c67f035a272c599bb89cfe803c1db6311e44bed3042fc25487 + languageName: node + linkType: hard + "unique-filename@npm:^3.0.0": version: 3.0.0 resolution: "unique-filename@npm:3.0.0"