@apify/utilities 2.29.2 → 2.29.4
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/cjs/index.cjs +13 -16
- package/cjs/index.cjs.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/esm/index.d.mts +1 -1
- package/esm/index.mjs +13 -16
- package/esm/index.mjs.map +1 -1
- package/package.json +4 -4
package/cjs/index.d.ts
CHANGED
|
@@ -494,7 +494,7 @@ declare function publicEncrypt({ publicKey, value }: EncryptOptions): {
|
|
|
494
494
|
* @param encryptedValue {string} Content in Base64 encrypted using AES cipher
|
|
495
495
|
* @returns {string}
|
|
496
496
|
*/
|
|
497
|
-
declare function privateDecrypt({ privateKey, encryptedPassword, encryptedValue
|
|
497
|
+
declare function privateDecrypt({ privateKey, encryptedPassword, encryptedValue }: DecryptOptions): string;
|
|
498
498
|
|
|
499
499
|
/**
|
|
500
500
|
* Extract import statements from the code.
|
package/esm/index.d.mts
CHANGED
|
@@ -494,7 +494,7 @@ declare function publicEncrypt({ publicKey, value }: EncryptOptions): {
|
|
|
494
494
|
* @param encryptedValue {string} Content in Base64 encrypted using AES cipher
|
|
495
495
|
* @returns {string}
|
|
496
496
|
*/
|
|
497
|
-
declare function privateDecrypt({ privateKey, encryptedPassword, encryptedValue
|
|
497
|
+
declare function privateDecrypt({ privateKey, encryptedPassword, encryptedValue }: DecryptOptions): string;
|
|
498
498
|
|
|
499
499
|
/**
|
|
500
500
|
* Extract import statements from the code.
|
package/esm/index.mjs
CHANGED
|
@@ -40,13 +40,13 @@ function parseDateFromJson(date) {
|
|
|
40
40
|
}
|
|
41
41
|
__name(parseDateFromJson, "parseDateFromJson");
|
|
42
42
|
async function delayPromise(millis) {
|
|
43
|
-
return new Promise((
|
|
43
|
+
return new Promise((resolve) => {
|
|
44
44
|
if (millis > 0) {
|
|
45
45
|
setTimeout(() => resolve(), millis);
|
|
46
46
|
} else {
|
|
47
47
|
resolve();
|
|
48
48
|
}
|
|
49
|
-
})
|
|
49
|
+
});
|
|
50
50
|
}
|
|
51
51
|
__name(delayPromise, "delayPromise");
|
|
52
52
|
function removeFromArray(array, element) {
|
|
@@ -1271,7 +1271,9 @@ var ESCAPE_TO_BSON = "\uFF54\uFF4F\uFF22\uFF33\uFF2F\uFF2E";
|
|
|
1271
1271
|
var ESCAPE_TO_STRING = "\uFF54\uFF4F\uFF33\uFF54\uFF52\uFF49\uFF4E\uFF47";
|
|
1272
1272
|
var ESCAPE_BSON_TYPE = "\uFF3F\uFF42\uFF53\uFF4F\uFF4E\uFF54\uFF59\uFF50\uFF45";
|
|
1273
1273
|
var ESCAPE_NULL = "";
|
|
1274
|
-
var REGEXP_IS_ESCAPED = new RegExp(
|
|
1274
|
+
var REGEXP_IS_ESCAPED = new RegExp(
|
|
1275
|
+
`(${ESCAPE_DOT}|^${ESCAPE_DOLLAR}|^${ESCAPE_TO_BSON}$|^${ESCAPE_BSON_TYPE}|^${ESCAPE_TO_STRING}$)`
|
|
1276
|
+
);
|
|
1275
1277
|
var REGEXP_DOT = new RegExp(ESCAPE_DOT, "g");
|
|
1276
1278
|
var REGEXP_DOLLAR = new RegExp(`^${ESCAPE_DOLLAR}`);
|
|
1277
1279
|
var REGEXP_TO_BSON = new RegExp(`^${ESCAPE_TO_BSON}$`);
|
|
@@ -1301,7 +1303,8 @@ function unescapePropertyName(name) {
|
|
|
1301
1303
|
}
|
|
1302
1304
|
__name(unescapePropertyName, "unescapePropertyName");
|
|
1303
1305
|
function traverseObject(obj, clone, transformFunc) {
|
|
1304
|
-
if (obj === null || typeof obj !== "object" || Object.prototype.toString.call(obj) === "[object Date]" || isBuffer(obj))
|
|
1306
|
+
if (obj === null || typeof obj !== "object" || Object.prototype.toString.call(obj) === "[object Date]" || isBuffer(obj))
|
|
1307
|
+
return obj;
|
|
1305
1308
|
let result;
|
|
1306
1309
|
if (Array.isArray(obj)) {
|
|
1307
1310
|
result = clone ? new Array(obj.length) : obj;
|
|
@@ -1361,7 +1364,8 @@ var _JsonVariable = class _JsonVariable {
|
|
|
1361
1364
|
__name(_JsonVariable, "JsonVariable");
|
|
1362
1365
|
var JsonVariable = _JsonVariable;
|
|
1363
1366
|
function jsonStringifyExtended(value, replacer, space = 0) {
|
|
1364
|
-
if (replacer && !(replacer instanceof Function))
|
|
1367
|
+
if (replacer && !(replacer instanceof Function))
|
|
1368
|
+
throw new Error('Parameter "replacer" of jsonStringifyExtended() must be a function!');
|
|
1365
1369
|
const replacements = {};
|
|
1366
1370
|
const extendedReplacer = /* @__PURE__ */ __name((key, val) => {
|
|
1367
1371
|
val = replacer ? replacer(key, val) : val;
|
|
@@ -1496,7 +1500,8 @@ var _HealthChecker = class _HealthChecker {
|
|
|
1496
1500
|
}
|
|
1497
1501
|
_validateCheck(check) {
|
|
1498
1502
|
if (!(check.type in CHECK_TYPES)) throw new Error(`Check type "${check.type}" is invalid`);
|
|
1499
|
-
if (typeof check.client !== "object")
|
|
1503
|
+
if (typeof check.client !== "object")
|
|
1504
|
+
throw new Error(`Check client must be an object got "${typeof check.client}" instead`);
|
|
1500
1505
|
}
|
|
1501
1506
|
async _performCheck(check) {
|
|
1502
1507
|
switch (check.type) {
|
|
@@ -1849,11 +1854,7 @@ function publicEncrypt({ publicKey, value }) {
|
|
|
1849
1854
|
};
|
|
1850
1855
|
}
|
|
1851
1856
|
__name(publicEncrypt, "publicEncrypt");
|
|
1852
|
-
function privateDecrypt({
|
|
1853
|
-
privateKey,
|
|
1854
|
-
encryptedPassword,
|
|
1855
|
-
encryptedValue
|
|
1856
|
-
}) {
|
|
1857
|
+
function privateDecrypt({ privateKey, encryptedPassword, encryptedValue }) {
|
|
1857
1858
|
const encryptedValueBuffer = Buffer.from(encryptedValue, "base64");
|
|
1858
1859
|
const encryptedPasswordBuffer = Buffer.from(encryptedPassword, "base64");
|
|
1859
1860
|
const passwordBuffer = crypto2.privateDecrypt(privateKey, encryptedPasswordBuffer);
|
|
@@ -1989,11 +1990,7 @@ async function createHmacSignatureAsync(secretKey, message) {
|
|
|
1989
1990
|
false,
|
|
1990
1991
|
["sign"]
|
|
1991
1992
|
);
|
|
1992
|
-
const signatureBuffer = await subtleCrypto.sign(
|
|
1993
|
-
"HMAC",
|
|
1994
|
-
key,
|
|
1995
|
-
encoder.encode(message)
|
|
1996
|
-
);
|
|
1993
|
+
const signatureBuffer = await subtleCrypto.sign("HMAC", key, encoder.encode(message));
|
|
1997
1994
|
const signatureArray = new Uint8Array(signatureBuffer);
|
|
1998
1995
|
const signatureHex = Array.from(signatureArray).map((b) => b.toString(16).padStart(2, "0")).join("").substring(0, 30);
|
|
1999
1996
|
return encodeBase62(BigInt(`0x${signatureHex}`));
|