@luminix/core 0.0.1-beta.4 → 0.0.1-beta.5
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/contracts/Builder.d.ts +4 -0
- package/dist/core.js +176 -152
- package/dist/types/Builder.d.ts +4 -0
- package/package.json +1 -1
- package/graph.png +0 -0
|
@@ -26,10 +26,14 @@ declare class Builder implements BuilderInterface {
|
|
|
26
26
|
where(scope: (builder: BuilderInterface) => BuilderInterface | void): this;
|
|
27
27
|
where(key: string, value: JsonValue): this;
|
|
28
28
|
where(key: string, operator: ExtendedOperator, value: JsonValue): this;
|
|
29
|
+
with(relation: string | string[]): this;
|
|
30
|
+
withOnly(relation: string | string[]): this;
|
|
31
|
+
without(relation: string | string[]): this;
|
|
29
32
|
orderBy(column: string, direction?: 'asc' | 'desc'): this;
|
|
30
33
|
searchBy(term: string): this;
|
|
31
34
|
minified(): this;
|
|
32
35
|
unset(key: string): this;
|
|
36
|
+
include(searchParams: URLSearchParams): this;
|
|
33
37
|
private exec;
|
|
34
38
|
get(page?: number, replaceLinksWith?: string): Promise<ModelPaginatedResponse>;
|
|
35
39
|
first(): Promise<Model | null>;
|
package/dist/core.js
CHANGED
|
@@ -3,21 +3,21 @@ var U = (n) => {
|
|
|
3
3
|
throw TypeError(n);
|
|
4
4
|
};
|
|
5
5
|
var Ce = (n, e, t) => e in n ? Qe(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
6
|
-
var
|
|
6
|
+
var m = (n, e, t) => Ce(n, typeof e != "symbol" ? e + "" : e, t), F = (n, e, t) => e.has(n) || U("Cannot " + t);
|
|
7
7
|
var o = (n, e, t) => (F(n, e, "read from private field"), t ? t.call(n) : e.get(n)), q = (n, e, t) => e.has(n) ? U("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), P = (n, e, t, r) => (F(n, e, "write to private field"), r ? r.call(n, t) : e.set(n, t), t), D = (n, e, t) => (F(n, e, "access private method"), t);
|
|
8
8
|
import f from "lodash";
|
|
9
|
-
import { produce as
|
|
9
|
+
import { produce as R, isDraftable as Le } from "immer";
|
|
10
10
|
import K, { isAxiosError as Je } from "axios";
|
|
11
11
|
var X, Y;
|
|
12
12
|
class Ue extends (Y = Error, X = Symbol.toStringTag, Y) {
|
|
13
13
|
constructor(t) {
|
|
14
14
|
super(`[Luminix] Facade "${t}" not found`);
|
|
15
|
-
|
|
15
|
+
m(this, X, "FacadeNotFoundException");
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
class De {
|
|
19
19
|
constructor(e) {
|
|
20
|
-
|
|
20
|
+
m(this, "_user");
|
|
21
21
|
this.app = e;
|
|
22
22
|
}
|
|
23
23
|
attempt(e, t = !1, r) {
|
|
@@ -93,9 +93,9 @@ class He {
|
|
|
93
93
|
this._debug && console.debug(...e);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
|
-
class
|
|
96
|
+
class S {
|
|
97
97
|
constructor(e) {
|
|
98
|
-
|
|
98
|
+
m(this, "locked", []);
|
|
99
99
|
this.bag = e, Object.freeze(this.bag);
|
|
100
100
|
}
|
|
101
101
|
get(e, t) {
|
|
@@ -111,14 +111,14 @@ class A {
|
|
|
111
111
|
throw new Error("Cannot set the root path when there are locked paths");
|
|
112
112
|
if (typeof t != "object" || t === null)
|
|
113
113
|
throw new TypeError("Value must be an object");
|
|
114
|
-
this.bag =
|
|
114
|
+
this.bag = R(this.bag, () => t), this.emit("change", {
|
|
115
115
|
path: e,
|
|
116
116
|
value: t,
|
|
117
117
|
type: "set"
|
|
118
118
|
});
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
|
-
this.bag =
|
|
121
|
+
this.bag = R(this.bag, (r) => {
|
|
122
122
|
f.set(r, e, t);
|
|
123
123
|
}), this.emit("change", {
|
|
124
124
|
path: e,
|
|
@@ -132,7 +132,7 @@ class A {
|
|
|
132
132
|
if (e === ".") {
|
|
133
133
|
if (this.locked.some((i) => f.has(t, i)))
|
|
134
134
|
throw new Error(`Cannot merge a path "${e}" that would override a locked path`);
|
|
135
|
-
this.bag =
|
|
135
|
+
this.bag = R(this.bag, (i) => ({
|
|
136
136
|
...i,
|
|
137
137
|
...t
|
|
138
138
|
})), this.emit("change", {
|
|
@@ -158,7 +158,7 @@ class A {
|
|
|
158
158
|
delete(e) {
|
|
159
159
|
if (this.locked.some((t) => e.startsWith(t)))
|
|
160
160
|
throw new Error(`Cannot delete a locked path "${e}"`);
|
|
161
|
-
this.bag =
|
|
161
|
+
this.bag = R(this.bag, (t) => {
|
|
162
162
|
f.unset(t, e);
|
|
163
163
|
}), this.emit("change", {
|
|
164
164
|
path: e,
|
|
@@ -172,7 +172,7 @@ class A {
|
|
|
172
172
|
this.locked.push(e);
|
|
173
173
|
}
|
|
174
174
|
clone() {
|
|
175
|
-
return new
|
|
175
|
+
return new S(this.bag);
|
|
176
176
|
}
|
|
177
177
|
all() {
|
|
178
178
|
return this.bag;
|
|
@@ -191,15 +191,15 @@ class A {
|
|
|
191
191
|
emit(e, t) {
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
|
-
function
|
|
195
|
-
var e, t, r, i,
|
|
194
|
+
function A(n) {
|
|
195
|
+
var e, t, r, i, Se, u;
|
|
196
196
|
return u = class extends (t = n, e = Symbol.toStringTag, t) {
|
|
197
197
|
constructor(...d) {
|
|
198
198
|
super(...d);
|
|
199
199
|
q(this, i);
|
|
200
200
|
q(this, r);
|
|
201
|
-
|
|
202
|
-
P(this, r, D(this, i,
|
|
201
|
+
m(this, e, n.name);
|
|
202
|
+
P(this, r, D(this, i, Se).call(this));
|
|
203
203
|
}
|
|
204
204
|
on(d, p) {
|
|
205
205
|
if (typeof d != "string")
|
|
@@ -213,8 +213,8 @@ function S(n) {
|
|
|
213
213
|
throw new TypeError("event must be a string");
|
|
214
214
|
if (typeof p != "function")
|
|
215
215
|
throw new TypeError("callback must be a function");
|
|
216
|
-
const y = o(this, r).on(d, (
|
|
217
|
-
y(), p(
|
|
216
|
+
const y = o(this, r).on(d, (w) => {
|
|
217
|
+
y(), p(w);
|
|
218
218
|
});
|
|
219
219
|
}
|
|
220
220
|
emit(d, p = {}) {
|
|
@@ -227,18 +227,18 @@ function S(n) {
|
|
|
227
227
|
source: this
|
|
228
228
|
});
|
|
229
229
|
}
|
|
230
|
-
}, r = new WeakMap(), i = new WeakSet(),
|
|
230
|
+
}, r = new WeakMap(), i = new WeakSet(), Se = function() {
|
|
231
231
|
return {
|
|
232
232
|
emit(d, p) {
|
|
233
|
-
for (let y = 0,
|
|
234
|
-
|
|
233
|
+
for (let y = 0, w = this.events[d] || [], g = w.length; y < g; y++)
|
|
234
|
+
w[y](p);
|
|
235
235
|
},
|
|
236
236
|
events: {},
|
|
237
237
|
on(d, p) {
|
|
238
238
|
var y;
|
|
239
239
|
return ((y = this.events)[d] || (y[d] = [])).push(p), () => {
|
|
240
|
-
var
|
|
241
|
-
this.events[d] = (
|
|
240
|
+
var w;
|
|
241
|
+
this.events[d] = (w = this.events[d]) == null ? void 0 : w.filter((g) => p !== g);
|
|
242
242
|
};
|
|
243
243
|
}
|
|
244
244
|
};
|
|
@@ -251,16 +251,16 @@ function $(n) {
|
|
|
251
251
|
return !(typeof n != "object" || n === null || !Reflect.has(n, "constructor") || Reflect.get(n.constructor, "name") !== "Collection");
|
|
252
252
|
}
|
|
253
253
|
var Z, z;
|
|
254
|
-
class
|
|
254
|
+
class b extends (z = Error, Z = Symbol.toStringTag, z) {
|
|
255
255
|
constructor() {
|
|
256
256
|
super("[Luminix] Method not implemented.");
|
|
257
|
-
|
|
257
|
+
m(this, Z, "MethodNotImplementedException");
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
260
|
function c(n = [], e = Q) {
|
|
261
261
|
if (!Array.isArray(n))
|
|
262
262
|
throw new TypeError("collect() expects an array");
|
|
263
|
-
return new (
|
|
263
|
+
return new (A(e))([...n]);
|
|
264
264
|
}
|
|
265
265
|
const T = (n) => {
|
|
266
266
|
n.emit("change", {
|
|
@@ -272,7 +272,7 @@ class Q {
|
|
|
272
272
|
constructor(e = []) {
|
|
273
273
|
// [Symbol.toStringTag] = 'Collection';
|
|
274
274
|
q(this, h);
|
|
275
|
-
|
|
275
|
+
m(this, O, "Collection");
|
|
276
276
|
P(this, h, e);
|
|
277
277
|
}
|
|
278
278
|
get items() {
|
|
@@ -902,30 +902,30 @@ class Q {
|
|
|
902
902
|
// HasEvents methods
|
|
903
903
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
904
904
|
on(e, t) {
|
|
905
|
-
throw new
|
|
905
|
+
throw new b();
|
|
906
906
|
}
|
|
907
907
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
908
908
|
once(e, t) {
|
|
909
|
-
throw new
|
|
909
|
+
throw new b();
|
|
910
910
|
}
|
|
911
911
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
912
912
|
emit(e, t) {
|
|
913
|
-
throw new
|
|
913
|
+
throw new b();
|
|
914
914
|
}
|
|
915
915
|
}
|
|
916
916
|
h = new WeakMap();
|
|
917
|
-
const C =
|
|
917
|
+
const C = A(Q);
|
|
918
918
|
var ee, te;
|
|
919
919
|
class W extends (te = Q, ee = Symbol.toStringTag, te) {
|
|
920
920
|
constructor() {
|
|
921
921
|
super(...arguments);
|
|
922
|
-
|
|
922
|
+
m(this, ee, "Collection");
|
|
923
923
|
}
|
|
924
924
|
intersect(t) {
|
|
925
925
|
return this.filter((r) => t.some((i) => i.getKey() === r.getKey()));
|
|
926
926
|
}
|
|
927
927
|
}
|
|
928
|
-
const
|
|
928
|
+
const v = (...n) => {
|
|
929
929
|
const e = new URLSearchParams();
|
|
930
930
|
return n.forEach((t) => {
|
|
931
931
|
const [, ...r] = t.split("?");
|
|
@@ -938,13 +938,13 @@ var re, se;
|
|
|
938
938
|
class We extends (se = Error, re = Symbol.toStringTag, se) {
|
|
939
939
|
constructor(t) {
|
|
940
940
|
super(`[Luminix] Model "${t}" does not have a primary key`);
|
|
941
|
-
|
|
941
|
+
m(this, re, "ModelWithoutPrimaryKeyException");
|
|
942
942
|
}
|
|
943
943
|
}
|
|
944
|
-
const Ge = S
|
|
944
|
+
const Ge = A(S);
|
|
945
945
|
class Ve {
|
|
946
946
|
constructor(e, t, r = {}) {
|
|
947
|
-
|
|
947
|
+
m(this, "bag");
|
|
948
948
|
this.facades = e, this.abstract = t, this.query = r, this.bag = new Ge(r), this.bag.on("change", () => {
|
|
949
949
|
this.emit("change", {
|
|
950
950
|
data: this.bag
|
|
@@ -953,15 +953,15 @@ class Ve {
|
|
|
953
953
|
}
|
|
954
954
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
955
955
|
on(e, t) {
|
|
956
|
-
throw new
|
|
956
|
+
throw new b();
|
|
957
957
|
}
|
|
958
958
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
959
959
|
once(e, t) {
|
|
960
|
-
throw new
|
|
960
|
+
throw new b();
|
|
961
961
|
}
|
|
962
962
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
963
963
|
emit(e, t) {
|
|
964
|
-
throw new
|
|
964
|
+
throw new b();
|
|
965
965
|
}
|
|
966
966
|
lock(e) {
|
|
967
967
|
this.bag.lock(e);
|
|
@@ -998,6 +998,21 @@ class Ve {
|
|
|
998
998
|
}[t] || f.upperFirst(f.camelCase(t));
|
|
999
999
|
return this.bag.set(`where.${f.camelCase(e)}${s}`, r), this;
|
|
1000
1000
|
}
|
|
1001
|
+
with(e) {
|
|
1002
|
+
const t = this.bag.get("with", []);
|
|
1003
|
+
return (Array.isArray(e) ? e : [e]).forEach((i) => {
|
|
1004
|
+
t.includes(i) || t.push(i);
|
|
1005
|
+
}), this.bag.set("with", t), this;
|
|
1006
|
+
}
|
|
1007
|
+
withOnly(e) {
|
|
1008
|
+
return this.bag.set("with", Array.isArray(e) ? e : [e]), this;
|
|
1009
|
+
}
|
|
1010
|
+
without(e) {
|
|
1011
|
+
const t = this.bag.get("with", []);
|
|
1012
|
+
return (Array.isArray(e) ? e : [e]).forEach((i) => {
|
|
1013
|
+
t.includes(i) && t.splice(t.indexOf(i), 1);
|
|
1014
|
+
}), this.bag.set("with", t), this;
|
|
1015
|
+
}
|
|
1001
1016
|
orderBy(e, t = "asc") {
|
|
1002
1017
|
return this.bag.set("order_by", `${e}:${t}`), this;
|
|
1003
1018
|
}
|
|
@@ -1010,6 +1025,11 @@ class Ve {
|
|
|
1010
1025
|
unset(e) {
|
|
1011
1026
|
return this.bag.delete(e), this;
|
|
1012
1027
|
}
|
|
1028
|
+
include(e) {
|
|
1029
|
+
for (const [t, r] of e.entries())
|
|
1030
|
+
this.bag.set(t, r);
|
|
1031
|
+
return this;
|
|
1032
|
+
}
|
|
1013
1033
|
async exec(e = 1, t) {
|
|
1014
1034
|
try {
|
|
1015
1035
|
this.bag.set("page", e), this.emit("submit", {
|
|
@@ -1031,16 +1051,16 @@ class Ve {
|
|
|
1031
1051
|
...r,
|
|
1032
1052
|
data: s,
|
|
1033
1053
|
links: {
|
|
1034
|
-
first: `${u}?${
|
|
1035
|
-
last: `${u}?${
|
|
1036
|
-
next: r.links.next && `${u}?${
|
|
1037
|
-
prev: r.links.prev && `${u}?${
|
|
1054
|
+
first: `${u}?${v(t, r.links.first).toString()}`,
|
|
1055
|
+
last: `${u}?${v(t, r.links.last).toString()}`,
|
|
1056
|
+
next: r.links.next && `${u}?${v(t, r.links.next).toString()}`,
|
|
1057
|
+
prev: r.links.prev && `${u}?${v(t, r.links.prev).toString()}`
|
|
1038
1058
|
},
|
|
1039
1059
|
meta: {
|
|
1040
1060
|
...r.meta,
|
|
1041
1061
|
links: r.meta.links.map((a) => ({
|
|
1042
1062
|
...a,
|
|
1043
|
-
url: a.url && `${u}?${
|
|
1063
|
+
url: a.url && `${u}?${v(t, a.url).toString()}`
|
|
1044
1064
|
}))
|
|
1045
1065
|
}
|
|
1046
1066
|
};
|
|
@@ -1098,42 +1118,42 @@ class Ve {
|
|
|
1098
1118
|
}), u;
|
|
1099
1119
|
}
|
|
1100
1120
|
}
|
|
1101
|
-
const Xe =
|
|
1121
|
+
const Xe = A(Ve);
|
|
1102
1122
|
var ie, ne;
|
|
1103
1123
|
class _ extends (ne = Error, ie = Symbol.toStringTag, ne) {
|
|
1104
1124
|
constructor(t) {
|
|
1105
1125
|
super(`[Luminix] Expected ${t} to be reducible.`);
|
|
1106
|
-
|
|
1126
|
+
m(this, ie, "NotReducibleException");
|
|
1107
1127
|
}
|
|
1108
1128
|
}
|
|
1109
1129
|
var oe, he;
|
|
1110
1130
|
class x extends (he = TypeError, oe = Symbol.toStringTag, he) {
|
|
1111
1131
|
constructor(t, r = "Model") {
|
|
1112
1132
|
super(`[Luminix] "${t}" expects ${r}`);
|
|
1113
|
-
|
|
1133
|
+
m(this, oe, "NotModelException");
|
|
1114
1134
|
}
|
|
1115
1135
|
}
|
|
1116
1136
|
var ue, ae;
|
|
1117
1137
|
class Ye extends (ae = Error, ue = Symbol.toStringTag, ae) {
|
|
1118
1138
|
constructor(t, r, i, s) {
|
|
1119
1139
|
super(`[Luminix] Could not determine inverse relation for "${r}" in model "${t}". Please specify a relation in model "${i}" of type ${s} that points back to "${t}".`);
|
|
1120
|
-
|
|
1140
|
+
m(this, ue, "NoInverseRelationException");
|
|
1121
1141
|
}
|
|
1122
1142
|
}
|
|
1123
1143
|
var le, ce;
|
|
1124
1144
|
class Ze extends (ce = Error, le = Symbol.toStringTag, ce) {
|
|
1125
1145
|
constructor(t) {
|
|
1126
1146
|
super(`[Luminix] Relation "${t}" is not supported`);
|
|
1127
|
-
|
|
1147
|
+
m(this, le, "UnsupportedRelationException");
|
|
1128
1148
|
}
|
|
1129
1149
|
}
|
|
1130
|
-
function
|
|
1150
|
+
function E(n) {
|
|
1131
1151
|
return typeof n == "object" && n !== null && n.__isModel === !0;
|
|
1132
1152
|
}
|
|
1133
1153
|
class j {
|
|
1134
1154
|
constructor(e, t, r, i = null) {
|
|
1135
|
-
|
|
1136
|
-
if (this.meta = e, this.facades = t, this.parent = r, this.items = i, i !== null && !
|
|
1155
|
+
m(this, "unsubscribeQuery", null);
|
|
1156
|
+
if (this.meta = e, this.facades = t, this.parent = r, this.items = i, i !== null && !E(i) && !($(i) && i.every(E)))
|
|
1137
1157
|
throw new x("Relation.constructor()", "Model, Collection<Model> or null");
|
|
1138
1158
|
}
|
|
1139
1159
|
make(e) {
|
|
@@ -1177,9 +1197,9 @@ class j {
|
|
|
1177
1197
|
throw new Ye(this.parent.getType(), t, this.getRelated().getSchemaName(), r[t].join(" or "));
|
|
1178
1198
|
}
|
|
1179
1199
|
set(e) {
|
|
1180
|
-
if (e !== null && !
|
|
1200
|
+
if (e !== null && !E(e) && !($(e) && e.every(E)))
|
|
1181
1201
|
throw new x("Relation.set()", "Model, Collection<Model> or null");
|
|
1182
|
-
!this.items ||
|
|
1202
|
+
!this.items || E(this.items) ? this.items = e : $(e) && this.items.splice(0, this.items.count(), ...e);
|
|
1183
1203
|
}
|
|
1184
1204
|
getForeignKey() {
|
|
1185
1205
|
return this.meta.foreignKey;
|
|
@@ -1209,7 +1229,7 @@ class j {
|
|
|
1209
1229
|
return this.items;
|
|
1210
1230
|
}
|
|
1211
1231
|
isSingle() {
|
|
1212
|
-
return
|
|
1232
|
+
return E(this.items);
|
|
1213
1233
|
}
|
|
1214
1234
|
isMultiple() {
|
|
1215
1235
|
return $(this.items);
|
|
@@ -1261,14 +1281,14 @@ var de, fe;
|
|
|
1261
1281
|
class Ne extends (fe = Error, de = Symbol.toStringTag, fe) {
|
|
1262
1282
|
constructor(t, r) {
|
|
1263
1283
|
super(`[Luminix] Attribute "${r}" in model "${t}" is not fillable`);
|
|
1264
|
-
|
|
1284
|
+
m(this, de, "AttributeNotFillableException");
|
|
1265
1285
|
}
|
|
1266
1286
|
}
|
|
1267
1287
|
var pe, me;
|
|
1268
|
-
class
|
|
1288
|
+
class ve extends (me = Error, pe = Symbol.toStringTag, me) {
|
|
1269
1289
|
constructor(t, r) {
|
|
1270
1290
|
super(`[Luminix] Model "${t}" must be persisted before calling "${r}"`);
|
|
1271
|
-
|
|
1291
|
+
m(this, pe, "ModelNotPersistedException");
|
|
1272
1292
|
}
|
|
1273
1293
|
}
|
|
1274
1294
|
function ze(n, e) {
|
|
@@ -1276,12 +1296,12 @@ function ze(n, e) {
|
|
|
1276
1296
|
r = Symbol.toStringTag;
|
|
1277
1297
|
class t {
|
|
1278
1298
|
constructor(s = {}) {
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1299
|
+
m(this, "_attributes", new S({}));
|
|
1300
|
+
m(this, "_original", {});
|
|
1301
|
+
m(this, "_relations", {});
|
|
1302
|
+
m(this, "_changedKeys", []);
|
|
1303
|
+
m(this, "exists", !1);
|
|
1304
|
+
m(this, r, f.upperFirst(f.camelCase(e)));
|
|
1285
1305
|
this.makeRelations(), this.makeAttributes(s);
|
|
1286
1306
|
}
|
|
1287
1307
|
cast(s, u) {
|
|
@@ -1322,7 +1342,7 @@ function ze(n, e) {
|
|
|
1322
1342
|
abstract: e
|
|
1323
1343
|
});
|
|
1324
1344
|
}
|
|
1325
|
-
this._attributes = new
|
|
1345
|
+
this._attributes = new S(l), this._original = l, this._changedKeys = [];
|
|
1326
1346
|
}
|
|
1327
1347
|
makePrimaryKeyReplacer() {
|
|
1328
1348
|
return {
|
|
@@ -1520,7 +1540,7 @@ function ze(n, e) {
|
|
|
1520
1540
|
}
|
|
1521
1541
|
async refresh() {
|
|
1522
1542
|
if (!this.exists)
|
|
1523
|
-
throw new
|
|
1543
|
+
throw new ve(e, "refresh");
|
|
1524
1544
|
const { data: s } = await n.route.call([
|
|
1525
1545
|
`luminix.${e}.show`,
|
|
1526
1546
|
this.makePrimaryKeyReplacer()
|
|
@@ -1558,7 +1578,7 @@ function ze(n, e) {
|
|
|
1558
1578
|
}
|
|
1559
1579
|
}
|
|
1560
1580
|
async push() {
|
|
1561
|
-
throw new
|
|
1581
|
+
throw new b();
|
|
1562
1582
|
}
|
|
1563
1583
|
async delete() {
|
|
1564
1584
|
try {
|
|
@@ -1719,25 +1739,25 @@ function ze(n, e) {
|
|
|
1719
1739
|
}
|
|
1720
1740
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1721
1741
|
on(s, u) {
|
|
1722
|
-
throw new
|
|
1742
|
+
throw new b();
|
|
1723
1743
|
}
|
|
1724
1744
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1725
1745
|
once(s, u) {
|
|
1726
|
-
throw new
|
|
1746
|
+
throw new b();
|
|
1727
1747
|
}
|
|
1728
1748
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1729
1749
|
emit(s, u) {
|
|
1730
|
-
throw new
|
|
1750
|
+
throw new b();
|
|
1731
1751
|
}
|
|
1732
1752
|
}
|
|
1733
|
-
return
|
|
1753
|
+
return A(t);
|
|
1734
1754
|
}
|
|
1735
1755
|
function Oe(n, e, t) {
|
|
1736
1756
|
var r, i;
|
|
1737
1757
|
return class extends (i = t, r = Symbol.toStringTag, i) {
|
|
1738
1758
|
constructor(u = {}) {
|
|
1739
1759
|
super(u);
|
|
1740
|
-
|
|
1760
|
+
m(this, r, f.upperFirst(f.camelCase(e)));
|
|
1741
1761
|
return new Proxy(this, {
|
|
1742
1762
|
get: (a, l) => {
|
|
1743
1763
|
if (l === "__isModel")
|
|
@@ -1781,19 +1801,19 @@ var ge, ye;
|
|
|
1781
1801
|
class ke extends (ye = Error, ge = Symbol.toStringTag, ye) {
|
|
1782
1802
|
constructor(t, r) {
|
|
1783
1803
|
super(`[Luminix] Cannot create reducer '${t}' on '${r}' as it is a reserved property`);
|
|
1784
|
-
|
|
1804
|
+
m(this, ge, "ReducerOverrideException");
|
|
1785
1805
|
}
|
|
1786
1806
|
}
|
|
1787
|
-
function
|
|
1807
|
+
function Re(n) {
|
|
1788
1808
|
return class extends n {
|
|
1789
1809
|
constructor(...t) {
|
|
1790
1810
|
super(...t);
|
|
1791
|
-
|
|
1811
|
+
m(this, "reducers", {});
|
|
1792
1812
|
return new Proxy(this, {
|
|
1793
1813
|
get(r, i, s) {
|
|
1794
1814
|
return typeof i == "symbol" || i in r ? Reflect.get(r, i, s) : (u, ...a) => {
|
|
1795
1815
|
const { [i]: l = c() } = r.reducers;
|
|
1796
|
-
return Le(u) ?
|
|
1816
|
+
return Le(u) ? R(u, (d) => l.sortBy("priority").reduce((p, y) => y.callback(p, ...a), d)) : l.sortBy("priority").reduce((d, p) => p.callback(d, ...a), u);
|
|
1797
1817
|
};
|
|
1798
1818
|
}
|
|
1799
1819
|
});
|
|
@@ -1825,19 +1845,19 @@ var we, be;
|
|
|
1825
1845
|
class G extends (be = Error, we = Symbol.toStringTag, be) {
|
|
1826
1846
|
constructor(t) {
|
|
1827
1847
|
super(`[Luminix] Model "${t}" not found`);
|
|
1828
|
-
|
|
1848
|
+
m(this, we, "ModelNotFoundException");
|
|
1829
1849
|
}
|
|
1830
1850
|
}
|
|
1831
1851
|
var Ee, xe;
|
|
1832
1852
|
class B extends (xe = TypeError, Ee = Symbol.toStringTag, xe) {
|
|
1833
1853
|
constructor(t, r, i) {
|
|
1834
1854
|
super(`[Luminix] "${t}" expects a related model of type "${r}". Received "${i}" instead.`);
|
|
1835
|
-
|
|
1855
|
+
m(this, Ee, "ModelInvalidRelatedTypeException");
|
|
1836
1856
|
}
|
|
1837
1857
|
}
|
|
1838
1858
|
class Be extends j {
|
|
1839
1859
|
constructor(e, t, r, i = null) {
|
|
1840
|
-
if (!
|
|
1860
|
+
if (!E(i) && i !== null)
|
|
1841
1861
|
throw new x("BelongsTo.constructor()", "Model or null");
|
|
1842
1862
|
super(e, t, r, i), this.meta = e, this.facades = t, this.parent = r, this.items = i;
|
|
1843
1863
|
}
|
|
@@ -1855,12 +1875,12 @@ class Be extends j {
|
|
|
1855
1875
|
return this.query().first();
|
|
1856
1876
|
}
|
|
1857
1877
|
async associate(e) {
|
|
1858
|
-
if (!
|
|
1878
|
+
if (!E(e))
|
|
1859
1879
|
throw new x("BelongsTo.associate()");
|
|
1860
1880
|
if (e.getType() !== this.getRelated().getSchemaName())
|
|
1861
1881
|
throw new B("BelongsTo.associate()", this.getRelated().getSchemaName(), e.getType());
|
|
1862
1882
|
if (!e.exists)
|
|
1863
|
-
throw new
|
|
1883
|
+
throw new ve(this.getRelated().getSchemaName(), "save");
|
|
1864
1884
|
return this.parent.update({
|
|
1865
1885
|
[this.getForeignKey()]: e.getKey()
|
|
1866
1886
|
});
|
|
@@ -1873,7 +1893,7 @@ class Be extends j {
|
|
|
1873
1893
|
}
|
|
1874
1894
|
class qe extends j {
|
|
1875
1895
|
constructor(e, t, r, i = null) {
|
|
1876
|
-
if (i !== null && !(i instanceof C && i.every(
|
|
1896
|
+
if (i !== null && !(i instanceof C && i.every(E)))
|
|
1877
1897
|
throw new x("BelongsToMany.constructor()", "Collection<Model> or null");
|
|
1878
1898
|
super(e, t, r, i), this.meta = e, this.facades = t, this.parent = r, this.items = i;
|
|
1879
1899
|
}
|
|
@@ -1982,7 +2002,7 @@ class L extends j {
|
|
|
1982
2002
|
return e.where(t, this.parent.getKey()), e.lock(`where.${t}`), e;
|
|
1983
2003
|
}
|
|
1984
2004
|
async saveQuietly(e) {
|
|
1985
|
-
if (!
|
|
2005
|
+
if (!E(e))
|
|
1986
2006
|
throw new x("HasOneOrMany.saveQuietly()");
|
|
1987
2007
|
if (e.getType() !== this.getRelated().getSchemaName())
|
|
1988
2008
|
throw new B("HasOneOrMany.saveQuietly()", this.getRelated().getSchemaName(), e.getType());
|
|
@@ -1991,7 +2011,7 @@ class L extends j {
|
|
|
1991
2011
|
}
|
|
1992
2012
|
class et extends L {
|
|
1993
2013
|
constructor(e, t, r, i = null) {
|
|
1994
|
-
if (!
|
|
2014
|
+
if (!E(i) && i !== null)
|
|
1995
2015
|
throw new x("HasOne.constructor()", "Model or null");
|
|
1996
2016
|
super(e, t, r, i), this.meta = e, this.facades = t, this.parent = r, this.items = i;
|
|
1997
2017
|
}
|
|
@@ -2010,7 +2030,7 @@ class et extends L {
|
|
|
2010
2030
|
}
|
|
2011
2031
|
class tt extends L {
|
|
2012
2032
|
constructor(e, t, r, i = null) {
|
|
2013
|
-
if (i !== null && !(i instanceof C && i.every(
|
|
2033
|
+
if (i !== null && !(i instanceof C && i.every(E)))
|
|
2014
2034
|
throw new x("HasMany.constructor()", "Collection<Model> or null");
|
|
2015
2035
|
super(e, t, r, i), this.meta = e, this.facades = t, this.parent = r, this.items = i;
|
|
2016
2036
|
}
|
|
@@ -2033,7 +2053,7 @@ class tt extends L {
|
|
|
2033
2053
|
return this.query().find(e);
|
|
2034
2054
|
}
|
|
2035
2055
|
async saveManyQuietly(e) {
|
|
2036
|
-
if (!Array.isArray(e) || !e.every(
|
|
2056
|
+
if (!Array.isArray(e) || !e.every(E))
|
|
2037
2057
|
throw new x("HasMany.saveManyQuietly()", "Model[]");
|
|
2038
2058
|
if (!e.every((t) => t.getType() === this.getRelated().getSchemaName()))
|
|
2039
2059
|
throw new B("HasMany.saveManyQuietly()", this.getRelated().getSchemaName(), e.map((t) => t.getType()).join(", "));
|
|
@@ -2058,7 +2078,7 @@ class Ie extends L {
|
|
|
2058
2078
|
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;
|
|
2059
2079
|
}
|
|
2060
2080
|
async saveQuietly(e) {
|
|
2061
|
-
if (!
|
|
2081
|
+
if (!E(e))
|
|
2062
2082
|
throw new x("MorphOneOrMany.saveQuietly()");
|
|
2063
2083
|
if (e.getType() !== this.getRelated().getSchemaName())
|
|
2064
2084
|
throw new B("MorphOneOrMany.saveQuietly()", this.getRelated().getSchemaName(), e.getType());
|
|
@@ -2068,7 +2088,7 @@ class Ie extends L {
|
|
|
2068
2088
|
}
|
|
2069
2089
|
class rt extends Ie {
|
|
2070
2090
|
constructor(e, t, r, i = null) {
|
|
2071
|
-
if (i !== null && !(i instanceof C && i.every(
|
|
2091
|
+
if (i !== null && !(i instanceof C && i.every(E)))
|
|
2072
2092
|
throw new x("MorphMany.constructor()", "Collection<Model> or null");
|
|
2073
2093
|
super(e, t, r, i), this.meta = e, this.facades = t, this.parent = r, this.items = i;
|
|
2074
2094
|
}
|
|
@@ -2091,7 +2111,7 @@ class rt extends Ie {
|
|
|
2091
2111
|
return this.query().find(e);
|
|
2092
2112
|
}
|
|
2093
2113
|
async saveManyQuietly(e) {
|
|
2094
|
-
if (!Array.isArray(e) || !e.every(
|
|
2114
|
+
if (!Array.isArray(e) || !e.every(E))
|
|
2095
2115
|
throw new x("MorphMany.saveManyQuietly()");
|
|
2096
2116
|
if (!e.every((t) => t.getType() === this.getRelated().getSchemaName()))
|
|
2097
2117
|
throw new B("MorphMany.saveManyQuietly()", this.getRelated().getSchemaName(), e.map((t) => t.getType()).join(", "));
|
|
@@ -2108,7 +2128,7 @@ class rt extends Ie {
|
|
|
2108
2128
|
}
|
|
2109
2129
|
class st extends Ie {
|
|
2110
2130
|
constructor(e, t, r, i = null) {
|
|
2111
|
-
if (super(e, t, r, i), this.meta = e, this.facades = t, this.parent = r, this.items = i, i !== null && !
|
|
2131
|
+
if (super(e, t, r, i), this.meta = e, this.facades = t, this.parent = r, this.items = i, i !== null && !E(i))
|
|
2112
2132
|
throw new x("MorphOne.constructor()", "Model or null");
|
|
2113
2133
|
}
|
|
2114
2134
|
isSingle() {
|
|
@@ -2139,7 +2159,7 @@ class it extends Be {
|
|
|
2139
2159
|
// return super.query();
|
|
2140
2160
|
// }
|
|
2141
2161
|
async associate(e) {
|
|
2142
|
-
if (!
|
|
2162
|
+
if (!E(e))
|
|
2143
2163
|
throw new x("MorphTo.associate()");
|
|
2144
2164
|
return e.exists || await e.save(), this.parent.update({
|
|
2145
2165
|
[this.getName() + "_id"]: e.getKey(),
|
|
@@ -2166,8 +2186,8 @@ var Me;
|
|
|
2166
2186
|
Me = Symbol.toStringTag;
|
|
2167
2187
|
class ot {
|
|
2168
2188
|
constructor(e) {
|
|
2169
|
-
|
|
2170
|
-
|
|
2189
|
+
m(this, "_models", {});
|
|
2190
|
+
m(this, Me, "ModelFacade");
|
|
2171
2191
|
this._schema = e;
|
|
2172
2192
|
}
|
|
2173
2193
|
boot(e) {
|
|
@@ -2206,47 +2226,47 @@ class ot {
|
|
|
2206
2226
|
}
|
|
2207
2227
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2208
2228
|
on(e, t) {
|
|
2209
|
-
throw new
|
|
2229
|
+
throw new b();
|
|
2210
2230
|
}
|
|
2211
2231
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2212
2232
|
once(e, t) {
|
|
2213
|
-
throw new
|
|
2233
|
+
throw new b();
|
|
2214
2234
|
}
|
|
2215
2235
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2216
2236
|
emit(e, t) {
|
|
2217
|
-
throw new
|
|
2237
|
+
throw new b();
|
|
2218
2238
|
}
|
|
2219
2239
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2220
2240
|
reducer(e, t, r) {
|
|
2221
|
-
throw new
|
|
2241
|
+
throw new b();
|
|
2222
2242
|
}
|
|
2223
2243
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2224
2244
|
removeReducer(e) {
|
|
2225
|
-
throw new
|
|
2245
|
+
throw new b();
|
|
2226
2246
|
}
|
|
2227
2247
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2228
2248
|
getReducer(e) {
|
|
2229
|
-
throw new
|
|
2249
|
+
throw new b();
|
|
2230
2250
|
}
|
|
2231
2251
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2232
2252
|
hasReducer(e) {
|
|
2233
|
-
throw new
|
|
2253
|
+
throw new b();
|
|
2234
2254
|
}
|
|
2235
2255
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2236
2256
|
clearReducer(e) {
|
|
2237
|
-
throw new
|
|
2257
|
+
throw new b();
|
|
2238
2258
|
}
|
|
2239
2259
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2240
2260
|
flushReducers() {
|
|
2241
|
-
throw new
|
|
2261
|
+
throw new b();
|
|
2242
2262
|
}
|
|
2243
2263
|
}
|
|
2244
|
-
const ht =
|
|
2264
|
+
const ht = A(Re(ot));
|
|
2245
2265
|
var _e, Te;
|
|
2246
2266
|
class ut extends (Te = Error, _e = Symbol.toStringTag, Te) {
|
|
2247
2267
|
constructor() {
|
|
2248
2268
|
super("[Luminix] Embed element not found. Make sure to include the `@luminixEmbed()` directive in your Blade template.");
|
|
2249
|
-
|
|
2269
|
+
m(this, _e, "NoEmbedException");
|
|
2250
2270
|
}
|
|
2251
2271
|
}
|
|
2252
2272
|
const Ke = (n, e = "data") => {
|
|
@@ -2254,10 +2274,10 @@ const Ke = (n, e = "data") => {
|
|
|
2254
2274
|
throw new ut();
|
|
2255
2275
|
const t = document.getElementById(`luminix-${e}::` + n);
|
|
2256
2276
|
return t ? t.dataset.json && t.dataset.value ? JSON.parse(t.dataset.value) : t.dataset.value : null;
|
|
2257
|
-
}, V = S
|
|
2277
|
+
}, V = A(S), at = (n) => Je(n) && n.response !== void 0 && n.response.data !== null && "message" in n.response.data && typeof n.response.data.message == "string" && "errors" in n.response.data && typeof n.response.data.errors == "object" && n.response.data.errors !== null && Object.values(n.response.data.errors).every((e) => Array.isArray(e) && e.every((t) => typeof t == "string")) && n.response.status === 422;
|
|
2258
2278
|
let lt = class {
|
|
2259
2279
|
constructor() {
|
|
2260
|
-
|
|
2280
|
+
m(this, "bags");
|
|
2261
2281
|
const e = {};
|
|
2262
2282
|
document.querySelectorAll('#luminix-embed [id^="luminix-error"]').forEach((r) => {
|
|
2263
2283
|
const s = r.id.replace("luminix-error::", "");
|
|
@@ -2285,11 +2305,11 @@ let lt = class {
|
|
|
2285
2305
|
this.bag(e).set(".", {});
|
|
2286
2306
|
}
|
|
2287
2307
|
};
|
|
2288
|
-
var $e,
|
|
2289
|
-
class ct extends (
|
|
2308
|
+
var $e, Ae;
|
|
2309
|
+
class ct extends (Ae = Error, $e = Symbol.toStringTag, Ae) {
|
|
2290
2310
|
constructor(t) {
|
|
2291
2311
|
super(`[Luminix] Route "${t}" not found`);
|
|
2292
|
-
|
|
2312
|
+
m(this, $e, "RouteNotFoundException");
|
|
2293
2313
|
}
|
|
2294
2314
|
}
|
|
2295
2315
|
class dt {
|
|
@@ -2321,12 +2341,12 @@ class dt {
|
|
|
2321
2341
|
throw new _("RouteFacade");
|
|
2322
2342
|
return this.appUrl + this.replaceRouteParams(`/${i}`);
|
|
2323
2343
|
}
|
|
2324
|
-
const u = i.match(s), a = u ? u.map((
|
|
2344
|
+
const u = i.match(s), a = u ? u.map((w) => w.slice(1, -1)) : [], l = Object.keys(r), d = a.filter((w) => !l.includes(w)), p = l.filter((w) => !a.includes(w));
|
|
2325
2345
|
if (d.length > 0)
|
|
2326
2346
|
throw new TypeError(`Missing values for parameter(s): ${d.join(", ")}`);
|
|
2327
2347
|
if (p.length > 0)
|
|
2328
2348
|
throw new TypeError(`Unexpected parameters: ${p.join(", ")}`);
|
|
2329
|
-
const y = a.reduce((
|
|
2349
|
+
const y = a.reduce((w, g) => w.replace(`{${g}}`, `${r[g]}`), i);
|
|
2330
2350
|
return this.appUrl + `/${y}`;
|
|
2331
2351
|
}
|
|
2332
2352
|
methods(e) {
|
|
@@ -2339,36 +2359,36 @@ class dt {
|
|
|
2339
2359
|
async call(e, t = {}) {
|
|
2340
2360
|
if (typeof this.axiosOptions != "function" || typeof this.axiosError != "function")
|
|
2341
2361
|
throw new _("RouteFacade");
|
|
2342
|
-
const [r, i] = this.extractGenerator(e), [, ...s] = this.get(r), u = this.url(i ? [r, i] : r), a = this.axiosOptions(t, r), { method: l = s[0], errorBag: d = "route.call", ...p } = a, { data: y, ...
|
|
2362
|
+
const [r, i] = this.extractGenerator(e), [, ...s] = this.get(r), u = this.url(i ? [r, i] : r), a = this.axiosOptions(t, r), { method: l = s[0], errorBag: d = "route.call", ...p } = a, { data: y, ...w } = p;
|
|
2343
2363
|
this.error.clear(d);
|
|
2344
2364
|
try {
|
|
2345
|
-
return ["get", "delete"].includes(l) ? await K[l](u, p) : await K[l](u, y,
|
|
2346
|
-
} catch (
|
|
2347
|
-
if (at(
|
|
2348
|
-
const { errors: je } =
|
|
2365
|
+
return ["get", "delete"].includes(l) ? await K[l](u, p) : await K[l](u, y, w);
|
|
2366
|
+
} catch (g) {
|
|
2367
|
+
if (at(g)) {
|
|
2368
|
+
const { errors: je } = g.response.data;
|
|
2349
2369
|
this.error.set(Object.entries(je).reduce((J, [Fe, Pe]) => (J[Fe] = Pe.join(" "), J), {}));
|
|
2350
|
-
} else K.isAxiosError(
|
|
2351
|
-
this.axiosError({ axios:
|
|
2352
|
-
error:
|
|
2370
|
+
} else K.isAxiosError(g) && this.error.set(
|
|
2371
|
+
this.axiosError({ axios: g.message }, {
|
|
2372
|
+
error: g,
|
|
2353
2373
|
name: r,
|
|
2354
2374
|
replace: i,
|
|
2355
2375
|
config: t
|
|
2356
2376
|
}),
|
|
2357
2377
|
d
|
|
2358
2378
|
);
|
|
2359
|
-
throw
|
|
2379
|
+
throw g;
|
|
2360
2380
|
}
|
|
2361
2381
|
}
|
|
2362
2382
|
toString() {
|
|
2363
2383
|
return "route";
|
|
2364
2384
|
}
|
|
2365
2385
|
}
|
|
2366
|
-
const ft =
|
|
2386
|
+
const ft = Re(dt);
|
|
2367
2387
|
class pt {
|
|
2368
2388
|
constructor() {
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2389
|
+
m(this, "facades", {});
|
|
2390
|
+
m(this, "booted", !1);
|
|
2391
|
+
m(this, "_plugins", []);
|
|
2372
2392
|
}
|
|
2373
2393
|
make(e = void 0) {
|
|
2374
2394
|
if (!e)
|
|
@@ -2386,32 +2406,36 @@ class pt {
|
|
|
2386
2406
|
return this._plugins;
|
|
2387
2407
|
}
|
|
2388
2408
|
async boot(e = {}) {
|
|
2389
|
-
var a, l, d, p, y;
|
|
2409
|
+
var a, l, d, p, y, w;
|
|
2390
2410
|
if (this.booted)
|
|
2391
2411
|
throw new window.Error("[Luminix] App already booted");
|
|
2392
2412
|
this.booted = !0, (a = e.app) != null && a.debug && console.log("[Luminix] Booting started..."), this.emit("init", {
|
|
2393
|
-
register: (
|
|
2394
|
-
this._plugins.push(
|
|
2413
|
+
register: (g) => {
|
|
2414
|
+
this._plugins.push(g), typeof g.register == "function" && g.register(this);
|
|
2395
2415
|
}
|
|
2396
2416
|
});
|
|
2397
2417
|
const t = (((l = e.app) == null ? void 0 : l.url) ?? "") + (((d = e.app) == null ? void 0 : d.bootUrl) ?? "/luminix-api/init");
|
|
2398
|
-
if (
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2418
|
+
if (document.getElementById("luminix-data::config")) {
|
|
2419
|
+
if (document.getElementById("luminix-data::config")) {
|
|
2420
|
+
const g = Ke("config");
|
|
2421
|
+
g && typeof g == "object" && f.merge(e, g);
|
|
2422
|
+
}
|
|
2423
|
+
} else try {
|
|
2424
|
+
const { data: g } = await K.get(t);
|
|
2425
|
+
g && typeof g == "object" && f.merge(e, g);
|
|
2426
|
+
} catch (g) {
|
|
2427
|
+
(p = e.app) != null && p.debug && console.error(g);
|
|
2428
|
+
}
|
|
2429
|
+
this.bind("log", new He(!!((y = e.app) != null && y.debug)));
|
|
2406
2430
|
const { log: r } = this.facades, {
|
|
2407
2431
|
manifest: { routes: i = {}, models: s = {} } = {},
|
|
2408
2432
|
...u
|
|
2409
2433
|
} = e;
|
|
2410
|
-
this.bind("config", new
|
|
2411
|
-
for (const
|
|
2412
|
-
typeof
|
|
2413
|
-
for (const
|
|
2414
|
-
typeof
|
|
2434
|
+
this.bind("config", new S(u)), this.facades.config.has("auth.user") || this.facades.config.set("auth.user", null), this.facades.config.lock("auth.user"), this.bind("error", new lt()), this.bind("route", new ft(i, this.facades.error, ((w = e.app) == null ? void 0 : w.url) ?? "")), this.bind("model", new ht(s)), this.bind("auth", new De(this)), this.emit("booting");
|
|
2435
|
+
for (const g of Object.values(this.facades))
|
|
2436
|
+
typeof g == "object" && g !== null && "boot" in g && typeof g.boot == "function" && g.boot(this);
|
|
2437
|
+
for (const g of this._plugins)
|
|
2438
|
+
typeof g.boot == "function" && g.boot(this.facades);
|
|
2415
2439
|
return r.info("[Luminix] App boot completed", {
|
|
2416
2440
|
config: this.facades.config.all(),
|
|
2417
2441
|
plugins: this._plugins,
|
|
@@ -2434,7 +2458,7 @@ class pt {
|
|
|
2434
2458
|
throw new window.Error("Method not implemented.");
|
|
2435
2459
|
}
|
|
2436
2460
|
}
|
|
2437
|
-
const mt =
|
|
2461
|
+
const mt = A(pt);
|
|
2438
2462
|
let M;
|
|
2439
2463
|
function N(n = void 0) {
|
|
2440
2464
|
if (M || (M = new mt()), typeof n != "string")
|
|
@@ -2461,11 +2485,11 @@ function Tt(n, e) {
|
|
|
2461
2485
|
function $t(n, e = "default") {
|
|
2462
2486
|
return n ? N().make("error").get(n, e) : N().make("error");
|
|
2463
2487
|
}
|
|
2464
|
-
function
|
|
2488
|
+
function At(...n) {
|
|
2465
2489
|
const e = N("log");
|
|
2466
2490
|
return n.length ? e.debug(...n) : e;
|
|
2467
2491
|
}
|
|
2468
|
-
function
|
|
2492
|
+
function St(n) {
|
|
2469
2493
|
const e = N("model");
|
|
2470
2494
|
return n ? e.make(n) : e;
|
|
2471
2495
|
}
|
|
@@ -2473,10 +2497,10 @@ function Nt(n, e = !1) {
|
|
|
2473
2497
|
const t = N("route");
|
|
2474
2498
|
return n ? e ? t.url([n, e]) : t.url(n) : t;
|
|
2475
2499
|
}
|
|
2476
|
-
class
|
|
2500
|
+
class vt {
|
|
2477
2501
|
constructor() {
|
|
2478
|
-
|
|
2479
|
-
|
|
2502
|
+
m(this, "name");
|
|
2503
|
+
m(this, "version");
|
|
2480
2504
|
}
|
|
2481
2505
|
register(e) {
|
|
2482
2506
|
}
|
|
@@ -2484,19 +2508,19 @@ class Rt {
|
|
|
2484
2508
|
}
|
|
2485
2509
|
}
|
|
2486
2510
|
export {
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2511
|
+
A as HasEvents,
|
|
2512
|
+
vt as Plugin,
|
|
2513
|
+
S as PropertyBag,
|
|
2514
|
+
Re as Reducible,
|
|
2491
2515
|
N as app,
|
|
2492
2516
|
Mt as auth,
|
|
2493
2517
|
_t as collect,
|
|
2494
2518
|
Tt as config,
|
|
2495
2519
|
$t as error,
|
|
2496
2520
|
$ as isCollection,
|
|
2497
|
-
|
|
2521
|
+
E as isModel,
|
|
2498
2522
|
at as isValidationError,
|
|
2499
|
-
|
|
2500
|
-
|
|
2523
|
+
At as log,
|
|
2524
|
+
St as model,
|
|
2501
2525
|
Nt as route
|
|
2502
2526
|
};
|
package/dist/types/Builder.d.ts
CHANGED
|
@@ -12,6 +12,9 @@ export type BuilderInterface<R, C> = EventSource<BuilderEventMap<R, C>> & {
|
|
|
12
12
|
where(key: string, value: JsonValue): BuilderInterface<R, C>;
|
|
13
13
|
where(key: string, operator: ExtendedOperator, value: JsonValue): BuilderInterface<R, C>;
|
|
14
14
|
where(key: string | Scope<R, C>, operatorOrValue?: ExtendedOperator | JsonValue, value?: JsonValue): BuilderInterface<R, C>;
|
|
15
|
+
with(relation: string | string[]): BuilderInterface<R, C>;
|
|
16
|
+
withOnly(relation: string | string[]): BuilderInterface<R, C>;
|
|
17
|
+
without(relation: string | string[]): BuilderInterface<R, C>;
|
|
15
18
|
whereNull(key: string): BuilderInterface<R, C>;
|
|
16
19
|
whereNotNull(key: string): BuilderInterface<R, C>;
|
|
17
20
|
whereBetween(key: string, value: [JsonValue, JsonValue]): BuilderInterface<R, C>;
|
|
@@ -20,6 +23,7 @@ export type BuilderInterface<R, C> = EventSource<BuilderEventMap<R, C>> & {
|
|
|
20
23
|
searchBy(term: string): BuilderInterface<R, C>;
|
|
21
24
|
minified(): BuilderInterface<R, C>;
|
|
22
25
|
limit(value: number): BuilderInterface<R, C>;
|
|
26
|
+
include(searchParams: URLSearchParams): BuilderInterface<R, C>;
|
|
23
27
|
get(page?: number, replaceLinksWith?: string): Promise<C>;
|
|
24
28
|
all(): Promise<Collection<R>>;
|
|
25
29
|
first(): Promise<R | null>;
|
package/package.json
CHANGED
package/graph.png
DELETED
|
Binary file
|