@nivaro/react 0.3.60 → 0.3.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/shared/components/CollectionBrowserView.js +259 -259
- package/dist/shared/components/ItemEditForm.js +4236 -4213
- package/dist/shared/components/import/reimportDiff.js +67 -46
- package/dist/shared/components/item-edit/QueueReturnChip.js +17 -13
- package/dist/shared/components/item-edit/RecordHeaderActions.js +8 -8
- package/dist/shared/components/item-edit/staged-links.js +21 -21
- package/dist/shared/components/panels/AddendumPanel.js +464 -466
- package/dist/shared/components/panels/PipelinePanel.js +391 -364
- package/dist/shared/components/panels/landing-state.js +32 -19
- package/dist/shared/components/queue/QueueWorklist.js +224 -222
- package/dist/shared/lib/list-page-memory.js +40 -32
- package/dist/shared/lib/request-gate.js +159 -144
- package/package.json +1 -1
|
@@ -1,54 +1,59 @@
|
|
|
1
|
-
const
|
|
2
|
-
function
|
|
1
|
+
const c = "nvr:list-page:", l = `${c}last:`, f = 50;
|
|
2
|
+
function s() {
|
|
3
3
|
var e;
|
|
4
4
|
if (typeof window > "u") return null;
|
|
5
5
|
const t = (e = window.history) == null ? void 0 : e.state;
|
|
6
6
|
return typeof (t == null ? void 0 : t.key) == "string" && t.key ? t.key : null;
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
|
|
8
|
+
function w() {
|
|
9
|
+
var e, r;
|
|
10
|
+
if (typeof window > "u") return !1;
|
|
11
|
+
const t = (e = window.history) == null ? void 0 : e.state;
|
|
12
|
+
return ((r = t == null ? void 0 : t.usr) == null ? void 0 : r.nvrListReturn) === !0;
|
|
13
|
+
}
|
|
14
|
+
function h() {
|
|
15
|
+
const t = s();
|
|
10
16
|
if (t || typeof window > "u" || !window.history) return t;
|
|
11
17
|
try {
|
|
12
18
|
const e = window.history.state, r = e && typeof e == "object" ? e : {}, n = `nvr${Math.random().toString(36).slice(2, 10)}`;
|
|
13
|
-
return window.history.replaceState({ ...r, key: n }, ""),
|
|
19
|
+
return window.history.replaceState({ ...r, key: n }, ""), s();
|
|
14
20
|
} catch {
|
|
15
21
|
return null;
|
|
16
22
|
}
|
|
17
23
|
}
|
|
18
24
|
function a(t, e) {
|
|
19
|
-
return `${
|
|
25
|
+
return `${c}${t}|${e}`;
|
|
20
26
|
}
|
|
21
|
-
function
|
|
22
|
-
if (!e) return null;
|
|
27
|
+
function d(t, e = s()) {
|
|
23
28
|
try {
|
|
24
|
-
const
|
|
25
|
-
return Number.isInteger(
|
|
29
|
+
const n = (e ? window.sessionStorage.getItem(a(t, e)) : null) ?? (w() ? window.sessionStorage.getItem(l + t) : null), o = n == null ? Number.NaN : Number(n);
|
|
30
|
+
return Number.isInteger(o) && o > 1 && o < 1e5 ? o : null;
|
|
26
31
|
} catch {
|
|
27
32
|
return null;
|
|
28
33
|
}
|
|
29
34
|
}
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
n.setItem(c, String(Math.floor(e)));
|
|
39
|
-
const u = [];
|
|
40
|
-
for (let o = 0; o < n.length; o++) {
|
|
41
|
-
const i = n.key(o);
|
|
42
|
-
i != null && i.startsWith(s) && u.push(i);
|
|
43
|
-
}
|
|
44
|
-
for (const o of u.slice(0, Math.max(0, u.length - 50))) n.removeItem(o);
|
|
45
|
-
} catch {
|
|
35
|
+
function g(t, e, r = e > 1 ? h() : s()) {
|
|
36
|
+
try {
|
|
37
|
+
const n = window.sessionStorage;
|
|
38
|
+
if (!(e > 1)) {
|
|
39
|
+
n.removeItem(l + t), r && n.removeItem(a(t, r));
|
|
40
|
+
return;
|
|
46
41
|
}
|
|
42
|
+
if (n.setItem(l + t, String(Math.floor(e))), !r) return;
|
|
43
|
+
n.setItem(a(t, r), String(Math.floor(e)));
|
|
44
|
+
const o = [];
|
|
45
|
+
for (let i = 0; i < n.length; i++) {
|
|
46
|
+
const u = n.key(i);
|
|
47
|
+
u != null && u.startsWith(c) && !u.startsWith(l) && o.push(u);
|
|
48
|
+
}
|
|
49
|
+
for (const i of o.slice(0, Math.max(0, o.length - f))) n.removeItem(i);
|
|
50
|
+
} catch {
|
|
51
|
+
}
|
|
47
52
|
}
|
|
48
|
-
function
|
|
53
|
+
function m(t, e) {
|
|
49
54
|
return t && t > 1 && e === 1 ? t : e;
|
|
50
55
|
}
|
|
51
|
-
function
|
|
56
|
+
function y(t) {
|
|
52
57
|
if (t.pending == null) return null;
|
|
53
58
|
if (t.failed && !t.fetching) return { close: !0, page: null };
|
|
54
59
|
if (!t.gateOpen || !t.loaded || t.fetching || t.placeholder) return null;
|
|
@@ -56,8 +61,11 @@ function w(t) {
|
|
|
56
61
|
return { close: !0, page: e != null && t.page > e ? e : null };
|
|
57
62
|
}
|
|
58
63
|
export {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
w as arrivedByListReturn,
|
|
65
|
+
h as ensureHistoryKey,
|
|
66
|
+
s as historyKey,
|
|
67
|
+
m as pageWhileSettling,
|
|
68
|
+
g as rememberListPage,
|
|
69
|
+
d as rememberedListPage,
|
|
70
|
+
y as restoreWindowOutcome
|
|
63
71
|
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { isRehearsalCommand as
|
|
2
|
-
import { noteCredentialChanged as
|
|
3
|
-
function
|
|
1
|
+
import { isRehearsalCommand as $, noteOwnWriteFromCommand as R } from "./own-writes.js";
|
|
2
|
+
import { noteCredentialChanged as Z, isIdentityRead as H, claimIdentityCall as U, signedOutError as x, noteSignedIn as B, isSignedOutError as F, noteUnauthorized as W } from "./signed-out.js";
|
|
3
|
+
function G(t) {
|
|
4
4
|
if (!t || typeof t != "object") return "";
|
|
5
|
-
const s = Object.entries(t).filter(([, o]) => o != null).map(([o,
|
|
5
|
+
const s = Object.entries(t).filter(([, o]) => o != null).map(([o, c]) => [o, String(c)]).sort(([o], [c]) => o < c ? -1 : o > c ? 1 : 0);
|
|
6
6
|
return s.length ? new URLSearchParams(s).toString() : "";
|
|
7
7
|
}
|
|
8
8
|
function P(t) {
|
|
9
9
|
const s = (t._method ?? "GET").toUpperCase(), o = s === "GET" || t._body === void 0 ? "" : JSON.stringify(t._body);
|
|
10
|
-
return `${s} ${t._path ?? ""} ${
|
|
10
|
+
return `${s} ${t._path ?? ""} ${G(t._params)} ${o}`;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function C(t) {
|
|
13
13
|
return (t._method ?? "GET").toUpperCase() === "GET";
|
|
14
14
|
}
|
|
15
|
-
const
|
|
16
|
-
function
|
|
17
|
-
return
|
|
15
|
+
const j = /^\/(widgets-internal\/[^/]+\/render|items\/[^/]+\/[^/]+\/child-summary|items\/[^/]+\/auto-id-preview|config-conformance\/record\/.+\/check|pipelines\/instance\/[^/]+\/owners\/batch|addendums\/summary|at-risk\/evaluate|record-views\/.+\/touch)$/;
|
|
16
|
+
function J(t) {
|
|
17
|
+
return C(t) ? !0 : (t._method ?? "GET").toUpperCase() !== "POST" ? !1 : j.test((t._path ?? "").split("?")[0]);
|
|
18
18
|
}
|
|
19
|
-
function
|
|
19
|
+
function g(t) {
|
|
20
20
|
if (t == null || typeof t != "object") return t;
|
|
21
21
|
try {
|
|
22
22
|
return structuredClone(t);
|
|
@@ -24,11 +24,18 @@ function T(t) {
|
|
|
24
24
|
return t;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
const
|
|
27
|
+
const N = Symbol("nivaro.coalesced");
|
|
28
28
|
function K(t) {
|
|
29
|
-
return t[
|
|
29
|
+
return t[N] === !0;
|
|
30
30
|
}
|
|
31
|
-
const k = 20,
|
|
31
|
+
const k = 20, Y = /^\/items\/([A-Za-z_][A-Za-z0-9_]*)(?:\/([^/?#]+))?$/, Q = /* @__PURE__ */ new Set([
|
|
32
|
+
"aggregate",
|
|
33
|
+
"export",
|
|
34
|
+
"distinct",
|
|
35
|
+
"resolve-paths",
|
|
36
|
+
"batch-read",
|
|
37
|
+
"filter-check"
|
|
38
|
+
]), V = /* @__PURE__ */ new Set([
|
|
32
39
|
"fields",
|
|
33
40
|
"filter",
|
|
34
41
|
"sort",
|
|
@@ -41,32 +48,32 @@ const k = 20, J = /^\/items\/([A-Za-z_][A-Za-z0-9_]*)(?:\/([^/?#]+))?$/, Y = /*
|
|
|
41
48
|
"conditions",
|
|
42
49
|
"labels"
|
|
43
50
|
]);
|
|
44
|
-
function
|
|
51
|
+
function X(t) {
|
|
45
52
|
const s = t;
|
|
46
53
|
if ((s._method ?? "GET").toUpperCase() !== "GET") return null;
|
|
47
|
-
const o =
|
|
54
|
+
const o = Y.exec(s._path ?? "");
|
|
48
55
|
if (!o) return null;
|
|
49
|
-
const [,
|
|
50
|
-
if (d !== void 0 &&
|
|
51
|
-
const m = s._params ?? {},
|
|
52
|
-
for (const [
|
|
53
|
-
if (
|
|
54
|
-
if (!
|
|
55
|
-
|
|
56
|
+
const [, c, d] = o;
|
|
57
|
+
if (d !== void 0 && Q.has(d)) return null;
|
|
58
|
+
const m = s._params ?? {}, u = {};
|
|
59
|
+
for (const [i, a] of Object.entries(m))
|
|
60
|
+
if (a !== void 0) {
|
|
61
|
+
if (!V.has(i)) return null;
|
|
62
|
+
u[i] = a;
|
|
56
63
|
}
|
|
57
|
-
return d === void 0 ? { collection:
|
|
64
|
+
return d === void 0 ? { collection: c, query: u } : { collection: c, id: d, query: u };
|
|
58
65
|
}
|
|
59
|
-
function
|
|
66
|
+
function ee(t) {
|
|
60
67
|
let s = [], o;
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
63
|
-
let
|
|
68
|
+
const c = (u) => t.request(u.command).then(u.resolve, u.reject), d = async (u) => {
|
|
69
|
+
if (u.length === 1) return c(u[0]);
|
|
70
|
+
let i;
|
|
64
71
|
try {
|
|
65
|
-
const
|
|
72
|
+
const a = await t.request({
|
|
66
73
|
_method: "POST",
|
|
67
74
|
_path: "/items/batch-read",
|
|
68
75
|
_body: {
|
|
69
|
-
reads:
|
|
76
|
+
reads: u.map((n, e) => ({
|
|
70
77
|
key: String(e),
|
|
71
78
|
collection: n.read.collection,
|
|
72
79
|
...n.read.id !== void 0 ? { id: n.read.id } : {},
|
|
@@ -74,50 +81,54 @@ function X(t) {
|
|
|
74
81
|
}))
|
|
75
82
|
}
|
|
76
83
|
});
|
|
77
|
-
|
|
84
|
+
i = Array.isArray(a == null ? void 0 : a.results) ? a.results : void 0;
|
|
78
85
|
} catch {
|
|
79
|
-
|
|
86
|
+
i = void 0;
|
|
80
87
|
}
|
|
81
|
-
|
|
82
|
-
const e =
|
|
88
|
+
u.forEach((a, n) => {
|
|
89
|
+
const e = i == null ? void 0 : i[n];
|
|
90
|
+
if ((e == null ? void 0 : e.status) === 404 && a.read.id !== void 0) {
|
|
91
|
+
a.reject(L());
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
83
94
|
if ((e == null ? void 0 : e.status) !== 200 || e === void 0) {
|
|
84
|
-
|
|
95
|
+
c(a);
|
|
85
96
|
return;
|
|
86
97
|
}
|
|
87
|
-
|
|
98
|
+
a.resolve(a.read.id !== void 0 ? { data: e.data } : { data: e.data, ...e.meta ?? {} });
|
|
88
99
|
});
|
|
89
100
|
}, m = () => {
|
|
90
101
|
o = void 0;
|
|
91
|
-
const
|
|
102
|
+
const u = s;
|
|
92
103
|
s = [];
|
|
93
|
-
for (let
|
|
94
|
-
d(
|
|
104
|
+
for (let i = 0; i < u.length; i += k)
|
|
105
|
+
d(u.slice(i, i + k));
|
|
95
106
|
};
|
|
96
|
-
return (
|
|
107
|
+
return (u, i) => new Promise((a, n) => {
|
|
97
108
|
s.push({
|
|
98
|
-
read:
|
|
99
|
-
command:
|
|
100
|
-
resolve:
|
|
109
|
+
read: i,
|
|
110
|
+
command: u,
|
|
111
|
+
resolve: a,
|
|
101
112
|
reject: n
|
|
102
113
|
}), o === void 0 && (o = setTimeout(m, 0));
|
|
103
114
|
});
|
|
104
115
|
}
|
|
105
|
-
const
|
|
106
|
-
function
|
|
116
|
+
const I = 50, te = 10, ne = /^\/collections\/([A-Za-z_][A-Za-z0-9_-]{0,127})$/;
|
|
117
|
+
function se(t) {
|
|
107
118
|
const s = t;
|
|
108
|
-
if ((s._method ?? "GET").toUpperCase() !== "GET" ||
|
|
109
|
-
const o =
|
|
119
|
+
if ((s._method ?? "GET").toUpperCase() !== "GET" || G(s._params) !== "") return null;
|
|
120
|
+
const o = ne.exec(s._path ?? "");
|
|
110
121
|
return o ? o[1] : null;
|
|
111
122
|
}
|
|
112
|
-
function
|
|
123
|
+
function L() {
|
|
113
124
|
return Object.assign(new Error("Not found"), { status: 404, response: { error: "Not found" } });
|
|
114
125
|
}
|
|
115
126
|
function oe(t) {
|
|
116
|
-
let s = !0, o = [],
|
|
117
|
-
const d = (
|
|
118
|
-
const
|
|
119
|
-
if (
|
|
120
|
-
for (const
|
|
127
|
+
let s = !0, o = [], c;
|
|
128
|
+
const d = (i) => t.request(i.command).then(i.resolve, i.reject), m = async (i) => {
|
|
129
|
+
const a = [...new Set(i.map((r) => r.name))];
|
|
130
|
+
if (a.length === 1 || !s) {
|
|
131
|
+
for (const r of i) d(r);
|
|
121
132
|
return;
|
|
122
133
|
}
|
|
123
134
|
let n;
|
|
@@ -125,13 +136,13 @@ function oe(t) {
|
|
|
125
136
|
n = await t.request({
|
|
126
137
|
_method: "GET",
|
|
127
138
|
_path: "/collections",
|
|
128
|
-
_params: { names:
|
|
139
|
+
_params: { names: a.join(",") }
|
|
129
140
|
});
|
|
130
|
-
} catch (
|
|
131
|
-
const h =
|
|
141
|
+
} catch (r) {
|
|
142
|
+
const h = r == null ? void 0 : r.status;
|
|
132
143
|
if (h === 400 || h === 404 || h === 405) s = !1;
|
|
133
144
|
else if (h === 429 || h !== void 0 && h >= 500) {
|
|
134
|
-
for (const
|
|
145
|
+
for (const y of i) y.reject(r);
|
|
135
146
|
return;
|
|
136
147
|
}
|
|
137
148
|
n = void 0;
|
|
@@ -139,166 +150,169 @@ function oe(t) {
|
|
|
139
150
|
const e = n == null ? void 0 : n.data;
|
|
140
151
|
if (!e || typeof e != "object" || Array.isArray(e)) {
|
|
141
152
|
Array.isArray(e) && (s = !1);
|
|
142
|
-
for (const
|
|
153
|
+
for (const r of i) d(r);
|
|
143
154
|
return;
|
|
144
155
|
}
|
|
145
156
|
const l = e, f = new Set(Array.isArray(n == null ? void 0 : n.missing) ? n.missing : []);
|
|
146
|
-
for (const
|
|
147
|
-
Object.hasOwn(l,
|
|
148
|
-
},
|
|
149
|
-
|
|
150
|
-
const
|
|
157
|
+
for (const r of i)
|
|
158
|
+
Object.hasOwn(l, r.name) ? r.resolve({ data: g(l[r.name]) }) : f.has(r.name) ? r.reject(L()) : d(r);
|
|
159
|
+
}, u = () => {
|
|
160
|
+
c = void 0;
|
|
161
|
+
const i = o;
|
|
151
162
|
o = [];
|
|
152
|
-
const
|
|
153
|
-
for (const e of
|
|
163
|
+
const a = [], n = /* @__PURE__ */ new Map();
|
|
164
|
+
for (const e of i) {
|
|
154
165
|
let l = n.get(e.name);
|
|
155
166
|
if (!l) {
|
|
156
|
-
const f =
|
|
157
|
-
l = f &&
|
|
167
|
+
const f = a[a.length - 1], r = f ? new Set(f.map((h) => h.name)).size : I;
|
|
168
|
+
l = f && r < I ? f : [], l !== f && a.push(l), n.set(e.name, l);
|
|
158
169
|
}
|
|
159
170
|
l.push(e);
|
|
160
171
|
}
|
|
161
|
-
for (const e of
|
|
172
|
+
for (const e of a) m(e);
|
|
162
173
|
};
|
|
163
|
-
return (
|
|
174
|
+
return (i, a) => new Promise((n, e) => {
|
|
164
175
|
o.push({
|
|
165
|
-
name:
|
|
166
|
-
command:
|
|
176
|
+
name: a,
|
|
177
|
+
command: i,
|
|
167
178
|
resolve: n,
|
|
168
179
|
reject: e
|
|
169
|
-
}),
|
|
180
|
+
}), c === void 0 && (c = setTimeout(u, te));
|
|
170
181
|
});
|
|
171
182
|
}
|
|
172
|
-
const
|
|
173
|
-
function
|
|
183
|
+
const q = 3e3, re = /^\/(collections\/[A-Za-z_][A-Za-z0-9_-]*|field-config\/[A-Za-z_][A-Za-z0-9_-]*|collection-layouts(\/active|\/summary\/[A-Za-z_][A-Za-z0-9_-]*)?|chat\/room-types|users\/me)$/, ie = /^\/(record-views|item-locks|drafts|presence|rum|analytics|session-recordings|comments|notifications|tasks|field-rules\/evaluate|chat\/(?!room-types)|field-config\/[^/]+\/(evaluate-visibility|evaluate-defaults|evaluate-lock|cascade|project)$|items\/(?!nivaro_|directus_)[^/]+|users\/cards$|files\/verify$)/;
|
|
184
|
+
function ae(t) {
|
|
174
185
|
const s = (t._path ?? "").split("?")[0];
|
|
175
|
-
return (t._method ?? "GET").toUpperCase() === "POST" &&
|
|
186
|
+
return (t._method ?? "GET").toUpperCase() === "POST" && j.test(s) ? !0 : ie.test(s);
|
|
176
187
|
}
|
|
177
188
|
function ce(t) {
|
|
178
189
|
const s = t;
|
|
179
|
-
if (!
|
|
190
|
+
if (!C(s) || !re.test(s._path ?? "")) return !1;
|
|
180
191
|
const o = s._params;
|
|
181
192
|
return !(o && o.item != null && /^\/collection-layouts\/active$/.test(s._path ?? ""));
|
|
182
193
|
}
|
|
183
|
-
let
|
|
184
|
-
function
|
|
185
|
-
|
|
194
|
+
let p = 0;
|
|
195
|
+
function D() {
|
|
196
|
+
p++;
|
|
186
197
|
}
|
|
187
|
-
let
|
|
198
|
+
let E = 0;
|
|
188
199
|
const ue = 50, le = /^\/items\//;
|
|
189
|
-
function fe(t, s
|
|
190
|
-
|
|
200
|
+
function fe(t, s) {
|
|
201
|
+
return t.config === s;
|
|
202
|
+
}
|
|
203
|
+
function de(t, s, o, c) {
|
|
204
|
+
if (s.epoch !== c) return !1;
|
|
191
205
|
const d = t._path ?? "";
|
|
192
206
|
return !le.test(d) || o - s.at < ue;
|
|
193
207
|
}
|
|
194
208
|
function w(t, s) {
|
|
195
209
|
return t.then(
|
|
196
|
-
(o) => (s &&
|
|
210
|
+
(o) => (s && B(), o),
|
|
197
211
|
(o) => {
|
|
198
|
-
throw
|
|
212
|
+
throw F(o, s) && W(s), o;
|
|
199
213
|
}
|
|
200
214
|
);
|
|
201
215
|
}
|
|
202
|
-
function
|
|
216
|
+
function ye(t, s = {}) {
|
|
203
217
|
if (K(t)) return t;
|
|
204
|
-
const o = /* @__PURE__ */ new Map(),
|
|
205
|
-
let
|
|
206
|
-
const
|
|
207
|
-
if (e !==
|
|
208
|
-
|
|
218
|
+
const o = /* @__PURE__ */ new Map(), c = s.batchReads ? ee(t) : null, d = s.batchCollections === !1 ? null : oe(t), m = /* @__PURE__ */ new Map();
|
|
219
|
+
let u = p;
|
|
220
|
+
const i = (n, e, l) => {
|
|
221
|
+
if (e !== p) return;
|
|
222
|
+
u !== p && (m.clear(), u = p);
|
|
209
223
|
const f = Date.now();
|
|
210
|
-
for (const [
|
|
224
|
+
for (const [r, h] of m) f - h.at >= q && m.delete(r);
|
|
211
225
|
m.set(n, { at: f, epoch: e, value: l });
|
|
212
|
-
},
|
|
226
|
+
}, a = (n) => {
|
|
213
227
|
const e = n;
|
|
214
|
-
if (!
|
|
215
|
-
const _ =
|
|
228
|
+
if (!C(e)) {
|
|
229
|
+
const _ = $(e._path, e._params);
|
|
216
230
|
_ || R(e._method, e._path, e._body);
|
|
217
|
-
const
|
|
218
|
-
|
|
231
|
+
const S = !ae(e);
|
|
232
|
+
S && D(), E++;
|
|
219
233
|
const O = w(t.request(n), !1).finally(() => {
|
|
220
|
-
|
|
234
|
+
E++;
|
|
221
235
|
});
|
|
222
|
-
return (
|
|
236
|
+
return (S ? O.finally(D) : O).then((b) => (_ || R(e._method, e._path, e._body, b), b));
|
|
223
237
|
}
|
|
224
238
|
if (n._signal)
|
|
225
239
|
return w(t.request(n), !1);
|
|
226
240
|
const l = P(e), f = ce(e);
|
|
227
241
|
if (f) {
|
|
228
242
|
const _ = m.get(l);
|
|
229
|
-
if (_ && _.epoch ===
|
|
230
|
-
return Promise.resolve(
|
|
243
|
+
if (_ && _.epoch === p && Date.now() - _.at < q)
|
|
244
|
+
return Promise.resolve(g(_.value));
|
|
231
245
|
}
|
|
232
|
-
const
|
|
233
|
-
if (
|
|
234
|
-
return
|
|
235
|
-
const h =
|
|
236
|
-
if (h && !
|
|
237
|
-
const
|
|
238
|
-
|
|
246
|
+
const r = o.get(l);
|
|
247
|
+
if (r && (f ? fe(r, p) : de(e, r, Date.now(), E)))
|
|
248
|
+
return r.p.then(g);
|
|
249
|
+
const h = H(e._method, e._path, e._params);
|
|
250
|
+
if (h && !U()) return Promise.reject(x());
|
|
251
|
+
const y = c ? X(e) : null, T = !y && d ? se(e) : null, z = w(
|
|
252
|
+
y && c ? c(n, y) : T && d ? d(n, T) : t.request(n),
|
|
239
253
|
h
|
|
240
|
-
),
|
|
254
|
+
), M = p, A = z.then((_) => (f && i(l, M, g(_)), _)).finally(() => {
|
|
241
255
|
var _;
|
|
242
256
|
((_ = o.get(l)) == null ? void 0 : _.p) === A && o.delete(l);
|
|
243
257
|
});
|
|
244
|
-
return o.set(l, { p: A, at: Date.now(), epoch:
|
|
258
|
+
return o.set(l, { p: A, at: Date.now(), epoch: E, config: p }), A;
|
|
245
259
|
};
|
|
246
260
|
return new Proxy(t, {
|
|
247
261
|
get(n, e, l) {
|
|
248
|
-
if (e === "request") return
|
|
249
|
-
if (e ===
|
|
262
|
+
if (e === "request") return a;
|
|
263
|
+
if (e === N) return !0;
|
|
250
264
|
if (e === "setToken" && typeof n.setToken == "function")
|
|
251
|
-
return (
|
|
252
|
-
n.setToken(
|
|
265
|
+
return (r) => {
|
|
266
|
+
n.setToken(r), Z();
|
|
253
267
|
};
|
|
254
268
|
const f = Reflect.get(n, e, l);
|
|
255
269
|
return typeof f == "function" ? f.bind(n) : f;
|
|
256
270
|
}
|
|
257
271
|
});
|
|
258
272
|
}
|
|
259
|
-
const
|
|
260
|
-
function
|
|
273
|
+
const he = /^\/(item-locks|drafts|auth)\b/, v = /* @__PURE__ */ new Set();
|
|
274
|
+
function me() {
|
|
261
275
|
for (const t of [...v]) t();
|
|
262
276
|
}
|
|
263
|
-
function
|
|
277
|
+
function ve(t) {
|
|
264
278
|
return t.subscribe((s) => {
|
|
265
|
-
s.type === "observerAdded" && s.query.state.fetchStatus === "fetching" && v.size !== 0 &&
|
|
279
|
+
s.type === "observerAdded" && s.query.state.fetchStatus === "fetching" && v.size !== 0 && me();
|
|
266
280
|
});
|
|
267
281
|
}
|
|
268
|
-
function
|
|
269
|
-
let o = s.open ?? !0,
|
|
282
|
+
function ge(t, s = {}) {
|
|
283
|
+
let o = s.open ?? !0, c;
|
|
270
284
|
const d = /* @__PURE__ */ new Map(), m = () => {
|
|
271
285
|
const n = [...d.values()];
|
|
272
286
|
d.clear();
|
|
273
287
|
for (const e of n) e.release();
|
|
274
|
-
},
|
|
275
|
-
v.delete(
|
|
276
|
-
},
|
|
288
|
+
}, u = () => {
|
|
289
|
+
v.delete(u), m();
|
|
290
|
+
}, i = (n) => {
|
|
277
291
|
const e = n;
|
|
278
|
-
if (o || !
|
|
292
|
+
if (o || !J(e) || he.test(e._path ?? "")) return t.request(n);
|
|
279
293
|
const l = P(e), f = d.get(l);
|
|
280
|
-
if (f) return f.promise.then(
|
|
281
|
-
let
|
|
294
|
+
if (f) return f.promise.then(g);
|
|
295
|
+
let r = () => {
|
|
282
296
|
};
|
|
283
|
-
const
|
|
284
|
-
|
|
297
|
+
const y = new Promise((T) => {
|
|
298
|
+
r = T;
|
|
285
299
|
}).then(() => t.request(n));
|
|
286
|
-
return d.set(l, { promise:
|
|
300
|
+
return d.set(l, { promise: y, release: r }), v.add(u), y;
|
|
287
301
|
};
|
|
288
302
|
return new Proxy(t, {
|
|
289
303
|
get(n, e, l) {
|
|
290
|
-
if (e === "request") return
|
|
304
|
+
if (e === "request") return i;
|
|
291
305
|
if (e === "open") return o;
|
|
292
306
|
if (e === "setOpen")
|
|
293
|
-
return (
|
|
294
|
-
|
|
307
|
+
return (r) => {
|
|
308
|
+
c !== void 0 && (clearTimeout(c), c = void 0);
|
|
295
309
|
const h = o;
|
|
296
|
-
o =
|
|
310
|
+
o = r, r && !h && (v.delete(u), m());
|
|
297
311
|
};
|
|
298
312
|
if (e === "dispose")
|
|
299
313
|
return () => {
|
|
300
|
-
|
|
301
|
-
|
|
314
|
+
c === void 0 && (c = setTimeout(() => {
|
|
315
|
+
c = void 0, o = !0, v.delete(u), m();
|
|
302
316
|
}, 0));
|
|
303
317
|
};
|
|
304
318
|
const f = Reflect.get(n, e, l);
|
|
@@ -308,18 +322,19 @@ function ve(t, s = {}) {
|
|
|
308
322
|
}
|
|
309
323
|
export {
|
|
310
324
|
k as BATCH_READ_LIMIT,
|
|
311
|
-
|
|
312
|
-
|
|
325
|
+
I as COLLECTION_BATCH_LIMIT,
|
|
326
|
+
te as COLLECTION_BATCH_WINDOW_MS,
|
|
313
327
|
ue as RECORD_JOIN_MS,
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
328
|
+
q as SETTLED_READ_MS,
|
|
329
|
+
se as batchableCollectionMeta,
|
|
330
|
+
X as batchableRead,
|
|
331
|
+
ge as createGatedClient,
|
|
332
|
+
D as forgetSettledReads,
|
|
319
333
|
K as isCoalesced,
|
|
320
334
|
ce as isSettledRead,
|
|
321
|
-
fe as
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
335
|
+
fe as mayJoinConfigInflight,
|
|
336
|
+
de as mayJoinInflight,
|
|
337
|
+
me as releaseGatedReads,
|
|
338
|
+
ve as releaseGatedReadsOnSharedFetch,
|
|
339
|
+
ye as withGetCoalescing
|
|
325
340
|
};
|