@wssto2/vue-core 0.4.5 → 0.4.6
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/{Activity-DukTfcmn.js → Activity-BVk8iG3X.js} +1 -1
- package/dist/{Changes-Dhi7EBe9.js → Changes-CaiZpcyW.js} +1 -1
- package/dist/CollectionPage.vue_vue_type_script_setup_true_lang-kBBHIJTB.js +1520 -0
- package/dist/{DeadLetters-CfKE1axC.js → DeadLetters-BOMgmmOg.js} +3 -3
- package/dist/{General-BwT5Y_TN.js → General-BaW63VQg.js} +1 -1
- package/dist/{ProfilePage-DIJEhiW-.js → ProfilePage-Bbv5KH3L.js} +1 -1
- package/dist/{Sessions-BZnBtu7h.js → Sessions-r9WHf0nU.js} +1 -1
- package/dist/{SettingsPage-BmRCB75J.js → SettingsPage-Dcib_TK0.js} +1 -1
- package/dist/{SignIn-D-n9cfMH.js → SignIn-DJ-ai_ap.js} +1 -1
- package/dist/{SignInPage-BzIP6sPa.js → SignInPage-CJAsxvc6.js} +1 -1
- package/dist/{SignIns-dFIzemgy.js → SignIns-NnIqezxn.js} +1 -1
- package/dist/{UserRecord-DoOu1hWB.js → UserRecord-JZFQ40hK.js} +3 -3
- package/dist/{UsersList-CYBGEOqE.js → UsersList-cfhb1GE7.js} +3 -3
- package/dist/collection/datePresets.d.ts +8 -4
- package/dist/collection/index.js +49 -49
- package/dist/collection/state.d.ts +10 -5
- package/dist/collection/useCollection.d.ts +20 -5
- package/dist/http-D_D9YbLH.js +194 -0
- package/dist/identity/index.js +1 -1
- package/dist/{index-BHt1dLX2.js → index-7QcMXQZq.js} +2 -2
- package/dist/{index-BVX0nmMv.js → index-By5B18A3.js} +10 -10
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{neighbors-DpaIMQAL.js → neighbors-BRf4Eh2R.js} +1 -1
- package/dist/notifications/index.js +1 -1
- package/dist/{status-D3cLPSCh.js → status-Ct8ixCoS.js} +2 -2
- package/package.json +1 -1
- package/dist/CollectionPage.vue_vue_type_script_setup_true_lang-BuAdhiy_.js +0 -1514
- package/dist/http-CNcDHSOj.js +0 -194
package/dist/http-CNcDHSOj.js
DELETED
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
import { hasInjectionContext as z, inject as $, watch as _ } from "vue";
|
|
2
|
-
import { g as O } from "./platform-q3cjODLx.js";
|
|
3
|
-
const j = [5, 8, 10, 15, 25, 50, 100], E = 25;
|
|
4
|
-
function U(e) {
|
|
5
|
-
const t = `defineCollection("${e.id}")`;
|
|
6
|
-
if (typeof e.id != "string" || e.id.trim() === "") throw new Error("defineCollection: `id` must be a non-empty string.");
|
|
7
|
-
if (!Number.isInteger(e.stateVersion) || e.stateVersion < 1) throw new Error(`${t}: \`stateVersion\` must be a positive integer.`);
|
|
8
|
-
if (typeof e.load != "function") throw new Error(`${t}: \`load\` must be a function.`);
|
|
9
|
-
if (typeof e.key != "function") throw new Error(`${t}: \`key\` must be a function.`);
|
|
10
|
-
const r = {
|
|
11
|
-
sorts: e.query?.sorts ? [...e.query.sorts] : null,
|
|
12
|
-
filters: e.query?.filters ? [...e.query.filters] : null,
|
|
13
|
-
views: e.query?.views ? [...e.query.views] : null,
|
|
14
|
-
sensitive: [...e.query?.sensitive ?? []],
|
|
15
|
-
pageSizes: [...e.query?.pageSizes ?? j],
|
|
16
|
-
search: e.query?.search ?? !0
|
|
17
|
-
};
|
|
18
|
-
if (r.pageSizes.length === 0 || r.pageSizes.some((c) => !Number.isInteger(c) || c < 1))
|
|
19
|
-
throw new Error(`${t}: \`query.pageSizes\` must list positive integers.`);
|
|
20
|
-
for (const c of r.sensitive)
|
|
21
|
-
if (r.filters && !r.filters.includes(c)) throw new Error(`${t}: sensitive filter "${c}" is not in \`query.filters\`.`);
|
|
22
|
-
const s = e.defaults ?? {}, n = s.pageSize ?? (r.pageSizes.includes(E) ? E : r.pageSizes[0]);
|
|
23
|
-
if (!r.pageSizes.includes(n)) throw new Error(`${t}: default page size ${n} is not one of ${r.pageSizes.join(", ")}.`);
|
|
24
|
-
const o = s.sort ?? null;
|
|
25
|
-
if (o !== null && r.sorts && !r.sorts.includes(o)) throw new Error(`${t}: default sort "${o}" is not in \`query.sorts\`.`);
|
|
26
|
-
const i = s.view ?? null;
|
|
27
|
-
if (i !== null && r.views && !r.views.includes(i)) throw new Error(`${t}: default view "${i}" is not in \`query.views\`.`);
|
|
28
|
-
const a = Object.fromEntries(Object.entries(s.filters ?? {}).filter(([, c]) => c !== void 0 && c !== ""));
|
|
29
|
-
for (const c of Object.keys(a))
|
|
30
|
-
if (r.filters && !r.filters.includes(c)) throw new Error(`${t}: default filter "${c}" is not in \`query.filters\`.`);
|
|
31
|
-
const l = s.page ?? 1;
|
|
32
|
-
if (!Number.isInteger(l) || l < 1) throw new Error(`${t}: default page must be a positive integer.`);
|
|
33
|
-
const f = s.direction ?? "asc";
|
|
34
|
-
if (f !== "asc" && f !== "desc") throw new Error(`${t}: default direction must be "asc" or "desc".`);
|
|
35
|
-
return Object.freeze({
|
|
36
|
-
id: e.id,
|
|
37
|
-
stateVersion: e.stateVersion,
|
|
38
|
-
load: e.load,
|
|
39
|
-
key: e.key,
|
|
40
|
-
defaults: Object.freeze({
|
|
41
|
-
page: l,
|
|
42
|
-
pageSize: n,
|
|
43
|
-
sort: o,
|
|
44
|
-
direction: f,
|
|
45
|
-
search: s.search ?? "",
|
|
46
|
-
view: i,
|
|
47
|
-
filters: Object.freeze(a)
|
|
48
|
-
}),
|
|
49
|
-
contract: Object.freeze(r),
|
|
50
|
-
migrate: e.migrate
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
const X = "from";
|
|
54
|
-
function F(e, t) {
|
|
55
|
-
if (typeof e == "string") {
|
|
56
|
-
const r = new URLSearchParams(t).toString(), s = e.indexOf("#"), n = s === -1 ? e : e.slice(0, s);
|
|
57
|
-
return `${n}${n.includes("?") ? "&" : "?"}${r}${s === -1 ? "" : e.slice(s)}`;
|
|
58
|
-
}
|
|
59
|
-
return { ...e, query: { ...e.query, ...t } };
|
|
60
|
-
}
|
|
61
|
-
function G(e) {
|
|
62
|
-
if (!z()) return;
|
|
63
|
-
const t = $(O, null);
|
|
64
|
-
t && _(
|
|
65
|
-
() => {
|
|
66
|
-
const r = t.session.state.value;
|
|
67
|
-
return r.status === "authenticated" ? r.user.id : null;
|
|
68
|
-
},
|
|
69
|
-
e,
|
|
70
|
-
{ flush: "sync" }
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
const I = 4096, k = 200, T = 32, N = 1e6, v = /^[A-Za-z0-9_.-]{1,64}$/;
|
|
74
|
-
function C(e) {
|
|
75
|
-
let t = "";
|
|
76
|
-
for (const r of new TextEncoder().encode(e)) t += String.fromCharCode(r);
|
|
77
|
-
return btoa(t).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
78
|
-
}
|
|
79
|
-
function M(e) {
|
|
80
|
-
const t = e.replace(/-/g, "+").replace(/_/g, "/"), r = atob(t.padEnd(Math.ceil(t.length / 4) * 4, "="));
|
|
81
|
-
return new TextDecoder("utf-8", { fatal: !0 }).decode(Uint8Array.from(r, (s) => s.charCodeAt(0)));
|
|
82
|
-
}
|
|
83
|
-
const S = (e) => typeof e == "object" && e !== null && !Array.isArray(e);
|
|
84
|
-
function m(e, t = k) {
|
|
85
|
-
return typeof e == "string" && e.length <= t ? e : null;
|
|
86
|
-
}
|
|
87
|
-
function A(e, t) {
|
|
88
|
-
const { defaults: r, contract: s } = e, n = typeof t.p == "number" && Number.isInteger(t.p) && t.p >= 1 && t.p <= N ? t.p : r.page, o = typeof t.l == "number" && s.pageSizes.includes(t.l) ? t.l : r.pageSize;
|
|
89
|
-
let i = r.sort;
|
|
90
|
-
const a = m(t.c, 64);
|
|
91
|
-
a !== null && (s.sorts ? s.sorts.includes(a) : v.test(a)) && (i = a);
|
|
92
|
-
const l = t.d === "asc" || t.d === "desc" ? t.d : r.direction, f = m(t.s) ?? r.search;
|
|
93
|
-
let c = r.view;
|
|
94
|
-
const g = m(t.w, 64);
|
|
95
|
-
g !== null && (s.views ? s.views.includes(g) : v.test(g)) && (c = g);
|
|
96
|
-
const w = S(t.f) ? {} : { ...r.filters };
|
|
97
|
-
if (S(t.f)) {
|
|
98
|
-
let y = 0;
|
|
99
|
-
for (const [u, h] of Object.entries(t.f)) {
|
|
100
|
-
if (++y > T) break;
|
|
101
|
-
if (!(s.filters ? s.filters.includes(u) : v.test(u)) || s.sensitive.includes(u)) continue;
|
|
102
|
-
const b = typeof h == "number" || typeof h == "boolean" ? String(h) : m(h);
|
|
103
|
-
b !== null && b !== "" && (w[u] = b);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return { page: n, pageSize: o, sort: i, direction: l, search: f, view: c, filters: w };
|
|
107
|
-
}
|
|
108
|
-
function J(e, t) {
|
|
109
|
-
const r = { v: e.stateVersion, p: t.page, l: t.pageSize };
|
|
110
|
-
t.sort && (r.c = t.sort), r.d = t.direction, t.search && (r.s = t.search), t.view && (r.w = t.view);
|
|
111
|
-
const s = Object.fromEntries(
|
|
112
|
-
Object.entries(t.filters).filter(([n, o]) => o !== void 0 && o !== "" && !e.contract.sensitive.includes(n))
|
|
113
|
-
);
|
|
114
|
-
return (Object.keys(s).length > 0 || Object.keys(e.defaults.filters).length > 0) && (r.f = s), C(JSON.stringify(r));
|
|
115
|
-
}
|
|
116
|
-
function x(e, t) {
|
|
117
|
-
const r = t.v === void 0 ? e.stateVersion : t.v;
|
|
118
|
-
if (typeof r != "number" || !Number.isInteger(r)) return null;
|
|
119
|
-
if (r === e.stateVersion) return A(e, t);
|
|
120
|
-
const s = e.migrate?.(t, r);
|
|
121
|
-
return s ? A(e, s) : null;
|
|
122
|
-
}
|
|
123
|
-
function Z(e, t) {
|
|
124
|
-
if (typeof t != "string" || t === "" || t.length > I) return null;
|
|
125
|
-
let r;
|
|
126
|
-
try {
|
|
127
|
-
r = JSON.parse(M(t));
|
|
128
|
-
} catch {
|
|
129
|
-
return null;
|
|
130
|
-
}
|
|
131
|
-
return S(r) ? x(e, r) : null;
|
|
132
|
-
}
|
|
133
|
-
function B(e) {
|
|
134
|
-
return JSON.stringify([
|
|
135
|
-
e.page,
|
|
136
|
-
e.pageSize,
|
|
137
|
-
e.sort,
|
|
138
|
-
e.direction,
|
|
139
|
-
e.search,
|
|
140
|
-
e.view,
|
|
141
|
-
Object.entries(e.filters).sort(([t], [r]) => t.localeCompare(r))
|
|
142
|
-
]);
|
|
143
|
-
}
|
|
144
|
-
const d = (e) => typeof e == "object" && e !== null && !Array.isArray(e), p = (...e) => {
|
|
145
|
-
for (const t of e) if (typeof t == "number" && Number.isFinite(t)) return t;
|
|
146
|
-
return null;
|
|
147
|
-
};
|
|
148
|
-
function L(e) {
|
|
149
|
-
return {
|
|
150
|
-
// Filters first: the reserved names below always win, a filter called "page" cannot break paging.
|
|
151
|
-
...e.filters,
|
|
152
|
-
page: e.page,
|
|
153
|
-
per_page: e.pageSize,
|
|
154
|
-
order_col: e.sort,
|
|
155
|
-
order_dir: e.sort ? e.direction : null,
|
|
156
|
-
search: e.search,
|
|
157
|
-
view: e.view
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
function P(e, t) {
|
|
161
|
-
const r = e.data, s = d(r) && Array.isArray(r.data), n = Array.isArray(r) ? r : s ? r.data : [], o = s ? r : {}, i = d(e.meta) ? e.meta : d(o.meta) ? o.meta : {}, a = p(o.per_page, i.per_page) ?? t.pageSize, l = p(o.total, i.total) ?? n.length, f = p(o.current_page, i.page, i.current_page) ?? t.page, c = p(o.last_page, i.last_page) ?? (l === 0 ? 0 : Math.ceil(l / Math.max(1, a))), g = p(o.from, i.from) ?? (n.length === 0 ? 0 : (f - 1) * a + 1), w = p(o.to, i.to) ?? (n.length === 0 ? 0 : g + n.length - 1), y = Array.isArray(i.views) ? i.views : Array.isArray(o.views) ? o.views : void 0;
|
|
162
|
-
return {
|
|
163
|
-
rows: n,
|
|
164
|
-
total: l,
|
|
165
|
-
page: f,
|
|
166
|
-
pageSize: a,
|
|
167
|
-
lastPage: c,
|
|
168
|
-
from: g,
|
|
169
|
-
to: w,
|
|
170
|
-
views: y?.filter(d).flatMap((u) => typeof u.key == "string" ? [{ key: u.key, count: p(u.count) ?? void 0 }] : []),
|
|
171
|
-
meta: i,
|
|
172
|
-
requestId: e.requestId
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
function K(e, t, r = {}) {
|
|
176
|
-
return async (s, { signal: n }) => {
|
|
177
|
-
const o = await e.get(t, { query: r.params ? r.params(s) : L(s), signal: n });
|
|
178
|
-
return P(o, s);
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
export {
|
|
182
|
-
j as D,
|
|
183
|
-
X as L,
|
|
184
|
-
U as a,
|
|
185
|
-
x as b,
|
|
186
|
-
Z as d,
|
|
187
|
-
J as e,
|
|
188
|
-
K as h,
|
|
189
|
-
L as l,
|
|
190
|
-
G as o,
|
|
191
|
-
B as q,
|
|
192
|
-
P as r,
|
|
193
|
-
F as w
|
|
194
|
-
};
|