From 48ba942a611c919ce8bfc30059ab4b1c144ec92a Mon Sep 17 00:00:00 2001 From: Ayumi Sarah Date: Fri, 21 Apr 2023 17:22:03 +0800 Subject: [PATCH] feat(file): [s3] allow stream file data (#677) --- package-lock.json | 652 +++++++++++++++++++++++++++++++++------------ package.json | 2 +- src/uploader/s3.js | 11 +- 3 files changed, 488 insertions(+), 177 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8d445bef..0148356c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@babel/runtime-corejs3": "^7.18.6", "@leancloud/adapter-types": "^5.0.0", "@leancloud/platform-adapters-browser": "^1.5.3", - "@leancloud/platform-adapters-node": "^1.5.3", + "@leancloud/platform-adapters-node": "^1.6.0", "@leancloud/platform-adapters-weapp": "^1.6.2", "debug": "^3.1.0", "eventemitter3": "^2.0.3", @@ -2334,17 +2334,95 @@ } }, "node_modules/@leancloud/platform-adapters-node": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/@leancloud/platform-adapters-node/-/platform-adapters-node-1.5.3.tgz", - "integrity": "sha512-IHsNTfoDVn1P+/jAwGBn9b6AL4urWVMXOivQe9R+E3l6xFVov/YhCMQzsFllmwzQFoqoHqPb7PkB+6nTKJSKSg==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@leancloud/platform-adapters-node/-/platform-adapters-node-1.6.0.tgz", + "integrity": "sha512-CHvD1nSYOuS+obxGy4u7KstqfN7PM1NG8jCx3LED/8nGshJM11PfzCeocGkLULUaiLg/N/1cGvh4AKX8NmAo9A==", "dependencies": { "@leancloud/adapter-types": "^5.0.0", - "@leancloud/adapters-superagent": "^1.4.3", + "@leancloud/adapter-utils": "^1.2.2", "@types/ws": "^7.2.2", "localstorage-memory": "^1.0.2", + "superagent": "^8.0.9", "ws": "^5.2.2" } }, + "node_modules/@leancloud/platform-adapters-node/node_modules/debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/@leancloud/platform-adapters-node/node_modules/form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/@leancloud/platform-adapters-node/node_modules/formidable": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/formidable/-/formidable-2.1.2.tgz", + "integrity": "sha512-CM3GuJ57US06mlpQ47YcunuUZ9jpm8Vx+P2CGt2j7HpgkKZO/DJYQ0Bobim8G6PFQmK5lOqOOdUXboU+h73A4g==", + "dependencies": { + "dezalgo": "^1.0.4", + "hexoid": "^1.0.0", + "once": "^1.4.0", + "qs": "^6.11.0" + }, + "funding": { + "url": "https://ko-fi.com/tunnckoCore/commissions" + } + }, + "node_modules/@leancloud/platform-adapters-node/node_modules/semver": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", + "integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@leancloud/platform-adapters-node/node_modules/superagent": { + "version": "8.0.9", + "resolved": "https://registry.npmjs.org/superagent/-/superagent-8.0.9.tgz", + "integrity": "sha512-4C7Bh5pyHTvU33KpZgwrNKh/VQnvgtCSqPRfJAUdmrtSYePVzVg4E4OzsrbkhJj9O7SO6Bnv75K/F8XVZT8YHA==", + "dependencies": { + "component-emitter": "^1.3.0", + "cookiejar": "^2.1.4", + "debug": "^4.3.4", + "fast-safe-stringify": "^2.1.1", + "form-data": "^4.0.0", + "formidable": "^2.1.2", + "methods": "^1.1.2", + "mime": "2.6.0", + "qs": "^6.11.0", + "semver": "^7.3.8" + }, + "engines": { + "node": ">=6.4.0 <13 || >=14" + } + }, "node_modules/@leancloud/platform-adapters-weapp": { "version": "1.6.2", "resolved": "https://registry.npmjs.org/@leancloud/platform-adapters-weapp/-/platform-adapters-weapp-1.6.2.tgz", @@ -2748,6 +2826,11 @@ "node": ">=0.10.0" } }, + "node_modules/asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==" + }, "node_modules/ascli": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/ascli/-/ascli-1.0.1.tgz", @@ -4061,9 +4144,9 @@ "dev": true }, "node_modules/cookiejar": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.3.tgz", - "integrity": "sha512-JxbCBUdrfr6AQjOXrxoTvAMJO4HBTUIlBzslcJPAz+/KT8yk53fXun51u+RenNYvad/+Vc2DIz5o9UxlCDymFQ==" + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.4.tgz", + "integrity": "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==" }, "node_modules/copy-descriptor": { "version": "0.1.1", @@ -4439,6 +4522,15 @@ "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=", "dev": true }, + "node_modules/dezalgo": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.4.tgz", + "integrity": "sha512-rXSP0bf+5n0Qonsb+SVVfNfIsimO4HEtmnIpPHY8Q1UCzKlQrDMfdobr8nJOOsRgWCyMRqeSBQzmWUMq7zvVig==", + "dependencies": { + "asap": "^2.0.0", + "wrappy": "1" + } + }, "node_modules/diff": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", @@ -5556,30 +5648,34 @@ }, "node_modules/fsevents/node_modules/abbrev": { "version": "1.1.1", - "extraneous": true, + "dev": true, "inBundle": true, - "license": "ISC" + "license": "ISC", + "optional": true }, "node_modules/fsevents/node_modules/ansi-regex": { "version": "2.1.1", - "extraneous": true, + "dev": true, "inBundle": true, "license": "MIT", + "optional": true, "engines": { "node": ">=0.10.0" } }, "node_modules/fsevents/node_modules/aproba": { "version": "1.2.0", - "extraneous": true, + "dev": true, "inBundle": true, - "license": "ISC" + "license": "ISC", + "optional": true }, "node_modules/fsevents/node_modules/are-we-there-yet": { "version": "1.1.5", - "extraneous": true, + "dev": true, "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "delegates": "^1.0.0", "readable-stream": "^2.0.6" @@ -5587,15 +5683,17 @@ }, "node_modules/fsevents/node_modules/balanced-match": { "version": "1.0.0", - "extraneous": true, + "dev": true, "inBundle": true, - "license": "MIT" + "license": "MIT", + "optional": true }, "node_modules/fsevents/node_modules/brace-expansion": { "version": "1.1.11", - "extraneous": true, + "dev": true, "inBundle": true, "license": "MIT", + "optional": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -5603,66 +5701,75 @@ }, "node_modules/fsevents/node_modules/chownr": { "version": "1.1.1", - "extraneous": true, + "dev": true, "inBundle": true, - "license": "ISC" + "license": "ISC", + "optional": true }, "node_modules/fsevents/node_modules/code-point-at": { "version": "1.1.0", - "extraneous": true, + "dev": true, "inBundle": true, "license": "MIT", + "optional": true, "engines": { "node": ">=0.10.0" } }, "node_modules/fsevents/node_modules/concat-map": { "version": "0.0.1", - "extraneous": true, + "dev": true, "inBundle": true, - "license": "MIT" + "license": "MIT", + "optional": true }, "node_modules/fsevents/node_modules/console-control-strings": { "version": "1.1.0", - "extraneous": true, + "dev": true, "inBundle": true, - "license": "ISC" + "license": "ISC", + "optional": true }, "node_modules/fsevents/node_modules/core-util-is": { "version": "1.0.2", - "extraneous": true, + "dev": true, "inBundle": true, - "license": "MIT" + "license": "MIT", + "optional": true }, "node_modules/fsevents/node_modules/debug": { "version": "4.1.1", - "extraneous": true, + "dev": true, "inBundle": true, "license": "MIT", + "optional": true, "dependencies": { "ms": "^2.1.1" } }, "node_modules/fsevents/node_modules/deep-extend": { "version": "0.6.0", - "extraneous": true, + "dev": true, "inBundle": true, "license": "MIT", + "optional": true, "engines": { "node": ">=4.0.0" } }, "node_modules/fsevents/node_modules/delegates": { "version": "1.0.0", - "extraneous": true, + "dev": true, "inBundle": true, - "license": "MIT" + "license": "MIT", + "optional": true }, "node_modules/fsevents/node_modules/detect-libc": { "version": "1.0.3", - "extraneous": true, + "dev": true, "inBundle": true, "license": "Apache-2.0", + "optional": true, "bin": { "detect-libc": "bin/detect-libc.js" }, @@ -5672,24 +5779,27 @@ }, "node_modules/fsevents/node_modules/fs-minipass": { "version": "1.2.5", - "extraneous": true, + "dev": true, "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "minipass": "^2.2.1" } }, "node_modules/fsevents/node_modules/fs.realpath": { "version": "1.0.0", - "extraneous": true, + "dev": true, "inBundle": true, - "license": "ISC" + "license": "ISC", + "optional": true }, "node_modules/fsevents/node_modules/gauge": { "version": "2.7.4", - "extraneous": true, + "dev": true, "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "aproba": "^1.0.3", "console-control-strings": "^1.0.0", @@ -5703,9 +5813,10 @@ }, "node_modules/fsevents/node_modules/glob": { "version": "7.1.3", - "extraneous": true, + "dev": true, "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -5720,15 +5831,17 @@ }, "node_modules/fsevents/node_modules/has-unicode": { "version": "2.0.1", - "extraneous": true, + "dev": true, "inBundle": true, - "license": "ISC" + "license": "ISC", + "optional": true }, "node_modules/fsevents/node_modules/iconv-lite": { "version": "0.4.24", - "extraneous": true, + "dev": true, "inBundle": true, "license": "MIT", + "optional": true, "dependencies": { "safer-buffer": ">= 2.1.2 < 3" }, @@ -5738,18 +5851,20 @@ }, "node_modules/fsevents/node_modules/ignore-walk": { "version": "3.0.1", - "extraneous": true, + "dev": true, "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "minimatch": "^3.0.4" } }, "node_modules/fsevents/node_modules/inflight": { "version": "1.0.6", - "extraneous": true, + "dev": true, "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "once": "^1.3.0", "wrappy": "1" @@ -5757,24 +5872,27 @@ }, "node_modules/fsevents/node_modules/inherits": { "version": "2.0.3", - "extraneous": true, + "dev": true, "inBundle": true, - "license": "ISC" + "license": "ISC", + "optional": true }, "node_modules/fsevents/node_modules/ini": { "version": "1.3.5", - "extraneous": true, + "dev": true, "inBundle": true, "license": "ISC", + "optional": true, "engines": { "node": "*" } }, "node_modules/fsevents/node_modules/is-fullwidth-code-point": { "version": "1.0.0", - "extraneous": true, + "dev": true, "inBundle": true, "license": "MIT", + "optional": true, "dependencies": { "number-is-nan": "^1.0.0" }, @@ -5784,15 +5902,17 @@ }, "node_modules/fsevents/node_modules/isarray": { "version": "1.0.0", - "extraneous": true, + "dev": true, "inBundle": true, - "license": "MIT" + "license": "MIT", + "optional": true }, "node_modules/fsevents/node_modules/minimatch": { "version": "3.0.4", - "extraneous": true, + "dev": true, "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -5802,15 +5922,17 @@ }, "node_modules/fsevents/node_modules/minimist": { "version": "0.0.8", - "extraneous": true, + "dev": true, "inBundle": true, - "license": "MIT" + "license": "MIT", + "optional": true }, "node_modules/fsevents/node_modules/minipass": { "version": "2.3.5", - "extraneous": true, + "dev": true, "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -5818,18 +5940,20 @@ }, "node_modules/fsevents/node_modules/minizlib": { "version": "1.2.1", - "extraneous": true, + "dev": true, "inBundle": true, "license": "MIT", + "optional": true, "dependencies": { "minipass": "^2.2.1" } }, "node_modules/fsevents/node_modules/mkdirp": { "version": "0.5.1", - "extraneous": true, + "dev": true, "inBundle": true, "license": "MIT", + "optional": true, "dependencies": { "minimist": "0.0.8" }, @@ -5839,15 +5963,17 @@ }, "node_modules/fsevents/node_modules/ms": { "version": "2.1.1", - "extraneous": true, + "dev": true, "inBundle": true, - "license": "MIT" + "license": "MIT", + "optional": true }, "node_modules/fsevents/node_modules/needle": { "version": "2.3.0", - "extraneous": true, + "dev": true, "inBundle": true, "license": "MIT", + "optional": true, "dependencies": { "debug": "^4.1.0", "iconv-lite": "^0.4.4", @@ -5862,9 +5988,10 @@ }, "node_modules/fsevents/node_modules/node-pre-gyp": { "version": "0.12.0", - "extraneous": true, + "dev": true, "inBundle": true, "license": "BSD-3-Clause", + "optional": true, "dependencies": { "detect-libc": "^1.0.2", "mkdirp": "^0.5.1", @@ -5883,9 +6010,10 @@ }, "node_modules/fsevents/node_modules/nopt": { "version": "4.0.1", - "extraneous": true, + "dev": true, "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "abbrev": "1", "osenv": "^0.1.4" @@ -5896,15 +6024,17 @@ }, "node_modules/fsevents/node_modules/npm-bundled": { "version": "1.0.6", - "extraneous": true, + "dev": true, "inBundle": true, - "license": "ISC" + "license": "ISC", + "optional": true }, "node_modules/fsevents/node_modules/npm-packlist": { "version": "1.4.1", - "extraneous": true, + "dev": true, "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "ignore-walk": "^3.0.1", "npm-bundled": "^1.0.1" @@ -5912,9 +6042,10 @@ }, "node_modules/fsevents/node_modules/npmlog": { "version": "4.1.2", - "extraneous": true, + "dev": true, "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "are-we-there-yet": "~1.1.2", "console-control-strings": "~1.1.0", @@ -5924,54 +6055,60 @@ }, "node_modules/fsevents/node_modules/number-is-nan": { "version": "1.0.1", - "extraneous": true, + "dev": true, "inBundle": true, "license": "MIT", + "optional": true, "engines": { "node": ">=0.10.0" } }, "node_modules/fsevents/node_modules/object-assign": { "version": "4.1.1", - "extraneous": true, + "dev": true, "inBundle": true, "license": "MIT", + "optional": true, "engines": { "node": ">=0.10.0" } }, "node_modules/fsevents/node_modules/once": { "version": "1.4.0", - "extraneous": true, + "dev": true, "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "wrappy": "1" } }, "node_modules/fsevents/node_modules/os-homedir": { "version": "1.0.2", - "extraneous": true, + "dev": true, "inBundle": true, "license": "MIT", + "optional": true, "engines": { "node": ">=0.10.0" } }, "node_modules/fsevents/node_modules/os-tmpdir": { "version": "1.0.2", - "extraneous": true, + "dev": true, "inBundle": true, "license": "MIT", + "optional": true, "engines": { "node": ">=0.10.0" } }, "node_modules/fsevents/node_modules/osenv": { "version": "0.1.5", - "extraneous": true, + "dev": true, "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "os-homedir": "^1.0.0", "os-tmpdir": "^1.0.0" @@ -5979,24 +6116,27 @@ }, "node_modules/fsevents/node_modules/path-is-absolute": { "version": "1.0.1", - "extraneous": true, + "dev": true, "inBundle": true, "license": "MIT", + "optional": true, "engines": { "node": ">=0.10.0" } }, "node_modules/fsevents/node_modules/process-nextick-args": { "version": "2.0.0", - "extraneous": true, + "dev": true, "inBundle": true, - "license": "MIT" + "license": "MIT", + "optional": true }, "node_modules/fsevents/node_modules/rc": { "version": "1.2.8", - "extraneous": true, + "dev": true, "inBundle": true, "license": "(BSD-2-Clause OR MIT OR Apache-2.0)", + "optional": true, "dependencies": { "deep-extend": "^0.6.0", "ini": "~1.3.0", @@ -6009,15 +6149,17 @@ }, "node_modules/fsevents/node_modules/rc/node_modules/minimist": { "version": "1.2.0", - "extraneous": true, + "dev": true, "inBundle": true, - "license": "MIT" + "license": "MIT", + "optional": true }, "node_modules/fsevents/node_modules/readable-stream": { "version": "2.3.6", - "extraneous": true, + "dev": true, "inBundle": true, "license": "MIT", + "optional": true, "dependencies": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -6030,9 +6172,10 @@ }, "node_modules/fsevents/node_modules/rimraf": { "version": "2.6.3", - "extraneous": true, + "dev": true, "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "glob": "^7.1.3" }, @@ -6042,57 +6185,65 @@ }, "node_modules/fsevents/node_modules/safe-buffer": { "version": "5.1.2", - "extraneous": true, + "dev": true, "inBundle": true, - "license": "MIT" + "license": "MIT", + "optional": true }, "node_modules/fsevents/node_modules/safer-buffer": { "version": "2.1.2", - "extraneous": true, + "dev": true, "inBundle": true, - "license": "MIT" + "license": "MIT", + "optional": true }, "node_modules/fsevents/node_modules/sax": { "version": "1.2.4", - "extraneous": true, + "dev": true, "inBundle": true, - "license": "ISC" + "license": "ISC", + "optional": true }, "node_modules/fsevents/node_modules/semver": { "version": "5.7.0", - "extraneous": true, + "dev": true, "inBundle": true, "license": "ISC", + "optional": true, "bin": { "semver": "bin/semver" } }, "node_modules/fsevents/node_modules/set-blocking": { "version": "2.0.0", - "extraneous": true, + "dev": true, "inBundle": true, - "license": "ISC" + "license": "ISC", + "optional": true }, "node_modules/fsevents/node_modules/signal-exit": { "version": "3.0.2", - "extraneous": true, + "dev": true, "inBundle": true, - "license": "ISC" + "license": "ISC", + "optional": true }, "node_modules/fsevents/node_modules/string_decoder": { "version": "1.1.1", - "extraneous": true, + "dev": true, "inBundle": true, "license": "MIT", + "optional": true, "dependencies": { "safe-buffer": "~5.1.0" } }, "node_modules/fsevents/node_modules/string-width": { "version": "1.0.2", - "extraneous": true, + "dev": true, "inBundle": true, "license": "MIT", + "optional": true, "dependencies": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -6104,9 +6255,10 @@ }, "node_modules/fsevents/node_modules/strip-ansi": { "version": "3.0.1", - "extraneous": true, + "dev": true, "inBundle": true, "license": "MIT", + "optional": true, "dependencies": { "ansi-regex": "^2.0.0" }, @@ -6116,18 +6268,20 @@ }, "node_modules/fsevents/node_modules/strip-json-comments": { "version": "2.0.1", - "extraneous": true, + "dev": true, "inBundle": true, "license": "MIT", + "optional": true, "engines": { "node": ">=0.10.0" } }, "node_modules/fsevents/node_modules/tar": { "version": "4.4.8", - "extraneous": true, + "dev": true, "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "chownr": "^1.1.1", "fs-minipass": "^1.2.5", @@ -6143,30 +6297,34 @@ }, "node_modules/fsevents/node_modules/util-deprecate": { "version": "1.0.2", - "extraneous": true, + "dev": true, "inBundle": true, - "license": "MIT" + "license": "MIT", + "optional": true }, "node_modules/fsevents/node_modules/wide-align": { "version": "1.1.3", - "extraneous": true, + "dev": true, "inBundle": true, "license": "ISC", + "optional": true, "dependencies": { "string-width": "^1.0.2 || 2" } }, "node_modules/fsevents/node_modules/wrappy": { "version": "1.0.2", - "extraneous": true, + "dev": true, "inBundle": true, - "license": "ISC" + "license": "ISC", + "optional": true }, "node_modules/fsevents/node_modules/yallist": { "version": "3.0.3", - "extraneous": true, + "dev": true, "inBundle": true, - "license": "ISC" + "license": "ISC", + "optional": true }, "node_modules/function-bind": { "version": "1.1.1", @@ -6483,6 +6641,14 @@ "he": "bin/he" } }, + "node_modules/hexoid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/hexoid/-/hexoid-1.0.0.tgz", + "integrity": "sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g==", + "engines": { + "node": ">=8" + } + }, "node_modules/hmac-drbg": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", @@ -14405,15 +14571,72 @@ } }, "@leancloud/platform-adapters-node": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/@leancloud/platform-adapters-node/-/platform-adapters-node-1.5.3.tgz", - "integrity": "sha512-IHsNTfoDVn1P+/jAwGBn9b6AL4urWVMXOivQe9R+E3l6xFVov/YhCMQzsFllmwzQFoqoHqPb7PkB+6nTKJSKSg==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@leancloud/platform-adapters-node/-/platform-adapters-node-1.6.0.tgz", + "integrity": "sha512-CHvD1nSYOuS+obxGy4u7KstqfN7PM1NG8jCx3LED/8nGshJM11PfzCeocGkLULUaiLg/N/1cGvh4AKX8NmAo9A==", "requires": { "@leancloud/adapter-types": "^5.0.0", - "@leancloud/adapters-superagent": "^1.4.3", + "@leancloud/adapter-utils": "^1.2.2", "@types/ws": "^7.2.2", "localstorage-memory": "^1.0.2", + "superagent": "^8.0.9", "ws": "^5.2.2" + }, + "dependencies": { + "debug": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "requires": { + "ms": "2.1.2" + } + }, + "form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, + "formidable": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/formidable/-/formidable-2.1.2.tgz", + "integrity": "sha512-CM3GuJ57US06mlpQ47YcunuUZ9jpm8Vx+P2CGt2j7HpgkKZO/DJYQ0Bobim8G6PFQmK5lOqOOdUXboU+h73A4g==", + "requires": { + "dezalgo": "^1.0.4", + "hexoid": "^1.0.0", + "once": "^1.4.0", + "qs": "^6.11.0" + } + }, + "semver": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz", + "integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==", + "requires": { + "lru-cache": "^6.0.0" + } + }, + "superagent": { + "version": "8.0.9", + "resolved": "https://registry.npmjs.org/superagent/-/superagent-8.0.9.tgz", + "integrity": "sha512-4C7Bh5pyHTvU33KpZgwrNKh/VQnvgtCSqPRfJAUdmrtSYePVzVg4E4OzsrbkhJj9O7SO6Bnv75K/F8XVZT8YHA==", + "requires": { + "component-emitter": "^1.3.0", + "cookiejar": "^2.1.4", + "debug": "^4.3.4", + "fast-safe-stringify": "^2.1.1", + "form-data": "^4.0.0", + "formidable": "^2.1.2", + "methods": "^1.1.2", + "mime": "2.6.0", + "qs": "^6.11.0", + "semver": "^7.3.8" + } + } } }, "@leancloud/platform-adapters-weapp": { @@ -14759,6 +14982,11 @@ "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", "dev": true }, + "asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==" + }, "ascli": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/ascli/-/ascli-1.0.1.tgz", @@ -15836,9 +16064,9 @@ "dev": true }, "cookiejar": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.3.tgz", - "integrity": "sha512-JxbCBUdrfr6AQjOXrxoTvAMJO4HBTUIlBzslcJPAz+/KT8yk53fXun51u+RenNYvad/+Vc2DIz5o9UxlCDymFQ==" + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.4.tgz", + "integrity": "sha512-LDx6oHrK+PhzLKJU9j5S7/Y3jM/mUHvD/DeI1WQmJn652iPC5Y4TBzC9l+5OMOXlyTTA+SmVUPm0HQUwpD5Jqw==" }, "copy-descriptor": { "version": "0.1.1", @@ -16144,6 +16372,15 @@ "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=", "dev": true }, + "dezalgo": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.4.tgz", + "integrity": "sha512-rXSP0bf+5n0Qonsb+SVVfNfIsimO4HEtmnIpPHY8Q1UCzKlQrDMfdobr8nJOOsRgWCyMRqeSBQzmWUMq7zvVig==", + "requires": { + "asap": "^2.0.0", + "wrappy": "1" + } + }, "diff": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", @@ -17078,22 +17315,26 @@ "abbrev": { "version": "1.1.1", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "ansi-regex": { "version": "2.1.1", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "are-we-there-yet": { "version": "1.1.5", "bundled": true, - "extraneous": true, + "dev": true, + "optional": true, "requires": { "delegates": "^1.0.0", "readable-stream": "^2.0.6" @@ -17102,12 +17343,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, - "extraneous": true, + "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -17116,32 +17359,38 @@ "chownr": { "version": "1.1.1", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "code-point-at": { "version": "1.1.0", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "debug": { "version": "4.1.1", "bundled": true, - "extraneous": true, + "dev": true, + "optional": true, "requires": { "ms": "^2.1.1" } @@ -17149,22 +17398,26 @@ "deep-extend": { "version": "0.6.0", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "delegates": { "version": "1.0.0", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "detect-libc": { "version": "1.0.3", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "fs-minipass": { "version": "1.2.5", "bundled": true, - "extraneous": true, + "dev": true, + "optional": true, "requires": { "minipass": "^2.2.1" } @@ -17172,12 +17425,14 @@ "fs.realpath": { "version": "1.0.0", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "gauge": { "version": "2.7.4", "bundled": true, - "extraneous": true, + "dev": true, + "optional": true, "requires": { "aproba": "^1.0.3", "console-control-strings": "^1.0.0", @@ -17192,7 +17447,8 @@ "glob": { "version": "7.1.3", "bundled": true, - "extraneous": true, + "dev": true, + "optional": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -17205,12 +17461,14 @@ "has-unicode": { "version": "2.0.1", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "iconv-lite": { "version": "0.4.24", "bundled": true, - "extraneous": true, + "dev": true, + "optional": true, "requires": { "safer-buffer": ">= 2.1.2 < 3" } @@ -17218,7 +17476,8 @@ "ignore-walk": { "version": "3.0.1", "bundled": true, - "extraneous": true, + "dev": true, + "optional": true, "requires": { "minimatch": "^3.0.4" } @@ -17226,7 +17485,8 @@ "inflight": { "version": "1.0.6", "bundled": true, - "extraneous": true, + "dev": true, + "optional": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -17235,17 +17495,20 @@ "inherits": { "version": "2.0.3", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, - "extraneous": true, + "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -17253,12 +17516,14 @@ "isarray": { "version": "1.0.0", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "minimatch": { "version": "3.0.4", "bundled": true, - "extraneous": true, + "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -17266,12 +17531,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "minipass": { "version": "2.3.5", "bundled": true, - "extraneous": true, + "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.2", "yallist": "^3.0.0" @@ -17280,7 +17547,8 @@ "minizlib": { "version": "1.2.1", "bundled": true, - "extraneous": true, + "dev": true, + "optional": true, "requires": { "minipass": "^2.2.1" } @@ -17288,7 +17556,8 @@ "mkdirp": { "version": "0.5.1", "bundled": true, - "extraneous": true, + "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -17296,12 +17565,14 @@ "ms": { "version": "2.1.1", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "needle": { "version": "2.3.0", "bundled": true, - "extraneous": true, + "dev": true, + "optional": true, "requires": { "debug": "^4.1.0", "iconv-lite": "^0.4.4", @@ -17311,7 +17582,8 @@ "node-pre-gyp": { "version": "0.12.0", "bundled": true, - "extraneous": true, + "dev": true, + "optional": true, "requires": { "detect-libc": "^1.0.2", "mkdirp": "^0.5.1", @@ -17328,7 +17600,8 @@ "nopt": { "version": "4.0.1", "bundled": true, - "extraneous": true, + "dev": true, + "optional": true, "requires": { "abbrev": "1", "osenv": "^0.1.4" @@ -17337,12 +17610,14 @@ "npm-bundled": { "version": "1.0.6", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "npm-packlist": { "version": "1.4.1", "bundled": true, - "extraneous": true, + "dev": true, + "optional": true, "requires": { "ignore-walk": "^3.0.1", "npm-bundled": "^1.0.1" @@ -17351,7 +17626,8 @@ "npmlog": { "version": "4.1.2", "bundled": true, - "extraneous": true, + "dev": true, + "optional": true, "requires": { "are-we-there-yet": "~1.1.2", "console-control-strings": "~1.1.0", @@ -17362,17 +17638,20 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "once": { "version": "1.4.0", "bundled": true, - "extraneous": true, + "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -17380,17 +17659,20 @@ "os-homedir": { "version": "1.0.2", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "os-tmpdir": { "version": "1.0.2", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "osenv": { "version": "0.1.5", "bundled": true, - "extraneous": true, + "dev": true, + "optional": true, "requires": { "os-homedir": "^1.0.0", "os-tmpdir": "^1.0.0" @@ -17399,17 +17681,20 @@ "path-is-absolute": { "version": "1.0.1", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "process-nextick-args": { "version": "2.0.0", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "rc": { "version": "1.2.8", "bundled": true, - "extraneous": true, + "dev": true, + "optional": true, "requires": { "deep-extend": "^0.6.0", "ini": "~1.3.0", @@ -17420,14 +17705,16 @@ "minimist": { "version": "1.2.0", "bundled": true, - "extraneous": true + "dev": true, + "optional": true } } }, "readable-stream": { "version": "2.3.6", "bundled": true, - "extraneous": true, + "dev": true, + "optional": true, "requires": { "core-util-is": "~1.0.0", "inherits": "~2.0.3", @@ -17441,7 +17728,8 @@ "rimraf": { "version": "2.6.3", "bundled": true, - "extraneous": true, + "dev": true, + "optional": true, "requires": { "glob": "^7.1.3" } @@ -17449,37 +17737,44 @@ "safe-buffer": { "version": "5.1.2", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "sax": { "version": "1.2.4", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "semver": { "version": "5.7.0", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "set-blocking": { "version": "2.0.0", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "signal-exit": { "version": "3.0.2", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "string_decoder": { "version": "1.1.1", "bundled": true, - "extraneous": true, + "dev": true, + "optional": true, "requires": { "safe-buffer": "~5.1.0" } @@ -17487,7 +17782,8 @@ "string-width": { "version": "1.0.2", "bundled": true, - "extraneous": true, + "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -17497,7 +17793,8 @@ "strip-ansi": { "version": "3.0.1", "bundled": true, - "extraneous": true, + "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -17505,12 +17802,14 @@ "strip-json-comments": { "version": "2.0.1", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "tar": { "version": "4.4.8", "bundled": true, - "extraneous": true, + "dev": true, + "optional": true, "requires": { "chownr": "^1.1.1", "fs-minipass": "^1.2.5", @@ -17524,12 +17823,14 @@ "util-deprecate": { "version": "1.0.2", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "wide-align": { "version": "1.1.3", "bundled": true, - "extraneous": true, + "dev": true, + "optional": true, "requires": { "string-width": "^1.0.2 || 2" } @@ -17537,12 +17838,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "extraneous": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.3", "bundled": true, - "extraneous": true + "dev": true, + "optional": true } } }, @@ -17791,6 +18094,11 @@ "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", "dev": true }, + "hexoid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/hexoid/-/hexoid-1.0.0.tgz", + "integrity": "sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g==" + }, "hmac-drbg": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", diff --git a/package.json b/package.json index c8a9dfc9..7d3b1bd4 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "@babel/runtime-corejs3": "^7.18.6", "@leancloud/adapter-types": "^5.0.0", "@leancloud/platform-adapters-browser": "^1.5.3", - "@leancloud/platform-adapters-node": "^1.5.3", + "@leancloud/platform-adapters-node": "^1.6.0", "@leancloud/platform-adapters-weapp": "^1.6.2", "debug": "^3.1.0", "eventemitter3": "^2.0.3", diff --git a/src/uploader/s3.js b/src/uploader/s3.js index ba53bc56..244c4ecc 100644 --- a/src/uploader/s3.js +++ b/src/uploader/s3.js @@ -4,10 +4,13 @@ const ajax = require('../utils/ajax'); module.exports = function upload(uploadInfo, data, file, saveOptions = {}) { /* NODE-ONLY:start */ if (data instanceof require('stream')) { - // data.pipe(req); - throw new TypeError( - 'Saving an AV.File from a Stream to S3 is not yet supported' - ); + const size = file.metaData('size'); + if (typeof size !== 'number') { + throw new Error( + 'Saving an AV.File from a Stream to S3 need metaData.size to be set' + ); + } + file.setUploadHeader('Content-Length', size.toString()); } /* NODE-ONLY:end */