@nivaro/react 0.3.61 → 0.3.63

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.
@@ -0,0 +1,68 @@
1
+ const v = /^\/(settings|roles|pinned|users|tasks|custom-actions|field-rules|notification-subscriptions|my-jobs|announcements\/active|notifications\/unread-count|session-recordings\/enabled|help-videos\/for|presence\/online|chaos\/(armed|status|gamedays\/active)|chat\/(rooms|room-types)|collection-layouts(\/active|\/why|\/summary\/[^/]+|\/\d+)?|field-config\/[^/]+|field-defaults\/mine|data-model\/(relations\/for\/[^/]+|resolve-cascade)|bulk-actions\/available|ai-settings\/[^/]+|item-actions\/registered|revisions(\/latest|\/field-touch|\/o2m-cell-provenance)?|comments(\/counts|\/machine-markers)?|(last-touch|drafts|addendums|erp-submissions|access-explain)\/[^/]+\/[^/]+|config-conformance\/record\/[^/]+\/[^/]+|integration-obligations\/record\/[^/]+\/[^/]+|record-views\/[^/]+\/[^/]+\/viewers|sla\/status\/[^/]+\/[^/]+|legal-holds\/check\/[^/]+\/[^/]+|layout-collab\/\d+\/whats-new|pipelines\/instances\/[^/]+|widgets-internal\/\d+|items\/[^/]+(\/[^/]+)?\/resolve-paths)$/, y = 20, T = 10;
2
+ function p(i) {
3
+ return v.test(i);
4
+ }
5
+ let f = null;
6
+ function b(i) {
7
+ f = i;
8
+ }
9
+ function _() {
10
+ return f;
11
+ }
12
+ function g(i) {
13
+ let u = !0, l = [], d;
14
+ const r = (t) => t.read.alone().then(t.resolve, t.reject), m = async (t) => {
15
+ if (t.length === 1 || !u) {
16
+ for (const e of t) r(e);
17
+ return;
18
+ }
19
+ let s;
20
+ try {
21
+ s = await i.post(t.map((e, n) => ({ key: String(n), path: e.path })));
22
+ } catch (e) {
23
+ const n = e == null ? void 0 : e.status;
24
+ if ((n === 404 || n === 405) && (u = !1), typeof n == "number" && n >= 400 && n < 500 && n !== 429) {
25
+ for (const o of t) r(o);
26
+ return;
27
+ }
28
+ for (const o of t) o.reject(e);
29
+ return;
30
+ }
31
+ const c = Array.isArray(s == null ? void 0 : s.results) ? s.results : null;
32
+ if (!c) {
33
+ for (const e of t) r(e);
34
+ return;
35
+ }
36
+ t.forEach((e, n) => {
37
+ const o = c[n], a = o == null ? void 0 : o.status;
38
+ if (!o || o.key !== String(n) || typeof a != "number" || !("body" in o)) {
39
+ r(e);
40
+ return;
41
+ }
42
+ a >= 200 && a < 300 ? e.resolve(o.body) : a >= 400 ? e.reject(e.read.error({ ...o, status: a })) : r(e);
43
+ });
44
+ }, h = () => {
45
+ d = void 0;
46
+ const t = l;
47
+ l = [];
48
+ for (let s = 0; s < t.length; s += 20)
49
+ m(t.slice(s, s + 20));
50
+ };
51
+ return (t, s) => new Promise((c, e) => {
52
+ l.push({
53
+ path: t,
54
+ read: s,
55
+ resolve: c,
56
+ reject: e
57
+ }), d === void 0 && (d = setTimeout(h, 10));
58
+ });
59
+ }
60
+ export {
61
+ v as BATCHABLE_GET,
62
+ y as BATCH_GET_LIMIT,
63
+ T as BATCH_GET_WINDOW_MS,
64
+ g as createGetBatcher,
65
+ p as isBatchableGetPath,
66
+ b as shareGetLoader,
67
+ _ as sharedGetLoader
68
+ };
@@ -1,54 +1,59 @@
1
- const s = "nvr:list-page:";
2
- function l() {
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 f() {
9
- const t = l();
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 }, ""), l();
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 `${s}${t}|${e}`;
25
+ return `${c}${t}|${e}`;
20
26
  }
21
- function h(t, e = l()) {
22
- if (!e) return null;
27
+ function d(t, e = s()) {
23
28
  try {
24
- const r = window.sessionStorage.getItem(a(t, e)), n = r == null ? Number.NaN : Number(r);
25
- return Number.isInteger(n) && n > 1 && n < 1e5 ? n : null;
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 y(t, e, r = e > 1 ? f() : l()) {
31
- if (r)
32
- try {
33
- const n = window.sessionStorage, c = a(t, r);
34
- if (!(e > 1)) {
35
- n.removeItem(c);
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 g(t, e) {
53
+ function m(t, e) {
49
54
  return t && t > 1 && e === 1 ? t : e;
50
55
  }
51
- function w(t) {
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
- g as pageWhileSettling,
60
- y as rememberListPage,
61
- h as rememberedListPage,
62
- w as restoreWindowOutcome
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
  };