@luminix/core 1.0.2 → 1.0.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
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var g = (o,
|
|
4
|
-
import { reader as
|
|
5
|
-
class
|
|
6
|
-
constructor(
|
|
1
|
+
var pe = Object.defineProperty;
|
|
2
|
+
var ge = (o, t, e) => t in o ? pe(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
|
|
3
|
+
var g = (o, t, e) => ge(o, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { reader as me, PropertyBag as _, EventSource as A, Collection as b, Query as T, Obj as p, Str as y, Reducible as oe, isValidationError as ye, Macroable as ae, Client as fe, ServiceProvider as we, MakeFacade as M, Application as ve } from "@luminix/support";
|
|
5
|
+
class be {
|
|
6
|
+
constructor(t, e, r) {
|
|
7
7
|
g(this, "_user");
|
|
8
|
-
this.config =
|
|
8
|
+
this.config = t, this.model = e, this.route = r;
|
|
9
9
|
}
|
|
10
|
-
attempt(
|
|
10
|
+
attempt(t, e = !1, r) {
|
|
11
11
|
const i = document.createElement("form");
|
|
12
12
|
i.method = "post", i.action = this.route.url("login"), i.style.display = "none";
|
|
13
|
-
const
|
|
14
|
-
if (typeof
|
|
13
|
+
const h = this.config.get("auth.csrf");
|
|
14
|
+
if (typeof h == "string") {
|
|
15
15
|
const u = document.createElement("input");
|
|
16
|
-
u.type = "hidden", u.name = "_token", u.value =
|
|
16
|
+
u.type = "hidden", u.name = "_token", u.value = h, i.appendChild(u);
|
|
17
17
|
}
|
|
18
18
|
const m = document.createElement("input");
|
|
19
|
-
m.type = "email", m.name = "email", m.value =
|
|
19
|
+
m.type = "email", m.name = "email", m.value = t.email, i.appendChild(m);
|
|
20
20
|
const c = document.createElement("input");
|
|
21
|
-
if (c.type = "password", c.name = "password", c.value =
|
|
21
|
+
if (c.type = "password", c.name = "password", c.value = t.password, i.appendChild(c), e) {
|
|
22
22
|
const u = document.createElement("input");
|
|
23
23
|
u.type = "checkbox", u.name = "remember", u.value = "1", u.checked = !0, i.appendChild(u);
|
|
24
24
|
}
|
|
@@ -27,130 +27,139 @@ class we {
|
|
|
27
27
|
check() {
|
|
28
28
|
return !!this.config.get("auth.user");
|
|
29
29
|
}
|
|
30
|
-
logout(
|
|
31
|
-
const
|
|
32
|
-
|
|
30
|
+
logout(t) {
|
|
31
|
+
const e = document.createElement("form");
|
|
32
|
+
e.method = "post", e.action = this.route.url("logout"), e.style.display = "none";
|
|
33
33
|
const r = this.config.get("auth.csrf");
|
|
34
34
|
if (typeof r == "string") {
|
|
35
35
|
const i = document.createElement("input");
|
|
36
|
-
i.type = "hidden", i.name = "_token", i.value = r,
|
|
36
|
+
i.type = "hidden", i.name = "_token", i.value = r, e.appendChild(i);
|
|
37
37
|
}
|
|
38
|
-
document.body.appendChild(
|
|
38
|
+
document.body.appendChild(e), t && e.addEventListener("submit", t), e.submit();
|
|
39
39
|
}
|
|
40
40
|
user() {
|
|
41
41
|
if (!this._user) {
|
|
42
|
-
const
|
|
43
|
-
if (!
|
|
42
|
+
const t = this.model.make("user"), e = this.config.get("auth.user");
|
|
43
|
+
if (!e)
|
|
44
44
|
return;
|
|
45
|
-
this._user = new e
|
|
45
|
+
this._user = new t(e), this._user.exists = !0;
|
|
46
46
|
}
|
|
47
47
|
return this._user;
|
|
48
48
|
}
|
|
49
49
|
id() {
|
|
50
|
-
var
|
|
51
|
-
return ((
|
|
50
|
+
var t;
|
|
51
|
+
return ((t = this.user()) == null ? void 0 : t.getKey()) || null;
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
class
|
|
54
|
+
class xe {
|
|
55
55
|
constructor() {
|
|
56
56
|
g(this, "bags");
|
|
57
|
-
const
|
|
57
|
+
const t = {};
|
|
58
58
|
document.querySelectorAll('#luminix-embed [id^="luminix-error"]').forEach((r) => {
|
|
59
|
-
const
|
|
60
|
-
|
|
59
|
+
const h = r.id.replace("luminix-error::", "");
|
|
60
|
+
t[h] = me(h, "error");
|
|
61
61
|
}), this.bags = {
|
|
62
|
-
default: new _(
|
|
62
|
+
default: new _(t)
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
|
-
bag(
|
|
66
|
-
return this.bags[
|
|
65
|
+
bag(t = "default") {
|
|
66
|
+
return this.bags[t] || (this.bags[t] = new _({})), this.bags[t];
|
|
67
67
|
}
|
|
68
|
-
add(
|
|
69
|
-
this.bag(r).set(
|
|
68
|
+
add(t, e, r = "default") {
|
|
69
|
+
this.bag(r).set(t, e);
|
|
70
70
|
}
|
|
71
|
-
set(
|
|
72
|
-
this.bag(
|
|
71
|
+
set(t, e = "default") {
|
|
72
|
+
this.bag(e).set(".", t);
|
|
73
73
|
}
|
|
74
|
-
all(
|
|
75
|
-
return this.bag(
|
|
74
|
+
all(t = "default") {
|
|
75
|
+
return this.bag(t).all();
|
|
76
76
|
}
|
|
77
|
-
get(
|
|
78
|
-
return this.bag(
|
|
77
|
+
get(t, e = "default") {
|
|
78
|
+
return this.bag(e).get(t, null);
|
|
79
79
|
}
|
|
80
|
-
clear(
|
|
81
|
-
this.bag(
|
|
80
|
+
clear(t = "default") {
|
|
81
|
+
this.bag(t).set(".", {});
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
class
|
|
85
|
-
constructor(
|
|
86
|
-
this._debug =
|
|
84
|
+
class Me {
|
|
85
|
+
constructor(t) {
|
|
86
|
+
this._debug = t;
|
|
87
87
|
}
|
|
88
|
-
emergency(...
|
|
89
|
-
this._debug && console.error(...
|
|
88
|
+
emergency(...t) {
|
|
89
|
+
this._debug && console.error(...t);
|
|
90
90
|
}
|
|
91
|
-
alert(...
|
|
92
|
-
this._debug && console.error(...
|
|
91
|
+
alert(...t) {
|
|
92
|
+
this._debug && console.error(...t);
|
|
93
93
|
}
|
|
94
|
-
critical(...
|
|
95
|
-
this._debug && console.error(...
|
|
94
|
+
critical(...t) {
|
|
95
|
+
this._debug && console.error(...t);
|
|
96
96
|
}
|
|
97
|
-
error(...
|
|
98
|
-
this._debug && console.error(...
|
|
97
|
+
error(...t) {
|
|
98
|
+
this._debug && console.error(...t);
|
|
99
99
|
}
|
|
100
|
-
warning(...
|
|
101
|
-
this._debug && console.warn(...
|
|
100
|
+
warning(...t) {
|
|
101
|
+
this._debug && console.warn(...t);
|
|
102
102
|
}
|
|
103
|
-
notice(...
|
|
104
|
-
this._debug && console.info(...
|
|
103
|
+
notice(...t) {
|
|
104
|
+
this._debug && console.info(...t);
|
|
105
105
|
}
|
|
106
|
-
info(...
|
|
107
|
-
this._debug && console.info(...
|
|
106
|
+
info(...t) {
|
|
107
|
+
this._debug && console.info(...t);
|
|
108
108
|
}
|
|
109
|
-
debug(...
|
|
110
|
-
this._debug && console.debug(...
|
|
109
|
+
debug(...t) {
|
|
110
|
+
this._debug && console.debug(...t);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
var O, j;
|
|
114
|
-
class
|
|
115
|
-
constructor(
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
class Ee extends (j = Error, O = Symbol.toStringTag, j) {
|
|
115
|
+
constructor(e, r) {
|
|
116
|
+
const i = r.json("message");
|
|
117
|
+
super(`[Luminix] Query for model "${e}" failed with status ${r.status()}` + (typeof i == "string" && i !== "" ? `: ${i}` : ""));
|
|
118
|
+
g(this, O, "ModelQueryFailedException");
|
|
119
|
+
this.response = r;
|
|
118
120
|
}
|
|
119
121
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
+
var B, C;
|
|
123
|
+
class $e extends (C = Error, B = Symbol.toStringTag, C) {
|
|
124
|
+
constructor(e) {
|
|
125
|
+
super(`[Luminix] Model "${e}" does not have a primary key`);
|
|
126
|
+
g(this, B, "ModelWithoutPrimaryKeyException");
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
class Se extends A {
|
|
130
|
+
constructor(e, r, i = {}) {
|
|
122
131
|
super();
|
|
123
132
|
g(this, "bag");
|
|
124
|
-
this.services =
|
|
133
|
+
this.services = e, this.abstract = r, this.bag = new _(i), this.bag.on("change", () => {
|
|
125
134
|
this.emit("change", {
|
|
126
135
|
data: this.bag,
|
|
127
136
|
source: this
|
|
128
137
|
});
|
|
129
138
|
});
|
|
130
139
|
}
|
|
131
|
-
lock(
|
|
132
|
-
this.bag.lock(
|
|
140
|
+
lock(e) {
|
|
141
|
+
this.bag.lock(e);
|
|
133
142
|
}
|
|
134
|
-
whereBetween(
|
|
135
|
-
return this.where(
|
|
143
|
+
whereBetween(e, r) {
|
|
144
|
+
return this.where(e, "between", r);
|
|
136
145
|
}
|
|
137
|
-
whereNotBetween(
|
|
138
|
-
return this.where(
|
|
146
|
+
whereNotBetween(e, r) {
|
|
147
|
+
return this.where(e, "notBetween", r);
|
|
139
148
|
}
|
|
140
|
-
whereNull(
|
|
141
|
-
return this.where(
|
|
149
|
+
whereNull(e) {
|
|
150
|
+
return this.where(e, "null", null);
|
|
142
151
|
}
|
|
143
|
-
whereNotNull(
|
|
144
|
-
return this.where(
|
|
152
|
+
whereNotNull(e) {
|
|
153
|
+
return this.where(e, "notNull", null);
|
|
145
154
|
}
|
|
146
|
-
limit(
|
|
147
|
-
return this.bag.set("per_page",
|
|
155
|
+
limit(e) {
|
|
156
|
+
return this.bag.set("per_page", e), this;
|
|
148
157
|
}
|
|
149
|
-
where(
|
|
150
|
-
if (this.bag.has("where") || this.bag.set("where", {}), typeof
|
|
151
|
-
return
|
|
158
|
+
where(e, r, i) {
|
|
159
|
+
if (this.bag.has("where") || this.bag.set("where", {}), typeof e == "function")
|
|
160
|
+
return e(this) || this;
|
|
152
161
|
if (typeof i > "u")
|
|
153
|
-
return this.bag.set(`where.${
|
|
162
|
+
return this.bag.set(`where.${e}`, r), this;
|
|
154
163
|
if (typeof r != "string")
|
|
155
164
|
throw new Error(`Invalid operator ${r} provided for where clause.`);
|
|
156
165
|
const m = {
|
|
@@ -161,54 +170,57 @@ class Me extends k {
|
|
|
161
170
|
"<": "lessThan",
|
|
162
171
|
"<=": "lessThanOrEquals"
|
|
163
172
|
}[r] || r;
|
|
164
|
-
return this.bag.set(`where.${
|
|
173
|
+
return this.bag.set(`where.${e}:${m}`, i), this;
|
|
165
174
|
}
|
|
166
|
-
with(
|
|
175
|
+
with(e) {
|
|
167
176
|
const r = this.bag.get("with", []);
|
|
168
|
-
return (Array.isArray(
|
|
169
|
-
r.includes(
|
|
177
|
+
return (Array.isArray(e) ? e : [e]).forEach((h) => {
|
|
178
|
+
r.includes(h) || r.push(h);
|
|
170
179
|
}), this.bag.set("with", r), this;
|
|
171
180
|
}
|
|
172
|
-
withOnly(
|
|
173
|
-
return this.bag.set("with", Array.isArray(
|
|
181
|
+
withOnly(e) {
|
|
182
|
+
return this.bag.set("with", Array.isArray(e) ? e : [e]), this;
|
|
174
183
|
}
|
|
175
|
-
without(
|
|
184
|
+
without(e) {
|
|
176
185
|
const r = this.bag.get("with", []);
|
|
177
|
-
return (Array.isArray(
|
|
178
|
-
r.includes(
|
|
186
|
+
return (Array.isArray(e) ? e : [e]).forEach((h) => {
|
|
187
|
+
r.includes(h) && r.splice(r.indexOf(h), 1);
|
|
179
188
|
}), this.bag.set("with", r), this;
|
|
180
189
|
}
|
|
181
|
-
orderBy(
|
|
182
|
-
return this.bag.set("order_by", `${
|
|
190
|
+
orderBy(e, r = "asc") {
|
|
191
|
+
return this.bag.set("order_by", `${e}:${r}`), this;
|
|
183
192
|
}
|
|
184
|
-
searchBy(
|
|
185
|
-
return this.bag.set("q",
|
|
193
|
+
searchBy(e) {
|
|
194
|
+
return e === "" ? (this.bag.delete("q"), this) : (this.bag.set("q", e), this);
|
|
186
195
|
}
|
|
187
196
|
minified() {
|
|
188
197
|
return this.bag.set("minified", 1), this;
|
|
189
198
|
}
|
|
190
|
-
unset(
|
|
191
|
-
return this.bag.delete(
|
|
199
|
+
unset(e) {
|
|
200
|
+
return this.bag.delete(e), this;
|
|
192
201
|
}
|
|
193
|
-
include(
|
|
194
|
-
for (const [r, i] of
|
|
202
|
+
include(e) {
|
|
203
|
+
for (const [r, i] of e.entries())
|
|
195
204
|
this.bag.set(r, i);
|
|
196
205
|
return this;
|
|
197
206
|
}
|
|
198
|
-
async exec(
|
|
207
|
+
async exec(e = {}) {
|
|
199
208
|
try {
|
|
200
209
|
const {
|
|
201
210
|
page: r = 1,
|
|
202
211
|
replaceLinks: i = !1
|
|
203
|
-
} =
|
|
212
|
+
} = e;
|
|
204
213
|
this.bag.set("page", r), this.emit("submit", {
|
|
205
214
|
data: this.bag,
|
|
206
215
|
source: this
|
|
207
216
|
});
|
|
208
|
-
const
|
|
217
|
+
const h = await this.services.route.call(
|
|
209
218
|
`luminix.${this.abstract}.index`,
|
|
210
219
|
(u) => u.withQueryParameters(this.bag.all())
|
|
211
|
-
)
|
|
220
|
+
);
|
|
221
|
+
if (h.failed())
|
|
222
|
+
throw new Ee(this.abstract, h);
|
|
223
|
+
const m = this.services.model.make(this.abstract), c = new b(h.json("data").map((u) => {
|
|
212
224
|
const s = new m(u);
|
|
213
225
|
return s.exists = !0, this.services.model.emit("fetch", {
|
|
214
226
|
class: this.abstract,
|
|
@@ -219,25 +231,25 @@ class Me extends k {
|
|
|
219
231
|
if (i) {
|
|
220
232
|
const u = window.location.href, [s] = u.split("?");
|
|
221
233
|
return {
|
|
222
|
-
...
|
|
234
|
+
...h.json(),
|
|
223
235
|
data: c,
|
|
224
236
|
links: {
|
|
225
|
-
first: `${s}?${
|
|
226
|
-
last: `${s}?${
|
|
227
|
-
next:
|
|
228
|
-
prev:
|
|
237
|
+
first: `${s}?${T.merge(u, h.json("links").first).toString()}`,
|
|
238
|
+
last: `${s}?${T.merge(u, h.json("links").last).toString()}`,
|
|
239
|
+
next: h.json("links").next && `${s}?${T.merge(u, h.json("links").next ?? "").toString()}`,
|
|
240
|
+
prev: h.json("links").prev && `${s}?${T.merge(u, h.json("links").prev ?? "").toString()}`
|
|
229
241
|
},
|
|
230
242
|
meta: {
|
|
231
|
-
...
|
|
232
|
-
links:
|
|
243
|
+
...h.json("meta"),
|
|
244
|
+
links: h.json("meta").links.map((n) => ({
|
|
233
245
|
...n,
|
|
234
|
-
url: n.url && `${s}?${
|
|
246
|
+
url: n.url && `${s}?${T.merge(u, n.url).toString()}`
|
|
235
247
|
}))
|
|
236
248
|
}
|
|
237
249
|
};
|
|
238
250
|
}
|
|
239
251
|
return {
|
|
240
|
-
...
|
|
252
|
+
...h.json(),
|
|
241
253
|
data: c
|
|
242
254
|
};
|
|
243
255
|
} catch (r) {
|
|
@@ -247,8 +259,8 @@ class Me extends k {
|
|
|
247
259
|
}), r;
|
|
248
260
|
}
|
|
249
261
|
}
|
|
250
|
-
async get(
|
|
251
|
-
const r = await this.exec(
|
|
262
|
+
async get(e = {}) {
|
|
263
|
+
const r = await this.exec(e);
|
|
252
264
|
return this.emit("success", {
|
|
253
265
|
response: r,
|
|
254
266
|
items: r.data,
|
|
@@ -256,18 +268,18 @@ class Me extends k {
|
|
|
256
268
|
}), r;
|
|
257
269
|
}
|
|
258
270
|
async first() {
|
|
259
|
-
const
|
|
271
|
+
const e = await this.limit(1).exec();
|
|
260
272
|
return this.emit("success", {
|
|
261
|
-
response:
|
|
262
|
-
items:
|
|
273
|
+
response: e,
|
|
274
|
+
items: e.data.first(),
|
|
263
275
|
source: this
|
|
264
|
-
}),
|
|
276
|
+
}), e.data.first();
|
|
265
277
|
}
|
|
266
|
-
async find(
|
|
278
|
+
async find(e) {
|
|
267
279
|
const r = this.services.model.schema(this.abstract).primaryKey;
|
|
268
280
|
if (!r)
|
|
269
|
-
throw new
|
|
270
|
-
const i = await this.where(r,
|
|
281
|
+
throw new $e(this.abstract);
|
|
282
|
+
const i = await this.where(r, e).limit(1).exec();
|
|
271
283
|
return this.emit("success", {
|
|
272
284
|
response: i,
|
|
273
285
|
items: i.data.sole(),
|
|
@@ -275,11 +287,11 @@ class Me extends k {
|
|
|
275
287
|
}), i.data.sole();
|
|
276
288
|
}
|
|
277
289
|
async all() {
|
|
278
|
-
const
|
|
290
|
+
const e = this.services.config.get("luminix.backend.api.max_per_page", 150), r = await this.limit(e).exec(), i = r.meta.last_page;
|
|
279
291
|
if (i === 1)
|
|
280
292
|
return r.data;
|
|
281
|
-
const
|
|
282
|
-
|
|
293
|
+
const h = Array.from({ length: i - 1 }, (u, s) => s + 2), m = await Promise.all(
|
|
294
|
+
h.map((u) => this.limit(e).exec({ page: u }))
|
|
283
295
|
), c = new b(
|
|
284
296
|
m.reduce((u, s) => (u.push(...s.data), u), r.data).all()
|
|
285
297
|
);
|
|
@@ -293,52 +305,52 @@ class Me extends k {
|
|
|
293
305
|
}), c;
|
|
294
306
|
}
|
|
295
307
|
}
|
|
296
|
-
var
|
|
297
|
-
class w extends (
|
|
298
|
-
constructor(
|
|
299
|
-
super(`[Luminix] "${
|
|
300
|
-
g(this,
|
|
308
|
+
var Q, I;
|
|
309
|
+
class w extends (I = TypeError, Q = Symbol.toStringTag, I) {
|
|
310
|
+
constructor(e, r = "Model") {
|
|
311
|
+
super(`[Luminix] "${e}" expects ${r}`);
|
|
312
|
+
g(this, Q, "NotModelException");
|
|
301
313
|
}
|
|
302
314
|
}
|
|
303
|
-
var
|
|
304
|
-
class
|
|
305
|
-
constructor(
|
|
306
|
-
super(`[Luminix] Could not determine inverse relation for "${r}" in model "${
|
|
307
|
-
g(this,
|
|
315
|
+
var P, L;
|
|
316
|
+
class Te extends (L = Error, P = Symbol.toStringTag, L) {
|
|
317
|
+
constructor(e, r, i, h) {
|
|
318
|
+
super(`[Luminix] Could not determine inverse relation for "${r}" in model "${e}". Please specify a relation in model "${i}" of type ${h} that points back to "${e}".`);
|
|
319
|
+
g(this, P, "NoInverseRelationException");
|
|
308
320
|
}
|
|
309
321
|
}
|
|
310
|
-
var
|
|
311
|
-
class
|
|
312
|
-
constructor(
|
|
313
|
-
super(`[Luminix] Relation "${
|
|
314
|
-
g(this,
|
|
322
|
+
var D, H;
|
|
323
|
+
class _e extends (H = Error, D = Symbol.toStringTag, H) {
|
|
324
|
+
constructor(e) {
|
|
325
|
+
super(`[Luminix] Relation "${e}" is not supported`);
|
|
326
|
+
g(this, D, "UnsupportedRelationException");
|
|
315
327
|
}
|
|
316
328
|
}
|
|
317
329
|
class N {
|
|
318
|
-
constructor(
|
|
330
|
+
constructor(t, e, r, i = null) {
|
|
319
331
|
g(this, "unsubscribeQuery", null);
|
|
320
|
-
if (this.services =
|
|
332
|
+
if (this.services = t, this.meta = e, this.parent = r, this.items = i, i !== null && !p.isModel(i) && !(i instanceof b && i.every(p.isModel)))
|
|
321
333
|
throw new w("Relation.constructor()", "Model, Collection<Model> or null");
|
|
322
334
|
}
|
|
323
|
-
make(
|
|
324
|
-
if (
|
|
335
|
+
make(t) {
|
|
336
|
+
if (t === null || typeof t > "u") {
|
|
325
337
|
this.set(null);
|
|
326
338
|
return;
|
|
327
339
|
}
|
|
328
|
-
const
|
|
340
|
+
const e = this.getRelated();
|
|
329
341
|
if (this.isSingle()) {
|
|
330
|
-
if (typeof
|
|
342
|
+
if (typeof t != "object" || Array.isArray(t))
|
|
331
343
|
throw new TypeError("Relation.make() expects an object");
|
|
332
|
-
this.set(new t
|
|
344
|
+
this.set(new e(t));
|
|
333
345
|
}
|
|
334
346
|
if (this.isMultiple()) {
|
|
335
|
-
if (!Array.isArray(
|
|
347
|
+
if (!Array.isArray(t))
|
|
336
348
|
throw new TypeError("Relation.make() expects an array");
|
|
337
|
-
this.set(new b(
|
|
349
|
+
this.set(new b(t.map((r) => new e(r))));
|
|
338
350
|
}
|
|
339
351
|
}
|
|
340
352
|
guessInverseRelation() {
|
|
341
|
-
const { relations:
|
|
353
|
+
const { relations: t } = this.getRelated().getSchema(), e = this.getType(), r = this.services.model.guessInverseRelation({
|
|
342
354
|
HasOne: ["BelongsTo"],
|
|
343
355
|
HasMany: ["BelongsTo"],
|
|
344
356
|
BelongsTo: ["HasOne", "HasMany"],
|
|
@@ -347,20 +359,20 @@ class N {
|
|
|
347
359
|
MorphOne: ["MorphTo"],
|
|
348
360
|
MorphMany: ["MorphTo"],
|
|
349
361
|
MorphToMany: ["MorphToMany"]
|
|
350
|
-
}, this.parent,
|
|
351
|
-
if (!(
|
|
352
|
-
throw new
|
|
353
|
-
for (const i in
|
|
354
|
-
const
|
|
355
|
-
if ((
|
|
362
|
+
}, this.parent, e, this.getRelated());
|
|
363
|
+
if (!(e in r))
|
|
364
|
+
throw new _e(e);
|
|
365
|
+
for (const i in t) {
|
|
366
|
+
const h = t[i];
|
|
367
|
+
if ((h.model === this.parent.getType() || ["MorphOne", "MorphMany"].includes(e)) && r[e].includes(h.type))
|
|
356
368
|
return i;
|
|
357
369
|
}
|
|
358
|
-
throw new
|
|
370
|
+
throw new Te(this.parent.getType(), e, this.getRelated().getSchemaName(), r[e].join(" or "));
|
|
359
371
|
}
|
|
360
|
-
set(
|
|
361
|
-
if (
|
|
372
|
+
set(t) {
|
|
373
|
+
if (t !== null && !p.isModel(t) && !(t instanceof b && t.every(p.isModel)))
|
|
362
374
|
throw new w("Relation.set()", "Model, Collection<Model> or null");
|
|
363
|
-
!this.items || p.isModel(this.items) ? this.items =
|
|
375
|
+
!this.items || p.isModel(this.items) ? this.items = t : t instanceof b && this.items.splice(0, this.items.count(), ...t);
|
|
364
376
|
}
|
|
365
377
|
getForeignKey() {
|
|
366
378
|
return this.meta.foreignKey;
|
|
@@ -378,10 +390,10 @@ class N {
|
|
|
378
390
|
return this.services.model.make(this.meta.model);
|
|
379
391
|
}
|
|
380
392
|
query() {
|
|
381
|
-
const
|
|
382
|
-
return this.unsubscribeQuery && this.unsubscribeQuery(), this.unsubscribeQuery =
|
|
383
|
-
this.items =
|
|
384
|
-
}),
|
|
393
|
+
const t = this.getRelated().query();
|
|
394
|
+
return this.unsubscribeQuery && this.unsubscribeQuery(), this.unsubscribeQuery = t.on("success", (e) => {
|
|
395
|
+
this.items = e.items;
|
|
396
|
+
}), t;
|
|
385
397
|
}
|
|
386
398
|
isLoaded() {
|
|
387
399
|
return this.items !== null;
|
|
@@ -398,32 +410,32 @@ class N {
|
|
|
398
410
|
getParent() {
|
|
399
411
|
return this.parent;
|
|
400
412
|
}
|
|
401
|
-
where(...
|
|
402
|
-
return this.query().where(...
|
|
413
|
+
where(...t) {
|
|
414
|
+
return this.query().where(...t);
|
|
403
415
|
}
|
|
404
|
-
whereNull(
|
|
405
|
-
return this.query().whereNull(
|
|
416
|
+
whereNull(t) {
|
|
417
|
+
return this.query().whereNull(t);
|
|
406
418
|
}
|
|
407
|
-
whereNotNull(
|
|
408
|
-
return this.query().whereNotNull(
|
|
419
|
+
whereNotNull(t) {
|
|
420
|
+
return this.query().whereNotNull(t);
|
|
409
421
|
}
|
|
410
|
-
whereBetween(
|
|
411
|
-
return this.query().whereBetween(
|
|
422
|
+
whereBetween(t, e) {
|
|
423
|
+
return this.query().whereBetween(t, e);
|
|
412
424
|
}
|
|
413
|
-
whereNotBetween(
|
|
414
|
-
return this.query().whereNotBetween(
|
|
425
|
+
whereNotBetween(t, e) {
|
|
426
|
+
return this.query().whereNotBetween(t, e);
|
|
415
427
|
}
|
|
416
|
-
orderBy(
|
|
417
|
-
return this.query().orderBy(
|
|
428
|
+
orderBy(t, e = "asc") {
|
|
429
|
+
return this.query().orderBy(t, e);
|
|
418
430
|
}
|
|
419
|
-
searchBy(
|
|
420
|
-
return this.query().searchBy(
|
|
431
|
+
searchBy(t) {
|
|
432
|
+
return this.query().searchBy(t);
|
|
421
433
|
}
|
|
422
434
|
minified() {
|
|
423
435
|
return this.query().minified();
|
|
424
436
|
}
|
|
425
|
-
limit(
|
|
426
|
-
return this.query().limit(
|
|
437
|
+
limit(t) {
|
|
438
|
+
return this.query().limit(t);
|
|
427
439
|
}
|
|
428
440
|
// get(page = 1, perPage = 15, replaceLinksWith?: string): Promise<ModelPaginatedResponse>
|
|
429
441
|
// {
|
|
@@ -438,30 +450,30 @@ class N {
|
|
|
438
450
|
// return this.query().find(id);
|
|
439
451
|
// }
|
|
440
452
|
}
|
|
441
|
-
var
|
|
442
|
-
class $ extends (
|
|
443
|
-
constructor(
|
|
444
|
-
super(`[Luminix] Expected ${
|
|
445
|
-
g(this,
|
|
453
|
+
var J, U;
|
|
454
|
+
class $ extends (U = Error, J = Symbol.toStringTag, U) {
|
|
455
|
+
constructor(e) {
|
|
456
|
+
super(`[Luminix] Expected ${e} to be reducible.`);
|
|
457
|
+
g(this, J, "NotReducibleException");
|
|
446
458
|
}
|
|
447
459
|
}
|
|
448
|
-
var
|
|
449
|
-
class
|
|
460
|
+
var F, W;
|
|
461
|
+
class Re extends (W = Error, F = Symbol.toStringTag, W) {
|
|
450
462
|
constructor() {
|
|
451
463
|
super("[Luminix] Method not implemented.");
|
|
452
|
-
g(this,
|
|
464
|
+
g(this, F, "MethodNotImplementedException");
|
|
453
465
|
}
|
|
454
466
|
}
|
|
455
|
-
var
|
|
456
|
-
class
|
|
457
|
-
constructor(
|
|
458
|
-
super(`[Luminix] Model "${
|
|
459
|
-
g(this,
|
|
467
|
+
var G, V;
|
|
468
|
+
class ue extends (V = Error, G = Symbol.toStringTag, V) {
|
|
469
|
+
constructor(e, r) {
|
|
470
|
+
super(`[Luminix] Model "${e}" must be persisted before calling "${r}"`);
|
|
471
|
+
g(this, G, "ModelNotPersistedException");
|
|
460
472
|
}
|
|
461
473
|
}
|
|
462
|
-
function
|
|
463
|
-
var
|
|
464
|
-
return c = class extends (m =
|
|
474
|
+
function Ne(o, t, e, r, i) {
|
|
475
|
+
var h, m, c;
|
|
476
|
+
return c = class extends (m = A, h = Symbol.toStringTag, m) {
|
|
465
477
|
constructor(s = {}) {
|
|
466
478
|
super();
|
|
467
479
|
g(this, "_attributes", new _({}));
|
|
@@ -470,7 +482,7 @@ function Se(o, e, t, r, i) {
|
|
|
470
482
|
g(this, "_changedKeys", []);
|
|
471
483
|
g(this, "exists", !1);
|
|
472
484
|
g(this, "wasRecentlyCreated", !1);
|
|
473
|
-
g(this,
|
|
485
|
+
g(this, h, y.studly(i));
|
|
474
486
|
this.makeRelations(), this.makeAttributes(s);
|
|
475
487
|
}
|
|
476
488
|
cast(s, n) {
|
|
@@ -480,31 +492,31 @@ function Se(o, e, t, r, i) {
|
|
|
480
492
|
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;
|
|
481
493
|
}
|
|
482
494
|
makeRelations() {
|
|
483
|
-
const { relations: s } =
|
|
495
|
+
const { relations: s } = e.schema(i);
|
|
484
496
|
if (this._relations = {}, !s)
|
|
485
497
|
return;
|
|
486
|
-
const n =
|
|
487
|
-
Object.entries(s).forEach(([a,
|
|
488
|
-
const { type: d } =
|
|
498
|
+
const n = e.getRelationConstructors(i);
|
|
499
|
+
Object.entries(s).forEach(([a, l]) => {
|
|
500
|
+
const { type: d } = l, v = d in n ? n[d] : N;
|
|
489
501
|
this._relations[a] = new v(
|
|
490
|
-
{ model:
|
|
491
|
-
{ name: a, ...
|
|
502
|
+
{ model: e, route: r },
|
|
503
|
+
{ name: a, ...l },
|
|
492
504
|
this,
|
|
493
505
|
null
|
|
494
506
|
);
|
|
495
507
|
});
|
|
496
508
|
}
|
|
497
509
|
makeAttributes(s) {
|
|
498
|
-
const { relations: n, attributes: a = [] } =
|
|
499
|
-
const
|
|
500
|
-
return
|
|
510
|
+
const { relations: n, attributes: a = [] } = e.schema(i), l = Object.keys(n || {}), d = p.omit(s, ...l), v = (f) => {
|
|
511
|
+
const S = a.find((de) => de.name == f);
|
|
512
|
+
return S ? !(f in d) && S.nullable : !1;
|
|
501
513
|
};
|
|
502
514
|
if (this.fillable.filter(v).forEach((f) => {
|
|
503
515
|
d[f] = null;
|
|
504
516
|
}), !this.validateJsonObject(d)) {
|
|
505
517
|
if (o.get("app.env", "production") === "production")
|
|
506
518
|
throw new TypeError(`[Luminix] Invalid attributes for model "${i}"`);
|
|
507
|
-
|
|
519
|
+
t.warning(`Invalid attributes for model "${i}".
|
|
508
520
|
This will throw an error in production.`, {
|
|
509
521
|
attributes: s,
|
|
510
522
|
abstract: i
|
|
@@ -529,30 +541,30 @@ function Se(o, e, t, r, i) {
|
|
|
529
541
|
this.emit("create", {
|
|
530
542
|
value: s,
|
|
531
543
|
source: this
|
|
532
|
-
}),
|
|
544
|
+
}), e.emit("create", {
|
|
533
545
|
class: i,
|
|
534
546
|
model: this,
|
|
535
|
-
source:
|
|
547
|
+
source: e
|
|
536
548
|
});
|
|
537
549
|
}
|
|
538
550
|
dispatchUpdateEvent(s) {
|
|
539
551
|
this.emit("update", {
|
|
540
552
|
value: s,
|
|
541
553
|
source: this
|
|
542
|
-
}),
|
|
554
|
+
}), e.emit("update", {
|
|
543
555
|
class: i,
|
|
544
556
|
model: this,
|
|
545
|
-
source:
|
|
557
|
+
source: e
|
|
546
558
|
});
|
|
547
559
|
}
|
|
548
560
|
dispatchSaveEvent() {
|
|
549
561
|
this.emit("save", {
|
|
550
562
|
value: this.diff(),
|
|
551
563
|
source: this
|
|
552
|
-
}),
|
|
564
|
+
}), e.emit("save", {
|
|
553
565
|
class: i,
|
|
554
566
|
model: this,
|
|
555
|
-
source:
|
|
567
|
+
source: e
|
|
556
568
|
});
|
|
557
569
|
}
|
|
558
570
|
dispatchDeleteEvent(s = !1) {
|
|
@@ -560,10 +572,10 @@ function Se(o, e, t, r, i) {
|
|
|
560
572
|
force: s,
|
|
561
573
|
[this.getKeyName()]: this.getKey(),
|
|
562
574
|
source: this
|
|
563
|
-
}),
|
|
575
|
+
}), e.emit("delete", {
|
|
564
576
|
class: i,
|
|
565
577
|
model: this,
|
|
566
|
-
source:
|
|
578
|
+
source: e,
|
|
567
579
|
force: s
|
|
568
580
|
});
|
|
569
581
|
}
|
|
@@ -571,10 +583,10 @@ function Se(o, e, t, r, i) {
|
|
|
571
583
|
this.emit("restore", {
|
|
572
584
|
value: this.attributes,
|
|
573
585
|
source: this
|
|
574
|
-
}),
|
|
586
|
+
}), e.emit("restore", {
|
|
575
587
|
class: i,
|
|
576
588
|
model: this,
|
|
577
|
-
source:
|
|
589
|
+
source: e
|
|
578
590
|
});
|
|
579
591
|
}
|
|
580
592
|
dispatchErrorEvent(s, n) {
|
|
@@ -582,16 +594,16 @@ function Se(o, e, t, r, i) {
|
|
|
582
594
|
error: s,
|
|
583
595
|
operation: n,
|
|
584
596
|
source: this
|
|
585
|
-
}),
|
|
597
|
+
}), e.emit("error", {
|
|
586
598
|
class: i,
|
|
587
599
|
model: this,
|
|
588
|
-
source:
|
|
600
|
+
source: e,
|
|
589
601
|
error: s,
|
|
590
602
|
operation: n
|
|
591
603
|
});
|
|
592
604
|
}
|
|
593
605
|
updateChangedKeys(s) {
|
|
594
|
-
const n = (
|
|
606
|
+
const n = (l, d) => typeof l == "object" && l !== null ? p.isEqual(l, d) : l == d, a = s.includes(".") || s.includes("[") ? s.split(/[.[]/)[0] : s;
|
|
595
607
|
!this._changedKeys.includes(a) && !n(p.get(this._original, a), this._attributes.get(a)) ? this._changedKeys.push(a) : this._changedKeys.includes(a) && n(p.get(this._original, a), this._attributes.get(a)) && this._changedKeys.splice(this._changedKeys.indexOf(a), 1);
|
|
596
608
|
}
|
|
597
609
|
validateJsonObject(s) {
|
|
@@ -607,20 +619,20 @@ function Se(o, e, t, r, i) {
|
|
|
607
619
|
return this._relations;
|
|
608
620
|
}
|
|
609
621
|
get fillable() {
|
|
610
|
-
return
|
|
622
|
+
return e.schema(i).fillable;
|
|
611
623
|
}
|
|
612
624
|
get primaryKey() {
|
|
613
|
-
return
|
|
625
|
+
return e.schema(i).primaryKey;
|
|
614
626
|
}
|
|
615
627
|
get timestamps() {
|
|
616
|
-
return
|
|
628
|
+
return e.schema(i).timestamps;
|
|
617
629
|
}
|
|
618
630
|
// get softDeletes() {
|
|
619
631
|
// return ModelFacade.schema(abstract).softDeletes;
|
|
620
632
|
// }
|
|
621
633
|
get casts() {
|
|
622
634
|
return {
|
|
623
|
-
...
|
|
635
|
+
...e.schema(i).casts,
|
|
624
636
|
...this.timestamps ? { created_at: "datetime", updated_at: "datetime" } : {}
|
|
625
637
|
// ...this.softDeletes ? { deleted_at: 'datetime' } : {},
|
|
626
638
|
};
|
|
@@ -632,30 +644,30 @@ function Se(o, e, t, r, i) {
|
|
|
632
644
|
getAttribute(s) {
|
|
633
645
|
let n = this._attributes.get(s, null);
|
|
634
646
|
s in this.casts && (n = this.cast(n, this.casts[s]));
|
|
635
|
-
const a =
|
|
647
|
+
const a = e[`model${y.studly(i)}Get${y.studly(s)}Attribute`];
|
|
636
648
|
if (typeof a != "function")
|
|
637
649
|
throw new $("ModelFacade");
|
|
638
|
-
return a.bind(
|
|
650
|
+
return a.bind(e)(n, this);
|
|
639
651
|
}
|
|
640
652
|
setAttribute(s, n) {
|
|
641
|
-
const
|
|
653
|
+
const l = e[`model${y.studly(i)}Set${y.studly(s)}Attribute`].bind(e)(
|
|
642
654
|
this.mutate(n, this.casts[s]),
|
|
643
655
|
this
|
|
644
656
|
);
|
|
645
|
-
if (!this.validateJsonObject({ [s]:
|
|
657
|
+
if (!this.validateJsonObject({ [s]: l })) {
|
|
646
658
|
if (o.get("app.env", "production") === "production")
|
|
647
659
|
throw new TypeError(`[Luminix] Attribute "${s}" in model "${i}" must be a boolean, number, string or null`);
|
|
648
|
-
|
|
660
|
+
t.warning(`Invalid type for attribute "${s}" in model "${i}" after mutation.
|
|
649
661
|
This will throw an error in production.`, {
|
|
650
662
|
key: s,
|
|
651
663
|
value: n,
|
|
652
|
-
mutated:
|
|
664
|
+
mutated: l,
|
|
653
665
|
cast: this.casts[s],
|
|
654
666
|
item: this.toJson()
|
|
655
667
|
});
|
|
656
668
|
return;
|
|
657
669
|
}
|
|
658
|
-
this._attributes.set(s,
|
|
670
|
+
this._attributes.set(s, l), this.updateChangedKeys(s), this.dispatchChangeEvent({ [s]: l });
|
|
659
671
|
}
|
|
660
672
|
getKey() {
|
|
661
673
|
return this.getAttribute(this.primaryKey);
|
|
@@ -664,19 +676,19 @@ function Se(o, e, t, r, i) {
|
|
|
664
676
|
return this.primaryKey;
|
|
665
677
|
}
|
|
666
678
|
fill(s) {
|
|
667
|
-
const n = p.pick(s, ...this.fillable), a = Object.entries(n).reduce((
|
|
668
|
-
const f =
|
|
679
|
+
const n = p.pick(s, ...this.fillable), a = Object.entries(n).reduce((l, [d, v]) => {
|
|
680
|
+
const f = e[`model${y.studly(i)}Set${y.studly(d)}Attribute`];
|
|
669
681
|
if (typeof f != "function")
|
|
670
682
|
throw new $("ModelFacade");
|
|
671
|
-
return
|
|
683
|
+
return l[d] = f.bind(e)(
|
|
672
684
|
this.mutate(v, this.casts[d]),
|
|
673
685
|
this
|
|
674
|
-
),
|
|
686
|
+
), l;
|
|
675
687
|
}, {});
|
|
676
688
|
if (!this.validateJsonObject(a)) {
|
|
677
689
|
if (o.get("app.env", "production") === "production")
|
|
678
690
|
throw new TypeError(`[Luminix] Invalid attributes for model "${i}"`);
|
|
679
|
-
|
|
691
|
+
t.warning(`Invalid attributes for model "${i}" after mutation.
|
|
680
692
|
This will throw an error in production.`, {
|
|
681
693
|
attributes: s,
|
|
682
694
|
mutatedAttributes: a,
|
|
@@ -685,19 +697,19 @@ function Se(o, e, t, r, i) {
|
|
|
685
697
|
});
|
|
686
698
|
return;
|
|
687
699
|
}
|
|
688
|
-
this._attributes.merge(".", a), Object.keys(a).forEach((
|
|
700
|
+
this._attributes.merge(".", a), Object.keys(a).forEach((l) => this.updateChangedKeys(l)), this.dispatchChangeEvent(a);
|
|
689
701
|
}
|
|
690
702
|
dump() {
|
|
691
|
-
|
|
703
|
+
t.info({
|
|
692
704
|
...this.toJson(),
|
|
693
705
|
[Symbol.toStringTag]: y.studly(i)
|
|
694
706
|
});
|
|
695
707
|
}
|
|
696
708
|
toJson() {
|
|
697
|
-
const s = Object.entries(this.relations).reduce((a, [
|
|
709
|
+
const s = Object.entries(this.relations).reduce((a, [l, d]) => (d.isLoaded() && (d.isSingle() ? a[y.snake(l)] = d.getLoadedItems().toJson() : d.isMultiple() && (a[y.snake(l)] = d.getLoadedItems().map((v) => v.toJson()).all())), a), {}), n = e[`model${y.studly(i)}Json`];
|
|
698
710
|
if (typeof n != "function")
|
|
699
711
|
throw new $("ModelFacade");
|
|
700
|
-
return n.bind(
|
|
712
|
+
return n.bind(e)({
|
|
701
713
|
...this.attributes,
|
|
702
714
|
...s
|
|
703
715
|
}, this);
|
|
@@ -740,13 +752,13 @@ function Se(o, e, t, r, i) {
|
|
|
740
752
|
];
|
|
741
753
|
}
|
|
742
754
|
getLabel() {
|
|
743
|
-
const { labeledBy: s } =
|
|
755
|
+
const { labeledBy: s } = e.schema(i);
|
|
744
756
|
return this.getAttribute(s);
|
|
745
757
|
}
|
|
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,
|
|
@@ -758,10 +770,10 @@ function Se(o, e, t, r, i) {
|
|
|
758
770
|
try {
|
|
759
771
|
const {
|
|
760
772
|
additionalPayload: a = {},
|
|
761
|
-
sendsOnlyModifiedFields:
|
|
773
|
+
sendsOnlyModifiedFields: l = !0
|
|
762
774
|
} = s, d = this.exists, v = {
|
|
763
775
|
...p.pick(
|
|
764
|
-
|
|
776
|
+
l && d ? this.diff() : this.attributes,
|
|
765
777
|
...this.fillable
|
|
766
778
|
),
|
|
767
779
|
...a
|
|
@@ -770,7 +782,7 @@ function Se(o, e, t, r, i) {
|
|
|
770
782
|
return;
|
|
771
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
788
|
return f.throw(), this.makeAttributes(f.json()), this.exists = !0, this.dispatchSaveEvent(), d ? this.dispatchUpdateEvent(f.json()) : (this.wasRecentlyCreated = !0, this.dispatchCreateEvent(f.json())), f;
|
|
@@ -779,7 +791,7 @@ function Se(o, e, t, r, i) {
|
|
|
779
791
|
}
|
|
780
792
|
}
|
|
781
793
|
async push() {
|
|
782
|
-
throw new
|
|
794
|
+
throw new Re();
|
|
783
795
|
}
|
|
784
796
|
async delete() {
|
|
785
797
|
try {
|
|
@@ -797,7 +809,7 @@ function Se(o, e, t, r, i) {
|
|
|
797
809
|
try {
|
|
798
810
|
const a = await r.call(
|
|
799
811
|
this.getRouteForUpdate(),
|
|
800
|
-
(
|
|
812
|
+
(l) => n ? n(l.withData(s)) : l.withData(s),
|
|
801
813
|
this.getErrorBag("update")
|
|
802
814
|
);
|
|
803
815
|
a.throw(), this.makeAttributes(a.json()), this.dispatchUpdateEvent(a.json());
|
|
@@ -834,11 +846,11 @@ function Se(o, e, t, r, i) {
|
|
|
834
846
|
return i;
|
|
835
847
|
}
|
|
836
848
|
static getSchema() {
|
|
837
|
-
return
|
|
849
|
+
return e.schema(i);
|
|
838
850
|
}
|
|
839
851
|
static query() {
|
|
840
|
-
return new
|
|
841
|
-
{ config: o, route: r, model:
|
|
852
|
+
return new Se(
|
|
853
|
+
{ config: o, route: r, model: e },
|
|
842
854
|
i
|
|
843
855
|
);
|
|
844
856
|
}
|
|
@@ -879,57 +891,57 @@ function Se(o, e, t, r, i) {
|
|
|
879
891
|
return this.query().first();
|
|
880
892
|
}
|
|
881
893
|
static async create(s) {
|
|
882
|
-
const n =
|
|
894
|
+
const n = e.make(i), a = new n();
|
|
883
895
|
return a.fill(s), await a.save(), a;
|
|
884
896
|
}
|
|
885
897
|
static async update(s, n) {
|
|
886
|
-
const a =
|
|
887
|
-
return
|
|
898
|
+
const a = e.make(i), l = new a({ id: s });
|
|
899
|
+
return l.fill(n), l.exists = !0, await l.save(), l;
|
|
888
900
|
}
|
|
889
901
|
static delete(s) {
|
|
890
902
|
if (Array.isArray(s))
|
|
891
903
|
return r.call(
|
|
892
904
|
`luminix.${i}.destroyMany`,
|
|
893
|
-
(
|
|
905
|
+
(l) => l.withQueryParameters({ ids: s }),
|
|
894
906
|
`${i}.deleteMany`
|
|
895
907
|
);
|
|
896
|
-
const n =
|
|
908
|
+
const n = e.make(i);
|
|
897
909
|
return new n({ id: s }).delete();
|
|
898
910
|
}
|
|
899
911
|
static async restore(s) {
|
|
900
912
|
if (Array.isArray(s))
|
|
901
913
|
return r.call(
|
|
902
914
|
`luminix.${i}.restoreMany`,
|
|
903
|
-
(
|
|
915
|
+
(l) => l.withData({ ids: s }),
|
|
904
916
|
`${i}.restoreMany`
|
|
905
917
|
);
|
|
906
|
-
const n =
|
|
918
|
+
const n = e.make(i);
|
|
907
919
|
return new n({ id: s }).restore();
|
|
908
920
|
}
|
|
909
921
|
static forceDelete(s) {
|
|
910
922
|
if (Array.isArray(s))
|
|
911
923
|
return r.call(
|
|
912
924
|
`luminix.${i}.destroyMany`,
|
|
913
|
-
(
|
|
925
|
+
(l) => l.withQueryParameters({ ids: s, force: !0 }),
|
|
914
926
|
`${i}.forceDeleteMany`
|
|
915
927
|
);
|
|
916
|
-
const n =
|
|
928
|
+
const n = e.make(i);
|
|
917
929
|
return new n({ id: s }).forceDelete();
|
|
918
930
|
}
|
|
919
931
|
static singular() {
|
|
920
|
-
return
|
|
932
|
+
return e.schema(i).displayName.singular;
|
|
921
933
|
}
|
|
922
934
|
static plural() {
|
|
923
|
-
return
|
|
935
|
+
return e.schema(i).displayName.plural;
|
|
924
936
|
}
|
|
925
937
|
}, g(c, "name", y.studly(i)), c;
|
|
926
938
|
}
|
|
927
|
-
function
|
|
939
|
+
function Ae(o, t, e) {
|
|
928
940
|
var r, i;
|
|
929
|
-
return class extends (i =
|
|
941
|
+
return class extends (i = e, r = Symbol.toStringTag, i) {
|
|
930
942
|
constructor(m = {}) {
|
|
931
943
|
super(m);
|
|
932
|
-
g(this, r, y.studly(
|
|
944
|
+
g(this, r, y.studly(t));
|
|
933
945
|
return new Proxy(this, {
|
|
934
946
|
get: (c, u) => {
|
|
935
947
|
if (u === "__isModel")
|
|
@@ -958,25 +970,25 @@ function _e(o, e, t) {
|
|
|
958
970
|
}
|
|
959
971
|
};
|
|
960
972
|
}
|
|
961
|
-
var
|
|
962
|
-
class q extends (
|
|
963
|
-
constructor(
|
|
964
|
-
super(`[Luminix] Model "${
|
|
965
|
-
g(this,
|
|
973
|
+
var z, X;
|
|
974
|
+
class q extends (X = Error, z = Symbol.toStringTag, X) {
|
|
975
|
+
constructor(e) {
|
|
976
|
+
super(`[Luminix] Model "${e}" not found`);
|
|
977
|
+
g(this, z, "ModelNotFoundException");
|
|
966
978
|
}
|
|
967
979
|
}
|
|
968
|
-
var
|
|
969
|
-
class R extends (
|
|
970
|
-
constructor(
|
|
971
|
-
super(`[Luminix] "${
|
|
972
|
-
g(this,
|
|
980
|
+
var Y, Z;
|
|
981
|
+
class R extends (Z = TypeError, Y = Symbol.toStringTag, Z) {
|
|
982
|
+
constructor(e, r, i) {
|
|
983
|
+
super(`[Luminix] "${e}" expects a related model of type "${r}". Received "${i}" instead.`);
|
|
984
|
+
g(this, Y, "ModelInvalidRelatedTypeException");
|
|
973
985
|
}
|
|
974
986
|
}
|
|
975
|
-
class
|
|
976
|
-
constructor(
|
|
987
|
+
class he extends N {
|
|
988
|
+
constructor(t, e, r, i = null) {
|
|
977
989
|
if (!p.isModel(i) && i !== null)
|
|
978
990
|
throw new w("BelongsTo.constructor()", "Model or null");
|
|
979
|
-
super(
|
|
991
|
+
super(t, e, r, i), this.services = t, this.meta = e, this.parent = r, this.items = i;
|
|
980
992
|
}
|
|
981
993
|
isSingle() {
|
|
982
994
|
return !0;
|
|
@@ -985,21 +997,21 @@ class ae extends N {
|
|
|
985
997
|
return !1;
|
|
986
998
|
}
|
|
987
999
|
query() {
|
|
988
|
-
const
|
|
989
|
-
return
|
|
1000
|
+
const t = super.query(), e = this.guessInverseRelation();
|
|
1001
|
+
return t.where(e, this.parent.getKey()), t.lock(`where.${e}`), t;
|
|
990
1002
|
}
|
|
991
1003
|
get() {
|
|
992
1004
|
return this.query().first();
|
|
993
1005
|
}
|
|
994
|
-
async associate(
|
|
995
|
-
if (!p.isModel(
|
|
1006
|
+
async associate(t) {
|
|
1007
|
+
if (!p.isModel(t))
|
|
996
1008
|
throw new w("BelongsTo.associate()");
|
|
997
|
-
if (
|
|
998
|
-
throw new R("BelongsTo.associate()", this.getRelated().getSchemaName(),
|
|
999
|
-
if (!
|
|
1000
|
-
throw new
|
|
1009
|
+
if (t.getType() !== this.getRelated().getSchemaName())
|
|
1010
|
+
throw new R("BelongsTo.associate()", this.getRelated().getSchemaName(), t.getType());
|
|
1011
|
+
if (!t.exists)
|
|
1012
|
+
throw new ue(this.getRelated().getSchemaName(), "save");
|
|
1001
1013
|
return this.parent.update({
|
|
1002
|
-
[this.getForeignKey()]:
|
|
1014
|
+
[this.getForeignKey()]: t.getKey()
|
|
1003
1015
|
});
|
|
1004
1016
|
}
|
|
1005
1017
|
dissociate() {
|
|
@@ -1008,11 +1020,11 @@ class ae extends N {
|
|
|
1008
1020
|
});
|
|
1009
1021
|
}
|
|
1010
1022
|
}
|
|
1011
|
-
class
|
|
1012
|
-
constructor(
|
|
1023
|
+
class le extends N {
|
|
1024
|
+
constructor(t, e, r, i = null) {
|
|
1013
1025
|
if (i !== null && !(i instanceof b && i.every(p.isModel)))
|
|
1014
1026
|
throw new w("BelongsToMany.constructor()", "Collection<Model> or null");
|
|
1015
|
-
super(
|
|
1027
|
+
super(t, e, r, i), this.services = t, this.meta = e, this.parent = r, this.items = i;
|
|
1016
1028
|
}
|
|
1017
1029
|
isSingle() {
|
|
1018
1030
|
return !1;
|
|
@@ -1021,11 +1033,11 @@ class ue extends N {
|
|
|
1021
1033
|
return !0;
|
|
1022
1034
|
}
|
|
1023
1035
|
query() {
|
|
1024
|
-
const
|
|
1025
|
-
return
|
|
1036
|
+
const t = super.query(), e = this.guessInverseRelation();
|
|
1037
|
+
return t.where(e, this.parent.getKey()), t.lock(`where.${e}`), t;
|
|
1026
1038
|
}
|
|
1027
|
-
get(
|
|
1028
|
-
return this.query().get(
|
|
1039
|
+
get(t) {
|
|
1040
|
+
return this.query().get(t);
|
|
1029
1041
|
}
|
|
1030
1042
|
all() {
|
|
1031
1043
|
return this.query().all();
|
|
@@ -1033,34 +1045,34 @@ class ue extends N {
|
|
|
1033
1045
|
first() {
|
|
1034
1046
|
return this.query().first();
|
|
1035
1047
|
}
|
|
1036
|
-
find(
|
|
1037
|
-
return this.query().find(
|
|
1048
|
+
find(t) {
|
|
1049
|
+
return this.query().find(t);
|
|
1038
1050
|
}
|
|
1039
|
-
attachQuietly(
|
|
1051
|
+
attachQuietly(t, e = {}) {
|
|
1040
1052
|
return this.services.route.call([
|
|
1041
1053
|
`luminix.${this.parent.getType()}.${this.getName()}:attach`,
|
|
1042
1054
|
{
|
|
1043
1055
|
[this.parent.getKeyName()]: this.parent.getKey(),
|
|
1044
|
-
itemId:
|
|
1056
|
+
itemId: t
|
|
1045
1057
|
}
|
|
1046
|
-
], (r) => r.withData(
|
|
1058
|
+
], (r) => r.withData(e));
|
|
1047
1059
|
}
|
|
1048
|
-
async attach(
|
|
1049
|
-
if (await this.attachQuietly(
|
|
1050
|
-
const r = this.items.search((
|
|
1060
|
+
async attach(t, e = {}) {
|
|
1061
|
+
if (await this.attachQuietly(t, e), this.items) {
|
|
1062
|
+
const r = this.items.search((h) => h.getKey() === t), i = await this.getRelated().find(t);
|
|
1051
1063
|
if (!i)
|
|
1052
1064
|
return;
|
|
1053
1065
|
r !== !1 ? this.items.put(r, i) : this.items.push(i);
|
|
1054
1066
|
} else
|
|
1055
1067
|
this.items = await this.all();
|
|
1056
1068
|
}
|
|
1057
|
-
async detachQuietly(
|
|
1069
|
+
async detachQuietly(t) {
|
|
1058
1070
|
await this.services.route.call(
|
|
1059
1071
|
[
|
|
1060
1072
|
`luminix.${this.parent.getType()}.${this.getName()}:detach`,
|
|
1061
1073
|
{
|
|
1062
1074
|
[this.parent.getKeyName()]: this.parent.getKey(),
|
|
1063
|
-
itemId:
|
|
1075
|
+
itemId: t
|
|
1064
1076
|
}
|
|
1065
1077
|
]
|
|
1066
1078
|
// {
|
|
@@ -1068,60 +1080,60 @@ class ue extends N {
|
|
|
1068
1080
|
// }
|
|
1069
1081
|
);
|
|
1070
1082
|
}
|
|
1071
|
-
async detach(
|
|
1072
|
-
if (await this.detachQuietly(
|
|
1073
|
-
const
|
|
1074
|
-
|
|
1083
|
+
async detach(t) {
|
|
1084
|
+
if (await this.detachQuietly(t), this.items) {
|
|
1085
|
+
const e = this.items.search((r) => r.getKey() === t);
|
|
1086
|
+
e !== !1 && this.items.pull(e);
|
|
1075
1087
|
}
|
|
1076
1088
|
}
|
|
1077
|
-
async syncQuietly(
|
|
1089
|
+
async syncQuietly(t) {
|
|
1078
1090
|
await this.services.route.call([
|
|
1079
1091
|
`luminix.${this.parent.getType()}.${this.getName()}:sync`,
|
|
1080
1092
|
{
|
|
1081
1093
|
[this.parent.getKeyName()]: this.parent.getKey()
|
|
1082
1094
|
}
|
|
1083
|
-
], (
|
|
1095
|
+
], (e) => e.withData(t));
|
|
1084
1096
|
}
|
|
1085
|
-
async sync(
|
|
1086
|
-
await this.syncQuietly(
|
|
1087
|
-
const
|
|
1088
|
-
this.items ? this.items.splice(0, this.items.count(), ...
|
|
1097
|
+
async sync(t) {
|
|
1098
|
+
await this.syncQuietly(t);
|
|
1099
|
+
const e = await this.all();
|
|
1100
|
+
this.items ? this.items.splice(0, this.items.count(), ...e) : this.items = e;
|
|
1089
1101
|
}
|
|
1090
|
-
async syncWithPivotValuesQuietly(
|
|
1102
|
+
async syncWithPivotValuesQuietly(t, e) {
|
|
1091
1103
|
await this.services.route.call([
|
|
1092
1104
|
`luminix.${this.parent.getType()}.${this.getName()}:sync`,
|
|
1093
1105
|
{
|
|
1094
1106
|
[this.parent.getKeyName()]: this.parent.getKey()
|
|
1095
1107
|
}
|
|
1096
|
-
], (r) => r.withData(
|
|
1108
|
+
], (r) => r.withData(t.map((i) => ({
|
|
1097
1109
|
[this.getRelated().getSchema().primaryKey]: i,
|
|
1098
|
-
...
|
|
1110
|
+
...e
|
|
1099
1111
|
}))));
|
|
1100
1112
|
}
|
|
1101
|
-
async syncWithPivotValues(
|
|
1102
|
-
await this.syncWithPivotValuesQuietly(
|
|
1113
|
+
async syncWithPivotValues(t, e) {
|
|
1114
|
+
await this.syncWithPivotValuesQuietly(t, e);
|
|
1103
1115
|
const r = await this.all();
|
|
1104
1116
|
this.items ? this.items.splice(0, this.items.count(), ...r) : this.items = r;
|
|
1105
1117
|
}
|
|
1106
1118
|
}
|
|
1107
|
-
class
|
|
1119
|
+
class k extends N {
|
|
1108
1120
|
query() {
|
|
1109
|
-
const
|
|
1110
|
-
return
|
|
1121
|
+
const t = super.query(), e = this.guessInverseRelation();
|
|
1122
|
+
return t.where(e, this.parent.getKey()), t.lock(`where.${e}`), t;
|
|
1111
1123
|
}
|
|
1112
|
-
async saveQuietly(
|
|
1113
|
-
if (!p.isModel(
|
|
1124
|
+
async saveQuietly(t) {
|
|
1125
|
+
if (!p.isModel(t))
|
|
1114
1126
|
throw new w("HasOneOrMany.saveQuietly()");
|
|
1115
|
-
if (
|
|
1116
|
-
throw new R("HasOneOrMany.saveQuietly()", this.getRelated().getSchemaName(),
|
|
1117
|
-
|
|
1127
|
+
if (t.getType() !== this.getRelated().getSchemaName())
|
|
1128
|
+
throw new R("HasOneOrMany.saveQuietly()", this.getRelated().getSchemaName(), t.getType());
|
|
1129
|
+
t.setAttribute(this.getForeignKey(), this.parent.getKey()), await t.save();
|
|
1118
1130
|
}
|
|
1119
1131
|
}
|
|
1120
|
-
class
|
|
1121
|
-
constructor(
|
|
1132
|
+
class ke extends k {
|
|
1133
|
+
constructor(t, e, r, i = null) {
|
|
1122
1134
|
if (!p.isModel(i) && i !== null)
|
|
1123
1135
|
throw new w("HasOne.constructor()", "Model or null");
|
|
1124
|
-
super(
|
|
1136
|
+
super(t, e, r, i), this.services = t, this.meta = e, this.parent = r, this.items = i;
|
|
1125
1137
|
}
|
|
1126
1138
|
isSingle() {
|
|
1127
1139
|
return !0;
|
|
@@ -1132,18 +1144,18 @@ class Re extends A {
|
|
|
1132
1144
|
get() {
|
|
1133
1145
|
return this.query().first();
|
|
1134
1146
|
}
|
|
1135
|
-
async save(
|
|
1136
|
-
await this.saveQuietly(
|
|
1147
|
+
async save(t) {
|
|
1148
|
+
await this.saveQuietly(t), this.items = t;
|
|
1137
1149
|
}
|
|
1138
1150
|
}
|
|
1139
1151
|
function K(o) {
|
|
1140
1152
|
return new b(o);
|
|
1141
1153
|
}
|
|
1142
|
-
class
|
|
1143
|
-
constructor(
|
|
1154
|
+
class qe extends k {
|
|
1155
|
+
constructor(t, e, r, i = null) {
|
|
1144
1156
|
if (i !== null && !(i instanceof b && i.every(p.isModel)))
|
|
1145
1157
|
throw new w("HasMany.constructor()", "Collection<Model> or null");
|
|
1146
|
-
super(
|
|
1158
|
+
super(t, e, r, i), this.services = t, this.meta = e, this.parent = r, this.items = i;
|
|
1147
1159
|
}
|
|
1148
1160
|
isSingle() {
|
|
1149
1161
|
return !1;
|
|
@@ -1151,8 +1163,8 @@ class Ne extends A {
|
|
|
1151
1163
|
isMultiple() {
|
|
1152
1164
|
return !0;
|
|
1153
1165
|
}
|
|
1154
|
-
get(
|
|
1155
|
-
return this.query().get(
|
|
1166
|
+
get(t) {
|
|
1167
|
+
return this.query().get(t);
|
|
1156
1168
|
}
|
|
1157
1169
|
all() {
|
|
1158
1170
|
return this.query().all();
|
|
@@ -1160,46 +1172,46 @@ class Ne extends A {
|
|
|
1160
1172
|
first() {
|
|
1161
1173
|
return this.query().first();
|
|
1162
1174
|
}
|
|
1163
|
-
find(
|
|
1164
|
-
return this.query().find(
|
|
1175
|
+
find(t) {
|
|
1176
|
+
return this.query().find(t);
|
|
1165
1177
|
}
|
|
1166
|
-
async saveManyQuietly(
|
|
1167
|
-
if (!Array.isArray(
|
|
1178
|
+
async saveManyQuietly(t) {
|
|
1179
|
+
if (!Array.isArray(t) || !t.every(p.isModel))
|
|
1168
1180
|
throw new w("HasMany.saveManyQuietly()", "Model[]");
|
|
1169
|
-
if (!
|
|
1170
|
-
throw new R("HasMany.saveManyQuietly()", this.getRelated().getSchemaName(),
|
|
1171
|
-
await Promise.all(
|
|
1181
|
+
if (!t.every((e) => e.getType() === this.getRelated().getSchemaName()))
|
|
1182
|
+
throw new R("HasMany.saveManyQuietly()", this.getRelated().getSchemaName(), t.map((e) => e.getType()).join(", "));
|
|
1183
|
+
await Promise.all(t.map((e) => (e.setAttribute(this.getForeignKey(), this.parent.getKey()), e.save())));
|
|
1172
1184
|
}
|
|
1173
|
-
async saveMany(
|
|
1174
|
-
await this.saveManyQuietly(
|
|
1185
|
+
async saveMany(t) {
|
|
1186
|
+
await this.saveManyQuietly(t), this.items ? this.items.splice(0, this.items.count(), ...t) : this.items = K(t);
|
|
1175
1187
|
}
|
|
1176
|
-
async save(
|
|
1177
|
-
await this.saveQuietly(
|
|
1188
|
+
async save(t) {
|
|
1189
|
+
await this.saveQuietly(t), this.items === null ? this.items = K([t]) : this.items.push(t);
|
|
1178
1190
|
}
|
|
1179
1191
|
}
|
|
1180
|
-
class
|
|
1192
|
+
class ce extends k {
|
|
1181
1193
|
query() {
|
|
1182
|
-
const
|
|
1183
|
-
|
|
1194
|
+
const t = this.getRelated().query();
|
|
1195
|
+
t.once("success", (r) => {
|
|
1184
1196
|
this.items = r.items;
|
|
1185
1197
|
});
|
|
1186
|
-
const
|
|
1187
|
-
return
|
|
1198
|
+
const e = this.guessInverseRelation();
|
|
1199
|
+
return t.where(e + "_id", this.parent.getKey()), t.where(e + "_type", this.getRelated().getSchemaName()), t.lock(`where.${e}_id`), t.lock(`where.${e}_type`), t;
|
|
1188
1200
|
}
|
|
1189
|
-
async saveQuietly(
|
|
1190
|
-
if (!p.isModel(
|
|
1201
|
+
async saveQuietly(t) {
|
|
1202
|
+
if (!p.isModel(t))
|
|
1191
1203
|
throw new w("MorphOneOrMany.saveQuietly()");
|
|
1192
|
-
if (
|
|
1193
|
-
throw new R("MorphOneOrMany.saveQuietly()", this.getRelated().getSchemaName(),
|
|
1194
|
-
const
|
|
1195
|
-
|
|
1204
|
+
if (t.getType() !== this.getRelated().getSchemaName())
|
|
1205
|
+
throw new R("MorphOneOrMany.saveQuietly()", this.getRelated().getSchemaName(), t.getType());
|
|
1206
|
+
const e = this.guessInverseRelation();
|
|
1207
|
+
t.setAttribute(e + "_id", this.parent.getKey()), t.setAttribute(e + "_type", this.parent.getType()), await t.save();
|
|
1196
1208
|
}
|
|
1197
1209
|
}
|
|
1198
|
-
class
|
|
1199
|
-
constructor(
|
|
1210
|
+
class Ke extends ce {
|
|
1211
|
+
constructor(t, e, r, i = null) {
|
|
1200
1212
|
if (i !== null && !(i instanceof b && i.every(p.isModel)))
|
|
1201
1213
|
throw new w("MorphMany.constructor()", "Collection<Model> or null");
|
|
1202
|
-
super(
|
|
1214
|
+
super(t, e, r, i), this.services = t, this.meta = e, this.parent = r, this.items = i;
|
|
1203
1215
|
}
|
|
1204
1216
|
isSingle() {
|
|
1205
1217
|
return !1;
|
|
@@ -1207,8 +1219,8 @@ class ke extends he {
|
|
|
1207
1219
|
isMultiple() {
|
|
1208
1220
|
return !0;
|
|
1209
1221
|
}
|
|
1210
|
-
get(
|
|
1211
|
-
return this.query().get(
|
|
1222
|
+
get(t) {
|
|
1223
|
+
return this.query().get(t);
|
|
1212
1224
|
}
|
|
1213
1225
|
all() {
|
|
1214
1226
|
return this.query().all();
|
|
@@ -1216,28 +1228,28 @@ class ke extends he {
|
|
|
1216
1228
|
first() {
|
|
1217
1229
|
return this.query().first();
|
|
1218
1230
|
}
|
|
1219
|
-
find(
|
|
1220
|
-
return this.query().find(
|
|
1231
|
+
find(t) {
|
|
1232
|
+
return this.query().find(t);
|
|
1221
1233
|
}
|
|
1222
|
-
async saveManyQuietly(
|
|
1223
|
-
if (!Array.isArray(
|
|
1234
|
+
async saveManyQuietly(t) {
|
|
1235
|
+
if (!Array.isArray(t) || !t.every(p.isModel))
|
|
1224
1236
|
throw new w("MorphMany.saveManyQuietly()");
|
|
1225
|
-
if (!
|
|
1226
|
-
throw new R("MorphMany.saveManyQuietly()", this.getRelated().getSchemaName(),
|
|
1227
|
-
await Promise.all(
|
|
1237
|
+
if (!t.every((e) => e.getType() === this.getRelated().getSchemaName()))
|
|
1238
|
+
throw new R("MorphMany.saveManyQuietly()", this.getRelated().getSchemaName(), t.map((e) => e.getType()).join(", "));
|
|
1239
|
+
await Promise.all(t.map((e) => (e.setAttribute(this.getName() + "_id", this.parent.getKey()), e.setAttribute(this.getName() + "_type", this.parent.getType()), e.save())));
|
|
1228
1240
|
}
|
|
1229
|
-
async saveMany(
|
|
1230
|
-
await this.saveManyQuietly(
|
|
1231
|
-
const
|
|
1232
|
-
this.items ? this.items.splice(0, this.items.count(), ...
|
|
1241
|
+
async saveMany(t) {
|
|
1242
|
+
await this.saveManyQuietly(t);
|
|
1243
|
+
const e = await this.all();
|
|
1244
|
+
this.items ? this.items.splice(0, this.items.count(), ...e) : this.items = e;
|
|
1233
1245
|
}
|
|
1234
|
-
async save(
|
|
1235
|
-
await this.saveQuietly(
|
|
1246
|
+
async save(t) {
|
|
1247
|
+
await this.saveQuietly(t), this.items ? this.items.push(t) : this.items = await this.all();
|
|
1236
1248
|
}
|
|
1237
1249
|
}
|
|
1238
|
-
class
|
|
1239
|
-
constructor(
|
|
1240
|
-
if (super(
|
|
1250
|
+
class Oe extends ce {
|
|
1251
|
+
constructor(t, e, r, i = null) {
|
|
1252
|
+
if (super(t, e, r, i), this.services = t, this.meta = e, this.parent = r, this.items = i, i !== null && !p.isModel(i))
|
|
1241
1253
|
throw new w("MorphOne.constructor()", "Model or null");
|
|
1242
1254
|
}
|
|
1243
1255
|
isSingle() {
|
|
@@ -1249,11 +1261,11 @@ class Ae extends he {
|
|
|
1249
1261
|
get() {
|
|
1250
1262
|
return this.query().first();
|
|
1251
1263
|
}
|
|
1252
|
-
async save(
|
|
1253
|
-
await this.saveQuietly(
|
|
1264
|
+
async save(t) {
|
|
1265
|
+
await this.saveQuietly(t), this.items = t;
|
|
1254
1266
|
}
|
|
1255
1267
|
}
|
|
1256
|
-
class
|
|
1268
|
+
class je extends he {
|
|
1257
1269
|
getRelated() {
|
|
1258
1270
|
return this.services.model.make(
|
|
1259
1271
|
this.parent.getAttribute(this.getName() + "_type")
|
|
@@ -1267,12 +1279,12 @@ class qe extends ae {
|
|
|
1267
1279
|
// this.of(this.parent.getAttribute(this.getName() + '_type') as string);
|
|
1268
1280
|
// return super.query();
|
|
1269
1281
|
// }
|
|
1270
|
-
async associate(
|
|
1271
|
-
if (!p.isModel(
|
|
1282
|
+
async associate(t) {
|
|
1283
|
+
if (!p.isModel(t))
|
|
1272
1284
|
throw new w("MorphTo.associate()");
|
|
1273
|
-
return
|
|
1274
|
-
[this.getName() + "_id"]:
|
|
1275
|
-
[this.getName() + "_type"]:
|
|
1285
|
+
return t.exists || await t.save(), this.parent.update({
|
|
1286
|
+
[this.getName() + "_id"]: t.getKey(),
|
|
1287
|
+
[this.getName() + "_type"]: t.getType()
|
|
1276
1288
|
});
|
|
1277
1289
|
}
|
|
1278
1290
|
dissociate() {
|
|
@@ -1282,133 +1294,128 @@ class qe extends ae {
|
|
|
1282
1294
|
});
|
|
1283
1295
|
}
|
|
1284
1296
|
}
|
|
1285
|
-
class
|
|
1286
|
-
query() {
|
|
1287
|
-
var r;
|
|
1288
|
-
const e = super.query(), t = `${(r = this.meta.morphType) == null ? void 0 : r.slice(0, -5)}_id`;
|
|
1289
|
-
return e.where(t, this.parent.getKey()), e.where(this.meta.morphType, this.parent.getType()), e.lock(`where.${t}`), e.lock(`where.${this.meta.morphType}`), e;
|
|
1290
|
-
}
|
|
1297
|
+
class Be extends le {
|
|
1291
1298
|
}
|
|
1292
|
-
var
|
|
1293
|
-
class
|
|
1294
|
-
constructor(
|
|
1299
|
+
var ee, te;
|
|
1300
|
+
class Ce extends (te = A, ee = Symbol.toStringTag, te) {
|
|
1301
|
+
constructor(e) {
|
|
1295
1302
|
super();
|
|
1296
1303
|
g(this, "_models", {});
|
|
1297
|
-
g(this,
|
|
1298
|
-
this._schema =
|
|
1304
|
+
g(this, ee, "ModelService");
|
|
1305
|
+
this._schema = e;
|
|
1299
1306
|
}
|
|
1300
|
-
boot(
|
|
1307
|
+
boot(e) {
|
|
1301
1308
|
this._schema && Object.keys(this._schema).forEach((r) => {
|
|
1302
|
-
const i = this[`model${y.studly(r)}`],
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1309
|
+
const i = this[`model${y.studly(r)}`], h = this.model(
|
|
1310
|
+
Ne(
|
|
1311
|
+
e.make("config"),
|
|
1312
|
+
e.make("log"),
|
|
1313
|
+
e.make("model"),
|
|
1314
|
+
e.make("route"),
|
|
1308
1315
|
r
|
|
1309
1316
|
),
|
|
1310
1317
|
r
|
|
1311
|
-
), m = i(
|
|
1312
|
-
this._models[r] =
|
|
1318
|
+
), m = i(h);
|
|
1319
|
+
this._models[r] = Ae(e.make("model"), r, m);
|
|
1313
1320
|
});
|
|
1314
1321
|
}
|
|
1315
|
-
schema(
|
|
1316
|
-
if (!this._schema ||
|
|
1317
|
-
throw new q(
|
|
1318
|
-
return
|
|
1322
|
+
schema(e) {
|
|
1323
|
+
if (!this._schema || e && !this._schema[e])
|
|
1324
|
+
throw new q(e || "undefined");
|
|
1325
|
+
return e ? this._schema[e] : this._schema;
|
|
1319
1326
|
}
|
|
1320
|
-
make(
|
|
1321
|
-
if (
|
|
1322
|
-
throw new q(
|
|
1323
|
-
return
|
|
1327
|
+
make(e) {
|
|
1328
|
+
if (e && !this._models[e])
|
|
1329
|
+
throw new q(e);
|
|
1330
|
+
return e ? this._models[e] : this._models;
|
|
1324
1331
|
}
|
|
1325
|
-
getRelationConstructors(
|
|
1332
|
+
getRelationConstructors(e) {
|
|
1326
1333
|
return this.relationMap({
|
|
1327
|
-
BelongsTo:
|
|
1328
|
-
BelongsToMany:
|
|
1329
|
-
HasOne:
|
|
1330
|
-
HasMany:
|
|
1331
|
-
MorphMany:
|
|
1332
|
-
MorphOne:
|
|
1333
|
-
MorphTo:
|
|
1334
|
-
MorphToMany:
|
|
1335
|
-
},
|
|
1334
|
+
BelongsTo: he,
|
|
1335
|
+
BelongsToMany: le,
|
|
1336
|
+
HasOne: ke,
|
|
1337
|
+
HasMany: qe,
|
|
1338
|
+
MorphMany: Ke,
|
|
1339
|
+
MorphOne: Oe,
|
|
1340
|
+
MorphTo: je,
|
|
1341
|
+
MorphToMany: Be
|
|
1342
|
+
}, e);
|
|
1336
1343
|
}
|
|
1337
1344
|
toString() {
|
|
1338
1345
|
return "model";
|
|
1339
1346
|
}
|
|
1340
1347
|
}
|
|
1341
|
-
const
|
|
1342
|
-
var
|
|
1343
|
-
class
|
|
1344
|
-
constructor(
|
|
1345
|
-
super(`[Luminix] Route "${
|
|
1346
|
-
g(this,
|
|
1348
|
+
const Qe = oe(Ce);
|
|
1349
|
+
var se, ie;
|
|
1350
|
+
class Ie extends (ie = Error, se = Symbol.toStringTag, ie) {
|
|
1351
|
+
constructor(e) {
|
|
1352
|
+
super(`[Luminix] Route "${e}" not found`);
|
|
1353
|
+
g(this, se, "RouteNotFoundException");
|
|
1347
1354
|
}
|
|
1348
1355
|
}
|
|
1349
|
-
class
|
|
1350
|
-
constructor(
|
|
1351
|
-
this.routes =
|
|
1356
|
+
class Pe {
|
|
1357
|
+
constructor(t, e, r, i = "") {
|
|
1358
|
+
this.routes = t, this.error = e, this.http = r, this.appUrl = i;
|
|
1352
1359
|
}
|
|
1353
|
-
isRouteTuple(
|
|
1354
|
-
if (!Array.isArray(
|
|
1360
|
+
isRouteTuple(t) {
|
|
1361
|
+
if (!Array.isArray(t) || t.length < 2)
|
|
1355
1362
|
return !1;
|
|
1356
|
-
const [
|
|
1357
|
-
if (typeof
|
|
1363
|
+
const [e, ...r] = t;
|
|
1364
|
+
if (typeof e != "string")
|
|
1358
1365
|
return !1;
|
|
1359
1366
|
const i = ["get", "post", "put", "patch", "delete"];
|
|
1360
|
-
return !!r.every((
|
|
1367
|
+
return !!r.every((h) => i.includes(h));
|
|
1361
1368
|
}
|
|
1362
|
-
extractGenerator(
|
|
1363
|
-
let
|
|
1364
|
-
return Array.isArray(
|
|
1369
|
+
extractGenerator(t) {
|
|
1370
|
+
let e, r = !1;
|
|
1371
|
+
return Array.isArray(t) ? [e, r] = t : e = t, [e, r];
|
|
1365
1372
|
}
|
|
1366
|
-
get(
|
|
1367
|
-
if (!this.exists(
|
|
1368
|
-
throw new
|
|
1369
|
-
return p.get(this.routes,
|
|
1373
|
+
get(t) {
|
|
1374
|
+
if (!this.exists(t))
|
|
1375
|
+
throw new Ie(t);
|
|
1376
|
+
return p.get(this.routes, t);
|
|
1370
1377
|
}
|
|
1371
|
-
url(
|
|
1372
|
-
return this.appUrl + this.path(
|
|
1378
|
+
url(t) {
|
|
1379
|
+
return this.appUrl + this.path(t);
|
|
1373
1380
|
}
|
|
1374
|
-
path(
|
|
1375
|
-
const [
|
|
1381
|
+
path(t) {
|
|
1382
|
+
const [e, r] = this.extractGenerator(t), i = this.get(e)[0].replace(/^\/|\/$/g, ""), h = /{([^}]+)}/g;
|
|
1376
1383
|
if (r === !1) {
|
|
1377
1384
|
if (typeof this.replaceRouteParams != "function")
|
|
1378
1385
|
throw new $("RouteFacade");
|
|
1379
1386
|
return this.replaceRouteParams(`/${i}`);
|
|
1380
1387
|
}
|
|
1381
|
-
const m = i.match(
|
|
1388
|
+
const m = i.match(h), c = m ? m.map((l) => l.slice(1, -1)) : [], u = Object.keys(r), s = c.filter((l) => !u.includes(l)), n = u.filter((l) => !c.includes(l));
|
|
1382
1389
|
if (s.length > 0)
|
|
1383
1390
|
throw new TypeError(`Missing values for parameter(s): ${s.join(", ")}`);
|
|
1384
1391
|
if (n.length > 0)
|
|
1385
1392
|
throw new TypeError(`Unexpected parameters: ${n.join(", ")}`);
|
|
1386
|
-
return `/${c.reduce((
|
|
1393
|
+
return `/${c.reduce((l, d) => l.replace(`{${d}}`, `${r[d]}`), i)}`;
|
|
1387
1394
|
}
|
|
1388
|
-
methods(
|
|
1389
|
-
const [
|
|
1390
|
-
return this.get(
|
|
1395
|
+
methods(t) {
|
|
1396
|
+
const [e] = this.extractGenerator(t);
|
|
1397
|
+
return this.get(e).slice(1);
|
|
1391
1398
|
}
|
|
1392
|
-
exists(
|
|
1393
|
-
return p.has(this.routes,
|
|
1399
|
+
exists(t) {
|
|
1400
|
+
return p.has(this.routes, t) && this.isRouteTuple(p.get(this.routes, t));
|
|
1394
1401
|
}
|
|
1395
1402
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1396
|
-
async call(
|
|
1403
|
+
async call(t, e = (i) => i, r = "default") {
|
|
1397
1404
|
if (typeof this.clientOptions != "function" || typeof this.clientError != "function")
|
|
1398
1405
|
throw new $("RouteFacade");
|
|
1399
|
-
const [i,
|
|
1406
|
+
const [i, h] = this.extractGenerator(t), [, ...m] = this.get(i), c = this.url(h ? [i, h] : i), u = e(this.http()), s = this.clientOptions({}, i);
|
|
1400
1407
|
p.isEmpty(s) || u.withOptions(s);
|
|
1401
1408
|
const n = m[0] ?? s.method;
|
|
1402
1409
|
this.error.clear(r);
|
|
1403
1410
|
const a = await u[n](c);
|
|
1404
|
-
if (
|
|
1405
|
-
const
|
|
1406
|
-
this.error.set(Object.entries(
|
|
1411
|
+
if (ye(a)) {
|
|
1412
|
+
const l = a.json("errors");
|
|
1413
|
+
this.error.set(Object.entries(l).reduce((d, [v, f]) => (d[v] = f.join(" "), d), {}), r);
|
|
1407
1414
|
} else a.failed() && this.error.set(
|
|
1408
1415
|
this.clientError({ axios: a.json("message") }, {
|
|
1409
1416
|
response: a,
|
|
1410
1417
|
name: i,
|
|
1411
|
-
replace:
|
|
1418
|
+
replace: h,
|
|
1412
1419
|
client: u
|
|
1413
1420
|
}),
|
|
1414
1421
|
r
|
|
@@ -1419,68 +1426,68 @@ class Ce {
|
|
|
1419
1426
|
return "route";
|
|
1420
1427
|
}
|
|
1421
1428
|
}
|
|
1422
|
-
const
|
|
1423
|
-
class
|
|
1429
|
+
const Le = oe(Pe);
|
|
1430
|
+
class De {
|
|
1424
1431
|
getClient() {
|
|
1425
|
-
return new
|
|
1432
|
+
return new fe();
|
|
1426
1433
|
}
|
|
1427
|
-
baseUrl(
|
|
1428
|
-
return this.getClient().baseUrl(
|
|
1434
|
+
baseUrl(t) {
|
|
1435
|
+
return this.getClient().baseUrl(t);
|
|
1429
1436
|
}
|
|
1430
1437
|
asForm() {
|
|
1431
1438
|
return this.getClient().asForm();
|
|
1432
1439
|
}
|
|
1433
|
-
accept(
|
|
1434
|
-
return this.getClient().accept(
|
|
1440
|
+
accept(t) {
|
|
1441
|
+
return this.getClient().accept(t);
|
|
1435
1442
|
}
|
|
1436
1443
|
acceptJson() {
|
|
1437
1444
|
return this.getClient().acceptJson();
|
|
1438
1445
|
}
|
|
1439
|
-
withHeaders(
|
|
1440
|
-
return this.getClient().withHeaders(
|
|
1446
|
+
withHeaders(t) {
|
|
1447
|
+
return this.getClient().withHeaders(t);
|
|
1441
1448
|
}
|
|
1442
|
-
withOptions(
|
|
1443
|
-
return this.getClient().withOptions(
|
|
1449
|
+
withOptions(t) {
|
|
1450
|
+
return this.getClient().withOptions(t);
|
|
1444
1451
|
}
|
|
1445
|
-
withData(
|
|
1446
|
-
return this.getClient().withData(
|
|
1452
|
+
withData(t) {
|
|
1453
|
+
return this.getClient().withData(t);
|
|
1447
1454
|
}
|
|
1448
|
-
withQueryParameters(
|
|
1449
|
-
return this.getClient().withQueryParameters(
|
|
1455
|
+
withQueryParameters(t) {
|
|
1456
|
+
return this.getClient().withQueryParameters(t);
|
|
1450
1457
|
}
|
|
1451
|
-
withBasicAuth(
|
|
1452
|
-
return this.getClient().withBasicAuth(
|
|
1458
|
+
withBasicAuth(t, e) {
|
|
1459
|
+
return this.getClient().withBasicAuth(t, e);
|
|
1453
1460
|
}
|
|
1454
|
-
withToken(
|
|
1455
|
-
return this.getClient().withToken(
|
|
1461
|
+
withToken(t) {
|
|
1462
|
+
return this.getClient().withToken(t);
|
|
1456
1463
|
}
|
|
1457
1464
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1458
|
-
get(
|
|
1459
|
-
return this.getClient().get(
|
|
1465
|
+
get(t, e) {
|
|
1466
|
+
return this.getClient().get(t, e);
|
|
1460
1467
|
}
|
|
1461
1468
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1462
|
-
post(
|
|
1463
|
-
return this.getClient().post(
|
|
1469
|
+
post(t, e) {
|
|
1470
|
+
return this.getClient().post(t, e);
|
|
1464
1471
|
}
|
|
1465
1472
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1466
|
-
put(
|
|
1467
|
-
return this.getClient().put(
|
|
1473
|
+
put(t, e) {
|
|
1474
|
+
return this.getClient().put(t, e);
|
|
1468
1475
|
}
|
|
1469
1476
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1470
|
-
patch(
|
|
1471
|
-
return this.getClient().patch(
|
|
1477
|
+
patch(t, e) {
|
|
1478
|
+
return this.getClient().patch(t, e);
|
|
1472
1479
|
}
|
|
1473
1480
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1474
|
-
delete(
|
|
1475
|
-
return this.getClient().delete(
|
|
1481
|
+
delete(t, e) {
|
|
1482
|
+
return this.getClient().delete(t, e);
|
|
1476
1483
|
}
|
|
1477
1484
|
}
|
|
1478
|
-
const
|
|
1479
|
-
var
|
|
1480
|
-
class
|
|
1485
|
+
const He = ae(De);
|
|
1486
|
+
var re, ne;
|
|
1487
|
+
class Je extends (ne = we, re = Symbol.toStringTag, ne) {
|
|
1481
1488
|
constructor() {
|
|
1482
1489
|
super(...arguments);
|
|
1483
|
-
g(this,
|
|
1490
|
+
g(this, re, "LuminixServiceProvider");
|
|
1484
1491
|
}
|
|
1485
1492
|
register() {
|
|
1486
1493
|
this.registerServices(), this.registerMacros(), this.app.on("ready", () => {
|
|
@@ -1491,25 +1498,25 @@ class Le extends (ie = ye, se = Symbol.toStringTag, ie) {
|
|
|
1491
1498
|
this.app.make("model").boot(this.app);
|
|
1492
1499
|
}
|
|
1493
1500
|
registerServices() {
|
|
1494
|
-
this.app.singleton("auth", () => new
|
|
1501
|
+
this.app.singleton("auth", () => new be(
|
|
1495
1502
|
this.app.make("config"),
|
|
1496
1503
|
this.app.make("model"),
|
|
1497
1504
|
this.app.make("route")
|
|
1498
1505
|
)), this.app.singleton("config", () => {
|
|
1499
|
-
const
|
|
1500
|
-
return
|
|
1501
|
-
}), this.app.singleton("error", () => new
|
|
1502
|
-
var
|
|
1503
|
-
return new
|
|
1506
|
+
const e = new _(p.omit(this.app.configuration, "manifest"));
|
|
1507
|
+
return e.has("auth.user") || e.set("auth.user", null), e.lock("auth.user"), e;
|
|
1508
|
+
}), this.app.singleton("error", () => new xe()), this.app.singleton("http", () => new He()), this.app.singleton("log", () => {
|
|
1509
|
+
var e;
|
|
1510
|
+
return new Me(((e = this.app.configuration.app) == null ? void 0 : e.debug) ?? !1);
|
|
1504
1511
|
}), this.app.singleton("model", () => {
|
|
1505
|
-
var
|
|
1506
|
-
return new
|
|
1507
|
-
((
|
|
1512
|
+
var e;
|
|
1513
|
+
return new Qe(
|
|
1514
|
+
((e = this.app.configuration.manifest) == null ? void 0 : e.models) ?? {}
|
|
1508
1515
|
);
|
|
1509
1516
|
}), this.app.singleton("route", () => {
|
|
1510
|
-
var
|
|
1511
|
-
return new
|
|
1512
|
-
((
|
|
1517
|
+
var e, r;
|
|
1518
|
+
return new Le(
|
|
1519
|
+
((e = this.app.configuration.manifest) == null ? void 0 : e.routes) ?? {},
|
|
1513
1520
|
this.app.make("error"),
|
|
1514
1521
|
() => this.app.make("http").getClient(),
|
|
1515
1522
|
(r = this.app.configuration.app) == null ? void 0 : r.url
|
|
@@ -1517,110 +1524,110 @@ class Le extends (ie = ye, se = Symbol.toStringTag, ie) {
|
|
|
1517
1524
|
});
|
|
1518
1525
|
}
|
|
1519
1526
|
registerMacros() {
|
|
1520
|
-
this.app.macro("environment", (...
|
|
1521
|
-
return typeof
|
|
1527
|
+
this.app.macro("environment", (...e) => e.length > 0 ? e.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"), p.macro("isModel", function(e) {
|
|
1528
|
+
return typeof e == "object" && e !== null && e.__isModel === !0;
|
|
1522
1529
|
});
|
|
1523
1530
|
}
|
|
1524
1531
|
}
|
|
1525
|
-
class
|
|
1532
|
+
class Ue {
|
|
1526
1533
|
constructor() {
|
|
1527
1534
|
g(this, "app");
|
|
1528
1535
|
}
|
|
1529
1536
|
getFacadeAccessor() {
|
|
1530
|
-
return this.app || (this.app = new (
|
|
1531
|
-
|
|
1537
|
+
return this.app || (this.app = new (ae(ve))([
|
|
1538
|
+
Je
|
|
1532
1539
|
])), this.app;
|
|
1533
1540
|
}
|
|
1534
1541
|
down() {
|
|
1535
1542
|
this.app && (this.app.flush(), delete this.app);
|
|
1536
1543
|
}
|
|
1537
|
-
setInstance(
|
|
1538
|
-
this.down(), this.app =
|
|
1544
|
+
setInstance(t) {
|
|
1545
|
+
this.down(), this.app = t;
|
|
1539
1546
|
}
|
|
1540
1547
|
}
|
|
1541
|
-
const x = M(
|
|
1548
|
+
const x = M(Ue);
|
|
1542
1549
|
function E(o = void 0) {
|
|
1543
1550
|
return typeof o != "string" ? x : x.make(o);
|
|
1544
1551
|
}
|
|
1545
|
-
function
|
|
1552
|
+
function tt() {
|
|
1546
1553
|
return E("auth");
|
|
1547
1554
|
}
|
|
1548
|
-
function
|
|
1549
|
-
const
|
|
1550
|
-
return typeof o > "u" ?
|
|
1555
|
+
function st(o, t) {
|
|
1556
|
+
const e = E("config");
|
|
1557
|
+
return typeof o > "u" ? e : e.get(o, t);
|
|
1551
1558
|
}
|
|
1552
|
-
function
|
|
1553
|
-
return o ? E().make("error").get(o,
|
|
1559
|
+
function it(o, t = "default") {
|
|
1560
|
+
return o ? E().make("error").get(o, t) : E().make("error");
|
|
1554
1561
|
}
|
|
1555
|
-
function
|
|
1556
|
-
const
|
|
1557
|
-
return o.length ?
|
|
1562
|
+
function rt(...o) {
|
|
1563
|
+
const t = E("log");
|
|
1564
|
+
return o.length ? t.debug(...o) : t;
|
|
1558
1565
|
}
|
|
1559
|
-
function
|
|
1560
|
-
const
|
|
1561
|
-
return o ?
|
|
1566
|
+
function nt(o) {
|
|
1567
|
+
const t = E("model");
|
|
1568
|
+
return o ? t.make(o) : t;
|
|
1562
1569
|
}
|
|
1563
|
-
function
|
|
1564
|
-
const
|
|
1565
|
-
return o ?
|
|
1570
|
+
function ot(o, t = !1) {
|
|
1571
|
+
const e = E("route");
|
|
1572
|
+
return o ? t ? e.url([o, t]) : e.url(o) : e;
|
|
1566
1573
|
}
|
|
1567
|
-
class
|
|
1574
|
+
class Fe {
|
|
1568
1575
|
getFacadeAccessor() {
|
|
1569
1576
|
return "auth";
|
|
1570
1577
|
}
|
|
1571
1578
|
}
|
|
1572
|
-
const
|
|
1573
|
-
class
|
|
1579
|
+
const at = M(Fe, x);
|
|
1580
|
+
class We {
|
|
1574
1581
|
getFacadeAccessor() {
|
|
1575
1582
|
return "config";
|
|
1576
1583
|
}
|
|
1577
1584
|
}
|
|
1578
|
-
const
|
|
1579
|
-
class
|
|
1585
|
+
const ut = M(We, x);
|
|
1586
|
+
class Ge {
|
|
1580
1587
|
getFacadeAccessor() {
|
|
1581
1588
|
return "error";
|
|
1582
1589
|
}
|
|
1583
1590
|
}
|
|
1584
|
-
const
|
|
1585
|
-
class
|
|
1591
|
+
const ht = M(Ge, x);
|
|
1592
|
+
class Ve {
|
|
1586
1593
|
getFacadeAccessor() {
|
|
1587
1594
|
return "http";
|
|
1588
1595
|
}
|
|
1589
1596
|
}
|
|
1590
|
-
const
|
|
1591
|
-
class
|
|
1597
|
+
const lt = M(Ve, x);
|
|
1598
|
+
class ze {
|
|
1592
1599
|
getFacadeAccessor() {
|
|
1593
1600
|
return "log";
|
|
1594
1601
|
}
|
|
1595
1602
|
}
|
|
1596
|
-
const
|
|
1597
|
-
class
|
|
1603
|
+
const ct = M(ze, x);
|
|
1604
|
+
class Xe {
|
|
1598
1605
|
getFacadeAccessor() {
|
|
1599
1606
|
return "model";
|
|
1600
1607
|
}
|
|
1601
1608
|
}
|
|
1602
|
-
const
|
|
1603
|
-
class
|
|
1609
|
+
const dt = M(Xe, x);
|
|
1610
|
+
class Ye {
|
|
1604
1611
|
getFacadeAccessor() {
|
|
1605
1612
|
return "route";
|
|
1606
1613
|
}
|
|
1607
1614
|
}
|
|
1608
|
-
const
|
|
1615
|
+
const pt = M(Ye, x);
|
|
1609
1616
|
export {
|
|
1610
1617
|
x as App,
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
+
at as Auth,
|
|
1619
|
+
ut as Config,
|
|
1620
|
+
ht as Error,
|
|
1621
|
+
lt as Http,
|
|
1622
|
+
ct as Log,
|
|
1623
|
+
dt as Model,
|
|
1624
|
+
pt as Route,
|
|
1618
1625
|
E as app,
|
|
1619
|
-
|
|
1626
|
+
tt as auth,
|
|
1620
1627
|
K as collect,
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1628
|
+
st as config,
|
|
1629
|
+
it as error,
|
|
1630
|
+
rt as log,
|
|
1631
|
+
nt as model,
|
|
1632
|
+
ot as route
|
|
1626
1633
|
};
|