@bedelightful/upload-sdk 0.0.7
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/LICENSE +8 -0
- package/README.md +132 -0
- package/dist/es/Exception/BaseException.js +14 -0
- package/dist/es/Exception/BaseException.js.map +1 -0
- package/dist/es/Exception/DownloadException.js +40 -0
- package/dist/es/Exception/DownloadException.js.map +1 -0
- package/dist/es/Exception/HttpException.js +50 -0
- package/dist/es/Exception/HttpException.js.map +1 -0
- package/dist/es/Exception/InitException.js +49 -0
- package/dist/es/Exception/InitException.js.map +1 -0
- package/dist/es/Exception/UploadException.js +50 -0
- package/dist/es/Exception/UploadException.js.map +1 -0
- package/dist/es/index.d.ts +867 -0
- package/dist/es/index.js +162 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/modules/Kodo/defaultUpload.js +38 -0
- package/dist/es/modules/Kodo/defaultUpload.js.map +1 -0
- package/dist/es/modules/Kodo/index.js +8 -0
- package/dist/es/modules/Kodo/index.js.map +1 -0
- package/dist/es/modules/Local/index.js +31 -0
- package/dist/es/modules/Local/index.js.map +1 -0
- package/dist/es/modules/MinIO/MultipartUpload.js +335 -0
- package/dist/es/modules/MinIO/MultipartUpload.js.map +1 -0
- package/dist/es/modules/MinIO/STSUpload.js +10 -0
- package/dist/es/modules/MinIO/STSUpload.js.map +1 -0
- package/dist/es/modules/MinIO/defaultUpload.js +124 -0
- package/dist/es/modules/MinIO/defaultUpload.js.map +1 -0
- package/dist/es/modules/MinIO/index.js +16 -0
- package/dist/es/modules/MinIO/index.js.map +1 -0
- package/dist/es/modules/OBS/MultipartUpload.js +269 -0
- package/dist/es/modules/OBS/MultipartUpload.js.map +1 -0
- package/dist/es/modules/OBS/STSUpload.js +71 -0
- package/dist/es/modules/OBS/STSUpload.js.map +1 -0
- package/dist/es/modules/OBS/defaultUpload.js +59 -0
- package/dist/es/modules/OBS/defaultUpload.js.map +1 -0
- package/dist/es/modules/OBS/index.js +16 -0
- package/dist/es/modules/OBS/index.js.map +1 -0
- package/dist/es/modules/OBS/utils/index.js +25 -0
- package/dist/es/modules/OBS/utils/index.js.map +1 -0
- package/dist/es/modules/OSS/MultipartUpload.js +232 -0
- package/dist/es/modules/OSS/MultipartUpload.js.map +1 -0
- package/dist/es/modules/OSS/STSUpload.js +48 -0
- package/dist/es/modules/OSS/STSUpload.js.map +1 -0
- package/dist/es/modules/OSS/defaultUpload.js +53 -0
- package/dist/es/modules/OSS/defaultUpload.js.map +1 -0
- package/dist/es/modules/OSS/index.js +16 -0
- package/dist/es/modules/OSS/index.js.map +1 -0
- package/dist/es/modules/OSS/utils/helper.js +137 -0
- package/dist/es/modules/OSS/utils/helper.js.map +1 -0
- package/dist/es/modules/OSS/utils/signature.js +96 -0
- package/dist/es/modules/OSS/utils/signature.js.map +1 -0
- package/dist/es/modules/TOS/MultipartUpload.js +288 -0
- package/dist/es/modules/TOS/MultipartUpload.js.map +1 -0
- package/dist/es/modules/TOS/STSUpload.js +92 -0
- package/dist/es/modules/TOS/STSUpload.js.map +1 -0
- package/dist/es/modules/TOS/defaultUpload.js +65 -0
- package/dist/es/modules/TOS/defaultUpload.js.map +1 -0
- package/dist/es/modules/TOS/index.js +16 -0
- package/dist/es/modules/TOS/index.js.map +1 -0
- package/dist/es/modules/TOS/utils/TosClientError.js +15 -0
- package/dist/es/modules/TOS/utils/TosClientError.js.map +1 -0
- package/dist/es/modules/TOS/utils/index.js +38 -0
- package/dist/es/modules/TOS/utils/index.js.map +1 -0
- package/dist/es/modules/TOS/utils/signatureV4.js +269 -0
- package/dist/es/modules/TOS/utils/signatureV4.js.map +1 -0
- package/dist/es/modules/TOS/utils/signatureV4Credentials.js +21 -0
- package/dist/es/modules/TOS/utils/signatureV4Credentials.js.map +1 -0
- package/dist/es/modules/TOS/utils/universal/crypto.browser.js +56 -0
- package/dist/es/modules/TOS/utils/universal/crypto.browser.js.map +1 -0
- package/dist/es/modules/TOS/utils/utils.js +18 -0
- package/dist/es/modules/TOS/utils/utils.js.map +1 -0
- package/dist/es/modules/index.js +20 -0
- package/dist/es/modules/index.js.map +1 -0
- package/dist/es/types/Kodo.js +1 -0
- package/dist/es/types/Kodo.js.map +1 -0
- package/dist/es/types/Local.js +1 -0
- package/dist/es/types/Local.js.map +1 -0
- package/dist/es/types/MinIO.js +1 -0
- package/dist/es/types/MinIO.js.map +1 -0
- package/dist/es/types/OBS.js +8 -0
- package/dist/es/types/OBS.js.map +1 -0
- package/dist/es/types/OSS.js +1 -0
- package/dist/es/types/OSS.js.map +1 -0
- package/dist/es/types/TOS.js +1 -0
- package/dist/es/types/TOS.js.map +1 -0
- package/dist/es/types/error.js +1 -0
- package/dist/es/types/error.js.map +1 -0
- package/dist/es/types/index.js +13 -0
- package/dist/es/types/index.js.map +1 -0
- package/dist/es/types/log.js +1 -0
- package/dist/es/types/log.js.map +1 -0
- package/dist/es/types/request.js +1 -0
- package/dist/es/types/request.js.map +1 -0
- package/dist/es/utils/EventEmitter.js +32 -0
- package/dist/es/utils/EventEmitter.js.map +1 -0
- package/dist/es/utils/UploadManger.js +276 -0
- package/dist/es/utils/UploadManger.js.map +1 -0
- package/dist/es/utils/UploadTask.js +13 -0
- package/dist/es/utils/UploadTask.js.map +1 -0
- package/dist/es/utils/checkDataFormat.js +41 -0
- package/dist/es/utils/checkDataFormat.js.map +1 -0
- package/dist/es/utils/global.js +83 -0
- package/dist/es/utils/global.js.map +1 -0
- package/dist/es/utils/index.js +20 -0
- package/dist/es/utils/index.js.map +1 -0
- package/dist/es/utils/logPubSub.js +59 -0
- package/dist/es/utils/logPubSub.js.map +1 -0
- package/dist/es/utils/multipart.js +159 -0
- package/dist/es/utils/multipart.js.map +1 -0
- package/dist/es/utils/nanoid.js +10 -0
- package/dist/es/utils/nanoid.js.map +1 -0
- package/dist/es/utils/regExpUtil.js +21 -0
- package/dist/es/utils/regExpUtil.js.map +1 -0
- package/dist/es/utils/request.js +234 -0
- package/dist/es/utils/request.js.map +1 -0
- package/dist/es/utils/response.js +20 -0
- package/dist/es/utils/response.js.map +1 -0
- package/dist/index.d.ts +867 -0
- package/dist/index.js +60913 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.js +130 -0
- package/dist/index.min.js.map +1 -0
- package/dist/lib/Exception/BaseException.js +37 -0
- package/dist/lib/Exception/BaseException.js.map +1 -0
- package/dist/lib/Exception/DownloadException.js +65 -0
- package/dist/lib/Exception/DownloadException.js.map +1 -0
- package/dist/lib/Exception/HttpException.js +75 -0
- package/dist/lib/Exception/HttpException.js.map +1 -0
- package/dist/lib/Exception/InitException.js +73 -0
- package/dist/lib/Exception/InitException.js.map +1 -0
- package/dist/lib/Exception/UploadException.js +75 -0
- package/dist/lib/Exception/UploadException.js.map +1 -0
- package/dist/lib/index.d.cts +867 -0
- package/dist/lib/index.js +203 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/modules/Kodo/defaultUpload.js +61 -0
- package/dist/lib/modules/Kodo/defaultUpload.js.map +1 -0
- package/dist/lib/modules/Kodo/index.js +28 -0
- package/dist/lib/modules/Kodo/index.js.map +1 -0
- package/dist/lib/modules/Local/index.js +50 -0
- package/dist/lib/modules/Local/index.js.map +1 -0
- package/dist/lib/modules/MinIO/MultipartUpload.js +357 -0
- package/dist/lib/modules/MinIO/MultipartUpload.js.map +1 -0
- package/dist/lib/modules/MinIO/STSUpload.js +33 -0
- package/dist/lib/modules/MinIO/STSUpload.js.map +1 -0
- package/dist/lib/modules/MinIO/defaultUpload.js +158 -0
- package/dist/lib/modules/MinIO/defaultUpload.js.map +1 -0
- package/dist/lib/modules/MinIO/index.js +35 -0
- package/dist/lib/modules/MinIO/index.js.map +1 -0
- package/dist/lib/modules/OBS/MultipartUpload.js +296 -0
- package/dist/lib/modules/OBS/MultipartUpload.js.map +1 -0
- package/dist/lib/modules/OBS/STSUpload.js +104 -0
- package/dist/lib/modules/OBS/STSUpload.js.map +1 -0
- package/dist/lib/modules/OBS/defaultUpload.js +88 -0
- package/dist/lib/modules/OBS/defaultUpload.js.map +1 -0
- package/dist/lib/modules/OBS/index.js +45 -0
- package/dist/lib/modules/OBS/index.js.map +1 -0
- package/dist/lib/modules/OBS/utils/index.js +49 -0
- package/dist/lib/modules/OBS/utils/index.js.map +1 -0
- package/dist/lib/modules/OSS/MultipartUpload.js +259 -0
- package/dist/lib/modules/OSS/MultipartUpload.js.map +1 -0
- package/dist/lib/modules/OSS/STSUpload.js +71 -0
- package/dist/lib/modules/OSS/STSUpload.js.map +1 -0
- package/dist/lib/modules/OSS/defaultUpload.js +76 -0
- package/dist/lib/modules/OSS/defaultUpload.js.map +1 -0
- package/dist/lib/modules/OSS/index.js +35 -0
- package/dist/lib/modules/OSS/index.js.map +1 -0
- package/dist/lib/modules/OSS/utils/helper.js +173 -0
- package/dist/lib/modules/OSS/utils/helper.js.map +1 -0
- package/dist/lib/modules/OSS/utils/signature.js +132 -0
- package/dist/lib/modules/OSS/utils/signature.js.map +1 -0
- package/dist/lib/modules/TOS/MultipartUpload.js +315 -0
- package/dist/lib/modules/TOS/MultipartUpload.js.map +1 -0
- package/dist/lib/modules/TOS/STSUpload.js +125 -0
- package/dist/lib/modules/TOS/STSUpload.js.map +1 -0
- package/dist/lib/modules/TOS/defaultUpload.js +94 -0
- package/dist/lib/modules/TOS/defaultUpload.js.map +1 -0
- package/dist/lib/modules/TOS/index.js +45 -0
- package/dist/lib/modules/TOS/index.js.map +1 -0
- package/dist/lib/modules/TOS/utils/TosClientError.js +34 -0
- package/dist/lib/modules/TOS/utils/TosClientError.js.map +1 -0
- package/dist/lib/modules/TOS/utils/index.js +64 -0
- package/dist/lib/modules/TOS/utils/index.js.map +1 -0
- package/dist/lib/modules/TOS/utils/signatureV4.js +294 -0
- package/dist/lib/modules/TOS/utils/signatureV4.js.map +1 -0
- package/dist/lib/modules/TOS/utils/signatureV4Credentials.js +44 -0
- package/dist/lib/modules/TOS/utils/signatureV4Credentials.js.map +1 -0
- package/dist/lib/modules/TOS/utils/universal/crypto.browser.js +93 -0
- package/dist/lib/modules/TOS/utils/universal/crypto.browser.js.map +1 -0
- package/dist/lib/modules/TOS/utils/utils.js +42 -0
- package/dist/lib/modules/TOS/utils/utils.js.map +1 -0
- package/dist/lib/modules/index.js +50 -0
- package/dist/lib/modules/index.js.map +1 -0
- package/dist/lib/types/Kodo.js +17 -0
- package/dist/lib/types/Kodo.js.map +1 -0
- package/dist/lib/types/Local.js +17 -0
- package/dist/lib/types/Local.js.map +1 -0
- package/dist/lib/types/MinIO.js +17 -0
- package/dist/lib/types/MinIO.js.map +1 -0
- package/dist/lib/types/OBS.js +32 -0
- package/dist/lib/types/OBS.js.map +1 -0
- package/dist/lib/types/OSS.js +17 -0
- package/dist/lib/types/OSS.js.map +1 -0
- package/dist/lib/types/TOS.js +17 -0
- package/dist/lib/types/TOS.js.map +1 -0
- package/dist/lib/types/error.js +17 -0
- package/dist/lib/types/error.js.map +1 -0
- package/dist/lib/types/index.js +37 -0
- package/dist/lib/types/index.js.map +1 -0
- package/dist/lib/types/log.js +17 -0
- package/dist/lib/types/log.js.map +1 -0
- package/dist/lib/types/request.js +17 -0
- package/dist/lib/types/request.js.map +1 -0
- package/dist/lib/utils/EventEmitter.js +51 -0
- package/dist/lib/utils/EventEmitter.js.map +1 -0
- package/dist/lib/utils/UploadManger.js +309 -0
- package/dist/lib/utils/UploadManger.js.map +1 -0
- package/dist/lib/utils/UploadTask.js +32 -0
- package/dist/lib/utils/UploadTask.js.map +1 -0
- package/dist/lib/utils/checkDataFormat.js +70 -0
- package/dist/lib/utils/checkDataFormat.js.map +1 -0
- package/dist/lib/utils/global.js +106 -0
- package/dist/lib/utils/global.js.map +1 -0
- package/dist/lib/utils/index.js +44 -0
- package/dist/lib/utils/index.js.map +1 -0
- package/dist/lib/utils/logPubSub.js +78 -0
- package/dist/lib/utils/logPubSub.js.map +1 -0
- package/dist/lib/utils/multipart.js +197 -0
- package/dist/lib/utils/multipart.js.map +1 -0
- package/dist/lib/utils/nanoid.js +33 -0
- package/dist/lib/utils/nanoid.js.map +1 -0
- package/dist/lib/utils/regExpUtil.js +44 -0
- package/dist/lib/utils/regExpUtil.js.map +1 -0
- package/dist/lib/utils/request.js +264 -0
- package/dist/lib/utils/request.js.map +1 -0
- package/dist/lib/utils/response.js +43 -0
- package/dist/lib/utils/response.js.map +1 -0
- package/dist/package.json +120 -0
- package/package.json +120 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var nanoid_exports = {};
|
|
21
|
+
__export(nanoid_exports, {
|
|
22
|
+
nanoid: () => nanoid
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(nanoid_exports);
|
|
25
|
+
const nanoid = /* @__PURE__ */ __name((t = 21) => crypto.getRandomValues(new Uint8Array(t)).reduce(
|
|
26
|
+
(t2, e) => t2 += (e &= 63) < 36 ? e.toString(36) : e < 62 ? (e - 26).toString(36).toUpperCase() : e > 62 ? "-" : "_",
|
|
27
|
+
""
|
|
28
|
+
), "nanoid");
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
nanoid
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=nanoid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/nanoid.ts"],"sourcesContent":["/* eslint-disable */\n/**\n * @description: Generate a unique id similar to uuid (borrowed from nanoid)\n * @param {*} t String length\n * @return {*} Unique id\n */\nexport const nanoid = (t = 21) =>\n\tcrypto\n\t\t.getRandomValues(new Uint8Array(t))\n\t\t.reduce(\n\t\t\t(t, e) =>\n\t\t\t\t(t +=\n\t\t\t\t\t(e &= 63) < 36\n\t\t\t\t\t\t? e.toString(36)\n\t\t\t\t\t\t: e < 62\n\t\t\t\t\t\t\t? (e - 26).toString(36).toUpperCase()\n\t\t\t\t\t\t\t: e > 62\n\t\t\t\t\t\t\t\t? \"-\"\n\t\t\t\t\t\t\t\t: \"_\"),\n\t\t\t\"\",\n\t\t)\n\n\n\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMO,MAAM,SAAS,wBAAC,IAAI,OAC1B,OACE,gBAAgB,IAAI,WAAW,CAAC,CAAC,EACjC;AAAA,EACA,CAACA,IAAG,MACFA,OACC,KAAK,MAAM,KACT,EAAE,SAAS,EAAE,IACb,IAAI,MACF,IAAI,IAAI,SAAS,EAAE,EAAE,YAAY,IAClC,IAAI,KACH,MACA;AAAA,EACP;AACD,GAdoB;","names":["t"]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var regExpUtil_exports = {};
|
|
21
|
+
__export(regExpUtil_exports, {
|
|
22
|
+
parseExtname: () => parseExtname
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(regExpUtil_exports);
|
|
25
|
+
function parseExtname(path) {
|
|
26
|
+
if (!path)
|
|
27
|
+
return "";
|
|
28
|
+
if (path.endsWith("/") || path.endsWith("\\"))
|
|
29
|
+
return "";
|
|
30
|
+
const fileName = path.split(/[/\\]/).pop() || "";
|
|
31
|
+
if (fileName.startsWith(".") && fileName.indexOf(".", 1) === -1) {
|
|
32
|
+
return fileName;
|
|
33
|
+
}
|
|
34
|
+
const lastDotIndex = fileName.lastIndexOf(".");
|
|
35
|
+
if (lastDotIndex === -1)
|
|
36
|
+
return "";
|
|
37
|
+
return fileName.substring(lastDotIndex);
|
|
38
|
+
}
|
|
39
|
+
__name(parseExtname, "parseExtname");
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
parseExtname
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=regExpUtil.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/regExpUtil.ts"],"sourcesContent":["/**\n * @description: Extract the extension from a file path\n * @param {string} path File path\n * @return {string} File extension (with dot, e.g., \".mp4\") or empty string if none\n */\nexport function parseExtname(path: string) {\n\t// First check if empty\n\tif (!path) return \"\"\n\n\t// Check whether the path ends with a slash or backslash\n\tif (path.endsWith(\"/\") || path.endsWith(\"\\\\\")) return \"\"\n\n\t// Get the part after the last / or \\\\\n\tconst fileName = path.split(/[/\\\\]/).pop() || \"\"\n\n\t// If the filename starts with a dot and has no other dots, return the whole name\n\tif (fileName.startsWith(\".\") && fileName.indexOf(\".\", 1) === -1) {\n\t\treturn fileName\n\t}\n\n\t// Find the part after the last dot\n\tconst lastDotIndex = fileName.lastIndexOf(\".\")\n\tif (lastDotIndex === -1) return \"\" // No extension\n\n\treturn fileName.substring(lastDotIndex)\n}\n\n\n\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKO,SAAS,aAAa,MAAc;AAE1C,MAAI,CAAC;AAAM,WAAO;AAGlB,MAAI,KAAK,SAAS,GAAG,KAAK,KAAK,SAAS,IAAI;AAAG,WAAO;AAGtD,QAAM,WAAW,KAAK,MAAM,OAAO,EAAE,IAAI,KAAK;AAG9C,MAAI,SAAS,WAAW,GAAG,KAAK,SAAS,QAAQ,KAAK,CAAC,MAAM,IAAI;AAChE,WAAO;AAAA,EACR;AAGA,QAAM,eAAe,SAAS,YAAY,GAAG;AAC7C,MAAI,iBAAiB;AAAI,WAAO;AAEhC,SAAO,SAAS,UAAU,YAAY;AACvC;AApBgB;","names":[]}
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var request_exports = {};
|
|
21
|
+
__export(request_exports, {
|
|
22
|
+
cancelRequest: () => cancelRequest,
|
|
23
|
+
completeRequest: () => completeRequest,
|
|
24
|
+
createAbortSignal: () => createAbortSignal,
|
|
25
|
+
getAbortSignal: () => getAbortSignal,
|
|
26
|
+
getTaskAbortState: () => getTaskAbortState,
|
|
27
|
+
pauseRequest: () => pauseRequest,
|
|
28
|
+
registerAbortController: () => registerAbortController,
|
|
29
|
+
request: () => request
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(request_exports);
|
|
32
|
+
var import_HttpException = require("../Exception/HttpException");
|
|
33
|
+
var import_checkDataFormat = require("./checkDataFormat");
|
|
34
|
+
var import_utils = require("../modules/TOS/utils");
|
|
35
|
+
let requestTasks = [];
|
|
36
|
+
let abortControllers = /* @__PURE__ */ new Map();
|
|
37
|
+
let taskAbortStates = /* @__PURE__ */ new Map();
|
|
38
|
+
function registerAbortController(taskId, controller) {
|
|
39
|
+
if (!abortControllers.has(taskId)) {
|
|
40
|
+
abortControllers.set(taskId, []);
|
|
41
|
+
}
|
|
42
|
+
abortControllers.get(taskId)?.push(controller);
|
|
43
|
+
}
|
|
44
|
+
__name(registerAbortController, "registerAbortController");
|
|
45
|
+
function getAbortSignal(taskId) {
|
|
46
|
+
const controllers = abortControllers.get(taskId);
|
|
47
|
+
if (controllers && controllers.length > 0) {
|
|
48
|
+
const controller = new AbortController();
|
|
49
|
+
controllers.push(controller);
|
|
50
|
+
return controller.signal;
|
|
51
|
+
}
|
|
52
|
+
return void 0;
|
|
53
|
+
}
|
|
54
|
+
__name(getAbortSignal, "getAbortSignal");
|
|
55
|
+
function createAbortSignal(taskId) {
|
|
56
|
+
const controller = new AbortController();
|
|
57
|
+
registerAbortController(taskId, controller);
|
|
58
|
+
return controller.signal;
|
|
59
|
+
}
|
|
60
|
+
__name(createAbortSignal, "createAbortSignal");
|
|
61
|
+
function getTaskAbortState(taskId) {
|
|
62
|
+
return taskAbortStates.get(taskId);
|
|
63
|
+
}
|
|
64
|
+
__name(getTaskAbortState, "getTaskAbortState");
|
|
65
|
+
function createXHR() {
|
|
66
|
+
if (typeof XMLHttpRequest !== "undefined") {
|
|
67
|
+
return new XMLHttpRequest();
|
|
68
|
+
}
|
|
69
|
+
throw new import_HttpException.HttpException(import_HttpException.HttpExceptionCode.REQUEST_NO_XHR_OBJ_AVAILABLE);
|
|
70
|
+
}
|
|
71
|
+
__name(createXHR, "createXHR");
|
|
72
|
+
function cancelRequest(taskId) {
|
|
73
|
+
taskAbortStates.set(taskId, "cancel");
|
|
74
|
+
requestTasks.forEach((task) => {
|
|
75
|
+
if (task.taskId === taskId) {
|
|
76
|
+
task.makeCancel();
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
const controllers = abortControllers.get(taskId);
|
|
80
|
+
if (controllers) {
|
|
81
|
+
controllers.forEach((controller) => {
|
|
82
|
+
controller.abort();
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
__name(cancelRequest, "cancelRequest");
|
|
87
|
+
function pauseRequest(taskId) {
|
|
88
|
+
taskAbortStates.set(taskId, "pause");
|
|
89
|
+
requestTasks.forEach((task) => {
|
|
90
|
+
if (task.taskId === taskId) {
|
|
91
|
+
task.makePause();
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
const controllers = abortControllers.get(taskId);
|
|
95
|
+
if (controllers) {
|
|
96
|
+
controllers.forEach((controller) => {
|
|
97
|
+
controller.abort();
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
__name(pauseRequest, "pauseRequest");
|
|
102
|
+
function parseXML(xml) {
|
|
103
|
+
let convertedObj = {};
|
|
104
|
+
if (xml?.children && xml.children.length !== 0) {
|
|
105
|
+
Object.values(xml.children).forEach((childNode) => {
|
|
106
|
+
convertedObj = {
|
|
107
|
+
...convertedObj,
|
|
108
|
+
[childNode.nodeName]: parseXML(childNode)
|
|
109
|
+
};
|
|
110
|
+
});
|
|
111
|
+
} else {
|
|
112
|
+
return xml?.textContent ? xml.textContent : {};
|
|
113
|
+
}
|
|
114
|
+
return convertedObj;
|
|
115
|
+
}
|
|
116
|
+
__name(parseXML, "parseXML");
|
|
117
|
+
function parseHeaderString(str) {
|
|
118
|
+
return str.split("\r\n").reduce((obj, header) => {
|
|
119
|
+
let tempObj = { ...obj };
|
|
120
|
+
if (header !== "" && header.split(":").length > 0) {
|
|
121
|
+
const [key, value] = header.split(":");
|
|
122
|
+
tempObj = {
|
|
123
|
+
...tempObj,
|
|
124
|
+
[key]: value.replace(" ", "")
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
return tempObj;
|
|
128
|
+
}, {});
|
|
129
|
+
}
|
|
130
|
+
__name(parseHeaderString, "parseHeaderString");
|
|
131
|
+
function completeRequest(taskId) {
|
|
132
|
+
if (taskId === void 0)
|
|
133
|
+
return;
|
|
134
|
+
requestTasks = requestTasks.filter((task) => task.taskId !== taskId);
|
|
135
|
+
abortControllers.delete(taskId);
|
|
136
|
+
taskAbortStates.delete(taskId);
|
|
137
|
+
}
|
|
138
|
+
__name(completeRequest, "completeRequest");
|
|
139
|
+
function isJSONResponse(req) {
|
|
140
|
+
return req.responseType === "json" && typeof req.response === "string";
|
|
141
|
+
}
|
|
142
|
+
__name(isJSONResponse, "isJSONResponse");
|
|
143
|
+
function addHeadersToResponse(result, responseHeaders) {
|
|
144
|
+
return {
|
|
145
|
+
...result,
|
|
146
|
+
headers: responseHeaders
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
__name(addHeadersToResponse, "addHeadersToResponse");
|
|
150
|
+
function request(uploadRequestConfig) {
|
|
151
|
+
const {
|
|
152
|
+
method,
|
|
153
|
+
url,
|
|
154
|
+
data,
|
|
155
|
+
query,
|
|
156
|
+
headers,
|
|
157
|
+
success,
|
|
158
|
+
fail,
|
|
159
|
+
taskId,
|
|
160
|
+
onProgress,
|
|
161
|
+
xmlResponse,
|
|
162
|
+
withoutWrapper
|
|
163
|
+
} = uploadRequestConfig;
|
|
164
|
+
return new Promise((resolve, reject) => {
|
|
165
|
+
const req = createXHR();
|
|
166
|
+
let isCancel = false;
|
|
167
|
+
let isPause = false;
|
|
168
|
+
req.responseType = xmlResponse ? "document" : "json";
|
|
169
|
+
req.upload.onloadstart = () => {
|
|
170
|
+
if (taskId) {
|
|
171
|
+
requestTasks.push({
|
|
172
|
+
taskId,
|
|
173
|
+
makeCancel: () => {
|
|
174
|
+
isCancel = true;
|
|
175
|
+
req.abort();
|
|
176
|
+
},
|
|
177
|
+
makePause: () => {
|
|
178
|
+
isPause = true;
|
|
179
|
+
req.abort();
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
req.upload.onprogress = (evt) => {
|
|
185
|
+
if (onProgress)
|
|
186
|
+
onProgress(evt.loaded / evt.total * 100, evt.loaded, evt.total, null);
|
|
187
|
+
};
|
|
188
|
+
let handledUrl = url;
|
|
189
|
+
if (query) {
|
|
190
|
+
const queryString = Object.entries(query).map(([key, value]) => {
|
|
191
|
+
if (value) {
|
|
192
|
+
return `${key}=${value}`;
|
|
193
|
+
}
|
|
194
|
+
return key;
|
|
195
|
+
}).join("&");
|
|
196
|
+
if (queryString) {
|
|
197
|
+
handledUrl += `?${queryString}`;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
req.open(method.toUpperCase(), handledUrl, true);
|
|
201
|
+
req.setRequestHeader("language", "zh_CN");
|
|
202
|
+
if (headers && Object.keys(headers).length > 0) {
|
|
203
|
+
const handledHeaders = (0, import_utils.formatHeaders)(headers);
|
|
204
|
+
Object.keys(handledHeaders).forEach((key) => {
|
|
205
|
+
req.setRequestHeader(key, headers[key]);
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
req.send(data);
|
|
209
|
+
req.onreadystatechange = () => {
|
|
210
|
+
if (req.readyState !== 4) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
if (/^2\d{2}/.test(String(req.status))) {
|
|
214
|
+
let result = isJSONResponse(req) ? JSON.parse(req.response) : req.response;
|
|
215
|
+
const responseHeaders = {
|
|
216
|
+
...parseHeaderString(req.getAllResponseHeaders())
|
|
217
|
+
};
|
|
218
|
+
if (xmlResponse) {
|
|
219
|
+
result = {
|
|
220
|
+
data: parseXML(req.responseXML)
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
if (withoutWrapper || !(0, import_checkDataFormat.isObject)(result)) {
|
|
224
|
+
result = {
|
|
225
|
+
data: result
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
result = addHeadersToResponse(result, responseHeaders);
|
|
229
|
+
resolve(result);
|
|
230
|
+
if (success && typeof success === "function") {
|
|
231
|
+
success(result);
|
|
232
|
+
}
|
|
233
|
+
} else {
|
|
234
|
+
if (fail && typeof fail === "function") {
|
|
235
|
+
fail(req.status, reject);
|
|
236
|
+
}
|
|
237
|
+
if (isCancel) {
|
|
238
|
+
reject(new import_HttpException.HttpException(import_HttpException.HttpExceptionCode.REQUEST_IS_CANCEL));
|
|
239
|
+
} else if (isPause) {
|
|
240
|
+
reject(new import_HttpException.HttpException(import_HttpException.HttpExceptionCode.REQUEST_IS_PAUSE));
|
|
241
|
+
}
|
|
242
|
+
reject(
|
|
243
|
+
new import_HttpException.HttpException(
|
|
244
|
+
import_HttpException.HttpExceptionCode.REQUEST_FAILED_WITH_STATUS_CODE,
|
|
245
|
+
req.status
|
|
246
|
+
)
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
__name(request, "request");
|
|
253
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
254
|
+
0 && (module.exports = {
|
|
255
|
+
cancelRequest,
|
|
256
|
+
completeRequest,
|
|
257
|
+
createAbortSignal,
|
|
258
|
+
getAbortSignal,
|
|
259
|
+
getTaskAbortState,
|
|
260
|
+
pauseRequest,
|
|
261
|
+
registerAbortController,
|
|
262
|
+
request
|
|
263
|
+
});
|
|
264
|
+
//# sourceMappingURL=request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/request.ts"],"sourcesContent":["/**\n * @file Global request\n */\n\nimport { HttpException, HttpExceptionCode } from \"../Exception/HttpException\"\nimport type { TaskId } from \"../types\"\nimport type { RequestTask, UploadRequestConfig } from \"../types/request\"\nimport { isObject } from \"./checkDataFormat\"\nimport { formatHeaders } from \"../modules/TOS/utils\"\n\n// Maintain a request queue\nlet requestTasks: RequestTask[] = []\n\n// Maintain AbortController queue (for AWS SDK and other Fetch-based requests)\nlet abortControllers: Map<TaskId, AbortController[]> = new Map()\n\n// Maintain task cancel/pause state (to distinguish between cancel and pause)\nlet taskAbortStates: Map<TaskId, \"cancel\" | \"pause\"> = new Map()\n\n/**\n * Register an AbortController for a task (used for AWS SDK requests)\n * @param {TaskId} taskId Task ID\n * @param {AbortController} controller AbortController instance\n */\nexport function registerAbortController(taskId: TaskId, controller: AbortController): void {\n\tif (!abortControllers.has(taskId)) {\n\t\tabortControllers.set(taskId, [])\n\t}\n\tabortControllers.get(taskId)?.push(controller)\n}\n\n/**\n * Get the AbortSignal for a task\n * @param {TaskId} taskId Task ID\n * @returns {AbortSignal | undefined} AbortSignal if exists\n */\nexport function getAbortSignal(taskId: TaskId): AbortSignal | undefined {\n\tconst controllers = abortControllers.get(taskId)\n\tif (controllers && controllers.length > 0) {\n\t\t// Create a new controller for this specific request\n\t\tconst controller = new AbortController()\n\t\tcontrollers.push(controller)\n\t\treturn controller.signal\n\t}\n\treturn undefined\n}\n\n/**\n * Create a new AbortController for a task and return its signal\n * @param {TaskId} taskId Task ID\n * @returns {AbortSignal} AbortSignal\n */\nexport function createAbortSignal(taskId: TaskId): AbortSignal {\n\tconst controller = new AbortController()\n\tregisterAbortController(taskId, controller)\n\treturn controller.signal\n}\n\n/**\n * Get the abort state of a task (cancel or pause)\n * @param {TaskId} taskId Task ID\n * @returns {\"cancel\" | \"pause\" | undefined} The abort state\n */\nexport function getTaskAbortState(taskId: TaskId): \"cancel\" | \"pause\" | undefined {\n\treturn taskAbortStates.get(taskId)\n}\n\n/**\n * XMLHttpRequest object compatibility handling\n */\nfunction createXHR() {\n\tif (typeof XMLHttpRequest !== \"undefined\") {\n\t\t// Firefox, Opera, Safari, Chrome\n\t\treturn new XMLHttpRequest()\n\t}\n\tthrow new HttpException(HttpExceptionCode.REQUEST_NO_XHR_OBJ_AVAILABLE)\n}\n/**\n * @description Terminate file upload\n * @param {TaskId} taskId Task ID\n */\nexport function cancelRequest(taskId: TaskId): void {\n\t// Set abort state to cancel\n\ttaskAbortStates.set(taskId, \"cancel\")\n\t\n\t// Cancel XHR requests\n\trequestTasks.forEach((task) => {\n\t\tif (task.taskId === taskId) {\n\t\t\ttask.makeCancel()\n\t\t}\n\t})\n\t\n\t// Cancel Fetch-based requests (AWS SDK)\n\tconst controllers = abortControllers.get(taskId)\n\tif (controllers) {\n\t\tcontrollers.forEach((controller) => {\n\t\t\tcontroller.abort()\n\t\t})\n\t}\n}\n\n/**\n * @description Pause file upload\n * @param {TaskId} taskId Task ID\n */\nexport function pauseRequest(taskId: TaskId): void {\n\t// Set abort state to pause\n\ttaskAbortStates.set(taskId, \"pause\")\n\t\n\t// Pause XHR requests\n\trequestTasks.forEach((task) => {\n\t\tif (task.taskId === taskId) {\n\t\t\ttask.makePause()\n\t\t}\n\t})\n\t\n\t// Pause Fetch-based requests (AWS SDK)\n\tconst controllers = abortControllers.get(taskId)\n\tif (controllers) {\n\t\tcontrollers.forEach((controller) => {\n\t\t\tcontroller.abort()\n\t\t})\n\t}\n}\n\n/**\n * @description XML =>>> Object\n * @param {XMLDocument} xml\n * @return {Object} convertedObj Converted Object\n */\nfunction parseXML(xml: XMLDocument | null): Record<string, string | object> | {} {\n\t// output\n\tlet convertedObj: Record<string, object | string> = {}\n\tif (xml?.children && xml.children.length !== 0) {\n\t\tObject.values(xml.children).forEach((childNode: any) => {\n\t\t\tconvertedObj = {\n\t\t\t\t...convertedObj,\n\t\t\t\t[childNode.nodeName]: parseXML(childNode),\n\t\t\t}\n\t\t})\n\t} else {\n\t\treturn xml?.textContent ? xml.textContent : {}\n\t}\n\treturn convertedObj\n}\n\n/**\n * Parse header string to object\n * @param str\n */\nfunction parseHeaderString(str: string) {\n\treturn str.split(\"\\r\\n\").reduce((obj, header) => {\n\t\tlet tempObj = { ...obj }\n\t\tif (header !== \"\" && header.split(\":\").length > 0) {\n\t\t\tconst [key, value] = header.split(\":\")\n\t\t\ttempObj = {\n\t\t\t\t...tempObj,\n\t\t\t\t[key]: value.replace(\" \", \"\"),\n\t\t\t}\n\t\t}\n\t\treturn tempObj\n\t}, {})\n}\n\n/**\n * @description Request completion (whether success or failure)\n * @param {TaskId} taskId Task ID\n */\nexport function completeRequest(taskId: TaskId | undefined): void {\n\tif (taskId === undefined) return\n\n\trequestTasks = requestTasks.filter((task) => task.taskId !== taskId)\n\t\n\t// Clean up AbortControllers\n\tabortControllers.delete(taskId)\n\t\n\t// Clean up abort state\n\ttaskAbortStates.delete(taskId)\n}\n\n/**\n * Determine if response is JSON\n * @param req\n */\nfunction isJSONResponse(req: XMLHttpRequest) {\n\treturn req.responseType === \"json\" && typeof req.response === \"string\"\n}\n\n/**\n * Add headers object to response object\n * @param result\n * @param responseHeaders\n */\nfunction addHeadersToResponse<T extends Record<string, any>, H extends Record<string, string>>(\n\tresult: T,\n\tresponseHeaders: H,\n): T & { headers: H } {\n\treturn {\n\t\t...result,\n\t\theaders: responseHeaders,\n\t}\n}\n\n/**\n * Encapsulate XHR request method\n * @param {UploadRequestConfig} uploadRequestConfig\n * @return {Promise<Result>}\n */\nexport function request<T>(uploadRequestConfig: UploadRequestConfig): Promise<T> {\n\tconst {\n\t\tmethod,\n\t\turl,\n\t\tdata,\n\t\tquery,\n\t\theaders,\n\t\tsuccess,\n\t\tfail,\n\t\ttaskId,\n\t\tonProgress,\n\t\txmlResponse,\n\t\twithoutWrapper,\n\t} = uploadRequestConfig\n\n\treturn new Promise((resolve, reject) => {\n\t\t// Create a request\n\t\tconst req = createXHR()\n\t\t// Cancel state\n\t\tlet isCancel: boolean = false\n\n\t\t// Pause state\n\t\tlet isPause: boolean = false\n\n\t\treq.responseType = xmlResponse ? \"document\" : \"json\"\n\n\t\t// Monitor upload file start\n\t\treq.upload.onloadstart = () => {\n\t\t\tif (taskId) {\n\t\t\t\trequestTasks.push({\n\t\t\t\t\ttaskId,\n\t\t\t\t\tmakeCancel: () => {\n\t\t\t\t\t\tisCancel = true\n\t\t\t\t\t\treq.abort()\n\t\t\t\t\t},\n\t\t\t\t\tmakePause: () => {\n\t\t\t\t\t\tisPause = true\n\t\t\t\t\t\treq.abort()\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\t// Monitor upload file progress event\n\t\treq.upload.onprogress = (evt: any) => {\n\t\t\tif (onProgress) onProgress((evt.loaded / evt.total) * 100, evt.loaded, evt.total, null)\n\t\t}\n\n\t\t// Handle query parameters\n\t\tlet handledUrl = url\n\t\tif (query) {\n\t\t\tconst queryString = Object.entries(query)\n\t\t\t\t.map(([key, value]) => {\n\t\t\t\t\tif (value) {\n\t\t\t\t\t\treturn `${key}=${value}`\n\t\t\t\t\t}\n\t\t\t\t\treturn key\n\t\t\t\t})\n\t\t\t\t.join(\"&\")\n\n\t\t\tif (queryString) {\n\t\t\t\thandledUrl += `?${queryString}`\n\t\t\t}\n\t\t}\n\n\t\t// Set request method, URL, async\n\t\treq.open(method.toUpperCase(), handledUrl, true)\n\n\t\t// Set request headers\n\t\treq.setRequestHeader(\"language\", \"zh_CN\")\n\n\t\tif (headers && Object.keys(headers).length > 0) {\n\t\t\tconst handledHeaders = formatHeaders(headers)\n\t\t\tObject.keys(handledHeaders).forEach((key) => {\n\t\t\t\treq.setRequestHeader(key, headers[key])\n\t\t\t})\n\t\t}\n\n\t\t// Send request\n\t\treq.send(data as XMLHttpRequestBodyInit | null)\n\n\t\t// Receive response\n\t\treq.onreadystatechange = () => {\n\t\t\tif (req.readyState !== 4) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Judge response status\n\t\t\tif (/^2\\d{2}/.test(String(req.status))) {\n\t\t\t\t// Request success\n\t\t\t\tlet result = isJSONResponse(req) ? JSON.parse(req.response) : req.response\n\t\t\t\tconst responseHeaders: Record<string, string> = {\n\t\t\t\t\t...parseHeaderString(req.getAllResponseHeaders()),\n\t\t\t\t}\n\n\t\t\t\t// aliyun initMultipleUpload\n\t\t\t\tif (xmlResponse) {\n\t\t\t\t\tresult = {\n\t\t\t\t\t\tdata: parseXML(req.responseXML),\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// tos post\n\t\t\t\tif (withoutWrapper || !isObject(result)) {\n\t\t\t\t\tresult = {\n\t\t\t\t\t\tdata: result,\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tresult = addHeadersToResponse(result, responseHeaders)\n\n\t\t\t\tresolve(result)\n\t\t\t\tif (success && typeof success === \"function\") {\n\t\t\t\t\tsuccess(result)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Request failure\n\t\t\t\tif (fail && typeof fail === \"function\") {\n\t\t\t\t\tfail(req.status, reject)\n\t\t\t\t}\n\t\t\t\tif (isCancel) {\n\t\t\t\t\treject(new HttpException(HttpExceptionCode.REQUEST_IS_CANCEL))\n\t\t\t\t} else if (isPause) {\n\t\t\t\t\treject(new HttpException(HttpExceptionCode.REQUEST_IS_PAUSE))\n\t\t\t\t}\n\t\t\t\treject(\n\t\t\t\t\tnew HttpException(\n\t\t\t\t\t\tHttpExceptionCode.REQUEST_FAILED_WITH_STATUS_CODE,\n\t\t\t\t\t\treq.status,\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t})\n}\n\n\n\n\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var response_exports = {};
|
|
21
|
+
__export(response_exports, {
|
|
22
|
+
normalizeSuccessResponse: () => normalizeSuccessResponse
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(response_exports);
|
|
25
|
+
const DEFAULT_SUCCESS_CODE = 1e3;
|
|
26
|
+
const DEFAULT_SUCCESS_MESSAGE = "Request successful";
|
|
27
|
+
function normalizeSuccessResponse(key, platform, headers) {
|
|
28
|
+
return {
|
|
29
|
+
code: DEFAULT_SUCCESS_CODE,
|
|
30
|
+
message: DEFAULT_SUCCESS_MESSAGE,
|
|
31
|
+
headers,
|
|
32
|
+
data: {
|
|
33
|
+
path: key,
|
|
34
|
+
platform
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
__name(normalizeSuccessResponse, "normalizeSuccessResponse");
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
normalizeSuccessResponse
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/response.ts"],"sourcesContent":["import type { NormalSuccessResponse, PlatformType } from \"../types\"\n\nconst DEFAULT_SUCCESS_CODE = 1000\nconst DEFAULT_SUCCESS_MESSAGE = \"Request successful\"\n\nexport function normalizeSuccessResponse(\n\tkey: string,\n\tplatform: PlatformType,\n\theaders: Record<string, string>,\n): NormalSuccessResponse {\n\treturn {\n\t\tcode: DEFAULT_SUCCESS_CODE,\n\t\tmessage: DEFAULT_SUCCESS_MESSAGE,\n\t\theaders,\n\t\tdata: {\n\t\t\tpath: key,\n\t\t\tplatform,\n\t\t},\n\t}\n}\n\n\n\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,MAAM,uBAAuB;AAC7B,MAAM,0BAA0B;AAEzB,SAAS,yBACf,KACA,UACA,SACwB;AACxB,SAAO;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT;AAAA,IACA,MAAM;AAAA,MACL,MAAM;AAAA,MACN;AAAA,IACD;AAAA,EACD;AACD;AAdgB;","names":[]}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bedelightful/upload-sdk",
|
|
3
|
+
"version": "0.0.7",
|
|
4
|
+
"description": "Unified upload toolkit supporting Aliyun OSS, Volcengine TOS, and Huawei OBS, with planned support for Tencent COS, Qiniu Kodo, Baidu BOS, NetEase NOS, and more.",
|
|
5
|
+
"keywords": [],
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/saashqdev/delightful/upload-sdk"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"author": "BeDelightful",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"import": {
|
|
16
|
+
"types": "./dist/es/index.d.ts",
|
|
17
|
+
"default": "./dist/es/index.js"
|
|
18
|
+
},
|
|
19
|
+
"require": {
|
|
20
|
+
"types": "./dist/lib/index.d.ts",
|
|
21
|
+
"default": "./dist/lib/index.js"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"main": "dist/lib/index.js",
|
|
26
|
+
"directories": {
|
|
27
|
+
"test": "tests"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist",
|
|
31
|
+
"README.md",
|
|
32
|
+
"package.json"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"prebuild": "rimraf dist",
|
|
36
|
+
"build": "npm run clean && tsup --config tsup.config.ts",
|
|
37
|
+
"clean": "rm -rf dist",
|
|
38
|
+
"lint": "eslint ./src --ext ts,tsx",
|
|
39
|
+
"lint:fix": "eslint ./src --ext ts,tsx --fix && prettier --write ./src/**/*.ts",
|
|
40
|
+
"test": "vitest run",
|
|
41
|
+
"test:watch": "vitest",
|
|
42
|
+
"test:ui": "vitest --ui"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@aws-sdk/client-s3": "^3.911.0",
|
|
46
|
+
"@babel/runtime": "^7.22.10",
|
|
47
|
+
"buffer": "^6.0.3",
|
|
48
|
+
"crypto-js": "^3.1.1",
|
|
49
|
+
"esdk-obs-browserjs": "^3.23.5",
|
|
50
|
+
"lodash-es": "~4.17.21",
|
|
51
|
+
"mime": "^3.0.0",
|
|
52
|
+
"process": "^0.11.10"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@babel/eslint-parser": "^7.18.2",
|
|
56
|
+
"@bedelightful/eslint-config": "~0.0.4",
|
|
57
|
+
"@semantic-release/changelog": "^6.0.1",
|
|
58
|
+
"@semantic-release/commit-analyzer": "^9.0.2",
|
|
59
|
+
"@semantic-release/git": "^10.0.1",
|
|
60
|
+
"@semantic-release/gitlab": "^9.4.1",
|
|
61
|
+
"@semantic-release/npm": "^9.0.1",
|
|
62
|
+
"@semantic-release/release-notes-generator": "^10.0.3",
|
|
63
|
+
"@types/crypto-js": "^4.1.1",
|
|
64
|
+
"@types/lodash-es": "~4.17.12",
|
|
65
|
+
"@types/mime": "^3.0.1",
|
|
66
|
+
"@types/node": "^20.17.9",
|
|
67
|
+
"@types/qs": "^6.9.7",
|
|
68
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
69
|
+
"@vitest/ui": "^3.2.4",
|
|
70
|
+
"babel": "^6.23.0",
|
|
71
|
+
"babel-eslint": "^10.1.0",
|
|
72
|
+
"babel-plugin-import": "^1.13.8",
|
|
73
|
+
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
|
74
|
+
"colors": "^1.3.2",
|
|
75
|
+
"commitizen": "^3.0.0",
|
|
76
|
+
"coveralls": "^3.0.2",
|
|
77
|
+
"cross-env": "^5.2.0",
|
|
78
|
+
"cz-conventional-changelog": "^2.1.0",
|
|
79
|
+
"esbuild-plugin-copy": "^2.1.1",
|
|
80
|
+
"eslint": "^8.57.1",
|
|
81
|
+
"jsdom": "^25.0.1",
|
|
82
|
+
"mock-xmlhttprequest": "^8.2.0",
|
|
83
|
+
"prettier": "^3.5.3",
|
|
84
|
+
"prompt": "^1.0.0",
|
|
85
|
+
"react": "^18.2.0",
|
|
86
|
+
"react-dom": "^18.2.0",
|
|
87
|
+
"replace-in-file": "^3.4.2",
|
|
88
|
+
"rimraf": "^6.0.1",
|
|
89
|
+
"semantic-release": "^19.0.3",
|
|
90
|
+
"shelljs": "^0.8.3",
|
|
91
|
+
"travis-deploy-once": "^5.0.9",
|
|
92
|
+
"ts-node": "^10.9.2",
|
|
93
|
+
"tslib": "^2.4.0",
|
|
94
|
+
"tsup": "~8.0.2",
|
|
95
|
+
"typedoc": "^0.27.5",
|
|
96
|
+
"typescript": "^5.7.2",
|
|
97
|
+
"url": "^0.11.0",
|
|
98
|
+
"vitest": "^3.2.4"
|
|
99
|
+
},
|
|
100
|
+
"engines": {
|
|
101
|
+
"node": ">=18.0.0"
|
|
102
|
+
},
|
|
103
|
+
"publishConfig": {
|
|
104
|
+
"access": "public"
|
|
105
|
+
},
|
|
106
|
+
"module": "dist/es/index.js",
|
|
107
|
+
"typings": "dist/es/index.d.ts",
|
|
108
|
+
"lint-staged": {
|
|
109
|
+
"./src/**/*.{ts,tsx}": [
|
|
110
|
+
"eslint --fix",
|
|
111
|
+
"prettier --write ./src/**/*.ts",
|
|
112
|
+
"git add"
|
|
113
|
+
]
|
|
114
|
+
},
|
|
115
|
+
"browserslist": [
|
|
116
|
+
"defaults",
|
|
117
|
+
"not IE 11",
|
|
118
|
+
"maintained node versions"
|
|
119
|
+
]
|
|
120
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bedelightful/upload-sdk",
|
|
3
|
+
"version": "0.0.7",
|
|
4
|
+
"description": "Unified upload toolkit supporting Aliyun OSS, Volcengine TOS, and Huawei OBS, with planned support for Tencent COS, Qiniu Kodo, Baidu BOS, NetEase NOS, and more.",
|
|
5
|
+
"keywords": [],
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/saashqdev/delightful/upload-sdk"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"author": "BeDelightful",
|
|
12
|
+
"type": "module",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"import": {
|
|
16
|
+
"types": "./dist/es/index.d.ts",
|
|
17
|
+
"default": "./dist/es/index.js"
|
|
18
|
+
},
|
|
19
|
+
"require": {
|
|
20
|
+
"types": "./dist/lib/index.d.ts",
|
|
21
|
+
"default": "./dist/lib/index.js"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"main": "dist/lib/index.js",
|
|
26
|
+
"directories": {
|
|
27
|
+
"test": "tests"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist",
|
|
31
|
+
"README.md",
|
|
32
|
+
"package.json"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"prebuild": "rimraf dist",
|
|
36
|
+
"build": "npm run clean && tsup --config tsup.config.ts",
|
|
37
|
+
"clean": "rm -rf dist",
|
|
38
|
+
"lint": "eslint ./src --ext ts,tsx",
|
|
39
|
+
"lint:fix": "eslint ./src --ext ts,tsx --fix && prettier --write ./src/**/*.ts",
|
|
40
|
+
"test": "vitest run",
|
|
41
|
+
"test:watch": "vitest",
|
|
42
|
+
"test:ui": "vitest --ui"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@aws-sdk/client-s3": "^3.911.0",
|
|
46
|
+
"@babel/runtime": "^7.22.10",
|
|
47
|
+
"buffer": "^6.0.3",
|
|
48
|
+
"crypto-js": "^3.1.1",
|
|
49
|
+
"esdk-obs-browserjs": "^3.23.5",
|
|
50
|
+
"lodash-es": "~4.17.21",
|
|
51
|
+
"mime": "^3.0.0",
|
|
52
|
+
"process": "^0.11.10"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@babel/eslint-parser": "^7.18.2",
|
|
56
|
+
"@bedelightful/eslint-config": "~0.0.11",
|
|
57
|
+
"@semantic-release/changelog": "^6.0.1",
|
|
58
|
+
"@semantic-release/commit-analyzer": "^9.0.2",
|
|
59
|
+
"@semantic-release/git": "^10.0.1",
|
|
60
|
+
"@semantic-release/gitlab": "^9.4.1",
|
|
61
|
+
"@semantic-release/npm": "^9.0.1",
|
|
62
|
+
"@semantic-release/release-notes-generator": "^10.0.3",
|
|
63
|
+
"@types/crypto-js": "^4.1.1",
|
|
64
|
+
"@types/lodash-es": "~4.17.12",
|
|
65
|
+
"@types/mime": "^3.0.1",
|
|
66
|
+
"@types/node": "^20.17.9",
|
|
67
|
+
"@types/qs": "^6.9.7",
|
|
68
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
69
|
+
"@vitest/ui": "^3.2.4",
|
|
70
|
+
"babel": "^6.23.0",
|
|
71
|
+
"babel-eslint": "^10.1.0",
|
|
72
|
+
"babel-plugin-import": "^1.13.8",
|
|
73
|
+
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
|
74
|
+
"colors": "^1.3.2",
|
|
75
|
+
"commitizen": "^3.0.0",
|
|
76
|
+
"coveralls": "^3.0.2",
|
|
77
|
+
"cross-env": "^5.2.0",
|
|
78
|
+
"cz-conventional-changelog": "^2.1.0",
|
|
79
|
+
"esbuild-plugin-copy": "^2.1.1",
|
|
80
|
+
"eslint": "^8.57.1",
|
|
81
|
+
"jsdom": "^25.0.1",
|
|
82
|
+
"mock-xmlhttprequest": "^8.2.0",
|
|
83
|
+
"prettier": "^3.5.3",
|
|
84
|
+
"prompt": "^1.0.0",
|
|
85
|
+
"react": "^18.2.0",
|
|
86
|
+
"react-dom": "^18.2.0",
|
|
87
|
+
"replace-in-file": "^3.4.2",
|
|
88
|
+
"rimraf": "^6.0.1",
|
|
89
|
+
"semantic-release": "^19.0.3",
|
|
90
|
+
"shelljs": "^0.8.3",
|
|
91
|
+
"travis-deploy-once": "^5.0.9",
|
|
92
|
+
"ts-node": "^10.9.2",
|
|
93
|
+
"tslib": "^2.4.0",
|
|
94
|
+
"tsup": "~8.0.2",
|
|
95
|
+
"typedoc": "^0.27.5",
|
|
96
|
+
"typescript": "^5.7.2",
|
|
97
|
+
"url": "^0.11.0",
|
|
98
|
+
"vitest": "^3.2.4"
|
|
99
|
+
},
|
|
100
|
+
"engines": {
|
|
101
|
+
"node": ">=18.0.0"
|
|
102
|
+
},
|
|
103
|
+
"publishConfig": {
|
|
104
|
+
"access": "public"
|
|
105
|
+
},
|
|
106
|
+
"module": "dist/es/index.js",
|
|
107
|
+
"typings": "dist/es/index.d.ts",
|
|
108
|
+
"lint-staged": {
|
|
109
|
+
"./src/**/*.{ts,tsx}": [
|
|
110
|
+
"eslint --fix",
|
|
111
|
+
"prettier --write ./src/**/*.ts",
|
|
112
|
+
"git add"
|
|
113
|
+
]
|
|
114
|
+
},
|
|
115
|
+
"browserslist": [
|
|
116
|
+
"defaults",
|
|
117
|
+
"not IE 11",
|
|
118
|
+
"maintained node versions"
|
|
119
|
+
]
|
|
120
|
+
}
|