@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,127 @@
|
|
|
1
|
+
/* eslint-disable no-use-before-define */
|
|
2
|
+
const { checkBucketName: _checkBucketName } = require('../utils/checkBucketName');
|
|
3
|
+
const { isArray } = require('../utils/isArray');
|
|
4
|
+
const { deepCopy } = require('../utils/deepCopy');
|
|
5
|
+
const { isObject } = require('../utils/isObject');
|
|
6
|
+
const { obj2xml } = require('../utils/obj2xml');
|
|
7
|
+
const { checkObjectTag } = require('../utils/checkObjectTag');
|
|
8
|
+
const { getStrBytesCount } = require('../utils/getStrBytesCount');
|
|
9
|
+
|
|
10
|
+
const proto = exports;
|
|
11
|
+
|
|
12
|
+
proto.putBucketLifecycle = async function putBucketLifecycle(name, rules, options) {
|
|
13
|
+
_checkBucketName(name);
|
|
14
|
+
|
|
15
|
+
if (!isArray(rules)) {
|
|
16
|
+
throw new Error('rules must be Array');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const params = this._bucketRequestParams('PUT', name, 'lifecycle', options);
|
|
20
|
+
const Rule = [];
|
|
21
|
+
const paramXMLObj = {
|
|
22
|
+
LifecycleConfiguration: {
|
|
23
|
+
Rule
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
rules.forEach(_ => {
|
|
28
|
+
defaultDaysAndDate2Expiration(_); // todo delete, 兼容旧版本
|
|
29
|
+
checkRule(_);
|
|
30
|
+
if (_.id) {
|
|
31
|
+
_.ID = _.id;
|
|
32
|
+
delete _.id;
|
|
33
|
+
}
|
|
34
|
+
Rule.push(_);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const paramXML = obj2xml(paramXMLObj, {
|
|
38
|
+
headers: true,
|
|
39
|
+
firstUpperCase: true
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
params.content = paramXML;
|
|
43
|
+
params.mime = 'xml';
|
|
44
|
+
params.successStatuses = [200];
|
|
45
|
+
const result = await this.request(params);
|
|
46
|
+
return {
|
|
47
|
+
res: result.res
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// todo delete, 兼容旧版本
|
|
52
|
+
function defaultDaysAndDate2Expiration(obj) {
|
|
53
|
+
if (obj.days) {
|
|
54
|
+
obj.expiration = {
|
|
55
|
+
days: obj.days
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
if (obj.date) {
|
|
59
|
+
obj.expiration = {
|
|
60
|
+
createdBeforeDate: obj.date
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function checkDaysAndDate(obj, key) {
|
|
66
|
+
const { days, createdBeforeDate } = obj;
|
|
67
|
+
if (!days && !createdBeforeDate) {
|
|
68
|
+
throw new Error(`${key} must includes days or createdBeforeDate`);
|
|
69
|
+
} else if (days && !/^[1-9][0-9]*$/.test(days)) {
|
|
70
|
+
throw new Error('days must be a positive integer');
|
|
71
|
+
} else if (createdBeforeDate && !/\d{4}-\d{2}-\d{2}T00:00:00.000Z/.test(createdBeforeDate)) {
|
|
72
|
+
throw new Error('createdBeforeDate must be date and conform to iso8601 format');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function handleCheckTag(tag) {
|
|
77
|
+
if (!isArray(tag) && !isObject(tag)) {
|
|
78
|
+
throw new Error('tag must be Object or Array');
|
|
79
|
+
}
|
|
80
|
+
tag = isObject(tag) ? [tag] : tag;
|
|
81
|
+
const tagObj = {};
|
|
82
|
+
const tagClone = deepCopy(tag);
|
|
83
|
+
tagClone.forEach(v => {
|
|
84
|
+
tagObj[v.key] = v.value;
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
checkObjectTag(tagObj);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function checkRule(rule) {
|
|
91
|
+
if (rule.id && getStrBytesCount(rule.id) > 255) throw new Error('ID is composed of 255 bytes at most');
|
|
92
|
+
|
|
93
|
+
if (rule.prefix === undefined) throw new Error('Rule must includes prefix');
|
|
94
|
+
|
|
95
|
+
if (!['Enabled', 'Disabled'].includes(rule.status)) throw new Error('Status must be Enabled or Disabled');
|
|
96
|
+
|
|
97
|
+
if (rule.transition) {
|
|
98
|
+
if (!['IA', 'Archive'].includes(rule.transition.storageClass))
|
|
99
|
+
throw new Error('StorageClass must be IA or Archive');
|
|
100
|
+
checkDaysAndDate(rule.transition, 'Transition');
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (rule.expiration) {
|
|
104
|
+
if (!rule.expiration.expiredObjectDeleteMarker) {
|
|
105
|
+
checkDaysAndDate(rule.expiration, 'Expiration');
|
|
106
|
+
} else if (rule.expiration.days || rule.expiration.createdBeforeDate) {
|
|
107
|
+
throw new Error('expiredObjectDeleteMarker cannot be used with days or createdBeforeDate');
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (rule.abortMultipartUpload) {
|
|
112
|
+
checkDaysAndDate(rule.abortMultipartUpload, 'AbortMultipartUpload');
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (!rule.expiration && !rule.abortMultipartUpload && !rule.transition && !rule.noncurrentVersionTransition) {
|
|
116
|
+
throw new Error(
|
|
117
|
+
'Rule must includes expiration or abortMultipartUpload or transition or noncurrentVersionTransition'
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (rule.tag) {
|
|
122
|
+
if (rule.abortMultipartUpload) {
|
|
123
|
+
throw new Error('Tag cannot be used with abortMultipartUpload');
|
|
124
|
+
}
|
|
125
|
+
handleCheckTag(rule.tag);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const { checkBucketName: _checkBucketName } = require('../utils/checkBucketName');
|
|
2
|
+
const { policy2Str } = require('../utils/policy2Str');
|
|
3
|
+
const { isObject } = require('../utils/isObject');
|
|
4
|
+
|
|
5
|
+
const proto = exports;
|
|
6
|
+
/**
|
|
7
|
+
* putBucketPolicy
|
|
8
|
+
* @param {String} bucketName - bucket name
|
|
9
|
+
* @param {Object} policy - bucket policy
|
|
10
|
+
* @param {Object} options
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
proto.putBucketPolicy = async function putBucketPolicy(bucketName, policy, options = {}) {
|
|
14
|
+
_checkBucketName(bucketName);
|
|
15
|
+
|
|
16
|
+
if (!isObject(policy)) {
|
|
17
|
+
throw new Error('policy is not Object');
|
|
18
|
+
}
|
|
19
|
+
const params = this._bucketRequestParams('PUT', bucketName, 'policy', options);
|
|
20
|
+
params.content = policy2Str(policy);
|
|
21
|
+
params.successStatuses = [200];
|
|
22
|
+
const result = await this.request(params);
|
|
23
|
+
return {
|
|
24
|
+
status: result.status,
|
|
25
|
+
res: result.res
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const { checkBucketName: _checkBucketName } = require('../utils/checkBucketName');
|
|
2
|
+
const { obj2xml } = require('../utils/obj2xml');
|
|
3
|
+
|
|
4
|
+
const proto = exports;
|
|
5
|
+
/**
|
|
6
|
+
* putBucketRequestPayment
|
|
7
|
+
* @param {String} bucketName
|
|
8
|
+
* @param {String} payer
|
|
9
|
+
* @param {Object} options
|
|
10
|
+
*/
|
|
11
|
+
const payerAll = ['BucketOwner', 'Requester'];
|
|
12
|
+
|
|
13
|
+
proto.putBucketRequestPayment = async function putBucketRequestPayment(bucketName, payer, options) {
|
|
14
|
+
options = options || {};
|
|
15
|
+
if (!payer || payerAll.indexOf(payer) < 0) {
|
|
16
|
+
throw new Error('payer must be BucketOwner or Requester');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
_checkBucketName(bucketName);
|
|
20
|
+
const params = this._bucketRequestParams('PUT', bucketName, 'requestPayment', options);
|
|
21
|
+
params.successStatuses = [200];
|
|
22
|
+
|
|
23
|
+
const paramXMLObj = {
|
|
24
|
+
RequestPaymentConfiguration: {
|
|
25
|
+
Payer: payer
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const paramXML = obj2xml(paramXMLObj, {
|
|
29
|
+
headers: true
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
params.mime = 'xml';
|
|
33
|
+
params.content = paramXML;
|
|
34
|
+
|
|
35
|
+
const result = await this.request(params);
|
|
36
|
+
return {
|
|
37
|
+
status: result.status,
|
|
38
|
+
res: result.res
|
|
39
|
+
};
|
|
40
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const { checkBucketName: _checkBucketName } = require('../utils/checkBucketName');
|
|
2
|
+
const { obj2xml } = require('../utils/obj2xml');
|
|
3
|
+
const { checkBucketTag } = require('../utils/checkBucketTag');
|
|
4
|
+
|
|
5
|
+
const proto = exports;
|
|
6
|
+
/**
|
|
7
|
+
* putBucketTags
|
|
8
|
+
* @param {String} name - bucket name
|
|
9
|
+
* @param {Object} tag - bucket tag, eg: `{a: "1", b: "2"}`
|
|
10
|
+
* @param {Object} options
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
proto.putBucketTags = async function putBucketTags(name, tag, options = {}) {
|
|
14
|
+
_checkBucketName(name);
|
|
15
|
+
checkBucketTag(tag);
|
|
16
|
+
const params = this._bucketRequestParams('PUT', name, 'tagging', options);
|
|
17
|
+
params.successStatuses = [200];
|
|
18
|
+
tag = Object.keys(tag).map(key => ({
|
|
19
|
+
Key: key,
|
|
20
|
+
Value: tag[key]
|
|
21
|
+
}));
|
|
22
|
+
|
|
23
|
+
const paramXMLObj = {
|
|
24
|
+
Tagging: {
|
|
25
|
+
TagSet: {
|
|
26
|
+
Tag: tag
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
params.mime = 'xml';
|
|
32
|
+
params.content = obj2xml(paramXMLObj);
|
|
33
|
+
|
|
34
|
+
const result = await this.request(params);
|
|
35
|
+
return {
|
|
36
|
+
res: result.res,
|
|
37
|
+
status: result.status
|
|
38
|
+
};
|
|
39
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const { checkBucketName: _checkBucketName } = require('../utils/checkBucketName');
|
|
2
|
+
const { obj2xml } = require('../utils/obj2xml');
|
|
3
|
+
|
|
4
|
+
const proto = exports;
|
|
5
|
+
/**
|
|
6
|
+
* putBucketVersioning
|
|
7
|
+
* @param {String} name - bucket name
|
|
8
|
+
* @param {String} status
|
|
9
|
+
* @param {Object} options
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
proto.putBucketVersioning = async function putBucketVersioning(name, status, options = {}) {
|
|
13
|
+
_checkBucketName(name);
|
|
14
|
+
if (!['Enabled', 'Suspended'].includes(status)) {
|
|
15
|
+
throw new Error('status must be Enabled or Suspended');
|
|
16
|
+
}
|
|
17
|
+
const params = this._bucketRequestParams('PUT', name, 'versioning', options);
|
|
18
|
+
|
|
19
|
+
const paramXMLObj = {
|
|
20
|
+
VersioningConfiguration: {
|
|
21
|
+
Status: status
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
params.mime = 'xml';
|
|
26
|
+
params.content = obj2xml(paramXMLObj, {
|
|
27
|
+
headers: true
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const result = await this.request(params);
|
|
31
|
+
return {
|
|
32
|
+
res: result.res,
|
|
33
|
+
status: result.status
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const { checkBucketName: _checkBucketName } = require('../utils/checkBucketName');
|
|
2
|
+
const { obj2xml } = require('../utils/obj2xml');
|
|
3
|
+
const { isArray } = require('../utils/isArray');
|
|
4
|
+
|
|
5
|
+
const proto = exports;
|
|
6
|
+
proto.putBucketWebsite = async function putBucketWebsite(name, config = {}, options) {
|
|
7
|
+
_checkBucketName(name);
|
|
8
|
+
const params = this._bucketRequestParams('PUT', name, 'website', options);
|
|
9
|
+
const IndexDocument = {
|
|
10
|
+
Suffix: config.index || 'index.html'
|
|
11
|
+
};
|
|
12
|
+
const WebsiteConfiguration = {
|
|
13
|
+
IndexDocument
|
|
14
|
+
};
|
|
15
|
+
let website = {
|
|
16
|
+
WebsiteConfiguration
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
if (config.supportSubDir) {
|
|
20
|
+
IndexDocument.SupportSubDir = config.supportSubDir;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (config.type) {
|
|
24
|
+
IndexDocument.Type = config.type;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (config.error) {
|
|
28
|
+
WebsiteConfiguration.ErrorDocument = {
|
|
29
|
+
Key: config.error
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (config.routingRules !== undefined) {
|
|
34
|
+
if (!isArray(config.routingRules)) {
|
|
35
|
+
throw new Error('RoutingRules must be Array');
|
|
36
|
+
}
|
|
37
|
+
WebsiteConfiguration.RoutingRules = {
|
|
38
|
+
RoutingRule: config.routingRules
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
website = obj2xml(website);
|
|
43
|
+
params.content = website;
|
|
44
|
+
params.mime = 'xml';
|
|
45
|
+
params.successStatuses = [200];
|
|
46
|
+
const result = await this.request(params);
|
|
47
|
+
return {
|
|
48
|
+
res: result.res
|
|
49
|
+
};
|
|
50
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
exports.encodeCallback = function encodeCallback(reqParams, options) {
|
|
2
|
+
reqParams.headers = reqParams.headers || {};
|
|
3
|
+
if (!Object.prototype.hasOwnProperty.call(reqParams.headers, 'x-oss-callback')) {
|
|
4
|
+
if (options.callback) {
|
|
5
|
+
const json = {
|
|
6
|
+
callbackUrl: encodeURI(options.callback.url),
|
|
7
|
+
callbackBody: options.callback.body
|
|
8
|
+
};
|
|
9
|
+
if (options.callback.host) {
|
|
10
|
+
json.callbackHost = options.callback.host;
|
|
11
|
+
}
|
|
12
|
+
if (options.callback.contentType) {
|
|
13
|
+
json.callbackBodyType = options.callback.contentType;
|
|
14
|
+
}
|
|
15
|
+
const callback = Buffer.from(JSON.stringify(json)).toString('base64');
|
|
16
|
+
reqParams.headers['x-oss-callback'] = callback;
|
|
17
|
+
|
|
18
|
+
if (options.callback.customValue) {
|
|
19
|
+
const callbackVar = {};
|
|
20
|
+
Object.keys(options.callback.customValue).forEach(key => {
|
|
21
|
+
callbackVar[`x:${key}`] = options.callback.customValue[key].toString();
|
|
22
|
+
});
|
|
23
|
+
reqParams.headers['x-oss-callback-var'] = Buffer.from(JSON.stringify(callbackVar)).toString('base64');
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getReqUrl(this: any, params: any): string;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getReqUrl = void 0;
|
|
7
|
+
const copy_to_1 = __importDefault(require("copy-to"));
|
|
8
|
+
const url_1 = __importDefault(require("url"));
|
|
9
|
+
const merge_descriptors_1 = __importDefault(require("merge-descriptors"));
|
|
10
|
+
const is_type_of_1 = __importDefault(require("is-type-of"));
|
|
11
|
+
const isIP_1 = require("../utils/isIP");
|
|
12
|
+
const checkConfigValid_1 = require("../utils/checkConfigValid");
|
|
13
|
+
function getReqUrl(params) {
|
|
14
|
+
const ep = {};
|
|
15
|
+
const isCname = this.options.cname;
|
|
16
|
+
checkConfigValid_1.checkConfigValid(this.options.endpoint, 'endpoint');
|
|
17
|
+
copy_to_1.default(this.options.endpoint, false).to(ep);
|
|
18
|
+
if (params.bucket && !isCname && !isIP_1.isIP(ep.hostname) && !this.options.sldEnable) {
|
|
19
|
+
ep.host = `${params.bucket}.${ep.host}`;
|
|
20
|
+
}
|
|
21
|
+
let resourcePath = '/';
|
|
22
|
+
if (params.bucket && this.options.sldEnable) {
|
|
23
|
+
resourcePath += `${params.bucket}/`;
|
|
24
|
+
}
|
|
25
|
+
if (params.object) {
|
|
26
|
+
// Preserve '/' in result url
|
|
27
|
+
resourcePath += this._escape(params.object).replace(/\+/g, '%2B');
|
|
28
|
+
}
|
|
29
|
+
ep.pathname = resourcePath;
|
|
30
|
+
const query = {};
|
|
31
|
+
if (params.query) {
|
|
32
|
+
merge_descriptors_1.default(query, params.query);
|
|
33
|
+
}
|
|
34
|
+
if (params.subres) {
|
|
35
|
+
let subresAsQuery = {};
|
|
36
|
+
if (is_type_of_1.default.string(params.subres)) {
|
|
37
|
+
subresAsQuery[params.subres] = '';
|
|
38
|
+
}
|
|
39
|
+
else if (is_type_of_1.default.array(params.subres)) {
|
|
40
|
+
params.subres.forEach(k => {
|
|
41
|
+
subresAsQuery[k] = '';
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
subresAsQuery = params.subres;
|
|
46
|
+
}
|
|
47
|
+
merge_descriptors_1.default(query, subresAsQuery);
|
|
48
|
+
}
|
|
49
|
+
ep.query = query;
|
|
50
|
+
return url_1.default.format(ep);
|
|
51
|
+
}
|
|
52
|
+
exports.getReqUrl = getReqUrl;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import copy from 'copy-to';
|
|
2
|
+
import urlutil from 'url';
|
|
3
|
+
import merge from 'merge-descriptors';
|
|
4
|
+
import is from 'is-type-of';
|
|
5
|
+
import { isIP } from '../utils/isIP';
|
|
6
|
+
import { checkConfigValid } from '../utils/checkConfigValid';
|
|
7
|
+
|
|
8
|
+
export function getReqUrl(this: any, params) {
|
|
9
|
+
const ep: any = {};
|
|
10
|
+
const isCname = this.options.cname;
|
|
11
|
+
checkConfigValid(this.options.endpoint, 'endpoint');
|
|
12
|
+
copy(this.options.endpoint, false).to(ep);
|
|
13
|
+
|
|
14
|
+
if (params.bucket && !isCname && !isIP(ep.hostname) && !this.options.sldEnable) {
|
|
15
|
+
ep.host = `${params.bucket}.${ep.host}`;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let resourcePath = '/';
|
|
19
|
+
if (params.bucket && this.options.sldEnable) {
|
|
20
|
+
resourcePath += `${params.bucket}/`;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (params.object) {
|
|
24
|
+
// Preserve '/' in result url
|
|
25
|
+
resourcePath += this._escape(params.object).replace(/\+/g, '%2B');
|
|
26
|
+
}
|
|
27
|
+
ep.pathname = resourcePath;
|
|
28
|
+
|
|
29
|
+
const query = {};
|
|
30
|
+
if (params.query) {
|
|
31
|
+
merge(query, params.query);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (params.subres) {
|
|
35
|
+
let subresAsQuery = {};
|
|
36
|
+
if ((is as any).string(params.subres)) {
|
|
37
|
+
subresAsQuery[params.subres] = '';
|
|
38
|
+
} else if (is.array(params.subres)) {
|
|
39
|
+
params.subres.forEach(k => {
|
|
40
|
+
subresAsQuery[k] = '';
|
|
41
|
+
});
|
|
42
|
+
} else {
|
|
43
|
+
subresAsQuery = params.subres;
|
|
44
|
+
}
|
|
45
|
+
merge(query, subresAsQuery);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
ep.query = query;
|
|
49
|
+
|
|
50
|
+
return urlutil.format(ep);
|
|
51
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
const ms = require('humanize-ms');
|
|
2
|
+
const urlutil = require('url');
|
|
3
|
+
const { checkBucketName: _checkBucketName } = require('../utils/checkBucketName');
|
|
4
|
+
const { setRegion } = require('../utils/setRegion');
|
|
5
|
+
const { checkConfigValid } = require('../utils/checkConfigValid');
|
|
6
|
+
|
|
7
|
+
function setEndpoint(endpoint, secure) {
|
|
8
|
+
checkConfigValid(endpoint, 'endpoint');
|
|
9
|
+
let url = urlutil.parse(endpoint);
|
|
10
|
+
|
|
11
|
+
if (!url.protocol) {
|
|
12
|
+
url = urlutil.parse(`http${secure ? 's' : ''}://${endpoint}`);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (url.protocol !== 'http:' && url.protocol !== 'https:') {
|
|
16
|
+
throw new Error('Endpoint protocol must be http or https.');
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return url;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
module.exports = function (options) {
|
|
23
|
+
if (!options || !options.accessKeyId || !options.accessKeySecret) {
|
|
24
|
+
throw new Error('require accessKeyId, accessKeySecret');
|
|
25
|
+
}
|
|
26
|
+
if (options.stsToken && !options.refreshSTSToken && !options.refreshSTSTokenInterval) {
|
|
27
|
+
console.warn(
|
|
28
|
+
"It's recommended to set 'refreshSTSToken' and 'refreshSTSTokenInterval' to refresh" +
|
|
29
|
+
' stsToken、accessKeyId、accessKeySecret automatically when sts token has expired'
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
if (options.bucket) {
|
|
33
|
+
_checkBucketName(options.bucket);
|
|
34
|
+
}
|
|
35
|
+
const opts = Object.assign(
|
|
36
|
+
{
|
|
37
|
+
region: 'oss-cn-hangzhou',
|
|
38
|
+
internal: false,
|
|
39
|
+
secure: false,
|
|
40
|
+
timeout: 60000,
|
|
41
|
+
bucket: null,
|
|
42
|
+
endpoint: null,
|
|
43
|
+
cname: false,
|
|
44
|
+
isRequestPay: false,
|
|
45
|
+
sldEnable: false,
|
|
46
|
+
headerEncoding: 'utf-8',
|
|
47
|
+
refreshSTSToken: null,
|
|
48
|
+
refreshSTSTokenInterval: 60000 * 5,
|
|
49
|
+
retryMax: 0,
|
|
50
|
+
authorizationV4: false // 启用v4签名,默认关闭
|
|
51
|
+
},
|
|
52
|
+
options
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
opts.accessKeyId = opts.accessKeyId.trim();
|
|
56
|
+
opts.accessKeySecret = opts.accessKeySecret.trim();
|
|
57
|
+
|
|
58
|
+
if (opts.timeout) {
|
|
59
|
+
opts.timeout = ms(opts.timeout);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (opts.endpoint) {
|
|
63
|
+
opts.endpoint = setEndpoint(opts.endpoint, opts.secure);
|
|
64
|
+
} else if (opts.region) {
|
|
65
|
+
opts.endpoint = setRegion(opts.region, opts.internal, opts.secure);
|
|
66
|
+
} else {
|
|
67
|
+
throw new Error('require options.endpoint or options.region');
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
opts.inited = true;
|
|
71
|
+
return opts;
|
|
72
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/* eslint-disable no-use-before-define */
|
|
2
|
+
const { checkBucketName: _checkBucketName } = require('../utils/checkBucketName');
|
|
3
|
+
const querystring = require('querystring');
|
|
4
|
+
const {
|
|
5
|
+
Base64: { encode: str2Base64 }
|
|
6
|
+
} = require('js-base64');
|
|
7
|
+
|
|
8
|
+
const proto = exports;
|
|
9
|
+
|
|
10
|
+
proto.processObjectSave = async function processObjectSave(sourceObject, targetObject, process, targetBucket) {
|
|
11
|
+
checkArgs(sourceObject, 'sourceObject');
|
|
12
|
+
checkArgs(targetObject, 'targetObject');
|
|
13
|
+
checkArgs(process, 'process');
|
|
14
|
+
targetObject = this._objectName(targetObject);
|
|
15
|
+
if (targetBucket) {
|
|
16
|
+
_checkBucketName(targetBucket);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const params = this._objectRequestParams('POST', sourceObject, {
|
|
20
|
+
subres: 'x-oss-process'
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const bucketParam = targetBucket ? `,b_${str2Base64(targetBucket)}` : '';
|
|
24
|
+
targetObject = str2Base64(targetObject);
|
|
25
|
+
|
|
26
|
+
const content = {
|
|
27
|
+
'x-oss-process': `${process}|sys/saveas,o_${targetObject}${bucketParam}`
|
|
28
|
+
};
|
|
29
|
+
params.content = querystring.stringify(content);
|
|
30
|
+
|
|
31
|
+
const result = await this.request(params);
|
|
32
|
+
return {
|
|
33
|
+
res: result.res,
|
|
34
|
+
status: result.res.status
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
function checkArgs(name, key) {
|
|
39
|
+
if (!name) {
|
|
40
|
+
throw new Error(`${key} is required`);
|
|
41
|
+
}
|
|
42
|
+
if (typeof name !== 'string') {
|
|
43
|
+
throw new Error(`${key} must be String`);
|
|
44
|
+
}
|
|
45
|
+
}
|