rest-client-vue 1.2.0-b1 → 1.2.0-b3

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,6 +1,6 @@
1
1
  var Ee = Object.defineProperty;
2
2
  var Ce = (h, i, g) => i in h ? Ee(h, i, { enumerable: !0, configurable: !0, writable: !0, value: g }) : h[i] = g;
3
- var ae = (h, i, g) => (Ce(h, typeof i != "symbol" ? i + "" : i, g), g), Te = (h, i, g) => {
3
+ var oe = (h, i, g) => (Ce(h, typeof i != "symbol" ? i + "" : i, g), g), Te = (h, i, g) => {
4
4
  if (!i.has(h))
5
5
  throw TypeError("Cannot " + g);
6
6
  };
@@ -9,10 +9,10 @@ var Q = (h, i, g) => (Te(h, i, "read from private field"), g ? g.call(h) : i.get
9
9
  throw TypeError("Cannot add the same private member more than once");
10
10
  i instanceof WeakSet ? i.add(h) : i.set(h, g);
11
11
  };
12
- import a from "lodash";
12
+ import o from "lodash";
13
13
  import { v4 as H } from "uuid";
14
- import { ref as I, toRef as se, computed as R, watch as L, nextTick as Le } from "vue";
15
- import $ from "axios";
14
+ import { ref as I, toRef as se, computed as R, watch as $, nextTick as Le } from "vue";
15
+ import x from "axios";
16
16
  import pe from "jsog";
17
17
  import X from "json-stringify-deterministic";
18
18
  import { defineStore as me } from "pinia";
@@ -23,36 +23,36 @@ const ye = {
23
23
  class Be extends Error {
24
24
  constructor(g, U = void 0, e = void 0) {
25
25
  super(g);
26
- ae(this, "context");
27
- ae(this, "innerError");
26
+ oe(this, "context");
27
+ oe(this, "innerError");
28
28
  this.context = U, this.innerError = e;
29
29
  }
30
30
  }
31
- var _;
31
+ var O;
32
32
  class Ie {
33
33
  constructor() {
34
- Se(this, _, {});
34
+ Se(this, O, {});
35
35
  }
36
36
  clearAllStores() {
37
- for (const i in Q(this, _))
38
- Q(this, _)[i].clear();
37
+ for (const i in Q(this, O))
38
+ Q(this, O)[i].clear();
39
39
  }
40
40
  destroyStore(i) {
41
- Q(this, _)[i] && (Q(this, _)[i].$dispose(), delete Q(this, _)[i]);
41
+ Q(this, O)[i] && (Q(this, O)[i].$dispose(), delete Q(this, O)[i]);
42
42
  }
43
43
  getStore(i) {
44
- return Q(this, _)[i];
44
+ return Q(this, O)[i];
45
45
  }
46
46
  registerStore(i, g) {
47
- Q(this, _)[i] = g;
47
+ Q(this, O)[i] = g;
48
48
  }
49
49
  }
50
- _ = new WeakMap();
50
+ O = new WeakMap();
51
51
  function v(h, i) {
52
- return a.get(h, (i == null ? void 0 : i.idProperty) || "_id");
52
+ return o.get(h, (i == null ? void 0 : i.idProperty) || "_id");
53
53
  }
54
54
  function $e(h, i) {
55
- const g = a.map(
55
+ const g = o.map(
56
56
  i,
57
57
  (U, e) => U != null ? `${encodeURIComponent(e)}=${encodeURIComponent(U)}` : null
58
58
  ).filter((U) => U != null).join("&");
@@ -80,6 +80,9 @@ const Ue = {
80
80
  query: null,
81
81
  resourceIds: null
82
82
  },
83
+ hooks: {
84
+ beforeLoadResources: null
85
+ },
83
86
  idProperty: "_id",
84
87
  limit: 5e3,
85
88
  limitTransientDataToLocalCollection: !0,
@@ -99,14 +102,15 @@ const Ue = {
99
102
  selection: [],
100
103
  detailSelection: [],
101
104
  invalidResources: [],
102
- transientData: {}
103
- }, oe = {
105
+ transientData: {},
106
+ _isBeforeLoad: !0
107
+ }, ae = {
104
108
  editingDetailSelection: !1,
105
109
  batchSaveAttempted: !1,
106
110
  editors: [],
107
111
  listNavigators: {}
108
112
  }, Pe = (h, i) => {
109
- i = a.merge({}, Ue, i);
113
+ i = o.merge({}, Ue, i);
110
114
  const g = me(h, {
111
115
  state: () => ({
112
116
  idProperty: i.idProperty,
@@ -116,7 +120,7 @@ const Ue = {
116
120
  referencePathsToExpand: i.referencePathsToExpand || null,
117
121
  restCollectionUrl: i.restCollectionUrl,
118
122
  ...Y,
119
- ...oe
123
+ ...ae
120
124
  }),
121
125
  getters: {
122
126
  /**
@@ -148,8 +152,8 @@ const Ue = {
148
152
  reset() {
149
153
  for (const e in Y)
150
154
  this[e] = Y[e];
151
- for (const e in oe)
152
- this[e] = oe[e];
155
+ for (const e in ae)
156
+ this[e] = ae[e];
153
157
  },
154
158
  /**
155
159
  * Reset the store to its initial state, but retain transient data if appropriate.
@@ -189,7 +193,7 @@ const Ue = {
189
193
  * @param filter The new filter.
190
194
  */
191
195
  setFilter(e) {
192
- a.isEqual(e, this.filter) || (this.filter = e, this.status = "NotLoaded", this.resources = [], this.remoteCollectionSize = null, this.selection = [], this.detailSelection = [], this.invalidResources = [], this.editingDetailSelection = !1);
196
+ o.isEqual(e, this.filter) || (this.filter = e, this.status = "NotLoaded", this.resources = [], this.remoteCollectionSize = null, this.selection = [], this.detailSelection = [], this.invalidResources = [], this.editingDetailSelection = !1);
193
197
  },
194
198
  /**
195
199
  * Set the filter query.
@@ -202,9 +206,9 @@ const Ue = {
202
206
  */
203
207
  async setQuery(e) {
204
208
  var r, t;
205
- if (!a.isEqual(e, (r = this.filter) == null ? void 0 : r.query) && (e != null || ((t = this.filter) == null ? void 0 : t.query) != null)) {
206
- const l = a.cloneDeep(this.filter) || {};
207
- e !== null ? l.query = e : a.unset(l, "query");
209
+ if (!o.isEqual(e, (r = this.filter) == null ? void 0 : r.query) && (e != null || ((t = this.filter) == null ? void 0 : t.query) != null)) {
210
+ const l = o.cloneDeep(this.filter) || {};
211
+ e !== null ? l.query = e : o.unset(l, "query");
208
212
  const u = this.status;
209
213
  this.setFilter(l), u != "NotLoaded" && await this.loadResources();
210
214
  }
@@ -219,9 +223,9 @@ const Ue = {
219
223
  * need to be reloaded.
220
224
  */
221
225
  async setFilterResourceIds(e) {
222
- if (!a.isEqual(e, a.get(this.filter, "resourceIds"))) {
223
- const r = a.cloneDeep(this.filter) || {};
224
- e != null ? r.resourceIds = e : a.unset(r, "resourceIds");
226
+ if (!o.isEqual(e, o.get(this.filter, "resourceIds"))) {
227
+ const r = o.cloneDeep(this.filter) || {};
228
+ e != null ? r.resourceIds = e : o.unset(r, "resourceIds");
225
229
  const t = this.status;
226
230
  this.setFilter(r), t != "NotLoaded" && await this.loadResources();
227
231
  }
@@ -301,29 +305,39 @@ const Ue = {
301
305
  * @param loadOptions Pagination options that may override the defaults.
302
306
  */
303
307
  async _loadResources(e, r, t) {
304
- var x, A, N, O, k;
308
+ var P, A, N, _, k;
305
309
  const l = e == 0;
306
- if (this.status = l ? "Loading" : "LoadingMore", this._loadOffset = e, ((x = this.filter) == null ? void 0 : x.query) === !1) {
310
+ if (this.status = l ? "Loading" : "LoadingMore", this._isBeforeLoad && i.hooks.beforeLoadResources) {
311
+ const E = i.hooks.beforeLoadResources();
312
+ if (o.isArray(E)) {
313
+ this.resources = E, this.status = "Loaded";
314
+ return;
315
+ } else if (E === !1) {
316
+ this.status = "Failed";
317
+ return;
318
+ }
319
+ }
320
+ if (this._isBeforeLoad = !1, this._loadOffset = e, ((P = this.filter) == null ? void 0 : P.query) === !1) {
307
321
  this.resources = [], this.remoteCollectionSize = 0;
308
322
  return;
309
323
  }
310
- const u = this.fixedQueryParams, c = a.cloneDeep(u), d = l ? (A = this.filter) != null && A.resourceIds && !this.order ? null : t.firstPageSize || ((N = i.loading) == null ? void 0 : N.firstPageSize) || t.pageSize || ((O = i.loading) == null ? void 0 : O.pageSize) || null : t.pageSize || ((k = i.loading) == null ? void 0 : k.pageSize) || null, m = d != null || i.limit != null ? a.min(a.filter([d, i.limit], (P) => P != null)) : void 0;
324
+ const u = this.fixedQueryParams, c = o.cloneDeep(u), d = l ? (A = this.filter) != null && A.resourceIds && !this.order ? null : t.firstPageSize || ((N = i.loading) == null ? void 0 : N.firstPageSize) || t.pageSize || ((_ = i.loading) == null ? void 0 : _.pageSize) || null : t.pageSize || ((k = i.loading) == null ? void 0 : k.pageSize) || null, m = d != null || i.limit != null ? o.min(o.filter([d, i.limit], (E) => E != null)) : void 0;
311
325
  m != null ? (c.offset = e, c.limit = m) : e != 0 && (c.offset = e);
312
326
  const w = $e(i.restCollectionUrl, c);
313
327
  try {
314
- const P = await $.get(w), y = this.fixedQueryParams;
315
- if (r != this._loadId || e != this._loadOffset || !a.isEqual(u, y))
328
+ const E = await x.get(w), y = this.fixedQueryParams;
329
+ if (r != this._loadId || e != this._loadOffset || !o.isEqual(u, y))
316
330
  console.log(`Discarding resources fetched by obsolete query from ${i.restCollectionUrl}.`);
317
331
  else {
318
- const S = pe.decode(a.get(P, "data.data", [])), T = (l ? 0 : this.resources.length) + S.length, E = m == null || S.length < m || i.limit && T >= i.limit;
332
+ const S = pe.decode(o.get(E, "data.data", [])), L = (l ? 0 : this.resources.length) + S.length, C = m == null || S.length < m || i.limit && L >= i.limit;
319
333
  console.log(
320
334
  `Loaded ${S.length}${l ? "" : " more"} resources from ${i.restCollectionUrl}`
321
335
  ), l && (this.resources = []);
322
336
  const D = [...this.resources, ...S.map((W) => Object.freeze(W))];
323
- this.resources = xe(D, this), a.get(P, "data.totalCollectionSize") ? this.remoteCollectionSize = a.get(P, "data.totalCollectionSize") : this.remoteCollectionSize = null, this.status = E ? "Loaded" : "LoadingMore", E || this._loadResources(this.resources.length, r, t);
337
+ this.resources = xe(D, this), o.get(E, "data.totalCollectionSize") ? this.remoteCollectionSize = o.get(E, "data.totalCollectionSize") : this.remoteCollectionSize = null, this.status = C ? "Loaded" : "LoadingMore", C || this._loadResources(this.resources.length, r, t);
324
338
  }
325
- } catch (P) {
326
- console.log(`Error while loading resources (URL="${w}"):`, P), this.clearRetainingTransientData(), this.status = "Failed";
339
+ } catch (E) {
340
+ console.log(`Error while loading resources (URL="${w}"):`, E), this.clearRetainingTransientData(), this.status = "Failed";
327
341
  }
328
342
  },
329
343
  // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -341,9 +355,9 @@ const Ue = {
341
355
  async checkForDeletedResource(e) {
342
356
  let r;
343
357
  try {
344
- r = await $.get(`${i.restCollectionUrl}/${e}`);
358
+ r = await x.get(`${i.restCollectionUrl}/${e}`);
345
359
  } catch (t) {
346
- $.isAxiosError(t) && (r = t.response);
360
+ x.isAxiosError(t) && (r = t.response);
347
361
  }
348
362
  return r && r.status == 404 ? (this.recordDeletion(e), !0) : !1;
349
363
  },
@@ -425,10 +439,10 @@ const Ue = {
425
439
  if (e) {
426
440
  const r = {};
427
441
  this.referencePathsToExpand && (r.r = X(this.referencePathsToExpand));
428
- const t = a.map(
442
+ const t = o.map(
429
443
  r,
430
444
  (c, d) => c != null ? `${encodeURIComponent(d)}=${encodeURIComponent(c)}` : null
431
- ).filter((c) => c != null).join("&"), l = a.isEmpty(t) ? `${i.restCollectionUrl}/${e}` : `${i.restCollectionUrl}/${e}?${t}`, u = await $.get(l);
445
+ ).filter((c) => c != null).join("&"), l = o.isEmpty(t) ? `${i.restCollectionUrl}/${e}` : `${i.restCollectionUrl}/${e}?${t}`, u = await x.get(l);
432
446
  if (u.status == 200) {
433
447
  const c = u.data;
434
448
  return this.recordUpdate(c), c;
@@ -445,7 +459,7 @@ const Ue = {
445
459
  * @param resourceDefaults Initial properties of the new resource.
446
460
  */
447
461
  addResource(e = {}) {
448
- this.detailSelection = [a.omit(a.merge({}, e), this.idProperty)], this.editingDetailSelection = !0;
462
+ this.detailSelection = [o.omit(o.merge({}, e), this.idProperty)], this.editingDetailSelection = !0;
449
463
  },
450
464
  /**
451
465
  * Delete one resource.
@@ -455,7 +469,7 @@ const Ue = {
455
469
  * @param resourceId The ID of the resource to delete.
456
470
  */
457
471
  async deleteResource(e) {
458
- if ((await $.delete(`${i.restCollectionUrl}/${e}`)).status == 200 && ["Loaded", "LoadingMore"].includes(this.status)) {
472
+ if ((await x.delete(`${i.restCollectionUrl}/${e}`)).status == 200 && ["Loaded", "LoadingMore"].includes(this.status)) {
459
473
  let t = this.resources.findIndex((l) => v(l, this) == e);
460
474
  t >= 0 && this.resources.splice(t, 1), t = this.selection.findIndex((l) => v(l, this) == e), t >= 0 && this.selection.splice(t, 1), t = this.detailSelection.findIndex((l) => v(l, this) == e), t >= 0 && (this.detailSelection.splice(t, 1), this.detailSelection.length == 0 && (this.editingDetailSelection = i.detail.autoEdit)), i.limitTransientDataToLocalCollection && delete this.transientData[e];
461
475
  }
@@ -472,7 +486,7 @@ const Ue = {
472
486
  * the operation failed.
473
487
  */
474
488
  async saveResource(e) {
475
- const r = v(e, this), t = r == null, l = await $({
489
+ const r = v(e, this), t = r == null, l = await x({
476
490
  method: t ? "post" : "put",
477
491
  url: t ? i.restCollectionUrl : `${i.restCollectionUrl}/${r}`,
478
492
  data: e
@@ -494,7 +508,7 @@ const Ue = {
494
508
  * @returns An array of refreshed local resources, one for each remote resource whose save operation succeeded.
495
509
  */
496
510
  async saveResources(e) {
497
- const r = await $({
511
+ const r = await x({
498
512
  method: "put",
499
513
  url: i.restCollectionUrl,
500
514
  data: e
@@ -520,9 +534,9 @@ const Ue = {
520
534
  * the operation failed.
521
535
  */
522
536
  async updateResources(e) {
523
- const r = await $({
537
+ const r = await x({
524
538
  method: "patch",
525
- url: `${i.restCollectionUrl}`,
539
+ url: i.restCollectionUrl,
526
540
  data: e
527
541
  });
528
542
  if (r.status == 200) {
@@ -550,7 +564,7 @@ const Ue = {
550
564
  * @param resourceIds The IDs of all local resources that failed validation.
551
565
  */
552
566
  setInvalidResourceIds(e) {
553
- a.isEqual(e, this.invalidResources.map((r) => v(r, this))) || (this.invalidResources = e.map((r) => this.resources.find((t) => v(t, this) == r)).filter((r) => r != null));
567
+ o.isEqual(e, this.invalidResources.map((r) => v(r, this))) || (this.invalidResources = e.map((r) => this.resources.find((t) => v(t, this) == r)).filter((r) => r != null));
554
568
  },
555
569
  /**
556
570
  * Set transient data.
@@ -561,7 +575,7 @@ const Ue = {
561
575
  */
562
576
  setTransientDataForResources(e) {
563
577
  const { transientData: r, merge: t = !0 } = e;
564
- t ? a.merge(this.transientData, r) : a.assign(this.transientData, r);
578
+ t ? o.merge(this.transientData, r) : o.assign(this.transientData, r);
565
579
  },
566
580
  // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
567
581
  // Actions: Managing selections
@@ -593,10 +607,10 @@ const Ue = {
593
607
  const { addToSelection: t, edit: l } = r || {}, u = this.selection.map((d) => v(d, this));
594
608
  let c = e;
595
609
  if (t) {
596
- const d = a.difference(e, u);
610
+ const d = o.difference(e, u);
597
611
  d.length > 0 && (c = u.concat(d).filter((m) => m != null));
598
612
  }
599
- a.isEqual(u, c) || this.setSelection(c, l);
613
+ o.isEqual(u, c) || this.setSelection(c, l);
600
614
  },
601
615
  /**
602
616
  * Set a new selection.
@@ -606,7 +620,7 @@ const Ue = {
606
620
  * be left as is, or set to true if options.detail.autoEdit is true.
607
621
  */
608
622
  setSelection(e, r) {
609
- if (!a.isEqual(e, this.selection.map((t) => v(t, this)))) {
623
+ if (!o.isEqual(e, this.selection.map((t) => v(t, this)))) {
610
624
  let t = !0;
611
625
  if (this.editors.length > 0) {
612
626
  if (i.detail.autoFromSingleSelection && this.selection.length == 1)
@@ -624,13 +638,13 @@ const Ue = {
624
638
  const l = this.selection[0];
625
639
  (this.detailSelection.length != 1 || v(this.detailSelection[0], this) != v(l, this)) && (this.detailSelection = [l]);
626
640
  } else if (i.detail.autoFromMultipleSelection && i.detail.allowMultiple && this.selection.length > 1)
627
- a.isEqual(
641
+ o.isEqual(
628
642
  this.selection.map((l) => v(l, this)),
629
643
  this.detailSelection.map((l) => v(l, this))
630
- ) || (this.detailSelection = a.clone(this.selection));
644
+ ) || (this.detailSelection = o.clone(this.selection));
631
645
  else if (i.detail.constrainToSelection) {
632
646
  const l = this.selection.map((d) => v(d, this)), u = this.detailSelection.map((d) => v(d, this)), c = u.filter((d) => l.includes(d));
633
- a.isEqual(c, u) || (this.detailSelection = this.detailSelection.filter((d) => c.includes(v(d, this))));
647
+ o.isEqual(c, u) || (this.detailSelection = this.detailSelection.filter((d) => c.includes(v(d, this))));
634
648
  }
635
649
  this.detailSelection.length == 0 ? this.editingDetailSelection = !1 : this.editingDetailSelection = r !== void 0 ? r : this.editingDetailSelection || i.detail.autoEdit;
636
650
  }
@@ -658,7 +672,7 @@ const Ue = {
658
672
  showSelectionAsDetail(e) {
659
673
  if (this.selection.length <= 1 || i.detail.allowMultiple) {
660
674
  const r = this.selection.map((l) => v(l, this)), t = this.detailSelection.map((l) => v(l, this));
661
- a.isEqual(r, t) || (this.detailSelection = a.clone(this.selection)), this.detailSelection.length == 0 ? this.editingDetailSelection = !1 : this.editingDetailSelection = e !== void 0 ? e : this.editingDetailSelection || i.detail.autoEdit;
675
+ o.isEqual(r, t) || (this.detailSelection = o.clone(this.selection)), this.detailSelection.length == 0 ? this.editingDetailSelection = !1 : this.editingDetailSelection = e !== void 0 ? e : this.editingDetailSelection || i.detail.autoEdit;
662
676
  }
663
677
  },
664
678
  // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -670,7 +684,7 @@ const Ue = {
670
684
  * @param editor The editor to deregister.
671
685
  */
672
686
  deregisterEditor(e) {
673
- a.remove(this.editors, (r) => r == e);
687
+ o.remove(this.editors, (r) => r == e);
674
688
  },
675
689
  /**
676
690
  * Register an editor.
@@ -725,18 +739,18 @@ const Ue = {
725
739
  enabled: U,
726
740
  resourceType: e,
727
741
  options: r
728
- } = h, t = I(void 0), l = I(i), u = I(g), c = I(U ?? !0), d = I([se(e)]), m = I(r), w = R(() => u.value), x = I(c.value), A = I(H()), N = I((de = (ue = m.value) == null ? void 0 : ue.filter) == null ? void 0 : de.resourceIds), O = I((fe = (he = m.value) == null ? void 0 : he.filter) == null ? void 0 : fe.query), k = R(
742
+ } = h, t = I(void 0), l = I(i), u = I(g), c = I(U ?? !0), d = I([se(e)]), m = I(r), w = R(() => u.value), P = I(c.value), A = I(H()), N = I((de = (ue = m.value) == null ? void 0 : ue.filter) == null ? void 0 : de.resourceIds), _ = I((fe = (he = m.value) == null ? void 0 : he.filter) == null ? void 0 : fe.query), k = R(
729
743
  () => u.value == null && l.value != null && ie.getStore(l.value) != null
730
- ), P = I(k.value), y = R(() => E("status", "Uninitialized"));
744
+ ), E = I(k.value), y = R(() => C("status", "Uninitialized"));
731
745
  function S(s) {
732
746
  if (t.value)
733
747
  return s(t.value);
734
748
  }
735
- async function T(s) {
749
+ async function L(s) {
736
750
  if (t.value)
737
751
  return await s(t.value);
738
752
  }
739
- function E(s, n) {
753
+ function C(s, n) {
740
754
  if (t.value)
741
755
  return t.value[s];
742
756
  if (n !== void 0)
@@ -747,33 +761,33 @@ const Ue = {
747
761
  var te, ve, ge, Re;
748
762
  const {
749
763
  collectionId: n,
750
- draftBatchId: C,
764
+ draftBatchId: T,
751
765
  enabled: F,
752
766
  resourceType: le,
753
767
  options: ee
754
768
  } = s;
755
- l.value = n, u.value = C, c.value = F ?? !0, d.value = [se(le)], ee != null && (m.value = ee, N.value = (ve = (te = m.value) == null ? void 0 : te.filter) == null ? void 0 : ve.resourceIds, O.value = (Re = (ge = m.value) == null ? void 0 : ge.filter) == null ? void 0 : Re.query), A.value = H(), W(c.value);
769
+ l.value = n, u.value = T, c.value = F ?? !0, d.value = [se(le)], ee != null && (m.value = ee, N.value = (ve = (te = m.value) == null ? void 0 : te.filter) == null ? void 0 : ve.resourceIds, _.value = (Re = (ge = m.value) == null ? void 0 : ge.filter) == null ? void 0 : Re.query), A.value = H(), W(c.value);
756
770
  }, W = async (s) => {
757
- s != x.value && (x.value = s, s && (K(), z()));
771
+ s != P.value && (P.value = s, s && (K(), z()));
758
772
  }, re = async (s) => {
759
- N.value = s, await T(async (n) => await n.setFilterResourceIds(N.value || null));
773
+ N.value = s, await L(async (n) => await n.setFilterResourceIds(N.value || null));
760
774
  }, J = async (s) => {
761
- if (O.value = s, y.value != "Uninitialized") {
762
- const n = s, C = R(() => a.isFunction(n) ? p.value ? n(p.value) : null : n);
763
- await T((F) => F.setQuery(C.value || null));
775
+ if (_.value = s, y.value != "Uninitialized") {
776
+ const n = s, T = R(() => o.isFunction(n) ? p.value ? n(p.value) : null : n);
777
+ await L((F) => F.setQuery(T.value || null));
764
778
  }
765
779
  }, K = () => {
766
- m.value = a.merge({}, m.value || {}, {
767
- filter: { resourceIds: N.value, query: O.value }
780
+ m.value = o.merge({}, m.value || {}, {
781
+ filter: { resourceIds: N.value, query: _.value }
768
782
  });
769
783
  }, p = R(
770
784
  () => d.value[0].value || void 0
771
785
  ), B = function(s) {
772
- const n = a.get(s, "filter.query"), C = a.get(s, "propertiesToExclude"), F = a.get(s, "referencePathsToExpand"), le = a.isFunction(n) ? n(p.value) : n, ee = p.value ? a.isFunction(C) ? C(p.value) : C || [] : [], te = p.value ? a.isFunction(F) ? F(p.value) : F || [] : [];
786
+ const n = o.get(s, "filter.query"), T = o.get(s, "propertiesToExclude"), F = o.get(s, "referencePathsToExpand"), le = o.isFunction(n) ? n(p.value) : n, ee = p.value ? o.isFunction(T) ? T(p.value) : T || [] : [], te = p.value ? o.isFunction(F) ? F(p.value) : F || [] : [];
773
787
  return {
774
- ...a.cloneDeep(s || {}),
788
+ ...o.cloneDeep(s || {}),
775
789
  filter: {
776
- ...a.cloneDeep((s == null ? void 0 : s.filter) || {}),
790
+ ...o.cloneDeep((s == null ? void 0 : s.filter) || {}),
777
791
  query: le
778
792
  },
779
793
  propertiesToExclude: ee,
@@ -782,21 +796,21 @@ const Ue = {
782
796
  }, q = R(() => B(m.value)), j = R(() => {
783
797
  if (q.value.restCollectionUrl !== void 0)
784
798
  return q.value.restCollectionUrl;
785
- if (!P.value)
799
+ if (!E.value)
786
800
  return !p.value || !p.value.collectionName ? null : w.value ? `${V.config.apiBaseUrl}/draft-batches/${w.value}/${p.value.collectionName}` : `${V.config.apiBaseUrl}/${p.value.collectionName}`;
787
- }), o = R(() => {
801
+ }), a = R(() => {
788
802
  var s;
789
803
  if (p.value)
790
- return a.mergeWith(
791
- a.cloneDeep(Ue),
804
+ return o.mergeWith(
805
+ o.cloneDeep(Ue),
792
806
  q.value,
793
807
  {
794
808
  idProperty: (s = p.value) == null ? void 0 : s.idProperty,
795
809
  restCollectionUrl: j.value || ""
796
810
  },
797
- (n, C) => {
798
- if (a.isArray(C) && C.length == 0 && (n == null || a.isArray(n)))
799
- return C;
811
+ (n, T) => {
812
+ if (o.isArray(T) && T.length == 0 && (n == null || o.isArray(n)))
813
+ return T;
800
814
  }
801
815
  );
802
816
  }), f = I(0), b = R(
@@ -805,35 +819,35 @@ const Ue = {
805
819
  return f.value, l.value || p.value && ((s = p.value) == null ? void 0 : s.collectionName) && (w.value ? `draftBatches/${w.value}/${p.value.collectionName}/${A.value}` : `${p.value.collectionName}/${A.value}`) || null;
806
820
  }
807
821
  ), z = () => {
808
- if (x.value) {
822
+ if (P.value) {
809
823
  let s = !1;
810
- return p.value && b.value && (t.value = ie.getStore(b.value), t.value ? s = !1 : o.value && (P.value = !1, t.value = Pe(b.value, o.value)(), s = !0)), s;
824
+ return p.value && b.value && (t.value = ie.getStore(b.value), t.value ? s = !1 : a.value && (E.value = !1, t.value = Pe(b.value, a.value)(), s = !0)), s;
811
825
  } else
812
826
  return !1;
813
827
  }, G = () => {
814
828
  b.value && l.value == b.value ? (t.value = void 0, z()) : (t.value = void 0, f.value = f.value + 1, z());
815
829
  };
816
- L(w, (s, n) => {
817
- a.isEqual(s, n) || G();
818
- }), L(x, (s, n) => {
830
+ $(w, (s, n) => {
831
+ o.isEqual(s, n) || G();
832
+ }), $(P, (s, n) => {
819
833
  s != n && (s ? z() : t.value = void 0);
820
- }), L(p, (s, n) => {
821
- s && !n ? z() : !s && n || a.isEqual(s, n) || G();
822
- }), L(o, (s, n) => {
823
- a.isEqual(s, n) || G();
824
- }), L(k, () => {
825
- k.value || (P.value = !1);
826
- }), L(b, () => z()), L(j, (s, n) => {
827
- a.isEqual(s, n) || G();
834
+ }), $(p, (s, n) => {
835
+ s && !n ? z() : !s && n || o.isEqual(s, n) || G();
836
+ }), $(a, (s, n) => {
837
+ o.isEqual(s, n) || G();
838
+ }), $(k, () => {
839
+ k.value || (E.value = !1);
840
+ }), $(b, () => z()), $(j, (s, n) => {
841
+ o.isEqual(s, n) || G();
828
842
  });
829
843
  const M = [], we = function(s) {
830
844
  y.value != "Uninitialized" ? Le(s) : M.push(s);
831
845
  };
832
- return L(y, (s, n) => {
846
+ return $(y, (s, n) => {
833
847
  if (s != "Uninitialized" && n == "Uninitialized") {
834
- const C = a.clone(M);
848
+ const T = o.clone(M);
835
849
  M.splice(0, M.length);
836
- for (const F of C)
850
+ for (const F of T)
837
851
  F();
838
852
  }
839
853
  }), z(), {
@@ -841,22 +855,22 @@ const Ue = {
841
855
  collectionId: b,
842
856
  draftBatchId: w,
843
857
  resourceType: p,
844
- restCollectionUrl: R(() => E("restCollectionUrl", null)),
858
+ restCollectionUrl: R(() => C("restCollectionUrl", null)),
845
859
  // Status
846
- enabled: x,
860
+ enabled: P,
847
861
  status: y,
848
- batchSaveAttempted: R(() => E("batchSaveAttempted", !1)),
849
- listNavigators: R(() => E("listNavigators", !1)),
862
+ batchSaveAttempted: R(() => C("batchSaveAttempted", !1)),
863
+ listNavigators: R(() => C("listNavigators", !1)),
850
864
  // Resources loaded from the REST API
851
- invalidResources: R(() => E("invalidResources", [])),
852
- resources: R(() => y.value != "Uninitialized" ? (T((s) => s.ensureCollectionLoaded()), E("resources", [])) : []),
853
- remoteCollectionSize: R(() => E("remoteCollectionSize", null)),
865
+ invalidResources: R(() => C("invalidResources", [])),
866
+ resources: R(() => y.value != "Uninitialized" ? (L((s) => s.ensureCollectionLoaded()), C("resources", [])) : []),
867
+ remoteCollectionSize: R(() => C("remoteCollectionSize", null)),
854
868
  // Transient data
855
- transientData: R(() => E("transientData", [])),
869
+ transientData: R(() => C("transientData", [])),
856
870
  // Selection and detail selection
857
- detailSelection: R(() => E("detailSelection", [])),
858
- editingDetailSelection: R(() => E("editingDetailSelection", !1)),
859
- selection: R(() => E("selection", [])),
871
+ detailSelection: R(() => C("detailSelection", [])),
872
+ editingDetailSelection: R(() => C("editingDetailSelection", !1)),
873
+ selection: R(() => C("selection", [])),
860
874
  // Methods: Configuration
861
875
  reconfigureCollection: D,
862
876
  setEditingDetailSelection: (s) => S(
@@ -871,24 +885,24 @@ const Ue = {
871
885
  setBatchSaveAttempted: (s) => S((n) => n.setBatchSaveAttempted(s)),
872
886
  // Local collection management
873
887
  clear: () => S((s) => s.clear()),
874
- ensureCollectionLoaded: async () => await T(async (s) => s.ensureCollectionLoaded()),
875
- loadResources: async () => await T(async (s) => await s.loadResources()),
888
+ ensureCollectionLoaded: async () => await L(async (s) => s.ensureCollectionLoaded()),
889
+ loadResources: async () => await L(async (s) => await s.loadResources()),
876
890
  // Methods: Recording changes to the collection
877
891
  addResource: (s) => S((n) => n.addResource(s)),
878
- checkForDeletedResource: async (s) => await T(async (n) => await n.checkForDeletedResource(s)) == !0,
892
+ checkForDeletedResource: async (s) => await L(async (n) => await n.checkForDeletedResource(s)) == !0,
879
893
  recordDeletion: (s) => S((n) => n.recordDeletion(s)),
880
- recordInsertion: (s, { insertAtBeginning: n = !1, transientData: C = void 0 } = {}) => S((F) => F.recordInsertion(s, { insertAtBeginning: n, transientData: C })),
894
+ recordInsertion: (s, { insertAtBeginning: n = !1, transientData: T = void 0 } = {}) => S((F) => F.recordInsertion(s, { insertAtBeginning: n, transientData: T })),
881
895
  recordUpdate: (s) => S((n) => n.recordUpdate(s)),
882
- refreshResource: async (s) => await T(
896
+ refreshResource: async (s) => await L(
883
897
  async (n) => await n.refreshResource(s)
884
898
  ),
885
899
  // Methods: Modifying the collection
886
- deleteResource: async (s) => await T(
900
+ deleteResource: async (s) => await L(
887
901
  async (n) => await n.deleteResource(s)
888
902
  ),
889
- saveResource: async (s) => await T(async (n) => await n.saveResource(s)),
890
- saveResources: async (s) => await T(async (n) => await n.saveResources(s)),
891
- updateResources: async (s) => await T(async (n) => await n.updateResources(s)),
903
+ saveResource: async (s) => await L(async (n) => await n.saveResource(s)),
904
+ saveResources: async (s) => await L(async (n) => await n.saveResources(s)),
905
+ updateResources: async (s) => await L(async (n) => await n.updateResources(s)),
892
906
  // Methods: Transient data
893
907
  clearTransientData: () => S((s) => s.clearTransientData()),
894
908
  setInvalidResourceIds: (s) => S((n) => n.setInvalidResourceIds(s)),
@@ -899,7 +913,7 @@ const Ue = {
899
913
  clearSelection: () => S((s) => s.clearSelection()),
900
914
  deselectResources: (s) => S((n) => n.deselectResources(s)),
901
915
  selectResources: (s, n) => S(
902
- (C) => C.selectResources(s, n)
916
+ (T) => T.selectResources(s, n)
903
917
  ),
904
918
  // Methods: Managing the detail view
905
919
  hideDetail: () => S((s) => s.hideDetail()),
@@ -916,7 +930,7 @@ const Ue = {
916
930
  ie.clearAllStores();
917
931
  };
918
932
  function ne(h, i) {
919
- return a.get(h, (i == null ? void 0 : i.idProperty) || "_id");
933
+ return o.get(h, (i == null ? void 0 : i.idProperty) || "_id");
920
934
  }
921
935
  const De = {
922
936
  idProperty: "_id"
@@ -924,7 +938,7 @@ const De = {
924
938
  resource: null,
925
939
  status: "NotLoaded"
926
940
  }, qe = (h, i) => {
927
- i = a.merge({}, De, i);
941
+ i = o.merge({}, De, i);
928
942
  const g = me(h, {
929
943
  state: () => ({
930
944
  idProperty: i.idProperty,
@@ -956,11 +970,11 @@ const De = {
956
970
  },
957
971
  async setResourceId(e) {
958
972
  const r = this.currentResourceUrl;
959
- this.resourceId = e, !a.isEqual(this.currentResourceUrl, r) && this.status != "NotLoaded" && await this.loadResource();
973
+ this.resourceId = e, !o.isEqual(this.currentResourceUrl, r) && this.status != "NotLoaded" && await this.loadResource();
960
974
  },
961
975
  async setResourceUrl(e) {
962
976
  const r = this.currentResourceUrl;
963
- this.resourceUrl = e, !a.isEqual(this.currentResourceUrl, r) && this.status != "NotLoaded" && await this.loadResource();
977
+ this.resourceUrl = e, !o.isEqual(this.currentResourceUrl, r) && this.status != "NotLoaded" && await this.loadResource();
964
978
  },
965
979
  // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
966
980
  // Actions: Loading and unloading the collection
@@ -992,13 +1006,13 @@ const De = {
992
1006
  const e = H();
993
1007
  if (this._loadId = e, this.currentResourceUrl) {
994
1008
  this.status = "Loading";
995
- const r = this.fixedQueryParams, t = a.cloneDeep(r), l = a.map(
1009
+ const r = this.fixedQueryParams, t = o.cloneDeep(r), l = o.map(
996
1010
  t,
997
1011
  (c, d) => c != null ? `${encodeURIComponent(d)}=${encodeURIComponent(c)}` : null
998
- ).filter((c) => c != null).join("&"), u = a.isEmpty(l) ? this.currentResourceUrl : `${this.currentResourceUrl}?${l}`;
1012
+ ).filter((c) => c != null).join("&"), u = o.isEmpty(l) ? this.currentResourceUrl : `${this.currentResourceUrl}?${l}`;
999
1013
  try {
1000
- const c = await $.get(u), d = this.fixedQueryParams;
1001
- e != this._loadId || !a.isEqual(r, d) ? console.log(`Discarding resource fetched by obsolete query from ${u}.`) : (this.resource = pe.decode(a.get(c, "data", {})), this.status = "Loaded");
1014
+ const c = await x.get(u), d = this.fixedQueryParams;
1015
+ e != this._loadId || !o.isEqual(r, d) ? console.log(`Discarding resource fetched by obsolete query from ${u}.`) : (this.resource = pe.decode(o.get(c, "data", {})), this.status = "Loaded");
1002
1016
  } catch (c) {
1003
1017
  console.log(`Error while loading resource (URL="${u}")`, c), this.reset(), this.status = "Failed";
1004
1018
  }
@@ -1020,9 +1034,9 @@ const De = {
1020
1034
  if (this.currentResourceUrl) {
1021
1035
  let e;
1022
1036
  try {
1023
- e = await $.get(this.currentResourceUrl);
1037
+ e = await x.get(this.currentResourceUrl);
1024
1038
  } catch (r) {
1025
- $.isAxiosError(r) && (e = r.response);
1039
+ x.isAxiosError(r) && (e = r.response);
1026
1040
  }
1027
1041
  return e && e.status == 404 ? (this.recordDeletion(), !0) : !1;
1028
1042
  } else
@@ -1093,7 +1107,7 @@ const De = {
1093
1107
  */
1094
1108
  async deleteResource() {
1095
1109
  if (this.currentResourceUrl)
1096
- (await $.delete(this.currentResourceUrl)).status == 200 && this.recordDeletion();
1110
+ (await x.delete(this.currentResourceUrl)).status == 200 && this.recordDeletion();
1097
1111
  else
1098
1112
  throw "Cannot delete a resource because its URL, or its ID and collection URL, are unknown.";
1099
1113
  },
@@ -1114,7 +1128,7 @@ const De = {
1114
1128
  throw "The REST resource store cannot create new resources on the server.";
1115
1129
  if (!this.currentResourceUrl)
1116
1130
  throw "Cannot save a resource because its URL, or its ID and collection URL, are unknown.";
1117
- const l = await $({
1131
+ const l = await x({
1118
1132
  method: t ? "post" : "put",
1119
1133
  url: this.currentResourceUrl,
1120
1134
  data: e
@@ -1138,7 +1152,7 @@ const De = {
1138
1152
  async updateResource(e) {
1139
1153
  if (!this.currentResourceUrl)
1140
1154
  throw "Cannot save a resource because its URL, or its ID and collection URL, are unknown.";
1141
- const r = await $({
1155
+ const r = await x({
1142
1156
  method: "patch",
1143
1157
  url: this.currentResourceUrl,
1144
1158
  data: e
@@ -1160,7 +1174,7 @@ const De = {
1160
1174
  c = `${this.currentResourceUrl}/${t}`;
1161
1175
  else
1162
1176
  throw "Cannot make a custom API request for a resource because its URL, or its ID and collection URL, are unknown.";
1163
- const d = await $({
1177
+ const d = await x({
1164
1178
  method: r || "get",
1165
1179
  url: c,
1166
1180
  data: u
@@ -1183,131 +1197,131 @@ const De = {
1183
1197
  enabled: U,
1184
1198
  resourceType: e,
1185
1199
  options: r
1186
- } = h, t = I(void 0), l = I(i), u = I(g), c = I(U ?? !0), d = I([se(e)]), m = I(r), w = R(() => u.value), x = I(c.value), A = I(H()), N = R(
1200
+ } = h, t = I(void 0), l = I(i), u = I(g), c = I(U ?? !0), d = I([se(e)]), m = I(r), w = R(() => u.value), P = I(c.value), A = I(H()), N = R(
1187
1201
  () => u.value == null && l.value != null && ce.getStore(l.value) != null
1188
- ), O = I(N.value), k = R(() => S("status", "Uninitialized"));
1189
- function P(o) {
1202
+ ), _ = I(N.value), k = R(() => S("status", "Uninitialized"));
1203
+ function E(a) {
1190
1204
  if (t.value)
1191
- return o(t.value);
1205
+ return a(t.value);
1192
1206
  }
1193
- async function y(o) {
1207
+ async function y(a) {
1194
1208
  if (t.value)
1195
- return await o(t.value);
1209
+ return await a(t.value);
1196
1210
  }
1197
- function S(o, f) {
1211
+ function S(a, f) {
1198
1212
  if (t.value)
1199
- return t.value[o];
1213
+ return t.value[a];
1200
1214
  if (f !== void 0)
1201
1215
  return f;
1202
1216
  throw "Attempted to use a REST resource store that has not been created, with no default value.";
1203
1217
  }
1204
- const T = (o = {}) => {
1218
+ const L = (a = {}) => {
1205
1219
  const {
1206
1220
  resourceClientId: f,
1207
1221
  draftBatchId: b,
1208
1222
  enabled: z,
1209
1223
  resourceType: G,
1210
1224
  options: M
1211
- } = o;
1212
- l.value = f, u.value = b, c.value = z ?? !0, d.value = [se(G)], M != null && (m.value = M), A.value = H(), E(c.value);
1213
- }, E = async (o) => {
1214
- o != x.value && (x.value = o, o && q());
1225
+ } = a;
1226
+ l.value = f, u.value = b, c.value = z ?? !0, d.value = [se(G)], M != null && (m.value = M), A.value = H(), C(c.value);
1227
+ }, C = async (a) => {
1228
+ a != P.value && (P.value = a, a && q());
1215
1229
  }, D = R(
1216
1230
  () => d.value[0].value || void 0
1217
- ), W = function(o) {
1218
- const f = a.get(o, "referencePathsToExpand"), b = D.value ? a.isFunction(f) ? f(D.value) : f || [] : [];
1231
+ ), W = function(a) {
1232
+ const f = o.get(a, "referencePathsToExpand"), b = D.value ? o.isFunction(f) ? f(D.value) : f || [] : [];
1219
1233
  return {
1220
- ...a.cloneDeep(o || {}),
1234
+ ...o.cloneDeep(a || {}),
1221
1235
  referencePathsToExpand: b
1222
1236
  };
1223
1237
  }, re = R(() => W(m.value)), J = R(() => {
1224
1238
  if (!D.value)
1225
1239
  return null;
1226
- if (!O.value)
1240
+ if (!_.value)
1227
1241
  return !D.value || !D.value.collectionName ? null : w.value ? `${V.config.apiBaseUrl}/draft-batches/${w.value}/${D.value.collectionName}` : `${V.config.apiBaseUrl}/${D.value.collectionName}`;
1228
1242
  }), K = R(() => {
1229
1243
  if (D.value && J.value)
1230
- return a.mergeWith(
1231
- a.cloneDeep(De),
1244
+ return o.mergeWith(
1245
+ o.cloneDeep(De),
1232
1246
  re.value,
1233
1247
  {
1234
1248
  idProperty: D.value.idProperty,
1235
1249
  restCollectionUrl: J.value
1236
1250
  },
1237
- (o, f) => {
1238
- if (a.isArray(f) && f.length == 0 && (o == null || a.isArray(o)))
1251
+ (a, f) => {
1252
+ if (o.isArray(f) && f.length == 0 && (a == null || o.isArray(a)))
1239
1253
  return f;
1240
1254
  }
1241
1255
  );
1242
1256
  }), p = I(0), B = R(
1243
1257
  () => {
1244
- var o;
1245
- return p.value, l.value || D.value && ((o = D.value) == null ? void 0 : o.collectionName) && (w.value ? `draftBatches/${w.value}/${D.value.collectionName}/${A.value}` : `${D.value.collectionName}/${A.value}`) || null;
1258
+ var a;
1259
+ return p.value, l.value || D.value && ((a = D.value) == null ? void 0 : a.collectionName) && (w.value ? `draftBatches/${w.value}/${D.value.collectionName}/${A.value}` : `${D.value.collectionName}/${A.value}`) || null;
1246
1260
  }
1247
1261
  ), q = () => {
1248
- if (x.value) {
1249
- let o = !1;
1250
- return D.value && B.value && (t.value = ce.getStore(B.value), t.value ? o = !1 : K.value && (O.value = !1, t.value = qe(B.value, K.value)(), o = !0)), o;
1262
+ if (P.value) {
1263
+ let a = !1;
1264
+ return D.value && B.value && (t.value = ce.getStore(B.value), t.value ? a = !1 : K.value && (_.value = !1, t.value = qe(B.value, K.value)(), a = !0)), a;
1251
1265
  } else
1252
1266
  return !1;
1253
1267
  }, j = () => {
1254
1268
  B.value && l.value == B.value ? (t.value = void 0, q()) : (t.value = void 0, p.value = p.value + 1, q());
1255
1269
  };
1256
- return L(w, (o, f) => {
1257
- a.isEqual(o, f) || j();
1258
- }), L(x, (o, f) => {
1259
- o != f && (o ? q() : t.value = void 0);
1260
- }), L(D, (o, f) => {
1261
- o && !f ? q() : !o && f || a.isEqual(o, f) || j();
1262
- }), L(K, (o, f) => {
1263
- a.isEqual(o, f) || j();
1264
- }), L(N, () => {
1265
- N.value || (O.value = !1);
1266
- }), L(B, () => q()), L(J, (o, f) => {
1267
- a.isEqual(o, f) || j();
1270
+ return $(w, (a, f) => {
1271
+ o.isEqual(a, f) || j();
1272
+ }), $(P, (a, f) => {
1273
+ a != f && (a ? q() : t.value = void 0);
1274
+ }), $(D, (a, f) => {
1275
+ a && !f ? q() : !a && f || o.isEqual(a, f) || j();
1276
+ }), $(K, (a, f) => {
1277
+ o.isEqual(a, f) || j();
1278
+ }), $(N, () => {
1279
+ N.value || (_.value = !1);
1280
+ }), $(B, () => q()), $(J, (a, f) => {
1281
+ o.isEqual(a, f) || j();
1268
1282
  }), q(), {
1269
1283
  // Configuration
1270
1284
  resourceClientId: B,
1271
1285
  draftBatchId: w,
1272
- enabled: x,
1286
+ enabled: P,
1273
1287
  resourceType: D,
1274
1288
  // Status
1275
1289
  status: k,
1276
1290
  // Resources loaded from the REST API
1277
- resource: R(() => k.value != "Uninitialized" ? (y((o) => o.ensureResourceLoaded()), S("resource", [])) : []),
1291
+ resource: R(() => k.value != "Uninitialized" ? (y((a) => a.ensureResourceLoaded()), S("resource", [])) : []),
1278
1292
  resourceId: R(() => S("resourceId", null)),
1279
1293
  resourceUrl: R(() => S("resourceUrl", null)),
1280
1294
  // Methods: Configuration
1281
- reconfigureClient: T,
1282
- setEnabled: E,
1283
- setResourceId: async (o) => await y(async (f) => await f.setResourceId(o)),
1284
- setResourceUrl: async (o) => await y(async (f) => await f.setResourceUrl(o)),
1295
+ reconfigureClient: L,
1296
+ setEnabled: C,
1297
+ setResourceId: async (a) => await y(async (f) => await f.setResourceId(a)),
1298
+ setResourceUrl: async (a) => await y(async (f) => await f.setResourceUrl(a)),
1285
1299
  // Methods: Status
1286
1300
  ensureStore: q,
1287
1301
  // Methods: Resource management
1288
- clear: () => P((o) => o.clear()),
1289
- ensureResourceLoaded: async () => await y(async (o) => o.ensureResourceLoaded()),
1290
- loadResource: async () => await y(async (o) => await o.loadResource()),
1302
+ clear: () => E((a) => a.clear()),
1303
+ ensureResourceLoaded: async () => await y(async (a) => a.ensureResourceLoaded()),
1304
+ loadResource: async () => await y(async (a) => await a.loadResource()),
1291
1305
  // Methods: Recording changes to the resource
1292
- checkForDeletedResource: async () => await y(async (o) => await o.checkForDeletedResource()) == !0,
1293
- recordDeletion: () => y((o) => o.recordDeletion()),
1294
- recordInsertion: (o) => y((f) => f.recordInsertion(o)),
1295
- recordUpdate: (o) => y((f) => f.recordUpdate(o)),
1296
- refreshResource: async () => await y(async (o) => await o.refreshResource()),
1306
+ checkForDeletedResource: async () => await y(async (a) => await a.checkForDeletedResource()) == !0,
1307
+ recordDeletion: () => y((a) => a.recordDeletion()),
1308
+ recordInsertion: (a) => y((f) => f.recordInsertion(a)),
1309
+ recordUpdate: (a) => y((f) => f.recordUpdate(a)),
1310
+ refreshResource: async () => await y(async (a) => await a.refreshResource()),
1297
1311
  // Methods: Modifying the resource
1298
- deleteResource: async () => await y(async (o) => await o.deleteResource()),
1299
- saveResource: async (o) => await y(async (f) => await f.saveResource(o)),
1300
- updateResource: async (o) => await y(async (f) => await f.updateResource(o)),
1312
+ deleteResource: async () => await y(async (a) => await a.deleteResource()),
1313
+ saveResource: async (a) => await y(async (f) => await f.saveResource(a)),
1314
+ updateResource: async (a) => await y(async (f) => await f.updateResource(a)),
1301
1315
  // Methods: Custom API endpoints
1302
- makeCustomApiRequest: async (o) => await y(
1303
- async (f) => await f.makeCustomApiRequest(o)
1316
+ makeCustomApiRequest: async (a) => await y(
1317
+ async (f) => await f.makeCustomApiRequest(a)
1304
1318
  )
1305
1319
  };
1306
1320
  }, V = {
1307
1321
  config: { ...ye }
1308
1322
  };
1309
1323
  function We(h) {
1310
- V.config = a.merge({}, ye, h);
1324
+ V.config = o.merge({}, ye, h);
1311
1325
  }
1312
1326
  export {
1313
1327
  Be as ApiClientError,
@@ -1 +1 @@
1
- (function(p,l){typeof exports=="object"&&typeof module<"u"?l(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"],l):(p=typeof globalThis<"u"?globalThis:p||self,l(p["rest-client-vue"]={},p._,p.uuid,p.Vue,p.axios,p.jsog,p.stringify,p.pinia))})(this,function(p,l,D,o,L,ae,G,ce){"use strict";var Fe=Object.defineProperty;var xe=(p,l,D)=>l in p?Fe(p,l,{enumerable:!0,configurable:!0,writable:!0,value:D}):p[l]=D;var oe=(p,l,D)=>(xe(p,typeof l!="symbol"?l+"":l,D),D),Ne=(p,l,D)=>{if(!l.has(p))throw TypeError("Cannot "+D)};var Q=(p,l,D)=>(Ne(p,l,"read from private field"),D?D.call(p):l.get(p)),Ie=(p,l,D)=>{if(l.has(p))throw TypeError("Cannot add the same private member more than once");l instanceof WeakSet?l.add(p):l.set(p,D)};var A;const ue={apiBaseUrl:"",useVueLogger:!1};class we extends Error{constructor(I,w=void 0,e=void 0){super(I);oe(this,"context");oe(this,"innerError");this.context=w,this.innerError=e}}class de{constructor(){Ie(this,A,{})}clearAllStores(){for(const n in Q(this,A))Q(this,A)[n].clear()}destroyStore(n){Q(this,A)[n]&&(Q(this,A)[n].$dispose(),delete Q(this,A)[n])}getStore(n){return Q(this,A)[n]}registerStore(n,I){Q(this,A)[n]=I}}A=new WeakMap;function R(v,n){return l.get(v,(n==null?void 0:n.idProperty)||"_id")}function Ue(v,n){const I=l.map(n,(w,e)=>w!=null?`${encodeURIComponent(e)}=${encodeURIComponent(w)}`:null).filter(w=>w!=null).join("&");if(I.length>0){const w=v.indexOf("?");return w==v.length-1?`${v}${I}`:w>=0?`${v}&${I}`:`${v}?${I}`}else return v}function De(v,n){var I;return v&&((I=n.filter)!=null&&I.resourceIds)&&!n.order?n.filter.resourceIds.map(w=>v.find(e=>R(e,n)==w)).filter(w=>w!=null):v}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:{}},Ee=(v,n)=>{n=l.merge({},he,n);const I=ce.defineStore(v,{state:()=>({idProperty:n.idProperty,filter:n.filter,order:n.order||null,propertiesToExclude:n.propertiesToExclude||null,referencePathsToExpand:n.referencePathsToExpand||null,restCollectionUrl:n.restCollectionUrl,...K,...ie}),getters:{fixedQueryParams:e=>{var r,d,u,h;const s={};(r=e.filter)!=null&&r.namedFilter&&(s.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};s.q=G(S)}return e.order&&(s.o=G(e.order)),e.propertiesToExclude&&(s.ex=G(e.propertiesToExclude)),e.referencePathsToExpand&&(s.r=G(e.referencePathsToExpand)),s}},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){l.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 s,t;if(!l.isEqual(e,(s=this.filter)==null?void 0:s.query)&&(e!=null||((t=this.filter)==null?void 0:t.query)!=null)){const r=l.cloneDeep(this.filter)||{};e!==null?r.query=e:l.unset(r,"query");const d=this.status;this.setFilter(r),d!="NotLoaded"&&await this.loadResources()}},async setFilterResourceIds(e){if(!l.isEqual(e,l.get(this.filter,"resourceIds"))){const s=l.cloneDeep(this.filter)||{};e!=null?s.resourceIds=e:l.unset(s,"resourceIds");const t=this.status;this.setFilter(s),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 s=D.v4();this._loadId=s,await this._loadResources(0,s,e)},async _loadResources(e,s,t){var q,O,N,k,B;const r=e==0;if(this.status=r?"Loading":"LoadingMore",this._loadOffset=e,((q=this.filter)==null?void 0:q.query)===!1){this.resources=[],this.remoteCollectionSize=0;return}const d=this.fixedQueryParams,u=l.cloneDeep(d),h=r?(O=this.filter)!=null&&O.resourceIds&&!this.order?null:t.firstPageSize||((N=n.loading)==null?void 0:N.firstPageSize)||t.pageSize||((k=n.loading)==null?void 0:k.pageSize)||null:t.pageSize||((B=n.loading)==null?void 0:B.pageSize)||null,S=h!=null||n.limit!=null?l.min(l.filter([h,n.limit],P=>P!=null)):void 0;S!=null?(u.offset=e,u.limit=S):e!=0&&(u.offset=e);const E=Ue(n.restCollectionUrl,u);try{const P=await L.get(E),y=this.fixedQueryParams;if(s!=this._loadId||e!=this._loadOffset||!l.isEqual(d,y))console.log(`Discarding resources fetched by obsolete query from ${n.restCollectionUrl}.`);else{const g=ae.decode(l.get(P,"data.data",[])),$=(r?0:this.resources.length)+g.length,C=S==null||g.length<S||n.limit&&$>=n.limit;console.log(`Loaded ${g.length}${r?"":" more"} resources from ${n.restCollectionUrl}`),r&&(this.resources=[]);const U=[...this.resources,...g.map(H=>Object.freeze(H))];this.resources=De(U,this),l.get(P,"data.totalCollectionSize")?this.remoteCollectionSize=l.get(P,"data.totalCollectionSize"):this.remoteCollectionSize=null,this.status=C?"Loaded":"LoadingMore",C||this._loadResources(this.resources.length,s,t)}}catch(P){console.log(`Error while loading resources (URL="${E}"):`,P),this.clearRetainingTransientData(),this.status="Failed"}},async checkForDeletedResource(e){let s;try{s=await L.get(`${n.restCollectionUrl}/${e}`)}catch(t){L.isAxiosError(t)&&(s=t.response)}return s&&s.status==404?(this.recordDeletion(e),!0):!1},recordDeletion(e){var s;if(["Loaded","LoadingMore"].includes(this.status)){let t=this.resources.findIndex(r=>R(r,this)==e);t>=0&&this.resources.splice(t,1),t=this.selection.findIndex(r=>R(r,this)==e),t>=0&&this.selection.splice(t,1),t=this.detailSelection.findIndex(r=>R(r,this)==e),t>=0&&(this.detailSelection.splice(t,1),this.detailSelection.length==0&&(this.editingDetailSelection=((s=n.detail)==null?void 0:s.autoEdit)||!1)),n.limitTransientDataToLocalCollection&&delete this.transientData[e]}},recordInsertion(e,{insertAtBeginning:s,transientData:t}={}){var r;if(["Loaded","LoadingMore"].includes(this.status)){const d=Object.freeze(e);s?this.resources.unshift(d):this.resources.push(d),(r=n.detail)!=null&&r.autoFromSingleInsertion&&(this.detailSelection.length==0||this.detailSelection.length==1&&R(this.detailSelection[0],this)==null)&&(this.detailSelection=[d],this.editingDetailSelection=n.detail.autoEdit);const u=R(e,this);u&&(t===void 0?delete this.transientData[u]:this.transientData[u]=t)}},recordUpdate(e){const s=R(e,this);if(s&&["Loaded","LoadingMore"].includes(this.status)){const t=Object.freeze(e);let r=this.resources.findIndex(d=>R(d,this)==s);r>=0&&(this.resources[r]=t),r=this.selection.findIndex(d=>R(d,this)==s),r>=0&&(this.selection[r]=t),r=this.detailSelection.findIndex(d=>R(d,this)==s),r>=0&&(this.detailSelection[r]=t)}},async refreshResource(e){if(e){const s={};this.referencePathsToExpand&&(s.r=G(this.referencePathsToExpand));const t=l.map(s,(u,h)=>u!=null?`${encodeURIComponent(h)}=${encodeURIComponent(u)}`:null).filter(u=>u!=null).join("&"),r=l.isEmpty(t)?`${n.restCollectionUrl}/${e}`:`${n.restCollectionUrl}/${e}?${t}`,d=await L.get(r);if(d.status==200){const u=d.data;return this.recordUpdate(u),u}}return null},addResource(e={}){this.detailSelection=[l.omit(l.merge({},e),this.idProperty)],this.editingDetailSelection=!0},async deleteResource(e){if((await L.delete(`${n.restCollectionUrl}/${e}`)).status==200&&["Loaded","LoadingMore"].includes(this.status)){let t=this.resources.findIndex(r=>R(r,this)==e);t>=0&&this.resources.splice(t,1),t=this.selection.findIndex(r=>R(r,this)==e),t>=0&&this.selection.splice(t,1),t=this.detailSelection.findIndex(r=>R(r,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 s=R(e,this),t=s==null,r=await L({method:t?"post":"put",url:t?n.restCollectionUrl:`${n.restCollectionUrl}/${s}`,data:e});if(r.status==200){const d=r.data,u=R(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 s=await L({method:"put",url:n.restCollectionUrl,data:e});if(s.status==200){const t=s.data||[],r=[];for(const[d,u]of t.entries()){const h=R(e[d],this)==null,S=R(u,this),E=S?await this.refreshResource(S):null;h&&this.recordInsertion(E||u),r.push(E||Object.freeze(u))}return r}return[]},async updateResources(e){const s=await L({method:"patch",url:`${n.restCollectionUrl}`,data:e});if(s.status==200){const t=s.data||[],r=[];for(const d of t){const u=R(d,this),h=u?await this.refreshResource(u):null;r.push(h||Object.freeze(d))}return r}return[]},clearTransientData(){this.transientData={}},setInvalidResourceIds(e){l.isEqual(e,this.invalidResources.map(s=>R(s,this)))||(this.invalidResources=e.map(s=>this.resources.find(t=>R(t,this)==s)).filter(s=>s!=null))},setTransientDataForResources(e){const{transientData:s,merge:t=!0}=e;t?l.merge(this.transientData,s):l.assign(this.transientData,s)},clearSelection(){this.setSelection([])},deselectResources(e){const s=this.selection.map(t=>R(t,this)).filter(t=>t!=null&&!e.includes(t));this.setSelection(s)},selectResources(e,s){const{addToSelection:t,edit:r}=s||{},d=this.selection.map(h=>R(h,this));let u=e;if(t){const h=l.difference(e,d);h.length>0&&(u=d.concat(h).filter(S=>S!=null))}l.isEqual(d,u)||this.setSelection(u,r)},setSelection(e,s){if(!l.isEqual(e,this.selection.map(t=>R(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 r=this.selection.map(h=>R(h,this)),u=this.detailSelection.map(h=>R(h,this)).filter(h=>r.includes(h));this.detailSelection.filter(h=>!u.includes(R(h,this))).length>0&&(t=!1)}}if(!t)return;if(this.selection=e.map(r=>this.resources.find(d=>R(d,this)==r)).filter(r=>r!=null),n.detail.autoFromSingleSelection&&this.selection.length==1){const r=this.selection[0];(this.detailSelection.length!=1||R(this.detailSelection[0],this)!=R(r,this))&&(this.detailSelection=[r])}else if(n.detail.autoFromMultipleSelection&&n.detail.allowMultiple&&this.selection.length>1)l.isEqual(this.selection.map(r=>R(r,this)),this.detailSelection.map(r=>R(r,this)))||(this.detailSelection=l.clone(this.selection));else if(n.detail.constrainToSelection){const r=this.selection.map(h=>R(h,this)),d=this.detailSelection.map(h=>R(h,this)),u=d.filter(h=>r.includes(h));l.isEqual(u,d)||(this.detailSelection=this.detailSelection.filter(h=>u.includes(R(h,this))))}this.detailSelection.length==0?this.editingDetailSelection=!1:this.editingDetailSelection=s!==void 0?s: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 s=this.selection.map(r=>R(r,this)),t=this.detailSelection.map(r=>R(r,this));l.isEqual(s,t)||(this.detailSelection=l.clone(this.selection)),this.detailSelection.length==0?this.editingDetailSelection=!1:this.editingDetailSelection=e!==void 0?e:this.editingDetailSelection||n.detail.autoEdit}},deregisterEditor(e){l.remove(this.editors,s=>s==e)},registerEditor(e){this.editors.includes(e)||this.editors.push(e)},deregisterListNavigator({name:e,listNavigator:s}){(s==null||this.listNavigators[e]==s)&&delete this.listNavigators[e]},registerListNavigator({name:e,listNavigator:s}){this.listNavigators[e]!=s&&(this.listNavigators[e]=s)}}});return(()=>{const e=(s,t)=>{const r=I(s,t);return _.registerStore(r.$id,r),r};return e.$id=I.$id,e})()},_=new de,Ce=(v={})=>{var Re,pe,ge,ve;const{collectionId:n,draftBatchId:I,enabled:w,resourceType:e,options:s}=v,t=o.ref(void 0),r=o.ref(n),d=o.ref(I),u=o.ref(w??!0),h=o.ref([o.toRef(e)]),S=o.ref(s),E=o.computed(()=>d.value),q=o.ref(u.value),O=o.ref(D.v4()),N=o.ref((pe=(Re=S.value)==null?void 0:Re.filter)==null?void 0:pe.resourceIds),k=o.ref((ve=(ge=S.value)==null?void 0:ge.filter)==null?void 0:ve.query),B=o.computed(()=>d.value==null&&r.value!=null&&_.getStore(r.value)!=null),P=o.ref(B.value),y=o.computed(()=>C("status","Uninitialized"));function g(i){if(t.value)return i(t.value)}async function $(i){if(t.value)return await i(t.value)}function C(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 U=(i={})=>{var te,me,Se,ye;const{collectionId:c,draftBatchId:T,enabled:x,resourceType:ne,options:ee}=i;r.value=c,d.value=T,u.value=x??!0,h.value=[o.toRef(ne)],ee!=null&&(S.value=ee,N.value=(me=(te=S.value)==null?void 0:te.filter)==null?void 0:me.resourceIds,k.value=(ye=(Se=S.value)==null?void 0:Se.filter)==null?void 0:ye.query),O.value=D.v4(),H(u.value)},H=async i=>{i!=q.value&&(q.value=i,i&&(V(),b()))},le=async i=>{N.value=i,await $(async c=>await c.setFilterResourceIds(N.value||null))},Z=async i=>{if(k.value=i,y.value!="Uninitialized"){const c=i,T=o.computed(()=>l.isFunction(c)?m.value?c(m.value):null:c);await $(x=>x.setQuery(T.value||null))}},V=()=>{S.value=l.merge({},S.value||{},{filter:{resourceIds:N.value,query:k.value}})},m=o.computed(()=>h.value[0].value||void 0),j=function(i){const c=l.get(i,"filter.query"),T=l.get(i,"propertiesToExclude"),x=l.get(i,"referencePathsToExpand"),ne=l.isFunction(c)?c(m.value):c,ee=m.value?l.isFunction(T)?T(m.value):T||[]:[],te=m.value?l.isFunction(x)?x(m.value):x||[]:[];return{...l.cloneDeep(i||{}),filter:{...l.cloneDeep((i==null?void 0:i.filter)||{}),query:ne},propertiesToExclude:ee,referencePathsToExpand:te}},F=o.computed(()=>j(S.value)),M=o.computed(()=>{if(F.value.restCollectionUrl!==void 0)return F.value.restCollectionUrl;if(!P.value)return!m.value||!m.value.collectionName?null:E.value?`${X.config.apiBaseUrl}/draft-batches/${E.value}/${m.value.collectionName}`:`${X.config.apiBaseUrl}/${m.value.collectionName}`}),a=o.computed(()=>{var i;if(m.value)return l.mergeWith(l.cloneDeep(he),F.value,{idProperty:(i=m.value)==null?void 0:i.idProperty,restCollectionUrl:M.value||""},(c,T)=>{if(l.isArray(T)&&T.length==0&&(c==null||l.isArray(c)))return T})}),f=o.ref(0),z=o.computed(()=>{var i;return f.value,r.value||m.value&&((i=m.value)==null?void 0:i.collectionName)&&(E.value?`draftBatches/${E.value}/${m.value.collectionName}/${O.value}`:`${m.value.collectionName}/${O.value}`)||null}),b=()=>{if(q.value){let i=!1;return m.value&&z.value&&(t.value=_.getStore(z.value),t.value?i=!1:a.value&&(P.value=!1,t.value=Ee(z.value,a.value)(),i=!0)),i}else return!1},J=()=>{z.value&&r.value==z.value?(t.value=void 0,b()):(t.value=void 0,f.value=f.value+1,b())};o.watch(E,(i,c)=>{l.isEqual(i,c)||J()}),o.watch(q,(i,c)=>{i!=c&&(i?b():t.value=void 0)}),o.watch(m,(i,c)=>{i&&!c?b():!i&&c||l.isEqual(i,c)||J()}),o.watch(a,(i,c)=>{l.isEqual(i,c)||J()}),o.watch(B,()=>{B.value||(P.value=!1)}),o.watch(z,()=>b()),o.watch(M,(i,c)=>{l.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=l.clone(W);W.splice(0,W.length);for(const x of T)x()}}),b(),{collectionId:z,draftBatchId:E,resourceType:m,restCollectionUrl:o.computed(()=>C("restCollectionUrl",null)),enabled:q,status:y,batchSaveAttempted:o.computed(()=>C("batchSaveAttempted",!1)),listNavigators:o.computed(()=>C("listNavigators",!1)),invalidResources:o.computed(()=>C("invalidResources",[])),resources:o.computed(()=>y.value!="Uninitialized"?($(i=>i.ensureCollectionLoaded()),C("resources",[])):[]),remoteCollectionSize:o.computed(()=>C("remoteCollectionSize",null)),transientData:o.computed(()=>C("transientData",[])),detailSelection:o.computed(()=>C("detailSelection",[])),editingDetailSelection:o.computed(()=>C("editingDetailSelection",!1)),selection:o.computed(()=>C("selection",[])),reconfigureCollection:U,setEditingDetailSelection:i=>g(c=>c.setEditingDetailSelection(i)),setEnabled:H,setFilterResourceIds:le,setQuery:Z,ensureStore:b,setBatchSaveAttempted:i=>g(c=>c.setBatchSaveAttempted(i)),clear:()=>g(i=>i.clear()),ensureCollectionLoaded:async()=>await $(async i=>i.ensureCollectionLoaded()),loadResources:async()=>await $(async i=>await i.loadResources()),addResource:i=>g(c=>c.addResource(i)),checkForDeletedResource:async i=>await $(async c=>await c.checkForDeletedResource(i))==!0,recordDeletion:i=>g(c=>c.recordDeletion(i)),recordInsertion:(i,{insertAtBeginning:c=!1,transientData:T=void 0}={})=>g(x=>x.recordInsertion(i,{insertAtBeginning:c,transientData:T})),recordUpdate:i=>g(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)),updateResources:async i=>await $(async c=>await c.updateResources(i)),clearTransientData:()=>g(i=>i.clearTransientData()),setInvalidResourceIds:i=>g(c=>c.setInvalidResourceIds(i)),setTransientDataForResources:i=>g(c=>c.setTransientDataForResources(i)),clearSelection:()=>g(i=>i.clearSelection()),deselectResources:i=>g(c=>c.deselectResources(i)),selectResources:(i,c)=>g(T=>T.selectResources(i,c)),hideDetail:()=>g(i=>i.hideDetail()),deregisterEditor:i=>g(c=>c.deregisterEditor(i)),registerEditor:i=>g(c=>c.registerEditor(i)),deregisterListNavigator:i=>g(c=>c.deregisterListNavigator(i)),registerListNavigator:i=>g(c=>c.registerListNavigator(i)),onItemsStoreReady:Pe}},Te=()=>{_.clearAllStores()};function se(v,n){return l.get(v,(n==null?void 0:n.idProperty)||"_id")}const fe={idProperty:"_id"},Y={resource:null,status:"NotLoaded"},Le=(v,n)=>{n=l.merge({},fe,n);const I=ce.defineStore(v,{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 s={};return e.referencePathsToExpand&&(s.r=G(e.referencePathsToExpand)),s}},actions:{reset(){for(const e in Y)this[e]=Y[e]},async setResourceId(e){const s=this.currentResourceUrl;this.resourceId=e,!l.isEqual(this.currentResourceUrl,s)&&this.status!="NotLoaded"&&await this.loadResource()},async setResourceUrl(e){const s=this.currentResourceUrl;this.resourceUrl=e,!l.isEqual(this.currentResourceUrl,s)&&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 s=this.fixedQueryParams,t=l.cloneDeep(s),r=l.map(t,(u,h)=>u!=null?`${encodeURIComponent(h)}=${encodeURIComponent(u)}`:null).filter(u=>u!=null).join("&"),d=l.isEmpty(r)?this.currentResourceUrl:`${this.currentResourceUrl}?${r}`;try{const u=await L.get(d),h=this.fixedQueryParams;e!=this._loadId||!l.isEqual(s,h)?console.log(`Discarding resource fetched by obsolete query from ${d}.`):(this.resource=ae.decode(l.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 L.get(this.currentResourceUrl)}catch(s){L.isAxiosError(s)&&(e=s.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 L.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 s=se(e,this),t=s==null;if(!s)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 r=await L({method:t?"post":"put",url:this.currentResourceUrl,data:e});if(r.status==200){const d=r.data,u=await this.refreshResource();return t&&this.recordInsertion(u||d),u||Object.freeze(d)}return null},async updateResource(e){if(!this.currentResourceUrl)throw"Cannot save a resource because its URL, or its ID and collection URL, are unknown.";const s=await L({method:"patch",url:this.currentResourceUrl,data:e});if(s.status==200){const t=s.data;return await this.refreshResource()||Object.freeze(t)}return null},async makeCustomApiRequest(e){const{method:s,subpath:t,url:r,data:d}=e;let u=r;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 L({method:s||"get",url:u,data:d});return h.status>=200&&h.status<300?h.data:null}}});return(()=>{const e=(s,t)=>{const r=I(s,t);return re.registerStore(r.$id,r),r};return e.$id=I.$id,e})()},re=new de,$e=(v={})=>{const{resourceClientId:n,draftBatchId:I,enabled:w,resourceType:e,options:s}=v,t=o.ref(void 0),r=o.ref(n),d=o.ref(I),u=o.ref(w??!0),h=o.ref([o.toRef(e)]),S=o.ref(s),E=o.computed(()=>d.value),q=o.ref(u.value),O=o.ref(D.v4()),N=o.computed(()=>d.value==null&&r.value!=null&&re.getStore(r.value)!=null),k=o.ref(N.value),B=o.computed(()=>g("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 g(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:b,resourceType:J,options:W}=a;r.value=f,d.value=z,u.value=b??!0,h.value=[o.toRef(J)],W!=null&&(S.value=W),O.value=D.v4(),C(u.value)},C=async a=>{a!=q.value&&(q.value=a,a&&F())},U=o.computed(()=>h.value[0].value||void 0),H=function(a){const f=l.get(a,"referencePathsToExpand"),z=U.value?l.isFunction(f)?f(U.value):f||[]:[];return{...l.cloneDeep(a||{}),referencePathsToExpand:z}},le=o.computed(()=>H(S.value)),Z=o.computed(()=>{if(!U.value)return null;if(!k.value)return!U.value||!U.value.collectionName?null:E.value?`${X.config.apiBaseUrl}/draft-batches/${E.value}/${U.value.collectionName}`:`${X.config.apiBaseUrl}/${U.value.collectionName}`}),V=o.computed(()=>{if(U.value&&Z.value)return l.mergeWith(l.cloneDeep(fe),le.value,{idProperty:U.value.idProperty,restCollectionUrl:Z.value},(a,f)=>{if(l.isArray(f)&&f.length==0&&(a==null||l.isArray(a)))return f})}),m=o.ref(0),j=o.computed(()=>{var a;return m.value,r.value||U.value&&((a=U.value)==null?void 0:a.collectionName)&&(E.value?`draftBatches/${E.value}/${U.value.collectionName}/${O.value}`:`${U.value.collectionName}/${O.value}`)||null}),F=()=>{if(q.value){let a=!1;return U.value&&j.value&&(t.value=re.getStore(j.value),t.value?a=!1:V.value&&(k.value=!1,t.value=Le(j.value,V.value)(),a=!0)),a}else return!1},M=()=>{j.value&&r.value==j.value?(t.value=void 0,F()):(t.value=void 0,m.value=m.value+1,F())};return o.watch(E,(a,f)=>{l.isEqual(a,f)||M()}),o.watch(q,(a,f)=>{a!=f&&(a?F():t.value=void 0)}),o.watch(U,(a,f)=>{a&&!f?F():!a&&f||l.isEqual(a,f)||M()}),o.watch(V,(a,f)=>{l.isEqual(a,f)||M()}),o.watch(N,()=>{N.value||(k.value=!1)}),o.watch(j,()=>F()),o.watch(Z,(a,f)=>{l.isEqual(a,f)||M()}),F(),{resourceClientId:j,draftBatchId:E,enabled:q,resourceType:U,status:B,resource:o.computed(()=>B.value!="Uninitialized"?(y(a=>a.ensureResourceLoaded()),g("resource",[])):[]),resourceId:o.computed(()=>g("resourceId",null)),resourceUrl:o.computed(()=>g("resourceUrl",null)),reconfigureClient:$,setEnabled:C,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)),updateResource:async a=>await y(async f=>await f.updateResource(a)),makeCustomApiRequest:async a=>await y(async f=>await f.makeCustomApiRequest(a))}},X={config:{...ue}};function qe(v){X.config=l.merge({},ue,v)}p.ApiClientError=we,p.clearAllRestCollections=Te,p.initRestClient=qe,p.restClient=X,p.useRestCollection=Ce,p.useRestResource=$e,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
1
+ (function(g,r){typeof exports=="object"&&typeof module<"u"?r(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"],r):(g=typeof globalThis<"u"?globalThis:g||self,r(g["rest-client-vue"]={},g._,g.uuid,g.Vue,g.axios,g.jsog,g.stringify,g.pinia))})(this,function(g,r,D,n,$,ae,G,ce){"use strict";var Fe=Object.defineProperty;var xe=(g,r,D)=>r in g?Fe(g,r,{enumerable:!0,configurable:!0,writable:!0,value:D}):g[r]=D;var ne=(g,r,D)=>(xe(g,typeof r!="symbol"?r+"":r,D),D),Ne=(g,r,D)=>{if(!r.has(g))throw TypeError("Cannot "+D)};var Q=(g,r,D)=>(Ne(g,r,"read from private field"),D?D.call(g):r.get(g)),Ie=(g,r,D)=>{if(r.has(g))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(g):r.set(g,D)};var A;const ue={apiBaseUrl:"",useVueLogger:!1};class we extends Error{constructor(I,w=void 0,e=void 0){super(I);ne(this,"context");ne(this,"innerError");this.context=w,this.innerError=e}}class de{constructor(){Ie(this,A,{})}clearAllStores(){for(const o in Q(this,A))Q(this,A)[o].clear()}destroyStore(o){Q(this,A)[o]&&(Q(this,A)[o].$dispose(),delete Q(this,A)[o])}getStore(o){return Q(this,A)[o]}registerStore(o,I){Q(this,A)[o]=I}}A=new WeakMap;function R(v,o){return r.get(v,(o==null?void 0:o.idProperty)||"_id")}function Ue(v,o){const I=r.map(o,(w,e)=>w!=null?`${encodeURIComponent(e)}=${encodeURIComponent(w)}`:null).filter(w=>w!=null).join("&");if(I.length>0){const w=v.indexOf("?");return w==v.length-1?`${v}${I}`:w>=0?`${v}&${I}`:`${v}?${I}`}else return v}function De(v,o){var I;return v&&((I=o.filter)!=null&&I.resourceIds)&&!o.order?o.filter.resourceIds.map(w=>v.find(e=>R(e,o)==w)).filter(w=>w!=null):v}const he={detail:{allowMultiple:!0,autoEdit:!1,autoFromMultipleSelection:!0,autoFromSingleInsertion:!0,autoFromSingleSelection:!0,constrainToSelection:!0},filter:{namedFilter:null,query:null,resourceIds:null},hooks:{beforeLoadResources: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:{},_isBeforeLoad:!0},se={editingDetailSelection:!1,batchSaveAttempted:!1,editors:[],listNavigators:{}},Ee=(v,o)=>{o=r.merge({},he,o);const I=ce.defineStore(v,{state:()=>({idProperty:o.idProperty,filter:o.filter,order:o.order||null,propertiesToExclude:o.propertiesToExclude||null,referencePathsToExpand:o.referencePathsToExpand||null,restCollectionUrl:o.restCollectionUrl,...K,...se}),getters:{fixedQueryParams:e=>{var l,d,u,h;const i={};(l=e.filter)!=null&&l.namedFilter&&(i.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};i.q=G(S)}return e.order&&(i.o=G(e.order)),e.propertiesToExclude&&(i.ex=G(e.propertiesToExclude)),e.referencePathsToExpand&&(i.r=G(e.referencePathsToExpand)),i}},actions:{reset(){for(const e in K)this[e]=K[e];for(const e in se)this[e]=se[e]},resetRetainingTransientData(){if(o.limitTransientDataToLocalCollection)this.reset();else{const e=this.transientData;this.reset(),this.transientData=e}},setEditingDetailSelection(e){this.editingDetailSelection=e},setFilter(e){r.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 i,t;if(!r.isEqual(e,(i=this.filter)==null?void 0:i.query)&&(e!=null||((t=this.filter)==null?void 0:t.query)!=null)){const l=r.cloneDeep(this.filter)||{};e!==null?l.query=e:r.unset(l,"query");const d=this.status;this.setFilter(l),d!="NotLoaded"&&await this.loadResources()}},async setFilterResourceIds(e){if(!r.isEqual(e,r.get(this.filter,"resourceIds"))){const i=r.cloneDeep(this.filter)||{};e!=null?i.resourceIds=e:r.unset(i,"resourceIds");const t=this.status;this.setFilter(i),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(o.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 i=D.v4();this._loadId=i,await this._loadResources(0,i,e)},async _loadResources(e,i,t){var P,O,N,k,B;const l=e==0;if(this.status=l?"Loading":"LoadingMore",this._isBeforeLoad&&o.hooks.beforeLoadResources){const C=o.hooks.beforeLoadResources();if(r.isArray(C)){this.resources=C,this.status="Loaded";return}else if(C===!1){this.status="Failed";return}}if(this._isBeforeLoad=!1,this._loadOffset=e,((P=this.filter)==null?void 0:P.query)===!1){this.resources=[],this.remoteCollectionSize=0;return}const d=this.fixedQueryParams,u=r.cloneDeep(d),h=l?(O=this.filter)!=null&&O.resourceIds&&!this.order?null:t.firstPageSize||((N=o.loading)==null?void 0:N.firstPageSize)||t.pageSize||((k=o.loading)==null?void 0:k.pageSize)||null:t.pageSize||((B=o.loading)==null?void 0:B.pageSize)||null,S=h!=null||o.limit!=null?r.min(r.filter([h,o.limit],C=>C!=null)):void 0;S!=null?(u.offset=e,u.limit=S):e!=0&&(u.offset=e);const E=Ue(o.restCollectionUrl,u);try{const C=await $.get(E),y=this.fixedQueryParams;if(i!=this._loadId||e!=this._loadOffset||!r.isEqual(d,y))console.log(`Discarding resources fetched by obsolete query from ${o.restCollectionUrl}.`);else{const p=ae.decode(r.get(C,"data.data",[])),q=(l?0:this.resources.length)+p.length,T=S==null||p.length<S||o.limit&&q>=o.limit;console.log(`Loaded ${p.length}${l?"":" more"} resources from ${o.restCollectionUrl}`),l&&(this.resources=[]);const U=[...this.resources,...p.map(H=>Object.freeze(H))];this.resources=De(U,this),r.get(C,"data.totalCollectionSize")?this.remoteCollectionSize=r.get(C,"data.totalCollectionSize"):this.remoteCollectionSize=null,this.status=T?"Loaded":"LoadingMore",T||this._loadResources(this.resources.length,i,t)}}catch(C){console.log(`Error while loading resources (URL="${E}"):`,C),this.clearRetainingTransientData(),this.status="Failed"}},async checkForDeletedResource(e){let i;try{i=await $.get(`${o.restCollectionUrl}/${e}`)}catch(t){$.isAxiosError(t)&&(i=t.response)}return i&&i.status==404?(this.recordDeletion(e),!0):!1},recordDeletion(e){var i;if(["Loaded","LoadingMore"].includes(this.status)){let t=this.resources.findIndex(l=>R(l,this)==e);t>=0&&this.resources.splice(t,1),t=this.selection.findIndex(l=>R(l,this)==e),t>=0&&this.selection.splice(t,1),t=this.detailSelection.findIndex(l=>R(l,this)==e),t>=0&&(this.detailSelection.splice(t,1),this.detailSelection.length==0&&(this.editingDetailSelection=((i=o.detail)==null?void 0:i.autoEdit)||!1)),o.limitTransientDataToLocalCollection&&delete this.transientData[e]}},recordInsertion(e,{insertAtBeginning:i,transientData:t}={}){var l;if(["Loaded","LoadingMore"].includes(this.status)){const d=Object.freeze(e);i?this.resources.unshift(d):this.resources.push(d),(l=o.detail)!=null&&l.autoFromSingleInsertion&&(this.detailSelection.length==0||this.detailSelection.length==1&&R(this.detailSelection[0],this)==null)&&(this.detailSelection=[d],this.editingDetailSelection=o.detail.autoEdit);const u=R(e,this);u&&(t===void 0?delete this.transientData[u]:this.transientData[u]=t)}},recordUpdate(e){const i=R(e,this);if(i&&["Loaded","LoadingMore"].includes(this.status)){const t=Object.freeze(e);let l=this.resources.findIndex(d=>R(d,this)==i);l>=0&&(this.resources[l]=t),l=this.selection.findIndex(d=>R(d,this)==i),l>=0&&(this.selection[l]=t),l=this.detailSelection.findIndex(d=>R(d,this)==i),l>=0&&(this.detailSelection[l]=t)}},async refreshResource(e){if(e){const i={};this.referencePathsToExpand&&(i.r=G(this.referencePathsToExpand));const t=r.map(i,(u,h)=>u!=null?`${encodeURIComponent(h)}=${encodeURIComponent(u)}`:null).filter(u=>u!=null).join("&"),l=r.isEmpty(t)?`${o.restCollectionUrl}/${e}`:`${o.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=[r.omit(r.merge({},e),this.idProperty)],this.editingDetailSelection=!0},async deleteResource(e){if((await $.delete(`${o.restCollectionUrl}/${e}`)).status==200&&["Loaded","LoadingMore"].includes(this.status)){let t=this.resources.findIndex(l=>R(l,this)==e);t>=0&&this.resources.splice(t,1),t=this.selection.findIndex(l=>R(l,this)==e),t>=0&&this.selection.splice(t,1),t=this.detailSelection.findIndex(l=>R(l,this)==e),t>=0&&(this.detailSelection.splice(t,1),this.detailSelection.length==0&&(this.editingDetailSelection=o.detail.autoEdit)),o.limitTransientDataToLocalCollection&&delete this.transientData[e]}},async saveResource(e){const i=R(e,this),t=i==null,l=await $({method:t?"post":"put",url:t?o.restCollectionUrl:`${o.restCollectionUrl}/${i}`,data:e});if(l.status==200){const d=l.data,u=R(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 i=await $({method:"put",url:o.restCollectionUrl,data:e});if(i.status==200){const t=i.data||[],l=[];for(const[d,u]of t.entries()){const h=R(e[d],this)==null,S=R(u,this),E=S?await this.refreshResource(S):null;h&&this.recordInsertion(E||u),l.push(E||Object.freeze(u))}return l}return[]},async updateResources(e){const i=await $({method:"patch",url:o.restCollectionUrl,data:e});if(i.status==200){const t=i.data||[],l=[];for(const d of t){const u=R(d,this),h=u?await this.refreshResource(u):null;l.push(h||Object.freeze(d))}return l}return[]},clearTransientData(){this.transientData={}},setInvalidResourceIds(e){r.isEqual(e,this.invalidResources.map(i=>R(i,this)))||(this.invalidResources=e.map(i=>this.resources.find(t=>R(t,this)==i)).filter(i=>i!=null))},setTransientDataForResources(e){const{transientData:i,merge:t=!0}=e;t?r.merge(this.transientData,i):r.assign(this.transientData,i)},clearSelection(){this.setSelection([])},deselectResources(e){const i=this.selection.map(t=>R(t,this)).filter(t=>t!=null&&!e.includes(t));this.setSelection(i)},selectResources(e,i){const{addToSelection:t,edit:l}=i||{},d=this.selection.map(h=>R(h,this));let u=e;if(t){const h=r.difference(e,d);h.length>0&&(u=d.concat(h).filter(S=>S!=null))}r.isEqual(d,u)||this.setSelection(u,l)},setSelection(e,i){if(!r.isEqual(e,this.selection.map(t=>R(t,this)))){let t=!0;if(this.editors.length>0){if(o.detail.autoFromSingleSelection&&this.selection.length==1)t=!1;else if(o.detail.autoFromMultipleSelection&&o.detail.allowMultiple&&this.selection.length>1)t=!1;else if(o.detail.constrainToSelection){const l=this.selection.map(h=>R(h,this)),u=this.detailSelection.map(h=>R(h,this)).filter(h=>l.includes(h));this.detailSelection.filter(h=>!u.includes(R(h,this))).length>0&&(t=!1)}}if(!t)return;if(this.selection=e.map(l=>this.resources.find(d=>R(d,this)==l)).filter(l=>l!=null),o.detail.autoFromSingleSelection&&this.selection.length==1){const l=this.selection[0];(this.detailSelection.length!=1||R(this.detailSelection[0],this)!=R(l,this))&&(this.detailSelection=[l])}else if(o.detail.autoFromMultipleSelection&&o.detail.allowMultiple&&this.selection.length>1)r.isEqual(this.selection.map(l=>R(l,this)),this.detailSelection.map(l=>R(l,this)))||(this.detailSelection=r.clone(this.selection));else if(o.detail.constrainToSelection){const l=this.selection.map(h=>R(h,this)),d=this.detailSelection.map(h=>R(h,this)),u=d.filter(h=>l.includes(h));r.isEqual(u,d)||(this.detailSelection=this.detailSelection.filter(h=>u.includes(R(h,this))))}this.detailSelection.length==0?this.editingDetailSelection=!1:this.editingDetailSelection=i!==void 0?i:this.editingDetailSelection||o.detail.autoEdit}},hideDetail(){this.detailSelection.length>0&&(this.detailSelection=[],this.editingDetailSelection=!1)},showSelectionAsDetail(e){if(this.selection.length<=1||o.detail.allowMultiple){const i=this.selection.map(l=>R(l,this)),t=this.detailSelection.map(l=>R(l,this));r.isEqual(i,t)||(this.detailSelection=r.clone(this.selection)),this.detailSelection.length==0?this.editingDetailSelection=!1:this.editingDetailSelection=e!==void 0?e:this.editingDetailSelection||o.detail.autoEdit}},deregisterEditor(e){r.remove(this.editors,i=>i==e)},registerEditor(e){this.editors.includes(e)||this.editors.push(e)},deregisterListNavigator({name:e,listNavigator:i}){(i==null||this.listNavigators[e]==i)&&delete this.listNavigators[e]},registerListNavigator({name:e,listNavigator:i}){this.listNavigators[e]!=i&&(this.listNavigators[e]=i)}}});return(()=>{const e=(i,t)=>{const l=I(i,t);return _.registerStore(l.$id,l),l};return e.$id=I.$id,e})()},_=new de,Ce=(v={})=>{var Re,ge,pe,ve;const{collectionId:o,draftBatchId:I,enabled:w,resourceType:e,options:i}=v,t=n.ref(void 0),l=n.ref(o),d=n.ref(I),u=n.ref(w??!0),h=n.ref([n.toRef(e)]),S=n.ref(i),E=n.computed(()=>d.value),P=n.ref(u.value),O=n.ref(D.v4()),N=n.ref((ge=(Re=S.value)==null?void 0:Re.filter)==null?void 0:ge.resourceIds),k=n.ref((ve=(pe=S.value)==null?void 0:pe.filter)==null?void 0:ve.query),B=n.computed(()=>d.value==null&&l.value!=null&&_.getStore(l.value)!=null),C=n.ref(B.value),y=n.computed(()=>T("status","Uninitialized"));function p(s){if(t.value)return s(t.value)}async function q(s){if(t.value)return await s(t.value)}function T(s,c){if(t.value)return t.value[s];if(c!==void 0)return c;throw"Attempted to use a REST collection store that has not been created, with no default value."}const U=(s={})=>{var te,me,Se,ye;const{collectionId:c,draftBatchId:L,enabled:x,resourceType:oe,options:ee}=s;l.value=c,d.value=L,u.value=x??!0,h.value=[n.toRef(oe)],ee!=null&&(S.value=ee,N.value=(me=(te=S.value)==null?void 0:te.filter)==null?void 0:me.resourceIds,k.value=(ye=(Se=S.value)==null?void 0:Se.filter)==null?void 0:ye.query),O.value=D.v4(),H(u.value)},H=async s=>{s!=P.value&&(P.value=s,s&&(V(),z()))},le=async s=>{N.value=s,await q(async c=>await c.setFilterResourceIds(N.value||null))},Z=async s=>{if(k.value=s,y.value!="Uninitialized"){const c=s,L=n.computed(()=>r.isFunction(c)?m.value?c(m.value):null:c);await q(x=>x.setQuery(L.value||null))}},V=()=>{S.value=r.merge({},S.value||{},{filter:{resourceIds:N.value,query:k.value}})},m=n.computed(()=>h.value[0].value||void 0),j=function(s){const c=r.get(s,"filter.query"),L=r.get(s,"propertiesToExclude"),x=r.get(s,"referencePathsToExpand"),oe=r.isFunction(c)?c(m.value):c,ee=m.value?r.isFunction(L)?L(m.value):L||[]:[],te=m.value?r.isFunction(x)?x(m.value):x||[]:[];return{...r.cloneDeep(s||{}),filter:{...r.cloneDeep((s==null?void 0:s.filter)||{}),query:oe},propertiesToExclude:ee,referencePathsToExpand:te}},F=n.computed(()=>j(S.value)),M=n.computed(()=>{if(F.value.restCollectionUrl!==void 0)return F.value.restCollectionUrl;if(!C.value)return!m.value||!m.value.collectionName?null:E.value?`${X.config.apiBaseUrl}/draft-batches/${E.value}/${m.value.collectionName}`:`${X.config.apiBaseUrl}/${m.value.collectionName}`}),a=n.computed(()=>{var s;if(m.value)return r.mergeWith(r.cloneDeep(he),F.value,{idProperty:(s=m.value)==null?void 0:s.idProperty,restCollectionUrl:M.value||""},(c,L)=>{if(r.isArray(L)&&L.length==0&&(c==null||r.isArray(c)))return L})}),f=n.ref(0),b=n.computed(()=>{var s;return f.value,l.value||m.value&&((s=m.value)==null?void 0:s.collectionName)&&(E.value?`draftBatches/${E.value}/${m.value.collectionName}/${O.value}`:`${m.value.collectionName}/${O.value}`)||null}),z=()=>{if(P.value){let s=!1;return m.value&&b.value&&(t.value=_.getStore(b.value),t.value?s=!1:a.value&&(C.value=!1,t.value=Ee(b.value,a.value)(),s=!0)),s}else return!1},J=()=>{b.value&&l.value==b.value?(t.value=void 0,z()):(t.value=void 0,f.value=f.value+1,z())};n.watch(E,(s,c)=>{r.isEqual(s,c)||J()}),n.watch(P,(s,c)=>{s!=c&&(s?z():t.value=void 0)}),n.watch(m,(s,c)=>{s&&!c?z():!s&&c||r.isEqual(s,c)||J()}),n.watch(a,(s,c)=>{r.isEqual(s,c)||J()}),n.watch(B,()=>{B.value||(C.value=!1)}),n.watch(b,()=>z()),n.watch(M,(s,c)=>{r.isEqual(s,c)||J()});const W=[],Pe=function(s){y.value!="Uninitialized"?n.nextTick(s):W.push(s)};return n.watch(y,(s,c)=>{if(s!="Uninitialized"&&c=="Uninitialized"){const L=r.clone(W);W.splice(0,W.length);for(const x of L)x()}}),z(),{collectionId:b,draftBatchId:E,resourceType:m,restCollectionUrl:n.computed(()=>T("restCollectionUrl",null)),enabled:P,status:y,batchSaveAttempted:n.computed(()=>T("batchSaveAttempted",!1)),listNavigators:n.computed(()=>T("listNavigators",!1)),invalidResources:n.computed(()=>T("invalidResources",[])),resources:n.computed(()=>y.value!="Uninitialized"?(q(s=>s.ensureCollectionLoaded()),T("resources",[])):[]),remoteCollectionSize:n.computed(()=>T("remoteCollectionSize",null)),transientData:n.computed(()=>T("transientData",[])),detailSelection:n.computed(()=>T("detailSelection",[])),editingDetailSelection:n.computed(()=>T("editingDetailSelection",!1)),selection:n.computed(()=>T("selection",[])),reconfigureCollection:U,setEditingDetailSelection:s=>p(c=>c.setEditingDetailSelection(s)),setEnabled:H,setFilterResourceIds:le,setQuery:Z,ensureStore:z,setBatchSaveAttempted:s=>p(c=>c.setBatchSaveAttempted(s)),clear:()=>p(s=>s.clear()),ensureCollectionLoaded:async()=>await q(async s=>s.ensureCollectionLoaded()),loadResources:async()=>await q(async s=>await s.loadResources()),addResource:s=>p(c=>c.addResource(s)),checkForDeletedResource:async s=>await q(async c=>await c.checkForDeletedResource(s))==!0,recordDeletion:s=>p(c=>c.recordDeletion(s)),recordInsertion:(s,{insertAtBeginning:c=!1,transientData:L=void 0}={})=>p(x=>x.recordInsertion(s,{insertAtBeginning:c,transientData:L})),recordUpdate:s=>p(c=>c.recordUpdate(s)),refreshResource:async s=>await q(async c=>await c.refreshResource(s)),deleteResource:async s=>await q(async c=>await c.deleteResource(s)),saveResource:async s=>await q(async c=>await c.saveResource(s)),saveResources:async s=>await q(async c=>await c.saveResources(s)),updateResources:async s=>await q(async c=>await c.updateResources(s)),clearTransientData:()=>p(s=>s.clearTransientData()),setInvalidResourceIds:s=>p(c=>c.setInvalidResourceIds(s)),setTransientDataForResources:s=>p(c=>c.setTransientDataForResources(s)),clearSelection:()=>p(s=>s.clearSelection()),deselectResources:s=>p(c=>c.deselectResources(s)),selectResources:(s,c)=>p(L=>L.selectResources(s,c)),hideDetail:()=>p(s=>s.hideDetail()),deregisterEditor:s=>p(c=>c.deregisterEditor(s)),registerEditor:s=>p(c=>c.registerEditor(s)),deregisterListNavigator:s=>p(c=>c.deregisterListNavigator(s)),registerListNavigator:s=>p(c=>c.registerListNavigator(s)),onItemsStoreReady:Pe}},Te=()=>{_.clearAllStores()};function ie(v,o){return r.get(v,(o==null?void 0:o.idProperty)||"_id")}const fe={idProperty:"_id"},Y={resource:null,status:"NotLoaded"},Le=(v,o)=>{o=r.merge({},fe,o);const I=ce.defineStore(v,{state:()=>({idProperty:o.idProperty,resourceId:o.resourceId||null,resourceUrl:o.resourceUrl||null,referencePathsToExpand:o.referencePathsToExpand||null,...Y}),getters:{currentResourceUrl:e=>e.resourceUrl||(o.restCollectionUrl&&e.resourceId?`${o.restCollectionUrl}/${e.resourceId}`:null)||o.restCollectionUrl||null,fixedQueryParams:e=>{const i={};return e.referencePathsToExpand&&(i.r=G(e.referencePathsToExpand)),i}},actions:{reset(){for(const e in Y)this[e]=Y[e]},async setResourceId(e){const i=this.currentResourceUrl;this.resourceId=e,!r.isEqual(this.currentResourceUrl,i)&&this.status!="NotLoaded"&&await this.loadResource()},async setResourceUrl(e){const i=this.currentResourceUrl;this.resourceUrl=e,!r.isEqual(this.currentResourceUrl,i)&&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 i=this.fixedQueryParams,t=r.cloneDeep(i),l=r.map(t,(u,h)=>u!=null?`${encodeURIComponent(h)}=${encodeURIComponent(u)}`:null).filter(u=>u!=null).join("&"),d=r.isEmpty(l)?this.currentResourceUrl:`${this.currentResourceUrl}?${l}`;try{const u=await $.get(d),h=this.fixedQueryParams;e!=this._loadId||!r.isEqual(i,h)?console.log(`Discarding resource fetched by obsolete query from ${d}.`):(this.resource=ae.decode(r.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(i){$.isAxiosError(i)&&(e=i.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=ie(e,this)||null,this.status=="Loaded"&&(this.resource=Object.freeze(e))},recordUpdate(e){this.resourceId=ie(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 i=ie(e,this),t=i==null;if(!i)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 updateResource(e){if(!this.currentResourceUrl)throw"Cannot save a resource because its URL, or its ID and collection URL, are unknown.";const i=await $({method:"patch",url:this.currentResourceUrl,data:e});if(i.status==200){const t=i.data;return await this.refreshResource()||Object.freeze(t)}return null},async makeCustomApiRequest(e){const{method:i,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:i||"get",url:u,data:d});return h.status>=200&&h.status<300?h.data:null}}});return(()=>{const e=(i,t)=>{const l=I(i,t);return re.registerStore(l.$id,l),l};return e.$id=I.$id,e})()},re=new de,$e=(v={})=>{const{resourceClientId:o,draftBatchId:I,enabled:w,resourceType:e,options:i}=v,t=n.ref(void 0),l=n.ref(o),d=n.ref(I),u=n.ref(w??!0),h=n.ref([n.toRef(e)]),S=n.ref(i),E=n.computed(()=>d.value),P=n.ref(u.value),O=n.ref(D.v4()),N=n.computed(()=>d.value==null&&l.value!=null&&re.getStore(l.value)!=null),k=n.ref(N.value),B=n.computed(()=>p("status","Uninitialized"));function C(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 q=(a={})=>{const{resourceClientId:f,draftBatchId:b,enabled:z,resourceType:J,options:W}=a;l.value=f,d.value=b,u.value=z??!0,h.value=[n.toRef(J)],W!=null&&(S.value=W),O.value=D.v4(),T(u.value)},T=async a=>{a!=P.value&&(P.value=a,a&&F())},U=n.computed(()=>h.value[0].value||void 0),H=function(a){const f=r.get(a,"referencePathsToExpand"),b=U.value?r.isFunction(f)?f(U.value):f||[]:[];return{...r.cloneDeep(a||{}),referencePathsToExpand:b}},le=n.computed(()=>H(S.value)),Z=n.computed(()=>{if(!U.value)return null;if(!k.value)return!U.value||!U.value.collectionName?null:E.value?`${X.config.apiBaseUrl}/draft-batches/${E.value}/${U.value.collectionName}`:`${X.config.apiBaseUrl}/${U.value.collectionName}`}),V=n.computed(()=>{if(U.value&&Z.value)return r.mergeWith(r.cloneDeep(fe),le.value,{idProperty:U.value.idProperty,restCollectionUrl:Z.value},(a,f)=>{if(r.isArray(f)&&f.length==0&&(a==null||r.isArray(a)))return f})}),m=n.ref(0),j=n.computed(()=>{var a;return m.value,l.value||U.value&&((a=U.value)==null?void 0:a.collectionName)&&(E.value?`draftBatches/${E.value}/${U.value.collectionName}/${O.value}`:`${U.value.collectionName}/${O.value}`)||null}),F=()=>{if(P.value){let a=!1;return U.value&&j.value&&(t.value=re.getStore(j.value),t.value?a=!1:V.value&&(k.value=!1,t.value=Le(j.value,V.value)(),a=!0)),a}else return!1},M=()=>{j.value&&l.value==j.value?(t.value=void 0,F()):(t.value=void 0,m.value=m.value+1,F())};return n.watch(E,(a,f)=>{r.isEqual(a,f)||M()}),n.watch(P,(a,f)=>{a!=f&&(a?F():t.value=void 0)}),n.watch(U,(a,f)=>{a&&!f?F():!a&&f||r.isEqual(a,f)||M()}),n.watch(V,(a,f)=>{r.isEqual(a,f)||M()}),n.watch(N,()=>{N.value||(k.value=!1)}),n.watch(j,()=>F()),n.watch(Z,(a,f)=>{r.isEqual(a,f)||M()}),F(),{resourceClientId:j,draftBatchId:E,enabled:P,resourceType:U,status:B,resource:n.computed(()=>B.value!="Uninitialized"?(y(a=>a.ensureResourceLoaded()),p("resource",[])):[]),resourceId:n.computed(()=>p("resourceId",null)),resourceUrl:n.computed(()=>p("resourceUrl",null)),reconfigureClient:q,setEnabled:T,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:()=>C(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)),updateResource:async a=>await y(async f=>await f.updateResource(a)),makeCustomApiRequest:async a=>await y(async f=>await f.makeCustomApiRequest(a))}},X={config:{...ue}};function qe(v){X.config=r.merge({},ue,v)}g.ApiClientError=we,g.clearAllRestCollections=Te,g.initRestClient=qe,g.restClient=X,g.useRestCollection=Ce,g.useRestResource=$e,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
@@ -19,6 +19,9 @@ export interface RestCollectionStoreOptions {
19
19
  constrainToSelection: boolean;
20
20
  };
21
21
  filter: RestCollectionFilter;
22
+ hooks: {
23
+ beforeLoadResources: (() => Resource[] | true | false) | null;
24
+ };
22
25
  idProperty: string;
23
26
  limit: number | null;
24
27
  limitTransientDataToLocalCollection: boolean;
@@ -58,6 +61,7 @@ export interface RestCollectionStoreState {
58
61
  transientData: {
59
62
  [id: ResourceId]: any;
60
63
  };
64
+ _isBeforeLoad?: boolean;
61
65
  _loadId?: string;
62
66
  _loadOffset?: number;
63
67
  }
@@ -120,6 +124,7 @@ declare const makeStore: (storeId: string, options: RestCollectionStoreOptions)
120
124
  [id: string]: any;
121
125
  [id: number]: any;
122
126
  };
127
+ _isBeforeLoad?: boolean | undefined;
123
128
  _loadId?: string | undefined;
124
129
  _loadOffset?: number | undefined;
125
130
  } & import("pinia").PiniaCustomStateProperties<RestCollectionStoreState>) => RestCollectionQueryParams;
@@ -483,6 +488,7 @@ export declare const storeRegistry: StoreRegistry<import("pinia").Store<string,
483
488
  [id: string]: any;
484
489
  [id: number]: any;
485
490
  };
491
+ _isBeforeLoad?: boolean | undefined;
486
492
  _loadId?: string | undefined;
487
493
  _loadOffset?: number | undefined;
488
494
  } & import("pinia").PiniaCustomStateProperties<RestCollectionStoreState>) => RestCollectionQueryParams;
@@ -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,EAAE,sBAAsB,EAAC,MAAM,iCAAiC,CAAA;AAC5F,OAAO,EAAC,WAAW,EAAE,UAAU,EAAC,MAAM,eAAe,CAAA;AACrD,OAAO,EAAC,aAAa,EAAC,MAAM,2BAA2B,CAAA;AAyCvD,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,uBAAuB,EAAE,OAAO,CAAA;QAChC,uBAAuB,EAAE,OAAO,CAAA;QAChC,oBAAoB,EAAE,OAAO,CAAA;KAC9B,CAAC;IACF,MAAM,EAAE,oBAAoB,CAAA;IAC5B,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,mCAAmC,EAAE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