pinia-orm-edge 1.10.2-28925154.307285d → 1.10.2-28995605.45f5631

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.
Files changed (51) hide show
  1. package/dist/casts.cjs +1 -1
  2. package/dist/casts.d.cts +1 -1
  3. package/dist/casts.d.mts +1 -1
  4. package/dist/casts.d.ts +1 -1
  5. package/dist/casts.mjs +1 -1
  6. package/dist/decorators.d.cts +2 -2
  7. package/dist/decorators.d.mts +2 -2
  8. package/dist/decorators.d.ts +2 -2
  9. package/dist/helpers.cjs +1 -1
  10. package/dist/helpers.d.cts +1 -1
  11. package/dist/helpers.d.mts +1 -1
  12. package/dist/helpers.d.ts +1 -1
  13. package/dist/helpers.mjs +1 -1
  14. package/dist/index.cjs +470 -623
  15. package/dist/index.d.cts +2 -2
  16. package/dist/index.d.mts +2 -2
  17. package/dist/index.d.ts +2 -2
  18. package/dist/index.mjs +470 -623
  19. package/dist/nanoid/async.cjs +2 -8
  20. package/dist/nanoid/async.d.cts +1 -1
  21. package/dist/nanoid/async.d.mts +1 -1
  22. package/dist/nanoid/async.d.ts +1 -1
  23. package/dist/nanoid/async.mjs +2 -8
  24. package/dist/nanoid/index.cjs +2 -8
  25. package/dist/nanoid/index.d.cts +1 -1
  26. package/dist/nanoid/index.d.mts +1 -1
  27. package/dist/nanoid/index.d.ts +1 -1
  28. package/dist/nanoid/index.mjs +2 -8
  29. package/dist/nanoid/non-secure.cjs +2 -8
  30. package/dist/nanoid/non-secure.d.cts +1 -1
  31. package/dist/nanoid/non-secure.d.mts +1 -1
  32. package/dist/nanoid/non-secure.d.ts +1 -1
  33. package/dist/nanoid/non-secure.mjs +2 -8
  34. package/dist/shared/{pinia-orm.4ff2e12f.mjs → pinia-orm.C7bM_uXu.mjs} +12 -18
  35. package/dist/shared/{pinia-orm.a661fdf8.cjs → pinia-orm.CO4kZz81.cjs} +1 -1
  36. package/dist/shared/{pinia-orm.7ddc00a8.mjs → pinia-orm.DGc38JnV.mjs} +1 -1
  37. package/dist/shared/{pinia-orm.a7e3e0f3.cjs → pinia-orm.DWjxIbAJ.cjs} +12 -18
  38. package/dist/uuid/v1.cjs +2 -8
  39. package/dist/uuid/v1.d.cts +1 -1
  40. package/dist/uuid/v1.d.mts +1 -1
  41. package/dist/uuid/v1.d.ts +1 -1
  42. package/dist/uuid/v1.mjs +2 -8
  43. package/dist/uuid/v4.cjs +2 -8
  44. package/dist/uuid/v4.d.cts +1 -1
  45. package/dist/uuid/v4.d.mts +1 -1
  46. package/dist/uuid/v4.d.ts +1 -1
  47. package/dist/uuid/v4.mjs +2 -8
  48. package/package.json +5 -5
  49. /package/dist/shared/{pinia-orm.cf7a7464.d.cts → pinia-orm.Bzthh6rU.d.cts} +0 -0
  50. /package/dist/shared/{pinia-orm.cf7a7464.d.mts → pinia-orm.Bzthh6rU.d.mts} +0 -0
  51. /package/dist/shared/{pinia-orm.cf7a7464.d.ts → pinia-orm.Bzthh6rU.d.ts} +0 -0
package/dist/index.cjs CHANGED
@@ -1,30 +1,24 @@
1
1
  'use strict';
2
2
 
3
- const Utils = require('./shared/pinia-orm.a661fdf8.cjs');
3
+ const Utils = require('./shared/pinia-orm.CO4kZz81.cjs');
4
4
  const pinia = require('pinia');
5
5
  const normalizr = require('@pinia-orm/normalizr');
6
6
  const vueDemi = require('vue-demi');
7
- const CastAttribute = require('./shared/pinia-orm.a7e3e0f3.cjs');
7
+ const CastAttribute = require('./shared/pinia-orm.DWjxIbAJ.cjs');
8
8
 
