@wssto2/vue-core 0.5.0 → 0.5.2
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/CHANGELOG.md +27 -0
- package/dist/{AccessGate.vue_vue_type_script_setup_true_lang-Nw1IsB8N.js → AccessGate.vue_vue_type_script_setup_true_lang-DZ9GcLC1.js} +1 -1
- package/dist/{Activity-CoGI2_GL.js → Activity-dpY2kIs2.js} +2 -2
- package/dist/{Changes-Cwfe6wbX.js → Changes-CL8F1w8q.js} +2 -2
- package/dist/{CollectionPage.vue_vue_type_script_setup_true_lang-CtvHtFLy.js → CollectionPage.vue_vue_type_script_setup_true_lang-l-e-6WeS.js} +1 -1
- package/dist/{DeadLetters-DyA5Dqn0.js → DeadLetters-DopyRRx0.js} +4 -4
- package/dist/{General-DTEfxWls.js → General-mrVzi-5R.js} +2 -2
- package/dist/{NewRolePage-CRZoUajV.js → NewRolePage-sfr7tQs5.js} +2 -2
- package/dist/{ProfilePage-DLY81mvN.js → ProfilePage-EiTIYzZ5.js} +2 -2
- package/dist/{RoleEditor.vue_vue_type_script_setup_true_lang-gXbxXG2R.js → RoleEditor.vue_vue_type_script_setup_true_lang-BGtyOyWL.js} +6 -5
- package/dist/{RolePage-B9t586Q8.js → RolePage-ByUr3v_H.js} +3 -3
- package/dist/{RolesPage-BRdG-OSL.js → RolesPage-CvHrY9ZC.js} +2 -2
- package/dist/{SectionNavigator.vue_vue_type_script_setup_true_lang-Cy9Oi0ts.js → SectionNavigator.vue_vue_type_script_setup_true_lang-Ci04hApd.js} +1 -1
- package/dist/{Sessions-vGyUOnPG.js → Sessions-CHLokZ9e.js} +2 -2
- package/dist/{SettingsPage-V8WeADZZ.js → SettingsPage-DvOGJz9L.js} +2 -2
- package/dist/{SignIn-C-3i8RG6.js → SignIn-ypRvdmjg.js} +2 -2
- package/dist/{SignInPage-D2NA3VKU.js → SignInPage-CbPeKlAo.js} +2 -2
- package/dist/{SignIns-eoYPB6kB.js → SignIns-BApzbGq-.js} +2 -2
- package/dist/{UserRecord-BaQl2zzQ.js → UserRecord-BCTaBajE.js} +5 -5
- package/dist/{UsersList-BfXWgH5K.js → UsersList-CqSK3cQL.js} +4 -4
- package/dist/access/api.d.ts +8 -7
- package/dist/access/context.d.ts +7 -0
- package/dist/access/feature.d.ts +8 -0
- package/dist/access/index.js +1 -1
- package/dist/access/labels.d.ts +5 -0
- package/dist/app/index.js +117 -115
- package/dist/app/keepAlive.d.ts +4 -8
- package/dist/collection/index.js +3 -3
- package/dist/{contributions-DVQPcjJz.js → contributions-fx5q5n1u.js} +1 -1
- package/dist/{guards-DRh4zmxO.js → guards-D4mXf_2X.js} +1 -1
- package/dist/{http-D_pBg22D.js → http-CdQowFlW.js} +1 -1
- package/dist/identity/index.d.ts +1 -1
- package/dist/identity/index.js +6 -7
- package/dist/identity/session.d.ts +10 -7
- package/dist/{index-g-qbUeTk.js → index-BPwfLD7i.js} +261 -239
- package/dist/index-BVlbcaKs.js +763 -0
- package/dist/{index-kqk7Mclb.js → index-auJqVMWC.js} +90 -92
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/keepAlive-z3IRFkQq.js +46 -0
- package/dist/{navigation-DuQwti76.js → navigation-Bc5EQ_Si.js} +1 -1
- package/dist/{neighbors-IMRQ4rkm.js → neighbors-Bv6vnWlW.js} +1 -1
- package/dist/notifications/index.d.ts +2 -0
- package/dist/notifications/index.js +5 -4
- package/dist/notifications/push/pushState.d.ts +27 -0
- package/dist/page/index.js +1 -1
- package/dist/platform/index.js +3 -3
- package/dist/platform/platform.d.ts +7 -2
- package/dist/platform/session.d.ts +17 -0
- package/dist/platform-Dx6STiwY.js +283 -0
- package/dist/router/index.js +3 -3
- package/dist/{sections-D5rgQ4YB.js → sections-B0HxIOC2.js} +1 -1
- package/dist/shell/index.js +3 -3
- package/dist/{status-C2gHqkj6.js → status-BUFELJz2.js} +2 -2
- package/dist/testing/index.js +1 -1
- package/package.json +1 -1
- package/dist/index-WkbzC_ee.js +0 -745
- package/dist/keepAlive-CDvMQlcJ.js +0 -49
- package/dist/platform-Dl1fbScN.js +0 -268
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
function w(a = {}) {
|
|
2
|
-
const { margin: v = 6e4, retryAfter: h = 3e4 } = a;
|
|
3
|
-
return {
|
|
4
|
-
id: "vue-core.keep-session-alive",
|
|
5
|
-
scope: "session",
|
|
6
|
-
start({ signal: i, platform: t, report: f }) {
|
|
7
|
-
let s, r = null;
|
|
8
|
-
const o = () => {
|
|
9
|
-
const e = t.session.state.value;
|
|
10
|
-
return e.status === "authenticated" && e.expiresAt ? e.expiresAt.getTime() - Date.now() - v : null;
|
|
11
|
-
}, m = () => (r ?? (r = (async () => {
|
|
12
|
-
try {
|
|
13
|
-
if (await a.renew?.(t), t.session.state.value.status !== "authenticated") return;
|
|
14
|
-
await t.session.refresh();
|
|
15
|
-
} catch (e) {
|
|
16
|
-
f(e);
|
|
17
|
-
} finally {
|
|
18
|
-
r = null;
|
|
19
|
-
}
|
|
20
|
-
})()), r);
|
|
21
|
-
function u(e = 0) {
|
|
22
|
-
clearTimeout(s);
|
|
23
|
-
const d = o();
|
|
24
|
-
d !== null && !i.aborted && (s = setTimeout(() => void n(), Math.min(Math.max(d, e), 864e5)));
|
|
25
|
-
}
|
|
26
|
-
async function n() {
|
|
27
|
-
if (i.aborted || !navigator.onLine) return;
|
|
28
|
-
const e = o();
|
|
29
|
-
if (e !== null) {
|
|
30
|
-
if (e <= 0) {
|
|
31
|
-
if (await m(), i.aborted) return;
|
|
32
|
-
u((o() ?? 1) <= 0 ? h : 0);
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
u();
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
const c = () => {
|
|
39
|
-
document.visibilityState === "visible" && n();
|
|
40
|
-
}, l = () => void n();
|
|
41
|
-
return document.addEventListener("visibilitychange", c), window.addEventListener("online", l), n(), () => {
|
|
42
|
-
clearTimeout(s), document.removeEventListener("visibilitychange", c), window.removeEventListener("online", l);
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
export {
|
|
48
|
-
w as k
|
|
49
|
-
};
|
|
@@ -1,268 +0,0 @@
|
|
|
1
|
-
import { c as k } from "./client-BHPFfBj3.js";
|
|
2
|
-
import { d as q } from "./context-Ch1r4fdN.js";
|
|
3
|
-
import { i as x, A as U } from "./error-Bb_dr_Ay.js";
|
|
4
|
-
import { shallowRef as _ } from "vue";
|
|
5
|
-
const z = (e, n) => e.level === n.level && e.id === n.id, C = (e, n) => Object.prototype.hasOwnProperty.call(e, n);
|
|
6
|
-
function I(e, n = {}) {
|
|
7
|
-
const t = n.covers ?? z;
|
|
8
|
-
function o(s) {
|
|
9
|
-
const r = e();
|
|
10
|
-
return !r || !C(r.permissions, s) || r.unavailable.includes(s) ? null : r.permissions[s] ?? null;
|
|
11
|
-
}
|
|
12
|
-
function u(s, r) {
|
|
13
|
-
const i = o(s);
|
|
14
|
-
return i ? r ? (i.clauses.length > 0 ? i.clauses.map((f) => f.scope) : [i.scope]).some((f) => t(f, r)) : !0 : !1;
|
|
15
|
-
}
|
|
16
|
-
return {
|
|
17
|
-
get root() {
|
|
18
|
-
return e()?.root ?? !1;
|
|
19
|
-
},
|
|
20
|
-
can: u,
|
|
21
|
-
canAny: (s) => s.some((r) => u(r)),
|
|
22
|
-
canAll: (s) => s.every((r) => u(r)),
|
|
23
|
-
held: o
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
const A = ["own", "own_location", "all"], m = (e) => typeof e == "object" && e !== null && !Array.isArray(e);
|
|
27
|
-
function $(e, n, t) {
|
|
28
|
-
return !m(e) || typeof e.level != "string" ? (t.push(`${n}: expected { level: string, id?: number }`), { level: "" }) : (e.id !== void 0 && typeof e.id != "number" && t.push(`${n}.id: expected number`), typeof e.id == "number" ? { level: e.level, id: e.id } : { level: e.level });
|
|
29
|
-
}
|
|
30
|
-
function S(e, n, t) {
|
|
31
|
-
return typeof e == "string" && A.includes(e) ? e : (t.push(`${n}: expected one of ${A.join(", ")}`), "own");
|
|
32
|
-
}
|
|
33
|
-
function T(e) {
|
|
34
|
-
const n = [], t = {}, o = { root: !1, permissions: {}, unavailable: [] };
|
|
35
|
-
if (!m(e)) return { snapshot: o, issues: ["access: expected an object"] };
|
|
36
|
-
if (!m(e.permissions)) n.push("access.permissions: expected an object");
|
|
37
|
-
else
|
|
38
|
-
for (const [s, r] of Object.entries(e.permissions)) {
|
|
39
|
-
const i = `access.permissions.${s}`;
|
|
40
|
-
if (!m(r)) {
|
|
41
|
-
n.push(`${i}: expected an object`);
|
|
42
|
-
continue;
|
|
43
|
-
}
|
|
44
|
-
const c = (Array.isArray(r.clauses) ? r.clauses : []).map((f, g) => {
|
|
45
|
-
const a = `${i}.clauses[${g}]`;
|
|
46
|
-
if (!m(f))
|
|
47
|
-
return n.push(`${a}: expected an object`), { scope: { level: "" }, qualifier: "own" };
|
|
48
|
-
const l = { scope: $(f.scope, `${a}.scope`, n), qualifier: S(f.qualifier, `${a}.qualifier`, n) };
|
|
49
|
-
return typeof f.role == "string" ? { ...l, role: f.role } : l;
|
|
50
|
-
});
|
|
51
|
-
t[s] = {
|
|
52
|
-
scope: $(r.scope, `${i}.scope`, n),
|
|
53
|
-
qualifier: S(r.qualifier, `${i}.qualifier`, n),
|
|
54
|
-
clauses: c
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
const u = e.unavailable ?? [];
|
|
58
|
-
return (!Array.isArray(u) || !u.every((s) => typeof s == "string")) && n.push("access.unavailable: expected an array of strings"), {
|
|
59
|
-
snapshot: {
|
|
60
|
-
root: e.root === !0,
|
|
61
|
-
permissions: t,
|
|
62
|
-
unavailable: Array.isArray(u) ? u.filter((s) => typeof s == "string") : []
|
|
63
|
-
},
|
|
64
|
-
issues: n
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
const N = (e) => typeof e == "object" && e !== null && !Array.isArray(e);
|
|
68
|
-
function j(e, n, t = "navigation") {
|
|
69
|
-
return Array.isArray(e) ? e.flatMap((o, u) => {
|
|
70
|
-
const s = `${t}[${u}]`;
|
|
71
|
-
if (!N(o) || typeof o.i18n != "string")
|
|
72
|
-
return n.push(`${s}: expected an object with an i18n key`), [];
|
|
73
|
-
for (const i of ["icon", "route"])
|
|
74
|
-
o[i] != null && typeof o[i] != "string" && n.push(`${s}.${i}: expected a string`);
|
|
75
|
-
const r = o.children == null ? void 0 : j(o.children, n, `${s}.children`);
|
|
76
|
-
return [
|
|
77
|
-
{
|
|
78
|
-
i18n: o.i18n,
|
|
79
|
-
...typeof o.icon == "string" && { icon: o.icon },
|
|
80
|
-
...typeof o.route == "string" && { route: o.route },
|
|
81
|
-
...r && { children: r }
|
|
82
|
-
}
|
|
83
|
-
];
|
|
84
|
-
}) : (n.push(`${t}: expected an array`), []);
|
|
85
|
-
}
|
|
86
|
-
const b = (e) => typeof e == "object" && e !== null && !Array.isArray(e), B = (e) => {
|
|
87
|
-
if (b(e) && (typeof e.id == "number" || typeof e.id == "string")) return { id: e.id };
|
|
88
|
-
throw new TypeError("expected an object with a numeric or string id");
|
|
89
|
-
};
|
|
90
|
-
function F(e, n = B) {
|
|
91
|
-
const t = [];
|
|
92
|
-
if (!b(e)) throw w(["expected an object"]);
|
|
93
|
-
let o = null;
|
|
94
|
-
try {
|
|
95
|
-
o = n(e.user);
|
|
96
|
-
} catch (c) {
|
|
97
|
-
t.push(`user: ${c instanceof Error ? c.message : "invalid"}`);
|
|
98
|
-
}
|
|
99
|
-
let u = null;
|
|
100
|
-
if (e.expires_at !== void 0 && e.expires_at !== null) {
|
|
101
|
-
const c = typeof e.expires_at == "string" ? new Date(e.expires_at) : null;
|
|
102
|
-
c === null || Number.isNaN(c.getTime()) ? t.push("expires_at: expected an ISO date-time string") : u = c;
|
|
103
|
-
}
|
|
104
|
-
let s;
|
|
105
|
-
if (e.impersonator !== void 0 && e.impersonator !== null) {
|
|
106
|
-
const c = e.impersonator;
|
|
107
|
-
b(c) && (typeof c.id == "number" || typeof c.id == "string") && typeof c.name == "string" ? s = { id: c.id, name: c.name } : t.push("impersonator: expected { id, name }");
|
|
108
|
-
}
|
|
109
|
-
const r = T(e.access);
|
|
110
|
-
t.push(...r.issues);
|
|
111
|
-
const i = e.navigation === void 0 || e.navigation === null ? void 0 : j(e.navigation, t);
|
|
112
|
-
if (o === null || t.length > 0) throw w(t);
|
|
113
|
-
return { user: o, expiresAt: u, access: r.snapshot, ...s && { impersonator: s }, ...i && { navigation: i } };
|
|
114
|
-
}
|
|
115
|
-
const w = (e) => new U({ kind: "malformed", message: `Unreadable session payload: ${e.join("; ")}` });
|
|
116
|
-
function H(e, n = {}) {
|
|
117
|
-
const { mePath: t = "/auth/me", signOutPath: o = "/auth/logout", parseUser: u } = n;
|
|
118
|
-
return {
|
|
119
|
-
async load(s) {
|
|
120
|
-
try {
|
|
121
|
-
const { data: r } = await e.get(t, { signal: s, handleUnauthorized: !1 });
|
|
122
|
-
return F(r, u);
|
|
123
|
-
} catch (r) {
|
|
124
|
-
if (x(r) && r.kind === "unauthorized") return null;
|
|
125
|
-
throw r;
|
|
126
|
-
}
|
|
127
|
-
},
|
|
128
|
-
async signOut() {
|
|
129
|
-
try {
|
|
130
|
-
await e.post(o, void 0, { handleUnauthorized: !1 });
|
|
131
|
-
} catch (s) {
|
|
132
|
-
if (!(x(s) && s.kind === "unauthorized")) throw s;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
function E(e) {
|
|
138
|
-
return e.status === "authenticated" ? e : e.status === "anonymous" && e.reason === "expired" ? e.previous ?? null : null;
|
|
139
|
-
}
|
|
140
|
-
const O = 3e3;
|
|
141
|
-
function Q(e, n = {}) {
|
|
142
|
-
const t = _({ status: "unknown" });
|
|
143
|
-
let o = 0;
|
|
144
|
-
const u = new Set(n.beforeSignOut ? [n.beforeSignOut] : []);
|
|
145
|
-
let s = !1, r = null, i = null;
|
|
146
|
-
function c() {
|
|
147
|
-
o++, i?.controller.abort(), i = null;
|
|
148
|
-
}
|
|
149
|
-
async function f(a) {
|
|
150
|
-
const l = new AbortController();
|
|
151
|
-
let h;
|
|
152
|
-
const y = new Promise((p) => {
|
|
153
|
-
h = setTimeout(() => {
|
|
154
|
-
l.abort(), n.onError?.(new Error(`A before-sign-out hook did not finish within ${O} ms; signing out without it.`)), p();
|
|
155
|
-
}, O);
|
|
156
|
-
}), v = Promise.all(
|
|
157
|
-
[...u].map(async (p) => {
|
|
158
|
-
try {
|
|
159
|
-
await p(a, l.signal);
|
|
160
|
-
} catch (d) {
|
|
161
|
-
n.onError?.(d);
|
|
162
|
-
}
|
|
163
|
-
})
|
|
164
|
-
).then(() => {
|
|
165
|
-
});
|
|
166
|
-
await Promise.race([v, y]), clearTimeout(h);
|
|
167
|
-
}
|
|
168
|
-
function g() {
|
|
169
|
-
if (i) return i.promise;
|
|
170
|
-
const a = o, l = new AbortController(), h = t.value, y = E(h) !== null;
|
|
171
|
-
y || (t.value = { status: "loading" });
|
|
172
|
-
const v = async () => {
|
|
173
|
-
try {
|
|
174
|
-
const d = await e.load(l.signal);
|
|
175
|
-
if (o !== a) return t.value;
|
|
176
|
-
t.value = d ? { status: "authenticated", ...d } : { status: "anonymous", reason: "none" };
|
|
177
|
-
} catch (d) {
|
|
178
|
-
if (o !== a) return t.value;
|
|
179
|
-
n.onError?.(d), t.value = y ? h : { status: "failed", error: d };
|
|
180
|
-
} finally {
|
|
181
|
-
o === a && (i = null);
|
|
182
|
-
}
|
|
183
|
-
return t.value;
|
|
184
|
-
}, p = Promise.resolve().then(v);
|
|
185
|
-
return i = { controller: l, promise: p }, p;
|
|
186
|
-
}
|
|
187
|
-
return {
|
|
188
|
-
state: t,
|
|
189
|
-
restore: () => t.value.status === "unknown" || t.value.status === "failed" ? g() : i?.promise ?? Promise.resolve(t.value),
|
|
190
|
-
refresh: g,
|
|
191
|
-
establish(a) {
|
|
192
|
-
c(), t.value = { status: "authenticated", ...a };
|
|
193
|
-
},
|
|
194
|
-
update(a) {
|
|
195
|
-
const l = t.value;
|
|
196
|
-
if (l.status === "authenticated") {
|
|
197
|
-
if (a.user && a.user.id !== l.user.id)
|
|
198
|
-
throw new Error(`session.update cannot change who is signed in (user ${String(l.user.id)} to ${String(a.user.id)}); use session.establish for a different person.`);
|
|
199
|
-
t.value = {
|
|
200
|
-
...l,
|
|
201
|
-
user: a.user ?? l.user,
|
|
202
|
-
access: a.access ?? l.access,
|
|
203
|
-
...(a.navigation ?? l.navigation) && { navigation: a.navigation ?? l.navigation }
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
},
|
|
207
|
-
expire() {
|
|
208
|
-
if (t.value.status !== "authenticated") return;
|
|
209
|
-
const { status: a, ...l } = t.value;
|
|
210
|
-
c(), t.value = s && !t.value.impersonator ? { status: "anonymous", reason: "expired", previous: l } : { status: "anonymous", reason: "expired" }, n.onExpired?.();
|
|
211
|
-
},
|
|
212
|
-
signOut() {
|
|
213
|
-
return r ?? (r = (async () => {
|
|
214
|
-
try {
|
|
215
|
-
const a = t.value;
|
|
216
|
-
a.status === "authenticated" && u.size > 0 && await f(a.user), c(), t.value = { status: "anonymous", reason: "signedOut" }, await e.signOut();
|
|
217
|
-
} finally {
|
|
218
|
-
r = null;
|
|
219
|
-
}
|
|
220
|
-
})()), r;
|
|
221
|
-
},
|
|
222
|
-
holdExpired(a) {
|
|
223
|
-
s = a;
|
|
224
|
-
},
|
|
225
|
-
onBeforeSignOut(a) {
|
|
226
|
-
return u.add(a), () => void u.delete(a);
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
function G(e) {
|
|
231
|
-
let n = null;
|
|
232
|
-
const t = k({
|
|
233
|
-
baseUrl: e.config.apiBase,
|
|
234
|
-
transport: e.transport,
|
|
235
|
-
headers: e.headers,
|
|
236
|
-
credentials: e.credentials,
|
|
237
|
-
requestId: e.requestId,
|
|
238
|
-
async onUnauthorized() {
|
|
239
|
-
return s.state.value.status !== "authenticated" ? "fail" : e.renewSession && (n ?? (n = e.renewSession(s, t).then(
|
|
240
|
-
(i) => i,
|
|
241
|
-
() => !1
|
|
242
|
-
).finally(() => {
|
|
243
|
-
n = null;
|
|
244
|
-
})), await n) ? "retry" : (s.expire(), "fail");
|
|
245
|
-
}
|
|
246
|
-
}), o = e.session ?? ((i) => H(i)), u = typeof o == "function" ? o(t) : o, s = Q(u, { onError: e.onSessionError, onExpired: e.onSessionExpired, beforeSignOut: e.beforeSignOut }), r = I(
|
|
247
|
-
() => E(s.state.value)?.access ?? null,
|
|
248
|
-
{ covers: e.covers }
|
|
249
|
-
);
|
|
250
|
-
return { config: e.config, http: t, session: s, access: r };
|
|
251
|
-
}
|
|
252
|
-
const P = q("platform"), R = P[0], J = P[1];
|
|
253
|
-
function V(e, n) {
|
|
254
|
-
e.provide(R, n);
|
|
255
|
-
}
|
|
256
|
-
export {
|
|
257
|
-
G as a,
|
|
258
|
-
O as b,
|
|
259
|
-
I as c,
|
|
260
|
-
Q as d,
|
|
261
|
-
H as e,
|
|
262
|
-
F as f,
|
|
263
|
-
R as g,
|
|
264
|
-
E as h,
|
|
265
|
-
V as i,
|
|
266
|
-
j as p,
|
|
267
|
-
J as u
|
|
268
|
-
};
|