@apify/utilities 2.7.5 → 2.7.6
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/index.js +26 -18
- package/index.js.map +1 -1
- package/index.mjs +26 -18
- package/index.mjs.map +1 -1
- package/package.json +4 -4
package/index.mjs
CHANGED
|
@@ -1240,7 +1240,7 @@ function isBadForMongo(obj) {
|
|
|
1240
1240
|
return isBad;
|
|
1241
1241
|
}
|
|
1242
1242
|
__name(isBadForMongo, "isBadForMongo");
|
|
1243
|
-
var
|
|
1243
|
+
var _JsonVariable = class _JsonVariable {
|
|
1244
1244
|
constructor(name) {
|
|
1245
1245
|
this.name = name;
|
|
1246
1246
|
}
|
|
@@ -1248,7 +1248,8 @@ var JsonVariable = class {
|
|
|
1248
1248
|
return `{{${this.name}}}`;
|
|
1249
1249
|
}
|
|
1250
1250
|
};
|
|
1251
|
-
__name(
|
|
1251
|
+
__name(_JsonVariable, "JsonVariable");
|
|
1252
|
+
var JsonVariable = _JsonVariable;
|
|
1252
1253
|
function jsonStringifyExtended(value, replacer, space = 0) {
|
|
1253
1254
|
if (replacer && !(replacer instanceof Function))
|
|
1254
1255
|
throw new Error('Parameter "replacer" of jsonStringifyExtended() must be a function!');
|
|
@@ -1292,13 +1293,14 @@ __name(isUrlRelative, "isUrlRelative");
|
|
|
1292
1293
|
|
|
1293
1294
|
// src/exponential_backoff.ts
|
|
1294
1295
|
import log2 from "@apify/log";
|
|
1295
|
-
var
|
|
1296
|
+
var _RetryableError = class _RetryableError extends Error {
|
|
1296
1297
|
constructor(error, ...args) {
|
|
1297
1298
|
super(...args);
|
|
1298
1299
|
this.error = error;
|
|
1299
1300
|
}
|
|
1300
1301
|
};
|
|
1301
|
-
__name(
|
|
1302
|
+
__name(_RetryableError, "RetryableError");
|
|
1303
|
+
var RetryableError = _RetryableError;
|
|
1302
1304
|
async function retryWithExpBackoff(params = {}) {
|
|
1303
1305
|
const { func, expBackoffMillis, expBackoffMaxRepeats } = params;
|
|
1304
1306
|
if (typeof func !== "function") {
|
|
@@ -1347,7 +1349,7 @@ var CHECK_TYPES = /* @__PURE__ */ ((CHECK_TYPES2) => {
|
|
|
1347
1349
|
CHECK_TYPES2["REDIS_WRITE"] = "REDIS_WRITE";
|
|
1348
1350
|
return CHECK_TYPES2;
|
|
1349
1351
|
})(CHECK_TYPES || {});
|
|
1350
|
-
var
|
|
1352
|
+
var _HealthChecker = class _HealthChecker {
|
|
1351
1353
|
constructor(options) {
|
|
1352
1354
|
this.options = options;
|
|
1353
1355
|
const {
|
|
@@ -1442,12 +1444,13 @@ var HealthChecker = class {
|
|
|
1442
1444
|
throw new Error(`Returned value "${given}" is not equal to "${expected}"!`);
|
|
1443
1445
|
}
|
|
1444
1446
|
};
|
|
1445
|
-
__name(
|
|
1446
|
-
|
|
1447
|
+
__name(_HealthChecker, "HealthChecker");
|
|
1448
|
+
_HealthChecker.CHECK_TYPES = CHECK_TYPES;
|
|
1449
|
+
var HealthChecker = _HealthChecker;
|
|
1447
1450
|
|
|
1448
1451
|
// src/parse_jsonl_stream.ts
|
|
1449
1452
|
import { Transform } from "stream";
|
|
1450
|
-
var
|
|
1453
|
+
var _ParseJsonlStream = class _ParseJsonlStream extends Transform {
|
|
1451
1454
|
constructor() {
|
|
1452
1455
|
super(...arguments);
|
|
1453
1456
|
this.pendingChunk = null;
|
|
@@ -1501,7 +1504,8 @@ var ParseJsonlStream = class extends Transform {
|
|
|
1501
1504
|
callback();
|
|
1502
1505
|
}
|
|
1503
1506
|
};
|
|
1504
|
-
__name(
|
|
1507
|
+
__name(_ParseJsonlStream, "ParseJsonlStream");
|
|
1508
|
+
var ParseJsonlStream = _ParseJsonlStream;
|
|
1505
1509
|
|
|
1506
1510
|
// src/streams_utilities.ts
|
|
1507
1511
|
async function concatStreamToBuffer(stream) {
|
|
@@ -1523,7 +1527,7 @@ async function readStreamToString(stream, encoding) {
|
|
|
1523
1527
|
__name(readStreamToString, "readStreamToString");
|
|
1524
1528
|
|
|
1525
1529
|
// src/webhook_payload_template.ts
|
|
1526
|
-
var
|
|
1530
|
+
var _WebhookPayloadTemplateError = class _WebhookPayloadTemplateError extends Error {
|
|
1527
1531
|
constructor(message) {
|
|
1528
1532
|
super(message);
|
|
1529
1533
|
this.name = this.constructor.name;
|
|
@@ -1532,20 +1536,23 @@ var WebhookPayloadTemplateError = class extends Error {
|
|
|
1532
1536
|
}
|
|
1533
1537
|
}
|
|
1534
1538
|
};
|
|
1535
|
-
__name(
|
|
1536
|
-
var
|
|
1539
|
+
__name(_WebhookPayloadTemplateError, "WebhookPayloadTemplateError");
|
|
1540
|
+
var WebhookPayloadTemplateError = _WebhookPayloadTemplateError;
|
|
1541
|
+
var _InvalidJsonError = class _InvalidJsonError extends WebhookPayloadTemplateError {
|
|
1537
1542
|
constructor(originalError) {
|
|
1538
1543
|
super(originalError.message);
|
|
1539
1544
|
}
|
|
1540
1545
|
};
|
|
1541
|
-
__name(
|
|
1542
|
-
var
|
|
1546
|
+
__name(_InvalidJsonError, "InvalidJsonError");
|
|
1547
|
+
var InvalidJsonError = _InvalidJsonError;
|
|
1548
|
+
var _InvalidVariableError = class _InvalidVariableError extends Error {
|
|
1543
1549
|
constructor(variable) {
|
|
1544
1550
|
super(`Invalid payload template variable: ${variable}`);
|
|
1545
1551
|
}
|
|
1546
1552
|
};
|
|
1547
|
-
__name(
|
|
1548
|
-
var
|
|
1553
|
+
__name(_InvalidVariableError, "InvalidVariableError");
|
|
1554
|
+
var InvalidVariableError = _InvalidVariableError;
|
|
1555
|
+
var _WebhookPayloadTemplate = class _WebhookPayloadTemplate {
|
|
1549
1556
|
constructor(template, allowedVariables = null, context = {}) {
|
|
1550
1557
|
this.template = template;
|
|
1551
1558
|
this.allowedVariables = allowedVariables;
|
|
@@ -1564,7 +1571,7 @@ var WebhookPayloadTemplate = class {
|
|
|
1564
1571
|
const type = typeof payloadTemplate;
|
|
1565
1572
|
if (type !== "string")
|
|
1566
1573
|
throw new Error(`Cannot parse a ${type} payload template.`);
|
|
1567
|
-
const template = new
|
|
1574
|
+
const template = new _WebhookPayloadTemplate(payloadTemplate, allowedVariables, context);
|
|
1568
1575
|
const data = template._parse();
|
|
1569
1576
|
if (options.interpolateStrings) {
|
|
1570
1577
|
return template._interpolate(data);
|
|
@@ -1716,7 +1723,8 @@ var WebhookPayloadTemplate = class {
|
|
|
1716
1723
|
return value ? JSON.stringify(value) : null;
|
|
1717
1724
|
}
|
|
1718
1725
|
};
|
|
1719
|
-
__name(
|
|
1726
|
+
__name(_WebhookPayloadTemplate, "WebhookPayloadTemplate");
|
|
1727
|
+
var WebhookPayloadTemplate = _WebhookPayloadTemplate;
|
|
1720
1728
|
|
|
1721
1729
|
// src/crypto.ts
|
|
1722
1730
|
import crypto2 from "crypto";
|