@nivaro/react 0.3.56 → 0.3.58
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/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +9 -2
- package/dist/shared/components/CollectionBrowserView.js +2827 -2750
- package/dist/shared/components/DataTable.js +247 -236
- package/dist/shared/components/ItemEditForm.js +1693 -1668
- package/dist/shared/components/ProfileView.js +716 -715
- package/dist/shared/components/RecordReadView.js +367 -364
- package/dist/shared/components/ReportView.js +64 -39
- package/dist/shared/components/alerts/AlertManagerView.js +284 -271
- package/dist/shared/components/cbv/row-focus.js +19 -0
- package/dist/shared/components/help-videos/HelpVideoPlayer.js +152 -147
- package/dist/shared/components/integrations/console/SignalCard.js +59 -59
- package/dist/shared/components/integrations/console/tone.js +52 -30
- package/dist/shared/components/item-edit/CatalogPickerField.js +525 -505
- package/dist/shared/components/item-edit/FieldRow.js +175 -173
- package/dist/shared/components/item-edit/InlineTableField.js +407 -402
- package/dist/shared/components/item-edit/M2MCombobox.js +313 -291
- package/dist/shared/components/item-edit/MidairCollisionDialog.js +1 -1
- package/dist/shared/components/item-edit/PlanGrid.js +826 -803
- package/dist/shared/components/item-edit/QuickCreateButton.js +115 -79
- package/dist/shared/components/item-edit/RecordLiveSync.js +77 -75
- package/dist/shared/components/item-edit/RelationCombobox.js +412 -328
- package/dist/shared/components/item-edit/RelationGroupedCombobox.js +147 -125
- package/dist/shared/components/item-edit/SummaryPanel.js +406 -392
- package/dist/shared/components/item-edit/option-disambiguate.js +44 -32
- package/dist/shared/components/item-edit/related-missing.js +45 -0
- package/dist/shared/components/item-edit/save-outcome.js +5 -5
- package/dist/shared/components/notifications/NotificationRulesEditor.js +130 -123
- package/dist/shared/components/panels/AccessDeniedPanel.js +52 -48
- package/dist/shared/components/panels/ItemLockBanner.js +2 -3
- package/dist/shared/components/panels/PipelinePanel.js +1027 -978
- package/dist/shared/components/panels/RevisionsPanel.js +4 -1
- package/dist/shared/components/panels/TaskPanel.js +265 -249
- package/dist/shared/components/panels/landing-state.js +27 -0
- package/dist/shared/components/pipeline/PipelineEditorView.js +86 -78
- package/dist/shared/components/profile/AiMemoryCard.js +12 -10
- package/dist/shared/components/queue/OwnerAvatars.js +80 -41
- package/dist/shared/components/queue/QueueItemSheet.js +111 -111
- package/dist/shared/components/queue/QueueQuickFilters.js +48 -48
- package/dist/shared/components/queue/QueueWorklist.js +975 -964
- package/dist/shared/components/queue/group-sums.js +27 -0
- package/dist/shared/components/queue/live-state-aspect.js +7 -3
- package/dist/shared/components/queue/path-label.js +14 -0
- package/dist/shared/components/widgets/ReviewListWidget.js +186 -168
- package/dist/shared/lib/back-closes.js +25 -0
- package/dist/shared/lib/cbv-page-warm.js +36 -0
- package/dist/shared/lib/form-usage-beacon.js +7 -7
- package/dist/shared/lib/list-page-memory.js +41 -0
- package/dist/shared/lib/live.js +44 -44
- package/dist/shared/lib/own-writes.js +76 -28
- package/dist/shared/lib/record-ref.js +78 -53
- package/dist/shared/lib/request-gate.js +110 -109
- package/dist/shared/lib/validation-rules.js +34 -19
- package/package.json +1 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { noteOwnWriteFromCommand as
|
|
2
|
-
import { noteCredentialChanged as
|
|
3
|
-
function
|
|
1
|
+
import { isRehearsalCommand as M, noteOwnWriteFromCommand as R } from "./own-writes.js";
|
|
2
|
+
import { noteCredentialChanged as $, isIdentityRead as Z, claimIdentityCall as H, signedOutError as U, noteSignedIn as x, isSignedOutError as B, noteUnauthorized as F } from "./signed-out.js";
|
|
3
|
+
function I(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, i]) => [o, String(i)]).sort(([o], [i]) => o < i ? -1 : o > i ? 1 : 0);
|
|
6
6
|
return s.length ? new URLSearchParams(s).toString() : "";
|
|
7
7
|
}
|
|
8
|
-
function
|
|
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 ?? ""} ${I(t._params)} ${o}`;
|
|
11
11
|
}
|
|
12
12
|
function S(t) {
|
|
13
13
|
return (t._method ?? "GET").toUpperCase() === "GET";
|
|
14
14
|
}
|
|
15
|
-
const
|
|
16
|
-
function
|
|
17
|
-
return S(t) ? !0 : (t._method ?? "GET").toUpperCase() !== "POST" ? !1 :
|
|
15
|
+
const N = /^\/(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 W(t) {
|
|
17
|
+
return S(t) ? !0 : (t._method ?? "GET").toUpperCase() !== "POST" ? !1 : N.test((t._path ?? "").split("?")[0]);
|
|
18
18
|
}
|
|
19
19
|
function T(t) {
|
|
20
20
|
if (t == null || typeof t != "object") return t;
|
|
@@ -24,11 +24,11 @@ function T(t) {
|
|
|
24
24
|
return t;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
const
|
|
28
|
-
function
|
|
29
|
-
return t[
|
|
27
|
+
const j = Symbol("nivaro.coalesced");
|
|
28
|
+
function K(t) {
|
|
29
|
+
return t[j] === !0;
|
|
30
30
|
}
|
|
31
|
-
const
|
|
31
|
+
const k = 20, J = /^\/items\/([A-Za-z_][A-Za-z0-9_]*)(?:\/([^/?#]+))?$/, Y = /* @__PURE__ */ new Set(["aggregate", "export", "distinct", "resolve-paths", "batch-read"]), Q = /* @__PURE__ */ new Set([
|
|
32
32
|
"fields",
|
|
33
33
|
"filter",
|
|
34
34
|
"sort",
|
|
@@ -41,25 +41,25 @@ const R = 20, W = /^\/items\/([A-Za-z_][A-Za-z0-9_]*)(?:\/([^/?#]+))?$/, K = /*
|
|
|
41
41
|
"conditions",
|
|
42
42
|
"labels"
|
|
43
43
|
]);
|
|
44
|
-
function
|
|
44
|
+
function V(t) {
|
|
45
45
|
const s = t;
|
|
46
46
|
if ((s._method ?? "GET").toUpperCase() !== "GET") return null;
|
|
47
|
-
const o =
|
|
47
|
+
const o = J.exec(s._path ?? "");
|
|
48
48
|
if (!o) return null;
|
|
49
|
-
const [,
|
|
50
|
-
if (d !== void 0 &&
|
|
49
|
+
const [, i, d] = o;
|
|
50
|
+
if (d !== void 0 && Y.has(d)) return null;
|
|
51
51
|
const m = s._params ?? {}, c = {};
|
|
52
52
|
for (const [r, u] of Object.entries(m))
|
|
53
53
|
if (u !== void 0) {
|
|
54
|
-
if (!
|
|
54
|
+
if (!Q.has(r)) return null;
|
|
55
55
|
c[r] = u;
|
|
56
56
|
}
|
|
57
|
-
return d === void 0 ? { collection:
|
|
57
|
+
return d === void 0 ? { collection: i, query: c } : { collection: i, id: d, query: c };
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function X(t) {
|
|
60
60
|
let s = [], o;
|
|
61
|
-
const
|
|
62
|
-
if (c.length === 1) return
|
|
61
|
+
const i = (c) => t.request(c.command).then(c.resolve, c.reject), d = async (c) => {
|
|
62
|
+
if (c.length === 1) return i(c[0]);
|
|
63
63
|
let r;
|
|
64
64
|
try {
|
|
65
65
|
const u = await t.request({
|
|
@@ -81,7 +81,7 @@ function Q(t) {
|
|
|
81
81
|
c.forEach((u, n) => {
|
|
82
82
|
const e = r == null ? void 0 : r[n];
|
|
83
83
|
if ((e == null ? void 0 : e.status) !== 200 || e === void 0) {
|
|
84
|
-
|
|
84
|
+
i(u);
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
87
|
u.resolve(u.read.id !== void 0 ? { data: e.data } : { data: e.data, ...e.meta ?? {} });
|
|
@@ -90,8 +90,8 @@ function Q(t) {
|
|
|
90
90
|
o = void 0;
|
|
91
91
|
const c = s;
|
|
92
92
|
s = [];
|
|
93
|
-
for (let r = 0; r < c.length; r +=
|
|
94
|
-
d(c.slice(r, r +
|
|
93
|
+
for (let r = 0; r < c.length; r += k)
|
|
94
|
+
d(c.slice(r, r + k));
|
|
95
95
|
};
|
|
96
96
|
return (c, r) => new Promise((u, n) => {
|
|
97
97
|
s.push({
|
|
@@ -102,22 +102,22 @@ function Q(t) {
|
|
|
102
102
|
}), o === void 0 && (o = setTimeout(m, 0));
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
|
-
const
|
|
106
|
-
function
|
|
105
|
+
const q = 50, ee = 10, te = /^\/collections\/([A-Za-z_][A-Za-z0-9_-]{0,127})$/;
|
|
106
|
+
function ne(t) {
|
|
107
107
|
const s = t;
|
|
108
|
-
if ((s._method ?? "GET").toUpperCase() !== "GET" ||
|
|
109
|
-
const o =
|
|
108
|
+
if ((s._method ?? "GET").toUpperCase() !== "GET" || I(s._params) !== "") return null;
|
|
109
|
+
const o = te.exec(s._path ?? "");
|
|
110
110
|
return o ? o[1] : null;
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function se() {
|
|
113
113
|
return Object.assign(new Error("Not found"), { status: 404, response: { error: "Not found" } });
|
|
114
114
|
}
|
|
115
|
-
function
|
|
116
|
-
let s = !0, o = [],
|
|
115
|
+
function oe(t) {
|
|
116
|
+
let s = !0, o = [], i;
|
|
117
117
|
const d = (r) => t.request(r.command).then(r.resolve, r.reject), m = async (r) => {
|
|
118
|
-
const u = [...new Set(r.map((
|
|
118
|
+
const u = [...new Set(r.map((a) => a.name))];
|
|
119
119
|
if (u.length === 1 || !s) {
|
|
120
|
-
for (const
|
|
120
|
+
for (const a of r) d(a);
|
|
121
121
|
return;
|
|
122
122
|
}
|
|
123
123
|
let n;
|
|
@@ -127,11 +127,11 @@ function ne(t) {
|
|
|
127
127
|
_path: "/collections",
|
|
128
128
|
_params: { names: u.join(",") }
|
|
129
129
|
});
|
|
130
|
-
} catch (
|
|
131
|
-
const h =
|
|
130
|
+
} catch (a) {
|
|
131
|
+
const h = a == null ? void 0 : a.status;
|
|
132
132
|
if (h === 400 || h === 404 || h === 405) s = !1;
|
|
133
133
|
else if (h === 429 || h !== void 0 && h >= 500) {
|
|
134
|
-
for (const p of r) p.reject(
|
|
134
|
+
for (const p of r) p.reject(a);
|
|
135
135
|
return;
|
|
136
136
|
}
|
|
137
137
|
n = void 0;
|
|
@@ -139,22 +139,22 @@ function ne(t) {
|
|
|
139
139
|
const e = n == null ? void 0 : n.data;
|
|
140
140
|
if (!e || typeof e != "object" || Array.isArray(e)) {
|
|
141
141
|
Array.isArray(e) && (s = !1);
|
|
142
|
-
for (const
|
|
142
|
+
for (const a of r) d(a);
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
145
|
const l = e, f = new Set(Array.isArray(n == null ? void 0 : n.missing) ? n.missing : []);
|
|
146
|
-
for (const
|
|
147
|
-
Object.hasOwn(l,
|
|
146
|
+
for (const a of r)
|
|
147
|
+
Object.hasOwn(l, a.name) ? a.resolve({ data: T(l[a.name]) }) : f.has(a.name) ? a.reject(se()) : d(a);
|
|
148
148
|
}, c = () => {
|
|
149
|
-
|
|
149
|
+
i = void 0;
|
|
150
150
|
const r = o;
|
|
151
151
|
o = [];
|
|
152
152
|
const u = [], n = /* @__PURE__ */ new Map();
|
|
153
153
|
for (const e of r) {
|
|
154
154
|
let l = n.get(e.name);
|
|
155
155
|
if (!l) {
|
|
156
|
-
const f = u[u.length - 1],
|
|
157
|
-
l = f &&
|
|
156
|
+
const f = u[u.length - 1], a = f ? new Set(f.map((h) => h.name)).size : q;
|
|
157
|
+
l = f && a < q ? f : [], l !== f && u.push(l), n.set(e.name, l);
|
|
158
158
|
}
|
|
159
159
|
l.push(e);
|
|
160
160
|
}
|
|
@@ -166,77 +166,78 @@ function ne(t) {
|
|
|
166
166
|
command: r,
|
|
167
167
|
resolve: n,
|
|
168
168
|
reject: e
|
|
169
|
-
}),
|
|
169
|
+
}), i === void 0 && (i = setTimeout(c, ee));
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
|
-
const
|
|
173
|
-
function
|
|
172
|
+
const D = 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)$/, ae = /^\/(record-views|item-locks|drafts|presence|rum|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$)/;
|
|
173
|
+
function ie(t) {
|
|
174
174
|
const s = (t._path ?? "").split("?")[0];
|
|
175
|
-
return (t._method ?? "GET").toUpperCase() === "POST" &&
|
|
175
|
+
return (t._method ?? "GET").toUpperCase() === "POST" && N.test(s) ? !0 : ae.test(s);
|
|
176
176
|
}
|
|
177
|
-
function
|
|
177
|
+
function ce(t) {
|
|
178
178
|
const s = t;
|
|
179
|
-
if (!S(s) || !
|
|
179
|
+
if (!S(s) || !re.test(s._path ?? "")) return !1;
|
|
180
180
|
const o = s._params;
|
|
181
181
|
return !(o && o.item != null && /^\/collection-layouts\/active$/.test(s._path ?? ""));
|
|
182
182
|
}
|
|
183
183
|
let y = 0;
|
|
184
|
-
function
|
|
184
|
+
function G() {
|
|
185
185
|
y++;
|
|
186
186
|
}
|
|
187
187
|
let g = 0;
|
|
188
|
-
const
|
|
189
|
-
function
|
|
190
|
-
if (s.epoch !==
|
|
188
|
+
const ue = 50, le = /^\/items\//;
|
|
189
|
+
function fe(t, s, o, i) {
|
|
190
|
+
if (s.epoch !== i) return !1;
|
|
191
191
|
const d = t._path ?? "";
|
|
192
|
-
return !
|
|
192
|
+
return !le.test(d) || o - s.at < ue;
|
|
193
193
|
}
|
|
194
194
|
function w(t, s) {
|
|
195
195
|
return t.then(
|
|
196
|
-
(o) => (s &&
|
|
196
|
+
(o) => (s && x(), o),
|
|
197
197
|
(o) => {
|
|
198
|
-
throw
|
|
198
|
+
throw B(o, s) && F(s), o;
|
|
199
199
|
}
|
|
200
200
|
);
|
|
201
201
|
}
|
|
202
|
-
function
|
|
203
|
-
if (
|
|
204
|
-
const o = /* @__PURE__ */ new Map(),
|
|
202
|
+
function pe(t, s = {}) {
|
|
203
|
+
if (K(t)) return t;
|
|
204
|
+
const o = /* @__PURE__ */ new Map(), i = s.batchReads ? X(t) : null, d = s.batchCollections === !1 ? null : oe(t), m = /* @__PURE__ */ new Map();
|
|
205
205
|
let c = y;
|
|
206
206
|
const r = (n, e, l) => {
|
|
207
207
|
if (e !== y) return;
|
|
208
208
|
c !== y && (m.clear(), c = y);
|
|
209
209
|
const f = Date.now();
|
|
210
|
-
for (const [
|
|
210
|
+
for (const [a, h] of m) f - h.at >= D && m.delete(a);
|
|
211
211
|
m.set(n, { at: f, epoch: e, value: l });
|
|
212
212
|
}, u = (n) => {
|
|
213
213
|
const e = n;
|
|
214
214
|
if (!S(e)) {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
215
|
+
const _ = M(e._path, e._params);
|
|
216
|
+
_ || R(e._method, e._path, e._body);
|
|
217
|
+
const C = !ie(e);
|
|
218
|
+
C && G(), g++;
|
|
219
|
+
const O = w(t.request(n), !1).finally(() => {
|
|
219
220
|
g++;
|
|
220
221
|
});
|
|
221
|
-
return (
|
|
222
|
+
return (C ? O.finally(G) : O).then((b) => (_ || R(e._method, e._path, e._body, b), b));
|
|
222
223
|
}
|
|
223
224
|
if (n._signal)
|
|
224
225
|
return w(t.request(n), !1);
|
|
225
|
-
const l =
|
|
226
|
+
const l = P(e), f = ce(e);
|
|
226
227
|
if (f) {
|
|
227
228
|
const _ = m.get(l);
|
|
228
|
-
if (_ && _.epoch === y && Date.now() - _.at <
|
|
229
|
+
if (_ && _.epoch === y && Date.now() - _.at < D)
|
|
229
230
|
return Promise.resolve(T(_.value));
|
|
230
231
|
}
|
|
231
|
-
const
|
|
232
|
-
if (
|
|
233
|
-
return
|
|
234
|
-
const h =
|
|
235
|
-
if (h &&
|
|
236
|
-
const p =
|
|
237
|
-
p &&
|
|
232
|
+
const a = o.get(l);
|
|
233
|
+
if (a && fe(e, a, Date.now(), g))
|
|
234
|
+
return a.p.then(T);
|
|
235
|
+
const h = Z(e._method, e._path, e._params);
|
|
236
|
+
if (h && !H()) return Promise.reject(U());
|
|
237
|
+
const p = i ? V(e) : null, E = !p && d ? ne(e) : null, L = w(
|
|
238
|
+
p && i ? i(n, p) : E && d ? d(n, E) : t.request(n),
|
|
238
239
|
h
|
|
239
|
-
),
|
|
240
|
+
), z = y, A = L.then((_) => (f && r(l, z, T(_)), _)).finally(() => {
|
|
240
241
|
var _;
|
|
241
242
|
((_ = o.get(l)) == null ? void 0 : _.p) === A && o.delete(l);
|
|
242
243
|
});
|
|
@@ -245,27 +246,27 @@ function me(t, s = {}) {
|
|
|
245
246
|
return new Proxy(t, {
|
|
246
247
|
get(n, e, l) {
|
|
247
248
|
if (e === "request") return u;
|
|
248
|
-
if (e ===
|
|
249
|
+
if (e === j) return !0;
|
|
249
250
|
if (e === "setToken" && typeof n.setToken == "function")
|
|
250
|
-
return (
|
|
251
|
-
n.setToken(
|
|
251
|
+
return (a) => {
|
|
252
|
+
n.setToken(a), $();
|
|
252
253
|
};
|
|
253
254
|
const f = Reflect.get(n, e, l);
|
|
254
255
|
return typeof f == "function" ? f.bind(n) : f;
|
|
255
256
|
}
|
|
256
257
|
});
|
|
257
258
|
}
|
|
258
|
-
const
|
|
259
|
-
function
|
|
259
|
+
const de = /^\/(item-locks|drafts|auth)\b/, v = /* @__PURE__ */ new Set();
|
|
260
|
+
function he() {
|
|
260
261
|
for (const t of [...v]) t();
|
|
261
262
|
}
|
|
262
|
-
function
|
|
263
|
+
function ye(t) {
|
|
263
264
|
return t.subscribe((s) => {
|
|
264
|
-
s.type === "observerAdded" && s.query.state.fetchStatus === "fetching" && v.size !== 0 &&
|
|
265
|
+
s.type === "observerAdded" && s.query.state.fetchStatus === "fetching" && v.size !== 0 && he();
|
|
265
266
|
});
|
|
266
267
|
}
|
|
267
|
-
function
|
|
268
|
-
let o = s.open ?? !0,
|
|
268
|
+
function ve(t, s = {}) {
|
|
269
|
+
let o = s.open ?? !0, i;
|
|
269
270
|
const d = /* @__PURE__ */ new Map(), m = () => {
|
|
270
271
|
const n = [...d.values()];
|
|
271
272
|
d.clear();
|
|
@@ -274,30 +275,30 @@ function pe(t, s = {}) {
|
|
|
274
275
|
v.delete(c), m();
|
|
275
276
|
}, r = (n) => {
|
|
276
277
|
const e = n;
|
|
277
|
-
if (o || !
|
|
278
|
-
const l =
|
|
278
|
+
if (o || !W(e) || de.test(e._path ?? "")) return t.request(n);
|
|
279
|
+
const l = P(e), f = d.get(l);
|
|
279
280
|
if (f) return f.promise.then(T);
|
|
280
|
-
let
|
|
281
|
+
let a = () => {
|
|
281
282
|
};
|
|
282
283
|
const p = new Promise((E) => {
|
|
283
|
-
|
|
284
|
+
a = E;
|
|
284
285
|
}).then(() => t.request(n));
|
|
285
|
-
return d.set(l, { promise: p, release:
|
|
286
|
+
return d.set(l, { promise: p, release: a }), v.add(c), p;
|
|
286
287
|
};
|
|
287
288
|
return new Proxy(t, {
|
|
288
289
|
get(n, e, l) {
|
|
289
290
|
if (e === "request") return r;
|
|
290
291
|
if (e === "open") return o;
|
|
291
292
|
if (e === "setOpen")
|
|
292
|
-
return (
|
|
293
|
-
|
|
293
|
+
return (a) => {
|
|
294
|
+
i !== void 0 && (clearTimeout(i), i = void 0);
|
|
294
295
|
const h = o;
|
|
295
|
-
o =
|
|
296
|
+
o = a, a && !h && (v.delete(c), m());
|
|
296
297
|
};
|
|
297
298
|
if (e === "dispose")
|
|
298
299
|
return () => {
|
|
299
|
-
|
|
300
|
-
|
|
300
|
+
i === void 0 && (i = setTimeout(() => {
|
|
301
|
+
i = void 0, o = !0, v.delete(c), m();
|
|
301
302
|
}, 0));
|
|
302
303
|
};
|
|
303
304
|
const f = Reflect.get(n, e, l);
|
|
@@ -306,19 +307,19 @@ function pe(t, s = {}) {
|
|
|
306
307
|
});
|
|
307
308
|
}
|
|
308
309
|
export {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
310
|
+
k as BATCH_READ_LIMIT,
|
|
311
|
+
q as COLLECTION_BATCH_LIMIT,
|
|
312
|
+
ee as COLLECTION_BATCH_WINDOW_MS,
|
|
313
|
+
ue as RECORD_JOIN_MS,
|
|
314
|
+
D as SETTLED_READ_MS,
|
|
315
|
+
ne as batchableCollectionMeta,
|
|
316
|
+
V as batchableRead,
|
|
317
|
+
ve as createGatedClient,
|
|
318
|
+
G as forgetSettledReads,
|
|
319
|
+
K as isCoalesced,
|
|
320
|
+
ce as isSettledRead,
|
|
321
|
+
fe as mayJoinInflight,
|
|
322
|
+
he as releaseGatedReads,
|
|
323
|
+
ye as releaseGatedReadsOnSharedFetch,
|
|
324
|
+
pe as withGetCoalescing
|
|
324
325
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
function
|
|
1
|
+
function l(t) {
|
|
2
2
|
return t == null || t === "" || Array.isArray(t) && t.length === 0;
|
|
3
3
|
}
|
|
4
|
-
function
|
|
4
|
+
function f(t) {
|
|
5
5
|
if (t == null || t === "") return null;
|
|
6
6
|
const e = /* @__PURE__ */ new Date(), r = Date.UTC(e.getFullYear(), e.getMonth(), e.getDate()), s = String(t).match(
|
|
7
7
|
/^(\d{4})-(\d{2})-(\d{2})(?:[T ]00:00:00(?:\.0+)?(?:Z|[+-]00:?00)?)?$/
|
|
@@ -12,7 +12,7 @@ function d(t) {
|
|
|
12
12
|
const i = Date.UTC(n.getFullYear(), n.getMonth(), n.getDate());
|
|
13
13
|
return Math.round((i - r) / 864e5);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function d(t) {
|
|
16
16
|
const e = String(t ?? "").trim();
|
|
17
17
|
if (!e) return { stored: null, display: "", valid: !0 };
|
|
18
18
|
const r = e.startsWith("+"), s = e.replace(/\D/g, "");
|
|
@@ -25,15 +25,29 @@ function c(t) {
|
|
|
25
25
|
} : r && s.length >= 8 && s.length <= 15 ? { stored: `+${s}`, display: `+${s}`, valid: !0 } : { stored: r ? `+${s}` : s, display: e, valid: !1 };
|
|
26
26
|
}
|
|
27
27
|
function y(t) {
|
|
28
|
-
const e =
|
|
28
|
+
const e = d(t);
|
|
29
29
|
return e.valid && e.stored ? e.display : String(t ?? "");
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function p(t, e) {
|
|
32
|
+
let r = t;
|
|
33
|
+
if (typeof r == "string")
|
|
34
|
+
try {
|
|
35
|
+
r = JSON.parse(r);
|
|
36
|
+
} catch {
|
|
37
|
+
return !1;
|
|
38
|
+
}
|
|
39
|
+
return Array.isArray(r) ? r.some((s) => {
|
|
40
|
+
if (!s || typeof s != "object") return !1;
|
|
41
|
+
const n = s;
|
|
42
|
+
return n.soft ? !1 : n.type === "required" ? !0 : n.type === "required_if" && n.field ? c(e[n.field], String(n.op ?? "eq"), n.value) : !1;
|
|
43
|
+
}) : !1;
|
|
44
|
+
}
|
|
45
|
+
function c(t, e, r) {
|
|
32
46
|
switch (e) {
|
|
33
47
|
case "null":
|
|
34
|
-
return
|
|
48
|
+
return l(t);
|
|
35
49
|
case "nnull":
|
|
36
|
-
return !
|
|
50
|
+
return !l(t);
|
|
37
51
|
case "neq":
|
|
38
52
|
return String(t ?? "") !== String(r ?? "");
|
|
39
53
|
case "in":
|
|
@@ -45,14 +59,14 @@ function f(t, e, r) {
|
|
|
45
59
|
function m(t, e) {
|
|
46
60
|
const r = (u) => typeof u == "number" ? u : typeof u == "string" && /^\s*-?(\d+\.?\d*|\.\d+)\s*$/.test(u) ? Number(u) : null, s = r(t), n = r(e);
|
|
47
61
|
if (s !== null && n !== null && Number.isFinite(s) && Number.isFinite(n)) return s - n;
|
|
48
|
-
const i = (u) => u instanceof Date ? Number.isNaN(u.getTime()) ? null : u.toISOString().slice(0, 10) : typeof u == "string" && /^\d{4}-\d{2}-\d{2}/.test(u) ? u.slice(0, 10) : null,
|
|
49
|
-
return
|
|
62
|
+
const i = (u) => u instanceof Date ? Number.isNaN(u.getTime()) ? null : u.toISOString().slice(0, 10) : typeof u == "string" && /^\d{4}-\d{2}-\d{2}/.test(u) ? u.slice(0, 10) : null, o = i(t), a = i(e);
|
|
63
|
+
return o === null || a === null ? null : o < a ? -1 : o > a ? 1 : 0;
|
|
50
64
|
}
|
|
51
65
|
function g(t, e, r, s, n, i) {
|
|
52
66
|
if (!r || !s) return null;
|
|
53
|
-
const
|
|
54
|
-
if (
|
|
55
|
-
const a = m(e,
|
|
67
|
+
const o = s[r];
|
|
68
|
+
if (l(e) || l(o)) return null;
|
|
69
|
+
const a = m(e, o);
|
|
56
70
|
if (a === null) return null;
|
|
57
71
|
const u = r.replace(/_/g, " ");
|
|
58
72
|
return t === "gte_field" && a < 0 ? i ?? `${n} must be on or after ${u}` : t === "lte_field" && a > 0 ? i ?? `${n} must be on or before ${u}` : null;
|
|
@@ -60,7 +74,7 @@ function g(t, e, r, s, n, i) {
|
|
|
60
74
|
function $(t, e, r, s) {
|
|
61
75
|
if (t.type === "required_if") {
|
|
62
76
|
const n = t.field;
|
|
63
|
-
return !n || !s || !
|
|
77
|
+
return !n || !s || !c(s[n], String(t.op ?? "eq"), t.value) ? null : l(e) ? t.message ?? `${r} is required when ${n} matches this condition` : null;
|
|
64
78
|
}
|
|
65
79
|
if (t.type === "gte_field" || t.type === "lte_field")
|
|
66
80
|
return g(
|
|
@@ -71,10 +85,10 @@ function $(t, e, r, s) {
|
|
|
71
85
|
r,
|
|
72
86
|
t.message
|
|
73
87
|
);
|
|
74
|
-
if (
|
|
88
|
+
if (l(e) && t.type !== "required") return null;
|
|
75
89
|
switch (t.type) {
|
|
76
90
|
case "required":
|
|
77
|
-
return
|
|
91
|
+
return l(e) ? t.message ?? `${r} is required` : null;
|
|
78
92
|
case "min": {
|
|
79
93
|
const n = Number(t.value);
|
|
80
94
|
return typeof e == "number" && e < n ? t.message ?? `${r} must be at least ${n}` : typeof e == "string" && e.length < n ? t.message ?? `${r} must be at least ${n} characters` : null;
|
|
@@ -92,7 +106,7 @@ function $(t, e, r, s) {
|
|
|
92
106
|
case "email":
|
|
93
107
|
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(e)) ? null : t.message ?? `${r} must be a valid email`;
|
|
94
108
|
case "phone":
|
|
95
|
-
return
|
|
109
|
+
return d(e).valid ? null : t.message ?? `${r} must be a valid phone number`;
|
|
96
110
|
case "url":
|
|
97
111
|
try {
|
|
98
112
|
return new URL(String(e)), null;
|
|
@@ -102,11 +116,11 @@ function $(t, e, r, s) {
|
|
|
102
116
|
// Date must be at least N calendar days from today (e.g. delivery-date
|
|
103
117
|
// minimums). max_days_from_today caps how far out a date may be.
|
|
104
118
|
case "min_days_from_today": {
|
|
105
|
-
const n =
|
|
119
|
+
const n = f(e), i = Number(t.value);
|
|
106
120
|
return n === null || Number.isNaN(i) || n >= i ? null : t.message ?? `${r} must be at least ${i} days from today`;
|
|
107
121
|
}
|
|
108
122
|
case "max_days_from_today": {
|
|
109
|
-
const n =
|
|
123
|
+
const n = f(e), i = Number(t.value);
|
|
110
124
|
return n === null || Number.isNaN(i) || n <= i ? null : t.message ?? `${r} must be within ${i} days of today`;
|
|
111
125
|
}
|
|
112
126
|
default:
|
|
@@ -116,5 +130,6 @@ function $(t, e, r, s) {
|
|
|
116
130
|
export {
|
|
117
131
|
$ as applyValidationRule,
|
|
118
132
|
y as formatPhone,
|
|
119
|
-
|
|
133
|
+
d as normalizePhone,
|
|
134
|
+
p as requiredByRules
|
|
120
135
|
};
|