@ztimson/momentum 0.45.1 → 0.47.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 +15 -10
- package/dist/api.d.ts.map +1 -1
- package/dist/auth.d.ts +8 -14
- package/dist/auth.d.ts.map +1 -1
- package/dist/client.d.ts +3 -3
- 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 +538 -655
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +536 -653
- package/dist/logger.d.ts +35 -15
- package/dist/logger.d.ts.map +1 -1
- package/dist/momentum.d.ts +9 -6
- 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/sockets.d.ts +3 -3
- package/dist/sockets.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 +3 -2
- package/dist/pathed-events.d.ts +0 -121
- package/dist/pathed-events.d.ts.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (
|
|
1
|
+
(function(global, factory) {
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.utils = {}));
|
|
3
3
|
})(this, function(exports2) {
|
|
4
4
|
"use strict";var __defProp = Object.defineProperty;
|
|
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 = (r, t, e) =>
|
|
11
|
-
function
|
|
8
|
+
var st = Object.defineProperty;
|
|
9
|
+
var it = (r, t, e) => t in r ? st(r, t, { enumerable: true, configurable: true, writable: true, value: e }) : r[t] = e;
|
|
10
|
+
var c = (r, t, e) => it(r, typeof t != "symbol" ? t + "" : t, e);
|
|
11
|
+
function ot(r, t = false) {
|
|
12
12
|
if (r == null) throw new Error("Cannot clean a NULL value");
|
|
13
13
|
return Array.isArray(r) ? r = r.filter((e) => e != null) : Object.entries(r).forEach(([e, n]) => {
|
|
14
14
|
(t && n === void 0 || !t && n == null) && delete r[e];
|
|
15
15
|
}), r;
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function O(r, t) {
|
|
18
18
|
const e = typeof r, n = typeof t;
|
|
19
|
-
return e != "object" || r == null || n != "object" || t == null ? e == "function" && n == "function" ? r.toString() == t.toString() : r === t : Object.keys(r).length != Object.keys(t).length ? false : Object.keys(r).every((
|
|
19
|
+
return e != "object" || r == null || n != "object" || t == null ? e == "function" && n == "function" ? r.toString() == t.toString() : r === t : Object.keys(r).length != Object.keys(t).length ? false : Object.keys(r).every((i) => O(r[i], t[i]));
|
|
20
20
|
}
|
|
21
|
-
function
|
|
21
|
+
function I(r) {
|
|
22
22
|
try {
|
|
23
23
|
return JSON.parse(r);
|
|
24
24
|
} catch {
|
|
25
25
|
return r;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function Ot(r, t) {
|
|
29
29
|
let e = [];
|
|
30
30
|
return JSON.stringify(r, (n, s) => {
|
|
31
31
|
if (typeof s == "object" && s !== null) {
|
|
@@ -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
|
|
38
|
+
function m(r) {
|
|
39
39
|
return Array.isArray(r) ? r : [r];
|
|
40
40
|
}
|
|
41
|
-
class
|
|
41
|
+
class S extends Array {
|
|
42
42
|
/** Number of elements in set */
|
|
43
43
|
get size() {
|
|
44
44
|
return this.length;
|
|
@@ -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 S(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 S(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 S([...this.difference(t), ...t.difference(this)]);
|
|
125
125
|
}
|
|
126
126
|
/**
|
|
127
127
|
* Create joined list of elements included in this & the comparison set
|
|
@@ -129,23 +129,31 @@ 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 S([...this, ...t]);
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
|
-
class
|
|
135
|
+
class Tt {
|
|
136
136
|
/**
|
|
137
137
|
* Create new cache
|
|
138
138
|
*
|
|
139
139
|
* @param {keyof T} key Default property to use as primary key
|
|
140
|
-
* @param
|
|
140
|
+
* @param options
|
|
141
141
|
*/
|
|
142
|
-
constructor(t, e) {
|
|
142
|
+
constructor(t, e = {}) {
|
|
143
143
|
c(this, "store", {});
|
|
144
144
|
c(this, "complete", false);
|
|
145
145
|
c(this, "values", this.all());
|
|
146
|
-
|
|
146
|
+
if (this.key = t, this.options = e, e.storageKey && !e.storage && (e.storage = localStorage), e.storageKey && e.storage) {
|
|
147
|
+
const n = e.storage.getItem(e.storageKey);
|
|
148
|
+
if (n)
|
|
149
|
+
try {
|
|
150
|
+
Object.assign(this.store, JSON.parse(n));
|
|
151
|
+
} catch {
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return new Proxy(this, {
|
|
147
155
|
get: (n, s) => s in n ? n[s] : n.store[s],
|
|
148
|
-
set: (n, s,
|
|
156
|
+
set: (n, s, i) => (s in n ? n[s] = i : n.store[s] = i, true)
|
|
149
157
|
});
|
|
150
158
|
}
|
|
151
159
|
getKey(t) {
|
|
@@ -181,13 +189,19 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
181
189
|
addAll(t, e = true) {
|
|
182
190
|
return t.forEach((n) => this.add(n)), this.complete = e, this;
|
|
183
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* Remove all keys from cache
|
|
194
|
+
*/
|
|
195
|
+
clear() {
|
|
196
|
+
this.store = {};
|
|
197
|
+
}
|
|
184
198
|
/**
|
|
185
199
|
* Delete an item from the cache
|
|
186
200
|
*
|
|
187
201
|
* @param {K} key Item's primary key
|
|
188
202
|
*/
|
|
189
203
|
delete(t) {
|
|
190
|
-
delete this.store[t];
|
|
204
|
+
delete this.store[t], this.options.storageKey && this.options.storage && this.options.storage.setItem(this.options.storageKey, JSON.stringify(this.store));
|
|
191
205
|
}
|
|
192
206
|
/**
|
|
193
207
|
* Return cache as an array of key-value pairs
|
|
@@ -225,21 +239,21 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
225
239
|
*
|
|
226
240
|
* @param {K} key Key item will be cached under
|
|
227
241
|
* @param {T} value Item to cache
|
|
228
|
-
* @param {number | undefined} ttl Override default expiry
|
|
242
|
+
* @param {number | undefined} ttl Override default expiry in seconds
|
|
229
243
|
* @return {this}
|
|
230
244
|
*/
|
|
231
|
-
set(t, e, n = this.ttl) {
|
|
232
|
-
return this.store[t] = e, n && setTimeout(() => {
|
|
245
|
+
set(t, e, n = this.options.ttl) {
|
|
246
|
+
return this.store[t] = e, this.options.storageKey && this.options.storage && this.options.storage.setItem(this.options.storageKey, JSON.stringify(this.store)), n && setTimeout(() => {
|
|
233
247
|
this.complete = false, this.delete(t);
|
|
234
|
-
}, n), this;
|
|
248
|
+
}, n * 1e3), this;
|
|
235
249
|
}
|
|
236
250
|
}
|
|
237
|
-
class
|
|
251
|
+
class x extends Promise {
|
|
238
252
|
constructor(e) {
|
|
239
253
|
super((n, s) => e(
|
|
240
|
-
(
|
|
241
|
-
(
|
|
242
|
-
(
|
|
254
|
+
(i) => n(i),
|
|
255
|
+
(i) => s(i),
|
|
256
|
+
(i) => this.progress = i
|
|
243
257
|
));
|
|
244
258
|
c(this, "listeners", []);
|
|
245
259
|
c(this, "_progress", 0);
|
|
@@ -251,10 +265,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
251
265
|
e != this._progress && (this._progress = e, this.listeners.forEach((n) => n(e)));
|
|
252
266
|
}
|
|
253
267
|
static from(e) {
|
|
254
|
-
return e instanceof
|
|
268
|
+
return e instanceof x ? e : new x((n, s) => e.then((...i) => n(...i)).catch((...i) => s(...i)));
|
|
255
269
|
}
|
|
256
270
|
from(e) {
|
|
257
|
-
const n =
|
|
271
|
+
const n = x.from(e);
|
|
258
272
|
return this.onProgress((s) => n.progress = s), n;
|
|
259
273
|
}
|
|
260
274
|
onProgress(e) {
|
|
@@ -271,16 +285,16 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
271
285
|
return this.from(super.finally(e));
|
|
272
286
|
}
|
|
273
287
|
}
|
|
274
|
-
function
|
|
275
|
-
r instanceof Blob || (r = new Blob(
|
|
288
|
+
function Dt(r, t) {
|
|
289
|
+
r instanceof Blob || (r = new Blob(m(r)));
|
|
276
290
|
const e = URL.createObjectURL(r);
|
|
277
|
-
|
|
291
|
+
lt(e, t), URL.revokeObjectURL(e);
|
|
278
292
|
}
|
|
279
|
-
function
|
|
293
|
+
function lt(r, t) {
|
|
280
294
|
const e = document.createElement("a");
|
|
281
295
|
e.href = r, e.download = t || r.split("/").pop(), document.body.appendChild(e), e.click(), document.body.removeChild(e);
|
|
282
296
|
}
|
|
283
|
-
function
|
|
297
|
+
function Mt(r = {}) {
|
|
284
298
|
return new Promise((t) => {
|
|
285
299
|
const e = document.createElement("input");
|
|
286
300
|
e.type = "file", e.accept = r.accept || "*", e.style.display = "none", e.multiple = !!r.multiple, e.onblur = e.onchange = async () => {
|
|
@@ -288,18 +302,18 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
288
302
|
}, document.body.appendChild(e), e.click();
|
|
289
303
|
});
|
|
290
304
|
}
|
|
291
|
-
function
|
|
305
|
+
function kt(r, t = /* @__PURE__ */ new Date()) {
|
|
292
306
|
(typeof t == "number" || typeof t == "string") && (t = new Date(t));
|
|
293
307
|
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
308
|
return e;
|
|
295
309
|
}
|
|
296
|
-
function
|
|
297
|
-
return new
|
|
298
|
-
const s = new XMLHttpRequest(),
|
|
299
|
-
r.files.forEach((
|
|
310
|
+
function Pt(r) {
|
|
311
|
+
return new x((t, e, n) => {
|
|
312
|
+
const s = new XMLHttpRequest(), i = new FormData();
|
|
313
|
+
r.files.forEach((o) => i.append("file", o)), s.withCredentials = !!r.withCredentials, s.upload.addEventListener("progress", (o) => o.lengthComputable ? n(o.loaded / o.total) : null), s.addEventListener("loadend", () => t(I(s.responseText))), s.addEventListener("error", () => e(I(s.responseText))), s.addEventListener("timeout", () => e({ error: "Request timed out" })), s.open("POST", r.url), Object.entries(r.headers || {}).forEach(([o, a]) => s.setRequestHeader(o, a)), s.send(i);
|
|
300
314
|
});
|
|
301
315
|
}
|
|
302
|
-
class
|
|
316
|
+
class K {
|
|
303
317
|
constructor() {
|
|
304
318
|
c(this, "listeners", {});
|
|
305
319
|
}
|
|
@@ -317,8 +331,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
317
331
|
}
|
|
318
332
|
static once(t, e) {
|
|
319
333
|
return new Promise((n) => {
|
|
320
|
-
const s = this.on(t, (...
|
|
321
|
-
n(
|
|
334
|
+
const s = this.on(t, (...i) => {
|
|
335
|
+
n(i.length == 1 ? i[0] : i), e && e(...i), s();
|
|
322
336
|
});
|
|
323
337
|
});
|
|
324
338
|
}
|
|
@@ -334,14 +348,14 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
334
348
|
}
|
|
335
349
|
once(t, e) {
|
|
336
350
|
return new Promise((n) => {
|
|
337
|
-
const s = this.on(t, (...
|
|
338
|
-
n(
|
|
351
|
+
const s = this.on(t, (...i) => {
|
|
352
|
+
n(i.length == 1 ? i[0] : i), e && e(...i), s();
|
|
339
353
|
});
|
|
340
354
|
});
|
|
341
355
|
}
|
|
342
356
|
}
|
|
343
|
-
c(
|
|
344
|
-
class
|
|
357
|
+
c(K, "listeners", {});
|
|
358
|
+
class g extends Error {
|
|
345
359
|
constructor(e, n) {
|
|
346
360
|
super(e);
|
|
347
361
|
c(this, "_code");
|
|
@@ -368,8 +382,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
368
382
|
return this.message || super.toString();
|
|
369
383
|
}
|
|
370
384
|
}
|
|
371
|
-
c(
|
|
372
|
-
class W extends
|
|
385
|
+
c(g, "code", 500);
|
|
386
|
+
class W extends g {
|
|
373
387
|
constructor(t = "Bad Request") {
|
|
374
388
|
super(t);
|
|
375
389
|
}
|
|
@@ -378,7 +392,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
378
392
|
}
|
|
379
393
|
}
|
|
380
394
|
c(W, "code", 400);
|
|
381
|
-
class
|
|
395
|
+
class v extends g {
|
|
382
396
|
constructor(t = "Unauthorized") {
|
|
383
397
|
super(t);
|
|
384
398
|
}
|
|
@@ -386,8 +400,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
386
400
|
return t.constructor.code == this.code;
|
|
387
401
|
}
|
|
388
402
|
}
|
|
389
|
-
c(
|
|
390
|
-
class
|
|
403
|
+
c(v, "code", 401);
|
|
404
|
+
class J extends g {
|
|
391
405
|
constructor(t = "Payment Required") {
|
|
392
406
|
super(t);
|
|
393
407
|
}
|
|
@@ -395,8 +409,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
395
409
|
return t.constructor.code == this.code;
|
|
396
410
|
}
|
|
397
411
|
}
|
|
398
|
-
c(
|
|
399
|
-
class
|
|
412
|
+
c(J, "code", 402);
|
|
413
|
+
class z extends g {
|
|
400
414
|
constructor(t = "Forbidden") {
|
|
401
415
|
super(t);
|
|
402
416
|
}
|
|
@@ -404,8 +418,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
404
418
|
return t.constructor.code == this.code;
|
|
405
419
|
}
|
|
406
420
|
}
|
|
407
|
-
c(
|
|
408
|
-
class Z extends
|
|
421
|
+
c(z, "code", 403);
|
|
422
|
+
class Z extends g {
|
|
409
423
|
constructor(t = "Not Found") {
|
|
410
424
|
super(t);
|
|
411
425
|
}
|
|
@@ -414,7 +428,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
414
428
|
}
|
|
415
429
|
}
|
|
416
430
|
c(Z, "code", 404);
|
|
417
|
-
class V extends
|
|
431
|
+
class V extends g {
|
|
418
432
|
constructor(t = "Method Not Allowed") {
|
|
419
433
|
super(t);
|
|
420
434
|
}
|
|
@@ -423,7 +437,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
423
437
|
}
|
|
424
438
|
}
|
|
425
439
|
c(V, "code", 405);
|
|
426
|
-
class X extends
|
|
440
|
+
class X extends g {
|
|
427
441
|
constructor(t = "Not Acceptable") {
|
|
428
442
|
super(t);
|
|
429
443
|
}
|
|
@@ -432,7 +446,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
432
446
|
}
|
|
433
447
|
}
|
|
434
448
|
c(X, "code", 406);
|
|
435
|
-
class Q extends
|
|
449
|
+
class Q extends g {
|
|
436
450
|
constructor(t = "Internal Server Error") {
|
|
437
451
|
super(t);
|
|
438
452
|
}
|
|
@@ -441,7 +455,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
441
455
|
}
|
|
442
456
|
}
|
|
443
457
|
c(Q, "code", 500);
|
|
444
|
-
class
|
|
458
|
+
class _ extends g {
|
|
445
459
|
constructor(t = "Not Implemented") {
|
|
446
460
|
super(t);
|
|
447
461
|
}
|
|
@@ -449,8 +463,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
449
463
|
return t.constructor.code == this.code;
|
|
450
464
|
}
|
|
451
465
|
}
|
|
452
|
-
c(
|
|
453
|
-
class
|
|
466
|
+
c(_, "code", 501);
|
|
467
|
+
class tt extends g {
|
|
454
468
|
constructor(t = "Bad Gateway") {
|
|
455
469
|
super(t);
|
|
456
470
|
}
|
|
@@ -458,8 +472,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
458
472
|
return t.constructor.code == this.code;
|
|
459
473
|
}
|
|
460
474
|
}
|
|
461
|
-
c(
|
|
462
|
-
class
|
|
475
|
+
c(tt, "code", 502);
|
|
476
|
+
class et extends g {
|
|
463
477
|
constructor(t = "Service Unavailable") {
|
|
464
478
|
super(t);
|
|
465
479
|
}
|
|
@@ -467,8 +481,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
467
481
|
return t.constructor.code == this.code;
|
|
468
482
|
}
|
|
469
483
|
}
|
|
470
|
-
c(
|
|
471
|
-
class
|
|
484
|
+
c(et, "code", 503);
|
|
485
|
+
class rt extends g {
|
|
472
486
|
constructor(t = "Gateway Timeout") {
|
|
473
487
|
super(t);
|
|
474
488
|
}
|
|
@@ -476,18 +490,18 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
476
490
|
return t.constructor.code == this.code;
|
|
477
491
|
}
|
|
478
492
|
}
|
|
479
|
-
c(
|
|
480
|
-
const
|
|
493
|
+
c(rt, "code", 504);
|
|
494
|
+
const E = class E2 {
|
|
481
495
|
constructor(t = {}) {
|
|
482
496
|
c(this, "interceptors", {});
|
|
483
497
|
c(this, "headers", {});
|
|
484
498
|
c(this, "url");
|
|
485
|
-
this.url = t.url ?? null, this.headers = t.headers || {}, t.interceptors && t.interceptors.forEach((e) =>
|
|
499
|
+
this.url = t.url ?? null, this.headers = t.headers || {}, t.interceptors && t.interceptors.forEach((e) => E2.addInterceptor(e));
|
|
486
500
|
}
|
|
487
501
|
static addInterceptor(t) {
|
|
488
|
-
const e = Object.keys(
|
|
489
|
-
return
|
|
490
|
-
|
|
502
|
+
const e = Object.keys(E2.interceptors).length.toString();
|
|
503
|
+
return E2.interceptors[e] = t, () => {
|
|
504
|
+
E2.interceptors[e] = null;
|
|
491
505
|
};
|
|
492
506
|
}
|
|
493
507
|
addInterceptor(t) {
|
|
@@ -500,50 +514,54 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
500
514
|
var s;
|
|
501
515
|
if (!this.url && !t.url) throw new Error("URL needs to be set");
|
|
502
516
|
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("?") ? "&" : "?") +
|
|
517
|
+
if (t.fragment && (e.includes("#") ? e.replace(/#.*(\?|\n)/g, (i, o) => `#${t.fragment}${o}`) : e += "#" + t.fragment), t.query) {
|
|
518
|
+
const i = Array.isArray(t.query) ? t.query : Object.keys(t.query).map((o) => ({ key: o, value: t.query[o] }));
|
|
519
|
+
e += (e.includes("?") ? "&" : "?") + i.map((o) => `${o.key}=${o.value}`).join("&");
|
|
506
520
|
}
|
|
507
|
-
const n =
|
|
521
|
+
const n = ot({
|
|
508
522
|
"Content-Type": t.body ? t.body instanceof FormData ? "multipart/form-data" : "application/json" : void 0,
|
|
509
|
-
...
|
|
523
|
+
...E2.headers,
|
|
510
524
|
...this.headers,
|
|
511
525
|
...t.headers
|
|
512
526
|
});
|
|
513
|
-
return typeof t.body == "object" && t.body != null && n["Content-Type"] == "application/json" && (t.body = JSON.stringify(t.body)), new
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
527
|
+
return typeof t.body == "object" && t.body != null && n["Content-Type"] == "application/json" && (t.body = JSON.stringify(t.body)), new x((i, o, a) => {
|
|
528
|
+
try {
|
|
529
|
+
fetch(e, {
|
|
530
|
+
headers: n,
|
|
531
|
+
method: t.method || (t.body ? "POST" : "GET"),
|
|
532
|
+
body: t.body
|
|
533
|
+
}).then(async (u) => {
|
|
534
|
+
var G, U;
|
|
535
|
+
for (let l of [...Object.values(E2.interceptors), ...Object.values(this.interceptors)])
|
|
536
|
+
await new Promise((C) => l(u, () => C()));
|
|
537
|
+
const $ = u.headers.get("Content-Length"), j = $ ? parseInt($, 10) : 0;
|
|
538
|
+
let P = 0;
|
|
539
|
+
const T = (G = u.body) == null ? void 0 : G.getReader(), nt = new ReadableStream({
|
|
540
|
+
start(l) {
|
|
541
|
+
function C() {
|
|
542
|
+
T == null || T.read().then((A) => {
|
|
543
|
+
if (A.done) return l.close();
|
|
544
|
+
P += A.value.byteLength, a(P / j), l.enqueue(A.value), C();
|
|
545
|
+
}).catch((A) => l.error(A));
|
|
546
|
+
}
|
|
547
|
+
C();
|
|
531
548
|
}
|
|
532
|
-
|
|
549
|
+
});
|
|
550
|
+
if (u.data = new Response(nt), t.decode == null || t.decode) {
|
|
551
|
+
const l = (U = u.headers.get("Content-Type")) == null ? void 0 : U.toLowerCase();
|
|
552
|
+
l != null && l.includes("form") ? u.data = await u.data.formData() : l != null && l.includes("json") ? u.data = await u.data.json() : l != null && l.includes("text") ? u.data = await u.data.text() : l != null && l.includes("application") && (u.data = await u.data.blob());
|
|
533
553
|
}
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
u.ok ? o(u) : i(u);
|
|
540
|
-
});
|
|
554
|
+
u.ok ? i(u) : o(u);
|
|
555
|
+
}).catch((u) => o(u));
|
|
556
|
+
} catch (u) {
|
|
557
|
+
o(u);
|
|
558
|
+
}
|
|
541
559
|
});
|
|
542
560
|
}
|
|
543
561
|
};
|
|
544
|
-
c(
|
|
545
|
-
let F =
|
|
546
|
-
const
|
|
562
|
+
c(E, "interceptors", {}), c(E, "headers", {});
|
|
563
|
+
let F = E;
|
|
564
|
+
const R = {
|
|
547
565
|
CLEAR: "\x1B[0m",
|
|
548
566
|
BRIGHT: "\x1B[1m",
|
|
549
567
|
DIM: "\x1B[2m",
|
|
@@ -551,7 +569,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
551
569
|
BLINK: "\x1B[5m",
|
|
552
570
|
REVERSE: "\x1B[7m",
|
|
553
571
|
HIDDEN: "\x1B[8m"
|
|
554
|
-
},
|
|
572
|
+
}, L = {
|
|
555
573
|
BLACK: "\x1B[30m",
|
|
556
574
|
RED: "\x1B[31m",
|
|
557
575
|
GREEN: "\x1B[32m",
|
|
@@ -569,355 +587,193 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
569
587
|
LIGHT_CYAN: "\x1B[96m",
|
|
570
588
|
WHITE: "\x1B[97m"
|
|
571
589
|
};
|
|
572
|
-
var
|
|
573
|
-
const
|
|
590
|
+
var ft = /* @__PURE__ */ ((r) => (r[r.ERROR = 0] = "ERROR", r[r.WARN = 1] = "WARN", r[r.INFO = 2] = "INFO", r[r.LOG = 3] = "LOG", r[r.DEBUG = 4] = "DEBUG", r))(ft || {});
|
|
591
|
+
const w = class w2 extends K {
|
|
574
592
|
constructor(t) {
|
|
575
593
|
super(), this.namespace = t;
|
|
576
594
|
}
|
|
577
595
|
pad(t, e, n, s = false) {
|
|
578
|
-
const
|
|
579
|
-
if (
|
|
580
|
-
const a = Array(~~(
|
|
581
|
-
return s ?
|
|
596
|
+
const i = t.toString(), o = e - i.length;
|
|
597
|
+
if (o <= 0) return i;
|
|
598
|
+
const a = Array(~~(o / n.length)).fill(n).join("");
|
|
599
|
+
return s ? i + a : a + i;
|
|
582
600
|
}
|
|
583
601
|
format(...t) {
|
|
584
602
|
const e = /* @__PURE__ */ new Date();
|
|
585
603
|
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
604
|
}
|
|
587
605
|
debug(...t) {
|
|
588
|
-
if (
|
|
606
|
+
if (w2.LOG_LEVEL < 4) return;
|
|
589
607
|
const e = this.format(...t);
|
|
590
|
-
|
|
608
|
+
w2.emit(4, e), console.debug(L.LIGHT_GREY + e + R.CLEAR);
|
|
591
609
|
}
|
|
592
610
|
log(...t) {
|
|
593
|
-
if (
|
|
611
|
+
if (w2.LOG_LEVEL < 3) return;
|
|
594
612
|
const e = this.format(...t);
|
|
595
|
-
|
|
613
|
+
w2.emit(3, e), console.log(R.CLEAR + e);
|
|
596
614
|
}
|
|
597
615
|
info(...t) {
|
|
598
|
-
if (
|
|
616
|
+
if (w2.LOG_LEVEL < 2) return;
|
|
599
617
|
const e = this.format(...t);
|
|
600
|
-
|
|
618
|
+
w2.emit(2, e), console.info(L.BLUE + e + R.CLEAR);
|
|
601
619
|
}
|
|
602
620
|
warn(...t) {
|
|
603
|
-
if (
|
|
621
|
+
if (w2.LOG_LEVEL < 1) return;
|
|
604
622
|
const e = this.format(...t);
|
|
605
|
-
|
|
623
|
+
w2.emit(1, e), console.warn(L.YELLOW + e + R.CLEAR);
|
|
606
624
|
}
|
|
607
625
|
error(...t) {
|
|
608
|
-
if (
|
|
626
|
+
if (w2.LOG_LEVEL < 0) return;
|
|
609
627
|
const e = this.format(...t);
|
|
610
|
-
|
|
628
|
+
w2.emit(0, e), console.error(L.RED + e + R.CLEAR);
|
|
611
629
|
}
|
|
612
630
|
};
|
|
613
|
-
c(
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
notify(t) {
|
|
647
|
-
Object.values(this.watches).forEach((e) => e(t));
|
|
648
|
-
}
|
|
649
|
-
/** Delete value from storage */
|
|
650
|
-
clear() {
|
|
651
|
-
this.storage.removeItem(this.key);
|
|
652
|
-
}
|
|
653
|
-
/** Save current value to storage */
|
|
654
|
-
save() {
|
|
655
|
-
this._value === void 0 ? this.clear() : this.storage.setItem(this.key, JSON.stringify(this._value)), this.notify(this.value);
|
|
656
|
-
}
|
|
657
|
-
/** Load value from storage */
|
|
658
|
-
load() {
|
|
659
|
-
if (this.storage[this.key] != null) {
|
|
660
|
-
let t = JSON.parse(this.storage.getItem(this.key));
|
|
661
|
-
t != null && typeof t == "object" && this.options.type && (t.__proto__ = this.options.type.prototype), this.value = t;
|
|
662
|
-
} else
|
|
663
|
-
this.value = this.options.default || void 0;
|
|
664
|
-
}
|
|
665
|
-
/**
|
|
666
|
-
* Callback function which is run when there are changes
|
|
667
|
-
*
|
|
668
|
-
* @param {(value: T) => any} fn Callback will run on each change; it's passed the next value & it's return is ignored
|
|
669
|
-
* @returns {() => void} Function which will unsubscribe the watch/callback when called
|
|
670
|
-
*/
|
|
671
|
-
watch(t) {
|
|
672
|
-
const e = Object.keys(this.watches).length;
|
|
673
|
-
return this.watches[e] = t, () => {
|
|
674
|
-
delete this.watches[e];
|
|
675
|
-
};
|
|
631
|
+
c(w, "LOG_LEVEL", 4);
|
|
632
|
+
function ee(r, ...t) {
|
|
633
|
+
const e = [];
|
|
634
|
+
for (let n = 0; n < r.length || n < t.length; n++)
|
|
635
|
+
r[n] && e.push(r[n]), t[n] && e.push(t[n]);
|
|
636
|
+
return new y(e.join(""));
|
|
637
|
+
}
|
|
638
|
+
function mt(r, ...t) {
|
|
639
|
+
let e = [];
|
|
640
|
+
for (let i = 0; i < r.length || i < t.length; i++)
|
|
641
|
+
r[i] && e.push(r[i]), t[i] && e.push(t[i]);
|
|
642
|
+
const [n, s] = e.join("").split(":");
|
|
643
|
+
return y.toString(n, s == null ? void 0 : s.split(""));
|
|
644
|
+
}
|
|
645
|
+
class y {
|
|
646
|
+
constructor(t) {
|
|
647
|
+
c(this, "module");
|
|
648
|
+
c(this, "fullPath");
|
|
649
|
+
c(this, "path");
|
|
650
|
+
c(this, "name");
|
|
651
|
+
c(this, "methods");
|
|
652
|
+
c(this, "all");
|
|
653
|
+
c(this, "none");
|
|
654
|
+
c(this, "create");
|
|
655
|
+
c(this, "read");
|
|
656
|
+
c(this, "update");
|
|
657
|
+
c(this, "delete");
|
|
658
|
+
var o;
|
|
659
|
+
if (typeof t == "object") return Object.assign(this, t);
|
|
660
|
+
let [e, n, s] = t.split(":");
|
|
661
|
+
s || (s = n || "*"), (e == "*" || !e && s == "*") && (e = "", s = "*");
|
|
662
|
+
let i = e.split("/").filter((a) => !!a);
|
|
663
|
+
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")));
|
|
676
664
|
}
|
|
677
665
|
/**
|
|
678
|
-
*
|
|
666
|
+
* Combine multiple events into one parsed object. Longest path takes precedent, but all subsequent methods are
|
|
667
|
+
* combined until a "none" is reached
|
|
679
668
|
*
|
|
680
|
-
* @
|
|
669
|
+
* @param {string | PathEvent} paths Events as strings or pre-parsed
|
|
670
|
+
* @return {PathEvent} Final combined permission
|
|
681
671
|
*/
|
|
682
|
-
|
|
683
|
-
|
|
672
|
+
static combine(t) {
|
|
673
|
+
let e = false;
|
|
674
|
+
const n = t.map((s) => new y(s)).toSorted((s, i) => {
|
|
675
|
+
const o = s.fullPath.length, a = i.fullPath.length;
|
|
676
|
+
return o < a ? 1 : o > a ? -1 : 0;
|
|
677
|
+
}).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);
|
|
678
|
+
return n.all && (n.methods = ["*"]), n.none && (n.methods = ["n"]), n.methods = new S(n.methods), n.raw = mt`${n.fullPath}:${n.methods}`, n;
|
|
684
679
|
}
|
|
685
680
|
/**
|
|
686
|
-
*
|
|
681
|
+
* Squash 2 sets of paths & return true if any overlap is found
|
|
687
682
|
*
|
|
688
|
-
* @
|
|
683
|
+
* @param {string | PathEvent | (string | PathEvent)[]} target Array of Events as strings or pre-parsed
|
|
684
|
+
* @param has Target must have at least one of these path
|
|
685
|
+
* @return {boolean} Whether there is any overlap
|
|
689
686
|
*/
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
Object.defineProperty(t, e, {
|
|
699
|
-
get: function() {
|
|
700
|
-
return s.value;
|
|
701
|
-
},
|
|
702
|
-
set: function(o) {
|
|
703
|
-
s.value = o;
|
|
704
|
-
}
|
|
687
|
+
static has(t, ...e) {
|
|
688
|
+
const n = m(e).map((i) => new y(i)), s = m(t).map((i) => new y(i));
|
|
689
|
+
return !!n.find((i) => {
|
|
690
|
+
if (!i.fullPath && i.all) return true;
|
|
691
|
+
const o = s.filter((u) => i.fullPath.startsWith(u.fullPath));
|
|
692
|
+
if (!o.length) return false;
|
|
693
|
+
const a = y.combine(o);
|
|
694
|
+
return !a.none && (a.all || new S(a.methods).intersection(new S(i.methods)).length);
|
|
705
695
|
});
|
|
706
|
-
};
|
|
707
|
-
}
|
|
708
|
-
S.persist = Bt;
|
|
709
|
-
var L = {};
|
|
710
|
-
Object.defineProperty(L, "__esModule", { value: true });
|
|
711
|
-
L.MemoryStorage = void 0;
|
|
712
|
-
class At {
|
|
713
|
-
get length() {
|
|
714
|
-
return Object.keys(this).length;
|
|
715
|
-
}
|
|
716
|
-
clear() {
|
|
717
|
-
Object.keys(this).forEach((t) => this.removeItem(t));
|
|
718
|
-
}
|
|
719
|
-
getItem(t) {
|
|
720
|
-
return this[t];
|
|
721
|
-
}
|
|
722
|
-
key(t) {
|
|
723
|
-
return Object.keys(this)[t];
|
|
724
|
-
}
|
|
725
|
-
removeItem(t) {
|
|
726
|
-
delete this[t];
|
|
727
|
-
}
|
|
728
|
-
setItem(t, e) {
|
|
729
|
-
this[t] = e;
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
L.MemoryStorage = At;
|
|
733
|
-
(function(r) {
|
|
734
|
-
var t = j && j.__createBinding || (Object.create ? function(n, s, o, i) {
|
|
735
|
-
i === void 0 && (i = o);
|
|
736
|
-
var a = Object.getOwnPropertyDescriptor(s, o);
|
|
737
|
-
(!a || ("get" in a ? !s.__esModule : a.writable || a.configurable)) && (a = { enumerable: true, get: function() {
|
|
738
|
-
return s[o];
|
|
739
|
-
} }), Object.defineProperty(n, i, a);
|
|
740
|
-
} : function(n, s, o, i) {
|
|
741
|
-
i === void 0 && (i = o), n[i] = s[o];
|
|
742
|
-
}), e = j && j.__exportStar || function(n, s) {
|
|
743
|
-
for (var o in n) o !== "default" && !Object.prototype.hasOwnProperty.call(s, o) && t(s, n, o);
|
|
744
|
-
};
|
|
745
|
-
Object.defineProperty(r, "__esModule", { value: true }), e(S, r), e(L, r);
|
|
746
|
-
})(xt);
|
|
747
|
-
function PE(str, ...args) {
|
|
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
|
-
let 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
|
-
const [paths, methods] = combined.join("").split(":");
|
|
762
|
-
return PathEvent.toString(paths, methods == null ? void 0 : methods.split(""));
|
|
763
|
-
}
|
|
764
|
-
class PathEvent {
|
|
765
|
-
constructor(pathedEvent) {
|
|
766
|
-
/** First directory in path */
|
|
767
|
-
__publicField(this, "module");
|
|
768
|
-
/** Entire path, including the module & name */
|
|
769
|
-
__publicField(this, "fullPath");
|
|
770
|
-
/** Path including the name, excluding the module */
|
|
771
|
-
__publicField(this, "path");
|
|
772
|
-
/** Last sagment of path */
|
|
773
|
-
__publicField(this, "name");
|
|
774
|
-
/** List of methods */
|
|
775
|
-
__publicField(this, "methods");
|
|
776
|
-
/** All/Wildcard specified */
|
|
777
|
-
__publicField(this, "all");
|
|
778
|
-
/** None specified */
|
|
779
|
-
__publicField(this, "none");
|
|
780
|
-
/** Create method specified */
|
|
781
|
-
__publicField(this, "create");
|
|
782
|
-
/** Read method specified */
|
|
783
|
-
__publicField(this, "read");
|
|
784
|
-
/** Update method specified */
|
|
785
|
-
__publicField(this, "update");
|
|
786
|
-
/** Delete method specified */
|
|
787
|
-
__publicField(this, "delete");
|
|
788
|
-
var _a;
|
|
789
|
-
if (typeof pathedEvent == "object") return Object.assign(this, pathedEvent);
|
|
790
|
-
let [p2, scope, method] = pathedEvent.split(":");
|
|
791
|
-
if (!method) method = scope || "*";
|
|
792
|
-
if (p2 == "*" || !p2 && method == "*") {
|
|
793
|
-
p2 = "";
|
|
794
|
-
method = "*";
|
|
795
|
-
}
|
|
796
|
-
let temp = p2.split("/").filter((p22) => !!p22);
|
|
797
|
-
this.module = ((_a = temp.splice(0, 1)[0]) == null ? void 0 : _a.toLowerCase()) || "";
|
|
798
|
-
this.fullPath = p2;
|
|
799
|
-
this.path = temp.join("/");
|
|
800
|
-
this.name = temp.pop() || "";
|
|
801
|
-
this.methods = method.split("");
|
|
802
|
-
this.all = method == null ? void 0 : method.includes("*");
|
|
803
|
-
this.none = method == null ? void 0 : method.includes("n");
|
|
804
|
-
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")));
|
|
805
|
-
this.read = !(method == null ? void 0 : method.includes("n")) && ((method == null ? void 0 : method.includes("*")) || (method == null ? void 0 : method.includes("r")));
|
|
806
|
-
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")));
|
|
807
|
-
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")));
|
|
808
696
|
}
|
|
809
697
|
/**
|
|
810
|
-
*
|
|
811
|
-
* combined until a "none" is reached
|
|
698
|
+
* Squash 2 sets of paths & return true if the target has all paths
|
|
812
699
|
*
|
|
813
|
-
* @param {string | PathEvent}
|
|
814
|
-
* @
|
|
700
|
+
* @param {string | PathEvent | (string | PathEvent)[]} target Array of Events as strings or pre-parsed
|
|
701
|
+
* @param has Target must have all these paths
|
|
702
|
+
* @return {boolean} Whether there is any overlap
|
|
815
703
|
*/
|
|
816
|
-
static
|
|
817
|
-
|
|
818
|
-
const combined = paths.map((p2) => new PathEvent(p2)).toSorted((p1, p2) => {
|
|
819
|
-
const l1 = p1.fullPath.length, l2 = p2.fullPath.length;
|
|
820
|
-
return l1 < l2 ? 1 : l1 > l2 ? -1 : 0;
|
|
821
|
-
}).reduce((acc, p2) => {
|
|
822
|
-
if (p2.none) hitNone = true;
|
|
823
|
-
if (!acc) return p2;
|
|
824
|
-
if (hitNone) return acc;
|
|
825
|
-
if (p2.all) acc.all = true;
|
|
826
|
-
if (p2.all || p2.create) acc.create = true;
|
|
827
|
-
if (p2.all || p2.read) acc.read = true;
|
|
828
|
-
if (p2.all || p2.update) acc.update = true;
|
|
829
|
-
if (p2.all || p2.delete) acc.delete = true;
|
|
830
|
-
acc.methods = [...acc.methods, ...p2.methods];
|
|
831
|
-
return acc;
|
|
832
|
-
}, null);
|
|
833
|
-
if (combined.all) combined.methods = ["*"];
|
|
834
|
-
if (combined.none) combined.methods = ["n"];
|
|
835
|
-
combined.methods = new B(combined.methods);
|
|
836
|
-
combined.raw = PES`${combined.fullPath}:${combined.methods}`;
|
|
837
|
-
return combined;
|
|
704
|
+
static hasAll(t, ...e) {
|
|
705
|
+
return e.filter((n) => y.has(t, n)).length == e.length;
|
|
838
706
|
}
|
|
839
707
|
/**
|
|
840
|
-
*
|
|
708
|
+
* Same as `has` but raises an error if there is no overlap
|
|
841
709
|
*
|
|
842
|
-
* @param {string |
|
|
843
|
-
* @param has
|
|
844
|
-
* @return {boolean} Whether there is any overlap
|
|
710
|
+
* @param {string | string[]} target Array of Events as strings or pre-parsed
|
|
711
|
+
* @param has Target must have at least one of these path
|
|
845
712
|
*/
|
|
846
|
-
static
|
|
847
|
-
|
|
848
|
-
const parsedTarget = ft(target).map((pe) => new PathEvent(pe));
|
|
849
|
-
return !!parsedRequired.find((r) => {
|
|
850
|
-
if (!r.fullPath && r.all) return true;
|
|
851
|
-
const filtered = parsedTarget.filter((p2) => r.fullPath.startsWith(p2.fullPath));
|
|
852
|
-
if (!filtered.length) return false;
|
|
853
|
-
const combined = PathEvent.combine(filtered);
|
|
854
|
-
return !combined.none && (combined.all || new B(combined.methods).intersection(new B(r.methods)).length);
|
|
855
|
-
});
|
|
713
|
+
static hasFatal(t, ...e) {
|
|
714
|
+
if (!y.has(t, ...e)) throw new Error(`Requires one of: ${m(e).join(", ")}`);
|
|
856
715
|
}
|
|
857
716
|
/**
|
|
858
|
-
* Same as `
|
|
717
|
+
* Same as `hasAll` but raises an error if the target is missing any paths
|
|
859
718
|
*
|
|
860
|
-
* @param {string | string[]} target Array of
|
|
861
|
-
* @param has
|
|
719
|
+
* @param {string | string[]} target Array of Events as strings or pre-parsed
|
|
720
|
+
* @param has Target must have all these paths
|
|
862
721
|
*/
|
|
863
|
-
static
|
|
864
|
-
if (!
|
|
722
|
+
static hasAllFatal(t, ...e) {
|
|
723
|
+
if (!y.hasAll(t, ...e)) throw new Error(`Requires all: ${m(e).join(", ")}`);
|
|
865
724
|
}
|
|
866
725
|
/**
|
|
867
|
-
* Create
|
|
726
|
+
* Create event string from its components
|
|
868
727
|
*
|
|
869
728
|
* @param {string | string[]} path Event path
|
|
870
729
|
* @param {Method} methods Event method
|
|
871
|
-
* @return {string} String representation of
|
|
730
|
+
* @return {string} String representation of Event
|
|
872
731
|
*/
|
|
873
|
-
static toString(
|
|
874
|
-
let
|
|
875
|
-
|
|
876
|
-
return p2 == null ? void 0 : p2.trim().replaceAll(/\/{2,}/g, "/").replaceAll(/(^\/|\/$)/g, "");
|
|
732
|
+
static toString(t, e) {
|
|
733
|
+
let n = m(t).filter((s) => s != null).join("/");
|
|
734
|
+
return e != null && e.length && (n += `:${m(e).map((s) => s.toLowerCase()).join("")}`), n == null ? void 0 : n.trim().replaceAll(/\/{2,}/g, "/").replaceAll(/(^\/|\/$)/g, "");
|
|
877
735
|
}
|
|
878
736
|
/**
|
|
879
|
-
* Create
|
|
737
|
+
* Create event string from its components
|
|
880
738
|
*
|
|
881
|
-
* @return {string} String representation of
|
|
739
|
+
* @return {string} String representation of Event
|
|
882
740
|
*/
|
|
883
741
|
toString() {
|
|
884
|
-
return
|
|
742
|
+
return y.toString(this.fullPath, this.methods);
|
|
885
743
|
}
|
|
886
744
|
}
|
|
887
|
-
class
|
|
745
|
+
class re {
|
|
888
746
|
constructor() {
|
|
889
|
-
|
|
747
|
+
c(this, "listeners", []);
|
|
890
748
|
}
|
|
891
|
-
emit(
|
|
892
|
-
const
|
|
893
|
-
this.listeners.filter((
|
|
749
|
+
emit(t, ...e) {
|
|
750
|
+
const n = new y(t);
|
|
751
|
+
this.listeners.filter((s) => y.has(s[0], t)).forEach(async (s) => s[1](n, ...e));
|
|
894
752
|
}
|
|
895
|
-
off(
|
|
896
|
-
this.listeners = this.listeners.filter((
|
|
753
|
+
off(t) {
|
|
754
|
+
this.listeners = this.listeners.filter((e) => e[1] != t);
|
|
897
755
|
}
|
|
898
|
-
on(
|
|
899
|
-
|
|
900
|
-
return () => this.off(listener);
|
|
756
|
+
on(t, e) {
|
|
757
|
+
return m(t).forEach((n) => this.listeners.push([new y(n), e])), () => this.off(e);
|
|
901
758
|
}
|
|
902
|
-
once(
|
|
903
|
-
return new Promise((
|
|
904
|
-
const
|
|
905
|
-
|
|
906
|
-
if (listener) listener(event2, ...args);
|
|
907
|
-
unsubscribe();
|
|
759
|
+
once(t, e) {
|
|
760
|
+
return new Promise((n) => {
|
|
761
|
+
const s = this.on(t, (i, ...o) => {
|
|
762
|
+
n(o.length < 2 ? o[0] : o), e && e(i, ...o), s();
|
|
908
763
|
});
|
|
909
764
|
});
|
|
910
765
|
}
|
|
911
|
-
relayEvents(
|
|
912
|
-
|
|
766
|
+
relayEvents(t) {
|
|
767
|
+
t.on("*", (e, ...n) => this.emit(e, ...n));
|
|
913
768
|
}
|
|
914
769
|
}
|
|
915
770
|
class Api extends F {
|
|
916
771
|
constructor(url = location.origin, opts = {}) {
|
|
917
|
-
opts.
|
|
918
|
-
|
|
919
|
-
__publicField(this, "emitter", new PathedEventEmitter());
|
|
772
|
+
super({ ...(opts == null ? void 0 : opts.http) || {}, url });
|
|
773
|
+
__publicField(this, "emitter", new re());
|
|
920
774
|
__publicField(this, "pending", {});
|
|
775
|
+
__publicField(this, "storageKey");
|
|
776
|
+
__publicField(this, "host");
|
|
921
777
|
__publicField(this, "_token", null);
|
|
922
778
|
__publicField(this, "emit", this.emitter.emit.bind(this.emitter));
|
|
923
779
|
__publicField(this, "off", this.emitter.off.bind(this.emitter));
|
|
@@ -926,6 +782,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
926
782
|
__publicField(this, "relayEvents", this.emitter.relayEvents.bind(this.emitter));
|
|
927
783
|
this.url = url;
|
|
928
784
|
this.opts = opts;
|
|
785
|
+
this.host = new URL(url).host;
|
|
786
|
+
this.storageKey = `momentum:token:${this.host}`;
|
|
787
|
+
if (opts.persist && localStorage) {
|
|
788
|
+
const token = localStorage.getItem(this.storageKey);
|
|
789
|
+
if (token) this.token = token;
|
|
790
|
+
}
|
|
929
791
|
}
|
|
930
792
|
get token() {
|
|
931
793
|
return this._token;
|
|
@@ -934,27 +796,31 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
934
796
|
if (token == this._token) return;
|
|
935
797
|
this._token = token;
|
|
936
798
|
this.headers["Authorization"] = token ? `Bearer ${token}` : null;
|
|
937
|
-
this.
|
|
799
|
+
if (this.opts.persist && localStorage) {
|
|
800
|
+
if (token) localStorage.setItem(this.storageKey, token);
|
|
801
|
+
else localStorage.removeItem(this.storageKey);
|
|
802
|
+
}
|
|
803
|
+
this.emit(mt`api/token:${token ? "u" : "d"}`, token);
|
|
938
804
|
}
|
|
939
805
|
healthcheck() {
|
|
940
806
|
return this.request({ url: "/api/healthcheck" }).then((resp) => {
|
|
941
|
-
this.emit(
|
|
807
|
+
this.emit(mt`api/healthcheck:r`, resp);
|
|
942
808
|
return resp;
|
|
943
809
|
});
|
|
944
810
|
}
|
|
945
811
|
request(options) {
|
|
946
|
-
const key =
|
|
812
|
+
const key = Ot(options);
|
|
947
813
|
const method = options.method == "GET" ? "r" : options.method == "POST" ? "c" : options.method == "DELETE" ? "d" : "u";
|
|
948
814
|
if (this.pending[key] != null) return this.pending[key];
|
|
949
815
|
this.pending[key] = super.request(options).then((response) => {
|
|
950
|
-
this.emit(
|
|
816
|
+
this.emit(mt`api/response:${method}`, { request: options, response });
|
|
951
817
|
return response.data;
|
|
952
818
|
}).catch((err) => {
|
|
953
819
|
const e = (err == null ? void 0 : err.data) || err;
|
|
954
|
-
this.emit(
|
|
820
|
+
this.emit(mt`api/error:${method}`, { request: options, error: e });
|
|
955
821
|
throw e;
|
|
956
822
|
}).finally(() => delete this.pending[key]);
|
|
957
|
-
this.emit(
|
|
823
|
+
this.emit(mt`api/request:${method}`, { request: options, response: this.pending[key] });
|
|
958
824
|
return this.pending[key];
|
|
959
825
|
}
|
|
960
826
|
}
|
|
@@ -968,59 +834,59 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
968
834
|
ActionType2[ActionType2["PUT"] = 6] = "PUT";
|
|
969
835
|
return ActionType2;
|
|
970
836
|
})(ActionType || {});
|
|
971
|
-
class Actions extends
|
|
837
|
+
class Actions extends re {
|
|
972
838
|
constructor(api) {
|
|
973
839
|
super();
|
|
974
840
|
__publicField(this, "api");
|
|
975
|
-
__publicField(this, "cache", new
|
|
841
|
+
__publicField(this, "cache", new Tt("_id"));
|
|
976
842
|
this.api = typeof api == "string" ? new Api(api) : api;
|
|
977
843
|
}
|
|
978
|
-
delete(id) {
|
|
979
|
-
if (!id) throw new Error("Cannot delete action, missing ID");
|
|
980
|
-
return this.api.request({ url: `/api/` + PES`actions/${id}`, method: "DELETE" }).then(() => {
|
|
981
|
-
this.cache.delete(id);
|
|
982
|
-
this.emit(PES`actions/${id}:d`, id);
|
|
983
|
-
});
|
|
984
|
-
}
|
|
985
844
|
all() {
|
|
986
|
-
return this.api.request({ url: `/api/` +
|
|
845
|
+
return this.api.request({ url: `/api/` + mt`actions` }).then((resp) => {
|
|
987
846
|
this.cache.addAll(resp);
|
|
988
|
-
this.emit(
|
|
847
|
+
this.emit(mt`actions:r`, resp || []);
|
|
989
848
|
return resp;
|
|
990
849
|
});
|
|
991
850
|
}
|
|
851
|
+
delete(id) {
|
|
852
|
+
if (!id) throw new Error("Cannot delete action, missing ID");
|
|
853
|
+
return this.api.request({ url: `/api/` + mt`actions/${id}`, method: "DELETE" }).then(() => {
|
|
854
|
+
this.cache.delete(id);
|
|
855
|
+
this.emit(mt`actions/${id}:d`, id);
|
|
856
|
+
});
|
|
857
|
+
}
|
|
992
858
|
read(id, reload = false) {
|
|
993
859
|
if (!id) throw new Error("Cannot read action, missing ID");
|
|
994
860
|
const cached = this.cache.get(id);
|
|
995
861
|
if (!reload && cached) return Promise.resolve(cached);
|
|
996
|
-
return this.api.request({ url: `/api/` +
|
|
862
|
+
return this.api.request({ url: `/api/` + mt`actions/${id}` }).then((action) => {
|
|
997
863
|
if (action) this.cache.add(action);
|
|
998
|
-
this.emit(
|
|
864
|
+
this.emit(mt`actions/${id}:r`, action);
|
|
999
865
|
return action;
|
|
1000
866
|
});
|
|
1001
867
|
}
|
|
1002
868
|
run(path, opts = {}) {
|
|
1003
869
|
if (!path) throw new Error("Cannot run action, missing path");
|
|
1004
|
-
return this.api.request({ url: `/api/` +
|
|
870
|
+
return this.api.request({ url: `/api/` + mt`actions/run/${path}`, ...opts });
|
|
1005
871
|
}
|
|
1006
872
|
runById(action, opts = {}) {
|
|
1007
873
|
const id = typeof action == "string" ? action : action == null ? void 0 : action._id;
|
|
1008
874
|
if (!id) throw new Error("Cannot run action, missing ID");
|
|
1009
|
-
return this.api.request({ url: "/api/" +
|
|
875
|
+
return this.api.request({ url: "/api/" + mt`actions/run-by-id/${id}`, method: "POST", ...opts });
|
|
1010
876
|
}
|
|
1011
877
|
update(action) {
|
|
1012
878
|
return this.api.request({
|
|
1013
|
-
url: `/api/` +
|
|
879
|
+
url: `/api/` + mt`actions/${action._id}`,
|
|
1014
880
|
method: "POST",
|
|
1015
881
|
body: action
|
|
1016
882
|
}).then((action2) => {
|
|
1017
883
|
if (action2) this.cache.add(action2);
|
|
1018
|
-
this.emit(
|
|
884
|
+
this.emit(mt`actions/${action2._id}:u`, action2);
|
|
1019
885
|
return action2;
|
|
1020
886
|
});
|
|
1021
887
|
}
|
|
1022
888
|
}
|
|
1023
|
-
class Ai extends
|
|
889
|
+
class Ai extends re {
|
|
1024
890
|
constructor(api) {
|
|
1025
891
|
super();
|
|
1026
892
|
__publicField(this, "api");
|
|
@@ -1028,19 +894,19 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1028
894
|
}
|
|
1029
895
|
ask(question, context) {
|
|
1030
896
|
if (!question) throw new Error("Cannot ask AI, missing question");
|
|
1031
|
-
return this.api.request({ url: `/api/` +
|
|
897
|
+
return this.api.request({ url: `/api/` + mt`ai`, method: "POST", body: {
|
|
1032
898
|
question,
|
|
1033
899
|
context
|
|
1034
900
|
} }).then((response) => {
|
|
1035
|
-
this.emit(
|
|
901
|
+
this.emit(mt`ai:c`, { question, context, response });
|
|
1036
902
|
return response;
|
|
1037
903
|
});
|
|
1038
904
|
}
|
|
1039
905
|
clear() {
|
|
1040
|
-
return this.api.request({ url: "/api/" +
|
|
906
|
+
return this.api.request({ url: "/api/" + mt`ai`, method: "DELETE" }).then(() => this.emit(mt`ai:d`, this.api.token));
|
|
1041
907
|
}
|
|
1042
908
|
}
|
|
1043
|
-
class Analytics extends
|
|
909
|
+
class Analytics extends re {
|
|
1044
910
|
constructor(api) {
|
|
1045
911
|
super();
|
|
1046
912
|
__publicField(this, "api");
|
|
@@ -1048,46 +914,24 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1048
914
|
}
|
|
1049
915
|
ipTrace(ip) {
|
|
1050
916
|
if (!ip) throw new Error("Cannot trace, missing IP");
|
|
1051
|
-
return this.api.request({ url: `/api/` +
|
|
1052
|
-
this.emit(
|
|
917
|
+
return this.api.request({ url: `/api/` + mt`analytics/trace/${ip}` }).then((resp) => {
|
|
918
|
+
this.emit(mt`analytics/trace/${ip}:r`, resp);
|
|
1053
919
|
return resp;
|
|
1054
920
|
});
|
|
1055
921
|
}
|
|
1056
922
|
}
|
|
1057
|
-
class
|
|
1058
|
-
constructor(api) {
|
|
1059
|
-
__publicField(this, "enable", this.reset);
|
|
1060
|
-
this.api = api;
|
|
1061
|
-
}
|
|
1062
|
-
disable(username) {
|
|
1063
|
-
return this.api.request({ url: `/api/auth/totp/${username}`, method: "DELETE" });
|
|
1064
|
-
}
|
|
1065
|
-
reset(username) {
|
|
1066
|
-
return this.api.request({ url: `/api/auth/totp/${username}`, method: "POST" });
|
|
1067
|
-
}
|
|
1068
|
-
setup(username, method = "app", totp) {
|
|
1069
|
-
return this.api.request({ url: `/api/auth/totp/${username}`, body: ut({
|
|
1070
|
-
method,
|
|
1071
|
-
totp
|
|
1072
|
-
}) });
|
|
1073
|
-
}
|
|
1074
|
-
}
|
|
1075
|
-
class Auth extends PathedEventEmitter {
|
|
923
|
+
class Auth extends re {
|
|
1076
924
|
constructor(api, opts = {}) {
|
|
1077
925
|
super();
|
|
1078
926
|
__publicField(this, "api");
|
|
1079
|
-
__publicField(this, "storageKey");
|
|
1080
|
-
__publicField(this, "totp");
|
|
1081
927
|
__publicField(this, "_user");
|
|
928
|
+
__publicField(this, "enableTotp", this.resetTotp);
|
|
1082
929
|
this.opts = opts;
|
|
1083
930
|
this.api = typeof api == "string" ? new Api(api) : api;
|
|
1084
|
-
this.totp = new Totp(this.api);
|
|
1085
931
|
this.opts = {
|
|
1086
|
-
|
|
1087
|
-
persist: true,
|
|
932
|
+
loginUrl: this.api.url + "/ui/#/login",
|
|
1088
933
|
...this.opts
|
|
1089
934
|
};
|
|
1090
|
-
this.storageKey = `momentum:${new URL(this.api.url).host}`;
|
|
1091
935
|
this.api.addInterceptor((resp, next) => {
|
|
1092
936
|
const blacklist = [
|
|
1093
937
|
"/api/auth/login",
|
|
@@ -1095,35 +939,24 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1095
939
|
"/api/auth/totp"
|
|
1096
940
|
];
|
|
1097
941
|
if (resp.status == 401 && !blacklist.find((url) => resp.url.includes(url)))
|
|
1098
|
-
this.emit(
|
|
942
|
+
this.emit(mt`auth/session-expired:d`, this.api.token);
|
|
1099
943
|
next();
|
|
1100
944
|
});
|
|
945
|
+
if (this.api.token) this.session(this.api.token, true);
|
|
946
|
+
else this.user = null;
|
|
1101
947
|
this.api.on("api/token", (event, token) => {
|
|
1102
|
-
var _a;
|
|
1103
|
-
console.log("loading user...");
|
|
1104
|
-
if ((_a = this.opts) == null ? void 0 : _a.persist) {
|
|
1105
|
-
if (token) localStorage.setItem(this.storageKey, token);
|
|
1106
|
-
else localStorage.removeItem(this.storageKey);
|
|
1107
|
-
}
|
|
1108
948
|
if (token) this.session(token, true).catch(() => {
|
|
1109
949
|
});
|
|
1110
950
|
else this.user = null;
|
|
1111
951
|
});
|
|
1112
|
-
if (opts == null ? void 0 : opts.persist) {
|
|
1113
|
-
const token = localStorage.getItem(this.storageKey);
|
|
1114
|
-
if (token) this.api.token = token;
|
|
1115
|
-
else this.user = null;
|
|
1116
|
-
} else {
|
|
1117
|
-
this.user = null;
|
|
1118
|
-
}
|
|
1119
952
|
}
|
|
1120
953
|
get user() {
|
|
1121
954
|
return this._user;
|
|
1122
955
|
}
|
|
1123
956
|
set user(user) {
|
|
1124
|
-
if (!
|
|
957
|
+
if (!O(this.user, user)) {
|
|
1125
958
|
this._user = user ? user : null;
|
|
1126
|
-
this.emit(
|
|
959
|
+
this.emit(mt`auth/user:u`, this._user);
|
|
1127
960
|
}
|
|
1128
961
|
}
|
|
1129
962
|
knownHost(host = location.origin) {
|
|
@@ -1144,16 +977,16 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1144
977
|
}).then(async (resp) => {
|
|
1145
978
|
this.api.token = (resp == null ? void 0 : resp.token) || null;
|
|
1146
979
|
const user = await this.once("auth/user");
|
|
1147
|
-
this.emit(
|
|
980
|
+
this.emit(mt`auth/login/${username}:u`, user);
|
|
1148
981
|
return user;
|
|
1149
982
|
});
|
|
1150
983
|
}
|
|
1151
984
|
loginRedirect(host = location.origin) {
|
|
1152
985
|
return new Promise((res, rej) => {
|
|
1153
986
|
var _a;
|
|
1154
|
-
const win = window.open(encodeURI(`${(_a = this.opts) == null ? void 0 : _a.
|
|
987
|
+
const win = window.open(encodeURI(`${(_a = this.opts) == null ? void 0 : _a.loginUrl}?redirect=postmessage&host=${host}`), "_blank");
|
|
1155
988
|
if (!win) return rej("Unable to open login");
|
|
1156
|
-
const origin = new URL(this.opts.
|
|
989
|
+
const origin = new URL(this.opts.loginUrl).origin;
|
|
1157
990
|
win.addEventListener("message", (event) => {
|
|
1158
991
|
const data = (event == null ? void 0 : event.data) || {};
|
|
1159
992
|
if (event.origin != data.sender || data.sender != origin) return;
|
|
@@ -1165,7 +998,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1165
998
|
});
|
|
1166
999
|
}
|
|
1167
1000
|
logout() {
|
|
1168
|
-
this.emit(
|
|
1001
|
+
this.emit(mt`auth/logout:d`, this.user);
|
|
1169
1002
|
this.api.token = null;
|
|
1170
1003
|
this.user = null;
|
|
1171
1004
|
}
|
|
@@ -1174,7 +1007,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1174
1007
|
if (!u.username || !u.password) throw new Error("Cannot register user, missing username or password");
|
|
1175
1008
|
const user = await this.api.request({ url: "/api/auth/register", body: { ...u } });
|
|
1176
1009
|
if ((_a = user == null ? void 0 : user.image) == null ? void 0 : _a.startsWith("/")) user.image = `${this.api.url}${user.image}?token=${this.api.token}`;
|
|
1177
|
-
this.emit(
|
|
1010
|
+
this.emit(mt`auth/register:c`, user);
|
|
1178
1011
|
return user;
|
|
1179
1012
|
}
|
|
1180
1013
|
reset(emailOrPass, token) {
|
|
@@ -1187,7 +1020,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1187
1020
|
password: token ? emailOrPass : void 0
|
|
1188
1021
|
}
|
|
1189
1022
|
}).then(() => {
|
|
1190
|
-
this.emit(
|
|
1023
|
+
this.emit(mt`auth/reset:${token ? "u" : "c"}`, token || emailOrPass);
|
|
1191
1024
|
});
|
|
1192
1025
|
}
|
|
1193
1026
|
async session(token, set = false) {
|
|
@@ -1196,12 +1029,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1196
1029
|
url: "/api/auth/session",
|
|
1197
1030
|
headers: token ? { "Authorization": `Bearer ${token}` } : void 0
|
|
1198
1031
|
});
|
|
1199
|
-
this.emit(
|
|
1032
|
+
this.emit(mt`auth/session:r`, session);
|
|
1200
1033
|
if (set) {
|
|
1201
1034
|
this.api.token = token;
|
|
1202
1035
|
if (session == null ? void 0 : session.user) session.user.image = `${this.api.url}${session.user.image}?token=${this.api.token}`;
|
|
1203
1036
|
this.user = (session == null ? void 0 : session.user) || null;
|
|
1204
|
-
if (session) this.emit(
|
|
1037
|
+
if (session) this.emit(mt`auth/login:c`, session.user);
|
|
1205
1038
|
}
|
|
1206
1039
|
return session;
|
|
1207
1040
|
}
|
|
@@ -1211,12 +1044,25 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1211
1044
|
url: "/api/auth/password",
|
|
1212
1045
|
body: { username, password, oldPassword }
|
|
1213
1046
|
}).then((resp) => {
|
|
1214
|
-
this.emit(
|
|
1047
|
+
this.emit(mt`auth/reset:u`, resp == null ? void 0 : resp.token);
|
|
1215
1048
|
if (resp == null ? void 0 : resp.token) this.api.token = resp.token;
|
|
1216
1049
|
});
|
|
1217
1050
|
}
|
|
1051
|
+
// TOTP ============================================================================================================
|
|
1052
|
+
disableTotp(username) {
|
|
1053
|
+
return this.api.request({ url: `/api/auth/totp/${username}`, method: "DELETE" });
|
|
1054
|
+
}
|
|
1055
|
+
resetTotp(username) {
|
|
1056
|
+
return this.api.request({ url: `/api/auth/totp/${username}`, method: "POST" });
|
|
1057
|
+
}
|
|
1058
|
+
setupTotp(username, method = "app", totp) {
|
|
1059
|
+
return this.api.request({ url: `/api/auth/totp/${username}`, body: ot({
|
|
1060
|
+
method,
|
|
1061
|
+
totp
|
|
1062
|
+
}) });
|
|
1063
|
+
}
|
|
1218
1064
|
}
|
|
1219
|
-
class Client extends
|
|
1065
|
+
class Client extends re {
|
|
1220
1066
|
constructor(settings) {
|
|
1221
1067
|
super();
|
|
1222
1068
|
__publicField(this, "_platform");
|
|
@@ -1243,9 +1089,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1243
1089
|
this._pwa = window.matchMedia("(display-mode: standalone)").matches || (navigator == null ? void 0 : navigator.standalone) || document.referrer.includes("android-app://");
|
|
1244
1090
|
return this._pwa;
|
|
1245
1091
|
}
|
|
1246
|
-
async inject(reload = false) {
|
|
1092
|
+
async inject(reload = false, firstLoad = true) {
|
|
1247
1093
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1248
|
-
|
|
1094
|
+
let settings = this.settings.cache;
|
|
1095
|
+
if (firstLoad) this.settings.all(false, reload).then(() => this.inject(false, false)).catch(() => {
|
|
1096
|
+
});
|
|
1249
1097
|
if (!document.querySelector('meta[name="mobile-web-app-capable"]')) {
|
|
1250
1098
|
const meta = document.createElement("meta");
|
|
1251
1099
|
meta.name = "mobile-web-app-capable";
|
|
@@ -1317,7 +1165,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1317
1165
|
if (!dismissed && !this.pwa && this.mobile) this.pwaPrompt();
|
|
1318
1166
|
}, 500);
|
|
1319
1167
|
}
|
|
1320
|
-
this.emit(
|
|
1168
|
+
this.emit(mt`client/inject:c`, this.platform);
|
|
1321
1169
|
}
|
|
1322
1170
|
pwaPrompt(platform) {
|
|
1323
1171
|
const url = this.settings.api.url;
|
|
@@ -1434,16 +1282,16 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1434
1282
|
setTimeout(() => {
|
|
1435
1283
|
prompt.remove();
|
|
1436
1284
|
backdrop.remove();
|
|
1437
|
-
this.emit(
|
|
1285
|
+
this.emit(mt`client/pwa:d`, platform);
|
|
1438
1286
|
}, 500);
|
|
1439
1287
|
};
|
|
1440
1288
|
prompt.append(close);
|
|
1441
1289
|
backdrop.append(prompt);
|
|
1442
1290
|
document.body.append(backdrop);
|
|
1443
|
-
this.emit(
|
|
1291
|
+
this.emit(mt`client/pwa:c`, platform);
|
|
1444
1292
|
}
|
|
1445
1293
|
}
|
|
1446
|
-
class Data extends
|
|
1294
|
+
class Data extends re {
|
|
1447
1295
|
constructor(api) {
|
|
1448
1296
|
super();
|
|
1449
1297
|
__publicField(this, "api");
|
|
@@ -1452,18 +1300,25 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1452
1300
|
create(collection, document2) {
|
|
1453
1301
|
if (!collection || !document2) throw new Error("Cannot create document, missing collection or document");
|
|
1454
1302
|
return this.api.request({
|
|
1455
|
-
url: `/api/` +
|
|
1303
|
+
url: `/api/` + mt`data/${collection}`,
|
|
1456
1304
|
method: "POST",
|
|
1457
1305
|
body: document2
|
|
1458
1306
|
}).then((resp) => {
|
|
1459
|
-
this.emit(
|
|
1307
|
+
this.emit(mt`data/${collection}:c`, resp);
|
|
1460
1308
|
return resp;
|
|
1461
1309
|
});
|
|
1462
1310
|
}
|
|
1311
|
+
delete(collection, id) {
|
|
1312
|
+
if (!collection || !id) throw new Error("Cannot delete document, missing collection or ID");
|
|
1313
|
+
return this.api.request({
|
|
1314
|
+
url: `/api/` + mt`data/${collection}/${id}`,
|
|
1315
|
+
method: "DELETE"
|
|
1316
|
+
}).then(() => this.emit(mt`data/${collection}/${id}:d`, id));
|
|
1317
|
+
}
|
|
1463
1318
|
read(collection, id) {
|
|
1464
1319
|
if (!collection) throw new Error("Cannot read documents, missing collection");
|
|
1465
|
-
return this.api.request({ url: `/api/` +
|
|
1466
|
-
this.emit(
|
|
1320
|
+
return this.api.request({ url: `/api/` + mt`data/${collection}/${id}` }).then((resp) => {
|
|
1321
|
+
this.emit(mt`data/${collection}/${id}:r`, collection, resp);
|
|
1467
1322
|
return resp;
|
|
1468
1323
|
});
|
|
1469
1324
|
}
|
|
@@ -1471,48 +1326,42 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1471
1326
|
if (!collection || !document2) throw new Error("Cannot update document, missing collection or document");
|
|
1472
1327
|
if (!document2._id) return this.create(collection, document2);
|
|
1473
1328
|
return this.api.request({
|
|
1474
|
-
url: `/api/` +
|
|
1329
|
+
url: `/api/` + mt`data/${collection}/${document2._id}`,
|
|
1475
1330
|
method: append ? "PATCH" : "PUT",
|
|
1476
1331
|
body: document2
|
|
1477
1332
|
}).then((resp) => {
|
|
1478
|
-
this.emit(
|
|
1333
|
+
this.emit(mt`data/${collection}/${document2._id}:u`, resp);
|
|
1479
1334
|
return resp;
|
|
1480
1335
|
});
|
|
1481
1336
|
}
|
|
1482
|
-
delete(collection, id) {
|
|
1483
|
-
if (!collection || !id) throw new Error("Cannot delete document, missing collection or ID");
|
|
1484
|
-
return this.api.request({
|
|
1485
|
-
url: `/api/` + PES`data/${collection}/${id}`,
|
|
1486
|
-
method: "DELETE"
|
|
1487
|
-
}).then(() => this.emit(PES`data/${collection}/${id}:d`, id));
|
|
1488
|
-
}
|
|
1489
1337
|
raw(collection, query) {
|
|
1490
1338
|
if (!collection || !query) throw new Error("Cannot execute raw query, missing collection or query");
|
|
1491
1339
|
const mode = query.operand.startsWith("find") ? "r" : query.operand == "insert" ? "c" : query.operand.startsWith("delete") ? "d" : "u";
|
|
1492
|
-
return this.api.request({ url: `/api/` +
|
|
1493
|
-
this.emit(
|
|
1340
|
+
return this.api.request({ url: `/api/` + mt`data/${collection}` + "?raw", body: query }).then((resp) => {
|
|
1341
|
+
this.emit(mt`data/${collection}:${mode}`, resp);
|
|
1494
1342
|
return resp;
|
|
1495
1343
|
});
|
|
1496
1344
|
}
|
|
1345
|
+
// Schema ==========================================================================================================
|
|
1497
1346
|
deleteSchema(path) {
|
|
1498
1347
|
if (!path) throw new Error("Cannot delete schema, missing collection path");
|
|
1499
|
-
return this.api.request({ url: `/api/` +
|
|
1348
|
+
return this.api.request({ url: `/api/` + mt`schema/${path}`, method: "DELETE" }).then(() => this.emit(mt`schema/${path}:d`, path));
|
|
1500
1349
|
}
|
|
1501
|
-
|
|
1502
|
-
return this.api.request({ url: "/api/" +
|
|
1503
|
-
this.emit(
|
|
1350
|
+
readSchema(pathOrTree) {
|
|
1351
|
+
return this.api.request({ url: "/api/" + mt`schema/${typeof pathOrTree == "string" ? pathOrTree : ""}` + (pathOrTree === true ? `?tree=${pathOrTree}` : "") }).then((resp) => {
|
|
1352
|
+
this.emit(mt`schema/${typeof pathOrTree == "string" ? pathOrTree : ""}:r`, resp);
|
|
1504
1353
|
return resp;
|
|
1505
1354
|
});
|
|
1506
1355
|
}
|
|
1507
|
-
|
|
1356
|
+
updateSchema(schema) {
|
|
1508
1357
|
if (!schema.path) throw new Error("Cannot update schema, missing collection path");
|
|
1509
|
-
return this.api.request({ url: "/api/" +
|
|
1510
|
-
this.emit(
|
|
1358
|
+
return this.api.request({ url: "/api/" + mt`schema/${schema.path}`, body: schema }).then((resp) => {
|
|
1359
|
+
this.emit(mt`schema/${schema.path}:${schema._id ? "u" : "c"}`, resp);
|
|
1511
1360
|
return resp;
|
|
1512
1361
|
});
|
|
1513
1362
|
}
|
|
1514
1363
|
}
|
|
1515
|
-
class Email extends
|
|
1364
|
+
class Email extends re {
|
|
1516
1365
|
constructor(api) {
|
|
1517
1366
|
super();
|
|
1518
1367
|
__publicField(this, "api");
|
|
@@ -1521,92 +1370,126 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1521
1370
|
send(email) {
|
|
1522
1371
|
var _a;
|
|
1523
1372
|
if (!email.to && !email.bcc || !email.body) throw new Error("Cannot send email, missing address or body");
|
|
1524
|
-
return this.api.request({ url: "/api/" +
|
|
1373
|
+
return this.api.request({ url: "/api/" + mt`email/${(_a = email.body) == null ? void 0 : _a.template}`, body: email }).then((response) => {
|
|
1525
1374
|
var _a2;
|
|
1526
|
-
this.emit(
|
|
1375
|
+
this.emit(mt`email/${(_a2 = email.body) == null ? void 0 : _a2.template}:c`, { email, response });
|
|
1527
1376
|
return response;
|
|
1528
1377
|
});
|
|
1529
1378
|
}
|
|
1530
1379
|
}
|
|
1531
|
-
class Groups extends
|
|
1380
|
+
class Groups extends re {
|
|
1532
1381
|
constructor(api) {
|
|
1533
1382
|
super();
|
|
1534
1383
|
__publicField(this, "api");
|
|
1535
|
-
__publicField(this, "cache", new
|
|
1384
|
+
__publicField(this, "cache", new Tt("name"));
|
|
1536
1385
|
this.api = typeof api == "string" ? new Api(api) : api;
|
|
1537
1386
|
}
|
|
1538
1387
|
async all(reload) {
|
|
1539
1388
|
if (!reload && this.cache.complete) return this.cache.all();
|
|
1540
|
-
return this.api.request({ url: `/api/` +
|
|
1389
|
+
return this.api.request({ url: `/api/` + mt`groups` }).then((resp) => {
|
|
1541
1390
|
this.cache.addAll(resp);
|
|
1542
|
-
this.emit(
|
|
1391
|
+
this.emit(mt`groups:r`, resp || []);
|
|
1543
1392
|
return resp;
|
|
1544
1393
|
});
|
|
1545
1394
|
}
|
|
1395
|
+
delete(name) {
|
|
1396
|
+
if (!name) throw new Error("Cannot delete group, missing name");
|
|
1397
|
+
return this.api.request({
|
|
1398
|
+
url: `/api/` + mt`groups/${name}`,
|
|
1399
|
+
method: "DELETE"
|
|
1400
|
+
}).then(() => {
|
|
1401
|
+
this.cache.delete(name);
|
|
1402
|
+
this.emit(mt`groups/${name}:d`);
|
|
1403
|
+
});
|
|
1404
|
+
}
|
|
1546
1405
|
create(group) {
|
|
1547
1406
|
if (!group.name) throw new Error("Cannot create group, missing name");
|
|
1548
1407
|
return this.api.request({
|
|
1549
|
-
url: `/api/` +
|
|
1408
|
+
url: `/api/` + mt`groups/${group.name}`,
|
|
1550
1409
|
method: "POST",
|
|
1551
1410
|
body: group
|
|
1552
1411
|
}).then((resp) => {
|
|
1553
1412
|
this.cache.add(resp);
|
|
1554
|
-
this.emit(
|
|
1413
|
+
this.emit(mt`groups/${group.name}:c`, resp);
|
|
1555
1414
|
return resp;
|
|
1556
1415
|
});
|
|
1557
1416
|
}
|
|
1558
1417
|
async read(name, reload) {
|
|
1559
1418
|
if (!name) throw new Error("Cannot read group, missing name");
|
|
1560
1419
|
if (!reload && this.cache.get(name)) return this.cache.get(name);
|
|
1561
|
-
return this.api.request({ url: `/api/` +
|
|
1420
|
+
return this.api.request({ url: `/api/` + mt`groups/${name}` }).then((resp) => {
|
|
1562
1421
|
this.cache.add(resp);
|
|
1563
|
-
this.emit(
|
|
1422
|
+
this.emit(mt`groups/${name}:r`, resp);
|
|
1564
1423
|
return resp;
|
|
1565
1424
|
});
|
|
1566
1425
|
}
|
|
1567
1426
|
update(group) {
|
|
1568
1427
|
if (!group.name) throw new Error("Cannot update group, missing name");
|
|
1569
1428
|
return this.api.request({
|
|
1570
|
-
url: `/api/` +
|
|
1429
|
+
url: `/api/` + mt`groups/${group.name}`,
|
|
1571
1430
|
method: "PATCH",
|
|
1572
1431
|
body: group
|
|
1573
1432
|
}).then((resp) => {
|
|
1574
1433
|
this.cache.add(resp);
|
|
1575
|
-
this.emit(
|
|
1434
|
+
this.emit(mt`groups/${group.name}:u`, resp);
|
|
1576
1435
|
return resp;
|
|
1577
1436
|
});
|
|
1578
1437
|
}
|
|
1579
|
-
delete(name) {
|
|
1580
|
-
if (!name) throw new Error("Cannot delete group, missing name");
|
|
1581
|
-
return this.api.request({
|
|
1582
|
-
url: `/api/` + PES`groups/${name}`,
|
|
1583
|
-
method: "DELETE"
|
|
1584
|
-
}).then(() => {
|
|
1585
|
-
this.cache.delete(name);
|
|
1586
|
-
this.emit(PES`groups/${name}:d`);
|
|
1587
|
-
});
|
|
1588
|
-
}
|
|
1589
1438
|
}
|
|
1590
|
-
class Logger extends
|
|
1591
|
-
constructor(api,
|
|
1439
|
+
class Logger extends re {
|
|
1440
|
+
constructor(api, channel, logLevel) {
|
|
1592
1441
|
super();
|
|
1593
1442
|
__publicField(this, "api");
|
|
1594
|
-
this
|
|
1443
|
+
__publicField(this, "console", {
|
|
1444
|
+
debug: console.debug,
|
|
1445
|
+
log: console.log,
|
|
1446
|
+
info: console.info,
|
|
1447
|
+
warn: console.warn,
|
|
1448
|
+
error: console.error
|
|
1449
|
+
});
|
|
1450
|
+
this.channel = channel;
|
|
1451
|
+
if (channel.toLowerCase() == "server") throw new Error('"Server" namespace is reserved');
|
|
1595
1452
|
this.api = typeof api == "string" ? new Api(api) : api;
|
|
1596
|
-
if (logLevel != null && logLevel != "NONE") {
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1453
|
+
if (logLevel != null && logLevel && logLevel != "NONE") {
|
|
1454
|
+
if (ft[logLevel] >= 0) {
|
|
1455
|
+
console.error = (...args) => {
|
|
1456
|
+
this.console.error(...args);
|
|
1457
|
+
this.error(...args);
|
|
1458
|
+
};
|
|
1459
|
+
window.addEventListener("unhandledrejection", async (event) => {
|
|
1460
|
+
var _a, _b, _c, _d;
|
|
1461
|
+
let log = ((_a = event.reason) == null ? void 0 : _a.stack) || event.reason;
|
|
1462
|
+
if ((_b = event.reason) == null ? void 0 : _b.url)
|
|
1463
|
+
log = `${event.reason.method} ${event.reason.url} -> ${event.reason.code}
|
|
1606
1464
|
|
|
1607
1465
|
${log}`;
|
|
1608
|
-
|
|
1609
|
-
|
|
1466
|
+
((_c = event.reason) == null ? void 0 : _c.code) == null || ((_d = event.reason) == null ? void 0 : _d.code) >= 500 ? this.error(log) : this.warn(log);
|
|
1467
|
+
});
|
|
1468
|
+
}
|
|
1469
|
+
if (ft[logLevel] >= 1) {
|
|
1470
|
+
console.warn = (...args) => {
|
|
1471
|
+
this.console.warn(...args);
|
|
1472
|
+
this.warn(...args);
|
|
1473
|
+
};
|
|
1474
|
+
}
|
|
1475
|
+
if (ft[logLevel] >= 2) {
|
|
1476
|
+
console.info = (...args) => {
|
|
1477
|
+
this.console.info(...args);
|
|
1478
|
+
this.info(...args);
|
|
1479
|
+
};
|
|
1480
|
+
}
|
|
1481
|
+
if (ft[logLevel] >= 3) {
|
|
1482
|
+
console.log = (...args) => {
|
|
1483
|
+
this.console.log(...args);
|
|
1484
|
+
this.log(...args);
|
|
1485
|
+
};
|
|
1486
|
+
}
|
|
1487
|
+
if (ft[logLevel] >= 4) {
|
|
1488
|
+
console.debug = (...args) => {
|
|
1489
|
+
this.console.debug(...args);
|
|
1490
|
+
this.debug(...args);
|
|
1491
|
+
};
|
|
1492
|
+
}
|
|
1610
1493
|
}
|
|
1611
1494
|
}
|
|
1612
1495
|
buildLog(level, log) {
|
|
@@ -1622,44 +1505,41 @@ ${log}`;
|
|
|
1622
1505
|
}
|
|
1623
1506
|
};
|
|
1624
1507
|
}
|
|
1625
|
-
|
|
1626
|
-
|
|
1508
|
+
create(log, channel = this.channel) {
|
|
1509
|
+
if (channel.toLowerCase() == "server") throw new Error('"Server" namespace is reserved');
|
|
1510
|
+
return this.api.request({ url: `/api/` + mt`logs/${channel}`, body: log }).then(() => this.emit(mt`logs/${channel}:c`, log)).catch(() => {
|
|
1627
1511
|
});
|
|
1628
1512
|
}
|
|
1629
|
-
|
|
1630
|
-
return this.api.request({ url:
|
|
1513
|
+
channels() {
|
|
1514
|
+
return this.api.request({ url: "/api/" + mt`logs/channels` });
|
|
1631
1515
|
}
|
|
1632
|
-
|
|
1633
|
-
return this.
|
|
1516
|
+
delete(channel = this.channel) {
|
|
1517
|
+
return this.api.request({ url: `/api/` + mt`logs/${channel}`, method: "DELETE" }).then(() => this.emit(mt`logs/${channel}:d`));
|
|
1634
1518
|
}
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
return this.api.request({ url: `/api/` + PES`logs/${namespace}` + (query ? `?${query}` : "") }).then((logs) => {
|
|
1639
|
-
this.emit(PES`logs/${namespace}:r`, logs);
|
|
1519
|
+
read(channel = this.channel) {
|
|
1520
|
+
return this.api.request({ url: `/api/` + mt`logs/${channel}` }).then((logs) => {
|
|
1521
|
+
this.emit(mt`logs/${channel}:r`, logs);
|
|
1640
1522
|
return logs;
|
|
1641
1523
|
});
|
|
1642
1524
|
}
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
debug(log, namespace = this.namespace) {
|
|
1647
|
-
return this.createLog(this.buildLog(yt.DEBUG, log), namespace);
|
|
1525
|
+
// Console =========================================================================================================
|
|
1526
|
+
debug(log, channel = this.channel) {
|
|
1527
|
+
return this.create(this.buildLog(ft.DEBUG, log), channel);
|
|
1648
1528
|
}
|
|
1649
|
-
log(log,
|
|
1650
|
-
return this.
|
|
1529
|
+
log(log, channel = this.channel) {
|
|
1530
|
+
return this.create(this.buildLog(ft.LOG, log), channel);
|
|
1651
1531
|
}
|
|
1652
|
-
info(log,
|
|
1653
|
-
return this.
|
|
1532
|
+
info(log, channel = this.channel) {
|
|
1533
|
+
return this.create(this.buildLog(ft.INFO, log), channel);
|
|
1654
1534
|
}
|
|
1655
|
-
warn(log,
|
|
1656
|
-
return this.
|
|
1535
|
+
warn(log, channel = this.channel) {
|
|
1536
|
+
return this.create(this.buildLog(ft.WARN, log), channel);
|
|
1657
1537
|
}
|
|
1658
|
-
error(log,
|
|
1659
|
-
return this.
|
|
1538
|
+
error(log, channel = this.channel) {
|
|
1539
|
+
return this.create(this.buildLog(ft.ERROR, log), channel);
|
|
1660
1540
|
}
|
|
1661
1541
|
}
|
|
1662
|
-
class Payments extends
|
|
1542
|
+
class Payments extends re {
|
|
1663
1543
|
constructor(api, secret) {
|
|
1664
1544
|
super();
|
|
1665
1545
|
__publicField(this, "api");
|
|
@@ -1682,7 +1562,7 @@ ${log}`;
|
|
|
1682
1562
|
amount,
|
|
1683
1563
|
custom
|
|
1684
1564
|
} });
|
|
1685
|
-
this.emit(
|
|
1565
|
+
this.emit(mt`payments:c`, request.data.clientSecret);
|
|
1686
1566
|
return request.data.clientSecret;
|
|
1687
1567
|
}
|
|
1688
1568
|
async createForm(element, amount, custom) {
|
|
@@ -1696,28 +1576,28 @@ ${log}`;
|
|
|
1696
1576
|
});
|
|
1697
1577
|
}
|
|
1698
1578
|
async history(username) {
|
|
1699
|
-
const history = await this.api.request({ url: `/api/` +
|
|
1700
|
-
this.emit(
|
|
1579
|
+
const history = await this.api.request({ url: `/api/` + mt`payments/${username}` });
|
|
1580
|
+
this.emit(mt`payments/${username}:r`, history);
|
|
1701
1581
|
return history;
|
|
1702
1582
|
}
|
|
1703
1583
|
}
|
|
1704
|
-
class Pdf extends
|
|
1584
|
+
class Pdf extends re {
|
|
1705
1585
|
constructor(api) {
|
|
1706
1586
|
super();
|
|
1707
1587
|
__publicField(this, "api");
|
|
1708
1588
|
this.api = typeof api == "string" ? new Api(api) : api;
|
|
1709
1589
|
}
|
|
1710
1590
|
createPdf(body, options) {
|
|
1711
|
-
return this.api.request({ url: `/api/` +
|
|
1591
|
+
return this.api.request({ url: `/api/` + mt`pdf`, body: { ...body, options }, decode: false }).then(async (resp) => {
|
|
1712
1592
|
const blob = await resp.blob();
|
|
1713
1593
|
if (options == null ? void 0 : options.download) {
|
|
1714
|
-
let filename = (options == null ? void 0 : options.filename) ||
|
|
1594
|
+
let filename = (options == null ? void 0 : options.filename) || kt();
|
|
1715
1595
|
if (!filename.endsWith(".pdf")) filename += ".pdf";
|
|
1716
1596
|
const url = URL.createObjectURL(blob);
|
|
1717
|
-
|
|
1597
|
+
lt(url, filename);
|
|
1718
1598
|
URL.revokeObjectURL(url);
|
|
1719
1599
|
}
|
|
1720
|
-
this.emit(
|
|
1600
|
+
this.emit(mt`pdf:c`, blob);
|
|
1721
1601
|
return blob;
|
|
1722
1602
|
});
|
|
1723
1603
|
}
|
|
@@ -1746,42 +1626,45 @@ ${log}`;
|
|
|
1746
1626
|
this.connect();
|
|
1747
1627
|
}
|
|
1748
1628
|
close() {
|
|
1749
|
-
console.debug("Disconnected from Momentum");
|
|
1750
|
-
this.open = false;
|
|
1751
|
-
this.connection.close();
|
|
1752
|
-
}
|
|
1753
|
-
connect(retry = 3) {
|
|
1754
1629
|
var _a;
|
|
1755
|
-
if (
|
|
1756
|
-
this.
|
|
1630
|
+
if (this.open) console.debug("Disconnected from Momentum");
|
|
1631
|
+
this.open = false;
|
|
1632
|
+
(_a = this.connection) == null ? void 0 : _a.close();
|
|
1633
|
+
this.connection = void 0;
|
|
1634
|
+
}
|
|
1635
|
+
connect() {
|
|
1636
|
+
if (this.open) this.close();
|
|
1637
|
+
if (navigator.onLine) {
|
|
1638
|
+
this.connection = new WebSocket(this.url + (this.api.token ? `?token=${this.api.token}` : ""));
|
|
1639
|
+
this.connection.onclose = this.close;
|
|
1640
|
+
this.connection.onmessage = this.handle;
|
|
1641
|
+
this.connection.onopen = () => {
|
|
1642
|
+
this.open = true;
|
|
1643
|
+
clearTimeout(timeout);
|
|
1644
|
+
console.debug("Connected to Momentum");
|
|
1645
|
+
};
|
|
1646
|
+
}
|
|
1757
1647
|
const timeout = setTimeout(() => {
|
|
1758
1648
|
if (this.open) return;
|
|
1759
|
-
this.
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
}, _Socket.timeout);
|
|
1763
|
-
this.connection.onclose = () => this.open = false;
|
|
1764
|
-
this.connection.onmessage = this.handle;
|
|
1765
|
-
this.connection.onopen = () => {
|
|
1766
|
-
this.open = true;
|
|
1767
|
-
clearTimeout(timeout);
|
|
1768
|
-
console.debug("Connected to Momentum");
|
|
1769
|
-
};
|
|
1649
|
+
this.close();
|
|
1650
|
+
this.connect();
|
|
1651
|
+
}, _Socket.pollingSpeed);
|
|
1770
1652
|
}
|
|
1771
1653
|
handle(...args) {
|
|
1772
1654
|
console.log(args);
|
|
1773
1655
|
}
|
|
1774
1656
|
send(channel, payload) {
|
|
1775
|
-
|
|
1657
|
+
var _a;
|
|
1658
|
+
(_a = this.connection) == null ? void 0 : _a.send(JSON.stringify({
|
|
1776
1659
|
token: this.api.token,
|
|
1777
1660
|
channel,
|
|
1778
1661
|
payload
|
|
1779
1662
|
}));
|
|
1780
1663
|
}
|
|
1781
1664
|
};
|
|
1782
|
-
__publicField(_Socket, "
|
|
1665
|
+
__publicField(_Socket, "pollingSpeed", 3e4);
|
|
1783
1666
|
let Socket = _Socket;
|
|
1784
|
-
class Storage extends
|
|
1667
|
+
class Storage extends re {
|
|
1785
1668
|
constructor(api) {
|
|
1786
1669
|
super();
|
|
1787
1670
|
__publicField(this, "api");
|
|
@@ -1789,119 +1672,119 @@ ${log}`;
|
|
|
1789
1672
|
}
|
|
1790
1673
|
copy(source, destination) {
|
|
1791
1674
|
if (!source || !destination) throw new Error("Cannot copy file or folder, missing source or destination");
|
|
1792
|
-
return this.api.request({ url: "/api/" +
|
|
1793
|
-
this.emit(
|
|
1675
|
+
return this.api.request({ url: "/api/" + mt`storage/${destination}`, body: { from: source } }).then((response) => {
|
|
1676
|
+
this.emit(mt`storage/${destination}:c`, response);
|
|
1794
1677
|
return response;
|
|
1795
1678
|
});
|
|
1796
1679
|
}
|
|
1797
1680
|
delete(path) {
|
|
1798
1681
|
if (!path) throw new Error("Cannot delete file or folder, missing path");
|
|
1799
|
-
return this.api.request({ url: "/api/" +
|
|
1800
|
-
this.emit(
|
|
1682
|
+
return this.api.request({ url: "/api/" + mt`storage/${path}`, method: "DELETE" }).then(() => {
|
|
1683
|
+
this.emit(mt`storage/${path}:d`, path);
|
|
1801
1684
|
});
|
|
1802
1685
|
}
|
|
1803
1686
|
download(path, opts = {}) {
|
|
1804
1687
|
if (!path) throw new Error("Cannot download file, missing path");
|
|
1805
|
-
return this.api.request({ ...opts, url: "/api/" +
|
|
1688
|
+
return this.api.request({ ...opts, url: "/api/" + mt`storage/${path}`, decode: false }).then(async (response) => {
|
|
1806
1689
|
const blob = await response.blob();
|
|
1807
1690
|
const name = opts.downloadAs || path.split("/").pop();
|
|
1808
|
-
this.emit(
|
|
1809
|
-
|
|
1691
|
+
this.emit(mt`storage/${path}:r`, blob);
|
|
1692
|
+
Dt(blob, name);
|
|
1810
1693
|
return response;
|
|
1811
1694
|
});
|
|
1812
1695
|
}
|
|
1813
1696
|
list(path) {
|
|
1814
1697
|
if (!path) path = "/";
|
|
1815
|
-
return this.api.request({ url: "/api/" +
|
|
1816
|
-
this.emit(
|
|
1698
|
+
return this.api.request({ url: "/api/" + mt`storage/${path}` + "?list" }).then((resp) => {
|
|
1699
|
+
this.emit(mt`storage/${path}:r`, resp);
|
|
1817
1700
|
return resp;
|
|
1818
1701
|
});
|
|
1819
1702
|
}
|
|
1820
1703
|
open(path, target = "_blank") {
|
|
1821
1704
|
if (!path) throw new Error("Cannot download file, missing path");
|
|
1822
|
-
const link = `${this.api.url}/api/` +
|
|
1705
|
+
const link = `${this.api.url}/api/` + mt`storage/${path}` + (this.api.token ? `?token=${this.api.token}` : "");
|
|
1823
1706
|
if (!target) return link;
|
|
1824
|
-
this.emit(
|
|
1707
|
+
this.emit(mt`storage/${path}:r`, path);
|
|
1825
1708
|
return window.open(link, target);
|
|
1826
1709
|
}
|
|
1827
1710
|
mkdir(path) {
|
|
1828
1711
|
if (!path) throw new Error("Cannot make directory, missing path");
|
|
1829
|
-
return this.api.request({ url: "/api/" +
|
|
1830
|
-
this.emit(
|
|
1712
|
+
return this.api.request({ url: "/api/" + mt`storage/${path}`, body: { directory: true } }).then((resp) => {
|
|
1713
|
+
this.emit(mt`storage/${path}:c`, resp);
|
|
1831
1714
|
return resp;
|
|
1832
1715
|
});
|
|
1833
1716
|
}
|
|
1834
1717
|
move(source, destination) {
|
|
1835
1718
|
if (!source || !destination) throw new Error("Cannot move file or folder, missing source or destination");
|
|
1836
1719
|
if (source == destination) return this.list(destination);
|
|
1837
|
-
return this.api.request({ url: "/api/" +
|
|
1838
|
-
this.emit(
|
|
1720
|
+
return this.api.request({ url: "/api/" + mt`storage/${source}`, method: "PATCH", body: { move: destination } }).then((response) => {
|
|
1721
|
+
this.emit(mt`storage/${source}:u`, response);
|
|
1839
1722
|
return response;
|
|
1840
1723
|
});
|
|
1841
1724
|
}
|
|
1842
1725
|
upload(files, opts) {
|
|
1843
|
-
return new
|
|
1844
|
-
if (!files) files = await
|
|
1726
|
+
return new x(async (res, rej, prog) => {
|
|
1727
|
+
if (!files) files = await Mt(typeof opts == "object" ? opts : void 0);
|
|
1845
1728
|
if (!files || Array.isArray(files) && !files.length) return [];
|
|
1846
1729
|
const path = (opts && typeof opts == "object" ? opts == null ? void 0 : opts.path : opts) || "/";
|
|
1847
|
-
return
|
|
1848
|
-
url: `${this.api.url}/api/` +
|
|
1849
|
-
files:
|
|
1730
|
+
return Pt({
|
|
1731
|
+
url: `${this.api.url}/api/` + mt`storage/${path}`,
|
|
1732
|
+
files: m(files),
|
|
1850
1733
|
headers: this.api.headers
|
|
1851
|
-
}).onProgress((
|
|
1852
|
-
prog(
|
|
1734
|
+
}).onProgress((p) => {
|
|
1735
|
+
prog(p);
|
|
1853
1736
|
}).then((resp) => {
|
|
1854
|
-
this.emit(
|
|
1737
|
+
this.emit(mt`storage/${path}:c`, resp);
|
|
1855
1738
|
res(resp);
|
|
1856
1739
|
}).catch((err) => rej(err));
|
|
1857
1740
|
});
|
|
1858
1741
|
}
|
|
1859
1742
|
}
|
|
1860
|
-
class Users extends
|
|
1743
|
+
class Users extends re {
|
|
1861
1744
|
constructor(api) {
|
|
1862
1745
|
super();
|
|
1863
1746
|
__publicField(this, "api");
|
|
1864
|
-
__publicField(this, "cache", new
|
|
1747
|
+
__publicField(this, "cache", new Tt("username"));
|
|
1865
1748
|
this.api = typeof api == "string" ? new Api(api) : api;
|
|
1866
1749
|
}
|
|
1867
1750
|
async all(reload) {
|
|
1868
1751
|
if (!reload && this.cache.complete) return this.cache.all();
|
|
1869
|
-
return this.api.request({ url: "/api/" +
|
|
1752
|
+
return this.api.request({ url: "/api/" + mt`users` }).then((resp) => {
|
|
1870
1753
|
resp == null ? void 0 : resp.forEach((r) => {
|
|
1871
1754
|
r.image = this.api.url + r.image + `?token=${this.api.token}`;
|
|
1872
1755
|
return r;
|
|
1873
1756
|
});
|
|
1874
1757
|
this.cache.addAll(resp);
|
|
1875
|
-
this.emit(
|
|
1758
|
+
this.emit(mt`users:r`, resp || []);
|
|
1876
1759
|
return resp;
|
|
1877
1760
|
});
|
|
1878
1761
|
}
|
|
1879
1762
|
delete(username) {
|
|
1880
1763
|
if (!username) throw new Error("Cannot delete user, missing username");
|
|
1881
1764
|
return this.api.request({
|
|
1882
|
-
url: "/api/" +
|
|
1765
|
+
url: "/api/" + mt`users/${username}`,
|
|
1883
1766
|
method: "DELETE"
|
|
1884
1767
|
}).then(() => {
|
|
1885
1768
|
this.cache.delete(username);
|
|
1886
|
-
this.emit(
|
|
1769
|
+
this.emit(mt`users/${username}:d`, username);
|
|
1887
1770
|
});
|
|
1888
1771
|
}
|
|
1889
1772
|
async read(username, reload) {
|
|
1890
1773
|
if (!username) throw new Error("Cannot read user, missing username");
|
|
1891
1774
|
if (!reload && this.cache.get(username)) return this.cache.get(username);
|
|
1892
|
-
return this.api.request({ url: "/api/" +
|
|
1775
|
+
return this.api.request({ url: "/api/" + mt`users/${username}` }).then((resp) => {
|
|
1893
1776
|
if (resp) {
|
|
1894
1777
|
resp.image = this.api.url + resp.image + `?token=${this.api.token}`;
|
|
1895
1778
|
this.cache.add(resp);
|
|
1896
1779
|
}
|
|
1897
|
-
this.emit(
|
|
1780
|
+
this.emit(mt`users/${username}:r`, resp);
|
|
1898
1781
|
return resp;
|
|
1899
1782
|
});
|
|
1900
1783
|
}
|
|
1901
1784
|
update(user) {
|
|
1902
1785
|
if (!user.username) throw new Error("Cannot update user, missing username");
|
|
1903
1786
|
return this.api.request({
|
|
1904
|
-
url: `/api/` +
|
|
1787
|
+
url: `/api/` + mt`users/${user.username}`,
|
|
1905
1788
|
method: "PATCH",
|
|
1906
1789
|
body: user
|
|
1907
1790
|
}).then((resp) => {
|
|
@@ -1909,60 +1792,64 @@ ${log}`;
|
|
|
1909
1792
|
resp.image = this.api.url + resp.image + `?token=${this.api.token}`;
|
|
1910
1793
|
this.cache.add(resp);
|
|
1911
1794
|
}
|
|
1912
|
-
this.emit(
|
|
1795
|
+
this.emit(mt`users/${user.username}:${resp._id ? "u" : "c"}`, resp);
|
|
1913
1796
|
return resp;
|
|
1914
1797
|
});
|
|
1915
1798
|
}
|
|
1916
1799
|
uploadImage(username, file) {
|
|
1917
1800
|
if (!username || !file) throw new Error("Cannot update user image, missing username or file");
|
|
1918
|
-
return
|
|
1919
|
-
url: this.api.url + `/api/` +
|
|
1801
|
+
return Pt({
|
|
1802
|
+
url: this.api.url + `/api/` + mt`users/${username}/image`,
|
|
1920
1803
|
files: [file],
|
|
1921
1804
|
headers: this.api.headers
|
|
1922
1805
|
});
|
|
1923
1806
|
}
|
|
1924
1807
|
}
|
|
1925
|
-
class Settings extends
|
|
1808
|
+
class Settings extends re {
|
|
1926
1809
|
constructor(api) {
|
|
1927
1810
|
super();
|
|
1928
1811
|
__publicField(this, "api");
|
|
1929
|
-
__publicField(this, "cache"
|
|
1812
|
+
__publicField(this, "cache");
|
|
1930
1813
|
this.api = typeof api == "string" ? new Api(api) : api;
|
|
1814
|
+
this.cache = new Tt("key", { storageKey: `momentum:settings:${this.api.host}` });
|
|
1815
|
+
this.api.on("api/token", () => this.all(false, true));
|
|
1931
1816
|
}
|
|
1932
|
-
async all(detailed
|
|
1817
|
+
async all(detailed, reload) {
|
|
1933
1818
|
if (!reload && !detailed && this.cache.complete) return this.cache;
|
|
1934
|
-
return this.api.request({ url: `/api/` +
|
|
1819
|
+
return this.api.request({ url: `/api/` + mt`settings` + (detailed ? "?detailed" : "") }).then((resp) => {
|
|
1820
|
+
this.cache.clear();
|
|
1935
1821
|
if (resp) Object.keys(resp).forEach((key) => this.cache.set(key, detailed ? resp[key].value : resp[key]));
|
|
1936
|
-
this.
|
|
1822
|
+
this.cache.complete = true;
|
|
1823
|
+
this.emit(mt`settings:r`, resp || []);
|
|
1937
1824
|
return resp;
|
|
1938
1825
|
});
|
|
1939
1826
|
}
|
|
1940
1827
|
delete(key) {
|
|
1941
1828
|
if (!key) throw new Error("Cannot delete setting, missing key");
|
|
1942
|
-
return this.api.request({ url: `/api/` +
|
|
1829
|
+
return this.api.request({ url: `/api/` + mt`settings/${key}`, method: "DELETE" }).then(() => {
|
|
1943
1830
|
this.cache.delete(key);
|
|
1944
|
-
this.emit(
|
|
1831
|
+
this.emit(mt`settings/${key}:d`, key);
|
|
1945
1832
|
});
|
|
1946
1833
|
}
|
|
1947
1834
|
read(key, reload = false) {
|
|
1948
1835
|
if (!key) throw new Error("Cannot read setting, missing key");
|
|
1949
1836
|
if (!reload && this.cache.get(key)) return this.cache.get(key);
|
|
1950
|
-
return this.api.request({ url: `/api/` +
|
|
1837
|
+
return this.api.request({ url: `/api/` + mt`settings/${key}` }).then((variable) => {
|
|
1951
1838
|
if (variable) this.cache.set(variable.key, variable.value);
|
|
1952
|
-
this.emit(
|
|
1839
|
+
this.emit(mt`settings/${key}:r`, variable);
|
|
1953
1840
|
return variable;
|
|
1954
1841
|
});
|
|
1955
1842
|
}
|
|
1956
1843
|
update(variable) {
|
|
1957
1844
|
if (!variable.key) throw new Error("Cannot update setting, missing key");
|
|
1958
|
-
return this.api.request({ url: `/api/` +
|
|
1845
|
+
return this.api.request({ url: `/api/` + mt`settings/${variable.key}`, body: variable }).then((variable2) => {
|
|
1959
1846
|
if (variable2) this.cache.set(variable2.key, variable2.value);
|
|
1960
|
-
this.emit(`/api/` +
|
|
1847
|
+
this.emit(`/api/` + mt`settings/${variable2.key}:${variable2._id ? "u" : "c"}`, variable2);
|
|
1961
1848
|
return variable2;
|
|
1962
1849
|
});
|
|
1963
1850
|
}
|
|
1964
1851
|
}
|
|
1965
|
-
class Static extends
|
|
1852
|
+
class Static extends re {
|
|
1966
1853
|
constructor(api) {
|
|
1967
1854
|
super();
|
|
1968
1855
|
__publicField(this, "api");
|
|
@@ -1970,27 +1857,27 @@ ${log}`;
|
|
|
1970
1857
|
}
|
|
1971
1858
|
delete(path) {
|
|
1972
1859
|
if (!path) throw new Error("Cannot delete static asset, missing path");
|
|
1973
|
-
return this.api.request({ url: `/api/` +
|
|
1974
|
-
this.emit(
|
|
1860
|
+
return this.api.request({ url: `/api/` + mt`static/${path}`, method: "DELETE" }).then(() => {
|
|
1861
|
+
this.emit(mt`static/${path}:d`, path);
|
|
1975
1862
|
});
|
|
1976
1863
|
}
|
|
1977
1864
|
upload(files, path = "/") {
|
|
1978
1865
|
if (!files) throw new Error("Cannot upload static assets, missing file");
|
|
1979
|
-
return new
|
|
1980
|
-
return
|
|
1981
|
-
url: this.api.url + "/api/" +
|
|
1982
|
-
files:
|
|
1866
|
+
return new x(async (res, rej, prog) => {
|
|
1867
|
+
return Pt({
|
|
1868
|
+
url: this.api.url + "/api/" + mt`static/${path}`,
|
|
1869
|
+
files: m(files),
|
|
1983
1870
|
headers: this.api.headers
|
|
1984
|
-
}).onProgress((
|
|
1985
|
-
prog(
|
|
1871
|
+
}).onProgress((p) => {
|
|
1872
|
+
prog(p);
|
|
1986
1873
|
}).then((resp) => {
|
|
1987
|
-
this.emit(
|
|
1874
|
+
this.emit(mt`static/${path}:c`, resp);
|
|
1988
1875
|
res(resp);
|
|
1989
1876
|
}).catch((err) => rej(err));
|
|
1990
1877
|
});
|
|
1991
1878
|
}
|
|
1992
1879
|
}
|
|
1993
|
-
class Momentum extends
|
|
1880
|
+
class Momentum extends re {
|
|
1994
1881
|
constructor(url, opts) {
|
|
1995
1882
|
super();
|
|
1996
1883
|
__publicField(this, "api");
|
|
@@ -2010,18 +1897,15 @@ ${log}`;
|
|
|
2010
1897
|
__publicField(this, "static");
|
|
2011
1898
|
__publicField(this, "storage");
|
|
2012
1899
|
__publicField(this, "users");
|
|
2013
|
-
this.api = new Api(url, opts
|
|
1900
|
+
this.api = new Api(url, opts);
|
|
2014
1901
|
this.actions = new Actions(this.api);
|
|
2015
1902
|
this.ai = new Ai(this.api);
|
|
2016
1903
|
this.analytics = new Analytics(this.api);
|
|
2017
|
-
this.auth = new Auth(this.api, {
|
|
2018
|
-
persist: (opts == null ? void 0 : opts.persist) ?? true,
|
|
2019
|
-
loginUi: opts == null ? void 0 : opts.loginUi
|
|
2020
|
-
});
|
|
1904
|
+
this.auth = new Auth(this.api, { loginUrl: opts == null ? void 0 : opts.loginUrl });
|
|
2021
1905
|
this.data = new Data(this.api);
|
|
2022
1906
|
this.email = new Email(this.api);
|
|
2023
1907
|
this.groups = new Groups(this.api);
|
|
2024
|
-
this.logger = new Logger(this.api, "client", opts == null ? void 0 : opts.logLevel);
|
|
1908
|
+
this.logger = new Logger(this.api, (opts == null ? void 0 : opts.app) || "client", opts == null ? void 0 : opts.logLevel);
|
|
2025
1909
|
if (opts == null ? void 0 : opts.stripeSecret) this.payments = new Payments(this.api, opts.stripeSecret);
|
|
2026
1910
|
this.pdf = new Pdf(this.api);
|
|
2027
1911
|
this.settings = new Settings(this.api);
|
|
@@ -2065,17 +1949,16 @@ ${log}`;
|
|
|
2065
1949
|
exports2.Groups = Groups;
|
|
2066
1950
|
exports2.Logger = Logger;
|
|
2067
1951
|
exports2.Momentum = Momentum;
|
|
2068
|
-
exports2.PE =
|
|
2069
|
-
exports2.PES =
|
|
2070
|
-
exports2.PathEvent =
|
|
2071
|
-
exports2.
|
|
1952
|
+
exports2.PE = ee;
|
|
1953
|
+
exports2.PES = mt;
|
|
1954
|
+
exports2.PathEvent = y;
|
|
1955
|
+
exports2.PathEventEmitter = re;
|
|
2072
1956
|
exports2.Payments = Payments;
|
|
2073
1957
|
exports2.Pdf = Pdf;
|
|
2074
1958
|
exports2.Settings = Settings;
|
|
2075
1959
|
exports2.Socket = Socket;
|
|
2076
1960
|
exports2.Static = Static;
|
|
2077
1961
|
exports2.Storage = Storage;
|
|
2078
|
-
exports2.Totp = Totp;
|
|
2079
1962
|
exports2.Users = Users;
|
|
2080
1963
|
Object.defineProperty(exports2, Symbol.toStringTag, { value: "Module" });
|
|
2081
1964
|
});
|