@luminix/core 0.4.2 → 0.4.4
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/core.js +228 -216
- package/package.json +1 -1
- package/types/exceptions/AttributeNotFoundException.d.ts +4 -0
package/dist/core.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { reader as
|
|
5
|
-
class
|
|
1
|
+
var pe = Object.defineProperty;
|
|
2
|
+
var ge = (o, e, t) => e in o ? pe(o, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : o[e] = t;
|
|
3
|
+
var p = (o, e, t) => ge(o, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { reader as ye, PropertyBag as _, EventSource as N, Collection as b, Query as T, Obj as g, Str as y, Reducible as oe, isValidationError as me, Macroable as ae, Client as fe, ServiceProvider as we, MakeFacade as M, Application as ve, Response as be } from "@luminix/support";
|
|
5
|
+
class xe {
|
|
6
6
|
constructor(e, t, r) {
|
|
7
|
-
|
|
7
|
+
p(this, "_user");
|
|
8
8
|
this.config = e, this.model = t, this.route = r;
|
|
9
9
|
}
|
|
10
10
|
attempt(e, t = !1, r) {
|
|
@@ -42,7 +42,7 @@ class we {
|
|
|
42
42
|
const e = this.model.make("user"), t = this.config.get("auth.user");
|
|
43
43
|
if (!t)
|
|
44
44
|
return;
|
|
45
|
-
this._user = new e(t);
|
|
45
|
+
this._user = new e(t), this._user.exists = !0;
|
|
46
46
|
}
|
|
47
47
|
return this._user;
|
|
48
48
|
}
|
|
@@ -51,19 +51,19 @@ class we {
|
|
|
51
51
|
return ((e = this.user()) == null ? void 0 : e.getKey()) || null;
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
class
|
|
54
|
+
class Me {
|
|
55
55
|
constructor() {
|
|
56
|
-
|
|
56
|
+
p(this, "bags");
|
|
57
57
|
const e = {};
|
|
58
58
|
document.querySelectorAll('#luminix-embed [id^="luminix-error"]').forEach((r) => {
|
|
59
59
|
const l = r.id.replace("luminix-error::", "");
|
|
60
|
-
e[l] =
|
|
60
|
+
e[l] = ye(l, "error");
|
|
61
61
|
}), this.bags = {
|
|
62
|
-
default: new
|
|
62
|
+
default: new _(e)
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
bag(e = "default") {
|
|
66
|
-
return this.bags[e] || (this.bags[e] = new
|
|
66
|
+
return this.bags[e] || (this.bags[e] = new _({})), this.bags[e];
|
|
67
67
|
}
|
|
68
68
|
add(e, t, r = "default") {
|
|
69
69
|
this.bag(r).set(e, t);
|
|
@@ -81,7 +81,7 @@ class ve {
|
|
|
81
81
|
this.bag(e).set(".", {});
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
class
|
|
84
|
+
class Ee {
|
|
85
85
|
constructor(e) {
|
|
86
86
|
this._debug = e;
|
|
87
87
|
}
|
|
@@ -111,17 +111,17 @@ class be {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
var j, O;
|
|
114
|
-
class
|
|
114
|
+
class $e extends (O = Error, j = Symbol.toStringTag, O) {
|
|
115
115
|
constructor(t) {
|
|
116
116
|
super(`[Luminix] Model "${t}" does not have a primary key`);
|
|
117
|
-
|
|
117
|
+
p(this, j, "ModelWithoutPrimaryKeyException");
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
-
class
|
|
120
|
+
class Se extends N {
|
|
121
121
|
constructor(t, r, i = {}) {
|
|
122
122
|
super();
|
|
123
|
-
|
|
124
|
-
this.services = t, this.abstract = r, this.bag = new
|
|
123
|
+
p(this, "bag");
|
|
124
|
+
this.services = t, this.abstract = r, this.bag = new _(i), this.bag.on("change", () => {
|
|
125
125
|
this.emit("change", {
|
|
126
126
|
data: this.bag,
|
|
127
127
|
source: this
|
|
@@ -222,16 +222,16 @@ class Me extends k {
|
|
|
222
222
|
...l.json(),
|
|
223
223
|
data: c,
|
|
224
224
|
links: {
|
|
225
|
-
first: `${s}?${
|
|
226
|
-
last: `${s}?${
|
|
227
|
-
next: l.json("links").next && `${s}?${
|
|
228
|
-
prev: l.json("links").prev && `${s}?${
|
|
225
|
+
first: `${s}?${T.merge(u, l.json("links").first).toString()}`,
|
|
226
|
+
last: `${s}?${T.merge(u, l.json("links").last).toString()}`,
|
|
227
|
+
next: l.json("links").next && `${s}?${T.merge(u, l.json("links").next ?? "").toString()}`,
|
|
228
|
+
prev: l.json("links").prev && `${s}?${T.merge(u, l.json("links").prev ?? "").toString()}`
|
|
229
229
|
},
|
|
230
230
|
meta: {
|
|
231
231
|
...l.json("meta"),
|
|
232
232
|
links: l.json("meta").links.map((n) => ({
|
|
233
233
|
...n,
|
|
234
|
-
url: n.url && `${s}?${
|
|
234
|
+
url: n.url && `${s}?${T.merge(u, n.url).toString()}`
|
|
235
235
|
}))
|
|
236
236
|
}
|
|
237
237
|
};
|
|
@@ -266,7 +266,7 @@ class Me extends k {
|
|
|
266
266
|
async find(t) {
|
|
267
267
|
const r = this.services.model.schema(this.abstract).primaryKey;
|
|
268
268
|
if (!r)
|
|
269
|
-
throw new
|
|
269
|
+
throw new $e(this.abstract);
|
|
270
270
|
const i = await this.where(r, t).limit(1).exec();
|
|
271
271
|
return this.emit("success", {
|
|
272
272
|
response: i,
|
|
@@ -294,31 +294,31 @@ class Me extends k {
|
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
296
|
var B, C;
|
|
297
|
-
class
|
|
297
|
+
class w extends (C = TypeError, B = Symbol.toStringTag, C) {
|
|
298
298
|
constructor(t, r = "Model") {
|
|
299
299
|
super(`[Luminix] "${t}" expects ${r}`);
|
|
300
|
-
|
|
300
|
+
p(this, B, "NotModelException");
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
303
|
var I, P;
|
|
304
|
-
class
|
|
304
|
+
class Te extends (P = Error, I = Symbol.toStringTag, P) {
|
|
305
305
|
constructor(t, r, i, l) {
|
|
306
306
|
super(`[Luminix] Could not determine inverse relation for "${r}" in model "${t}". Please specify a relation in model "${i}" of type ${l} that points back to "${t}".`);
|
|
307
|
-
|
|
307
|
+
p(this, I, "NoInverseRelationException");
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
310
|
var Q, L;
|
|
311
|
-
class
|
|
311
|
+
class _e extends (L = Error, Q = Symbol.toStringTag, L) {
|
|
312
312
|
constructor(t) {
|
|
313
313
|
super(`[Luminix] Relation "${t}" is not supported`);
|
|
314
|
-
|
|
314
|
+
p(this, Q, "UnsupportedRelationException");
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
|
-
class
|
|
317
|
+
class A {
|
|
318
318
|
constructor(e, t, r, i = null) {
|
|
319
|
-
|
|
320
|
-
if (this.services = e, this.meta = t, this.parent = r, this.items = i, i !== null && !
|
|
321
|
-
throw new
|
|
319
|
+
p(this, "unsubscribeQuery", null);
|
|
320
|
+
if (this.services = e, this.meta = t, this.parent = r, this.items = i, i !== null && !g.isModel(i) && !(i instanceof b && i.every(g.isModel)))
|
|
321
|
+
throw new w("Relation.constructor()", "Model, Collection<Model> or null");
|
|
322
322
|
}
|
|
323
323
|
make(e) {
|
|
324
324
|
const t = this.getRelated();
|
|
@@ -349,18 +349,18 @@ class R {
|
|
|
349
349
|
MorphToMany: ["MorphToMany"]
|
|
350
350
|
}, this.parent, t, this.getRelated());
|
|
351
351
|
if (!(t in r))
|
|
352
|
-
throw new
|
|
352
|
+
throw new _e(t);
|
|
353
353
|
for (const i in e) {
|
|
354
354
|
const l = e[i];
|
|
355
355
|
if ((l.model === this.parent.getType() || ["MorphOne", "MorphMany"].includes(t)) && r[t].includes(l.type))
|
|
356
356
|
return i;
|
|
357
357
|
}
|
|
358
|
-
throw new
|
|
358
|
+
throw new Te(this.parent.getType(), t, this.getRelated().getSchemaName(), r[t].join(" or "));
|
|
359
359
|
}
|
|
360
360
|
set(e) {
|
|
361
|
-
if (e !== null && !
|
|
362
|
-
throw new
|
|
363
|
-
!this.items ||
|
|
361
|
+
if (e !== null && !g.isModel(e) && !(e instanceof b && e.every(g.isModel)))
|
|
362
|
+
throw new w("Relation.set()", "Model, Collection<Model> or null");
|
|
363
|
+
!this.items || g.isModel(this.items) ? this.items = e : e instanceof b && this.items.splice(0, this.items.count(), ...e);
|
|
364
364
|
}
|
|
365
365
|
getForeignKey() {
|
|
366
366
|
return this.meta.foreignKey;
|
|
@@ -390,7 +390,7 @@ class R {
|
|
|
390
390
|
return this.items;
|
|
391
391
|
}
|
|
392
392
|
isSingle() {
|
|
393
|
-
return
|
|
393
|
+
return g.isModel(this.items);
|
|
394
394
|
}
|
|
395
395
|
isMultiple() {
|
|
396
396
|
return this.items instanceof b;
|
|
@@ -442,39 +442,46 @@ var D, H;
|
|
|
442
442
|
class E extends (H = Error, D = Symbol.toStringTag, H) {
|
|
443
443
|
constructor(t) {
|
|
444
444
|
super(`[Luminix] Expected ${t} to be reducible.`);
|
|
445
|
-
|
|
445
|
+
p(this, D, "NotReducibleException");
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
|
-
var J,
|
|
449
|
-
class
|
|
448
|
+
var J, F;
|
|
449
|
+
class Re extends (F = Error, J = Symbol.toStringTag, F) {
|
|
450
450
|
constructor() {
|
|
451
451
|
super("[Luminix] Method not implemented.");
|
|
452
|
-
|
|
452
|
+
p(this, J, "MethodNotImplementedException");
|
|
453
453
|
}
|
|
454
454
|
}
|
|
455
|
-
var
|
|
456
|
-
class
|
|
455
|
+
var U, W;
|
|
456
|
+
class ue extends (W = Error, U = Symbol.toStringTag, W) {
|
|
457
457
|
constructor(t, r) {
|
|
458
458
|
super(`[Luminix] Model "${t}" must be persisted before calling "${r}"`);
|
|
459
|
-
|
|
459
|
+
p(this, U, "ModelNotPersistedException");
|
|
460
460
|
}
|
|
461
461
|
}
|
|
462
|
-
|
|
462
|
+
var G, V;
|
|
463
|
+
class Ae extends (V = Error, G = Symbol.toStringTag, V) {
|
|
464
|
+
constructor(t, r) {
|
|
465
|
+
super(`[Luminix] Attribute "${r}" not found in model "${t}". Check if your database is up to date.`);
|
|
466
|
+
p(this, G, "AttributeNotFoundException");
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
function Ne(o, e, t, r, i) {
|
|
463
470
|
var l, m, c;
|
|
464
|
-
return c = class extends (m =
|
|
471
|
+
return c = class extends (m = N, l = Symbol.toStringTag, m) {
|
|
465
472
|
constructor(s = {}) {
|
|
466
473
|
super();
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
+
p(this, "_attributes", new _({}));
|
|
475
|
+
p(this, "_original", {});
|
|
476
|
+
p(this, "_relations", {});
|
|
477
|
+
p(this, "_changedKeys", []);
|
|
478
|
+
p(this, "exists", !1);
|
|
479
|
+
p(this, "wasRecentlyCreated", !1);
|
|
480
|
+
p(this, l, y.studly(i));
|
|
474
481
|
this.makeRelations(), this.makeAttributes(s);
|
|
475
482
|
}
|
|
476
483
|
cast(s, n) {
|
|
477
|
-
return s == null || !n ? s : ["boolean", "bool"].includes(n) ? !!s : ["date", "datetime", "immutable_date", "immutable_datetime"].includes(n) && typeof s == "string" ? new Date(s) : ["float", "double", "integer", "int"].includes(n) || n.startsWith("decimal:") ? Number(s) : s;
|
|
484
|
+
return s == null || !n ? s : ["boolean", "bool"].includes(n) ? !!s && s !== "0" : ["date", "datetime", "immutable_date", "immutable_datetime"].includes(n) && typeof s == "string" ? new Date(s) : ["float", "double", "integer", "int"].includes(n) || n.startsWith("decimal:") ? Number(s) : s;
|
|
478
485
|
}
|
|
479
486
|
mutate(s, n) {
|
|
480
487
|
return s == null || !n ? s : ["boolean", "bool"].includes(n) ? !!s : ["date", "datetime", "immutable_date", "immutable_datetime"].includes(n) && s instanceof Date ? s.toISOString() : ["float", "double", "integer", "int"].includes(n) || n.startsWith("decimal:") ? Number(s) : s;
|
|
@@ -485,8 +492,8 @@ function Te(o, e, t, r, i) {
|
|
|
485
492
|
return;
|
|
486
493
|
const n = t.getRelationConstructors(i);
|
|
487
494
|
Object.entries(s).forEach(([a, h]) => {
|
|
488
|
-
const { type: d } = h,
|
|
489
|
-
this._relations[a] = new
|
|
495
|
+
const { type: d } = h, v = d in n ? n[d] : A;
|
|
496
|
+
this._relations[a] = new v(
|
|
490
497
|
{ model: t, route: r },
|
|
491
498
|
{ name: a, ...h },
|
|
492
499
|
this,
|
|
@@ -495,12 +502,17 @@ function Te(o, e, t, r, i) {
|
|
|
495
502
|
});
|
|
496
503
|
}
|
|
497
504
|
makeAttributes(s) {
|
|
498
|
-
const { relations: n } = t.schema(i),
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
}
|
|
505
|
+
const { relations: n, attributes: a } = t.schema(i), h = Object.keys(n || {}), d = g.omit(s, ...h), v = (f) => {
|
|
506
|
+
const S = a.find((de) => de.name == f);
|
|
507
|
+
if (!S)
|
|
508
|
+
throw new Ae(i, f);
|
|
509
|
+
return !(f in d) && S.nullable;
|
|
510
|
+
};
|
|
511
|
+
if (this.fillable.filter(v).forEach((f) => {
|
|
512
|
+
d[f] = null;
|
|
513
|
+
}), n && Object.keys(n).forEach((f) => {
|
|
514
|
+
this.relation(y.camel(f)).make(s[f]);
|
|
515
|
+
}), !this.validateJsonObject(d)) {
|
|
504
516
|
if (o.get("app.env", "production") === "production")
|
|
505
517
|
throw new TypeError(`[Luminix] Invalid attributes for model "${i}"`);
|
|
506
518
|
e.warning(`Invalid attributes for model "${i}".
|
|
@@ -509,7 +521,7 @@ function Te(o, e, t, r, i) {
|
|
|
509
521
|
abstract: i
|
|
510
522
|
});
|
|
511
523
|
}
|
|
512
|
-
this._attributes.set(".",
|
|
524
|
+
this._attributes.set(".", d), this._original = d, this._changedKeys.splice(0, this._changedKeys.length);
|
|
513
525
|
}
|
|
514
526
|
makePrimaryKeyReplacer() {
|
|
515
527
|
return {
|
|
@@ -588,8 +600,8 @@ function Te(o, e, t, r, i) {
|
|
|
588
600
|
});
|
|
589
601
|
}
|
|
590
602
|
updateChangedKeys(s) {
|
|
591
|
-
const n = (h, d) => typeof h == "object" && h !== null ?
|
|
592
|
-
!this._changedKeys.includes(a) && !n(
|
|
603
|
+
const n = (h, d) => typeof h == "object" && h !== null ? g.isEqual(h, d) : h == d, a = s.includes(".") || s.includes("[") ? s.split(/[.[]/)[0] : s;
|
|
604
|
+
!this._changedKeys.includes(a) && !n(g.get(this._original, a), this._attributes.get(a)) ? this._changedKeys.push(a) : this._changedKeys.includes(a) && n(g.get(this._original, a), this._attributes.get(a)) && this._changedKeys.splice(this._changedKeys.indexOf(a), 1);
|
|
593
605
|
}
|
|
594
606
|
validateJsonObject(s) {
|
|
595
607
|
return typeof s != "object" || s === null ? !1 : Object.entries(s).every(([, n]) => ["boolean", "number", "string"].includes(typeof n) || n === null || this.validateJsonObject(n) || Array.isArray(n) && n.every((a) => this.validateJsonObject(a)));
|
|
@@ -664,12 +676,12 @@ function Te(o, e, t, r, i) {
|
|
|
664
676
|
return this.primaryKey;
|
|
665
677
|
}
|
|
666
678
|
fill(s) {
|
|
667
|
-
const n =
|
|
668
|
-
const
|
|
669
|
-
if (typeof
|
|
679
|
+
const n = g.pick(s, ...this.fillable), a = Object.entries(n).reduce((h, [d, v]) => {
|
|
680
|
+
const f = t[`model${y.studly(i)}Set${y.studly(d)}Attribute`];
|
|
681
|
+
if (typeof f != "function")
|
|
670
682
|
throw new E("ModelFacade");
|
|
671
|
-
return h[d] =
|
|
672
|
-
this.mutate(
|
|
683
|
+
return h[d] = f.bind(t)(
|
|
684
|
+
this.mutate(v, this.casts[d]),
|
|
673
685
|
this
|
|
674
686
|
), h;
|
|
675
687
|
}, {});
|
|
@@ -694,7 +706,7 @@ function Te(o, e, t, r, i) {
|
|
|
694
706
|
});
|
|
695
707
|
}
|
|
696
708
|
toJson() {
|
|
697
|
-
const s = Object.entries(this.relations).reduce((a, [h, d]) => (d.isLoaded() && (d.isSingle() ? a[y.snake(h)] = d.getLoadedItems().toJson() : d.isMultiple() && (a[y.snake(h)] = d.getLoadedItems().map((
|
|
709
|
+
const s = Object.entries(this.relations).reduce((a, [h, d]) => (d.isLoaded() && (d.isSingle() ? a[y.snake(h)] = d.getLoadedItems().toJson() : d.isMultiple() && (a[y.snake(h)] = d.getLoadedItems().map((v) => v.toJson()).all())), a), {}), n = t[`model${y.studly(i)}Json`];
|
|
698
710
|
if (typeof n != "function")
|
|
699
711
|
throw new E("ModelFacade");
|
|
700
712
|
return n.bind(t)({
|
|
@@ -746,7 +758,7 @@ function Te(o, e, t, r, i) {
|
|
|
746
758
|
/* * * * */
|
|
747
759
|
async refresh(s) {
|
|
748
760
|
if (!this.exists)
|
|
749
|
-
throw new
|
|
761
|
+
throw new ue(i, "refresh");
|
|
750
762
|
const n = await r.call(
|
|
751
763
|
this.getRouteForRefresh(),
|
|
752
764
|
s,
|
|
@@ -759,29 +771,29 @@ function Te(o, e, t, r, i) {
|
|
|
759
771
|
const {
|
|
760
772
|
additionalPayload: a = {},
|
|
761
773
|
sendsOnlyModifiedFields: h = !0
|
|
762
|
-
} = s, d = this.exists,
|
|
763
|
-
...
|
|
774
|
+
} = s, d = this.exists, v = {
|
|
775
|
+
...g.pick(
|
|
764
776
|
h && d ? this.diff() : this.attributes,
|
|
765
777
|
...this.fillable
|
|
766
778
|
),
|
|
767
779
|
...a
|
|
768
780
|
};
|
|
769
|
-
if (
|
|
781
|
+
if (g.isEmpty(v))
|
|
770
782
|
return;
|
|
771
|
-
const
|
|
783
|
+
const f = await r.call(
|
|
772
784
|
this.getRouteForSave(),
|
|
773
|
-
(
|
|
785
|
+
(S) => n ? n(S.withData(v)) : S.withData(v),
|
|
774
786
|
this.getErrorBag(d ? "update" : "store")
|
|
775
787
|
);
|
|
776
|
-
if (
|
|
777
|
-
return this.makeAttributes(
|
|
778
|
-
throw
|
|
788
|
+
if (f.successful())
|
|
789
|
+
return this.makeAttributes(f.json()), this.exists = !0, this.dispatchSaveEvent(), d ? this.dispatchUpdateEvent(f.json()) : (this.wasRecentlyCreated = !0, this.dispatchCreateEvent(f.json())), f;
|
|
790
|
+
throw f;
|
|
779
791
|
} catch (a) {
|
|
780
792
|
throw this.dispatchErrorEvent(a, "save"), a;
|
|
781
793
|
}
|
|
782
794
|
}
|
|
783
795
|
async push() {
|
|
784
|
-
throw new
|
|
796
|
+
throw new Re();
|
|
785
797
|
}
|
|
786
798
|
async delete() {
|
|
787
799
|
try {
|
|
@@ -849,7 +861,7 @@ function Te(o, e, t, r, i) {
|
|
|
849
861
|
return t.schema(i);
|
|
850
862
|
}
|
|
851
863
|
static query() {
|
|
852
|
-
return new
|
|
864
|
+
return new Se(
|
|
853
865
|
{ config: o, route: r, model: t },
|
|
854
866
|
i
|
|
855
867
|
);
|
|
@@ -934,14 +946,14 @@ function Te(o, e, t, r, i) {
|
|
|
934
946
|
static plural() {
|
|
935
947
|
return t.schema(i).displayName.plural;
|
|
936
948
|
}
|
|
937
|
-
},
|
|
949
|
+
}, p(c, "name", y.studly(i)), c;
|
|
938
950
|
}
|
|
939
|
-
function
|
|
951
|
+
function ke(o, e, t) {
|
|
940
952
|
var r, i;
|
|
941
953
|
return class extends (i = t, r = Symbol.toStringTag, i) {
|
|
942
954
|
constructor(m = {}) {
|
|
943
955
|
super(m);
|
|
944
|
-
|
|
956
|
+
p(this, r, y.studly(e));
|
|
945
957
|
return new Proxy(this, {
|
|
946
958
|
get: (c, u) => {
|
|
947
959
|
if (u === "__isModel")
|
|
@@ -970,24 +982,24 @@ function _e(o, e, t) {
|
|
|
970
982
|
}
|
|
971
983
|
};
|
|
972
984
|
}
|
|
973
|
-
var
|
|
974
|
-
class q extends (
|
|
985
|
+
var z, X;
|
|
986
|
+
class q extends (X = Error, z = Symbol.toStringTag, X) {
|
|
975
987
|
constructor(t) {
|
|
976
988
|
super(`[Luminix] Model "${t}" not found`);
|
|
977
|
-
|
|
989
|
+
p(this, z, "ModelNotFoundException");
|
|
978
990
|
}
|
|
979
991
|
}
|
|
980
|
-
var
|
|
981
|
-
class
|
|
992
|
+
var Y, Z;
|
|
993
|
+
class R extends (Z = TypeError, Y = Symbol.toStringTag, Z) {
|
|
982
994
|
constructor(t, r, i) {
|
|
983
995
|
super(`[Luminix] "${t}" expects a related model of type "${r}". Received "${i}" instead.`);
|
|
984
|
-
|
|
996
|
+
p(this, Y, "ModelInvalidRelatedTypeException");
|
|
985
997
|
}
|
|
986
998
|
}
|
|
987
|
-
class
|
|
999
|
+
class he extends A {
|
|
988
1000
|
constructor(e, t, r, i = null) {
|
|
989
|
-
if (!
|
|
990
|
-
throw new
|
|
1001
|
+
if (!g.isModel(i) && i !== null)
|
|
1002
|
+
throw new w("BelongsTo.constructor()", "Model or null");
|
|
991
1003
|
super(e, t, r, i), this.services = e, this.meta = t, this.parent = r, this.items = i;
|
|
992
1004
|
}
|
|
993
1005
|
isSingle() {
|
|
@@ -1004,12 +1016,12 @@ class ae extends R {
|
|
|
1004
1016
|
return this.query().first();
|
|
1005
1017
|
}
|
|
1006
1018
|
async associate(e) {
|
|
1007
|
-
if (!
|
|
1008
|
-
throw new
|
|
1019
|
+
if (!g.isModel(e))
|
|
1020
|
+
throw new w("BelongsTo.associate()");
|
|
1009
1021
|
if (e.getType() !== this.getRelated().getSchemaName())
|
|
1010
|
-
throw new
|
|
1022
|
+
throw new R("BelongsTo.associate()", this.getRelated().getSchemaName(), e.getType());
|
|
1011
1023
|
if (!e.exists)
|
|
1012
|
-
throw new
|
|
1024
|
+
throw new ue(this.getRelated().getSchemaName(), "save");
|
|
1013
1025
|
return this.parent.update({
|
|
1014
1026
|
[this.getForeignKey()]: e.getKey()
|
|
1015
1027
|
});
|
|
@@ -1020,10 +1032,10 @@ class ae extends R {
|
|
|
1020
1032
|
});
|
|
1021
1033
|
}
|
|
1022
1034
|
}
|
|
1023
|
-
class
|
|
1035
|
+
class le extends A {
|
|
1024
1036
|
constructor(e, t, r, i = null) {
|
|
1025
|
-
if (i !== null && !(i instanceof b && i.every(
|
|
1026
|
-
throw new
|
|
1037
|
+
if (i !== null && !(i instanceof b && i.every(g.isModel)))
|
|
1038
|
+
throw new w("BelongsToMany.constructor()", "Collection<Model> or null");
|
|
1027
1039
|
super(e, t, r, i), this.services = e, this.meta = t, this.parent = r, this.items = i;
|
|
1028
1040
|
}
|
|
1029
1041
|
isSingle() {
|
|
@@ -1116,23 +1128,23 @@ class ue extends R {
|
|
|
1116
1128
|
this.items ? this.items.splice(0, this.items.count(), ...r) : this.items = r;
|
|
1117
1129
|
}
|
|
1118
1130
|
}
|
|
1119
|
-
class
|
|
1131
|
+
class k extends A {
|
|
1120
1132
|
query() {
|
|
1121
1133
|
const e = super.query(), t = this.guessInverseRelation();
|
|
1122
1134
|
return e.where(t, this.parent.getKey()), e.lock(`where.${t}`), e;
|
|
1123
1135
|
}
|
|
1124
1136
|
async saveQuietly(e) {
|
|
1125
|
-
if (!
|
|
1126
|
-
throw new
|
|
1137
|
+
if (!g.isModel(e))
|
|
1138
|
+
throw new w("HasOneOrMany.saveQuietly()");
|
|
1127
1139
|
if (e.getType() !== this.getRelated().getSchemaName())
|
|
1128
|
-
throw new
|
|
1140
|
+
throw new R("HasOneOrMany.saveQuietly()", this.getRelated().getSchemaName(), e.getType());
|
|
1129
1141
|
e.setAttribute(this.getForeignKey(), this.parent.getKey()), await e.save();
|
|
1130
1142
|
}
|
|
1131
1143
|
}
|
|
1132
|
-
class
|
|
1144
|
+
class qe extends k {
|
|
1133
1145
|
constructor(e, t, r, i = null) {
|
|
1134
|
-
if (!
|
|
1135
|
-
throw new
|
|
1146
|
+
if (!g.isModel(i) && i !== null)
|
|
1147
|
+
throw new w("HasOne.constructor()", "Model or null");
|
|
1136
1148
|
super(e, t, r, i), this.services = e, this.meta = t, this.parent = r, this.items = i;
|
|
1137
1149
|
}
|
|
1138
1150
|
isSingle() {
|
|
@@ -1151,10 +1163,10 @@ class Re extends A {
|
|
|
1151
1163
|
function K(o) {
|
|
1152
1164
|
return new b(o);
|
|
1153
1165
|
}
|
|
1154
|
-
class
|
|
1166
|
+
class Ke extends k {
|
|
1155
1167
|
constructor(e, t, r, i = null) {
|
|
1156
|
-
if (i !== null && !(i instanceof b && i.every(
|
|
1157
|
-
throw new
|
|
1168
|
+
if (i !== null && !(i instanceof b && i.every(g.isModel)))
|
|
1169
|
+
throw new w("HasMany.constructor()", "Collection<Model> or null");
|
|
1158
1170
|
super(e, t, r, i), this.services = e, this.meta = t, this.parent = r, this.items = i;
|
|
1159
1171
|
}
|
|
1160
1172
|
isSingle() {
|
|
@@ -1176,10 +1188,10 @@ class ke extends A {
|
|
|
1176
1188
|
return this.query().find(e);
|
|
1177
1189
|
}
|
|
1178
1190
|
async saveManyQuietly(e) {
|
|
1179
|
-
if (!Array.isArray(e) || !e.every(
|
|
1180
|
-
throw new
|
|
1191
|
+
if (!Array.isArray(e) || !e.every(g.isModel))
|
|
1192
|
+
throw new w("HasMany.saveManyQuietly()", "Model[]");
|
|
1181
1193
|
if (!e.every((t) => t.getType() === this.getRelated().getSchemaName()))
|
|
1182
|
-
throw new
|
|
1194
|
+
throw new R("HasMany.saveManyQuietly()", this.getRelated().getSchemaName(), e.map((t) => t.getType()).join(", "));
|
|
1183
1195
|
await Promise.all(e.map((t) => (t.setAttribute(this.getForeignKey(), this.parent.getKey()), t.save())));
|
|
1184
1196
|
}
|
|
1185
1197
|
async saveMany(e) {
|
|
@@ -1189,7 +1201,7 @@ class ke extends A {
|
|
|
1189
1201
|
await this.saveQuietly(e), this.items === null ? this.items = K([e]) : this.items.push(e);
|
|
1190
1202
|
}
|
|
1191
1203
|
}
|
|
1192
|
-
class
|
|
1204
|
+
class ce extends k {
|
|
1193
1205
|
query() {
|
|
1194
1206
|
const e = this.getRelated().query();
|
|
1195
1207
|
e.once("success", (r) => {
|
|
@@ -1199,18 +1211,18 @@ class he extends A {
|
|
|
1199
1211
|
return e.where(t + "_id", this.parent.getKey()), e.where(t + "_type", this.getRelated().getSchemaName()), e.lock(`where.${t}_id`), e.lock(`where.${t}_type`), e;
|
|
1200
1212
|
}
|
|
1201
1213
|
async saveQuietly(e) {
|
|
1202
|
-
if (!
|
|
1203
|
-
throw new
|
|
1214
|
+
if (!g.isModel(e))
|
|
1215
|
+
throw new w("MorphOneOrMany.saveQuietly()");
|
|
1204
1216
|
if (e.getType() !== this.getRelated().getSchemaName())
|
|
1205
|
-
throw new
|
|
1217
|
+
throw new R("MorphOneOrMany.saveQuietly()", this.getRelated().getSchemaName(), e.getType());
|
|
1206
1218
|
const t = this.guessInverseRelation();
|
|
1207
1219
|
e.setAttribute(t + "_id", this.parent.getKey()), e.setAttribute(t + "_type", this.parent.getType()), await e.save();
|
|
1208
1220
|
}
|
|
1209
1221
|
}
|
|
1210
|
-
class
|
|
1222
|
+
class je extends ce {
|
|
1211
1223
|
constructor(e, t, r, i = null) {
|
|
1212
|
-
if (i !== null && !(i instanceof b && i.every(
|
|
1213
|
-
throw new
|
|
1224
|
+
if (i !== null && !(i instanceof b && i.every(g.isModel)))
|
|
1225
|
+
throw new w("MorphMany.constructor()", "Collection<Model> or null");
|
|
1214
1226
|
super(e, t, r, i), this.services = e, this.meta = t, this.parent = r, this.items = i;
|
|
1215
1227
|
}
|
|
1216
1228
|
isSingle() {
|
|
@@ -1232,10 +1244,10 @@ class Ae extends he {
|
|
|
1232
1244
|
return this.query().find(e);
|
|
1233
1245
|
}
|
|
1234
1246
|
async saveManyQuietly(e) {
|
|
1235
|
-
if (!Array.isArray(e) || !e.every(
|
|
1236
|
-
throw new
|
|
1247
|
+
if (!Array.isArray(e) || !e.every(g.isModel))
|
|
1248
|
+
throw new w("MorphMany.saveManyQuietly()");
|
|
1237
1249
|
if (!e.every((t) => t.getType() === this.getRelated().getSchemaName()))
|
|
1238
|
-
throw new
|
|
1250
|
+
throw new R("MorphMany.saveManyQuietly()", this.getRelated().getSchemaName(), e.map((t) => t.getType()).join(", "));
|
|
1239
1251
|
await Promise.all(e.map((t) => (t.setAttribute(this.getName() + "_id", this.parent.getKey()), t.setAttribute(this.getName() + "_type", this.parent.getType()), t.save())));
|
|
1240
1252
|
}
|
|
1241
1253
|
async saveMany(e) {
|
|
@@ -1247,10 +1259,10 @@ class Ae extends he {
|
|
|
1247
1259
|
await this.saveQuietly(e), this.items ? this.items.push(e) : this.items = await this.all();
|
|
1248
1260
|
}
|
|
1249
1261
|
}
|
|
1250
|
-
class
|
|
1262
|
+
class Oe extends ce {
|
|
1251
1263
|
constructor(e, t, r, i = null) {
|
|
1252
|
-
if (super(e, t, r, i), this.services = e, this.meta = t, this.parent = r, this.items = i, i !== null && !
|
|
1253
|
-
throw new
|
|
1264
|
+
if (super(e, t, r, i), this.services = e, this.meta = t, this.parent = r, this.items = i, i !== null && !g.isModel(i))
|
|
1265
|
+
throw new w("MorphOne.constructor()", "Model or null");
|
|
1254
1266
|
}
|
|
1255
1267
|
isSingle() {
|
|
1256
1268
|
return !0;
|
|
@@ -1265,7 +1277,7 @@ class Ne extends he {
|
|
|
1265
1277
|
await this.saveQuietly(e), this.items = e;
|
|
1266
1278
|
}
|
|
1267
1279
|
}
|
|
1268
|
-
class
|
|
1280
|
+
class Be extends he {
|
|
1269
1281
|
getRelated() {
|
|
1270
1282
|
return this.services.model.make(
|
|
1271
1283
|
this.parent.getAttribute(this.getName() + "_type")
|
|
@@ -1280,8 +1292,8 @@ class qe extends ae {
|
|
|
1280
1292
|
// return super.query();
|
|
1281
1293
|
// }
|
|
1282
1294
|
async associate(e) {
|
|
1283
|
-
if (!
|
|
1284
|
-
throw new
|
|
1295
|
+
if (!g.isModel(e))
|
|
1296
|
+
throw new w("MorphTo.associate()");
|
|
1285
1297
|
return e.exists || await e.save(), this.parent.update({
|
|
1286
1298
|
[this.getName() + "_id"]: e.getKey(),
|
|
1287
1299
|
[this.getName() + "_type"]: e.getType()
|
|
@@ -1294,24 +1306,24 @@ class qe extends ae {
|
|
|
1294
1306
|
});
|
|
1295
1307
|
}
|
|
1296
1308
|
}
|
|
1297
|
-
class
|
|
1309
|
+
class Ce extends le {
|
|
1298
1310
|
query() {
|
|
1299
1311
|
const e = super.query(), t = this.guessInverseRelation();
|
|
1300
1312
|
return e.where(t + "_id", this.parent.getKey()), e.where(t + "_type", this.parent.getType()), e.lock(`where.${t}_id`), e.lock(`where.${t}_type`), e;
|
|
1301
1313
|
}
|
|
1302
1314
|
}
|
|
1303
|
-
var
|
|
1304
|
-
class
|
|
1315
|
+
var ee, te;
|
|
1316
|
+
class Ie extends (te = N, ee = Symbol.toStringTag, te) {
|
|
1305
1317
|
constructor(t) {
|
|
1306
1318
|
super();
|
|
1307
|
-
|
|
1308
|
-
|
|
1319
|
+
p(this, "_models", {});
|
|
1320
|
+
p(this, ee, "ModelService");
|
|
1309
1321
|
this._schema = t;
|
|
1310
1322
|
}
|
|
1311
1323
|
boot(t) {
|
|
1312
1324
|
this._schema && Object.keys(this._schema).forEach((r) => {
|
|
1313
1325
|
const i = this[`model${y.studly(r)}`], l = this.model(
|
|
1314
|
-
|
|
1326
|
+
Ne(
|
|
1315
1327
|
t.make("config"),
|
|
1316
1328
|
t.make("log"),
|
|
1317
1329
|
t.make("model"),
|
|
@@ -1320,7 +1332,7 @@ class je extends (Z = k, Y = Symbol.toStringTag, Z) {
|
|
|
1320
1332
|
),
|
|
1321
1333
|
r
|
|
1322
1334
|
), m = i(l);
|
|
1323
|
-
this._models[r] =
|
|
1335
|
+
this._models[r] = ke(t.make("model"), r, m);
|
|
1324
1336
|
});
|
|
1325
1337
|
}
|
|
1326
1338
|
schema(t) {
|
|
@@ -1335,29 +1347,29 @@ class je extends (Z = k, Y = Symbol.toStringTag, Z) {
|
|
|
1335
1347
|
}
|
|
1336
1348
|
getRelationConstructors(t) {
|
|
1337
1349
|
return this.relationMap({
|
|
1338
|
-
BelongsTo:
|
|
1339
|
-
BelongsToMany:
|
|
1340
|
-
HasOne:
|
|
1341
|
-
HasMany:
|
|
1342
|
-
MorphMany:
|
|
1343
|
-
MorphOne:
|
|
1344
|
-
MorphTo:
|
|
1345
|
-
MorphToMany:
|
|
1350
|
+
BelongsTo: he,
|
|
1351
|
+
BelongsToMany: le,
|
|
1352
|
+
HasOne: qe,
|
|
1353
|
+
HasMany: Ke,
|
|
1354
|
+
MorphMany: je,
|
|
1355
|
+
MorphOne: Oe,
|
|
1356
|
+
MorphTo: Be,
|
|
1357
|
+
MorphToMany: Ce
|
|
1346
1358
|
}, t);
|
|
1347
1359
|
}
|
|
1348
1360
|
toString() {
|
|
1349
1361
|
return "model";
|
|
1350
1362
|
}
|
|
1351
1363
|
}
|
|
1352
|
-
const
|
|
1353
|
-
var
|
|
1354
|
-
class
|
|
1364
|
+
const Pe = oe(Ie);
|
|
1365
|
+
var se, ie;
|
|
1366
|
+
class Qe extends (ie = Error, se = Symbol.toStringTag, ie) {
|
|
1355
1367
|
constructor(t) {
|
|
1356
1368
|
super(`[Luminix] Route "${t}" not found`);
|
|
1357
|
-
|
|
1369
|
+
p(this, se, "RouteNotFoundException");
|
|
1358
1370
|
}
|
|
1359
1371
|
}
|
|
1360
|
-
class
|
|
1372
|
+
class Le {
|
|
1361
1373
|
constructor(e, t, r, i = "") {
|
|
1362
1374
|
this.routes = e, this.error = t, this.http = r, this.appUrl = i;
|
|
1363
1375
|
}
|
|
@@ -1376,8 +1388,8 @@ class Ce {
|
|
|
1376
1388
|
}
|
|
1377
1389
|
get(e) {
|
|
1378
1390
|
if (!this.exists(e))
|
|
1379
|
-
throw new
|
|
1380
|
-
return
|
|
1391
|
+
throw new Qe(e);
|
|
1392
|
+
return g.get(this.routes, e);
|
|
1381
1393
|
}
|
|
1382
1394
|
url(e) {
|
|
1383
1395
|
return this.appUrl + this.path(e);
|
|
@@ -1401,20 +1413,20 @@ class Ce {
|
|
|
1401
1413
|
return this.get(t).slice(1);
|
|
1402
1414
|
}
|
|
1403
1415
|
exists(e) {
|
|
1404
|
-
return
|
|
1416
|
+
return g.has(this.routes, e) && this.isRouteTuple(g.get(this.routes, e));
|
|
1405
1417
|
}
|
|
1406
1418
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1407
1419
|
async call(e, t = (i) => i, r = "default") {
|
|
1408
1420
|
if (typeof this.clientOptions != "function" || typeof this.clientError != "function")
|
|
1409
1421
|
throw new E("RouteFacade");
|
|
1410
1422
|
const [i, l] = this.extractGenerator(e), [, ...m] = this.get(i), c = this.url(l ? [i, l] : i), u = t(this.http()), s = this.clientOptions({}, i);
|
|
1411
|
-
|
|
1423
|
+
g.isEmpty(s) || u.withOptions(s);
|
|
1412
1424
|
const n = m[0] ?? s.method;
|
|
1413
1425
|
this.error.clear(r);
|
|
1414
1426
|
const a = await u[n](c);
|
|
1415
|
-
if (
|
|
1427
|
+
if (me(a)) {
|
|
1416
1428
|
const h = a.json("errors");
|
|
1417
|
-
this.error.set(Object.entries(h).reduce((d, [
|
|
1429
|
+
this.error.set(Object.entries(h).reduce((d, [v, f]) => (d[v] = f.join(" "), d), {}), r);
|
|
1418
1430
|
} else a.failed() && this.error.set(
|
|
1419
1431
|
this.clientError({ axios: a.json("message") }, {
|
|
1420
1432
|
response: a,
|
|
@@ -1430,10 +1442,10 @@ class Ce {
|
|
|
1430
1442
|
return "route";
|
|
1431
1443
|
}
|
|
1432
1444
|
}
|
|
1433
|
-
const
|
|
1434
|
-
class
|
|
1445
|
+
const De = oe(Le);
|
|
1446
|
+
class He {
|
|
1435
1447
|
getClient() {
|
|
1436
|
-
return new
|
|
1448
|
+
return new fe();
|
|
1437
1449
|
}
|
|
1438
1450
|
baseUrl(e) {
|
|
1439
1451
|
return this.getClient().baseUrl(e);
|
|
@@ -1486,12 +1498,12 @@ class Pe {
|
|
|
1486
1498
|
return this.getClient().delete(e, t);
|
|
1487
1499
|
}
|
|
1488
1500
|
}
|
|
1489
|
-
const
|
|
1490
|
-
var
|
|
1491
|
-
class
|
|
1501
|
+
const Je = ae(He);
|
|
1502
|
+
var re, ne;
|
|
1503
|
+
class Fe extends (ne = we, re = Symbol.toStringTag, ne) {
|
|
1492
1504
|
constructor() {
|
|
1493
1505
|
super(...arguments);
|
|
1494
|
-
|
|
1506
|
+
p(this, re, "LuminixServiceProvider");
|
|
1495
1507
|
}
|
|
1496
1508
|
register() {
|
|
1497
1509
|
this.registerServices(), this.registerMacros(), this.app.on("ready", () => {
|
|
@@ -1502,24 +1514,24 @@ class Le extends (ie = ye, se = Symbol.toStringTag, ie) {
|
|
|
1502
1514
|
this.app.make("model").boot(this.app);
|
|
1503
1515
|
}
|
|
1504
1516
|
registerServices() {
|
|
1505
|
-
this.app.singleton("auth", () => new
|
|
1517
|
+
this.app.singleton("auth", () => new xe(
|
|
1506
1518
|
this.app.make("config"),
|
|
1507
1519
|
this.app.make("model"),
|
|
1508
1520
|
this.app.make("route")
|
|
1509
1521
|
)), this.app.singleton("config", () => {
|
|
1510
|
-
const t = new
|
|
1522
|
+
const t = new _(g.omit(this.app.configuration, "manifest"));
|
|
1511
1523
|
return t.has("auth.user") || t.set("auth.user", null), t.lock("auth.user"), t;
|
|
1512
|
-
}), this.app.singleton("error", () => new
|
|
1524
|
+
}), this.app.singleton("error", () => new Me()), this.app.singleton("http", () => new Je()), this.app.singleton("log", () => {
|
|
1513
1525
|
var t;
|
|
1514
|
-
return new
|
|
1526
|
+
return new Ee(((t = this.app.configuration.app) == null ? void 0 : t.debug) ?? !1);
|
|
1515
1527
|
}), this.app.singleton("model", () => {
|
|
1516
1528
|
var t;
|
|
1517
|
-
return new
|
|
1529
|
+
return new Pe(
|
|
1518
1530
|
((t = this.app.configuration.manifest) == null ? void 0 : t.models) ?? {}
|
|
1519
1531
|
);
|
|
1520
1532
|
}), this.app.singleton("route", () => {
|
|
1521
1533
|
var t, r;
|
|
1522
|
-
return new
|
|
1534
|
+
return new De(
|
|
1523
1535
|
((t = this.app.configuration.manifest) == null ? void 0 : t.routes) ?? {},
|
|
1524
1536
|
this.app.make("error"),
|
|
1525
1537
|
() => this.app.make("http"),
|
|
@@ -1528,18 +1540,18 @@ class Le extends (ie = ye, se = Symbol.toStringTag, ie) {
|
|
|
1528
1540
|
});
|
|
1529
1541
|
}
|
|
1530
1542
|
registerMacros() {
|
|
1531
|
-
this.app.macro("environment", (...t) => t.length > 0 ? t.includes(this.app.make("config").get("app.env", "production")) : this.app.make("config").get("app.env", "production")), this.app.macro("getLocale", () => this.app.make("config").get("app.locale", "en")), this.app.macro("hasDebugModeEnabled", () => this.app.make("config").get("app.debug", !1)), this.app.macro("isLocal", () => this.app.make("config").get("app.env", "production") === "local"), this.app.macro("isProduction", () => this.app.make("config").get("app.env", "production") === "production"),
|
|
1543
|
+
this.app.macro("environment", (...t) => t.length > 0 ? t.includes(this.app.make("config").get("app.env", "production")) : this.app.make("config").get("app.env", "production")), this.app.macro("getLocale", () => this.app.make("config").get("app.locale", "en")), this.app.macro("hasDebugModeEnabled", () => this.app.make("config").get("app.debug", !1)), this.app.macro("isLocal", () => this.app.make("config").get("app.env", "production") === "local"), this.app.macro("isProduction", () => this.app.make("config").get("app.env", "production") === "production"), g.macro("isModel", function(t) {
|
|
1532
1544
|
return typeof t == "object" && t !== null && t.__isModel === !0;
|
|
1533
1545
|
});
|
|
1534
1546
|
}
|
|
1535
1547
|
}
|
|
1536
|
-
class
|
|
1548
|
+
class Ue {
|
|
1537
1549
|
constructor() {
|
|
1538
|
-
|
|
1550
|
+
p(this, "app");
|
|
1539
1551
|
}
|
|
1540
1552
|
getFacadeAccessor() {
|
|
1541
|
-
return this.app || (this.app = new (
|
|
1542
|
-
|
|
1553
|
+
return this.app || (this.app = new (ae(ve))([
|
|
1554
|
+
Fe
|
|
1543
1555
|
])), this.app;
|
|
1544
1556
|
}
|
|
1545
1557
|
down() {
|
|
@@ -1549,78 +1561,78 @@ class De {
|
|
|
1549
1561
|
this.down(), this.app = e;
|
|
1550
1562
|
}
|
|
1551
1563
|
}
|
|
1552
|
-
const x = M(
|
|
1564
|
+
const x = M(Ue);
|
|
1553
1565
|
function $(o = void 0) {
|
|
1554
1566
|
return typeof o != "string" ? x : x.make(o);
|
|
1555
1567
|
}
|
|
1556
|
-
function
|
|
1568
|
+
function st() {
|
|
1557
1569
|
return $("auth");
|
|
1558
1570
|
}
|
|
1559
|
-
function
|
|
1571
|
+
function it(o, e) {
|
|
1560
1572
|
const t = $("config");
|
|
1561
1573
|
return typeof o > "u" ? t : t.get(o, e);
|
|
1562
1574
|
}
|
|
1563
|
-
function
|
|
1575
|
+
function rt(o, e = "default") {
|
|
1564
1576
|
return o ? $().make("error").get(o, e) : $().make("error");
|
|
1565
1577
|
}
|
|
1566
|
-
function
|
|
1578
|
+
function nt(...o) {
|
|
1567
1579
|
const e = $("log");
|
|
1568
1580
|
return o.length ? e.debug(...o) : e;
|
|
1569
1581
|
}
|
|
1570
|
-
function
|
|
1582
|
+
function ot(o) {
|
|
1571
1583
|
const e = $("model");
|
|
1572
1584
|
return o ? e.make(o) : e;
|
|
1573
1585
|
}
|
|
1574
|
-
function
|
|
1586
|
+
function at(o, e = !1) {
|
|
1575
1587
|
const t = $("route");
|
|
1576
1588
|
return o ? e ? t.url([o, e]) : t.url(o) : t;
|
|
1577
1589
|
}
|
|
1578
|
-
class
|
|
1590
|
+
class We {
|
|
1579
1591
|
getFacadeAccessor() {
|
|
1580
1592
|
return "auth";
|
|
1581
1593
|
}
|
|
1582
1594
|
}
|
|
1583
|
-
const
|
|
1584
|
-
class
|
|
1595
|
+
const ut = M(We, x);
|
|
1596
|
+
class Ge {
|
|
1585
1597
|
getFacadeAccessor() {
|
|
1586
1598
|
return "config";
|
|
1587
1599
|
}
|
|
1588
1600
|
}
|
|
1589
|
-
const
|
|
1590
|
-
class
|
|
1601
|
+
const ht = M(Ge, x), lt = (o) => o instanceof be && o.unprocessableEntity() && typeof o.json("message") == "string" && typeof o.json("errors") == "object" && o.json("errors") !== null && Object.values(o.json("errors")).every((e) => Array.isArray(e) && e.every((t) => typeof t == "string"));
|
|
1602
|
+
class Ve {
|
|
1591
1603
|
getFacadeAccessor() {
|
|
1592
1604
|
return "error";
|
|
1593
1605
|
}
|
|
1594
1606
|
}
|
|
1595
|
-
const
|
|
1596
|
-
class
|
|
1607
|
+
const ct = M(Ve, x);
|
|
1608
|
+
class ze {
|
|
1597
1609
|
getFacadeAccessor() {
|
|
1598
1610
|
return "http";
|
|
1599
1611
|
}
|
|
1600
1612
|
}
|
|
1601
|
-
const
|
|
1602
|
-
class
|
|
1613
|
+
const dt = M(ze, x);
|
|
1614
|
+
class Xe {
|
|
1603
1615
|
getFacadeAccessor() {
|
|
1604
1616
|
return "log";
|
|
1605
1617
|
}
|
|
1606
1618
|
}
|
|
1607
|
-
const
|
|
1608
|
-
class
|
|
1619
|
+
const pt = M(Xe, x);
|
|
1620
|
+
class Ye {
|
|
1609
1621
|
getFacadeAccessor() {
|
|
1610
1622
|
return "model";
|
|
1611
1623
|
}
|
|
1612
1624
|
}
|
|
1613
|
-
const
|
|
1614
|
-
class
|
|
1625
|
+
const gt = M(Ye, x);
|
|
1626
|
+
class Ze {
|
|
1615
1627
|
getFacadeAccessor() {
|
|
1616
1628
|
return "route";
|
|
1617
1629
|
}
|
|
1618
1630
|
}
|
|
1619
|
-
const
|
|
1620
|
-
class
|
|
1631
|
+
const yt = M(Ze, x);
|
|
1632
|
+
class mt {
|
|
1621
1633
|
constructor() {
|
|
1622
|
-
|
|
1623
|
-
|
|
1634
|
+
p(this, "name");
|
|
1635
|
+
p(this, "version");
|
|
1624
1636
|
}
|
|
1625
1637
|
register(e) {
|
|
1626
1638
|
}
|
|
@@ -1629,21 +1641,21 @@ class dt {
|
|
|
1629
1641
|
}
|
|
1630
1642
|
export {
|
|
1631
1643
|
x as App,
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1644
|
+
ut as Auth,
|
|
1645
|
+
ht as Config,
|
|
1646
|
+
ct as Error,
|
|
1647
|
+
dt as Http,
|
|
1648
|
+
pt as Log,
|
|
1649
|
+
gt as Model,
|
|
1650
|
+
mt as Plugin,
|
|
1651
|
+
yt as Route,
|
|
1640
1652
|
$ as app,
|
|
1641
|
-
|
|
1653
|
+
st as auth,
|
|
1642
1654
|
K as collect,
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1655
|
+
it as config,
|
|
1656
|
+
rt as error,
|
|
1657
|
+
lt as isValidationError,
|
|
1658
|
+
nt as log,
|
|
1659
|
+
ot as model,
|
|
1660
|
+
at as route
|
|
1649
1661
|
};
|
package/package.json
CHANGED