pinia-orm-edge 1.10.2-28925154.307285d → 1.10.2-28995613.4bc658f

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