@apify/utilities 2.18.1 → 2.19.0
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 +10 -4
- package/cjs/index.cjs.map +1 -1
- package/cjs/index.d.ts +5 -1
- package/esm/index.d.mts +5 -1
- package/esm/index.mjs +9 -4
- package/esm/index.mjs.map +1 -1
- package/package.json +4 -4
package/cjs/index.d.ts
CHANGED
|
@@ -114,6 +114,10 @@ declare function configureLogger(givenLog: Log, isProduction?: boolean): void;
|
|
|
114
114
|
* Wraps given promise with timeout.
|
|
115
115
|
*/
|
|
116
116
|
declare function timeoutPromise<T>(promise: Promise<T>, timeoutMillis: number, errorMessage?: string): Promise<unknown>;
|
|
117
|
+
/**
|
|
118
|
+
* Removes the leading ^ and trailing $ from regex
|
|
119
|
+
*/
|
|
120
|
+
declare function createInjectableRegExp(regex: RegExp): RegExp;
|
|
117
121
|
|
|
118
122
|
/*!
|
|
119
123
|
* This module contains various client-side utility and helper functions.
|
|
@@ -561,4 +565,4 @@ declare function createStorageContentSignature({ resourceId, urlSigningSecretKey
|
|
|
561
565
|
version?: number;
|
|
562
566
|
}): string;
|
|
563
567
|
|
|
564
|
-
export { type BetterIntervalID, CHECK_TYPES, CodeHashManager, CodeHashMetaKey, HealthChecker, InvalidJsonError, InvalidVariableError, JsonVariable, ParseJsonlStream, RetryableError, WebhookPayloadTemplate, betterClearInterval, betterSetInterval, buildOrVersionNumberIntToStr, checkParamPrototypeOrThrow, concatStreamToBuffer, configureLogger, createHmacSignature, createStorageContentSignature, cryptoRandomObjectId, dateToString, delayPromise, deterministicUniqueId, escapeForBson, escapePropertyName, escapeRegExp, expressErrorHandler, getOrdinalSuffix, getRandomInt, http404Route, isBadForMongo, isBuffer, isForbiddenUsername, isNullOrUndefined, isUrlRelative, jsonStringifyExtended, leftpad, markedDecreaseHeadsLevel, markedSetNofollowLinks, normalizeUrl, parseDateFromJson, parseUrl, privateDecrypt, promisifyServerListen, publicEncrypt, readStreamToString, removeFromArray, retryWithExpBackoff, separateImports, sequentializePromises, splitFullName, timeoutPromise, traverseObject, truncate, unescapeFromBson, unescapePropertyName, weightedAverage };
|
|
568
|
+
export { type BetterIntervalID, CHECK_TYPES, CodeHashManager, CodeHashMetaKey, HealthChecker, InvalidJsonError, InvalidVariableError, JsonVariable, ParseJsonlStream, RetryableError, WebhookPayloadTemplate, betterClearInterval, betterSetInterval, buildOrVersionNumberIntToStr, checkParamPrototypeOrThrow, concatStreamToBuffer, configureLogger, createHmacSignature, createInjectableRegExp, createStorageContentSignature, cryptoRandomObjectId, dateToString, delayPromise, deterministicUniqueId, escapeForBson, escapePropertyName, escapeRegExp, expressErrorHandler, getOrdinalSuffix, getRandomInt, http404Route, isBadForMongo, isBuffer, isForbiddenUsername, isNullOrUndefined, isUrlRelative, jsonStringifyExtended, leftpad, markedDecreaseHeadsLevel, markedSetNofollowLinks, normalizeUrl, parseDateFromJson, parseUrl, privateDecrypt, promisifyServerListen, publicEncrypt, readStreamToString, removeFromArray, retryWithExpBackoff, separateImports, sequentializePromises, splitFullName, timeoutPromise, traverseObject, truncate, unescapeFromBson, unescapePropertyName, weightedAverage };
|
package/esm/index.d.mts
CHANGED
|
@@ -114,6 +114,10 @@ declare function configureLogger(givenLog: Log, isProduction?: boolean): void;
|
|
|
114
114
|
* Wraps given promise with timeout.
|
|
115
115
|
*/
|
|
116
116
|
declare function timeoutPromise<T>(promise: Promise<T>, timeoutMillis: number, errorMessage?: string): Promise<unknown>;
|
|
117
|
+
/**
|
|
118
|
+
* Removes the leading ^ and trailing $ from regex
|
|
119
|
+
*/
|
|
120
|
+
declare function createInjectableRegExp(regex: RegExp): RegExp;
|
|
117
121
|
|
|
118
122
|
/*!
|
|
119
123
|
* This module contains various client-side utility and helper functions.
|
|
@@ -561,4 +565,4 @@ declare function createStorageContentSignature({ resourceId, urlSigningSecretKey
|
|
|
561
565
|
version?: number;
|
|
562
566
|
}): string;
|
|
563
567
|
|
|
564
|
-
export { type BetterIntervalID, CHECK_TYPES, CodeHashManager, CodeHashMetaKey, HealthChecker, InvalidJsonError, InvalidVariableError, JsonVariable, ParseJsonlStream, RetryableError, WebhookPayloadTemplate, betterClearInterval, betterSetInterval, buildOrVersionNumberIntToStr, checkParamPrototypeOrThrow, concatStreamToBuffer, configureLogger, createHmacSignature, createStorageContentSignature, cryptoRandomObjectId, dateToString, delayPromise, deterministicUniqueId, escapeForBson, escapePropertyName, escapeRegExp, expressErrorHandler, getOrdinalSuffix, getRandomInt, http404Route, isBadForMongo, isBuffer, isForbiddenUsername, isNullOrUndefined, isUrlRelative, jsonStringifyExtended, leftpad, markedDecreaseHeadsLevel, markedSetNofollowLinks, normalizeUrl, parseDateFromJson, parseUrl, privateDecrypt, promisifyServerListen, publicEncrypt, readStreamToString, removeFromArray, retryWithExpBackoff, separateImports, sequentializePromises, splitFullName, timeoutPromise, traverseObject, truncate, unescapeFromBson, unescapePropertyName, weightedAverage };
|
|
568
|
+
export { type BetterIntervalID, CHECK_TYPES, CodeHashManager, CodeHashMetaKey, HealthChecker, InvalidJsonError, InvalidVariableError, JsonVariable, ParseJsonlStream, RetryableError, WebhookPayloadTemplate, betterClearInterval, betterSetInterval, buildOrVersionNumberIntToStr, checkParamPrototypeOrThrow, concatStreamToBuffer, configureLogger, createHmacSignature, createInjectableRegExp, createStorageContentSignature, cryptoRandomObjectId, dateToString, delayPromise, deterministicUniqueId, escapeForBson, escapePropertyName, escapeRegExp, expressErrorHandler, getOrdinalSuffix, getRandomInt, http404Route, isBadForMongo, isBuffer, isForbiddenUsername, isNullOrUndefined, isUrlRelative, jsonStringifyExtended, leftpad, markedDecreaseHeadsLevel, markedSetNofollowLinks, normalizeUrl, parseDateFromJson, parseUrl, privateDecrypt, promisifyServerListen, publicEncrypt, readStreamToString, removeFromArray, retryWithExpBackoff, separateImports, sequentializePromises, splitFullName, timeoutPromise, traverseObject, truncate, unescapeFromBson, unescapePropertyName, weightedAverage };
|
package/esm/index.mjs
CHANGED
|
@@ -34,13 +34,13 @@ function parseDateFromJson(date) {
|
|
|
34
34
|
}
|
|
35
35
|
__name(parseDateFromJson, "parseDateFromJson");
|
|
36
36
|
async function delayPromise(millis) {
|
|
37
|
-
return new Promise((resolve) => {
|
|
37
|
+
return new Promise(((resolve) => {
|
|
38
38
|
if (millis > 0) {
|
|
39
39
|
setTimeout(() => resolve(), millis);
|
|
40
40
|
} else {
|
|
41
41
|
resolve();
|
|
42
42
|
}
|
|
43
|
-
});
|
|
43
|
+
}));
|
|
44
44
|
}
|
|
45
45
|
__name(delayPromise, "delayPromise");
|
|
46
46
|
function removeFromArray(array, element) {
|
|
@@ -1016,6 +1016,10 @@ async function timeoutPromise(promise, timeoutMillis, errorMessage = "Promise ha
|
|
|
1016
1016
|
});
|
|
1017
1017
|
}
|
|
1018
1018
|
__name(timeoutPromise, "timeoutPromise");
|
|
1019
|
+
function createInjectableRegExp(regex) {
|
|
1020
|
+
return new RegExp(regex.source.replace(/^\^|\$$/g, ""));
|
|
1021
|
+
}
|
|
1022
|
+
__name(createInjectableRegExp, "createInjectableRegExp");
|
|
1019
1023
|
|
|
1020
1024
|
// src/utilities.client.ts
|
|
1021
1025
|
import { RELATIVE_URL_REGEX, VERSION_INT_MAJOR_BASE, VERSION_INT_MINOR_BASE } from "@apify/consts";
|
|
@@ -1103,9 +1107,9 @@ function parseUrl(str) {
|
|
|
1103
1107
|
});
|
|
1104
1108
|
uri.fragmentKey = {};
|
|
1105
1109
|
if (uri.fragment) {
|
|
1106
|
-
uri.fragment.replace(o.q.parser, ($0, $1, $2) => {
|
|
1110
|
+
uri.fragment.replace(o.q.parser, (($0, $1, $2) => {
|
|
1107
1111
|
if ($1) uri.fragmentKey[$1] = $2;
|
|
1108
|
-
});
|
|
1112
|
+
}));
|
|
1109
1113
|
}
|
|
1110
1114
|
return uri;
|
|
1111
1115
|
}
|
|
@@ -1893,6 +1897,7 @@ export {
|
|
|
1893
1897
|
concatStreamToBuffer,
|
|
1894
1898
|
configureLogger,
|
|
1895
1899
|
createHmacSignature,
|
|
1900
|
+
createInjectableRegExp,
|
|
1896
1901
|
createStorageContentSignature,
|
|
1897
1902
|
cryptoRandomObjectId,
|
|
1898
1903
|
dateToString,
|