pinia-orm-edge 1.10.0-28586201.60fc813 → 1.10.0-28683053.be0793d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/casts.d.cts CHANGED
@@ -1,7 +1,7 @@
1
- import { a0 as CastAttribute, m as ModelFields } from './shared/pinia-orm.f37062c8.cjs';
1
+ import { a0 as CastAttribute, m as ModelFields } from './shared/pinia-orm.52557866.cjs';
2
2
  import 'pinia';
3
- import '@pinia-orm/normalizr';
4
3
  import '@/composables';
4
+ import '@pinia-orm/normalizr';
5
5
 
6
6
  declare class ArrayCast extends CastAttribute {
7
7
  /**
package/dist/casts.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { a0 as CastAttribute, m as ModelFields } from './shared/pinia-orm.f37062c8.mjs';
1
+ import { a0 as CastAttribute, m as ModelFields } from './shared/pinia-orm.52557866.mjs';
2
2
  import 'pinia';
3
- import '@pinia-orm/normalizr';
4
3
  import '@/composables';
4
+ import '@pinia-orm/normalizr';
5
5
 
6
6
  declare class ArrayCast extends CastAttribute {
7
7
  /**
package/dist/casts.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { a0 as CastAttribute, m as ModelFields } from './shared/pinia-orm.f37062c8.js';
1
+ import { a0 as CastAttribute, m as ModelFields } from './shared/pinia-orm.52557866.js';
2
2
  import 'pinia';
3
- import '@pinia-orm/normalizr';
4
3
  import '@/composables';
4
+ import '@pinia-orm/normalizr';
5
5
 
6
6
  declare class ArrayCast extends CastAttribute {
7
7
  /**
@@ -143,6 +143,16 @@ function MorphToMany(related, pivot, relatedId, id, type, parentKey, relatedKey)
143
143
  };
144
144
  }
145
145
 
146
+ function MorphedByMany(related, pivot, relatedId, id, type, parentKey, relatedKey) {
147
+ return (target, propertyKey) => {
148
+ const self = target.$self();
149
+ self.setRegistry(
150
+ propertyKey,
151
+ () => self.morphedByMany(related(), pivot(), relatedId, id, type, parentKey, relatedKey)
152
+ );
153
+ };
154
+ }
155
+
146
156
  function MorphMany(related, id, type, localKey) {
147
157
  return (target, propertyKey) => {
148
158
  const self = target.$self();
@@ -211,6 +221,7 @@ exports.MorphMany = MorphMany;
211
221
  exports.MorphOne = MorphOne;
212
222
  exports.MorphTo = MorphTo;
213
223
  exports.MorphToMany = MorphToMany;
224
+ exports.MorphedByMany = MorphedByMany;
214
225
  exports.Mutate = Mutate;
215
226
  exports.NonEnumerable = NonEnumerable;
216
227
  exports.Num = Num;
@@ -1,8 +1,8 @@
1
- import { a1 as TypeDefault, an as PropertyDecorator, ao as TypeOptions, ap as UidOptions, M as Model, s as PrimaryKey, H as deleteModes, a0 as CastAttribute, aj as Mutator } from './shared/pinia-orm.f37062c8.cjs';
2
- export { aq as NanoidOptions } from './shared/pinia-orm.f37062c8.cjs';
1
+ import { a1 as TypeDefault, an as PropertyDecorator, ao as TypeOptions, ap as UidOptions, M as Model, s as PrimaryKey, H as deleteModes, a0 as CastAttribute, aj as Mutator } from './shared/pinia-orm.52557866.cjs';
2
+ export { aq as NanoidOptions } from './shared/pinia-orm.52557866.cjs';
3
3
  import 'pinia';
4
- import '@pinia-orm/normalizr';
5
4
  import '@/composables';
5
+ import '@pinia-orm/normalizr';
6
6
 
7
7
  /**
8
8
  * Create an Attr attribute property decorator.
@@ -74,6 +74,11 @@ declare function MorphTo(related: () => typeof Model[], id: string, type: string
74
74
  */
75
75
  declare function MorphToMany(related: () => typeof Model, pivot: () => typeof Model, relatedId: string, id: string, type: string, parentKey?: string, relatedKey?: string): PropertyDecorator;
76
76
 
77
+ /**
78
+ * Create a morph-to-many attribute property decorator.
79
+ */
80
+ declare function MorphedByMany(related: () => typeof Model, pivot: () => typeof Model, relatedId: string, id: string, type: string, parentKey?: string, relatedKey?: string): PropertyDecorator;
81
+
77
82
  /**
78
83
  * Create a morph-many attribute property decorator.
79
84
  */
@@ -104,4 +109,4 @@ declare function Hidden(): PropertyDecorator;
104
109
  */
105
110
  declare function NonEnumerable(target: any, propertyKey: string): void;
106
111
 
107
- export { Attr, BelongsTo, BelongsToMany, Bool, Cast, HasMany, HasManyBy, HasManyThrough, HasOne, Hidden, MorphMany, MorphOne, MorphTo, MorphToMany, Mutate, NonEnumerable, Num, OnDelete, PropertyDecorator, Str, TypeOptions, Uid, UidOptions };
112
+ export { Attr, BelongsTo, BelongsToMany, Bool, Cast, HasMany, HasManyBy, HasManyThrough, HasOne, Hidden, MorphMany, MorphOne, MorphTo, MorphToMany, MorphedByMany, Mutate, NonEnumerable, Num, OnDelete, PropertyDecorator, Str, TypeOptions, Uid, UidOptions };
@@ -1,8 +1,8 @@
1
- import { a1 as TypeDefault, an as PropertyDecorator, ao as TypeOptions, ap as UidOptions, M as Model, s as PrimaryKey, H as deleteModes, a0 as CastAttribute, aj as Mutator } from './shared/pinia-orm.f37062c8.mjs';
2
- export { aq as NanoidOptions } from './shared/pinia-orm.f37062c8.mjs';
1
+ import { a1 as TypeDefault, an as PropertyDecorator, ao as TypeOptions, ap as UidOptions, M as Model, s as PrimaryKey, H as deleteModes, a0 as CastAttribute, aj as Mutator } from './shared/pinia-orm.52557866.mjs';
2
+ export { aq as NanoidOptions } from './shared/pinia-orm.52557866.mjs';
3
3
  import 'pinia';
4
- import '@pinia-orm/normalizr';
5
4
  import '@/composables';
5
+ import '@pinia-orm/normalizr';
6
6
 
7
7
  /**
8
8
  * Create an Attr attribute property decorator.
@@ -74,6 +74,11 @@ declare function MorphTo(related: () => typeof Model[], id: string, type: string
74
74
  */
75
75
  declare function MorphToMany(related: () => typeof Model, pivot: () => typeof Model, relatedId: string, id: string, type: string, parentKey?: string, relatedKey?: string): PropertyDecorator;
76
76
 
77
+ /**
78
+ * Create a morph-to-many attribute property decorator.
79
+ */
80
+ declare function MorphedByMany(related: () => typeof Model, pivot: () => typeof Model, relatedId: string, id: string, type: string, parentKey?: string, relatedKey?: string): PropertyDecorator;
81
+
77
82
  /**
78
83
  * Create a morph-many attribute property decorator.
79
84
  */
@@ -104,4 +109,4 @@ declare function Hidden(): PropertyDecorator;
104
109
  */
105
110
  declare function NonEnumerable(target: any, propertyKey: string): void;
106
111
 
107
- export { Attr, BelongsTo, BelongsToMany, Bool, Cast, HasMany, HasManyBy, HasManyThrough, HasOne, Hidden, MorphMany, MorphOne, MorphTo, MorphToMany, Mutate, NonEnumerable, Num, OnDelete, PropertyDecorator, Str, TypeOptions, Uid, UidOptions };
112
+ export { Attr, BelongsTo, BelongsToMany, Bool, Cast, HasMany, HasManyBy, HasManyThrough, HasOne, Hidden, MorphMany, MorphOne, MorphTo, MorphToMany, MorphedByMany, Mutate, NonEnumerable, Num, OnDelete, PropertyDecorator, Str, TypeOptions, Uid, UidOptions };
@@ -1,8 +1,8 @@
1
- import { a1 as TypeDefault, an as PropertyDecorator, ao as TypeOptions, ap as UidOptions, M as Model, s as PrimaryKey, H as deleteModes, a0 as CastAttribute, aj as Mutator } from './shared/pinia-orm.f37062c8.js';
2
- export { aq as NanoidOptions } from './shared/pinia-orm.f37062c8.js';
1
+ import { a1 as TypeDefault, an as PropertyDecorator, ao as TypeOptions, ap as UidOptions, M as Model, s as PrimaryKey, H as deleteModes, a0 as CastAttribute, aj as Mutator } from './shared/pinia-orm.52557866.js';
2
+ export { aq as NanoidOptions } from './shared/pinia-orm.52557866.js';
3
3
  import 'pinia';
4
- import '@pinia-orm/normalizr';
5
4
  import '@/composables';
5
+ import '@pinia-orm/normalizr';
6
6
 
7
7
  /**
8
8
  * Create an Attr attribute property decorator.
@@ -74,6 +74,11 @@ declare function MorphTo(related: () => typeof Model[], id: string, type: string
74
74
  */
75
75
  declare function MorphToMany(related: () => typeof Model, pivot: () => typeof Model, relatedId: string, id: string, type: string, parentKey?: string, relatedKey?: string): PropertyDecorator;
76
76
 
77
+ /**
78
+ * Create a morph-to-many attribute property decorator.
79
+ */
80
+ declare function MorphedByMany(related: () => typeof Model, pivot: () => typeof Model, relatedId: string, id: string, type: string, parentKey?: string, relatedKey?: string): PropertyDecorator;
81
+
77
82
  /**
78
83
  * Create a morph-many attribute property decorator.
79
84
  */
@@ -104,4 +109,4 @@ declare function Hidden(): PropertyDecorator;
104
109
  */
105
110
  declare function NonEnumerable(target: any, propertyKey: string): void;
106
111
 
107
- export { Attr, BelongsTo, BelongsToMany, Bool, Cast, HasMany, HasManyBy, HasManyThrough, HasOne, Hidden, MorphMany, MorphOne, MorphTo, MorphToMany, Mutate, NonEnumerable, Num, OnDelete, PropertyDecorator, Str, TypeOptions, Uid, UidOptions };
112
+ export { Attr, BelongsTo, BelongsToMany, Bool, Cast, HasMany, HasManyBy, HasManyThrough, HasOne, Hidden, MorphMany, MorphOne, MorphTo, MorphToMany, MorphedByMany, Mutate, NonEnumerable, Num, OnDelete, PropertyDecorator, Str, TypeOptions, Uid, UidOptions };
@@ -141,6 +141,16 @@ function MorphToMany(related, pivot, relatedId, id, type, parentKey, relatedKey)
141
141
  };
