@nocobase/plugin-file-manager 2.0.0-alpha.9 → 2.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/models/DisplayPreviewFieldModel.d.ts +1 -0
- package/dist/client/models/UploadActionModel.d.ts +3 -1
- package/dist/client/schemas/storageTypes/ali-oss.d.ts +12 -0
- package/dist/client/schemas/storageTypes/common.d.ts +12 -0
- package/dist/client/schemas/storageTypes/index.d.ts +48 -0
- package/dist/client/schemas/storageTypes/local.d.ts +12 -0
- package/dist/client/schemas/storageTypes/s3.d.ts +12 -0
- package/dist/client/schemas/storageTypes/tx-cos.d.ts +12 -0
- package/dist/client/templates/file.d.ts +4 -0
- package/dist/common/collections/storages.d.ts +11 -0
- package/dist/common/collections/storages.js +6 -0
- package/dist/externalVersion.js +8 -8
- package/dist/locale/de-DE.json +42 -29
- package/dist/locale/en-US.json +43 -30
- package/dist/locale/es-ES.json +54 -0
- package/dist/locale/fr-FR.json +45 -12
- package/dist/locale/hu-HU.json +48 -0
- package/dist/locale/id-ID.json +48 -0
- package/dist/locale/it-IT.json +43 -28
- package/dist/locale/ja-JP.json +43 -30
- package/dist/locale/ko-KR.json +46 -24
- package/dist/locale/nl-NL.json +53 -39
- package/dist/locale/pt-BR.json +54 -0
- package/dist/locale/ru-RU.json +47 -11
- package/dist/locale/tr-TR.json +47 -10
- package/dist/locale/uk-UA.json +54 -0
- package/dist/locale/vi-VN.json +48 -0
- package/dist/locale/zh-CN.json +41 -31
- package/dist/locale/zh-TW.json +54 -0
- package/dist/node_modules/@aws-sdk/client-s3/package.json +1 -1
- package/dist/node_modules/@aws-sdk/lib-storage/LICENSE +201 -0
- package/dist/node_modules/{multer-s3 → @aws-sdk/lib-storage/dist-cjs}/index.js +574 -6229
- package/dist/node_modules/@aws-sdk/lib-storage/dist-cjs/runtimeConfig.browser.js +8 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-cjs/runtimeConfig.js +10 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-cjs/runtimeConfig.native.js +8 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-cjs/runtimeConfig.shared.js +6 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-es/Upload.js +304 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-es/bytelength.js +27 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-es/chunker.js +24 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-es/chunks/getChunkStream.js +24 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-es/chunks/getChunkUint8Array.js +19 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-es/chunks/getDataReadable.js +11 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-es/chunks/getDataReadableStream.js +24 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-es/index.js +2 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-es/runtimeConfig.browser.js +5 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-es/runtimeConfig.js +7 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-es/runtimeConfig.native.js +5 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-es/runtimeConfig.shared.js +3 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-es/types.js +1 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/Upload.d.ts +59 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/bytelength.d.ts +1 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/chunker.d.ts +3 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/chunks/getChunkStream.d.ts +2 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/chunks/getChunkUint8Array.d.ts +2 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/chunks/getDataReadable.d.ts +3 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/chunks/getDataReadableStream.d.ts +1 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/index.d.ts +2 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/runtimeConfig.browser.d.ts +7 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/runtimeConfig.d.ts +8 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/runtimeConfig.native.d.ts +7 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/runtimeConfig.shared.d.ts +6 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/Upload.d.ts +43 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/bytelength.d.ts +1 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/chunker.d.ts +6 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/chunks/getChunkStream.d.ts +6 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/chunks/getChunkUint8Array.d.ts +5 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/chunks/getDataReadable.d.ts +4 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/chunks/getDataReadableStream.d.ts +3 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/index.d.ts +2 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/runtimeConfig.browser.d.ts +4 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/runtimeConfig.d.ts +4 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/runtimeConfig.native.d.ts +4 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/runtimeConfig.shared.d.ts +3 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/ts3.4/types.d.ts +22 -0
- package/dist/node_modules/@aws-sdk/lib-storage/dist-types/types.d.ts +51 -0
- package/dist/node_modules/@aws-sdk/lib-storage/package.json +1 -0
- package/dist/node_modules/{multer-s3 → ali-oss}/LICENSE +1 -2
- package/dist/node_modules/ali-oss/dist/aliyun-oss-sdk.js +44018 -0
- package/dist/node_modules/ali-oss/dist/aliyun-oss-sdk.min.js +4 -0
- package/dist/node_modules/ali-oss/lib/browser/bucket.js +296 -0
- package/dist/node_modules/ali-oss/lib/browser/client.js +452 -0
- package/dist/node_modules/ali-oss/lib/browser/managed-upload.js +360 -0
- package/dist/node_modules/ali-oss/lib/browser/object.js +385 -0
- package/dist/node_modules/ali-oss/lib/browser/version.js +1 -0
- package/dist/node_modules/ali-oss/lib/browser.js +6 -0
- package/dist/node_modules/ali-oss/lib/bucket.js +337 -0
- package/dist/node_modules/{multer-aliyun-oss/index.js → ali-oss/lib/client.js} +2 -2
- package/dist/node_modules/ali-oss/lib/cluster.js +228 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/abortBucketWorm.d.ts +4 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/abortBucketWorm.js +14 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/abortBucketWorm.ts +12 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/completeBucketWorm.d.ts +4 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/completeBucketWorm.js +14 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/completeBucketWorm.ts +12 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/deleteBucketEncryption.js +20 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/deleteBucketInventory.d.ts +10 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/deleteBucketInventory.js +22 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/deleteBucketInventory.ts +21 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/deleteBucketLifecycle.js +13 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/deleteBucketPolicy.js +21 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/deleteBucketTags.js +21 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/deleteBucketWebsite.js +13 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/extendBucketWorm.d.ts +4 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/extendBucketWorm.js +23 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/extendBucketWorm.ts +21 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketEncryption.js +21 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketInventory.d.ts +11 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketInventory.js +25 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketInventory.ts +24 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketLifecycle.js +33 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketPolicy.js +28 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketRequestPayment.js +25 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketStat.d.ts +23 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketStat.js +17 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketStat.ts +34 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketTags.js +23 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketVersioning.js +22 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketWebsite.js +28 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketWorm.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketWorm.js +20 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/getBucketWorm.ts +22 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/index.js +34 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/initiateBucketWorm.d.ts +5 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/initiateBucketWorm.js +24 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/initiateBucketWorm.ts +23 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/listBucketInventory.d.ts +13 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/listBucketInventory.js +29 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/listBucketInventory.ts +32 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/putBucket.js +31 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/putBucketEncryption.js +36 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/putBucketInventory.d.ts +36 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/putBucketInventory.js +58 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/putBucketInventory.ts +84 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/putBucketLifecycle.js +127 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/putBucketPolicy.js +27 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/putBucketRequestPayment.js +40 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/putBucketTags.js +39 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/putBucketVersioning.js +35 -0
- package/dist/node_modules/ali-oss/lib/common/bucket/putBucketWebsite.js +50 -0
- package/dist/node_modules/ali-oss/lib/common/callback.js +27 -0
- package/dist/node_modules/ali-oss/lib/common/client/getReqUrl.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/client/getReqUrl.js +52 -0
- package/dist/node_modules/ali-oss/lib/common/client/getReqUrl.ts +51 -0
- package/dist/node_modules/ali-oss/lib/common/client/initOptions.js +72 -0
- package/dist/node_modules/ali-oss/lib/common/image/index.js +5 -0
- package/dist/node_modules/ali-oss/lib/common/image/processObjectSave.js +45 -0
- package/dist/node_modules/ali-oss/lib/common/multipart-copy.js +240 -0
- package/dist/node_modules/ali-oss/lib/common/multipart.js +271 -0
- package/dist/node_modules/ali-oss/lib/common/object/asyncSignatureUrl.js +57 -0
- package/dist/node_modules/ali-oss/lib/common/object/calculatePostSignature.js +35 -0
- package/dist/node_modules/ali-oss/lib/common/object/copyObject.js +74 -0
- package/dist/node_modules/ali-oss/lib/common/object/delete.js +22 -0
- package/dist/node_modules/ali-oss/lib/common/object/deleteMulti.js +57 -0
- package/dist/node_modules/ali-oss/lib/common/object/deleteObjectTagging.js +22 -0
- package/dist/node_modules/ali-oss/lib/common/object/generateObjectUrl.js +28 -0
- package/dist/node_modules/ali-oss/lib/common/object/get.js +64 -0
- package/dist/node_modules/ali-oss/lib/common/object/getACL.js +30 -0
- package/dist/node_modules/ali-oss/lib/common/object/getAsyncFetch.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/object/getAsyncFetch.js +26 -0
- package/dist/node_modules/ali-oss/lib/common/object/getAsyncFetch.ts +25 -0
- package/dist/node_modules/ali-oss/lib/common/object/getBucketVersions.js +98 -0
- package/dist/node_modules/ali-oss/lib/common/object/getObjectMeta.js +23 -0
- package/dist/node_modules/ali-oss/lib/common/object/getObjectTagging.js +34 -0
- package/dist/node_modules/ali-oss/lib/common/object/getObjectUrl.js +21 -0
- package/dist/node_modules/ali-oss/lib/common/object/getSymlink.js +23 -0
- package/dist/node_modules/ali-oss/lib/common/object/head.js +40 -0
- package/dist/node_modules/ali-oss/lib/common/object/index.js +26 -0
- package/dist/node_modules/ali-oss/lib/common/object/postAsyncFetch.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/object/postAsyncFetch.js +44 -0
- package/dist/node_modules/ali-oss/lib/common/object/postAsyncFetch.ts +46 -0
- package/dist/node_modules/ali-oss/lib/common/object/putACL.js +27 -0
- package/dist/node_modules/ali-oss/lib/common/object/putObjectTagging.js +43 -0
- package/dist/node_modules/ali-oss/lib/common/object/putSymlink.js +33 -0
- package/dist/node_modules/ali-oss/lib/common/object/signatureUrl.js +52 -0
- package/dist/node_modules/ali-oss/lib/common/object/signatureUrlV4.js +70 -0
- package/dist/node_modules/ali-oss/lib/common/parallel.js +177 -0
- package/dist/node_modules/ali-oss/lib/common/signUtils.js +355 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkBucketName.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkBucketName.js +9 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkBucketName.ts +6 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkBucketNameTest.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkBucketNameTest.js +14 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkBucketNameTest.ts +12 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkBucketTag.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkBucketTag.js +49 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkBucketTag.ts +52 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkConfigValid.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkConfigValid.js +30 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkConfigValid.ts +27 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkEnv.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkEnv.js +9 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkEnv.ts +5 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkObjectTag.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkObjectTag.js +50 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkObjectTag.ts +53 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkUserAgent.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkUserAgent.js +7 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkUserAgent.ts +4 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkValid.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkValid.js +14 -0
- package/dist/node_modules/ali-oss/lib/common/utils/checkValid.ts +9 -0
- package/dist/node_modules/ali-oss/lib/common/utils/createRequest.d.ts +8 -0
- package/dist/node_modules/ali-oss/lib/common/utils/createRequest.js +139 -0
- package/dist/node_modules/ali-oss/lib/common/utils/createRequest.ts +169 -0
- package/dist/node_modules/ali-oss/lib/common/utils/dataFix.d.ts +12 -0
- package/dist/node_modules/ali-oss/lib/common/utils/dataFix.js +63 -0
- package/dist/node_modules/ali-oss/lib/common/utils/dataFix.ts +78 -0
- package/dist/node_modules/ali-oss/lib/common/utils/deepCopy.d.ts +2 -0
- package/dist/node_modules/ali-oss/lib/common/utils/deepCopy.js +41 -0
- package/dist/node_modules/ali-oss/lib/common/utils/deepCopy.ts +47 -0
- package/dist/node_modules/ali-oss/lib/common/utils/encodeString.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/encodeString.js +12 -0
- package/dist/node_modules/ali-oss/lib/common/utils/encodeString.ts +7 -0
- package/dist/node_modules/ali-oss/lib/common/utils/encoder.d.ts +2 -0
- package/dist/node_modules/ali-oss/lib/common/utils/encoder.js +9 -0
- package/dist/node_modules/ali-oss/lib/common/utils/encoder.ts +6 -0
- package/dist/node_modules/ali-oss/lib/common/utils/formatInventoryConfig.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/formatInventoryConfig.js +45 -0
- package/dist/node_modules/ali-oss/lib/common/utils/formatInventoryConfig.ts +41 -0
- package/dist/node_modules/ali-oss/lib/common/utils/formatObjKey.d.ts +6 -0
- package/dist/node_modules/ali-oss/lib/common/utils/formatObjKey.js +34 -0
- package/dist/node_modules/ali-oss/lib/common/utils/formatObjKey.ts +35 -0
- package/dist/node_modules/ali-oss/lib/common/utils/formatTag.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/formatTag.js +22 -0
- package/dist/node_modules/ali-oss/lib/common/utils/formatTag.ts +20 -0
- package/dist/node_modules/ali-oss/lib/common/utils/getStandardRegion.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/getStandardRegion.js +7 -0
- package/dist/node_modules/ali-oss/lib/common/utils/getStandardRegion.ts +3 -0
- package/dist/node_modules/ali-oss/lib/common/utils/getStrBytesCount.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/getStrBytesCount.js +17 -0
- package/dist/node_modules/ali-oss/lib/common/utils/getStrBytesCount.ts +12 -0
- package/dist/node_modules/ali-oss/lib/common/utils/getUserAgent.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/getUserAgent.js +18 -0
- package/dist/node_modules/ali-oss/lib/common/utils/getUserAgent.ts +14 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isArray.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isArray.js +6 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isArray.ts +3 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isBlob.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isBlob.js +7 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isBlob.ts +3 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isBuffer.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isBuffer.js +7 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isBuffer.ts +3 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isDingTalk.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isDingTalk.js +10 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isDingTalk.ts +6 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isFile.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isFile.js +6 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isFile.ts +3 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isFunction.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isFunction.js +6 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isFunction.ts +3 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isIP.d.ts +6 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isIP.js +14 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isIP.ts +12 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isObject.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isObject.js +6 -0
- package/dist/node_modules/ali-oss/lib/common/utils/isObject.ts +3 -0
- package/dist/node_modules/ali-oss/lib/common/utils/lowercaseKeyHeader.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/lowercaseKeyHeader.js +14 -0
- package/dist/node_modules/ali-oss/lib/common/utils/lowercaseKeyHeader.ts +11 -0
- package/dist/node_modules/ali-oss/lib/common/utils/obj2xml.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/obj2xml.js +43 -0
- package/dist/node_modules/ali-oss/lib/common/utils/obj2xml.ts +37 -0
- package/dist/node_modules/ali-oss/lib/common/utils/omit.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/omit.js +11 -0
- package/dist/node_modules/ali-oss/lib/common/utils/omit.ts +9 -0
- package/dist/node_modules/ali-oss/lib/common/utils/policy2Str.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/policy2Str.js +21 -0
- package/dist/node_modules/ali-oss/lib/common/utils/policy2Str.ts +15 -0
- package/dist/node_modules/ali-oss/lib/common/utils/retry.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/common/utils/retry.js +30 -0
- package/dist/node_modules/ali-oss/lib/common/utils/retry.ts +26 -0
- package/dist/node_modules/ali-oss/lib/common/utils/setRegion.d.ts +3 -0
- package/dist/node_modules/ali-oss/lib/common/utils/setRegion.js +20 -0
- package/dist/node_modules/ali-oss/lib/common/utils/setRegion.ts +15 -0
- package/dist/node_modules/ali-oss/lib/common/utils/setSTSToken.d.ts +2 -0
- package/dist/node_modules/ali-oss/lib/common/utils/setSTSToken.js +36 -0
- package/dist/node_modules/ali-oss/lib/common/utils/setSTSToken.ts +32 -0
- package/dist/node_modules/ali-oss/lib/global.d.ts +6 -0
- package/dist/node_modules/ali-oss/lib/image.js +146 -0
- package/dist/node_modules/ali-oss/lib/managed-upload.js +380 -0
- package/dist/node_modules/ali-oss/lib/object.js +420 -0
- package/dist/node_modules/ali-oss/lib/rtmp.js +295 -0
- package/dist/node_modules/ali-oss/lib/setConfig.d.ts +3 -0
- package/dist/node_modules/ali-oss/lib/setConfig.js +42 -0
- package/dist/node_modules/ali-oss/lib/setConfig.ts +52 -0
- package/dist/node_modules/ali-oss/lib/sts.js +156 -0
- package/dist/node_modules/ali-oss/lib/types/experimental.d.ts +1 -0
- package/dist/node_modules/ali-oss/lib/types/experimental.js +2 -0
- package/dist/node_modules/ali-oss/lib/types/experimental.ts +1 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/.editorconfig +17 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/.idea/.name +1 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/.idea/bowser.iml +8 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/.idea/encodings.xml +6 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/.idea/inspectionProfiles/Project_Default.xml +6 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/.idea/jsLibraryMappings.xml +8 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/.idea/markdown-exported-files.xml +8 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/.idea/markdown-navigator/profiles_settings.xml +3 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/.idea/markdown-navigator.xml +67 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/.idea/misc.xml +6 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/.idea/modules.xml +8 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/.idea/vcs.xml +6 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/.idea/watcherTasks.xml +4 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/.idea/workspace.xml +696 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/.travis.yml +8 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/bower.json +33 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/bowser.js +644 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/bowser.min.js +6 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/package.json +38 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/src/bowser.js +644 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/test/test.js +151 -0
- package/dist/node_modules/ali-oss/node_modules/bowser/typings.d.ts +115 -0
- package/dist/node_modules/ali-oss/node_modules/dateformat/.vs/ProjectSettings.json +3 -0
- package/dist/node_modules/ali-oss/node_modules/dateformat/.vs/config/applicationhost.config +1031 -0
- package/dist/node_modules/ali-oss/node_modules/dateformat/.vs/node-dateformat/v15/.suo +0 -0
- package/dist/node_modules/ali-oss/node_modules/dateformat/.vs/slnx.sqlite +0 -0
- package/dist/node_modules/ali-oss/node_modules/dateformat/lib/dateformat.js +226 -0
- package/dist/node_modules/ali-oss/node_modules/dateformat/package.json +30 -0
- package/dist/node_modules/ali-oss/node_modules/mime/Mime.js +97 -0
- package/dist/node_modules/ali-oss/node_modules/mime/cli.js +46 -0
- package/dist/node_modules/ali-oss/node_modules/mime/index.js +4 -0
- package/dist/node_modules/ali-oss/node_modules/mime/lite.js +4 -0
- package/dist/node_modules/ali-oss/node_modules/mime/package.json +52 -0
- package/dist/node_modules/ali-oss/node_modules/mime/types/other.js +1 -0
- package/dist/node_modules/ali-oss/node_modules/mime/types/standard.js +1 -0
- package/dist/node_modules/ali-oss/package.json +1 -0
- package/dist/node_modules/ali-oss/shims/crypto/crypto.js +98 -0
- package/dist/node_modules/ali-oss/shims/crypto/helpers.js +36 -0
- package/dist/node_modules/ali-oss/shims/crypto/md5.js +152 -0
- package/dist/node_modules/ali-oss/shims/crypto/sha.js +91 -0
- package/dist/node_modules/ali-oss/shims/crypto/sha256.js +163 -0
- package/dist/node_modules/ali-oss/shims/debug.js +3 -0
- package/dist/node_modules/ali-oss/shims/is-type-of.js +18 -0
- package/dist/node_modules/ali-oss/shims/process.js +35 -0
- package/dist/node_modules/ali-oss/shims/stream-http/index.js +82 -0
- package/dist/node_modules/ali-oss/shims/stream-http/lib/capability.js +72 -0
- package/dist/node_modules/ali-oss/shims/stream-http/lib/request.js +320 -0
- package/dist/node_modules/ali-oss/shims/stream-http/lib/response.js +217 -0
- package/dist/node_modules/ali-oss/shims/url/index.js +696 -0
- package/dist/node_modules/ali-oss/shims/url/util.js +16 -0
- package/dist/node_modules/ali-oss/shims/utility.js +25 -0
- package/dist/node_modules/ali-oss/shims/xhr.js +798 -0
- package/dist/node_modules/mime-match/package.json +1 -1
- package/dist/node_modules/mime-types/package.json +1 -1
- package/dist/node_modules/mkdirp/package.json +1 -1
- package/dist/node_modules/multer-cos/package.json +1 -1
- package/dist/node_modules/url-join/package.json +1 -1
- package/dist/server/actions/storages.js +4 -6
- package/dist/server/server.js +1 -0
- package/dist/server/storages/ali-oss.d.ts +15 -1
- package/dist/server/storages/ali-oss.js +66 -2
- package/dist/server/storages/index.d.ts +1 -0
- package/dist/server/storages/local.js +1 -1
- package/dist/server/storages/s3.d.ts +10 -3
- package/dist/server/storages/s3.js +121 -29
- package/dist/server/storages/tx-cos.js +1 -1
- package/dist/server/utils.d.ts +1 -0
- package/dist/server/utils.js +43 -0
- package/package.json +7 -3
- package/dist/node_modules/multer-aliyun-oss/package.json +0 -1
- package/dist/node_modules/multer-s3/.gitattributes +0 -1
- package/dist/node_modules/multer-s3/.travis.yml +0 -6
- package/dist/node_modules/multer-s3/package.json +0 -1
- package/dist/node_modules/multer-s3/test/basic.js +0 -293
- package/dist/node_modules/multer-s3/test/files/a.txt +0 -1
- package/dist/node_modules/multer-s3/test/files/test.svg +0 -3
- package/dist/node_modules/multer-s3/test/files/test2.svg +0 -9
- package/dist/node_modules/multer-s3/test/util/mock-s3.js +0 -17
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClientDefaultValues = void 0;
|
|
4
|
+
const runtimeConfig_shared_1 = require("./runtimeConfig.shared");
|
|
5
|
+
exports.ClientDefaultValues = {
|
|
6
|
+
...runtimeConfig_shared_1.ClientSharedValues,
|
|
7
|
+
runtime: "browser",
|
|
8
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClientDefaultValues = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const runtimeConfig_shared_1 = require("./runtimeConfig.shared");
|
|
6
|
+
exports.ClientDefaultValues = {
|
|
7
|
+
...runtimeConfig_shared_1.ClientSharedValues,
|
|
8
|
+
runtime: "node",
|
|
9
|
+
lstatSync: fs_1.lstatSync,
|
|
10
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClientDefaultValues = void 0;
|
|
4
|
+
const runtimeConfig_browser_1 = require("./runtimeConfig.browser");
|
|
5
|
+
exports.ClientDefaultValues = {
|
|
6
|
+
...runtimeConfig_browser_1.ClientDefaultValues,
|
|
7
|
+
runtime: "react-native",
|
|
8
|
+
};
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { AbortMultipartUploadCommand, ChecksumAlgorithm, CompleteMultipartUploadCommand, CreateMultipartUploadCommand, PutObjectCommand, PutObjectTaggingCommand, UploadPartCommand, } from "@aws-sdk/client-s3";
|
|
2
|
+
import { AbortController } from "@smithy/abort-controller";
|
|
3
|
+
import { getEndpointFromInstructions, toEndpointV1, } from "@smithy/middleware-endpoint";
|
|
4
|
+
import { extendedEncodeURIComponent } from "@smithy/smithy-client";
|
|
5
|
+
import { EventEmitter } from "events";
|
|
6
|
+
import { byteLength } from "./bytelength";
|
|
7
|
+
import { getChunk } from "./chunker";
|
|
8
|
+
export class Upload extends EventEmitter {
|
|
9
|
+
static MIN_PART_SIZE = 1024 * 1024 * 5;
|
|
10
|
+
MAX_PARTS = 10000;
|
|
11
|
+
queueSize = 4;
|
|
12
|
+
partSize = Upload.MIN_PART_SIZE;
|
|
13
|
+
leavePartsOnError = false;
|
|
14
|
+
tags = [];
|
|
15
|
+
client;
|
|
16
|
+
params;
|
|
17
|
+
totalBytes;
|
|
18
|
+
bytesUploadedSoFar;
|
|
19
|
+
abortController;
|
|
20
|
+
concurrentUploaders = [];
|
|
21
|
+
createMultiPartPromise;
|
|
22
|
+
abortMultipartUploadCommand = null;
|
|
23
|
+
uploadedParts = [];
|
|
24
|
+
uploadEnqueuedPartsCount = 0;
|
|
25
|
+
uploadId;
|
|
26
|
+
uploadEvent;
|
|
27
|
+
isMultiPart = true;
|
|
28
|
+
singleUploadResult;
|
|
29
|
+
sent = false;
|
|
30
|
+
constructor(options) {
|
|
31
|
+
super();
|
|
32
|
+
this.queueSize = options.queueSize || this.queueSize;
|
|
33
|
+
this.partSize = options.partSize || this.partSize;
|
|
34
|
+
this.leavePartsOnError = options.leavePartsOnError || this.leavePartsOnError;
|
|
35
|
+
this.tags = options.tags || this.tags;
|
|
36
|
+
this.client = options.client;
|
|
37
|
+
this.params = options.params;
|
|
38
|
+
this.__validateInput();
|
|
39
|
+
this.totalBytes = byteLength(this.params.Body);
|
|
40
|
+
this.bytesUploadedSoFar = 0;
|
|
41
|
+
this.abortController = options.abortController ?? new AbortController();
|
|
42
|
+
}
|
|
43
|
+
async abort() {
|
|
44
|
+
this.abortController.abort();
|
|
45
|
+
}
|
|
46
|
+
async done() {
|
|
47
|
+
if (this.sent) {
|
|
48
|
+
throw new Error("@aws-sdk/lib-storage: this instance of Upload has already executed .done(). Create a new instance.");
|
|
49
|
+
}
|
|
50
|
+
this.sent = true;
|
|
51
|
+
return await Promise.race([this.__doMultipartUpload(), this.__abortTimeout(this.abortController.signal)]);
|
|
52
|
+
}
|
|
53
|
+
on(event, listener) {
|
|
54
|
+
this.uploadEvent = event;
|
|
55
|
+
return super.on(event, listener);
|
|
56
|
+
}
|
|
57
|
+
async __uploadUsingPut(dataPart) {
|
|
58
|
+
this.isMultiPart = false;
|
|
59
|
+
const params = { ...this.params, Body: dataPart.data };
|
|
60
|
+
const clientConfig = this.client.config;
|
|
61
|
+
const requestHandler = clientConfig.requestHandler;
|
|
62
|
+
const eventEmitter = requestHandler instanceof EventEmitter ? requestHandler : null;
|
|
63
|
+
const uploadEventListener = (event) => {
|
|
64
|
+
this.bytesUploadedSoFar = event.loaded;
|
|
65
|
+
this.totalBytes = event.total;
|
|
66
|
+
this.__notifyProgress({
|
|
67
|
+
loaded: this.bytesUploadedSoFar,
|
|
68
|
+
total: this.totalBytes,
|
|
69
|
+
part: dataPart.partNumber,
|
|
70
|
+
Key: this.params.Key,
|
|
71
|
+
Bucket: this.params.Bucket,
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
if (eventEmitter !== null) {
|
|
75
|
+
eventEmitter.on("xhr.upload.progress", uploadEventListener);
|
|
76
|
+
}
|
|
77
|
+
const resolved = await Promise.all([this.client.send(new PutObjectCommand(params)), clientConfig?.endpoint?.()]);
|
|
78
|
+
const putResult = resolved[0];
|
|
79
|
+
let endpoint = resolved[1];
|
|
80
|
+
if (!endpoint) {
|
|
81
|
+
endpoint = toEndpointV1(await getEndpointFromInstructions(params, PutObjectCommand, {
|
|
82
|
+
...clientConfig,
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
if (!endpoint) {
|
|
86
|
+
throw new Error('Could not resolve endpoint from S3 "client.config.endpoint()" nor EndpointsV2.');
|
|
87
|
+
}
|
|
88
|
+
if (eventEmitter !== null) {
|
|
89
|
+
eventEmitter.off("xhr.upload.progress", uploadEventListener);
|
|
90
|
+
}
|
|
91
|
+
const locationKey = this.params
|
|
92
|
+
.Key.split("/")
|
|
93
|
+
.map((segment) => extendedEncodeURIComponent(segment))
|
|
94
|
+
.join("/");
|
|
95
|
+
const locationBucket = extendedEncodeURIComponent(this.params.Bucket);
|
|
96
|
+
const Location = (() => {
|
|
97
|
+
const endpointHostnameIncludesBucket = endpoint.hostname.startsWith(`${locationBucket}.`);
|
|
98
|
+
const forcePathStyle = this.client.config.forcePathStyle;
|
|
99
|
+
const optionalPort = endpoint.port ? `:${endpoint.port}` : ``;
|
|
100
|
+
if (forcePathStyle) {
|
|
101
|
+
return `${endpoint.protocol}//${endpoint.hostname}${optionalPort}/${locationBucket}/${locationKey}`;
|
|
102
|
+
}
|
|
103
|
+
if (endpointHostnameIncludesBucket) {
|
|
104
|
+
return `${endpoint.protocol}//${endpoint.hostname}${optionalPort}/${locationKey}`;
|
|
105
|
+
}
|
|
106
|
+
return `${endpoint.protocol}//${locationBucket}.${endpoint.hostname}${optionalPort}/${locationKey}`;
|
|
107
|
+
})();
|
|
108
|
+
this.singleUploadResult = {
|
|
109
|
+
...putResult,
|
|
110
|
+
Bucket: this.params.Bucket,
|
|
111
|
+
Key: this.params.Key,
|
|
112
|
+
Location,
|
|
113
|
+
};
|
|
114
|
+
const totalSize = byteLength(dataPart.data);
|
|
115
|
+
this.__notifyProgress({
|
|
116
|
+
loaded: totalSize,
|
|
117
|
+
total: totalSize,
|
|
118
|
+
part: 1,
|
|
119
|
+
Key: this.params.Key,
|
|
120
|
+
Bucket: this.params.Bucket,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
async __createMultipartUpload() {
|
|
124
|
+
const requestChecksumCalculation = await this.client.config.requestChecksumCalculation();
|
|
125
|
+
if (!this.createMultiPartPromise) {
|
|
126
|
+
const createCommandParams = { ...this.params, Body: undefined };
|
|
127
|
+
if (requestChecksumCalculation === "WHEN_SUPPORTED") {
|
|
128
|
+
createCommandParams.ChecksumAlgorithm = this.params.ChecksumAlgorithm || ChecksumAlgorithm.CRC32;
|
|
129
|
+
}
|
|
130
|
+
this.createMultiPartPromise = this.client
|
|
131
|
+
.send(new CreateMultipartUploadCommand(createCommandParams))
|
|
132
|
+
.then((createMpuResponse) => {
|
|
133
|
+
this.abortMultipartUploadCommand = new AbortMultipartUploadCommand({
|
|
134
|
+
Bucket: this.params.Bucket,
|
|
135
|
+
Key: this.params.Key,
|
|
136
|
+
UploadId: createMpuResponse.UploadId,
|
|
137
|
+
});
|
|
138
|
+
return createMpuResponse;
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
return this.createMultiPartPromise;
|
|
142
|
+
}
|
|
143
|
+
async __doConcurrentUpload(dataFeeder) {
|
|
144
|
+
for await (const dataPart of dataFeeder) {
|
|
145
|
+
if (this.uploadEnqueuedPartsCount > this.MAX_PARTS) {
|
|
146
|
+
throw new Error(`Exceeded ${this.MAX_PARTS} parts in multipart upload to Bucket: ${this.params.Bucket} Key: ${this.params.Key}.`);
|
|
147
|
+
}
|
|
148
|
+
if (this.abortController.signal.aborted) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
if (dataPart.partNumber === 1 && dataPart.lastPart) {
|
|
152
|
+
return await this.__uploadUsingPut(dataPart);
|
|
153
|
+
}
|
|
154
|
+
if (!this.uploadId) {
|
|
155
|
+
const { UploadId } = await this.__createMultipartUpload();
|
|
156
|
+
this.uploadId = UploadId;
|
|
157
|
+
if (this.abortController.signal.aborted) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
const partSize = byteLength(dataPart.data) || 0;
|
|
162
|
+
const requestHandler = this.client.config.requestHandler;
|
|
163
|
+
const eventEmitter = requestHandler instanceof EventEmitter ? requestHandler : null;
|
|
164
|
+
let lastSeenBytes = 0;
|
|
165
|
+
const uploadEventListener = (event, request) => {
|
|
166
|
+
const requestPartSize = Number(request.query["partNumber"]) || -1;
|
|
167
|
+
if (requestPartSize !== dataPart.partNumber) {
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (event.total && partSize) {
|
|
171
|
+
this.bytesUploadedSoFar += event.loaded - lastSeenBytes;
|
|
172
|
+
lastSeenBytes = event.loaded;
|
|
173
|
+
}
|
|
174
|
+
this.__notifyProgress({
|
|
175
|
+
loaded: this.bytesUploadedSoFar,
|
|
176
|
+
total: this.totalBytes,
|
|
177
|
+
part: dataPart.partNumber,
|
|
178
|
+
Key: this.params.Key,
|
|
179
|
+
Bucket: this.params.Bucket,
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
if (eventEmitter !== null) {
|
|
183
|
+
eventEmitter.on("xhr.upload.progress", uploadEventListener);
|
|
184
|
+
}
|
|
185
|
+
this.uploadEnqueuedPartsCount += 1;
|
|
186
|
+
const partResult = await this.client.send(new UploadPartCommand({
|
|
187
|
+
...this.params,
|
|
188
|
+
ContentLength: undefined,
|
|
189
|
+
UploadId: this.uploadId,
|
|
190
|
+
Body: dataPart.data,
|
|
191
|
+
PartNumber: dataPart.partNumber,
|
|
192
|
+
}));
|
|
193
|
+
if (eventEmitter !== null) {
|
|
194
|
+
eventEmitter.off("xhr.upload.progress", uploadEventListener);
|
|
195
|
+
}
|
|
196
|
+
if (this.abortController.signal.aborted) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
if (!partResult.ETag) {
|
|
200
|
+
throw new Error(`Part ${dataPart.partNumber} is missing ETag in UploadPart response. Missing Bucket CORS configuration for ETag header?`);
|
|
201
|
+
}
|
|
202
|
+
this.uploadedParts.push({
|
|
203
|
+
PartNumber: dataPart.partNumber,
|
|
204
|
+
ETag: partResult.ETag,
|
|
205
|
+
...(partResult.ChecksumCRC32 && { ChecksumCRC32: partResult.ChecksumCRC32 }),
|
|
206
|
+
...(partResult.ChecksumCRC32C && { ChecksumCRC32C: partResult.ChecksumCRC32C }),
|
|
207
|
+
...(partResult.ChecksumSHA1 && { ChecksumSHA1: partResult.ChecksumSHA1 }),
|
|
208
|
+
...(partResult.ChecksumSHA256 && { ChecksumSHA256: partResult.ChecksumSHA256 }),
|
|
209
|
+
});
|
|
210
|
+
if (eventEmitter === null) {
|
|
211
|
+
this.bytesUploadedSoFar += partSize;
|
|
212
|
+
}
|
|
213
|
+
this.__notifyProgress({
|
|
214
|
+
loaded: this.bytesUploadedSoFar,
|
|
215
|
+
total: this.totalBytes,
|
|
216
|
+
part: dataPart.partNumber,
|
|
217
|
+
Key: this.params.Key,
|
|
218
|
+
Bucket: this.params.Bucket,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
async __doMultipartUpload() {
|
|
223
|
+
const dataFeeder = getChunk(this.params.Body, this.partSize);
|
|
224
|
+
const concurrentUploaderFailures = [];
|
|
225
|
+
for (let index = 0; index < this.queueSize; index++) {
|
|
226
|
+
const currentUpload = this.__doConcurrentUpload(dataFeeder).catch((err) => {
|
|
227
|
+
concurrentUploaderFailures.push(err);
|
|
228
|
+
});
|
|
229
|
+
this.concurrentUploaders.push(currentUpload);
|
|
230
|
+
}
|
|
231
|
+
await Promise.all(this.concurrentUploaders);
|
|
232
|
+
if (concurrentUploaderFailures.length >= 1) {
|
|
233
|
+
await this.markUploadAsAborted();
|
|
234
|
+
throw concurrentUploaderFailures[0];
|
|
235
|
+
}
|
|
236
|
+
if (this.abortController.signal.aborted) {
|
|
237
|
+
await this.markUploadAsAborted();
|
|
238
|
+
throw Object.assign(new Error("Upload aborted."), { name: "AbortError" });
|
|
239
|
+
}
|
|
240
|
+
let result;
|
|
241
|
+
if (this.isMultiPart) {
|
|
242
|
+
this.uploadedParts.sort((a, b) => a.PartNumber - b.PartNumber);
|
|
243
|
+
const uploadCompleteParams = {
|
|
244
|
+
...this.params,
|
|
245
|
+
Body: undefined,
|
|
246
|
+
UploadId: this.uploadId,
|
|
247
|
+
MultipartUpload: {
|
|
248
|
+
Parts: this.uploadedParts,
|
|
249
|
+
},
|
|
250
|
+
};
|
|
251
|
+
result = await this.client.send(new CompleteMultipartUploadCommand(uploadCompleteParams));
|
|
252
|
+
if (typeof result?.Location === "string" && result.Location.includes("%2F")) {
|
|
253
|
+
result.Location = result.Location.replace(/%2F/g, "/");
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
else {
|
|
257
|
+
result = this.singleUploadResult;
|
|
258
|
+
}
|
|
259
|
+
this.abortMultipartUploadCommand = null;
|
|
260
|
+
if (this.tags.length) {
|
|
261
|
+
await this.client.send(new PutObjectTaggingCommand({
|
|
262
|
+
...this.params,
|
|
263
|
+
Tagging: {
|
|
264
|
+
TagSet: this.tags,
|
|
265
|
+
},
|
|
266
|
+
}));
|
|
267
|
+
}
|
|
268
|
+
return result;
|
|
269
|
+
}
|
|
270
|
+
async markUploadAsAborted() {
|
|
271
|
+
if (this.uploadId && !this.leavePartsOnError && null !== this.abortMultipartUploadCommand) {
|
|
272
|
+
await this.client.send(this.abortMultipartUploadCommand);
|
|
273
|
+
this.abortMultipartUploadCommand = null;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
__notifyProgress(progress) {
|
|
277
|
+
if (this.uploadEvent) {
|
|
278
|
+
this.emit(this.uploadEvent, progress);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
async __abortTimeout(abortSignal) {
|
|
282
|
+
return new Promise((resolve, reject) => {
|
|
283
|
+
abortSignal.onabort = () => {
|
|
284
|
+
const abortError = new Error("Upload aborted.");
|
|
285
|
+
abortError.name = "AbortError";
|
|
286
|
+
reject(abortError);
|
|
287
|
+
};
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
__validateInput() {
|
|
291
|
+
if (!this.params) {
|
|
292
|
+
throw new Error(`InputError: Upload requires params to be passed to upload.`);
|
|
293
|
+
}
|
|
294
|
+
if (!this.client) {
|
|
295
|
+
throw new Error(`InputError: Upload requires a AWS client to do uploads with.`);
|
|
296
|
+
}
|
|
297
|
+
if (this.partSize < Upload.MIN_PART_SIZE) {
|
|
298
|
+
throw new Error(`EntityTooSmall: Your proposed upload partsize [${this.partSize}] is smaller than the minimum allowed size [${Upload.MIN_PART_SIZE}] (5MB)`);
|
|
299
|
+
}
|
|
300
|
+
if (this.queueSize < 1) {
|
|
301
|
+
throw new Error(`Queue size: Must have at least one uploading queue.`);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Buffer } from "buffer";
|
|
2
|
+
import { ClientDefaultValues } from "./runtimeConfig";
|
|
3
|
+
export const byteLength = (input) => {
|
|
4
|
+
if (input === null || input === undefined)
|
|
5
|
+
return 0;
|
|
6
|
+
if (typeof input === "string") {
|
|
7
|
+
return Buffer.byteLength(input);
|
|
8
|
+
}
|
|
9
|
+
if (typeof input.byteLength === "number") {
|
|
10
|
+
return input.byteLength;
|
|
11
|
+
}
|
|
12
|
+
else if (typeof input.length === "number") {
|
|
13
|
+
return input.length;
|
|
14
|
+
}
|
|
15
|
+
else if (typeof input.size === "number") {
|
|
16
|
+
return input.size;
|
|
17
|
+
}
|
|
18
|
+
else if (typeof input.path === "string") {
|
|
19
|
+
try {
|
|
20
|
+
return ClientDefaultValues.lstatSync(input.path).size;
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return undefined;
|
|
27
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Buffer } from "buffer";
|
|
2
|
+
import { Readable } from "stream";
|
|
3
|
+
import { getChunkStream } from "./chunks/getChunkStream";
|
|
4
|
+
import { getChunkUint8Array } from "./chunks/getChunkUint8Array";
|
|
5
|
+
import { getDataReadable } from "./chunks/getDataReadable";
|
|
6
|
+
import { getDataReadableStream } from "./chunks/getDataReadableStream";
|
|
7
|
+
export const getChunk = (data, partSize) => {
|
|
8
|
+
if (data instanceof Uint8Array) {
|
|
9
|
+
return getChunkUint8Array(data, partSize);
|
|
10
|
+
}
|
|
11
|
+
if (data instanceof Readable) {
|
|
12
|
+
return getChunkStream(data, partSize, getDataReadable);
|
|
13
|
+
}
|
|
14
|
+
if (data instanceof String || typeof data === "string") {
|
|
15
|
+
return getChunkUint8Array(Buffer.from(data), partSize);
|
|
16
|
+
}
|
|
17
|
+
if (typeof data.stream === "function") {
|
|
18
|
+
return getChunkStream(data.stream(), partSize, getDataReadableStream);
|
|
19
|
+
}
|
|
20
|
+
if (data instanceof ReadableStream) {
|
|
21
|
+
return getChunkStream(data, partSize, getDataReadableStream);
|
|
22
|
+
}
|
|
23
|
+
throw new Error("Body Data is unsupported format, expected data to be one of: string | Uint8Array | Buffer | Readable | ReadableStream | Blob;.");
|
|
24
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Buffer } from "buffer";
|
|
2
|
+
export async function* getChunkStream(data, partSize, getNextData) {
|
|
3
|
+
let partNumber = 1;
|
|
4
|
+
const currentBuffer = { chunks: [], length: 0 };
|
|
5
|
+
for await (const datum of getNextData(data)) {
|
|
6
|
+
currentBuffer.chunks.push(datum);
|
|
7
|
+
currentBuffer.length += datum.byteLength;
|
|
8
|
+
while (currentBuffer.length > partSize) {
|
|
9
|
+
const dataChunk = currentBuffer.chunks.length > 1 ? Buffer.concat(currentBuffer.chunks) : currentBuffer.chunks[0];
|
|
10
|
+
yield {
|
|
11
|
+
partNumber,
|
|
12
|
+
data: dataChunk.subarray(0, partSize),
|
|
13
|
+
};
|
|
14
|
+
currentBuffer.chunks = [dataChunk.subarray(partSize)];
|
|
15
|
+
currentBuffer.length = currentBuffer.chunks[0].byteLength;
|
|
16
|
+
partNumber += 1;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
yield {
|
|
20
|
+
partNumber,
|
|
21
|
+
data: currentBuffer.chunks.length !== 1 ? Buffer.concat(currentBuffer.chunks) : currentBuffer.chunks[0],
|
|
22
|
+
lastPart: true,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export async function* getChunkUint8Array(data, partSize) {
|
|
2
|
+
let partNumber = 1;
|
|
3
|
+
let startByte = 0;
|
|
4
|
+
let endByte = partSize;
|
|
5
|
+
while (endByte < data.byteLength) {
|
|
6
|
+
yield {
|
|
7
|
+
partNumber,
|
|
8
|
+
data: data.subarray(startByte, endByte),
|
|
9
|
+
};
|
|
10
|
+
partNumber += 1;
|
|
11
|
+
startByte = endByte;
|
|
12
|
+
endByte = startByte + partSize;
|
|
13
|
+
}
|
|
14
|
+
yield {
|
|
15
|
+
partNumber,
|
|
16
|
+
data: data.subarray(startByte),
|
|
17
|
+
lastPart: true,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Buffer } from "buffer";
|
|
2
|
+
export async function* getDataReadableStream(data) {
|
|
3
|
+
const reader = data.getReader();
|
|
4
|
+
try {
|
|
5
|
+
while (true) {
|
|
6
|
+
const { done, value } = await reader.read();
|
|
7
|
+
if (done) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
if (Buffer.isBuffer(value) || value instanceof Uint8Array) {
|
|
11
|
+
yield value;
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
yield Buffer.from(value);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
catch (e) {
|
|
19
|
+
throw e;
|
|
20
|
+
}
|
|
21
|
+
finally {
|
|
22
|
+
reader.releaseLock();
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { CompleteMultipartUploadCommandOutput } from "@aws-sdk/client-s3";
|
|
3
|
+
import { EventEmitter } from "events";
|
|
4
|
+
import { BodyDataTypes, Options, Progress } from "./types";
|
|
5
|
+
export interface RawDataPart {
|
|
6
|
+
partNumber: number;
|
|
7
|
+
data: BodyDataTypes;
|
|
8
|
+
lastPart?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare class Upload extends EventEmitter {
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
* modified in testing only.
|
|
14
|
+
*/
|
|
15
|
+
private static MIN_PART_SIZE;
|
|
16
|
+
/**
|
|
17
|
+
* S3 multipart upload does not allow more than 10,000 parts.
|
|
18
|
+
*/
|
|
19
|
+
private MAX_PARTS;
|
|
20
|
+
private readonly queueSize;
|
|
21
|
+
private readonly partSize;
|
|
22
|
+
private readonly leavePartsOnError;
|
|
23
|
+
private readonly tags;
|
|
24
|
+
private readonly client;
|
|
25
|
+
private readonly params;
|
|
26
|
+
private totalBytes?;
|
|
27
|
+
private bytesUploadedSoFar;
|
|
28
|
+
private abortController;
|
|
29
|
+
private concurrentUploaders;
|
|
30
|
+
private createMultiPartPromise?;
|
|
31
|
+
private abortMultipartUploadCommand;
|
|
32
|
+
private uploadedParts;
|
|
33
|
+
private uploadEnqueuedPartsCount;
|
|
34
|
+
/**
|
|
35
|
+
* Last UploadId if the upload was done with MultipartUpload and not PutObject.
|
|
36
|
+
*/
|
|
37
|
+
uploadId?: string;
|
|
38
|
+
uploadEvent?: string;
|
|
39
|
+
private isMultiPart;
|
|
40
|
+
private singleUploadResult?;
|
|
41
|
+
private sent;
|
|
42
|
+
constructor(options: Options);
|
|
43
|
+
abort(): Promise<void>;
|
|
44
|
+
done(): Promise<CompleteMultipartUploadCommandOutput>;
|
|
45
|
+
on(event: "httpUploadProgress", listener: (progress: Progress) => void): this;
|
|
46
|
+
private __uploadUsingPut;
|
|
47
|
+
private __createMultipartUpload;
|
|
48
|
+
private __doConcurrentUpload;
|
|
49
|
+
private __doMultipartUpload;
|
|
50
|
+
/**
|
|
51
|
+
* Abort the last multipart upload in progress
|
|
52
|
+
* if we know the upload id, the user did not specify to leave the parts, and
|
|
53
|
+
* we have a prepared AbortMultipartUpload command.
|
|
54
|
+
*/
|
|
55
|
+
private markUploadAsAborted;
|
|
56
|
+
private __notifyProgress;
|
|
57
|
+
private __abortTimeout;
|
|
58
|
+
private __validateInput;
|
|
59
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const byteLength: (input: any) => any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getDataReadableStream(data: ReadableStream): AsyncGenerator<Uint8Array>;
|