@nestia/fetcher 12.0.0-dev.20260612.1 → 12.0.0-dev.20260619.1
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/lib/AesPkcs5.js +12 -9
- package/lib/AesPkcs5.js.map +1 -1
- package/lib/AesPkcs5.mjs +2 -45
- package/lib/AesPkcs5.mjs.map +1 -1
- package/lib/AesPkcs52.mjs +53 -0
- package/lib/AesPkcs52.mjs.map +1 -0
- package/lib/EncryptedFetcher.js +77 -62
- package/lib/EncryptedFetcher.js.map +1 -1
- package/lib/EncryptedFetcher.mjs +2 -82
- package/lib/EncryptedFetcher.mjs.map +1 -1
- package/lib/EncryptedFetcher2.mjs +105 -0
- package/lib/EncryptedFetcher2.mjs.map +1 -0
- package/lib/FormDataInput.js +3 -3
- package/lib/FormDataInput.js.map +1 -1
- package/lib/FormDataInput.mjs +2 -1
- package/lib/FormDataInput.mjs.map +1 -1
- package/lib/FormDataInput2.mjs +6 -0
- package/lib/FormDataInput2.mjs.map +1 -0
- package/lib/HttpError.js +6 -11
- package/lib/HttpError.js.map +1 -1
- package/lib/HttpError.mjs +1 -1
- package/lib/HttpError2.mjs +16 -0
- package/lib/HttpError2.mjs.map +1 -0
- package/lib/IConnection.js +3 -3
- package/lib/IConnection.js.map +1 -1
- package/lib/IConnection.mjs +2 -1
- package/lib/IConnection.mjs.map +1 -1
- package/lib/IConnection2.mjs +6 -0
- package/lib/IConnection2.mjs.map +1 -0
- package/lib/IEncryptionPassword.js +3 -3
- package/lib/IEncryptionPassword.js.map +1 -1
- package/lib/IEncryptionPassword.mjs +2 -1
- package/lib/IEncryptionPassword.mjs.map +1 -1
- package/lib/IEncryptionPassword2.mjs +6 -0
- package/lib/IEncryptionPassword2.mjs.map +1 -0
- package/lib/IFetchEvent.js +21 -3
- package/lib/IFetchEvent.js.map +1 -1
- package/lib/IFetchEvent.mjs +2 -1
- package/lib/IFetchEvent.mjs.map +1 -1
- package/lib/IFetchEvent2.mjs +6 -0
- package/lib/IFetchEvent2.mjs.map +1 -0
- package/lib/IFetchRoute.js +3 -3
- package/lib/IFetchRoute.js.map +1 -1
- package/lib/IFetchRoute.mjs +2 -1
- package/lib/IFetchRoute.mjs.map +1 -1
- package/lib/IFetchRoute2.mjs +6 -0
- package/lib/IFetchRoute2.mjs.map +1 -0
- package/lib/IPropagation.js +3 -3
- package/lib/IPropagation.js.map +1 -1
- package/lib/IPropagation.mjs +2 -1
- package/lib/IPropagation.mjs.map +1 -1
- package/lib/IPropagation2.mjs +6 -0
- package/lib/IPropagation2.mjs.map +1 -0
- package/lib/NestiaSimulator.js +8 -8
- package/lib/NestiaSimulator.js.map +1 -1
- package/lib/NestiaSimulator.mjs +2 -43
- package/lib/NestiaSimulator.mjs.map +1 -1
- package/lib/NestiaSimulator2.mjs +49 -0
- package/lib/NestiaSimulator2.mjs.map +1 -0
- package/lib/PlainFetcher.js +38 -23
- package/lib/PlainFetcher.js.map +1 -1
- package/lib/PlainFetcher.mjs +2 -42
- package/lib/PlainFetcher.mjs.map +1 -1
- package/lib/PlainFetcher2.mjs +63 -0
- package/lib/PlainFetcher2.mjs.map +1 -0
- package/lib/_virtual/AesPkcs5.mjs +4 -0
- package/lib/_virtual/AesPkcs5.mjs.map +1 -0
- package/lib/_virtual/EncryptedFetcher.mjs +4 -0
- package/lib/_virtual/EncryptedFetcher.mjs.map +1 -0
- package/lib/_virtual/FetcherBase.mjs +4 -0
- package/lib/_virtual/FetcherBase.mjs.map +1 -0
- package/lib/_virtual/FormDataInput.mjs +4 -0
- package/lib/_virtual/FormDataInput.mjs.map +1 -0
- package/lib/_virtual/HttpError.mjs +4 -0
- package/lib/_virtual/HttpError.mjs.map +1 -0
- package/lib/_virtual/IConnection.mjs +4 -0
- package/lib/_virtual/IConnection.mjs.map +1 -0
- package/lib/_virtual/IEncryptionPassword.mjs +4 -0
- package/lib/_virtual/IEncryptionPassword.mjs.map +1 -0
- package/lib/_virtual/IFetchEvent.mjs +4 -0
- package/lib/_virtual/IFetchEvent.mjs.map +1 -0
- package/lib/_virtual/IFetchRoute.mjs +4 -0
- package/lib/_virtual/IFetchRoute.mjs.map +1 -0
- package/lib/_virtual/IPropagation.mjs +4 -0
- package/lib/_virtual/IPropagation.mjs.map +1 -0
- package/lib/_virtual/NestiaSimulator.mjs +4 -0
- package/lib/_virtual/NestiaSimulator.mjs.map +1 -0
- package/lib/_virtual/PlainFetcher.mjs +4 -0
- package/lib/_virtual/PlainFetcher.mjs.map +1 -0
- package/lib/_virtual/_commonjsHelpers.mjs +35 -0
- package/lib/_virtual/_commonjsHelpers.mjs.map +1 -0
- package/lib/_virtual/_node_crypto.mjs +7 -0
- package/lib/_virtual/_node_crypto.mjs.map +1 -0
- package/lib/_virtual/index.mjs +4 -0
- package/lib/_virtual/index.mjs.map +1 -0
- package/lib/_virtual/is_binary_response_content_type.mjs +4 -0
- package/lib/_virtual/is_binary_response_content_type.mjs.map +1 -0
- package/lib/_virtual/utils.mjs +7 -0
- package/lib/_virtual/utils.mjs.map +1 -0
- package/lib/index.js +26 -21
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +1 -3
- package/lib/index.mjs.map +1 -1
- package/lib/index2.mjs +53 -0
- package/lib/index2.mjs.map +1 -0
- package/lib/internal/FetcherBase.js +50 -44
- package/lib/internal/FetcherBase.js.map +1 -1
- package/lib/internal/FetcherBase.mjs +2 -189
- package/lib/internal/FetcherBase.mjs.map +1 -1
- package/lib/internal/FetcherBase2.mjs +203 -0
- package/lib/internal/FetcherBase2.mjs.map +1 -0
- package/lib/internal/is_binary_response_content_type.js +4 -4
- package/lib/internal/is_binary_response_content_type.js.map +1 -1
- package/lib/internal/is_binary_response_content_type.mjs +2 -12
- package/lib/internal/is_binary_response_content_type.mjs.map +1 -1
- package/lib/internal/is_binary_response_content_type2.mjs +18 -0
- package/lib/internal/is_binary_response_content_type2.mjs.map +1 -0
- package/package.json +5 -7
package/lib/AesPkcs5.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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.AesPkcs5 = void 0;
|
|
7
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
5
8
|
/**
|
|
6
9
|
* Utility class for the AES-128/256 encryption.
|
|
7
10
|
*
|
|
@@ -12,7 +15,7 @@ var crypto = require('crypto');
|
|
|
12
15
|
*
|
|
13
16
|
* @author Jeongho Nam - https://github.com/samchon
|
|
14
17
|
*/
|
|
15
|
-
|
|
18
|
+
var AesPkcs5;
|
|
16
19
|
(function (AesPkcs5) {
|
|
17
20
|
/**
|
|
18
21
|
* Encrypt data
|
|
@@ -24,7 +27,7 @@ exports.AesPkcs5 = void 0;
|
|
|
24
27
|
*/
|
|
25
28
|
function encrypt(data, key, iv) {
|
|
26
29
|
const bytes = key.length * 8;
|
|
27
|
-
const cipher =
|
|
30
|
+
const cipher = crypto_1.default.createCipheriv(`AES-${bytes}-CBC`, key, iv);
|
|
28
31
|
return cipher.update(data, "utf8", "base64") + cipher.final("base64");
|
|
29
32
|
}
|
|
30
33
|
AesPkcs5.encrypt = encrypt;
|
|
@@ -38,9 +41,9 @@ exports.AesPkcs5 = void 0;
|
|
|
38
41
|
*/
|
|
39
42
|
function decrypt(data, key, iv) {
|
|
40
43
|
const bytes = key.length * 8;
|
|
41
|
-
const decipher =
|
|
44
|
+
const decipher = crypto_1.default.createDecipheriv(`AES-${bytes}-CBC`, key, iv);
|
|
42
45
|
return decipher.update(data, "base64", "utf8") + decipher.final("utf8");
|
|
43
46
|
}
|
|
44
47
|
AesPkcs5.decrypt = decrypt;
|
|
45
|
-
})(
|
|
46
|
-
//# sourceMappingURL=AesPkcs5.js.map
|
|
48
|
+
})(AesPkcs5 || (exports.AesPkcs5 = AesPkcs5 = {}));
|
|
49
|
+
//# sourceMappingURL=AesPkcs5.js.map
|
package/lib/AesPkcs5.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AesPkcs5.js","sources":["../src/AesPkcs5.ts"],"
|
|
1
|
+
{"version":3,"file":"AesPkcs5.js","sourceRoot":"","sources":["../src/AesPkcs5.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAE5B;;;;;;;;;GASG;AACH,IAAiB,QAAQ,CA4BxB;AA5BD,WAAiB,QAAQ;IACvB;;;;;;;OAOG;IACH,SAAgB,OAAO,CAAC,IAAY,EAAE,GAAW,EAAE,EAAU;QAC3D,MAAM,KAAK,GAAW,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;QACrC,MAAM,MAAM,GAAG,gBAAM,CAAC,cAAc,CAAC,OAAO,KAAK,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;QAClE,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACxE,CAAC;IAJe,SAAA,OAAO,UAItB,CAAA;IAED;;;;;;;OAOG;IACH,SAAgB,OAAO,CAAC,IAAY,EAAE,GAAW,EAAE,EAAU;QAC3D,MAAM,KAAK,GAAW,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;QACrC,MAAM,QAAQ,GAAG,gBAAM,CAAC,gBAAgB,CAAC,OAAO,KAAK,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;QACtE,OAAO,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1E,CAAC;IAJe,SAAA,OAAO,UAItB,CAAA;AACH,CAAC,EA5BgB,QAAQ,aAAR,QAAQ,GAAR,QAAQ,QA4BxB"}
|
package/lib/AesPkcs5.mjs
CHANGED
|
@@ -1,46 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Utility class for the AES-128/256 encryption.
|
|
5
|
-
*
|
|
6
|
-
* - AES-128/256
|
|
7
|
-
* - CBC mode
|
|
8
|
-
* - PKCS#5 Padding
|
|
9
|
-
* - Base64 Encoding
|
|
10
|
-
*
|
|
11
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
12
|
-
*/
|
|
13
|
-
var AesPkcs5;
|
|
14
|
-
(function (AesPkcs5) {
|
|
15
|
-
/**
|
|
16
|
-
* Encrypt data
|
|
17
|
-
*
|
|
18
|
-
* @param data Target data
|
|
19
|
-
* @param key Key value of the encryption.
|
|
20
|
-
* @param iv Initializer Vector for the encryption
|
|
21
|
-
* @returns Encrypted data
|
|
22
|
-
*/
|
|
23
|
-
function encrypt(data, key, iv) {
|
|
24
|
-
const bytes = key.length * 8;
|
|
25
|
-
const cipher = crypto.createCipheriv(`AES-${bytes}-CBC`, key, iv);
|
|
26
|
-
return cipher.update(data, "utf8", "base64") + cipher.final("base64");
|
|
27
|
-
}
|
|
28
|
-
AesPkcs5.encrypt = encrypt;
|
|
29
|
-
/**
|
|
30
|
-
* Decrypt data.
|
|
31
|
-
*
|
|
32
|
-
* @param data Target data
|
|
33
|
-
* @param key Key value of the decryption.
|
|
34
|
-
* @param iv Initializer Vector for the decryption
|
|
35
|
-
* @returns Decrypted data.
|
|
36
|
-
*/
|
|
37
|
-
function decrypt(data, key, iv) {
|
|
38
|
-
const bytes = key.length * 8;
|
|
39
|
-
const decipher = crypto.createDecipheriv(`AES-${bytes}-CBC`, key, iv);
|
|
40
|
-
return decipher.update(data, "base64", "utf8") + decipher.final("utf8");
|
|
41
|
-
}
|
|
42
|
-
AesPkcs5.decrypt = decrypt;
|
|
43
|
-
})(AesPkcs5 || (AesPkcs5 = {}));
|
|
44
|
-
|
|
45
|
-
export { AesPkcs5 };
|
|
1
|
+
export { AesPkcs5 } from './AesPkcs52.mjs';
|
|
2
|
+
export { __exports as default } from './_virtual/AesPkcs5.mjs';
|
|
46
3
|
//# sourceMappingURL=AesPkcs5.mjs.map
|
package/lib/AesPkcs5.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AesPkcs5.mjs","sources":[
|
|
1
|
+
{"version":3,"file":"AesPkcs5.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { __exports as AesPkcs5$1 } from './_virtual/AesPkcs5.mjs';
|
|
2
|
+
import require$$0 from './_virtual/_node_crypto.mjs';
|
|
3
|
+
|
|
4
|
+
var __importDefault = (AesPkcs5$1 && AesPkcs5$1.__importDefault) || function (mod) {
|
|
5
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6
|
+
};
|
|
7
|
+
Object.defineProperty(AesPkcs5$1, "__esModule", { value: true });
|
|
8
|
+
var AesPkcs5_2 = AesPkcs5$1.AesPkcs5 = void 0;
|
|
9
|
+
const crypto_1 = __importDefault(require$$0);
|
|
10
|
+
/**
|
|
11
|
+
* Utility class for the AES-128/256 encryption.
|
|
12
|
+
*
|
|
13
|
+
* - AES-128/256
|
|
14
|
+
* - CBC mode
|
|
15
|
+
* - PKCS#5 Padding
|
|
16
|
+
* - Base64 Encoding
|
|
17
|
+
*
|
|
18
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
19
|
+
*/
|
|
20
|
+
var AesPkcs5;
|
|
21
|
+
(function (AesPkcs5) {
|
|
22
|
+
/**
|
|
23
|
+
* Encrypt data
|
|
24
|
+
*
|
|
25
|
+
* @param data Target data
|
|
26
|
+
* @param key Key value of the encryption.
|
|
27
|
+
* @param iv Initializer Vector for the encryption
|
|
28
|
+
* @returns Encrypted data
|
|
29
|
+
*/
|
|
30
|
+
function encrypt(data, key, iv) {
|
|
31
|
+
const bytes = key.length * 8;
|
|
32
|
+
const cipher = crypto_1.default.createCipheriv(`AES-${bytes}-CBC`, key, iv);
|
|
33
|
+
return cipher.update(data, "utf8", "base64") + cipher.final("base64");
|
|
34
|
+
}
|
|
35
|
+
AesPkcs5.encrypt = encrypt;
|
|
36
|
+
/**
|
|
37
|
+
* Decrypt data.
|
|
38
|
+
*
|
|
39
|
+
* @param data Target data
|
|
40
|
+
* @param key Key value of the decryption.
|
|
41
|
+
* @param iv Initializer Vector for the decryption
|
|
42
|
+
* @returns Decrypted data.
|
|
43
|
+
*/
|
|
44
|
+
function decrypt(data, key, iv) {
|
|
45
|
+
const bytes = key.length * 8;
|
|
46
|
+
const decipher = crypto_1.default.createDecipheriv(`AES-${bytes}-CBC`, key, iv);
|
|
47
|
+
return decipher.update(data, "base64", "utf8") + decipher.final("utf8");
|
|
48
|
+
}
|
|
49
|
+
AesPkcs5.decrypt = decrypt;
|
|
50
|
+
})(AesPkcs5 || (AesPkcs5_2 = AesPkcs5$1.AesPkcs5 = AesPkcs5 = {}));
|
|
51
|
+
|
|
52
|
+
export { AesPkcs5_2 as AesPkcs5, AesPkcs5$1 as default };
|
|
53
|
+
//# sourceMappingURL=AesPkcs52.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AesPkcs52.mjs","sources":["AesPkcs5.js"],"sourcesContent":["\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.AesPkcs5 = void 0;\nconst crypto_1 = __importDefault(require(\"crypto\"));\n/**\n * Utility class for the AES-128/256 encryption.\n *\n * - AES-128/256\n * - CBC mode\n * - PKCS#5 Padding\n * - Base64 Encoding\n *\n * @author Jeongho Nam - https://github.com/samchon\n */\nvar AesPkcs5;\n(function (AesPkcs5) {\n /**\n * Encrypt data\n *\n * @param data Target data\n * @param key Key value of the encryption.\n * @param iv Initializer Vector for the encryption\n * @returns Encrypted data\n */\n function encrypt(data, key, iv) {\n const bytes = key.length * 8;\n const cipher = crypto_1.default.createCipheriv(`AES-${bytes}-CBC`, key, iv);\n return cipher.update(data, \"utf8\", \"base64\") + cipher.final(\"base64\");\n }\n AesPkcs5.encrypt = encrypt;\n /**\n * Decrypt data.\n *\n * @param data Target data\n * @param key Key value of the decryption.\n * @param iv Initializer Vector for the decryption\n * @returns Decrypted data.\n */\n function decrypt(data, key, iv) {\n const bytes = key.length * 8;\n const decipher = crypto_1.default.createDecipheriv(`AES-${bytes}-CBC`, key, iv);\n return decipher.update(data, \"base64\", \"utf8\") + decipher.final(\"utf8\");\n }\n AesPkcs5.decrypt = decrypt;\n})(AesPkcs5 || (exports.AesPkcs5 = AesPkcs5 = {}));\n//# sourceMappingURL=AesPkcs5.js.map"],"names":["this","AesPkcs5_1"],"mappings":";;;AACA,IAAI,eAAe,GAAG,CAACA,UAAI,IAAIA,UAAI,CAAC,eAAe,KAAK,UAAU,GAAG,EAAE;AACvE,IAAI,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,UAAU,IAAI,GAAG,GAAG,EAAE,SAAS,EAAE,GAAG,EAAE;AAC7D,CAAC;AACD,MAAM,CAAC,cAAc,CAACC,UAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,IAAA,UAAA,GAAAA,UAAA,CAAA,QAAgB,GAAG;AACnB,MAAM,QAAQ,GAAG,eAAe,CAAC,UAAiB,CAAC;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,QAAQ;AACZ,CAAC,UAAU,QAAQ,EAAE;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE;AACpC,QAAQ,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC;AACpC,QAAQ,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC;AACnF,QAAQ,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC;AAC7E,IAAA;AACA,IAAI,QAAQ,CAAC,OAAO,GAAG,OAAO;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,SAAS,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE;AACpC,QAAQ,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC;AACpC,QAAQ,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC;AACvF,QAAQ,OAAO,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC;AAC/E,IAAA;AACA,IAAI,QAAQ,CAAC,OAAO,GAAG,OAAO;AAC9B,CAAC,EAAE,QAAQ,KAAK,UAAA,GAAAA,UAAA,CAAA,QAAgB,GAAG,QAAQ,GAAG,EAAE,CAAC,CAAC;;;;"}
|
package/lib/EncryptedFetcher.js
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.EncryptedFetcher = void 0;
|
|
13
|
+
const AesPkcs5_1 = require("./AesPkcs5");
|
|
14
|
+
const FetcherBase_1 = require("./internal/FetcherBase");
|
|
6
15
|
/**
|
|
7
16
|
* Utility class for `fetch` functions used in `@nestia/sdk` with encryption.
|
|
8
17
|
*
|
|
@@ -19,65 +28,71 @@ var FetcherBase = require('./internal/FetcherBase.js');
|
|
|
19
28
|
*
|
|
20
29
|
* @author Jeongho Nam - https://github.com/samchon
|
|
21
30
|
*/
|
|
22
|
-
|
|
31
|
+
var EncryptedFetcher;
|
|
23
32
|
(function (EncryptedFetcher) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
body
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
33
|
+
function fetch(connection, route, input, stringify) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
var _a, _b, _c, _d;
|
|
36
|
+
if ((((_a = route.request) === null || _a === void 0 ? void 0 : _a.encrypted) === true || ((_b = route.response) === null || _b === void 0 ? void 0 : _b.encrypted)) &&
|
|
37
|
+
connection.encryption === undefined)
|
|
38
|
+
throw new Error("Error on EncryptedFetcher.fetch(): the encryption password has not been configured.");
|
|
39
|
+
const closure = typeof connection.encryption === "function"
|
|
40
|
+
? (direction) => (headers, body) => connection.encryption({
|
|
41
|
+
headers,
|
|
42
|
+
body,
|
|
43
|
+
direction,
|
|
44
|
+
})
|
|
45
|
+
: () => () => connection.encryption;
|
|
46
|
+
return FetcherBase_1.FetcherBase.request({
|
|
47
|
+
className: "EncryptedFetcher",
|
|
48
|
+
encode: ((_c = route.request) === null || _c === void 0 ? void 0 : _c.encrypted) === true
|
|
49
|
+
? (input, headers) => {
|
|
50
|
+
const p = closure("encode")(headers, input);
|
|
51
|
+
return AesPkcs5_1.AesPkcs5.encrypt((stringify !== null && stringify !== void 0 ? stringify : JSON.stringify)(input), p.key, p.iv);
|
|
52
|
+
}
|
|
53
|
+
: (input) => input,
|
|
54
|
+
decode: ((_d = route.response) === null || _d === void 0 ? void 0 : _d.encrypted) === true
|
|
55
|
+
? (input, headers) => {
|
|
56
|
+
const p = closure("decode")(headers, input);
|
|
57
|
+
const s = AesPkcs5_1.AesPkcs5.decrypt(input, p.key, p.iv);
|
|
58
|
+
return s.length ? JSON.parse(s) : s;
|
|
59
|
+
}
|
|
60
|
+
: (input) => input,
|
|
61
|
+
})(connection, route, input, stringify);
|
|
62
|
+
});
|
|
51
63
|
}
|
|
52
64
|
EncryptedFetcher.fetch = fetch;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
body
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
65
|
+
function propagate(connection, route, input, stringify) {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
var _a, _b, _c, _d;
|
|
68
|
+
if ((((_a = route.request) === null || _a === void 0 ? void 0 : _a.encrypted) === true || ((_b = route.response) === null || _b === void 0 ? void 0 : _b.encrypted)) &&
|
|
69
|
+
connection.encryption === undefined)
|
|
70
|
+
throw new Error("Error on EncryptedFetcher.propagate(): the encryption password has not been configured.");
|
|
71
|
+
const closure = typeof connection.encryption === "function"
|
|
72
|
+
? (direction) => (headers, body) => connection.encryption({
|
|
73
|
+
headers,
|
|
74
|
+
body,
|
|
75
|
+
direction,
|
|
76
|
+
})
|
|
77
|
+
: () => () => connection.encryption;
|
|
78
|
+
return FetcherBase_1.FetcherBase.propagate({
|
|
79
|
+
className: "EncryptedFetcher",
|
|
80
|
+
encode: ((_c = route.request) === null || _c === void 0 ? void 0 : _c.encrypted) === true
|
|
81
|
+
? (input, headers) => {
|
|
82
|
+
const p = closure("encode")(headers, input);
|
|
83
|
+
return AesPkcs5_1.AesPkcs5.encrypt((stringify !== null && stringify !== void 0 ? stringify : JSON.stringify)(input), p.key, p.iv);
|
|
84
|
+
}
|
|
85
|
+
: (input) => input,
|
|
86
|
+
decode: ((_d = route.response) === null || _d === void 0 ? void 0 : _d.encrypted) === true
|
|
87
|
+
? (input, headers) => {
|
|
88
|
+
const p = closure("decode")(headers, input);
|
|
89
|
+
const s = AesPkcs5_1.AesPkcs5.decrypt(input, p.key, p.iv);
|
|
90
|
+
return s.length ? JSON.parse(s) : s;
|
|
91
|
+
}
|
|
92
|
+
: (input) => input,
|
|
93
|
+
})(connection, route, input, stringify);
|
|
94
|
+
});
|
|
80
95
|
}
|
|
81
96
|
EncryptedFetcher.propagate = propagate;
|
|
82
|
-
})(
|
|
83
|
-
//# sourceMappingURL=EncryptedFetcher.js.map
|
|
97
|
+
})(EncryptedFetcher || (exports.EncryptedFetcher = EncryptedFetcher = {}));
|
|
98
|
+
//# sourceMappingURL=EncryptedFetcher.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EncryptedFetcher.js","sources":["../src/EncryptedFetcher.ts"],"
|
|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EAAE,SAAS,CAAoB,CAAC;QAC7D,CAAC;KAAA;IAjDqB,iBAAA,SAAS,YAiD9B,CAAA;AACH,CAAC,EAxJgB,gBAAgB,aAAhB,gBAAgB,GAAhB,gBAAgB,QAwJhC"}
|
package/lib/EncryptedFetcher.mjs
CHANGED
|
@@ -1,83 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Utility class for `fetch` functions used in `@nestia/sdk` with encryption.
|
|
6
|
-
*
|
|
7
|
-
* `EncryptedFetcher` is a utility class designed for SDK functions generated by
|
|
8
|
-
* [`@nestia/sdk`](https://nestia.io/docs/sdk/sdk), interacting with the remote
|
|
9
|
-
* HTTP API encrypted by AES-PKCS algorithm. In other words, this is a
|
|
10
|
-
* collection of dedicated `fetch()` functions for `@nestia/sdk` with
|
|
11
|
-
* encryption.
|
|
12
|
-
*
|
|
13
|
-
* For reference, `EncryptedFetcher` class being used only when target
|
|
14
|
-
* controller method is encrypting body data by `@EncryptedRoute` or
|
|
15
|
-
* `@EncryptedBody` decorators. If those decorators are not used,
|
|
16
|
-
* {@link PlainFetcher} class would be used instead.
|
|
17
|
-
*
|
|
18
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
19
|
-
*/
|
|
20
|
-
var EncryptedFetcher;
|
|
21
|
-
(function (EncryptedFetcher) {
|
|
22
|
-
async function fetch(connection, route, input, stringify) {
|
|
23
|
-
if ((route.request?.encrypted === true || route.response?.encrypted) &&
|
|
24
|
-
connection.encryption === undefined)
|
|
25
|
-
throw new Error("Error on EncryptedFetcher.fetch(): the encryption password has not been configured.");
|
|
26
|
-
const closure = typeof connection.encryption === "function"
|
|
27
|
-
? (direction) => (headers, body) => connection.encryption({
|
|
28
|
-
headers,
|
|
29
|
-
body,
|
|
30
|
-
direction,
|
|
31
|
-
})
|
|
32
|
-
: () => () => connection.encryption;
|
|
33
|
-
return FetcherBase.request({
|
|
34
|
-
className: "EncryptedFetcher",
|
|
35
|
-
encode: route.request?.encrypted === true
|
|
36
|
-
? (input, headers) => {
|
|
37
|
-
const p = closure("encode")(headers, input);
|
|
38
|
-
return AesPkcs5.encrypt((stringify ?? JSON.stringify)(input), p.key, p.iv);
|
|
39
|
-
}
|
|
40
|
-
: (input) => input,
|
|
41
|
-
decode: route.response?.encrypted === true
|
|
42
|
-
? (input, headers) => {
|
|
43
|
-
const p = closure("decode")(headers, input);
|
|
44
|
-
const s = AesPkcs5.decrypt(input, p.key, p.iv);
|
|
45
|
-
return s.length ? JSON.parse(s) : s;
|
|
46
|
-
}
|
|
47
|
-
: (input) => input,
|
|
48
|
-
})(connection, route, input, stringify);
|
|
49
|
-
}
|
|
50
|
-
EncryptedFetcher.fetch = fetch;
|
|
51
|
-
async function propagate(connection, route, input, stringify) {
|
|
52
|
-
if ((route.request?.encrypted === true || route.response?.encrypted) &&
|
|
53
|
-
connection.encryption === undefined)
|
|
54
|
-
throw new Error("Error on EncryptedFetcher.propagate(): the encryption password has not been configured.");
|
|
55
|
-
const closure = typeof connection.encryption === "function"
|
|
56
|
-
? (direction) => (headers, body) => connection.encryption({
|
|
57
|
-
headers,
|
|
58
|
-
body,
|
|
59
|
-
direction,
|
|
60
|
-
})
|
|
61
|
-
: () => () => connection.encryption;
|
|
62
|
-
return FetcherBase.propagate({
|
|
63
|
-
className: "EncryptedFetcher",
|
|
64
|
-
encode: route.request?.encrypted === true
|
|
65
|
-
? (input, headers) => {
|
|
66
|
-
const p = closure("encode")(headers, input);
|
|
67
|
-
return AesPkcs5.encrypt((stringify ?? JSON.stringify)(input), p.key, p.iv);
|
|
68
|
-
}
|
|
69
|
-
: (input) => input,
|
|
70
|
-
decode: route.response?.encrypted === true
|
|
71
|
-
? (input, headers) => {
|
|
72
|
-
const p = closure("decode")(headers, input);
|
|
73
|
-
const s = AesPkcs5.decrypt(input, p.key, p.iv);
|
|
74
|
-
return s.length ? JSON.parse(s) : s;
|
|
75
|
-
}
|
|
76
|
-
: (input) => input,
|
|
77
|
-
})(connection, route, input, stringify);
|
|
78
|
-
}
|
|
79
|
-
EncryptedFetcher.propagate = propagate;
|
|
80
|
-
})(EncryptedFetcher || (EncryptedFetcher = {}));
|
|
81
|
-
|
|
82
|
-
export { EncryptedFetcher };
|
|
1
|
+
export { EncryptedFetcher } from './EncryptedFetcher2.mjs';
|
|
2
|
+
export { __exports as default } from './_virtual/EncryptedFetcher.mjs';
|
|
83
3
|
//# sourceMappingURL=EncryptedFetcher.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EncryptedFetcher.mjs","sources":[
|
|
1
|
+
{"version":3,"file":"EncryptedFetcher.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { __exports as EncryptedFetcher$1 } from './_virtual/EncryptedFetcher.mjs';
|
|
2
|
+
import './AesPkcs52.mjs';
|
|
3
|
+
import './internal/FetcherBase2.mjs';
|
|
4
|
+
import { __exports as FetcherBase } from './_virtual/FetcherBase.mjs';
|
|
5
|
+
import { __exports as AesPkcs5 } from './_virtual/AesPkcs5.mjs';
|
|
6
|
+
|
|
7
|
+
var __awaiter = (EncryptedFetcher$1 && EncryptedFetcher$1.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
13
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(EncryptedFetcher$1, "__esModule", { value: true });
|
|
17
|
+
var EncryptedFetcher_2 = EncryptedFetcher$1.EncryptedFetcher = void 0;
|
|
18
|
+
const AesPkcs5_1 = AesPkcs5;
|
|
19
|
+
const FetcherBase_1 = FetcherBase;
|
|
20
|
+
/**
|
|
21
|
+
* Utility class for `fetch` functions used in `@nestia/sdk` with encryption.
|
|
22
|
+
*
|
|
23
|
+
* `EncryptedFetcher` is a utility class designed for SDK functions generated by
|
|
24
|
+
* [`@nestia/sdk`](https://nestia.io/docs/sdk/sdk), interacting with the remote
|
|
25
|
+
* HTTP API encrypted by AES-PKCS algorithm. In other words, this is a
|
|
26
|
+
* collection of dedicated `fetch()` functions for `@nestia/sdk` with
|
|
27
|
+
* encryption.
|
|
28
|
+
*
|
|
29
|
+
* For reference, `EncryptedFetcher` class being used only when target
|
|
30
|
+
* controller method is encrypting body data by `@EncryptedRoute` or
|
|
31
|
+
* `@EncryptedBody` decorators. If those decorators are not used,
|
|
32
|
+
* {@link PlainFetcher} class would be used instead.
|
|
33
|
+
*
|
|
34
|
+
* @author Jeongho Nam - https://github.com/samchon
|
|
35
|
+
*/
|
|
36
|
+
var EncryptedFetcher;
|
|
37
|
+
(function (EncryptedFetcher) {
|
|
38
|
+
function fetch(connection, route, input, stringify) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
var _a, _b, _c, _d;
|
|
41
|
+
if ((((_a = route.request) === null || _a === void 0 ? void 0 : _a.encrypted) === true || ((_b = route.response) === null || _b === void 0 ? void 0 : _b.encrypted)) &&
|
|
42
|
+
connection.encryption === undefined)
|
|
43
|
+
throw new Error("Error on EncryptedFetcher.fetch(): the encryption password has not been configured.");
|
|
44
|
+
const closure = typeof connection.encryption === "function"
|
|
45
|
+
? (direction) => (headers, body) => connection.encryption({
|
|
46
|
+
headers,
|
|
47
|
+
body,
|
|
48
|
+
direction,
|
|
49
|
+
})
|
|
50
|
+
: () => () => connection.encryption;
|
|
51
|
+
return FetcherBase_1.FetcherBase.request({
|
|
52
|
+
className: "EncryptedFetcher",
|
|
53
|
+
encode: ((_c = route.request) === null || _c === void 0 ? void 0 : _c.encrypted) === true
|
|
54
|
+
? (input, headers) => {
|
|
55
|
+
const p = closure("encode")(headers, input);
|
|
56
|
+
return AesPkcs5_1.AesPkcs5.encrypt((stringify !== null && stringify !== void 0 ? stringify : JSON.stringify)(input), p.key, p.iv);
|
|
57
|
+
}
|
|
58
|
+
: (input) => input,
|
|
59
|
+
decode: ((_d = route.response) === null || _d === void 0 ? void 0 : _d.encrypted) === true
|
|
60
|
+
? (input, headers) => {
|
|
61
|
+
const p = closure("decode")(headers, input);
|
|
62
|
+
const s = AesPkcs5_1.AesPkcs5.decrypt(input, p.key, p.iv);
|
|
63
|
+
return s.length ? JSON.parse(s) : s;
|
|
64
|
+
}
|
|
65
|
+
: (input) => input,
|
|
66
|
+
})(connection, route, input, stringify);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
EncryptedFetcher.fetch = fetch;
|
|
70
|
+
function propagate(connection, route, input, stringify) {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
var _a, _b, _c, _d;
|
|
73
|
+
if ((((_a = route.request) === null || _a === void 0 ? void 0 : _a.encrypted) === true || ((_b = route.response) === null || _b === void 0 ? void 0 : _b.encrypted)) &&
|
|
74
|
+
connection.encryption === undefined)
|
|
75
|
+
throw new Error("Error on EncryptedFetcher.propagate(): the encryption password has not been configured.");
|
|
76
|
+
const closure = typeof connection.encryption === "function"
|
|
77
|
+
? (direction) => (headers, body) => connection.encryption({
|
|
78
|
+
headers,
|
|
79
|
+
body,
|
|
80
|
+
direction,
|
|
81
|
+
})
|
|
82
|
+
: () => () => connection.encryption;
|
|
83
|
+
return FetcherBase_1.FetcherBase.propagate({
|
|
84
|
+
className: "EncryptedFetcher",
|
|
85
|
+
encode: ((_c = route.request) === null || _c === void 0 ? void 0 : _c.encrypted) === true
|
|
86
|
+
? (input, headers) => {
|
|
87
|
+
const p = closure("encode")(headers, input);
|
|
88
|
+
return AesPkcs5_1.AesPkcs5.encrypt((stringify !== null && stringify !== void 0 ? stringify : JSON.stringify)(input), p.key, p.iv);
|
|
89
|
+
}
|
|
90
|
+
: (input) => input,
|
|
91
|
+
decode: ((_d = route.response) === null || _d === void 0 ? void 0 : _d.encrypted) === true
|
|
92
|
+
? (input, headers) => {
|
|
93
|
+
const p = closure("decode")(headers, input);
|
|
94
|
+
const s = AesPkcs5_1.AesPkcs5.decrypt(input, p.key, p.iv);
|
|
95
|
+
return s.length ? JSON.parse(s) : s;
|
|
96
|
+
}
|
|
97
|
+
: (input) => input,
|
|
98
|
+
})(connection, route, input, stringify);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
EncryptedFetcher.propagate = propagate;
|
|
102
|
+
})(EncryptedFetcher || (EncryptedFetcher_2 = EncryptedFetcher$1.EncryptedFetcher = EncryptedFetcher = {}));
|
|
103
|
+
|
|
104
|
+
export { EncryptedFetcher_2 as EncryptedFetcher, EncryptedFetcher$1 as default };
|
|
105
|
+
//# sourceMappingURL=EncryptedFetcher2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EncryptedFetcher2.mjs","sources":["EncryptedFetcher.js"],"sourcesContent":["\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.EncryptedFetcher = void 0;\nconst AesPkcs5_1 = require(\"./AesPkcs5\");\nconst FetcherBase_1 = require(\"./internal/FetcherBase\");\n/**\n * Utility class for `fetch` functions used in `@nestia/sdk` with encryption.\n *\n * `EncryptedFetcher` is a utility class designed for SDK functions generated by\n * [`@nestia/sdk`](https://nestia.io/docs/sdk/sdk), interacting with the remote\n * HTTP API encrypted by AES-PKCS algorithm. In other words, this is a\n * collection of dedicated `fetch()` functions for `@nestia/sdk` with\n * encryption.\n *\n * For reference, `EncryptedFetcher` class being used only when target\n * controller method is encrypting body data by `@EncryptedRoute` or\n * `@EncryptedBody` decorators. If those decorators are not used,\n * {@link PlainFetcher} class would be used instead.\n *\n * @author Jeongho Nam - https://github.com/samchon\n */\nvar EncryptedFetcher;\n(function (EncryptedFetcher) {\n function fetch(connection, route, input, stringify) {\n return __awaiter(this, void 0, void 0, function* () {\n var _a, _b, _c, _d;\n if ((((_a = route.request) === null || _a === void 0 ? void 0 : _a.encrypted) === true || ((_b = route.response) === null || _b === void 0 ? void 0 : _b.encrypted)) &&\n connection.encryption === undefined)\n throw new Error(\"Error on EncryptedFetcher.fetch(): the encryption password has not been configured.\");\n const closure = typeof connection.encryption === \"function\"\n ? (direction) => (headers, body) => connection.encryption({\n headers,\n body,\n direction,\n })\n : () => () => connection.encryption;\n return FetcherBase_1.FetcherBase.request({\n className: \"EncryptedFetcher\",\n encode: ((_c = route.request) === null || _c === void 0 ? void 0 : _c.encrypted) === true\n ? (input, headers) => {\n const p = closure(\"encode\")(headers, input);\n return AesPkcs5_1.AesPkcs5.encrypt((stringify !== null && stringify !== void 0 ? stringify : JSON.stringify)(input), p.key, p.iv);\n }\n : (input) => input,\n decode: ((_d = route.response) === null || _d === void 0 ? void 0 : _d.encrypted) === true\n ? (input, headers) => {\n const p = closure(\"decode\")(headers, input);\n const s = AesPkcs5_1.AesPkcs5.decrypt(input, p.key, p.iv);\n return s.length ? JSON.parse(s) : s;\n }\n : (input) => input,\n })(connection, route, input, stringify);\n });\n }\n EncryptedFetcher.fetch = fetch;\n function propagate(connection, route, input, stringify) {\n return __awaiter(this, void 0, void 0, function* () {\n var _a, _b, _c, _d;\n if ((((_a = route.request) === null || _a === void 0 ? void 0 : _a.encrypted) === true || ((_b = route.response) === null || _b === void 0 ? void 0 : _b.encrypted)) &&\n connection.encryption === undefined)\n throw new Error(\"Error on EncryptedFetcher.propagate(): the encryption password has not been configured.\");\n const closure = typeof connection.encryption === \"function\"\n ? (direction) => (headers, body) => connection.encryption({\n headers,\n body,\n direction,\n })\n : () => () => connection.encryption;\n return FetcherBase_1.FetcherBase.propagate({\n className: \"EncryptedFetcher\",\n encode: ((_c = route.request) === null || _c === void 0 ? void 0 : _c.encrypted) === true\n ? (input, headers) => {\n const p = closure(\"encode\")(headers, input);\n return AesPkcs5_1.AesPkcs5.encrypt((stringify !== null && stringify !== void 0 ? stringify : JSON.stringify)(input), p.key, p.iv);\n }\n : (input) => input,\n decode: ((_d = route.response) === null || _d === void 0 ? void 0 : _d.encrypted) === true\n ? (input, headers) => {\n const p = closure(\"decode\")(headers, input);\n const s = AesPkcs5_1.AesPkcs5.decrypt(input, p.key, p.iv);\n return s.length ? JSON.parse(s) : s;\n }\n : (input) => input,\n })(connection, route, input, stringify);\n });\n }\n EncryptedFetcher.propagate = propagate;\n})(EncryptedFetcher || (exports.EncryptedFetcher = EncryptedFetcher = {}));\n//# sourceMappingURL=EncryptedFetcher.js.map"],"names":["this","EncryptedFetcher_1","require$$0","require$$1"],"mappings":";;;;;;AACA,IAAI,SAAS,GAAG,CAACA,kBAAI,IAAIA,kBAAI,CAAC,SAAS,KAAK,UAAU,OAAO,EAAE,UAAU,EAAE,CAAC,EAAE,SAAS,EAAE;AACzF,IAAI,SAAS,KAAK,CAAC,KAAK,EAAE,EAAE,OAAO,KAAK,YAAY,CAAC,GAAG,KAAK,GAAG,IAAI,CAAC,CAAC,UAAU,OAAO,EAAE,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAA,CAAE,CAAC,CAAC,CAAA;AAC9G,IAAI,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,EAAE,UAAU,OAAO,EAAE,MAAM,EAAE;AAC/D,QAAQ,SAAS,SAA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MAAM,GAAG,EAAE,CAAC,SAAS,MAAM;AACtG,sBAAsB,CAAC,KAAK,EAAE,OAAO,KAAK;AAC1C,wBAAwB,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC;AACnE,wBAAwB,MAAM,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;AACjF,wBAAwB,OAAO,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;AAC3D,oBAAA;AACA,sBAAsB,CAAC,KAAK,KAAK,KAAK;AACtC,aAAa,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,CAAC;AACnD,QAAA,CAAS,CAAC;AACV,IAAA;AACA,IAAI,gBAAgB,CAAC,SAAS,GAAG,SAAS;AAC1C,CAAC,EAAE,gBAAgB,KAAK,kBAAA,GAAAF,kBAAA,CAAA,gBAAwB,GAAG,gBAAgB,GAAG,EAAE,CAAC,CAAC;;;;"}
|
package/lib/FormDataInput.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=FormDataInput.js.map
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
//# sourceMappingURL=FormDataInput.js.map
|
package/lib/FormDataInput.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormDataInput.js","
|
|
1
|
+
{"version":3,"file":"FormDataInput.js","sourceRoot":"","sources":["../src/FormDataInput.ts"],"names":[],"mappings":""}
|
package/lib/FormDataInput.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormDataInput.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"FormDataInput.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormDataInput2.mjs","sources":["FormDataInput.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n//# sourceMappingURL=FormDataInput.js.map"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,aAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;;;;"}
|