rest-client-vue 1.1.1-b1 → 1.1.1-b10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -31,6 +31,7 @@ export declare interface ConcreteRestCollectionStoreOptionsInput {
31
31
  pageSize?: number | null;
32
32
  };
33
33
  order?: [any, string][];
34
+ propertyBlacklist?: string[];
34
35
  referencePathsToExpand?: string[];
35
36
  restCollectionUrl?: string | null;
36
37
  }
@@ -126,6 +127,18 @@ export declare interface RestCollection<T extends Resource = Resource> {
126
127
  * To allow for asynchronous loading of resource types, this may be undefined.
127
128
  */
128
129
  resourceType: Ref<ResourceType | undefined>;
130
+ /**
131
+ * The REST collection URL.
132
+ *
133
+ * This is reported by the actual Pinia store. It may be arrived at in three ways:
134
+ * - It may have been specified in {@link RestCollectionOptions.options}.
135
+ * - It may have been calculated from the entity type and draft batch ID. This is the most common scenario.
136
+ * - Or this RestCollection may reference an existing store, in which case the URL was determined by the collection
137
+ * that originally created the store.
138
+ *
139
+ * It defaults to null when no store is present.
140
+ */
141
+ restCollectionUrl: Ref<string | null>;
129
142
  /** A status indicating whether resources have been loaded yet from the REST API. */
130
143
  status: Ref<RestCollectionStatus>;
131
144
  batchSaveAttempted: Ref<boolean>;
@@ -139,6 +152,8 @@ export declare interface RestCollection<T extends Resource = Resource> {
139
152
  invalidResources: Ref<T[]>;
140
153
  /** The array of resources that have been loaded from the REST API into the local collection. */
141
154
  resources: Ref<T[]>;
155
+ /** The total number of resources available in the remote collection. */
156
+ remoteCollectionSize: Ref<number | null>;
142
157
  /** Transient data that a client has associated with the resources via {@link setTransientDataForResources}. */
143
158
  transientData: Ref<any[]>;
144
159
  /** Resources in the current detail view, a sublist of {@link resources}. */
@@ -364,6 +379,7 @@ export declare interface RestCollectionStoreOptionsInput {
364
379
  pageSize?: number | null;
365
380
  };
366
381
  order?: [any, string][];
382
+ propertyBlacklist?: string[] | ((resourceType: ResourceType) => string[]);
367
383
  referencePathsToExpand?: string[] | ((resourceType: ResourceType) => string[]);
368
384
  restCollectionUrl?: string | null;
369
385
  }
@@ -1,59 +1,59 @@
1
- var we = Object.defineProperty;
2
- var Ce = (f, s, R) => s in f ? we(f, s, { enumerable: !0, configurable: !0, writable: !0, value: R }) : f[s] = R;
3
- var re = (f, s, R) => (Ce(f, typeof s != "symbol" ? s + "" : s, R), R), Te = (f, s, R) => {
1
+ var Ee = Object.defineProperty;
2
+ var we = (f, s, S) => s in f ? Ee(f, s, { enumerable: !0, configurable: !0, writable: !0, value: S }) : f[s] = S;
3
+ var ae = (f, s, S) => (we(f, typeof s != "symbol" ? s + "" : s, S), S), Te = (f, s, S) => {
4
4
  if (!s.has(f))
5
- throw TypeError("Cannot " + R);
5
+ throw TypeError("Cannot " + S);
6
6
  };
7
- var Q = (f, s, R) => (Te(f, s, "read from private field"), R ? R.call(f) : s.get(f)), Se = (f, s, R) => {
7
+ var Q = (f, s, S) => (Te(f, s, "read from private field"), S ? S.call(f) : s.get(f)), Se = (f, s, S) => {
8
8
  if (s.has(f))
9
9
  throw TypeError("Cannot add the same private member more than once");
10
- s instanceof WeakSet ? s.add(f) : s.set(f, R);
10
+ s instanceof WeakSet ? s.add(f) : s.set(f, S);
11
11
  };
12
12
  import a from "lodash";
13
- import { v4 as X } from "uuid";
14
- import { ref as I, toRef as te, computed as S, watch as C, nextTick as Le } from "vue";
13
+ import { v4 as H } from "uuid";
14
+ import { ref as I, toRef as se, computed as R, watch as T, nextTick as Le } from "vue";
15
15
  import P from "axios";
16
16
  import me from "jsog";
17
- import V from "json-stringify-deterministic";
18
- import { defineStore as ye } from "pinia";
19
- const pe = {
17
+ import X from "json-stringify-deterministic";
18
+ import { defineStore as pe } from "pinia";
19
+ const ye = {
20
20
  apiBaseUrl: "",
21
21
  useVueLogger: !1
22
22
  };
23
- class ke extends Error {
24
- constructor(R, $ = void 0, e = void 0) {
25
- super(R);
26
- re(this, "context");
27
- re(this, "innerError");
23
+ class _e extends Error {
24
+ constructor(S, $ = void 0, e = void 0) {
25
+ super(S);
26
+ ae(this, "context");
27
+ ae(this, "innerError");
28
28
  this.context = $, this.innerError = e;
29
29
  }
30
30
  }
31
- var O;
31
+ var k;
32
32
  class Ie {
33
33
  constructor() {
34
- Se(this, O, {});
34
+ Se(this, k, {});
35
35
  }
36
36
  clearAllStores() {
37
- for (const s in Q(this, O))
38
- Q(this, O)[s].clear();
37
+ for (const s in Q(this, k))
38
+ Q(this, k)[s].clear();
39
39
  }
40
40
  destroyStore(s) {
41
- Q(this, O)[s] && (Q(this, O)[s].$dispose(), delete Q(this, O)[s]);
41
+ Q(this, k)[s] && (Q(this, k)[s].$dispose(), delete Q(this, k)[s]);
42
42
  }
43
43
  getStore(s) {
44
- return Q(this, O)[s];
44
+ return Q(this, k)[s];
45
45
  }
46
- registerStore(s, R) {
47
- Q(this, O)[s] = R;
46
+ registerStore(s, S) {
47
+ Q(this, k)[s] = S;
48
48
  }
49
49
  }
50
- O = new WeakMap();
50
+ k = new WeakMap();
51
51
  function v(f, s) {
52
52
  return a.get(f, (s == null ? void 0 : s.idProperty) || "_id");
53
53
  }
54
54
  function $e(f, s) {
55
- var R;
56
- return f && ((R = s.filter) != null && R.resourceIds) && !s.order ? s.filter.resourceIds.map(($) => f.find((e) => v(e, s) == $)).filter(($) => $ != null) : f;
55
+ var S;
56
+ return f && ((S = s.filter) != null && S.resourceIds) && !s.order ? s.filter.resourceIds.map(($) => f.find((e) => v(e, s) == $)).filter(($) => $ != null) : f;
57
57
  }
58
58
  const De = {
59
59
  detail: {
@@ -79,30 +79,33 @@ const De = {
79
79
  order: [
80
80
  // TODO Move to SFA LIMS.
81
81
  [{ path: "history.creation.timestamp" }, "desc"],
82
- [{ path: "history.creation.orderInBatch" }, "desc"]
82
+ [{ path: "history.creation.indexInBatch" }, "desc"]
83
83
  ]
84
- }, Y = {
84
+ }, Z = {
85
85
  resources: [],
86
+ remoteCollectionSize: null,
86
87
  status: "NotLoaded",
87
88
  selection: [],
88
89
  detailSelection: [],
89
90
  invalidResources: [],
90
91
  transientData: {}
91
- }, le = {
92
+ }, oe = {
92
93
  editingDetailSelection: !1,
93
94
  batchSaveAttempted: !1,
94
95
  editors: [],
95
96
  listNavigators: {}
96
97
  }, Pe = (f, s) => {
97
98
  s = a.merge({}, De, s);
98
- const R = ye(f, {
99
+ const S = pe(f, {
99
100
  state: () => ({
100
101
  idProperty: s.idProperty,
101
102
  filter: s.filter,
102
103
  order: s.order || null,
104
+ propertyBlacklist: s.propertyBlacklist || null,
103
105
  referencePathsToExpand: s.referencePathsToExpand || null,
104
- ...Y,
105
- ...le
106
+ restCollectionUrl: s.restCollectionUrl,
107
+ ...Z,
108
+ ...oe
106
109
  }),
107
110
  getters: {
108
111
  /**
@@ -117,9 +120,9 @@ const De = {
117
120
  const t = [];
118
121
  if ((u = e.filter) != null && u.resourceIds && t.push({ l: { path: e.idProperty }, r: { constant: e.filter.resourceIds }, operator: "in" }), (c = e.filter) != null && c.query && t.push((d = e.filter) == null ? void 0 : d.query), t.length > 0) {
119
122
  const y = t.length == 1 ? t[0] : { and: t };
120
- r.q = V(y);
123
+ r.q = X(y);
121
124
  }
122
- return e.order && (r.o = V(e.order)), e.referencePathsToExpand && (r.r = V(e.referencePathsToExpand)), r;
125
+ return e.order && (r.o = X(e.order)), e.propertyBlacklist && (r.ex = X(e.propertyBlacklist)), e.referencePathsToExpand && (r.r = X(e.referencePathsToExpand)), r;
123
126
  }
124
127
  },
125
128
  actions: {
@@ -132,10 +135,10 @@ const De = {
132
135
  * Configuration is retained, but REST collection contents and contextual state are reset.
133
136
  */
134
137
  reset() {
135
- for (const e in Y)
136
- this[e] = Y[e];
137
- for (const e in le)
138
- this[e] = le[e];
138
+ for (const e in Z)
139
+ this[e] = Z[e];
140
+ for (const e in oe)
141
+ this[e] = oe[e];
139
142
  },
140
143
  /**
141
144
  * Reset the store to its initial state, but retain transient data if appropriate.
@@ -175,7 +178,7 @@ const De = {
175
178
  * @param filter The new filter.
176
179
  */
177
180
  setFilter(e) {
178
- a.isEqual(e, this.filter) || (this.filter = e, this.status = "NotLoaded", this.resources = [], this.selection = [], this.detailSelection = [], this.invalidResources = [], this.editingDetailSelection = !1);
181
+ 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);
179
182
  },
180
183
  /**
181
184
  * Set the filter query.
@@ -235,8 +238,8 @@ const De = {
235
238
  * Configuration and contextual state are retained, but REST collection contents are reset.
236
239
  */
237
240
  clear() {
238
- for (const e in Y)
239
- this[e] = Y[e];
241
+ for (const e in Z)
242
+ this[e] = Z[e];
240
243
  },
241
244
  /**
242
245
  * Clear the collection's contents, but retain transient data if appropriate.
@@ -270,7 +273,7 @@ const De = {
270
273
  */
271
274
  async loadResources(e = {}) {
272
275
  this.resetRetainingTransientData();
273
- const r = X();
276
+ const r = H();
274
277
  this._loadId = r, await this._loadResources(0, r, e);
275
278
  },
276
279
  /**
@@ -287,32 +290,32 @@ const De = {
287
290
  * @param loadOptions Pagination options that may override the defaults.
288
291
  */
289
292
  async _loadResources(e, r, t) {
290
- var b, q, A, z, B;
293
+ var z, F, A, B, O;
291
294
  const l = e == 0;
292
- if (this.status = l ? "Loading" : "LoadingMore", this._loadOffset = e, ((b = this.filter) == null ? void 0 : b.query) === !1) {
293
- this.resources = [];
295
+ if (this.status = l ? "Loading" : "LoadingMore", this._loadOffset = e, ((z = this.filter) == null ? void 0 : z.query) === !1) {
296
+ this.resources = [], this.remoteCollectionSize = 0;
294
297
  return;
295
298
  }
296
- const u = this.fixedQueryParams, c = a.cloneDeep(u), d = l ? (q = this.filter) != null && q.resourceIds && !this.order ? null : t.firstPageSize || ((A = s.loading) == null ? void 0 : A.firstPageSize) || t.pageSize || ((z = s.loading) == null ? void 0 : z.pageSize) || null : t.pageSize || ((B = s.loading) == null ? void 0 : B.pageSize) || null, y = d != null || s.limit != null ? a.min(a.filter([d, s.limit], (g) => g != null)) : void 0;
299
+ const u = this.fixedQueryParams, c = a.cloneDeep(u), d = l ? (F = this.filter) != null && F.resourceIds && !this.order ? null : t.firstPageSize || ((A = s.loading) == null ? void 0 : A.firstPageSize) || t.pageSize || ((B = s.loading) == null ? void 0 : B.pageSize) || null : t.pageSize || ((O = s.loading) == null ? void 0 : O.pageSize) || null, y = d != null || s.limit != null ? a.min(a.filter([d, s.limit], (g) => g != null)) : void 0;
297
300
  y != null ? (c.offset = e, c.limit = y) : e != 0 && (c.offset = e);
298
301
  const U = a.map(
299
302
  c,
300
303
  (g, m) => g != null ? `${encodeURIComponent(m)}=${encodeURIComponent(g)}` : null
301
- ).filter((g) => g != null).join("&"), T = a.isEmpty(U) ? s.restCollectionUrl : `${s.restCollectionUrl}?${U}`;
304
+ ).filter((g) => g != null).join("&"), L = a.isEmpty(U) ? s.restCollectionUrl : `${s.restCollectionUrl}?${U}`;
302
305
  try {
303
- const g = await P.get(T), m = this.fixedQueryParams;
306
+ const g = await P.get(L), m = this.fixedQueryParams;
304
307
  if (r != this._loadId || e != this._loadOffset || !a.isEqual(u, m))
305
308
  console.log(`Discarding resources fetched by obsolete query from ${s.restCollectionUrl}.`);
306
309
  else {
307
- const E = me.decode(a.get(g, "data.data", [])), L = (l ? 0 : this.resources.length) + E.length, D = y == null || E.length < y || s.limit && L >= s.limit;
310
+ const C = me.decode(a.get(g, "data.data", [])), w = (l ? 0 : this.resources.length) + C.length, D = y == null || C.length < y || s.limit && w >= s.limit;
308
311
  console.log(
309
- `Loaded ${E.length}${l ? "" : " more"} resources from ${s.restCollectionUrl}`
312
+ `Loaded ${C.length}${l ? "" : " more"} resources from ${s.restCollectionUrl}`
310
313
  ), l && (this.resources = []);
311
- const W = [...this.resources, ...E.map((H) => Object.freeze(H))];
312
- this.resources = $e(W, this), this.status = D ? "Loaded" : "LoadingMore", D || this._loadResources(this.resources.length, r, t);
314
+ const W = [...this.resources, ...C.map((J) => Object.freeze(J))];
315
+ this.resources = $e(W, this), a.get(g, "data.totalCollectionSize") ? this.remoteCollectionSize = a.get(g, "data.totalCollectionSize") : this.remoteCollectionSize = null, this.status = D ? "Loaded" : "LoadingMore", D || this._loadResources(this.resources.length, r, t);
313
316
  }
314
317
  } catch (g) {
315
- console.log(`Error while loading resources (URL="${T}"):`, g), this.clearRetainingTransientData(), this.status = "Failed";
318
+ console.log(`Error while loading resources (URL="${L}"):`, g), this.clearRetainingTransientData(), this.status = "Failed";
316
319
  }
317
320
  },
318
321
  // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -413,7 +416,7 @@ const De = {
413
416
  async refreshResource(e) {
414
417
  if (e) {
415
418
  const r = {};
416
- this.referencePathsToExpand && (r.r = V(this.referencePathsToExpand));
419
+ this.referencePathsToExpand && (r.r = X(this.referencePathsToExpand));
417
420
  const t = a.map(
418
421
  r,
419
422
  (c, d) => c != null ? `${encodeURIComponent(d)}=${encodeURIComponent(c)}` : null
@@ -675,80 +678,79 @@ const De = {
675
678
  });
676
679
  return (() => {
677
680
  const e = (r, t) => {
678
- const l = R(r, t);
679
- return ie.registerStore(l.$id, l), l;
681
+ const l = S(r, t);
682
+ return re.registerStore(l.$id, l), l;
680
683
  };
681
- return e.$id = R.$id, e;
684
+ return e.$id = S.$id, e;
682
685
  })();
683
- }, ie = new Ie(), Be = (f = {}) => {
684
- var oe, ce, ue, de;
686
+ }, re = new Ie(), Oe = (f = {}) => {
687
+ var ue, de, he, fe;
685
688
  const {
686
689
  collectionId: s,
687
- draftBatchId: R,
690
+ draftBatchId: S,
688
691
  enabled: $,
689
692
  resourceType: e,
690
693
  options: r
691
- } = f, t = I(void 0), l = I(s), u = I(R), c = I($ ?? !0), d = I([te(e)]), y = I(r), U = S(() => u.value), T = I(c.value), b = I(X()), q = I((ce = (oe = y.value) == null ? void 0 : oe.filter) == null ? void 0 : ce.resourceIds), A = I((de = (ue = y.value) == null ? void 0 : ue.filter) == null ? void 0 : de.query), z = S(
692
- () => u.value == null && l.value != null && ie.getStore(l.value) != null
693
- ), B = I(z.value), g = S(() => L("status", "Uninitialized"));
694
+ } = f, t = I(void 0), l = I(s), u = I(S), c = I($ ?? !0), d = I([se(e)]), y = I(r), U = R(() => u.value), L = I(c.value), z = I(H()), F = I((de = (ue = y.value) == null ? void 0 : ue.filter) == null ? void 0 : de.resourceIds), A = I((fe = (he = y.value) == null ? void 0 : he.filter) == null ? void 0 : fe.query), B = R(
695
+ () => u.value == null && l.value != null && re.getStore(l.value) != null
696
+ ), O = I(B.value), g = R(() => w("status", "Uninitialized"));
694
697
  function m(i) {
695
698
  if (t.value)
696
699
  return i(t.value);
697
700
  }
698
- async function E(i) {
701
+ async function C(i) {
699
702
  if (t.value)
700
703
  return await i(t.value);
701
704
  }
702
- function L(i, o) {
705
+ function w(i, n) {
703
706
  if (t.value)
704
707
  return t.value[i];
705
- if (o !== void 0)
706
- return o;
708
+ if (n !== void 0)
709
+ return n;
707
710
  throw "Attempted to use a REST collection store that has not been created, with no default value.";
708
711
  }
709
712
  const D = (i = {}) => {
710
- var fe, ve, ge, Re;
713
+ var ie, ve, ge, Re;
711
714
  const {
712
- collectionId: o,
713
- draftBatchId: w,
714
- enabled: _,
715
- resourceType: se,
716
- options: he
715
+ collectionId: n,
716
+ draftBatchId: E,
717
+ enabled: q,
718
+ resourceType: le,
719
+ options: te
717
720
  } = i;
718
- l.value = o, u.value = w, c.value = _ ?? !0, d.value = [te(se)], he != null && (y.value = he, q.value = (ve = (fe = y.value) == null ? void 0 : fe.filter) == null ? void 0 : ve.resourceIds, A.value = (Re = (ge = y.value) == null ? void 0 : ge.filter) == null ? void 0 : Re.query), b.value = X(), W(c.value);
721
+ l.value = n, u.value = E, c.value = q ?? !0, d.value = [se(le)], te != null && (y.value = te, F.value = (ve = (ie = y.value) == null ? void 0 : ie.filter) == null ? void 0 : ve.resourceIds, A.value = (Re = (ge = y.value) == null ? void 0 : ge.filter) == null ? void 0 : Re.query), z.value = H(), W(c.value);
719
722
  }, W = async (i) => {
720
- i != T.value && (T.value = i, i && (K(), N()));
721
- }, H = async (i) => {
722
- q.value = i, await E(async (o) => await o.setFilterResourceIds(q.value || null));
723
+ i != L.value && (L.value = i, i && (Y(), b()));
723
724
  }, J = async (i) => {
725
+ F.value = i, await C(async (n) => await n.setFilterResourceIds(F.value || null));
726
+ }, K = async (i) => {
724
727
  if (A.value = i, g.value != "Uninitialized") {
725
- const o = i, w = S(() => a.isFunction(o) ? p.value ? o(p.value) : null : o);
726
- await E((_) => _.setQuery(w.value || null));
728
+ const n = i, E = R(() => a.isFunction(n) ? p.value ? n(p.value) : null : n);
729
+ await C((q) => q.setQuery(E.value || null));
727
730
  }
728
- }, K = () => {
731
+ }, Y = () => {
729
732
  y.value = a.merge({}, y.value || {}, {
730
- filter: { resourceIds: q.value, query: A.value }
733
+ filter: { resourceIds: F.value, query: A.value }
731
734
  });
732
- }, p = S(
735
+ }, p = R(
733
736
  () => d.value[0].value || void 0
734
- ), k = function(i) {
735
- const o = a.get(i, "filter.query"), w = a.get(i, "referencePathsToExpand"), _ = a.isFunction(o) ? o(p.value) : o, se = p.value ? a.isFunction(w) ? w(p.value) : w || [] : [];
737
+ ), _ = function(i) {
738
+ const n = a.get(i, "filter.query"), E = a.get(i, "propertyBlacklist"), q = a.get(i, "referencePathsToExpand"), le = a.isFunction(n) ? n(p.value) : n, te = p.value ? a.isFunction(E) ? E(p.value) : E || [] : [], ie = p.value ? a.isFunction(q) ? q(p.value) : q || [] : [];
736
739
  return {
737
740
  ...a.cloneDeep(i || {}),
738
741
  filter: {
739
742
  ...a.cloneDeep((i == null ? void 0 : i.filter) || {}),
740
- query: _
743
+ query: le
741
744
  },
742
- referencePathsToExpand: se
745
+ propertyBlacklist: te,
746
+ referencePathsToExpand: ie
743
747
  };
744
- }, x = S(() => k(y.value)), M = S(() => {
745
- if (!p.value)
746
- return null;
748
+ }, x = R(() => _(y.value)), M = R(() => {
747
749
  if (x.value.restCollectionUrl !== void 0)
748
750
  return x.value.restCollectionUrl;
749
- if (!B.value)
751
+ if (!O.value)
750
752
  return !p.value || !p.value.collectionName ? null : U.value ? `${ee.config.apiBaseUrl}/draft-batches/${U.value}/${p.value.collectionName}` : `${ee.config.apiBaseUrl}/${p.value.collectionName}`;
751
- }), n = S(() => {
753
+ }), o = R(() => {
752
754
  var i;
753
755
  if (p.value)
754
756
  return a.mergeWith(
@@ -758,148 +760,150 @@ const De = {
758
760
  idProperty: (i = p.value) == null ? void 0 : i.idProperty,
759
761
  restCollectionUrl: M.value || ""
760
762
  },
761
- (o, w) => {
762
- if (a.isArray(w) && w.length == 0 && (o == null || a.isArray(o)))
763
- return w;
763
+ (n, E) => {
764
+ if (a.isArray(E) && E.length == 0 && (n == null || a.isArray(n)))
765
+ return E;
764
766
  }
765
767
  );
766
- }), h = I(0), F = S(
768
+ }), h = I(0), N = R(
767
769
  () => {
768
770
  var i;
769
- return h.value, l.value || p.value && ((i = p.value) == null ? void 0 : i.collectionName) && (U.value ? `draftBatches/${U.value}/${p.value.collectionName}/${b.value}` : `${p.value.collectionName}/${b.value}`) || null;
771
+ return h.value, l.value || p.value && ((i = p.value) == null ? void 0 : i.collectionName) && (U.value ? `draftBatches/${U.value}/${p.value.collectionName}/${z.value}` : `${p.value.collectionName}/${z.value}`) || null;
770
772
  }
771
- ), N = () => {
772
- if (T.value) {
773
+ ), b = () => {
774
+ if (L.value) {
773
775
  let i = !1;
774
- return p.value && F.value && (t.value = ie.getStore(F.value), t.value ? i = !1 : n.value && (B.value = !1, t.value = Pe(F.value, n.value)(), i = !0)), i;
776
+ return p.value && N.value && (t.value = re.getStore(N.value), t.value ? i = !1 : o.value && (O.value = !1, t.value = Pe(N.value, o.value)(), i = !0)), i;
775
777
  } else
776
778
  return !1;
777
779
  }, G = () => {
778
- F.value && l.value == F.value ? (t.value = void 0, N()) : (t.value = void 0, h.value = h.value + 1, N());
780
+ N.value && l.value == N.value ? (t.value = void 0, b()) : (t.value = void 0, h.value = h.value + 1, b());
779
781
  };
780
- C(U, (i, o) => {
781
- a.isEqual(i, o) || G();
782
- }), C(T, (i, o) => {
783
- i != o && (i ? N() : t.value = void 0);
784
- }), C(p, (i, o) => {
785
- i && !o ? N() : !i && o || a.isEqual(i, o) || G();
786
- }), C(n, (i, o) => {
787
- a.isEqual(i, o) || G();
788
- }), C(z, () => {
789
- z.value || (B.value = !1);
790
- }), C(F, () => N()), C(M, (i, o) => {
791
- a.isEqual(i, o) || G();
782
+ T(U, (i, n) => {
783
+ a.isEqual(i, n) || G();
784
+ }), T(L, (i, n) => {
785
+ i != n && (i ? b() : t.value = void 0);
786
+ }), T(p, (i, n) => {
787
+ i && !n ? b() : !i && n || a.isEqual(i, n) || G();
788
+ }), T(o, (i, n) => {
789
+ a.isEqual(i, n) || G();
790
+ }), T(B, () => {
791
+ B.value || (O.value = !1);
792
+ }), T(N, () => b()), T(M, (i, n) => {
793
+ a.isEqual(i, n) || G();
792
794
  });
793
- const j = [], Ee = function(i) {
795
+ const j = [], Ce = function(i) {
794
796
  g.value != "Uninitialized" ? Le(i) : j.push(i);
795
797
  };
796
- return C(g, (i, o) => {
797
- if (i != "Uninitialized" && o == "Uninitialized") {
798
- const w = a.clone(j);
798
+ return T(g, (i, n) => {
799
+ if (i != "Uninitialized" && n == "Uninitialized") {
800
+ const E = a.clone(j);
799
801
  j.splice(0, j.length);
800
- for (const _ of w)
801
- _();
802
+ for (const q of E)
803
+ q();
802
804
  }
803
- }), N(), {
805
+ }), b(), {
804
806
  // Configuration
805
- collectionId: F,
807
+ collectionId: N,
806
808
  draftBatchId: U,
807
809
  resourceType: p,
810
+ restCollectionUrl: R(() => w("restCollectionUrl", null)),
808
811
  // Status
809
- enabled: T,
812
+ enabled: L,
810
813
  status: g,
811
- batchSaveAttempted: S(() => L("batchSaveAttempted", !1)),
812
- listNavigators: S(() => L("listNavigators", !1)),
814
+ batchSaveAttempted: R(() => w("batchSaveAttempted", !1)),
815
+ listNavigators: R(() => w("listNavigators", !1)),
813
816
  // Resources loaded from the REST API
814
- invalidResources: S(() => L("invalidResources", [])),
815
- resources: S(() => g.value != "Uninitialized" ? (E((i) => i.ensureCollectionLoaded()), L("resources", [])) : []),
817
+ invalidResources: R(() => w("invalidResources", [])),
818
+ resources: R(() => g.value != "Uninitialized" ? (C((i) => i.ensureCollectionLoaded()), w("resources", [])) : []),
819
+ remoteCollectionSize: R(() => w("remoteCollectionSize", null)),
816
820
  // Transient data
817
- transientData: S(() => L("transientData", [])),
821
+ transientData: R(() => w("transientData", [])),
818
822
  // Selection and detail selection
819
- detailSelection: S(() => L("detailSelection", [])),
820
- editingDetailSelection: S(() => L("editingDetailSelection", !1)),
821
- selection: S(() => L("selection", [])),
823
+ detailSelection: R(() => w("detailSelection", [])),
824
+ editingDetailSelection: R(() => w("editingDetailSelection", !1)),
825
+ selection: R(() => w("selection", [])),
822
826
  // Methods: Configuration
823
827
  reconfigureCollection: D,
824
828
  setEditingDetailSelection: (i) => m(
825
- (o) => o.setEditingDetailSelection(i)
829
+ (n) => n.setEditingDetailSelection(i)
826
830
  ),
827
831
  setEnabled: W,
828
- setFilterResourceIds: H,
829
- setQuery: J,
832
+ setFilterResourceIds: J,
833
+ setQuery: K,
830
834
  // Methods: Status
831
- ensureStore: N,
835
+ ensureStore: b,
832
836
  // TODO Rename
833
- setBatchSaveAttempted: (i) => m((o) => o.setBatchSaveAttempted(i)),
837
+ setBatchSaveAttempted: (i) => m((n) => n.setBatchSaveAttempted(i)),
834
838
  // Local collection management
835
839
  clear: () => m((i) => i.clear()),
836
- ensureCollectionLoaded: async () => await E(async (i) => i.ensureCollectionLoaded()),
837
- loadResources: async () => await E(async (i) => await i.loadResources()),
840
+ ensureCollectionLoaded: async () => await C(async (i) => i.ensureCollectionLoaded()),
841
+ loadResources: async () => await C(async (i) => await i.loadResources()),
838
842
  // Methods: Recording changes to the collection
839
- addResource: (i) => m((o) => o.addResource(i)),
840
- checkForDeletedResource: async (i) => await E(async (o) => await o.checkForDeletedResource(i)) == !0,
841
- recordDeletion: (i) => m((o) => o.recordDeletion(i)),
842
- recordInsertion: (i, { insertAtBeginning: o = !1, transientData: w = void 0 } = {}) => m((_) => _.recordInsertion(i, { insertAtBeginning: o, transientData: w })),
843
- recordUpdate: (i) => m((o) => o.recordUpdate(i)),
844
- refreshResource: async (i) => await E(
845
- async (o) => await o.refreshResource(i)
843
+ addResource: (i) => m((n) => n.addResource(i)),
844
+ checkForDeletedResource: async (i) => await C(async (n) => await n.checkForDeletedResource(i)) == !0,
845
+ recordDeletion: (i) => m((n) => n.recordDeletion(i)),
846
+ recordInsertion: (i, { insertAtBeginning: n = !1, transientData: E = void 0 } = {}) => m((q) => q.recordInsertion(i, { insertAtBeginning: n, transientData: E })),
847
+ recordUpdate: (i) => m((n) => n.recordUpdate(i)),
848
+ refreshResource: async (i) => await C(
849
+ async (n) => await n.refreshResource(i)
846
850
  ),
847
851
  // Methods: Modifying the collection
848
- deleteResource: async (i) => await E(
849
- async (o) => await o.deleteResource(i)
852
+ deleteResource: async (i) => await C(
853
+ async (n) => await n.deleteResource(i)
850
854
  ),
851
- saveResource: async (i) => await E(async (o) => await o.saveResource(i)),
852
- saveResources: async (i) => await E(async (o) => await o.saveResources(i)),
855
+ saveResource: async (i) => await C(async (n) => await n.saveResource(i)),
856
+ saveResources: async (i) => await C(async (n) => await n.saveResources(i)),
853
857
  // Methods: Transient data
854
858
  clearTransientData: () => m((i) => i.clearTransientData()),
855
- setInvalidResourceIds: (i) => m((o) => o.setInvalidResourceIds(i)),
859
+ setInvalidResourceIds: (i) => m((n) => n.setInvalidResourceIds(i)),
856
860
  setTransientDataForResources: (i) => m(
857
- (o) => o.setTransientDataForResources(i)
861
+ (n) => n.setTransientDataForResources(i)
858
862
  ),
859
863
  // Methods: Selection and detail selection
860
864
  clearSelection: () => m((i) => i.clearSelection()),
861
- deselectResources: (i) => m((o) => o.deselectResources(i)),
862
- selectResources: (i, o) => m(
863
- (w) => w.selectResources(i, o)
865
+ deselectResources: (i) => m((n) => n.deselectResources(i)),
866
+ selectResources: (i, n) => m(
867
+ (E) => E.selectResources(i, n)
864
868
  ),
865
869
  // Methods: Managing the detail view
866
870
  hideDetail: () => m((i) => i.hideDetail()),
867
871
  // Methods: Editors
868
- deregisterEditor: (i) => m((o) => o.deregisterEditor(i)),
869
- registerEditor: (i) => m((o) => o.registerEditor(i)),
872
+ deregisterEditor: (i) => m((n) => n.deregisterEditor(i)),
873
+ registerEditor: (i) => m((n) => n.registerEditor(i)),
870
874
  // Methods: List navigators
871
- deregisterListNavigator: (i) => m((o) => o.deregisterListNavigator(i)),
872
- registerListNavigator: (i) => m((o) => o.registerListNavigator(i)),
875
+ deregisterListNavigator: (i) => m((n) => n.deregisterListNavigator(i)),
876
+ registerListNavigator: (i) => m((n) => n.registerListNavigator(i)),
873
877
  // Callbacks
874
- onItemsStoreReady: Ee
878
+ onItemsStoreReady: Ce
875
879
  };
876
880
  }, Qe = () => {
877
- ie.clearAllStores();
881
+ re.clearAllStores();
878
882
  };
879
- function ae(f, s) {
883
+ function ne(f, s) {
880
884
  return a.get(f, (s == null ? void 0 : s.idProperty) || "_id");
881
885
  }
882
886
  const Ue = {
883
887
  idProperty: "_id"
884
- }, Z = {
888
+ }, V = {
885
889
  resource: null,
886
890
  status: "NotLoaded"
887
891
  }, xe = (f, s) => {
888
892
  s = a.merge({}, Ue, s);
889
- const R = ye(f, {
893
+ const S = pe(f, {
890
894
  state: () => ({
891
895
  idProperty: s.idProperty,
892
896
  resourceId: s.resourceId || null,
893
897
  resourceUrl: s.resourceUrl || null,
894
898
  referencePathsToExpand: s.referencePathsToExpand || null,
895
- ...Z
899
+ ...V
896
900
  }),
897
901
  getters: {
898
902
  currentResourceUrl: (e) => e.resourceUrl || (s.restCollectionUrl && e.resourceId ? `${s.restCollectionUrl}/${e.resourceId}` : null) || s.restCollectionUrl || null,
899
903
  /** Get the REST query parameters that can be determined from the options. */
900
904
  fixedQueryParams: (e) => {
901
905
  const r = {};
902
- return e.referencePathsToExpand && (r.r = V(e.referencePathsToExpand)), r;
906
+ return e.referencePathsToExpand && (r.r = X(e.referencePathsToExpand)), r;
903
907
  }
904
908
  },
905
909
  actions: {
@@ -912,8 +916,8 @@ const Ue = {
912
916
  * Configuration is retained, but REST resource content and contextual state are reset.
913
917
  */
914
918
  reset() {
915
- for (const e in Z)
916
- this[e] = Z[e];
919
+ for (const e in V)
920
+ this[e] = V[e];
917
921
  },
918
922
  async setResourceId(e) {
919
923
  const r = this.currentResourceUrl;
@@ -932,8 +936,8 @@ const Ue = {
932
936
  * Configuration and contextual state are retained, but REST collection contents are reset.
933
937
  */
934
938
  clear() {
935
- for (const e in Z)
936
- this[e] = Z[e];
939
+ for (const e in V)
940
+ this[e] = V[e];
937
941
  },
938
942
  /**
939
943
  * Load the resource, if it has not been loaded.
@@ -950,7 +954,7 @@ const Ue = {
950
954
  */
951
955
  async loadResource() {
952
956
  this.reset();
953
- const e = X();
957
+ const e = H();
954
958
  if (this._loadId = e, this.currentResourceUrl) {
955
959
  this.status = "Loading";
956
960
  const r = this.fixedQueryParams, t = a.cloneDeep(r), l = a.map(
@@ -1018,7 +1022,7 @@ const Ue = {
1018
1022
  * @param resource The resource that has been inserted.
1019
1023
  */
1020
1024
  recordInsertion(e) {
1021
- this.resourceId = ae(e, this) || null, this.status == "Loaded" && (this.resource = Object.freeze(e));
1025
+ this.resourceId = ne(e, this) || null, this.status == "Loaded" && (this.resource = Object.freeze(e));
1022
1026
  },
1023
1027
  /**
1024
1028
  * Record an update, making the same changes in the local resource.
@@ -1039,7 +1043,7 @@ const Ue = {
1039
1043
  * @param resource The resource that has been updated.
1040
1044
  */
1041
1045
  recordUpdate(e) {
1042
- this.resourceId = ae(e, this) || null, this.status == "Loaded" && (this.resource = Object.freeze(e));
1046
+ this.resourceId = ne(e, this) || null, this.status == "Loaded" && (this.resource = Object.freeze(e));
1043
1047
  },
1044
1048
  async refreshResource() {
1045
1049
  return await this.loadResource(), this.resource;
@@ -1070,7 +1074,7 @@ const Ue = {
1070
1074
  * the operation failed.
1071
1075
  */
1072
1076
  async saveResource(e) {
1073
- const r = ae(e, this), t = r == null;
1077
+ const r = ne(e, this), t = r == null;
1074
1078
  if (!r)
1075
1079
  throw "The REST resource store cannot create new resources on the server.";
1076
1080
  if (!this.currentResourceUrl)
@@ -1108,148 +1112,148 @@ const Ue = {
1108
1112
  });
1109
1113
  return (() => {
1110
1114
  const e = (r, t) => {
1111
- const l = R(r, t);
1112
- return ne.registerStore(l.$id, l), l;
1115
+ const l = S(r, t);
1116
+ return ce.registerStore(l.$id, l), l;
1113
1117
  };
1114
- return e.$id = R.$id, e;
1118
+ return e.$id = S.$id, e;
1115
1119
  })();
1116
- }, ne = new Ie(), Me = (f = {}) => {
1120
+ }, ce = new Ie(), Me = (f = {}) => {
1117
1121
  const {
1118
1122
  resourceClientId: s,
1119
- draftBatchId: R,
1123
+ draftBatchId: S,
1120
1124
  enabled: $,
1121
1125
  resourceType: e,
1122
1126
  options: r
1123
- } = f, t = I(void 0), l = I(s), u = I(R), c = I($ ?? !0), d = I([te(e)]), y = I(r), U = S(() => u.value), T = I(c.value), b = I(X()), q = S(
1124
- () => u.value == null && l.value != null && ne.getStore(l.value) != null
1125
- ), A = I(q.value), z = S(() => m("status", "Uninitialized"));
1126
- function B(n) {
1127
+ } = f, t = I(void 0), l = I(s), u = I(S), c = I($ ?? !0), d = I([se(e)]), y = I(r), U = R(() => u.value), L = I(c.value), z = I(H()), F = R(
1128
+ () => u.value == null && l.value != null && ce.getStore(l.value) != null
1129
+ ), A = I(F.value), B = R(() => m("status", "Uninitialized"));
1130
+ function O(o) {
1127
1131
  if (t.value)
1128
- return n(t.value);
1132
+ return o(t.value);
1129
1133
  }
1130
- async function g(n) {
1134
+ async function g(o) {
1131
1135
  if (t.value)
1132
- return await n(t.value);
1136
+ return await o(t.value);
1133
1137
  }
1134
- function m(n, h) {
1138
+ function m(o, h) {
1135
1139
  if (t.value)
1136
- return t.value[n];
1140
+ return t.value[o];
1137
1141
  if (h !== void 0)
1138
1142
  return h;
1139
1143
  throw "Attempted to use a REST resource store that has not been created, with no default value.";
1140
1144
  }
1141
- const E = (n = {}) => {
1145
+ const C = (o = {}) => {
1142
1146
  const {
1143
1147
  resourceClientId: h,
1144
- draftBatchId: F,
1145
- enabled: N,
1148
+ draftBatchId: N,
1149
+ enabled: b,
1146
1150
  resourceType: G,
1147
1151
  options: j
1148
- } = n;
1149
- l.value = h, u.value = F, c.value = N ?? !0, d.value = [te(G)], j != null && (y.value = j), b.value = X(), L(c.value);
1150
- }, L = async (n) => {
1151
- n != T.value && (T.value = n, n && x());
1152
- }, D = S(
1152
+ } = o;
1153
+ l.value = h, u.value = N, c.value = b ?? !0, d.value = [se(G)], j != null && (y.value = j), z.value = H(), w(c.value);
1154
+ }, w = async (o) => {
1155
+ o != L.value && (L.value = o, o && x());
1156
+ }, D = R(
1153
1157
  () => d.value[0].value || void 0
1154
- ), W = function(n) {
1155
- const h = a.get(n, "referencePathsToExpand"), F = D.value ? a.isFunction(h) ? h(D.value) : h || [] : [];
1158
+ ), W = function(o) {
1159
+ const h = a.get(o, "referencePathsToExpand"), N = D.value ? a.isFunction(h) ? h(D.value) : h || [] : [];
1156
1160
  return {
1157
- ...a.cloneDeep(n || {}),
1158
- referencePathsToExpand: F
1161
+ ...a.cloneDeep(o || {}),
1162
+ referencePathsToExpand: N
1159
1163
  };
1160
- }, H = S(() => W(y.value)), J = S(() => {
1164
+ }, J = R(() => W(y.value)), K = R(() => {
1161
1165
  if (!D.value)
1162
1166
  return null;
1163
1167
  if (!A.value)
1164
1168
  return !D.value || !D.value.collectionName ? null : U.value ? `${ee.config.apiBaseUrl}/draft-batches/${U.value}/${D.value.collectionName}` : `${ee.config.apiBaseUrl}/${D.value.collectionName}`;
1165
- }), K = S(() => {
1166
- if (D.value && J.value)
1169
+ }), Y = R(() => {
1170
+ if (D.value && K.value)
1167
1171
  return a.mergeWith(
1168
1172
  a.cloneDeep(Ue),
1169
- H.value,
1173
+ J.value,
1170
1174
  {
1171
1175
  idProperty: D.value.idProperty,
1172
- restCollectionUrl: J.value
1176
+ restCollectionUrl: K.value
1173
1177
  },
1174
- (n, h) => {
1175
- if (a.isArray(h) && h.length == 0 && (n == null || a.isArray(n)))
1178
+ (o, h) => {
1179
+ if (a.isArray(h) && h.length == 0 && (o == null || a.isArray(o)))
1176
1180
  return h;
1177
1181
  }
1178
1182
  );
1179
- }), p = I(0), k = S(
1183
+ }), p = I(0), _ = R(
1180
1184
  () => {
1181
- var n;
1182
- return p.value, l.value || D.value && ((n = D.value) == null ? void 0 : n.collectionName) && (U.value ? `draftBatches/${U.value}/${D.value.collectionName}/${b.value}` : `${D.value.collectionName}/${b.value}`) || null;
1185
+ var o;
1186
+ return p.value, l.value || D.value && ((o = D.value) == null ? void 0 : o.collectionName) && (U.value ? `draftBatches/${U.value}/${D.value.collectionName}/${z.value}` : `${D.value.collectionName}/${z.value}`) || null;
1183
1187
  }
1184
1188
  ), x = () => {
1185
- if (T.value) {
1186
- let n = !1;
1187
- return D.value && k.value && (t.value = ne.getStore(k.value), t.value ? n = !1 : K.value && (A.value = !1, t.value = xe(k.value, K.value)(), n = !0)), n;
1189
+ if (L.value) {
1190
+ let o = !1;
1191
+ return D.value && _.value && (t.value = ce.getStore(_.value), t.value ? o = !1 : Y.value && (A.value = !1, t.value = xe(_.value, Y.value)(), o = !0)), o;
1188
1192
  } else
1189
1193
  return !1;
1190
1194
  }, M = () => {
1191
- k.value && l.value == k.value ? (t.value = void 0, x()) : (t.value = void 0, p.value = p.value + 1, x());
1195
+ _.value && l.value == _.value ? (t.value = void 0, x()) : (t.value = void 0, p.value = p.value + 1, x());
1192
1196
  };
1193
- return C(U, (n, h) => {
1194
- a.isEqual(n, h) || M();
1195
- }), C(T, (n, h) => {
1196
- n != h && (n ? x() : t.value = void 0);
1197
- }), C(D, (n, h) => {
1198
- n && !h ? x() : !n && h || a.isEqual(n, h) || M();
1199
- }), C(K, (n, h) => {
1200
- a.isEqual(n, h) || M();
1201
- }), C(q, () => {
1202
- q.value || (A.value = !1);
1203
- }), C(k, () => x()), C(J, (n, h) => {
1204
- a.isEqual(n, h) || M();
1197
+ return T(U, (o, h) => {
1198
+ a.isEqual(o, h) || M();
1199
+ }), T(L, (o, h) => {
1200
+ o != h && (o ? x() : t.value = void 0);
1201
+ }), T(D, (o, h) => {
1202
+ o && !h ? x() : !o && h || a.isEqual(o, h) || M();
1203
+ }), T(Y, (o, h) => {
1204
+ a.isEqual(o, h) || M();
1205
+ }), T(F, () => {
1206
+ F.value || (A.value = !1);
1207
+ }), T(_, () => x()), T(K, (o, h) => {
1208
+ a.isEqual(o, h) || M();
1205
1209
  }), x(), {
1206
1210
  // Configuration
1207
- resourceClientId: k,
1211
+ resourceClientId: _,
1208
1212
  draftBatchId: U,
1209
- enabled: T,
1213
+ enabled: L,
1210
1214
  resourceType: D,
1211
1215
  // Status
1212
- status: z,
1216
+ status: B,
1213
1217
  // Resources loaded from the REST API
1214
- resource: S(() => z.value != "Uninitialized" ? (g((n) => n.ensureResourceLoaded()), m("resource", [])) : []),
1215
- resourceId: S(() => m("resourceId", null)),
1216
- resourceUrl: S(() => m("resourceUrl", null)),
1218
+ resource: R(() => B.value != "Uninitialized" ? (g((o) => o.ensureResourceLoaded()), m("resource", [])) : []),
1219
+ resourceId: R(() => m("resourceId", null)),
1220
+ resourceUrl: R(() => m("resourceUrl", null)),
1217
1221
  // Methods: Configuration
1218
- reconfigureClient: E,
1219
- setEnabled: L,
1220
- setResourceId: async (n) => await g(async (h) => await h.setResourceId(n)),
1221
- setResourceUrl: async (n) => await g(async (h) => await h.setResourceUrl(n)),
1222
+ reconfigureClient: C,
1223
+ setEnabled: w,
1224
+ setResourceId: async (o) => await g(async (h) => await h.setResourceId(o)),
1225
+ setResourceUrl: async (o) => await g(async (h) => await h.setResourceUrl(o)),
1222
1226
  // Methods: Status
1223
1227
  ensureStore: x,
1224
1228
  // Methods: Resource management
1225
- clear: () => B((n) => n.clear()),
1226
- ensureResourceLoaded: async () => await g(async (n) => n.ensureResourceLoaded()),
1227
- loadResource: async () => await g(async (n) => await n.loadResource()),
1229
+ clear: () => O((o) => o.clear()),
1230
+ ensureResourceLoaded: async () => await g(async (o) => o.ensureResourceLoaded()),
1231
+ loadResource: async () => await g(async (o) => await o.loadResource()),
1228
1232
  // Methods: Recording changes to the resource
1229
- checkForDeletedResource: async () => await g(async (n) => await n.checkForDeletedResource()) == !0,
1230
- recordDeletion: () => g((n) => n.recordDeletion()),
1231
- recordInsertion: (n) => g((h) => h.recordInsertion(n)),
1232
- recordUpdate: (n) => g((h) => h.recordUpdate(n)),
1233
- refreshResource: async () => await g(async (n) => await n.refreshResource()),
1233
+ checkForDeletedResource: async () => await g(async (o) => await o.checkForDeletedResource()) == !0,
1234
+ recordDeletion: () => g((o) => o.recordDeletion()),
1235
+ recordInsertion: (o) => g((h) => h.recordInsertion(o)),
1236
+ recordUpdate: (o) => g((h) => h.recordUpdate(o)),
1237
+ refreshResource: async () => await g(async (o) => await o.refreshResource()),
1234
1238
  // Methods: Modifying the resource
1235
- deleteResource: async () => await g(async (n) => await n.deleteResource()),
1236
- saveResource: async (n) => await g(async (h) => await h.saveResource(n)),
1239
+ deleteResource: async () => await g(async (o) => await o.deleteResource()),
1240
+ saveResource: async (o) => await g(async (h) => await h.saveResource(o)),
1237
1241
  // Methods: Custom API endpoints
1238
- makeCustomApiRequest: async (n) => await g(
1239
- async (h) => await h.makeCustomApiRequest(n)
1242
+ makeCustomApiRequest: async (o) => await g(
1243
+ async (h) => await h.makeCustomApiRequest(o)
1240
1244
  )
1241
1245
  };
1242
1246
  }, ee = {
1243
- config: { ...pe }
1247
+ config: { ...ye }
1244
1248
  };
1245
1249
  function je(f) {
1246
- ee.config = a.merge({}, pe, f);
1250
+ ee.config = a.merge({}, ye, f);
1247
1251
  }
1248
1252
  export {
1249
- ke as ApiClientError,
1253
+ _e as ApiClientError,
1250
1254
  Qe as clearAllRestCollections,
1251
1255
  je as initRestClient,
1252
1256
  ee as restClient,
1253
- Be as useRestCollection,
1257
+ Oe as useRestCollection,
1254
1258
  Me as useRestResource
1255
1259
  };
@@ -1 +1 @@
1
- (function(v,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):(v=typeof globalThis<"u"?globalThis:v||self,r(v["rest-client-vue"]={},v._,v.uuid,v.Vue,v.axios,v.jsog,v.stringify,v.pinia))})(this,function(v,r,I,a,$,ne,J,ae){"use strict";var Pe=Object.defineProperty;var Fe=(v,r,I)=>r in v?Pe(v,r,{enumerable:!0,configurable:!0,writable:!0,value:I}):v[r]=I;var le=(v,r,I)=>(Fe(v,typeof r!="symbol"?r+"":r,I),I),Ne=(v,r,I)=>{if(!r.has(v))throw TypeError("Cannot "+I)};var j=(v,r,I)=>(Ne(v,r,"read from private field"),I?I.call(v):r.get(v)),Ie=(v,r,I)=>{if(r.has(v))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(v):r.set(v,I)};var A;const oe={apiBaseUrl:"",useVueLogger:!1};class we extends Error{constructor(C,q=void 0,e=void 0){super(C);le(this,"context");le(this,"innerError");this.context=q,this.innerError=e}}class ce{constructor(){Ie(this,A,{})}clearAllStores(){for(const n in j(this,A))j(this,A)[n].clear()}destroyStore(n){j(this,A)[n]&&(j(this,A)[n].$dispose(),delete j(this,A)[n])}getStore(n){return j(this,A)[n]}registerStore(n,C){j(this,A)[n]=C}}A=new WeakMap;function g(w,n){return r.get(w,(n==null?void 0:n.idProperty)||"_id")}function De(w,n){var C;return w&&((C=n.filter)!=null&&C.resourceIds)&&!n.order?n.filter.resourceIds.map(q=>w.find(e=>g(e,n)==q)).filter(q=>q!=null):w}const ue={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.orderInBatch"},"desc"]]},K={resources:[],status:"NotLoaded",selection:[],detailSelection:[],invalidResources:[],transientData:{}},te={editingDetailSelection:!1,batchSaveAttempted:!1,editors:[],listNavigators:{}},Ee=(w,n)=>{n=r.merge({},ue,n);const C=ae.defineStore(w,{state:()=>({idProperty:n.idProperty,filter:n.filter,order:n.order||null,referencePathsToExpand:n.referencePathsToExpand||null,...K,...te}),getters:{fixedQueryParams:e=>{var l,d,u,h;const s={};(l=e.filter)!=null&&l.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 p=t.length==1?t[0]:{and:t};s.q=J(p)}return e.order&&(s.o=J(e.order)),e.referencePathsToExpand&&(s.r=J(e.referencePathsToExpand)),s}},actions:{reset(){for(const e in K)this[e]=K[e];for(const e in te)this[e]=te[e]},resetRetainingTransientData(){if(n.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.selection=[],this.detailSelection=[],this.invalidResources=[],this.editingDetailSelection=!1)},async setQuery(e){var s,t;if(!r.isEqual(e,(s=this.filter)==null?void 0:s.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 s=r.cloneDeep(this.filter)||{};e!=null?s.resourceIds=e:r.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=I.v4();this._loadId=s,await this._loadResources(0,s,e)},async _loadResources(e,s,t){var b,F,O,k,Q;const l=e==0;if(this.status=l?"Loading":"LoadingMore",this._loadOffset=e,((b=this.filter)==null?void 0:b.query)===!1){this.resources=[];return}const d=this.fixedQueryParams,u=r.cloneDeep(d),h=l?(F=this.filter)!=null&&F.resourceIds&&!this.order?null:t.firstPageSize||((O=n.loading)==null?void 0:O.firstPageSize)||t.pageSize||((k=n.loading)==null?void 0:k.pageSize)||null:t.pageSize||((Q=n.loading)==null?void 0:Q.pageSize)||null,p=h!=null||n.limit!=null?r.min(r.filter([h,n.limit],R=>R!=null)):void 0;p!=null?(u.offset=e,u.limit=p):e!=0&&(u.offset=e);const D=r.map(u,(R,m)=>R!=null?`${encodeURIComponent(m)}=${encodeURIComponent(R)}`:null).filter(R=>R!=null).join("&"),T=r.isEmpty(D)?n.restCollectionUrl:`${n.restCollectionUrl}?${D}`;try{const R=await $.get(T),m=this.fixedQueryParams;if(s!=this._loadId||e!=this._loadOffset||!r.isEqual(d,m))console.log(`Discarding resources fetched by obsolete query from ${n.restCollectionUrl}.`);else{const E=ne.decode(r.get(R,"data.data",[])),L=(l?0:this.resources.length)+E.length,y=p==null||E.length<p||n.limit&&L>=n.limit;console.log(`Loaded ${E.length}${l?"":" more"} resources from ${n.restCollectionUrl}`),l&&(this.resources=[]);const X=[...this.resources,...E.map(Z=>Object.freeze(Z))];this.resources=De(X,this),this.status=y?"Loaded":"LoadingMore",y||this._loadResources(this.resources.length,s,t)}}catch(R){console.log(`Error while loading resources (URL="${T}"):`,R),this.clearRetainingTransientData(),this.status="Failed"}},async checkForDeletedResource(e){let s;try{s=await $.get(`${n.restCollectionUrl}/${e}`)}catch(t){$.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(l=>g(l,this)==e);t>=0&&this.resources.splice(t,1),t=this.selection.findIndex(l=>g(l,this)==e),t>=0&&this.selection.splice(t,1),t=this.detailSelection.findIndex(l=>g(l,this)==e),t>=0&&(this.detailSelection.splice(t,1),this.detailSelection.length==0&&(this.editingDetailSelection=((s=n.detail)==null?void 0:s.autoEdit)||!1)),n.limitTransientDataToLocalCollection&&delete this.transientData[e]}},recordInsertion(e,{insertAtBeginning:s,transientData:t}={}){var l;if(["Loaded","LoadingMore"].includes(this.status)){const d=Object.freeze(e);s?this.resources.unshift(d):this.resources.push(d),(l=n.detail)!=null&&l.autoFromSingleInsertion&&(this.detailSelection.length==0||this.detailSelection.length==1&&g(this.detailSelection[0],this)==null)&&(this.detailSelection=[d],this.editingDetailSelection=n.detail.autoEdit);const u=g(e,this);u&&(t===void 0?delete this.transientData[u]:this.transientData[u]=t)}},recordUpdate(e){const s=g(e,this);if(s&&["Loaded","LoadingMore"].includes(this.status)){const t=Object.freeze(e);let l=this.resources.findIndex(d=>g(d,this)==s);l>=0&&(this.resources[l]=t),l=this.selection.findIndex(d=>g(d,this)==s),l>=0&&(this.selection[l]=t),l=this.detailSelection.findIndex(d=>g(d,this)==s),l>=0&&(this.detailSelection[l]=t)}},async refreshResource(e){if(e){const s={};this.referencePathsToExpand&&(s.r=J(this.referencePathsToExpand));const t=r.map(s,(u,h)=>u!=null?`${encodeURIComponent(h)}=${encodeURIComponent(u)}`:null).filter(u=>u!=null).join("&"),l=r.isEmpty(t)?`${n.restCollectionUrl}/${e}`:`${n.restCollectionUrl}/${e}?${t}`,d=await $.get(l);if(d.status==200){const u=d.data;return this.recordUpdate(u),u}}return null},addResource(e={}){this.detailSelection=[r.omit(r.merge({},e),this.idProperty)],this.editingDetailSelection=!0},async deleteResource(e){if((await $.delete(`${n.restCollectionUrl}/${e}`)).status==200&&["Loaded","LoadingMore"].includes(this.status)){let t=this.resources.findIndex(l=>g(l,this)==e);t>=0&&this.resources.splice(t,1),t=this.selection.findIndex(l=>g(l,this)==e),t>=0&&this.selection.splice(t,1),t=this.detailSelection.findIndex(l=>g(l,this)==e),t>=0&&(this.detailSelection.splice(t,1),this.detailSelection.length==0&&(this.editingDetailSelection=n.detail.autoEdit)),n.limitTransientDataToLocalCollection&&delete this.transientData[e]}},async saveResource(e){const s=g(e,this),t=s==null,l=await $({method:t?"post":"put",url:t?n.restCollectionUrl:`${n.restCollectionUrl}/${s}`,data:e});if(l.status==200){const d=l.data,u=g(d,this),h=u?await this.refreshResource(u):null;return t&&this.recordInsertion(h||Object.freeze(d)),h||d}return null},async saveResources(e){const s=await $({method:"put",url:n.restCollectionUrl,data:e});if(s.status==200){const t=s.data||[],l=[];for(const[d,u]of t.entries()){const h=g(e[d],this)==null,p=g(u,this),D=p?await this.refreshResource(p):null;h&&this.recordInsertion(D||u),l.push(D||Object.freeze(u))}return l}return[]},clearTransientData(){this.transientData={}},setInvalidResourceIds(e){r.isEqual(e,this.invalidResources.map(s=>g(s,this)))||(this.invalidResources=e.map(s=>this.resources.find(t=>g(t,this)==s)).filter(s=>s!=null))},setTransientDataForResources(e){const{transientData:s,merge:t=!0}=e;t?r.merge(this.transientData,s):r.assign(this.transientData,s)},clearSelection(){this.setSelection([])},deselectResources(e){const s=this.selection.map(t=>g(t,this)).filter(t=>t!=null&&!e.includes(t));this.setSelection(s)},selectResources(e,s){const{addToSelection:t,edit:l}=s||{},d=this.selection.map(h=>g(h,this));let u=e;if(t){const h=r.difference(e,d);h.length>0&&(u=d.concat(h).filter(p=>p!=null))}r.isEqual(d,u)||this.setSelection(u,l)},setSelection(e,s){if(!r.isEqual(e,this.selection.map(t=>g(t,this)))){let t=!0;if(this.editors.length>0){if(n.detail.autoFromSingleSelection&&this.selection.length==1)t=!1;else if(n.detail.autoFromMultipleSelection&&n.detail.allowMultiple&&this.selection.length>1)t=!1;else if(n.detail.constrainToSelection){const l=this.selection.map(h=>g(h,this)),u=this.detailSelection.map(h=>g(h,this)).filter(h=>l.includes(h));this.detailSelection.filter(h=>!u.includes(g(h,this))).length>0&&(t=!1)}}if(!t)return;if(this.selection=e.map(l=>this.resources.find(d=>g(d,this)==l)).filter(l=>l!=null),n.detail.autoFromSingleSelection&&this.selection.length==1){const l=this.selection[0];(this.detailSelection.length!=1||g(this.detailSelection[0],this)!=g(l,this))&&(this.detailSelection=[l])}else if(n.detail.autoFromMultipleSelection&&n.detail.allowMultiple&&this.selection.length>1)r.isEqual(this.selection.map(l=>g(l,this)),this.detailSelection.map(l=>g(l,this)))||(this.detailSelection=r.clone(this.selection));else if(n.detail.constrainToSelection){const l=this.selection.map(h=>g(h,this)),d=this.detailSelection.map(h=>g(h,this)),u=d.filter(h=>l.includes(h));r.isEqual(u,d)||(this.detailSelection=this.detailSelection.filter(h=>u.includes(g(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(l=>g(l,this)),t=this.detailSelection.map(l=>g(l,this));r.isEqual(s,t)||(this.detailSelection=r.clone(this.selection)),this.detailSelection.length==0?this.editingDetailSelection=!1:this.editingDetailSelection=e!==void 0?e:this.editingDetailSelection||n.detail.autoEdit}},deregisterEditor(e){r.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 l=C(s,t);return ee.registerStore(l.$id,l),l};return e.$id=C.$id,e})()},ee=new ce,Ue=(w={})=>{var he,fe,ge,ve;const{collectionId:n,draftBatchId:C,enabled:q,resourceType:e,options:s}=w,t=a.ref(void 0),l=a.ref(n),d=a.ref(C),u=a.ref(q??!0),h=a.ref([a.toRef(e)]),p=a.ref(s),D=a.computed(()=>d.value),T=a.ref(u.value),b=a.ref(I.v4()),F=a.ref((fe=(he=p.value)==null?void 0:he.filter)==null?void 0:fe.resourceIds),O=a.ref((ve=(ge=p.value)==null?void 0:ge.filter)==null?void 0:ve.query),k=a.computed(()=>d.value==null&&l.value!=null&&ee.getStore(l.value)!=null),Q=a.ref(k.value),R=a.computed(()=>L("status","Uninitialized"));function m(i){if(t.value)return i(t.value)}async function E(i){if(t.value)return await i(t.value)}function L(i,c){if(t.value)return t.value[i];if(c!==void 0)return c;throw"Attempted to use a REST collection store that has not been created, with no default value."}const y=(i={})=>{var me,pe,Se,ye;const{collectionId:c,draftBatchId:U,enabled:z,resourceType:re,options:Re}=i;l.value=c,d.value=U,u.value=z??!0,h.value=[a.toRef(re)],Re!=null&&(p.value=Re,F.value=(pe=(me=p.value)==null?void 0:me.filter)==null?void 0:pe.resourceIds,O.value=(ye=(Se=p.value)==null?void 0:Se.filter)==null?void 0:ye.query),b.value=I.v4(),X(u.value)},X=async i=>{i!=T.value&&(T.value=i,i&&(_(),x()))},Z=async i=>{F.value=i,await E(async c=>await c.setFilterResourceIds(F.value||null))},V=async i=>{if(O.value=i,R.value!="Uninitialized"){const c=i,U=a.computed(()=>r.isFunction(c)?S.value?c(S.value):null:c);await E(z=>z.setQuery(U.value||null))}},_=()=>{p.value=r.merge({},p.value||{},{filter:{resourceIds:F.value,query:O.value}})},S=a.computed(()=>h.value[0].value||void 0),B=function(i){const c=r.get(i,"filter.query"),U=r.get(i,"referencePathsToExpand"),z=r.isFunction(c)?c(S.value):c,re=S.value?r.isFunction(U)?U(S.value):U||[]:[];return{...r.cloneDeep(i||{}),filter:{...r.cloneDeep((i==null?void 0:i.filter)||{}),query:z},referencePathsToExpand:re}},P=a.computed(()=>B(p.value)),M=a.computed(()=>{if(!S.value)return null;if(P.value.restCollectionUrl!==void 0)return P.value.restCollectionUrl;if(!Q.value)return!S.value||!S.value.collectionName?null:D.value?`${G.config.apiBaseUrl}/draft-batches/${D.value}/${S.value.collectionName}`:`${G.config.apiBaseUrl}/${S.value.collectionName}`}),o=a.computed(()=>{var i;if(S.value)return r.mergeWith(r.cloneDeep(ue),P.value,{idProperty:(i=S.value)==null?void 0:i.idProperty,restCollectionUrl:M.value||""},(c,U)=>{if(r.isArray(U)&&U.length==0&&(c==null||r.isArray(c)))return U})}),f=a.ref(0),N=a.computed(()=>{var i;return f.value,l.value||S.value&&((i=S.value)==null?void 0:i.collectionName)&&(D.value?`draftBatches/${D.value}/${S.value.collectionName}/${b.value}`:`${S.value.collectionName}/${b.value}`)||null}),x=()=>{if(T.value){let i=!1;return S.value&&N.value&&(t.value=ee.getStore(N.value),t.value?i=!1:o.value&&(Q.value=!1,t.value=Ee(N.value,o.value)(),i=!0)),i}else return!1},H=()=>{N.value&&l.value==N.value?(t.value=void 0,x()):(t.value=void 0,f.value=f.value+1,x())};a.watch(D,(i,c)=>{r.isEqual(i,c)||H()}),a.watch(T,(i,c)=>{i!=c&&(i?x():t.value=void 0)}),a.watch(S,(i,c)=>{i&&!c?x():!i&&c||r.isEqual(i,c)||H()}),a.watch(o,(i,c)=>{r.isEqual(i,c)||H()}),a.watch(k,()=>{k.value||(Q.value=!1)}),a.watch(N,()=>x()),a.watch(M,(i,c)=>{r.isEqual(i,c)||H()});const W=[],qe=function(i){R.value!="Uninitialized"?a.nextTick(i):W.push(i)};return a.watch(R,(i,c)=>{if(i!="Uninitialized"&&c=="Uninitialized"){const U=r.clone(W);W.splice(0,W.length);for(const z of U)z()}}),x(),{collectionId:N,draftBatchId:D,resourceType:S,enabled:T,status:R,batchSaveAttempted:a.computed(()=>L("batchSaveAttempted",!1)),listNavigators:a.computed(()=>L("listNavigators",!1)),invalidResources:a.computed(()=>L("invalidResources",[])),resources:a.computed(()=>R.value!="Uninitialized"?(E(i=>i.ensureCollectionLoaded()),L("resources",[])):[]),transientData:a.computed(()=>L("transientData",[])),detailSelection:a.computed(()=>L("detailSelection",[])),editingDetailSelection:a.computed(()=>L("editingDetailSelection",!1)),selection:a.computed(()=>L("selection",[])),reconfigureCollection:y,setEditingDetailSelection:i=>m(c=>c.setEditingDetailSelection(i)),setEnabled:X,setFilterResourceIds:Z,setQuery:V,ensureStore:x,setBatchSaveAttempted:i=>m(c=>c.setBatchSaveAttempted(i)),clear:()=>m(i=>i.clear()),ensureCollectionLoaded:async()=>await E(async i=>i.ensureCollectionLoaded()),loadResources:async()=>await E(async i=>await i.loadResources()),addResource:i=>m(c=>c.addResource(i)),checkForDeletedResource:async i=>await E(async c=>await c.checkForDeletedResource(i))==!0,recordDeletion:i=>m(c=>c.recordDeletion(i)),recordInsertion:(i,{insertAtBeginning:c=!1,transientData:U=void 0}={})=>m(z=>z.recordInsertion(i,{insertAtBeginning:c,transientData:U})),recordUpdate:i=>m(c=>c.recordUpdate(i)),refreshResource:async i=>await E(async c=>await c.refreshResource(i)),deleteResource:async i=>await E(async c=>await c.deleteResource(i)),saveResource:async i=>await E(async c=>await c.saveResource(i)),saveResources:async i=>await E(async c=>await c.saveResources(i)),clearTransientData:()=>m(i=>i.clearTransientData()),setInvalidResourceIds:i=>m(c=>c.setInvalidResourceIds(i)),setTransientDataForResources:i=>m(c=>c.setTransientDataForResources(i)),clearSelection:()=>m(i=>i.clearSelection()),deselectResources:i=>m(c=>c.deselectResources(i)),selectResources:(i,c)=>m(U=>U.selectResources(i,c)),hideDetail:()=>m(i=>i.hideDetail()),deregisterEditor:i=>m(c=>c.deregisterEditor(i)),registerEditor:i=>m(c=>c.registerEditor(i)),deregisterListNavigator:i=>m(c=>c.deregisterListNavigator(i)),registerListNavigator:i=>m(c=>c.registerListNavigator(i)),onItemsStoreReady:qe}},Ce=()=>{ee.clearAllStores()};function ie(w,n){return r.get(w,(n==null?void 0:n.idProperty)||"_id")}const de={idProperty:"_id"},Y={resource:null,status:"NotLoaded"},Te=(w,n)=>{n=r.merge({},de,n);const C=ae.defineStore(w,{state:()=>({idProperty:n.idProperty,resourceId:n.resourceId||null,resourceUrl:n.resourceUrl||null,referencePathsToExpand:n.referencePathsToExpand||null,...Y}),getters:{currentResourceUrl:e=>e.resourceUrl||(n.restCollectionUrl&&e.resourceId?`${n.restCollectionUrl}/${e.resourceId}`:null)||n.restCollectionUrl||null,fixedQueryParams:e=>{const s={};return e.referencePathsToExpand&&(s.r=J(e.referencePathsToExpand)),s}},actions:{reset(){for(const e in Y)this[e]=Y[e]},async setResourceId(e){const s=this.currentResourceUrl;this.resourceId=e,!r.isEqual(this.currentResourceUrl,s)&&this.status!="NotLoaded"&&await this.loadResource()},async setResourceUrl(e){const s=this.currentResourceUrl;this.resourceUrl=e,!r.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=I.v4();if(this._loadId=e,this.currentResourceUrl){this.status="Loading";const s=this.fixedQueryParams,t=r.cloneDeep(s),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(s,h)?console.log(`Discarding resource fetched by obsolete query from ${d}.`):(this.resource=ne.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(s){$.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=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 s=ie(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 l=await $({method:t?"post":"put",url:this.currentResourceUrl,data:e});if(l.status==200){const d=l.data,u=await this.refreshResource();return t&&this.recordInsertion(u||d),u||Object.freeze(d)}return null},async makeCustomApiRequest(e){const{method:s,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:s||"get",url:u,data:d});return h.status>=200&&h.status<300?h.data:null}}});return(()=>{const e=(s,t)=>{const l=C(s,t);return se.registerStore(l.$id,l),l};return e.$id=C.$id,e})()},se=new ce,Le=(w={})=>{const{resourceClientId:n,draftBatchId:C,enabled:q,resourceType:e,options:s}=w,t=a.ref(void 0),l=a.ref(n),d=a.ref(C),u=a.ref(q??!0),h=a.ref([a.toRef(e)]),p=a.ref(s),D=a.computed(()=>d.value),T=a.ref(u.value),b=a.ref(I.v4()),F=a.computed(()=>d.value==null&&l.value!=null&&se.getStore(l.value)!=null),O=a.ref(F.value),k=a.computed(()=>m("status","Uninitialized"));function Q(o){if(t.value)return o(t.value)}async function R(o){if(t.value)return await o(t.value)}function m(o,f){if(t.value)return t.value[o];if(f!==void 0)return f;throw"Attempted to use a REST resource store that has not been created, with no default value."}const E=(o={})=>{const{resourceClientId:f,draftBatchId:N,enabled:x,resourceType:H,options:W}=o;l.value=f,d.value=N,u.value=x??!0,h.value=[a.toRef(H)],W!=null&&(p.value=W),b.value=I.v4(),L(u.value)},L=async o=>{o!=T.value&&(T.value=o,o&&P())},y=a.computed(()=>h.value[0].value||void 0),X=function(o){const f=r.get(o,"referencePathsToExpand"),N=y.value?r.isFunction(f)?f(y.value):f||[]:[];return{...r.cloneDeep(o||{}),referencePathsToExpand:N}},Z=a.computed(()=>X(p.value)),V=a.computed(()=>{if(!y.value)return null;if(!O.value)return!y.value||!y.value.collectionName?null:D.value?`${G.config.apiBaseUrl}/draft-batches/${D.value}/${y.value.collectionName}`:`${G.config.apiBaseUrl}/${y.value.collectionName}`}),_=a.computed(()=>{if(y.value&&V.value)return r.mergeWith(r.cloneDeep(de),Z.value,{idProperty:y.value.idProperty,restCollectionUrl:V.value},(o,f)=>{if(r.isArray(f)&&f.length==0&&(o==null||r.isArray(o)))return f})}),S=a.ref(0),B=a.computed(()=>{var o;return S.value,l.value||y.value&&((o=y.value)==null?void 0:o.collectionName)&&(D.value?`draftBatches/${D.value}/${y.value.collectionName}/${b.value}`:`${y.value.collectionName}/${b.value}`)||null}),P=()=>{if(T.value){let o=!1;return y.value&&B.value&&(t.value=se.getStore(B.value),t.value?o=!1:_.value&&(O.value=!1,t.value=Te(B.value,_.value)(),o=!0)),o}else return!1},M=()=>{B.value&&l.value==B.value?(t.value=void 0,P()):(t.value=void 0,S.value=S.value+1,P())};return a.watch(D,(o,f)=>{r.isEqual(o,f)||M()}),a.watch(T,(o,f)=>{o!=f&&(o?P():t.value=void 0)}),a.watch(y,(o,f)=>{o&&!f?P():!o&&f||r.isEqual(o,f)||M()}),a.watch(_,(o,f)=>{r.isEqual(o,f)||M()}),a.watch(F,()=>{F.value||(O.value=!1)}),a.watch(B,()=>P()),a.watch(V,(o,f)=>{r.isEqual(o,f)||M()}),P(),{resourceClientId:B,draftBatchId:D,enabled:T,resourceType:y,status:k,resource:a.computed(()=>k.value!="Uninitialized"?(R(o=>o.ensureResourceLoaded()),m("resource",[])):[]),resourceId:a.computed(()=>m("resourceId",null)),resourceUrl:a.computed(()=>m("resourceUrl",null)),reconfigureClient:E,setEnabled:L,setResourceId:async o=>await R(async f=>await f.setResourceId(o)),setResourceUrl:async o=>await R(async f=>await f.setResourceUrl(o)),ensureStore:P,clear:()=>Q(o=>o.clear()),ensureResourceLoaded:async()=>await R(async o=>o.ensureResourceLoaded()),loadResource:async()=>await R(async o=>await o.loadResource()),checkForDeletedResource:async()=>await R(async o=>await o.checkForDeletedResource())==!0,recordDeletion:()=>R(o=>o.recordDeletion()),recordInsertion:o=>R(f=>f.recordInsertion(o)),recordUpdate:o=>R(f=>f.recordUpdate(o)),refreshResource:async()=>await R(async o=>await o.refreshResource()),deleteResource:async()=>await R(async o=>await o.deleteResource()),saveResource:async o=>await R(async f=>await f.saveResource(o)),makeCustomApiRequest:async o=>await R(async f=>await f.makeCustomApiRequest(o))}},G={config:{...oe}};function $e(w){G.config=r.merge({},oe,w)}v.ApiClientError=we,v.clearAllRestCollections=Ce,v.initRestClient=$e,v.restClient=G,v.useRestCollection=Ue,v.useRestResource=Le,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});
1
+ (function(v,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("lodash"),require("uuid"),require("vue"),require("axios"),require("jsog"),require("json-stringify-deterministic"),require("pinia")):typeof define=="function"&&define.amd?define(["exports","lodash","uuid","vue","axios","jsog","json-stringify-deterministic","pinia"],s):(v=typeof globalThis<"u"?globalThis:v||self,s(v["rest-client-vue"]={},v._,v.uuid,v.Vue,v.axios,v.jsog,v.stringify,v.pinia))})(this,function(v,s,I,o,$,ae,G,ce){"use strict";var Pe=Object.defineProperty;var Fe=(v,s,I)=>s in v?Pe(v,s,{enumerable:!0,configurable:!0,writable:!0,value:I}):v[s]=I;var oe=(v,s,I)=>(Fe(v,typeof s!="symbol"?s+"":s,I),I),Ne=(v,s,I)=>{if(!s.has(v))throw TypeError("Cannot "+I)};var j=(v,s,I)=>(Ne(v,s,"read from private field"),I?I.call(v):s.get(v)),Ie=(v,s,I)=>{if(s.has(v))throw TypeError("Cannot add the same private member more than once");s instanceof WeakSet?s.add(v):s.set(v,I)};var A;const ue={apiBaseUrl:"",useVueLogger:!1};class we extends Error{constructor(E,q=void 0,e=void 0){super(E);oe(this,"context");oe(this,"innerError");this.context=q,this.innerError=e}}class de{constructor(){Ie(this,A,{})}clearAllStores(){for(const n in j(this,A))j(this,A)[n].clear()}destroyStore(n){j(this,A)[n]&&(j(this,A)[n].$dispose(),delete j(this,A)[n])}getStore(n){return j(this,A)[n]}registerStore(n,E){j(this,A)[n]=E}}A=new WeakMap;function g(w,n){return s.get(w,(n==null?void 0:n.idProperty)||"_id")}function De(w,n){var E;return w&&((E=n.filter)!=null&&E.resourceIds)&&!n.order?n.filter.resourceIds.map(q=>w.find(e=>g(e,n)==q)).filter(q=>q!=null):w}const he={detail:{allowMultiple:!0,autoEdit:!1,autoFromMultipleSelection:!0,autoFromSingleInsertion:!0,autoFromSingleSelection:!0,constrainToSelection:!0},filter:{namedFilter:null,query:null,resourceIds:null},idProperty:"_id",limit:5e3,limitTransientDataToLocalCollection:!0,loading:{firstPageSize:500,pageSize:5e3},order:[[{path:"history.creation.timestamp"},"desc"],[{path:"history.creation.indexInBatch"},"desc"]]},K={resources:[],remoteCollectionSize:null,status:"NotLoaded",selection:[],detailSelection:[],invalidResources:[],transientData:{}},se={editingDetailSelection:!1,batchSaveAttempted:!1,editors:[],listNavigators:{}},Ce=(w,n)=>{n=s.merge({},he,n);const E=ce.defineStore(w,{state:()=>({idProperty:n.idProperty,filter:n.filter,order:n.order||null,propertyBlacklist:n.propertyBlacklist||null,referencePathsToExpand:n.referencePathsToExpand||null,restCollectionUrl:n.restCollectionUrl,...K,...se}),getters:{fixedQueryParams:e=>{var l,d,u,h;const r={};(l=e.filter)!=null&&l.namedFilter&&(r.namedFilter=e.filter.namedFilter);const t=[];if((d=e.filter)!=null&&d.resourceIds&&t.push({l:{path:e.idProperty},r:{constant:e.filter.resourceIds},operator:"in"}),(u=e.filter)!=null&&u.query&&t.push((h=e.filter)==null?void 0:h.query),t.length>0){const S=t.length==1?t[0]:{and:t};r.q=G(S)}return e.order&&(r.o=G(e.order)),e.propertyBlacklist&&(r.ex=G(e.propertyBlacklist)),e.referencePathsToExpand&&(r.r=G(e.referencePathsToExpand)),r}},actions:{reset(){for(const e in K)this[e]=K[e];for(const e in se)this[e]=se[e]},resetRetainingTransientData(){if(n.limitTransientDataToLocalCollection)this.reset();else{const e=this.transientData;this.reset(),this.transientData=e}},setEditingDetailSelection(e){this.editingDetailSelection=e},setFilter(e){s.isEqual(e,this.filter)||(this.filter=e,this.status="NotLoaded",this.resources=[],this.remoteCollectionSize=null,this.selection=[],this.detailSelection=[],this.invalidResources=[],this.editingDetailSelection=!1)},async setQuery(e){var r,t;if(!s.isEqual(e,(r=this.filter)==null?void 0:r.query)&&(e!=null||((t=this.filter)==null?void 0:t.query)!=null)){const l=s.cloneDeep(this.filter)||{};e!==null?l.query=e:s.unset(l,"query");const d=this.status;this.setFilter(l),d!="NotLoaded"&&await this.loadResources()}},async setFilterResourceIds(e){if(!s.isEqual(e,s.get(this.filter,"resourceIds"))){const r=s.cloneDeep(this.filter)||{};e!=null?r.resourceIds=e:s.unset(r,"resourceIds");const t=this.status;this.setFilter(r),t!="NotLoaded"&&await this.loadResources()}},setBatchSaveAttempted(e){e!=this.batchSaveAttempted&&(this.batchSaveAttempted=e)},clear(){for(const e in K)this[e]=K[e]},clearRetainingTransientData(){if(n.limitTransientDataToLocalCollection)this.reset();else{const e=this.transientData;this.reset(),this.transientData=e}},async ensureCollectionLoaded(){["Loaded","Loading","LoadingMore","Failed"].includes(this.status)||await this.loadResources()},async loadResources(e={}){this.resetRetainingTransientData();const r=I.v4();this._loadId=r,await this._loadResources(0,r,e)},async _loadResources(e,r,t){var b,N,k,B,Q;const l=e==0;if(this.status=l?"Loading":"LoadingMore",this._loadOffset=e,((b=this.filter)==null?void 0:b.query)===!1){this.resources=[],this.remoteCollectionSize=0;return}const d=this.fixedQueryParams,u=s.cloneDeep(d),h=l?(N=this.filter)!=null&&N.resourceIds&&!this.order?null:t.firstPageSize||((k=n.loading)==null?void 0:k.firstPageSize)||t.pageSize||((B=n.loading)==null?void 0:B.pageSize)||null:t.pageSize||((Q=n.loading)==null?void 0:Q.pageSize)||null,S=h!=null||n.limit!=null?s.min(s.filter([h,n.limit],p=>p!=null)):void 0;S!=null?(u.offset=e,u.limit=S):e!=0&&(u.offset=e);const D=s.map(u,(p,m)=>p!=null?`${encodeURIComponent(m)}=${encodeURIComponent(p)}`:null).filter(p=>p!=null).join("&"),L=s.isEmpty(D)?n.restCollectionUrl:`${n.restCollectionUrl}?${D}`;try{const p=await $.get(L),m=this.fixedQueryParams;if(r!=this._loadId||e!=this._loadOffset||!s.isEqual(d,m))console.log(`Discarding resources fetched by obsolete query from ${n.restCollectionUrl}.`);else{const C=ae.decode(s.get(p,"data.data",[])),T=(l?0:this.resources.length)+C.length,y=S==null||C.length<S||n.limit&&T>=n.limit;console.log(`Loaded ${C.length}${l?"":" more"} resources from ${n.restCollectionUrl}`),l&&(this.resources=[]);const H=[...this.resources,...C.map(Z=>Object.freeze(Z))];this.resources=De(H,this),s.get(p,"data.totalCollectionSize")?this.remoteCollectionSize=s.get(p,"data.totalCollectionSize"):this.remoteCollectionSize=null,this.status=y?"Loaded":"LoadingMore",y||this._loadResources(this.resources.length,r,t)}}catch(p){console.log(`Error while loading resources (URL="${L}"):`,p),this.clearRetainingTransientData(),this.status="Failed"}},async checkForDeletedResource(e){let r;try{r=await $.get(`${n.restCollectionUrl}/${e}`)}catch(t){$.isAxiosError(t)&&(r=t.response)}return r&&r.status==404?(this.recordDeletion(e),!0):!1},recordDeletion(e){var r;if(["Loaded","LoadingMore"].includes(this.status)){let t=this.resources.findIndex(l=>g(l,this)==e);t>=0&&this.resources.splice(t,1),t=this.selection.findIndex(l=>g(l,this)==e),t>=0&&this.selection.splice(t,1),t=this.detailSelection.findIndex(l=>g(l,this)==e),t>=0&&(this.detailSelection.splice(t,1),this.detailSelection.length==0&&(this.editingDetailSelection=((r=n.detail)==null?void 0:r.autoEdit)||!1)),n.limitTransientDataToLocalCollection&&delete this.transientData[e]}},recordInsertion(e,{insertAtBeginning:r,transientData:t}={}){var l;if(["Loaded","LoadingMore"].includes(this.status)){const d=Object.freeze(e);r?this.resources.unshift(d):this.resources.push(d),(l=n.detail)!=null&&l.autoFromSingleInsertion&&(this.detailSelection.length==0||this.detailSelection.length==1&&g(this.detailSelection[0],this)==null)&&(this.detailSelection=[d],this.editingDetailSelection=n.detail.autoEdit);const u=g(e,this);u&&(t===void 0?delete this.transientData[u]:this.transientData[u]=t)}},recordUpdate(e){const r=g(e,this);if(r&&["Loaded","LoadingMore"].includes(this.status)){const t=Object.freeze(e);let l=this.resources.findIndex(d=>g(d,this)==r);l>=0&&(this.resources[l]=t),l=this.selection.findIndex(d=>g(d,this)==r),l>=0&&(this.selection[l]=t),l=this.detailSelection.findIndex(d=>g(d,this)==r),l>=0&&(this.detailSelection[l]=t)}},async refreshResource(e){if(e){const r={};this.referencePathsToExpand&&(r.r=G(this.referencePathsToExpand));const t=s.map(r,(u,h)=>u!=null?`${encodeURIComponent(h)}=${encodeURIComponent(u)}`:null).filter(u=>u!=null).join("&"),l=s.isEmpty(t)?`${n.restCollectionUrl}/${e}`:`${n.restCollectionUrl}/${e}?${t}`,d=await $.get(l);if(d.status==200){const u=d.data;return this.recordUpdate(u),u}}return null},addResource(e={}){this.detailSelection=[s.omit(s.merge({},e),this.idProperty)],this.editingDetailSelection=!0},async deleteResource(e){if((await $.delete(`${n.restCollectionUrl}/${e}`)).status==200&&["Loaded","LoadingMore"].includes(this.status)){let t=this.resources.findIndex(l=>g(l,this)==e);t>=0&&this.resources.splice(t,1),t=this.selection.findIndex(l=>g(l,this)==e),t>=0&&this.selection.splice(t,1),t=this.detailSelection.findIndex(l=>g(l,this)==e),t>=0&&(this.detailSelection.splice(t,1),this.detailSelection.length==0&&(this.editingDetailSelection=n.detail.autoEdit)),n.limitTransientDataToLocalCollection&&delete this.transientData[e]}},async saveResource(e){const r=g(e,this),t=r==null,l=await $({method:t?"post":"put",url:t?n.restCollectionUrl:`${n.restCollectionUrl}/${r}`,data:e});if(l.status==200){const d=l.data,u=g(d,this),h=u?await this.refreshResource(u):null;return t&&this.recordInsertion(h||Object.freeze(d)),h||d}return null},async saveResources(e){const r=await $({method:"put",url:n.restCollectionUrl,data:e});if(r.status==200){const t=r.data||[],l=[];for(const[d,u]of t.entries()){const h=g(e[d],this)==null,S=g(u,this),D=S?await this.refreshResource(S):null;h&&this.recordInsertion(D||u),l.push(D||Object.freeze(u))}return l}return[]},clearTransientData(){this.transientData={}},setInvalidResourceIds(e){s.isEqual(e,this.invalidResources.map(r=>g(r,this)))||(this.invalidResources=e.map(r=>this.resources.find(t=>g(t,this)==r)).filter(r=>r!=null))},setTransientDataForResources(e){const{transientData:r,merge:t=!0}=e;t?s.merge(this.transientData,r):s.assign(this.transientData,r)},clearSelection(){this.setSelection([])},deselectResources(e){const r=this.selection.map(t=>g(t,this)).filter(t=>t!=null&&!e.includes(t));this.setSelection(r)},selectResources(e,r){const{addToSelection:t,edit:l}=r||{},d=this.selection.map(h=>g(h,this));let u=e;if(t){const h=s.difference(e,d);h.length>0&&(u=d.concat(h).filter(S=>S!=null))}s.isEqual(d,u)||this.setSelection(u,l)},setSelection(e,r){if(!s.isEqual(e,this.selection.map(t=>g(t,this)))){let t=!0;if(this.editors.length>0){if(n.detail.autoFromSingleSelection&&this.selection.length==1)t=!1;else if(n.detail.autoFromMultipleSelection&&n.detail.allowMultiple&&this.selection.length>1)t=!1;else if(n.detail.constrainToSelection){const l=this.selection.map(h=>g(h,this)),u=this.detailSelection.map(h=>g(h,this)).filter(h=>l.includes(h));this.detailSelection.filter(h=>!u.includes(g(h,this))).length>0&&(t=!1)}}if(!t)return;if(this.selection=e.map(l=>this.resources.find(d=>g(d,this)==l)).filter(l=>l!=null),n.detail.autoFromSingleSelection&&this.selection.length==1){const l=this.selection[0];(this.detailSelection.length!=1||g(this.detailSelection[0],this)!=g(l,this))&&(this.detailSelection=[l])}else if(n.detail.autoFromMultipleSelection&&n.detail.allowMultiple&&this.selection.length>1)s.isEqual(this.selection.map(l=>g(l,this)),this.detailSelection.map(l=>g(l,this)))||(this.detailSelection=s.clone(this.selection));else if(n.detail.constrainToSelection){const l=this.selection.map(h=>g(h,this)),d=this.detailSelection.map(h=>g(h,this)),u=d.filter(h=>l.includes(h));s.isEqual(u,d)||(this.detailSelection=this.detailSelection.filter(h=>u.includes(g(h,this))))}this.detailSelection.length==0?this.editingDetailSelection=!1:this.editingDetailSelection=r!==void 0?r:this.editingDetailSelection||n.detail.autoEdit}},hideDetail(){this.detailSelection.length>0&&(this.detailSelection=[],this.editingDetailSelection=!1)},showSelectionAsDetail(e){if(this.selection.length<=1||n.detail.allowMultiple){const r=this.selection.map(l=>g(l,this)),t=this.detailSelection.map(l=>g(l,this));s.isEqual(r,t)||(this.detailSelection=s.clone(this.selection)),this.detailSelection.length==0?this.editingDetailSelection=!1:this.editingDetailSelection=e!==void 0?e:this.editingDetailSelection||n.detail.autoEdit}},deregisterEditor(e){s.remove(this.editors,r=>r==e)},registerEditor(e){this.editors.includes(e)||this.editors.push(e)},deregisterListNavigator({name:e,listNavigator:r}){(r==null||this.listNavigators[e]==r)&&delete this.listNavigators[e]},registerListNavigator({name:e,listNavigator:r}){this.listNavigators[e]!=r&&(this.listNavigators[e]=r)}}});return(()=>{const e=(r,t)=>{const l=E(r,t);return ee.registerStore(l.$id,l),l};return e.$id=E.$id,e})()},ee=new de,Ue=(w={})=>{var ge,ve,pe,me;const{collectionId:n,draftBatchId:E,enabled:q,resourceType:e,options:r}=w,t=o.ref(void 0),l=o.ref(n),d=o.ref(E),u=o.ref(q??!0),h=o.ref([o.toRef(e)]),S=o.ref(r),D=o.computed(()=>d.value),L=o.ref(u.value),b=o.ref(I.v4()),N=o.ref((ve=(ge=S.value)==null?void 0:ge.filter)==null?void 0:ve.resourceIds),k=o.ref((me=(pe=S.value)==null?void 0:pe.filter)==null?void 0:me.query),B=o.computed(()=>d.value==null&&l.value!=null&&ee.getStore(l.value)!=null),Q=o.ref(B.value),p=o.computed(()=>T("status","Uninitialized"));function m(i){if(t.value)return i(t.value)}async function C(i){if(t.value)return await i(t.value)}function T(i,c){if(t.value)return t.value[i];if(c!==void 0)return c;throw"Attempted to use a REST collection store that has not been created, with no default value."}const y=(i={})=>{var ie,Re,Se,ye;const{collectionId:c,draftBatchId:U,enabled:F,resourceType:ne,options:te}=i;l.value=c,d.value=U,u.value=F??!0,h.value=[o.toRef(ne)],te!=null&&(S.value=te,N.value=(Re=(ie=S.value)==null?void 0:ie.filter)==null?void 0:Re.resourceIds,k.value=(ye=(Se=S.value)==null?void 0:Se.filter)==null?void 0:ye.query),b.value=I.v4(),H(u.value)},H=async i=>{i!=L.value&&(L.value=i,i&&(_(),z()))},Z=async i=>{N.value=i,await C(async c=>await c.setFilterResourceIds(N.value||null))},V=async i=>{if(k.value=i,p.value!="Uninitialized"){const c=i,U=o.computed(()=>s.isFunction(c)?R.value?c(R.value):null:c);await C(F=>F.setQuery(U.value||null))}},_=()=>{S.value=s.merge({},S.value||{},{filter:{resourceIds:N.value,query:k.value}})},R=o.computed(()=>h.value[0].value||void 0),O=function(i){const c=s.get(i,"filter.query"),U=s.get(i,"propertyBlacklist"),F=s.get(i,"referencePathsToExpand"),ne=s.isFunction(c)?c(R.value):c,te=R.value?s.isFunction(U)?U(R.value):U||[]:[],ie=R.value?s.isFunction(F)?F(R.value):F||[]:[];return{...s.cloneDeep(i||{}),filter:{...s.cloneDeep((i==null?void 0:i.filter)||{}),query:ne},propertyBlacklist:te,referencePathsToExpand:ie}},P=o.computed(()=>O(S.value)),M=o.computed(()=>{if(P.value.restCollectionUrl!==void 0)return P.value.restCollectionUrl;if(!Q.value)return!R.value||!R.value.collectionName?null:D.value?`${X.config.apiBaseUrl}/draft-batches/${D.value}/${R.value.collectionName}`:`${X.config.apiBaseUrl}/${R.value.collectionName}`}),a=o.computed(()=>{var i;if(R.value)return s.mergeWith(s.cloneDeep(he),P.value,{idProperty:(i=R.value)==null?void 0:i.idProperty,restCollectionUrl:M.value||""},(c,U)=>{if(s.isArray(U)&&U.length==0&&(c==null||s.isArray(c)))return U})}),f=o.ref(0),x=o.computed(()=>{var i;return f.value,l.value||R.value&&((i=R.value)==null?void 0:i.collectionName)&&(D.value?`draftBatches/${D.value}/${R.value.collectionName}/${b.value}`:`${R.value.collectionName}/${b.value}`)||null}),z=()=>{if(L.value){let i=!1;return R.value&&x.value&&(t.value=ee.getStore(x.value),t.value?i=!1:a.value&&(Q.value=!1,t.value=Ce(x.value,a.value)(),i=!0)),i}else return!1},J=()=>{x.value&&l.value==x.value?(t.value=void 0,z()):(t.value=void 0,f.value=f.value+1,z())};o.watch(D,(i,c)=>{s.isEqual(i,c)||J()}),o.watch(L,(i,c)=>{i!=c&&(i?z():t.value=void 0)}),o.watch(R,(i,c)=>{i&&!c?z():!i&&c||s.isEqual(i,c)||J()}),o.watch(a,(i,c)=>{s.isEqual(i,c)||J()}),o.watch(B,()=>{B.value||(Q.value=!1)}),o.watch(x,()=>z()),o.watch(M,(i,c)=>{s.isEqual(i,c)||J()});const W=[],qe=function(i){p.value!="Uninitialized"?o.nextTick(i):W.push(i)};return o.watch(p,(i,c)=>{if(i!="Uninitialized"&&c=="Uninitialized"){const U=s.clone(W);W.splice(0,W.length);for(const F of U)F()}}),z(),{collectionId:x,draftBatchId:D,resourceType:R,restCollectionUrl:o.computed(()=>T("restCollectionUrl",null)),enabled:L,status:p,batchSaveAttempted:o.computed(()=>T("batchSaveAttempted",!1)),listNavigators:o.computed(()=>T("listNavigators",!1)),invalidResources:o.computed(()=>T("invalidResources",[])),resources:o.computed(()=>p.value!="Uninitialized"?(C(i=>i.ensureCollectionLoaded()),T("resources",[])):[]),remoteCollectionSize:o.computed(()=>T("remoteCollectionSize",null)),transientData:o.computed(()=>T("transientData",[])),detailSelection:o.computed(()=>T("detailSelection",[])),editingDetailSelection:o.computed(()=>T("editingDetailSelection",!1)),selection:o.computed(()=>T("selection",[])),reconfigureCollection:y,setEditingDetailSelection:i=>m(c=>c.setEditingDetailSelection(i)),setEnabled:H,setFilterResourceIds:Z,setQuery:V,ensureStore:z,setBatchSaveAttempted:i=>m(c=>c.setBatchSaveAttempted(i)),clear:()=>m(i=>i.clear()),ensureCollectionLoaded:async()=>await C(async i=>i.ensureCollectionLoaded()),loadResources:async()=>await C(async i=>await i.loadResources()),addResource:i=>m(c=>c.addResource(i)),checkForDeletedResource:async i=>await C(async c=>await c.checkForDeletedResource(i))==!0,recordDeletion:i=>m(c=>c.recordDeletion(i)),recordInsertion:(i,{insertAtBeginning:c=!1,transientData:U=void 0}={})=>m(F=>F.recordInsertion(i,{insertAtBeginning:c,transientData:U})),recordUpdate:i=>m(c=>c.recordUpdate(i)),refreshResource:async i=>await C(async c=>await c.refreshResource(i)),deleteResource:async i=>await C(async c=>await c.deleteResource(i)),saveResource:async i=>await C(async c=>await c.saveResource(i)),saveResources:async i=>await C(async c=>await c.saveResources(i)),clearTransientData:()=>m(i=>i.clearTransientData()),setInvalidResourceIds:i=>m(c=>c.setInvalidResourceIds(i)),setTransientDataForResources:i=>m(c=>c.setTransientDataForResources(i)),clearSelection:()=>m(i=>i.clearSelection()),deselectResources:i=>m(c=>c.deselectResources(i)),selectResources:(i,c)=>m(U=>U.selectResources(i,c)),hideDetail:()=>m(i=>i.hideDetail()),deregisterEditor:i=>m(c=>c.deregisterEditor(i)),registerEditor:i=>m(c=>c.registerEditor(i)),deregisterListNavigator:i=>m(c=>c.deregisterListNavigator(i)),registerListNavigator:i=>m(c=>c.registerListNavigator(i)),onItemsStoreReady:qe}},Ee=()=>{ee.clearAllStores()};function re(w,n){return s.get(w,(n==null?void 0:n.idProperty)||"_id")}const fe={idProperty:"_id"},Y={resource:null,status:"NotLoaded"},Te=(w,n)=>{n=s.merge({},fe,n);const E=ce.defineStore(w,{state:()=>({idProperty:n.idProperty,resourceId:n.resourceId||null,resourceUrl:n.resourceUrl||null,referencePathsToExpand:n.referencePathsToExpand||null,...Y}),getters:{currentResourceUrl:e=>e.resourceUrl||(n.restCollectionUrl&&e.resourceId?`${n.restCollectionUrl}/${e.resourceId}`:null)||n.restCollectionUrl||null,fixedQueryParams:e=>{const r={};return e.referencePathsToExpand&&(r.r=G(e.referencePathsToExpand)),r}},actions:{reset(){for(const e in Y)this[e]=Y[e]},async setResourceId(e){const r=this.currentResourceUrl;this.resourceId=e,!s.isEqual(this.currentResourceUrl,r)&&this.status!="NotLoaded"&&await this.loadResource()},async setResourceUrl(e){const r=this.currentResourceUrl;this.resourceUrl=e,!s.isEqual(this.currentResourceUrl,r)&&this.status!="NotLoaded"&&await this.loadResource()},clear(){for(const e in Y)this[e]=Y[e]},async ensureResourceLoaded(){["Loaded","Loading","Failed"].includes(this.status)||await this.loadResource()},async loadResource(){this.reset();const e=I.v4();if(this._loadId=e,this.currentResourceUrl){this.status="Loading";const r=this.fixedQueryParams,t=s.cloneDeep(r),l=s.map(t,(u,h)=>u!=null?`${encodeURIComponent(h)}=${encodeURIComponent(u)}`:null).filter(u=>u!=null).join("&"),d=s.isEmpty(l)?this.currentResourceUrl:`${this.currentResourceUrl}?${l}`;try{const u=await $.get(d),h=this.fixedQueryParams;e!=this._loadId||!s.isEqual(r,h)?console.log(`Discarding resource fetched by obsolete query from ${d}.`):(this.resource=ae.decode(s.get(u,"data",{})),this.status="Loaded")}catch(u){console.log(`Error while loading resource (URL="${d}")`,u),this.reset(),this.status="Failed"}}else throw"Cannot load a resource because its URL, or its ID and collection URL, are unknown."},async checkForDeletedResource(){if(this.currentResourceUrl){let e;try{e=await $.get(this.currentResourceUrl)}catch(r){$.isAxiosError(r)&&(e=r.response)}return e&&e.status==404?(this.recordDeletion(),!0):!1}else throw"Cannot check for a deleted resource because its URL, or its ID and collection URL, are unknown."},recordDeletion(){this.resource=null,this.status="Loaded"},recordInsertion(e){this.resourceId=re(e,this)||null,this.status=="Loaded"&&(this.resource=Object.freeze(e))},recordUpdate(e){this.resourceId=re(e,this)||null,this.status=="Loaded"&&(this.resource=Object.freeze(e))},async refreshResource(){return await this.loadResource(),this.resource},async deleteResource(){if(this.currentResourceUrl)(await $.delete(this.currentResourceUrl)).status==200&&this.recordDeletion();else throw"Cannot delete a resource because its URL, or its ID and collection URL, are unknown."},async saveResource(e){const r=re(e,this),t=r==null;if(!r)throw"The REST resource store cannot create new resources on the server.";if(!this.currentResourceUrl)throw"Cannot save a resource because its URL, or its ID and collection URL, are unknown.";const l=await $({method:t?"post":"put",url:this.currentResourceUrl,data:e});if(l.status==200){const d=l.data,u=await this.refreshResource();return t&&this.recordInsertion(u||d),u||Object.freeze(d)}return null},async makeCustomApiRequest(e){const{method:r,subpath:t,url:l,data:d}=e;let u=l;if(!u)if(this.currentResourceUrl)u=`${this.currentResourceUrl}/${t}`;else throw"Cannot make a custom API request for a resource because its URL, or its ID and collection URL, are unknown.";const h=await $({method:r||"get",url:u,data:d});return h.status>=200&&h.status<300?h.data:null}}});return(()=>{const e=(r,t)=>{const l=E(r,t);return le.registerStore(l.$id,l),l};return e.$id=E.$id,e})()},le=new de,Le=(w={})=>{const{resourceClientId:n,draftBatchId:E,enabled:q,resourceType:e,options:r}=w,t=o.ref(void 0),l=o.ref(n),d=o.ref(E),u=o.ref(q??!0),h=o.ref([o.toRef(e)]),S=o.ref(r),D=o.computed(()=>d.value),L=o.ref(u.value),b=o.ref(I.v4()),N=o.computed(()=>d.value==null&&l.value!=null&&le.getStore(l.value)!=null),k=o.ref(N.value),B=o.computed(()=>m("status","Uninitialized"));function Q(a){if(t.value)return a(t.value)}async function p(a){if(t.value)return await a(t.value)}function m(a,f){if(t.value)return t.value[a];if(f!==void 0)return f;throw"Attempted to use a REST resource store that has not been created, with no default value."}const C=(a={})=>{const{resourceClientId:f,draftBatchId:x,enabled:z,resourceType:J,options:W}=a;l.value=f,d.value=x,u.value=z??!0,h.value=[o.toRef(J)],W!=null&&(S.value=W),b.value=I.v4(),T(u.value)},T=async a=>{a!=L.value&&(L.value=a,a&&P())},y=o.computed(()=>h.value[0].value||void 0),H=function(a){const f=s.get(a,"referencePathsToExpand"),x=y.value?s.isFunction(f)?f(y.value):f||[]:[];return{...s.cloneDeep(a||{}),referencePathsToExpand:x}},Z=o.computed(()=>H(S.value)),V=o.computed(()=>{if(!y.value)return null;if(!k.value)return!y.value||!y.value.collectionName?null:D.value?`${X.config.apiBaseUrl}/draft-batches/${D.value}/${y.value.collectionName}`:`${X.config.apiBaseUrl}/${y.value.collectionName}`}),_=o.computed(()=>{if(y.value&&V.value)return s.mergeWith(s.cloneDeep(fe),Z.value,{idProperty:y.value.idProperty,restCollectionUrl:V.value},(a,f)=>{if(s.isArray(f)&&f.length==0&&(a==null||s.isArray(a)))return f})}),R=o.ref(0),O=o.computed(()=>{var a;return R.value,l.value||y.value&&((a=y.value)==null?void 0:a.collectionName)&&(D.value?`draftBatches/${D.value}/${y.value.collectionName}/${b.value}`:`${y.value.collectionName}/${b.value}`)||null}),P=()=>{if(L.value){let a=!1;return y.value&&O.value&&(t.value=le.getStore(O.value),t.value?a=!1:_.value&&(k.value=!1,t.value=Te(O.value,_.value)(),a=!0)),a}else return!1},M=()=>{O.value&&l.value==O.value?(t.value=void 0,P()):(t.value=void 0,R.value=R.value+1,P())};return o.watch(D,(a,f)=>{s.isEqual(a,f)||M()}),o.watch(L,(a,f)=>{a!=f&&(a?P():t.value=void 0)}),o.watch(y,(a,f)=>{a&&!f?P():!a&&f||s.isEqual(a,f)||M()}),o.watch(_,(a,f)=>{s.isEqual(a,f)||M()}),o.watch(N,()=>{N.value||(k.value=!1)}),o.watch(O,()=>P()),o.watch(V,(a,f)=>{s.isEqual(a,f)||M()}),P(),{resourceClientId:O,draftBatchId:D,enabled:L,resourceType:y,status:B,resource:o.computed(()=>B.value!="Uninitialized"?(p(a=>a.ensureResourceLoaded()),m("resource",[])):[]),resourceId:o.computed(()=>m("resourceId",null)),resourceUrl:o.computed(()=>m("resourceUrl",null)),reconfigureClient:C,setEnabled:T,setResourceId:async a=>await p(async f=>await f.setResourceId(a)),setResourceUrl:async a=>await p(async f=>await f.setResourceUrl(a)),ensureStore:P,clear:()=>Q(a=>a.clear()),ensureResourceLoaded:async()=>await p(async a=>a.ensureResourceLoaded()),loadResource:async()=>await p(async a=>await a.loadResource()),checkForDeletedResource:async()=>await p(async a=>await a.checkForDeletedResource())==!0,recordDeletion:()=>p(a=>a.recordDeletion()),recordInsertion:a=>p(f=>f.recordInsertion(a)),recordUpdate:a=>p(f=>f.recordUpdate(a)),refreshResource:async()=>await p(async a=>await a.refreshResource()),deleteResource:async()=>await p(async a=>await a.deleteResource()),saveResource:async a=>await p(async f=>await f.saveResource(a)),makeCustomApiRequest:async a=>await p(async f=>await f.makeCustomApiRequest(a))}},X={config:{...ue}};function $e(w){X.config=s.merge({},ue,w)}v.ApiClientError=we,v.clearAllRestCollections=Ee,v.initRestClient=$e,v.restClient=X,v.useRestCollection=Ue,v.useRestResource=Le,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});
@@ -54,6 +54,7 @@ export interface ConcreteRestCollectionStoreOptionsInput {
54
54
  pageSize?: number | null;
55
55
  };
56
56
  order?: [any, string][];
57
+ propertyBlacklist?: string[];
57
58
  referencePathsToExpand?: string[];
58
59
  restCollectionUrl?: string | null;
59
60
  }
@@ -79,6 +80,7 @@ export interface RestCollectionStoreOptionsInput {
79
80
  pageSize?: number | null;
80
81
  };
81
82
  order?: [any, string][];
83
+ propertyBlacklist?: string[] | ((resourceType: ResourceType) => string[]);
82
84
  referencePathsToExpand?: string[] | ((resourceType: ResourceType) => string[]);
83
85
  restCollectionUrl?: string | null;
84
86
  }
@@ -129,6 +131,18 @@ export interface RestCollection<T extends Resource = Resource> {
129
131
  * To allow for asynchronous loading of resource types, this may be undefined.
130
132
  */
131
133
  resourceType: Ref<ResourceType | undefined>;
134
+ /**
135
+ * The REST collection URL.
136
+ *
137
+ * This is reported by the actual Pinia store. It may be arrived at in three ways:
138
+ * - It may have been specified in {@link RestCollectionOptions.options}.
139
+ * - It may have been calculated from the entity type and draft batch ID. This is the most common scenario.
140
+ * - Or this RestCollection may reference an existing store, in which case the URL was determined by the collection
141
+ * that originally created the store.
142
+ *
143
+ * It defaults to null when no store is present.
144
+ */
145
+ restCollectionUrl: Ref<string | null>;
132
146
  /** A status indicating whether resources have been loaded yet from the REST API. */
133
147
  status: Ref<RestCollectionStatus>;
134
148
  batchSaveAttempted: Ref<boolean>;
@@ -142,6 +156,8 @@ export interface RestCollection<T extends Resource = Resource> {
142
156
  invalidResources: Ref<T[]>;
143
157
  /** The array of resources that have been loaded from the REST API into the local collection. */
144
158
  resources: Ref<T[]>;
159
+ /** The total number of resources available in the remote collection. */
160
+ remoteCollectionSize: Ref<number | null>;
145
161
  /** Transient data that a client has associated with the resources via {@link setTransientDataForResources}. */
146
162
  transientData: Ref<any[]>;
147
163
  /** Resources in the current detail view, a sublist of {@link resources}. */
@@ -1 +1 @@
1
- {"version":3,"file":"rest-collection.d.ts","sourceRoot":"","sources":["../../src/rest-collection.ts"],"names":[],"mappings":"AAEA,OAAO,EAA0B,GAAG,EAAe,MAAM,KAAK,CAAA;AAI9D,OAAO,EAAC,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAC,MAAM,gCAAgC,CAAA;AACjF,OAAkB,EAEhB,oBAAoB,EAIrB,MAAM,mCAAmC,CAAA;AAE1C,6CAA6C;AAC7C,MAAM,WAAW,qBAAqB;IACpC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;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;IAM1F,iBAAiB,EAAE,CAAC,QAAQ,EAAE,gCAAgC,KAAK,IAAI,CAAA;CACxE;6DAEsD,qBAAqB;AAA5E,wBAidC;AAED,eAAO,MAAM,uBAAuB,YAA2C,CAAA"}
@@ -27,6 +27,7 @@ export interface RestCollectionStoreOptions {
27
27
  pageSize?: number;
28
28
  };
29
29
  order?: QueryOrder;
30
+ propertyBlacklist?: string[];
30
31
  referencePathsToExpand?: string[];
31
32
  restCollectionUrl: string;
32
33
  }
@@ -39,8 +40,11 @@ export interface RestCollectionStoreState {
39
40
  idProperty: string;
40
41
  filter: RestCollectionFilter;
41
42
  order: QueryOrder | null;
43
+ propertyBlacklist: string[] | null;
42
44
  referencePathsToExpand: string[] | null;
45
+ restCollectionUrl: string;
43
46
  resources: Resource[];
47
+ remoteCollectionSize: number | null;
44
48
  status: RestCollectionStoreStatus;
45
49
  selection: Resource[];
46
50
  detailSelection: Resource[];
@@ -68,6 +72,8 @@ interface RestCollectionQueryParams {
68
72
  q?: string;
69
73
  /** Deterministically JSON-serialized representation of a QueryOrder. */
70
74
  o?: string;
75
+ /** Deterministically JSON-serialized array of path strings to exclude. */
76
+ ex?: string;
71
77
  /** Deterministically JSON-serialized array of path strings to expand. */
72
78
  r?: string;
73
79
  /** Page offset, the 0-based index of the first resource to return. */
@@ -95,8 +101,11 @@ declare const makeStore: (storeId: string, options: RestCollectionStoreOptions)
95
101
  path: string;
96
102
  sqlType?: string | undefined;
97
103
  }, import("../queries.js").QueryOrderDirection])[] | null;
104
+ propertyBlacklist: string[] | null;
98
105
  referencePathsToExpand: string[] | null;
106
+ restCollectionUrl: string;
99
107
  resources: Resource[];
108
+ remoteCollectionSize: number | null;
100
109
  status: RestCollectionStoreStatus;
101
110
  selection: Resource[];
102
111
  detailSelection: Resource[];
@@ -444,8 +453,11 @@ export declare const storeRegistry: StoreRegistry<import("pinia").Store<string,
444
453
  path: string;
445
454
  sqlType?: string | undefined;
446
455
  }, import("../queries.js").QueryOrderDirection])[] | null;
456
+ propertyBlacklist: string[] | null;
447
457
  referencePathsToExpand: string[] | null;
458
+ restCollectionUrl: string;
448
459
  resources: Resource[];
460
+ remoteCollectionSize: number | null;
449
461
  status: RestCollectionStoreStatus;
450
462
  selection: Resource[];
451
463
  detailSelection: Resource[];
@@ -1 +1 @@
1
- {"version":3,"file":"rest-collection-store.d.ts","sourceRoot":"","sources":["../../../src/stores/rest-collection-store.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,sBAAsB,EAAE,sBAAsB,EAAC,MAAM,uBAAuB,CAAA;AACpF,OAAO,EAAC,QAAQ,EAAE,UAAU,EAAC,MAAM,iCAAiC,CAAA;AACpE,OAAO,EAAC,WAAW,EAAE,UAAU,EAAC,MAAM,eAAe,CAAA;AACrD,OAAO,EAAC,aAAa,EAAC,MAAM,2BAA2B,CAAA;AAsBvD,2FAA2F;AAC3F,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,KAAK,EAAE,GAAG,GAAG,IAAI,CAAA;IACjB,WAAW,EAAE,UAAU,EAAE,GAAG,IAAI,CAAA;CACjC;AAED,0EAA0E;AAC1E,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE;QACN,aAAa,EAAE,OAAO,CAAA;QACtB,QAAQ,EAAE,OAAO,CAAA;QACjB,yBAAyB,EAAE,OAAO,CAAA;QAClC,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,OAAO,CAAA;IAC5C,OAAO,EAAE;QACP,aAAa,CAAC,EAAE,MAAM,CAAA;QACtB,QAAQ,CAAC,EAAE,MAAM,CAAA;KAClB,CAAA;IACD,KAAK,CAAC,EAAE,UAAU,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