@plumile/backoffice-react 0.1.179 → 0.1.182
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/lib/esm/auth/login/loginPage.css.js +0 -1
- package/lib/esm/components/backoffice/columns/buildDataTableColumns.js +1 -1
- package/lib/esm/components/backoffice/columns/buildDataTableColumns.js.map +1 -1
- package/lib/esm/components/backoffice/detail/BackofficeRelationsSummaryGrid.js +1 -1
- package/lib/esm/components/backoffice/detail/BackofficeRelationsSummaryGrid.js.map +1 -1
- package/lib/esm/components/backoffice/detail/backofficeDetailRelationLink.css.js +1 -0
- package/lib/esm/components/backoffice/filters/BackofficeFilterAction.js +1 -1
- package/lib/esm/components/backoffice/filters/BackofficeFilterAction.js.map +1 -1
- package/lib/esm/components/backoffice/filters/deferredFilterSearchInput.css.js +1 -0
- package/lib/esm/components/backoffice/hub/BackofficeHubTemplate.js +1 -1
- package/lib/esm/components/backoffice/hub/BackofficeHubTemplate.js.map +1 -1
- package/lib/esm/components/backoffice/layout/breadcrumb/BackofficeTopbarBreadcrumb.js +1 -1
- package/lib/esm/components/backoffice/layout/breadcrumb/BackofficeTopbarBreadcrumb.js.map +1 -1
- package/lib/esm/components/backoffice/links/BackofficeInlineLink.js +2 -2
- package/lib/esm/components/backoffice/links/BackofficeInlineLink.js.map +1 -1
- package/lib/esm/components/backoffice/links/BackofficeLink.js +2 -2
- package/lib/esm/components/backoffice/links/BackofficeLink.js.map +1 -1
- package/lib/esm/components/backoffice/refs/backofficeEntityIdRef.css.js +0 -1
- package/lib/esm/components/backoffice/scaffolds/BackofficeEntityDetailNotFound.js +1 -1
- package/lib/esm/components/backoffice/scaffolds/BackofficeEntityDetailNotFound.js.map +1 -1
- package/lib/esm/components/backoffice/scaffolds/BackofficeEntityListScaffold.js +241 -228
- package/lib/esm/components/backoffice/scaffolds/BackofficeEntityListScaffold.js.map +1 -1
- package/lib/esm/components/backoffice/scaffolds/backofficeEntityListScaffold.css.js +2 -2
- package/lib/esm/components/backoffice/scaffolds/backofficeEntityListScaffold.css.js.map +1 -1
- package/lib/esm/hooks/useBackofficeListRefetch.js +18 -16
- package/lib/esm/hooks/useBackofficeListRefetch.js.map +1 -1
- package/lib/esm/hooks/useBackofficeListUrlState.js +23 -21
- package/lib/esm/hooks/useBackofficeListUrlState.js.map +1 -1
- package/lib/esm/i18n/locales/en/backofficeReact.js +1 -0
- package/lib/esm/i18n/locales/en/backofficeReact.js.map +1 -1
- package/lib/esm/i18n/locales/fr/backofficeReact.js +1 -0
- package/lib/esm/i18n/locales/fr/backofficeReact.js.map +1 -1
- package/lib/esm/index.js +26 -25
- package/lib/esm/pages/BackofficeEntityDetailFramePage.js +4 -4
- package/lib/esm/pages/BackofficeEntityDetailFramePage.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityDetailLayoutPage.js +1 -1
- package/lib/esm/pages/BackofficeEntityDetailLayoutPage.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityDetailPage.js +3 -3
- package/lib/esm/pages/BackofficeEntityDetailPage.js.map +1 -1
- package/lib/esm/pages/BackofficeEntityListPage.js +2 -2
- package/lib/esm/pages/BackofficeEntityListPage.js.map +1 -1
- package/lib/esm/pages/detail/buildTabsItems.js +1 -1
- package/lib/esm/pages/detail/buildTabsItems.js.map +1 -1
- package/lib/esm/provider/BackofficeProvider.js +63 -63
- package/lib/esm/provider/BackofficeProvider.js.map +1 -1
- package/lib/esm/relay/RelayProvider.js +2 -13
- package/lib/esm/relay/environment.js +2 -463
- package/lib/esm/relay/shortAccessTokenEnvironment.js +2 -15
- package/lib/esm/relay/useRelayOperationActivity.js +2 -0
- package/lib/esm/router/createBackofficeRoutes.js +11 -6
- package/lib/esm/router/createBackofficeRoutes.js.map +1 -1
- package/lib/types/components/backoffice/links/BackofficeInlineLink.d.ts +3 -2
- package/lib/types/components/backoffice/links/BackofficeInlineLink.d.ts.map +1 -1
- package/lib/types/components/backoffice/links/BackofficeLink.d.ts +3 -2
- package/lib/types/components/backoffice/links/BackofficeLink.d.ts.map +1 -1
- package/lib/types/components/backoffice/scaffolds/BackofficeEntityListScaffold.d.ts.map +1 -1
- package/lib/types/components/backoffice/scaffolds/backofficeEntityListScaffold.css.d.ts +1 -0
- package/lib/types/components/backoffice/scaffolds/backofficeEntityListScaffold.css.d.ts.map +1 -1
- package/lib/types/hooks/useBackofficeListRefetch.d.ts +5 -4
- package/lib/types/hooks/useBackofficeListRefetch.d.ts.map +1 -1
- package/lib/types/hooks/useBackofficeListUrlState.d.ts.map +1 -1
- package/lib/types/i18n/resources.d.ts +2 -0
- package/lib/types/i18n/resources.d.ts.map +1 -1
- package/lib/types/index.d.ts +3 -2
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/pages/BackofficeEntityDetailFramePage.d.ts +6 -3
- package/lib/types/pages/BackofficeEntityDetailFramePage.d.ts.map +1 -1
- package/lib/types/provider/BackofficeProvider.d.ts.map +1 -1
- package/lib/types/relay/RelayProvider.d.ts +1 -6
- package/lib/types/relay/RelayProvider.d.ts.map +1 -1
- package/lib/types/relay/environment.d.ts +1 -119
- package/lib/types/relay/environment.d.ts.map +1 -1
- package/lib/types/relay/shortAccessTokenEnvironment.d.ts +4 -3
- package/lib/types/relay/shortAccessTokenEnvironment.d.ts.map +1 -1
- package/lib/types/relay/useRelayOperationActivity.d.ts +2 -0
- package/lib/types/relay/useRelayOperationActivity.d.ts.map +1 -0
- package/lib/types/router/createBackofficeRoutes.d.ts.map +1 -1
- package/package.json +14 -12
- package/lib/esm/relay/RelayProvider.js.map +0 -1
- package/lib/esm/relay/environment.js.map +0 -1
- package/lib/esm/relay/shortAccessTokenEnvironment.js.map +0 -1
|
@@ -1,463 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
//#region src/relay/environment.ts
|
|
4
|
-
var o = "/api/graphql", s = "/api/ws", c, l, u, d, f = "graphql-transport-ws", p = 5e3, m = 1e4, h = 10, g = 500, _ = {
|
|
5
|
-
generation: 0,
|
|
6
|
-
reason: null,
|
|
7
|
-
status: "idle"
|
|
8
|
-
}, v = /* @__PURE__ */ new Set();
|
|
9
|
-
function y() {}
|
|
10
|
-
var b = y;
|
|
11
|
-
e() && (b = (e) => {
|
|
12
|
-
console.log("relayFieldLogger: ", e);
|
|
13
|
-
});
|
|
14
|
-
var x = (e) => {
|
|
15
|
-
if (typeof e != "object" || !e) return null;
|
|
16
|
-
let { id: t } = e;
|
|
17
|
-
return typeof t != "string" || t.trim() === "" ? null : t;
|
|
18
|
-
}, S = (e, t) => d?.(e, t) ?? x(e, t);
|
|
19
|
-
function C(e, t) {
|
|
20
|
-
_ = {
|
|
21
|
-
generation: _.generation + 1,
|
|
22
|
-
reason: t,
|
|
23
|
-
status: e
|
|
24
|
-
};
|
|
25
|
-
for (let e of v) e();
|
|
26
|
-
}
|
|
27
|
-
function w() {
|
|
28
|
-
if (l != null) {
|
|
29
|
-
try {
|
|
30
|
-
l.dispose();
|
|
31
|
-
} catch {}
|
|
32
|
-
l = void 0;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
function T() {
|
|
36
|
-
return _;
|
|
37
|
-
}
|
|
38
|
-
function E(e) {
|
|
39
|
-
return v.add(e), () => {
|
|
40
|
-
v.delete(e);
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
function D(e = {}) {
|
|
44
|
-
w(), C("reconnecting", e.reason ?? "manual_reconnect");
|
|
45
|
-
}
|
|
46
|
-
async function O(e = {}) {
|
|
47
|
-
let t = l;
|
|
48
|
-
t?.hasActiveConnection() && (await t.refreshAuthentication() || D({ reason: e.reason ?? "auth_refresh_fallback" }));
|
|
49
|
-
}
|
|
50
|
-
function k(e = {}) {
|
|
51
|
-
let { httpUrl: t, wsUrl: n, logEvents: r, getDataId: i, getAuthHeaders: a } = e;
|
|
52
|
-
typeof t == "string" && t !== "" && (o = t), typeof n == "string" && n !== "" && (s = n), r != null && (b = r ? (e) => {
|
|
53
|
-
console.log("relayFieldLogger: ", e);
|
|
54
|
-
} : y), d = i, u = a, w(), c = void 0, C("configured", "configure");
|
|
55
|
-
}
|
|
56
|
-
function A() {
|
|
57
|
-
let e = s;
|
|
58
|
-
if (e.startsWith("ws")) return e;
|
|
59
|
-
if (e.startsWith("http")) return e.replace(/^http/, "ws");
|
|
60
|
-
if (e.startsWith("/")) {
|
|
61
|
-
if (typeof window > "u") return e;
|
|
62
|
-
let t = "ws:";
|
|
63
|
-
return window.location.protocol === "https:" && (t = "wss:"), `${t}//${window.location.host}${e}`;
|
|
64
|
-
}
|
|
65
|
-
return e;
|
|
66
|
-
}
|
|
67
|
-
function j(...t) {
|
|
68
|
-
e() && console.log("[RelayNetwork]", ...t);
|
|
69
|
-
}
|
|
70
|
-
async function M() {
|
|
71
|
-
return u == null ? {} : u();
|
|
72
|
-
}
|
|
73
|
-
var N = class {
|
|
74
|
-
url;
|
|
75
|
-
socket = null;
|
|
76
|
-
connectPromise = null;
|
|
77
|
-
disposed = !1;
|
|
78
|
-
acknowledged = !1;
|
|
79
|
-
retryCount = 0;
|
|
80
|
-
nextId = 1;
|
|
81
|
-
keepAliveTimer = null;
|
|
82
|
-
subscriptions = /* @__PURE__ */ new Map();
|
|
83
|
-
pendingAuthUpdate = null;
|
|
84
|
-
constructor(e) {
|
|
85
|
-
this.url = e;
|
|
86
|
-
}
|
|
87
|
-
hasActiveConnection() {
|
|
88
|
-
return this.socket?.readyState === WebSocket.OPEN && this.acknowledged;
|
|
89
|
-
}
|
|
90
|
-
dispose() {
|
|
91
|
-
this.disposed = !0, this.resolvePendingAuthUpdate(!1), this.stopKeepAlive();
|
|
92
|
-
let { socket: e } = this;
|
|
93
|
-
this.socket = null, this.connectPromise = null, this.acknowledged = !1, e != null && e.readyState !== WebSocket.CLOSED && e.close(1e3, "Normal Closure");
|
|
94
|
-
}
|
|
95
|
-
subscribe(e, t) {
|
|
96
|
-
let n = String(this.nextId);
|
|
97
|
-
return this.nextId += 1, this.subscriptions.set(n, {
|
|
98
|
-
payload: e,
|
|
99
|
-
sink: t
|
|
100
|
-
}), this.connectAndSubscribe(n).catch((e) => {
|
|
101
|
-
j("subscription websocket connect failed", e), this.scheduleReconnect();
|
|
102
|
-
}), () => {
|
|
103
|
-
this.unsubscribe(n);
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
async refreshAuthentication() {
|
|
107
|
-
if (!this.hasActiveConnection()) return !0;
|
|
108
|
-
let { socket: e } = this;
|
|
109
|
-
if (e == null) return !0;
|
|
110
|
-
if (this.pendingAuthUpdate != null) return !1;
|
|
111
|
-
let t;
|
|
112
|
-
try {
|
|
113
|
-
t = await M();
|
|
114
|
-
} catch {
|
|
115
|
-
return !1;
|
|
116
|
-
}
|
|
117
|
-
return Object.keys(t).length === 0 ? !1 : new Promise((e) => {
|
|
118
|
-
let n = setTimeout(() => {
|
|
119
|
-
this.pendingAuthUpdate = null, e(!1);
|
|
120
|
-
}, p);
|
|
121
|
-
this.pendingAuthUpdate = {
|
|
122
|
-
resolve: e,
|
|
123
|
-
timeout: n
|
|
124
|
-
}, this.send({
|
|
125
|
-
type: "connection_auth_update",
|
|
126
|
-
payload: t
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
async connectAndSubscribe(e) {
|
|
131
|
-
let t = this.hasActiveConnection();
|
|
132
|
-
if (await this.ensureConnected(), !t) return;
|
|
133
|
-
let n = this.subscriptions.get(e);
|
|
134
|
-
n != null && this.send({
|
|
135
|
-
id: e,
|
|
136
|
-
type: "subscribe",
|
|
137
|
-
payload: n.payload
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
async ensureConnected() {
|
|
141
|
-
if (!this.hasActiveConnection()) {
|
|
142
|
-
if (this.connectPromise != null) {
|
|
143
|
-
await this.connectPromise;
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
this.connectPromise = this.openSocket();
|
|
147
|
-
try {
|
|
148
|
-
await this.connectPromise;
|
|
149
|
-
} finally {
|
|
150
|
-
this.connectPromise = null;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
async openSocket() {
|
|
155
|
-
if (this.disposed) throw Error("WebSocket client is disposed");
|
|
156
|
-
await new Promise((e, t) => {
|
|
157
|
-
let n = !1, r = () => {
|
|
158
|
-
n || (n = !0, e());
|
|
159
|
-
}, i = (e) => {
|
|
160
|
-
n || (n = !0, t(e));
|
|
161
|
-
}, a = new WebSocket(this.url, f);
|
|
162
|
-
this.socket = a, this.acknowledged = !1, a.onopen = () => {
|
|
163
|
-
M().catch(() => ({})).then((e) => {
|
|
164
|
-
if (a.readyState === WebSocket.OPEN) {
|
|
165
|
-
if (Object.keys(e).length > 0) {
|
|
166
|
-
this.send({
|
|
167
|
-
type: "connection_init",
|
|
168
|
-
payload: e
|
|
169
|
-
});
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
this.send({ type: "connection_init" });
|
|
173
|
-
}
|
|
174
|
-
}).catch((e) => {
|
|
175
|
-
i(e);
|
|
176
|
-
});
|
|
177
|
-
}, a.onerror = () => {
|
|
178
|
-
i(/* @__PURE__ */ Error("GraphQL subscription websocket error"));
|
|
179
|
-
}, a.onmessage = (e) => {
|
|
180
|
-
this.handleMessage(e.data, r, i);
|
|
181
|
-
}, a.onclose = () => {
|
|
182
|
-
i(/* @__PURE__ */ Error("GraphQL subscription websocket closed")), this.handleClose();
|
|
183
|
-
};
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
handleMessage(e, t, n) {
|
|
187
|
-
let r;
|
|
188
|
-
try {
|
|
189
|
-
r = JSON.parse(String(e));
|
|
190
|
-
} catch {
|
|
191
|
-
n(/* @__PURE__ */ Error("Invalid GraphQL websocket message")), this.socket?.close(4400, "Invalid websocket message");
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
switch (r.type) {
|
|
195
|
-
case "connection_ack":
|
|
196
|
-
this.acknowledged = !0, this.retryCount = 0, this.startKeepAlive(), t(), this.resubscribeActiveOperations();
|
|
197
|
-
return;
|
|
198
|
-
case "connection_auth_update_ack":
|
|
199
|
-
this.resolvePendingAuthUpdate(!0);
|
|
200
|
-
return;
|
|
201
|
-
case "next":
|
|
202
|
-
this.subscriptions.get(r.id)?.sink.next(r.payload);
|
|
203
|
-
return;
|
|
204
|
-
case "error":
|
|
205
|
-
r.id == null ? this.resolvePendingAuthUpdate(!1) : this.failSubscription(r.id, r.payload);
|
|
206
|
-
return;
|
|
207
|
-
case "complete":
|
|
208
|
-
this.completeSubscription(r.id);
|
|
209
|
-
return;
|
|
210
|
-
case "ping":
|
|
211
|
-
this.send({
|
|
212
|
-
type: "pong",
|
|
213
|
-
payload: r.payload
|
|
214
|
-
});
|
|
215
|
-
return;
|
|
216
|
-
case "pong": return;
|
|
217
|
-
default: n(/* @__PURE__ */ Error("Unsupported GraphQL websocket message")), this.socket?.close(4400, "Unsupported websocket message");
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
handleClose() {
|
|
221
|
-
this.acknowledged = !1, this.socket = null, this.connectPromise = null, this.stopKeepAlive(), this.resolvePendingAuthUpdate(!1), !this.disposed && this.subscriptions.size > 0 && this.scheduleReconnect();
|
|
222
|
-
}
|
|
223
|
-
scheduleReconnect() {
|
|
224
|
-
if (this.retryCount >= h) {
|
|
225
|
-
let e = /* @__PURE__ */ Error("GraphQL subscription websocket retry exhausted");
|
|
226
|
-
for (let t of [...this.subscriptions.keys()]) this.failSubscription(t, e);
|
|
227
|
-
return;
|
|
228
|
-
}
|
|
229
|
-
let e = Math.min(8e3, g * 2 ** this.retryCount) + Math.random() * 200;
|
|
230
|
-
this.retryCount += 1, setTimeout(() => {
|
|
231
|
-
this.disposed || this.subscriptions.size === 0 || this.ensureConnected().catch((e) => {
|
|
232
|
-
this.scheduleReconnect(), j("subscription websocket reconnect failed", e);
|
|
233
|
-
});
|
|
234
|
-
}, e);
|
|
235
|
-
}
|
|
236
|
-
resubscribeActiveOperations() {
|
|
237
|
-
for (let [e, t] of this.subscriptions) this.send({
|
|
238
|
-
id: e,
|
|
239
|
-
type: "subscribe",
|
|
240
|
-
payload: t.payload
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
unsubscribe(e) {
|
|
244
|
-
this.subscriptions.delete(e) && this.socket?.readyState === WebSocket.OPEN && this.send({
|
|
245
|
-
id: e,
|
|
246
|
-
type: "complete"
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
failSubscription(e, t) {
|
|
250
|
-
let n = this.subscriptions.get(e);
|
|
251
|
-
n != null && (this.subscriptions.delete(e), n.sink.error(t));
|
|
252
|
-
}
|
|
253
|
-
completeSubscription(e) {
|
|
254
|
-
let t = this.subscriptions.get(e);
|
|
255
|
-
t != null && (this.subscriptions.delete(e), t.sink.complete());
|
|
256
|
-
}
|
|
257
|
-
startKeepAlive() {
|
|
258
|
-
this.stopKeepAlive(), this.keepAliveTimer = setInterval(() => {
|
|
259
|
-
this.socket?.readyState === WebSocket.OPEN && this.send({ type: "ping" });
|
|
260
|
-
}, m);
|
|
261
|
-
}
|
|
262
|
-
stopKeepAlive() {
|
|
263
|
-
this.keepAliveTimer != null && (clearInterval(this.keepAliveTimer), this.keepAliveTimer = null);
|
|
264
|
-
}
|
|
265
|
-
resolvePendingAuthUpdate(e) {
|
|
266
|
-
let t = this.pendingAuthUpdate;
|
|
267
|
-
t != null && (clearTimeout(t.timeout), this.pendingAuthUpdate = null, t.resolve(e));
|
|
268
|
-
}
|
|
269
|
-
send(e) {
|
|
270
|
-
let { socket: t } = this;
|
|
271
|
-
t?.readyState === WebSocket.OPEN && t.send(JSON.stringify(e));
|
|
272
|
-
}
|
|
273
|
-
};
|
|
274
|
-
function P() {
|
|
275
|
-
if (l != null) return l;
|
|
276
|
-
if (typeof window > "u") throw Error("GraphQL subscriptions unavailable in non-browser environment");
|
|
277
|
-
return l = new N(A()), l;
|
|
278
|
-
}
|
|
279
|
-
function F(e) {
|
|
280
|
-
return typeof File < "u" && e instanceof File || typeof Blob < "u" && e instanceof Blob;
|
|
281
|
-
}
|
|
282
|
-
function I(e, t, n) {
|
|
283
|
-
if (F(e)) return n.push({
|
|
284
|
-
path: t,
|
|
285
|
-
file: e
|
|
286
|
-
}), null;
|
|
287
|
-
if (Array.isArray(e)) return e.map((e, r) => I(e, `${t}.${r}`, n));
|
|
288
|
-
if (typeof e == "object" && e) {
|
|
289
|
-
let r = {};
|
|
290
|
-
for (let [i, a] of Object.entries(e)) r[i] = I(a, `${t}.${i}`, n);
|
|
291
|
-
return r;
|
|
292
|
-
}
|
|
293
|
-
return e;
|
|
294
|
-
}
|
|
295
|
-
function L(e, t) {
|
|
296
|
-
let n = [], r = I(t, "variables", n), i = new FormData(), a = {
|
|
297
|
-
query: e,
|
|
298
|
-
variables: r
|
|
299
|
-
};
|
|
300
|
-
i.append("operations", JSON.stringify(a));
|
|
301
|
-
let o = {};
|
|
302
|
-
return n.forEach((e, t) => {
|
|
303
|
-
o[t] = [e.path];
|
|
304
|
-
}), i.append("map", JSON.stringify(o)), n.forEach((e, t) => {
|
|
305
|
-
i.append(String(t), e.file);
|
|
306
|
-
}), i;
|
|
307
|
-
}
|
|
308
|
-
var R = {
|
|
309
|
-
maxAttempts: 3,
|
|
310
|
-
baseDelayMs: 300,
|
|
311
|
-
maxDelayMs: 4e3,
|
|
312
|
-
fetchTimeoutMs: 6e5
|
|
313
|
-
};
|
|
314
|
-
async function z(e) {
|
|
315
|
-
await new Promise((t) => {
|
|
316
|
-
setTimeout(() => {
|
|
317
|
-
t();
|
|
318
|
-
}, e);
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
function B(e, t) {
|
|
322
|
-
let n = Math.min(t.maxDelayMs, t.baseDelayMs * 2 ** e);
|
|
323
|
-
return n + Math.random() * .2 * n;
|
|
324
|
-
}
|
|
325
|
-
function V(e) {
|
|
326
|
-
return e === 408 || e === 429 || e >= 500 && e < 600;
|
|
327
|
-
}
|
|
328
|
-
function H(e) {
|
|
329
|
-
return e instanceof TypeError || e instanceof Error && e.name === "AbortError";
|
|
330
|
-
}
|
|
331
|
-
var U = class extends Error {
|
|
332
|
-
errors;
|
|
333
|
-
response;
|
|
334
|
-
constructor(e, t) {
|
|
335
|
-
super(e[0]?.message ?? "GraphQL response error"), this.errors = e, this.response = t, this.name = "GraphQLResponseError";
|
|
336
|
-
}
|
|
337
|
-
};
|
|
338
|
-
function W(e) {
|
|
339
|
-
return e == null ? !1 : typeof e == "object" ? Object.values(e).some((e) => e != null) : !0;
|
|
340
|
-
}
|
|
341
|
-
function G(e) {
|
|
342
|
-
let { data: t, errors: n } = e;
|
|
343
|
-
if (typeof t != "object" || !t || !Array.isArray(n) || n.length === 0) return !1;
|
|
344
|
-
let r = t;
|
|
345
|
-
return n.every((e) => {
|
|
346
|
-
let [t, ...n] = e.path ?? [];
|
|
347
|
-
return typeof t != "string" || n.length === 0 ? !1 : Object.prototype.hasOwnProperty.call(r, t) && r[t] == null;
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
function K(e) {
|
|
351
|
-
return Array.isArray(e.errors) && e.errors.length > 0 && !W(e.data) && !G(e);
|
|
352
|
-
}
|
|
353
|
-
async function q(e, t, n, r) {
|
|
354
|
-
let i = e.text;
|
|
355
|
-
if (i == null) throw Error("Missing GraphQL query text");
|
|
356
|
-
let a = i;
|
|
357
|
-
async function s(e) {
|
|
358
|
-
let n = new AbortController(), r = setTimeout(() => {
|
|
359
|
-
n.abort();
|
|
360
|
-
}, R.fetchTimeoutMs);
|
|
361
|
-
try {
|
|
362
|
-
let r, i = {};
|
|
363
|
-
if (u != null) try {
|
|
364
|
-
Object.assign(i, await u());
|
|
365
|
-
} catch {}
|
|
366
|
-
(() => {
|
|
367
|
-
try {
|
|
368
|
-
let e = [t];
|
|
369
|
-
for (; e.length > 0;) {
|
|
370
|
-
let t = e.pop();
|
|
371
|
-
if (F(t)) return !0;
|
|
372
|
-
Array.isArray(t) ? e.push(...t) : typeof t == "object" && t && e.push(...Object.values(t));
|
|
373
|
-
}
|
|
374
|
-
} catch {}
|
|
375
|
-
return !1;
|
|
376
|
-
})() ? r = L(a, t) : (i["Content-Type"] = "application/json", r = JSON.stringify({
|
|
377
|
-
query: a,
|
|
378
|
-
variables: t
|
|
379
|
-
}));
|
|
380
|
-
let s = await fetch(o, {
|
|
381
|
-
method: "POST",
|
|
382
|
-
body: r,
|
|
383
|
-
headers: i,
|
|
384
|
-
credentials: "include",
|
|
385
|
-
signal: n.signal
|
|
386
|
-
});
|
|
387
|
-
if (!s.ok) {
|
|
388
|
-
if (e < R.maxAttempts - 1 && V(s.status)) throw Error(`Retryable HTTP status ${s.status}`);
|
|
389
|
-
let t = await s.text().catch(() => "");
|
|
390
|
-
throw Error(`GraphQL HTTP error ${s.status}: ${t}`);
|
|
391
|
-
}
|
|
392
|
-
let c = await s.json();
|
|
393
|
-
if (Array.isArray(c.errors) && c.errors.length > 0 && j("GraphQL errors", c.errors), K(c)) throw new U(c.errors ?? [], c);
|
|
394
|
-
return c;
|
|
395
|
-
} finally {
|
|
396
|
-
clearTimeout(r);
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
for (let e = 0; e < R.maxAttempts; e += 1) try {
|
|
400
|
-
return await s(e);
|
|
401
|
-
} catch (t) {
|
|
402
|
-
let n = e === R.maxAttempts - 1;
|
|
403
|
-
if (!(H(t) || t instanceof Error && t.message.includes("Retryable HTTP status")) || n) throw j("GraphQL fetch error", t), t;
|
|
404
|
-
await z(B(e, R));
|
|
405
|
-
}
|
|
406
|
-
throw Error("Exhausted retries without returning a result");
|
|
407
|
-
}
|
|
408
|
-
function J(e, t) {
|
|
409
|
-
return j("subscription:start", e.name, t), r.create((n) => {
|
|
410
|
-
let r = e.text;
|
|
411
|
-
if (r == null || r === "") return n.error(/* @__PURE__ */ Error("Subscription operation text is empty")), () => {};
|
|
412
|
-
let i = P().subscribe({
|
|
413
|
-
query: r,
|
|
414
|
-
variables: t,
|
|
415
|
-
operationName: e.name
|
|
416
|
-
}, {
|
|
417
|
-
next: (e) => {
|
|
418
|
-
n.next(e);
|
|
419
|
-
},
|
|
420
|
-
error: (e) => {
|
|
421
|
-
let t;
|
|
422
|
-
t = e instanceof Error ? e : /* @__PURE__ */ Error("Subscription error"), n.error(t);
|
|
423
|
-
},
|
|
424
|
-
complete: () => {
|
|
425
|
-
n.complete();
|
|
426
|
-
}
|
|
427
|
-
});
|
|
428
|
-
return () => {
|
|
429
|
-
i();
|
|
430
|
-
};
|
|
431
|
-
});
|
|
432
|
-
}
|
|
433
|
-
function Y() {
|
|
434
|
-
return n.create(q, J);
|
|
435
|
-
}
|
|
436
|
-
function X() {
|
|
437
|
-
return c ??= new t({
|
|
438
|
-
getDataID: S,
|
|
439
|
-
relayFieldLogger: b,
|
|
440
|
-
network: Y(),
|
|
441
|
-
store: new a(new i())
|
|
442
|
-
}), c;
|
|
443
|
-
}
|
|
444
|
-
function Z() {
|
|
445
|
-
let e = X(), t = new i();
|
|
446
|
-
e.getStore().publish(t), e.getStore().notify();
|
|
447
|
-
}
|
|
448
|
-
var Q = {
|
|
449
|
-
RelayWebSocketClient: N,
|
|
450
|
-
buildFormData: L,
|
|
451
|
-
calcBackoff: B,
|
|
452
|
-
collectFiles: I,
|
|
453
|
-
getDataId: S,
|
|
454
|
-
hasUsableTopLevelData: W,
|
|
455
|
-
isNetworkError: H,
|
|
456
|
-
isRetryableStatus: V,
|
|
457
|
-
isUploadable: F,
|
|
458
|
-
shouldThrowGraphQLResponseError: K
|
|
459
|
-
};
|
|
460
|
-
//#endregion
|
|
461
|
-
export { U as GraphQLResponseError, Q as __test, k as configureRelayEnvironment, X as getEnvironment, Y as getNetwork, T as getRelayTransportSnapshot, D as reconnectRelayWebSocket, O as refreshRelayWebSocketAuthentication, Z as resetRelayStore, E as subscribeRelayTransport };
|
|
462
|
-
|
|
463
|
-
//# sourceMappingURL=environment.js.map
|
|
1
|
+
import { configureRelayEnvironment as e, getEnvironment as t, getNetwork as n, getRelayOperationActivitySnapshot as r, getRelayTransportSnapshot as i, reconnectRelayWebSocket as a, refreshRelayWebSocketAuthentication as o, resetRelayStore as s, subscribeRelayOperationActivity as c, subscribeRelayTransport as l } from "@plumile/relay";
|
|
2
|
+
export { e as configureRelayEnvironment, t as getEnvironment, n as getNetwork, r as getRelayOperationActivitySnapshot, i as getRelayTransportSnapshot, a as reconnectRelayWebSocket, o as refreshRelayWebSocketAuthentication, s as resetRelayStore, c as subscribeRelayOperationActivity, l as subscribeRelayTransport };
|
|
@@ -1,15 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
//#region src/relay/shortAccessTokenEnvironment.ts
|
|
4
|
-
function i(i) {
|
|
5
|
-
return r({
|
|
6
|
-
...i,
|
|
7
|
-
configureRelayEnvironment: e,
|
|
8
|
-
reconnectRelayWebSocket: t,
|
|
9
|
-
refreshRelayWebSocketAuthentication: n
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
//#endregion
|
|
13
|
-
export { i as configureBackofficeShortAccessTokenRelayEnvironment };
|
|
14
|
-
|
|
15
|
-
//# sourceMappingURL=shortAccessTokenEnvironment.js.map
|
|
1
|
+
import { configureShortAccessTokenRelayEnvironment as e, configureShortAccessTokenRelayEnvironment as t } from "@plumile/relay";
|
|
2
|
+
export { t as configureBackofficeShortAccessTokenRelayEnvironment, e as configureShortAccessTokenRelayEnvironment };
|
|
@@ -119,6 +119,7 @@ function U(i) {
|
|
|
119
119
|
let t = H({
|
|
120
120
|
path: "",
|
|
121
121
|
resourcePage: _,
|
|
122
|
+
prepareSearchBehavior: "path",
|
|
122
123
|
prepare: async ({ context: t, query: n }) => {
|
|
123
124
|
let { config: r } = await c.loadListEntity(e.id), { list: i, listUrlCodec: a, listDefaults: o } = r;
|
|
124
125
|
if (a == null || o == null) throw Error(`Backoffice entity ${e.id} does not expose a list configuration.`);
|
|
@@ -169,6 +170,7 @@ function U(i) {
|
|
|
169
170
|
let n = H({
|
|
170
171
|
path: t.pathSegment,
|
|
171
172
|
resourcePage: v,
|
|
173
|
+
suspenseBoundary: "segment",
|
|
172
174
|
prepare: async ({ context: n, variables: r }) => {
|
|
173
175
|
let i = String(r.id ?? ""), a = await c.loadDetailPageEntity(e.id, t.id), o = a.config.page.buildVariables == null ? { variables: { id: i } } : a.config.page.buildVariables({ id: i }), s = f(n.relayEnvironment, a.config.page.query, o.variables);
|
|
174
176
|
return {
|
|
@@ -197,6 +199,7 @@ function U(i) {
|
|
|
197
199
|
}), a = H({
|
|
198
200
|
path: "",
|
|
199
201
|
resourcePage: b,
|
|
202
|
+
suspenseBoundary: "segment",
|
|
200
203
|
prepare: async ({ context: t, variables: n }) => {
|
|
201
204
|
let { config: r } = await c.loadDetailLayoutEntity(e.id), i = String(n.id ?? ""), a = r.layoutPage.buildVariables == null ? { variables: { id: i } } : r.layoutPage.buildVariables({ id: i }), o = f(t.relayEnvironment, r.layoutPage.query, a.variables);
|
|
202
205
|
return {
|
|
@@ -234,6 +237,7 @@ function U(i) {
|
|
|
234
237
|
H({
|
|
235
238
|
path: ":pagePath",
|
|
236
239
|
resourcePage: x,
|
|
240
|
+
suspenseBoundary: "segment",
|
|
237
241
|
prepare: async ({ variables: t }) => {
|
|
238
242
|
let n = await c.loadDetailLayoutEntity(e.id), r = String(t.id ?? ""), i = String(t.pagePath ?? "");
|
|
239
243
|
return {
|
|
@@ -259,13 +263,13 @@ function U(i) {
|
|
|
259
263
|
let s = H({
|
|
260
264
|
path: ":id",
|
|
261
265
|
resourcePage: y,
|
|
262
|
-
|
|
263
|
-
|
|
266
|
+
suspenseBoundary: "segment",
|
|
267
|
+
prepare: ({ variables: t }) => {
|
|
268
|
+
let n = String(t.id ?? "");
|
|
264
269
|
return {
|
|
265
270
|
entityId: e.id,
|
|
266
271
|
entityManifest: e,
|
|
267
|
-
|
|
268
|
-
id: r
|
|
272
|
+
id: n
|
|
269
273
|
};
|
|
270
274
|
},
|
|
271
275
|
render: ({ children: e, prepared: t, Component: n }) => {
|
|
@@ -273,7 +277,6 @@ function U(i) {
|
|
|
273
277
|
let r = t;
|
|
274
278
|
return /* @__PURE__ */ o(n, {
|
|
275
279
|
entityManifest: r.entityManifest,
|
|
276
|
-
config: r.entityConfig,
|
|
277
280
|
prepared: r,
|
|
278
281
|
children: e
|
|
279
282
|
});
|
|
@@ -283,7 +286,8 @@ function U(i) {
|
|
|
283
286
|
return q.set(s, e.id), r.push(s), H({
|
|
284
287
|
path: n,
|
|
285
288
|
children: r,
|
|
286
|
-
resourcePage: m
|
|
289
|
+
resourcePage: m,
|
|
290
|
+
suspenseBoundary: "segment"
|
|
287
291
|
});
|
|
288
292
|
}), ue = Object.values(s).filter((e) => e.kind === "tool").map((e) => {
|
|
289
293
|
let t = H({
|
|
@@ -312,6 +316,7 @@ function U(i) {
|
|
|
312
316
|
path: I,
|
|
313
317
|
resourcePage: h,
|
|
314
318
|
prepareSearchBehavior: "path",
|
|
319
|
+
suspenseBoundary: "segment",
|
|
315
320
|
prepare: ie,
|
|
316
321
|
render: ({ children: e, prepared: t, route: n, Component: r }) => {
|
|
317
322
|
if (r == null) return null;
|