@ztimson/momentum 0.45.0 → 0.46.0
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/actions.d.ts +3 -4
- package/dist/actions.d.ts.map +1 -1
- package/dist/ai.d.ts +2 -2
- package/dist/ai.d.ts.map +1 -1
- package/dist/analytics.d.ts +2 -2
- package/dist/analytics.d.ts.map +1 -1
- package/dist/api.d.ts +7 -8
- package/dist/api.d.ts.map +1 -1
- package/dist/auth.d.ts +9 -12
- package/dist/auth.d.ts.map +1 -1
- package/dist/client.d.ts +2 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.d.ts.map +1 -1
- package/dist/data.d.ts +7 -8
- package/dist/data.d.ts.map +1 -1
- package/dist/email.d.ts +2 -2
- package/dist/email.d.ts.map +1 -1
- package/dist/groups.d.ts +3 -4
- package/dist/groups.d.ts.map +1 -1
- package/dist/index.cjs +579 -603
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +579 -603
- package/dist/logger.d.ts +34 -15
- package/dist/logger.d.ts.map +1 -1
- package/dist/momentum.d.ts +9 -4
- package/dist/momentum.d.ts.map +1 -1
- package/dist/payments.d.ts +2 -2
- package/dist/payments.d.ts.map +1 -1
- package/dist/pdf.d.ts +2 -2
- package/dist/pdf.d.ts.map +1 -1
- package/dist/settings.d.ts +2 -3
- package/dist/settings.d.ts.map +1 -1
- package/dist/static.d.ts +2 -3
- package/dist/static.d.ts.map +1 -1
- package/dist/storage.d.ts +2 -3
- package/dist/storage.d.ts.map +1 -1
- package/dist/users.d.ts +2 -3
- package/dist/users.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/pathed-events.d.ts +0 -121
- package/dist/pathed-events.d.ts.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -5,29 +5,29 @@
|
|
|
5
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
6
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var c = (
|
|
11
|
-
function
|
|
12
|
-
if (
|
|
13
|
-
return Array.isArray(
|
|
14
|
-
(t &&
|
|
15
|
-
}),
|
|
8
|
+
var ut = Object.defineProperty;
|
|
9
|
+
var at = (n, t, e) => t in n ? ut(n, t, { enumerable: true, configurable: true, writable: true, value: e }) : n[t] = e;
|
|
10
|
+
var c = (n, t, e) => at(n, typeof t != "symbol" ? t + "" : t, e);
|
|
11
|
+
function lt(n, t = false) {
|
|
12
|
+
if (n == null) throw new Error("Cannot clean a NULL value");
|
|
13
|
+
return Array.isArray(n) ? n = n.filter((e) => e != null) : Object.entries(n).forEach(([e, r]) => {
|
|
14
|
+
(t && r === void 0 || !t && r == null) && delete n[e];
|
|
15
|
+
}), n;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
const e = typeof
|
|
19
|
-
return e != "object" ||
|
|
17
|
+
function $(n, t) {
|
|
18
|
+
const e = typeof n, r = typeof t;
|
|
19
|
+
return e != "object" || n == null || r != "object" || t == null ? e == "function" && r == "function" ? n.toString() == t.toString() : n === t : Object.keys(n).length != Object.keys(t).length ? false : Object.keys(n).every((i) => $(n[i], t[i]));
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function k(n) {
|
|
22
22
|
try {
|
|
23
|
-
return JSON.parse(
|
|
23
|
+
return JSON.parse(n);
|
|
24
24
|
} catch {
|
|
25
|
-
return
|
|
25
|
+
return n;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function It(n, t) {
|
|
29
29
|
let e = [];
|
|
30
|
-
return JSON.stringify(
|
|
30
|
+
return JSON.stringify(n, (r, s) => {
|
|
31
31
|
if (typeof s == "object" && s !== null) {
|
|
32
32
|
if (e.includes(s)) return;
|
|
33
33
|
e.push(s);
|
|
@@ -35,10 +35,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
35
35
|
return s;
|
|
36
36
|
}, t);
|
|
37
37
|
}
|
|
38
|
-
function
|
|
39
|
-
return Array.isArray(
|
|
38
|
+
function b(n) {
|
|
39
|
+
return Array.isArray(n) ? n : [n];
|
|
40
40
|
}
|
|
41
|
-
class
|
|
41
|
+
class E extends Array {
|
|
42
42
|
/** Number of elements in set */
|
|
43
43
|
get size() {
|
|
44
44
|
return this.length;
|
|
@@ -63,8 +63,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
63
63
|
*/
|
|
64
64
|
delete(...t) {
|
|
65
65
|
t.forEach((e) => {
|
|
66
|
-
const
|
|
67
|
-
|
|
66
|
+
const r = this.indexOf(e);
|
|
67
|
+
r != -1 && this.slice(r, 1);
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
@@ -73,7 +73,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
73
73
|
* @return {ASet<T>} Different elements
|
|
74
74
|
*/
|
|
75
75
|
difference(t) {
|
|
76
|
-
return new
|
|
76
|
+
return new E(this.filter((e) => !t.has(e)));
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
79
|
* Check if set includes element
|
|
@@ -89,7 +89,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
89
89
|
* @return {boolean} Set of common elements
|
|
90
90
|
*/
|
|
91
91
|
intersection(t) {
|
|
92
|
-
return new
|
|
92
|
+
return new E(this.filter((e) => t.has(e)));
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
95
95
|
* Check if this set has no elements in common with the comparison set
|
|
@@ -121,7 +121,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
121
121
|
* @return {ASet<T>} New set of unique elements
|
|
122
122
|
*/
|
|
123
123
|
symmetricDifference(t) {
|
|
124
|
-
return new
|
|
124
|
+
return new E([...this.difference(t), ...t.difference(this)]);
|
|
125
125
|
}
|
|
126
126
|
/**
|
|
127
127
|
* Create joined list of elements included in this & the comparison set
|
|
@@ -129,10 +129,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
129
129
|
* @return {ASet<T>} New set of both previous sets combined
|
|
130
130
|
*/
|
|
131
131
|
union(t) {
|
|
132
|
-
return new
|
|
132
|
+
return new E([...this, ...t]);
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
|
-
class
|
|
135
|
+
class Gt {
|
|
136
136
|
/**
|
|
137
137
|
* Create new cache
|
|
138
138
|
*
|
|
@@ -144,8 +144,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
144
144
|
c(this, "complete", false);
|
|
145
145
|
c(this, "values", this.all());
|
|
146
146
|
return this.key = t, this.ttl = e, new Proxy(this, {
|
|
147
|
-
get: (
|
|
148
|
-
set: (
|
|
147
|
+
get: (r, s) => s in r ? r[s] : r.store[s],
|
|
148
|
+
set: (r, s, i) => (s in r ? r[s] = i : r.store[s] = i, true)
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
151
|
getKey(t) {
|
|
@@ -168,8 +168,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
168
168
|
* @return {this}
|
|
169
169
|
*/
|
|
170
170
|
add(t, e = this.ttl) {
|
|
171
|
-
const
|
|
172
|
-
return this.set(
|
|
171
|
+
const r = this.getKey(t);
|
|
172
|
+
return this.set(r, t, e), this;
|
|
173
173
|
}
|
|
174
174
|
/**
|
|
175
175
|
* Add several rows to the cache
|
|
@@ -179,7 +179,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
179
179
|
* @return {this}
|
|
180
180
|
*/
|
|
181
181
|
addAll(t, e = true) {
|
|
182
|
-
return t.forEach((
|
|
182
|
+
return t.forEach((r) => this.add(r)), this.complete = e, this;
|
|
183
183
|
}
|
|
184
184
|
/**
|
|
185
185
|
* Delete an item from the cache
|
|
@@ -228,18 +228,18 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
228
228
|
* @param {number | undefined} ttl Override default expiry
|
|
229
229
|
* @return {this}
|
|
230
230
|
*/
|
|
231
|
-
set(t, e,
|
|
232
|
-
return this.store[t] = e,
|
|
231
|
+
set(t, e, r = this.ttl) {
|
|
232
|
+
return this.store[t] = e, r && setTimeout(() => {
|
|
233
233
|
this.complete = false, this.delete(t);
|
|
234
|
-
},
|
|
234
|
+
}, r), this;
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
|
-
class
|
|
237
|
+
class O extends Promise {
|
|
238
238
|
constructor(e) {
|
|
239
|
-
super((
|
|
240
|
-
(
|
|
241
|
-
(
|
|
242
|
-
(
|
|
239
|
+
super((r, s) => e(
|
|
240
|
+
(i) => r(i),
|
|
241
|
+
(i) => s(i),
|
|
242
|
+
(i) => this.progress = i
|
|
243
243
|
));
|
|
244
244
|
c(this, "listeners", []);
|
|
245
245
|
c(this, "_progress", 0);
|
|
@@ -248,20 +248,20 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
248
248
|
return this._progress;
|
|
249
249
|
}
|
|
250
250
|
set progress(e) {
|
|
251
|
-
e != this._progress && (this._progress = e, this.listeners.forEach((
|
|
251
|
+
e != this._progress && (this._progress = e, this.listeners.forEach((r) => r(e)));
|
|
252
252
|
}
|
|
253
253
|
static from(e) {
|
|
254
|
-
return e instanceof
|
|
254
|
+
return e instanceof O ? e : new O((r, s) => e.then((...i) => r(...i)).catch((...i) => s(...i)));
|
|
255
255
|
}
|
|
256
256
|
from(e) {
|
|
257
|
-
const
|
|
258
|
-
return this.onProgress((s) =>
|
|
257
|
+
const r = O.from(e);
|
|
258
|
+
return this.onProgress((s) => r.progress = s), r;
|
|
259
259
|
}
|
|
260
260
|
onProgress(e) {
|
|
261
261
|
return this.listeners.push(e), this;
|
|
262
262
|
}
|
|
263
|
-
then(e,
|
|
264
|
-
const s = super.then(e,
|
|
263
|
+
then(e, r) {
|
|
264
|
+
const s = super.then(e, r);
|
|
265
265
|
return this.from(s);
|
|
266
266
|
}
|
|
267
267
|
catch(e) {
|
|
@@ -271,81 +271,81 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
271
271
|
return this.from(super.finally(e));
|
|
272
272
|
}
|
|
273
273
|
}
|
|
274
|
-
function
|
|
275
|
-
|
|
276
|
-
const e = URL.createObjectURL(
|
|
277
|
-
|
|
274
|
+
function qt(n, t) {
|
|
275
|
+
n instanceof Blob || (n = new Blob(b(n)));
|
|
276
|
+
const e = URL.createObjectURL(n);
|
|
277
|
+
pt(e, t), URL.revokeObjectURL(e);
|
|
278
278
|
}
|
|
279
|
-
function
|
|
279
|
+
function pt(n, t) {
|
|
280
280
|
const e = document.createElement("a");
|
|
281
|
-
e.href =
|
|
281
|
+
e.href = n, e.download = t || n.split("/").pop(), document.body.appendChild(e), e.click(), document.body.removeChild(e);
|
|
282
282
|
}
|
|
283
|
-
function
|
|
283
|
+
function Ft(n = {}) {
|
|
284
284
|
return new Promise((t) => {
|
|
285
285
|
const e = document.createElement("input");
|
|
286
|
-
e.type = "file", e.accept =
|
|
286
|
+
e.type = "file", e.accept = n.accept || "*", e.style.display = "none", e.multiple = !!n.multiple, e.onblur = e.onchange = async () => {
|
|
287
287
|
t(Array.from(e.files)), e.remove();
|
|
288
288
|
}, document.body.appendChild(e), e.click();
|
|
289
289
|
});
|
|
290
290
|
}
|
|
291
|
-
function
|
|
291
|
+
function Yt(n, t = /* @__PURE__ */ new Date()) {
|
|
292
292
|
(typeof t == "number" || typeof t == "string") && (t = new Date(t));
|
|
293
293
|
const e = `${t.getFullYear()}-${(t.getMonth() + 1).toString().padStart(2, "0")}-${t.getDate().toString().padStart(2, "0")}_${t.getHours().toString().padStart(2, "0")}-${t.getMinutes().toString().padStart(2, "0")}-${t.getSeconds().toString().padStart(2, "0")}`;
|
|
294
294
|
return e;
|
|
295
295
|
}
|
|
296
|
-
function
|
|
297
|
-
return new
|
|
298
|
-
const s = new XMLHttpRequest(),
|
|
299
|
-
|
|
296
|
+
function Ht(n) {
|
|
297
|
+
return new O((t, e, r) => {
|
|
298
|
+
const s = new XMLHttpRequest(), i = new FormData();
|
|
299
|
+
n.files.forEach((o) => i.append("file", o)), s.withCredentials = !!n.withCredentials, s.upload.addEventListener("progress", (o) => o.lengthComputable ? r(o.loaded / o.total) : null), s.addEventListener("loadend", () => t(k(s.responseText))), s.addEventListener("error", () => e(k(s.responseText))), s.addEventListener("timeout", () => e({ error: "Request timed out" })), s.open("POST", n.url), Object.entries(n.headers || {}).forEach(([o, u]) => s.setRequestHeader(o, u)), s.send(i);
|
|
300
300
|
});
|
|
301
301
|
}
|
|
302
|
-
class
|
|
302
|
+
class z {
|
|
303
303
|
constructor() {
|
|
304
304
|
c(this, "listeners", {});
|
|
305
305
|
}
|
|
306
306
|
static emit(t, ...e) {
|
|
307
|
-
(this.listeners["*"] || []).forEach((
|
|
307
|
+
(this.listeners["*"] || []).forEach((r) => r(t, ...e)), (this.listeners[t.toString()] || []).forEach((r) => r(...e));
|
|
308
308
|
}
|
|
309
309
|
static off(t, e) {
|
|
310
|
-
const
|
|
311
|
-
this.listeners[
|
|
310
|
+
const r = t.toString();
|
|
311
|
+
this.listeners[r] = (this.listeners[r] || []).filter((s) => s === e);
|
|
312
312
|
}
|
|
313
313
|
static on(t, e) {
|
|
314
314
|
var s;
|
|
315
|
-
const
|
|
316
|
-
return this.listeners[
|
|
315
|
+
const r = t.toString();
|
|
316
|
+
return this.listeners[r] || (this.listeners[r] = []), (s = this.listeners[r]) == null || s.push(e), () => this.off(t, e);
|
|
317
317
|
}
|
|
318
318
|
static once(t, e) {
|
|
319
|
-
return new Promise((
|
|
320
|
-
const s = this.on(t, (...
|
|
321
|
-
|
|
319
|
+
return new Promise((r) => {
|
|
320
|
+
const s = this.on(t, (...i) => {
|
|
321
|
+
r(i.length == 1 ? i[0] : i), e && e(...i), s();
|
|
322
322
|
});
|
|
323
323
|
});
|
|
324
324
|
}
|
|
325
325
|
emit(t, ...e) {
|
|
326
|
-
(this.listeners["*"] || []).forEach((
|
|
326
|
+
(this.listeners["*"] || []).forEach((r) => r(t, ...e)), (this.listeners[t] || []).forEach((r) => r(...e));
|
|
327
327
|
}
|
|
328
328
|
off(t, e) {
|
|
329
|
-
this.listeners[t] = (this.listeners[t] || []).filter((
|
|
329
|
+
this.listeners[t] = (this.listeners[t] || []).filter((r) => r === e);
|
|
330
330
|
}
|
|
331
331
|
on(t, e) {
|
|
332
|
-
var
|
|
333
|
-
return this.listeners[t] || (this.listeners[t] = []), (
|
|
332
|
+
var r;
|
|
333
|
+
return this.listeners[t] || (this.listeners[t] = []), (r = this.listeners[t]) == null || r.push(e), () => this.off(t, e);
|
|
334
334
|
}
|
|
335
335
|
once(t, e) {
|
|
336
|
-
return new Promise((
|
|
337
|
-
const s = this.on(t, (...
|
|
338
|
-
|
|
336
|
+
return new Promise((r) => {
|
|
337
|
+
const s = this.on(t, (...i) => {
|
|
338
|
+
r(i.length == 1 ? i[0] : i), e && e(...i), s();
|
|
339
339
|
});
|
|
340
340
|
});
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
|
-
c(
|
|
344
|
-
class
|
|
345
|
-
constructor(e,
|
|
343
|
+
c(z, "listeners", {});
|
|
344
|
+
class g extends Error {
|
|
345
|
+
constructor(e, r) {
|
|
346
346
|
super(e);
|
|
347
347
|
c(this, "_code");
|
|
348
|
-
|
|
348
|
+
r != null && (this._code = r);
|
|
349
349
|
}
|
|
350
350
|
get code() {
|
|
351
351
|
return this._code || this.constructor.code;
|
|
@@ -354,11 +354,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
354
354
|
this._code = e;
|
|
355
355
|
}
|
|
356
356
|
static from(e) {
|
|
357
|
-
const
|
|
357
|
+
const r = Number(e.statusCode) ?? Number(e.code), s = new this(e.message || e.toString());
|
|
358
358
|
return Object.assign(s, {
|
|
359
359
|
stack: e.stack,
|
|
360
360
|
...e,
|
|
361
|
-
code:
|
|
361
|
+
code: r ?? void 0
|
|
362
362
|
});
|
|
363
363
|
}
|
|
364
364
|
static instanceof(e) {
|
|
@@ -368,8 +368,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
368
368
|
return this.message || super.toString();
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
|
-
c(
|
|
372
|
-
class
|
|
371
|
+
c(g, "code", 500);
|
|
372
|
+
class K extends g {
|
|
373
373
|
constructor(t = "Bad Request") {
|
|
374
374
|
super(t);
|
|
375
375
|
}
|
|
@@ -377,8 +377,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
377
377
|
return t.constructor.code == this.code;
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
|
-
c(
|
|
381
|
-
class
|
|
380
|
+
c(K, "code", 400);
|
|
381
|
+
class Z extends g {
|
|
382
382
|
constructor(t = "Unauthorized") {
|
|
383
383
|
super(t);
|
|
384
384
|
}
|
|
@@ -386,8 +386,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
386
386
|
return t.constructor.code == this.code;
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
|
-
c(
|
|
390
|
-
class
|
|
389
|
+
c(Z, "code", 401);
|
|
390
|
+
class _ extends g {
|
|
391
391
|
constructor(t = "Payment Required") {
|
|
392
392
|
super(t);
|
|
393
393
|
}
|
|
@@ -395,8 +395,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
395
395
|
return t.constructor.code == this.code;
|
|
396
396
|
}
|
|
397
397
|
}
|
|
398
|
-
c(
|
|
399
|
-
class
|
|
398
|
+
c(_, "code", 402);
|
|
399
|
+
class V extends g {
|
|
400
400
|
constructor(t = "Forbidden") {
|
|
401
401
|
super(t);
|
|
402
402
|
}
|
|
@@ -404,8 +404,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
404
404
|
return t.constructor.code == this.code;
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
|
-
c(
|
|
408
|
-
class
|
|
407
|
+
c(V, "code", 403);
|
|
408
|
+
class X extends g {
|
|
409
409
|
constructor(t = "Not Found") {
|
|
410
410
|
super(t);
|
|
411
411
|
}
|
|
@@ -413,8 +413,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
413
413
|
return t.constructor.code == this.code;
|
|
414
414
|
}
|
|
415
415
|
}
|
|
416
|
-
c(
|
|
417
|
-
class
|
|
416
|
+
c(X, "code", 404);
|
|
417
|
+
class Q extends g {
|
|
418
418
|
constructor(t = "Method Not Allowed") {
|
|
419
419
|
super(t);
|
|
420
420
|
}
|
|
@@ -422,8 +422,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
422
422
|
return t.constructor.code == this.code;
|
|
423
423
|
}
|
|
424
424
|
}
|
|
425
|
-
c(
|
|
426
|
-
class
|
|
425
|
+
c(Q, "code", 405);
|
|
426
|
+
class tt extends g {
|
|
427
427
|
constructor(t = "Not Acceptable") {
|
|
428
428
|
super(t);
|
|
429
429
|
}
|
|
@@ -431,8 +431,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
431
431
|
return t.constructor.code == this.code;
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
|
-
c(
|
|
435
|
-
class
|
|
434
|
+
c(tt, "code", 406);
|
|
435
|
+
class et extends g {
|
|
436
436
|
constructor(t = "Internal Server Error") {
|
|
437
437
|
super(t);
|
|
438
438
|
}
|
|
@@ -440,8 +440,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
440
440
|
return t.constructor.code == this.code;
|
|
441
441
|
}
|
|
442
442
|
}
|
|
443
|
-
c(
|
|
444
|
-
class
|
|
443
|
+
c(et, "code", 500);
|
|
444
|
+
class nt extends g {
|
|
445
445
|
constructor(t = "Not Implemented") {
|
|
446
446
|
super(t);
|
|
447
447
|
}
|
|
@@ -449,8 +449,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
449
449
|
return t.constructor.code == this.code;
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
|
-
c(
|
|
453
|
-
class
|
|
452
|
+
c(nt, "code", 501);
|
|
453
|
+
class rt extends g {
|
|
454
454
|
constructor(t = "Bad Gateway") {
|
|
455
455
|
super(t);
|
|
456
456
|
}
|
|
@@ -458,8 +458,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
458
458
|
return t.constructor.code == this.code;
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
|
-
c(
|
|
462
|
-
class
|
|
461
|
+
c(rt, "code", 502);
|
|
462
|
+
class st extends g {
|
|
463
463
|
constructor(t = "Service Unavailable") {
|
|
464
464
|
super(t);
|
|
465
465
|
}
|
|
@@ -467,8 +467,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
467
467
|
return t.constructor.code == this.code;
|
|
468
468
|
}
|
|
469
469
|
}
|
|
470
|
-
c(
|
|
471
|
-
class
|
|
470
|
+
c(st, "code", 503);
|
|
471
|
+
class it extends g {
|
|
472
472
|
constructor(t = "Gateway Timeout") {
|
|
473
473
|
super(t);
|
|
474
474
|
}
|
|
@@ -476,18 +476,18 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
476
476
|
return t.constructor.code == this.code;
|
|
477
477
|
}
|
|
478
478
|
}
|
|
479
|
-
c(
|
|
480
|
-
const
|
|
479
|
+
c(it, "code", 504);
|
|
480
|
+
const m = class m2 {
|
|
481
481
|
constructor(t = {}) {
|
|
482
482
|
c(this, "interceptors", {});
|
|
483
483
|
c(this, "headers", {});
|
|
484
484
|
c(this, "url");
|
|
485
|
-
this.url = t.url ?? null, this.headers = t.headers || {}, t.interceptors && t.interceptors.forEach((e) =>
|
|
485
|
+
this.url = t.url ?? null, this.headers = t.headers || {}, t.interceptors && t.interceptors.forEach((e) => m2.addInterceptor(e));
|
|
486
486
|
}
|
|
487
487
|
static addInterceptor(t) {
|
|
488
|
-
const e = Object.keys(
|
|
489
|
-
return
|
|
490
|
-
|
|
488
|
+
const e = Object.keys(m2.interceptors).length.toString();
|
|
489
|
+
return m2.interceptors[e] = t, () => {
|
|
490
|
+
m2.interceptors[e] = null;
|
|
491
491
|
};
|
|
492
492
|
}
|
|
493
493
|
addInterceptor(t) {
|
|
@@ -500,50 +500,50 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
500
500
|
var s;
|
|
501
501
|
if (!this.url && !t.url) throw new Error("URL needs to be set");
|
|
502
502
|
let e = ((s = t.url) != null && s.startsWith("http") ? t.url : (this.url || "") + (t.url || "")).replace(/([^:]\/)\/+/g, "$1");
|
|
503
|
-
if (t.fragment && (e.includes("#") ? e.replace(/#.*(\?|\n)/g, (
|
|
504
|
-
const
|
|
505
|
-
e += (e.includes("?") ? "&" : "?") +
|
|
503
|
+
if (t.fragment && (e.includes("#") ? e.replace(/#.*(\?|\n)/g, (i, o) => `#${t.fragment}${o}`) : e += "#" + t.fragment), t.query) {
|
|
504
|
+
const i = Array.isArray(t.query) ? t.query : Object.keys(t.query).map((o) => ({ key: o, value: t.query[o] }));
|
|
505
|
+
e += (e.includes("?") ? "&" : "?") + i.map((o) => `${o.key}=${o.value}`).join("&");
|
|
506
506
|
}
|
|
507
|
-
const
|
|
507
|
+
const r = lt({
|
|
508
508
|
"Content-Type": t.body ? t.body instanceof FormData ? "multipart/form-data" : "application/json" : void 0,
|
|
509
|
-
...
|
|
509
|
+
...m2.headers,
|
|
510
510
|
...this.headers,
|
|
511
511
|
...t.headers
|
|
512
512
|
});
|
|
513
|
-
return typeof t.body == "object" && t.body != null &&
|
|
513
|
+
return typeof t.body == "object" && t.body != null && r["Content-Type"] == "application/json" && (t.body = JSON.stringify(t.body)), new O((i, o, u) => {
|
|
514
514
|
fetch(e, {
|
|
515
|
-
headers:
|
|
515
|
+
headers: r,
|
|
516
516
|
method: t.method || (t.body ? "POST" : "GET"),
|
|
517
517
|
body: t.body
|
|
518
|
-
}).then(async (
|
|
519
|
-
var
|
|
520
|
-
for (let l of [...Object.values(
|
|
521
|
-
await new Promise((
|
|
522
|
-
const
|
|
523
|
-
let
|
|
524
|
-
const
|
|
518
|
+
}).then(async (a) => {
|
|
519
|
+
var q, F;
|
|
520
|
+
for (let l of [...Object.values(m2.interceptors), ...Object.values(this.interceptors)])
|
|
521
|
+
await new Promise((C) => l(a, () => C()));
|
|
522
|
+
const R = a.headers.get("Content-Length"), T = R ? parseInt(R, 10) : 0;
|
|
523
|
+
let U = 0;
|
|
524
|
+
const M = (q = a.body) == null ? void 0 : q.getReader(), ct = new ReadableStream({
|
|
525
525
|
start(l) {
|
|
526
|
-
function
|
|
527
|
-
|
|
528
|
-
if (
|
|
529
|
-
|
|
530
|
-
}).catch((
|
|
526
|
+
function C() {
|
|
527
|
+
M == null || M.read().then((A) => {
|
|
528
|
+
if (A.done) return l.close();
|
|
529
|
+
U += A.value.byteLength, u(U / T), l.enqueue(A.value), C();
|
|
530
|
+
}).catch((A) => l.error(A));
|
|
531
531
|
}
|
|
532
|
-
|
|
532
|
+
C();
|
|
533
533
|
}
|
|
534
534
|
});
|
|
535
|
-
if (
|
|
536
|
-
const l = (
|
|
537
|
-
l != null && l.includes("form") ?
|
|
535
|
+
if (a.data = new Response(ct), t.decode == null || t.decode) {
|
|
536
|
+
const l = (F = a.headers.get("Content-Type")) == null ? void 0 : F.toLowerCase();
|
|
537
|
+
l != null && l.includes("form") ? a.data = await a.data.formData() : l != null && l.includes("json") ? a.data = await a.data.json() : l != null && l.includes("text") ? a.data = await a.data.text() : l != null && l.includes("application") && (a.data = await a.data.blob());
|
|
538
538
|
}
|
|
539
|
-
|
|
539
|
+
a.ok ? i(a) : o(a);
|
|
540
540
|
});
|
|
541
541
|
});
|
|
542
542
|
}
|
|
543
543
|
};
|
|
544
|
-
c(
|
|
545
|
-
let
|
|
546
|
-
const
|
|
544
|
+
c(m, "interceptors", {}), c(m, "headers", {});
|
|
545
|
+
let H = m;
|
|
546
|
+
const j = {
|
|
547
547
|
CLEAR: "\x1B[0m",
|
|
548
548
|
BRIGHT: "\x1B[1m",
|
|
549
549
|
DIM: "\x1B[2m",
|
|
@@ -551,7 +551,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
551
551
|
BLINK: "\x1B[5m",
|
|
552
552
|
REVERSE: "\x1B[7m",
|
|
553
553
|
HIDDEN: "\x1B[8m"
|
|
554
|
-
},
|
|
554
|
+
}, L = {
|
|
555
555
|
BLACK: "\x1B[30m",
|
|
556
556
|
RED: "\x1B[31m",
|
|
557
557
|
GREEN: "\x1B[32m",
|
|
@@ -569,52 +569,190 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
569
569
|
LIGHT_CYAN: "\x1B[96m",
|
|
570
570
|
WHITE: "\x1B[97m"
|
|
571
571
|
};
|
|
572
|
-
var yt = /* @__PURE__ */ ((
|
|
573
|
-
const
|
|
572
|
+
var yt = /* @__PURE__ */ ((n) => (n[n.ERROR = 0] = "ERROR", n[n.WARN = 1] = "WARN", n[n.INFO = 2] = "INFO", n[n.LOG = 3] = "LOG", n[n.DEBUG = 4] = "DEBUG", n))(yt || {});
|
|
573
|
+
const w = class w2 extends z {
|
|
574
574
|
constructor(t) {
|
|
575
575
|
super(), this.namespace = t;
|
|
576
576
|
}
|
|
577
|
-
pad(t, e,
|
|
578
|
-
const
|
|
579
|
-
if (
|
|
580
|
-
const
|
|
581
|
-
return s ?
|
|
577
|
+
pad(t, e, r, s = false) {
|
|
578
|
+
const i = t.toString(), o = e - i.length;
|
|
579
|
+
if (o <= 0) return i;
|
|
580
|
+
const u = Array(~~(o / r.length)).fill(r).join("");
|
|
581
|
+
return s ? i + u : u + i;
|
|
582
582
|
}
|
|
583
583
|
format(...t) {
|
|
584
584
|
const e = /* @__PURE__ */ new Date();
|
|
585
585
|
return `${`${e.getFullYear()}-${e.getMonth() + 1}-${e.getDate()} ${this.pad(e.getHours().toString(), 2, "0")}:${this.pad(e.getMinutes().toString(), 2, "0")}:${this.pad(e.getSeconds().toString(), 2, "0")}.${this.pad(e.getMilliseconds().toString(), 3, "0", true)}`}${this.namespace ? ` [${this.namespace}]` : ""} ${t.join(" ")}`;
|
|
586
586
|
}
|
|
587
587
|
debug(...t) {
|
|
588
|
-
if (
|
|
588
|
+
if (w2.LOG_LEVEL < 4) return;
|
|
589
589
|
const e = this.format(...t);
|
|
590
|
-
|
|
590
|
+
w2.emit(4, e), console.debug(L.LIGHT_GREY + e + j.CLEAR);
|
|
591
591
|
}
|
|
592
592
|
log(...t) {
|
|
593
|
-
if (
|
|
593
|
+
if (w2.LOG_LEVEL < 3) return;
|
|
594
594
|
const e = this.format(...t);
|
|
595
|
-
|
|
595
|
+
w2.emit(3, e), console.log(j.CLEAR + e);
|
|
596
596
|
}
|
|
597
597
|
info(...t) {
|
|
598
|
-
if (
|
|
598
|
+
if (w2.LOG_LEVEL < 2) return;
|
|
599
599
|
const e = this.format(...t);
|
|
600
|
-
|
|
600
|
+
w2.emit(2, e), console.info(L.BLUE + e + j.CLEAR);
|
|
601
601
|
}
|
|
602
602
|
warn(...t) {
|
|
603
|
-
if (
|
|
603
|
+
if (w2.LOG_LEVEL < 1) return;
|
|
604
604
|
const e = this.format(...t);
|
|
605
|
-
|
|
605
|
+
w2.emit(1, e), console.warn(L.YELLOW + e + j.CLEAR);
|
|
606
606
|
}
|
|
607
607
|
error(...t) {
|
|
608
|
-
if (
|
|
608
|
+
if (w2.LOG_LEVEL < 0) return;
|
|
609
609
|
const e = this.format(...t);
|
|
610
|
-
|
|
610
|
+
w2.emit(0, e), console.error(L.RED + e + j.CLEAR);
|
|
611
611
|
}
|
|
612
612
|
};
|
|
613
|
-
c(
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
613
|
+
c(w, "LOG_LEVEL", 4);
|
|
614
|
+
function ue(n, ...t) {
|
|
615
|
+
const e = [];
|
|
616
|
+
for (let r = 0; r < n.length || r < t.length; r++)
|
|
617
|
+
n[r] && e.push(n[r]), t[r] && e.push(t[r]);
|
|
618
|
+
return new y(e.join(""));
|
|
619
|
+
}
|
|
620
|
+
function xt(n, ...t) {
|
|
621
|
+
let e = [];
|
|
622
|
+
for (let i = 0; i < n.length || i < t.length; i++)
|
|
623
|
+
n[i] && e.push(n[i]), t[i] && e.push(t[i]);
|
|
624
|
+
const [r, s] = e.join("").split(":");
|
|
625
|
+
return y.toString(r, s == null ? void 0 : s.split(""));
|
|
626
|
+
}
|
|
627
|
+
class y {
|
|
628
|
+
constructor(t) {
|
|
629
|
+
c(this, "module");
|
|
630
|
+
c(this, "fullPath");
|
|
631
|
+
c(this, "path");
|
|
632
|
+
c(this, "name");
|
|
633
|
+
c(this, "methods");
|
|
634
|
+
c(this, "all");
|
|
635
|
+
c(this, "none");
|
|
636
|
+
c(this, "create");
|
|
637
|
+
c(this, "read");
|
|
638
|
+
c(this, "update");
|
|
639
|
+
c(this, "delete");
|
|
640
|
+
var o;
|
|
641
|
+
if (typeof t == "object") return Object.assign(this, t);
|
|
642
|
+
let [e, r, s] = t.split(":");
|
|
643
|
+
s || (s = r || "*"), (e == "*" || !e && s == "*") && (e = "", s = "*");
|
|
644
|
+
let i = e.split("/").filter((u) => !!u);
|
|
645
|
+
this.module = ((o = i.splice(0, 1)[0]) == null ? void 0 : o.toLowerCase()) || "", this.fullPath = e, this.path = i.join("/"), this.name = i.pop() || "", this.methods = s.split(""), this.all = s == null ? void 0 : s.includes("*"), this.none = s == null ? void 0 : s.includes("n"), this.create = !(s != null && s.includes("n")) && ((s == null ? void 0 : s.includes("*")) || (s == null ? void 0 : s.includes("w")) || (s == null ? void 0 : s.includes("c"))), this.read = !(s != null && s.includes("n")) && ((s == null ? void 0 : s.includes("*")) || (s == null ? void 0 : s.includes("r"))), this.update = !(s != null && s.includes("n")) && ((s == null ? void 0 : s.includes("*")) || (s == null ? void 0 : s.includes("w")) || (s == null ? void 0 : s.includes("u"))), this.delete = !(s != null && s.includes("n")) && ((s == null ? void 0 : s.includes("*")) || (s == null ? void 0 : s.includes("w")) || (s == null ? void 0 : s.includes("d")));
|
|
646
|
+
}
|
|
647
|
+
/**
|
|
648
|
+
* Combine multiple events into one parsed object. Longest path takes precedent, but all subsequent methods are
|
|
649
|
+
* combined until a "none" is reached
|
|
650
|
+
*
|
|
651
|
+
* @param {string | PathEvent} paths Events as strings or pre-parsed
|
|
652
|
+
* @return {PathEvent} Final combined permission
|
|
653
|
+
*/
|
|
654
|
+
static combine(t) {
|
|
655
|
+
let e = false;
|
|
656
|
+
const r = t.map((s) => new y(s)).toSorted((s, i) => {
|
|
657
|
+
const o = s.fullPath.length, u = i.fullPath.length;
|
|
658
|
+
return o < u ? 1 : o > u ? -1 : 0;
|
|
659
|
+
}).reduce((s, i) => (i.none && (e = true), s ? (e || (i.all && (s.all = true), (i.all || i.create) && (s.create = true), (i.all || i.read) && (s.read = true), (i.all || i.update) && (s.update = true), (i.all || i.delete) && (s.delete = true), s.methods = [...s.methods, ...i.methods]), s) : i), null);
|
|
660
|
+
return r.all && (r.methods = ["*"]), r.none && (r.methods = ["n"]), r.methods = new E(r.methods), r.raw = xt`${r.fullPath}:${r.methods}`, r;
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* Squash 2 sets of paths & return true if any overlap is found
|
|
664
|
+
*
|
|
665
|
+
* @param {string | PathEvent | (string | PathEvent)[]} target Array of Events as strings or pre-parsed
|
|
666
|
+
* @param has Target must have at least one of these path
|
|
667
|
+
* @return {boolean} Whether there is any overlap
|
|
668
|
+
*/
|
|
669
|
+
static has(t, ...e) {
|
|
670
|
+
const r = b(e).map((i) => new y(i)), s = b(t).map((i) => new y(i));
|
|
671
|
+
return !!r.find((i) => {
|
|
672
|
+
if (!i.fullPath && i.all) return true;
|
|
673
|
+
const o = s.filter((a) => i.fullPath.startsWith(a.fullPath));
|
|
674
|
+
if (!o.length) return false;
|
|
675
|
+
const u = y.combine(o);
|
|
676
|
+
return !u.none && (u.all || new E(u.methods).intersection(new E(i.methods)).length);
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* Squash 2 sets of paths & return true if the target has all paths
|
|
681
|
+
*
|
|
682
|
+
* @param {string | PathEvent | (string | PathEvent)[]} target Array of Events as strings or pre-parsed
|
|
683
|
+
* @param has Target must have all these paths
|
|
684
|
+
* @return {boolean} Whether there is any overlap
|
|
685
|
+
*/
|
|
686
|
+
static hasAll(t, ...e) {
|
|
687
|
+
return e.filter((r) => y.has(t, r)).length == e.length;
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* Same as `has` but raises an error if there is no overlap
|
|
691
|
+
*
|
|
692
|
+
* @param {string | string[]} target Array of Events as strings or pre-parsed
|
|
693
|
+
* @param has Target must have at least one of these path
|
|
694
|
+
*/
|
|
695
|
+
static hasFatal(t, ...e) {
|
|
696
|
+
if (!y.has(t, ...e)) throw new Error(`Requires one of: ${b(e).join(", ")}`);
|
|
697
|
+
}
|
|
698
|
+
/**
|
|
699
|
+
* Same as `hasAll` but raises an error if the target is missing any paths
|
|
700
|
+
*
|
|
701
|
+
* @param {string | string[]} target Array of Events as strings or pre-parsed
|
|
702
|
+
* @param has Target must have all these paths
|
|
703
|
+
*/
|
|
704
|
+
static hasAllFatal(t, ...e) {
|
|
705
|
+
if (!y.hasAll(t, ...e)) throw new Error(`Requires all: ${b(e).join(", ")}`);
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Create event string from its components
|
|
709
|
+
*
|
|
710
|
+
* @param {string | string[]} path Event path
|
|
711
|
+
* @param {Method} methods Event method
|
|
712
|
+
* @return {string} String representation of Event
|
|
713
|
+
*/
|
|
714
|
+
static toString(t, e) {
|
|
715
|
+
let r = b(t).filter((s) => s != null).join("/");
|
|
716
|
+
return e != null && e.length && (r += `:${b(e).map((s) => s.toLowerCase()).join("")}`), r == null ? void 0 : r.trim().replaceAll(/\/{2,}/g, "/").replaceAll(/(^\/|\/$)/g, "");
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* Create event string from its components
|
|
720
|
+
*
|
|
721
|
+
* @return {string} String representation of Event
|
|
722
|
+
*/
|
|
723
|
+
toString() {
|
|
724
|
+
return y.toString(this.fullPath, this.methods);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
class ae {
|
|
728
|
+
constructor() {
|
|
729
|
+
c(this, "listeners", []);
|
|
730
|
+
}
|
|
731
|
+
emit(t, ...e) {
|
|
732
|
+
const r = new y(t);
|
|
733
|
+
this.listeners.filter((s) => y.has(s[0], t)).forEach(async (s) => s[1](r, ...e));
|
|
734
|
+
}
|
|
735
|
+
off(t) {
|
|
736
|
+
this.listeners = this.listeners.filter((e) => e[1] != t);
|
|
737
|
+
}
|
|
738
|
+
on(t, e) {
|
|
739
|
+
return b(t).forEach((r) => this.listeners.push([new y(r), e])), () => this.off(e);
|
|
740
|
+
}
|
|
741
|
+
once(t, e) {
|
|
742
|
+
return new Promise((r) => {
|
|
743
|
+
const s = this.on(t, (i, ...o) => {
|
|
744
|
+
r(o.length < 2 ? o[0] : o), e && e(i, ...o), s();
|
|
745
|
+
});
|
|
746
|
+
});
|
|
747
|
+
}
|
|
748
|
+
relayEvents(t) {
|
|
749
|
+
t.on("*", (e, ...r) => this.emit(e, ...r));
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
var v = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, At = {}, B = {};
|
|
753
|
+
Object.defineProperty(B, "__esModule", { value: true });
|
|
754
|
+
B.persist = B.Persist = void 0;
|
|
755
|
+
class ot {
|
|
618
756
|
/**
|
|
619
757
|
* @param {string} key Primary key value will be stored under
|
|
620
758
|
* @param {PersistOptions<T>} options Configure using {@link PersistOptions}
|
|
@@ -635,11 +773,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
635
773
|
/** Set value with proxy object wrapper to sync future changes */
|
|
636
774
|
set value(t) {
|
|
637
775
|
t == null || typeof t != "object" ? this._value = t : this._value = new Proxy(t, {
|
|
638
|
-
get: (e,
|
|
639
|
-
const
|
|
640
|
-
return this.save(),
|
|
641
|
-
} : e[
|
|
642
|
-
set: (e,
|
|
776
|
+
get: (e, r) => typeof e[r] == "function" ? (...i) => {
|
|
777
|
+
const o = e[r](...i);
|
|
778
|
+
return this.save(), o;
|
|
779
|
+
} : e[r],
|
|
780
|
+
set: (e, r, s) => (e[r] = s, this.save(), true)
|
|
643
781
|
}), this.save();
|
|
644
782
|
}
|
|
645
783
|
/** Notify listeners of change */
|
|
@@ -691,25 +829,25 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
691
829
|
return this.value;
|
|
692
830
|
}
|
|
693
831
|
}
|
|
694
|
-
|
|
695
|
-
function
|
|
832
|
+
B.Persist = ot;
|
|
833
|
+
function jt(n) {
|
|
696
834
|
return (t, e) => {
|
|
697
|
-
const
|
|
835
|
+
const r = (n == null ? void 0 : n.key) || `${t.constructor.name}.${e.toString()}`, s = new ot(r, n);
|
|
698
836
|
Object.defineProperty(t, e, {
|
|
699
837
|
get: function() {
|
|
700
838
|
return s.value;
|
|
701
839
|
},
|
|
702
|
-
set: function(
|
|
703
|
-
s.value =
|
|
840
|
+
set: function(i) {
|
|
841
|
+
s.value = i;
|
|
704
842
|
}
|
|
705
843
|
});
|
|
706
844
|
};
|
|
707
845
|
}
|
|
708
|
-
|
|
709
|
-
var
|
|
710
|
-
Object.defineProperty(
|
|
711
|
-
|
|
712
|
-
class
|
|
846
|
+
B.persist = jt;
|
|
847
|
+
var I = {};
|
|
848
|
+
Object.defineProperty(I, "__esModule", { value: true });
|
|
849
|
+
I.MemoryStorage = void 0;
|
|
850
|
+
class $t {
|
|
713
851
|
get length() {
|
|
714
852
|
return Object.keys(this).length;
|
|
715
853
|
}
|
|
@@ -729,206 +867,26 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
729
867
|
this[t] = e;
|
|
730
868
|
}
|
|
731
869
|
}
|
|
732
|
-
|
|
733
|
-
(function(
|
|
734
|
-
var t =
|
|
735
|
-
|
|
736
|
-
var
|
|
737
|
-
(!
|
|
738
|
-
return s[
|
|
739
|
-
} }), Object.defineProperty(
|
|
740
|
-
} : function(
|
|
741
|
-
|
|
742
|
-
}), e =
|
|
743
|
-
for (var
|
|
870
|
+
I.MemoryStorage = $t;
|
|
871
|
+
(function(n) {
|
|
872
|
+
var t = v && v.__createBinding || (Object.create ? function(r, s, i, o) {
|
|
873
|
+
o === void 0 && (o = i);
|
|
874
|
+
var u = Object.getOwnPropertyDescriptor(s, i);
|
|
875
|
+
(!u || ("get" in u ? !s.__esModule : u.writable || u.configurable)) && (u = { enumerable: true, get: function() {
|
|
876
|
+
return s[i];
|
|
877
|
+
} }), Object.defineProperty(r, o, u);
|
|
878
|
+
} : function(r, s, i, o) {
|
|
879
|
+
o === void 0 && (o = i), r[o] = s[i];
|
|
880
|
+
}), e = v && v.__exportStar || function(r, s) {
|
|
881
|
+
for (var i in r) i !== "default" && !Object.prototype.hasOwnProperty.call(s, i) && t(s, r, i);
|
|
744
882
|
};
|
|
745
|
-
Object.defineProperty(
|
|
746
|
-
})(
|
|
747
|
-
|
|
748
|
-
const combined = [];
|
|
749
|
-
for (let i = 0; i < str.length || i < args.length; i++) {
|
|
750
|
-
if (str[i]) combined.push(str[i]);
|
|
751
|
-
if (args[i]) combined.push(args[i]);
|
|
752
|
-
}
|
|
753
|
-
return new PathEvent(combined.join(""));
|
|
754
|
-
}
|
|
755
|
-
function PES(str, ...args) {
|
|
756
|
-
const combined = [];
|
|
757
|
-
for (let i = 0; i < str.length || i < args.length; i++) {
|
|
758
|
-
if (str[i]) combined.push(str[i]);
|
|
759
|
-
if (args[i]) combined.push(args[i]);
|
|
760
|
-
}
|
|
761
|
-
let colon = false;
|
|
762
|
-
const [paths, methods] = combined.filter((p2) => p2 != null).flatMap((p2) => {
|
|
763
|
-
var _a;
|
|
764
|
-
return (_a = p2 == null ? void 0 : p2.toString()) == null ? void 0 : _a.split(":");
|
|
765
|
-
}).reduce((acc, p2) => {
|
|
766
|
-
if (p2.endsWith(":")) {
|
|
767
|
-
colon = true;
|
|
768
|
-
if (p2.length > 1) acc[0].push(p2.slice(0, -1));
|
|
769
|
-
} else {
|
|
770
|
-
acc[colon ? 1 : 0].push(p2);
|
|
771
|
-
}
|
|
772
|
-
return acc;
|
|
773
|
-
}, [[], []]);
|
|
774
|
-
return PathEvent.toString(paths, methods);
|
|
775
|
-
}
|
|
776
|
-
class PathEvent {
|
|
777
|
-
constructor(pathedEvent) {
|
|
778
|
-
/** First directory in path */
|
|
779
|
-
__publicField(this, "module");
|
|
780
|
-
/** Entire path, including the module & name */
|
|
781
|
-
__publicField(this, "fullPath");
|
|
782
|
-
/** Path including the name, excluding the module */
|
|
783
|
-
__publicField(this, "path");
|
|
784
|
-
/** Last sagment of path */
|
|
785
|
-
__publicField(this, "name");
|
|
786
|
-
/** List of methods */
|
|
787
|
-
__publicField(this, "methods");
|
|
788
|
-
/** All/Wildcard specified */
|
|
789
|
-
__publicField(this, "all");
|
|
790
|
-
/** None specified */
|
|
791
|
-
__publicField(this, "none");
|
|
792
|
-
/** Create method specified */
|
|
793
|
-
__publicField(this, "create");
|
|
794
|
-
/** Read method specified */
|
|
795
|
-
__publicField(this, "read");
|
|
796
|
-
/** Update method specified */
|
|
797
|
-
__publicField(this, "update");
|
|
798
|
-
/** Delete method specified */
|
|
799
|
-
__publicField(this, "delete");
|
|
800
|
-
var _a;
|
|
801
|
-
if (typeof pathedEvent == "object") return Object.assign(this, pathedEvent);
|
|
802
|
-
let [p2, scope, method] = pathedEvent.split(":");
|
|
803
|
-
if (!method) method = scope || "*";
|
|
804
|
-
if (p2 == "*" || !p2 && method == "*") {
|
|
805
|
-
p2 = "";
|
|
806
|
-
method = "*";
|
|
807
|
-
}
|
|
808
|
-
let temp = p2.split("/").filter((p22) => !!p22);
|
|
809
|
-
this.module = ((_a = temp.splice(0, 1)[0]) == null ? void 0 : _a.toLowerCase()) || "";
|
|
810
|
-
this.fullPath = p2;
|
|
811
|
-
this.path = temp.join("/");
|
|
812
|
-
this.name = temp.pop() || "";
|
|
813
|
-
this.methods = method.split("");
|
|
814
|
-
this.all = method == null ? void 0 : method.includes("*");
|
|
815
|
-
this.none = method == null ? void 0 : method.includes("n");
|
|
816
|
-
this.create = !(method == null ? void 0 : method.includes("n")) && ((method == null ? void 0 : method.includes("*")) || (method == null ? void 0 : method.includes("w")) || (method == null ? void 0 : method.includes("c")));
|
|
817
|
-
this.read = !(method == null ? void 0 : method.includes("n")) && ((method == null ? void 0 : method.includes("*")) || (method == null ? void 0 : method.includes("r")));
|
|
818
|
-
this.update = !(method == null ? void 0 : method.includes("n")) && ((method == null ? void 0 : method.includes("*")) || (method == null ? void 0 : method.includes("w")) || (method == null ? void 0 : method.includes("u")));
|
|
819
|
-
this.delete = !(method == null ? void 0 : method.includes("n")) && ((method == null ? void 0 : method.includes("*")) || (method == null ? void 0 : method.includes("w")) || (method == null ? void 0 : method.includes("d")));
|
|
820
|
-
}
|
|
821
|
-
/**
|
|
822
|
-
* Combine multiple pathed events into one parsed object. Longest path takes precedent, but all subsequent methods are
|
|
823
|
-
* combined until a "none" is reached
|
|
824
|
-
*
|
|
825
|
-
* @param {string | PathEvent} paths PathedEvents as strings or pre-parsed
|
|
826
|
-
* @return {PathEvent} Final combined permission
|
|
827
|
-
*/
|
|
828
|
-
static combine(paths) {
|
|
829
|
-
let hitNone = false;
|
|
830
|
-
const combined = paths.map((p2) => new PathEvent(p2)).toSorted((p1, p2) => {
|
|
831
|
-
const l1 = p1.fullPath.length, l2 = p2.fullPath.length;
|
|
832
|
-
return l1 < l2 ? 1 : l1 > l2 ? -1 : 0;
|
|
833
|
-
}).reduce((acc, p2) => {
|
|
834
|
-
if (p2.none) hitNone = true;
|
|
835
|
-
if (!acc) return p2;
|
|
836
|
-
if (hitNone) return acc;
|
|
837
|
-
if (p2.all) acc.all = true;
|
|
838
|
-
if (p2.all || p2.create) acc.create = true;
|
|
839
|
-
if (p2.all || p2.read) acc.read = true;
|
|
840
|
-
if (p2.all || p2.update) acc.update = true;
|
|
841
|
-
if (p2.all || p2.delete) acc.delete = true;
|
|
842
|
-
acc.methods = [...acc.methods, ...p2.methods];
|
|
843
|
-
return acc;
|
|
844
|
-
}, null);
|
|
845
|
-
if (combined.all) combined.methods = ["*"];
|
|
846
|
-
if (combined.none) combined.methods = ["n"];
|
|
847
|
-
combined.methods = new B(combined.methods);
|
|
848
|
-
combined.raw = PES`${combined.fullPath}:${combined.methods}`;
|
|
849
|
-
return combined;
|
|
850
|
-
}
|
|
851
|
-
/**
|
|
852
|
-
* Squash 2 sets of paths & return true if any overlap is found
|
|
853
|
-
*
|
|
854
|
-
* @param {string | PathEvent | (string | PathEvent)[]} target Array of PathedEvents as strings or pre-parsed
|
|
855
|
-
* @param has
|
|
856
|
-
* @return {boolean} Whether there is any overlap
|
|
857
|
-
*/
|
|
858
|
-
static has(target, ...has) {
|
|
859
|
-
const parsedRequired = ft(has).map((pe) => new PathEvent(pe));
|
|
860
|
-
const parsedTarget = ft(target).map((pe) => new PathEvent(pe));
|
|
861
|
-
return !!parsedRequired.find((r) => {
|
|
862
|
-
if (!r.fullPath && r.all) return true;
|
|
863
|
-
const filtered = parsedTarget.filter((p2) => r.fullPath.startsWith(p2.fullPath));
|
|
864
|
-
if (!filtered.length) return false;
|
|
865
|
-
const combined = PathEvent.combine(filtered);
|
|
866
|
-
return !combined.none && (combined.all || new B(combined.methods).intersection(new B(r.methods)).length);
|
|
867
|
-
});
|
|
868
|
-
}
|
|
869
|
-
/**
|
|
870
|
-
* Same as `has` but raises an error if there is no overlap
|
|
871
|
-
*
|
|
872
|
-
* @param {string | string[]} target Array of PathedEvents as strings or pre-parsed
|
|
873
|
-
* @param has
|
|
874
|
-
*/
|
|
875
|
-
static hasFatal(target, ...has) {
|
|
876
|
-
if (!PathEvent.has(target, ...has)) throw new Error(`Missing permission: ${ft(has).join(", ")}`);
|
|
877
|
-
}
|
|
878
|
-
/**
|
|
879
|
-
* Create pathed event string from its components
|
|
880
|
-
*
|
|
881
|
-
* @param {string | string[]} path Event path
|
|
882
|
-
* @param {Method} methods Event method
|
|
883
|
-
* @return {string} String representation of PathedEvent
|
|
884
|
-
*/
|
|
885
|
-
static toString(path, methods) {
|
|
886
|
-
let p2 = ft(path).filter((p22) => p22 != null).join("/");
|
|
887
|
-
if (methods.length) p2 += `:${ft(methods).map((m) => m.toLowerCase()).join("")}`;
|
|
888
|
-
return p2 == null ? void 0 : p2.trim().replaceAll(/\/{2,}/g, "/").replaceAll(/(^\/|\/$)/g, "");
|
|
889
|
-
}
|
|
890
|
-
/**
|
|
891
|
-
* Create pathed event string from its components
|
|
892
|
-
*
|
|
893
|
-
* @return {string} String representation of PathedEvent
|
|
894
|
-
*/
|
|
895
|
-
toString() {
|
|
896
|
-
return PathEvent.toString(this.fullPath, this.methods);
|
|
897
|
-
}
|
|
898
|
-
}
|
|
899
|
-
class PathedEventEmitter {
|
|
900
|
-
constructor() {
|
|
901
|
-
__publicField(this, "listeners", []);
|
|
902
|
-
}
|
|
903
|
-
emit(event, ...args) {
|
|
904
|
-
const parsed = new PathEvent(event);
|
|
905
|
-
this.listeners.filter((l) => PathEvent.has(l[0], event)).forEach((l) => l[1](parsed, ...args));
|
|
906
|
-
}
|
|
907
|
-
off(listener) {
|
|
908
|
-
this.listeners = this.listeners.filter((l) => l[1] != listener);
|
|
909
|
-
}
|
|
910
|
-
on(event, listener) {
|
|
911
|
-
ft(event).forEach((e) => this.listeners.push([new PathEvent(e), listener]));
|
|
912
|
-
return () => this.off(listener);
|
|
913
|
-
}
|
|
914
|
-
once(event, listener) {
|
|
915
|
-
return new Promise((res) => {
|
|
916
|
-
const unsubscribe = this.on(event, (event2, ...args) => {
|
|
917
|
-
res(args.length < 2 ? args[0] : args);
|
|
918
|
-
if (listener) listener(event2, ...args);
|
|
919
|
-
unsubscribe();
|
|
920
|
-
});
|
|
921
|
-
});
|
|
922
|
-
}
|
|
923
|
-
relayEvents(emitter) {
|
|
924
|
-
emitter.on("*", (event, ...args) => this.emit(event, ...args));
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
class Api extends F {
|
|
883
|
+
Object.defineProperty(n, "__esModule", { value: true }), e(B, n), e(I, n);
|
|
884
|
+
})(At);
|
|
885
|
+
class Api extends H {
|
|
928
886
|
constructor(url = location.origin, opts = {}) {
|
|
929
887
|
opts.url = url;
|
|
930
888
|
super(opts);
|
|
931
|
-
__publicField(this, "emitter", new
|
|
889
|
+
__publicField(this, "emitter", new ae());
|
|
932
890
|
__publicField(this, "pending", {});
|
|
933
891
|
__publicField(this, "_token", null);
|
|
934
892
|
__publicField(this, "emit", this.emitter.emit.bind(this.emitter));
|
|
@@ -946,27 +904,27 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
946
904
|
if (token == this._token) return;
|
|
947
905
|
this._token = token;
|
|
948
906
|
this.headers["Authorization"] = token ? `Bearer ${token}` : null;
|
|
949
|
-
this.emit(
|
|
907
|
+
this.emit(xt`api/token:${token ? "u" : "d"}`, token);
|
|
950
908
|
}
|
|
951
909
|
healthcheck() {
|
|
952
910
|
return this.request({ url: "/api/healthcheck" }).then((resp) => {
|
|
953
|
-
this.emit(
|
|
911
|
+
this.emit(xt`api/healthcheck:r`, resp);
|
|
954
912
|
return resp;
|
|
955
913
|
});
|
|
956
914
|
}
|
|
957
915
|
request(options) {
|
|
958
|
-
const key =
|
|
916
|
+
const key = It(options);
|
|
959
917
|
const method = options.method == "GET" ? "r" : options.method == "POST" ? "c" : options.method == "DELETE" ? "d" : "u";
|
|
960
918
|
if (this.pending[key] != null) return this.pending[key];
|
|
961
919
|
this.pending[key] = super.request(options).then((response) => {
|
|
962
|
-
this.emit(
|
|
920
|
+
this.emit(xt`api/response:${method}`, { request: options, response });
|
|
963
921
|
return response.data;
|
|
964
922
|
}).catch((err) => {
|
|
965
923
|
const e = (err == null ? void 0 : err.data) || err;
|
|
966
|
-
this.emit(
|
|
924
|
+
this.emit(xt`api/error:${method}`, { request: options, error: e });
|
|
967
925
|
throw e;
|
|
968
926
|
}).finally(() => delete this.pending[key]);
|
|
969
|
-
this.emit(
|
|
927
|
+
this.emit(xt`api/request:${method}`, { request: options, response: this.pending[key] });
|
|
970
928
|
return this.pending[key];
|
|
971
929
|
}
|
|
972
930
|
}
|
|
@@ -980,59 +938,59 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
980
938
|
ActionType2[ActionType2["PUT"] = 6] = "PUT";
|
|
981
939
|
return ActionType2;
|
|
982
940
|
})(ActionType || {});
|
|
983
|
-
class Actions extends
|
|
941
|
+
class Actions extends ae {
|
|
984
942
|
constructor(api) {
|
|
985
943
|
super();
|
|
986
944
|
__publicField(this, "api");
|
|
987
|
-
__publicField(this, "cache", new
|
|
945
|
+
__publicField(this, "cache", new Gt("_id"));
|
|
988
946
|
this.api = typeof api == "string" ? new Api(api) : api;
|
|
989
947
|
}
|
|
990
|
-
delete(id) {
|
|
991
|
-
if (!id) throw new Error("Cannot delete action, missing ID");
|
|
992
|
-
return this.api.request({ url: `/api/` + PES`actions/${id}`, method: "DELETE" }).then(() => {
|
|
993
|
-
this.cache.delete(id);
|
|
994
|
-
this.emit(PES`actions/${id}:d`, id);
|
|
995
|
-
});
|
|
996
|
-
}
|
|
997
948
|
all() {
|
|
998
|
-
return this.api.request({ url: `/api/` +
|
|
949
|
+
return this.api.request({ url: `/api/` + xt`actions` }).then((resp) => {
|
|
999
950
|
this.cache.addAll(resp);
|
|
1000
|
-
this.emit(
|
|
951
|
+
this.emit(xt`actions:r`, resp || []);
|
|
1001
952
|
return resp;
|
|
1002
953
|
});
|
|
1003
954
|
}
|
|
955
|
+
delete(id) {
|
|
956
|
+
if (!id) throw new Error("Cannot delete action, missing ID");
|
|
957
|
+
return this.api.request({ url: `/api/` + xt`actions/${id}`, method: "DELETE" }).then(() => {
|
|
958
|
+
this.cache.delete(id);
|
|
959
|
+
this.emit(xt`actions/${id}:d`, id);
|
|
960
|
+
});
|
|
961
|
+
}
|
|
1004
962
|
read(id, reload = false) {
|
|
1005
963
|
if (!id) throw new Error("Cannot read action, missing ID");
|
|
1006
964
|
const cached = this.cache.get(id);
|
|
1007
965
|
if (!reload && cached) return Promise.resolve(cached);
|
|
1008
|
-
return this.api.request({ url: `/api/` +
|
|
966
|
+
return this.api.request({ url: `/api/` + xt`actions/${id}` }).then((action) => {
|
|
1009
967
|
if (action) this.cache.add(action);
|
|
1010
|
-
this.emit(
|
|
968
|
+
this.emit(xt`actions/${id}:r`, action);
|
|
1011
969
|
return action;
|
|
1012
970
|
});
|
|
1013
971
|
}
|
|
1014
972
|
run(path, opts = {}) {
|
|
1015
973
|
if (!path) throw new Error("Cannot run action, missing path");
|
|
1016
|
-
return this.api.request({ url: `/api/` +
|
|
974
|
+
return this.api.request({ url: `/api/` + xt`actions/run/${path}`, ...opts });
|
|
1017
975
|
}
|
|
1018
976
|
runById(action, opts = {}) {
|
|
1019
977
|
const id = typeof action == "string" ? action : action == null ? void 0 : action._id;
|
|
1020
978
|
if (!id) throw new Error("Cannot run action, missing ID");
|
|
1021
|
-
return this.api.request({ url: "/api/" +
|
|
979
|
+
return this.api.request({ url: "/api/" + xt`actions/run-by-id/${id}`, method: "POST", ...opts });
|
|
1022
980
|
}
|
|
1023
981
|
update(action) {
|
|
1024
982
|
return this.api.request({
|
|
1025
|
-
url: `/api/` +
|
|
983
|
+
url: `/api/` + xt`actions/${action._id}`,
|
|
1026
984
|
method: "POST",
|
|
1027
985
|
body: action
|
|
1028
986
|
}).then((action2) => {
|
|
1029
987
|
if (action2) this.cache.add(action2);
|
|
1030
|
-
this.emit(
|
|
988
|
+
this.emit(xt`actions/${action2._id}:u`, action2);
|
|
1031
989
|
return action2;
|
|
1032
990
|
});
|
|
1033
991
|
}
|
|
1034
992
|
}
|
|
1035
|
-
class Ai extends
|
|
993
|
+
class Ai extends ae {
|
|
1036
994
|
constructor(api) {
|
|
1037
995
|
super();
|
|
1038
996
|
__publicField(this, "api");
|
|
@@ -1040,19 +998,19 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1040
998
|
}
|
|
1041
999
|
ask(question, context) {
|
|
1042
1000
|
if (!question) throw new Error("Cannot ask AI, missing question");
|
|
1043
|
-
return this.api.request({ url: `/api/` +
|
|
1001
|
+
return this.api.request({ url: `/api/` + xt`ai`, method: "POST", body: {
|
|
1044
1002
|
question,
|
|
1045
1003
|
context
|
|
1046
1004
|
} }).then((response) => {
|
|
1047
|
-
this.emit(
|
|
1005
|
+
this.emit(xt`ai:c`, { question, context, response });
|
|
1048
1006
|
return response;
|
|
1049
1007
|
});
|
|
1050
1008
|
}
|
|
1051
1009
|
clear() {
|
|
1052
|
-
return this.api.request({ url: "/api/" +
|
|
1010
|
+
return this.api.request({ url: "/api/" + xt`ai`, method: "DELETE" }).then(() => this.emit(xt`ai:d`, this.api.token));
|
|
1053
1011
|
}
|
|
1054
1012
|
}
|
|
1055
|
-
class Analytics extends
|
|
1013
|
+
class Analytics extends ae {
|
|
1056
1014
|
constructor(api) {
|
|
1057
1015
|
super();
|
|
1058
1016
|
__publicField(this, "api");
|
|
@@ -1060,42 +1018,23 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1060
1018
|
}
|
|
1061
1019
|
ipTrace(ip) {
|
|
1062
1020
|
if (!ip) throw new Error("Cannot trace, missing IP");
|
|
1063
|
-
return this.api.request({ url: `/api/` +
|
|
1064
|
-
this.emit(
|
|
1021
|
+
return this.api.request({ url: `/api/` + xt`analytics/trace/${ip}` }).then((resp) => {
|
|
1022
|
+
this.emit(xt`analytics/trace/${ip}:r`, resp);
|
|
1065
1023
|
return resp;
|
|
1066
1024
|
});
|
|
1067
1025
|
}
|
|
1068
1026
|
}
|
|
1069
|
-
class
|
|
1070
|
-
constructor(api) {
|
|
1071
|
-
__publicField(this, "enable", this.reset);
|
|
1072
|
-
this.api = api;
|
|
1073
|
-
}
|
|
1074
|
-
disable(username) {
|
|
1075
|
-
return this.api.request({ url: `/api/auth/totp/${username}`, method: "DELETE" });
|
|
1076
|
-
}
|
|
1077
|
-
reset(username) {
|
|
1078
|
-
return this.api.request({ url: `/api/auth/totp/${username}`, method: "POST" });
|
|
1079
|
-
}
|
|
1080
|
-
setup(username, method = "app", totp) {
|
|
1081
|
-
return this.api.request({ url: `/api/auth/totp/${username}`, body: ut({
|
|
1082
|
-
method,
|
|
1083
|
-
totp
|
|
1084
|
-
}) });
|
|
1085
|
-
}
|
|
1086
|
-
}
|
|
1087
|
-
class Auth extends PathedEventEmitter {
|
|
1027
|
+
class Auth extends ae {
|
|
1088
1028
|
constructor(api, opts = {}) {
|
|
1089
1029
|
super();
|
|
1090
1030
|
__publicField(this, "api");
|
|
1091
1031
|
__publicField(this, "storageKey");
|
|
1092
|
-
__publicField(this, "totp");
|
|
1093
1032
|
__publicField(this, "_user");
|
|
1033
|
+
__publicField(this, "enableTotp", this.resetTotp);
|
|
1094
1034
|
this.opts = opts;
|
|
1095
1035
|
this.api = typeof api == "string" ? new Api(api) : api;
|
|
1096
|
-
this.totp = new Totp(this.api);
|
|
1097
1036
|
this.opts = {
|
|
1098
|
-
|
|
1037
|
+
loginUrl: this.api.url + "/ui/#/login",
|
|
1099
1038
|
persist: true,
|
|
1100
1039
|
...this.opts
|
|
1101
1040
|
};
|
|
@@ -1107,12 +1046,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1107
1046
|
"/api/auth/totp"
|
|
1108
1047
|
];
|
|
1109
1048
|
if (resp.status == 401 && !blacklist.find((url) => resp.url.includes(url)))
|
|
1110
|
-
this.emit(
|
|
1049
|
+
this.emit(xt`auth/session-expired:d`, this.api.token);
|
|
1111
1050
|
next();
|
|
1112
1051
|
});
|
|
1113
1052
|
this.api.on("api/token", (event, token) => {
|
|
1114
1053
|
var _a;
|
|
1115
|
-
console.log("loading user...");
|
|
1116
1054
|
if ((_a = this.opts) == null ? void 0 : _a.persist) {
|
|
1117
1055
|
if (token) localStorage.setItem(this.storageKey, token);
|
|
1118
1056
|
else localStorage.removeItem(this.storageKey);
|
|
@@ -1133,17 +1071,14 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1133
1071
|
return this._user;
|
|
1134
1072
|
}
|
|
1135
1073
|
set user(user) {
|
|
1136
|
-
if (
|
|
1074
|
+
if (!$(this.user, user)) {
|
|
1137
1075
|
this._user = user ? user : null;
|
|
1138
|
-
this.emit(
|
|
1076
|
+
this.emit(xt`auth/user:u`, this._user);
|
|
1139
1077
|
}
|
|
1140
1078
|
}
|
|
1141
1079
|
knownHost(host = location.origin) {
|
|
1142
1080
|
if (host.startsWith("/")) return Promise.resolve();
|
|
1143
|
-
return this.api.request({ url: `/api/auth/known-host?host=${encodeURI(new URL(host).origin)}` })
|
|
1144
|
-
this.emit(PES`auth/known-host/${host}:r`, false);
|
|
1145
|
-
throw err;
|
|
1146
|
-
});
|
|
1081
|
+
return this.api.request({ url: `/api/auth/known-host?host=${encodeURI(new URL(host).origin)}` });
|
|
1147
1082
|
}
|
|
1148
1083
|
login(username, password, totp) {
|
|
1149
1084
|
if (!username || !password) throw new Error("Cannot login, missing username or password");
|
|
@@ -1159,16 +1094,16 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1159
1094
|
}).then(async (resp) => {
|
|
1160
1095
|
this.api.token = (resp == null ? void 0 : resp.token) || null;
|
|
1161
1096
|
const user = await this.once("auth/user");
|
|
1162
|
-
this.emit(
|
|
1097
|
+
this.emit(xt`auth/login/${username}:u`, user);
|
|
1163
1098
|
return user;
|
|
1164
1099
|
});
|
|
1165
1100
|
}
|
|
1166
1101
|
loginRedirect(host = location.origin) {
|
|
1167
1102
|
return new Promise((res, rej) => {
|
|
1168
1103
|
var _a;
|
|
1169
|
-
const win = window.open(encodeURI(`${(_a = this.opts) == null ? void 0 : _a.
|
|
1104
|
+
const win = window.open(encodeURI(`${(_a = this.opts) == null ? void 0 : _a.loginUrl}?redirect=postmessage&host=${host}`), "_blank");
|
|
1170
1105
|
if (!win) return rej("Unable to open login");
|
|
1171
|
-
const origin = new URL(this.opts.
|
|
1106
|
+
const origin = new URL(this.opts.loginUrl).origin;
|
|
1172
1107
|
win.addEventListener("message", (event) => {
|
|
1173
1108
|
const data = (event == null ? void 0 : event.data) || {};
|
|
1174
1109
|
if (event.origin != data.sender || data.sender != origin) return;
|
|
@@ -1180,7 +1115,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1180
1115
|
});
|
|
1181
1116
|
}
|
|
1182
1117
|
logout() {
|
|
1183
|
-
this.emit(
|
|
1118
|
+
this.emit(xt`auth/logout:d`, this.user);
|
|
1184
1119
|
this.api.token = null;
|
|
1185
1120
|
this.user = null;
|
|
1186
1121
|
}
|
|
@@ -1189,7 +1124,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1189
1124
|
if (!u.username || !u.password) throw new Error("Cannot register user, missing username or password");
|
|
1190
1125
|
const user = await this.api.request({ url: "/api/auth/register", body: { ...u } });
|
|
1191
1126
|
if ((_a = user == null ? void 0 : user.image) == null ? void 0 : _a.startsWith("/")) user.image = `${this.api.url}${user.image}?token=${this.api.token}`;
|
|
1192
|
-
this.emit(
|
|
1127
|
+
this.emit(xt`auth/register:c`, user);
|
|
1193
1128
|
return user;
|
|
1194
1129
|
}
|
|
1195
1130
|
reset(emailOrPass, token) {
|
|
@@ -1202,7 +1137,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1202
1137
|
password: token ? emailOrPass : void 0
|
|
1203
1138
|
}
|
|
1204
1139
|
}).then(() => {
|
|
1205
|
-
this.emit(
|
|
1140
|
+
this.emit(xt`auth/reset:${token ? "u" : "c"}`, token || emailOrPass);
|
|
1206
1141
|
});
|
|
1207
1142
|
}
|
|
1208
1143
|
async session(token, set = false) {
|
|
@@ -1211,12 +1146,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1211
1146
|
url: "/api/auth/session",
|
|
1212
1147
|
headers: token ? { "Authorization": `Bearer ${token}` } : void 0
|
|
1213
1148
|
});
|
|
1214
|
-
this.emit(
|
|
1149
|
+
this.emit(xt`auth/session:r`, session);
|
|
1215
1150
|
if (set) {
|
|
1216
1151
|
this.api.token = token;
|
|
1217
1152
|
if (session == null ? void 0 : session.user) session.user.image = `${this.api.url}${session.user.image}?token=${this.api.token}`;
|
|
1218
1153
|
this.user = (session == null ? void 0 : session.user) || null;
|
|
1219
|
-
if (session) this.emit(
|
|
1154
|
+
if (session) this.emit(xt`auth/login:c`, session.user);
|
|
1220
1155
|
}
|
|
1221
1156
|
return session;
|
|
1222
1157
|
}
|
|
@@ -1226,12 +1161,25 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1226
1161
|
url: "/api/auth/password",
|
|
1227
1162
|
body: { username, password, oldPassword }
|
|
1228
1163
|
}).then((resp) => {
|
|
1229
|
-
this.emit(
|
|
1164
|
+
this.emit(xt`auth/reset:u`, resp == null ? void 0 : resp.token);
|
|
1230
1165
|
if (resp == null ? void 0 : resp.token) this.api.token = resp.token;
|
|
1231
1166
|
});
|
|
1232
1167
|
}
|
|
1168
|
+
// TOTP ============================================================================================================
|
|
1169
|
+
disableTotp(username) {
|
|
1170
|
+
return this.api.request({ url: `/api/auth/totp/${username}`, method: "DELETE" });
|
|
1171
|
+
}
|
|
1172
|
+
resetTotp(username) {
|
|
1173
|
+
return this.api.request({ url: `/api/auth/totp/${username}`, method: "POST" });
|
|
1174
|
+
}
|
|
1175
|
+
setupTotp(username, method = "app", totp) {
|
|
1176
|
+
return this.api.request({ url: `/api/auth/totp/${username}`, body: lt({
|
|
1177
|
+
method,
|
|
1178
|
+
totp
|
|
1179
|
+
}) });
|
|
1180
|
+
}
|
|
1233
1181
|
}
|
|
1234
|
-
class Client extends
|
|
1182
|
+
class Client extends ae {
|
|
1235
1183
|
constructor(settings) {
|
|
1236
1184
|
super();
|
|
1237
1185
|
__publicField(this, "_platform");
|
|
@@ -1332,7 +1280,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1332
1280
|
if (!dismissed && !this.pwa && this.mobile) this.pwaPrompt();
|
|
1333
1281
|
}, 500);
|
|
1334
1282
|
}
|
|
1335
|
-
this.emit(
|
|
1283
|
+
this.emit(xt`client/inject:c`, this.platform);
|
|
1336
1284
|
}
|
|
1337
1285
|
pwaPrompt(platform) {
|
|
1338
1286
|
const url = this.settings.api.url;
|
|
@@ -1449,16 +1397,16 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1449
1397
|
setTimeout(() => {
|
|
1450
1398
|
prompt.remove();
|
|
1451
1399
|
backdrop.remove();
|
|
1452
|
-
this.emit(
|
|
1400
|
+
this.emit(xt`client/pwa:d`, platform);
|
|
1453
1401
|
}, 500);
|
|
1454
1402
|
};
|
|
1455
1403
|
prompt.append(close);
|
|
1456
1404
|
backdrop.append(prompt);
|
|
1457
1405
|
document.body.append(backdrop);
|
|
1458
|
-
this.emit(
|
|
1406
|
+
this.emit(xt`client/pwa:c`, platform);
|
|
1459
1407
|
}
|
|
1460
1408
|
}
|
|
1461
|
-
class Data extends
|
|
1409
|
+
class Data extends ae {
|
|
1462
1410
|
constructor(api) {
|
|
1463
1411
|
super();
|
|
1464
1412
|
__publicField(this, "api");
|
|
@@ -1467,18 +1415,25 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1467
1415
|
create(collection, document2) {
|
|
1468
1416
|
if (!collection || !document2) throw new Error("Cannot create document, missing collection or document");
|
|
1469
1417
|
return this.api.request({
|
|
1470
|
-
url: `/api/` +
|
|
1418
|
+
url: `/api/` + xt`data/${collection}`,
|
|
1471
1419
|
method: "POST",
|
|
1472
1420
|
body: document2
|
|
1473
1421
|
}).then((resp) => {
|
|
1474
|
-
this.emit(
|
|
1422
|
+
this.emit(xt`data/${collection}:c`, resp);
|
|
1475
1423
|
return resp;
|
|
1476
1424
|
});
|
|
1477
1425
|
}
|
|
1426
|
+
delete(collection, id) {
|
|
1427
|
+
if (!collection || !id) throw new Error("Cannot delete document, missing collection or ID");
|
|
1428
|
+
return this.api.request({
|
|
1429
|
+
url: `/api/` + xt`data/${collection}/${id}`,
|
|
1430
|
+
method: "DELETE"
|
|
1431
|
+
}).then(() => this.emit(xt`data/${collection}/${id}:d`, id));
|
|
1432
|
+
}
|
|
1478
1433
|
read(collection, id) {
|
|
1479
1434
|
if (!collection) throw new Error("Cannot read documents, missing collection");
|
|
1480
|
-
return this.api.request({ url: `/api/` +
|
|
1481
|
-
this.emit(
|
|
1435
|
+
return this.api.request({ url: `/api/` + xt`data/${collection}/${id}` }).then((resp) => {
|
|
1436
|
+
this.emit(xt`data/${collection}/${id}:r`, collection, resp);
|
|
1482
1437
|
return resp;
|
|
1483
1438
|
});
|
|
1484
1439
|
}
|
|
@@ -1486,48 +1441,42 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1486
1441
|
if (!collection || !document2) throw new Error("Cannot update document, missing collection or document");
|
|
1487
1442
|
if (!document2._id) return this.create(collection, document2);
|
|
1488
1443
|
return this.api.request({
|
|
1489
|
-
url: `/api/` +
|
|
1444
|
+
url: `/api/` + xt`data/${collection}/${document2._id}`,
|
|
1490
1445
|
method: append ? "PATCH" : "PUT",
|
|
1491
1446
|
body: document2
|
|
1492
1447
|
}).then((resp) => {
|
|
1493
|
-
this.emit(
|
|
1448
|
+
this.emit(xt`data/${collection}/${document2._id}:u`, resp);
|
|
1494
1449
|
return resp;
|
|
1495
1450
|
});
|
|
1496
1451
|
}
|
|
1497
|
-
delete(collection, id) {
|
|
1498
|
-
if (!collection || !id) throw new Error("Cannot delete document, missing collection or ID");
|
|
1499
|
-
return this.api.request({
|
|
1500
|
-
url: `/api/` + PES`data/${collection}/${id}`,
|
|
1501
|
-
method: "DELETE"
|
|
1502
|
-
}).then(() => this.emit(PES`data/${collection}/${id}:d`, id));
|
|
1503
|
-
}
|
|
1504
1452
|
raw(collection, query) {
|
|
1505
1453
|
if (!collection || !query) throw new Error("Cannot execute raw query, missing collection or query");
|
|
1506
1454
|
const mode = query.operand.startsWith("find") ? "r" : query.operand == "insert" ? "c" : query.operand.startsWith("delete") ? "d" : "u";
|
|
1507
|
-
return this.api.request({ url: `/api/` +
|
|
1508
|
-
this.emit(
|
|
1455
|
+
return this.api.request({ url: `/api/` + xt`data/${collection}` + "?raw", body: query }).then((resp) => {
|
|
1456
|
+
this.emit(xt`data/${collection}:${mode}`, resp);
|
|
1509
1457
|
return resp;
|
|
1510
1458
|
});
|
|
1511
1459
|
}
|
|
1460
|
+
// Schema ==========================================================================================================
|
|
1512
1461
|
deleteSchema(path) {
|
|
1513
1462
|
if (!path) throw new Error("Cannot delete schema, missing collection path");
|
|
1514
|
-
return this.api.request({ url: `/api/` +
|
|
1463
|
+
return this.api.request({ url: `/api/` + xt`schema/${path}`, method: "DELETE" }).then(() => this.emit(xt`schema/${path}:d`, path));
|
|
1515
1464
|
}
|
|
1516
|
-
|
|
1517
|
-
return this.api.request({ url: "/api/" +
|
|
1518
|
-
this.emit(
|
|
1465
|
+
readSchema(pathOrTree) {
|
|
1466
|
+
return this.api.request({ url: "/api/" + xt`schema/${typeof pathOrTree == "string" ? pathOrTree : ""}` + (pathOrTree === true ? `?tree=${pathOrTree}` : "") }).then((resp) => {
|
|
1467
|
+
this.emit(xt`schema/${typeof pathOrTree == "string" ? pathOrTree : ""}:r`, resp);
|
|
1519
1468
|
return resp;
|
|
1520
1469
|
});
|
|
1521
1470
|
}
|
|
1522
|
-
|
|
1471
|
+
updateSchema(schema) {
|
|
1523
1472
|
if (!schema.path) throw new Error("Cannot update schema, missing collection path");
|
|
1524
|
-
return this.api.request({ url: "/api/" +
|
|
1525
|
-
this.emit(
|
|
1473
|
+
return this.api.request({ url: "/api/" + xt`schema/${schema.path}`, body: schema }).then((resp) => {
|
|
1474
|
+
this.emit(xt`schema/${schema.path}:${schema._id ? "u" : "c"}`, resp);
|
|
1526
1475
|
return resp;
|
|
1527
1476
|
});
|
|
1528
1477
|
}
|
|
1529
1478
|
}
|
|
1530
|
-
class Email extends
|
|
1479
|
+
class Email extends ae {
|
|
1531
1480
|
constructor(api) {
|
|
1532
1481
|
super();
|
|
1533
1482
|
__publicField(this, "api");
|
|
@@ -1536,92 +1485,126 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1536
1485
|
send(email) {
|
|
1537
1486
|
var _a;
|
|
1538
1487
|
if (!email.to && !email.bcc || !email.body) throw new Error("Cannot send email, missing address or body");
|
|
1539
|
-
return this.api.request({ url: "/api/" +
|
|
1488
|
+
return this.api.request({ url: "/api/" + xt`email/${(_a = email.body) == null ? void 0 : _a.template}`, body: email }).then((response) => {
|
|
1540
1489
|
var _a2;
|
|
1541
|
-
this.emit(
|
|
1490
|
+
this.emit(xt`email/${(_a2 = email.body) == null ? void 0 : _a2.template}:c`, { email, response });
|
|
1542
1491
|
return response;
|
|
1543
1492
|
});
|
|
1544
1493
|
}
|
|
1545
1494
|
}
|
|
1546
|
-
class Groups extends
|
|
1495
|
+
class Groups extends ae {
|
|
1547
1496
|
constructor(api) {
|
|
1548
1497
|
super();
|
|
1549
1498
|
__publicField(this, "api");
|
|
1550
|
-
__publicField(this, "cache", new
|
|
1499
|
+
__publicField(this, "cache", new Gt("name"));
|
|
1551
1500
|
this.api = typeof api == "string" ? new Api(api) : api;
|
|
1552
1501
|
}
|
|
1553
1502
|
async all(reload) {
|
|
1554
1503
|
if (!reload && this.cache.complete) return this.cache.all();
|
|
1555
|
-
return this.api.request({ url: `/api/` +
|
|
1504
|
+
return this.api.request({ url: `/api/` + xt`groups` }).then((resp) => {
|
|
1556
1505
|
this.cache.addAll(resp);
|
|
1557
|
-
this.emit(
|
|
1506
|
+
this.emit(xt`groups:r`, resp || []);
|
|
1558
1507
|
return resp;
|
|
1559
1508
|
});
|
|
1560
1509
|
}
|
|
1510
|
+
delete(name) {
|
|
1511
|
+
if (!name) throw new Error("Cannot delete group, missing name");
|
|
1512
|
+
return this.api.request({
|
|
1513
|
+
url: `/api/` + xt`groups/${name}`,
|
|
1514
|
+
method: "DELETE"
|
|
1515
|
+
}).then(() => {
|
|
1516
|
+
this.cache.delete(name);
|
|
1517
|
+
this.emit(xt`groups/${name}:d`);
|
|
1518
|
+
});
|
|
1519
|
+
}
|
|
1561
1520
|
create(group) {
|
|
1562
1521
|
if (!group.name) throw new Error("Cannot create group, missing name");
|
|
1563
1522
|
return this.api.request({
|
|
1564
|
-
url: `/api/` +
|
|
1523
|
+
url: `/api/` + xt`groups/${group.name}`,
|
|
1565
1524
|
method: "POST",
|
|
1566
1525
|
body: group
|
|
1567
1526
|
}).then((resp) => {
|
|
1568
1527
|
this.cache.add(resp);
|
|
1569
|
-
this.emit(
|
|
1528
|
+
this.emit(xt`groups/${group.name}:c`, resp);
|
|
1570
1529
|
return resp;
|
|
1571
1530
|
});
|
|
1572
1531
|
}
|
|
1573
1532
|
async read(name, reload) {
|
|
1574
1533
|
if (!name) throw new Error("Cannot read group, missing name");
|
|
1575
1534
|
if (!reload && this.cache.get(name)) return this.cache.get(name);
|
|
1576
|
-
return this.api.request({ url: `/api/` +
|
|
1535
|
+
return this.api.request({ url: `/api/` + xt`groups/${name}` }).then((resp) => {
|
|
1577
1536
|
this.cache.add(resp);
|
|
1578
|
-
this.emit(
|
|
1537
|
+
this.emit(xt`groups/${name}:r`, resp);
|
|
1579
1538
|
return resp;
|
|
1580
1539
|
});
|
|
1581
1540
|
}
|
|
1582
1541
|
update(group) {
|
|
1583
1542
|
if (!group.name) throw new Error("Cannot update group, missing name");
|
|
1584
1543
|
return this.api.request({
|
|
1585
|
-
url: `/api/` +
|
|
1544
|
+
url: `/api/` + xt`groups/${group.name}`,
|
|
1586
1545
|
method: "PATCH",
|
|
1587
1546
|
body: group
|
|
1588
1547
|
}).then((resp) => {
|
|
1589
1548
|
this.cache.add(resp);
|
|
1590
|
-
this.emit(
|
|
1549
|
+
this.emit(xt`groups/${group.name}:u`, resp);
|
|
1591
1550
|
return resp;
|
|
1592
1551
|
});
|
|
1593
1552
|
}
|
|
1594
|
-
delete(name) {
|
|
1595
|
-
if (!name) throw new Error("Cannot delete group, missing name");
|
|
1596
|
-
return this.api.request({
|
|
1597
|
-
url: `/api/` + PES`groups/${name}`,
|
|
1598
|
-
method: "DELETE"
|
|
1599
|
-
}).then(() => {
|
|
1600
|
-
this.cache.delete(name);
|
|
1601
|
-
this.emit(PES`groups/${name}:d`);
|
|
1602
|
-
});
|
|
1603
|
-
}
|
|
1604
1553
|
}
|
|
1605
|
-
class Logger extends
|
|
1606
|
-
constructor(api,
|
|
1554
|
+
class Logger extends ae {
|
|
1555
|
+
constructor(api, channel, logLevel) {
|
|
1607
1556
|
super();
|
|
1608
1557
|
__publicField(this, "api");
|
|
1609
|
-
this
|
|
1558
|
+
__publicField(this, "console", {
|
|
1559
|
+
debug: console.debug,
|
|
1560
|
+
log: console.log,
|
|
1561
|
+
info: console.info,
|
|
1562
|
+
warn: console.warn,
|
|
1563
|
+
error: console.error
|
|
1564
|
+
});
|
|
1565
|
+
this.channel = channel;
|
|
1566
|
+
if (channel.toLowerCase() == "server") throw new Error('"Server" namespace is reserved');
|
|
1610
1567
|
this.api = typeof api == "string" ? new Api(api) : api;
|
|
1611
|
-
if (logLevel != null && logLevel != "NONE") {
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1568
|
+
if (logLevel != null && logLevel && logLevel != "NONE") {
|
|
1569
|
+
if (yt[logLevel] >= 0) {
|
|
1570
|
+
console.error = (...args) => {
|
|
1571
|
+
this.console.error(...args);
|
|
1572
|
+
this.error(...args);
|
|
1573
|
+
};
|
|
1574
|
+
window.addEventListener("unhandledrejection", async (event) => {
|
|
1575
|
+
var _a, _b, _c, _d;
|
|
1576
|
+
let log = ((_a = event.reason) == null ? void 0 : _a.stack) || event.reason;
|
|
1577
|
+
if ((_b = event.reason) == null ? void 0 : _b.url)
|
|
1578
|
+
log = `${event.reason.method} ${event.reason.url} -> ${event.reason.code}
|
|
1621
1579
|
|
|
1622
1580
|
${log}`;
|
|
1623
|
-
|
|
1624
|
-
|
|
1581
|
+
((_c = event.reason) == null ? void 0 : _c.code) == null || ((_d = event.reason) == null ? void 0 : _d.code) >= 500 ? this.error(log) : this.warn(log);
|
|
1582
|
+
});
|
|
1583
|
+
}
|
|
1584
|
+
if (yt[logLevel] >= 1) {
|
|
1585
|
+
console.warn = (...args) => {
|
|
1586
|
+
this.console.warn(...args);
|
|
1587
|
+
this.warn(...args);
|
|
1588
|
+
};
|
|
1589
|
+
}
|
|
1590
|
+
if (yt[logLevel] >= 2) {
|
|
1591
|
+
console.info = (...args) => {
|
|
1592
|
+
this.console.info(...args);
|
|
1593
|
+
this.info(...args);
|
|
1594
|
+
};
|
|
1595
|
+
}
|
|
1596
|
+
if (yt[logLevel] >= 3) {
|
|
1597
|
+
console.log = (...args) => {
|
|
1598
|
+
this.console.log(...args);
|
|
1599
|
+
this.log(...args);
|
|
1600
|
+
};
|
|
1601
|
+
}
|
|
1602
|
+
if (yt[logLevel] >= 4) {
|
|
1603
|
+
console.debug = (...args) => {
|
|
1604
|
+
this.console.debug(...args);
|
|
1605
|
+
this.debug(...args);
|
|
1606
|
+
};
|
|
1607
|
+
}
|
|
1625
1608
|
}
|
|
1626
1609
|
}
|
|
1627
1610
|
buildLog(level, log) {
|
|
@@ -1637,44 +1620,38 @@ ${log}`;
|
|
|
1637
1620
|
}
|
|
1638
1621
|
};
|
|
1639
1622
|
}
|
|
1640
|
-
|
|
1641
|
-
|
|
1623
|
+
create(log, channel = this.channel) {
|
|
1624
|
+
if (channel.toLowerCase() == "server") throw new Error('"Server" namespace is reserved');
|
|
1625
|
+
return this.api.request({ url: `/api/` + xt`logs/${channel}`, body: log }).then(() => this.emit(xt`logs/${channel}:c`, log)).catch(() => {
|
|
1642
1626
|
});
|
|
1643
1627
|
}
|
|
1644
|
-
|
|
1645
|
-
return this.api.request({ url: `/api/` +
|
|
1628
|
+
delete(channel = this.channel) {
|
|
1629
|
+
return this.api.request({ url: `/api/` + xt`logs/${channel}`, method: "DELETE" }).then(() => this.emit(xt`logs/${channel}:d`));
|
|
1646
1630
|
}
|
|
1647
|
-
|
|
1648
|
-
return this.
|
|
1649
|
-
|
|
1650
|
-
getLogs(length, page, namespace = this.namespace) {
|
|
1651
|
-
if (!namespace) throw new Error("Cannot get logs, missing namespace");
|
|
1652
|
-
const query = [length ? `length=${length}` : void 0, page ? `page=${page}` : void 0].filter((v) => !!v).join("&");
|
|
1653
|
-
return this.api.request({ url: `/api/` + PES`logs/${namespace}` + (query ? `?${query}` : "") }).then((logs) => {
|
|
1654
|
-
this.emit(PES`logs/${namespace}:r`, logs);
|
|
1631
|
+
read(channel = this.channel) {
|
|
1632
|
+
return this.api.request({ url: `/api/` + xt`logs/${channel}` }).then((logs) => {
|
|
1633
|
+
this.emit(xt`logs/${channel}:r`, logs);
|
|
1655
1634
|
return logs;
|
|
1656
1635
|
});
|
|
1657
1636
|
}
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
debug(log, namespace = this.namespace) {
|
|
1662
|
-
return this.createLog(this.buildLog(yt.DEBUG, log), namespace);
|
|
1637
|
+
// Console =========================================================================================================
|
|
1638
|
+
debug(log, channel = this.channel) {
|
|
1639
|
+
return this.create(this.buildLog(yt.DEBUG, log), channel);
|
|
1663
1640
|
}
|
|
1664
|
-
log(log,
|
|
1665
|
-
return this.
|
|
1641
|
+
log(log, channel = this.channel) {
|
|
1642
|
+
return this.create(this.buildLog(yt.LOG, log), channel);
|
|
1666
1643
|
}
|
|
1667
|
-
info(log,
|
|
1668
|
-
return this.
|
|
1644
|
+
info(log, channel = this.channel) {
|
|
1645
|
+
return this.create(this.buildLog(yt.INFO, log), channel);
|
|
1669
1646
|
}
|
|
1670
|
-
warn(log,
|
|
1671
|
-
return this.
|
|
1647
|
+
warn(log, channel = this.channel) {
|
|
1648
|
+
return this.create(this.buildLog(yt.WARN, log), channel);
|
|
1672
1649
|
}
|
|
1673
|
-
error(log,
|
|
1674
|
-
return this.
|
|
1650
|
+
error(log, channel = this.channel) {
|
|
1651
|
+
return this.create(this.buildLog(yt.ERROR, log), channel);
|
|
1675
1652
|
}
|
|
1676
1653
|
}
|
|
1677
|
-
class Payments extends
|
|
1654
|
+
class Payments extends ae {
|
|
1678
1655
|
constructor(api, secret) {
|
|
1679
1656
|
super();
|
|
1680
1657
|
__publicField(this, "api");
|
|
@@ -1697,7 +1674,7 @@ ${log}`;
|
|
|
1697
1674
|
amount,
|
|
1698
1675
|
custom
|
|
1699
1676
|
} });
|
|
1700
|
-
this.emit(
|
|
1677
|
+
this.emit(xt`payments:c`, request.data.clientSecret);
|
|
1701
1678
|
return request.data.clientSecret;
|
|
1702
1679
|
}
|
|
1703
1680
|
async createForm(element, amount, custom) {
|
|
@@ -1711,28 +1688,28 @@ ${log}`;
|
|
|
1711
1688
|
});
|
|
1712
1689
|
}
|
|
1713
1690
|
async history(username) {
|
|
1714
|
-
const history = await this.api.request({ url: `/api/` +
|
|
1715
|
-
this.emit(
|
|
1691
|
+
const history = await this.api.request({ url: `/api/` + xt`payments/${username}` });
|
|
1692
|
+
this.emit(xt`payments/${username}:r`, history);
|
|
1716
1693
|
return history;
|
|
1717
1694
|
}
|
|
1718
1695
|
}
|
|
1719
|
-
class Pdf extends
|
|
1696
|
+
class Pdf extends ae {
|
|
1720
1697
|
constructor(api) {
|
|
1721
1698
|
super();
|
|
1722
1699
|
__publicField(this, "api");
|
|
1723
1700
|
this.api = typeof api == "string" ? new Api(api) : api;
|
|
1724
1701
|
}
|
|
1725
1702
|
createPdf(body, options) {
|
|
1726
|
-
return this.api.request({ url: `/api/` +
|
|
1703
|
+
return this.api.request({ url: `/api/` + xt`pdf`, body: { ...body, options }, decode: false }).then(async (resp) => {
|
|
1727
1704
|
const blob = await resp.blob();
|
|
1728
1705
|
if (options == null ? void 0 : options.download) {
|
|
1729
|
-
let filename = (options == null ? void 0 : options.filename) ||
|
|
1706
|
+
let filename = (options == null ? void 0 : options.filename) || Yt();
|
|
1730
1707
|
if (!filename.endsWith(".pdf")) filename += ".pdf";
|
|
1731
1708
|
const url = URL.createObjectURL(blob);
|
|
1732
|
-
|
|
1709
|
+
pt(url, filename);
|
|
1733
1710
|
URL.revokeObjectURL(url);
|
|
1734
1711
|
}
|
|
1735
|
-
this.emit(
|
|
1712
|
+
this.emit(xt`pdf:c`, blob);
|
|
1736
1713
|
return blob;
|
|
1737
1714
|
});
|
|
1738
1715
|
}
|
|
@@ -1796,7 +1773,7 @@ ${log}`;
|
|
|
1796
1773
|
};
|
|
1797
1774
|
__publicField(_Socket, "timeout", 1e4);
|
|
1798
1775
|
let Socket = _Socket;
|
|
1799
|
-
class Storage extends
|
|
1776
|
+
class Storage extends ae {
|
|
1800
1777
|
constructor(api) {
|
|
1801
1778
|
super();
|
|
1802
1779
|
__publicField(this, "api");
|
|
@@ -1804,119 +1781,119 @@ ${log}`;
|
|
|
1804
1781
|
}
|
|
1805
1782
|
copy(source, destination) {
|
|
1806
1783
|
if (!source || !destination) throw new Error("Cannot copy file or folder, missing source or destination");
|
|
1807
|
-
return this.api.request({ url: "/api/" +
|
|
1808
|
-
this.emit(
|
|
1784
|
+
return this.api.request({ url: "/api/" + xt`storage/${destination}`, body: { from: source } }).then((response) => {
|
|
1785
|
+
this.emit(xt`storage/${destination}:c`, response);
|
|
1809
1786
|
return response;
|
|
1810
1787
|
});
|
|
1811
1788
|
}
|
|
1812
1789
|
delete(path) {
|
|
1813
1790
|
if (!path) throw new Error("Cannot delete file or folder, missing path");
|
|
1814
|
-
return this.api.request({ url: "/api/" +
|
|
1815
|
-
this.emit(
|
|
1791
|
+
return this.api.request({ url: "/api/" + xt`storage/${path}`, method: "DELETE" }).then(() => {
|
|
1792
|
+
this.emit(xt`storage/${path}:d`, path);
|
|
1816
1793
|
});
|
|
1817
1794
|
}
|
|
1818
1795
|
download(path, opts = {}) {
|
|
1819
1796
|
if (!path) throw new Error("Cannot download file, missing path");
|
|
1820
|
-
return this.api.request({ ...opts, url: "/api/" +
|
|
1797
|
+
return this.api.request({ ...opts, url: "/api/" + xt`storage/${path}`, decode: false }).then(async (response) => {
|
|
1821
1798
|
const blob = await response.blob();
|
|
1822
1799
|
const name = opts.downloadAs || path.split("/").pop();
|
|
1823
|
-
this.emit(
|
|
1824
|
-
|
|
1800
|
+
this.emit(xt`storage/${path}:r`, blob);
|
|
1801
|
+
qt(blob, name);
|
|
1825
1802
|
return response;
|
|
1826
1803
|
});
|
|
1827
1804
|
}
|
|
1828
1805
|
list(path) {
|
|
1829
1806
|
if (!path) path = "/";
|
|
1830
|
-
return this.api.request({ url: "/api/" +
|
|
1831
|
-
this.emit(
|
|
1807
|
+
return this.api.request({ url: "/api/" + xt`storage/${path}` + "?list" }).then((resp) => {
|
|
1808
|
+
this.emit(xt`storage/${path}:r`, resp);
|
|
1832
1809
|
return resp;
|
|
1833
1810
|
});
|
|
1834
1811
|
}
|
|
1835
1812
|
open(path, target = "_blank") {
|
|
1836
1813
|
if (!path) throw new Error("Cannot download file, missing path");
|
|
1837
|
-
const link = `${this.api.url}/api/` +
|
|
1814
|
+
const link = `${this.api.url}/api/` + xt`storage/${path}` + (this.api.token ? `?token=${this.api.token}` : "");
|
|
1838
1815
|
if (!target) return link;
|
|
1839
|
-
this.emit(
|
|
1816
|
+
this.emit(xt`storage/${path}:r`, path);
|
|
1840
1817
|
return window.open(link, target);
|
|
1841
1818
|
}
|
|
1842
1819
|
mkdir(path) {
|
|
1843
1820
|
if (!path) throw new Error("Cannot make directory, missing path");
|
|
1844
|
-
return this.api.request({ url: "/api/" +
|
|
1845
|
-
this.emit(
|
|
1821
|
+
return this.api.request({ url: "/api/" + xt`storage/${path}`, body: { directory: true } }).then((resp) => {
|
|
1822
|
+
this.emit(xt`storage/${path}:c`, resp);
|
|
1846
1823
|
return resp;
|
|
1847
1824
|
});
|
|
1848
1825
|
}
|
|
1849
1826
|
move(source, destination) {
|
|
1850
1827
|
if (!source || !destination) throw new Error("Cannot move file or folder, missing source or destination");
|
|
1851
1828
|
if (source == destination) return this.list(destination);
|
|
1852
|
-
return this.api.request({ url: "/api/" +
|
|
1853
|
-
this.emit(
|
|
1829
|
+
return this.api.request({ url: "/api/" + xt`storage/${source}`, method: "PATCH", body: { move: destination } }).then((response) => {
|
|
1830
|
+
this.emit(xt`storage/${source}:u`, response);
|
|
1854
1831
|
return response;
|
|
1855
1832
|
});
|
|
1856
1833
|
}
|
|
1857
1834
|
upload(files, opts) {
|
|
1858
|
-
return new
|
|
1859
|
-
if (!files) files = await
|
|
1835
|
+
return new O(async (res, rej, prog) => {
|
|
1836
|
+
if (!files) files = await Ft(typeof opts == "object" ? opts : void 0);
|
|
1860
1837
|
if (!files || Array.isArray(files) && !files.length) return [];
|
|
1861
1838
|
const path = (opts && typeof opts == "object" ? opts == null ? void 0 : opts.path : opts) || "/";
|
|
1862
|
-
return
|
|
1863
|
-
url: `${this.api.url}/api/` +
|
|
1864
|
-
files:
|
|
1839
|
+
return Ht({
|
|
1840
|
+
url: `${this.api.url}/api/` + xt`storage/${path}`,
|
|
1841
|
+
files: b(files),
|
|
1865
1842
|
headers: this.api.headers
|
|
1866
|
-
}).onProgress((
|
|
1867
|
-
prog(
|
|
1843
|
+
}).onProgress((p) => {
|
|
1844
|
+
prog(p);
|
|
1868
1845
|
}).then((resp) => {
|
|
1869
|
-
this.emit(
|
|
1846
|
+
this.emit(xt`storage/${path}:c`, resp);
|
|
1870
1847
|
res(resp);
|
|
1871
1848
|
}).catch((err) => rej(err));
|
|
1872
1849
|
});
|
|
1873
1850
|
}
|
|
1874
1851
|
}
|
|
1875
|
-
class Users extends
|
|
1852
|
+
class Users extends ae {
|
|
1876
1853
|
constructor(api) {
|
|
1877
1854
|
super();
|
|
1878
1855
|
__publicField(this, "api");
|
|
1879
|
-
__publicField(this, "cache", new
|
|
1856
|
+
__publicField(this, "cache", new Gt("username"));
|
|
1880
1857
|
this.api = typeof api == "string" ? new Api(api) : api;
|
|
1881
1858
|
}
|
|
1882
1859
|
async all(reload) {
|
|
1883
1860
|
if (!reload && this.cache.complete) return this.cache.all();
|
|
1884
|
-
return this.api.request({ url: "/api/" +
|
|
1861
|
+
return this.api.request({ url: "/api/" + xt`users` }).then((resp) => {
|
|
1885
1862
|
resp == null ? void 0 : resp.forEach((r) => {
|
|
1886
1863
|
r.image = this.api.url + r.image + `?token=${this.api.token}`;
|
|
1887
1864
|
return r;
|
|
1888
1865
|
});
|
|
1889
1866
|
this.cache.addAll(resp);
|
|
1890
|
-
this.emit(
|
|
1867
|
+
this.emit(xt`users:r`, resp || []);
|
|
1891
1868
|
return resp;
|
|
1892
1869
|
});
|
|
1893
1870
|
}
|
|
1894
1871
|
delete(username) {
|
|
1895
1872
|
if (!username) throw new Error("Cannot delete user, missing username");
|
|
1896
1873
|
return this.api.request({
|
|
1897
|
-
url: "/api/" +
|
|
1874
|
+
url: "/api/" + xt`users/${username}`,
|
|
1898
1875
|
method: "DELETE"
|
|
1899
1876
|
}).then(() => {
|
|
1900
1877
|
this.cache.delete(username);
|
|
1901
|
-
this.emit(
|
|
1878
|
+
this.emit(xt`users/${username}:d`, username);
|
|
1902
1879
|
});
|
|
1903
1880
|
}
|
|
1904
1881
|
async read(username, reload) {
|
|
1905
1882
|
if (!username) throw new Error("Cannot read user, missing username");
|
|
1906
1883
|
if (!reload && this.cache.get(username)) return this.cache.get(username);
|
|
1907
|
-
return this.api.request({ url: "/api/" +
|
|
1884
|
+
return this.api.request({ url: "/api/" + xt`users/${username}` }).then((resp) => {
|
|
1908
1885
|
if (resp) {
|
|
1909
1886
|
resp.image = this.api.url + resp.image + `?token=${this.api.token}`;
|
|
1910
1887
|
this.cache.add(resp);
|
|
1911
1888
|
}
|
|
1912
|
-
this.emit(
|
|
1889
|
+
this.emit(xt`users/${username}:r`, resp);
|
|
1913
1890
|
return resp;
|
|
1914
1891
|
});
|
|
1915
1892
|
}
|
|
1916
1893
|
update(user) {
|
|
1917
1894
|
if (!user.username) throw new Error("Cannot update user, missing username");
|
|
1918
1895
|
return this.api.request({
|
|
1919
|
-
url: `/api/` +
|
|
1896
|
+
url: `/api/` + xt`users/${user.username}`,
|
|
1920
1897
|
method: "PATCH",
|
|
1921
1898
|
body: user
|
|
1922
1899
|
}).then((resp) => {
|
|
@@ -1924,60 +1901,60 @@ ${log}`;
|
|
|
1924
1901
|
resp.image = this.api.url + resp.image + `?token=${this.api.token}`;
|
|
1925
1902
|
this.cache.add(resp);
|
|
1926
1903
|
}
|
|
1927
|
-
this.emit(
|
|
1904
|
+
this.emit(xt`users/${user.username}:${resp._id ? "u" : "c"}`, resp);
|
|
1928
1905
|
return resp;
|
|
1929
1906
|
});
|
|
1930
1907
|
}
|
|
1931
1908
|
uploadImage(username, file) {
|
|
1932
1909
|
if (!username || !file) throw new Error("Cannot update user image, missing username or file");
|
|
1933
|
-
return
|
|
1934
|
-
url: this.api.url + `/api/` +
|
|
1910
|
+
return Ht({
|
|
1911
|
+
url: this.api.url + `/api/` + xt`users/${username}/image`,
|
|
1935
1912
|
files: [file],
|
|
1936
1913
|
headers: this.api.headers
|
|
1937
1914
|
});
|
|
1938
1915
|
}
|
|
1939
1916
|
}
|
|
1940
|
-
class Settings extends
|
|
1917
|
+
class Settings extends ae {
|
|
1941
1918
|
constructor(api) {
|
|
1942
1919
|
super();
|
|
1943
1920
|
__publicField(this, "api");
|
|
1944
|
-
__publicField(this, "cache", new
|
|
1921
|
+
__publicField(this, "cache", new Gt());
|
|
1945
1922
|
this.api = typeof api == "string" ? new Api(api) : api;
|
|
1946
1923
|
}
|
|
1947
1924
|
async all(detailed = false, reload) {
|
|
1948
1925
|
if (!reload && !detailed && this.cache.complete) return this.cache;
|
|
1949
|
-
return this.api.request({ url: `/api/` +
|
|
1926
|
+
return this.api.request({ url: `/api/` + xt`settings` + (detailed ? "?detailed" : "") }).then((resp) => {
|
|
1950
1927
|
if (resp) Object.keys(resp).forEach((key) => this.cache.set(key, detailed ? resp[key].value : resp[key]));
|
|
1951
|
-
this.emit(
|
|
1928
|
+
this.emit(xt`settings:r`, resp || []);
|
|
1952
1929
|
return resp;
|
|
1953
1930
|
});
|
|
1954
1931
|
}
|
|
1955
1932
|
delete(key) {
|
|
1956
1933
|
if (!key) throw new Error("Cannot delete setting, missing key");
|
|
1957
|
-
return this.api.request({ url: `/api/` +
|
|
1934
|
+
return this.api.request({ url: `/api/` + xt`settings/${key}`, method: "DELETE" }).then(() => {
|
|
1958
1935
|
this.cache.delete(key);
|
|
1959
|
-
this.emit(
|
|
1936
|
+
this.emit(xt`settings/${key}:d`, key);
|
|
1960
1937
|
});
|
|
1961
1938
|
}
|
|
1962
1939
|
read(key, reload = false) {
|
|
1963
1940
|
if (!key) throw new Error("Cannot read setting, missing key");
|
|
1964
1941
|
if (!reload && this.cache.get(key)) return this.cache.get(key);
|
|
1965
|
-
return this.api.request({ url: `/api/` +
|
|
1942
|
+
return this.api.request({ url: `/api/` + xt`settings/${key}` }).then((variable) => {
|
|
1966
1943
|
if (variable) this.cache.set(variable.key, variable.value);
|
|
1967
|
-
this.emit(
|
|
1944
|
+
this.emit(xt`settings/${key}:r`, variable);
|
|
1968
1945
|
return variable;
|
|
1969
1946
|
});
|
|
1970
1947
|
}
|
|
1971
1948
|
update(variable) {
|
|
1972
1949
|
if (!variable.key) throw new Error("Cannot update setting, missing key");
|
|
1973
|
-
return this.api.request({ url: `/api/` +
|
|
1950
|
+
return this.api.request({ url: `/api/` + xt`settings/${variable.key}`, body: variable }).then((variable2) => {
|
|
1974
1951
|
if (variable2) this.cache.set(variable2.key, variable2.value);
|
|
1975
|
-
this.emit(`/api/` +
|
|
1952
|
+
this.emit(`/api/` + xt`settings/${variable2.key}:${variable2._id ? "u" : "c"}`, variable2);
|
|
1976
1953
|
return variable2;
|
|
1977
1954
|
});
|
|
1978
1955
|
}
|
|
1979
1956
|
}
|
|
1980
|
-
class Static extends
|
|
1957
|
+
class Static extends ae {
|
|
1981
1958
|
constructor(api) {
|
|
1982
1959
|
super();
|
|
1983
1960
|
__publicField(this, "api");
|
|
@@ -1985,27 +1962,27 @@ ${log}`;
|
|
|
1985
1962
|
}
|
|
1986
1963
|
delete(path) {
|
|
1987
1964
|
if (!path) throw new Error("Cannot delete static asset, missing path");
|
|
1988
|
-
return this.api.request({ url: `/api/` +
|
|
1989
|
-
this.emit(
|
|
1965
|
+
return this.api.request({ url: `/api/` + xt`static/${path}`, method: "DELETE" }).then(() => {
|
|
1966
|
+
this.emit(xt`static/${path}:d`, path);
|
|
1990
1967
|
});
|
|
1991
1968
|
}
|
|
1992
1969
|
upload(files, path = "/") {
|
|
1993
1970
|
if (!files) throw new Error("Cannot upload static assets, missing file");
|
|
1994
|
-
return new
|
|
1995
|
-
return
|
|
1996
|
-
url: this.api.url + "/api/" +
|
|
1997
|
-
files:
|
|
1971
|
+
return new O(async (res, rej, prog) => {
|
|
1972
|
+
return Ht({
|
|
1973
|
+
url: this.api.url + "/api/" + xt`static/${path}`,
|
|
1974
|
+
files: b(files),
|
|
1998
1975
|
headers: this.api.headers
|
|
1999
|
-
}).onProgress((
|
|
2000
|
-
prog(
|
|
1976
|
+
}).onProgress((p) => {
|
|
1977
|
+
prog(p);
|
|
2001
1978
|
}).then((resp) => {
|
|
2002
|
-
this.emit(
|
|
1979
|
+
this.emit(xt`static/${path}:c`, resp);
|
|
2003
1980
|
res(resp);
|
|
2004
1981
|
}).catch((err) => rej(err));
|
|
2005
1982
|
});
|
|
2006
1983
|
}
|
|
2007
1984
|
}
|
|
2008
|
-
class Momentum extends
|
|
1985
|
+
class Momentum extends ae {
|
|
2009
1986
|
constructor(url, opts) {
|
|
2010
1987
|
super();
|
|
2011
1988
|
__publicField(this, "api");
|
|
@@ -2031,12 +2008,12 @@ ${log}`;
|
|
|
2031
2008
|
this.analytics = new Analytics(this.api);
|
|
2032
2009
|
this.auth = new Auth(this.api, {
|
|
2033
2010
|
persist: (opts == null ? void 0 : opts.persist) ?? true,
|
|
2034
|
-
|
|
2011
|
+
loginUrl: opts == null ? void 0 : opts.loginUrl
|
|
2035
2012
|
});
|
|
2036
2013
|
this.data = new Data(this.api);
|
|
2037
2014
|
this.email = new Email(this.api);
|
|
2038
2015
|
this.groups = new Groups(this.api);
|
|
2039
|
-
this.logger = new Logger(this.api, "client", opts == null ? void 0 : opts.logLevel);
|
|
2016
|
+
this.logger = new Logger(this.api, (opts == null ? void 0 : opts.app) || "client", opts == null ? void 0 : opts.logLevel);
|
|
2040
2017
|
if (opts == null ? void 0 : opts.stripeSecret) this.payments = new Payments(this.api, opts.stripeSecret);
|
|
2041
2018
|
this.pdf = new Pdf(this.api);
|
|
2042
2019
|
this.settings = new Settings(this.api);
|
|
@@ -2080,17 +2057,16 @@ ${log}`;
|
|
|
2080
2057
|
exports2.Groups = Groups;
|
|
2081
2058
|
exports2.Logger = Logger;
|
|
2082
2059
|
exports2.Momentum = Momentum;
|
|
2083
|
-
exports2.PE =
|
|
2084
|
-
exports2.PES =
|
|
2085
|
-
exports2.PathEvent =
|
|
2086
|
-
exports2.
|
|
2060
|
+
exports2.PE = ue;
|
|
2061
|
+
exports2.PES = xt;
|
|
2062
|
+
exports2.PathEvent = y;
|
|
2063
|
+
exports2.PathEventEmitter = ae;
|
|
2087
2064
|
exports2.Payments = Payments;
|
|
2088
2065
|
exports2.Pdf = Pdf;
|
|
2089
2066
|
exports2.Settings = Settings;
|
|
2090
2067
|
exports2.Socket = Socket;
|
|
2091
2068
|
exports2.Static = Static;
|
|
2092
2069
|
exports2.Storage = Storage;
|
|
2093
|
-
exports2.Totp = Totp;
|
|
2094
2070
|
exports2.Users = Users;
|
|
2095
2071
|
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
2096
2072
|
});
|