as-model 0.1.4 → 0.1.5
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/index.js +11 -3
- package/esm/key/index.js +12 -4
- package/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1159,18 +1159,26 @@
|
|
|
1159
1159
|
return;
|
|
1160
1160
|
}
|
|
1161
1161
|
storeUnits.forEach(function(un, i) {
|
|
1162
|
-
var
|
|
1163
|
-
if (!
|
|
1162
|
+
var keyLike = keys[i];
|
|
1163
|
+
if (!keyLike) {
|
|
1164
1164
|
return;
|
|
1165
1165
|
}
|
|
1166
|
+
var ifIsModelKey = validations.isModelKey(keyLike);
|
|
1167
|
+
var key = ifIsModelKey ? keyLike : keyLike.key;
|
|
1166
1168
|
Object.assign(un, {
|
|
1167
1169
|
key
|
|
1168
1170
|
});
|
|
1169
1171
|
un.update({
|
|
1170
|
-
model:
|
|
1172
|
+
model: ifIsModelKey ? keyLike.source : keyLike.key.source
|
|
1171
1173
|
});
|
|
1172
1174
|
});
|
|
1173
1175
|
},
|
|
1176
|
+
keys: function keys() {
|
|
1177
|
+
return storeUnits.map(function(param) {
|
|
1178
|
+
var key = param.key;
|
|
1179
|
+
return key;
|
|
1180
|
+
});
|
|
1181
|
+
},
|
|
1174
1182
|
destroy: function destroy2() {
|
|
1175
1183
|
storeUnits.forEach(function(unit) {
|
|
1176
1184
|
unit.destroy();
|
package/esm/key/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
2
|
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
3
3
|
import { createStore, createPrimaryKey } from "../store";
|
|
4
|
-
import { isModelKey } from "../validation";
|
|
4
|
+
import { isModelKey, validations } from "../validation";
|
|
5
5
|
function createKey(model) {
|
|
6
6
|
var config = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
7
7
|
var wrapModel = createPrimaryKey(model, config);
|
|
@@ -47,18 +47,26 @@ function createStores(modelKeys) {
|
|
|
47
47
|
return;
|
|
48
48
|
}
|
|
49
49
|
storeUnits.forEach(function(un, i) {
|
|
50
|
-
var
|
|
51
|
-
if (!
|
|
50
|
+
var keyLike = keys[i];
|
|
51
|
+
if (!keyLike) {
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
+
var ifIsModelKey = validations.isModelKey(keyLike);
|
|
55
|
+
var key = ifIsModelKey ? keyLike : keyLike.key;
|
|
54
56
|
Object.assign(un, {
|
|
55
57
|
key
|
|
56
58
|
});
|
|
57
59
|
un.update({
|
|
58
|
-
model:
|
|
60
|
+
model: ifIsModelKey ? keyLike.source : keyLike.key.source
|
|
59
61
|
});
|
|
60
62
|
});
|
|
61
63
|
},
|
|
64
|
+
keys: function keys() {
|
|
65
|
+
return storeUnits.map(function(param) {
|
|
66
|
+
var key = param.key;
|
|
67
|
+
return key;
|
|
68
|
+
});
|
|
69
|
+
},
|
|
62
70
|
destroy: function destroy() {
|
|
63
71
|
storeUnits.forEach(function(unit) {
|
|
64
72
|
unit.destroy();
|
package/index.d.ts
CHANGED