@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,53 @@
|
|
|
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
|
+
pattern: /^[a-zA-Z0-9 +-=._:/]+$/,
|
|
14
|
+
msg: 'tag can contain letters, numbers, spaces, and the following symbols: plus sign (+), hyphen (-), equal sign (=), period (.), underscore (_), colon (:), and forward slash (/)'
|
|
15
|
+
}
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
const rules = {
|
|
19
|
+
key: [
|
|
20
|
+
...commonRules,
|
|
21
|
+
{
|
|
22
|
+
pattern: /^.{1,128}$/,
|
|
23
|
+
msg: 'tag key can be a maximum of 128 bytes in length'
|
|
24
|
+
}
|
|
25
|
+
],
|
|
26
|
+
value: [
|
|
27
|
+
...commonRules,
|
|
28
|
+
{
|
|
29
|
+
pattern: /^.{0,256}$/,
|
|
30
|
+
msg: 'tag value can be a maximum of 256 bytes in length'
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export function checkObjectTag(tag) {
|
|
36
|
+
if (!isObject(tag)) {
|
|
37
|
+
throw new Error('tag must be Object');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const entries = Object.entries(tag);
|
|
41
|
+
|
|
42
|
+
if (entries.length > 10) {
|
|
43
|
+
throw new Error('maximum of 10 tags for a object');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const rulesIndexKey = ['key', 'value'];
|
|
47
|
+
|
|
48
|
+
entries.forEach(keyValue => {
|
|
49
|
+
keyValue.forEach((item, index) => {
|
|
50
|
+
checkValid(item, rules[rulesIndexKey[index]]);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const checkUserAgent: (ua: any) => any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function checkValid(_value: any, _rules: any): void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkValid = void 0;
|
|
4
|
+
function checkValid(_value, _rules) {
|
|
5
|
+
_rules.forEach(rule => {
|
|
6
|
+
if (rule.validator) {
|
|
7
|
+
rule.validator(_value);
|
|
8
|
+
}
|
|
9
|
+
else if (rule.pattern && !rule.pattern.test(_value)) {
|
|
10
|
+
throw new Error(rule.msg);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
exports.checkValid = checkValid;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createRequest = void 0;
|
|
4
|
+
const crypto = require('crypto');
|
|
5
|
+
const debug = require('debug')('ali-oss');
|
|
6
|
+
const _isString = require('lodash/isString');
|
|
7
|
+
const _isArray = require('lodash/isArray');
|
|
8
|
+
const _isObject = require('lodash/isObject');
|
|
9
|
+
const mime = require('mime');
|
|
10
|
+
const dateFormat = require('dateformat');
|
|
11
|
+
const copy = require('copy-to');
|
|
12
|
+
const path = require('path');
|
|
13
|
+
const { encoder } = require('./encoder');
|
|
14
|
+
const { isIP } = require('./isIP');
|
|
15
|
+
const { setRegion } = require('./setRegion');
|
|
16
|
+
const { getReqUrl } = require('../client/getReqUrl');
|
|
17
|
+
const { isDingTalk } = require('./isDingTalk');
|
|
18
|
+
function getHeader(headers, name) {
|
|
19
|
+
return headers[name] || headers[name.toLowerCase()];
|
|
20
|
+
}
|
|
21
|
+
function delHeader(headers, name) {
|
|
22
|
+
delete headers[name];
|
|
23
|
+
delete headers[name.toLowerCase()];
|
|
24
|
+
}
|
|
25
|
+
function createRequest(params) {
|
|
26
|
+
let date = new Date();
|
|
27
|
+
if (this.options.amendTimeSkewed) {
|
|
28
|
+
date = +new Date() + this.options.amendTimeSkewed;
|
|
29
|
+
}
|
|
30
|
+
const headers = {
|
|
31
|
+
'x-oss-date': dateFormat(date, this.options.authorizationV4 ? "UTC:yyyymmdd'T'HHMMss'Z'" : "UTC:ddd, dd mmm yyyy HH:MM:ss 'GMT'")
|
|
32
|
+
};
|
|
33
|
+
if (this.options.authorizationV4) {
|
|
34
|
+
headers['x-oss-content-sha256'] = 'UNSIGNED-PAYLOAD';
|
|
35
|
+
}
|
|
36
|
+
if (typeof window !== 'undefined') {
|
|
37
|
+
headers['x-oss-user-agent'] = this.userAgent;
|
|
38
|
+
}
|
|
39
|
+
if (this.userAgent.includes('nodejs')) {
|
|
40
|
+
headers['User-Agent'] = this.userAgent;
|
|
41
|
+
}
|
|
42
|
+
if (this.options.isRequestPay) {
|
|
43
|
+
Object.assign(headers, { 'x-oss-request-payer': 'requester' });
|
|
44
|
+
}
|
|
45
|
+
if (this.options.stsToken) {
|
|
46
|
+
headers['x-oss-security-token'] = this.options.stsToken;
|
|
47
|
+
}
|
|
48
|
+
copy(params.headers).to(headers);
|
|
49
|
+
if (!getHeader(headers, 'Content-Type')) {
|
|
50
|
+
if (params.mime && params.mime.indexOf('/') > 0) {
|
|
51
|
+
headers['Content-Type'] = params.mime;
|
|
52
|
+
}
|
|
53
|
+
else if (isDingTalk()) {
|
|
54
|
+
headers['Content-Type'] = 'application/octet-stream';
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
headers['Content-Type'] = mime.getType(params.mime || path.extname(params.object || ''));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (!getHeader(headers, 'Content-Type')) {
|
|
61
|
+
delHeader(headers, 'Content-Type');
|
|
62
|
+
}
|
|
63
|
+
if (params.content) {
|
|
64
|
+
if (!params.disabledMD5) {
|
|
65
|
+
if (!params.headers || !params.headers['Content-MD5']) {
|
|
66
|
+
headers['Content-MD5'] = crypto.createHash('md5').update(Buffer.from(params.content, 'utf8')).digest('base64');
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
headers['Content-MD5'] = params.headers['Content-MD5'];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (!headers['Content-Length']) {
|
|
73
|
+
headers['Content-Length'] = params.content.length;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const { hasOwnProperty } = Object.prototype;
|
|
77
|
+
for (const k in headers) {
|
|
78
|
+
if (headers[k] && hasOwnProperty.call(headers, k)) {
|
|
79
|
+
headers[k] = encoder(String(headers[k]), this.options.headerEncoding);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const queries = {};
|
|
83
|
+
if (_isString(params.subres)) {
|
|
84
|
+
queries[params.subres] = null;
|
|
85
|
+
}
|
|
86
|
+
else if (_isArray(params.subres)) {
|
|
87
|
+
params.subres.forEach(v => {
|
|
88
|
+
queries[v] = null;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
else if (_isObject(params.subres)) {
|
|
92
|
+
Object.entries(params.subres).forEach(v => {
|
|
93
|
+
queries[v[0]] = v[1] === '' ? null : v[1];
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
if (_isObject(params.query)) {
|
|
97
|
+
Object.entries(params.query).forEach(v => {
|
|
98
|
+
queries[v[0]] = v[1];
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
headers.authorization = this.options.authorizationV4
|
|
102
|
+
? this.authorizationV4(params.method, {
|
|
103
|
+
headers,
|
|
104
|
+
queries
|
|
105
|
+
}, params.bucket, params.object, params.additionalHeaders)
|
|
106
|
+
: this.authorization(params.method, this._getResource(params), params.subres, headers, this.options.headerEncoding);
|
|
107
|
+
// const url = this._getReqUrl(params);
|
|
108
|
+
if (isIP(this.options.endpoint.hostname)) {
|
|
109
|
+
const { region, internal, secure } = this.options;
|
|
110
|
+
const hostInfo = setRegion(region, internal, secure);
|
|
111
|
+
headers.host = `${params.bucket}.${hostInfo.host}`;
|
|
112
|
+
}
|
|
113
|
+
const url = getReqUrl.bind(this)(params);
|
|
114
|
+
debug('request %s %s, with headers %j, !!stream: %s', params.method, url, headers, !!params.stream);
|
|
115
|
+
const timeout = params.timeout || this.options.timeout;
|
|
116
|
+
const reqParams = {
|
|
117
|
+
method: params.method,
|
|
118
|
+
content: params.content,
|
|
119
|
+
stream: params.stream,
|
|
120
|
+
headers,
|
|
121
|
+
timeout,
|
|
122
|
+
writeStream: params.writeStream,
|
|
123
|
+
customResponse: params.customResponse,
|
|
124
|
+
ctx: params.ctx || this.ctx
|
|
125
|
+
};
|
|
126
|
+
if (this.agent) {
|
|
127
|
+
reqParams.agent = this.agent;
|
|
128
|
+
}
|
|
129
|
+
if (this.httpsAgent) {
|
|
130
|
+
reqParams.httpsAgent = this.httpsAgent;
|
|
131
|
+
}
|
|
132
|
+
reqParams.enableProxy = !!this.options.enableProxy;
|
|
133
|
+
reqParams.proxy = this.options.proxy ? this.options.proxy : null;
|
|
134
|
+
return {
|
|
135
|
+
url,
|
|
136
|
+
params: reqParams
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
exports.createRequest = createRequest;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
const crypto = require('crypto');
|
|
2
|
+
const debug = require('debug')('ali-oss');
|
|
3
|
+
const _isString = require('lodash/isString');
|
|
4
|
+
const _isArray = require('lodash/isArray');
|
|
5
|
+
const _isObject = require('lodash/isObject');
|
|
6
|
+
const mime = require('mime');
|
|
7
|
+
const dateFormat = require('dateformat');
|
|
8
|
+
const copy = require('copy-to');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const { encoder } = require('./encoder');
|
|
11
|
+
const { isIP } = require('./isIP');
|
|
12
|
+
const { setRegion } = require('./setRegion');
|
|
13
|
+
const { getReqUrl } = require('../client/getReqUrl');
|
|
14
|
+
const { isDingTalk } = require('./isDingTalk');
|
|
15
|
+
|
|
16
|
+
interface Headers {
|
|
17
|
+
[propName: string]: any;
|
|
18
|
+
'x-oss-date': string;
|
|
19
|
+
'x-oss-user-agent'?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface ReqParams {
|
|
23
|
+
[propName: string]: any;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function getHeader(headers: Headers, name: string) {
|
|
27
|
+
return headers[name] || headers[name.toLowerCase()];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function delHeader(headers: Headers, name: string) {
|
|
31
|
+
delete headers[name];
|
|
32
|
+
delete headers[name.toLowerCase()];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function createRequest(this: any, params) {
|
|
36
|
+
let date = new Date();
|
|
37
|
+
if (this.options.amendTimeSkewed) {
|
|
38
|
+
date = +new Date() + this.options.amendTimeSkewed;
|
|
39
|
+
}
|
|
40
|
+
const headers: Headers = {
|
|
41
|
+
'x-oss-date': dateFormat(
|
|
42
|
+
date,
|
|
43
|
+
this.options.authorizationV4 ? "UTC:yyyymmdd'T'HHMMss'Z'" : "UTC:ddd, dd mmm yyyy HH:MM:ss 'GMT'"
|
|
44
|
+
)
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
if (this.options.authorizationV4) {
|
|
48
|
+
headers['x-oss-content-sha256'] = 'UNSIGNED-PAYLOAD';
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (typeof window !== 'undefined') {
|
|
52
|
+
headers['x-oss-user-agent'] = this.userAgent;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (this.userAgent.includes('nodejs')) {
|
|
56
|
+
headers['User-Agent'] = this.userAgent;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (this.options.isRequestPay) {
|
|
60
|
+
Object.assign(headers, { 'x-oss-request-payer': 'requester' });
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (this.options.stsToken) {
|
|
64
|
+
headers['x-oss-security-token'] = this.options.stsToken;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
copy(params.headers).to(headers);
|
|
68
|
+
|
|
69
|
+
if (!getHeader(headers, 'Content-Type')) {
|
|
70
|
+
if (params.mime && params.mime.indexOf('/') > 0) {
|
|
71
|
+
headers['Content-Type'] = params.mime;
|
|
72
|
+
} else if (isDingTalk()) {
|
|
73
|
+
headers['Content-Type'] = 'application/octet-stream';
|
|
74
|
+
} else {
|
|
75
|
+
headers['Content-Type'] = mime.getType(params.mime || path.extname(params.object || ''));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (!getHeader(headers, 'Content-Type')) {
|
|
80
|
+
delHeader(headers, 'Content-Type');
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if (params.content) {
|
|
84
|
+
if (!params.disabledMD5) {
|
|
85
|
+
if (!params.headers || !params.headers['Content-MD5']) {
|
|
86
|
+
headers['Content-MD5'] = crypto.createHash('md5').update(Buffer.from(params.content, 'utf8')).digest('base64');
|
|
87
|
+
} else {
|
|
88
|
+
headers['Content-MD5'] = params.headers['Content-MD5'];
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (!headers['Content-Length']) {
|
|
92
|
+
headers['Content-Length'] = params.content.length;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const { hasOwnProperty } = Object.prototype;
|
|
97
|
+
for (const k in headers) {
|
|
98
|
+
if (headers[k] && hasOwnProperty.call(headers, k)) {
|
|
99
|
+
headers[k] = encoder(String(headers[k]), this.options.headerEncoding);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const queries = {};
|
|
104
|
+
|
|
105
|
+
if (_isString(params.subres)) {
|
|
106
|
+
queries[params.subres] = null;
|
|
107
|
+
} else if (_isArray(params.subres)) {
|
|
108
|
+
params.subres.forEach(v => {
|
|
109
|
+
queries[v] = null;
|
|
110
|
+
});
|
|
111
|
+
} else if (_isObject(params.subres)) {
|
|
112
|
+
Object.entries(params.subres).forEach(v => {
|
|
113
|
+
queries[v[0]] = v[1] === '' ? null : v[1];
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (_isObject(params.query)) {
|
|
118
|
+
Object.entries(params.query).forEach(v => {
|
|
119
|
+
queries[v[0]] = v[1];
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
headers.authorization = this.options.authorizationV4
|
|
124
|
+
? this.authorizationV4(
|
|
125
|
+
params.method,
|
|
126
|
+
{
|
|
127
|
+
headers,
|
|
128
|
+
queries
|
|
129
|
+
},
|
|
130
|
+
params.bucket,
|
|
131
|
+
params.object,
|
|
132
|
+
params.additionalHeaders
|
|
133
|
+
)
|
|
134
|
+
: this.authorization(params.method, this._getResource(params), params.subres, headers, this.options.headerEncoding);
|
|
135
|
+
|
|
136
|
+
// const url = this._getReqUrl(params);
|
|
137
|
+
if (isIP(this.options.endpoint.hostname)) {
|
|
138
|
+
const { region, internal, secure } = this.options;
|
|
139
|
+
const hostInfo = setRegion(region, internal, secure);
|
|
140
|
+
headers.host = `${params.bucket}.${hostInfo.host}`;
|
|
141
|
+
}
|
|
142
|
+
const url = getReqUrl.bind(this)(params);
|
|
143
|
+
debug('request %s %s, with headers %j, !!stream: %s', params.method, url, headers, !!params.stream);
|
|
144
|
+
const timeout = params.timeout || this.options.timeout;
|
|
145
|
+
const reqParams: ReqParams = {
|
|
146
|
+
method: params.method,
|
|
147
|
+
content: params.content,
|
|
148
|
+
stream: params.stream,
|
|
149
|
+
headers,
|
|
150
|
+
timeout,
|
|
151
|
+
writeStream: params.writeStream,
|
|
152
|
+
customResponse: params.customResponse,
|
|
153
|
+
ctx: params.ctx || this.ctx
|
|
154
|
+
};
|
|
155
|
+
if (this.agent) {
|
|
156
|
+
reqParams.agent = this.agent;
|
|
157
|
+
}
|
|
158
|
+
if (this.httpsAgent) {
|
|
159
|
+
reqParams.httpsAgent = this.httpsAgent;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
reqParams.enableProxy = !!this.options.enableProxy;
|
|
163
|
+
reqParams.proxy = this.options.proxy ? this.options.proxy : null;
|
|
164
|
+
|
|
165
|
+
return {
|
|
166
|
+
url,
|
|
167
|
+
params: reqParams
|
|
168
|
+
};
|
|
169
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface Rename {
|
|
2
|
+
[propName: string]: string;
|
|
3
|
+
}
|
|
4
|
+
interface Config {
|
|
5
|
+
lowerFirst?: boolean;
|
|
6
|
+
rename?: Rename;
|
|
7
|
+
remove?: string[];
|
|
8
|
+
camel?: string[];
|
|
9
|
+
bool?: string[];
|
|
10
|
+
}
|
|
11
|
+
export declare function dataFix(o: object, conf: Config, finalKill?: Function): typeof dataFix | undefined;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dataFix = void 0;
|
|
4
|
+
const isObject_1 = require("./isObject");
|
|
5
|
+
const TRUE = ['true', 'TRUE', '1', 1];
|
|
6
|
+
const FALSE = ['false', 'FALSE', '0', 0];
|
|
7
|
+
function dataFix(o, conf, finalKill) {
|
|
8
|
+
if (!isObject_1.isObject(o))
|
|
9
|
+
return;
|
|
10
|
+
const { remove = [], rename = {}, camel = [], bool = [], lowerFirst = false } = conf;
|
|
11
|
+
// 删除不需要的数据
|
|
12
|
+
remove.forEach(v => delete o[v]);
|
|
13
|
+
// 重命名
|
|
14
|
+
Object.entries(rename).forEach(v => {
|
|
15
|
+
if (!o[v[0]])
|
|
16
|
+
return;
|
|
17
|
+
if (o[v[1]])
|
|
18
|
+
return;
|
|
19
|
+
o[v[1]] = o[v[0]];
|
|
20
|
+
delete o[v[0]];
|
|
21
|
+
});
|
|
22
|
+
// 驼峰化
|
|
23
|
+
camel.forEach(v => {
|
|
24
|
+
if (!o[v])
|
|
25
|
+
return;
|
|
26
|
+
const afterKey = v.replace(/^(.)/, $0 => $0.toLowerCase()).replace(/-(\w)/g, (_, $1) => $1.toUpperCase());
|
|
27
|
+
if (o[afterKey])
|
|
28
|
+
return;
|
|
29
|
+
o[afterKey] = o[v];
|
|
30
|
+
// todo 暂时兼容以前数据,不做删除
|
|
31
|
+
// delete o[v];
|
|
32
|
+
});
|
|
33
|
+
// 转换值为布尔值
|
|
34
|
+
bool.forEach(v => {
|
|
35
|
+
o[v] = fixBool(o[v]);
|
|
36
|
+
});
|
|
37
|
+
// finalKill
|
|
38
|
+
if (typeof finalKill === 'function') {
|
|
39
|
+
finalKill(o);
|
|
40
|
+
}
|
|
41
|
+
// 首字母转小写
|
|
42
|
+
fixLowerFirst(o, lowerFirst);
|
|
43
|
+
return dataFix;
|
|
44
|
+
}
|
|
45
|
+
exports.dataFix = dataFix;
|
|
46
|
+
function fixBool(value) {
|
|
47
|
+
if (!value)
|
|
48
|
+
return false;
|
|
49
|
+
if (TRUE.includes(value))
|
|
50
|
+
return true;
|
|
51
|
+
return FALSE.includes(value) ? false : value;
|
|
52
|
+
}
|
|
53
|
+
function fixLowerFirst(o, lowerFirst) {
|
|
54
|
+
if (lowerFirst) {
|
|
55
|
+
Object.keys(o).forEach(key => {
|
|
56
|
+
const lowerK = key.replace(/^\w/, match => match.toLowerCase());
|
|
57
|
+
if (typeof o[lowerK] === 'undefined') {
|
|
58
|
+
o[lowerK] = o[key];
|
|
59
|
+
delete o[key];
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { isObject } from './isObject';
|
|
2
|
+
|
|
3
|
+
interface Rename {
|
|
4
|
+
[propName: string]: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
interface Config {
|
|
8
|
+
lowerFirst?: boolean;
|
|
9
|
+
rename?: Rename;
|
|
10
|
+
remove?: string[];
|
|
11
|
+
camel?: string[];
|
|
12
|
+
bool?: string[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const TRUE = ['true', 'TRUE', '1', 1];
|
|
16
|
+
const FALSE = ['false', 'FALSE', '0', 0];
|
|
17
|
+
|
|
18
|
+
export function dataFix(o: object, conf: Config, finalKill?: Function) {
|
|
19
|
+
if (!isObject(o)) return;
|
|
20
|
+
|
|
21
|
+
const { remove = [], rename = {}, camel = [], bool = [], lowerFirst = false } = conf;
|
|
22
|
+
|
|
23
|
+
// 删除不需要的数据
|
|
24
|
+
remove.forEach(v => delete o[v]);
|
|
25
|
+
|
|
26
|
+
// 重命名
|
|
27
|
+
Object.entries(rename).forEach(v => {
|
|
28
|
+
if (!o[v[0]]) return;
|
|
29
|
+
if (o[v[1]]) return;
|
|
30
|
+
o[v[1]] = o[v[0]];
|
|
31
|
+
delete o[v[0]];
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// 驼峰化
|
|
35
|
+
camel.forEach(v => {
|
|
36
|
+
if (!o[v]) return;
|
|
37
|
+
const afterKey = v.replace(/^(.)/, $0 => $0.toLowerCase()).replace(/-(\w)/g, (_, $1) => $1.toUpperCase());
|
|
38
|
+
if (o[afterKey]) return;
|
|
39
|
+
o[afterKey] = o[v];
|
|
40
|
+
// todo 暂时兼容以前数据,不做删除
|
|
41
|
+
// delete o[v];
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// 转换值为布尔值
|
|
45
|
+
bool.forEach(v => {
|
|
46
|
+
o[v] = fixBool(o[v]);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// finalKill
|
|
50
|
+
if (typeof finalKill === 'function') {
|
|
51
|
+
finalKill(o);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// 首字母转小写
|
|
55
|
+
fixLowerFirst(o, lowerFirst);
|
|
56
|
+
|
|
57
|
+
return dataFix;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function fixBool(value) {
|
|
61
|
+
if (!value) return false;
|
|
62
|
+
|
|
63
|
+
if (TRUE.includes(value)) return true;
|
|
64
|
+
|
|
65
|
+
return FALSE.includes(value) ? false : value;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function fixLowerFirst(o, lowerFirst) {
|
|
69
|
+
if (lowerFirst) {
|
|
70
|
+
Object.keys(o).forEach(key => {
|
|
71
|
+
const lowerK = key.replace(/^\w/, match => match.toLowerCase());
|
|
72
|
+
if (typeof o[lowerK] === 'undefined') {
|
|
73
|
+
o[lowerK] = o[key];
|
|
74
|
+
delete o[key];
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deepCopyWith = exports.deepCopy = void 0;
|
|
4
|
+
const isBuffer_1 = require("./isBuffer");
|
|
5
|
+
exports.deepCopy = obj => {
|
|
6
|
+
if (obj === null || typeof obj !== 'object') {
|
|
7
|
+
return obj;
|
|
8
|
+
}
|
|
9
|
+
if (isBuffer_1.isBuffer(obj)) {
|
|
10
|
+
return obj.slice();
|
|
11
|
+
}
|
|
12
|
+
const copy = Array.isArray(obj) ? [] : {};
|
|
13
|
+
Object.keys(obj).forEach(key => {
|
|
14
|
+
copy[key] = exports.deepCopy(obj[key]);
|
|
15
|
+
});
|
|
16
|
+
return copy;
|
|
17
|
+
};
|
|
18
|
+
exports.deepCopyWith = (obj, customizer) => {
|
|
19
|
+
function deepCopyWithHelper(value, innerKey, innerObject) {
|
|
20
|
+
const result = customizer(value, innerKey, innerObject);
|
|
21
|
+
if (result !== undefined)
|
|
22
|
+
return result;
|
|
23
|
+
if (value === null || typeof value !== 'object') {
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
26
|
+
if (isBuffer_1.isBuffer(value)) {
|
|
27
|
+
return value.slice();
|
|
28
|
+
}
|
|
29
|
+
const copy = Array.isArray(value) ? [] : {};
|
|
30
|
+
Object.keys(value).forEach(k => {
|
|
31
|
+
copy[k] = deepCopyWithHelper(value[k], k, value);
|
|
32
|
+
});
|
|
33
|
+
return copy;
|
|
34
|
+
}
|
|
35
|
+
if (customizer) {
|
|
36
|
+
return deepCopyWithHelper(obj, '', null);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
return exports.deepCopy(obj);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { isBuffer } from './isBuffer';
|
|
2
|
+
|
|
3
|
+
export const deepCopy = obj => {
|
|
4
|
+
if (obj === null || typeof obj !== 'object') {
|
|
5
|
+
return obj;
|
|
6
|
+
}
|
|
7
|
+
if (isBuffer(obj)) {
|
|
8
|
+
return obj.slice();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const copy = Array.isArray(obj) ? [] : {};
|
|
12
|
+
|
|
13
|
+
Object.keys(obj).forEach(key => {
|
|
14
|
+
copy[key] = deepCopy(obj[key]);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
return copy;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const deepCopyWith = (obj: any, customizer?: (v: any, k: string, o: any) => any) => {
|
|
21
|
+
function deepCopyWithHelper(value: any, innerKey: string, innerObject: any) {
|
|
22
|
+
const result = customizer!(value, innerKey, innerObject);
|
|
23
|
+
if (result !== undefined) return result;
|
|
24
|
+
|
|
25
|
+
if (value === null || typeof value !== 'object') {
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (isBuffer(value)) {
|
|
30
|
+
return value.slice();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const copy = Array.isArray(value) ? [] : {};
|
|
34
|
+
|
|
35
|
+
Object.keys(value).forEach(k => {
|
|
36
|
+
copy[k] = deepCopyWithHelper(value[k], k, value);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
return copy;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (customizer) {
|
|
43
|
+
return deepCopyWithHelper(obj, '', null);
|
|
44
|
+
} else {
|
|
45
|
+
return deepCopy(obj);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function encodeString(str: unknown): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
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.encodeString = void 0;
|
|
7
|
+
const toString_1 = __importDefault(require("lodash/toString"));
|
|
8
|
+
function encodeString(str) {
|
|
9
|
+
const tempStr = toString_1.default(str);
|
|
10
|
+
return encodeURIComponent(tempStr).replace(/[!'()*]/g, c => `%${c.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
11
|
+
}
|
|
12
|
+
exports.encodeString = encodeString;
|