9
- var __defProp$l = Object.defineProperty;
10
- var __defNormalProp$l = (obj, key, value) => key in obj ? __defProp$l(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
- var __publicField$l = (obj, key, value) => {
12
- __defNormalProp$l(obj, typeof key !== "symbol" ? key + "" : key, value);
13
- return value;
14
- };
15
9
  class Attribute {
10
+ /**
11
+ * The model instance.
12
+ */
13
+ model;
14
+ /**
15
+ * The field name
16
+ */
17
+ key;
16
18
  /**
17
19
  * Create a new Attribute instance.
18
20
  */
19
21
  constructor(model) {
20
- /**
21
- * The model instance.
22
- */
23
- __publicField$l(this, "model");
24
- /**
25
- * The field name
26
- */
27
- __publicField$l(this, "key");
28
22
  this.model = model;
29
23
  this.key = "";
30
24
  }
@@ -37,30 +31,24 @@ class Attribute {
37
31
  }
38
32
  }
39
33
 
40
- var __defProp$k = Object.defineProperty;
41
- var __defNormalProp$k = (obj, key, value) => key in obj ? __defProp$k(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
42
- var __publicField$k = (obj, key, value) => {
43
- __defNormalProp$k(obj, typeof key !== "symbol" ? key + "" : key, value);
44
- return value;
45
- };
46
34
  class Relation extends Attribute {
35
+ /**
36
+ * The parent model.
37
+ */
38
+ parent;
39
+ /**
40
+ * The related model.
41
+ */
42
+ related;
43
+ /**
44
+ * The delete mode
45
+ */
46
+ onDeleteMode;
47
47
  /**
48
48
  * Create a new relation instance.
49
49
  */
50
50
  constructor(parent, related) {
51
51
  super(parent);
52
- /**
53
- * The parent model.
54
- */
55
- __publicField$k(this, "parent");
56
- /**
57
- * The related model.
58
- */
59
- __publicField$k(this, "related");
60
- /**
61
- * The delete mode
62
- */
63
- __publicField$k(this, "onDeleteMode");
64
52
  this.parent = parent;
65
53
  this.related = related;
66
54
  }
@@ -122,38 +110,32 @@ class Relation extends Attribute {
122
110
  }
123
111
  }
124
112
 
125
- var __defProp$j = Object.defineProperty;
126
- var __defNormalProp$j = (obj, key, value) => key in obj ? __defProp$j(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
127
- var __publicField$j = (obj, key, value) => {
128
- __defNormalProp$j(obj, typeof key !== "symbol" ? key + "" : key, value);
129
- return value;
130
- };
131
113
  class MorphTo extends Relation {
114
+ /**
115
+ * The related models.
116
+ */
117
+ relatedModels;
118
+ /**
119
+ * The related model dictionary.
120
+ */
121
+ relatedTypes;
122
+ /**
123
+ * The field name that contains id of the parent model.
124
+ */
125
+ morphId;
126
+ /**
127
+ * The field name that contains type of the parent model.
128
+ */
129
+ morphType;
130
+ /**
131
+ * The associated key of the child model.
132
+ */
133
+ ownerKey;
132
134
  /**
133
135
  * Create a new morph-to relation instance.
134
136
  */
135
137
  constructor(parent, relatedModels, morphId, morphType, ownerKey) {
136
138
  super(parent, parent);
137
- /**
138
- * The related models.
139
- */
140
- __publicField$j(this, "relatedModels");
141
- /**
142
- * The related model dictionary.
143
- */
144
- __publicField$j(this, "relatedTypes");
145
- /**
146
- * The field name that contains id of the parent model.
147
- */
148
- __publicField$j(this, "morphId");
149
- /**
150
- * The field name that contains type of the parent model.
151
- */
152
- __publicField$j(this, "morphType");
153
- /**
154
- * The associated key of the child model.
155
- */
156
- __publicField$j(this, "ownerKey");
157
139
  this.relatedModels = relatedModels;
158
140
  this.relatedTypes = this.createRelatedTypes(relatedModels);
159
141
  this.morphId = morphId;
@@ -268,26 +250,20 @@ class MorphTo extends Relation {
268
250
  }
269
251
  }
270
252
 
271
- var __defProp$i = Object.defineProperty;
272
- var __defNormalProp$i = (obj, key, value) => key in obj ? __defProp$i(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
273
- var __publicField$i = (obj, key, value) => {
274
- __defNormalProp$i(obj, typeof key !== "symbol" ? key + "" : key, value);
275
- return value;
276
- };
277
253
  class Type extends Attribute {
254
+ /**
255
+ * The raw default value for the attribute (can be a function).
256
+ */
257
+ rawDefaultValue;
258
+ /**
259
+ * Whether the attribute accepts `null` value or not.
260
+ */
261
+ isNullable = true;
278
262
  /**
279
263
  * Create a new Type attribute instance.
280
264
  */
281
265
  constructor(model, defaultValue = null) {
282
266
  super(model);
283
- /**
284
- * The raw default value for the attribute (can be a function).
285
- */
286
- __publicField$i(this, "rawDefaultValue");
287
- /**
288
- * Whether the attribute accepts `null` value or not.
289
- */
290
- __publicField$i(this, "isNullable", true);
291
267
  this.rawDefaultValue = defaultValue;
292
268
  }
293
269
  /**
@@ -326,24 +302,18 @@ class Type extends Attribute {
326
302
  }
327
303
  }
328
304
 
329
- var __defProp$h = Object.defineProperty;
330
- var __defNormalProp$h = (obj, key, value) => key in obj ? __defProp$h(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
331
- var __publicField$h = (obj, key, value) => {
332
- __defNormalProp$h(obj, typeof key !== "symbol" ? key + "" : key, value);
333
- return value;
334
- };
335
305
  class Uid extends Type {
306
+ options;
307
+ // This alphabet uses `A-Za-z0-9_-` symbols.
308
+ // The order of characters is optimized for better gzip and brotli compression.
309
+ // References to the same file (works both for gzip and brotli):
310
+ // `'use`, `andom`, and `rict'`
311
+ // References to the brotli default dictionary:
312
+ // `-26T`, `1983`, `40px`, `75px`, `bush`, `jack`, `mind`, `very`, and `wolf`
313
+ alphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
314
+ size = 21;
336
315
  constructor(model, options = {}) {
337
316
  super(model);
338
- __publicField$h(this, "options");
339
- // This alphabet uses `A-Za-z0-9_-` symbols.
340
- // The order of characters is optimized for better gzip and brotli compression.
341
- // References to the same file (works both for gzip and brotli):
342
- // `'use`, `andom`, and `rict'`
343
- // References to the brotli default dictionary:
344
- // `-26T`, `1983`, `40px`, `75px`, `bush`, `jack`, `mind`, `very`, and `wolf`
345
- __publicField$h(this, "alphabet", "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict");
346
- __publicField$h(this, "size", 21);
347
317
  this.options = typeof options === "number" ? { size: options } : options;
348
318
  this.alphabet = this.options.alphabet ?? this.alphabet;
349
319
  this.size = this.options.size ?? this.size;
@@ -360,25 +330,19 @@ class Uid extends Type {
360
330
  }
361
331
  }
362
332
 
363
- var __defProp$g = Object.defineProperty;
364
- var __defNormalProp$g = (obj, key, value) => key in obj ? __defProp$g(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
365
- var __publicField$g = (obj, key, value) => {
366
- __defNormalProp$g(obj, typeof key !== "symbol" ? key + "" : key, value);
367
- return value;
368
- };
369
333
  class Schema {
334
+ /**
335
+ * The list of generated schemas.
336
+ */
337
+ schemas = {};
338
+ /**
339
+ * The model instance.
340
+ */
341
+ model;
370
342
  /**
371
343
  * Create a new Schema instance.
372
344
  */
373
345
  constructor(model) {
374
- /**
375
- * The list of generated schemas.
376
- */
377
- __publicField$g(this, "schemas", {});
378
- /**
379
- * The model instance.
380
- */
381
- __publicField$g(this, "model");
382
346
  this.model = model;
383
347
  }
384
348
  /**
@@ -493,21 +457,15 @@ class Schema {
493
457
  }
494
458
  }
495
459
 
496
- var __defProp$f = Object.defineProperty;
497
- var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
498
- var __publicField$f = (obj, key, value) => {
499
- __defNormalProp$f(obj, typeof key !== "symbol" ? key + "" : key, value);
500
- return value;
501
- };
502
460
  class Interpreter {
461
+ /**
462
+ * The model object.
463
+ */
464
+ model;
503
465
  /**
504
466
  * Create a new Interpreter instance.
505
467
  */
506
468
  constructor(model) {
507
- /**
508
- * The model object.
509
- */
510
- __publicField$f(this, "model");
511
469
  this.model = model;
512
470
  }
513
471
  process(data) {
@@ -602,42 +560,36 @@ function useDataStore(id, options, customOptions, query) {
602
560
  }), customOptions);
603
561
  }
604
562
 
605
- var __defProp$e = Object.defineProperty;
606
- var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
607
- var __publicField$e = (obj, key, value) => {
608
- __defNormalProp$e(obj, typeof key !== "symbol" ? key + "" : key, value);
609
- return value;
610
- };
611
563
  class BelongsToMany extends Relation {
564
+ /**
565
+ * The pivot model.
566
+ */
567
+ pivot;
568
+ /**
569
+ * The foreign key of the parent model.
570
+ */
571
+ foreignPivotKey;
572
+ /**
573
+ * The associated key of the relation.
574
+ */
575
+ relatedPivotKey;
576
+ /**
577
+ * The key name of the parent model.
578
+ */
579
+ parentKey;
580
+ /**
581
+ * The key name of the related model.
582
+ */
583
+ relatedKey;
584
+ /**
585
+ * The key name of the pivot data.
586
+ */
587
+ pivotKey = "pivot";
612
588
  /**
613
589
  * Create a new belongs to instance.
614
590
  */
615
591
  constructor(parent, related, pivot, foreignPivotKey, relatedPivotKey, parentKey, relatedKey) {
616
592
  super(parent, related);
617
- /**
618
- * The pivot model.
619
- */
620
- __publicField$e(this, "pivot");
621
- /**
622
- * The foreign key of the parent model.
623
- */
624
- __publicField$e(this, "foreignPivotKey");
625
- /**
626
- * The associated key of the relation.
627
- */
628
- __publicField$e(this, "relatedPivotKey");
629
- /**
630
- * The key name of the parent model.
631
- */
632
- __publicField$e(this, "parentKey");
633
- /**
634
- * The key name of the related model.
635
- */
636
- __publicField$e(this, "relatedKey");
637
- /**
638
- * The key name of the pivot data.
639
- */
640
- __publicField$e(this, "pivotKey", "pivot");
641
593
  this.pivot = pivot;
642
594
  this.foreignPivotKey = foreignPivotKey;
643
595
  this.relatedPivotKey = relatedPivotKey;
@@ -707,72 +659,66 @@ class BelongsToMany extends Relation {
707
659
  }
708
660
  }
709
661
 
710
- var __defProp$d = Object.defineProperty;
711
- var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
712
- var __publicField$d = (obj, key, value) => {
713
- __defNormalProp$d(obj, typeof key !== "symbol" ? key + "" : key, value);
714
- return value;
715
- };
716
662
  class Query {
663
+ /**
664
+ * The database instance.
665
+ */
666
+ database;
667
+ /**
668
+ * The model object.
669
+ */
670
+ model;
671
+ /**
672
+ * The where constraints for the query.
673
+ */
674
+ wheres = [];
675
+ /**
676
+ * The orderings for the query.
677
+ */
678
+ orders = [];
679
+ /**
680
+ * The orderings for the query.
681
+ */
682
+ groups = [];
683
+ /**
684
+ * The maximum number of records to return.
685
+ */
686
+ take = null;
687
+ /**
688
+ * The number of records to skip.
689
+ */
690
+ skip = 0;
691
+ /**
692
+ * Fields that should be visible.
693
+ */
694
+ visible = ["*"];
695
+ /**
696
+ * Fields that should be hidden.
697
+ */
698
+ hidden = [];
699
+ /**
700
+ * The cache object.
701
+ */
702
+ cache;
703
+ /**
704
+ * The relationships that should be eager loaded.
705
+ */
706
+ eagerLoad = {};
707
+ /**
708
+ * The pinia store.
709
+ */
710
+ pinia;
711
+ fromCache = false;
712
+ cacheConfig = {};
713
+ getNewHydrated = false;
714
+ /**
715
+ * Hydrated models. They are stored to prevent rerendering of child components.
716
+ */
717
+ hydratedDataCache;
717
718
  /**
718
719
  * Create a new query instance.
719
720
  */
720
721
  constructor(database, model, cache, hydratedData, pinia) {
721
- /**
722
- * The database instance.
723
- */
724
- __publicField$d(this, "database");
725
- /**
726
- * The model object.
727
- */
728
- __publicField$d(this, "model");
729
- /**
730
- * The where constraints for the query.
731
- */
732
- __publicField$d(this, "wheres", []);
733
- /**
734
- * The orderings for the query.
735
- */
736
- __publicField$d(this, "orders", []);
737
- /**
738
- * The orderings for the query.
739
- */
740
- __publicField$d(this, "groups", []);
741
- /**
742
- * The maximum number of records to return.
743
- */
744
- __publicField$d(this, "take", null);
745
- /**
746
- * The number of records to skip.
747
- */
748
- __publicField$d(this, "skip", 0);
749
- /**
750
- * Fields that should be visible.
751
- */
752
- __publicField$d(this, "visible", ["*"]);
753
- /**
754
- * Fields that should be hidden.
755
- */
756
- __publicField$d(this, "hidden", []);
757
- /**
758
- * The cache object.
759
- */
760
- __publicField$d(this, "cache");
761
- /**
762
- * The relationships that should be eager loaded.
763
- */
764
- __publicField$d(this, "eagerLoad", {});
765
- /**
766
- * The pinia store.
767
- */
768
- __publicField$d(this, "pinia");
769
- __publicField$d(this, "fromCache", false);
770
- __publicField$d(this, "cacheConfig", {});
771
- __publicField$d(this, "getNewHydrated", false);
772
- /**
773
- * Hydrated models. They are stored to prevent rerendering of child components.
774
- */
775
- __publicField$d(this, "hydratedDataCache");
776
722
  this.database = database;
777
723
  this.model = model;
778
724
  this.pinia = pinia;
@@ -1567,37 +1513,15 @@ class Query {
1567
1513
  }
1568
1514
  }
1569
1515
 
1570
- var __defProp$c = Object.defineProperty;
1571
- var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1572
- var __publicField$c = (obj, key, value) => {
1573
- __defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
1574
- return value;
1575
- };
1576
- var __accessCheck = (obj, member, msg) => {
1577
- if (!member.has(obj))
1578
- throw TypeError("Cannot " + msg);
1579
- };
1580
- var __privateGet = (obj, member, getter) => {
1581
- __accessCheck(obj, member, "read from private field");
1582
- return getter ? getter.call(obj) : member.get(obj);
1583
- };
1584
- var __privateAdd = (obj, member, value) => {
1585
- if (member.has(obj))
1586
- throw TypeError("Cannot add the same private member more than once");
1587
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
1588
- };
1589
- var _a, _map;
1590
1516
  class WeakCache {
1591
- constructor() {
1592
- // @ts-expect-error dont know
1593
- __publicField$c(this, _a);
1594
- __privateAdd(this, _map, /* @__PURE__ */ new Map());
1595
- }
1517
+ // @ts-expect-error dont know
1518
+ [Symbol.toStringTag];
1519
+ #map = /* @__PURE__ */ new Map();
1596
1520
  has(key) {
1597
- return !!(__privateGet(this, _map).has(key) && __privateGet(this, _map).get(key)?.deref());
1521
+ return !!(this.#map.has(key) && this.#map.get(key)?.deref());
1598
1522
  }
1599
1523
  get(key) {
1600
- const weakRef = __privateGet(this, _map).get(key);
1524
+ const weakRef = this.#map.get(key);
1601
1525
  if (!weakRef) {
1602
1526
  return void 0;
1603
1527
  }
@@ -1605,21 +1529,21 @@ class WeakCache {
1605
1529
  if (value) {
1606
1530
  return value;
1607
1531
  }
1608
- __privateGet(this, _map).delete(key);
1532
+ this.#map.delete(key);
1609
1533
  return void 0;
1610
1534
  }
1611
1535
  set(key, value) {
1612
- __privateGet(this, _map).set(key, new WeakRef(value));
1536
+ this.#map.set(key, new WeakRef(value));
1613
1537
  return this;
1614
1538
  }
1615
1539
  get size() {
1616
- return __privateGet(this, _map).size;
1540
+ return this.#map.size;
1617
1541
  }
1618
1542
  clear() {
1619
- __privateGet(this, _map).clear();
1543
+ this.#map.clear();
1620
1544
  }
1621
1545
  delete(key) {
1622
- __privateGet(this, _map).delete(key);
1546
+ this.#map.delete(key);
1623
1547
  return false;
1624
1548
  }
1625
1549
  forEach(cb) {
@@ -1627,11 +1551,11 @@ class WeakCache {
1627
1551
  cb(value, key, this);
1628
1552
  }
1629
1553
  }
1630
- *[(_a = Symbol.toStringTag, Symbol.iterator)]() {
1631
- for (const [key, weakRef] of __privateGet(this, _map)) {
1554
+ *[Symbol.iterator]() {
1555
+ for (const [key, weakRef] of this.#map) {
1632
1556
  const ref = weakRef.deref();
1633
1557
  if (!ref) {
1634
- __privateGet(this, _map).delete(key);
1558
+ this.#map.delete(key);
1635
1559
  continue;
1636
1560
  }
1637
1561
  yield [key, ref];
@@ -1653,7 +1577,6 @@ class WeakCache {
1653
1577
  }
1654
1578
  }
1655
1579
  }
1656
- _map = new WeakMap();
1657
1580
 
1658
1581
  const cache$1 = new WeakCache();
1659
1582
 
@@ -1676,45 +1599,49 @@ const CONFIG_DEFAULTS = {
1676
1599
  };
1677
1600
  const config = { ...CONFIG_DEFAULTS };
1678
1601
 
1679
- var __defProp$b = Object.defineProperty;
1680
- var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1681
- var __publicField$b = (obj, key, value) => {
1682
- __defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
1683
- return value;
1684
- };
1685
1602
  class Repository {
1603
+ /**
1604
+ * A special flag to indicate if this is the repository class or not. It's
1605
+ * used when retrieving repository instance from `store.$repo()` method to
1606
+ * determine whether the passed in class is either a repository or a model.
1607
+ */
1608
+ static _isRepository = true;
1609
+ /**
1610
+ * The database instance.
1611
+ */
1612
+ database;
1613
+ /**
1614
+ * The model instance.
1615
+ */
1616
+ model;
1617
+ /**
1618
+ * The pinia instance
1619
+ */
1620
+ pinia;
1621
+ /**
1622
+ * The cache instance
1623
+ */
1624
+ queryCache;
1625
+ /**
1626
+ * Hydrated models. They are stored to prevent rerendering of child components.
1627
+ */
1628
+ hydratedDataCache;
1629
+ /**
1630
+ * The model object to be used for the custom repository.
1631
+ */
1632
+ use;
1633
+ /**
1634
+ * The model object to be used for the custom repository.
1635
+ */
1636
+ static useModel;
1637
+ /**
1638
+ * Global config
1639
+ */
1640
+ config;
1686
1641
  /**
1687
1642
  * Create a new Repository instance.
1688
1643
  */
1689
1644
  constructor(database, pinia) {
1690
- /**
1691
- * The database instance.
1692
- */
1693
- __publicField$b(this, "database");
1694
- /**
1695
- * The model instance.
1696
- */
1697
- __publicField$b(this, "model");
1698
- /**
1699
- * The pinia instance
1700
- */
1701
- __publicField$b(this, "pinia");
1702
- /**
1703
- * The cache instance
1704
- */
1705
- __publicField$b(this, "queryCache");
1706
- /**
1707
- * Hydrated models. They are stored to prevent rerendering of child components.
1708
- */
1709
- __publicField$b(this, "hydratedDataCache");
1710
- /**
1711
- * The model object to be used for the custom repository.
1712
- */
1713
- __publicField$b(this, "use");
1714
- /**
1715
- * Global config
1716
- */
1717
- __publicField$b(this, "config");
1718
1645
  this.config = config;
1719
1646
  this.database = database;
1720
1647
  this.pinia = pinia;
@@ -1980,30 +1907,12 @@ class Repository {
1980
1907
  return this.query().flush();
1981
1908
  }
1982
1909
  }
1983
- /**
1984
- * A special flag to indicate if this is the repository class or not. It's
1985
- * used when retrieving repository instance from `store.$repo()` method to
1986
- * determine whether the passed in class is either a repository or a model.
1987
- */
1988
- __publicField$b(Repository, "_isRepository", true);
1989
- /**
1990
- * The model object to be used for the custom repository.
1991
- */
1992
- __publicField$b(Repository, "useModel");
1993
1910
 
1994
- var __defProp$a = Object.defineProperty;
1995
- var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1996
- var __publicField$a = (obj, key, value) => {
1997
- __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
1998
- return value;
1999
- };
2000
1911
  class Database {
2001
- constructor() {
2002
- /**
2003
- * The list of registered models.
2004
- */
2005
- __publicField$a(this, "models", {});
2006
- }
1912
+ /**
1913
+ * The list of registered models.
1914
+ */
1915
+ models = {};
2007
1916
  /**
2008
1917
  * Register the given model.
2009
1918
  */
@@ -2139,26 +2048,20 @@ class Boolean extends Type {
2139
2048
  }
2140
2049
  }
2141
2050
 
2142
- var __defProp$9 = Object.defineProperty;
2143
- var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2144
- var __publicField$9 = (obj, key, value) => {
2145
- __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
2146
- return value;
2147
- };
2148
2051
  class HasOne extends Relation {
2052
+ /**
2053
+ * The foreign key of the parent model.
2054
+ */
2055
+ foreignKey;
2056
+ /**
2057
+ * The local key of the parent model.
2058
+ */
2059
+ localKey;
2149
2060
  /**
2150
2061
  * Create a new has-one relation instance.
2151
2062
  */
2152
2063
  constructor(parent, related, foreignKey, localKey) {
2153
2064
  super(parent, related);
2154
- /**
2155
- * The foreign key of the parent model.
2156
- */
2157
- __publicField$9(this, "foreignKey");
2158
- /**
2159
- * The local key of the parent model.
2160
- */
2161
- __publicField$9(this, "localKey");
2162
2065
  this.foreignKey = foreignKey;
2163
2066
  this.localKey = localKey;
2164
2067
  }
@@ -2222,30 +2125,24 @@ class HasOne extends Relation {
2222
2125
  }
2223
2126
  }
2224
2127
 
2225
- var __defProp$8 = Object.defineProperty;
2226
- var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2227
- var __publicField$8 = (obj, key, value) => {
2228
- __defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
2229
- return value;
2230
- };
2231
2128
  class BelongsTo extends Relation {
2129
+ /**
2130
+ * The child model instance of the relation.
2131
+ */
2132
+ child;
2133
+ /**
2134
+ * The foreign key of the parent model.
2135
+ */
2136
+ foreignKey;
2137
+ /**
2138
+ * The associated key on the parent model.
2139
+ */
2140
+ ownerKey;
2232
2141
  /**
2233
2142
  * Create a new belongs-to relation instance.
2234
2143
  */
2235
2144
  constructor(parent, child, foreignKey, ownerKey) {
2236
2145
  super(parent, child);
2237
- /**
2238
- * The child model instance of the relation.
2239
- */
2240
- __publicField$8(this, "child");
2241
- /**
2242
- * The foreign key of the parent model.
2243
- */
2244
- __publicField$8(this, "foreignKey");
2245
- /**
2246
- * The associated key on the parent model.
2247
- */
2248
- __publicField$8(this, "ownerKey");
2249
2146
  this.foreignKey = foreignKey;
2250
2147
  this.ownerKey = ownerKey;
2251
2148
  this.child = child;
@@ -2322,26 +2219,20 @@ class BelongsTo extends Relation {
2322
2219
  }
2323
2220
  }
2324
2221
 
2325
- var __defProp$7 = Object.defineProperty;
2326
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2327
- var __publicField$7 = (obj, key, value) => {
2328
- __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
2329
- return value;
2330
- };
2331
2222
  class HasMany extends Relation {
2223
+ /**
2224
+ * The foreign key of the parent model.
2225
+ */
2226
+ foreignKey;
2227
+ /**
2228
+ * The local key of the parent model.
2229
+ */
2230
+ localKey;
2332
2231
  /**
2333
2232
  * Create a new has-many relation instance.
2334
2233
  */
2335
2234
  constructor(parent, related, foreignKey, localKey) {
2336
2235
  super(parent, related);
2337
- /**
2338
- * The foreign key of the parent model.
2339
- */
2340
- __publicField$7(this, "foreignKey");
2341
- /**
2342
- * The local key of the parent model.
2343
- */
2344
- __publicField$7(this, "localKey");
2345
2236
  this.foreignKey = foreignKey;
2346
2237
  this.localKey = localKey;
2347
2238
  }
@@ -2406,30 +2297,24 @@ class HasMany extends Relation {
2406
2297
  }
2407
2298
  }
2408
2299
 
2409
- var __defProp$6 = Object.defineProperty;
2410
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2411
- var __publicField$6 = (obj, key, value) => {
2412
- __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
2413
- return value;
2414
- };
2415
2300
  class HasManyBy extends Relation {
2301
+ /**
2302
+ * The child model instance of the relation.
2303
+ */
2304
+ child;
2305
+ /**
2306
+ * The foreign key of the parent model.
2307
+ */
2308
+ foreignKey;
2309
+ /**
2310
+ * The owner key of the parent model.
2311
+ */
2312
+ ownerKey;
2416
2313
  /**
2417
2314
  * Create a new has-many-by relation instance.
2418
2315
  */
2419
2316
  constructor(parent, child, foreignKey, ownerKey) {
2420
2317
  super(parent, child);
2421
- /**
2422
- * The child model instance of the relation.
2423
- */
2424
- __publicField$6(this, "child");
2425
- /**
2426
- * The foreign key of the parent model.
2427
- */
2428
- __publicField$6(this, "foreignKey");
2429
- /**
2430
- * The owner key of the parent model.
2431
- */
2432
- __publicField$6(this, "ownerKey");
2433
2318
  this.foreignKey = foreignKey;
2434
2319
  this.ownerKey = ownerKey;
2435
2320
  this.child = child;
@@ -2521,30 +2406,24 @@ class HasManyBy extends Relation {
2521
2406
  }
2522
2407
  }
2523
2408
 
2524
- var __defProp$5 = Object.defineProperty;
2525
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2526
- var __publicField$5 = (obj, key, value) => {
2527
- __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
2528
- return value;
2529
- };
2530
2409
  class MorphOne extends Relation {
2410
+ /**
2411
+ * The field name that contains id of the parent model.
2412
+ */
2413
+ morphId;
2414
+ /**
2415
+ * The field name that contains type of the parent model.
2416
+ */
2417
+ morphType;
2418
+ /**
2419
+ * The local key of the model.
2420
+ */
2421
+ localKey;
2531
2422
  /**
2532
2423
  * Create a new morph-one relation instance.
2533
2424
  */
2534
2425
  constructor(parent, related, morphId, morphType, localKey) {
2535
2426
  super(parent, related);
2536
- /**
2537
- * The field name that contains id of the parent model.
2538
- */
2539
- __publicField$5(this, "morphId");
2540
- /**
2541
- * The field name that contains type of the parent model.
2542
- */
2543
- __publicField$5(this, "morphType");
2544
- /**
2545
- * The local key of the model.
2546
- */
2547
- __publicField$5(this, "localKey");
2548
2427
  this.morphId = morphId;
2549
2428
  this.morphType = morphType;
2550
2429
  this.localKey = localKey;
@@ -2601,30 +2480,24 @@ class MorphOne extends Relation {
2601
2480
  }
2602
2481
  }
2603
2482
 
2604
- var __defProp$4 = Object.defineProperty;
2605
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2606
- var __publicField$4 = (obj, key, value) => {
2607
- __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
2608
- return value;
2609
- };
2610
2483
  class MorphMany extends Relation {
2484
+ /**
2485
+ * The field name that contains id of the parent model.
2486
+ */
2487
+ morphId;
2488
+ /**
2489
+ * The field name that contains type of the parent model.
2490
+ */
2491
+ morphType;
2492
+ /**
2493
+ * The local key of the model.
2494
+ */
2495
+ localKey;
2611
2496
  /**
2612
2497
  * Create a new morph-many relation instance.
2613
2498
  */
2614
2499
  constructor(parent, related, morphId, morphType, localKey) {
2615
2500
  super(parent, related);
2616
- /**
2617
- * The field name that contains id of the parent model.
2618
- */
2619
- __publicField$4(this, "morphId");
2620
- /**
2621
- * The field name that contains type of the parent model.
2622
- */
2623
- __publicField$4(this, "morphType");
2624
- /**
2625
- * The local key of the model.
2626
- */
2627
- __publicField$4(this, "localKey");
2628
2501
  this.morphId = morphId;
2629
2502
  this.morphType = morphType;
2630
2503
  this.localKey = localKey;
@@ -2681,38 +2554,32 @@ class MorphMany extends Relation {
2681
2554
  }
2682
2555
  }
2683
2556
 
2684
- var __defProp$3 = Object.defineProperty;
2685
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2686
- var __publicField$3 = (obj, key, value) => {
2687
- __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
2688
- return value;
2689
- };
2690
2557
  class HasManyThrough extends Relation {
2558
+ /**
2559
+ * The "through" parent model.
2560
+ */
2561
+ through;
2562
+ /**
2563
+ * The near key on the relationship.
2564
+ */
2565
+ firstKey;
2566
+ /**
2567
+ * The far key on the relationship.
2568
+ */
2569
+ secondKey;
2570
+ /**
2571
+ * The local key on the relationship.
2572
+ */
2573
+ localKey;
2574
+ /**
2575
+ * The local key on the intermediary model.
2576
+ */
2577
+ secondLocalKey;
2691
2578
  /**
2692
2579
  * Create a new has-many-through relation instance.
2693
2580
  */
2694
2581
  constructor(parent, related, through, firstKey, secondKey, localKey, secondLocalKey) {
2695
2582
  super(parent, related);
2696
- /**
2697
- * The "through" parent model.
2698
- */
2699
- __publicField$3(this, "through");
2700
- /**
2701
- * The near key on the relationship.
2702
- */
2703
- __publicField$3(this, "firstKey");
2704
- /**
2705
- * The far key on the relationship.
2706
- */
2707
- __publicField$3(this, "secondKey");
2708
- /**
2709
- * The local key on the relationship.
2710
- */
2711
- __publicField$3(this, "localKey");
2712
- /**
2713
- * The local key on the intermediary model.
2714
- */
2715
- __publicField$3(this, "secondLocalKey");
2716
2583
  this.through = through;
2717
2584
  this.firstKey = firstKey;
2718
2585
  this.secondKey = secondKey;
@@ -2770,46 +2637,40 @@ class HasManyThrough extends Relation {
2770
2637
  }
2771
2638
  }
2772
2639
 
2773
- var __defProp$2 = Object.defineProperty;
2774
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2775
- var __publicField$2 = (obj, key, value) => {
2776
- __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
2777
- return value;
2778
- };
2779
2640
  class MorphToMany extends Relation {
2641
+ /**
2642
+ * The pivot model.
2643
+ */
2644
+ pivot;
2645
+ /**
2646
+ * The field name that contains id of the parent model.
2647
+ */
2648
+ morphId;
2649
+ /**
2650
+ * The field name that contains type of the parent model.
2651
+ */
2652
+ morphType;
2653
+ /**
2654
+ * The associated key of the relation.
2655
+ */
2656
+ relatedId;
2657
+ /**
2658
+ * The key name of the parent model.
2659
+ */
2660
+ parentKey;
2661
+ /**
2662
+ * The key name of the related model.
2663
+ */
2664
+ relatedKey;
2665
+ /**
2666
+ * The key name of the pivot data.
2667
+ */
2668
+ pivotKey = "pivot";
2780
2669
  /**
2781
2670
  * Create a new morph to many to instance.
2782
2671
  */
2783
2672
  constructor(parent, related, pivot, relatedId, morphId, morphType, parentKey, relatedKey) {
2784
2673
  super(parent, related);
2785
- /**
2786
- * The pivot model.
2787
- */
2788
- __publicField$2(this, "pivot");
2789
- /**
2790
- * The field name that contains id of the parent model.
2791
- */
2792
- __publicField$2(this, "morphId");
2793
- /**
2794
- * The field name that contains type of the parent model.
2795
- */
2796
- __publicField$2(this, "morphType");
2797
- /**
2798
- * The associated key of the relation.
2799
- */
2800
- __publicField$2(this, "relatedId");
2801
- /**
2802
- * The key name of the parent model.
2803
- */
2804
- __publicField$2(this, "parentKey");
2805
- /**
2806
- * The key name of the related model.
2807
- */
2808
- __publicField$2(this, "relatedKey");
2809
- /**
2810
- * The key name of the pivot data.
2811
- */
2812
- __publicField$2(this, "pivotKey", "pivot");
2813
2674
  this.pivot = pivot;
2814
2675
  this.morphId = morphId;
2815
2676
  this.morphType = morphType;
@@ -2880,46 +2741,40 @@ class MorphToMany extends Relation {
2880
2741
  }
2881
2742
  }
2882
2743
 
2883
- var __defProp$1 = Object.defineProperty;
2884
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2885
- var __publicField$1 = (obj, key, value) => {
2886
- __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
2887
- return value;
2888
- };
2889
2744
  class MorphedByMany extends Relation {
2745
+ /**
2746
+ * The pivot model.
2747
+ */
2748
+ pivot;
2749
+ /**
2750
+ * The field name that contains id of the parent model.
2751
+ */
2752
+ morphId;
2753
+ /**
2754
+ * The field name that contains type of the parent model.
2755
+ */
2756
+ morphType;
2757
+ /**
2758
+ * The associated key of the relation.
2759
+ */
2760
+ relatedId;
2761
+ /**
2762
+ * The key name of the parent model.
2763
+ */
2764
+ parentKey;
2765
+ /**
2766
+ * The key name of the related model.
2767
+ */
2768
+ relatedKey;
2769
+ /**
2770
+ * The key name of the pivot data.
2771
+ */
2772
+ pivotKey = "pivot";
2890
2773
  /**
2891
2774
  * Create a new morph to many to instance.
2892
2775
  */
2893
2776
  constructor(parent, related, pivot, relatedId, morphId, morphType, parentKey, relatedKey) {
2894
2777
  super(parent, related);
2895
- /**
2896
- * The pivot model.
2897
- */
2898
- __publicField$1(this, "pivot");
2899
- /**
2900
- * The field name that contains id of the parent model.
2901
- */
2902
- __publicField$1(this, "morphId");
2903
- /**
2904
- * The field name that contains type of the parent model.
2905
- */
2906
- __publicField$1(this, "morphType");
2907
- /**
2908
- * The associated key of the relation.
2909
- */
2910
- __publicField$1(this, "relatedId");
2911
- /**
2912
- * The key name of the parent model.
2913
- */
2914
- __publicField$1(this, "parentKey");
2915
- /**
2916
- * The key name of the related model.
2917
- */
2918
- __publicField$1(this, "relatedKey");
2919
- /**
2920
- * The key name of the pivot data.
2921
- */
2922
- __publicField$1(this, "pivotKey", "pivot");
2923
2778
  this.pivot = pivot;
2924
2779
  this.morphId = morphId;
2925
2780
  this.morphType = morphType;
@@ -2985,13 +2840,85 @@ class MorphedByMany extends Relation {
2985
2840
  }
2986
2841
  }
2987
2842
 
2988
- var __defProp = Object.defineProperty;
2989
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2990
- var __publicField = (obj, key, value) => {
2991
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
2992
- return value;
2993
- };
2994
2843
  class Model {
2844
+ /**
2845
+ * The name of the model.
2846
+ */
2847
+ static entity;
2848
+ /**
2849
+ * The reference to the base entity name if the class extends a base entity.
2850
+ */
2851
+ static baseEntity;
2852
+ /**
2853
+ * The reference to the base namespace if the class extends a base with a different namespace.
2854
+ */
2855
+ static baseNamespace;
2856
+ /**
2857
+ * Define a namespace if you have multiple equal entity names.
2858
+ * Resulting in "{namespace}/{entity}"
2859
+ */
2860
+ static namespace;
2861
+ /**
2862
+ * The primary key for the model.
2863
+ */
2864
+ static primaryKey = "id";
2865
+ /**
2866
+ * The meta key for the model.
2867
+ */
2868
+ static metaKey = "_meta";
2869
+ /**
2870
+ * Hidden properties
2871
+ */
2872
+ static hidden = ["_meta"];
2873
+ /**
2874
+ * Visible properties
2875
+ */
2876
+ static visible = [];
2877
+ /**
2878
+ * The global install options
2879
+ */
2880
+ static config;
2881
+ /**
2882
+ * The type key for the model.
2883
+ */
2884
+ static typeKey = "type";
2885
+ /**
2886
+ * Behaviour for relational fields on delete.
2887
+ */
2888
+ static fieldsOnDelete = {};
2889
+ /**
2890
+ * Original model data.
2891
+ */
2892
+ static original = {};
2893
+ /**
2894
+ * The schema for the model. It contains the result of the `fields`
2895
+ * method or the attributes defined by decorators.
2896
+ */
2897
+ static schemas = {};
2898
+ /**
2899
+ * The registry for the model. It contains predefined model schema generated
2900
+ * by the property decorators and gets evaluated, and stored, on the `schema`
2901
+ * property when registering models to the database.
2902
+ */
2903
+ static registries = {};
2904
+ /**
2905
+ * The pinia options for the model. It can contain options which will passed
2906
+ * to the 'defineStore' function of pinia.
2907
+ */
2908
+ static piniaOptions = {};
2909
+ static piniaExtend = {};
2910
+ /**
2911
+ * The mutators for the model.
2912
+ */
2913
+ static fieldMutators = {};
2914
+ /**
2915
+ * The casts for the model.
2916
+ */
2917
+ static fieldCasts = {};
2918
+ /**
2919
+ * The array of booted models.
2920
+ */
2921
+ static booted = {};
2995
2922
  /**
2996
2923
  * Create a new model instance.
2997
2924
  */
@@ -3260,6 +3187,51 @@ class Model {
3260
3187
  localKey = localKey ?? model.$getLocalKey();
3261
3188
  return new MorphMany(model, related.newRawInstance(), id, type, localKey);
3262
3189
  }
3190
+ /**
3191
+ * Lifecycle hook for before saving
3192
+ */
3193
+ static saving = () => {
3194
+ };
3195
+ /**
3196
+ * Lifecycle hook for before updating
3197
+ */
3198
+ static updating = () => {
3199
+ };
3200
+ /**
3201
+ * Lifecycle hook for before creating
3202
+ */
3203
+ static creating = () => {
3204
+ };
3205
+ /**
3206
+ * Lifecycle hook for before deleting
3207
+ */
3208
+ static deleting = () => {
3209
+ };
3210
+ /**
3211
+ * Lifecycle hook for after getting data
3212
+ */
3213
+ static retrieved = () => {
3214
+ };
3215
+ /**
3216
+ * Lifecycle hook for after saved
3217
+ */
3218
+ static saved = () => {
3219
+ };
3220
+ /**
3221
+ * Lifecycle hook for after updated
3222
+ */
3223
+ static updated = () => {
3224
+ };
3225
+ /**
3226
+ * Lifecycle hook for after created
3227
+ */
3228
+ static created = () => {
3229
+ };
3230
+ /**
3231
+ * Lifecycle hook for after deleted
3232
+ */
3233
+ static deleted = () => {
3234
+ };
3263
3235
  /**
3264
3236
  * Mutators to mutate matching fields when instantiating the model.
3265
3237
  */
@@ -3409,7 +3381,6 @@ class Model {
3409
3381
  * by the attributes default value.
3410
3382
  */
3411
3383
  $fill(attributes = {}, options = {}) {
3412
- var _a, _b;
3413
3384
  const operation = options.operation ?? "get";
3414
3385
  const modelConfig = {
3415
3386
  ...config.model,
@@ -3448,7 +3419,7 @@ class Model {
3448
3419
  }
3449
3420
  this[key] = this[key] ?? keyValue;
3450
3421
  }
3451
- operation === "set" && (((_a = this.$self().original)[_b = this.$modelEntity()] ?? (_a[_b] = {}))[this.$getKey(this, true)] = this.$getAttributes());
3422
+ operation === "set" && ((this.$self().original[this.$modelEntity()] ??= {})[this.$getKey(this, true)] = this.$getAttributes());
3452
3423
  modelConfig.withMeta && operation === "set" && this.$fillMeta(options.action);
3453
3424
  return this;
3454
3425
  }
@@ -3596,8 +3567,7 @@ class Model {
3596
3567
  * Get the original values of the model instance
3597
3568
  */
3598
3569
  $getOriginal() {
3599
- var _a, _b;
3600
- return ((_a = this.$self().original)[_b = this.$modelEntity()] ?? (_a[_b] = {}))[this.$getKey(this, true)];
3570
+ return (this.$self().original[this.$modelEntity()] ??= {})[this.$getKey(this, true)];
3601
3571
  }
3602
3572
  /**
3603
3573
  * Return the model instance with its original state
@@ -3698,129 +3668,6 @@ class Model {
3698
3668
  return Utils.isArray(relation) ? relation.map((model) => model.$toJson()) : relation.$toJson();
3699
3669
  }
3700
3670
  }
3701
- /**
3702
- * The name of the model.
3703
- */
3704
- __publicField(Model, "entity");
3705
- /**
3706
- * The reference to the base entity name if the class extends a base entity.
3707
- */
3708
- __publicField(Model, "baseEntity");
3709
- /**
3710
- * The reference to the base namespace if the class extends a base with a different namespace.
3711
- */
3712
- __publicField(Model, "baseNamespace");
3713
- /**
3714
- * Define a namespace if you have multiple equal entity names.
3715
- * Resulting in "{namespace}/{entity}"
3716
- */
3717
- __publicField(Model, "namespace");
3718
- /**
3719
- * The primary key for the model.
3720
- */
3721
- __publicField(Model, "primaryKey", "id");
3722
- /**
3723
- * The meta key for the model.
3724
- */
3725
- __publicField(Model, "metaKey", "_meta");
3726
- /**
3727
- * Hidden properties
3728
- */
3729
- __publicField(Model, "hidden", ["_meta"]);
3730
- /**
3731
- * Visible properties
3732
- */
3733
- __publicField(Model, "visible", []);
3734
- /**
3735
- * The global install options
3736
- */
3737
- __publicField(Model, "config");
3738
- /**
3739
- * The type key for the model.
3740
- */
3741
- __publicField(Model, "typeKey", "type");
3742
- /**
3743
- * Behaviour for relational fields on delete.
3744
- */
3745
- __publicField(Model, "fieldsOnDelete", {});
3746
- /**
3747
- * Original model data.
3748
- */
3749
- __publicField(Model, "original", {});
3750
- /**
3751
- * The schema for the model. It contains the result of the `fields`
3752
- * method or the attributes defined by decorators.
3753
- */
3754
- __publicField(Model, "schemas", {});
3755
- /**
3756
- * The registry for the model. It contains predefined model schema generated
3757
- * by the property decorators and gets evaluated, and stored, on the `schema`
3758
- * property when registering models to the database.
3759
- */
3760
- __publicField(Model, "registries", {});
3761
- /**
3762
- * The pinia options for the model. It can contain options which will passed
3763
- * to the 'defineStore' function of pinia.
3764
- */
3765
- __publicField(Model, "piniaOptions", {});
3766
- __publicField(Model, "piniaExtend", {});
3767
- /**
3768
- * The mutators for the model.
3769
- */
3770
- __publicField(Model, "fieldMutators", {});
3771
- /**
3772
- * The casts for the model.
3773
- */
3774
- __publicField(Model, "fieldCasts", {});
3775
- /**
3776
- * The array of booted models.
3777
- */
3778
- __publicField(Model, "booted", {});
3779
- /**
3780
- * Lifecycle hook for before saving
3781
- */
3782
- __publicField(Model, "saving", () => {
3783
- });
3784
- /**
3785
- * Lifecycle hook for before updating
3786
- */
3787
- __publicField(Model, "updating", () => {
3788
- });
3789
- /**
3790
- * Lifecycle hook for before creating
3791
- */
3792
- __publicField(Model, "creating", () => {
3793
- });
3794
- /**
3795
- * Lifecycle hook for before deleting
3796
- */
3797
- __publicField(Model, "deleting", () => {
3798
- });
3799
- /**
3800
- * Lifecycle hook for after getting data
3801
- */
3802
- __publicField(Model, "retrieved", () => {
3803
- });
3804
- /**
3805
- * Lifecycle hook for after saved
3806
- */
3807
- __publicField(Model, "saved", () => {
3808
- });
3809
- /**
3810
- * Lifecycle hook for after updated
3811
- */
3812
- __publicField(Model, "updated", () => {
3813
- });
3814
- /**
3815
- * Lifecycle hook for after created
3816
- */
3817
- __publicField(Model, "created", () => {
3818
- });
3819
- /**
3820
- * Lifecycle hook for after deleted
3821
- */
3822
- __publicField(Model, "deleted", () => {
3823
- });
3824
3671
 
3825
3672
  exports.CastAttribute = CastAttribute.CastAttribute;
3826
3673
  exports.Attribute = Attribute;