pinia-orm-edge 1.10.0-28693034.220b093 → 1.10.0-28693772.aceb134
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 +1 -1
- package/dist/casts.d.mts +1 -1
- package/dist/casts.d.ts +1 -1
- package/dist/decorators.cjs +18 -9
- package/dist/decorators.d.cts +14 -5
- package/dist/decorators.d.mts +14 -5
- package/dist/decorators.d.ts +14 -5
- package/dist/decorators.mjs +18 -9
- package/dist/helpers.d.cts +1 -1
- package/dist/helpers.d.mts +1 -1
- package/dist/helpers.d.ts +1 -1
- package/dist/index.cjs +33 -23
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +33 -23
- package/dist/nanoid/async.d.cts +1 -1
- package/dist/nanoid/async.d.mts +1 -1
- package/dist/nanoid/async.d.ts +1 -1
- package/dist/nanoid/index.d.cts +1 -1
- package/dist/nanoid/index.d.mts +1 -1
- package/dist/nanoid/index.d.ts +1 -1
- package/dist/nanoid/non-secure.d.cts +1 -1
- package/dist/nanoid/non-secure.d.mts +1 -1
- package/dist/nanoid/non-secure.d.ts +1 -1
- package/dist/shared/{pinia-orm.e4d337f9.d.cts → pinia-orm.90cdba8c.d.cts} +9 -2
- package/dist/shared/{pinia-orm.e4d337f9.d.mts → pinia-orm.90cdba8c.d.mts} +9 -2
- package/dist/shared/{pinia-orm.e4d337f9.d.ts → pinia-orm.90cdba8c.d.ts} +9 -2
- package/dist/uuid/v1.d.cts +1 -1
- package/dist/uuid/v1.d.mts +1 -1
- package/dist/uuid/v1.d.ts +1 -1
- package/dist/uuid/v4.d.cts +1 -1
- package/dist/uuid/v4.d.mts +1 -1
- package/dist/uuid/v4.d.ts +1 -1
- package/package.json +2 -2
package/dist/casts.d.cts
CHANGED
package/dist/casts.d.mts
CHANGED
package/dist/casts.d.ts
CHANGED
package/dist/decorators.cjs
CHANGED
@@ -78,7 +78,12 @@ function BelongsToMany(related, pivot, foreignPivotKey, relatedPivotKey, parentK
|
|
78
78
|
const self = target.$self();
|
79
79
|
self.setRegistry(
|
80
80
|
propertyKey,
|
81
|
-
() =>
|
81
|
+
() => {
|
82
|
+
if (typeof pivot === "function") {
|
83
|
+
return self.belongsToMany(related(), pivot(), foreignPivotKey, relatedPivotKey, parentKey, relatedKey);
|
84
|
+
}
|
85
|
+
return self.belongsToMany(related(), pivot.model(), foreignPivotKey, relatedPivotKey, parentKey, relatedKey).as(pivot.as);
|
86
|
+
}
|
82
87
|
);
|
83
88
|
};
|
84
89
|
}
|
@@ -136,20 +141,24 @@ function MorphTo(related, id, type, ownerKey) {
|
|
136
141
|
function MorphToMany(related, pivot, relatedId, id, type, parentKey, relatedKey) {
|
137
142
|
return (target, propertyKey) => {
|
138
143
|
const self = target.$self();
|
139
|
-
self.setRegistry(
|
140
|
-
|
141
|
-
|
142
|
-
|
144
|
+
self.setRegistry(propertyKey, () => {
|
145
|
+
if (typeof pivot === "function") {
|
146
|
+
return self.morphToMany(related(), pivot(), relatedId, id, type, parentKey, relatedKey);
|
147
|
+
}
|
148
|
+
return self.morphToMany(related(), pivot.model(), relatedId, id, type, parentKey, relatedKey).as(pivot.as);
|
149
|
+
});
|
143
150
|
};
|
144
151
|
}
|
145
152
|
|
146
153
|
function MorphedByMany(related, pivot, relatedId, id, type, parentKey, relatedKey) {
|
147
154
|
return (target, propertyKey) => {
|
148
155
|
const self = target.$self();
|
149
|
-
self.setRegistry(
|
150
|
-
|
151
|
-
|
152
|
-
|
156
|
+
self.setRegistry(propertyKey, () => {
|
157
|
+
if (typeof pivot === "function") {
|
158
|
+
return self.morphedByMany(related(), pivot(), relatedId, id, type, parentKey, relatedKey);
|
159
|
+
}
|
160
|
+
return self.morphedByMany(related(), pivot.model(), relatedId, id, type, parentKey, relatedKey).as(pivot.as);
|
161
|
+
});
|
153
162
|
};
|
154
163
|
}
|
155
164
|
|
package/dist/decorators.d.cts
CHANGED
@@ -1,5 +1,5 @@
|
|
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.
|
2
|
-
export { aq as NanoidOptions } from './shared/pinia-orm.
|
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.90cdba8c.cjs';
|
2
|
+
export { aq as NanoidOptions } from './shared/pinia-orm.90cdba8c.cjs';
|
3
3
|
import 'pinia';
|
4
4
|
import '@/composables';
|
5
5
|
import '@pinia-orm/normalizr';
|
@@ -42,7 +42,10 @@ declare function BelongsTo(related: () => typeof Model, foreignKey: PrimaryKey,
|
|
42
42
|
/**
|
43
43
|
* Create a belongs-to-many attribute property decorator.
|
44
44
|
*/
|
45
|
-
declare function BelongsToMany(related: () => typeof Model, pivot: () => typeof Model
|
45
|
+
declare function BelongsToMany(related: () => typeof Model, pivot: (() => typeof Model) | {
|
46
|
+
as: string;
|
47
|
+
model: () => typeof Model;
|
48
|
+
}, foreignPivotKey: string, relatedPivotKey: string, parentKey?: string, relatedKey?: string): PropertyDecorator;
|
46
49
|
|
47
50
|
/**
|
48
51
|
* Create a has-many attribute property decorator.
|
@@ -72,12 +75,18 @@ declare function MorphTo(related: () => typeof Model[], id: string, type: string
|
|
72
75
|
/**
|
73
76
|
* Create a morph-to-many attribute property decorator.
|
74
77
|
*/
|
75
|
-
declare function MorphToMany(related: () => typeof Model, pivot: () => typeof Model
|
78
|
+
declare function MorphToMany(related: () => typeof Model, pivot: (() => typeof Model) | {
|
79
|
+
as: string;
|
80
|
+
model: () => typeof Model;
|
81
|
+
}, relatedId: string, id: string, type: string, parentKey?: string, relatedKey?: string): PropertyDecorator;
|
76
82
|
|
77
83
|
/**
|
78
84
|
* Create a morph-to-many attribute property decorator.
|
79
85
|
*/
|
80
|
-
declare function MorphedByMany(related: () => typeof Model, pivot: () => typeof Model
|
86
|
+
declare function MorphedByMany(related: () => typeof Model, pivot: (() => typeof Model) | {
|
87
|
+
as: string;
|
88
|
+
model: () => typeof Model;
|
89
|
+
}, relatedId: string, id: string, type: string, parentKey?: string, relatedKey?: string): PropertyDecorator;
|
81
90
|
|
82
91
|
/**
|
83
92
|
* Create a morph-many attribute property decorator.
|
package/dist/decorators.d.mts
CHANGED
@@ -1,5 +1,5 @@
|
|
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.
|
2
|
-
export { aq as NanoidOptions } from './shared/pinia-orm.
|
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.90cdba8c.mjs';
|
2
|
+
export { aq as NanoidOptions } from './shared/pinia-orm.90cdba8c.mjs';
|
3
3
|
import 'pinia';
|
4
4
|
import '@/composables';
|
5
5
|
import '@pinia-orm/normalizr';
|
@@ -42,7 +42,10 @@ declare function BelongsTo(related: () => typeof Model, foreignKey: PrimaryKey,
|
|
42
42
|
/**
|
43
43
|
* Create a belongs-to-many attribute property decorator.
|
44
44
|
*/
|
45
|
-
declare function BelongsToMany(related: () => typeof Model, pivot: () => typeof Model
|
45
|
+
declare function BelongsToMany(related: () => typeof Model, pivot: (() => typeof Model) | {
|
46
|
+
as: string;
|
47
|
+
model: () => typeof Model;
|
48
|
+
}, foreignPivotKey: string, relatedPivotKey: string, parentKey?: string, relatedKey?: string): PropertyDecorator;
|
46
49
|
|
47
50
|
/**
|
48
51
|
* Create a has-many attribute property decorator.
|
@@ -72,12 +75,18 @@ declare function MorphTo(related: () => typeof Model[], id: string, type: string
|
|
72
75
|
/**
|
73
76
|
* Create a morph-to-many attribute property decorator.
|
74
77
|
*/
|
75
|
-
declare function MorphToMany(related: () => typeof Model, pivot: () => typeof Model
|
78
|
+
declare function MorphToMany(related: () => typeof Model, pivot: (() => typeof Model) | {
|
79
|
+
as: string;
|
80
|
+
model: () => typeof Model;
|
81
|
+
}, relatedId: string, id: string, type: string, parentKey?: string, relatedKey?: string): PropertyDecorator;
|
76
82
|
|
77
83
|
/**
|
78
84
|
* Create a morph-to-many attribute property decorator.
|
79
85
|
*/
|
80
|
-
declare function MorphedByMany(related: () => typeof Model, pivot: () => typeof Model
|
86
|
+
declare function MorphedByMany(related: () => typeof Model, pivot: (() => typeof Model) | {
|
87
|
+
as: string;
|
88
|
+
model: () => typeof Model;
|
89
|
+
}, relatedId: string, id: string, type: string, parentKey?: string, relatedKey?: string): PropertyDecorator;
|
81
90
|
|
82
91
|
/**
|
83
92
|
* Create a morph-many attribute property decorator.
|
package/dist/decorators.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
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.
|
2
|
-
export { aq as NanoidOptions } from './shared/pinia-orm.
|
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.90cdba8c.js';
|
2
|
+
export { aq as NanoidOptions } from './shared/pinia-orm.90cdba8c.js';
|
3
3
|
import 'pinia';
|
4
4
|
import '@/composables';
|
5
5
|
import '@pinia-orm/normalizr';
|
@@ -42,7 +42,10 @@ declare function BelongsTo(related: () => typeof Model, foreignKey: PrimaryKey,
|
|
42
42
|
/**
|
43
43
|
* Create a belongs-to-many attribute property decorator.
|
44
44
|
*/
|
45
|
-
declare function BelongsToMany(related: () => typeof Model, pivot: () => typeof Model
|
45
|
+
declare function BelongsToMany(related: () => typeof Model, pivot: (() => typeof Model) | {
|
46
|
+
as: string;
|
47
|
+
model: () => typeof Model;
|
48
|
+
}, foreignPivotKey: string, relatedPivotKey: string, parentKey?: string, relatedKey?: string): PropertyDecorator;
|
46
49
|
|
47
50
|
/**
|
48
51
|
* Create a has-many attribute property decorator.
|
@@ -72,12 +75,18 @@ declare function MorphTo(related: () => typeof Model[], id: string, type: string
|
|
72
75
|
/**
|
73
76
|
* Create a morph-to-many attribute property decorator.
|
74
77
|
*/
|
75
|
-
declare function MorphToMany(related: () => typeof Model, pivot: () => typeof Model
|
78
|
+
declare function MorphToMany(related: () => typeof Model, pivot: (() => typeof Model) | {
|
79
|
+
as: string;
|
80
|
+
model: () => typeof Model;
|
81
|
+
}, relatedId: string, id: string, type: string, parentKey?: string, relatedKey?: string): PropertyDecorator;
|
76
82
|
|
77
83
|
/**
|
78
84
|
* Create a morph-to-many attribute property decorator.
|
79
85
|
*/
|
80
|
-
declare function MorphedByMany(related: () => typeof Model, pivot: () => typeof Model
|
86
|
+
declare function MorphedByMany(related: () => typeof Model, pivot: (() => typeof Model) | {
|
87
|
+
as: string;
|
88
|
+
model: () => typeof Model;
|
89
|
+
}, relatedId: string, id: string, type: string, parentKey?: string, relatedKey?: string): PropertyDecorator;
|
81
90
|
|
82
91
|
/**
|
83
92
|
* Create a morph-many attribute property decorator.
|
package/dist/decorators.mjs
CHANGED
@@ -76,7 +76,12 @@ function BelongsToMany(related, pivot, foreignPivotKey, relatedPivotKey, parentK
|
|
76
76
|
const self = target.$self();
|
77
77
|
self.setRegistry(
|
78
78
|
propertyKey,
|
79
|
-
() =>
|
79
|
+
() => {
|
80
|
+
if (typeof pivot === "function") {
|
81
|
+
return self.belongsToMany(related(), pivot(), foreignPivotKey, relatedPivotKey, parentKey, relatedKey);
|
82
|
+
}
|
83
|
+
return self.belongsToMany(related(), pivot.model(), foreignPivotKey, relatedPivotKey, parentKey, relatedKey).as(pivot.as);
|
84
|
+
}
|
80
85
|
);
|
81
86
|
};
|
82
87
|
}
|
@@ -134,20 +139,24 @@ function MorphTo(related, id, type, ownerKey) {
|
|
134
139
|
function MorphToMany(related, pivot, relatedId, id, type, parentKey, relatedKey) {
|
135
140
|
return (target, propertyKey) => {
|
136
141
|
const self = target.$self();
|
137
|
-
self.setRegistry(
|
138
|
-
|
139
|
-
|
140
|
-
|
142
|
+
self.setRegistry(propertyKey, () => {
|
143
|
+
if (typeof pivot === "function") {
|
144
|
+
return self.morphToMany(related(), pivot(), relatedId, id, type, parentKey, relatedKey);
|
145
|
+
}
|
146
|
+
return self.morphToMany(related(), pivot.model(), relatedId, id, type, parentKey, relatedKey).as(pivot.as);
|
147
|
+
});
|
141
148
|
};
|
142
149
|
}
|
143
150
|
|
144
151
|
function MorphedByMany(related, pivot, relatedId, id, type, parentKey, relatedKey) {
|
145
152
|
return (target, propertyKey) => {
|
146
153
|
const self = target.$self();
|
147
|
-
self.setRegistry(
|
148
|
-
|
149
|
-
|
150
|
-
|
154
|
+
self.setRegistry(propertyKey, () => {
|
155
|
+
if (typeof pivot === "function") {
|
156
|
+
return self.morphedByMany(related(), pivot(), relatedId, id, type, parentKey, relatedKey);
|
157
|
+
}
|
158
|
+
return self.morphedByMany(related(), pivot.model(), relatedId, id, type, parentKey, relatedKey).as(pivot.as);
|
159
|
+
});
|
151
160
|
};
|
152
161
|
}
|
153
162
|
|
package/dist/helpers.d.cts
CHANGED
package/dist/helpers.d.mts
CHANGED
package/dist/helpers.d.ts
CHANGED
package/dist/index.cjs
CHANGED
@@ -652,7 +652,7 @@ class BelongsToMany extends Relation {
|
|
652
652
|
* Attach the parent type and id to the given relation.
|
653
653
|
*/
|
654
654
|
attach(record, child) {
|
655
|
-
const pivot = child.
|
655
|
+
const pivot = child[this.pivotKey] ?? {};
|
656
656
|
pivot[this.foreignPivotKey] = record[this.parentKey];
|
657
657
|
pivot[this.relatedPivotKey] = child[this.relatedKey];
|
658
658
|
child[`pivot_${this.relatedPivotKey}_${this.pivot.$entity()}`] = pivot;
|
@@ -677,7 +677,7 @@ class BelongsToMany extends Relation {
|
|
677
677
|
return;
|
678
678
|
}
|
679
679
|
const relatedModelCopy = relatedModel.$newInstance(relatedModel.$toJson(), { operation: void 0 });
|
680
|
-
relatedModelCopy.$setRelation(
|
680
|
+
relatedModelCopy.$setRelation(this.pivotKey, pivot, true);
|
681
681
|
relationResults.push(relatedModelCopy);
|
682
682
|
});
|
683
683
|
parentModel.$setRelation(relation, relationResults);
|
@@ -688,6 +688,13 @@ class BelongsToMany extends Relation {
|
|
688
688
|
*/
|
689
689
|
addEagerConstraints(_query, _collection) {
|
690
690
|
}
|
691
|
+
/**
|
692
|
+
* Specify the custom pivot accessor to use for the relationship.
|
693
|
+
*/
|
694
|
+
as(accessor) {
|
695
|
+
this.pivotKey = accessor;
|
696
|
+
return this;
|
697
|
+
}
|
691
698
|
}
|
692
699
|
|
693
700
|
var __defProp$d = Object.defineProperty;
|
@@ -2812,7 +2819,7 @@ class MorphToMany extends Relation {
|
|
2812
2819
|
* Attach the parent type and id to the given relation.
|
2813
2820
|
*/
|
2814
2821
|
attach(record, child) {
|
2815
|
-
const pivot = child.
|
2822
|
+
const pivot = child[this.pivotKey] ?? {};
|
2816
2823
|
pivot[this.morphId] = record[this.parentKey];
|
2817
2824
|
pivot[this.morphType] = this.parent.$entity();
|
2818
2825
|
pivot[this.relatedId] = child[this.relatedKey];
|
@@ -2835,7 +2842,7 @@ class MorphToMany extends Relation {
|
|
2835
2842
|
relatedModels.forEach((relatedModel) => {
|
2836
2843
|
const pivot = pivotModels[`[${parentModel[this.parentKey]},${relatedModel[this.relatedKey]},${this.parent.$entity()}]`]?.[0] ?? null;
|
2837
2844
|
const relatedModelCopy = relatedModel.$newInstance(relatedModel.$toJson(), { operation: void 0 });
|
2838
|
-
relatedModelCopy.$setRelation(
|
2845
|
+
relatedModelCopy.$setRelation(this.pivotKey, pivot, true);
|
2839
2846
|
if (pivot) {
|
2840
2847
|
relationResults.push(relatedModelCopy);
|
2841
2848
|
}
|
@@ -2848,6 +2855,13 @@ class MorphToMany extends Relation {
|
|
2848
2855
|
*/
|
2849
2856
|
addEagerConstraints(_query, _collection) {
|
2850
2857
|
}
|
2858
|
+
/**
|
2859
|
+
* Specify the custom pivot accessor to use for the relationship.
|
2860
|
+
*/
|
2861
|
+
as(accessor) {
|
2862
|
+
this.pivotKey = accessor;
|
2863
|
+
return this;
|
2864
|
+
}
|
2851
2865
|
}
|
2852
2866
|
|
2853
2867
|
var __defProp$1 = Object.defineProperty;
|
@@ -2913,7 +2927,7 @@ class MorphedByMany extends Relation {
|
|
2913
2927
|
* Attach the parent type and id to the given relation.
|
2914
2928
|
*/
|
2915
2929
|
attach(record, child) {
|
2916
|
-
const pivot = record.
|
2930
|
+
const pivot = record[this.pivotKey] ?? {};
|
2917
2931
|
pivot[this.morphId] = child[this.relatedKey];
|
2918
2932
|
pivot[this.morphType] = this.related.$entity();
|
2919
2933
|
pivot[this.relatedId] = record[this.parentKey];
|
@@ -2932,18 +2946,13 @@ class MorphedByMany extends Relation {
|
|
2932
2946
|
const relatedModels = query.get(false);
|
2933
2947
|
const pivotModels = query.newQuery(this.pivot.$modelEntity()).whereIn(this.relatedId, this.getKeys(models, this.parentKey)).whereIn(this.morphId, this.getKeys(relatedModels, this.relatedKey)).groupBy(this.relatedId, this.morphType).get();
|
2934
2948
|
models.forEach((parentModel) => {
|
2935
|
-
const relationResults = [];
|
2936
2949
|
const resultModelIds = this.getKeys(pivotModels[`[${parentModel[this.parentKey]},${this.related.$entity()}]`] ?? [], this.morphId);
|
2937
2950
|
const relatedModelsFiltered = relatedModels.filter((filterdModel) => resultModelIds.includes(filterdModel[this.relatedKey]));
|
2938
|
-
|
2939
|
-
|
2940
|
-
|
2941
|
-
|
2942
|
-
|
2943
|
-
}
|
2944
|
-
relationResults.push(relatedModelCopy);
|
2945
|
-
});
|
2946
|
-
parentModel.$setRelation(relation, relationResults);
|
2951
|
+
const pivot = (pivotModels[`[${parentModel[this.parentKey]},${this.related.$entity()}]`] ?? [])?.[0] ?? null;
|
2952
|
+
if (pivot) {
|
2953
|
+
parentModel.$setRelation(this.pivotKey, pivot, true);
|
2954
|
+
}
|
2955
|
+
parentModel.$setRelation(relation, relatedModelsFiltered);
|
2947
2956
|
});
|
2948
2957
|
}
|
2949
2958
|
/**
|
@@ -2951,6 +2960,13 @@ class MorphedByMany extends Relation {
|
|
2951
2960
|
*/
|
2952
2961
|
addEagerConstraints(_query, _collection) {
|
2953
2962
|
}
|
2963
|
+
/**
|
2964
|
+
* Specify the custom pivot accessor to use for the relationship.
|
2965
|
+
*/
|
2966
|
+
as(accessor) {
|
2967
|
+
this.pivotKey = accessor;
|
2968
|
+
return this;
|
2969
|
+
}
|
2954
2970
|
}
|
2955
2971
|
|
2956
2972
|
var __defProp = Object.defineProperty;
|
@@ -2964,8 +2980,6 @@ class Model {
|
|
2964
2980
|
* Create a new model instance.
|
2965
2981
|
*/
|
2966
2982
|
constructor(attributes, options = { operation: "set" }) {
|
2967
|
-
// [s: keyof ModelFields]: any
|
2968
|
-
__publicField(this, "pivot");
|
2969
2983
|
this.$boot();
|
2970
2984
|
const fill = options.fill ?? true;
|
2971
2985
|
fill && this.$fill(attributes, options);
|
@@ -3537,12 +3551,8 @@ class Model {
|
|
3537
3551
|
/**
|
3538
3552
|
* Set the given relationship on the model.
|
3539
3553
|
*/
|
3540
|
-
$setRelation(relation, model) {
|
3541
|
-
if (
|
3542
|
-
this.pivot = model;
|
3543
|
-
return this;
|
3544
|
-
}
|
3545
|
-
if (this.$fields()[relation]) {
|
3554
|
+
$setRelation(relation, model, isPivot = false) {
|
3555
|
+
if (this.$fields()[relation] || isPivot) {
|
3546
3556
|
this[relation] = model;
|
3547
3557
|
}
|
3548
3558
|
return this;
|
package/dist/index.d.cts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { R as Repository, C as Constructor, M as Model, Q as Query, D as DataStore, E as Elements, W as WeakCache, F as FilledInstallOptions } from './shared/pinia-orm.
|
2
|
-
export { A as AfterHook, y as Attribute, B as BeforeHook, K as BelongsTo, L as BelongsToMany, am as CacheConfig, g as CacheConfigOptions, a0 as CastAttribute, $ as Casts, b as Collection, i as CreatePiniaOrm, c as DataStoreState, k as Database, z as Dictionary, ah as EagerLoad, ai as EagerLoadConstraint, a as Element, a6 as GetElementType, ac as Group, ae as GroupBy, af as GroupByFields, G as GroupedCollection, O as HasMany, U as HasManyBy, V as HasManyThrough, T as HasOne, w as InheritanceTypes, h as InstallOptions, a3 as Interpreter, I as Item, v as MetaValues, f as ModelConfigOptions, m as ModelFields, t as ModelOptions, o as ModelRegistries, q as ModelRegistry, n as ModelSchemas, X as MorphMany, _ as MorphOne, Y as MorphTo, Z as MorphToMany, aj as Mutator, ak as MutatorFunctions, al as Mutators, a5 as NonMethodKeys, N as NormalizedData, ab as Order, ad as OrderBy, ag as OrderDirection, d as PiniaOrmPlugin, P as PiniaOrmPluginContext, s as PrimaryKey, J as Relation, l as Schema, S as Schemas, a2 as Type, a1 as TypeDefault, a7 as UltimateKeys, a4 as Where, aa as WhereGroup, a8 as WherePrimaryClosure, a9 as WhereSecondaryClosure, x as WithKeys, j as createORM, e as definePiniaOrmPlugin, H as deleteModes, p as plugins, r as registerPlugins, u as useDataStore } from './shared/pinia-orm.
|
1
|
+
import { R as Repository, C as Constructor, M as Model, Q as Query, D as DataStore, E as Elements, W as WeakCache, F as FilledInstallOptions } from './shared/pinia-orm.90cdba8c.cjs';
|
2
|
+
export { A as AfterHook, y as Attribute, B as BeforeHook, K as BelongsTo, L as BelongsToMany, am as CacheConfig, g as CacheConfigOptions, a0 as CastAttribute, $ as Casts, b as Collection, i as CreatePiniaOrm, c as DataStoreState, k as Database, z as Dictionary, ah as EagerLoad, ai as EagerLoadConstraint, a as Element, a6 as GetElementType, ac as Group, ae as GroupBy, af as GroupByFields, G as GroupedCollection, O as HasMany, U as HasManyBy, V as HasManyThrough, T as HasOne, w as InheritanceTypes, h as InstallOptions, a3 as Interpreter, I as Item, v as MetaValues, f as ModelConfigOptions, m as ModelFields, t as ModelOptions, o as ModelRegistries, q as ModelRegistry, n as ModelSchemas, X as MorphMany, _ as MorphOne, Y as MorphTo, Z as MorphToMany, aj as Mutator, ak as MutatorFunctions, al as Mutators, a5 as NonMethodKeys, N as NormalizedData, ab as Order, ad as OrderBy, ag as OrderDirection, d as PiniaOrmPlugin, P as PiniaOrmPluginContext, s as PrimaryKey, J as Relation, l as Schema, S as Schemas, a2 as Type, a1 as TypeDefault, a7 as UltimateKeys, a4 as Where, aa as WhereGroup, a8 as WherePrimaryClosure, a9 as WhereSecondaryClosure, x as WithKeys, j as createORM, e as definePiniaOrmPlugin, H as deleteModes, p as plugins, r as registerPlugins, u as useDataStore } from './shared/pinia-orm.90cdba8c.cjs';
|
3
3
|
import { Pinia } from 'pinia';
|
4
4
|
import '@/composables';
|
5
5
|
import '@pinia-orm/normalizr';
|
package/dist/index.d.mts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { R as Repository, C as Constructor, M as Model, Q as Query, D as DataStore, E as Elements, W as WeakCache, F as FilledInstallOptions } from './shared/pinia-orm.
|
2
|
-
export { A as AfterHook, y as Attribute, B as BeforeHook, K as BelongsTo, L as BelongsToMany, am as CacheConfig, g as CacheConfigOptions, a0 as CastAttribute, $ as Casts, b as Collection, i as CreatePiniaOrm, c as DataStoreState, k as Database, z as Dictionary, ah as EagerLoad, ai as EagerLoadConstraint, a as Element, a6 as GetElementType, ac as Group, ae as GroupBy, af as GroupByFields, G as GroupedCollection, O as HasMany, U as HasManyBy, V as HasManyThrough, T as HasOne, w as InheritanceTypes, h as InstallOptions, a3 as Interpreter, I as Item, v as MetaValues, f as ModelConfigOptions, m as ModelFields, t as ModelOptions, o as ModelRegistries, q as ModelRegistry, n as ModelSchemas, X as MorphMany, _ as MorphOne, Y as MorphTo, Z as MorphToMany, aj as Mutator, ak as MutatorFunctions, al as Mutators, a5 as NonMethodKeys, N as NormalizedData, ab as Order, ad as OrderBy, ag as OrderDirection, d as PiniaOrmPlugin, P as PiniaOrmPluginContext, s as PrimaryKey, J as Relation, l as Schema, S as Schemas, a2 as Type, a1 as TypeDefault, a7 as UltimateKeys, a4 as Where, aa as WhereGroup, a8 as WherePrimaryClosure, a9 as WhereSecondaryClosure, x as WithKeys, j as createORM, e as definePiniaOrmPlugin, H as deleteModes, p as plugins, r as registerPlugins, u as useDataStore } from './shared/pinia-orm.
|
1
|
+
import { R as Repository, C as Constructor, M as Model, Q as Query, D as DataStore, E as Elements, W as WeakCache, F as FilledInstallOptions } from './shared/pinia-orm.90cdba8c.mjs';
|
2
|
+
export { A as AfterHook, y as Attribute, B as BeforeHook, K as BelongsTo, L as BelongsToMany, am as CacheConfig, g as CacheConfigOptions, a0 as CastAttribute, $ as Casts, b as Collection, i as CreatePiniaOrm, c as DataStoreState, k as Database, z as Dictionary, ah as EagerLoad, ai as EagerLoadConstraint, a as Element, a6 as GetElementType, ac as Group, ae as GroupBy, af as GroupByFields, G as GroupedCollection, O as HasMany, U as HasManyBy, V as HasManyThrough, T as HasOne, w as InheritanceTypes, h as InstallOptions, a3 as Interpreter, I as Item, v as MetaValues, f as ModelConfigOptions, m as ModelFields, t as ModelOptions, o as ModelRegistries, q as ModelRegistry, n as ModelSchemas, X as MorphMany, _ as MorphOne, Y as MorphTo, Z as MorphToMany, aj as Mutator, ak as MutatorFunctions, al as Mutators, a5 as NonMethodKeys, N as NormalizedData, ab as Order, ad as OrderBy, ag as OrderDirection, d as PiniaOrmPlugin, P as PiniaOrmPluginContext, s as PrimaryKey, J as Relation, l as Schema, S as Schemas, a2 as Type, a1 as TypeDefault, a7 as UltimateKeys, a4 as Where, aa as WhereGroup, a8 as WherePrimaryClosure, a9 as WhereSecondaryClosure, x as WithKeys, j as createORM, e as definePiniaOrmPlugin, H as deleteModes, p as plugins, r as registerPlugins, u as useDataStore } from './shared/pinia-orm.90cdba8c.mjs';
|
3
3
|
import { Pinia } from 'pinia';
|
4
4
|
import '@/composables';
|
5
5
|
import '@pinia-orm/normalizr';
|
package/dist/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { R as Repository, C as Constructor, M as Model, Q as Query, D as DataStore, E as Elements, W as WeakCache, F as FilledInstallOptions } from './shared/pinia-orm.
|
2
|
-
export { A as AfterHook, y as Attribute, B as BeforeHook, K as BelongsTo, L as BelongsToMany, am as CacheConfig, g as CacheConfigOptions, a0 as CastAttribute, $ as Casts, b as Collection, i as CreatePiniaOrm, c as DataStoreState, k as Database, z as Dictionary, ah as EagerLoad, ai as EagerLoadConstraint, a as Element, a6 as GetElementType, ac as Group, ae as GroupBy, af as GroupByFields, G as GroupedCollection, O as HasMany, U as HasManyBy, V as HasManyThrough, T as HasOne, w as InheritanceTypes, h as InstallOptions, a3 as Interpreter, I as Item, v as MetaValues, f as ModelConfigOptions, m as ModelFields, t as ModelOptions, o as ModelRegistries, q as ModelRegistry, n as ModelSchemas, X as MorphMany, _ as MorphOne, Y as MorphTo, Z as MorphToMany, aj as Mutator, ak as MutatorFunctions, al as Mutators, a5 as NonMethodKeys, N as NormalizedData, ab as Order, ad as OrderBy, ag as OrderDirection, d as PiniaOrmPlugin, P as PiniaOrmPluginContext, s as PrimaryKey, J as Relation, l as Schema, S as Schemas, a2 as Type, a1 as TypeDefault, a7 as UltimateKeys, a4 as Where, aa as WhereGroup, a8 as WherePrimaryClosure, a9 as WhereSecondaryClosure, x as WithKeys, j as createORM, e as definePiniaOrmPlugin, H as deleteModes, p as plugins, r as registerPlugins, u as useDataStore } from './shared/pinia-orm.
|
1
|
+
import { R as Repository, C as Constructor, M as Model, Q as Query, D as DataStore, E as Elements, W as WeakCache, F as FilledInstallOptions } from './shared/pinia-orm.90cdba8c.js';
|
2
|
+
export { A as AfterHook, y as Attribute, B as BeforeHook, K as BelongsTo, L as BelongsToMany, am as CacheConfig, g as CacheConfigOptions, a0 as CastAttribute, $ as Casts, b as Collection, i as CreatePiniaOrm, c as DataStoreState, k as Database, z as Dictionary, ah as EagerLoad, ai as EagerLoadConstraint, a as Element, a6 as GetElementType, ac as Group, ae as GroupBy, af as GroupByFields, G as GroupedCollection, O as HasMany, U as HasManyBy, V as HasManyThrough, T as HasOne, w as InheritanceTypes, h as InstallOptions, a3 as Interpreter, I as Item, v as MetaValues, f as ModelConfigOptions, m as ModelFields, t as ModelOptions, o as ModelRegistries, q as ModelRegistry, n as ModelSchemas, X as MorphMany, _ as MorphOne, Y as MorphTo, Z as MorphToMany, aj as Mutator, ak as MutatorFunctions, al as Mutators, a5 as NonMethodKeys, N as NormalizedData, ab as Order, ad as OrderBy, ag as OrderDirection, d as PiniaOrmPlugin, P as PiniaOrmPluginContext, s as PrimaryKey, J as Relation, l as Schema, S as Schemas, a2 as Type, a1 as TypeDefault, a7 as UltimateKeys, a4 as Where, aa as WhereGroup, a8 as WherePrimaryClosure, a9 as WhereSecondaryClosure, x as WithKeys, j as createORM, e as definePiniaOrmPlugin, H as deleteModes, p as plugins, r as registerPlugins, u as useDataStore } from './shared/pinia-orm.90cdba8c.js';
|
3
3
|
import { Pinia } from 'pinia';
|
4
4
|
import '@/composables';
|
5
5
|
import '@pinia-orm/normalizr';
|
package/dist/index.mjs
CHANGED
@@ -650,7 +650,7 @@ class BelongsToMany extends Relation {
|
|
650
650
|
* Attach the parent type and id to the given relation.
|
651
651
|
*/
|
652
652
|
attach(record, child) {
|
653
|
-
const pivot = child.
|
653
|
+
const pivot = child[this.pivotKey] ?? {};
|
654
654
|
pivot[this.foreignPivotKey] = record[this.parentKey];
|
655
655
|
pivot[this.relatedPivotKey] = child[this.relatedKey];
|
656
656
|
child[`pivot_${this.relatedPivotKey}_${this.pivot.$entity()}`] = pivot;
|
@@ -675,7 +675,7 @@ class BelongsToMany extends Relation {
|
|
675
675
|
return;
|
676
676
|
}
|
677
677
|
const relatedModelCopy = relatedModel.$newInstance(relatedModel.$toJson(), { operation: void 0 });
|
678
|
-
relatedModelCopy.$setRelation(
|
678
|
+
relatedModelCopy.$setRelation(this.pivotKey, pivot, true);
|
679
679
|
relationResults.push(relatedModelCopy);
|
680
680
|
});
|
681
681
|
parentModel.$setRelation(relation, relationResults);
|
@@ -686,6 +686,13 @@ class BelongsToMany extends Relation {
|
|
686
686
|
*/
|
687
687
|
addEagerConstraints(_query, _collection) {
|
688
688
|
}
|
689
|
+
/**
|
690
|
+
* Specify the custom pivot accessor to use for the relationship.
|
691
|
+
*/
|
692
|
+
as(accessor) {
|
693
|
+
this.pivotKey = accessor;
|
694
|
+
return this;
|
695
|
+
}
|
689
696
|
}
|
690
697
|
|
691
698
|
var __defProp$d = Object.defineProperty;
|
@@ -2810,7 +2817,7 @@ class MorphToMany extends Relation {
|
|
2810
2817
|
* Attach the parent type and id to the given relation.
|
2811
2818
|
*/
|
2812
2819
|
attach(record, child) {
|
2813
|
-
const pivot = child.
|
2820
|
+
const pivot = child[this.pivotKey] ?? {};
|
2814
2821
|
pivot[this.morphId] = record[this.parentKey];
|
2815
2822
|
pivot[this.morphType] = this.parent.$entity();
|
2816
2823
|
pivot[this.relatedId] = child[this.relatedKey];
|
@@ -2833,7 +2840,7 @@ class MorphToMany extends Relation {
|
|
2833
2840
|
relatedModels.forEach((relatedModel) => {
|
2834
2841
|
const pivot = pivotModels[`[${parentModel[this.parentKey]},${relatedModel[this.relatedKey]},${this.parent.$entity()}]`]?.[0] ?? null;
|
2835
2842
|
const relatedModelCopy = relatedModel.$newInstance(relatedModel.$toJson(), { operation: void 0 });
|
2836
|
-
relatedModelCopy.$setRelation(
|
2843
|
+
relatedModelCopy.$setRelation(this.pivotKey, pivot, true);
|
2837
2844
|
if (pivot) {
|
2838
2845
|
relationResults.push(relatedModelCopy);
|
2839
2846
|
}
|
@@ -2846,6 +2853,13 @@ class MorphToMany extends Relation {
|
|
2846
2853
|
*/
|
2847
2854
|
addEagerConstraints(_query, _collection) {
|
2848
2855
|
}
|
2856
|
+
/**
|
2857
|
+
* Specify the custom pivot accessor to use for the relationship.
|
2858
|
+
*/
|
2859
|
+
as(accessor) {
|
2860
|
+
this.pivotKey = accessor;
|
2861
|
+
return this;
|
2862
|
+
}
|
2849
2863
|
}
|
2850
2864
|
|
2851
2865
|
var __defProp$1 = Object.defineProperty;
|
@@ -2911,7 +2925,7 @@ class MorphedByMany extends Relation {
|
|
2911
2925
|
* Attach the parent type and id to the given relation.
|
2912
2926
|
*/
|
2913
2927
|
attach(record, child) {
|
2914
|
-
const pivot = record.
|
2928
|
+
const pivot = record[this.pivotKey] ?? {};
|
2915
2929
|
pivot[this.morphId] = child[this.relatedKey];
|
2916
2930
|
pivot[this.morphType] = this.related.$entity();
|
2917
2931
|
pivot[this.relatedId] = record[this.parentKey];
|
@@ -2930,18 +2944,13 @@ class MorphedByMany extends Relation {
|
|
2930
2944
|
const relatedModels = query.get(false);
|
2931
2945
|
const pivotModels = query.newQuery(this.pivot.$modelEntity()).whereIn(this.relatedId, this.getKeys(models, this.parentKey)).whereIn(this.morphId, this.getKeys(relatedModels, this.relatedKey)).groupBy(this.relatedId, this.morphType).get();
|
2932
2946
|
models.forEach((parentModel) => {
|
2933
|
-
const relationResults = [];
|
2934
2947
|
const resultModelIds = this.getKeys(pivotModels[`[${parentModel[this.parentKey]},${this.related.$entity()}]`] ?? [], this.morphId);
|
2935
2948
|
const relatedModelsFiltered = relatedModels.filter((filterdModel) => resultModelIds.includes(filterdModel[this.relatedKey]));
|
2936
|
-
|
2937
|
-
|
2938
|
-
|
2939
|
-
|
2940
|
-
|
2941
|
-
}
|
2942
|
-
relationResults.push(relatedModelCopy);
|
2943
|
-
});
|
2944
|
-
parentModel.$setRelation(relation, relationResults);
|
2949
|
+
const pivot = (pivotModels[`[${parentModel[this.parentKey]},${this.related.$entity()}]`] ?? [])?.[0] ?? null;
|
2950
|
+
if (pivot) {
|
2951
|
+
parentModel.$setRelation(this.pivotKey, pivot, true);
|
2952
|
+
}
|
2953
|
+
parentModel.$setRelation(relation, relatedModelsFiltered);
|
2945
2954
|
});
|
2946
2955
|
}
|
2947
2956
|
/**
|
@@ -2949,6 +2958,13 @@ class MorphedByMany extends Relation {
|
|
2949
2958
|
*/
|
2950
2959
|
addEagerConstraints(_query, _collection) {
|
2951
2960
|
}
|
2961
|
+
/**
|
2962
|
+
* Specify the custom pivot accessor to use for the relationship.
|
2963
|
+
*/
|
2964
|
+
as(accessor) {
|
2965
|
+
this.pivotKey = accessor;
|
2966
|
+
return this;
|
2967
|
+
}
|
2952
2968
|
}
|
2953
2969
|
|
2954
2970
|
var __defProp = Object.defineProperty;
|
@@ -2962,8 +2978,6 @@ class Model {
|
|
2962
2978
|
* Create a new model instance.
|
2963
2979
|
*/
|
2964
2980
|
constructor(attributes, options = { operation: "set" }) {
|
2965
|
-
// [s: keyof ModelFields]: any
|
2966
|
-
__publicField(this, "pivot");
|
2967
2981
|
this.$boot();
|
2968
2982
|
const fill = options.fill ?? true;
|
2969
2983
|
fill && this.$fill(attributes, options);
|
@@ -3535,12 +3549,8 @@ class Model {
|
|
3535
3549
|
/**
|
3536
3550
|
* Set the given relationship on the model.
|
3537
3551
|
*/
|
3538
|
-
$setRelation(relation, model) {
|
3539
|
-
if (
|
3540
|
-
this.pivot = model;
|
3541
|
-
return this;
|
3542
|
-
}
|
3543
|
-
if (this.$fields()[relation]) {
|
3552
|
+
$setRelation(relation, model, isPivot = false) {
|
3553
|
+
if (this.$fields()[relation] || isPivot) {
|
3544
3554
|
this[relation] = model;
|
3545
3555
|
}
|
3546
3556
|
return this;
|
package/dist/nanoid/async.d.cts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.
|
1
|
+
import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.90cdba8c.cjs';
|
2
2
|
import 'pinia';
|
3
3
|
import '@/composables';
|
4
4
|
import '@pinia-orm/normalizr';
|
package/dist/nanoid/async.d.mts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.
|
1
|
+
import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.90cdba8c.mjs';
|
2
2
|
import 'pinia';
|
3
3
|
import '@/composables';
|
4
4
|
import '@pinia-orm/normalizr';
|
package/dist/nanoid/async.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.
|
1
|
+
import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.90cdba8c.js';
|
2
2
|
import 'pinia';
|
3
3
|
import '@/composables';
|
4
4
|
import '@pinia-orm/normalizr';
|
package/dist/nanoid/index.d.cts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.
|
1
|
+
import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.90cdba8c.cjs';
|
2
2
|
import 'pinia';
|
3
3
|
import '@/composables';
|
4
4
|
import '@pinia-orm/normalizr';
|
package/dist/nanoid/index.d.mts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.
|
1
|
+
import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.90cdba8c.mjs';
|
2
2
|
import 'pinia';
|
3
3
|
import '@/composables';
|
4
4
|
import '@pinia-orm/normalizr';
|
package/dist/nanoid/index.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.
|
1
|
+
import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.90cdba8c.js';
|
2
2
|
import 'pinia';
|
3
3
|
import '@/composables';
|
4
4
|
import '@pinia-orm/normalizr';
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.
|
1
|
+
import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.90cdba8c.cjs';
|
2
2
|
import 'pinia';
|
3
3
|
import '@/composables';
|
4
4
|
import '@pinia-orm/normalizr';
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.
|
1
|
+
import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.90cdba8c.mjs';
|
2
2
|
import 'pinia';
|
3
3
|
import '@/composables';
|
4
4
|
import '@pinia-orm/normalizr';
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.
|
1
|
+
import { a0 as CastAttribute, aq as NanoidOptions, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.90cdba8c.js';
|
2
2
|
import 'pinia';
|
3
3
|
import '@/composables';
|
4
4
|
import '@pinia-orm/normalizr';
|
@@ -888,6 +888,10 @@ declare class BelongsToMany extends Relation {
|
|
888
888
|
* Set the constraints for the related relation.
|
889
889
|
*/
|
890
890
|
addEagerConstraints(_query: Query, _collection: Collection): void;
|
891
|
+
/**
|
892
|
+
* Specify the custom pivot accessor to use for the relationship.
|
893
|
+
*/
|
894
|
+
as(accessor: string): this;
|
891
895
|
}
|
892
896
|
|
893
897
|
declare class HasMany extends Relation {
|
@@ -1317,6 +1321,10 @@ declare class MorphToMany extends Relation {
|
|
1317
1321
|
* Set the constraints for the related relation.
|
1318
1322
|
*/
|
1319
1323
|
addEagerConstraints(_query: Query, _collection: Collection): void;
|
1324
|
+
/**
|
1325
|
+
* Specify the custom pivot accessor to use for the relationship.
|
1326
|
+
*/
|
1327
|
+
as(accessor: string): this;
|
1320
1328
|
}
|
1321
1329
|
|
1322
1330
|
type ModelFields = Record<string, Attribute>;
|
@@ -1350,7 +1358,6 @@ type WithKeys<T> = {
|
|
1350
1358
|
[P in keyof T]: T[P] extends (Model | null) | Model[] ? P & string : never;
|
1351
1359
|
}[keyof T];
|
1352
1360
|
declare class Model {
|
1353
|
-
pivot?: any;
|
1354
1361
|
_meta: undefined | MetaValues;
|
1355
1362
|
/**
|
1356
1363
|
* The name of the model.
|
@@ -1721,7 +1728,7 @@ declare class Model {
|
|
1721
1728
|
/**
|
1722
1729
|
* Set the given relationship on the model.
|
1723
1730
|
*/
|
1724
|
-
$setRelation(relation: string, model: Model | Model[] | null): this;
|
1731
|
+
$setRelation(relation: string, model: Model | Model[] | null, isPivot?: boolean): this;
|
1725
1732
|
/**
|
1726
1733
|
* Get the mutators of the model
|
1727
1734
|
*/
|
@@ -888,6 +888,10 @@ declare class BelongsToMany extends Relation {
|
|
888
888
|
* Set the constraints for the related relation.
|
889
889
|
*/
|
890
890
|
addEagerConstraints(_query: Query, _collection: Collection): void;
|
891
|
+
/**
|
892
|
+
* Specify the custom pivot accessor to use for the relationship.
|
893
|
+
*/
|
894
|
+
as(accessor: string): this;
|
891
895
|
}
|
892
896
|
|
893
897
|
declare class HasMany extends Relation {
|
@@ -1317,6 +1321,10 @@ declare class MorphToMany extends Relation {
|
|
1317
1321
|
* Set the constraints for the related relation.
|
1318
1322
|
*/
|
1319
1323
|
addEagerConstraints(_query: Query, _collection: Collection): void;
|
1324
|
+
/**
|
1325
|
+
* Specify the custom pivot accessor to use for the relationship.
|
1326
|
+
*/
|
1327
|
+
as(accessor: string): this;
|
1320
1328
|
}
|
1321
1329
|
|
1322
1330
|
type ModelFields = Record<string, Attribute>;
|
@@ -1350,7 +1358,6 @@ type WithKeys<T> = {
|
|
1350
1358
|
[P in keyof T]: T[P] extends (Model | null) | Model[] ? P & string : never;
|
1351
1359
|
}[keyof T];
|
1352
1360
|
declare class Model {
|
1353
|
-
pivot?: any;
|
1354
1361
|
_meta: undefined | MetaValues;
|
1355
1362
|
/**
|
1356
1363
|
* The name of the model.
|
@@ -1721,7 +1728,7 @@ declare class Model {
|
|
1721
1728
|
/**
|
1722
1729
|
* Set the given relationship on the model.
|
1723
1730
|
*/
|
1724
|
-
$setRelation(relation: string, model: Model | Model[] | null): this;
|
1731
|
+
$setRelation(relation: string, model: Model | Model[] | null, isPivot?: boolean): this;
|
1725
1732
|
/**
|
1726
1733
|
* Get the mutators of the model
|
1727
1734
|
*/
|
@@ -888,6 +888,10 @@ declare class BelongsToMany extends Relation {
|
|
888
888
|
* Set the constraints for the related relation.
|
889
889
|
*/
|
890
890
|
addEagerConstraints(_query: Query, _collection: Collection): void;
|
891
|
+
/**
|
892
|
+
* Specify the custom pivot accessor to use for the relationship.
|
893
|
+
*/
|
894
|
+
as(accessor: string): this;
|
891
895
|
}
|
892
896
|
|
893
897
|
declare class HasMany extends Relation {
|
@@ -1317,6 +1321,10 @@ declare class MorphToMany extends Relation {
|
|
1317
1321
|
* Set the constraints for the related relation.
|
1318
1322
|
*/
|
1319
1323
|
addEagerConstraints(_query: Query, _collection: Collection): void;
|
1324
|
+
/**
|
1325
|
+
* Specify the custom pivot accessor to use for the relationship.
|
1326
|
+
*/
|
1327
|
+
as(accessor: string): this;
|
1320
1328
|
}
|
1321
1329
|
|
1322
1330
|
type ModelFields = Record<string, Attribute>;
|
@@ -1350,7 +1358,6 @@ type WithKeys<T> = {
|
|
1350
1358
|
[P in keyof T]: T[P] extends (Model | null) | Model[] ? P & string : never;
|
1351
1359
|
}[keyof T];
|
1352
1360
|
declare class Model {
|
1353
|
-
pivot?: any;
|
1354
1361
|
_meta: undefined | MetaValues;
|
1355
1362
|
/**
|
1356
1363
|
* The name of the model.
|
@@ -1721,7 +1728,7 @@ declare class Model {
|
|
1721
1728
|
/**
|
1722
1729
|
* Set the given relationship on the model.
|
1723
1730
|
*/
|
1724
|
-
$setRelation(relation: string, model: Model | Model[] | null): this;
|
1731
|
+
$setRelation(relation: string, model: Model | Model[] | null, isPivot?: boolean): this;
|
1725
1732
|
/**
|
1726
1733
|
* Get the mutators of the model
|
1727
1734
|
*/
|
package/dist/uuid/v1.d.cts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { V1Options } from 'uuid';
|
2
|
-
import { a0 as CastAttribute, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.
|
2
|
+
import { a0 as CastAttribute, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.90cdba8c.cjs';
|
3
3
|
import 'pinia';
|
4
4
|
import '@/composables';
|
5
5
|
import '@pinia-orm/normalizr';
|
package/dist/uuid/v1.d.mts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { V1Options } from 'uuid';
|
2
|
-
import { a0 as CastAttribute, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.
|
2
|
+
import { a0 as CastAttribute, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.90cdba8c.mjs';
|
3
3
|
import 'pinia';
|
4
4
|
import '@/composables';
|
5
5
|
import '@pinia-orm/normalizr';
|
package/dist/uuid/v1.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { V1Options } from 'uuid';
|
2
|
-
import { a0 as CastAttribute, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.
|
2
|
+
import { a0 as CastAttribute, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.90cdba8c.js';
|
3
3
|
import 'pinia';
|
4
4
|
import '@/composables';
|
5
5
|
import '@pinia-orm/normalizr';
|
package/dist/uuid/v4.d.cts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { V4Options } from 'uuid';
|
2
|
-
import { a0 as CastAttribute, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.
|
2
|
+
import { a0 as CastAttribute, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.90cdba8c.cjs';
|
3
3
|
import 'pinia';
|
4
4
|
import '@/composables';
|
5
5
|
import '@pinia-orm/normalizr';
|
package/dist/uuid/v4.d.mts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { V4Options } from 'uuid';
|
2
|
-
import { a0 as CastAttribute, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.
|
2
|
+
import { a0 as CastAttribute, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.90cdba8c.mjs';
|
3
3
|
import 'pinia';
|
4
4
|
import '@/composables';
|
5
5
|
import '@pinia-orm/normalizr';
|
package/dist/uuid/v4.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { V4Options } from 'uuid';
|
2
|
-
import { a0 as CastAttribute, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.
|
2
|
+
import { a0 as CastAttribute, m as ModelFields, an as PropertyDecorator } from '../shared/pinia-orm.90cdba8c.js';
|
3
3
|
import 'pinia';
|
4
4
|
import '@/composables';
|
5
5
|
import '@pinia-orm/normalizr';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "pinia-orm-edge",
|
3
|
-
"version": "1.10.0-
|
3
|
+
"version": "1.10.0-28693772.aceb134",
|
4
4
|
"description": "The Pinia plugin to enable Object-Relational Mapping access to the Pinia Store.",
|
5
5
|
"keywords": [
|
6
6
|
"vue",
|
@@ -46,7 +46,7 @@
|
|
46
46
|
"pinia": "^2.1.7"
|
47
47
|
},
|
48
48
|
"dependencies": {
|
49
|
-
"@pinia-orm/normalizr": "npm:@pinia-orm/normalizr-edge@1.10.0-
|
49
|
+
"@pinia-orm/normalizr": "npm:@pinia-orm/normalizr-edge@1.10.0-28693772.aceb134"
|
50
50
|
},
|
51
51
|
"devDependencies": {
|
52
52
|
"@nuxt/eslint-config": "^0.3.13",
|