@apify/utilities 2.24.0 → 2.25.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 +17 -1
- package/cjs/index.cjs.map +1 -1
- package/cjs/index.d.ts +12 -1
- package/esm/index.d.mts +12 -1
- package/esm/index.mjs +16 -1
- package/esm/index.mjs.map +1 -1
- package/package.json +2 -2
package/esm/index.d.mts
CHANGED
|
@@ -592,4 +592,15 @@ declare function createStorageContentSignatureAsync({ resourceId, urlSigningSecr
|
|
|
592
592
|
version?: number;
|
|
593
593
|
}): Promise<string>;
|
|
594
594
|
|
|
595
|
-
|
|
595
|
+
/**
|
|
596
|
+
* Strictly parses a value to a boolean, returning `null` if the value is invalid.
|
|
597
|
+
* - Returns `true` for: `true`, `1`, `'1'`, `'true'` (case-insensitive).
|
|
598
|
+
* - Returns `false` for: `false`, `0`, `'0'`, `'false'` (case-insensitive).
|
|
599
|
+
* - Returns `null` for any other value.
|
|
600
|
+
*
|
|
601
|
+
* @param value - The value to parse (unknown type).
|
|
602
|
+
* @returns {boolean | null} The parsed boolean or null if the input is invalid.
|
|
603
|
+
*/
|
|
604
|
+
declare const parseBooleanOrNull: (value: unknown) => boolean | null;
|
|
605
|
+
|
|
606
|
+
export { type BetterIntervalID, CHECK_TYPES, CodeHashManager, CodeHashMetaKey, HealthChecker, InvalidJsonError, InvalidVariableError, JsonVariable, ParseJsonlStream, RetryableError, WebhookPayloadTemplate, betterClearInterval, betterSetInterval, buildOrVersionNumberIntToStr, checkParamPrototypeOrThrow, concatStreamToBuffer, configureLogger, createHmacSignature, createHmacSignatureAsync, createInjectableRegExp, createStorageContentSignature, createStorageContentSignatureAsync, cryptoRandomObjectId, dateToString, delayPromise, deterministicUniqueId, escapeForBson, escapePropertyName, escapeRegExp, expressErrorHandler, getOrdinalSuffix, getRandomInt, http404Route, isBadForMongo, isBuffer, isForbiddenUsername, isNullOrUndefined, isUrlRelative, jsonStringifyExtended, leftpad, markedDecreaseHeadsLevel, markedSetNofollowLinks, normalizeUrl, parseBooleanOrNull, parseDateFromJson, parseUrl, privateDecrypt, promisifyServerListen, publicEncrypt, readStreamToString, removeFromArray, retryWithExpBackoff, separateImports, sequentializePromises, splitFullName, timeoutPromise, traverseObject, truncate, unescapeFromBson, unescapePropertyName, weightedAverage };
|
package/esm/index.mjs
CHANGED
|
@@ -342,8 +342,10 @@ var FORBIDDEN_USERNAMES_REGEXPS = [
|
|
|
342
342
|
"security\\.txt",
|
|
343
343
|
// All hidden files
|
|
344
344
|
"(\\..*)",
|
|
345
|
-
//
|
|
345
|
+
// Username starting with xxx-
|
|
346
346
|
"(xxx-.*)",
|
|
347
|
+
// Username starting with install-cli. (see https://docs.apify.com/cli/docs/installation)
|
|
348
|
+
"(install-cli\\..*)",
|
|
347
349
|
// Strings not starting with letter or number
|
|
348
350
|
"([^0-9a-z].*)",
|
|
349
351
|
// Strings not ending with letter or number
|
|
@@ -1950,6 +1952,18 @@ async function createStorageContentSignatureAsync({
|
|
|
1950
1952
|
return typedArrayToBase64Url(new TextEncoder().encode(`${version}.${expiresAt}.${hmac}`));
|
|
1951
1953
|
}
|
|
1952
1954
|
__name(createStorageContentSignatureAsync, "createStorageContentSignatureAsync");
|
|
1955
|
+
|
|
1956
|
+
// src/parse_boolean.ts
|
|
1957
|
+
var parseBooleanOrNull = /* @__PURE__ */ __name((value) => {
|
|
1958
|
+
if (value === true || value === 1) return true;
|
|
1959
|
+
if (value === false || value === 0) return false;
|
|
1960
|
+
if (typeof value === "string") {
|
|
1961
|
+
const lowerValue = value.trim().toLowerCase();
|
|
1962
|
+
if (lowerValue === "true" || lowerValue === "1") return true;
|
|
1963
|
+
if (lowerValue === "false" || lowerValue === "0") return false;
|
|
1964
|
+
}
|
|
1965
|
+
return null;
|
|
1966
|
+
}, "parseBooleanOrNull");
|
|
1953
1967
|
export {
|
|
1954
1968
|
CHECK_TYPES,
|
|
1955
1969
|
CodeHashManager,
|
|
@@ -1993,6 +2007,7 @@ export {
|
|
|
1993
2007
|
markedDecreaseHeadsLevel,
|
|
1994
2008
|
markedSetNofollowLinks,
|
|
1995
2009
|
normalizeUrl,
|
|
2010
|
+
parseBooleanOrNull,
|
|
1996
2011
|
parseDateFromJson,
|
|
1997
2012
|
parseUrl,
|
|
1998
2013
|
privateDecrypt,
|