fui-material 2.8.15 → 2.8.16
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/dist/f-ui-kit.es.js
CHANGED
|
@@ -9054,7 +9054,9 @@ const ERROR_FIELDS = [
|
|
|
9054
9054
|
"detail",
|
|
9055
9055
|
"traceId",
|
|
9056
9056
|
"requestId",
|
|
9057
|
-
"timestamp"
|
|
9057
|
+
"timestamp",
|
|
9058
|
+
"exception",
|
|
9059
|
+
"path"
|
|
9058
9060
|
];
|
|
9059
9061
|
function isScalar(value) {
|
|
9060
9062
|
return typeof value === "string" || typeof value === "boolean" || typeof value === "number" && Number.isFinite(value);
|
|
@@ -9074,7 +9076,7 @@ function normalizeRequestErrorResponse(data) {
|
|
|
9074
9076
|
for (const field of ERROR_FIELDS) {
|
|
9075
9077
|
const value = data[field];
|
|
9076
9078
|
if (!isScalar(value)) continue;
|
|
9077
|
-
const text = String(value);
|
|
9079
|
+
const text = field === "path" ? normalizeErrorPath(String(value)) : String(value);
|
|
9078
9080
|
result[field] = text.slice(
|
|
9079
9081
|
0,
|
|
9080
9082
|
field === "message" || field === "detail" ? LONG_ERROR_FIELD_LIMIT : SHORT_ERROR_FIELD_LIMIT
|
|
@@ -9098,6 +9100,53 @@ function getErrorResponseData(error2) {
|
|
|
9098
9100
|
function getRequestErrorResponse(error2) {
|
|
9099
9101
|
return normalizeRequestErrorResponse(getErrorResponseData(error2));
|
|
9100
9102
|
}
|
|
9103
|
+
function normalizeErrorPath(value) {
|
|
9104
|
+
return new URL(value, "http://observer.invalid").pathname.replace(
|
|
9105
|
+
/\/(?:\d+|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|[0-9a-f]{16,})(?=\/|$)/gi,
|
|
9106
|
+
"/<id>"
|
|
9107
|
+
);
|
|
9108
|
+
}
|
|
9109
|
+
const SENSITIVE_BODY_FIELD = /password|passwd|pwd|token|auth|cookie|secret|session|csrf|email|e-mail|phone|mobile|telephone|address|passport|snils|inn|kpp|account|card|birth|fio|name|surname|patronymic|executor|waterUser|org|contract|docNum|basis|notes|comment|description|text|content|file|scan|парол|токен|куки|почт|телефон|адрес|паспорт|снилс|инн|фио|фамили|отчеств|^имя$/i;
|
|
9110
|
+
function scrubRequestText(value, limit) {
|
|
9111
|
+
return value.replace(/https?:\/\/[^\s"'<>]+/gi, (url) => normalizeErrorPath(url)).replace(/\?[^\s"'<>)]*/g, "?").replace(/#[^\s"'<>)]*/g, "#").slice(0, limit);
|
|
9112
|
+
}
|
|
9113
|
+
function getRequestErrorBody(observer, method, outcome, error2, requestData) {
|
|
9114
|
+
try {
|
|
9115
|
+
if (!(observer == null ? void 0 : observer.captureErrorRequestBody) || outcome !== "failure" || !["POST", "PATCH"].includes(method.trim().toUpperCase())) return void 0;
|
|
9116
|
+
const candidate = error2 && typeof error2 === "object" ? error2 : void 0;
|
|
9117
|
+
let input = candidate && "requestBody" in candidate ? candidate.requestBody : (candidate == null ? void 0 : candidate.config) ? candidate.config.data : requestData;
|
|
9118
|
+
if (input === void 0) return void 0;
|
|
9119
|
+
if (typeof input === "string") {
|
|
9120
|
+
if (input === "[truncated]" || input === "[omitted]") return input;
|
|
9121
|
+
if (input.length > 65536) return "[truncated]";
|
|
9122
|
+
input = JSON.parse(input);
|
|
9123
|
+
if (typeof input === "string") return void 0;
|
|
9124
|
+
}
|
|
9125
|
+
if (input !== null && typeof input === "object" && !Array.isArray(input) && Object.getPrototypeOf(input) !== Object.prototype && Object.getPrototypeOf(input) !== null) return void 0;
|
|
9126
|
+
const visited = /* @__PURE__ */ new WeakSet();
|
|
9127
|
+
let remaining = 200;
|
|
9128
|
+
const sanitize = (value, depth) => {
|
|
9129
|
+
if (--remaining < 0 || depth > 6) return "[truncated]";
|
|
9130
|
+
if (value === null || typeof value === "boolean") return value;
|
|
9131
|
+
if (typeof value === "number") return Number.isFinite(value) ? value : "[omitted]";
|
|
9132
|
+
if (typeof value === "string") return scrubRequestText(value, 512);
|
|
9133
|
+
if (!value || typeof value !== "object") return "[omitted]";
|
|
9134
|
+
if (!Array.isArray(value) && Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) return "[omitted]";
|
|
9135
|
+
if (visited.has(value)) return "[circular]";
|
|
9136
|
+
visited.add(value);
|
|
9137
|
+
const result2 = Array.isArray(value) ? value.slice(0, 50).map((item) => sanitize(item, depth + 1)) : Object.fromEntries(Object.keys(value).slice(0, 50).map((key) => [
|
|
9138
|
+
scrubRequestText(key, 128),
|
|
9139
|
+
SENSITIVE_BODY_FIELD.test(key) ? "[redacted]" : sanitize(value[key], depth + 1)
|
|
9140
|
+
]));
|
|
9141
|
+
visited.delete(value);
|
|
9142
|
+
return result2;
|
|
9143
|
+
};
|
|
9144
|
+
const result = sanitize(input, 0);
|
|
9145
|
+
return new TextEncoder().encode(JSON.stringify(result)).byteLength <= 8192 ? result : "[truncated]";
|
|
9146
|
+
} catch {
|
|
9147
|
+
return void 0;
|
|
9148
|
+
}
|
|
9149
|
+
}
|
|
9101
9150
|
const getRequestNow = () => {
|
|
9102
9151
|
if (typeof performance !== "undefined" && typeof performance.now === "function") {
|
|
9103
9152
|
return performance.now();
|
|
@@ -9157,7 +9206,7 @@ function notifyRequestObserver(observer, observation) {
|
|
|
9157
9206
|
} catch {
|
|
9158
9207
|
}
|
|
9159
9208
|
}
|
|
9160
|
-
async function observeRequest(observer, requestFn, method, url) {
|
|
9209
|
+
async function observeRequest(observer, requestFn, method, url, requestData) {
|
|
9161
9210
|
if (!observer) {
|
|
9162
9211
|
return requestFn();
|
|
9163
9212
|
}
|
|
@@ -9179,6 +9228,7 @@ async function observeRequest(observer, requestFn, method, url) {
|
|
|
9179
9228
|
const durationMs = calcDurationMs(startTime);
|
|
9180
9229
|
const { outcome, errorCategory, status } = classifyRequestError(error2);
|
|
9181
9230
|
const errorResponse = outcome === "failure" ? getRequestErrorResponse(error2) : void 0;
|
|
9231
|
+
const errorRequestBody = getRequestErrorBody(observer, normalizedMethod, outcome, error2, requestData);
|
|
9182
9232
|
notifyRequestObserver(observer, {
|
|
9183
9233
|
method: normalizedMethod,
|
|
9184
9234
|
url,
|
|
@@ -9186,7 +9236,8 @@ async function observeRequest(observer, requestFn, method, url) {
|
|
|
9186
9236
|
durationMs,
|
|
9187
9237
|
outcome,
|
|
9188
9238
|
errorCategory,
|
|
9189
|
-
...errorResponse ? { errorResponse } : {}
|
|
9239
|
+
...errorResponse ? { errorResponse } : {},
|
|
9240
|
+
...errorRequestBody !== void 0 ? { errorRequestBody } : {}
|
|
9190
9241
|
});
|
|
9191
9242
|
throw error2;
|
|
9192
9243
|
}
|
|
@@ -9212,7 +9263,8 @@ const FLibraryProvider = ({
|
|
|
9212
9263
|
effectiveObserver,
|
|
9213
9264
|
() => config.apiService.request(url, reqConfig),
|
|
9214
9265
|
(reqConfig == null ? void 0 : reqConfig.method) ?? "GET",
|
|
9215
|
-
url
|
|
9266
|
+
url,
|
|
9267
|
+
reqConfig == null ? void 0 : reqConfig.data
|
|
9216
9268
|
);
|
|
9217
9269
|
}
|
|
9218
9270
|
}
|
|
@@ -9280,6 +9332,7 @@ const useFApi = ({
|
|
|
9280
9332
|
if (effectiveObserver) {
|
|
9281
9333
|
const { outcome, errorCategory, status } = classifyRequestError(error22);
|
|
9282
9334
|
const errorResponse = outcome === "failure" ? getRequestErrorResponse(error22) : void 0;
|
|
9335
|
+
const errorRequestBody = getRequestErrorBody(effectiveObserver, method, outcome, error22, config.data);
|
|
9283
9336
|
notifyRequestObserver(effectiveObserver, {
|
|
9284
9337
|
method,
|
|
9285
9338
|
url,
|
|
@@ -9287,7 +9340,8 @@ const useFApi = ({
|
|
|
9287
9340
|
durationMs: calcDurationMs(startTime),
|
|
9288
9341
|
outcome,
|
|
9289
9342
|
errorCategory,
|
|
9290
|
-
...errorResponse ? { errorResponse } : {}
|
|
9343
|
+
...errorResponse ? { errorResponse } : {},
|
|
9344
|
+
...errorRequestBody !== void 0 ? { errorRequestBody } : {}
|
|
9291
9345
|
});
|
|
9292
9346
|
}
|
|
9293
9347
|
const err = error22;
|