@nivaro/react 0.3.15 → 0.3.17

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.
Files changed (37) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +127 -6
  4. package/dist/index.js +736 -734
  5. package/dist/shared/components/CollectionBrowserView.js +2344 -2309
  6. package/dist/shared/components/ItemEditForm.js +3773 -3604
  7. package/dist/shared/components/RecordGridEditor.js +319 -282
  8. package/dist/shared/components/RecordReadView.js +202 -200
  9. package/dist/shared/components/cbv/unknown-fields.js +18 -8
  10. package/dist/shared/components/chat/ChatAnalyticsView.js +2 -2
  11. package/dist/shared/components/import/DocumentAutofillButton.js +148 -142
  12. package/dist/shared/components/item-edit/CatalogPickerField.js +264 -276
  13. package/dist/shared/components/item-edit/FieldRenderer.js +136 -133
  14. package/dist/shared/components/item-edit/FieldRow.js +198 -184
  15. package/dist/shared/components/item-edit/HeaderTools.js +107 -99
  16. package/dist/shared/components/item-edit/InlineTableField.js +138 -136
  17. package/dist/shared/components/item-edit/RecordLiveSync.js +1 -0
  18. package/dist/shared/components/item-edit/RelationCombobox.js +30 -23
  19. package/dist/shared/components/item-edit/SummaryPanel.js +334 -294
  20. package/dist/shared/components/item-edit/column-length.js +12 -0
  21. package/dist/shared/components/panels/AccessDeniedPanel.js +47 -37
  22. package/dist/shared/components/panels/ItemLockBanner.js +307 -285
  23. package/dist/shared/components/panels/PipelinePanel.js +486 -465
  24. package/dist/shared/components/panels/RevisionsPanel.js +210 -204
  25. package/dist/shared/components/pipeline/PipelineEditorView.js +1672 -1568
  26. package/dist/shared/components/profile/DelegationCard.js +178 -121
  27. package/dist/shared/components/profile/PersonActivity.js +152 -139
  28. package/dist/shared/components/queue/QueueWorklist.js +668 -659
  29. package/dist/shared/components/queue/transition-note.js +90 -0
  30. package/dist/shared/components/support/SupportRequestDialog.js +100 -89
  31. package/dist/shared/components/support/TicketDetailSheet.js +104 -91
  32. package/dist/shared/lib/autofill-runs.js +33 -26
  33. package/dist/shared/lib/draft-store.js +40 -24
  34. package/dist/shared/lib/live-queries.js +10 -9
  35. package/dist/shared/lib/request-gate.js +140 -127
  36. package/dist/shared/lib/restore-skipped.js +10 -0
  37. package/package.json +1 -1
