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