@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,240 @@
|
|
|
1
|
+
/* eslint-disable no-async-promise-executor */
|
|
2
|
+
|
|
3
|
+
const debug = require('debug')('ali-oss:multipart-copy');
|
|
4
|
+
const copy = require('copy-to');
|
|
5
|
+
|
|
6
|
+
const proto = exports;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Upload a part copy in a multipart from the source bucket/object
|
|
10
|
+
* used with initMultipartUpload and completeMultipartUpload.
|
|
11
|
+
* @param {String} name copy object name
|
|
12
|
+
* @param {String} uploadId the upload id
|
|
13
|
+
* @param {Number} partNo the part number
|
|
14
|
+
* @param {String} range like 0-102400 part size need to copy
|
|
15
|
+
* @param {Object} sourceData
|
|
16
|
+
* {String} sourceData.sourceKey the source object name
|
|
17
|
+
* {String} sourceData.sourceBucketName the source bucket name
|
|
18
|
+
* @param {Object} options
|
|
19
|
+
*/
|
|
20
|
+
/* eslint max-len: [0] */
|
|
21
|
+
proto.uploadPartCopy = async function uploadPartCopy(name, uploadId, partNo, range, sourceData, options = {}) {
|
|
22
|
+
options.headers = options.headers || {};
|
|
23
|
+
const versionId = options.versionId || (options.subres && options.subres.versionId) || null;
|
|
24
|
+
let copySource;
|
|
25
|
+
if (versionId) {
|
|
26
|
+
copySource = `/${sourceData.sourceBucketName}/${encodeURIComponent(sourceData.sourceKey)}?versionId=${versionId}`;
|
|
27
|
+
} else {
|
|
28
|
+
copySource = `/${sourceData.sourceBucketName}/${encodeURIComponent(sourceData.sourceKey)}`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
options.headers['x-oss-copy-source'] = copySource;
|
|
32
|
+
if (range) {
|
|
33
|
+
options.headers['x-oss-copy-source-range'] = `bytes=${range}`;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
options.subres = {
|
|
37
|
+
partNumber: partNo,
|
|
38
|
+
uploadId
|
|
39
|
+
};
|
|
40
|
+
const params = this._objectRequestParams('PUT', name, options);
|
|
41
|
+
params.mime = options.mime;
|
|
42
|
+
params.successStatuses = [200];
|
|
43
|
+
|
|
44
|
+
const result = await this.request(params);
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
name,
|
|
48
|
+
etag: result.res.headers.etag,
|
|
49
|
+
res: result.res
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @param {String} name copy object name
|
|
55
|
+
* @param {Object} sourceData
|
|
56
|
+
* {String} sourceData.sourceKey the source object name
|
|
57
|
+
* {String} sourceData.sourceBucketName the source bucket name
|
|
58
|
+
* {Number} sourceData.startOffset data copy start byte offset, e.g: 0
|
|
59
|
+
* {Number} sourceData.endOffset data copy end byte offset, e.g: 102400
|
|
60
|
+
* @param {Object} options
|
|
61
|
+
* {Number} options.partSize
|
|
62
|
+
*/
|
|
63
|
+
proto.multipartUploadCopy = async function multipartUploadCopy(name, sourceData, options = {}) {
|
|
64
|
+
this.resetCancelFlag();
|
|
65
|
+
const { versionId = null } = options;
|
|
66
|
+
const metaOpt = {
|
|
67
|
+
versionId
|
|
68
|
+
};
|
|
69
|
+
const objectMeta = await this._getObjectMeta(sourceData.sourceBucketName, sourceData.sourceKey, metaOpt);
|
|
70
|
+
const fileSize = objectMeta.res.headers['content-length'];
|
|
71
|
+
sourceData.startOffset = sourceData.startOffset || 0;
|
|
72
|
+
sourceData.endOffset = sourceData.endOffset || fileSize;
|
|
73
|
+
|
|
74
|
+
if (options.checkpoint && options.checkpoint.uploadId) {
|
|
75
|
+
return await this._resumeMultipartCopy(options.checkpoint, sourceData, options);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const minPartSize = 100 * 1024;
|
|
79
|
+
|
|
80
|
+
const copySize = sourceData.endOffset - sourceData.startOffset;
|
|
81
|
+
if (copySize < minPartSize) {
|
|
82
|
+
throw new Error(`copySize must not be smaller than ${minPartSize}`);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (options.partSize && options.partSize < minPartSize) {
|
|
86
|
+
throw new Error(`partSize must not be smaller than ${minPartSize}`);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const init = await this.initMultipartUpload(name, options);
|
|
90
|
+
const { uploadId } = init;
|
|
91
|
+
const partSize = this._getPartSize(copySize, options.partSize);
|
|
92
|
+
|
|
93
|
+
const checkpoint = {
|
|
94
|
+
name,
|
|
95
|
+
copySize,
|
|
96
|
+
partSize,
|
|
97
|
+
uploadId,
|
|
98
|
+
doneParts: []
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
if (options && options.progress) {
|
|
102
|
+
await options.progress(0, checkpoint, init.res);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return await this._resumeMultipartCopy(checkpoint, sourceData, options);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
/*
|
|
109
|
+
* Resume multipart copy from checkpoint. The checkpoint will be
|
|
110
|
+
* updated after each successful part copy.
|
|
111
|
+
* @param {Object} checkpoint the checkpoint
|
|
112
|
+
* @param {Object} options
|
|
113
|
+
*/
|
|
114
|
+
proto._resumeMultipartCopy = async function _resumeMultipartCopy(checkpoint, sourceData, options) {
|
|
115
|
+
if (this.isCancel()) {
|
|
116
|
+
throw this._makeCancelEvent();
|
|
117
|
+
}
|
|
118
|
+
const { versionId = null } = options;
|
|
119
|
+
const metaOpt = {
|
|
120
|
+
versionId
|
|
121
|
+
};
|
|
122
|
+
const { copySize, partSize, uploadId, doneParts, name } = checkpoint;
|
|
123
|
+
|
|
124
|
+
const partOffs = this._divideMultipartCopyParts(copySize, partSize, sourceData.startOffset);
|
|
125
|
+
const numParts = partOffs.length;
|
|
126
|
+
|
|
127
|
+
const uploadPartCopyOptions = {
|
|
128
|
+
headers: {}
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
if (options.copyheaders) {
|
|
132
|
+
copy(options.copyheaders).to(uploadPartCopyOptions.headers);
|
|
133
|
+
}
|
|
134
|
+
if (versionId) {
|
|
135
|
+
copy(metaOpt).to(uploadPartCopyOptions);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const uploadPartJob = function uploadPartJob(self, partNo, source) {
|
|
139
|
+
return new Promise(async (resolve, reject) => {
|
|
140
|
+
try {
|
|
141
|
+
if (!self.isCancel()) {
|
|
142
|
+
const pi = partOffs[partNo - 1];
|
|
143
|
+
const range = `${pi.start}-${pi.end - 1}`;
|
|
144
|
+
|
|
145
|
+
let result;
|
|
146
|
+
try {
|
|
147
|
+
result = await self.uploadPartCopy(name, uploadId, partNo, range, source, uploadPartCopyOptions);
|
|
148
|
+
} catch (error) {
|
|
149
|
+
if (error.status === 404) {
|
|
150
|
+
throw self._makeAbortEvent();
|
|
151
|
+
}
|
|
152
|
+
throw error;
|
|
153
|
+
}
|
|
154
|
+
if (!self.isCancel()) {
|
|
155
|
+
debug(`content-range ${result.res.headers['content-range']}`);
|
|
156
|
+
doneParts.push({
|
|
157
|
+
number: partNo,
|
|
158
|
+
etag: result.res.headers.etag
|
|
159
|
+
});
|
|
160
|
+
checkpoint.doneParts = doneParts;
|
|
161
|
+
|
|
162
|
+
if (options && options.progress) {
|
|
163
|
+
await options.progress(doneParts.length / numParts, checkpoint, result.res);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
resolve();
|
|
168
|
+
} catch (err) {
|
|
169
|
+
err.partNum = partNo;
|
|
170
|
+
reject(err);
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const all = Array.from(new Array(numParts), (x, i) => i + 1);
|
|
176
|
+
const done = doneParts.map(p => p.number);
|
|
177
|
+
const todo = all.filter(p => done.indexOf(p) < 0);
|
|
178
|
+
const defaultParallel = 5;
|
|
179
|
+
const parallel = options.parallel || defaultParallel;
|
|
180
|
+
|
|
181
|
+
if (this.checkBrowserAndVersion('Internet Explorer', '10') || parallel === 1) {
|
|
182
|
+
for (let i = 0; i < todo.length; i++) {
|
|
183
|
+
if (this.isCancel()) {
|
|
184
|
+
throw this._makeCancelEvent();
|
|
185
|
+
}
|
|
186
|
+
/* eslint no-await-in-loop: [0] */
|
|
187
|
+
await uploadPartJob(this, todo[i], sourceData);
|
|
188
|
+
}
|
|
189
|
+
} else {
|
|
190
|
+
// upload in parallel
|
|
191
|
+
const errors = await this._parallelNode(todo, parallel, uploadPartJob, sourceData);
|
|
192
|
+
|
|
193
|
+
const abortEvent = errors.find(err => err.name === 'abort');
|
|
194
|
+
if (abortEvent) throw abortEvent;
|
|
195
|
+
|
|
196
|
+
if (this.isCancel()) {
|
|
197
|
+
throw this._makeCancelEvent();
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// check errors after all jobs are completed
|
|
201
|
+
if (errors && errors.length > 0) {
|
|
202
|
+
const err = errors[0];
|
|
203
|
+
err.message = `Failed to copy some parts with error: ${err.toString()} part_num: ${err.partNum}`;
|
|
204
|
+
throw err;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return await this.completeMultipartUpload(name, uploadId, doneParts, options);
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
proto._divideMultipartCopyParts = function _divideMultipartCopyParts(fileSize, partSize, startOffset) {
|
|
212
|
+
const numParts = Math.ceil(fileSize / partSize);
|
|
213
|
+
|
|
214
|
+
const partOffs = [];
|
|
215
|
+
for (let i = 0; i < numParts; i++) {
|
|
216
|
+
const start = partSize * i + startOffset;
|
|
217
|
+
const end = Math.min(start + partSize, fileSize + startOffset);
|
|
218
|
+
|
|
219
|
+
partOffs.push({
|
|
220
|
+
start,
|
|
221
|
+
end
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
return partOffs;
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Get Object Meta
|
|
230
|
+
* @param {String} bucket bucket name
|
|
231
|
+
* @param {String} name object name
|
|
232
|
+
* @param {Object} options
|
|
233
|
+
*/
|
|
234
|
+
proto._getObjectMeta = async function _getObjectMeta(bucket, name, options) {
|
|
235
|
+
const currentBucket = this.getBucket();
|
|
236
|
+
this.setBucket(bucket);
|
|
237
|
+
const data = await this.head(name, options);
|
|
238
|
+
this.setBucket(currentBucket);
|
|
239
|
+
return data;
|
|
240
|
+
};
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
const copy = require('copy-to');
|
|
2
|
+
const callback = require('./callback');
|
|
3
|
+
const { deepCopyWith } = require('./utils/deepCopy');
|
|
4
|
+
const { isBuffer } = require('./utils/isBuffer');
|
|
5
|
+
const { omit } = require('./utils/omit');
|
|
6
|
+
|
|
7
|
+
const proto = exports;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* List the on-going multipart uploads
|
|
11
|
+
* https://help.aliyun.com/document_detail/31997.html
|
|
12
|
+
* @param {Object} options
|
|
13
|
+
* @return {Array} the multipart uploads
|
|
14
|
+
*/
|
|
15
|
+
proto.listUploads = async function listUploads(query, options) {
|
|
16
|
+
options = options || {};
|
|
17
|
+
const opt = {};
|
|
18
|
+
copy(options).to(opt);
|
|
19
|
+
opt.subres = 'uploads';
|
|
20
|
+
const params = this._objectRequestParams('GET', '', opt);
|
|
21
|
+
params.query = query;
|
|
22
|
+
params.xmlResponse = true;
|
|
23
|
+
params.successStatuses = [200];
|
|
24
|
+
|
|
25
|
+
const result = await this.request(params);
|
|
26
|
+
let uploads = result.data.Upload || [];
|
|
27
|
+
if (!Array.isArray(uploads)) {
|
|
28
|
+
uploads = [uploads];
|
|
29
|
+
}
|
|
30
|
+
uploads = uploads.map(up => ({
|
|
31
|
+
name: up.Key,
|
|
32
|
+
uploadId: up.UploadId,
|
|
33
|
+
initiated: up.Initiated
|
|
34
|
+
}));
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
res: result.res,
|
|
38
|
+
uploads,
|
|
39
|
+
bucket: result.data.Bucket,
|
|
40
|
+
nextKeyMarker: result.data.NextKeyMarker,
|
|
41
|
+
nextUploadIdMarker: result.data.NextUploadIdMarker,
|
|
42
|
+
isTruncated: result.data.IsTruncated === 'true'
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* List the done uploadPart parts
|
|
48
|
+
* @param {String} name object name
|
|
49
|
+
* @param {String} uploadId multipart upload id
|
|
50
|
+
* @param {Object} query
|
|
51
|
+
* {Number} query.max-parts The maximum part number in the response of the OSS. Default value: 1000
|
|
52
|
+
* {Number} query.part-number-marker Starting position of a specific list.
|
|
53
|
+
* {String} query.encoding-type Specify the encoding of the returned content and the encoding type.
|
|
54
|
+
* @param {Object} options
|
|
55
|
+
* @return {Object} result
|
|
56
|
+
*/
|
|
57
|
+
proto.listParts = async function listParts(name, uploadId, query, options) {
|
|
58
|
+
options = options || {};
|
|
59
|
+
const opt = {};
|
|
60
|
+
copy(options).to(opt);
|
|
61
|
+
opt.subres = {
|
|
62
|
+
uploadId
|
|
63
|
+
};
|
|
64
|
+
const params = this._objectRequestParams('GET', name, opt);
|
|
65
|
+
params.query = query;
|
|
66
|
+
params.xmlResponse = true;
|
|
67
|
+
params.successStatuses = [200];
|
|
68
|
+
|
|
69
|
+
const result = await this.request(params);
|
|
70
|
+
|
|
71
|
+
return {
|
|
72
|
+
res: result.res,
|
|
73
|
+
uploadId: result.data.UploadId,
|
|
74
|
+
bucket: result.data.Bucket,
|
|
75
|
+
name: result.data.Key,
|
|
76
|
+
partNumberMarker: result.data.PartNumberMarker,
|
|
77
|
+
nextPartNumberMarker: result.data.NextPartNumberMarker,
|
|
78
|
+
maxParts: result.data.MaxParts,
|
|
79
|
+
isTruncated: result.data.IsTruncated,
|
|
80
|
+
parts: result.data.Part || []
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Abort a multipart upload transaction
|
|
86
|
+
* @param {String} name the object name
|
|
87
|
+
* @param {String} uploadId the upload id
|
|
88
|
+
* @param {Object} options
|
|
89
|
+
*/
|
|
90
|
+
proto.abortMultipartUpload = async function abortMultipartUpload(name, uploadId, options) {
|
|
91
|
+
this._stop();
|
|
92
|
+
options = options || {};
|
|
93
|
+
const opt = {};
|
|
94
|
+
copy(options).to(opt);
|
|
95
|
+
opt.subres = { uploadId };
|
|
96
|
+
const params = this._objectRequestParams('DELETE', name, opt);
|
|
97
|
+
params.successStatuses = [204];
|
|
98
|
+
|
|
99
|
+
const result = await this.request(params);
|
|
100
|
+
return {
|
|
101
|
+
res: result.res
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Initiate a multipart upload transaction
|
|
107
|
+
* @param {String} name the object name
|
|
108
|
+
* @param {Object} options
|
|
109
|
+
* @return {String} upload id
|
|
110
|
+
*/
|
|
111
|
+
proto.initMultipartUpload = async function initMultipartUpload(name, options) {
|
|
112
|
+
options = options || {};
|
|
113
|
+
const opt = {};
|
|
114
|
+
copy(options).to(opt);
|
|
115
|
+
opt.headers = opt.headers || {};
|
|
116
|
+
this._convertMetaToHeaders(options.meta, opt.headers);
|
|
117
|
+
|
|
118
|
+
opt.subres = 'uploads';
|
|
119
|
+
const params = this._objectRequestParams('POST', name, opt);
|
|
120
|
+
params.mime = options.mime;
|
|
121
|
+
params.xmlResponse = true;
|
|
122
|
+
params.successStatuses = [200];
|
|
123
|
+
|
|
124
|
+
const result = await this.request(params);
|
|
125
|
+
|
|
126
|
+
return {
|
|
127
|
+
res: result.res,
|
|
128
|
+
bucket: result.data.Bucket,
|
|
129
|
+
name: result.data.Key,
|
|
130
|
+
uploadId: result.data.UploadId
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Upload a part in a multipart upload transaction
|
|
136
|
+
* @param {String} name the object name
|
|
137
|
+
* @param {String} uploadId the upload id
|
|
138
|
+
* @param {Integer} partNo the part number
|
|
139
|
+
* @param {File} file upload File, whole File
|
|
140
|
+
* @param {Integer} start part start bytes e.g: 102400
|
|
141
|
+
* @param {Integer} end part end bytes e.g: 204800
|
|
142
|
+
* @param {Object} options
|
|
143
|
+
*/
|
|
144
|
+
proto.uploadPart = async function uploadPart(name, uploadId, partNo, file, start, end, options) {
|
|
145
|
+
const data = {
|
|
146
|
+
size: end - start
|
|
147
|
+
};
|
|
148
|
+
const isBrowserEnv = process && process.browser;
|
|
149
|
+
isBrowserEnv
|
|
150
|
+
? (data.content = await this._createBuffer(file, start, end))
|
|
151
|
+
: (data.stream = await this._createStream(file, start, end));
|
|
152
|
+
return await this._uploadPart(name, uploadId, partNo, data, options);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Complete a multipart upload transaction
|
|
157
|
+
* @param {String} name the object name
|
|
158
|
+
* @param {String} uploadId the upload id
|
|
159
|
+
* @param {Array} parts the uploaded parts, each in the structure:
|
|
160
|
+
* {Integer} number partNo
|
|
161
|
+
* {String} etag part etag uploadPartCopy result.res.header.etag
|
|
162
|
+
* @param {Object} options
|
|
163
|
+
* {Object} options.callback The callback parameter is composed of a JSON string encoded in Base64
|
|
164
|
+
* {String} options.callback.url the OSS sends a callback request to this URL
|
|
165
|
+
* {String} options.callback.host The host header value for initiating callback requests
|
|
166
|
+
* {String} options.callback.body The value of the request body when a callback is initiated
|
|
167
|
+
* {String} options.callback.contentType The Content-Type of the callback requests initiatiated
|
|
168
|
+
* {Object} options.callback.customValue Custom parameters are a map of key-values, e.g:
|
|
169
|
+
* customValue = {
|
|
170
|
+
* key1: 'value1',
|
|
171
|
+
* key2: 'value2'
|
|
172
|
+
* }
|
|
173
|
+
*/
|
|
174
|
+
proto.completeMultipartUpload = async function completeMultipartUpload(name, uploadId, parts, options) {
|
|
175
|
+
const completeParts = parts
|
|
176
|
+
.concat()
|
|
177
|
+
.sort((a, b) => a.number - b.number)
|
|
178
|
+
.filter((item, index, arr) => !index || item.number !== arr[index - 1].number);
|
|
179
|
+
let xml = '<?xml version="1.0" encoding="UTF-8"?>\n<CompleteMultipartUpload>\n';
|
|
180
|
+
for (let i = 0; i < completeParts.length; i++) {
|
|
181
|
+
const p = completeParts[i];
|
|
182
|
+
xml += '<Part>\n';
|
|
183
|
+
xml += `<PartNumber>${p.number}</PartNumber>\n`;
|
|
184
|
+
xml += `<ETag>${p.etag}</ETag>\n`;
|
|
185
|
+
xml += '</Part>\n';
|
|
186
|
+
}
|
|
187
|
+
xml += '</CompleteMultipartUpload>';
|
|
188
|
+
|
|
189
|
+
options = options || {};
|
|
190
|
+
let opt = {};
|
|
191
|
+
opt = deepCopyWith(options, _ => {
|
|
192
|
+
if (isBuffer(_)) return null;
|
|
193
|
+
});
|
|
194
|
+
opt.subres = { uploadId };
|
|
195
|
+
opt.headers = omit(opt.headers, ['x-oss-server-side-encryption', 'x-oss-storage-class']);
|
|
196
|
+
|
|
197
|
+
const params = this._objectRequestParams('POST', name, opt);
|
|
198
|
+
callback.encodeCallback(params, opt);
|
|
199
|
+
params.mime = 'xml';
|
|
200
|
+
params.content = xml;
|
|
201
|
+
|
|
202
|
+
if (!(params.headers && params.headers['x-oss-callback'])) {
|
|
203
|
+
params.xmlResponse = true;
|
|
204
|
+
}
|
|
205
|
+
params.successStatuses = [200];
|
|
206
|
+
const result = await this.request(params);
|
|
207
|
+
|
|
208
|
+
if (options.progress) {
|
|
209
|
+
await options.progress(1, null, result.res);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const ret = {
|
|
213
|
+
res: result.res,
|
|
214
|
+
bucket: params.bucket,
|
|
215
|
+
name,
|
|
216
|
+
etag: result.res.headers.etag
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
if (params.headers && params.headers['x-oss-callback']) {
|
|
220
|
+
ret.data = JSON.parse(result.data.toString());
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
return ret;
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Upload a part in a multipart upload transaction
|
|
228
|
+
* @param {String} name the object name
|
|
229
|
+
* @param {String} uploadId the upload id
|
|
230
|
+
* @param {Integer} partNo the part number
|
|
231
|
+
* @param {Object} data the body data
|
|
232
|
+
* @param {Object} options
|
|
233
|
+
*/
|
|
234
|
+
proto._uploadPart = async function _uploadPart(name, uploadId, partNo, data, options) {
|
|
235
|
+
options = options || {};
|
|
236
|
+
const opt = {};
|
|
237
|
+
copy(options).to(opt);
|
|
238
|
+
opt.headers = opt.headers || {};
|
|
239
|
+
opt.headers['Content-Length'] = data.size;
|
|
240
|
+
|
|
241
|
+
// Uploading shards does not require x-oss server side encryption
|
|
242
|
+
opt.headers = omit(opt.headers, ['x-oss-server-side-encryption']);
|
|
243
|
+
opt.subres = {
|
|
244
|
+
partNumber: partNo,
|
|
245
|
+
uploadId
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
const params = this._objectRequestParams('PUT', name, opt);
|
|
249
|
+
params.mime = opt.mime;
|
|
250
|
+
const isBrowserEnv = process && process.browser;
|
|
251
|
+
isBrowserEnv ? (params.content = data.content) : (params.stream = data.stream);
|
|
252
|
+
params.successStatuses = [200];
|
|
253
|
+
params.disabledMD5 = options.disabledMD5;
|
|
254
|
+
|
|
255
|
+
const result = await this.request(params);
|
|
256
|
+
|
|
257
|
+
if (!result.res.headers.etag) {
|
|
258
|
+
throw new Error(
|
|
259
|
+
'Please set the etag of expose-headers in OSS \n https://help.aliyun.com/document_detail/32069.html'
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
if (data.stream) {
|
|
263
|
+
data.stream = null;
|
|
264
|
+
params.stream = null;
|
|
265
|
+
}
|
|
266
|
+
return {
|
|
267
|
+
name,
|
|
268
|
+
etag: result.res.headers.etag,
|
|
269
|
+
res: result.res
|
|
270
|
+
};
|
|
271
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const urlutil = require('url');
|
|
2
|
+
const utility = require('utility');
|
|
3
|
+
const copy = require('copy-to');
|
|
4
|
+
const signHelper = require('../../common/signUtils');
|
|
5
|
+
const { isIP } = require('../utils/isIP');
|
|
6
|
+
const { setSTSToken } = require('../utils/setSTSToken');
|
|
7
|
+
const { isFunction } = require('../utils/isFunction');
|
|
8
|
+
|
|
9
|
+
const proto = exports;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* asyncSignatureUrl
|
|
13
|
+
* @param {String} name object name
|
|
14
|
+
* @param {Object} options options
|
|
15
|
+
* @param {boolean} [strictObjectNameValidation=true] the flag of verifying object name strictly
|
|
16
|
+
*/
|
|
17
|
+
proto.asyncSignatureUrl = async function asyncSignatureUrl(name, options, strictObjectNameValidation = true) {
|
|
18
|
+
if (isIP(this.options.endpoint.hostname)) {
|
|
19
|
+
throw new Error('can not get the object URL when endpoint is IP');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (strictObjectNameValidation && /^\?/.test(name)) {
|
|
23
|
+
throw new Error(`Invalid object name ${name}`);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
options = options || {};
|
|
27
|
+
name = this._objectName(name);
|
|
28
|
+
options.method = options.method || 'GET';
|
|
29
|
+
const expires = utility.timestamp() + (options.expires || 1800);
|
|
30
|
+
const params = {
|
|
31
|
+
bucket: this.options.bucket,
|
|
32
|
+
object: name
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const resource = this._getResource(params);
|
|
36
|
+
|
|
37
|
+
if (this.options.stsToken && isFunction(this.options.refreshSTSToken)) {
|
|
38
|
+
await setSTSToken.call(this);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (this.options.stsToken) {
|
|
42
|
+
options['security-token'] = this.options.stsToken;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const signRes = signHelper._signatureForURL(this.options.accessKeySecret, options, resource, expires);
|
|
46
|
+
|
|
47
|
+
const url = urlutil.parse(this._getReqUrl(params));
|
|
48
|
+
url.query = {
|
|
49
|
+
OSSAccessKeyId: this.options.accessKeyId,
|
|
50
|
+
Expires: expires,
|
|
51
|
+
Signature: signRes.Signature
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
copy(signRes.subResource).to(url.query);
|
|
55
|
+
|
|
56
|
+
return url.format();
|
|
57
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const { policy2Str } = require('../utils/policy2Str');
|
|
2
|
+
const signHelper = require('../signUtils');
|
|
3
|
+
const { isObject } = require('../utils/isObject');
|
|
4
|
+
|
|
5
|
+
const proto = exports;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @param {Object or JSON} policy specifies the validity of the fields in the request.
|
|
9
|
+
* @return {Object} params
|
|
10
|
+
* {String} params.OSSAccessKeyId
|
|
11
|
+
* {String} params.Signature
|
|
12
|
+
* {String} params.policy JSON text encoded with UTF-8 and Base64.
|
|
13
|
+
*/
|
|
14
|
+
proto.calculatePostSignature = function calculatePostSignature(policy) {
|
|
15
|
+
if (!isObject(policy) && typeof policy !== 'string') {
|
|
16
|
+
throw new Error('policy must be JSON string or Object');
|
|
17
|
+
}
|
|
18
|
+
if (!isObject(policy)) {
|
|
19
|
+
try {
|
|
20
|
+
JSON.stringify(JSON.parse(policy));
|
|
21
|
+
} catch (error) {
|
|
22
|
+
throw new Error('policy must be JSON string or Object');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
policy = Buffer.from(policy2Str(policy), 'utf8').toString('base64');
|
|
26
|
+
|
|
27
|
+
const Signature = signHelper.computeSignature(this.options.accessKeySecret, policy);
|
|
28
|
+
|
|
29
|
+
const query = {
|
|
30
|
+
OSSAccessKeyId: this.options.accessKeyId,
|
|
31
|
+
Signature,
|
|
32
|
+
policy
|
|
33
|
+
};
|
|
34
|
+
return query;
|
|
35
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const { checkBucketName: _checkBucketName } = require('../utils/checkBucketName');
|
|
2
|
+
|
|
3
|
+
const proto = exports;
|
|
4
|
+
|
|
5
|
+
const REPLACE_HEDERS = [
|
|
6
|
+
'content-type',
|
|
7
|
+
'content-encoding',
|
|
8
|
+
'content-language',
|
|
9
|
+
'content-disposition',
|
|
10
|
+
'cache-control',
|
|
11
|
+
'expires'
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
proto.copy = async function copy(name, sourceName, bucketName, options) {
|
|
15
|
+
if (typeof bucketName === 'object') {
|
|
16
|
+
options = bucketName; // 兼容旧版本,旧版本第三个参数为options
|
|
17
|
+
}
|
|
18
|
+
options = options || {};
|
|
19
|
+
options.headers = options.headers || {};
|
|
20
|
+
|
|
21
|
+
Object.keys(options.headers).forEach(key => {
|
|
22
|
+
options.headers[`x-oss-copy-source-${key.toLowerCase()}`] = options.headers[key];
|
|
23
|
+
});
|
|
24
|
+
if (options.meta || Object.keys(options.headers).find(_ => REPLACE_HEDERS.includes(_.toLowerCase()))) {
|
|
25
|
+
options.headers['x-oss-metadata-directive'] = 'REPLACE';
|
|
26
|
+
}
|
|
27
|
+
this._convertMetaToHeaders(options.meta, options.headers);
|
|
28
|
+
|
|
29
|
+
sourceName = this._getSourceName(sourceName, bucketName);
|
|
30
|
+
|
|
31
|
+
if (options.versionId) {
|
|
32
|
+
sourceName = `${sourceName}?versionId=${options.versionId}`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
options.headers['x-oss-copy-source'] = sourceName;
|
|
36
|
+
|
|
37
|
+
const params = this._objectRequestParams('PUT', name, options);
|
|
38
|
+
params.xmlResponse = true;
|
|
39
|
+
params.successStatuses = [200, 304];
|
|
40
|
+
|
|
41
|
+
const result = await this.request(params);
|
|
42
|
+
|
|
43
|
+
let { data } = result;
|
|
44
|
+
if (data) {
|
|
45
|
+
data = {
|
|
46
|
+
etag: data.ETag,
|
|
47
|
+
lastModified: data.LastModified
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return {
|
|
52
|
+
data,
|
|
53
|
+
res: result.res
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
// todo delete
|
|
58
|
+
proto._getSourceName = function _getSourceName(sourceName, bucketName) {
|
|
59
|
+
if (typeof bucketName === 'string') {
|
|
60
|
+
sourceName = this._objectName(sourceName);
|
|
61
|
+
} else if (sourceName[0] !== '/') {
|
|
62
|
+
bucketName = this.options.bucket;
|
|
63
|
+
} else {
|
|
64
|
+
bucketName = sourceName.replace(/\/(.+?)(\/.*)/, '$1');
|
|
65
|
+
sourceName = sourceName.replace(/(\/.+?\/)(.*)/, '$2');
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
_checkBucketName(bucketName);
|
|
69
|
+
|
|
70
|
+
sourceName = encodeURIComponent(sourceName);
|
|
71
|
+
|
|
72
|
+
sourceName = `/${bucketName}/${sourceName}`;
|
|
73
|
+
return sourceName;
|
|
74
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const proto = exports;
|
|
2
|
+
/**
|
|
3
|
+
* delete
|
|
4
|
+
* @param {String} name - object name
|
|
5
|
+
* @param {Object} options
|
|
6
|
+
* @param {{res}}
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
proto.delete = async function _delete(name, options = {}) {
|
|
10
|
+
options.subres = Object.assign({}, options.subres);
|
|
11
|
+
if (options.versionId) {
|
|
12
|
+
options.subres.versionId = options.versionId;
|
|
13
|
+
}
|
|
14
|
+
const params = this._objectRequestParams('DELETE', name, options);
|
|
15
|
+
params.successStatuses = [204];
|
|
16
|
+
|
|
17
|
+
const result = await this.request(params);
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
res: result.res
|
|
21
|
+
};
|
|
22
|
+
};
|