@@ -1,26 +1,40 @@
1
- const i = "nivaro-drafts", c = "drafts";
2
- function m(e, t, n) {
1
+ const u = "nivaro-drafts", l = "drafts";
2
+ function g(e) {
3
+ if (e == null) return null;
4
+ const t = JSON.stringify(
5
+ e,
6
+ (o, r) => r && typeof r == "object" && !Array.isArray(r) ? Object.fromEntries(Object.entries(r).sort(([a], [c]) => a < c ? -1 : a > c ? 1 : 0)) : r
7
+ );
8
+ if (!t || t === "{}" || t === "[]") return null;
9
+ let n = 5381;
10
+ for (let o = 0; o < t.length; o++) n = (n << 5) + n + t.charCodeAt(o) | 0;
11
+ return `p${(n >>> 0).toString(36)}:${t.length}`;
12
+ }
13
+ function m(e, t) {
14
+ return (e.prefill_sig ?? null) === t;
15
+ }
16
+ function y(e, t, n) {
3
17
  return `${e}:${t && t !== "new" ? t : "new"}:${n || "anon"}`;
4
18
  }
5
19
  function f() {
6
20
  return new Promise((e) => {
7
21
  try {
8
22
  if (typeof indexedDB > "u") return e(null);
9
- const t = indexedDB.open(i, 1);
23
+ const t = indexedDB.open(u, 1);
10
24
  t.onupgradeneeded = () => {
11
25
  const n = t.result;
12
- n.objectStoreNames.contains(c) || n.createObjectStore(c, { keyPath: "key" });
26
+ n.objectStoreNames.contains(l) || n.createObjectStore(l, { keyPath: "key" });
13
27
  }, t.onsuccess = () => e(t.result), t.onerror = () => e(null), t.onblocked = () => e(null);
14
28
  } catch {
15
29
  e(null);
16
30
  }
17
31
  });
18
32
  }
19
- async function l(e, t) {
33
+ async function i(e, t) {
20
34
  const n = await f();
21
35
  return n ? new Promise((o) => {
22
36
  try {
23
- const r = n.transaction(c, e), a = t(r.objectStore(c));
37
+ const r = n.transaction(l, e), a = t(r.objectStore(l));
24
38
  a.onsuccess = () => o(a.result), a.onerror = () => o(null), r.oncomplete = () => n.close(), r.onerror = () => {
25
39
  n.close(), o(null);
26
40
  };
@@ -29,18 +43,18 @@ async function l(e, t) {
29
43
  }
30
44
  }) : null;
31
45
  }
32
- async function g(e) {
33
- return await l("readwrite", (n) => n.put(e)) != null;
34
- }
35
46
  async function b(e) {
36
- const t = await l("readonly", (n) => n.get(e));
47
+ return await i("readwrite", (n) => n.put(e)) != null;
48
+ }
49
+ async function p(e) {
50
+ const t = await i("readonly", (n) => n.get(e));
37
51
  return t && typeof t == "object" && t.key === e ? t : null;
38
52
  }
39
- async function y(e) {
40
- await l("readwrite", (t) => t.delete(e));
53
+ async function h(e) {
54
+ await i("readwrite", (t) => t.delete(e));
41
55
  }
42
56
  const s = "nvr:draft-created:", d = 7 * 864e5;
43
- function p(e, t, n = /* @__PURE__ */ new Date()) {
57
+ function O(e, t, n = /* @__PURE__ */ new Date()) {
44
58
  try {
45
59
  localStorage.setItem(
46
60
  s + e,
@@ -49,7 +63,7 @@ function p(e, t, n = /* @__PURE__ */ new Date()) {
49
63
  } catch {
50
64
  }
51
65
  }
52
- function w(e, t, n = /* @__PURE__ */ new Date()) {
66
+ function S(e, t, n = /* @__PURE__ */ new Date()) {
53
67
  try {
54
68
  const o = localStorage.getItem(s + e);
55
69
  if (!o) return null;
@@ -58,21 +72,23 @@ function w(e, t, n = /* @__PURE__ */ new Date()) {
58
72
  const a = Date.parse(r.at);
59
73
  if (!Number.isFinite(a) || n.getTime() - a > d)
60
74
  return localStorage.removeItem(s + e), null;
61
- const u = t ? Date.parse(t) : Number.NaN;
62
- return !Number.isFinite(u) || u > a ? null : { id: r.id, at: r.at };
75
+ const c = t ? Date.parse(t) : Number.NaN;
76
+ return !Number.isFinite(c) || c > a ? null : { id: r.id, at: r.at };
63
77
  } catch {
64
78
  return null;
65
79
  }
66
80
  }
67
- function D(e) {
81
+ function w(e) {
68
82
  return Object.keys(e.fields ?? {}).length > 0 || Object.values(e.pending_rows ?? {}).some((t) => t.length > 0) || Object.values(e.pending_edits ?? {}).some((t) => Object.keys(t).length > 0) || Object.values(e.pending_deletes ?? {}).some((t) => t.length > 0) || Object.values(e.m2m_links ?? {}).some((t) => t.length > 0) || Object.values(e.m2m_unlinks ?? {}).some((t) => t.length > 0);
69
83
  }
70
84
  export {
71
- y as deleteDraft,
72
- w as draftCreatedAs,
73
- D as draftHasContent,
74
- m as draftKey,
75
- b as loadDraft,
76
- p as markDraftCreated,
77
- g as saveDraft
85
+ h as deleteDraft,
86
+ S as draftCreatedAs,
87
+ w as draftHasContent,
88
+ y as draftKey,
89
+ m as draftMatchesPrefill,
90
+ p as loadDraft,
91
+ O as markDraftCreated,
92
+ g as prefillSignature,
93
+ b as saveDraft
78
94
  };
@@ -18,6 +18,7 @@ const he = [
18
18
  "tasks",
19
19
  "addendums",
20
20
  "pipeline-instance",
21
+ "pipeline-instance-lock",
21
22
  "pipeline-all-owners",
22
23
  "pipeline-instance-owners",
23
24
  "pipeline-owners-resolved",
@@ -123,7 +124,7 @@ function we(t, s, o = {}) {
123
124
  }));
124
125
  }, se = L.subscribe((e) => {
125
126
  (e.type === "added" || e.type === "removed" || e.type === "observerAdded" || e.type === "observerRemoved" || e.type === "observerOptionsUpdated") && te();
126
- }), F = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new Map(), A = /* @__PURE__ */ new Set(), oe = (e, n) => {
127
+ }), F = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Set(), oe = (e, n) => {
127
128
  if (e.length === 0) return;
128
129
  const i = new Set(e), r = d();
129
130
  for (const f of e) F.set(f, r);
@@ -134,7 +135,7 @@ function we(t, s, o = {}) {
134
135
  }, q = (e, n = !0) => {
135
136
  const i = [], r = [];
136
137
  for (const u of e)
137
- u.getObserversCount() === 0 ? r.push(u) : c != null && c.hidden ? (r.push(u), A.add(u)) : i.push(u);
138
+ u.getObserversCount() === 0 ? r.push(u) : c != null && c.hidden ? (r.push(u), k.add(u)) : i.push(u);
138
139
  if (r.length) {
139
140
  const u = new Set(r);
140
141
  S.deferred += r.length, t.invalidateQueries({ predicate: (g) => u.has(g), refetchType: "none" });
@@ -172,7 +173,7 @@ function we(t, s, o = {}) {
172
173
  const n = [];
173
174
  for (const r of L.getAll())
174
175
  I(r) && n.push(r);
175
- A.clear();
176
+ k.clear();
176
177
  const i = new Set(n);
177
178
  t.invalidateQueries(
178
179
  {
@@ -196,20 +197,20 @@ function we(t, s, o = {}) {
196
197
  n && !H && (e.resumed === "unverified" || e.resumed === void 0) && V(), H = n;
197
198
  }), K = () => V(), b = o.reconcileOnCatchupFull === !1 ? null : p;
198
199
  b == null || b.addEventListener("nvr:catchup-full", K);
199
- let k = c != null && c.hidden ? d() : null;
200
+ let A = c != null && c.hidden ? d() : null;
200
201
  const P = () => {
201
202
  if (!c) return;
202
203
  if (c.hidden) {
203
- k ?? (k = d());
204
+ A ?? (A = d());
204
205
  return;
205
206
  }
206
- const e = k == null ? 0 : d() - k;
207
- if (k = null, e >= M) {
207
+ const e = A == null ? 0 : d() - A;
208
+ if (A = null, e >= M) {
208
209
  x();
209
210
  return;
210
211
  }
211
- const n = [...A].filter((i) => i.getObserversCount() > 0);
212
- A.clear(), q(n, !1);
212
+ const n = [...k].filter((i) => i.getObserversCount() > 0);
213
+ k.clear(), q(n, !1);
213
214
  };
214
215
  return c == null || c.addEventListener("visibilitychange", P), z(t, 1), B(), {
215
216
  reconcile: x,
@@ -1,20 +1,20 @@
1
- import { noteOwnWriteFromCommand as C } from "./own-writes.js";
2
- import { noteCredentialChanged as z, isIdentityRead as D, claimIdentityCall as M, signedOutError as $, noteSignedIn as Z, isSignedOutError as U, noteUnauthorized as x } from "./signed-out.js";
3
- function q(t) {
1
+ import { noteOwnWriteFromCommand as O } from "./own-writes.js";
2
+ import { noteCredentialChanged as z, isIdentityRead as M, claimIdentityCall as $, signedOutError as Z, noteSignedIn as H, isSignedOutError as U, noteUnauthorized as x } 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, u]) => [o, String(u)]).sort(([o], [u]) => o < u ? -1 : o > u ? 1 : 0);
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
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 ?? ""} ${q(t._params)} ${o}`;
10
+ return `${s} ${t._path ?? ""} ${I(t._params)} ${o}`;
11
11
  }
12
- function A(t) {
12
+ function w(t) {
13
13
  return (t._method ?? "GET").toUpperCase() === "GET";
14
14
  }
15
- const I = /^\/(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 H(t) {
17
- return A(t) ? !0 : (t._method ?? "GET").toUpperCase() !== "POST" ? !1 : I.test((t._path ?? "").split("?")[0]);
15
+ const q = /^\/(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 B(t) {
17
+ return w(t) ? !0 : (t._method ?? "GET").toUpperCase() !== "POST" ? !1 : q.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 j = Symbol("nivaro.coalesced");
28
- function B(t) {
29
- return t[j] === !0;
27
+ const N = Symbol("nivaro.coalesced");
28
+ function F(t) {
29
+ return t[N] === !0;
30
30
  }
31
- const O = 20, F = /^\/items\/([A-Za-z_][A-Za-z0-9_]*)(?:\/([^/?#]+))?$/, W = /* @__PURE__ */ new Set(["aggregate", "export", "distinct", "resolve-paths", "batch-read"]), K = /* @__PURE__ */ new Set([
31
+ const b = 20, W = /^\/items\/([A-Za-z_][A-Za-z0-9_]*)(?:\/([^/?#]+))?$/, K = /* @__PURE__ */ new Set(["aggregate", "export", "distinct", "resolve-paths", "batch-read"]), J = /* @__PURE__ */ new Set([
32
32
  "fields",
33
33
  "filter",
34
34
  "sort",
@@ -44,29 +44,29 @@ const O = 20, F = /^\/items\/([A-Za-z_][A-Za-z0-9_]*)(?:\/([^/?#]+))?$/, W = /*
44
44
  function Y(t) {
45
45
  const s = t;
46
46
  if ((s._method ?? "GET").toUpperCase() !== "GET") return null;
47
- const o = F.exec(s._path ?? "");
47
+ const o = W.exec(s._path ?? "");
48
48
  if (!o) return null;
49
- const [, u, d] = o;
50
- if (d !== void 0 && W.has(d)) return null;
51
- const m = s._params ?? {}, a = {};
52
- for (const [r, c] of Object.entries(m))
53
- if (c !== void 0) {
54
- if (!K.has(r)) return null;
55
- a[r] = c;
49
+ const [, i, d] = o;
50
+ if (d !== void 0 && K.has(d)) return null;
51
+ const m = s._params ?? {}, c = {};
52
+ for (const [r, u] of Object.entries(m))
53
+ if (u !== void 0) {
54
+ if (!J.has(r)) return null;
55
+ c[r] = u;
56
56
  }
57
- return d === void 0 ? { collection: u, query: a } : { collection: u, id: d, query: a };
57
+ return d === void 0 ? { collection: i, query: c } : { collection: i, id: d, query: c };
58
58
  }
59
- function J(t) {
59
+ function Q(t) {
60
60
  let s = [], o;
61
- const u = (a) => t.request(a.command).then(a.resolve, a.reject), d = async (a) => {
62
- if (a.length === 1) return u(a[0]);
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
- const c = await t.request({
65
+ const u = await t.request({
66
66
  _method: "POST",
67
67
  _path: "/items/batch-read",
68
68
  _body: {
69
- reads: a.map((n, e) => ({
69
+ reads: c.map((n, e) => ({
70
70
  key: String(e),
71
71
  collection: n.read.collection,
72
72
  ...n.read.id !== void 0 ? { id: n.read.id } : {},
@@ -74,50 +74,50 @@ function J(t) {
74
74
  }))
75
75
  }
76
76
  });
77
- r = Array.isArray(c == null ? void 0 : c.results) ? c.results : void 0;
77
+ r = Array.isArray(u == null ? void 0 : u.results) ? u.results : void 0;
78
78
  } catch {
79
79
  r = void 0;
80
80
  }
81
- a.forEach((c, n) => {
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
- u(c);
84
+ i(u);
85
85
  return;
86
86
  }
87
- c.resolve(c.read.id !== void 0 ? { data: e.data } : { data: e.data, ...e.meta ?? {} });
87
+ u.resolve(u.read.id !== void 0 ? { data: e.data } : { data: e.data, ...e.meta ?? {} });
88
88
  });
89
89
  }, m = () => {
90
90
  o = void 0;
91
- const a = s;
91
+ const c = s;
92
92
  s = [];
93
- for (let r = 0; r < a.length; r += O)
94
- d(a.slice(r, r + O));
93
+ for (let r = 0; r < c.length; r += b)
94
+ d(c.slice(r, r + b));
95
95
  };
96
- return (a, r) => new Promise((c, n) => {
96
+ return (c, r) => new Promise((u, n) => {
97
97
  s.push({
98
98
  read: r,
99
- command: a,
100
- resolve: c,
99
+ command: c,
100
+ resolve: u,
101
101
  reject: n
102
102
  }), o === void 0 && (o = setTimeout(m, 0));
103
103
  });
104
104
  }
105
- const b = 50, Q = 10, V = /^\/collections\/([A-Za-z_][A-Za-z0-9_-]{0,127})$/;
106
- function X(t) {
105
+ const R = 50, V = 10, X = /^\/collections\/([A-Za-z_][A-Za-z0-9_-]{0,127})$/;
106
+ function ee(t) {
107
107
  const s = t;
108
- if ((s._method ?? "GET").toUpperCase() !== "GET" || q(s._params) !== "") return null;
109
- const o = V.exec(s._path ?? "");
108
+ if ((s._method ?? "GET").toUpperCase() !== "GET" || I(s._params) !== "") return null;
109
+ const o = X.exec(s._path ?? "");
110
110
  return o ? o[1] : null;
111
111
  }
112
- function ee() {
112
+ function te() {
113
113
  return Object.assign(new Error("Not found"), { status: 404, response: { error: "Not found" } });
114
114
  }
115
- function te(t) {
116
- let s = !0, o = [], u;
115
+ function ne(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 c = [...new Set(r.map((i) => i.name))];
119
- if (c.length === 1 || !s) {
120
- for (const i of r) d(i);
118
+ const u = [...new Set(r.map((a) => a.name))];
119
+ if (u.length === 1 || !s) {
120
+ for (const a of r) d(a);
121
121
  return;
122
122
  }
123
123
  let n;
@@ -125,13 +125,13 @@ function te(t) {
125
125
  n = await t.request({
126
126
  _method: "GET",
127
127
  _path: "/collections",
128
- _params: { names: c.join(",") }
128
+ _params: { names: u.join(",") }
129
129
  });
130
- } catch (i) {
131
- const h = i == null ? void 0 : i.status;
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(i);
134
+ for (const p of r) p.reject(a);
135
135
  return;
136
136
  }
137
137
  n = void 0;
@@ -139,152 +139,163 @@ function te(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 i of r) d(i);
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 i of r)
147
- Object.hasOwn(l, i.name) ? i.resolve({ data: T(l[i.name]) }) : f.has(i.name) ? i.reject(ee()) : d(i);
148
- }, a = () => {
149
- u = void 0;
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(te()) : d(a);
148
+ }, c = () => {
149
+ i = void 0;
150
150
  const r = o;
151
151
  o = [];
152
- const c = [], n = /* @__PURE__ */ new Map();
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 = c[c.length - 1], i = f ? new Set(f.map((h) => h.name)).size : b;
157
- l = f && i < b ? f : [], l !== f && c.push(l), n.set(e.name, l);
156
+ const f = u[u.length - 1], a = f ? new Set(f.map((h) => h.name)).size : R;
157
+ l = f && a < R ? f : [], l !== f && u.push(l), n.set(e.name, l);
158
158
  }
159
159
  l.push(e);
160
160
  }
161
- for (const e of c) m(e);
161
+ for (const e of u) m(e);
162
162
  };
163
- return (r, c) => new Promise((n, e) => {
163
+ return (r, u) => new Promise((n, e) => {
164
164
  o.push({
165
- name: c,
165
+ name: u,
166
166
  command: r,
167
167
  resolve: n,
168
168
  reject: e
169
- }), u === void 0 && (u = setTimeout(a, Q));
169
+ }), i === void 0 && (i = setTimeout(c, V));
170
170
  });
171
171
  }
172
- const R = 3e3, ne = /^\/(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)$/, se = /^\/(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 oe(t) {
172
+ const k = 3e3, se = /^\/(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)$/, oe = /^\/(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 re(t) {
174
174
  const s = (t._path ?? "").split("?")[0];
175
- return (t._method ?? "GET").toUpperCase() === "POST" && I.test(s) ? !0 : se.test(s);
175
+ return (t._method ?? "GET").toUpperCase() === "POST" && q.test(s) ? !0 : oe.test(s);
176
176
  }
177
- function re(t) {
177
+ function ae(t) {
178
178
  const s = t;
179
- if (!A(s) || !ne.test(s._path ?? "")) return !1;
179
+ if (!w(s) || !se.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 k() {
184
+ function D() {
185
185
  y++;
186
186
  }
187
+ let A = 0;
188
+ const ie = 50, ce = /^\/items\//;
189
+ function ue(t, s, o, i) {
190
+ if (s.epoch !== i) return !1;
191
+ const d = t._path ?? "";
192
+ return !ce.test(d) || o - s.at < ie;
193
+ }
187
194
  function G(t, s) {
188
195
  return t.then(
189
- (o) => (s && Z(), o),
196
+ (o) => (s && H(), o),
190
197
  (o) => {
191
198
  throw U(o, s) && x(s), o;
192
199
  }
193
200
  );
194
201
  }
195
- function le(t, s = {}) {
196
- if (B(t)) return t;
197
- const o = /* @__PURE__ */ new Map(), u = s.batchReads ? J(t) : null, d = s.batchCollections === !1 ? null : te(t), m = /* @__PURE__ */ new Map();
198
- let a = y;
202
+ function me(t, s = {}) {
203
+ if (F(t)) return t;
204
+ const o = /* @__PURE__ */ new Map(), i = s.batchReads ? Q(t) : null, d = s.batchCollections === !1 ? null : ne(t), m = /* @__PURE__ */ new Map();
205
+ let c = y;
199
206
  const r = (n, e, l) => {
200
207
  if (e !== y) return;
201
- a !== y && (m.clear(), a = y);
208
+ c !== y && (m.clear(), c = y);
202
209
  const f = Date.now();
203
- for (const [i, h] of m) f - h.at >= R && m.delete(i);
210
+ for (const [a, h] of m) f - h.at >= k && m.delete(a);
204
211
  m.set(n, { at: f, epoch: e, value: l });
205
- }, c = (n) => {
212
+ }, u = (n) => {
206
213
  const e = n;
207
- if (!A(e)) {
208
- C(e._method, e._path, e._body);
209
- const _ = !oe(e);
210
- _ && k();
211
- const w = G(t.request(n), !1);
212
- return (_ ? w.finally(k) : w).then((S) => (C(e._method, e._path, e._body, S), S));
214
+ if (!w(e)) {
215
+ O(e._method, e._path, e._body);
216
+ const _ = !re(e);
217
+ _ && D(), A++;
218
+ const S = G(t.request(n), !1).finally(() => {
219
+ A++;
220
+ });
221
+ return (_ ? S.finally(D) : S).then((C) => (O(e._method, e._path, e._body, C), C));
213
222
  }
214
- const l = P(e), f = re(e);
223
+ const l = P(e), f = ae(e);
215
224
  if (f) {
216
225
  const _ = m.get(l);
217
- if (_ && _.epoch === y && Date.now() - _.at < R)
226
+ if (_ && _.epoch === y && Date.now() - _.at < k)
218
227
  return Promise.resolve(T(_.value));
219
228
  }
220
- const i = o.get(l);
221
- if (i) return i.then(T);
222
- const h = D(e._method, e._path, e._params);
223
- if (h && !M()) return Promise.reject($());
224
- const p = u ? Y(e) : null, E = !p && d ? X(e) : null, L = G(
225
- p && u ? u(n, p) : E && d ? d(n, E) : t.request(n),
229
+ const a = o.get(l);
230
+ if (a && ue(e, a, Date.now(), A))
231
+ return a.p.then(T);
232
+ const h = M(e._method, e._path, e._params);
233
+ if (h && !$()) return Promise.reject(Z());
234
+ const p = i ? Y(e) : null, E = !p && d ? ee(e) : null, j = G(
235
+ p && i ? i(n, p) : E && d ? d(n, E) : t.request(n),
226
236
  h
227
- ), N = y, g = L.then((_) => (f && r(l, N, T(_)), _)).finally(() => {
228
- o.get(l) === g && o.delete(l);
237
+ ), L = y, g = j.then((_) => (f && r(l, L, T(_)), _)).finally(() => {
238
+ var _;
239
+ ((_ = o.get(l)) == null ? void 0 : _.p) === g && o.delete(l);
229
240
  });
230
- return o.set(l, g), g;
241
+ return o.set(l, { p: g, at: Date.now(), epoch: A }), g;
231
242
  };
232
243
  return new Proxy(t, {
233
244
  get(n, e, l) {
234
- if (e === "request") return c;
235
- if (e === j) return !0;
245
+ if (e === "request") return u;
246
+ if (e === N) return !0;
236
247
  if (e === "setToken" && typeof n.setToken == "function")
237
- return (i) => {
238
- n.setToken(i), z();
248
+ return (a) => {
249
+ n.setToken(a), z();
239
250
  };
240
251
  const f = Reflect.get(n, e, l);
241
252
  return typeof f == "function" ? f.bind(n) : f;
242
253
  }
243
254
  });
244
255
  }
245
- const ie = /^\/(item-locks|drafts|auth)\b/, v = /* @__PURE__ */ new Set();
246
- function ae() {
256
+ const le = /^\/(item-locks|drafts|auth)\b/, v = /* @__PURE__ */ new Set();
257
+ function fe() {
247
258
  for (const t of [...v]) t();
248
259
  }
249
- function fe(t) {
260
+ function _e(t) {
250
261
  return t.subscribe((s) => {
251
- s.type === "observerAdded" && s.query.state.fetchStatus === "fetching" && v.size !== 0 && ae();
262
+ s.type === "observerAdded" && s.query.state.fetchStatus === "fetching" && v.size !== 0 && fe();
252
263
  });
253
264
  }
254
- function de(t, s = {}) {
255
- let o = s.open ?? !0, u;
265
+ function pe(t, s = {}) {
266
+ let o = s.open ?? !0, i;
256
267
  const d = /* @__PURE__ */ new Map(), m = () => {
257
268
  const n = [...d.values()];
258
269
  d.clear();
259
270
  for (const e of n) e.release();
260
- }, a = () => {
261
- v.delete(a), m();
271
+ }, c = () => {
272
+ v.delete(c), m();
262
273
  }, r = (n) => {
263
274
  const e = n;
264
- if (o || !H(e) || ie.test(e._path ?? "")) return t.request(n);
275
+ if (o || !B(e) || le.test(e._path ?? "")) return t.request(n);
265
276
  const l = P(e), f = d.get(l);
266
277
  if (f) return f.promise.then(T);
267
- let i = () => {
278
+ let a = () => {
268
279
  };
269
280
  const p = new Promise((E) => {
270
- i = E;
281
+ a = E;
271
282
  }).then(() => t.request(n));
272
- return d.set(l, { promise: p, release: i }), v.add(a), p;
283
+ return d.set(l, { promise: p, release: a }), v.add(c), p;
273
284
  };
274
285
  return new Proxy(t, {
275
286
  get(n, e, l) {
276
287
  if (e === "request") return r;
277
288
  if (e === "open") return o;
278
289
  if (e === "setOpen")
279
- return (i) => {
280
- u !== void 0 && (clearTimeout(u), u = void 0);
290
+ return (a) => {
291
+ i !== void 0 && (clearTimeout(i), i = void 0);
281
292
  const h = o;
282
- o = i, i && !h && (v.delete(a), m());
293
+ o = a, a && !h && (v.delete(c), m());
283
294
  };
284
295
  if (e === "dispose")
285
296
  return () => {
286
- u === void 0 && (u = setTimeout(() => {
287
- u = void 0, o = !0, v.delete(a), m();
297
+ i === void 0 && (i = setTimeout(() => {
298
+ i = void 0, o = !0, v.delete(c), m();
288
299
  }, 0));
289
300
  };
290
301
  const f = Reflect.get(n, e, l);
@@ -293,17 +304,19 @@ function de(t, s = {}) {
293
304
  });
294
305
  }
295
306
  export {
296
- O as BATCH_READ_LIMIT,
297
- b as COLLECTION_BATCH_LIMIT,
298
- Q as COLLECTION_BATCH_WINDOW_MS,
299
- R as SETTLED_READ_MS,
300
- X as batchableCollectionMeta,
307
+ b as BATCH_READ_LIMIT,
308
+ R as COLLECTION_BATCH_LIMIT,
309
+ V as COLLECTION_BATCH_WINDOW_MS,
310
+ ie as RECORD_JOIN_MS,
311
+ k as SETTLED_READ_MS,
312
+ ee as batchableCollectionMeta,
301
313
  Y as batchableRead,
302
- de as createGatedClient,
303
- k as forgetSettledReads,
304
- B as isCoalesced,
305
- re as isSettledRead,
306
- ae as releaseGatedReads,
307
- fe as releaseGatedReadsOnSharedFetch,
308
- le as withGetCoalescing
314
+ pe as createGatedClient,
315
+ D as forgetSettledReads,
316
+ F as isCoalesced,
317
+ ae as isSettledRead,
318
+ ue as mayJoinInflight,
319
+ fe as releaseGatedReads,
320
+ _e as releaseGatedReadsOnSharedFetch,
321
+ me as withGetCoalescing
309
322
  };
@@ -0,0 +1,10 @@
1
+ function c(r) {
2
+ var o;
3
+ const e = r, n = ((o = e == null ? void 0 : e.data) == null ? void 0 : o.skipped_fields) ?? (e == null ? void 0 : e.skipped_fields);
4
+ if (!Array.isArray(n) || n.length === 0) return null;
5
+ const t = [...new Set(n.map((a) => String(a).replace(/_/g, " ")))], s = t.slice(0, 5).join(", "), i = t.length > 5 ? ` and ${t.length - 5} more` : "";
6
+ return `Not restored (you can't change ${t.length === 1 ? "it" : "them"}): ${s}${i}`;
7
+ }
8
+ export {
9
+ c as restoreSkippedNote
10
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nivaro/react",
3
- "version": "0.3.15",
3
+ "version": "0.3.17",
4
4
  "description": "React hooks and components for Nivaro CMS forms",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",