@burdenoff/fe-libs 2026.1028.8 → 2026.1028.9
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.
|
@@ -18,8 +18,19 @@ var e = "burdenoff:backend-error", t = "burdenoff:connection-status", n = "Somet
|
|
|
18
18
|
TIMEOUT: "The request took too long. Please try again.",
|
|
19
19
|
UNAUTHENTICATED: "Please sign in to continue.",
|
|
20
20
|
VALIDATION_ERROR: "Please check the information and try again.",
|
|
21
|
-
WORKSPACE_REQUIRED: "Please choose a workspace and try again."
|
|
22
|
-
|
|
21
|
+
WORKSPACE_REQUIRED: "Please choose a workspace and try again.",
|
|
22
|
+
AUTH_SERVICE_UNAVAILABLE: "We couldn't verify your access just now. Please try again in a moment.",
|
|
23
|
+
RBAC_SERVICE_UNAVAILABLE: "We couldn't verify your access just now. Please try again in a moment."
|
|
24
|
+
}, i = {
|
|
25
|
+
UNAUTHENTICATED_ACTOR: "Your session has expired. Please sign in again.",
|
|
26
|
+
WORKSPACE_SESSION_UNRESOLVED: "Your workspace session has expired. Refresh the page to continue.",
|
|
27
|
+
WORKSPACE_CONTEXT_MISSING: "Please choose a workspace and try again."
|
|
28
|
+
};
|
|
29
|
+
function a(e) {
|
|
30
|
+
let t = e?.authFailure;
|
|
31
|
+
if (typeof t == "string") return i[t];
|
|
32
|
+
}
|
|
33
|
+
var o = [
|
|
23
34
|
/^Syntax Error:/i,
|
|
24
35
|
/^Cannot query field\b/i,
|
|
25
36
|
/^Cannot return null for non-nullable field\b/i,
|
|
@@ -31,123 +42,123 @@ var e = "burdenoff:backend-error", t = "burdenoff:connection-status", n = "Somet
|
|
|
31
42
|
/^Fragment "[^"]+" cannot be spread here/i,
|
|
32
43
|
/^There can be only one/i,
|
|
33
44
|
/Did you mean /i
|
|
34
|
-
],
|
|
45
|
+
], s = new Set([
|
|
35
46
|
"UNAUTHENTICATED",
|
|
36
47
|
"TOKEN_EXPIRED",
|
|
37
48
|
"RESOURCE_CAP_EXCEEDED",
|
|
38
49
|
"STORAGE_QUOTA_EXCEEDED",
|
|
39
50
|
"QUOTA_EXHAUSTED"
|
|
40
|
-
]),
|
|
51
|
+
]), c = new Set([
|
|
41
52
|
"ExportTranslations",
|
|
42
53
|
"exportTranslations",
|
|
43
54
|
"AdminEntityCounts",
|
|
44
55
|
"GetTenants"
|
|
45
|
-
]),
|
|
56
|
+
]), l = ["exportTranslations"], u = ["No translation keys found for the specified criteria"], d = [
|
|
46
57
|
/failed to fetch/i,
|
|
47
58
|
/networkerror when attempting to fetch/i,
|
|
48
59
|
/network request failed/i,
|
|
49
60
|
/the network connection was lost/i,
|
|
50
61
|
/\bECONNREFUSED\b|\bECONNRESET\b|\bETIMEDOUT\b|\bENOTFOUND\b|\bEAI_AGAIN\b|\bEHOSTUNREACH\b|\bENETUNREACH\b/i,
|
|
51
62
|
/network circuit breaker is open/i
|
|
52
|
-
],
|
|
63
|
+
], f = [
|
|
53
64
|
"We could not reach the server. Please check your connection and try again.",
|
|
54
65
|
"The server is having trouble right now. Please try again in a moment.",
|
|
55
66
|
"The server took too long to respond. Please try again."
|
|
56
|
-
],
|
|
67
|
+
], p = [
|
|
57
68
|
/\bunauthori[sz]ed\b|\bunauthenticated\b|\btoken[\s_-]?expired\b|\b401\b|\b403\b/i,
|
|
58
69
|
/invalid email or password/i,
|
|
59
70
|
/you do not have permission/i
|
|
60
71
|
];
|
|
61
|
-
function
|
|
72
|
+
function m(e) {
|
|
62
73
|
return typeof e == "object" && !!e && !Array.isArray(e);
|
|
63
74
|
}
|
|
64
|
-
function
|
|
75
|
+
function h(e) {
|
|
65
76
|
if (!e) return !1;
|
|
66
77
|
let t = e.trim();
|
|
67
|
-
return t.length === 0 ||
|
|
78
|
+
return t.length === 0 || p.some((e) => e.test(t)) ? !1 : f.includes(t) || t.toLowerCase() === "load failed" ? !0 : d.some((e) => e.test(t));
|
|
68
79
|
}
|
|
69
|
-
function
|
|
70
|
-
return !!(e instanceof DOMException && e.name === "AbortError" || e instanceof Error && e.name === "AbortError" ||
|
|
80
|
+
function g(e) {
|
|
81
|
+
return !!(e instanceof DOMException && e.name === "AbortError" || e instanceof Error && e.name === "AbortError" || m(e) && e.name === "AbortError");
|
|
71
82
|
}
|
|
72
|
-
function
|
|
83
|
+
function _(e) {
|
|
73
84
|
if (typeof e == "string") return e;
|
|
74
85
|
if (e instanceof Error) return e.message;
|
|
75
|
-
if (
|
|
76
|
-
let t =
|
|
86
|
+
if (m(e)) {
|
|
87
|
+
let t = T(e, "message");
|
|
77
88
|
if (t) return t;
|
|
78
|
-
let n =
|
|
89
|
+
let n = D(e);
|
|
79
90
|
if (n && n.length > 0 && typeof n[0]?.message == "string") return n[0].message ?? void 0;
|
|
80
91
|
let r = e.networkError;
|
|
81
|
-
if (
|
|
92
|
+
if (m(r)) return T(r, "message");
|
|
82
93
|
}
|
|
83
94
|
}
|
|
84
|
-
function
|
|
85
|
-
if (!
|
|
95
|
+
function v(e) {
|
|
96
|
+
if (!m(e)) return;
|
|
86
97
|
let t = e.statusCode ?? e.status;
|
|
87
98
|
if (typeof t == "number") return t;
|
|
88
99
|
let n = e.networkError;
|
|
89
|
-
if (
|
|
100
|
+
if (m(n)) {
|
|
90
101
|
let e = n.statusCode ?? n.status;
|
|
91
102
|
if (typeof e == "number") return e;
|
|
92
103
|
}
|
|
93
104
|
}
|
|
94
|
-
function
|
|
95
|
-
if (e == null ||
|
|
96
|
-
let t =
|
|
97
|
-
if (
|
|
98
|
-
let n =
|
|
99
|
-
return n === 401 || n === 403 ? !1 : typeof navigator < "u" && navigator.onLine === !1 || e instanceof TypeError &&
|
|
100
|
-
}
|
|
101
|
-
var
|
|
102
|
-
function
|
|
103
|
-
let r = Date.now(), i =
|
|
104
|
-
r -
|
|
105
|
+
function y(e) {
|
|
106
|
+
if (e == null || g(e)) return !1;
|
|
107
|
+
let t = O(e);
|
|
108
|
+
if (E(t?.extensions?.code ?? t?.extensions?.errorCode)) return !1;
|
|
109
|
+
let n = v(e);
|
|
110
|
+
return n === 401 || n === 403 ? !1 : typeof navigator < "u" && navigator.onLine === !1 || e instanceof TypeError && h(e.message) ? !0 : h(_(e));
|
|
111
|
+
}
|
|
112
|
+
var b = 1e4, x = 0, S = !1;
|
|
113
|
+
function C(e, n) {
|
|
114
|
+
let r = Date.now(), i = _(e) ?? "Network request failed", a = typeof navigator > "u" ? !0 : navigator.onLine;
|
|
115
|
+
r - x > b && (x = r, console.warn("[Burdenoff network] request could not reach the server", {
|
|
105
116
|
message: i,
|
|
106
117
|
operationName: n.operationName,
|
|
107
118
|
online: a
|
|
108
|
-
})), typeof window < "u" && !
|
|
119
|
+
})), typeof window < "u" && !S && (S = !0, window.dispatchEvent(new CustomEvent(t, { detail: {
|
|
109
120
|
online: !1,
|
|
110
121
|
since: r
|
|
111
122
|
} })));
|
|
112
123
|
}
|
|
113
|
-
function
|
|
114
|
-
typeof window > "u" || (
|
|
124
|
+
function w() {
|
|
125
|
+
typeof window > "u" || (S && (S = !1, x = 0), window.dispatchEvent(new CustomEvent(t, { detail: {
|
|
115
126
|
online: !0,
|
|
116
127
|
since: Date.now()
|
|
117
128
|
} })));
|
|
118
129
|
}
|
|
119
|
-
function
|
|
130
|
+
function T(e, t) {
|
|
120
131
|
let n = e[t];
|
|
121
132
|
return typeof n == "string" && n.trim().length > 0 ? n : void 0;
|
|
122
133
|
}
|
|
123
|
-
function
|
|
134
|
+
function E(e) {
|
|
124
135
|
if (!(typeof e != "string" || e.trim().length === 0)) return e.trim().replace(/[\s-]+/g, "_").toUpperCase();
|
|
125
136
|
}
|
|
126
|
-
function
|
|
127
|
-
if (!
|
|
137
|
+
function D(e) {
|
|
138
|
+
if (!m(e)) return;
|
|
128
139
|
let t = e.errors;
|
|
129
140
|
if (Array.isArray(t)) return t;
|
|
130
141
|
let n = e.graphQLErrors;
|
|
131
142
|
if (Array.isArray(n)) return n;
|
|
132
143
|
let r = e.networkError;
|
|
133
|
-
if (
|
|
144
|
+
if (m(r)) {
|
|
134
145
|
let e = r.result;
|
|
135
|
-
if (
|
|
146
|
+
if (m(e) && Array.isArray(e.errors)) return e.errors;
|
|
136
147
|
}
|
|
137
148
|
}
|
|
138
|
-
function
|
|
139
|
-
let t =
|
|
149
|
+
function O(e) {
|
|
150
|
+
let t = D(e);
|
|
140
151
|
if (t && t.length > 0) return t[0];
|
|
141
|
-
if (
|
|
152
|
+
if (m(e) && ("message" in e || "extensions" in e)) return e;
|
|
142
153
|
}
|
|
143
|
-
function
|
|
154
|
+
function k(e) {
|
|
144
155
|
if (e) return e.userMessage ?? e.humanMessage ?? e.displayMessage;
|
|
145
156
|
}
|
|
146
|
-
function
|
|
147
|
-
return e.length > 220 || e.includes("\n") ||
|
|
157
|
+
function A(e) {
|
|
158
|
+
return e.length > 220 || e.includes("\n") || o.some((t) => t.test(e)) || /\b(prisma|sql|constraint|undefined|null|ECONN[A-Z_]*|ETIMEDOUT|ENOTFOUND)\b/i.test(e) || /failed to fetch|network error|graphql fetch failed/i.test(e) || /Cannot (read|set|find|access|query)/i.test(e);
|
|
148
159
|
}
|
|
149
|
-
function
|
|
150
|
-
if (
|
|
160
|
+
function j(e) {
|
|
161
|
+
if (o.some((t) => t.test(e))) return "BAD_USER_INPUT";
|
|
151
162
|
let t = e.toLowerCase();
|
|
152
163
|
if (t.includes("unauthenticated") || t.includes("unauthorized")) return "UNAUTHENTICATED";
|
|
153
164
|
if (t.includes("workspace context")) return "WORKSPACE_REQUIRED";
|
|
@@ -156,20 +167,22 @@ function k(e) {
|
|
|
156
167
|
if (t.includes("quota") || t.includes("limit reached")) return "QUOTA_EXCEEDED";
|
|
157
168
|
if (t.includes("required") || t.includes("invalid") || t.includes("missing")) return "BAD_USER_INPUT";
|
|
158
169
|
}
|
|
159
|
-
function
|
|
160
|
-
let
|
|
161
|
-
if (
|
|
170
|
+
function M(e, t, i, o) {
|
|
171
|
+
let s = k(e?.extensions ?? void 0);
|
|
172
|
+
if (s) return s;
|
|
173
|
+
let c = a(e?.extensions ?? void 0);
|
|
174
|
+
if (c) return c;
|
|
162
175
|
if (t && r[t]) return r[t];
|
|
163
176
|
if (i) return i;
|
|
164
|
-
let
|
|
165
|
-
return
|
|
177
|
+
let l = e ? void 0 : o;
|
|
178
|
+
return l && !A(l) ? l : e?.message && !A(e.message) ? e.message : i ?? n;
|
|
166
179
|
}
|
|
167
|
-
function
|
|
180
|
+
function N(e) {
|
|
168
181
|
if (!(!e || e.length === 0)) return e.map((e) => String(e)).join(".");
|
|
169
182
|
}
|
|
170
|
-
function
|
|
183
|
+
function P(e, t = {}) {
|
|
171
184
|
if (e == null) return null;
|
|
172
|
-
let n =
|
|
185
|
+
let n = O(e), r = n?.extensions ?? void 0, i = e instanceof Error ? e.message : m(e) ? T(e, "message") : void 0, a = E(r?.code ?? r?.errorCode) ?? j(i ?? n?.message ?? ""), o = r?.serviceName, s = N(n?.path), c = r?.requestId ?? r?.correlationId ?? r?.traceId, l = M(n, a, t.fallbackMessage, i);
|
|
173
186
|
return {
|
|
174
187
|
message: l,
|
|
175
188
|
technicalMessage: r?.technicalMessage ?? (n?.message && n.message !== l ? n.message : void 0) ?? (i && i !== l ? i : void 0),
|
|
@@ -181,20 +194,20 @@ function M(e, t = {}) {
|
|
|
181
194
|
extensions: r
|
|
182
195
|
};
|
|
183
196
|
}
|
|
184
|
-
function
|
|
185
|
-
return
|
|
197
|
+
function F(e) {
|
|
198
|
+
return m(e) && typeof e.message == "string";
|
|
186
199
|
}
|
|
187
|
-
function
|
|
188
|
-
return !e || e.code &&
|
|
200
|
+
function I(e) {
|
|
201
|
+
return !e || e.code && s.has(e.code) || e.operationName && c.has(e.operationName) || e.path && l.some((t) => e.path === t || e.path?.startsWith(`${t}.`)) || e.technicalMessage && u.some((t) => e.technicalMessage.includes(t)) || !e.code && h(e.technicalMessage ?? e.message) ? !1 : e.message.trim().length > 0;
|
|
189
202
|
}
|
|
190
|
-
function
|
|
191
|
-
if (typeof window > "u" ||
|
|
192
|
-
if (
|
|
193
|
-
|
|
203
|
+
function L(t, n = {}) {
|
|
204
|
+
if (typeof window > "u" || g(t)) return;
|
|
205
|
+
if (y(t)) {
|
|
206
|
+
C(t, n);
|
|
194
207
|
return;
|
|
195
208
|
}
|
|
196
|
-
let r =
|
|
197
|
-
|
|
209
|
+
let r = F(t) ? t : P(t, n);
|
|
210
|
+
I(r) && window.dispatchEvent(new CustomEvent(e, { detail: r }));
|
|
198
211
|
}
|
|
199
212
|
//#endregion
|
|
200
|
-
export { e as BACKEND_ERROR_EVENT, t as CONNECTION_STATUS_EVENT,
|
|
213
|
+
export { e as BACKEND_ERROR_EVENT, t as CONNECTION_STATUS_EVENT, L as dispatchBackendErrorEvent, P as extractBackendError, g as isAbortError, F as isBackendErrorDisplay, y as isTransportError, w as markConnectionHealthy, I as shouldToastBackendError };
|