@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,355 @@
|
|
|
1
|
+
const crypto = require('crypto');
|
|
2
|
+
const is = require('is-type-of');
|
|
3
|
+
const qs = require('qs');
|
|
4
|
+
const { lowercaseKeyHeader } = require('./utils/lowercaseKeyHeader');
|
|
5
|
+
const { encodeString } = require('./utils/encodeString');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param {String} resourcePath
|
|
10
|
+
* @param {Object} parameters
|
|
11
|
+
* @return
|
|
12
|
+
*/
|
|
13
|
+
exports.buildCanonicalizedResource = function buildCanonicalizedResource(resourcePath, parameters) {
|
|
14
|
+
let canonicalizedResource = `${resourcePath}`;
|
|
15
|
+
let separatorString = '?';
|
|
16
|
+
|
|
17
|
+
if (is.string(parameters) && parameters.trim() !== '') {
|
|
18
|
+
canonicalizedResource += separatorString + parameters;
|
|
19
|
+
} else if (is.array(parameters)) {
|
|
20
|
+
parameters.sort();
|
|
21
|
+
canonicalizedResource += separatorString + parameters.join('&');
|
|
22
|
+
} else if (parameters) {
|
|
23
|
+
const compareFunc = (entry1, entry2) => {
|
|
24
|
+
if (entry1[0] > entry2[0]) {
|
|
25
|
+
return 1;
|
|
26
|
+
} else if (entry1[0] < entry2[0]) {
|
|
27
|
+
return -1;
|
|
28
|
+
}
|
|
29
|
+
return 0;
|
|
30
|
+
};
|
|
31
|
+
const processFunc = key => {
|
|
32
|
+
canonicalizedResource += separatorString + key;
|
|
33
|
+
if (parameters[key] || parameters[key] === 0) {
|
|
34
|
+
canonicalizedResource += `=${parameters[key]}`;
|
|
35
|
+
}
|
|
36
|
+
separatorString = '&';
|
|
37
|
+
};
|
|
38
|
+
Object.keys(parameters).sort(compareFunc).forEach(processFunc);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return canonicalizedResource;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @param {String} method
|
|
46
|
+
* @param {String} resourcePath
|
|
47
|
+
* @param {Object} request
|
|
48
|
+
* @param {String} expires
|
|
49
|
+
* @return {String} canonicalString
|
|
50
|
+
*/
|
|
51
|
+
exports.buildCanonicalString = function canonicalString(method, resourcePath, request, expires) {
|
|
52
|
+
request = request || {};
|
|
53
|
+
const headers = lowercaseKeyHeader(request.headers);
|
|
54
|
+
const OSS_PREFIX = 'x-oss-';
|
|
55
|
+
const ossHeaders = [];
|
|
56
|
+
const headersToSign = {};
|
|
57
|
+
|
|
58
|
+
let signContent = [
|
|
59
|
+
method.toUpperCase(),
|
|
60
|
+
headers['content-md5'] || '',
|
|
61
|
+
headers['content-type'],
|
|
62
|
+
expires || headers['x-oss-date']
|
|
63
|
+
];
|
|
64
|
+
|
|
65
|
+
Object.keys(headers).forEach(key => {
|
|
66
|
+
const lowerKey = key.toLowerCase();
|
|
67
|
+
if (lowerKey.indexOf(OSS_PREFIX) === 0) {
|
|
68
|
+
headersToSign[lowerKey] = String(headers[key]).trim();
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
Object.keys(headersToSign)
|
|
73
|
+
.sort()
|
|
74
|
+
.forEach(key => {
|
|
75
|
+
ossHeaders.push(`${key}:${headersToSign[key]}`);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
signContent = signContent.concat(ossHeaders);
|
|
79
|
+
|
|
80
|
+
signContent.push(this.buildCanonicalizedResource(resourcePath, request.parameters));
|
|
81
|
+
|
|
82
|
+
return signContent.join('\n');
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @param {String} accessKeySecret
|
|
87
|
+
* @param {String} canonicalString
|
|
88
|
+
*/
|
|
89
|
+
exports.computeSignature = function computeSignature(accessKeySecret, canonicalString, headerEncoding = 'utf-8') {
|
|
90
|
+
const signature = crypto.createHmac('sha1', accessKeySecret);
|
|
91
|
+
return signature.update(Buffer.from(canonicalString, headerEncoding)).digest('base64');
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* @param {String} accessKeyId
|
|
96
|
+
* @param {String} accessKeySecret
|
|
97
|
+
* @param {String} canonicalString
|
|
98
|
+
*/
|
|
99
|
+
exports.authorization = function authorization(accessKeyId, accessKeySecret, canonicalString, headerEncoding) {
|
|
100
|
+
return `OSS ${accessKeyId}:${this.computeSignature(accessKeySecret, canonicalString, headerEncoding)}`;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* @param {string[]} [additionalHeaders]
|
|
105
|
+
* @returns {string[]}
|
|
106
|
+
*/
|
|
107
|
+
exports.fixAdditionalHeaders = additionalHeaders => {
|
|
108
|
+
if (!additionalHeaders) {
|
|
109
|
+
return [];
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const OSS_PREFIX = 'x-oss-';
|
|
113
|
+
|
|
114
|
+
return [...new Set(additionalHeaders.map(v => v.toLowerCase()))]
|
|
115
|
+
.filter(v => {
|
|
116
|
+
return v !== 'content-type' && v !== 'content-md5' && !v.startsWith(OSS_PREFIX);
|
|
117
|
+
})
|
|
118
|
+
.sort();
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @param {string} method
|
|
123
|
+
* @param {Object} request
|
|
124
|
+
* @param {Object} request.headers
|
|
125
|
+
* @param {Object} [request.queries]
|
|
126
|
+
* @param {string} [bucketName]
|
|
127
|
+
* @param {string} [objectName]
|
|
128
|
+
* @param {string[]} [additionalHeaders] additional headers after deduplication, lowercase and sorting
|
|
129
|
+
* @returns {string}
|
|
130
|
+
*/
|
|
131
|
+
exports.getCanonicalRequest = function getCanonicalRequest(method, request, bucketName, objectName, additionalHeaders) {
|
|
132
|
+
const headers = lowercaseKeyHeader(request.headers);
|
|
133
|
+
const queries = request.queries || {};
|
|
134
|
+
const OSS_PREFIX = 'x-oss-';
|
|
135
|
+
|
|
136
|
+
if (objectName && !bucketName) {
|
|
137
|
+
throw Error('Please ensure that bucketName is passed into getCanonicalRequest.');
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const signContent = [
|
|
141
|
+
method.toUpperCase(), // HTTP Verb
|
|
142
|
+
encodeString(`/${bucketName ? `${bucketName}/` : ''}${objectName || ''}`).replace(/%2F/g, '/') // Canonical URI
|
|
143
|
+
];
|
|
144
|
+
|
|
145
|
+
// Canonical Query String
|
|
146
|
+
signContent.push(
|
|
147
|
+
qs.stringify(queries, {
|
|
148
|
+
encoder: encodeString,
|
|
149
|
+
sort: (a, b) => a.localeCompare(b),
|
|
150
|
+
strictNullHandling: true
|
|
151
|
+
})
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
// Canonical Headers
|
|
155
|
+
if (additionalHeaders) {
|
|
156
|
+
additionalHeaders.forEach(v => {
|
|
157
|
+
if (!Object.prototype.hasOwnProperty.call(headers, v)) {
|
|
158
|
+
throw Error(`Can't find additional header ${v} in request headers.`);
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const tempHeaders = new Set(additionalHeaders);
|
|
164
|
+
|
|
165
|
+
Object.keys(headers).forEach(v => {
|
|
166
|
+
if (v === 'content-type' || v === 'content-md5' || v.startsWith(OSS_PREFIX)) {
|
|
167
|
+
tempHeaders.add(v);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
const canonicalHeaders = `${[...tempHeaders]
|
|
172
|
+
.sort()
|
|
173
|
+
.map(v => `${v}:${is.string(headers[v]) ? headers[v].trim() : headers[v]}\n`)
|
|
174
|
+
.join('')}`;
|
|
175
|
+
|
|
176
|
+
signContent.push(canonicalHeaders);
|
|
177
|
+
|
|
178
|
+
// Additional Headers
|
|
179
|
+
if (additionalHeaders.length > 0) {
|
|
180
|
+
signContent.push(additionalHeaders.join(';'));
|
|
181
|
+
} else {
|
|
182
|
+
signContent.push('');
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Hashed Payload
|
|
186
|
+
signContent.push(headers['x-oss-content-sha256'] || 'UNSIGNED-PAYLOAD');
|
|
187
|
+
|
|
188
|
+
return signContent.join('\n');
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* @param {string} region Standard region, e.g. cn-hangzhou
|
|
193
|
+
* @param {string} date ISO8601 UTC:yyyymmdd'T'HHMMss'Z'
|
|
194
|
+
* @param {string} canonicalRequest
|
|
195
|
+
* @returns {string}
|
|
196
|
+
*/
|
|
197
|
+
exports.getStringToSign = function getStringToSign(region, date, canonicalRequest) {
|
|
198
|
+
const stringToSign = [
|
|
199
|
+
'OSS4-HMAC-SHA256',
|
|
200
|
+
date, // TimeStamp
|
|
201
|
+
`${date.split('T')[0]}/${region}/oss/aliyun_v4_request`, // Scope
|
|
202
|
+
crypto.createHash('sha256').update(canonicalRequest).digest('hex') // Hashed Canonical Request
|
|
203
|
+
];
|
|
204
|
+
|
|
205
|
+
return stringToSign.join('\n');
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* @param {String} accessKeySecret
|
|
210
|
+
* @param {string} date yyyymmdd
|
|
211
|
+
* @param {string} region Standard region, e.g. cn-hangzhou
|
|
212
|
+
* @param {string} stringToSign
|
|
213
|
+
* @returns {string}
|
|
214
|
+
*/
|
|
215
|
+
exports.getSignatureV4 = function getSignatureV4(accessKeySecret, date, region, stringToSign) {
|
|
216
|
+
const signingDate = crypto.createHmac('sha256', `aliyun_v4${accessKeySecret}`).update(date).digest();
|
|
217
|
+
const signingRegion = crypto.createHmac('sha256', signingDate).update(region).digest();
|
|
218
|
+
const signingOss = crypto.createHmac('sha256', signingRegion).update('oss').digest();
|
|
219
|
+
const signingKey = crypto.createHmac('sha256', signingOss).update('aliyun_v4_request').digest();
|
|
220
|
+
const signatureValue = crypto.createHmac('sha256', signingKey).update(stringToSign).digest('hex');
|
|
221
|
+
|
|
222
|
+
return signatureValue;
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* @param {String} accessKeyId
|
|
227
|
+
* @param {String} accessKeySecret
|
|
228
|
+
* @param {string} region Standard region, e.g. cn-hangzhou
|
|
229
|
+
* @param {string} method
|
|
230
|
+
* @param {Object} request
|
|
231
|
+
* @param {Object} request.headers
|
|
232
|
+
* @param {Object} [request.queries]
|
|
233
|
+
* @param {string} [bucketName]
|
|
234
|
+
* @param {string} [objectName]
|
|
235
|
+
* @param {string[]} [additionalHeaders]
|
|
236
|
+
* @param {string} [headerEncoding='utf-8']
|
|
237
|
+
* @returns {string}
|
|
238
|
+
*/
|
|
239
|
+
exports.authorizationV4 = function authorizationV4(
|
|
240
|
+
accessKeyId,
|
|
241
|
+
accessKeySecret,
|
|
242
|
+
region,
|
|
243
|
+
method,
|
|
244
|
+
request,
|
|
245
|
+
bucketName,
|
|
246
|
+
objectName,
|
|
247
|
+
additionalHeaders,
|
|
248
|
+
headerEncoding = 'utf-8'
|
|
249
|
+
) {
|
|
250
|
+
const fixedAdditionalHeaders = this.fixAdditionalHeaders(additionalHeaders);
|
|
251
|
+
const fixedHeaders = {};
|
|
252
|
+
Object.entries(request.headers).forEach(v => {
|
|
253
|
+
fixedHeaders[v[0]] = is.string(v[1]) ? Buffer.from(v[1], headerEncoding).toString() : v[1];
|
|
254
|
+
});
|
|
255
|
+
const date = fixedHeaders['x-oss-date'] || (request.queries && request.queries['x-oss-date']);
|
|
256
|
+
const canonicalRequest = this.getCanonicalRequest(
|
|
257
|
+
method,
|
|
258
|
+
{
|
|
259
|
+
headers: fixedHeaders,
|
|
260
|
+
queries: request.queries
|
|
261
|
+
},
|
|
262
|
+
bucketName,
|
|
263
|
+
objectName,
|
|
264
|
+
fixedAdditionalHeaders
|
|
265
|
+
);
|
|
266
|
+
const stringToSign = this.getStringToSign(region, date, canonicalRequest);
|
|
267
|
+
const onlyDate = date.split('T')[0];
|
|
268
|
+
const signatureValue = this.getSignatureV4(accessKeySecret, onlyDate, region, stringToSign);
|
|
269
|
+
const additionalHeadersValue =
|
|
270
|
+
fixedAdditionalHeaders.length > 0 ? `AdditionalHeaders=${fixedAdditionalHeaders.join(';')},` : '';
|
|
271
|
+
|
|
272
|
+
return `OSS4-HMAC-SHA256 Credential=${accessKeyId}/${onlyDate}/${region}/oss/aliyun_v4_request,${additionalHeadersValue}Signature=${signatureValue}`;
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
*
|
|
277
|
+
* @param {String} accessKeySecret
|
|
278
|
+
* @param {Object} options
|
|
279
|
+
* @param {String} resource
|
|
280
|
+
* @param {Number} expires
|
|
281
|
+
*/
|
|
282
|
+
exports._signatureForURL = function _signatureForURL(accessKeySecret, options = {}, resource, expires, headerEncoding) {
|
|
283
|
+
const headers = {};
|
|
284
|
+
const { subResource = {} } = options;
|
|
285
|
+
|
|
286
|
+
if (options.process) {
|
|
287
|
+
const processKeyword = 'x-oss-process';
|
|
288
|
+
subResource[processKeyword] = options.process;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
if (options.trafficLimit) {
|
|
292
|
+
const trafficLimitKey = 'x-oss-traffic-limit';
|
|
293
|
+
subResource[trafficLimitKey] = options.trafficLimit;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
if (options.response) {
|
|
297
|
+
Object.keys(options.response).forEach(k => {
|
|
298
|
+
const key = `response-${k.toLowerCase()}`;
|
|
299
|
+
subResource[key] = options.response[k];
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
Object.keys(options).forEach(key => {
|
|
304
|
+
const lowerKey = key.toLowerCase();
|
|
305
|
+
const value = options[key];
|
|
306
|
+
if (lowerKey.indexOf('x-oss-') === 0) {
|
|
307
|
+
headers[lowerKey] = value;
|
|
308
|
+
} else if (lowerKey.indexOf('content-md5') === 0) {
|
|
309
|
+
headers[key] = value;
|
|
310
|
+
} else if (lowerKey.indexOf('content-type') === 0) {
|
|
311
|
+
headers[key] = value;
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
if (Object.prototype.hasOwnProperty.call(options, 'security-token')) {
|
|
316
|
+
subResource['security-token'] = options['security-token'];
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
if (Object.prototype.hasOwnProperty.call(options, 'callback')) {
|
|
320
|
+
const json = {
|
|
321
|
+
callbackUrl: encodeURI(options.callback.url),
|
|
322
|
+
callbackBody: options.callback.body
|
|
323
|
+
};
|
|
324
|
+
if (options.callback.host) {
|
|
325
|
+
json.callbackHost = options.callback.host;
|
|
326
|
+
}
|
|
327
|
+
if (options.callback.contentType) {
|
|
328
|
+
json.callbackBodyType = options.callback.contentType;
|
|
329
|
+
}
|
|
330
|
+
subResource.callback = Buffer.from(JSON.stringify(json)).toString('base64');
|
|
331
|
+
|
|
332
|
+
if (options.callback.customValue) {
|
|
333
|
+
const callbackVar = {};
|
|
334
|
+
Object.keys(options.callback.customValue).forEach(key => {
|
|
335
|
+
callbackVar[`x:${key}`] = options.callback.customValue[key];
|
|
336
|
+
});
|
|
337
|
+
subResource['callback-var'] = Buffer.from(JSON.stringify(callbackVar)).toString('base64');
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
const canonicalString = this.buildCanonicalString(
|
|
342
|
+
options.method,
|
|
343
|
+
resource,
|
|
344
|
+
{
|
|
345
|
+
headers,
|
|
346
|
+
parameters: subResource
|
|
347
|
+
},
|
|
348
|
+
expires.toString()
|
|
349
|
+
);
|
|
350
|
+
|
|
351
|
+
return {
|
|
352
|
+
Signature: this.computeSignature(accessKeySecret, canonicalString, headerEncoding),
|
|
353
|
+
subResource
|
|
354
|
+
};
|
|
355
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const checkBucketName: (name: string, createBucket?: boolean) => void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkBucketName = void 0;
|
|
4
|
+
exports.checkBucketName = (name, createBucket = false) => {
|
|
5
|
+
const bucketRegex = createBucket ? /^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/ : /^[a-z0-9_][a-z0-9-_]{1,61}[a-z0-9_]$/;
|
|
6
|
+
if (!bucketRegex.test(name)) {
|
|
7
|
+
throw new Error('The bucket must be conform to the specifications');
|
|
8
|
+
}
|
|
9
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const checkBucketName = (name: string, createBucket = false): void => {
|
|
2
|
+
const bucketRegex = createBucket ? /^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/ : /^[a-z0-9_][a-z0-9-_]{1,61}[a-z0-9_]$/;
|
|
3
|
+
if (!bucketRegex.test(name)) {
|
|
4
|
+
throw new Error('The bucket must be conform to the specifications');
|
|
5
|
+
}
|
|
6
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const checkBucketNameTest: (name: string, createBucket: boolean) => void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkBucketNameTest = void 0;
|
|
4
|
+
const isArray_1 = require("./isArray");
|
|
5
|
+
exports.checkBucketNameTest = (name, createBucket) => {
|
|
6
|
+
const bucketRegex = createBucket ? /^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/ : /^[a-z0-9_][a-z0-9-_]{1,61}[a-z0-9_]$/;
|
|
7
|
+
if (!bucketRegex.test(name)) {
|
|
8
|
+
throw new Error('The bucket must be conform to the specifications');
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
let res = isArray_1.isArray([1, 2, 3]);
|
|
12
|
+
console.log(res, 'is array');
|
|
13
|
+
res = isArray_1.isArray('');
|
|
14
|
+
console.log(res, 'is array');
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { isArray } from './isArray';
|
|
2
|
+
|
|
3
|
+
export const checkBucketNameTest = (name: string, createBucket: boolean): void => {
|
|
4
|
+
const bucketRegex = createBucket ? /^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/ : /^[a-z0-9_][a-z0-9-_]{1,61}[a-z0-9_]$/;
|
|
5
|
+
if (!bucketRegex.test(name)) {
|
|
6
|
+
throw new Error('The bucket must be conform to the specifications');
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
let res = isArray([1, 2, 3]);
|
|
10
|
+
console.log(res, 'is array');
|
|
11
|
+
res = isArray('');
|
|
12
|
+
console.log(res, 'is array');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const checkBucketTag: (tag: object) => void;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkBucketTag = void 0;
|
|
4
|
+
const { checkValid } = require('./checkValid');
|
|
5
|
+
const { isObject } = require('./isObject');
|
|
6
|
+
const commonRules = [
|
|
7
|
+
{
|
|
8
|
+
validator: value => {
|
|
9
|
+
if (typeof value !== 'string') {
|
|
10
|
+
throw new Error('the key and value of the tag must be String');
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
];
|
|
15
|
+
const rules = {
|
|
16
|
+
key: [
|
|
17
|
+
...commonRules,
|
|
18
|
+
{
|
|
19
|
+
pattern: /^.{1,64}$/,
|
|
20
|
+
msg: 'tag key can be a maximum of 64 bytes in length'
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
pattern: /^(?!https*:\/\/|Aliyun)/,
|
|
24
|
+
msg: 'tag key can not startsWith: http://, https://, Aliyun'
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
value: [
|
|
28
|
+
...commonRules,
|
|
29
|
+
{
|
|
30
|
+
pattern: /^.{0,128}$/,
|
|
31
|
+
msg: 'tag value can be a maximum of 128 bytes in length'
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
};
|
|
35
|
+
exports.checkBucketTag = (tag) => {
|
|
36
|
+
if (!isObject(tag)) {
|
|
37
|
+
throw new Error('bucket tag must be Object');
|
|
38
|
+
}
|
|
39
|
+
const entries = Object.entries(tag);
|
|
40
|
+
if (entries.length > 20) {
|
|
41
|
+
throw new Error('maximum of 20 tags for a bucket');
|
|
42
|
+
}
|
|
43
|
+
const rulesIndexKey = ['key', 'value'];
|
|
44
|
+
entries.forEach(keyValue => {
|
|
45
|
+
keyValue.forEach((item, index) => {
|
|
46
|
+
checkValid(item, rules[rulesIndexKey[index]]);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const { checkValid } = require('./checkValid');
|
|
2
|
+
const { isObject } = require('./isObject');
|
|
3
|
+
|
|
4
|
+
const commonRules = [
|
|
5
|
+
{
|
|
6
|
+
validator: value => {
|
|
7
|
+
if (typeof value !== 'string') {
|
|
8
|
+
throw new Error('the key and value of the tag must be String');
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
const rules = {
|
|
15
|
+
key: [
|
|
16
|
+
...commonRules,
|
|
17
|
+
{
|
|
18
|
+
pattern: /^.{1,64}$/,
|
|
19
|
+
msg: 'tag key can be a maximum of 64 bytes in length'
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
pattern: /^(?!https*:\/\/|Aliyun)/,
|
|
23
|
+
msg: 'tag key can not startsWith: http://, https://, Aliyun'
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
value: [
|
|
27
|
+
...commonRules,
|
|
28
|
+
{
|
|
29
|
+
pattern: /^.{0,128}$/,
|
|
30
|
+
msg: 'tag value can be a maximum of 128 bytes in length'
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const checkBucketTag = (tag: object) => {
|
|
36
|
+
if (!isObject(tag)) {
|
|
37
|
+
throw new Error('bucket tag must be Object');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const entries = Object.entries(tag);
|
|
41
|
+
|
|
42
|
+
if (entries.length > 20) {
|
|
43
|
+
throw new Error('maximum of 20 tags for a bucket');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const rulesIndexKey = ['key', 'value'];
|
|
47
|
+
entries.forEach(keyValue => {
|
|
48
|
+
keyValue.forEach((item, index) => {
|
|
49
|
+
checkValid(item, rules[rulesIndexKey[index]]);
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const checkConfigValid: (conf: any, key: 'endpoint' | 'region') => void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkConfigValid = void 0;
|
|
4
|
+
const checkConfigMap = {
|
|
5
|
+
endpoint: checkEndpoint,
|
|
6
|
+
region: /^[a-zA-Z0-9\-_]+$/
|
|
7
|
+
};
|
|
8
|
+
function checkEndpoint(endpoint) {
|
|
9
|
+
if (typeof endpoint === 'string') {
|
|
10
|
+
return /^[a-zA-Z0-9._:/-]+$/.test(endpoint);
|
|
11
|
+
}
|
|
12
|
+
else if (endpoint.host) {
|
|
13
|
+
return /^[a-zA-Z0-9._:/-]+$/.test(endpoint.host);
|
|
14
|
+
}
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
exports.checkConfigValid = (conf, key) => {
|
|
18
|
+
if (checkConfigMap[key]) {
|
|
19
|
+
let isConfigValid = true;
|
|
20
|
+
if (checkConfigMap[key] instanceof Function) {
|
|
21
|
+
isConfigValid = checkConfigMap[key](conf);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
isConfigValid = checkConfigMap[key].test(conf);
|
|
25
|
+
}
|
|
26
|
+
if (!isConfigValid) {
|
|
27
|
+
throw new Error(`The ${key} must be conform to the specifications`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const checkConfigMap = {
|
|
2
|
+
endpoint: checkEndpoint,
|
|
3
|
+
region: /^[a-zA-Z0-9\-_]+$/
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
function checkEndpoint(endpoint) {
|
|
7
|
+
if (typeof endpoint === 'string') {
|
|
8
|
+
return /^[a-zA-Z0-9._:/-]+$/.test(endpoint);
|
|
9
|
+
} else if (endpoint.host) {
|
|
10
|
+
return /^[a-zA-Z0-9._:/-]+$/.test(endpoint.host);
|
|
11
|
+
}
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const checkConfigValid = (conf, key: 'endpoint' | 'region'): void => {
|
|
16
|
+
if (checkConfigMap[key]) {
|
|
17
|
+
let isConfigValid = true;
|
|
18
|
+
if (checkConfigMap[key] instanceof Function) {
|
|
19
|
+
isConfigValid = (checkConfigMap[key] as Function)(conf);
|
|
20
|
+
} else {
|
|
21
|
+
isConfigValid = (checkConfigMap[key] as RegExp).test(conf);
|
|
22
|
+
}
|
|
23
|
+
if (!isConfigValid) {
|
|
24
|
+
throw new Error(`The ${key} must be conform to the specifications`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function checkEnv(msg: string): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function checkObjectTag(tag: any): void;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkObjectTag = void 0;
|
|
4
|
+
const { checkValid } = require('./checkValid');
|
|
5
|
+
const { isObject } = require('./isObject');
|
|
6
|
+
const commonRules = [
|
|
7
|
+
{
|
|
8
|
+
validator: value => {
|
|
9
|
+
if (typeof value !== 'string') {
|
|
10
|
+
throw new Error('the key and value of the tag must be String');
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
pattern: /^[a-zA-Z0-9 +-=._:/]+$/,
|
|
16
|
+
msg: 'tag can contain letters, numbers, spaces, and the following symbols: plus sign (+), hyphen (-), equal sign (=), period (.), underscore (_), colon (:), and forward slash (/)'
|
|
17
|
+
}
|
|
18
|
+
];
|
|
19
|
+
const rules = {
|
|
20
|
+
key: [
|
|
21
|
+
...commonRules,
|
|
22
|
+
{
|
|
23
|
+
pattern: /^.{1,128}$/,
|
|
24
|
+
msg: 'tag key can be a maximum of 128 bytes in length'
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
value: [
|
|
28
|
+
...commonRules,
|
|
29
|
+
{
|
|
30
|
+
pattern: /^.{0,256}$/,
|
|
31
|
+
msg: 'tag value can be a maximum of 256 bytes in length'
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
};
|
|
35
|
+
function checkObjectTag(tag) {
|
|
36
|
+
if (!isObject(tag)) {
|
|
37
|
+
throw new Error('tag must be Object');
|
|
38
|
+
}
|
|
39
|
+
const entries = Object.entries(tag);
|
|
40
|
+
if (entries.length > 10) {
|
|
41
|
+
throw new Error('maximum of 10 tags for a object');
|
|
42
|
+
}
|
|
43
|
+
const rulesIndexKey = ['key', 'value'];
|
|
44
|
+
entries.forEach(keyValue => {
|
|
45
|
+
keyValue.forEach((item, index) => {
|
|
46
|
+
checkValid(item, rules[rulesIndexKey[index]]);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
exports.checkObjectTag = checkObjectTag;
|