@luminix/core 0.3.1 → 0.3.3
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 +116 -116
- package/package.json +1 -1
- package/types/services/RouteService.d.ts +1 -0
package/dist/core.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var p = (o, t, e) =>
|
|
4
|
-
import { reader as
|
|
5
|
-
class
|
|
1
|
+
var le = Object.defineProperty;
|
|
2
|
+
var ce = (o, t, e) => t in o ? le(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
|
|
3
|
+
var p = (o, t, e) => ce(o, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { reader as de, PropertyBag as _, EventSource as A, Collection as b, Query as S, Obj as d, Str as m, Reducible as ie, isValidationError as pe, Macroable as ne, Client as ge, ServiceProvider as ye, MakeFacade as M, Application as me, Response as fe } from "@luminix/support";
|
|
5
|
+
class we {
|
|
6
6
|
constructor(t, e, i) {
|
|
7
7
|
p(this, "_user");
|
|
8
8
|
this.config = t, this.model = e, this.route = i;
|
|
@@ -51,13 +51,13 @@ class fe {
|
|
|
51
51
|
return ((t = this.user()) == null ? void 0 : t.getKey()) || null;
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
class
|
|
54
|
+
class ve {
|
|
55
55
|
constructor() {
|
|
56
56
|
p(this, "bags");
|
|
57
57
|
const t = {};
|
|
58
58
|
document.querySelectorAll('#luminix-embed [id^="luminix-error"]').forEach((i) => {
|
|
59
59
|
const c = i.id.replace("luminix-error::", "");
|
|
60
|
-
t[c] =
|
|
60
|
+
t[c] = de(c, "error");
|
|
61
61
|
}), this.bags = {
|
|
62
62
|
default: new _(t)
|
|
63
63
|
};
|
|
@@ -81,7 +81,7 @@ class we {
|
|
|
81
81
|
this.bag(t).set(".", {});
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
class
|
|
84
|
+
class be {
|
|
85
85
|
constructor(t) {
|
|
86
86
|
this._debug = t;
|
|
87
87
|
}
|
|
@@ -110,14 +110,14 @@ class ve {
|
|
|
110
110
|
this._debug && console.debug(...t);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
var
|
|
114
|
-
class
|
|
113
|
+
var j, O;
|
|
114
|
+
class xe extends (O = Error, j = Symbol.toStringTag, O) {
|
|
115
115
|
constructor(e) {
|
|
116
116
|
super(`[Luminix] Model "${e}" does not have a primary key`);
|
|
117
|
-
p(this,
|
|
117
|
+
p(this, j, "ModelWithoutPrimaryKeyException");
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
-
class
|
|
120
|
+
class Me extends A {
|
|
121
121
|
constructor(e, i, s = {}) {
|
|
122
122
|
super();
|
|
123
123
|
p(this, "bag");
|
|
@@ -262,7 +262,7 @@ class xe extends A {
|
|
|
262
262
|
async find(e) {
|
|
263
263
|
const i = this.services.model.schema(this.abstract).primaryKey;
|
|
264
264
|
if (!i)
|
|
265
|
-
throw new
|
|
265
|
+
throw new xe(this.abstract);
|
|
266
266
|
const s = await this.where(i, e).limit(1).exec(1);
|
|
267
267
|
return this.emit("success", {
|
|
268
268
|
response: s,
|
|
@@ -289,25 +289,25 @@ class xe extends A {
|
|
|
289
289
|
}), l;
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
|
-
var
|
|
293
|
-
class f extends (
|
|
292
|
+
var B, C;
|
|
293
|
+
class f extends (C = TypeError, B = Symbol.toStringTag, C) {
|
|
294
294
|
constructor(e, i = "Model") {
|
|
295
295
|
super(`[Luminix] "${e}" expects ${i}`);
|
|
296
|
-
p(this,
|
|
296
|
+
p(this, B, "NotModelException");
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
|
-
var
|
|
300
|
-
class
|
|
299
|
+
var P, I;
|
|
300
|
+
class Ee extends (I = Error, P = Symbol.toStringTag, I) {
|
|
301
301
|
constructor(e, i, s, c) {
|
|
302
302
|
super(`[Luminix] Could not determine inverse relation for "${i}" in model "${e}". Please specify a relation in model "${s}" of type ${c} that points back to "${e}".`);
|
|
303
|
-
p(this,
|
|
303
|
+
p(this, P, "NoInverseRelationException");
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
|
-
var
|
|
307
|
-
class
|
|
306
|
+
var Q, D;
|
|
307
|
+
class $e extends (D = Error, Q = Symbol.toStringTag, D) {
|
|
308
308
|
constructor(e) {
|
|
309
309
|
super(`[Luminix] Relation "${e}" is not supported`);
|
|
310
|
-
p(this,
|
|
310
|
+
p(this, Q, "UnsupportedRelationException");
|
|
311
311
|
}
|
|
312
312
|
}
|
|
313
313
|
class R {
|
|
@@ -345,13 +345,13 @@ class R {
|
|
|
345
345
|
MorphToMany: ["MorphToMany"]
|
|
346
346
|
}, this.parent, e, this.getRelated());
|
|
347
347
|
if (!(e in i))
|
|
348
|
-
throw new
|
|
348
|
+
throw new $e(e);
|
|
349
349
|
for (const s in t) {
|
|
350
350
|
const c = t[s];
|
|
351
351
|
if ((c.model === this.parent.getType() || ["MorphOne", "MorphMany"].includes(e)) && i[e].includes(c.type))
|
|
352
352
|
return s;
|
|
353
353
|
}
|
|
354
|
-
throw new
|
|
354
|
+
throw new Ee(this.parent.getType(), e, this.getRelated().getSchemaName(), i[e].join(" or "));
|
|
355
355
|
}
|
|
356
356
|
set(t) {
|
|
357
357
|
if (t !== null && !d.isModel(t) && !(t instanceof b && t.every(d.isModel)))
|
|
@@ -434,28 +434,28 @@ class R {
|
|
|
434
434
|
// return this.query().find(id);
|
|
435
435
|
// }
|
|
436
436
|
}
|
|
437
|
-
var
|
|
438
|
-
class E extends (
|
|
437
|
+
var H, L;
|
|
438
|
+
class E extends (L = Error, H = Symbol.toStringTag, L) {
|
|
439
439
|
constructor(e) {
|
|
440
440
|
super(`[Luminix] Expected ${e} to be reducible.`);
|
|
441
|
-
p(this,
|
|
441
|
+
p(this, H, "NotReducibleException");
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
|
-
var
|
|
445
|
-
class
|
|
444
|
+
var J, U;
|
|
445
|
+
class Se extends (U = Error, J = Symbol.toStringTag, U) {
|
|
446
446
|
constructor() {
|
|
447
447
|
super("[Luminix] Method not implemented.");
|
|
448
|
-
p(this,
|
|
448
|
+
p(this, J, "MethodNotImplementedException");
|
|
449
449
|
}
|
|
450
450
|
}
|
|
451
|
-
var
|
|
452
|
-
class
|
|
451
|
+
var F, G;
|
|
452
|
+
class oe extends (G = Error, F = Symbol.toStringTag, G) {
|
|
453
453
|
constructor(e, i) {
|
|
454
454
|
super(`[Luminix] Model "${e}" must be persisted before calling "${i}"`);
|
|
455
|
-
p(this,
|
|
455
|
+
p(this, F, "ModelNotPersistedException");
|
|
456
456
|
}
|
|
457
457
|
}
|
|
458
|
-
function
|
|
458
|
+
function _e(o, t, e, i, s) {
|
|
459
459
|
var c, y, l;
|
|
460
460
|
return l = class extends (y = A, c = Symbol.toStringTag, y) {
|
|
461
461
|
constructor(r = {}) {
|
|
@@ -740,7 +740,7 @@ function Se(o, t, e, i, s) {
|
|
|
740
740
|
}
|
|
741
741
|
async refresh(r) {
|
|
742
742
|
if (!this.exists)
|
|
743
|
-
throw new
|
|
743
|
+
throw new oe(s, "refresh");
|
|
744
744
|
const n = await i.call(
|
|
745
745
|
this.getRouteForRefresh(),
|
|
746
746
|
r,
|
|
@@ -775,7 +775,7 @@ function Se(o, t, e, i, s) {
|
|
|
775
775
|
}
|
|
776
776
|
}
|
|
777
777
|
async push() {
|
|
778
|
-
throw new
|
|
778
|
+
throw new Se();
|
|
779
779
|
}
|
|
780
780
|
async delete() {
|
|
781
781
|
try {
|
|
@@ -842,7 +842,7 @@ function Se(o, t, e, i, s) {
|
|
|
842
842
|
return e.schema(s);
|
|
843
843
|
}
|
|
844
844
|
static query() {
|
|
845
|
-
return new
|
|
845
|
+
return new Me(
|
|
846
846
|
{ config: o, route: i, model: e },
|
|
847
847
|
s
|
|
848
848
|
);
|
|
@@ -929,7 +929,7 @@ function Se(o, t, e, i, s) {
|
|
|
929
929
|
}
|
|
930
930
|
}, p(l, "name", m.studly(s)), l;
|
|
931
931
|
}
|
|
932
|
-
function
|
|
932
|
+
function Te(o, t, e) {
|
|
933
933
|
var i, s;
|
|
934
934
|
return class extends (s = e, i = Symbol.toStringTag, s) {
|
|
935
935
|
constructor(y = {}) {
|
|
@@ -963,21 +963,21 @@ function _e(o, t, e) {
|
|
|
963
963
|
}
|
|
964
964
|
};
|
|
965
965
|
}
|
|
966
|
-
var
|
|
967
|
-
class K extends (
|
|
966
|
+
var V, W;
|
|
967
|
+
class K extends (W = Error, V = Symbol.toStringTag, W) {
|
|
968
968
|
constructor(e) {
|
|
969
969
|
super(`[Luminix] Model "${e}" not found`);
|
|
970
|
-
p(this,
|
|
970
|
+
p(this, V, "ModelNotFoundException");
|
|
971
971
|
}
|
|
972
972
|
}
|
|
973
|
-
var
|
|
974
|
-
class T extends (
|
|
973
|
+
var z, X;
|
|
974
|
+
class T extends (X = TypeError, z = Symbol.toStringTag, X) {
|
|
975
975
|
constructor(e, i, s) {
|
|
976
976
|
super(`[Luminix] "${e}" expects a related model of type "${i}". Received "${s}" instead.`);
|
|
977
|
-
p(this,
|
|
977
|
+
p(this, z, "ModelInvalidRelatedTypeException");
|
|
978
978
|
}
|
|
979
979
|
}
|
|
980
|
-
class
|
|
980
|
+
class ae extends R {
|
|
981
981
|
constructor(t, e, i, s = null) {
|
|
982
982
|
if (!d.isModel(s) && s !== null)
|
|
983
983
|
throw new f("BelongsTo.constructor()", "Model or null");
|
|
@@ -1002,7 +1002,7 @@ class oe extends R {
|
|
|
1002
1002
|
if (t.getType() !== this.getRelated().getSchemaName())
|
|
1003
1003
|
throw new T("BelongsTo.associate()", this.getRelated().getSchemaName(), t.getType());
|
|
1004
1004
|
if (!t.exists)
|
|
1005
|
-
throw new
|
|
1005
|
+
throw new oe(this.getRelated().getSchemaName(), "save");
|
|
1006
1006
|
return this.parent.update({
|
|
1007
1007
|
[this.getForeignKey()]: t.getKey()
|
|
1008
1008
|
});
|
|
@@ -1013,7 +1013,7 @@ class oe extends R {
|
|
|
1013
1013
|
});
|
|
1014
1014
|
}
|
|
1015
1015
|
}
|
|
1016
|
-
class
|
|
1016
|
+
class ue extends R {
|
|
1017
1017
|
constructor(t, e, i, s = null) {
|
|
1018
1018
|
if (s !== null && !(s instanceof b && s.every(d.isModel)))
|
|
1019
1019
|
throw new f("BelongsToMany.constructor()", "Collection<Model> or null");
|
|
@@ -1122,7 +1122,7 @@ class N extends R {
|
|
|
1122
1122
|
t.setAttribute(this.getForeignKey(), this.parent.getKey()), await t.save();
|
|
1123
1123
|
}
|
|
1124
1124
|
}
|
|
1125
|
-
class
|
|
1125
|
+
class Re extends N {
|
|
1126
1126
|
constructor(t, e, i, s = null) {
|
|
1127
1127
|
if (!d.isModel(s) && s !== null)
|
|
1128
1128
|
throw new f("HasOne.constructor()", "Model or null");
|
|
@@ -1141,7 +1141,10 @@ class Te extends N {
|
|
|
1141
1141
|
await this.saveQuietly(t), this.items = t;
|
|
1142
1142
|
}
|
|
1143
1143
|
}
|
|
1144
|
-
|
|
1144
|
+
function k(o) {
|
|
1145
|
+
return new b(o);
|
|
1146
|
+
}
|
|
1147
|
+
class Ae extends N {
|
|
1145
1148
|
constructor(t, e, i, s = null) {
|
|
1146
1149
|
if (s !== null && !(s instanceof b && s.every(d.isModel)))
|
|
1147
1150
|
throw new f("HasMany.constructor()", "Collection<Model> or null");
|
|
@@ -1173,15 +1176,13 @@ class Re extends N {
|
|
|
1173
1176
|
await Promise.all(t.map((e) => (e.setAttribute(this.getForeignKey(), this.parent.getKey()), e.save())));
|
|
1174
1177
|
}
|
|
1175
1178
|
async saveMany(t) {
|
|
1176
|
-
await this.saveManyQuietly(t);
|
|
1177
|
-
const e = await this.all();
|
|
1178
|
-
this.items ? this.items.splice(0, this.items.count(), ...e) : this.items = e;
|
|
1179
|
+
await this.saveManyQuietly(t), this.items ? this.items.splice(0, this.items.count(), ...t) : this.items = k(t);
|
|
1179
1180
|
}
|
|
1180
1181
|
async save(t) {
|
|
1181
|
-
await this.saveQuietly(t), this.items === null ? this.items =
|
|
1182
|
+
await this.saveQuietly(t), this.items === null ? this.items = k([t]) : this.items.push(t);
|
|
1182
1183
|
}
|
|
1183
1184
|
}
|
|
1184
|
-
class
|
|
1185
|
+
class he extends N {
|
|
1185
1186
|
query() {
|
|
1186
1187
|
const t = this.getRelated().query();
|
|
1187
1188
|
t.once("success", (i) => {
|
|
@@ -1199,7 +1200,7 @@ class ue extends N {
|
|
|
1199
1200
|
t.setAttribute(e + "_id", this.parent.getKey()), t.setAttribute(e + "_type", this.parent.getType()), await t.save();
|
|
1200
1201
|
}
|
|
1201
1202
|
}
|
|
1202
|
-
class
|
|
1203
|
+
class Ne extends he {
|
|
1203
1204
|
constructor(t, e, i, s = null) {
|
|
1204
1205
|
if (s !== null && !(s instanceof b && s.every(d.isModel)))
|
|
1205
1206
|
throw new f("MorphMany.constructor()", "Collection<Model> or null");
|
|
@@ -1239,7 +1240,7 @@ class Ae extends ue {
|
|
|
1239
1240
|
this.items ? this.items.splice(0, this.items.count(), ...e) : this.items = e;
|
|
1240
1241
|
}
|
|
1241
1242
|
}
|
|
1242
|
-
class
|
|
1243
|
+
class qe extends he {
|
|
1243
1244
|
constructor(t, e, i, s = null) {
|
|
1244
1245
|
if (super(t, e, i, s), this.services = t, this.meta = e, this.parent = i, this.items = s, s !== null && !d.isModel(s))
|
|
1245
1246
|
throw new f("MorphOne.constructor()", "Model or null");
|
|
@@ -1257,7 +1258,7 @@ class Ne extends ue {
|
|
|
1257
1258
|
await this.saveQuietly(t), this.items = t;
|
|
1258
1259
|
}
|
|
1259
1260
|
}
|
|
1260
|
-
class
|
|
1261
|
+
class Ke extends ae {
|
|
1261
1262
|
getRelated() {
|
|
1262
1263
|
return this.services.model.make(
|
|
1263
1264
|
this.parent.getAttribute(this.getName() + "_type")
|
|
@@ -1286,24 +1287,24 @@ class qe extends oe {
|
|
|
1286
1287
|
});
|
|
1287
1288
|
}
|
|
1288
1289
|
}
|
|
1289
|
-
class
|
|
1290
|
+
class ke extends ue {
|
|
1290
1291
|
query() {
|
|
1291
1292
|
const t = super.query(), e = this.guessInverseRelation();
|
|
1292
1293
|
return t.where(e + "_id", this.parent.getKey()), t.where(e + "_type", this.parent.getType()), t.lock(`where.${e}_id`), t.lock(`where.${e}_type`), t;
|
|
1293
1294
|
}
|
|
1294
1295
|
}
|
|
1295
|
-
var
|
|
1296
|
-
class
|
|
1296
|
+
var Y, Z;
|
|
1297
|
+
class je extends (Z = A, Y = Symbol.toStringTag, Z) {
|
|
1297
1298
|
constructor(e) {
|
|
1298
1299
|
super();
|
|
1299
1300
|
p(this, "_models", {});
|
|
1300
|
-
p(this,
|
|
1301
|
+
p(this, Y, "ModelService");
|
|
1301
1302
|
this._schema = e;
|
|
1302
1303
|
}
|
|
1303
1304
|
boot(e) {
|
|
1304
1305
|
this._schema && Object.keys(this._schema).forEach((i) => {
|
|
1305
1306
|
const s = this[`model${m.studly(i)}`], c = this.model(
|
|
1306
|
-
|
|
1307
|
+
_e(
|
|
1307
1308
|
e.make("config"),
|
|
1308
1309
|
e.make("log"),
|
|
1309
1310
|
e.make("model"),
|
|
@@ -1312,7 +1313,7 @@ class ke extends (Y = A, X = Symbol.toStringTag, Y) {
|
|
|
1312
1313
|
),
|
|
1313
1314
|
i
|
|
1314
1315
|
), y = s(c);
|
|
1315
|
-
this._models[i] =
|
|
1316
|
+
this._models[i] = Te(e.make("model"), i, y);
|
|
1316
1317
|
});
|
|
1317
1318
|
}
|
|
1318
1319
|
schema(e) {
|
|
@@ -1327,29 +1328,29 @@ class ke extends (Y = A, X = Symbol.toStringTag, Y) {
|
|
|
1327
1328
|
}
|
|
1328
1329
|
getRelationConstructors(e) {
|
|
1329
1330
|
return this.relationMap({
|
|
1330
|
-
BelongsTo:
|
|
1331
|
-
BelongsToMany:
|
|
1332
|
-
HasOne:
|
|
1333
|
-
HasMany:
|
|
1334
|
-
MorphMany:
|
|
1335
|
-
MorphOne:
|
|
1336
|
-
MorphTo:
|
|
1337
|
-
MorphToMany:
|
|
1331
|
+
BelongsTo: ae,
|
|
1332
|
+
BelongsToMany: ue,
|
|
1333
|
+
HasOne: Re,
|
|
1334
|
+
HasMany: Ae,
|
|
1335
|
+
MorphMany: Ne,
|
|
1336
|
+
MorphOne: qe,
|
|
1337
|
+
MorphTo: Ke,
|
|
1338
|
+
MorphToMany: ke
|
|
1338
1339
|
}, e);
|
|
1339
1340
|
}
|
|
1340
1341
|
toString() {
|
|
1341
1342
|
return "model";
|
|
1342
1343
|
}
|
|
1343
1344
|
}
|
|
1344
|
-
const
|
|
1345
|
-
var
|
|
1346
|
-
class
|
|
1345
|
+
const Oe = ie(je);
|
|
1346
|
+
var ee, te;
|
|
1347
|
+
class Be extends (te = Error, ee = Symbol.toStringTag, te) {
|
|
1347
1348
|
constructor(e) {
|
|
1348
1349
|
super(`[Luminix] Route "${e}" not found`);
|
|
1349
|
-
p(this,
|
|
1350
|
+
p(this, ee, "RouteNotFoundException");
|
|
1350
1351
|
}
|
|
1351
1352
|
}
|
|
1352
|
-
class
|
|
1353
|
+
class Ce {
|
|
1353
1354
|
constructor(t, e, i, s = "") {
|
|
1354
1355
|
this.routes = t, this.error = e, this.http = i, this.appUrl = s;
|
|
1355
1356
|
}
|
|
@@ -1368,23 +1369,25 @@ class Be {
|
|
|
1368
1369
|
}
|
|
1369
1370
|
get(t) {
|
|
1370
1371
|
if (!this.exists(t))
|
|
1371
|
-
throw new
|
|
1372
|
+
throw new Be(t);
|
|
1372
1373
|
return d.get(this.routes, t);
|
|
1373
1374
|
}
|
|
1374
1375
|
url(t) {
|
|
1376
|
+
return this.appUrl + this.path(t);
|
|
1377
|
+
}
|
|
1378
|
+
path(t) {
|
|
1375
1379
|
const [e, i] = this.extractGenerator(t), s = this.get(e)[0].replace(/^\/|\/$/g, ""), c = /{([^}]+)}/g;
|
|
1376
1380
|
if (i === !1) {
|
|
1377
1381
|
if (typeof this.replaceRouteParams != "function")
|
|
1378
1382
|
throw new E("RouteFacade");
|
|
1379
|
-
return this.
|
|
1383
|
+
return this.replaceRouteParams(`/${s}`);
|
|
1380
1384
|
}
|
|
1381
1385
|
const y = s.match(c), l = y ? y.map((h) => h.slice(1, -1)) : [], u = Object.keys(i), r = l.filter((h) => !u.includes(h)), n = u.filter((h) => !l.includes(h));
|
|
1382
1386
|
if (r.length > 0)
|
|
1383
1387
|
throw new TypeError(`Missing values for parameter(s): ${r.join(", ")}`);
|
|
1384
1388
|
if (n.length > 0)
|
|
1385
1389
|
throw new TypeError(`Unexpected parameters: ${n.join(", ")}`);
|
|
1386
|
-
|
|
1387
|
-
return this.appUrl + `/${a}`;
|
|
1390
|
+
return `/${l.reduce((h, g) => h.replace(`{${g}}`, `${i[g]}`), s)}`;
|
|
1388
1391
|
}
|
|
1389
1392
|
methods(t) {
|
|
1390
1393
|
const [e] = this.extractGenerator(t);
|
|
@@ -1402,7 +1405,7 @@ class Be {
|
|
|
1402
1405
|
const n = y[0] ?? r.method;
|
|
1403
1406
|
this.error.clear(i);
|
|
1404
1407
|
const a = await u[n](l);
|
|
1405
|
-
if (
|
|
1408
|
+
if (pe(a)) {
|
|
1406
1409
|
const h = a.json("errors");
|
|
1407
1410
|
this.error.set(Object.entries(h).reduce((g, [w, v]) => (g[w] = v.join(" "), g), {}), i);
|
|
1408
1411
|
} else a.failed() && this.error.set(
|
|
@@ -1420,10 +1423,10 @@ class Be {
|
|
|
1420
1423
|
return "route";
|
|
1421
1424
|
}
|
|
1422
1425
|
}
|
|
1423
|
-
const
|
|
1426
|
+
const Pe = ie(Ce);
|
|
1424
1427
|
class Ie {
|
|
1425
1428
|
getClient() {
|
|
1426
|
-
return new
|
|
1429
|
+
return new ge();
|
|
1427
1430
|
}
|
|
1428
1431
|
baseUrl(t) {
|
|
1429
1432
|
return this.getClient().baseUrl(t);
|
|
@@ -1476,12 +1479,12 @@ class Ie {
|
|
|
1476
1479
|
return this.getClient().delete(t, e);
|
|
1477
1480
|
}
|
|
1478
1481
|
}
|
|
1479
|
-
const
|
|
1480
|
-
var
|
|
1481
|
-
class
|
|
1482
|
+
const Qe = ne(Ie);
|
|
1483
|
+
var se, re;
|
|
1484
|
+
class De extends (re = ye, se = Symbol.toStringTag, re) {
|
|
1482
1485
|
constructor() {
|
|
1483
1486
|
super(...arguments);
|
|
1484
|
-
p(this,
|
|
1487
|
+
p(this, se, "LuminixServiceProvider");
|
|
1485
1488
|
}
|
|
1486
1489
|
register() {
|
|
1487
1490
|
this.registerServices(), this.registerMacros(), this.app.on("ready", () => {
|
|
@@ -1492,24 +1495,24 @@ class Qe extends (se = ge, te = Symbol.toStringTag, se) {
|
|
|
1492
1495
|
this.app.make("model").boot(this.app);
|
|
1493
1496
|
}
|
|
1494
1497
|
registerServices() {
|
|
1495
|
-
this.app.singleton("auth", () => new
|
|
1498
|
+
this.app.singleton("auth", () => new we(
|
|
1496
1499
|
this.app.make("config"),
|
|
1497
1500
|
this.app.make("model"),
|
|
1498
1501
|
this.app.make("route")
|
|
1499
1502
|
)), this.app.singleton("config", () => {
|
|
1500
1503
|
const e = new _(d.omit(this.app.configuration, "manifest"));
|
|
1501
1504
|
return e.has("auth.user") || e.set("auth.user", null), e.lock("auth.user"), e;
|
|
1502
|
-
}), this.app.singleton("error", () => new
|
|
1505
|
+
}), this.app.singleton("error", () => new ve()), this.app.singleton("http", () => new Qe()), this.app.singleton("log", () => {
|
|
1503
1506
|
var e;
|
|
1504
|
-
return new
|
|
1507
|
+
return new be(((e = this.app.configuration.app) == null ? void 0 : e.debug) ?? !1);
|
|
1505
1508
|
}), this.app.singleton("model", () => {
|
|
1506
1509
|
var e;
|
|
1507
|
-
return new
|
|
1510
|
+
return new Oe(
|
|
1508
1511
|
((e = this.app.configuration.manifest) == null ? void 0 : e.models) ?? {}
|
|
1509
1512
|
);
|
|
1510
1513
|
}), this.app.singleton("route", () => {
|
|
1511
1514
|
var e, i;
|
|
1512
|
-
return new
|
|
1515
|
+
return new Pe(
|
|
1513
1516
|
((e = this.app.configuration.manifest) == null ? void 0 : e.routes) ?? {},
|
|
1514
1517
|
this.app.make("error"),
|
|
1515
1518
|
() => this.app.make("http"),
|
|
@@ -1523,29 +1526,26 @@ class Qe extends (se = ge, te = Symbol.toStringTag, se) {
|
|
|
1523
1526
|
});
|
|
1524
1527
|
}
|
|
1525
1528
|
}
|
|
1526
|
-
class
|
|
1529
|
+
class He {
|
|
1527
1530
|
constructor() {
|
|
1528
1531
|
p(this, "app");
|
|
1529
1532
|
}
|
|
1530
1533
|
getFacadeAccessor() {
|
|
1531
|
-
return this.app || (this.app = new (
|
|
1532
|
-
|
|
1534
|
+
return this.app || (this.app = new (ne(me))([
|
|
1535
|
+
De
|
|
1533
1536
|
])), this.app;
|
|
1534
1537
|
}
|
|
1535
1538
|
down() {
|
|
1536
1539
|
this.app && (this.app.flush(), delete this.app);
|
|
1537
1540
|
}
|
|
1538
1541
|
}
|
|
1539
|
-
const x = M(
|
|
1542
|
+
const x = M(He);
|
|
1540
1543
|
function $(o = void 0) {
|
|
1541
1544
|
return typeof o != "string" ? x : x.make(o);
|
|
1542
1545
|
}
|
|
1543
|
-
function
|
|
1546
|
+
function Ye() {
|
|
1544
1547
|
return $("auth");
|
|
1545
1548
|
}
|
|
1546
|
-
function Ye(o) {
|
|
1547
|
-
return new b(o);
|
|
1548
|
-
}
|
|
1549
1549
|
function Ze(o, t) {
|
|
1550
1550
|
const e = $("config");
|
|
1551
1551
|
return typeof o > "u" ? e : e.get(o, t);
|
|
@@ -1565,48 +1565,48 @@ function rt(o, t = !1) {
|
|
|
1565
1565
|
const e = $("route");
|
|
1566
1566
|
return o ? t ? e.url([o, t]) : e.url(o) : e;
|
|
1567
1567
|
}
|
|
1568
|
-
class
|
|
1568
|
+
class Le {
|
|
1569
1569
|
getFacadeAccessor() {
|
|
1570
1570
|
return "auth";
|
|
1571
1571
|
}
|
|
1572
1572
|
}
|
|
1573
|
-
const it = M(
|
|
1574
|
-
class
|
|
1573
|
+
const it = M(Le, x);
|
|
1574
|
+
class Je {
|
|
1575
1575
|
getFacadeAccessor() {
|
|
1576
1576
|
return "config";
|
|
1577
1577
|
}
|
|
1578
1578
|
}
|
|
1579
|
-
const nt = M(
|
|
1580
|
-
class
|
|
1579
|
+
const nt = M(Je, x), ot = (o) => o instanceof fe && o.unprocessableEntity() && typeof o.json("message") == "string" && typeof o.json("errors") == "object" && o.json("errors") !== null && Object.values(o.json("errors")).every((t) => Array.isArray(t) && t.every((e) => typeof e == "string"));
|
|
1580
|
+
class Ue {
|
|
1581
1581
|
getFacadeAccessor() {
|
|
1582
1582
|
return "error";
|
|
1583
1583
|
}
|
|
1584
1584
|
}
|
|
1585
|
-
const at = M(
|
|
1586
|
-
class
|
|
1585
|
+
const at = M(Ue, x);
|
|
1586
|
+
class Fe {
|
|
1587
1587
|
getFacadeAccessor() {
|
|
1588
1588
|
return "http";
|
|
1589
1589
|
}
|
|
1590
1590
|
}
|
|
1591
|
-
const ut = M(
|
|
1592
|
-
class
|
|
1591
|
+
const ut = M(Fe, x);
|
|
1592
|
+
class Ge {
|
|
1593
1593
|
getFacadeAccessor() {
|
|
1594
1594
|
return "log";
|
|
1595
1595
|
}
|
|
1596
1596
|
}
|
|
1597
|
-
const ht = M(
|
|
1598
|
-
class
|
|
1597
|
+
const ht = M(Ge, x);
|
|
1598
|
+
class Ve {
|
|
1599
1599
|
getFacadeAccessor() {
|
|
1600
1600
|
return "model";
|
|
1601
1601
|
}
|
|
1602
1602
|
}
|
|
1603
|
-
const lt = M(
|
|
1604
|
-
class
|
|
1603
|
+
const lt = M(Ve, x);
|
|
1604
|
+
class We {
|
|
1605
1605
|
getFacadeAccessor() {
|
|
1606
1606
|
return "route";
|
|
1607
1607
|
}
|
|
1608
1608
|
}
|
|
1609
|
-
const ct = M(
|
|
1609
|
+
const ct = M(We, x);
|
|
1610
1610
|
class dt {
|
|
1611
1611
|
constructor() {
|
|
1612
1612
|
p(this, "name");
|
|
@@ -1628,8 +1628,8 @@ export {
|
|
|
1628
1628
|
dt as Plugin,
|
|
1629
1629
|
ct as Route,
|
|
1630
1630
|
$ as app,
|
|
1631
|
-
|
|
1632
|
-
|
|
1631
|
+
Ye as auth,
|
|
1632
|
+
k as collect,
|
|
1633
1633
|
Ze as config,
|
|
1634
1634
|
et as error,
|
|
1635
1635
|
ot as isValidationError,
|
package/package.json
CHANGED
|
@@ -11,6 +11,7 @@ export declare class RouteService {
|
|
|
11
11
|
private extractGenerator;
|
|
12
12
|
get(name: string): RouteTuple;
|
|
13
13
|
url(generator: RouteGenerator): string;
|
|
14
|
+
path(generator: RouteGenerator): string;
|
|
14
15
|
methods(generator: RouteGenerator): HttpMethod[];
|
|
15
16
|
exists(name: string): boolean;
|
|
16
17
|
call<TResponse = any>(generator: RouteGenerator, tap?: (client: Client) => Client, errorBag?: string): Promise<Response<TResponse>>;
|