142
142
  }
143
143
 
144
+ function MorphedByMany(related, pivot, relatedId, id, type, parentKey, relatedKey) {
145
+ return (target, propertyKey) => {
146
+ const self = target.$self();
147
+ self.setRegistry(
148
+ propertyKey,
149
+ () => self.morphedByMany(related(), pivot(), relatedId, id, type, parentKey, relatedKey)
150
+ );
151
+ };
152
+ }
153
+
144
154
  function MorphMany(related, id, type, localKey) {
145
155
  return (target, propertyKey) => {
146
156
  const self = target.$self();
@@ -195,4 +205,4 @@ function NonEnumerable(target, propertyKey) {
195
205
  }
196
206
  }
197
207
 
198
- export { Attr, BelongsTo, BelongsToMany, Bool, Cast, HasMany, HasManyBy, HasManyThrough, HasOne, Hidden, MorphMany, MorphOne, MorphTo, MorphToMany, Mutate, NonEnumerable, Num, OnDelete, Str, Uid };
208
+ export { Attr, BelongsTo, BelongsToMany, Bool, Cast, HasMany, HasManyBy, HasManyThrough, HasOne, Hidden, MorphMany, MorphOne, MorphTo, MorphToMany, MorphedByMany, Mutate, NonEnumerable, Num, OnDelete, Str, Uid };
package/dist/helpers.cjs CHANGED
@@ -66,4 +66,5 @@ exports.useKeys = useKeys;
66
66
  exports.useMax = useMax;
67
67
  exports.useMin = useMin;
68
68
  exports.usePluck = usePluck;
69
+ exports.useSortBy = useSortBy;
69
70
  exports.useSum = useSum;
@@ -1,11 +1,16 @@
1
- import { M as Model, b as Collection } from './shared/pinia-orm.f37062c8.cjs';
1
+ import { M as Model, b as Collection } from './shared/pinia-orm.52557866.cjs';
2
2
  import 'pinia';
3
- import '@pinia-orm/normalizr';
4
3
  import '@/composables';
4
+ import '@pinia-orm/normalizr';
5
5
 
6
6
  type SortFlags = 'SORT_REGULAR' | 'SORT_FLAG_CASE';
7
7
 
8
8
  type sorting<T> = ((record: T) => any) | string | [string, 'asc' | 'desc'][];
9
+ /**
10
+ * Creates an array of elements, sorted in specified order by the results
11
+ * of running each element in a collection thru each iteratee.
12
+ */
13
+ declare function useSortBy<T extends Record<string, any>>(collection: T[], sort: sorting<T>, flags?: SortFlags): T[];
9
14
 
10
15
  interface UseCollect<M extends Model = Model> {
11
16
  sum: (field: string) => number;
@@ -51,4 +56,4 @@ declare function useMax(models: Collection, field: string): number;
51
56
  */
52
57
  declare function usePluck(models: Collection, field: string): any[];
53
58
 
54
- export { type UseCollect, useCollect, useGroupBy, useKeys, useMax, useMin, usePluck, useSum };
59
+ export { type UseCollect, type sorting, useCollect, useGroupBy, useKeys, useMax, useMin, usePluck, useSortBy, useSum };
@@ -1,11 +1,16 @@
1
- import { M as Model, b as Collection } from './shared/pinia-orm.f37062c8.mjs';
1
+ import { M as Model, b as Collection } from './shared/pinia-orm.52557866.mjs';
2
2
  import 'pinia';
3
- import '@pinia-orm/normalizr';
4
3
  import '@/composables';
4
+ import '@pinia-orm/normalizr';
5
5
 
6
6
  type SortFlags = 'SORT_REGULAR' | 'SORT_FLAG_CASE';
7
7
 
8
8
  type sorting<T> = ((record: T) => any) | string | [string, 'asc' | 'desc'][];
9
+ /**
10
+ * Creates an array of elements, sorted in specified order by the results
11
+ * of running each element in a collection thru each iteratee.
12
+ */
13
+ declare function useSortBy<T extends Record<string, any>>(collection: T[], sort: sorting<T>, flags?: SortFlags): T[];
9
14
 
10
15
  interface UseCollect<M extends Model = Model> {
11
16
  sum: (field: string) => number;
@@ -51,4 +56,4 @@ declare function useMax(models: Collection, field: string): number;
51
56
  */
52
57
  declare function usePluck(models: Collection, field: string): any[];
53
58
 
54
- export { type UseCollect, useCollect, useGroupBy, useKeys, useMax, useMin, usePluck, useSum };
59
+ export { type UseCollect, type sorting, useCollect, useGroupBy, useKeys, useMax, useMin, usePluck, useSortBy, useSum };
package/dist/helpers.d.ts CHANGED
@@ -1,11 +1,16 @@
1
- import { M as Model, b as Collection } from './shared/pinia-orm.f37062c8.js';
1
+ import { M as Model, b as Collection } from './shared/pinia-orm.52557866.js';
2
2
  import 'pinia';
3
- import '@pinia-orm/normalizr';
4
3
  import '@/composables';
4
+ import '@pinia-orm/normalizr';
5
5
 
6
6
  type SortFlags = 'SORT_REGULAR' | 'SORT_FLAG_CASE';
7
7
 
8
8
  type sorting<T> = ((record: T) => any) | string | [string, 'asc' | 'desc'][];
9
+ /**
10
+ * Creates an array of elements, sorted in specified order by the results
11
+ * of running each element in a collection thru each iteratee.
12
+ */
13
+ declare function useSortBy<T extends Record<string, any>>(collection: T[], sort: sorting<T>, flags?: SortFlags): T[];
9
14
 
10
15
  interface UseCollect<M extends Model = Model> {
11
16
  sum: (field: string) => number;
@@ -51,4 +56,4 @@ declare function useMax(models: Collection, field: string): number;
51
56
  */
52
57
  declare function usePluck(models: Collection, field: string): any[];
53
58
 
54
- export { type UseCollect, useCollect, useGroupBy, useKeys, useMax, useMin, usePluck, useSum };
59
+ export { type UseCollect, type sorting, useCollect, useGroupBy, useKeys, useMax, useMin, usePluck, useSortBy, useSum };
package/dist/helpers.mjs CHANGED
@@ -58,4 +58,4 @@ function useCollect(models) {
58
58
  };
59
59
  }
60
60
 
61
- export { useCollect, useGroupBy, useKeys, useMax, useMin, usePluck, useSum };
61
+ export { useCollect, useGroupBy, useKeys, useMax, useMin, usePluck, useSortBy, useSum };