rest-client-vue 1.1.1-b10 → 1.1.1-b11

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.
@@ -1,17 +1,17 @@
1
1
  var Ee = Object.defineProperty;
2
- var we = (f, s, S) => s in f ? Ee(f, s, { enumerable: !0, configurable: !0, writable: !0, value: S }) : f[s] = S;
3
- var ae = (f, s, S) => (we(f, typeof s != "symbol" ? s + "" : s, S), S), Te = (f, s, S) => {
4
- if (!s.has(f))
5
- throw TypeError("Cannot " + S);
2
+ var we = (h, s, g) => s in h ? Ee(h, s, { enumerable: !0, configurable: !0, writable: !0, value: g }) : h[s] = g;
3
+ var ae = (h, s, g) => (we(h, typeof s != "symbol" ? s + "" : s, g), g), Te = (h, s, g) => {
4
+ if (!s.has(h))
5
+ throw TypeError("Cannot " + g);
6
6
  };
7
- var Q = (f, s, S) => (Te(f, s, "read from private field"), S ? S.call(f) : s.get(f)), Se = (f, s, S) => {
8
- if (s.has(f))
7
+ var Q = (h, s, g) => (Te(h, s, "read from private field"), g ? g.call(h) : s.get(h)), Se = (h, s, g) => {
8
+ if (s.has(h))
9
9
  throw TypeError("Cannot add the same private member more than once");
10
- s instanceof WeakSet ? s.add(f) : s.set(f, S);
10
+ s instanceof WeakSet ? s.add(h) : s.set(h, g);
11
11
  };
12
12
  import a from "lodash";
13
13
  import { v4 as H } from "uuid";
14
- import { ref as I, toRef as se, computed as R, watch as T, nextTick as Le } from "vue";
14
+ import { ref as y, toRef as ie, computed as R, watch as T, nextTick as Le } from "vue";
15
15
  import P from "axios";
16
16
  import me from "jsog";
17
17
  import X from "json-stringify-deterministic";
@@ -21,39 +21,46 @@ const ye = {
21
21
  useVueLogger: !1
22
22
  };
23
23
  class _e extends Error {
24
- constructor(S, $ = void 0, e = void 0) {
25
- super(S);
24
+ constructor(g, U = void 0, e = void 0) {
25
+ super(g);
26
26
  ae(this, "context");
27
27
  ae(this, "innerError");
28
- this.context = $, this.innerError = e;
28
+ this.context = U, this.innerError = e;
29
29
  }
30
30
  }
31
- var k;
31
+ var B;
32
32
  class Ie {
33
33
  constructor() {
34
- Se(this, k, {});
34
+ Se(this, B, {});
35
35
  }
36
36
  clearAllStores() {
37
- for (const s in Q(this, k))
38
- Q(this, k)[s].clear();
37
+ for (const s in Q(this, B))
38
+ Q(this, B)[s].clear();
39
39
  }
40
40
  destroyStore(s) {
41
- Q(this, k)[s] && (Q(this, k)[s].$dispose(), delete Q(this, k)[s]);
41
+ Q(this, B)[s] && (Q(this, B)[s].$dispose(), delete Q(this, B)[s]);
42
42
  }
43
43
  getStore(s) {
44
- return Q(this, k)[s];
44
+ return Q(this, B)[s];
45
45
  }
46
- registerStore(s, S) {
47
- Q(this, k)[s] = S;
46
+ registerStore(s, g) {
47
+ Q(this, B)[s] = g;
48
48
  }
49
49
  }
50
- k = new WeakMap();
51
- function v(f, s) {
52
- return a.get(f, (s == null ? void 0 : s.idProperty) || "_id");
50
+ B = new WeakMap();
51
+ function v(h, s) {
52
+ return a.get(h, (s == null ? void 0 : s.idProperty) || "_id");
53
53
  }
54
- function $e(f, s) {
55
- var S;
56
- return f && ((S = s.filter) != null && S.resourceIds) && !s.order ? s.filter.resourceIds.map(($) => f.find((e) => v(e, s) == $)).filter(($) => $ != null) : f;
54
+ function $e(h, s) {
55
+ const g = a.map(
56
+ s,
57
+ (U, e) => U != null ? `${encodeURIComponent(e)}=${encodeURIComponent(U)}` : null
58
+ ).filter((U) => U != null).join("&");
59
+ return g.length > 0 ? h.indexOf("?") == h.length - 1 ? `${h}&${g}` : `${h}?${g}` : h;
60
+ }
61
+ function xe(h, s) {
62
+ var g;
63
+ return h && ((g = s.filter) != null && g.resourceIds) && !s.order ? s.filter.resourceIds.map((U) => h.find((e) => v(e, s) == U)).filter((U) => U != null) : h;
57
64
  }
58
65
  const De = {
59
66
  detail: {
@@ -81,7 +88,7 @@ const De = {
81
88
  [{ path: "history.creation.timestamp" }, "desc"],
82
89
  [{ path: "history.creation.indexInBatch" }, "desc"]
83
90
  ]
84
- }, Z = {
91
+ }, Y = {
85
92
  resources: [],
86
93
  remoteCollectionSize: null,
87
94
  status: "NotLoaded",
@@ -89,14 +96,14 @@ const De = {
89
96
  detailSelection: [],
90
97
  invalidResources: [],
91
98
  transientData: {}
92
- }, oe = {
99
+ }, ne = {
93
100
  editingDetailSelection: !1,
94
101
  batchSaveAttempted: !1,
95
102
  editors: [],
96
103
  listNavigators: {}
97
- }, Pe = (f, s) => {
104
+ }, Pe = (h, s) => {
98
105
  s = a.merge({}, De, s);
99
- const S = pe(f, {
106
+ const g = pe(h, {
100
107
  state: () => ({
101
108
  idProperty: s.idProperty,
102
109
  filter: s.filter,
@@ -104,8 +111,8 @@ const De = {
104
111
  propertyBlacklist: s.propertyBlacklist || null,
105
112
  referencePathsToExpand: s.referencePathsToExpand || null,
106
113
  restCollectionUrl: s.restCollectionUrl,
107
- ...Z,
108
- ...oe
114
+ ...Y,
115
+ ...ne
109
116
  }),
110
117
  getters: {
111
118
  /**
@@ -119,8 +126,8 @@ const De = {
119
126
  (l = e.filter) != null && l.namedFilter && (r.namedFilter = e.filter.namedFilter);
120
127
  const t = [];
121
128
  if ((u = e.filter) != null && u.resourceIds && t.push({ l: { path: e.idProperty }, r: { constant: e.filter.resourceIds }, operator: "in" }), (c = e.filter) != null && c.query && t.push((d = e.filter) == null ? void 0 : d.query), t.length > 0) {
122
- const y = t.length == 1 ? t[0] : { and: t };
123
- r.q = X(y);
129
+ const p = t.length == 1 ? t[0] : { and: t };
130
+ r.q = X(p);
124
131
  }
125
132
  return e.order && (r.o = X(e.order)), e.propertyBlacklist && (r.ex = X(e.propertyBlacklist)), e.referencePathsToExpand && (r.r = X(e.referencePathsToExpand)), r;
126
133
  }
@@ -135,10 +142,10 @@ const De = {
135
142
  * Configuration is retained, but REST collection contents and contextual state are reset.
136
143
  */
137
144
  reset() {
138
- for (const e in Z)
139
- this[e] = Z[e];
140
- for (const e in oe)
141
- this[e] = oe[e];
145
+ for (const e in Y)
146
+ this[e] = Y[e];
147
+ for (const e in ne)
148
+ this[e] = ne[e];
142
149
  },
143
150
  /**
144
151
  * Reset the store to its initial state, but retain transient data if appropriate.
@@ -238,8 +245,8 @@ const De = {
238
245
  * Configuration and contextual state are retained, but REST collection contents are reset.
239
246
  */
240
247
  clear() {
241
- for (const e in Z)
242
- this[e] = Z[e];
248
+ for (const e in Y)
249
+ this[e] = Y[e];
243
250
  },
244
251
  /**
245
252
  * Clear the collection's contents, but retain transient data if appropriate.
@@ -290,32 +297,29 @@ const De = {
290
297
  * @param loadOptions Pagination options that may override the defaults.
291
298
  */
292
299
  async _loadResources(e, r, t) {
293
- var z, F, A, B, O;
300
+ var L, A, N, k, O;
294
301
  const l = e == 0;
295
- if (this.status = l ? "Loading" : "LoadingMore", this._loadOffset = e, ((z = this.filter) == null ? void 0 : z.query) === !1) {
302
+ if (this.status = l ? "Loading" : "LoadingMore", this._loadOffset = e, ((L = this.filter) == null ? void 0 : L.query) === !1) {
296
303
  this.resources = [], this.remoteCollectionSize = 0;
297
304
  return;
298
305
  }
299
- const u = this.fixedQueryParams, c = a.cloneDeep(u), d = l ? (F = this.filter) != null && F.resourceIds && !this.order ? null : t.firstPageSize || ((A = s.loading) == null ? void 0 : A.firstPageSize) || t.pageSize || ((B = s.loading) == null ? void 0 : B.pageSize) || null : t.pageSize || ((O = s.loading) == null ? void 0 : O.pageSize) || null, y = d != null || s.limit != null ? a.min(a.filter([d, s.limit], (g) => g != null)) : void 0;
300
- y != null ? (c.offset = e, c.limit = y) : e != 0 && (c.offset = e);
301
- const U = a.map(
302
- c,
303
- (g, m) => g != null ? `${encodeURIComponent(m)}=${encodeURIComponent(g)}` : null
304
- ).filter((g) => g != null).join("&"), L = a.isEmpty(U) ? s.restCollectionUrl : `${s.restCollectionUrl}?${U}`;
306
+ const u = this.fixedQueryParams, c = a.cloneDeep(u), d = l ? (A = this.filter) != null && A.resourceIds && !this.order ? null : t.firstPageSize || ((N = s.loading) == null ? void 0 : N.firstPageSize) || t.pageSize || ((k = s.loading) == null ? void 0 : k.pageSize) || null : t.pageSize || ((O = s.loading) == null ? void 0 : O.pageSize) || null, p = d != null || s.limit != null ? a.min(a.filter([d, s.limit], (x) => x != null)) : void 0;
307
+ p != null ? (c.offset = e, c.limit = p) : e != 0 && (c.offset = e);
308
+ const C = $e(s.restCollectionUrl, c);
305
309
  try {
306
- const g = await P.get(L), m = this.fixedQueryParams;
307
- if (r != this._loadId || e != this._loadOffset || !a.isEqual(u, m))
310
+ const x = await P.get(C), I = this.fixedQueryParams;
311
+ if (r != this._loadId || e != this._loadOffset || !a.isEqual(u, I))
308
312
  console.log(`Discarding resources fetched by obsolete query from ${s.restCollectionUrl}.`);
309
313
  else {
310
- const C = me.decode(a.get(g, "data.data", [])), w = (l ? 0 : this.resources.length) + C.length, D = y == null || C.length < y || s.limit && w >= s.limit;
314
+ const S = me.decode(a.get(x, "data.data", [])), $ = (l ? 0 : this.resources.length) + S.length, E = p == null || S.length < p || s.limit && $ >= s.limit;
311
315
  console.log(
312
- `Loaded ${C.length}${l ? "" : " more"} resources from ${s.restCollectionUrl}`
316
+ `Loaded ${S.length}${l ? "" : " more"} resources from ${s.restCollectionUrl}`
313
317
  ), l && (this.resources = []);
314
- const W = [...this.resources, ...C.map((J) => Object.freeze(J))];
315
- this.resources = $e(W, this), a.get(g, "data.totalCollectionSize") ? this.remoteCollectionSize = a.get(g, "data.totalCollectionSize") : this.remoteCollectionSize = null, this.status = D ? "Loaded" : "LoadingMore", D || this._loadResources(this.resources.length, r, t);
318
+ const D = [...this.resources, ...S.map((W) => Object.freeze(W))];
319
+ this.resources = xe(D, this), a.get(x, "data.totalCollectionSize") ? this.remoteCollectionSize = a.get(x, "data.totalCollectionSize") : this.remoteCollectionSize = null, this.status = E ? "Loaded" : "LoadingMore", E || this._loadResources(this.resources.length, r, t);
316
320
  }
317
- } catch (g) {
318
- console.log(`Error while loading resources (URL="${L}"):`, g), this.clearRetainingTransientData(), this.status = "Failed";
321
+ } catch (x) {
322
+ console.log(`Error while loading resources (URL="${C}"):`, x), this.clearRetainingTransientData(), this.status = "Failed";
319
323
  }
320
324
  },
321
325
  // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -494,8 +498,8 @@ const De = {
494
498
  if (r.status == 200) {
495
499
  const t = r.data || [], l = [];
496
500
  for (const [u, c] of t.entries()) {
497
- const d = v(e[u], this) == null, y = v(c, this), U = y ? await this.refreshResource(y) : null;
498
- d && this.recordInsertion(U || c), l.push(U || Object.freeze(c));
501
+ const d = v(e[u], this) == null, p = v(c, this), C = p ? await this.refreshResource(p) : null;
502
+ d && this.recordInsertion(C || c), l.push(C || Object.freeze(c));
499
503
  }
500
504
  return l;
501
505
  }
@@ -560,7 +564,7 @@ const De = {
560
564
  let c = e;
561
565
  if (t) {
562
566
  const d = a.difference(e, u);
563
- d.length > 0 && (c = u.concat(d).filter((y) => y != null));
567
+ d.length > 0 && (c = u.concat(d).filter((p) => p != null));
564
568
  }
565
569
  a.isEqual(u, c) || this.setSelection(c, l);
566
570
  },
@@ -678,225 +682,225 @@ const De = {
678
682
  });
679
683
  return (() => {
680
684
  const e = (r, t) => {
681
- const l = S(r, t);
682
- return re.registerStore(l.$id, l), l;
685
+ const l = g(r, t);
686
+ return se.registerStore(l.$id, l), l;
683
687
  };
684
- return e.$id = S.$id, e;
688
+ return e.$id = g.$id, e;
685
689
  })();
686
- }, re = new Ie(), Oe = (f = {}) => {
690
+ }, se = new Ie(), Qe = (h = {}) => {
687
691
  var ue, de, he, fe;
688
692
  const {
689
693
  collectionId: s,
690
- draftBatchId: S,
691
- enabled: $,
694
+ draftBatchId: g,
695
+ enabled: U,
692
696
  resourceType: e,
693
697
  options: r
694
- } = f, t = I(void 0), l = I(s), u = I(S), c = I($ ?? !0), d = I([se(e)]), y = I(r), U = R(() => u.value), L = I(c.value), z = I(H()), F = I((de = (ue = y.value) == null ? void 0 : ue.filter) == null ? void 0 : de.resourceIds), A = I((fe = (he = y.value) == null ? void 0 : he.filter) == null ? void 0 : fe.query), B = R(
695
- () => u.value == null && l.value != null && re.getStore(l.value) != null
696
- ), O = I(B.value), g = R(() => w("status", "Uninitialized"));
697
- function m(i) {
698
+ } = h, t = y(void 0), l = y(s), u = y(g), c = y(U ?? !0), d = y([ie(e)]), p = y(r), C = R(() => u.value), L = y(c.value), A = y(H()), N = y((de = (ue = p.value) == null ? void 0 : ue.filter) == null ? void 0 : de.resourceIds), k = y((fe = (he = p.value) == null ? void 0 : he.filter) == null ? void 0 : fe.query), O = R(
699
+ () => u.value == null && l.value != null && se.getStore(l.value) != null
700
+ ), x = y(O.value), I = R(() => E("status", "Uninitialized"));
701
+ function S(i) {
698
702
  if (t.value)
699
703
  return i(t.value);
700
704
  }
701
- async function C(i) {
705
+ async function $(i) {
702
706
  if (t.value)
703
707
  return await i(t.value);
704
708
  }
705
- function w(i, n) {
709
+ function E(i, o) {
706
710
  if (t.value)
707
711
  return t.value[i];
708
- if (n !== void 0)
709
- return n;
712
+ if (o !== void 0)
713
+ return o;
710
714
  throw "Attempted to use a REST collection store that has not been created, with no default value.";
711
715
  }
712
716
  const D = (i = {}) => {
713
- var ie, ve, ge, Re;
717
+ var te, ve, ge, Re;
714
718
  const {
715
- collectionId: n,
716
- draftBatchId: E,
717
- enabled: q,
719
+ collectionId: o,
720
+ draftBatchId: w,
721
+ enabled: F,
718
722
  resourceType: le,
719
- options: te
723
+ options: ee
720
724
  } = i;
721
- l.value = n, u.value = E, c.value = q ?? !0, d.value = [se(le)], te != null && (y.value = te, F.value = (ve = (ie = y.value) == null ? void 0 : ie.filter) == null ? void 0 : ve.resourceIds, A.value = (Re = (ge = y.value) == null ? void 0 : ge.filter) == null ? void 0 : Re.query), z.value = H(), W(c.value);
725
+ l.value = o, u.value = w, c.value = F ?? !0, d.value = [ie(le)], ee != null && (p.value = ee, N.value = (ve = (te = p.value) == null ? void 0 : te.filter) == null ? void 0 : ve.resourceIds, k.value = (Re = (ge = p.value) == null ? void 0 : ge.filter) == null ? void 0 : Re.query), A.value = H(), W(c.value);
722
726
  }, W = async (i) => {
723
- i != L.value && (L.value = i, i && (Y(), b()));
727
+ i != L.value && (L.value = i, i && (K(), z()));
728
+ }, re = async (i) => {
729
+ N.value = i, await $(async (o) => await o.setFilterResourceIds(N.value || null));
724
730
  }, J = async (i) => {
725
- F.value = i, await C(async (n) => await n.setFilterResourceIds(F.value || null));
726
- }, K = async (i) => {
727
- if (A.value = i, g.value != "Uninitialized") {
728
- const n = i, E = R(() => a.isFunction(n) ? p.value ? n(p.value) : null : n);
729
- await C((q) => q.setQuery(E.value || null));
731
+ if (k.value = i, I.value != "Uninitialized") {
732
+ const o = i, w = R(() => a.isFunction(o) ? m.value ? o(m.value) : null : o);
733
+ await $((F) => F.setQuery(w.value || null));
730
734
  }
731
- }, Y = () => {
732
- y.value = a.merge({}, y.value || {}, {
733
- filter: { resourceIds: F.value, query: A.value }
735
+ }, K = () => {
736
+ p.value = a.merge({}, p.value || {}, {
737
+ filter: { resourceIds: N.value, query: k.value }
734
738
  });
735
- }, p = R(
739
+ }, m = R(
736
740
  () => d.value[0].value || void 0
737
741
  ), _ = function(i) {
738
- const n = a.get(i, "filter.query"), E = a.get(i, "propertyBlacklist"), q = a.get(i, "referencePathsToExpand"), le = a.isFunction(n) ? n(p.value) : n, te = p.value ? a.isFunction(E) ? E(p.value) : E || [] : [], ie = p.value ? a.isFunction(q) ? q(p.value) : q || [] : [];
742
+ const o = a.get(i, "filter.query"), w = a.get(i, "propertyBlacklist"), F = a.get(i, "referencePathsToExpand"), le = a.isFunction(o) ? o(m.value) : o, ee = m.value ? a.isFunction(w) ? w(m.value) : w || [] : [], te = m.value ? a.isFunction(F) ? F(m.value) : F || [] : [];
739
743
  return {
740
744
  ...a.cloneDeep(i || {}),
741
745
  filter: {
742
746
  ...a.cloneDeep((i == null ? void 0 : i.filter) || {}),
743
747
  query: le
744
748
  },
745
- propertyBlacklist: te,
746
- referencePathsToExpand: ie
749
+ propertyBlacklist: ee,
750
+ referencePathsToExpand: te
747
751
  };
748
- }, x = R(() => _(y.value)), M = R(() => {
749
- if (x.value.restCollectionUrl !== void 0)
750
- return x.value.restCollectionUrl;
751
- if (!O.value)
752
- return !p.value || !p.value.collectionName ? null : U.value ? `${ee.config.apiBaseUrl}/draft-batches/${U.value}/${p.value.collectionName}` : `${ee.config.apiBaseUrl}/${p.value.collectionName}`;
753
- }), o = R(() => {
752
+ }, q = R(() => _(p.value)), M = R(() => {
753
+ if (q.value.restCollectionUrl !== void 0)
754
+ return q.value.restCollectionUrl;
755
+ if (!x.value)
756
+ return !m.value || !m.value.collectionName ? null : C.value ? `${V.config.apiBaseUrl}/draft-batches/${C.value}/${m.value.collectionName}` : `${V.config.apiBaseUrl}/${m.value.collectionName}`;
757
+ }), n = R(() => {
754
758
  var i;
755
- if (p.value)
759
+ if (m.value)
756
760
  return a.mergeWith(
757
761
  a.cloneDeep(De),
758
- x.value,
762
+ q.value,
759
763
  {
760
- idProperty: (i = p.value) == null ? void 0 : i.idProperty,
764
+ idProperty: (i = m.value) == null ? void 0 : i.idProperty,
761
765
  restCollectionUrl: M.value || ""
762
766
  },
763
- (n, E) => {
764
- if (a.isArray(E) && E.length == 0 && (n == null || a.isArray(n)))
765
- return E;
767
+ (o, w) => {
768
+ if (a.isArray(w) && w.length == 0 && (o == null || a.isArray(o)))
769
+ return w;
766
770
  }
767
771
  );
768
- }), h = I(0), N = R(
772
+ }), f = y(0), b = R(
769
773
  () => {
770
774
  var i;
771
- return h.value, l.value || p.value && ((i = p.value) == null ? void 0 : i.collectionName) && (U.value ? `draftBatches/${U.value}/${p.value.collectionName}/${z.value}` : `${p.value.collectionName}/${z.value}`) || null;
775
+ return f.value, l.value || m.value && ((i = m.value) == null ? void 0 : i.collectionName) && (C.value ? `draftBatches/${C.value}/${m.value.collectionName}/${A.value}` : `${m.value.collectionName}/${A.value}`) || null;
772
776
  }
773
- ), b = () => {
777
+ ), z = () => {
774
778
  if (L.value) {
775
779
  let i = !1;
776
- return p.value && N.value && (t.value = re.getStore(N.value), t.value ? i = !1 : o.value && (O.value = !1, t.value = Pe(N.value, o.value)(), i = !0)), i;
780
+ return m.value && b.value && (t.value = se.getStore(b.value), t.value ? i = !1 : n.value && (x.value = !1, t.value = Pe(b.value, n.value)(), i = !0)), i;
777
781
  } else
778
782
  return !1;
779
783
  }, G = () => {
780
- N.value && l.value == N.value ? (t.value = void 0, b()) : (t.value = void 0, h.value = h.value + 1, b());
784
+ b.value && l.value == b.value ? (t.value = void 0, z()) : (t.value = void 0, f.value = f.value + 1, z());
781
785
  };
782
- T(U, (i, n) => {
783
- a.isEqual(i, n) || G();
784
- }), T(L, (i, n) => {
785
- i != n && (i ? b() : t.value = void 0);
786
- }), T(p, (i, n) => {
787
- i && !n ? b() : !i && n || a.isEqual(i, n) || G();
788
- }), T(o, (i, n) => {
789
- a.isEqual(i, n) || G();
790
- }), T(B, () => {
791
- B.value || (O.value = !1);
792
- }), T(N, () => b()), T(M, (i, n) => {
793
- a.isEqual(i, n) || G();
786
+ T(C, (i, o) => {
787
+ a.isEqual(i, o) || G();
788
+ }), T(L, (i, o) => {
789
+ i != o && (i ? z() : t.value = void 0);
790
+ }), T(m, (i, o) => {
791
+ i && !o ? z() : !i && o || a.isEqual(i, o) || G();
792
+ }), T(n, (i, o) => {
793
+ a.isEqual(i, o) || G();
794
+ }), T(O, () => {
795
+ O.value || (x.value = !1);
796
+ }), T(b, () => z()), T(M, (i, o) => {
797
+ a.isEqual(i, o) || G();
794
798
  });
795
799
  const j = [], Ce = function(i) {
796
- g.value != "Uninitialized" ? Le(i) : j.push(i);
800
+ I.value != "Uninitialized" ? Le(i) : j.push(i);
797
801
  };
798
- return T(g, (i, n) => {
799
- if (i != "Uninitialized" && n == "Uninitialized") {
800
- const E = a.clone(j);
802
+ return T(I, (i, o) => {
803
+ if (i != "Uninitialized" && o == "Uninitialized") {
804
+ const w = a.clone(j);
801
805
  j.splice(0, j.length);
802
- for (const q of E)
803
- q();
806
+ for (const F of w)
807
+ F();
804
808
  }
805
- }), b(), {
809
+ }), z(), {
806
810
  // Configuration
807
- collectionId: N,
808
- draftBatchId: U,
809
- resourceType: p,
810
- restCollectionUrl: R(() => w("restCollectionUrl", null)),
811
+ collectionId: b,
812
+ draftBatchId: C,
813
+ resourceType: m,
814
+ restCollectionUrl: R(() => E("restCollectionUrl", null)),
811
815
  // Status
812
816
  enabled: L,
813
- status: g,
814
- batchSaveAttempted: R(() => w("batchSaveAttempted", !1)),
815
- listNavigators: R(() => w("listNavigators", !1)),
817
+ status: I,
818
+ batchSaveAttempted: R(() => E("batchSaveAttempted", !1)),
819
+ listNavigators: R(() => E("listNavigators", !1)),
816
820
  // Resources loaded from the REST API
817
- invalidResources: R(() => w("invalidResources", [])),
818
- resources: R(() => g.value != "Uninitialized" ? (C((i) => i.ensureCollectionLoaded()), w("resources", [])) : []),
819
- remoteCollectionSize: R(() => w("remoteCollectionSize", null)),
821
+ invalidResources: R(() => E("invalidResources", [])),
822
+ resources: R(() => I.value != "Uninitialized" ? ($((i) => i.ensureCollectionLoaded()), E("resources", [])) : []),
823
+ remoteCollectionSize: R(() => E("remoteCollectionSize", null)),
820
824
  // Transient data
821
- transientData: R(() => w("transientData", [])),
825
+ transientData: R(() => E("transientData", [])),
822
826
  // Selection and detail selection
823
- detailSelection: R(() => w("detailSelection", [])),
824
- editingDetailSelection: R(() => w("editingDetailSelection", !1)),
825
- selection: R(() => w("selection", [])),
827
+ detailSelection: R(() => E("detailSelection", [])),
828
+ editingDetailSelection: R(() => E("editingDetailSelection", !1)),
829
+ selection: R(() => E("selection", [])),
826
830
  // Methods: Configuration
827
831
  reconfigureCollection: D,
828
- setEditingDetailSelection: (i) => m(
829
- (n) => n.setEditingDetailSelection(i)
832
+ setEditingDetailSelection: (i) => S(
833
+ (o) => o.setEditingDetailSelection(i)
830
834
  ),
831
835
  setEnabled: W,
832
- setFilterResourceIds: J,
833
- setQuery: K,
836
+ setFilterResourceIds: re,
837
+ setQuery: J,
834
838
  // Methods: Status
835
- ensureStore: b,
839
+ ensureStore: z,
836
840
  // TODO Rename
837
- setBatchSaveAttempted: (i) => m((n) => n.setBatchSaveAttempted(i)),
841
+ setBatchSaveAttempted: (i) => S((o) => o.setBatchSaveAttempted(i)),
838
842
  // Local collection management
839
- clear: () => m((i) => i.clear()),
840
- ensureCollectionLoaded: async () => await C(async (i) => i.ensureCollectionLoaded()),
841
- loadResources: async () => await C(async (i) => await i.loadResources()),
843
+ clear: () => S((i) => i.clear()),
844
+ ensureCollectionLoaded: async () => await $(async (i) => i.ensureCollectionLoaded()),
845
+ loadResources: async () => await $(async (i) => await i.loadResources()),
842
846
  // Methods: Recording changes to the collection
843
- addResource: (i) => m((n) => n.addResource(i)),
844
- checkForDeletedResource: async (i) => await C(async (n) => await n.checkForDeletedResource(i)) == !0,
845
- recordDeletion: (i) => m((n) => n.recordDeletion(i)),
846
- recordInsertion: (i, { insertAtBeginning: n = !1, transientData: E = void 0 } = {}) => m((q) => q.recordInsertion(i, { insertAtBeginning: n, transientData: E })),
847
- recordUpdate: (i) => m((n) => n.recordUpdate(i)),
848
- refreshResource: async (i) => await C(
849
- async (n) => await n.refreshResource(i)
847
+ addResource: (i) => S((o) => o.addResource(i)),
848
+ checkForDeletedResource: async (i) => await $(async (o) => await o.checkForDeletedResource(i)) == !0,
849
+ recordDeletion: (i) => S((o) => o.recordDeletion(i)),
850
+ recordInsertion: (i, { insertAtBeginning: o = !1, transientData: w = void 0 } = {}) => S((F) => F.recordInsertion(i, { insertAtBeginning: o, transientData: w })),
851
+ recordUpdate: (i) => S((o) => o.recordUpdate(i)),
852
+ refreshResource: async (i) => await $(
853
+ async (o) => await o.refreshResource(i)
850
854
  ),
851
855
  // Methods: Modifying the collection
852
- deleteResource: async (i) => await C(
853
- async (n) => await n.deleteResource(i)
856
+ deleteResource: async (i) => await $(
857
+ async (o) => await o.deleteResource(i)
854
858
  ),
855
- saveResource: async (i) => await C(async (n) => await n.saveResource(i)),
856
- saveResources: async (i) => await C(async (n) => await n.saveResources(i)),
859
+ saveResource: async (i) => await $(async (o) => await o.saveResource(i)),
860
+ saveResources: async (i) => await $(async (o) => await o.saveResources(i)),
857
861
  // Methods: Transient data
858
- clearTransientData: () => m((i) => i.clearTransientData()),
859
- setInvalidResourceIds: (i) => m((n) => n.setInvalidResourceIds(i)),
860
- setTransientDataForResources: (i) => m(
861
- (n) => n.setTransientDataForResources(i)
862
+ clearTransientData: () => S((i) => i.clearTransientData()),
863
+ setInvalidResourceIds: (i) => S((o) => o.setInvalidResourceIds(i)),
864
+ setTransientDataForResources: (i) => S(
865
+ (o) => o.setTransientDataForResources(i)
862
866
  ),
863
867
  // Methods: Selection and detail selection
864
- clearSelection: () => m((i) => i.clearSelection()),
865
- deselectResources: (i) => m((n) => n.deselectResources(i)),
866
- selectResources: (i, n) => m(
867
- (E) => E.selectResources(i, n)
868
+ clearSelection: () => S((i) => i.clearSelection()),
869
+ deselectResources: (i) => S((o) => o.deselectResources(i)),
870
+ selectResources: (i, o) => S(
871
+ (w) => w.selectResources(i, o)
868
872
  ),
869
873
  // Methods: Managing the detail view
870
- hideDetail: () => m((i) => i.hideDetail()),
874
+ hideDetail: () => S((i) => i.hideDetail()),
871
875
  // Methods: Editors
872
- deregisterEditor: (i) => m((n) => n.deregisterEditor(i)),
873
- registerEditor: (i) => m((n) => n.registerEditor(i)),
876
+ deregisterEditor: (i) => S((o) => o.deregisterEditor(i)),
877
+ registerEditor: (i) => S((o) => o.registerEditor(i)),
874
878
  // Methods: List navigators
875
- deregisterListNavigator: (i) => m((n) => n.deregisterListNavigator(i)),
876
- registerListNavigator: (i) => m((n) => n.registerListNavigator(i)),
879
+ deregisterListNavigator: (i) => S((o) => o.deregisterListNavigator(i)),
880
+ registerListNavigator: (i) => S((o) => o.registerListNavigator(i)),
877
881
  // Callbacks
878
882
  onItemsStoreReady: Ce
879
883
  };
880
- }, Qe = () => {
881
- re.clearAllStores();
884
+ }, Me = () => {
885
+ se.clearAllStores();
882
886
  };
883
- function ne(f, s) {
884
- return a.get(f, (s == null ? void 0 : s.idProperty) || "_id");
887
+ function oe(h, s) {
888
+ return a.get(h, (s == null ? void 0 : s.idProperty) || "_id");
885
889
  }
886
890
  const Ue = {
887
891
  idProperty: "_id"
888
- }, V = {
892
+ }, Z = {
889
893
  resource: null,
890
894
  status: "NotLoaded"
891
- }, xe = (f, s) => {
895
+ }, qe = (h, s) => {
892
896
  s = a.merge({}, Ue, s);
893
- const S = pe(f, {
897
+ const g = pe(h, {
894
898
  state: () => ({
895
899
  idProperty: s.idProperty,
896
900
  resourceId: s.resourceId || null,
897
901
  resourceUrl: s.resourceUrl || null,
898
902
  referencePathsToExpand: s.referencePathsToExpand || null,
899
- ...V
903
+ ...Z
900
904
  }),
901
905
  getters: {
902
906
  currentResourceUrl: (e) => e.resourceUrl || (s.restCollectionUrl && e.resourceId ? `${s.restCollectionUrl}/${e.resourceId}` : null) || s.restCollectionUrl || null,
@@ -916,8 +920,8 @@ const Ue = {
916
920
  * Configuration is retained, but REST resource content and contextual state are reset.
917
921
  */
918
922
  reset() {
919
- for (const e in V)
920
- this[e] = V[e];
923
+ for (const e in Z)
924
+ this[e] = Z[e];
921
925
  },
922
926
  async setResourceId(e) {
923
927
  const r = this.currentResourceUrl;
@@ -936,8 +940,8 @@ const Ue = {
936
940
  * Configuration and contextual state are retained, but REST collection contents are reset.
937
941
  */
938
942
  clear() {
939
- for (const e in V)
940
- this[e] = V[e];
943
+ for (const e in Z)
944
+ this[e] = Z[e];
941
945
  },
942
946
  /**
943
947
  * Load the resource, if it has not been loaded.
@@ -1022,7 +1026,7 @@ const Ue = {
1022
1026
  * @param resource The resource that has been inserted.
1023
1027
  */
1024
1028
  recordInsertion(e) {
1025
- this.resourceId = ne(e, this) || null, this.status == "Loaded" && (this.resource = Object.freeze(e));
1029
+ this.resourceId = oe(e, this) || null, this.status == "Loaded" && (this.resource = Object.freeze(e));
1026
1030
  },
1027
1031
  /**
1028
1032
  * Record an update, making the same changes in the local resource.
@@ -1043,7 +1047,7 @@ const Ue = {
1043
1047
  * @param resource The resource that has been updated.
1044
1048
  */
1045
1049
  recordUpdate(e) {
1046
- this.resourceId = ne(e, this) || null, this.status == "Loaded" && (this.resource = Object.freeze(e));
1050
+ this.resourceId = oe(e, this) || null, this.status == "Loaded" && (this.resource = Object.freeze(e));
1047
1051
  },
1048
1052
  async refreshResource() {
1049
1053
  return await this.loadResource(), this.resource;
@@ -1074,7 +1078,7 @@ const Ue = {
1074
1078
  * the operation failed.
1075
1079
  */
1076
1080
  async saveResource(e) {
1077
- const r = ne(e, this), t = r == null;
1081
+ const r = oe(e, this), t = r == null;
1078
1082
  if (!r)
1079
1083
  throw "The REST resource store cannot create new resources on the server.";
1080
1084
  if (!this.currentResourceUrl)
@@ -1112,148 +1116,148 @@ const Ue = {
1112
1116
  });
1113
1117
  return (() => {
1114
1118
  const e = (r, t) => {
1115
- const l = S(r, t);
1119
+ const l = g(r, t);
1116
1120
  return ce.registerStore(l.$id, l), l;
1117
1121
  };
1118
- return e.$id = S.$id, e;
1122
+ return e.$id = g.$id, e;
1119
1123
  })();
1120
- }, ce = new Ie(), Me = (f = {}) => {
1124
+ }, ce = new Ie(), je = (h = {}) => {
1121
1125
  const {
1122
1126
  resourceClientId: s,
1123
- draftBatchId: S,
1124
- enabled: $,
1127
+ draftBatchId: g,
1128
+ enabled: U,
1125
1129
  resourceType: e,
1126
1130
  options: r
1127
- } = f, t = I(void 0), l = I(s), u = I(S), c = I($ ?? !0), d = I([se(e)]), y = I(r), U = R(() => u.value), L = I(c.value), z = I(H()), F = R(
1131
+ } = h, t = y(void 0), l = y(s), u = y(g), c = y(U ?? !0), d = y([ie(e)]), p = y(r), C = R(() => u.value), L = y(c.value), A = y(H()), N = R(
1128
1132
  () => u.value == null && l.value != null && ce.getStore(l.value) != null
1129
- ), A = I(F.value), B = R(() => m("status", "Uninitialized"));
1130
- function O(o) {
1133
+ ), k = y(N.value), O = R(() => S("status", "Uninitialized"));
1134
+ function x(n) {
1131
1135
  if (t.value)
1132
- return o(t.value);
1136
+ return n(t.value);
1133
1137
  }
1134
- async function g(o) {
1138
+ async function I(n) {
1135
1139
  if (t.value)
1136
- return await o(t.value);
1140
+ return await n(t.value);
1137
1141
  }
1138
- function m(o, h) {
1142
+ function S(n, f) {
1139
1143
  if (t.value)
1140
- return t.value[o];
1141
- if (h !== void 0)
1142
- return h;
1144
+ return t.value[n];
1145
+ if (f !== void 0)
1146
+ return f;
1143
1147
  throw "Attempted to use a REST resource store that has not been created, with no default value.";
1144
1148
  }
1145
- const C = (o = {}) => {
1149
+ const $ = (n = {}) => {
1146
1150
  const {
1147
- resourceClientId: h,
1148
- draftBatchId: N,
1149
- enabled: b,
1151
+ resourceClientId: f,
1152
+ draftBatchId: b,
1153
+ enabled: z,
1150
1154
  resourceType: G,
1151
1155
  options: j
1152
- } = o;
1153
- l.value = h, u.value = N, c.value = b ?? !0, d.value = [se(G)], j != null && (y.value = j), z.value = H(), w(c.value);
1154
- }, w = async (o) => {
1155
- o != L.value && (L.value = o, o && x());
1156
+ } = n;
1157
+ l.value = f, u.value = b, c.value = z ?? !0, d.value = [ie(G)], j != null && (p.value = j), A.value = H(), E(c.value);
1158
+ }, E = async (n) => {
1159
+ n != L.value && (L.value = n, n && q());
1156
1160
  }, D = R(
1157
1161
  () => d.value[0].value || void 0
1158
- ), W = function(o) {
1159
- const h = a.get(o, "referencePathsToExpand"), N = D.value ? a.isFunction(h) ? h(D.value) : h || [] : [];
1162
+ ), W = function(n) {
1163
+ const f = a.get(n, "referencePathsToExpand"), b = D.value ? a.isFunction(f) ? f(D.value) : f || [] : [];
1160
1164
  return {
1161
- ...a.cloneDeep(o || {}),
1162
- referencePathsToExpand: N
1165
+ ...a.cloneDeep(n || {}),
1166
+ referencePathsToExpand: b
1163
1167
  };
1164
- }, J = R(() => W(y.value)), K = R(() => {
1168
+ }, re = R(() => W(p.value)), J = R(() => {
1165
1169
  if (!D.value)
1166
1170
  return null;
1167
- if (!A.value)
1168
- return !D.value || !D.value.collectionName ? null : U.value ? `${ee.config.apiBaseUrl}/draft-batches/${U.value}/${D.value.collectionName}` : `${ee.config.apiBaseUrl}/${D.value.collectionName}`;
1169
- }), Y = R(() => {
1170
- if (D.value && K.value)
1171
+ if (!k.value)
1172
+ return !D.value || !D.value.collectionName ? null : C.value ? `${V.config.apiBaseUrl}/draft-batches/${C.value}/${D.value.collectionName}` : `${V.config.apiBaseUrl}/${D.value.collectionName}`;
1173
+ }), K = R(() => {
1174
+ if (D.value && J.value)
1171
1175
  return a.mergeWith(
1172
1176
  a.cloneDeep(Ue),
1173
- J.value,
1177
+ re.value,
1174
1178
  {
1175
1179
  idProperty: D.value.idProperty,
1176
- restCollectionUrl: K.value
1180
+ restCollectionUrl: J.value
1177
1181
  },
1178
- (o, h) => {
1179
- if (a.isArray(h) && h.length == 0 && (o == null || a.isArray(o)))
1180
- return h;
1182
+ (n, f) => {
1183
+ if (a.isArray(f) && f.length == 0 && (n == null || a.isArray(n)))
1184
+ return f;
1181
1185
  }
1182
1186
  );
1183
- }), p = I(0), _ = R(
1187
+ }), m = y(0), _ = R(
1184
1188
  () => {
1185
- var o;
1186
- return p.value, l.value || D.value && ((o = D.value) == null ? void 0 : o.collectionName) && (U.value ? `draftBatches/${U.value}/${D.value.collectionName}/${z.value}` : `${D.value.collectionName}/${z.value}`) || null;
1189
+ var n;
1190
+ return m.value, l.value || D.value && ((n = D.value) == null ? void 0 : n.collectionName) && (C.value ? `draftBatches/${C.value}/${D.value.collectionName}/${A.value}` : `${D.value.collectionName}/${A.value}`) || null;
1187
1191
  }
1188
- ), x = () => {
1192
+ ), q = () => {
1189
1193
  if (L.value) {
1190
- let o = !1;
1191
- return D.value && _.value && (t.value = ce.getStore(_.value), t.value ? o = !1 : Y.value && (A.value = !1, t.value = xe(_.value, Y.value)(), o = !0)), o;
1194
+ let n = !1;
1195
+ return D.value && _.value && (t.value = ce.getStore(_.value), t.value ? n = !1 : K.value && (k.value = !1, t.value = qe(_.value, K.value)(), n = !0)), n;
1192
1196
  } else
1193
1197
  return !1;
1194
1198
  }, M = () => {
1195
- _.value && l.value == _.value ? (t.value = void 0, x()) : (t.value = void 0, p.value = p.value + 1, x());
1199
+ _.value && l.value == _.value ? (t.value = void 0, q()) : (t.value = void 0, m.value = m.value + 1, q());
1196
1200
  };
1197
- return T(U, (o, h) => {
1198
- a.isEqual(o, h) || M();
1199
- }), T(L, (o, h) => {
1200
- o != h && (o ? x() : t.value = void 0);
1201
- }), T(D, (o, h) => {
1202
- o && !h ? x() : !o && h || a.isEqual(o, h) || M();
1203
- }), T(Y, (o, h) => {
1204
- a.isEqual(o, h) || M();
1205
- }), T(F, () => {
1206
- F.value || (A.value = !1);
1207
- }), T(_, () => x()), T(K, (o, h) => {
1208
- a.isEqual(o, h) || M();
1209
- }), x(), {
1201
+ return T(C, (n, f) => {
1202
+ a.isEqual(n, f) || M();
1203
+ }), T(L, (n, f) => {
1204
+ n != f && (n ? q() : t.value = void 0);
1205
+ }), T(D, (n, f) => {
1206
+ n && !f ? q() : !n && f || a.isEqual(n, f) || M();
1207
+ }), T(K, (n, f) => {
1208
+ a.isEqual(n, f) || M();
1209
+ }), T(N, () => {
1210
+ N.value || (k.value = !1);
1211
+ }), T(_, () => q()), T(J, (n, f) => {
1212
+ a.isEqual(n, f) || M();
1213
+ }), q(), {
1210
1214
  // Configuration
1211
1215
  resourceClientId: _,
1212
- draftBatchId: U,
1216
+ draftBatchId: C,
1213
1217
  enabled: L,
1214
1218
  resourceType: D,
1215
1219
  // Status
1216
- status: B,
1220
+ status: O,
1217
1221
  // Resources loaded from the REST API
1218
- resource: R(() => B.value != "Uninitialized" ? (g((o) => o.ensureResourceLoaded()), m("resource", [])) : []),
1219
- resourceId: R(() => m("resourceId", null)),
1220
- resourceUrl: R(() => m("resourceUrl", null)),
1222
+ resource: R(() => O.value != "Uninitialized" ? (I((n) => n.ensureResourceLoaded()), S("resource", [])) : []),
1223
+ resourceId: R(() => S("resourceId", null)),
1224
+ resourceUrl: R(() => S("resourceUrl", null)),
1221
1225
  // Methods: Configuration
1222
- reconfigureClient: C,
1223
- setEnabled: w,
1224
- setResourceId: async (o) => await g(async (h) => await h.setResourceId(o)),
1225
- setResourceUrl: async (o) => await g(async (h) => await h.setResourceUrl(o)),
1226
+ reconfigureClient: $,
1227
+ setEnabled: E,
1228
+ setResourceId: async (n) => await I(async (f) => await f.setResourceId(n)),
1229
+ setResourceUrl: async (n) => await I(async (f) => await f.setResourceUrl(n)),
1226
1230
  // Methods: Status
1227
- ensureStore: x,
1231
+ ensureStore: q,
1228
1232
  // Methods: Resource management
1229
- clear: () => O((o) => o.clear()),
1230
- ensureResourceLoaded: async () => await g(async (o) => o.ensureResourceLoaded()),
1231
- loadResource: async () => await g(async (o) => await o.loadResource()),
1233
+ clear: () => x((n) => n.clear()),
1234
+ ensureResourceLoaded: async () => await I(async (n) => n.ensureResourceLoaded()),
1235
+ loadResource: async () => await I(async (n) => await n.loadResource()),
1232
1236
  // Methods: Recording changes to the resource
1233
- checkForDeletedResource: async () => await g(async (o) => await o.checkForDeletedResource()) == !0,
1234
- recordDeletion: () => g((o) => o.recordDeletion()),
1235
- recordInsertion: (o) => g((h) => h.recordInsertion(o)),
1236
- recordUpdate: (o) => g((h) => h.recordUpdate(o)),
1237
- refreshResource: async () => await g(async (o) => await o.refreshResource()),
1237
+ checkForDeletedResource: async () => await I(async (n) => await n.checkForDeletedResource()) == !0,
1238
+ recordDeletion: () => I((n) => n.recordDeletion()),
1239
+ recordInsertion: (n) => I((f) => f.recordInsertion(n)),
1240
+ recordUpdate: (n) => I((f) => f.recordUpdate(n)),
1241
+ refreshResource: async () => await I(async (n) => await n.refreshResource()),
1238
1242
  // Methods: Modifying the resource
1239
- deleteResource: async () => await g(async (o) => await o.deleteResource()),
1240
- saveResource: async (o) => await g(async (h) => await h.saveResource(o)),
1243
+ deleteResource: async () => await I(async (n) => await n.deleteResource()),
1244
+ saveResource: async (n) => await I(async (f) => await f.saveResource(n)),
1241
1245
  // Methods: Custom API endpoints
1242
- makeCustomApiRequest: async (o) => await g(
1243
- async (h) => await h.makeCustomApiRequest(o)
1246
+ makeCustomApiRequest: async (n) => await I(
1247
+ async (f) => await f.makeCustomApiRequest(n)
1244
1248
  )
1245
1249
  };
1246
- }, ee = {
1250
+ }, V = {
1247
1251
  config: { ...ye }
1248
1252
  };
1249
- function je(f) {
1250
- ee.config = a.merge({}, ye, f);
1253
+ function We(h) {
1254
+ V.config = a.merge({}, ye, h);
1251
1255
  }
1252
1256
  export {
1253
1257
  _e as ApiClientError,
1254
- Qe as clearAllRestCollections,
1255
- je as initRestClient,
1256
- ee as restClient,
1257
- Oe as useRestCollection,
1258
- Me as useRestResource
1258
+ Me as clearAllRestCollections,
1259
+ We as initRestClient,
1260
+ V as restClient,
1261
+ Qe as useRestCollection,
1262
+ je as useRestResource
1259
1263
  };
@@ -1 +1 @@
1
- (function(v,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("lodash"),require("uuid"),require("vue"),require("axios"),require("jsog"),require("json-stringify-deterministic"),require("pinia")):typeof define=="function"&&define.amd?define(["exports","lodash","uuid","vue","axios","jsog","json-stringify-deterministic","pinia"],s):(v=typeof globalThis<"u"?globalThis:v||self,s(v["rest-client-vue"]={},v._,v.uuid,v.Vue,v.axios,v.jsog,v.stringify,v.pinia))})(this,function(v,s,I,o,$,ae,G,ce){"use strict";var Pe=Object.defineProperty;var Fe=(v,s,I)=>s in v?Pe(v,s,{enumerable:!0,configurable:!0,writable:!0,value:I}):v[s]=I;var oe=(v,s,I)=>(Fe(v,typeof s!="symbol"?s+"":s,I),I),Ne=(v,s,I)=>{if(!s.has(v))throw TypeError("Cannot "+I)};var j=(v,s,I)=>(Ne(v,s,"read from private field"),I?I.call(v):s.get(v)),Ie=(v,s,I)=>{if(s.has(v))throw TypeError("Cannot add the same private member more than once");s instanceof WeakSet?s.add(v):s.set(v,I)};var A;const ue={apiBaseUrl:"",useVueLogger:!1};class we extends Error{constructor(E,q=void 0,e=void 0){super(E);oe(this,"context");oe(this,"innerError");this.context=q,this.innerError=e}}class de{constructor(){Ie(this,A,{})}clearAllStores(){for(const n in j(this,A))j(this,A)[n].clear()}destroyStore(n){j(this,A)[n]&&(j(this,A)[n].$dispose(),delete j(this,A)[n])}getStore(n){return j(this,A)[n]}registerStore(n,E){j(this,A)[n]=E}}A=new WeakMap;function g(w,n){return s.get(w,(n==null?void 0:n.idProperty)||"_id")}function De(w,n){var E;return w&&((E=n.filter)!=null&&E.resourceIds)&&!n.order?n.filter.resourceIds.map(q=>w.find(e=>g(e,n)==q)).filter(q=>q!=null):w}const he={detail:{allowMultiple:!0,autoEdit:!1,autoFromMultipleSelection:!0,autoFromSingleInsertion:!0,autoFromSingleSelection:!0,constrainToSelection:!0},filter:{namedFilter:null,query:null,resourceIds:null},idProperty:"_id",limit:5e3,limitTransientDataToLocalCollection:!0,loading:{firstPageSize:500,pageSize:5e3},order:[[{path:"history.creation.timestamp"},"desc"],[{path:"history.creation.indexInBatch"},"desc"]]},K={resources:[],remoteCollectionSize:null,status:"NotLoaded",selection:[],detailSelection:[],invalidResources:[],transientData:{}},se={editingDetailSelection:!1,batchSaveAttempted:!1,editors:[],listNavigators:{}},Ce=(w,n)=>{n=s.merge({},he,n);const E=ce.defineStore(w,{state:()=>({idProperty:n.idProperty,filter:n.filter,order:n.order||null,propertyBlacklist:n.propertyBlacklist||null,referencePathsToExpand:n.referencePathsToExpand||null,restCollectionUrl:n.restCollectionUrl,...K,...se}),getters:{fixedQueryParams:e=>{var l,d,u,h;const r={};(l=e.filter)!=null&&l.namedFilter&&(r.namedFilter=e.filter.namedFilter);const t=[];if((d=e.filter)!=null&&d.resourceIds&&t.push({l:{path:e.idProperty},r:{constant:e.filter.resourceIds},operator:"in"}),(u=e.filter)!=null&&u.query&&t.push((h=e.filter)==null?void 0:h.query),t.length>0){const S=t.length==1?t[0]:{and:t};r.q=G(S)}return e.order&&(r.o=G(e.order)),e.propertyBlacklist&&(r.ex=G(e.propertyBlacklist)),e.referencePathsToExpand&&(r.r=G(e.referencePathsToExpand)),r}},actions:{reset(){for(const e in K)this[e]=K[e];for(const e in se)this[e]=se[e]},resetRetainingTransientData(){if(n.limitTransientDataToLocalCollection)this.reset();else{const e=this.transientData;this.reset(),this.transientData=e}},setEditingDetailSelection(e){this.editingDetailSelection=e},setFilter(e){s.isEqual(e,this.filter)||(this.filter=e,this.status="NotLoaded",this.resources=[],this.remoteCollectionSize=null,this.selection=[],this.detailSelection=[],this.invalidResources=[],this.editingDetailSelection=!1)},async setQuery(e){var r,t;if(!s.isEqual(e,(r=this.filter)==null?void 0:r.query)&&(e!=null||((t=this.filter)==null?void 0:t.query)!=null)){const l=s.cloneDeep(this.filter)||{};e!==null?l.query=e:s.unset(l,"query");const d=this.status;this.setFilter(l),d!="NotLoaded"&&await this.loadResources()}},async setFilterResourceIds(e){if(!s.isEqual(e,s.get(this.filter,"resourceIds"))){const r=s.cloneDeep(this.filter)||{};e!=null?r.resourceIds=e:s.unset(r,"resourceIds");const t=this.status;this.setFilter(r),t!="NotLoaded"&&await this.loadResources()}},setBatchSaveAttempted(e){e!=this.batchSaveAttempted&&(this.batchSaveAttempted=e)},clear(){for(const e in K)this[e]=K[e]},clearRetainingTransientData(){if(n.limitTransientDataToLocalCollection)this.reset();else{const e=this.transientData;this.reset(),this.transientData=e}},async ensureCollectionLoaded(){["Loaded","Loading","LoadingMore","Failed"].includes(this.status)||await this.loadResources()},async loadResources(e={}){this.resetRetainingTransientData();const r=I.v4();this._loadId=r,await this._loadResources(0,r,e)},async _loadResources(e,r,t){var b,N,k,B,Q;const l=e==0;if(this.status=l?"Loading":"LoadingMore",this._loadOffset=e,((b=this.filter)==null?void 0:b.query)===!1){this.resources=[],this.remoteCollectionSize=0;return}const d=this.fixedQueryParams,u=s.cloneDeep(d),h=l?(N=this.filter)!=null&&N.resourceIds&&!this.order?null:t.firstPageSize||((k=n.loading)==null?void 0:k.firstPageSize)||t.pageSize||((B=n.loading)==null?void 0:B.pageSize)||null:t.pageSize||((Q=n.loading)==null?void 0:Q.pageSize)||null,S=h!=null||n.limit!=null?s.min(s.filter([h,n.limit],p=>p!=null)):void 0;S!=null?(u.offset=e,u.limit=S):e!=0&&(u.offset=e);const D=s.map(u,(p,m)=>p!=null?`${encodeURIComponent(m)}=${encodeURIComponent(p)}`:null).filter(p=>p!=null).join("&"),L=s.isEmpty(D)?n.restCollectionUrl:`${n.restCollectionUrl}?${D}`;try{const p=await $.get(L),m=this.fixedQueryParams;if(r!=this._loadId||e!=this._loadOffset||!s.isEqual(d,m))console.log(`Discarding resources fetched by obsolete query from ${n.restCollectionUrl}.`);else{const C=ae.decode(s.get(p,"data.data",[])),T=(l?0:this.resources.length)+C.length,y=S==null||C.length<S||n.limit&&T>=n.limit;console.log(`Loaded ${C.length}${l?"":" more"} resources from ${n.restCollectionUrl}`),l&&(this.resources=[]);const H=[...this.resources,...C.map(Z=>Object.freeze(Z))];this.resources=De(H,this),s.get(p,"data.totalCollectionSize")?this.remoteCollectionSize=s.get(p,"data.totalCollectionSize"):this.remoteCollectionSize=null,this.status=y?"Loaded":"LoadingMore",y||this._loadResources(this.resources.length,r,t)}}catch(p){console.log(`Error while loading resources (URL="${L}"):`,p),this.clearRetainingTransientData(),this.status="Failed"}},async checkForDeletedResource(e){let r;try{r=await $.get(`${n.restCollectionUrl}/${e}`)}catch(t){$.isAxiosError(t)&&(r=t.response)}return r&&r.status==404?(this.recordDeletion(e),!0):!1},recordDeletion(e){var r;if(["Loaded","LoadingMore"].includes(this.status)){let t=this.resources.findIndex(l=>g(l,this)==e);t>=0&&this.resources.splice(t,1),t=this.selection.findIndex(l=>g(l,this)==e),t>=0&&this.selection.splice(t,1),t=this.detailSelection.findIndex(l=>g(l,this)==e),t>=0&&(this.detailSelection.splice(t,1),this.detailSelection.length==0&&(this.editingDetailSelection=((r=n.detail)==null?void 0:r.autoEdit)||!1)),n.limitTransientDataToLocalCollection&&delete this.transientData[e]}},recordInsertion(e,{insertAtBeginning:r,transientData:t}={}){var l;if(["Loaded","LoadingMore"].includes(this.status)){const d=Object.freeze(e);r?this.resources.unshift(d):this.resources.push(d),(l=n.detail)!=null&&l.autoFromSingleInsertion&&(this.detailSelection.length==0||this.detailSelection.length==1&&g(this.detailSelection[0],this)==null)&&(this.detailSelection=[d],this.editingDetailSelection=n.detail.autoEdit);const u=g(e,this);u&&(t===void 0?delete this.transientData[u]:this.transientData[u]=t)}},recordUpdate(e){const r=g(e,this);if(r&&["Loaded","LoadingMore"].includes(this.status)){const t=Object.freeze(e);let l=this.resources.findIndex(d=>g(d,this)==r);l>=0&&(this.resources[l]=t),l=this.selection.findIndex(d=>g(d,this)==r),l>=0&&(this.selection[l]=t),l=this.detailSelection.findIndex(d=>g(d,this)==r),l>=0&&(this.detailSelection[l]=t)}},async refreshResource(e){if(e){const r={};this.referencePathsToExpand&&(r.r=G(this.referencePathsToExpand));const t=s.map(r,(u,h)=>u!=null?`${encodeURIComponent(h)}=${encodeURIComponent(u)}`:null).filter(u=>u!=null).join("&"),l=s.isEmpty(t)?`${n.restCollectionUrl}/${e}`:`${n.restCollectionUrl}/${e}?${t}`,d=await $.get(l);if(d.status==200){const u=d.data;return this.recordUpdate(u),u}}return null},addResource(e={}){this.detailSelection=[s.omit(s.merge({},e),this.idProperty)],this.editingDetailSelection=!0},async deleteResource(e){if((await $.delete(`${n.restCollectionUrl}/${e}`)).status==200&&["Loaded","LoadingMore"].includes(this.status)){let t=this.resources.findIndex(l=>g(l,this)==e);t>=0&&this.resources.splice(t,1),t=this.selection.findIndex(l=>g(l,this)==e),t>=0&&this.selection.splice(t,1),t=this.detailSelection.findIndex(l=>g(l,this)==e),t>=0&&(this.detailSelection.splice(t,1),this.detailSelection.length==0&&(this.editingDetailSelection=n.detail.autoEdit)),n.limitTransientDataToLocalCollection&&delete this.transientData[e]}},async saveResource(e){const r=g(e,this),t=r==null,l=await $({method:t?"post":"put",url:t?n.restCollectionUrl:`${n.restCollectionUrl}/${r}`,data:e});if(l.status==200){const d=l.data,u=g(d,this),h=u?await this.refreshResource(u):null;return t&&this.recordInsertion(h||Object.freeze(d)),h||d}return null},async saveResources(e){const r=await $({method:"put",url:n.restCollectionUrl,data:e});if(r.status==200){const t=r.data||[],l=[];for(const[d,u]of t.entries()){const h=g(e[d],this)==null,S=g(u,this),D=S?await this.refreshResource(S):null;h&&this.recordInsertion(D||u),l.push(D||Object.freeze(u))}return l}return[]},clearTransientData(){this.transientData={}},setInvalidResourceIds(e){s.isEqual(e,this.invalidResources.map(r=>g(r,this)))||(this.invalidResources=e.map(r=>this.resources.find(t=>g(t,this)==r)).filter(r=>r!=null))},setTransientDataForResources(e){const{transientData:r,merge:t=!0}=e;t?s.merge(this.transientData,r):s.assign(this.transientData,r)},clearSelection(){this.setSelection([])},deselectResources(e){const r=this.selection.map(t=>g(t,this)).filter(t=>t!=null&&!e.includes(t));this.setSelection(r)},selectResources(e,r){const{addToSelection:t,edit:l}=r||{},d=this.selection.map(h=>g(h,this));let u=e;if(t){const h=s.difference(e,d);h.length>0&&(u=d.concat(h).filter(S=>S!=null))}s.isEqual(d,u)||this.setSelection(u,l)},setSelection(e,r){if(!s.isEqual(e,this.selection.map(t=>g(t,this)))){let t=!0;if(this.editors.length>0){if(n.detail.autoFromSingleSelection&&this.selection.length==1)t=!1;else if(n.detail.autoFromMultipleSelection&&n.detail.allowMultiple&&this.selection.length>1)t=!1;else if(n.detail.constrainToSelection){const l=this.selection.map(h=>g(h,this)),u=this.detailSelection.map(h=>g(h,this)).filter(h=>l.includes(h));this.detailSelection.filter(h=>!u.includes(g(h,this))).length>0&&(t=!1)}}if(!t)return;if(this.selection=e.map(l=>this.resources.find(d=>g(d,this)==l)).filter(l=>l!=null),n.detail.autoFromSingleSelection&&this.selection.length==1){const l=this.selection[0];(this.detailSelection.length!=1||g(this.detailSelection[0],this)!=g(l,this))&&(this.detailSelection=[l])}else if(n.detail.autoFromMultipleSelection&&n.detail.allowMultiple&&this.selection.length>1)s.isEqual(this.selection.map(l=>g(l,this)),this.detailSelection.map(l=>g(l,this)))||(this.detailSelection=s.clone(this.selection));else if(n.detail.constrainToSelection){const l=this.selection.map(h=>g(h,this)),d=this.detailSelection.map(h=>g(h,this)),u=d.filter(h=>l.includes(h));s.isEqual(u,d)||(this.detailSelection=this.detailSelection.filter(h=>u.includes(g(h,this))))}this.detailSelection.length==0?this.editingDetailSelection=!1:this.editingDetailSelection=r!==void 0?r:this.editingDetailSelection||n.detail.autoEdit}},hideDetail(){this.detailSelection.length>0&&(this.detailSelection=[],this.editingDetailSelection=!1)},showSelectionAsDetail(e){if(this.selection.length<=1||n.detail.allowMultiple){const r=this.selection.map(l=>g(l,this)),t=this.detailSelection.map(l=>g(l,this));s.isEqual(r,t)||(this.detailSelection=s.clone(this.selection)),this.detailSelection.length==0?this.editingDetailSelection=!1:this.editingDetailSelection=e!==void 0?e:this.editingDetailSelection||n.detail.autoEdit}},deregisterEditor(e){s.remove(this.editors,r=>r==e)},registerEditor(e){this.editors.includes(e)||this.editors.push(e)},deregisterListNavigator({name:e,listNavigator:r}){(r==null||this.listNavigators[e]==r)&&delete this.listNavigators[e]},registerListNavigator({name:e,listNavigator:r}){this.listNavigators[e]!=r&&(this.listNavigators[e]=r)}}});return(()=>{const e=(r,t)=>{const l=E(r,t);return ee.registerStore(l.$id,l),l};return e.$id=E.$id,e})()},ee=new de,Ue=(w={})=>{var ge,ve,pe,me;const{collectionId:n,draftBatchId:E,enabled:q,resourceType:e,options:r}=w,t=o.ref(void 0),l=o.ref(n),d=o.ref(E),u=o.ref(q??!0),h=o.ref([o.toRef(e)]),S=o.ref(r),D=o.computed(()=>d.value),L=o.ref(u.value),b=o.ref(I.v4()),N=o.ref((ve=(ge=S.value)==null?void 0:ge.filter)==null?void 0:ve.resourceIds),k=o.ref((me=(pe=S.value)==null?void 0:pe.filter)==null?void 0:me.query),B=o.computed(()=>d.value==null&&l.value!=null&&ee.getStore(l.value)!=null),Q=o.ref(B.value),p=o.computed(()=>T("status","Uninitialized"));function m(i){if(t.value)return i(t.value)}async function C(i){if(t.value)return await i(t.value)}function T(i,c){if(t.value)return t.value[i];if(c!==void 0)return c;throw"Attempted to use a REST collection store that has not been created, with no default value."}const y=(i={})=>{var ie,Re,Se,ye;const{collectionId:c,draftBatchId:U,enabled:F,resourceType:ne,options:te}=i;l.value=c,d.value=U,u.value=F??!0,h.value=[o.toRef(ne)],te!=null&&(S.value=te,N.value=(Re=(ie=S.value)==null?void 0:ie.filter)==null?void 0:Re.resourceIds,k.value=(ye=(Se=S.value)==null?void 0:Se.filter)==null?void 0:ye.query),b.value=I.v4(),H(u.value)},H=async i=>{i!=L.value&&(L.value=i,i&&(_(),z()))},Z=async i=>{N.value=i,await C(async c=>await c.setFilterResourceIds(N.value||null))},V=async i=>{if(k.value=i,p.value!="Uninitialized"){const c=i,U=o.computed(()=>s.isFunction(c)?R.value?c(R.value):null:c);await C(F=>F.setQuery(U.value||null))}},_=()=>{S.value=s.merge({},S.value||{},{filter:{resourceIds:N.value,query:k.value}})},R=o.computed(()=>h.value[0].value||void 0),O=function(i){const c=s.get(i,"filter.query"),U=s.get(i,"propertyBlacklist"),F=s.get(i,"referencePathsToExpand"),ne=s.isFunction(c)?c(R.value):c,te=R.value?s.isFunction(U)?U(R.value):U||[]:[],ie=R.value?s.isFunction(F)?F(R.value):F||[]:[];return{...s.cloneDeep(i||{}),filter:{...s.cloneDeep((i==null?void 0:i.filter)||{}),query:ne},propertyBlacklist:te,referencePathsToExpand:ie}},P=o.computed(()=>O(S.value)),M=o.computed(()=>{if(P.value.restCollectionUrl!==void 0)return P.value.restCollectionUrl;if(!Q.value)return!R.value||!R.value.collectionName?null:D.value?`${X.config.apiBaseUrl}/draft-batches/${D.value}/${R.value.collectionName}`:`${X.config.apiBaseUrl}/${R.value.collectionName}`}),a=o.computed(()=>{var i;if(R.value)return s.mergeWith(s.cloneDeep(he),P.value,{idProperty:(i=R.value)==null?void 0:i.idProperty,restCollectionUrl:M.value||""},(c,U)=>{if(s.isArray(U)&&U.length==0&&(c==null||s.isArray(c)))return U})}),f=o.ref(0),x=o.computed(()=>{var i;return f.value,l.value||R.value&&((i=R.value)==null?void 0:i.collectionName)&&(D.value?`draftBatches/${D.value}/${R.value.collectionName}/${b.value}`:`${R.value.collectionName}/${b.value}`)||null}),z=()=>{if(L.value){let i=!1;return R.value&&x.value&&(t.value=ee.getStore(x.value),t.value?i=!1:a.value&&(Q.value=!1,t.value=Ce(x.value,a.value)(),i=!0)),i}else return!1},J=()=>{x.value&&l.value==x.value?(t.value=void 0,z()):(t.value=void 0,f.value=f.value+1,z())};o.watch(D,(i,c)=>{s.isEqual(i,c)||J()}),o.watch(L,(i,c)=>{i!=c&&(i?z():t.value=void 0)}),o.watch(R,(i,c)=>{i&&!c?z():!i&&c||s.isEqual(i,c)||J()}),o.watch(a,(i,c)=>{s.isEqual(i,c)||J()}),o.watch(B,()=>{B.value||(Q.value=!1)}),o.watch(x,()=>z()),o.watch(M,(i,c)=>{s.isEqual(i,c)||J()});const W=[],qe=function(i){p.value!="Uninitialized"?o.nextTick(i):W.push(i)};return o.watch(p,(i,c)=>{if(i!="Uninitialized"&&c=="Uninitialized"){const U=s.clone(W);W.splice(0,W.length);for(const F of U)F()}}),z(),{collectionId:x,draftBatchId:D,resourceType:R,restCollectionUrl:o.computed(()=>T("restCollectionUrl",null)),enabled:L,status:p,batchSaveAttempted:o.computed(()=>T("batchSaveAttempted",!1)),listNavigators:o.computed(()=>T("listNavigators",!1)),invalidResources:o.computed(()=>T("invalidResources",[])),resources:o.computed(()=>p.value!="Uninitialized"?(C(i=>i.ensureCollectionLoaded()),T("resources",[])):[]),remoteCollectionSize:o.computed(()=>T("remoteCollectionSize",null)),transientData:o.computed(()=>T("transientData",[])),detailSelection:o.computed(()=>T("detailSelection",[])),editingDetailSelection:o.computed(()=>T("editingDetailSelection",!1)),selection:o.computed(()=>T("selection",[])),reconfigureCollection:y,setEditingDetailSelection:i=>m(c=>c.setEditingDetailSelection(i)),setEnabled:H,setFilterResourceIds:Z,setQuery:V,ensureStore:z,setBatchSaveAttempted:i=>m(c=>c.setBatchSaveAttempted(i)),clear:()=>m(i=>i.clear()),ensureCollectionLoaded:async()=>await C(async i=>i.ensureCollectionLoaded()),loadResources:async()=>await C(async i=>await i.loadResources()),addResource:i=>m(c=>c.addResource(i)),checkForDeletedResource:async i=>await C(async c=>await c.checkForDeletedResource(i))==!0,recordDeletion:i=>m(c=>c.recordDeletion(i)),recordInsertion:(i,{insertAtBeginning:c=!1,transientData:U=void 0}={})=>m(F=>F.recordInsertion(i,{insertAtBeginning:c,transientData:U})),recordUpdate:i=>m(c=>c.recordUpdate(i)),refreshResource:async i=>await C(async c=>await c.refreshResource(i)),deleteResource:async i=>await C(async c=>await c.deleteResource(i)),saveResource:async i=>await C(async c=>await c.saveResource(i)),saveResources:async i=>await C(async c=>await c.saveResources(i)),clearTransientData:()=>m(i=>i.clearTransientData()),setInvalidResourceIds:i=>m(c=>c.setInvalidResourceIds(i)),setTransientDataForResources:i=>m(c=>c.setTransientDataForResources(i)),clearSelection:()=>m(i=>i.clearSelection()),deselectResources:i=>m(c=>c.deselectResources(i)),selectResources:(i,c)=>m(U=>U.selectResources(i,c)),hideDetail:()=>m(i=>i.hideDetail()),deregisterEditor:i=>m(c=>c.deregisterEditor(i)),registerEditor:i=>m(c=>c.registerEditor(i)),deregisterListNavigator:i=>m(c=>c.deregisterListNavigator(i)),registerListNavigator:i=>m(c=>c.registerListNavigator(i)),onItemsStoreReady:qe}},Ee=()=>{ee.clearAllStores()};function re(w,n){return s.get(w,(n==null?void 0:n.idProperty)||"_id")}const fe={idProperty:"_id"},Y={resource:null,status:"NotLoaded"},Te=(w,n)=>{n=s.merge({},fe,n);const E=ce.defineStore(w,{state:()=>({idProperty:n.idProperty,resourceId:n.resourceId||null,resourceUrl:n.resourceUrl||null,referencePathsToExpand:n.referencePathsToExpand||null,...Y}),getters:{currentResourceUrl:e=>e.resourceUrl||(n.restCollectionUrl&&e.resourceId?`${n.restCollectionUrl}/${e.resourceId}`:null)||n.restCollectionUrl||null,fixedQueryParams:e=>{const r={};return e.referencePathsToExpand&&(r.r=G(e.referencePathsToExpand)),r}},actions:{reset(){for(const e in Y)this[e]=Y[e]},async setResourceId(e){const r=this.currentResourceUrl;this.resourceId=e,!s.isEqual(this.currentResourceUrl,r)&&this.status!="NotLoaded"&&await this.loadResource()},async setResourceUrl(e){const r=this.currentResourceUrl;this.resourceUrl=e,!s.isEqual(this.currentResourceUrl,r)&&this.status!="NotLoaded"&&await this.loadResource()},clear(){for(const e in Y)this[e]=Y[e]},async ensureResourceLoaded(){["Loaded","Loading","Failed"].includes(this.status)||await this.loadResource()},async loadResource(){this.reset();const e=I.v4();if(this._loadId=e,this.currentResourceUrl){this.status="Loading";const r=this.fixedQueryParams,t=s.cloneDeep(r),l=s.map(t,(u,h)=>u!=null?`${encodeURIComponent(h)}=${encodeURIComponent(u)}`:null).filter(u=>u!=null).join("&"),d=s.isEmpty(l)?this.currentResourceUrl:`${this.currentResourceUrl}?${l}`;try{const u=await $.get(d),h=this.fixedQueryParams;e!=this._loadId||!s.isEqual(r,h)?console.log(`Discarding resource fetched by obsolete query from ${d}.`):(this.resource=ae.decode(s.get(u,"data",{})),this.status="Loaded")}catch(u){console.log(`Error while loading resource (URL="${d}")`,u),this.reset(),this.status="Failed"}}else throw"Cannot load a resource because its URL, or its ID and collection URL, are unknown."},async checkForDeletedResource(){if(this.currentResourceUrl){let e;try{e=await $.get(this.currentResourceUrl)}catch(r){$.isAxiosError(r)&&(e=r.response)}return e&&e.status==404?(this.recordDeletion(),!0):!1}else throw"Cannot check for a deleted resource because its URL, or its ID and collection URL, are unknown."},recordDeletion(){this.resource=null,this.status="Loaded"},recordInsertion(e){this.resourceId=re(e,this)||null,this.status=="Loaded"&&(this.resource=Object.freeze(e))},recordUpdate(e){this.resourceId=re(e,this)||null,this.status=="Loaded"&&(this.resource=Object.freeze(e))},async refreshResource(){return await this.loadResource(),this.resource},async deleteResource(){if(this.currentResourceUrl)(await $.delete(this.currentResourceUrl)).status==200&&this.recordDeletion();else throw"Cannot delete a resource because its URL, or its ID and collection URL, are unknown."},async saveResource(e){const r=re(e,this),t=r==null;if(!r)throw"The REST resource store cannot create new resources on the server.";if(!this.currentResourceUrl)throw"Cannot save a resource because its URL, or its ID and collection URL, are unknown.";const l=await $({method:t?"post":"put",url:this.currentResourceUrl,data:e});if(l.status==200){const d=l.data,u=await this.refreshResource();return t&&this.recordInsertion(u||d),u||Object.freeze(d)}return null},async makeCustomApiRequest(e){const{method:r,subpath:t,url:l,data:d}=e;let u=l;if(!u)if(this.currentResourceUrl)u=`${this.currentResourceUrl}/${t}`;else throw"Cannot make a custom API request for a resource because its URL, or its ID and collection URL, are unknown.";const h=await $({method:r||"get",url:u,data:d});return h.status>=200&&h.status<300?h.data:null}}});return(()=>{const e=(r,t)=>{const l=E(r,t);return le.registerStore(l.$id,l),l};return e.$id=E.$id,e})()},le=new de,Le=(w={})=>{const{resourceClientId:n,draftBatchId:E,enabled:q,resourceType:e,options:r}=w,t=o.ref(void 0),l=o.ref(n),d=o.ref(E),u=o.ref(q??!0),h=o.ref([o.toRef(e)]),S=o.ref(r),D=o.computed(()=>d.value),L=o.ref(u.value),b=o.ref(I.v4()),N=o.computed(()=>d.value==null&&l.value!=null&&le.getStore(l.value)!=null),k=o.ref(N.value),B=o.computed(()=>m("status","Uninitialized"));function Q(a){if(t.value)return a(t.value)}async function p(a){if(t.value)return await a(t.value)}function m(a,f){if(t.value)return t.value[a];if(f!==void 0)return f;throw"Attempted to use a REST resource store that has not been created, with no default value."}const C=(a={})=>{const{resourceClientId:f,draftBatchId:x,enabled:z,resourceType:J,options:W}=a;l.value=f,d.value=x,u.value=z??!0,h.value=[o.toRef(J)],W!=null&&(S.value=W),b.value=I.v4(),T(u.value)},T=async a=>{a!=L.value&&(L.value=a,a&&P())},y=o.computed(()=>h.value[0].value||void 0),H=function(a){const f=s.get(a,"referencePathsToExpand"),x=y.value?s.isFunction(f)?f(y.value):f||[]:[];return{...s.cloneDeep(a||{}),referencePathsToExpand:x}},Z=o.computed(()=>H(S.value)),V=o.computed(()=>{if(!y.value)return null;if(!k.value)return!y.value||!y.value.collectionName?null:D.value?`${X.config.apiBaseUrl}/draft-batches/${D.value}/${y.value.collectionName}`:`${X.config.apiBaseUrl}/${y.value.collectionName}`}),_=o.computed(()=>{if(y.value&&V.value)return s.mergeWith(s.cloneDeep(fe),Z.value,{idProperty:y.value.idProperty,restCollectionUrl:V.value},(a,f)=>{if(s.isArray(f)&&f.length==0&&(a==null||s.isArray(a)))return f})}),R=o.ref(0),O=o.computed(()=>{var a;return R.value,l.value||y.value&&((a=y.value)==null?void 0:a.collectionName)&&(D.value?`draftBatches/${D.value}/${y.value.collectionName}/${b.value}`:`${y.value.collectionName}/${b.value}`)||null}),P=()=>{if(L.value){let a=!1;return y.value&&O.value&&(t.value=le.getStore(O.value),t.value?a=!1:_.value&&(k.value=!1,t.value=Te(O.value,_.value)(),a=!0)),a}else return!1},M=()=>{O.value&&l.value==O.value?(t.value=void 0,P()):(t.value=void 0,R.value=R.value+1,P())};return o.watch(D,(a,f)=>{s.isEqual(a,f)||M()}),o.watch(L,(a,f)=>{a!=f&&(a?P():t.value=void 0)}),o.watch(y,(a,f)=>{a&&!f?P():!a&&f||s.isEqual(a,f)||M()}),o.watch(_,(a,f)=>{s.isEqual(a,f)||M()}),o.watch(N,()=>{N.value||(k.value=!1)}),o.watch(O,()=>P()),o.watch(V,(a,f)=>{s.isEqual(a,f)||M()}),P(),{resourceClientId:O,draftBatchId:D,enabled:L,resourceType:y,status:B,resource:o.computed(()=>B.value!="Uninitialized"?(p(a=>a.ensureResourceLoaded()),m("resource",[])):[]),resourceId:o.computed(()=>m("resourceId",null)),resourceUrl:o.computed(()=>m("resourceUrl",null)),reconfigureClient:C,setEnabled:T,setResourceId:async a=>await p(async f=>await f.setResourceId(a)),setResourceUrl:async a=>await p(async f=>await f.setResourceUrl(a)),ensureStore:P,clear:()=>Q(a=>a.clear()),ensureResourceLoaded:async()=>await p(async a=>a.ensureResourceLoaded()),loadResource:async()=>await p(async a=>await a.loadResource()),checkForDeletedResource:async()=>await p(async a=>await a.checkForDeletedResource())==!0,recordDeletion:()=>p(a=>a.recordDeletion()),recordInsertion:a=>p(f=>f.recordInsertion(a)),recordUpdate:a=>p(f=>f.recordUpdate(a)),refreshResource:async()=>await p(async a=>await a.refreshResource()),deleteResource:async()=>await p(async a=>await a.deleteResource()),saveResource:async a=>await p(async f=>await f.saveResource(a)),makeCustomApiRequest:async a=>await p(async f=>await f.makeCustomApiRequest(a))}},X={config:{...ue}};function $e(w){X.config=s.merge({},ue,w)}v.ApiClientError=we,v.clearAllRestCollections=Ee,v.initRestClient=$e,v.restClient=X,v.useRestCollection=Ue,v.useRestResource=Le,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});
1
+ (function(v,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("lodash"),require("uuid"),require("vue"),require("axios"),require("jsog"),require("json-stringify-deterministic"),require("pinia")):typeof define=="function"&&define.amd?define(["exports","lodash","uuid","vue","axios","jsog","json-stringify-deterministic","pinia"],s):(v=typeof globalThis<"u"?globalThis:v||self,s(v["rest-client-vue"]={},v._,v.uuid,v.Vue,v.axios,v.jsog,v.stringify,v.pinia))})(this,function(v,s,D,o,q,ae,G,ce){"use strict";var Fe=Object.defineProperty;var Ne=(v,s,D)=>s in v?Fe(v,s,{enumerable:!0,configurable:!0,writable:!0,value:D}):v[s]=D;var oe=(v,s,D)=>(Ne(v,typeof s!="symbol"?s+"":s,D),D),xe=(v,s,D)=>{if(!s.has(v))throw TypeError("Cannot "+D)};var j=(v,s,D)=>(xe(v,s,"read from private field"),D?D.call(v):s.get(v)),Ie=(v,s,D)=>{if(s.has(v))throw TypeError("Cannot add the same private member more than once");s instanceof WeakSet?s.add(v):s.set(v,D)};var b;const ue={apiBaseUrl:"",useVueLogger:!1};class we extends Error{constructor(I,U=void 0,e=void 0){super(I);oe(this,"context");oe(this,"innerError");this.context=U,this.innerError=e}}class de{constructor(){Ie(this,b,{})}clearAllStores(){for(const n in j(this,b))j(this,b)[n].clear()}destroyStore(n){j(this,b)[n]&&(j(this,b)[n].$dispose(),delete j(this,b)[n])}getStore(n){return j(this,b)[n]}registerStore(n,I){j(this,b)[n]=I}}b=new WeakMap;function g(m,n){return s.get(m,(n==null?void 0:n.idProperty)||"_id")}function De(m,n){const I=s.map(n,(U,e)=>U!=null?`${encodeURIComponent(e)}=${encodeURIComponent(U)}`:null).filter(U=>U!=null).join("&");return I.length>0?m.indexOf("?")==m.length-1?`${m}&${I}`:`${m}?${I}`:m}function Ue(m,n){var I;return m&&((I=n.filter)!=null&&I.resourceIds)&&!n.order?n.filter.resourceIds.map(U=>m.find(e=>g(e,n)==U)).filter(U=>U!=null):m}const he={detail:{allowMultiple:!0,autoEdit:!1,autoFromMultipleSelection:!0,autoFromSingleInsertion:!0,autoFromSingleSelection:!0,constrainToSelection:!0},filter:{namedFilter:null,query:null,resourceIds:null},idProperty:"_id",limit:5e3,limitTransientDataToLocalCollection:!0,loading:{firstPageSize:500,pageSize:5e3},order:[[{path:"history.creation.timestamp"},"desc"],[{path:"history.creation.indexInBatch"},"desc"]]},K={resources:[],remoteCollectionSize:null,status:"NotLoaded",selection:[],detailSelection:[],invalidResources:[],transientData:{}},ie={editingDetailSelection:!1,batchSaveAttempted:!1,editors:[],listNavigators:{}},Ce=(m,n)=>{n=s.merge({},he,n);const I=ce.defineStore(m,{state:()=>({idProperty:n.idProperty,filter:n.filter,order:n.order||null,propertyBlacklist:n.propertyBlacklist||null,referencePathsToExpand:n.referencePathsToExpand||null,restCollectionUrl:n.restCollectionUrl,...K,...ie}),getters:{fixedQueryParams:e=>{var l,d,u,h;const r={};(l=e.filter)!=null&&l.namedFilter&&(r.namedFilter=e.filter.namedFilter);const t=[];if((d=e.filter)!=null&&d.resourceIds&&t.push({l:{path:e.idProperty},r:{constant:e.filter.resourceIds},operator:"in"}),(u=e.filter)!=null&&u.query&&t.push((h=e.filter)==null?void 0:h.query),t.length>0){const S=t.length==1?t[0]:{and:t};r.q=G(S)}return e.order&&(r.o=G(e.order)),e.propertyBlacklist&&(r.ex=G(e.propertyBlacklist)),e.referencePathsToExpand&&(r.r=G(e.referencePathsToExpand)),r}},actions:{reset(){for(const e in K)this[e]=K[e];for(const e in ie)this[e]=ie[e]},resetRetainingTransientData(){if(n.limitTransientDataToLocalCollection)this.reset();else{const e=this.transientData;this.reset(),this.transientData=e}},setEditingDetailSelection(e){this.editingDetailSelection=e},setFilter(e){s.isEqual(e,this.filter)||(this.filter=e,this.status="NotLoaded",this.resources=[],this.remoteCollectionSize=null,this.selection=[],this.detailSelection=[],this.invalidResources=[],this.editingDetailSelection=!1)},async setQuery(e){var r,t;if(!s.isEqual(e,(r=this.filter)==null?void 0:r.query)&&(e!=null||((t=this.filter)==null?void 0:t.query)!=null)){const l=s.cloneDeep(this.filter)||{};e!==null?l.query=e:s.unset(l,"query");const d=this.status;this.setFilter(l),d!="NotLoaded"&&await this.loadResources()}},async setFilterResourceIds(e){if(!s.isEqual(e,s.get(this.filter,"resourceIds"))){const r=s.cloneDeep(this.filter)||{};e!=null?r.resourceIds=e:s.unset(r,"resourceIds");const t=this.status;this.setFilter(r),t!="NotLoaded"&&await this.loadResources()}},setBatchSaveAttempted(e){e!=this.batchSaveAttempted&&(this.batchSaveAttempted=e)},clear(){for(const e in K)this[e]=K[e]},clearRetainingTransientData(){if(n.limitTransientDataToLocalCollection)this.reset();else{const e=this.transientData;this.reset(),this.transientData=e}},async ensureCollectionLoaded(){["Loaded","Loading","LoadingMore","Failed"].includes(this.status)||await this.loadResources()},async loadResources(e={}){this.resetRetainingTransientData();const r=D.v4();this._loadId=r,await this._loadResources(0,r,e)},async _loadResources(e,r,t){var L,k,x,O,B;const l=e==0;if(this.status=l?"Loading":"LoadingMore",this._loadOffset=e,((L=this.filter)==null?void 0:L.query)===!1){this.resources=[],this.remoteCollectionSize=0;return}const d=this.fixedQueryParams,u=s.cloneDeep(d),h=l?(k=this.filter)!=null&&k.resourceIds&&!this.order?null:t.firstPageSize||((x=n.loading)==null?void 0:x.firstPageSize)||t.pageSize||((O=n.loading)==null?void 0:O.pageSize)||null:t.pageSize||((B=n.loading)==null?void 0:B.pageSize)||null,S=h!=null||n.limit!=null?s.min(s.filter([h,n.limit],P=>P!=null)):void 0;S!=null?(u.offset=e,u.limit=S):e!=0&&(u.offset=e);const C=De(n.restCollectionUrl,u);try{const P=await q.get(C),y=this.fixedQueryParams;if(r!=this._loadId||e!=this._loadOffset||!s.isEqual(d,y))console.log(`Discarding resources fetched by obsolete query from ${n.restCollectionUrl}.`);else{const p=ae.decode(s.get(P,"data.data",[])),$=(l?0:this.resources.length)+p.length,E=S==null||p.length<S||n.limit&&$>=n.limit;console.log(`Loaded ${p.length}${l?"":" more"} resources from ${n.restCollectionUrl}`),l&&(this.resources=[]);const w=[...this.resources,...p.map(H=>Object.freeze(H))];this.resources=Ue(w,this),s.get(P,"data.totalCollectionSize")?this.remoteCollectionSize=s.get(P,"data.totalCollectionSize"):this.remoteCollectionSize=null,this.status=E?"Loaded":"LoadingMore",E||this._loadResources(this.resources.length,r,t)}}catch(P){console.log(`Error while loading resources (URL="${C}"):`,P),this.clearRetainingTransientData(),this.status="Failed"}},async checkForDeletedResource(e){let r;try{r=await q.get(`${n.restCollectionUrl}/${e}`)}catch(t){q.isAxiosError(t)&&(r=t.response)}return r&&r.status==404?(this.recordDeletion(e),!0):!1},recordDeletion(e){var r;if(["Loaded","LoadingMore"].includes(this.status)){let t=this.resources.findIndex(l=>g(l,this)==e);t>=0&&this.resources.splice(t,1),t=this.selection.findIndex(l=>g(l,this)==e),t>=0&&this.selection.splice(t,1),t=this.detailSelection.findIndex(l=>g(l,this)==e),t>=0&&(this.detailSelection.splice(t,1),this.detailSelection.length==0&&(this.editingDetailSelection=((r=n.detail)==null?void 0:r.autoEdit)||!1)),n.limitTransientDataToLocalCollection&&delete this.transientData[e]}},recordInsertion(e,{insertAtBeginning:r,transientData:t}={}){var l;if(["Loaded","LoadingMore"].includes(this.status)){const d=Object.freeze(e);r?this.resources.unshift(d):this.resources.push(d),(l=n.detail)!=null&&l.autoFromSingleInsertion&&(this.detailSelection.length==0||this.detailSelection.length==1&&g(this.detailSelection[0],this)==null)&&(this.detailSelection=[d],this.editingDetailSelection=n.detail.autoEdit);const u=g(e,this);u&&(t===void 0?delete this.transientData[u]:this.transientData[u]=t)}},recordUpdate(e){const r=g(e,this);if(r&&["Loaded","LoadingMore"].includes(this.status)){const t=Object.freeze(e);let l=this.resources.findIndex(d=>g(d,this)==r);l>=0&&(this.resources[l]=t),l=this.selection.findIndex(d=>g(d,this)==r),l>=0&&(this.selection[l]=t),l=this.detailSelection.findIndex(d=>g(d,this)==r),l>=0&&(this.detailSelection[l]=t)}},async refreshResource(e){if(e){const r={};this.referencePathsToExpand&&(r.r=G(this.referencePathsToExpand));const t=s.map(r,(u,h)=>u!=null?`${encodeURIComponent(h)}=${encodeURIComponent(u)}`:null).filter(u=>u!=null).join("&"),l=s.isEmpty(t)?`${n.restCollectionUrl}/${e}`:`${n.restCollectionUrl}/${e}?${t}`,d=await q.get(l);if(d.status==200){const u=d.data;return this.recordUpdate(u),u}}return null},addResource(e={}){this.detailSelection=[s.omit(s.merge({},e),this.idProperty)],this.editingDetailSelection=!0},async deleteResource(e){if((await q.delete(`${n.restCollectionUrl}/${e}`)).status==200&&["Loaded","LoadingMore"].includes(this.status)){let t=this.resources.findIndex(l=>g(l,this)==e);t>=0&&this.resources.splice(t,1),t=this.selection.findIndex(l=>g(l,this)==e),t>=0&&this.selection.splice(t,1),t=this.detailSelection.findIndex(l=>g(l,this)==e),t>=0&&(this.detailSelection.splice(t,1),this.detailSelection.length==0&&(this.editingDetailSelection=n.detail.autoEdit)),n.limitTransientDataToLocalCollection&&delete this.transientData[e]}},async saveResource(e){const r=g(e,this),t=r==null,l=await q({method:t?"post":"put",url:t?n.restCollectionUrl:`${n.restCollectionUrl}/${r}`,data:e});if(l.status==200){const d=l.data,u=g(d,this),h=u?await this.refreshResource(u):null;return t&&this.recordInsertion(h||Object.freeze(d)),h||d}return null},async saveResources(e){const r=await q({method:"put",url:n.restCollectionUrl,data:e});if(r.status==200){const t=r.data||[],l=[];for(const[d,u]of t.entries()){const h=g(e[d],this)==null,S=g(u,this),C=S?await this.refreshResource(S):null;h&&this.recordInsertion(C||u),l.push(C||Object.freeze(u))}return l}return[]},clearTransientData(){this.transientData={}},setInvalidResourceIds(e){s.isEqual(e,this.invalidResources.map(r=>g(r,this)))||(this.invalidResources=e.map(r=>this.resources.find(t=>g(t,this)==r)).filter(r=>r!=null))},setTransientDataForResources(e){const{transientData:r,merge:t=!0}=e;t?s.merge(this.transientData,r):s.assign(this.transientData,r)},clearSelection(){this.setSelection([])},deselectResources(e){const r=this.selection.map(t=>g(t,this)).filter(t=>t!=null&&!e.includes(t));this.setSelection(r)},selectResources(e,r){const{addToSelection:t,edit:l}=r||{},d=this.selection.map(h=>g(h,this));let u=e;if(t){const h=s.difference(e,d);h.length>0&&(u=d.concat(h).filter(S=>S!=null))}s.isEqual(d,u)||this.setSelection(u,l)},setSelection(e,r){if(!s.isEqual(e,this.selection.map(t=>g(t,this)))){let t=!0;if(this.editors.length>0){if(n.detail.autoFromSingleSelection&&this.selection.length==1)t=!1;else if(n.detail.autoFromMultipleSelection&&n.detail.allowMultiple&&this.selection.length>1)t=!1;else if(n.detail.constrainToSelection){const l=this.selection.map(h=>g(h,this)),u=this.detailSelection.map(h=>g(h,this)).filter(h=>l.includes(h));this.detailSelection.filter(h=>!u.includes(g(h,this))).length>0&&(t=!1)}}if(!t)return;if(this.selection=e.map(l=>this.resources.find(d=>g(d,this)==l)).filter(l=>l!=null),n.detail.autoFromSingleSelection&&this.selection.length==1){const l=this.selection[0];(this.detailSelection.length!=1||g(this.detailSelection[0],this)!=g(l,this))&&(this.detailSelection=[l])}else if(n.detail.autoFromMultipleSelection&&n.detail.allowMultiple&&this.selection.length>1)s.isEqual(this.selection.map(l=>g(l,this)),this.detailSelection.map(l=>g(l,this)))||(this.detailSelection=s.clone(this.selection));else if(n.detail.constrainToSelection){const l=this.selection.map(h=>g(h,this)),d=this.detailSelection.map(h=>g(h,this)),u=d.filter(h=>l.includes(h));s.isEqual(u,d)||(this.detailSelection=this.detailSelection.filter(h=>u.includes(g(h,this))))}this.detailSelection.length==0?this.editingDetailSelection=!1:this.editingDetailSelection=r!==void 0?r:this.editingDetailSelection||n.detail.autoEdit}},hideDetail(){this.detailSelection.length>0&&(this.detailSelection=[],this.editingDetailSelection=!1)},showSelectionAsDetail(e){if(this.selection.length<=1||n.detail.allowMultiple){const r=this.selection.map(l=>g(l,this)),t=this.detailSelection.map(l=>g(l,this));s.isEqual(r,t)||(this.detailSelection=s.clone(this.selection)),this.detailSelection.length==0?this.editingDetailSelection=!1:this.editingDetailSelection=e!==void 0?e:this.editingDetailSelection||n.detail.autoEdit}},deregisterEditor(e){s.remove(this.editors,r=>r==e)},registerEditor(e){this.editors.includes(e)||this.editors.push(e)},deregisterListNavigator({name:e,listNavigator:r}){(r==null||this.listNavigators[e]==r)&&delete this.listNavigators[e]},registerListNavigator({name:e,listNavigator:r}){this.listNavigators[e]!=r&&(this.listNavigators[e]=r)}}});return(()=>{const e=(r,t)=>{const l=I(r,t);return _.registerStore(l.$id,l),l};return e.$id=I.$id,e})()},_=new de,Ee=(m={})=>{var ge,ve,pe,me;const{collectionId:n,draftBatchId:I,enabled:U,resourceType:e,options:r}=m,t=o.ref(void 0),l=o.ref(n),d=o.ref(I),u=o.ref(U??!0),h=o.ref([o.toRef(e)]),S=o.ref(r),C=o.computed(()=>d.value),L=o.ref(u.value),k=o.ref(D.v4()),x=o.ref((ve=(ge=S.value)==null?void 0:ge.filter)==null?void 0:ve.resourceIds),O=o.ref((me=(pe=S.value)==null?void 0:pe.filter)==null?void 0:me.query),B=o.computed(()=>d.value==null&&l.value!=null&&_.getStore(l.value)!=null),P=o.ref(B.value),y=o.computed(()=>E("status","Uninitialized"));function p(i){if(t.value)return i(t.value)}async function $(i){if(t.value)return await i(t.value)}function E(i,c){if(t.value)return t.value[i];if(c!==void 0)return c;throw"Attempted to use a REST collection store that has not been created, with no default value."}const w=(i={})=>{var te,Re,Se,ye;const{collectionId:c,draftBatchId:T,enabled:N,resourceType:ne,options:ee}=i;l.value=c,d.value=T,u.value=N??!0,h.value=[o.toRef(ne)],ee!=null&&(S.value=ee,x.value=(Re=(te=S.value)==null?void 0:te.filter)==null?void 0:Re.resourceIds,O.value=(ye=(Se=S.value)==null?void 0:Se.filter)==null?void 0:ye.query),k.value=D.v4(),H(u.value)},H=async i=>{i!=L.value&&(L.value=i,i&&(V(),A()))},le=async i=>{x.value=i,await $(async c=>await c.setFilterResourceIds(x.value||null))},Z=async i=>{if(O.value=i,y.value!="Uninitialized"){const c=i,T=o.computed(()=>s.isFunction(c)?R.value?c(R.value):null:c);await $(N=>N.setQuery(T.value||null))}},V=()=>{S.value=s.merge({},S.value||{},{filter:{resourceIds:x.value,query:O.value}})},R=o.computed(()=>h.value[0].value||void 0),Q=function(i){const c=s.get(i,"filter.query"),T=s.get(i,"propertyBlacklist"),N=s.get(i,"referencePathsToExpand"),ne=s.isFunction(c)?c(R.value):c,ee=R.value?s.isFunction(T)?T(R.value):T||[]:[],te=R.value?s.isFunction(N)?N(R.value):N||[]:[];return{...s.cloneDeep(i||{}),filter:{...s.cloneDeep((i==null?void 0:i.filter)||{}),query:ne},propertyBlacklist:ee,referencePathsToExpand:te}},F=o.computed(()=>Q(S.value)),M=o.computed(()=>{if(F.value.restCollectionUrl!==void 0)return F.value.restCollectionUrl;if(!P.value)return!R.value||!R.value.collectionName?null:C.value?`${X.config.apiBaseUrl}/draft-batches/${C.value}/${R.value.collectionName}`:`${X.config.apiBaseUrl}/${R.value.collectionName}`}),a=o.computed(()=>{var i;if(R.value)return s.mergeWith(s.cloneDeep(he),F.value,{idProperty:(i=R.value)==null?void 0:i.idProperty,restCollectionUrl:M.value||""},(c,T)=>{if(s.isArray(T)&&T.length==0&&(c==null||s.isArray(c)))return T})}),f=o.ref(0),z=o.computed(()=>{var i;return f.value,l.value||R.value&&((i=R.value)==null?void 0:i.collectionName)&&(C.value?`draftBatches/${C.value}/${R.value.collectionName}/${k.value}`:`${R.value.collectionName}/${k.value}`)||null}),A=()=>{if(L.value){let i=!1;return R.value&&z.value&&(t.value=_.getStore(z.value),t.value?i=!1:a.value&&(P.value=!1,t.value=Ce(z.value,a.value)(),i=!0)),i}else return!1},J=()=>{z.value&&l.value==z.value?(t.value=void 0,A()):(t.value=void 0,f.value=f.value+1,A())};o.watch(C,(i,c)=>{s.isEqual(i,c)||J()}),o.watch(L,(i,c)=>{i!=c&&(i?A():t.value=void 0)}),o.watch(R,(i,c)=>{i&&!c?A():!i&&c||s.isEqual(i,c)||J()}),o.watch(a,(i,c)=>{s.isEqual(i,c)||J()}),o.watch(B,()=>{B.value||(P.value=!1)}),o.watch(z,()=>A()),o.watch(M,(i,c)=>{s.isEqual(i,c)||J()});const W=[],Pe=function(i){y.value!="Uninitialized"?o.nextTick(i):W.push(i)};return o.watch(y,(i,c)=>{if(i!="Uninitialized"&&c=="Uninitialized"){const T=s.clone(W);W.splice(0,W.length);for(const N of T)N()}}),A(),{collectionId:z,draftBatchId:C,resourceType:R,restCollectionUrl:o.computed(()=>E("restCollectionUrl",null)),enabled:L,status:y,batchSaveAttempted:o.computed(()=>E("batchSaveAttempted",!1)),listNavigators:o.computed(()=>E("listNavigators",!1)),invalidResources:o.computed(()=>E("invalidResources",[])),resources:o.computed(()=>y.value!="Uninitialized"?($(i=>i.ensureCollectionLoaded()),E("resources",[])):[]),remoteCollectionSize:o.computed(()=>E("remoteCollectionSize",null)),transientData:o.computed(()=>E("transientData",[])),detailSelection:o.computed(()=>E("detailSelection",[])),editingDetailSelection:o.computed(()=>E("editingDetailSelection",!1)),selection:o.computed(()=>E("selection",[])),reconfigureCollection:w,setEditingDetailSelection:i=>p(c=>c.setEditingDetailSelection(i)),setEnabled:H,setFilterResourceIds:le,setQuery:Z,ensureStore:A,setBatchSaveAttempted:i=>p(c=>c.setBatchSaveAttempted(i)),clear:()=>p(i=>i.clear()),ensureCollectionLoaded:async()=>await $(async i=>i.ensureCollectionLoaded()),loadResources:async()=>await $(async i=>await i.loadResources()),addResource:i=>p(c=>c.addResource(i)),checkForDeletedResource:async i=>await $(async c=>await c.checkForDeletedResource(i))==!0,recordDeletion:i=>p(c=>c.recordDeletion(i)),recordInsertion:(i,{insertAtBeginning:c=!1,transientData:T=void 0}={})=>p(N=>N.recordInsertion(i,{insertAtBeginning:c,transientData:T})),recordUpdate:i=>p(c=>c.recordUpdate(i)),refreshResource:async i=>await $(async c=>await c.refreshResource(i)),deleteResource:async i=>await $(async c=>await c.deleteResource(i)),saveResource:async i=>await $(async c=>await c.saveResource(i)),saveResources:async i=>await $(async c=>await c.saveResources(i)),clearTransientData:()=>p(i=>i.clearTransientData()),setInvalidResourceIds:i=>p(c=>c.setInvalidResourceIds(i)),setTransientDataForResources:i=>p(c=>c.setTransientDataForResources(i)),clearSelection:()=>p(i=>i.clearSelection()),deselectResources:i=>p(c=>c.deselectResources(i)),selectResources:(i,c)=>p(T=>T.selectResources(i,c)),hideDetail:()=>p(i=>i.hideDetail()),deregisterEditor:i=>p(c=>c.deregisterEditor(i)),registerEditor:i=>p(c=>c.registerEditor(i)),deregisterListNavigator:i=>p(c=>c.deregisterListNavigator(i)),registerListNavigator:i=>p(c=>c.registerListNavigator(i)),onItemsStoreReady:Pe}},Te=()=>{_.clearAllStores()};function se(m,n){return s.get(m,(n==null?void 0:n.idProperty)||"_id")}const fe={idProperty:"_id"},Y={resource:null,status:"NotLoaded"},Le=(m,n)=>{n=s.merge({},fe,n);const I=ce.defineStore(m,{state:()=>({idProperty:n.idProperty,resourceId:n.resourceId||null,resourceUrl:n.resourceUrl||null,referencePathsToExpand:n.referencePathsToExpand||null,...Y}),getters:{currentResourceUrl:e=>e.resourceUrl||(n.restCollectionUrl&&e.resourceId?`${n.restCollectionUrl}/${e.resourceId}`:null)||n.restCollectionUrl||null,fixedQueryParams:e=>{const r={};return e.referencePathsToExpand&&(r.r=G(e.referencePathsToExpand)),r}},actions:{reset(){for(const e in Y)this[e]=Y[e]},async setResourceId(e){const r=this.currentResourceUrl;this.resourceId=e,!s.isEqual(this.currentResourceUrl,r)&&this.status!="NotLoaded"&&await this.loadResource()},async setResourceUrl(e){const r=this.currentResourceUrl;this.resourceUrl=e,!s.isEqual(this.currentResourceUrl,r)&&this.status!="NotLoaded"&&await this.loadResource()},clear(){for(const e in Y)this[e]=Y[e]},async ensureResourceLoaded(){["Loaded","Loading","Failed"].includes(this.status)||await this.loadResource()},async loadResource(){this.reset();const e=D.v4();if(this._loadId=e,this.currentResourceUrl){this.status="Loading";const r=this.fixedQueryParams,t=s.cloneDeep(r),l=s.map(t,(u,h)=>u!=null?`${encodeURIComponent(h)}=${encodeURIComponent(u)}`:null).filter(u=>u!=null).join("&"),d=s.isEmpty(l)?this.currentResourceUrl:`${this.currentResourceUrl}?${l}`;try{const u=await q.get(d),h=this.fixedQueryParams;e!=this._loadId||!s.isEqual(r,h)?console.log(`Discarding resource fetched by obsolete query from ${d}.`):(this.resource=ae.decode(s.get(u,"data",{})),this.status="Loaded")}catch(u){console.log(`Error while loading resource (URL="${d}")`,u),this.reset(),this.status="Failed"}}else throw"Cannot load a resource because its URL, or its ID and collection URL, are unknown."},async checkForDeletedResource(){if(this.currentResourceUrl){let e;try{e=await q.get(this.currentResourceUrl)}catch(r){q.isAxiosError(r)&&(e=r.response)}return e&&e.status==404?(this.recordDeletion(),!0):!1}else throw"Cannot check for a deleted resource because its URL, or its ID and collection URL, are unknown."},recordDeletion(){this.resource=null,this.status="Loaded"},recordInsertion(e){this.resourceId=se(e,this)||null,this.status=="Loaded"&&(this.resource=Object.freeze(e))},recordUpdate(e){this.resourceId=se(e,this)||null,this.status=="Loaded"&&(this.resource=Object.freeze(e))},async refreshResource(){return await this.loadResource(),this.resource},async deleteResource(){if(this.currentResourceUrl)(await q.delete(this.currentResourceUrl)).status==200&&this.recordDeletion();else throw"Cannot delete a resource because its URL, or its ID and collection URL, are unknown."},async saveResource(e){const r=se(e,this),t=r==null;if(!r)throw"The REST resource store cannot create new resources on the server.";if(!this.currentResourceUrl)throw"Cannot save a resource because its URL, or its ID and collection URL, are unknown.";const l=await q({method:t?"post":"put",url:this.currentResourceUrl,data:e});if(l.status==200){const d=l.data,u=await this.refreshResource();return t&&this.recordInsertion(u||d),u||Object.freeze(d)}return null},async makeCustomApiRequest(e){const{method:r,subpath:t,url:l,data:d}=e;let u=l;if(!u)if(this.currentResourceUrl)u=`${this.currentResourceUrl}/${t}`;else throw"Cannot make a custom API request for a resource because its URL, or its ID and collection URL, are unknown.";const h=await q({method:r||"get",url:u,data:d});return h.status>=200&&h.status<300?h.data:null}}});return(()=>{const e=(r,t)=>{const l=I(r,t);return re.registerStore(l.$id,l),l};return e.$id=I.$id,e})()},re=new de,$e=(m={})=>{const{resourceClientId:n,draftBatchId:I,enabled:U,resourceType:e,options:r}=m,t=o.ref(void 0),l=o.ref(n),d=o.ref(I),u=o.ref(U??!0),h=o.ref([o.toRef(e)]),S=o.ref(r),C=o.computed(()=>d.value),L=o.ref(u.value),k=o.ref(D.v4()),x=o.computed(()=>d.value==null&&l.value!=null&&re.getStore(l.value)!=null),O=o.ref(x.value),B=o.computed(()=>p("status","Uninitialized"));function P(a){if(t.value)return a(t.value)}async function y(a){if(t.value)return await a(t.value)}function p(a,f){if(t.value)return t.value[a];if(f!==void 0)return f;throw"Attempted to use a REST resource store that has not been created, with no default value."}const $=(a={})=>{const{resourceClientId:f,draftBatchId:z,enabled:A,resourceType:J,options:W}=a;l.value=f,d.value=z,u.value=A??!0,h.value=[o.toRef(J)],W!=null&&(S.value=W),k.value=D.v4(),E(u.value)},E=async a=>{a!=L.value&&(L.value=a,a&&F())},w=o.computed(()=>h.value[0].value||void 0),H=function(a){const f=s.get(a,"referencePathsToExpand"),z=w.value?s.isFunction(f)?f(w.value):f||[]:[];return{...s.cloneDeep(a||{}),referencePathsToExpand:z}},le=o.computed(()=>H(S.value)),Z=o.computed(()=>{if(!w.value)return null;if(!O.value)return!w.value||!w.value.collectionName?null:C.value?`${X.config.apiBaseUrl}/draft-batches/${C.value}/${w.value.collectionName}`:`${X.config.apiBaseUrl}/${w.value.collectionName}`}),V=o.computed(()=>{if(w.value&&Z.value)return s.mergeWith(s.cloneDeep(fe),le.value,{idProperty:w.value.idProperty,restCollectionUrl:Z.value},(a,f)=>{if(s.isArray(f)&&f.length==0&&(a==null||s.isArray(a)))return f})}),R=o.ref(0),Q=o.computed(()=>{var a;return R.value,l.value||w.value&&((a=w.value)==null?void 0:a.collectionName)&&(C.value?`draftBatches/${C.value}/${w.value.collectionName}/${k.value}`:`${w.value.collectionName}/${k.value}`)||null}),F=()=>{if(L.value){let a=!1;return w.value&&Q.value&&(t.value=re.getStore(Q.value),t.value?a=!1:V.value&&(O.value=!1,t.value=Le(Q.value,V.value)(),a=!0)),a}else return!1},M=()=>{Q.value&&l.value==Q.value?(t.value=void 0,F()):(t.value=void 0,R.value=R.value+1,F())};return o.watch(C,(a,f)=>{s.isEqual(a,f)||M()}),o.watch(L,(a,f)=>{a!=f&&(a?F():t.value=void 0)}),o.watch(w,(a,f)=>{a&&!f?F():!a&&f||s.isEqual(a,f)||M()}),o.watch(V,(a,f)=>{s.isEqual(a,f)||M()}),o.watch(x,()=>{x.value||(O.value=!1)}),o.watch(Q,()=>F()),o.watch(Z,(a,f)=>{s.isEqual(a,f)||M()}),F(),{resourceClientId:Q,draftBatchId:C,enabled:L,resourceType:w,status:B,resource:o.computed(()=>B.value!="Uninitialized"?(y(a=>a.ensureResourceLoaded()),p("resource",[])):[]),resourceId:o.computed(()=>p("resourceId",null)),resourceUrl:o.computed(()=>p("resourceUrl",null)),reconfigureClient:$,setEnabled:E,setResourceId:async a=>await y(async f=>await f.setResourceId(a)),setResourceUrl:async a=>await y(async f=>await f.setResourceUrl(a)),ensureStore:F,clear:()=>P(a=>a.clear()),ensureResourceLoaded:async()=>await y(async a=>a.ensureResourceLoaded()),loadResource:async()=>await y(async a=>await a.loadResource()),checkForDeletedResource:async()=>await y(async a=>await a.checkForDeletedResource())==!0,recordDeletion:()=>y(a=>a.recordDeletion()),recordInsertion:a=>y(f=>f.recordInsertion(a)),recordUpdate:a=>y(f=>f.recordUpdate(a)),refreshResource:async()=>await y(async a=>await a.refreshResource()),deleteResource:async()=>await y(async a=>await a.deleteResource()),saveResource:async a=>await y(async f=>await f.saveResource(a)),makeCustomApiRequest:async a=>await y(async f=>await f.makeCustomApiRequest(a))}},X={config:{...ue}};function qe(m){X.config=s.merge({},ue,m)}v.ApiClientError=we,v.clearAllRestCollections=Te,v.initRestClient=qe,v.restClient=X,v.useRestCollection=Ee,v.useRestResource=$e,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});
@@ -1 +1 @@
1
- {"version":3,"file":"rest-collection-store.d.ts","sourceRoot":"","sources":["../../../src/stores/rest-collection-store.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,sBAAsB,EAAE,sBAAsB,EAAC,MAAM,uBAAuB,CAAA;AACpF,OAAO,EAAC,QAAQ,EAAE,UAAU,EAAC,MAAM,iCAAiC,CAAA;AACpE,OAAO,EAAC,WAAW,EAAE,UAAU,EAAC,MAAM,eAAe,CAAA;AACrD,OAAO,EAAC,aAAa,EAAC,MAAM,2BAA2B,CAAA;AAsBvD,2FAA2F;AAC3F,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,KAAK,EAAE,GAAG,GAAG,IAAI,CAAA;IACjB,WAAW,EAAE,UAAU,EAAE,GAAG,IAAI,CAAA;CACjC;AAED,0EAA0E;AAC1E,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE;QACN,aAAa,EAAE,OAAO,CAAA;QACtB,QAAQ,EAAE,OAAO,CAAA;QACjB,yBAAyB,EAAE,OAAO,CAAA;QAClC,uBAAu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