@dereekb/util 13.14.0 → 13.16.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/eslint/index.cjs.js +2 -2
- package/eslint/index.esm.js +2 -2
- package/eslint/package.json +2 -2
- package/eslint/src/lib/require-dbx-rule-companion-tags.rule.d.ts +1 -1
- package/fetch/index.cjs.js +15 -15
- package/fetch/index.esm.js +15 -15
- package/fetch/package.json +2 -2
- package/index.cjs.js +204 -87
- package/index.esm.js +200 -88
- package/package.json +1 -1
- package/src/lib/hash.d.ts +22 -0
- package/src/lib/string/string.d.ts +85 -0
- package/test/index.cjs.js +6 -6
- package/test/index.esm.js +6 -6
- package/test/package.json +2 -2
package/eslint/index.cjs.js
CHANGED
|
@@ -8939,7 +8939,7 @@ function collectRuleCompanions(parsed) {
|
|
|
8939
8939
|
/**
|
|
8940
8940
|
* ESLint rule enforcing `@dbxRule` companion tags on enum members in
|
|
8941
8941
|
* `codes.ts` files. Mirrors the extractor at
|
|
8942
|
-
* `packages/dbx-
|
|
8942
|
+
* `packages/dbx-cli/validate/scripts/extract-rule-catalog.mjs`.
|
|
8943
8943
|
*/ var UTIL_REQUIRE_DBX_RULE_COMPANION_TAGS_RULE = {
|
|
8944
8944
|
meta: {
|
|
8945
8945
|
type: 'suggestion',
|
|
@@ -9415,7 +9415,7 @@ function collectRuleCompanions(parsed) {
|
|
|
9415
9415
|
* @param name - The original SCREAMING_CASE identifier.
|
|
9416
9416
|
* @returns The suggested identifier with `DEFAULT_` prefixed.
|
|
9417
9417
|
*/ function suggestedName(name) {
|
|
9418
|
-
var stripped = name.
|
|
9418
|
+
var stripped = name.replaceAll(/_DEFAULT(?=_|$)/g, '');
|
|
9419
9419
|
return "DEFAULT_".concat(stripped);
|
|
9420
9420
|
}
|
|
9421
9421
|
/**
|
package/eslint/index.esm.js
CHANGED
|
@@ -8937,7 +8937,7 @@ function collectRuleCompanions(parsed) {
|
|
|
8937
8937
|
/**
|
|
8938
8938
|
* ESLint rule enforcing `@dbxRule` companion tags on enum members in
|
|
8939
8939
|
* `codes.ts` files. Mirrors the extractor at
|
|
8940
|
-
* `packages/dbx-
|
|
8940
|
+
* `packages/dbx-cli/validate/scripts/extract-rule-catalog.mjs`.
|
|
8941
8941
|
*/ var UTIL_REQUIRE_DBX_RULE_COMPANION_TAGS_RULE = {
|
|
8942
8942
|
meta: {
|
|
8943
8943
|
type: 'suggestion',
|
|
@@ -9413,7 +9413,7 @@ function collectRuleCompanions(parsed) {
|
|
|
9413
9413
|
* @param name - The original SCREAMING_CASE identifier.
|
|
9414
9414
|
* @returns The suggested identifier with `DEFAULT_` prefixed.
|
|
9415
9415
|
*/ function suggestedName(name) {
|
|
9416
|
-
var stripped = name.
|
|
9416
|
+
var stripped = name.replaceAll(/_DEFAULT(?=_|$)/g, '');
|
|
9417
9417
|
return "DEFAULT_".concat(stripped);
|
|
9418
9418
|
}
|
|
9419
9419
|
/**
|
package/eslint/package.json
CHANGED
|
@@ -38,7 +38,7 @@ export interface UtilRequireDbxRuleCompanionTagsRuleDefinition {
|
|
|
38
38
|
/**
|
|
39
39
|
* ESLint rule enforcing `@dbxRule` companion tags on enum members in
|
|
40
40
|
* `codes.ts` files. Mirrors the extractor at
|
|
41
|
-
* `packages/dbx-
|
|
41
|
+
* `packages/dbx-cli/validate/scripts/extract-rule-catalog.mjs`.
|
|
42
42
|
*/
|
|
43
43
|
export declare const UTIL_REQUIRE_DBX_RULE_COMPANION_TAGS_RULE: UtilRequireDbxRuleCompanionTagsRuleDefinition;
|
|
44
44
|
export {};
|
package/fetch/index.cjs.js
CHANGED
|
@@ -1079,23 +1079,15 @@ function fetchFileFromUrl(input, safe) {
|
|
|
1079
1079
|
];
|
|
1080
1080
|
case 1:
|
|
1081
1081
|
response = _state.sent();
|
|
1082
|
-
if (
|
|
1082
|
+
if (!response.ok) return [
|
|
1083
1083
|
3,
|
|
1084
|
-
|
|
1084
|
+
3
|
|
1085
1085
|
];
|
|
1086
|
-
if (!safe) {
|
|
1087
|
-
throw new Error("Failed to fetch file from ".concat(url, ": ").concat(response.status, " ").concat(response.statusText));
|
|
1088
|
-
}
|
|
1089
|
-
return [
|
|
1090
|
-
3,
|
|
1091
|
-
4
|
|
1092
|
-
];
|
|
1093
|
-
case 2:
|
|
1094
1086
|
return [
|
|
1095
1087
|
4,
|
|
1096
1088
|
response.arrayBuffer()
|
|
1097
1089
|
];
|
|
1098
|
-
case
|
|
1090
|
+
case 2:
|
|
1099
1091
|
buffer = _state.sent();
|
|
1100
1092
|
responseMimeType = (_ref = mimeType !== null && mimeType !== void 0 ? mimeType : response.headers.get('content-type')) !== null && _ref !== void 0 ? _ref : undefined;
|
|
1101
1093
|
fileName = (_ref1 = (_input_fileName = input.fileName) !== null && _input_fileName !== void 0 ? _input_fileName : util.urlWithoutParameters(url).split('/').pop()) !== null && _ref1 !== void 0 ? _ref1 : 'file';
|
|
@@ -1105,6 +1097,14 @@ function fetchFileFromUrl(input, safe) {
|
|
|
1105
1097
|
result = new File([
|
|
1106
1098
|
buffer
|
|
1107
1099
|
], fileName, options);
|
|
1100
|
+
return [
|
|
1101
|
+
3,
|
|
1102
|
+
4
|
|
1103
|
+
];
|
|
1104
|
+
case 3:
|
|
1105
|
+
if (!safe) {
|
|
1106
|
+
throw new Error("Failed to fetch file from ".concat(url, ": ").concat(response.status, " ").concat(response.statusText));
|
|
1107
|
+
}
|
|
1108
1108
|
_state.label = 4;
|
|
1109
1109
|
case 4:
|
|
1110
1110
|
return [
|
|
@@ -2457,10 +2457,10 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
2457
2457
|
var baseUrl = fetchURL(input.url);
|
|
2458
2458
|
if (input.queryParams) {
|
|
2459
2459
|
var searchParams = queryParamsToSearchParams(input.queryParams);
|
|
2460
|
-
if (
|
|
2461
|
-
url = util.fixExtraQueryParameters(baseUrl + "?".concat(searchParams.toString()));
|
|
2462
|
-
} else {
|
|
2460
|
+
if (util.isEmptyIterable(searchParams)) {
|
|
2463
2461
|
url = baseUrl;
|
|
2462
|
+
} else {
|
|
2463
|
+
url = util.fixExtraQueryParameters(baseUrl + "?".concat(searchParams.toString()));
|
|
2464
2464
|
}
|
|
2465
2465
|
} else {
|
|
2466
2466
|
url = baseUrl;
|
|
@@ -2726,7 +2726,7 @@ var JsonResponseParseError = /*#__PURE__*/ function(Error1) {
|
|
|
2726
2726
|
* @param body
|
|
2727
2727
|
* @returns
|
|
2728
2728
|
*/ function fetchJsonBodyString(body) {
|
|
2729
|
-
return body
|
|
2729
|
+
return body == null ? undefined : typeof body === 'string' ? body : JSON.stringify(body);
|
|
2730
2730
|
}
|
|
2731
2731
|
var throwJsonResponseParseErrorFunction = function throwJsonResponseParseErrorFunction(response) {
|
|
2732
2732
|
throw new JsonResponseParseError(response);
|
package/fetch/index.esm.js
CHANGED
|
@@ -1077,23 +1077,15 @@ function fetchFileFromUrl(input, safe) {
|
|
|
1077
1077
|
];
|
|
1078
1078
|
case 1:
|
|
1079
1079
|
response = _state.sent();
|
|
1080
|
-
if (
|
|
1080
|
+
if (!response.ok) return [
|
|
1081
1081
|
3,
|
|
1082
|
-
|
|
1082
|
+
3
|
|
1083
1083
|
];
|
|
1084
|
-
if (!safe) {
|
|
1085
|
-
throw new Error("Failed to fetch file from ".concat(url, ": ").concat(response.status, " ").concat(response.statusText));
|
|
1086
|
-
}
|
|
1087
|
-
return [
|
|
1088
|
-
3,
|
|
1089
|
-
4
|
|
1090
|
-
];
|
|
1091
|
-
case 2:
|
|
1092
1084
|
return [
|
|
1093
1085
|
4,
|
|
1094
1086
|
response.arrayBuffer()
|
|
1095
1087
|
];
|
|
1096
|
-
case
|
|
1088
|
+
case 2:
|
|
1097
1089
|
buffer = _state.sent();
|
|
1098
1090
|
responseMimeType = (_ref = mimeType !== null && mimeType !== void 0 ? mimeType : response.headers.get('content-type')) !== null && _ref !== void 0 ? _ref : undefined;
|
|
1099
1091
|
fileName = (_ref1 = (_input_fileName = input.fileName) !== null && _input_fileName !== void 0 ? _input_fileName : urlWithoutParameters(url).split('/').pop()) !== null && _ref1 !== void 0 ? _ref1 : 'file';
|
|
@@ -1103,6 +1095,14 @@ function fetchFileFromUrl(input, safe) {
|
|
|
1103
1095
|
result = new File([
|
|
1104
1096
|
buffer
|
|
1105
1097
|
], fileName, options);
|
|
1098
|
+
return [
|
|
1099
|
+
3,
|
|
1100
|
+
4
|
|
1101
|
+
];
|
|
1102
|
+
case 3:
|
|
1103
|
+
if (!safe) {
|
|
1104
|
+
throw new Error("Failed to fetch file from ".concat(url, ": ").concat(response.status, " ").concat(response.statusText));
|
|
1105
|
+
}
|
|
1106
1106
|
_state.label = 4;
|
|
1107
1107
|
case 4:
|
|
1108
1108
|
return [
|
|
@@ -2455,10 +2455,10 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
2455
2455
|
var baseUrl = fetchURL(input.url);
|
|
2456
2456
|
if (input.queryParams) {
|
|
2457
2457
|
var searchParams = queryParamsToSearchParams(input.queryParams);
|
|
2458
|
-
if (
|
|
2459
|
-
url = fixExtraQueryParameters(baseUrl + "?".concat(searchParams.toString()));
|
|
2460
|
-
} else {
|
|
2458
|
+
if (isEmptyIterable(searchParams)) {
|
|
2461
2459
|
url = baseUrl;
|
|
2460
|
+
} else {
|
|
2461
|
+
url = fixExtraQueryParameters(baseUrl + "?".concat(searchParams.toString()));
|
|
2462
2462
|
}
|
|
2463
2463
|
} else {
|
|
2464
2464
|
url = baseUrl;
|
|
@@ -2724,7 +2724,7 @@ var JsonResponseParseError = /*#__PURE__*/ function(Error1) {
|
|
|
2724
2724
|
* @param body
|
|
2725
2725
|
* @returns
|
|
2726
2726
|
*/ function fetchJsonBodyString(body) {
|
|
2727
|
-
return body
|
|
2727
|
+
return body == null ? undefined : typeof body === 'string' ? body : JSON.stringify(body);
|
|
2728
2728
|
}
|
|
2729
2729
|
var throwJsonResponseParseErrorFunction = function throwJsonResponseParseErrorFunction(response) {
|
|
2730
2730
|
throw new JsonResponseParseError(response);
|
package/fetch/package.json
CHANGED