@ryuzaki13/react-foundation-lib 1.8.3 → 2.0.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/README.md +5 -3
- package/dist/error-report/breadcrumbs.d.ts.map +1 -1
- package/dist/error-report/capture.d.ts.map +1 -1
- package/dist/error-report/diagnostics.d.ts.map +1 -1
- package/dist/error-report/drafts.d.ts +2 -11
- package/dist/error-report/drafts.d.ts.map +1 -1
- package/dist/error-report/errorInfo.d.ts.map +1 -1
- package/dist/error-report/index.d.ts +5 -0
- package/dist/error-report/index.d.ts.map +1 -1
- package/dist/error-report/index.js +920 -210
- package/dist/error-report/index.js.map +1 -1
- package/dist/error-report/payload.d.ts +13 -0
- package/dist/error-report/payload.d.ts.map +1 -0
- package/dist/error-report/queue.d.ts +15 -0
- package/dist/error-report/queue.d.ts.map +1 -0
- package/dist/error-report/queueContract.d.ts +62 -0
- package/dist/error-report/queueContract.d.ts.map +1 -0
- package/dist/error-report/queueRecord.d.ts +9 -0
- package/dist/error-report/queueRecord.d.ts.map +1 -0
- package/dist/error-report/safeValue.d.ts +26 -2
- package/dist/error-report/safeValue.d.ts.map +1 -1
- package/dist/error-report/schema.d.ts +14 -0
- package/dist/error-report/schema.d.ts.map +1 -0
- package/dist/error-report/transport.d.ts +0 -2
- package/dist/error-report/transport.d.ts.map +1 -1
- package/dist/error-report/types.d.ts +26 -1
- package/dist/error-report/types.d.ts.map +1 -1
- package/dist/pwa/index.d.ts +1 -0
- package/dist/pwa/index.d.ts.map +1 -1
- package/dist/pwa/index.js +75 -59
- package/dist/pwa/index.js.map +1 -1
- package/dist/pwa/useBrowserOnlineStatus.d.ts +3 -0
- package/dist/pwa/useBrowserOnlineStatus.d.ts.map +1 -0
- package/dist/query-client/index.js +137 -43
- package/dist/query-client/index.js.map +1 -1
- package/dist/query-client/persistence.d.ts +21 -3
- package/dist/query-client/persistence.d.ts.map +1 -1
- package/dist/query-client/queryMeta.d.ts +21 -2
- package/dist/query-client/queryMeta.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/error-report/README.mdx +133 -27
- package/src/pwa/README.mdx +4 -0
- package/src/query-client/README.mdx +48 -7
|
@@ -5,145 +5,238 @@ import { hashString128 as r, uuidv4 as i } from "../crypto/index.js";
|
|
|
5
5
|
import { an as a } from "../chunks/odata-service-CWkHASdw.js";
|
|
6
6
|
import { createIndexedDbQueryStorage as o } from "../query-client/index.js";
|
|
7
7
|
import { getSessionStorageId as s } from "../session-storage/index.js";
|
|
8
|
+
import { z as c } from "zod";
|
|
8
9
|
//#region src/error-report/safeValue.ts
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
var ee = 4, te = 20, ne = 40, l = 4096, re = "[REDACTED]", ie = [
|
|
11
|
+
"apikey",
|
|
12
|
+
"authorization",
|
|
13
|
+
"cookie",
|
|
14
|
+
"csrf",
|
|
15
|
+
"password",
|
|
16
|
+
"passwd",
|
|
17
|
+
"refreshtoken",
|
|
18
|
+
"secret",
|
|
19
|
+
"sessiontoken",
|
|
20
|
+
"token"
|
|
21
|
+
], ae = "url", u;
|
|
22
|
+
function oe(e) {
|
|
23
|
+
return e.toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
24
|
+
}
|
|
25
|
+
function se(e) {
|
|
26
|
+
let t = oe(e);
|
|
27
|
+
return ie.some((e) => t.includes(e));
|
|
28
|
+
}
|
|
29
|
+
function ce(e) {
|
|
30
|
+
return oe(e).endsWith(ae);
|
|
31
|
+
}
|
|
32
|
+
function le(e) {
|
|
33
|
+
return /^(?:https?:\/\/|\/)[^\s]*[?#]/i.test(e);
|
|
34
|
+
}
|
|
35
|
+
function ue(e) {
|
|
36
|
+
try {
|
|
37
|
+
let t = new URL(e, "https://error-report.invalid"), n = t.pathname;
|
|
38
|
+
return t.origin === "https://error-report.invalid" ? n : `${t.origin}${n}`;
|
|
39
|
+
} catch {
|
|
40
|
+
return e.split(/[?#]/, 1)[0] ?? e;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function d(e, t = l) {
|
|
44
|
+
let n = e.slice(0, t);
|
|
45
|
+
return /\bbearer\s/i.test(n) && (n = n.replace(/\bBearer\s+[A-Za-z0-9._~+/=-]{8,}/gi, "Bearer [REDACTED]")), n.includes("@") && (n = n.replace(/[A-Z0-9._%+-]{1,254}@[A-Z0-9.-]{1,253}\.[A-Z]{2,63}/gi, "[REDACTED_EMAIL]")), n;
|
|
46
|
+
}
|
|
47
|
+
function f(e) {
|
|
48
|
+
return new TextEncoder().encode(e).byteLength;
|
|
49
|
+
}
|
|
50
|
+
function p(e, t) {
|
|
51
|
+
let n = d(e, t);
|
|
52
|
+
if (f(n) <= t) return n;
|
|
53
|
+
let r = 0, i = n.length;
|
|
54
|
+
for (; r < i;) {
|
|
55
|
+
let e = Math.ceil((r + i) / 2);
|
|
56
|
+
f(n.slice(0, e)) <= t ? r = e : i = e - 1;
|
|
57
|
+
}
|
|
58
|
+
let a = n.charCodeAt(r - 1), o = a >= 55296 && a <= 56319 ? r - 1 : r;
|
|
59
|
+
return n.slice(0, o);
|
|
60
|
+
}
|
|
61
|
+
function m(e, t, n, r) {
|
|
62
|
+
if (r && se(r)) return re;
|
|
63
|
+
if (t >= ee) return { type: "truncated" };
|
|
64
|
+
if (e === null || typeof e == "boolean") return e;
|
|
65
|
+
if (typeof e == "number") return Number.isFinite(e) ? e : { type: "non-finite-number" };
|
|
66
|
+
if (typeof e == "string") return d(r && ce(r) || le(e) ? ue(e) : e, n.maxStringLength);
|
|
13
67
|
if (e === void 0) return { type: "undefined" };
|
|
14
|
-
if (e instanceof Date) return e.toISOString();
|
|
15
|
-
if (Array.isArray(e)) return e.slice(0, ee).map((e) => u(e, t + 1));
|
|
68
|
+
if (e instanceof Date) return Number.isNaN(e.getTime()) ? { type: "invalid-date" } : e.toISOString();
|
|
16
69
|
if (typeof e == "object") {
|
|
17
|
-
|
|
18
|
-
|
|
70
|
+
if (n.seen.has(e)) return { type: "circular" };
|
|
71
|
+
n.seen.add(e);
|
|
72
|
+
}
|
|
73
|
+
if (Array.isArray(e)) return e.slice(0, te).map((e) => m(e, t + 1, n));
|
|
74
|
+
if (typeof e == "object") try {
|
|
75
|
+
let r = Object.entries(e).sort(([e], [t]) => e.localeCompare(t)).slice(0, ne);
|
|
76
|
+
return Object.fromEntries(r.map(([e, r]) => [e, m(r, t + 1, n, e)]));
|
|
77
|
+
} catch {
|
|
78
|
+
return { type: "unreadable" };
|
|
19
79
|
}
|
|
20
80
|
return typeof e == "function" ? { type: "function" } : typeof e == "symbol" ? { type: "symbol" } : typeof e == "bigint" ? e.toString() : { type: "unknown" };
|
|
21
81
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
82
|
+
function de(e, t = 0) {
|
|
83
|
+
return m(e, t, {
|
|
84
|
+
seen: /* @__PURE__ */ new WeakSet(),
|
|
85
|
+
maxStringLength: l
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
function h(e, t = 0) {
|
|
89
|
+
if (t >= ee) return { type: "truncated" };
|
|
24
90
|
if (e === null) return { type: "null" };
|
|
25
91
|
if (e === void 0) return { type: "undefined" };
|
|
26
92
|
if (Array.isArray(e)) return {
|
|
27
93
|
type: "array",
|
|
28
94
|
length: e.length,
|
|
29
|
-
firstItemsShape: e.slice(0, 3).map((e) =>
|
|
95
|
+
firstItemsShape: e.slice(0, 3).map((e) => h(e, t + 1))
|
|
30
96
|
};
|
|
31
97
|
if (typeof e == "object") {
|
|
32
|
-
let n = Object.entries(e).slice(0,
|
|
98
|
+
let n = Object.entries(e).slice(0, ne);
|
|
33
99
|
return {
|
|
34
100
|
type: "object",
|
|
35
101
|
keys: n.map(([e]) => e),
|
|
36
|
-
shape: Object.fromEntries(n.map(([e, n]) => [e,
|
|
102
|
+
shape: Object.fromEntries(n.map(([e, n]) => [e, h(n, t + 1)]))
|
|
37
103
|
};
|
|
38
104
|
}
|
|
39
105
|
return { type: typeof e };
|
|
40
106
|
}
|
|
41
|
-
function
|
|
107
|
+
function fe(e) {
|
|
108
|
+
u = e;
|
|
109
|
+
}
|
|
110
|
+
function g(e, t, n = l) {
|
|
111
|
+
let r = (e) => m(e, 0, {
|
|
112
|
+
seen: /* @__PURE__ */ new WeakSet(),
|
|
113
|
+
maxStringLength: n
|
|
114
|
+
}), i = r(e);
|
|
115
|
+
if (!u) return i;
|
|
116
|
+
try {
|
|
117
|
+
let e = u(i, t);
|
|
118
|
+
return e === void 0 ? void 0 : r(e);
|
|
119
|
+
} catch {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function _(e, t = { scope: "context" }) {
|
|
42
124
|
if (!e) return;
|
|
43
|
-
let
|
|
44
|
-
|
|
125
|
+
let n = g(e, t);
|
|
126
|
+
if (!(!n || Array.isArray(n) || typeof n != "object")) return Object.keys(n).length ? n : void 0;
|
|
45
127
|
}
|
|
46
128
|
//#endregion
|
|
47
129
|
//#region src/error-report/breadcrumbs.ts
|
|
48
|
-
var
|
|
130
|
+
var pe = 20, me = 120, he = [
|
|
49
131
|
"button",
|
|
50
132
|
"a",
|
|
51
133
|
"input",
|
|
52
134
|
"select",
|
|
53
135
|
"textarea",
|
|
54
136
|
"[role]",
|
|
55
|
-
"[
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"[data-action]"
|
|
59
|
-
].join(","), p = [];
|
|
60
|
-
function ae() {
|
|
137
|
+
"[data-error-report-target]"
|
|
138
|
+
].join(","), ge = /^[a-z0-9][a-z0-9._:/-]*$/i, v = [];
|
|
139
|
+
function _e() {
|
|
61
140
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
62
141
|
}
|
|
63
|
-
function
|
|
64
|
-
|
|
142
|
+
function y(e) {
|
|
143
|
+
v = [...v, {
|
|
65
144
|
...e,
|
|
66
|
-
utc: e.utc ??
|
|
145
|
+
utc: d(e.utc ?? _e(), 64),
|
|
146
|
+
routeId: e.routeId ? d(e.routeId.split(/[?#]/, 1)[0] ?? e.routeId, 512) : void 0,
|
|
147
|
+
appId: e.appId ? d(e.appId, 128) : void 0,
|
|
148
|
+
viewId: e.viewId ? d(e.viewId, 128) : void 0,
|
|
149
|
+
target: e.target ? d(e.target, 2048) : void 0,
|
|
150
|
+
detail: _(e.detail, {
|
|
151
|
+
scope: "breadcrumb-detail",
|
|
152
|
+
source: e.type
|
|
153
|
+
})
|
|
67
154
|
}].slice(-80);
|
|
68
155
|
}
|
|
69
|
-
function
|
|
70
|
-
return
|
|
156
|
+
function ve() {
|
|
157
|
+
return v.slice();
|
|
158
|
+
}
|
|
159
|
+
function ye() {
|
|
160
|
+
v = [];
|
|
71
161
|
}
|
|
72
|
-
function
|
|
73
|
-
|
|
162
|
+
function be(t) {
|
|
163
|
+
return e(t, me);
|
|
74
164
|
}
|
|
75
|
-
function
|
|
76
|
-
|
|
165
|
+
function xe(e) {
|
|
166
|
+
let t = be(e.getAttribute("data-error-report-target"));
|
|
167
|
+
return t && ge.test(t) ? t : void 0;
|
|
168
|
+
}
|
|
169
|
+
function Se(e, t) {
|
|
170
|
+
let n = be(e.getAttribute(t));
|
|
171
|
+
return n && ge.test(n) ? n : void 0;
|
|
77
172
|
}
|
|
78
|
-
function
|
|
173
|
+
function Ce(e) {
|
|
79
174
|
return {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
title: _(e.getAttribute("title")),
|
|
84
|
-
ariaLabel: _(e.getAttribute("aria-label")),
|
|
85
|
-
dataUi: _(e.getAttribute("data-ui")),
|
|
86
|
-
dataAction: _(e.getAttribute("data-action"))
|
|
175
|
+
role: Se(e, "role"),
|
|
176
|
+
type: Se(e, "type"),
|
|
177
|
+
errorReportTarget: xe(e)
|
|
87
178
|
};
|
|
88
179
|
}
|
|
89
|
-
function
|
|
90
|
-
if (!(t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement || t instanceof HTMLSelectElement) && t.matches("button,a,[role],[aria-label],[title]")) return e(t.textContent, ne);
|
|
91
|
-
}
|
|
92
|
-
function se(e) {
|
|
180
|
+
function we(e) {
|
|
93
181
|
return typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/["\\#.[\]>~+:]/g, "\\$&");
|
|
94
182
|
}
|
|
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("");
|
|
98
|
-
}
|
|
99
183
|
function b(e) {
|
|
100
|
-
let t =
|
|
184
|
+
let t = Ce(e), n = [e.tagName.toLowerCase()];
|
|
185
|
+
return t.role && n.push(`[role="${t.role}"]`), t.type && n.push(`[type="${t.type}"]`), t.errorReportTarget && n.push(`[data-error-report-target="${we(t.errorReportTarget)}"]`), n.join("");
|
|
186
|
+
}
|
|
187
|
+
function Te(e) {
|
|
188
|
+
let t = Ce(e);
|
|
101
189
|
return {
|
|
102
190
|
tag: e.tagName.toLowerCase(),
|
|
103
|
-
selector:
|
|
104
|
-
text: oe(e),
|
|
191
|
+
selector: b(e),
|
|
105
192
|
...t
|
|
106
193
|
};
|
|
107
194
|
}
|
|
108
|
-
function
|
|
195
|
+
function Ee(e) {
|
|
109
196
|
return Object.fromEntries(Object.entries(e).filter(([, e]) => e !== void 0 && (!Array.isArray(e) || e.length > 0)));
|
|
110
197
|
}
|
|
111
|
-
function
|
|
198
|
+
function De(e) {
|
|
112
199
|
let t = [], n = e;
|
|
113
|
-
for (; n && n !== document.documentElement && t.length <
|
|
200
|
+
for (; n && n !== document.documentElement && t.length < pe && (t.push(n), n !== document.body);) n = n.parentElement;
|
|
114
201
|
return t;
|
|
115
202
|
}
|
|
116
|
-
function
|
|
117
|
-
return e.closest(
|
|
203
|
+
function Oe(e) {
|
|
204
|
+
return e.closest(he) ?? e;
|
|
118
205
|
}
|
|
119
|
-
function
|
|
120
|
-
if (e instanceof Element) return
|
|
206
|
+
function ke(e) {
|
|
207
|
+
if (e instanceof Element) return De(Oe(e)).map((e) => b(e)).join(" > ");
|
|
121
208
|
}
|
|
122
|
-
function
|
|
123
|
-
let t = e.target instanceof Element ? e.target : void 0, n = t ?
|
|
124
|
-
return
|
|
209
|
+
function Ae(e) {
|
|
210
|
+
let t = e.target instanceof Element ? e.target : void 0, n = t ? Oe(t) : void 0, r = n ? De(n).map((e) => Ee(Te(e))) : [];
|
|
211
|
+
return _({
|
|
125
212
|
button: e.button,
|
|
126
213
|
ctrlKey: e.ctrlKey,
|
|
127
214
|
shiftKey: e.shiftKey,
|
|
128
215
|
altKey: e.altKey,
|
|
129
216
|
clientX: e.clientX,
|
|
130
217
|
clientY: e.clientY,
|
|
131
|
-
target: n ?
|
|
218
|
+
target: n ? Ee(Te(n)) : void 0,
|
|
132
219
|
chain: r
|
|
220
|
+
}, {
|
|
221
|
+
scope: "breadcrumb-detail",
|
|
222
|
+
source: "click"
|
|
133
223
|
});
|
|
134
224
|
}
|
|
135
|
-
function
|
|
225
|
+
function je() {
|
|
136
226
|
if (typeof window > "u") return () => void 0;
|
|
137
227
|
let e = (e) => {
|
|
138
|
-
|
|
228
|
+
y({
|
|
139
229
|
type: "click",
|
|
140
|
-
target:
|
|
141
|
-
detail:
|
|
230
|
+
target: ke(e.target),
|
|
231
|
+
detail: Ae(e)
|
|
142
232
|
});
|
|
143
233
|
}, t = () => {
|
|
144
|
-
|
|
234
|
+
y({
|
|
145
235
|
type: "visibility",
|
|
146
|
-
detail:
|
|
236
|
+
detail: _({ visibilityState: document.visibilityState }, {
|
|
237
|
+
scope: "breadcrumb-detail",
|
|
238
|
+
source: "visibility"
|
|
239
|
+
})
|
|
147
240
|
});
|
|
148
241
|
};
|
|
149
242
|
return window.addEventListener("click", e, !0), document.addEventListener("visibilitychange", t), () => {
|
|
@@ -151,58 +244,247 @@ function w() {
|
|
|
151
244
|
};
|
|
152
245
|
}
|
|
153
246
|
//#endregion
|
|
247
|
+
//#region src/error-report/payload.ts
|
|
248
|
+
var Me = 1, x = 262144, S = 65536, Ne = 32768, Pe = 256, Fe = 128, Ie = 2048;
|
|
249
|
+
function Le(e) {
|
|
250
|
+
return new TextEncoder().encode(JSON.stringify(e)).byteLength;
|
|
251
|
+
}
|
|
252
|
+
function Re(e) {
|
|
253
|
+
return d(e.split(/[?#]/, 1)[0] ?? e, Ie);
|
|
254
|
+
}
|
|
255
|
+
function C(e, t, n, r = "characters") {
|
|
256
|
+
let i = g(r === "bytes" ? p(e, n) : d(e, n), t, n);
|
|
257
|
+
if (typeof i == "string") return r === "bytes" ? p(i, n) : d(i, n);
|
|
258
|
+
}
|
|
259
|
+
function w(e, t) {
|
|
260
|
+
return {
|
|
261
|
+
name: d(e.name, 256),
|
|
262
|
+
message: C(e.message, {
|
|
263
|
+
scope: "error-message",
|
|
264
|
+
source: t
|
|
265
|
+
}, 4096) ?? "[REDACTED]",
|
|
266
|
+
code: e.code ? d(e.code, 128) : void 0,
|
|
267
|
+
stackTrace: e.stackTrace ? C(e.stackTrace, {
|
|
268
|
+
scope: "stack-trace",
|
|
269
|
+
source: t
|
|
270
|
+
}, S, "bytes") : void 0,
|
|
271
|
+
httpStatus: e.httpStatus
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
function ze(e) {
|
|
275
|
+
return {
|
|
276
|
+
...e,
|
|
277
|
+
queryHash: d(e.queryHash, 512),
|
|
278
|
+
queryKey: g(e.queryKey, {
|
|
279
|
+
scope: "query-key",
|
|
280
|
+
source: e.queryHash
|
|
281
|
+
}) ?? { type: "redacted" },
|
|
282
|
+
meta: _(e.meta, {
|
|
283
|
+
scope: "query-meta",
|
|
284
|
+
source: e.queryHash
|
|
285
|
+
}),
|
|
286
|
+
dataShape: e.dataShape ? g(e.dataShape, {
|
|
287
|
+
scope: "query-data-shape",
|
|
288
|
+
source: e.queryHash
|
|
289
|
+
}) : void 0,
|
|
290
|
+
error: e.error ? w(e.error, e.queryHash) : void 0
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
function Be(e) {
|
|
294
|
+
return {
|
|
295
|
+
...e,
|
|
296
|
+
mutationKey: e.mutationKey ? g(e.mutationKey, { scope: "mutation-key" }) : void 0,
|
|
297
|
+
meta: _(e.meta, { scope: "mutation-meta" }),
|
|
298
|
+
error: e.error ? w(e.error, "mutation") : void 0
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
function Ve(e) {
|
|
302
|
+
return {
|
|
303
|
+
...e,
|
|
304
|
+
buster: e.buster ? d(e.buster, 512) : void 0,
|
|
305
|
+
queryHash: e.queryHash ? d(e.queryHash, 512) : void 0,
|
|
306
|
+
queryKey: e.queryKey ? g(e.queryKey, {
|
|
307
|
+
scope: "persisted-query-key",
|
|
308
|
+
source: e.queryHash
|
|
309
|
+
}) : void 0,
|
|
310
|
+
error: e.error ? w(e.error, e.queryHash) : void 0
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
function T(e) {
|
|
314
|
+
return Le(e);
|
|
315
|
+
}
|
|
316
|
+
function He(e) {
|
|
317
|
+
return {
|
|
318
|
+
...e,
|
|
319
|
+
reportId: d(e.reportId, 128),
|
|
320
|
+
sessionId: d(e.sessionId, 128),
|
|
321
|
+
createdUtc: d(e.createdUtc, 64),
|
|
322
|
+
application: d(e.application, Fe),
|
|
323
|
+
source: d(e.source, Pe),
|
|
324
|
+
error: w(e.error, e.source),
|
|
325
|
+
environment: {
|
|
326
|
+
...e.environment,
|
|
327
|
+
buildId: e.environment.buildId ? d(e.environment.buildId, 128) : void 0
|
|
328
|
+
},
|
|
329
|
+
client: e.client ? {
|
|
330
|
+
userAgent: e.client.userAgent ? d(e.client.userAgent) : void 0,
|
|
331
|
+
language: e.client.language ? d(e.client.language, 128) : void 0,
|
|
332
|
+
timeZone: e.client.timeZone ? d(e.client.timeZone, 128) : void 0
|
|
333
|
+
} : void 0,
|
|
334
|
+
location: e.location ? {
|
|
335
|
+
pathname: Re(e.location.pathname),
|
|
336
|
+
origin: e.location.origin ? d(e.location.origin.split(/[?#]/, 1)[0] ?? e.location.origin, Ie) : void 0
|
|
337
|
+
} : void 0,
|
|
338
|
+
react: e.react?.componentStack ? { componentStack: C(e.react.componentStack, {
|
|
339
|
+
scope: "stack-trace",
|
|
340
|
+
source: "react-component-stack"
|
|
341
|
+
}, Ne, "bytes") } : void 0,
|
|
342
|
+
query: e.query ? ze(e.query) : void 0,
|
|
343
|
+
mutation: e.mutation ? Be(e.mutation) : void 0,
|
|
344
|
+
queryClient: e.queryClient ? {
|
|
345
|
+
queries: e.queryClient.queries.slice(-40).map(ze),
|
|
346
|
+
mutations: e.queryClient.mutations.slice(-40).map(Be)
|
|
347
|
+
} : void 0,
|
|
348
|
+
persistedQueries: e.persistedQueries?.slice(-40).map(Ve),
|
|
349
|
+
breadcrumbs: e.breadcrumbs.slice(-80).map((e) => ({
|
|
350
|
+
...e,
|
|
351
|
+
utc: d(e.utc, 64),
|
|
352
|
+
routeId: e.routeId ? d(e.routeId, 512) : void 0,
|
|
353
|
+
appId: e.appId ? d(e.appId, 128) : void 0,
|
|
354
|
+
viewId: e.viewId ? d(e.viewId, 128) : void 0,
|
|
355
|
+
target: e.target ? d(e.target, 2048) : void 0,
|
|
356
|
+
detail: _(e.detail, {
|
|
357
|
+
scope: "breadcrumb-detail",
|
|
358
|
+
source: e.type
|
|
359
|
+
})
|
|
360
|
+
})),
|
|
361
|
+
context: _(e.context, {
|
|
362
|
+
scope: "context",
|
|
363
|
+
source: e.source
|
|
364
|
+
})
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
function Ue(e) {
|
|
368
|
+
let t = He(e), n = T(t);
|
|
369
|
+
if (n <= 262144) return t;
|
|
370
|
+
let r = [], i = {
|
|
371
|
+
...t,
|
|
372
|
+
truncation: {
|
|
373
|
+
reason: "payload-size",
|
|
374
|
+
limitBytes: x,
|
|
375
|
+
originalBytes: n,
|
|
376
|
+
droppedSections: r
|
|
377
|
+
}
|
|
378
|
+
}, a = (e, t, n) => {
|
|
379
|
+
!t(i) || T(i) <= 262144 || (r.push(e), i = n(i));
|
|
380
|
+
};
|
|
381
|
+
return a("queryClient", (e) => e.queryClient !== void 0, (e) => ({
|
|
382
|
+
...e,
|
|
383
|
+
queryClient: void 0
|
|
384
|
+
})), a("persistedQueries", (e) => e.persistedQueries !== void 0, (e) => ({
|
|
385
|
+
...e,
|
|
386
|
+
persistedQueries: void 0
|
|
387
|
+
})), a("context", (e) => e.context !== void 0, (e) => ({
|
|
388
|
+
...e,
|
|
389
|
+
context: void 0
|
|
390
|
+
})), a("query.meta", (e) => e.query?.meta !== void 0, (e) => ({
|
|
391
|
+
...e,
|
|
392
|
+
query: e.query ? {
|
|
393
|
+
...e.query,
|
|
394
|
+
meta: void 0
|
|
395
|
+
} : void 0
|
|
396
|
+
})), a("query.dataShape", (e) => e.query?.dataShape !== void 0, (e) => ({
|
|
397
|
+
...e,
|
|
398
|
+
query: e.query ? {
|
|
399
|
+
...e.query,
|
|
400
|
+
dataShape: void 0
|
|
401
|
+
} : void 0
|
|
402
|
+
})), a("mutation.meta", (e) => e.mutation?.meta !== void 0, (e) => ({
|
|
403
|
+
...e,
|
|
404
|
+
mutation: e.mutation ? {
|
|
405
|
+
...e.mutation,
|
|
406
|
+
meta: void 0
|
|
407
|
+
} : void 0
|
|
408
|
+
})), a("breadcrumbs:oldest", (e) => e.breadcrumbs.length > 20, (e) => ({
|
|
409
|
+
...e,
|
|
410
|
+
breadcrumbs: e.breadcrumbs.slice(-20)
|
|
411
|
+
})), a("query", (e) => e.query !== void 0, (e) => ({
|
|
412
|
+
...e,
|
|
413
|
+
query: void 0
|
|
414
|
+
})), a("mutation", (e) => e.mutation !== void 0, (e) => ({
|
|
415
|
+
...e,
|
|
416
|
+
mutation: void 0
|
|
417
|
+
})), a("react", (e) => e.react !== void 0, (e) => ({
|
|
418
|
+
...e,
|
|
419
|
+
react: void 0
|
|
420
|
+
})), a("breadcrumbs", (e) => e.breadcrumbs.length > 0, (e) => ({
|
|
421
|
+
...e,
|
|
422
|
+
breadcrumbs: []
|
|
423
|
+
})), a("client", (e) => e.client !== void 0, (e) => ({
|
|
424
|
+
...e,
|
|
425
|
+
client: void 0
|
|
426
|
+
})), a("viewport", (e) => e.viewport !== void 0, (e) => ({
|
|
427
|
+
...e,
|
|
428
|
+
viewport: void 0
|
|
429
|
+
})), i;
|
|
430
|
+
}
|
|
431
|
+
//#endregion
|
|
154
432
|
//#region src/error-report/errorInfo.ts
|
|
155
|
-
var
|
|
433
|
+
var We = "Неизвестная ошибка";
|
|
156
434
|
function E(e) {
|
|
157
|
-
return t(e) ? e :
|
|
435
|
+
return t(e) ? d(e) : We;
|
|
158
436
|
}
|
|
159
437
|
function D(e) {
|
|
160
438
|
let t = e.status ?? e.statusCode ?? e.httpStatus;
|
|
161
439
|
return typeof t == "number" && Number.isFinite(t) ? t : void 0;
|
|
162
440
|
}
|
|
163
|
-
function
|
|
441
|
+
function Ge(e) {
|
|
164
442
|
if (!e || typeof e != "object") return null;
|
|
165
443
|
let n = e.appError;
|
|
166
444
|
if (!n || typeof n != "object") return null;
|
|
167
445
|
let r = n, i = t(r.message);
|
|
168
446
|
return i ? {
|
|
169
447
|
name: "AppError",
|
|
170
|
-
message: i,
|
|
171
|
-
code: t(r.code),
|
|
448
|
+
message: d(i),
|
|
449
|
+
code: t(r.code) ? d(String(r.code), 128) : void 0,
|
|
172
450
|
httpStatus: D(r)
|
|
173
451
|
} : null;
|
|
174
452
|
}
|
|
175
453
|
function O(e) {
|
|
176
|
-
let t =
|
|
454
|
+
let t = Ge(e);
|
|
177
455
|
if (t) return t;
|
|
178
456
|
if (e instanceof Error) return {
|
|
179
|
-
name: e.name || "Error",
|
|
457
|
+
name: d(e.name || "Error", 256),
|
|
180
458
|
message: E(e.message),
|
|
181
|
-
stackTrace: e.stack
|
|
459
|
+
stackTrace: e.stack ? p(e.stack, S) : void 0
|
|
182
460
|
};
|
|
183
461
|
if (e && typeof e == "object") {
|
|
184
462
|
let t = e;
|
|
185
463
|
return {
|
|
186
|
-
name: typeof t.name == "string" ? t.name : "Error",
|
|
464
|
+
name: d(typeof t.name == "string" ? t.name : "Error", 256),
|
|
187
465
|
message: E(typeof t.message == "string" ? t.message : String(e)),
|
|
188
|
-
stackTrace: typeof t.stack == "string" ? t.stack : void 0,
|
|
466
|
+
stackTrace: typeof t.stack == "string" ? p(t.stack, S) : void 0,
|
|
189
467
|
httpStatus: D(t)
|
|
190
468
|
};
|
|
191
469
|
}
|
|
192
470
|
return {
|
|
193
471
|
name: "Error",
|
|
194
|
-
message: E(typeof e == "string" ? e : String(e ??
|
|
472
|
+
message: E(typeof e == "string" ? e : String(e ?? We))
|
|
195
473
|
};
|
|
196
474
|
}
|
|
197
475
|
//#endregion
|
|
198
476
|
//#region src/error-report/diagnostics.ts
|
|
199
|
-
function
|
|
200
|
-
return
|
|
477
|
+
function Ke(e, t, n) {
|
|
478
|
+
return _(e, {
|
|
479
|
+
scope: t,
|
|
480
|
+
source: n
|
|
481
|
+
});
|
|
201
482
|
}
|
|
202
|
-
function
|
|
483
|
+
function k(e) {
|
|
484
|
+
let t = g(e.queryKey, { scope: "query-key" }) ?? { type: "redacted" }, i = r(n(t));
|
|
203
485
|
return {
|
|
204
|
-
queryHash:
|
|
205
|
-
queryKey:
|
|
486
|
+
queryHash: i,
|
|
487
|
+
queryKey: t,
|
|
206
488
|
status: e.state.status,
|
|
207
489
|
fetchStatus: e.state.fetchStatus,
|
|
208
490
|
dataUpdatedAt: e.state.dataUpdatedAt,
|
|
@@ -210,64 +492,66 @@ function A(e) {
|
|
|
210
492
|
failureCount: e.state.fetchFailureCount,
|
|
211
493
|
isInvalidated: e.state.isInvalidated,
|
|
212
494
|
observersCount: e.getObserversCount(),
|
|
213
|
-
meta:
|
|
214
|
-
dataShape:
|
|
495
|
+
meta: Ke(e.meta, "query-meta", i),
|
|
496
|
+
dataShape: g(h(e.state.data), {
|
|
497
|
+
scope: "query-data-shape",
|
|
498
|
+
source: i
|
|
499
|
+
}),
|
|
215
500
|
error: e.state.error ? O(e.state.error) : void 0
|
|
216
501
|
};
|
|
217
502
|
}
|
|
218
|
-
function
|
|
503
|
+
function A(e) {
|
|
219
504
|
return {
|
|
220
|
-
mutationKey: e.options.mutationKey ?
|
|
505
|
+
mutationKey: e.options.mutationKey ? g(e.options.mutationKey, { scope: "mutation-key" }) : void 0,
|
|
221
506
|
status: e.state.status,
|
|
222
507
|
failureCount: e.state.failureCount,
|
|
223
508
|
submittedAt: e.state.submittedAt,
|
|
224
|
-
meta:
|
|
509
|
+
meta: Ke(e.meta, "mutation-meta"),
|
|
225
510
|
error: e.state.error ? O(e.state.error) : void 0
|
|
226
511
|
};
|
|
227
512
|
}
|
|
228
|
-
function
|
|
513
|
+
function j(e) {
|
|
229
514
|
return {
|
|
230
|
-
queries: e.getQueryCache().getAll().slice(-40).map(
|
|
231
|
-
mutations: e.getMutationCache().getAll().slice(-40).map(
|
|
515
|
+
queries: e.getQueryCache().getAll().slice(-40).map(k),
|
|
516
|
+
mutations: e.getMutationCache().getAll().slice(-40).map(A)
|
|
232
517
|
};
|
|
233
518
|
}
|
|
234
|
-
function
|
|
235
|
-
let
|
|
519
|
+
function qe(e) {
|
|
520
|
+
let t = e.state, i = g(e.queryKey, { scope: "persisted-query-key" }), a = i ? r(n(i)) : void 0;
|
|
236
521
|
return {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
error: n.error ? O(n.error) : void 0
|
|
522
|
+
buster: e.buster ? d(e.buster, 512) : void 0,
|
|
523
|
+
queryHash: a,
|
|
524
|
+
queryKey: i,
|
|
525
|
+
status: t.status,
|
|
526
|
+
fetchStatus: t.fetchStatus,
|
|
527
|
+
dataUpdatedAt: t.dataUpdatedAt,
|
|
528
|
+
errorUpdatedAt: t.errorUpdatedAt,
|
|
529
|
+
failureCount: t.fetchFailureCount,
|
|
530
|
+
error: t.error ? O(t.error) : void 0
|
|
247
531
|
};
|
|
248
532
|
}
|
|
249
|
-
async function
|
|
533
|
+
async function M() {
|
|
250
534
|
let e = o();
|
|
251
535
|
if (!e?.entries) return [];
|
|
252
536
|
try {
|
|
253
|
-
return (await e.entries()).slice(-40).map(([
|
|
537
|
+
return (await e.entries()).slice(-40).map(([, e]) => qe(e));
|
|
254
538
|
} catch {
|
|
255
539
|
return [];
|
|
256
540
|
}
|
|
257
541
|
}
|
|
258
542
|
//#endregion
|
|
259
543
|
//#region src/error-report/environment.ts
|
|
260
|
-
function
|
|
544
|
+
function Je(e = {}) {
|
|
261
545
|
let t = e.isDev ?? __DEV__;
|
|
262
546
|
return typeof window < "u" && !t;
|
|
263
547
|
}
|
|
264
|
-
function
|
|
548
|
+
function Ye() {
|
|
265
549
|
return {
|
|
266
550
|
mode: __DEV__ ? "development" : "production",
|
|
267
551
|
buildId: typeof __APP_BUILD_ID__ == "string" ? __APP_BUILD_ID__ : void 0
|
|
268
552
|
};
|
|
269
553
|
}
|
|
270
|
-
function
|
|
554
|
+
function Xe() {
|
|
271
555
|
if (!(typeof window > "u")) return {
|
|
272
556
|
userAgent: window.navigator.userAgent,
|
|
273
557
|
language: window.navigator.language,
|
|
@@ -275,135 +559,312 @@ function I() {
|
|
|
275
559
|
};
|
|
276
560
|
}
|
|
277
561
|
//#endregion
|
|
562
|
+
//#region src/error-report/schema.ts
|
|
563
|
+
var N = c.lazy(() => c.union([
|
|
564
|
+
c.string().max(4096),
|
|
565
|
+
c.number().finite(),
|
|
566
|
+
c.boolean(),
|
|
567
|
+
c.null(),
|
|
568
|
+
c.array(N).max(20),
|
|
569
|
+
c.record(c.string(), N).refine((e) => Object.keys(e).length <= 40)
|
|
570
|
+
])), P = c.record(c.string(), N).refine((e) => Object.keys(e).length <= 40), F = c.object({
|
|
571
|
+
name: c.string().min(1).max(256),
|
|
572
|
+
message: c.string().min(1).max(4096),
|
|
573
|
+
code: c.string().max(128).optional(),
|
|
574
|
+
stackTrace: c.string().refine((e) => f(e) <= 65536).optional(),
|
|
575
|
+
httpStatus: c.number().finite().optional()
|
|
576
|
+
}).strict(), Ze = c.object({
|
|
577
|
+
utc: c.string().min(1).max(64),
|
|
578
|
+
type: c.enum([
|
|
579
|
+
"route",
|
|
580
|
+
"click",
|
|
581
|
+
"visibility",
|
|
582
|
+
"query-error",
|
|
583
|
+
"mutation-error",
|
|
584
|
+
"runtime-error"
|
|
585
|
+
]),
|
|
586
|
+
routeId: c.string().max(512).optional(),
|
|
587
|
+
appId: c.string().max(128).optional(),
|
|
588
|
+
viewId: c.string().max(128).optional(),
|
|
589
|
+
target: c.string().max(2048).optional(),
|
|
590
|
+
detail: P.optional()
|
|
591
|
+
}).strict(), Qe = c.object({
|
|
592
|
+
queryHash: c.string().max(512),
|
|
593
|
+
queryKey: N,
|
|
594
|
+
status: c.string().max(64).optional(),
|
|
595
|
+
fetchStatus: c.string().max(64).optional(),
|
|
596
|
+
dataUpdatedAt: c.number().finite().optional(),
|
|
597
|
+
errorUpdatedAt: c.number().finite().optional(),
|
|
598
|
+
failureCount: c.number().finite().optional(),
|
|
599
|
+
isInvalidated: c.boolean().optional(),
|
|
600
|
+
observersCount: c.number().finite().optional(),
|
|
601
|
+
meta: P.optional(),
|
|
602
|
+
dataShape: N.optional(),
|
|
603
|
+
error: F.optional()
|
|
604
|
+
}).strict(), $e = c.object({
|
|
605
|
+
mutationKey: N.optional(),
|
|
606
|
+
status: c.string().max(64).optional(),
|
|
607
|
+
failureCount: c.number().finite().optional(),
|
|
608
|
+
submittedAt: c.number().finite().optional(),
|
|
609
|
+
meta: P.optional(),
|
|
610
|
+
error: F.optional()
|
|
611
|
+
}).strict(), et = c.object({
|
|
612
|
+
buster: c.string().max(512).optional(),
|
|
613
|
+
queryHash: c.string().max(512).optional(),
|
|
614
|
+
queryKey: N.optional(),
|
|
615
|
+
status: c.string().max(64).optional(),
|
|
616
|
+
fetchStatus: c.string().max(64).optional(),
|
|
617
|
+
dataUpdatedAt: c.number().finite().optional(),
|
|
618
|
+
errorUpdatedAt: c.number().finite().optional(),
|
|
619
|
+
failureCount: c.number().finite().optional(),
|
|
620
|
+
error: F.optional()
|
|
621
|
+
}).strict(), tt = c.object({
|
|
622
|
+
payloadVersion: c.literal(1),
|
|
623
|
+
application: c.string().min(1).max(128),
|
|
624
|
+
reportId: c.string().uuid(),
|
|
625
|
+
sessionId: c.string().uuid(),
|
|
626
|
+
createdUtc: c.string().min(1).max(64),
|
|
627
|
+
category: c.enum([
|
|
628
|
+
"query",
|
|
629
|
+
"mutation",
|
|
630
|
+
"runtime",
|
|
631
|
+
"react"
|
|
632
|
+
]),
|
|
633
|
+
source: c.string().min(1).max(256),
|
|
634
|
+
error: F,
|
|
635
|
+
environment: c.object({
|
|
636
|
+
mode: c.enum(["development", "production"]),
|
|
637
|
+
buildId: c.string().max(128).optional()
|
|
638
|
+
}).strict(),
|
|
639
|
+
client: c.object({
|
|
640
|
+
userAgent: c.string().max(4096).optional(),
|
|
641
|
+
language: c.string().max(128).optional(),
|
|
642
|
+
timeZone: c.string().max(128).optional()
|
|
643
|
+
}).strict().optional(),
|
|
644
|
+
location: c.object({
|
|
645
|
+
pathname: c.string().max(2048),
|
|
646
|
+
origin: c.string().max(2048).optional()
|
|
647
|
+
}).strict().optional(),
|
|
648
|
+
viewport: c.object({
|
|
649
|
+
width: c.number().finite(),
|
|
650
|
+
height: c.number().finite(),
|
|
651
|
+
devicePixelRatio: c.number().finite().optional()
|
|
652
|
+
}).strict().optional(),
|
|
653
|
+
react: c.object({ componentStack: c.string().refine((e) => f(e) <= 32768).optional() }).strict().optional(),
|
|
654
|
+
query: Qe.optional(),
|
|
655
|
+
mutation: $e.optional(),
|
|
656
|
+
queryClient: c.object({
|
|
657
|
+
queries: c.array(Qe).max(40),
|
|
658
|
+
mutations: c.array($e).max(40)
|
|
659
|
+
}).strict().optional(),
|
|
660
|
+
persistedQueries: c.array(et).max(40).optional(),
|
|
661
|
+
breadcrumbs: c.array(Ze).max(80),
|
|
662
|
+
context: P.optional(),
|
|
663
|
+
truncation: c.object({
|
|
664
|
+
reason: c.literal("payload-size"),
|
|
665
|
+
limitBytes: c.literal(x),
|
|
666
|
+
originalBytes: c.number().int().positive(),
|
|
667
|
+
droppedSections: c.array(c.string().max(128)).max(32)
|
|
668
|
+
}).strict().optional()
|
|
669
|
+
}).strict().refine((e) => T(e) <= x), nt = c.object({
|
|
670
|
+
reportId: c.string().uuid(),
|
|
671
|
+
sessionId: c.string().uuid(),
|
|
672
|
+
createdUtc: c.string().min(1).max(64),
|
|
673
|
+
category: c.enum([
|
|
674
|
+
"query",
|
|
675
|
+
"mutation",
|
|
676
|
+
"runtime",
|
|
677
|
+
"react"
|
|
678
|
+
]),
|
|
679
|
+
status: c.enum([
|
|
680
|
+
"pending",
|
|
681
|
+
"sending",
|
|
682
|
+
"sent",
|
|
683
|
+
"failed"
|
|
684
|
+
]),
|
|
685
|
+
sentUtc: c.string().min(1).max(64).optional(),
|
|
686
|
+
failedReason: c.string().max(4096).optional(),
|
|
687
|
+
payload: tt
|
|
688
|
+
}).strict().superRefine((e, t) => {
|
|
689
|
+
(e.reportId !== e.payload.reportId || e.sessionId !== e.payload.sessionId || e.createdUtc !== e.payload.createdUtc || e.category !== e.payload.category) && t.addIssue({
|
|
690
|
+
code: "custom",
|
|
691
|
+
message: "Draft identity должна совпадать с payload identity."
|
|
692
|
+
});
|
|
693
|
+
});
|
|
694
|
+
function I(e, t) {
|
|
695
|
+
try {
|
|
696
|
+
return new TextEncoder().encode(JSON.stringify(e)).byteLength <= t;
|
|
697
|
+
} catch {
|
|
698
|
+
return !1;
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
function L(e) {
|
|
702
|
+
if (I(e, 262144)) try {
|
|
703
|
+
let t = tt.safeParse(e);
|
|
704
|
+
return t.success ? t.data : void 0;
|
|
705
|
+
} catch {
|
|
706
|
+
return;
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
function R(e) {
|
|
710
|
+
if (I(e, 278528)) try {
|
|
711
|
+
let t = nt.safeParse(e);
|
|
712
|
+
return t.success ? t.data : void 0;
|
|
713
|
+
} catch {
|
|
714
|
+
return;
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
function rt(e) {
|
|
718
|
+
return Array.isArray(e) ? e.flatMap((e) => {
|
|
719
|
+
let t = R(e);
|
|
720
|
+
return t ? [t] : [];
|
|
721
|
+
}) : [];
|
|
722
|
+
}
|
|
723
|
+
//#endregion
|
|
278
724
|
//#region src/error-report/drafts.ts
|
|
279
|
-
var
|
|
280
|
-
function
|
|
725
|
+
var it = `${__APP_ID__}.errorReport.drafts.v2`, at = `${__APP_ID__}.errorReport.sessionId.v1`, z = st();
|
|
726
|
+
function ot() {
|
|
281
727
|
return a(/* @__PURE__ */ new Date());
|
|
282
728
|
}
|
|
283
|
-
function
|
|
729
|
+
function st() {
|
|
284
730
|
if (typeof sessionStorage > "u") return [];
|
|
285
731
|
try {
|
|
286
|
-
let e = sessionStorage.getItem(
|
|
287
|
-
return
|
|
732
|
+
let e = sessionStorage.getItem(it);
|
|
733
|
+
return rt(e ? JSON.parse(e) : []);
|
|
288
734
|
} catch {
|
|
289
735
|
return [];
|
|
290
736
|
}
|
|
291
737
|
}
|
|
292
|
-
function
|
|
293
|
-
if (
|
|
294
|
-
sessionStorage.setItem(
|
|
738
|
+
function ct(e) {
|
|
739
|
+
if (z = e.slice(-10), !(typeof sessionStorage > "u")) try {
|
|
740
|
+
sessionStorage.setItem(it, JSON.stringify(z));
|
|
295
741
|
} catch {}
|
|
296
742
|
}
|
|
297
|
-
function
|
|
743
|
+
function lt() {
|
|
298
744
|
if (!(typeof window > "u")) return {
|
|
299
745
|
pathname: window.location.pathname,
|
|
300
746
|
origin: window.location.origin
|
|
301
747
|
};
|
|
302
748
|
}
|
|
303
|
-
function
|
|
749
|
+
function ut() {
|
|
304
750
|
if (!(typeof window > "u")) return {
|
|
305
751
|
width: window.innerWidth,
|
|
306
752
|
height: window.innerHeight,
|
|
307
753
|
devicePixelRatio: window.devicePixelRatio
|
|
308
754
|
};
|
|
309
755
|
}
|
|
310
|
-
function
|
|
311
|
-
|
|
756
|
+
function dt(e) {
|
|
757
|
+
if (!e) return;
|
|
758
|
+
let t = g(e, {
|
|
759
|
+
scope: "draft-failed-reason",
|
|
760
|
+
source: "delivery"
|
|
761
|
+
});
|
|
762
|
+
return typeof t == "string" ? t : void 0;
|
|
763
|
+
}
|
|
764
|
+
function ft(e) {
|
|
765
|
+
return z.find((t) => t.reportId === e);
|
|
312
766
|
}
|
|
313
|
-
function
|
|
314
|
-
let n =
|
|
767
|
+
function pt(e, t) {
|
|
768
|
+
let n = ft(e);
|
|
315
769
|
if (!n) return;
|
|
316
|
-
let r = {
|
|
770
|
+
let r = R({
|
|
317
771
|
...n,
|
|
318
|
-
...t
|
|
319
|
-
|
|
320
|
-
|
|
772
|
+
...t,
|
|
773
|
+
sentUtc: "sentUtc" in t ? t.sentUtc ? d(t.sentUtc, 64) : void 0 : n.sentUtc,
|
|
774
|
+
failedReason: "failedReason" in t ? dt(t.failedReason) : n.failedReason
|
|
775
|
+
});
|
|
776
|
+
if (r) return ct(z.map((t) => t.reportId === e ? r : t)), r;
|
|
321
777
|
}
|
|
322
|
-
function
|
|
323
|
-
return
|
|
778
|
+
function mt() {
|
|
779
|
+
return z;
|
|
324
780
|
}
|
|
325
|
-
function
|
|
326
|
-
if (!
|
|
327
|
-
let t = i(), n = s(
|
|
781
|
+
function B(e) {
|
|
782
|
+
if (!Je()) return;
|
|
783
|
+
let t = i(), n = s(at), r = ot(), a = Ue({
|
|
784
|
+
payloadVersion: 1,
|
|
785
|
+
application: __APP_ID__,
|
|
328
786
|
reportId: t,
|
|
329
787
|
sessionId: n,
|
|
330
788
|
createdUtc: r,
|
|
331
789
|
category: e.category,
|
|
332
|
-
source: e.source,
|
|
790
|
+
source: d(e.source, 256),
|
|
333
791
|
error: e.error,
|
|
334
|
-
environment:
|
|
335
|
-
client:
|
|
336
|
-
location:
|
|
337
|
-
viewport:
|
|
792
|
+
environment: Ye(),
|
|
793
|
+
client: Xe(),
|
|
794
|
+
location: lt(),
|
|
795
|
+
viewport: ut(),
|
|
338
796
|
react: e.react,
|
|
339
797
|
query: e.query,
|
|
340
798
|
mutation: e.mutation,
|
|
341
799
|
queryClient: e.queryClient,
|
|
342
800
|
persistedQueries: e.persistedQueries,
|
|
343
|
-
breadcrumbs:
|
|
344
|
-
context: e.context
|
|
345
|
-
|
|
801
|
+
breadcrumbs: ve(),
|
|
802
|
+
context: _(e.context, {
|
|
803
|
+
scope: "context",
|
|
804
|
+
source: e.source
|
|
805
|
+
})
|
|
806
|
+
}), o = R({
|
|
346
807
|
reportId: t,
|
|
347
808
|
sessionId: n,
|
|
348
809
|
createdUtc: r,
|
|
349
810
|
category: e.category,
|
|
350
811
|
status: "pending",
|
|
351
812
|
payload: a
|
|
352
|
-
};
|
|
353
|
-
return
|
|
813
|
+
});
|
|
814
|
+
if (o) return ct([...z, o]), o;
|
|
354
815
|
}
|
|
355
816
|
//#endregion
|
|
356
817
|
//#region src/error-report/runtimeDeduplication.ts
|
|
357
|
-
var
|
|
358
|
-
function
|
|
818
|
+
var ht = 6e4, gt = 100, V = /* @__PURE__ */ new Map();
|
|
819
|
+
function _t(e) {
|
|
359
820
|
if (e) return e.split("\n").map((e) => e.trim()).filter(Boolean);
|
|
360
821
|
}
|
|
361
|
-
function
|
|
822
|
+
function vt(e) {
|
|
362
823
|
return r(n({
|
|
363
824
|
category: e.category,
|
|
364
825
|
source: e.source,
|
|
365
826
|
error: {
|
|
366
827
|
...e.error,
|
|
367
|
-
stackTrace:
|
|
828
|
+
stackTrace: _t(e.error.stackTrace)
|
|
368
829
|
},
|
|
369
830
|
pathname: e.pathname,
|
|
370
831
|
scope: e.scope
|
|
371
832
|
}));
|
|
372
833
|
}
|
|
373
|
-
function
|
|
374
|
-
let n =
|
|
375
|
-
!n || t && n.capture !== t || (clearTimeout(n.expirationTimer),
|
|
834
|
+
function H(e, t) {
|
|
835
|
+
let n = V.get(e);
|
|
836
|
+
!n || t && n.capture !== t || (clearTimeout(n.expirationTimer), V.delete(e));
|
|
376
837
|
}
|
|
377
|
-
function
|
|
378
|
-
for (let [t, n] of
|
|
838
|
+
function yt(e) {
|
|
839
|
+
for (let [t, n] of V) e - n.capturedAt >= 6e4 && H(t, n.capture);
|
|
379
840
|
}
|
|
380
|
-
function
|
|
381
|
-
let e =
|
|
382
|
-
e &&
|
|
841
|
+
function bt() {
|
|
842
|
+
let e = V.keys().next().value;
|
|
843
|
+
e && H(e);
|
|
383
844
|
}
|
|
384
|
-
function
|
|
385
|
-
let n = Date.now(), r =
|
|
845
|
+
function xt(e, t) {
|
|
846
|
+
let n = Date.now(), r = vt(e), i = V.get(r);
|
|
386
847
|
if (i && n - i.capturedAt < 6e4) return i.capture;
|
|
387
|
-
for (
|
|
848
|
+
for (yt(n); V.size >= gt;) bt();
|
|
388
849
|
let a = t(), o = setTimeout(() => {
|
|
389
|
-
|
|
390
|
-
},
|
|
391
|
-
return
|
|
850
|
+
H(r, a);
|
|
851
|
+
}, ht);
|
|
852
|
+
return V.set(r, {
|
|
392
853
|
capturedAt: n,
|
|
393
854
|
capture: a,
|
|
394
855
|
expirationTimer: o
|
|
395
856
|
}), a.catch(() => {
|
|
396
|
-
|
|
857
|
+
H(r, a);
|
|
397
858
|
}), a;
|
|
398
859
|
}
|
|
399
|
-
function
|
|
400
|
-
for (let e of
|
|
401
|
-
|
|
860
|
+
function St() {
|
|
861
|
+
for (let e of V.values()) clearTimeout(e.expirationTimer);
|
|
862
|
+
V.clear();
|
|
402
863
|
}
|
|
403
864
|
//#endregion
|
|
404
865
|
//#region src/error-report/transport.ts
|
|
405
|
-
var
|
|
406
|
-
function
|
|
866
|
+
var Ct = 6e4, wt = 100, Tt = 250, U, Et = /* @__PURE__ */ new WeakSet(), Dt = /* @__PURE__ */ new WeakSet(), W = /* @__PURE__ */ new Map();
|
|
867
|
+
function Ot(e) {
|
|
407
868
|
return [
|
|
408
869
|
e.source,
|
|
409
870
|
e.method,
|
|
@@ -412,85 +873,103 @@ function De(e) {
|
|
|
412
873
|
e.responseUrl
|
|
413
874
|
].filter(Boolean).join("|");
|
|
414
875
|
}
|
|
415
|
-
function
|
|
416
|
-
let t = Date.now(), n =
|
|
417
|
-
for (let [e, n] of
|
|
418
|
-
let r =
|
|
419
|
-
return r && t - r <
|
|
876
|
+
function kt(e) {
|
|
877
|
+
let t = Date.now(), n = Ot(e);
|
|
878
|
+
for (let [e, n] of W) (t - n > Ct || W.size > wt) && W.delete(e);
|
|
879
|
+
let r = W.get(n);
|
|
880
|
+
return r && t - r < Ct ? !0 : (W.set(n, t), !1);
|
|
420
881
|
}
|
|
421
|
-
function
|
|
422
|
-
|
|
882
|
+
function At(e) {
|
|
883
|
+
U = e, W.clear();
|
|
423
884
|
}
|
|
424
|
-
function
|
|
425
|
-
return e instanceof Error &&
|
|
885
|
+
function jt(e) {
|
|
886
|
+
return e instanceof Error && Et.has(e);
|
|
426
887
|
}
|
|
427
|
-
function
|
|
428
|
-
e instanceof Error &&
|
|
888
|
+
function G(e) {
|
|
889
|
+
e instanceof Error && Dt.add(e);
|
|
429
890
|
}
|
|
430
|
-
function
|
|
431
|
-
|
|
432
|
-
if (!
|
|
433
|
-
let n =
|
|
891
|
+
function Mt(e, t) {
|
|
892
|
+
Et.add(e), setTimeout(() => {
|
|
893
|
+
if (!Dt.has(e) && U && !kt(t)) try {
|
|
894
|
+
let n = U(e, t);
|
|
434
895
|
Promise.resolve(n).catch(() => void 0);
|
|
435
896
|
} catch {}
|
|
436
|
-
},
|
|
897
|
+
}, Tt);
|
|
437
898
|
}
|
|
438
899
|
//#endregion
|
|
439
900
|
//#region src/error-report/capture.ts
|
|
440
|
-
async function
|
|
441
|
-
|
|
901
|
+
async function Nt(e, t, n, r) {
|
|
902
|
+
G(e);
|
|
442
903
|
let i = r?.source ?? "query";
|
|
443
|
-
|
|
904
|
+
y({
|
|
444
905
|
type: "query-error",
|
|
445
|
-
detail:
|
|
446
|
-
queryHash: t.queryHash,
|
|
906
|
+
detail: _({
|
|
447
907
|
queryKey: r?.queryKey ?? t.queryKey,
|
|
448
908
|
...r?.detail
|
|
909
|
+
}, {
|
|
910
|
+
scope: "breadcrumb-detail",
|
|
911
|
+
source: i
|
|
449
912
|
})
|
|
450
913
|
});
|
|
451
|
-
let [a, o] = await Promise.all([
|
|
452
|
-
return
|
|
914
|
+
let [a, o] = await Promise.all([M(), Promise.resolve(j(n))]);
|
|
915
|
+
return B({
|
|
453
916
|
category: "query",
|
|
454
917
|
source: i,
|
|
455
918
|
error: r?.errorInfo ?? O(e),
|
|
456
|
-
query:
|
|
919
|
+
query: k(t),
|
|
457
920
|
queryClient: o,
|
|
458
921
|
persistedQueries: a,
|
|
459
|
-
context:
|
|
922
|
+
context: _(r?.detail, {
|
|
923
|
+
scope: "context",
|
|
924
|
+
source: i
|
|
925
|
+
})
|
|
460
926
|
});
|
|
461
927
|
}
|
|
462
|
-
async function
|
|
463
|
-
|
|
928
|
+
async function Pt(e, t, n, r = {}) {
|
|
929
|
+
G(e);
|
|
464
930
|
let i = r.source ?? "mutation";
|
|
465
|
-
|
|
931
|
+
y({
|
|
466
932
|
type: "mutation-error",
|
|
467
|
-
detail:
|
|
933
|
+
detail: _({
|
|
468
934
|
mutationKey: t.options.mutationKey,
|
|
469
935
|
...r.detail
|
|
936
|
+
}, {
|
|
937
|
+
scope: "breadcrumb-detail",
|
|
938
|
+
source: i
|
|
470
939
|
})
|
|
471
940
|
});
|
|
472
|
-
let [a, o] = await Promise.all([
|
|
473
|
-
return
|
|
941
|
+
let [a, o] = await Promise.all([M(), Promise.resolve(j(n))]);
|
|
942
|
+
return B({
|
|
474
943
|
category: "mutation",
|
|
475
944
|
source: i,
|
|
476
945
|
error: r.errorInfo ?? O(e),
|
|
477
|
-
mutation:
|
|
946
|
+
mutation: A(t),
|
|
478
947
|
queryClient: o,
|
|
479
|
-
persistedQueries: a
|
|
948
|
+
persistedQueries: a,
|
|
949
|
+
context: _(r.detail, {
|
|
950
|
+
scope: "context",
|
|
951
|
+
source: i
|
|
952
|
+
})
|
|
480
953
|
});
|
|
481
954
|
}
|
|
482
|
-
function
|
|
483
|
-
let r = t.category ?? "runtime", i = t.source ?? t.category ?? "runtime", a = t.errorInfo ?? O(e), o =
|
|
484
|
-
|
|
955
|
+
function Ft(e, t = {}, n) {
|
|
956
|
+
let r = t.category ?? "runtime", i = t.source ?? t.category ?? "runtime", a = t.errorInfo ?? O(e), o = _(t.detail, {
|
|
957
|
+
scope: "context",
|
|
958
|
+
source: i
|
|
959
|
+
}), s = async () => {
|
|
960
|
+
y({
|
|
485
961
|
type: "runtime-error",
|
|
486
|
-
detail:
|
|
962
|
+
detail: _({
|
|
487
963
|
category: r,
|
|
488
964
|
source: i,
|
|
489
965
|
...t.detail
|
|
966
|
+
}, {
|
|
967
|
+
scope: "breadcrumb-detail",
|
|
968
|
+
source: i
|
|
490
969
|
})
|
|
491
970
|
});
|
|
492
|
-
let [e, s] = n ? await Promise.all([
|
|
493
|
-
return
|
|
971
|
+
let [e, s] = n ? await Promise.all([M(), Promise.resolve(j(n))]) : [void 0, void 0];
|
|
972
|
+
return B({
|
|
494
973
|
category: r,
|
|
495
974
|
source: i,
|
|
496
975
|
error: a,
|
|
@@ -500,7 +979,7 @@ function Ne(e, t = {}, n) {
|
|
|
500
979
|
context: o
|
|
501
980
|
});
|
|
502
981
|
};
|
|
503
|
-
return typeof window > "u" ? s() :
|
|
982
|
+
return typeof window > "u" ? s() : xt({
|
|
504
983
|
category: r,
|
|
505
984
|
source: i,
|
|
506
985
|
error: a,
|
|
@@ -512,17 +991,248 @@ function Ne(e, t = {}, n) {
|
|
|
512
991
|
}, s);
|
|
513
992
|
}
|
|
514
993
|
//#endregion
|
|
994
|
+
//#region src/error-report/queueContract.ts
|
|
995
|
+
var It = 1, Lt = 50, Rt = 6048e5, zt = 3e4, Bt = /* @__PURE__ */ new Set([
|
|
996
|
+
"http",
|
|
997
|
+
"network",
|
|
998
|
+
"timeout",
|
|
999
|
+
"unknown"
|
|
1000
|
+
]);
|
|
1001
|
+
function K(e) {
|
|
1002
|
+
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
1003
|
+
}
|
|
1004
|
+
function q(e) {
|
|
1005
|
+
return typeof e == "string" && e.length <= 64 && Number.isFinite(Date.parse(e));
|
|
1006
|
+
}
|
|
1007
|
+
function Vt(e) {
|
|
1008
|
+
return typeof e == "number" && Number.isSafeInteger(e) && e >= 0;
|
|
1009
|
+
}
|
|
1010
|
+
function Ht(e) {
|
|
1011
|
+
if (e !== void 0 && !(!K(e) || !q(e.utc) || typeof e.kind != "string") && Bt.has(e.kind) && !(e.httpStatus !== void 0 && (typeof e.httpStatus != "number" || !Number.isInteger(e.httpStatus) || e.httpStatus < 100 || e.httpStatus > 599))) return {
|
|
1012
|
+
utc: e.utc,
|
|
1013
|
+
kind: e.kind,
|
|
1014
|
+
httpStatus: e.httpStatus
|
|
1015
|
+
};
|
|
1016
|
+
}
|
|
1017
|
+
function Ut(e) {
|
|
1018
|
+
if (e !== void 0 && !(!K(e) || typeof e.ownerId != "string" || e.ownerId.length === 0 || e.ownerId.length > 128) && q(e.expiresUtc)) return {
|
|
1019
|
+
ownerId: e.ownerId,
|
|
1020
|
+
expiresUtc: e.expiresUtc
|
|
1021
|
+
};
|
|
1022
|
+
}
|
|
1023
|
+
function Wt(e) {
|
|
1024
|
+
if (!K(e) || e.queueVersion !== 1 || typeof e.reportId != "string" || !q(e.enqueuedUtc) || !q(e.expiresUtc) || !q(e.nextAttemptUtc) || !Vt(e.attemptCount)) return;
|
|
1025
|
+
let t = L(e.payload);
|
|
1026
|
+
if (!t || t.reportId !== e.reportId) return;
|
|
1027
|
+
let n = Ut(e.lease);
|
|
1028
|
+
if (e.lease !== void 0 && !n) return;
|
|
1029
|
+
let r = Ht(e.lastFailure);
|
|
1030
|
+
if (!(e.lastFailure !== void 0 && !r)) return {
|
|
1031
|
+
queueVersion: 1,
|
|
1032
|
+
reportId: e.reportId,
|
|
1033
|
+
enqueuedUtc: e.enqueuedUtc,
|
|
1034
|
+
expiresUtc: e.expiresUtc,
|
|
1035
|
+
nextAttemptUtc: e.nextAttemptUtc,
|
|
1036
|
+
attemptCount: e.attemptCount,
|
|
1037
|
+
payload: t,
|
|
1038
|
+
lease: n,
|
|
1039
|
+
lastFailure: r
|
|
1040
|
+
};
|
|
1041
|
+
}
|
|
1042
|
+
function J(e, t) {
|
|
1043
|
+
if (!Array.isArray(e)) return [];
|
|
1044
|
+
let n = /* @__PURE__ */ new Set(), r = [];
|
|
1045
|
+
for (let i of e) {
|
|
1046
|
+
let e = Wt(i);
|
|
1047
|
+
if (!(!e || Date.parse(e.expiresUtc) <= t || n.has(e.reportId)) && (n.add(e.reportId), r.push(e), r.length === 50)) break;
|
|
1048
|
+
}
|
|
1049
|
+
return r;
|
|
1050
|
+
}
|
|
1051
|
+
//#endregion
|
|
1052
|
+
//#region src/error-report/queue.ts
|
|
1053
|
+
var Y = "queue.v1", Gt = "records";
|
|
1054
|
+
function X(e) {
|
|
1055
|
+
return new Date(e).toISOString();
|
|
1056
|
+
}
|
|
1057
|
+
function Z(e) {
|
|
1058
|
+
let t = e.trim();
|
|
1059
|
+
if (t.length === 0 || t.length > 128) throw Error("Error report lease owner должен содержать от 1 до 128 символов");
|
|
1060
|
+
return t;
|
|
1061
|
+
}
|
|
1062
|
+
function Kt(e, t) {
|
|
1063
|
+
return Date.parse(e.nextAttemptUtc) - Date.parse(t.nextAttemptUtc) || Date.parse(e.enqueuedUtc) - Date.parse(t.enqueuedUtc);
|
|
1064
|
+
}
|
|
1065
|
+
function Q(e, t, n) {
|
|
1066
|
+
let r = e.findIndex((e) => e.reportId === t);
|
|
1067
|
+
return r < 0 ? {
|
|
1068
|
+
index: r,
|
|
1069
|
+
result: "missing"
|
|
1070
|
+
} : e[r]?.lease?.ownerId === n ? {
|
|
1071
|
+
index: r,
|
|
1072
|
+
result: "updated"
|
|
1073
|
+
} : {
|
|
1074
|
+
index: r,
|
|
1075
|
+
result: "lease-mismatch"
|
|
1076
|
+
};
|
|
1077
|
+
}
|
|
1078
|
+
function qt(e = {}) {
|
|
1079
|
+
let t = e.storage ?? o({
|
|
1080
|
+
dbName: e.dbName ?? `${__APP_ID__}.error-report.queue.v1`,
|
|
1081
|
+
storeName: Gt,
|
|
1082
|
+
indexedDB: e.indexedDB
|
|
1083
|
+
});
|
|
1084
|
+
if (!t) return;
|
|
1085
|
+
let n = t;
|
|
1086
|
+
function r(e, t) {
|
|
1087
|
+
return n.updateItem(Y, (n) => {
|
|
1088
|
+
let r = t(J(n, e));
|
|
1089
|
+
return {
|
|
1090
|
+
action: "set",
|
|
1091
|
+
value: r.records,
|
|
1092
|
+
result: r.result
|
|
1093
|
+
};
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
1096
|
+
return {
|
|
1097
|
+
enqueue: async (e, t = /* @__PURE__ */ new Date()) => {
|
|
1098
|
+
let n = L(e);
|
|
1099
|
+
if (!n) return { status: "invalid-payload" };
|
|
1100
|
+
let i = t.getTime();
|
|
1101
|
+
return Number.isFinite(i) ? r(i, (e) => {
|
|
1102
|
+
if (e.some((e) => e.reportId === n.reportId)) return {
|
|
1103
|
+
records: e,
|
|
1104
|
+
result: { status: "duplicate" }
|
|
1105
|
+
};
|
|
1106
|
+
let t;
|
|
1107
|
+
if (e.length >= 50) {
|
|
1108
|
+
let n = e.map((e, t) => ({
|
|
1109
|
+
record: e,
|
|
1110
|
+
index: t
|
|
1111
|
+
})).filter(({ record: e }) => e.lease === void 0).sort((e, t) => Date.parse(e.record.enqueuedUtc) - Date.parse(t.record.enqueuedUtc))[0]?.index;
|
|
1112
|
+
if (n === void 0) return {
|
|
1113
|
+
records: e,
|
|
1114
|
+
result: { status: "capacity-exceeded" }
|
|
1115
|
+
};
|
|
1116
|
+
t = e[n]?.reportId, e.splice(n, 1);
|
|
1117
|
+
}
|
|
1118
|
+
let r = X(i);
|
|
1119
|
+
return e.push({
|
|
1120
|
+
queueVersion: 1,
|
|
1121
|
+
reportId: n.reportId,
|
|
1122
|
+
enqueuedUtc: r,
|
|
1123
|
+
expiresUtc: X(i + Rt),
|
|
1124
|
+
nextAttemptUtc: r,
|
|
1125
|
+
attemptCount: 0,
|
|
1126
|
+
payload: n
|
|
1127
|
+
}), {
|
|
1128
|
+
records: e,
|
|
1129
|
+
result: t ? {
|
|
1130
|
+
status: "enqueued",
|
|
1131
|
+
evictedReportId: t
|
|
1132
|
+
} : { status: "enqueued" }
|
|
1133
|
+
};
|
|
1134
|
+
}) : { status: "invalid-payload" };
|
|
1135
|
+
},
|
|
1136
|
+
leaseNext: async ({ ownerId: e, now: t = /* @__PURE__ */ new Date(), leaseDurationMs: n = zt }) => {
|
|
1137
|
+
let i = Z(e), a = t.getTime();
|
|
1138
|
+
if (!Number.isFinite(a) || !Number.isFinite(n) || n <= 0) throw Error("Error report lease требует валидное время и положительную длительность");
|
|
1139
|
+
return r(a, (e) => {
|
|
1140
|
+
let t = e.filter((e) => Date.parse(e.nextAttemptUtc) <= a && (e.lease === void 0 || Date.parse(e.lease.expiresUtc) <= a)).sort(Kt)[0];
|
|
1141
|
+
if (!t) return {
|
|
1142
|
+
records: e,
|
|
1143
|
+
result: void 0
|
|
1144
|
+
};
|
|
1145
|
+
let r = {
|
|
1146
|
+
...t,
|
|
1147
|
+
attemptCount: t.attemptCount + 1,
|
|
1148
|
+
lease: {
|
|
1149
|
+
ownerId: i,
|
|
1150
|
+
expiresUtc: X(a + n)
|
|
1151
|
+
}
|
|
1152
|
+
};
|
|
1153
|
+
return {
|
|
1154
|
+
records: e.map((e) => e.reportId === t.reportId ? r : e),
|
|
1155
|
+
result: r
|
|
1156
|
+
};
|
|
1157
|
+
});
|
|
1158
|
+
},
|
|
1159
|
+
acknowledge: async (e, t) => {
|
|
1160
|
+
let n = Z(t);
|
|
1161
|
+
return r(Date.now(), (t) => {
|
|
1162
|
+
let r = Q(t, e, n);
|
|
1163
|
+
return r.result === "updated" ? (t.splice(r.index, 1), {
|
|
1164
|
+
records: t,
|
|
1165
|
+
result: "updated"
|
|
1166
|
+
}) : {
|
|
1167
|
+
records: t,
|
|
1168
|
+
result: r.result
|
|
1169
|
+
};
|
|
1170
|
+
});
|
|
1171
|
+
},
|
|
1172
|
+
reschedule: async (e, t, n) => {
|
|
1173
|
+
let i = Z(t), a = Date.parse(n.nextAttemptUtc), o = Date.parse(n.failure.utc);
|
|
1174
|
+
if (!Number.isFinite(a) || !Number.isFinite(o)) throw Error("Error report retry требует валидные UTC timestamps");
|
|
1175
|
+
return r(o, (t) => {
|
|
1176
|
+
let r = Q(t, e, i);
|
|
1177
|
+
if (r.result !== "updated") return {
|
|
1178
|
+
records: t,
|
|
1179
|
+
result: r.result
|
|
1180
|
+
};
|
|
1181
|
+
let a = t[r.index];
|
|
1182
|
+
return a ? (t[r.index] = {
|
|
1183
|
+
...a,
|
|
1184
|
+
nextAttemptUtc: n.nextAttemptUtc,
|
|
1185
|
+
lease: void 0,
|
|
1186
|
+
lastFailure: n.failure
|
|
1187
|
+
}, {
|
|
1188
|
+
records: t,
|
|
1189
|
+
result: "updated"
|
|
1190
|
+
}) : {
|
|
1191
|
+
records: t,
|
|
1192
|
+
result: "missing"
|
|
1193
|
+
};
|
|
1194
|
+
});
|
|
1195
|
+
},
|
|
1196
|
+
discard: async (e, t) => {
|
|
1197
|
+
let n = Z(t);
|
|
1198
|
+
return r(Date.now(), (t) => {
|
|
1199
|
+
let r = Q(t, e, n);
|
|
1200
|
+
return r.result === "updated" ? (t.splice(r.index, 1), {
|
|
1201
|
+
records: t,
|
|
1202
|
+
result: "updated"
|
|
1203
|
+
}) : {
|
|
1204
|
+
records: t,
|
|
1205
|
+
result: r.result
|
|
1206
|
+
};
|
|
1207
|
+
});
|
|
1208
|
+
},
|
|
1209
|
+
getRecords: async (e = /* @__PURE__ */ new Date()) => {
|
|
1210
|
+
let t = e.getTime();
|
|
1211
|
+
return Number.isFinite(t) ? J(await n.getItem(Y), t).sort(Kt) : [];
|
|
1212
|
+
},
|
|
1213
|
+
getNextWakeUtc: async (e = /* @__PURE__ */ new Date()) => {
|
|
1214
|
+
let t = e.getTime();
|
|
1215
|
+
if (!Number.isFinite(t)) return;
|
|
1216
|
+
let r = J(await n.getItem(Y), t).reduce((e, t) => {
|
|
1217
|
+
let n = Math.max(Date.parse(t.nextAttemptUtc), t.lease ? Date.parse(t.lease.expiresUtc) : 0);
|
|
1218
|
+
return e === void 0 || n < e ? n : e;
|
|
1219
|
+
}, void 0);
|
|
1220
|
+
return r === void 0 ? void 0 : X(r);
|
|
1221
|
+
}
|
|
1222
|
+
};
|
|
1223
|
+
}
|
|
1224
|
+
//#endregion
|
|
515
1225
|
//#region src/error-report/runtime.ts
|
|
516
1226
|
var $;
|
|
517
|
-
function
|
|
518
|
-
$ = e,
|
|
1227
|
+
function Jt(e) {
|
|
1228
|
+
$ = e, St();
|
|
519
1229
|
}
|
|
520
|
-
async function
|
|
1230
|
+
async function Yt(e, t = {}) {
|
|
521
1231
|
if ($) try {
|
|
522
1232
|
await $(e, t);
|
|
523
1233
|
} catch {}
|
|
524
1234
|
}
|
|
525
1235
|
//#endregion
|
|
526
|
-
export {
|
|
1236
|
+
export { x as ERROR_REPORT_PAYLOAD_MAX_BYTES, Me as ERROR_REPORT_PAYLOAD_VERSION, zt as ERROR_REPORT_QUEUE_LEASE_MS, Lt as ERROR_REPORT_QUEUE_MAX_ITEMS, Rt as ERROR_REPORT_QUEUE_TTL_MS, It as ERROR_REPORT_QUEUE_VERSION, S as ERROR_REPORT_STACK_TRACE_MAX_BYTES, y as addErrorReportBreadcrumb, B as captureErrorReportDraft, Pt as captureMutationErrorReport, Nt as captureQueryErrorReport, Ft as captureRuntimeErrorReport, ye as clearErrorReportBreadcrumbs, A as collectMutationDiagnostics, M as collectPersistedQueryDiagnostics, j as collectQueryClientDiagnostics, k as collectQueryDiagnostics, h as createDataShape, de as createDiagnosticValue, O as createErrorInfo, qt as createErrorReportQueue, ve as getErrorReportBreadcrumbs, Xe as getErrorReportClientEnvironment, ft as getErrorReportDraft, mt as getErrorReportDrafts, Ye as getErrorReportEnvironment, T as getErrorReportPayloadSize, f as getUtf8TextSize, je as installErrorReportBrowserBreadcrumbs, Je as isErrorReportingEnabled, jt as isTransportErrorReportScheduled, Ue as limitErrorReportPayload, J as normalizeErrorReportQueueRecords, R as parseErrorReportDraft, rt as parseErrorReportDrafts, L as parseErrorReportPayload, Wt as parseErrorReportQueueRecord, Yt as reportRuntimeError, Mt as reportTransportError, _ as sanitizeDetail, d as sanitizeDiagnosticText, p as sanitizeDiagnosticTextBytes, g as sanitizeErrorReportValue, Jt as setErrorReportRuntimeErrorReporter, fe as setErrorReportSanitizer, At as setErrorReportTransportErrorReporter, G as suppressTransportErrorReport, pt as updateErrorReportDraft };
|
|
527
1237
|
|
|
528
1238
|
//# sourceMappingURL=index.js.map
|