@apify/utilities 2.7.5 → 2.7.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/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.js
CHANGED
|
@@ -1327,7 +1327,7 @@ function isBadForMongo(obj) {
|
|
|
1327
1327
|
return isBad;
|
|
1328
1328
|
}
|
|
1329
1329
|
__name(isBadForMongo, "isBadForMongo");
|
|
1330
|
-
var
|
|
1330
|
+
var _JsonVariable = class _JsonVariable {
|
|
1331
1331
|
constructor(name) {
|
|
1332
1332
|
this.name = name;
|
|
1333
1333
|
}
|
|
@@ -1335,7 +1335,8 @@ var JsonVariable = class {
|
|
|
1335
1335
|
return `{{${this.name}}}`;
|
|
1336
1336
|
}
|
|
1337
1337
|
};
|
|
1338
|
-
__name(
|
|
1338
|
+
__name(_JsonVariable, "JsonVariable");
|
|
1339
|
+
var JsonVariable = _JsonVariable;
|
|
1339
1340
|
function jsonStringifyExtended(value, replacer, space = 0) {
|
|
1340
1341
|
if (replacer && !(replacer instanceof Function))
|
|
1341
1342
|
throw new Error('Parameter "replacer" of jsonStringifyExtended() must be a function!');
|
|
@@ -1379,13 +1380,14 @@ __name(isUrlRelative, "isUrlRelative");
|
|
|
1379
1380
|
|
|
1380
1381
|
// src/exponential_backoff.ts
|
|
1381
1382
|
var import_log2 = __toESM(require("@apify/log"));
|
|
1382
|
-
var
|
|
1383
|
+
var _RetryableError = class _RetryableError extends Error {
|
|
1383
1384
|
constructor(error, ...args) {
|
|
1384
1385
|
super(...args);
|
|
1385
1386
|
this.error = error;
|
|
1386
1387
|
}
|
|
1387
1388
|
};
|
|
1388
|
-
__name(
|
|
1389
|
+
__name(_RetryableError, "RetryableError");
|
|
1390
|
+
var RetryableError = _RetryableError;
|
|
1389
1391
|
async function retryWithExpBackoff(params = {}) {
|
|
1390
1392
|
const { func, expBackoffMillis, expBackoffMaxRepeats } = params;
|
|
1391
1393
|
if (typeof func !== "function") {
|
|
@@ -1434,7 +1436,7 @@ var CHECK_TYPES = /* @__PURE__ */ ((CHECK_TYPES2) => {
|
|
|
1434
1436
|
CHECK_TYPES2["REDIS_WRITE"] = "REDIS_WRITE";
|
|
1435
1437
|
return CHECK_TYPES2;
|
|
1436
1438
|
})(CHECK_TYPES || {});
|
|
1437
|
-
var
|
|
1439
|
+
var _HealthChecker = class _HealthChecker {
|
|
1438
1440
|
constructor(options) {
|
|
1439
1441
|
this.options = options;
|
|
1440
1442
|
const {
|
|
@@ -1529,12 +1531,13 @@ var HealthChecker = class {
|
|
|
1529
1531
|
throw new Error(`Returned value "${given}" is not equal to "${expected}"!`);
|
|
1530
1532
|
}
|
|
1531
1533
|
};
|
|
1532
|
-
__name(
|
|
1533
|
-
|
|
1534
|
+
__name(_HealthChecker, "HealthChecker");
|
|
1535
|
+
_HealthChecker.CHECK_TYPES = CHECK_TYPES;
|
|
1536
|
+
var HealthChecker = _HealthChecker;
|
|
1534
1537
|
|
|
1535
1538
|
// src/parse_jsonl_stream.ts
|
|
1536
1539
|
var import_stream = require("stream");
|
|
1537
|
-
var
|
|
1540
|
+
var _ParseJsonlStream = class _ParseJsonlStream extends import_stream.Transform {
|
|
1538
1541
|
constructor() {
|
|
1539
1542
|
super(...arguments);
|
|
1540
1543
|
this.pendingChunk = null;
|
|
@@ -1588,7 +1591,8 @@ var ParseJsonlStream = class extends import_stream.Transform {
|
|
|
1588
1591
|
callback();
|
|
1589
1592
|
}
|
|
1590
1593
|
};
|
|
1591
|
-
__name(
|
|
1594
|
+
__name(_ParseJsonlStream, "ParseJsonlStream");
|
|
1595
|
+
var ParseJsonlStream = _ParseJsonlStream;
|
|
1592
1596
|
|
|
1593
1597
|
// src/streams_utilities.ts
|
|
1594
1598
|
async function concatStreamToBuffer(stream) {
|
|
@@ -1610,7 +1614,7 @@ async function readStreamToString(stream, encoding) {
|
|
|
1610
1614
|
__name(readStreamToString, "readStreamToString");
|
|
1611
1615
|
|
|
1612
1616
|
// src/webhook_payload_template.ts
|
|
1613
|
-
var
|
|
1617
|
+
var _WebhookPayloadTemplateError = class _WebhookPayloadTemplateError extends Error {
|
|
1614
1618
|
constructor(message) {
|
|
1615
1619
|
super(message);
|
|
1616
1620
|
this.name = this.constructor.name;
|
|
@@ -1619,20 +1623,23 @@ var WebhookPayloadTemplateError = class extends Error {
|
|
|
1619
1623
|
}
|
|
1620
1624
|
}
|
|
1621
1625
|
};
|
|
1622
|
-
__name(
|
|
1623
|
-
var
|
|
1626
|
+
__name(_WebhookPayloadTemplateError, "WebhookPayloadTemplateError");
|
|
1627
|
+
var WebhookPayloadTemplateError = _WebhookPayloadTemplateError;
|
|
1628
|
+
var _InvalidJsonError = class _InvalidJsonError extends WebhookPayloadTemplateError {
|
|
1624
1629
|
constructor(originalError) {
|
|
1625
1630
|
super(originalError.message);
|
|
1626
1631
|
}
|
|
1627
1632
|
};
|
|
1628
|
-
__name(
|
|
1629
|
-
var
|
|
1633
|
+
__name(_InvalidJsonError, "InvalidJsonError");
|
|
1634
|
+
var InvalidJsonError = _InvalidJsonError;
|
|
1635
|
+
var _InvalidVariableError = class _InvalidVariableError extends Error {
|
|
1630
1636
|
constructor(variable) {
|
|
1631
1637
|
super(`Invalid payload template variable: ${variable}`);
|
|
1632
1638
|
}
|
|
1633
1639
|
};
|
|
1634
|
-
__name(
|
|
1635
|
-
var
|
|
1640
|
+
__name(_InvalidVariableError, "InvalidVariableError");
|
|
1641
|
+
var InvalidVariableError = _InvalidVariableError;
|
|
1642
|
+
var _WebhookPayloadTemplate = class _WebhookPayloadTemplate {
|
|
1636
1643
|
constructor(template, allowedVariables = null, context = {}) {
|
|
1637
1644
|
this.template = template;
|
|
1638
1645
|
this.allowedVariables = allowedVariables;
|
|
@@ -1651,7 +1658,7 @@ var WebhookPayloadTemplate = class {
|
|
|
1651
1658
|
const type = typeof payloadTemplate;
|
|
1652
1659
|
if (type !== "string")
|
|
1653
1660
|
throw new Error(`Cannot parse a ${type} payload template.`);
|
|
1654
|
-
const template = new
|
|
1661
|
+
const template = new _WebhookPayloadTemplate(payloadTemplate, allowedVariables, context);
|
|
1655
1662
|
const data = template._parse();
|
|
1656
1663
|
if (options.interpolateStrings) {
|
|
1657
1664
|
return template._interpolate(data);
|
|
@@ -1803,7 +1810,8 @@ var WebhookPayloadTemplate = class {
|
|
|
1803
1810
|
return value ? JSON.stringify(value) : null;
|
|
1804
1811
|
}
|
|
1805
1812
|
};
|
|
1806
|
-
__name(
|
|
1813
|
+
__name(_WebhookPayloadTemplate, "WebhookPayloadTemplate");
|
|
1814
|
+
var WebhookPayloadTemplate = _WebhookPayloadTemplate;
|
|
1807
1815
|
|
|
1808
1816
|
// src/crypto.ts
|
|
1809
1817
|
var import_crypto2 = __toESM(require("crypto"));
|