@ryuzaki13/react-foundation-lib 1.2.0 → 1.2.2
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/error-report/capture.d.ts.map +1 -1
- package/dist/error-report/index.js +243 -183
- package/dist/error-report/index.js.map +1 -1
- package/dist/error-report/runtime.d.ts.map +1 -1
- package/dist/error-report/runtimeDeduplication.d.ts +25 -0
- package/dist/error-report/runtimeDeduplication.d.ts.map +1 -0
- package/package.json +3 -1
- package/src/binary/README.md +110 -0
- package/src/file/README.md +289 -0
- package/src/file/file.mdx +6 -0
- package/src/formatters/date/README.md +459 -0
- package/src/formatters/date/date.mdx +6 -0
- package/src/formatters/number/README.md +123 -0
- package/src/formatters/number/number.mdx +6 -0
- package/src/formatters/valueState/README.md +275 -0
- package/src/formatters/valueState/valueState.mdx +6 -0
- package/src/formulas/README.md +42 -0
- package/src/formulas/formulas.mdx +6 -0
- package/src/pwa/README.md +638 -0
- package/src/pwa/pwa.mdx +6 -0
- package/src/query-client/README.md +565 -0
- package/src/query-client/queryClient.mdx +6 -0
|
@@ -1,50 +1,51 @@
|
|
|
1
1
|
import { _ as e } from "../chunks/array-BBSjoTRy.js";
|
|
2
2
|
import { qt as t } from "../chunks/formatters-DbsO3__r.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { stableStringify as n } from "../utils/index.js";
|
|
4
|
+
import { hashString128 as r, uuidv4 as i } from "../crypto/index.js";
|
|
5
|
+
import { v as a } from "../chunks/dateUtils-D9dpdTl7.js";
|
|
6
|
+
import { createIndexedDbQueryStorage as o } from "../query-client/index.js";
|
|
7
|
+
import { getSessionStorageId as s } from "../session-storage/index.js";
|
|
7
8
|
//#region src/error-report/safeValue.ts
|
|
8
|
-
var
|
|
9
|
-
function
|
|
10
|
-
if (t >=
|
|
9
|
+
var c = 4, ee = 20, l = 40;
|
|
10
|
+
function u(e, t = 0) {
|
|
11
|
+
if (t >= c) return { type: "truncated" };
|
|
11
12
|
if (e === null || typeof e == "string" || typeof e == "number" || typeof e == "boolean") return e;
|
|
12
13
|
if (e === void 0) return { type: "undefined" };
|
|
13
14
|
if (e instanceof Date) return e.toISOString();
|
|
14
|
-
if (Array.isArray(e)) return e.slice(0,
|
|
15
|
+
if (Array.isArray(e)) return e.slice(0, ee).map((e) => u(e, t + 1));
|
|
15
16
|
if (typeof e == "object") {
|
|
16
|
-
let n = Object.entries(e).slice(0,
|
|
17
|
-
return Object.fromEntries(n.map(([e, n]) => [e,
|
|
17
|
+
let n = Object.entries(e).slice(0, l);
|
|
18
|
+
return Object.fromEntries(n.map(([e, n]) => [e, u(n, t + 1)]));
|
|
18
19
|
}
|
|
19
20
|
return typeof e == "function" ? { type: "function" } : typeof e == "symbol" ? { type: "symbol" } : typeof e == "bigint" ? e.toString() : { type: "unknown" };
|
|
20
21
|
}
|
|
21
|
-
function
|
|
22
|
-
if (t >=
|
|
22
|
+
function d(e, t = 0) {
|
|
23
|
+
if (t >= c) return { type: "truncated" };
|
|
23
24
|
if (e === null) return { type: "null" };
|
|
24
25
|
if (e === void 0) return { type: "undefined" };
|
|
25
26
|
if (Array.isArray(e)) return {
|
|
26
27
|
type: "array",
|
|
27
28
|
length: e.length,
|
|
28
|
-
firstItemsShape: e.slice(0, 3).map((e) =>
|
|
29
|
+
firstItemsShape: e.slice(0, 3).map((e) => d(e, t + 1))
|
|
29
30
|
};
|
|
30
31
|
if (typeof e == "object") {
|
|
31
|
-
let n = Object.entries(e).slice(0,
|
|
32
|
+
let n = Object.entries(e).slice(0, l);
|
|
32
33
|
return {
|
|
33
34
|
type: "object",
|
|
34
35
|
keys: n.map(([e]) => e),
|
|
35
|
-
shape: Object.fromEntries(n.map(([e, n]) => [e,
|
|
36
|
+
shape: Object.fromEntries(n.map(([e, n]) => [e, d(n, t + 1)]))
|
|
36
37
|
};
|
|
37
38
|
}
|
|
38
39
|
return { type: typeof e };
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
+
function f(e) {
|
|
41
42
|
if (!e) return;
|
|
42
|
-
let t = Object.entries(e).slice(0,
|
|
43
|
+
let t = Object.entries(e).slice(0, l).map(([e, t]) => [e, u(t)]);
|
|
43
44
|
return t.length ? Object.fromEntries(t) : void 0;
|
|
44
45
|
}
|
|
45
46
|
//#endregion
|
|
46
47
|
//#region src/error-report/breadcrumbs.ts
|
|
47
|
-
var
|
|
48
|
+
var te = 20, ne = 80, re = 120, ie = [
|
|
48
49
|
"button",
|
|
49
50
|
"a",
|
|
50
51
|
"input",
|
|
@@ -56,93 +57,93 @@ var f = 20, ee = 80, te = 120, ne = [
|
|
|
56
57
|
"[data-ui]",
|
|
57
58
|
"[data-action]"
|
|
58
59
|
].join(","), p = [];
|
|
59
|
-
function
|
|
60
|
+
function ae() {
|
|
60
61
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
61
62
|
}
|
|
62
|
-
function
|
|
63
|
+
function m(e) {
|
|
63
64
|
p = [...p, {
|
|
64
65
|
...e,
|
|
65
|
-
utc: e.utc ??
|
|
66
|
+
utc: e.utc ?? ae()
|
|
66
67
|
}].slice(-80);
|
|
67
68
|
}
|
|
68
|
-
function
|
|
69
|
+
function h() {
|
|
69
70
|
return p;
|
|
70
71
|
}
|
|
71
|
-
function
|
|
72
|
+
function g() {
|
|
72
73
|
p = [];
|
|
73
74
|
}
|
|
74
|
-
function
|
|
75
|
-
return t(e,
|
|
75
|
+
function _(e) {
|
|
76
|
+
return t(e, re);
|
|
76
77
|
}
|
|
77
|
-
function
|
|
78
|
+
function v(e) {
|
|
78
79
|
return {
|
|
79
|
-
id:
|
|
80
|
-
role:
|
|
81
|
-
type:
|
|
82
|
-
title:
|
|
83
|
-
ariaLabel:
|
|
84
|
-
dataUi:
|
|
85
|
-
dataAction:
|
|
80
|
+
id: _(e.id),
|
|
81
|
+
role: _(e.getAttribute("role")),
|
|
82
|
+
type: _(e.getAttribute("type")),
|
|
83
|
+
title: _(e.getAttribute("title")),
|
|
84
|
+
ariaLabel: _(e.getAttribute("aria-label")),
|
|
85
|
+
dataUi: _(e.getAttribute("data-ui")),
|
|
86
|
+
dataAction: _(e.getAttribute("data-action"))
|
|
86
87
|
};
|
|
87
88
|
}
|
|
88
|
-
function
|
|
89
|
-
if (!(e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement) && e.matches("button,a,[role],[aria-label],[title]")) return t(e.textContent,
|
|
89
|
+
function oe(e) {
|
|
90
|
+
if (!(e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement) && e.matches("button,a,[role],[aria-label],[title]")) return t(e.textContent, ne);
|
|
90
91
|
}
|
|
91
|
-
function
|
|
92
|
+
function se(e) {
|
|
92
93
|
return typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/["\\#.[\]>~+:]/g, "\\$&");
|
|
93
94
|
}
|
|
94
|
-
function
|
|
95
|
-
let t =
|
|
96
|
-
return t.id && n.push(`#${
|
|
95
|
+
function y(e) {
|
|
96
|
+
let t = v(e), n = [e.tagName.toLowerCase()];
|
|
97
|
+
return t.id && n.push(`#${se(t.id)}`), t.role && n.push(`[role="${t.role}"]`), t.type && n.push(`[type="${t.type}"]`), t.dataUi && n.push(`[data-ui="${t.dataUi}"]`), t.dataAction && n.push(`[data-action="${t.dataAction}"]`), n.join("");
|
|
97
98
|
}
|
|
98
|
-
function
|
|
99
|
-
let t =
|
|
99
|
+
function b(e) {
|
|
100
|
+
let t = v(e);
|
|
100
101
|
return {
|
|
101
102
|
tag: e.tagName.toLowerCase(),
|
|
102
|
-
selector:
|
|
103
|
-
text:
|
|
103
|
+
selector: y(e),
|
|
104
|
+
text: oe(e),
|
|
104
105
|
...t
|
|
105
106
|
};
|
|
106
107
|
}
|
|
107
|
-
function
|
|
108
|
+
function x(e) {
|
|
108
109
|
return Object.fromEntries(Object.entries(e).filter(([, e]) => e !== void 0 && (!Array.isArray(e) || e.length > 0)));
|
|
109
110
|
}
|
|
110
|
-
function
|
|
111
|
+
function S(e) {
|
|
111
112
|
let t = [], n = e;
|
|
112
|
-
for (; n && n !== document.documentElement && t.length <
|
|
113
|
+
for (; n && n !== document.documentElement && t.length < te && (t.push(n), n !== document.body);) n = n.parentElement;
|
|
113
114
|
return t;
|
|
114
115
|
}
|
|
115
|
-
function
|
|
116
|
-
return e.closest(
|
|
116
|
+
function C(e) {
|
|
117
|
+
return e.closest(ie) ?? e;
|
|
117
118
|
}
|
|
118
|
-
function
|
|
119
|
-
if (e instanceof Element) return C(
|
|
119
|
+
function ce(e) {
|
|
120
|
+
if (e instanceof Element) return S(C(e)).map((e) => y(e)).join(" > ");
|
|
120
121
|
}
|
|
121
|
-
function
|
|
122
|
-
let t = e.target instanceof Element ? e.target : void 0, n = t ?
|
|
123
|
-
return
|
|
122
|
+
function le(e) {
|
|
123
|
+
let t = e.target instanceof Element ? e.target : void 0, n = t ? C(t) : void 0, r = n ? S(n).map((e) => x(b(e))) : [];
|
|
124
|
+
return f({
|
|
124
125
|
button: e.button,
|
|
125
126
|
ctrlKey: e.ctrlKey,
|
|
126
127
|
shiftKey: e.shiftKey,
|
|
127
128
|
altKey: e.altKey,
|
|
128
129
|
clientX: e.clientX,
|
|
129
130
|
clientY: e.clientY,
|
|
130
|
-
target: n ?
|
|
131
|
+
target: n ? x(b(n)) : void 0,
|
|
131
132
|
chain: r
|
|
132
133
|
});
|
|
133
134
|
}
|
|
134
|
-
function
|
|
135
|
+
function w() {
|
|
135
136
|
if (typeof window > "u") return () => void 0;
|
|
136
137
|
let e = (e) => {
|
|
137
|
-
|
|
138
|
+
m({
|
|
138
139
|
type: "click",
|
|
139
|
-
target:
|
|
140
|
-
detail:
|
|
140
|
+
target: ce(e.target),
|
|
141
|
+
detail: le(e)
|
|
141
142
|
});
|
|
142
143
|
}, t = () => {
|
|
143
|
-
|
|
144
|
+
m({
|
|
144
145
|
type: "visibility",
|
|
145
|
-
detail:
|
|
146
|
+
detail: f({ visibilityState: document.visibilityState })
|
|
146
147
|
});
|
|
147
148
|
};
|
|
148
149
|
return window.addEventListener("click", e, !0), document.addEventListener("visibilitychange", t), () => {
|
|
@@ -151,15 +152,15 @@ function oe() {
|
|
|
151
152
|
}
|
|
152
153
|
//#endregion
|
|
153
154
|
//#region src/error-report/errorInfo.ts
|
|
154
|
-
var
|
|
155
|
-
function
|
|
156
|
-
return e(t) ? t :
|
|
155
|
+
var T = "Неизвестная ошибка";
|
|
156
|
+
function E(t) {
|
|
157
|
+
return e(t) ? t : T;
|
|
157
158
|
}
|
|
158
|
-
function
|
|
159
|
+
function D(e) {
|
|
159
160
|
let t = e.status ?? e.statusCode ?? e.httpStatus;
|
|
160
161
|
return typeof t == "number" && Number.isFinite(t) ? t : void 0;
|
|
161
162
|
}
|
|
162
|
-
function
|
|
163
|
+
function ue(t) {
|
|
163
164
|
if (!t || typeof t != "object") return null;
|
|
164
165
|
let n = t.appError;
|
|
165
166
|
if (!n || typeof n != "object") return null;
|
|
@@ -168,40 +169,40 @@ function se(t) {
|
|
|
168
169
|
name: "AppError",
|
|
169
170
|
message: i,
|
|
170
171
|
code: e(r.code),
|
|
171
|
-
httpStatus:
|
|
172
|
+
httpStatus: D(r)
|
|
172
173
|
} : null;
|
|
173
174
|
}
|
|
174
|
-
function
|
|
175
|
-
let t =
|
|
175
|
+
function O(e) {
|
|
176
|
+
let t = ue(e);
|
|
176
177
|
if (t) return t;
|
|
177
178
|
if (e instanceof Error) return {
|
|
178
179
|
name: e.name || "Error",
|
|
179
|
-
message:
|
|
180
|
+
message: E(e.message),
|
|
180
181
|
stackTrace: e.stack
|
|
181
182
|
};
|
|
182
183
|
if (e && typeof e == "object") {
|
|
183
184
|
let t = e;
|
|
184
185
|
return {
|
|
185
186
|
name: typeof t.name == "string" ? t.name : "Error",
|
|
186
|
-
message:
|
|
187
|
+
message: E(typeof t.message == "string" ? t.message : String(e)),
|
|
187
188
|
stackTrace: typeof t.stack == "string" ? t.stack : void 0,
|
|
188
|
-
httpStatus:
|
|
189
|
+
httpStatus: D(t)
|
|
189
190
|
};
|
|
190
191
|
}
|
|
191
192
|
return {
|
|
192
193
|
name: "Error",
|
|
193
|
-
message:
|
|
194
|
+
message: E(typeof e == "string" ? e : String(e ?? T))
|
|
194
195
|
};
|
|
195
196
|
}
|
|
196
197
|
//#endregion
|
|
197
198
|
//#region src/error-report/diagnostics.ts
|
|
198
|
-
function
|
|
199
|
-
return
|
|
199
|
+
function k(e) {
|
|
200
|
+
return f(e);
|
|
200
201
|
}
|
|
201
|
-
function
|
|
202
|
+
function A(e) {
|
|
202
203
|
return {
|
|
203
204
|
queryHash: e.queryHash,
|
|
204
|
-
queryKey:
|
|
205
|
+
queryKey: u(e.queryKey),
|
|
205
206
|
status: e.state.status,
|
|
206
207
|
fetchStatus: e.state.fetchStatus,
|
|
207
208
|
dataUpdatedAt: e.state.dataUpdatedAt,
|
|
@@ -209,64 +210,64 @@ function j(e) {
|
|
|
209
210
|
failureCount: e.state.fetchFailureCount,
|
|
210
211
|
isInvalidated: e.state.isInvalidated,
|
|
211
212
|
observersCount: e.getObserversCount(),
|
|
212
|
-
meta:
|
|
213
|
-
dataShape:
|
|
214
|
-
error: e.state.error ?
|
|
213
|
+
meta: k(e.meta),
|
|
214
|
+
dataShape: d(e.state.data),
|
|
215
|
+
error: e.state.error ? O(e.state.error) : void 0
|
|
215
216
|
};
|
|
216
217
|
}
|
|
217
|
-
function
|
|
218
|
+
function j(e) {
|
|
218
219
|
return {
|
|
219
|
-
mutationKey: e.options.mutationKey ?
|
|
220
|
+
mutationKey: e.options.mutationKey ? u(e.options.mutationKey) : void 0,
|
|
220
221
|
status: e.state.status,
|
|
221
222
|
failureCount: e.state.failureCount,
|
|
222
223
|
submittedAt: e.state.submittedAt,
|
|
223
|
-
meta:
|
|
224
|
-
error: e.state.error ?
|
|
224
|
+
meta: k(e.meta),
|
|
225
|
+
error: e.state.error ? O(e.state.error) : void 0
|
|
225
226
|
};
|
|
226
227
|
}
|
|
227
|
-
function
|
|
228
|
+
function M(e) {
|
|
228
229
|
return {
|
|
229
|
-
queries: e.getQueryCache().getAll().slice(-40).map(
|
|
230
|
-
mutations: e.getMutationCache().getAll().slice(-40).map(
|
|
230
|
+
queries: e.getQueryCache().getAll().slice(-40).map(A),
|
|
231
|
+
mutations: e.getMutationCache().getAll().slice(-40).map(j)
|
|
231
232
|
};
|
|
232
233
|
}
|
|
233
|
-
function
|
|
234
|
+
function de(e, t) {
|
|
234
235
|
let n = t.state;
|
|
235
236
|
return {
|
|
236
237
|
storageKey: e,
|
|
237
238
|
buster: t.buster,
|
|
238
239
|
queryHash: t.queryHash,
|
|
239
|
-
queryKey:
|
|
240
|
+
queryKey: u(t.queryKey),
|
|
240
241
|
status: n.status,
|
|
241
242
|
fetchStatus: n.fetchStatus,
|
|
242
243
|
dataUpdatedAt: n.dataUpdatedAt,
|
|
243
244
|
errorUpdatedAt: n.errorUpdatedAt,
|
|
244
245
|
failureCount: n.fetchFailureCount,
|
|
245
|
-
error: n.error ?
|
|
246
|
+
error: n.error ? O(n.error) : void 0
|
|
246
247
|
};
|
|
247
248
|
}
|
|
248
|
-
async function
|
|
249
|
-
let e =
|
|
249
|
+
async function N() {
|
|
250
|
+
let e = o();
|
|
250
251
|
if (!e?.entries) return [];
|
|
251
252
|
try {
|
|
252
|
-
return (await e.entries()).slice(-40).map(([e, t]) =>
|
|
253
|
+
return (await e.entries()).slice(-40).map(([e, t]) => de(e, t));
|
|
253
254
|
} catch {
|
|
254
255
|
return [];
|
|
255
256
|
}
|
|
256
257
|
}
|
|
257
258
|
//#endregion
|
|
258
259
|
//#region src/error-report/environment.ts
|
|
259
|
-
function
|
|
260
|
+
function P(e = {}) {
|
|
260
261
|
let t = e.isDev ?? __DEV__;
|
|
261
262
|
return typeof window < "u" && !t;
|
|
262
263
|
}
|
|
263
|
-
function
|
|
264
|
+
function F() {
|
|
264
265
|
return {
|
|
265
266
|
mode: __DEV__ ? "development" : "production",
|
|
266
267
|
buildId: typeof __APP_BUILD_ID__ == "string" ? __APP_BUILD_ID__ : void 0
|
|
267
268
|
};
|
|
268
269
|
}
|
|
269
|
-
function
|
|
270
|
+
function I() {
|
|
270
271
|
if (!(typeof window > "u")) return {
|
|
271
272
|
userAgent: window.navigator.userAgent,
|
|
272
273
|
language: window.navigator.language,
|
|
@@ -275,86 +276,134 @@ function L() {
|
|
|
275
276
|
}
|
|
276
277
|
//#endregion
|
|
277
278
|
//#region src/error-report/drafts.ts
|
|
278
|
-
var
|
|
279
|
-
function
|
|
280
|
-
return
|
|
279
|
+
var L = `${__APP_ID__}.errorReport.drafts.v1`, fe = `${__APP_ID__}.errorReport.sessionId.v1`, R = B();
|
|
280
|
+
function z() {
|
|
281
|
+
return a(/* @__PURE__ */ new Date());
|
|
281
282
|
}
|
|
282
|
-
function
|
|
283
|
+
function B() {
|
|
283
284
|
if (typeof sessionStorage > "u") return [];
|
|
284
285
|
try {
|
|
285
|
-
let e = sessionStorage.getItem(
|
|
286
|
+
let e = sessionStorage.getItem(L), t = e ? JSON.parse(e) : [];
|
|
286
287
|
return Array.isArray(t) ? t : [];
|
|
287
288
|
} catch {
|
|
288
289
|
return [];
|
|
289
290
|
}
|
|
290
291
|
}
|
|
291
|
-
function
|
|
292
|
-
if (
|
|
293
|
-
sessionStorage.setItem(
|
|
292
|
+
function V(e) {
|
|
293
|
+
if (R = e.slice(-10), !(typeof sessionStorage > "u")) try {
|
|
294
|
+
sessionStorage.setItem(L, JSON.stringify(R));
|
|
294
295
|
} catch {}
|
|
295
296
|
}
|
|
296
|
-
function
|
|
297
|
+
function pe() {
|
|
297
298
|
if (!(typeof window > "u")) return {
|
|
298
299
|
pathname: window.location.pathname,
|
|
299
300
|
origin: window.location.origin
|
|
300
301
|
};
|
|
301
302
|
}
|
|
302
|
-
function
|
|
303
|
+
function me() {
|
|
303
304
|
if (!(typeof window > "u")) return {
|
|
304
305
|
width: window.innerWidth,
|
|
305
306
|
height: window.innerHeight,
|
|
306
307
|
devicePixelRatio: window.devicePixelRatio
|
|
307
308
|
};
|
|
308
309
|
}
|
|
309
|
-
function
|
|
310
|
-
return
|
|
310
|
+
function H(e) {
|
|
311
|
+
return R.find((t) => t.reportId === e);
|
|
311
312
|
}
|
|
312
|
-
function
|
|
313
|
-
let n =
|
|
313
|
+
function he(e, t) {
|
|
314
|
+
let n = H(e);
|
|
314
315
|
if (!n) return;
|
|
315
316
|
let r = {
|
|
316
317
|
...n,
|
|
317
318
|
...t
|
|
318
319
|
};
|
|
319
|
-
return
|
|
320
|
+
return V(R.map((t) => t.reportId === e ? r : t)), r;
|
|
320
321
|
}
|
|
321
|
-
function
|
|
322
|
-
return
|
|
322
|
+
function ge() {
|
|
323
|
+
return R;
|
|
323
324
|
}
|
|
324
|
-
function
|
|
325
|
-
if (!
|
|
326
|
-
let t =
|
|
325
|
+
function U(e) {
|
|
326
|
+
if (!P()) return;
|
|
327
|
+
let t = i(), n = s(fe), r = z(), a = {
|
|
327
328
|
reportId: t,
|
|
328
|
-
sessionId:
|
|
329
|
-
createdUtc:
|
|
329
|
+
sessionId: n,
|
|
330
|
+
createdUtc: r,
|
|
330
331
|
category: e.category,
|
|
331
332
|
source: e.source,
|
|
332
333
|
error: e.error,
|
|
333
|
-
environment:
|
|
334
|
-
client:
|
|
335
|
-
location:
|
|
336
|
-
viewport:
|
|
334
|
+
environment: F(),
|
|
335
|
+
client: I(),
|
|
336
|
+
location: pe(),
|
|
337
|
+
viewport: me(),
|
|
337
338
|
react: e.react,
|
|
338
339
|
query: e.query,
|
|
339
340
|
mutation: e.mutation,
|
|
340
341
|
queryClient: e.queryClient,
|
|
341
342
|
persistedQueries: e.persistedQueries,
|
|
342
|
-
breadcrumbs:
|
|
343
|
+
breadcrumbs: h(),
|
|
343
344
|
context: e.context
|
|
344
|
-
},
|
|
345
|
+
}, o = {
|
|
345
346
|
reportId: t,
|
|
346
|
-
sessionId:
|
|
347
|
-
createdUtc:
|
|
347
|
+
sessionId: n,
|
|
348
|
+
createdUtc: r,
|
|
348
349
|
category: e.category,
|
|
349
350
|
status: "pending",
|
|
350
|
-
payload:
|
|
351
|
+
payload: a
|
|
351
352
|
};
|
|
352
|
-
return
|
|
353
|
+
return V([...R, o]), o;
|
|
354
|
+
}
|
|
355
|
+
//#endregion
|
|
356
|
+
//#region src/error-report/runtimeDeduplication.ts
|
|
357
|
+
var _e = 6e4, ve = 100, W = /* @__PURE__ */ new Map();
|
|
358
|
+
function ye(e) {
|
|
359
|
+
if (e) return e.split("\n").map((e) => e.trim()).filter(Boolean);
|
|
360
|
+
}
|
|
361
|
+
function be(e) {
|
|
362
|
+
return r(n({
|
|
363
|
+
category: e.category,
|
|
364
|
+
source: e.source,
|
|
365
|
+
error: {
|
|
366
|
+
...e.error,
|
|
367
|
+
stackTrace: ye(e.error.stackTrace)
|
|
368
|
+
},
|
|
369
|
+
pathname: e.pathname,
|
|
370
|
+
scope: e.scope
|
|
371
|
+
}));
|
|
372
|
+
}
|
|
373
|
+
function G(e, t) {
|
|
374
|
+
let n = W.get(e);
|
|
375
|
+
!n || t && n.capture !== t || (clearTimeout(n.expirationTimer), W.delete(e));
|
|
376
|
+
}
|
|
377
|
+
function xe(e) {
|
|
378
|
+
for (let [t, n] of W) e - n.capturedAt >= 6e4 && G(t, n.capture);
|
|
379
|
+
}
|
|
380
|
+
function Se() {
|
|
381
|
+
let e = W.keys().next().value;
|
|
382
|
+
e && G(e);
|
|
383
|
+
}
|
|
384
|
+
function Ce(e, t) {
|
|
385
|
+
let n = Date.now(), r = be(e), i = W.get(r);
|
|
386
|
+
if (i && n - i.capturedAt < 6e4) return i.capture;
|
|
387
|
+
for (xe(n); W.size >= ve;) Se();
|
|
388
|
+
let a = t(), o = setTimeout(() => {
|
|
389
|
+
G(r, a);
|
|
390
|
+
}, _e);
|
|
391
|
+
return W.set(r, {
|
|
392
|
+
capturedAt: n,
|
|
393
|
+
capture: a,
|
|
394
|
+
expirationTimer: o
|
|
395
|
+
}), a.catch(() => {
|
|
396
|
+
G(r, a);
|
|
397
|
+
}), a;
|
|
398
|
+
}
|
|
399
|
+
function we() {
|
|
400
|
+
for (let e of W.values()) clearTimeout(e.expirationTimer);
|
|
401
|
+
W.clear();
|
|
353
402
|
}
|
|
354
403
|
//#endregion
|
|
355
404
|
//#region src/error-report/transport.ts
|
|
356
|
-
var
|
|
357
|
-
function
|
|
405
|
+
var K = 6e4, Te = 100, Ee = 250, q, J = /* @__PURE__ */ new WeakSet(), Y = /* @__PURE__ */ new WeakSet(), X = /* @__PURE__ */ new Map();
|
|
406
|
+
function De(e) {
|
|
358
407
|
return [
|
|
359
408
|
e.source,
|
|
360
409
|
e.method,
|
|
@@ -363,106 +412,117 @@ function me(e) {
|
|
|
363
412
|
e.responseUrl
|
|
364
413
|
].filter(Boolean).join("|");
|
|
365
414
|
}
|
|
366
|
-
function
|
|
367
|
-
let t = Date.now(), n =
|
|
368
|
-
for (let [e, n] of
|
|
369
|
-
let r =
|
|
370
|
-
return r && t - r <
|
|
415
|
+
function Z(e) {
|
|
416
|
+
let t = Date.now(), n = De(e);
|
|
417
|
+
for (let [e, n] of X) (t - n > K || X.size > Te) && X.delete(e);
|
|
418
|
+
let r = X.get(n);
|
|
419
|
+
return r && t - r < K ? !0 : (X.set(n, t), !1);
|
|
371
420
|
}
|
|
372
|
-
function
|
|
373
|
-
|
|
421
|
+
function Oe(e) {
|
|
422
|
+
q = e, X.clear();
|
|
374
423
|
}
|
|
375
|
-
function
|
|
376
|
-
return e instanceof Error &&
|
|
424
|
+
function ke(e) {
|
|
425
|
+
return e instanceof Error && J.has(e);
|
|
377
426
|
}
|
|
378
427
|
function Q(e) {
|
|
379
|
-
e instanceof Error &&
|
|
428
|
+
e instanceof Error && Y.add(e);
|
|
380
429
|
}
|
|
381
|
-
function
|
|
382
|
-
|
|
383
|
-
if (!
|
|
384
|
-
let n =
|
|
430
|
+
function Ae(e, t) {
|
|
431
|
+
J.add(e), setTimeout(() => {
|
|
432
|
+
if (!Y.has(e) && q && !Z(t)) try {
|
|
433
|
+
let n = q(e, t);
|
|
385
434
|
Promise.resolve(n).catch(() => void 0);
|
|
386
435
|
} catch {}
|
|
387
|
-
},
|
|
436
|
+
}, Ee);
|
|
388
437
|
}
|
|
389
438
|
//#endregion
|
|
390
439
|
//#region src/error-report/capture.ts
|
|
391
|
-
async function
|
|
440
|
+
async function je(e, t, n, r) {
|
|
392
441
|
Q(e);
|
|
393
442
|
let i = r?.source ?? "query";
|
|
394
|
-
|
|
443
|
+
m({
|
|
395
444
|
type: "query-error",
|
|
396
|
-
detail:
|
|
445
|
+
detail: f({
|
|
397
446
|
queryHash: t.queryHash,
|
|
398
447
|
queryKey: r?.queryKey ?? t.queryKey,
|
|
399
448
|
...r?.detail
|
|
400
449
|
})
|
|
401
450
|
});
|
|
402
|
-
let [a, o] = await Promise.all([
|
|
403
|
-
return
|
|
451
|
+
let [a, o] = await Promise.all([N(), Promise.resolve(M(n))]);
|
|
452
|
+
return U({
|
|
404
453
|
category: "query",
|
|
405
454
|
source: i,
|
|
406
|
-
error: r?.errorInfo ??
|
|
407
|
-
query:
|
|
455
|
+
error: r?.errorInfo ?? O(e),
|
|
456
|
+
query: A(t),
|
|
408
457
|
queryClient: o,
|
|
409
458
|
persistedQueries: a,
|
|
410
|
-
context:
|
|
459
|
+
context: f(r?.detail)
|
|
411
460
|
});
|
|
412
461
|
}
|
|
413
|
-
async function
|
|
462
|
+
async function Me(e, t, n, r = {}) {
|
|
414
463
|
Q(e);
|
|
415
464
|
let i = r.source ?? "mutation";
|
|
416
|
-
|
|
465
|
+
m({
|
|
417
466
|
type: "mutation-error",
|
|
418
|
-
detail:
|
|
467
|
+
detail: f({
|
|
419
468
|
mutationKey: t.options.mutationKey,
|
|
420
469
|
...r.detail
|
|
421
470
|
})
|
|
422
471
|
});
|
|
423
|
-
let [a, o] = await Promise.all([
|
|
424
|
-
return
|
|
472
|
+
let [a, o] = await Promise.all([N(), Promise.resolve(M(n))]);
|
|
473
|
+
return U({
|
|
425
474
|
category: "mutation",
|
|
426
475
|
source: i,
|
|
427
|
-
error: r.errorInfo ??
|
|
428
|
-
mutation:
|
|
476
|
+
error: r.errorInfo ?? O(e),
|
|
477
|
+
mutation: j(t),
|
|
429
478
|
queryClient: o,
|
|
430
479
|
persistedQueries: a
|
|
431
480
|
});
|
|
432
481
|
}
|
|
433
|
-
|
|
434
|
-
let r = t.source ?? t.category ?? "runtime"
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
482
|
+
function Ne(e, t = {}, n) {
|
|
483
|
+
let r = t.category ?? "runtime", i = t.source ?? t.category ?? "runtime", a = t.errorInfo ?? O(e), o = f(t.detail), s = async () => {
|
|
484
|
+
m({
|
|
485
|
+
type: "runtime-error",
|
|
486
|
+
detail: f({
|
|
487
|
+
category: r,
|
|
488
|
+
source: i,
|
|
489
|
+
...t.detail
|
|
490
|
+
})
|
|
491
|
+
});
|
|
492
|
+
let [e, s] = n ? await Promise.all([N(), Promise.resolve(M(n))]) : [void 0, void 0];
|
|
493
|
+
return U({
|
|
494
|
+
category: r,
|
|
495
|
+
source: i,
|
|
496
|
+
error: a,
|
|
497
|
+
react: t.componentStack ? { componentStack: t.componentStack } : void 0,
|
|
498
|
+
queryClient: s,
|
|
499
|
+
persistedQueries: e,
|
|
500
|
+
context: o
|
|
501
|
+
});
|
|
502
|
+
};
|
|
503
|
+
return typeof window > "u" ? s() : Ce({
|
|
504
|
+
category: r,
|
|
505
|
+
source: i,
|
|
506
|
+
error: a,
|
|
507
|
+
pathname: window.location.pathname,
|
|
508
|
+
scope: {
|
|
509
|
+
componentStack: t.componentStack,
|
|
510
|
+
detail: o
|
|
511
|
+
}
|
|
512
|
+
}, s);
|
|
453
513
|
}
|
|
454
514
|
//#endregion
|
|
455
515
|
//#region src/error-report/runtime.ts
|
|
456
516
|
var $;
|
|
457
|
-
function
|
|
458
|
-
$ = e;
|
|
517
|
+
function Pe(e) {
|
|
518
|
+
$ = e, we();
|
|
459
519
|
}
|
|
460
|
-
async function
|
|
520
|
+
async function Fe(e, t = {}) {
|
|
461
521
|
if ($) try {
|
|
462
522
|
await $(e, t);
|
|
463
523
|
} catch {}
|
|
464
524
|
}
|
|
465
525
|
//#endregion
|
|
466
|
-
export {
|
|
526
|
+
export { m as addErrorReportBreadcrumb, U as captureErrorReportDraft, Me as captureMutationErrorReport, je as captureQueryErrorReport, Ne as captureRuntimeErrorReport, g as clearErrorReportBreadcrumbs, j as collectMutationDiagnostics, N as collectPersistedQueryDiagnostics, M as collectQueryClientDiagnostics, A as collectQueryDiagnostics, d as createDataShape, u as createDiagnosticValue, O as createErrorInfo, h as getErrorReportBreadcrumbs, I as getErrorReportClientEnvironment, H as getErrorReportDraft, ge as getErrorReportDrafts, F as getErrorReportEnvironment, w as installErrorReportBrowserBreadcrumbs, P as isErrorReportingEnabled, ke as isTransportErrorReportScheduled, Fe as reportRuntimeError, Ae as reportTransportError, f as sanitizeDetail, Pe as setErrorReportRuntimeErrorReporter, Oe as setErrorReportTransportErrorReporter, Q as suppressTransportErrorReport, he as updateErrorReportDraft };
|
|
467
527
|
|
|
468
528
|
//# sourceMappingURL=index.js.map
|