as-model 0.1.25 → 0.1.26
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/README.md +558 -483
- package/dist/index.js +11 -4
- package/esm/store/enhance/signal.js +3 -3
- package/esm/validation/index.js +9 -1
- package/index.d.ts +322 -315
- package/package.json +68 -68
package/dist/index.js
CHANGED
|
@@ -186,12 +186,19 @@
|
|
|
186
186
|
}
|
|
187
187
|
return data.tokenIdentifier === tokenIdentifier && data.tokenIdentifier();
|
|
188
188
|
}
|
|
189
|
+
function isStoreIndex(data) {
|
|
190
|
+
if (!data) {
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
return !!data.key && isModelKey(data.key);
|
|
194
|
+
}
|
|
189
195
|
var validations = {
|
|
190
196
|
isInstanceFromNoStateModel,
|
|
191
197
|
isModelKey,
|
|
192
198
|
isModelStore,
|
|
193
199
|
isModelUsage,
|
|
194
|
-
isToken
|
|
200
|
+
isToken,
|
|
201
|
+
isStoreIndex
|
|
195
202
|
};
|
|
196
203
|
|
|
197
204
|
// src/tools/proxy.ts
|
|
@@ -907,7 +914,7 @@
|
|
|
907
914
|
// src/store/enhance/signal.ts
|
|
908
915
|
function createSignal(store) {
|
|
909
916
|
var signalStore = {
|
|
910
|
-
collection:
|
|
917
|
+
collection: {},
|
|
911
918
|
started: false,
|
|
912
919
|
enabled: false
|
|
913
920
|
};
|
|
@@ -919,7 +926,6 @@
|
|
|
919
926
|
}
|
|
920
927
|
var collection = signalStore.collection;
|
|
921
928
|
if (collection == null) {
|
|
922
|
-
dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher(action);
|
|
923
929
|
return;
|
|
924
930
|
}
|
|
925
931
|
var storeInstance = extractInstance(store.updater);
|
|
@@ -954,7 +960,6 @@
|
|
|
954
960
|
if (!signalStore.started) {
|
|
955
961
|
return;
|
|
956
962
|
}
|
|
957
|
-
signalStore.collection = signalStore.collection || {};
|
|
958
963
|
signalStore.collection[key] = val;
|
|
959
964
|
};
|
|
960
965
|
var getInstance = function getInstance2(options) {
|
|
@@ -966,9 +971,11 @@
|
|
|
966
971
|
};
|
|
967
972
|
signal.startStatistics = function startStatistics() {
|
|
968
973
|
signalStore.started = true;
|
|
974
|
+
signalStore.collection = {};
|
|
969
975
|
};
|
|
970
976
|
signal.stopStatistics = function stopStatistics() {
|
|
971
977
|
signalStore.started = false;
|
|
978
|
+
signalStore.collection = {};
|
|
972
979
|
};
|
|
973
980
|
signal.subscribe = function subscribe(dispatchCallback) {
|
|
974
981
|
return store.subscribe(dispatchCallback);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cacheIdentify, extractInstance } from "../instance";
|
|
2
2
|
function createSignal(store) {
|
|
3
3
|
const signalStore = {
|
|
4
|
-
collection:
|
|
4
|
+
collection: {},
|
|
5
5
|
started: false,
|
|
6
6
|
enabled: false
|
|
7
7
|
};
|
|
@@ -13,7 +13,6 @@ function createSignal(store) {
|
|
|
13
13
|
}
|
|
14
14
|
const { collection } = signalStore;
|
|
15
15
|
if (collection == null) {
|
|
16
|
-
dispatcher == null ? void 0 : dispatcher(action);
|
|
17
16
|
return;
|
|
18
17
|
}
|
|
19
18
|
const storeInstance = extractInstance(store.updater);
|
|
@@ -48,7 +47,6 @@ function createSignal(store) {
|
|
|
48
47
|
if (!signalStore.started) {
|
|
49
48
|
return;
|
|
50
49
|
}
|
|
51
|
-
signalStore.collection = signalStore.collection || {};
|
|
52
50
|
signalStore.collection[key] = val;
|
|
53
51
|
};
|
|
54
52
|
const getInstance = function getInstance2(options) {
|
|
@@ -63,9 +61,11 @@ function createSignal(store) {
|
|
|
63
61
|
};
|
|
64
62
|
signal.startStatistics = function startStatistics() {
|
|
65
63
|
signalStore.started = true;
|
|
64
|
+
signalStore.collection = {};
|
|
66
65
|
};
|
|
67
66
|
signal.stopStatistics = function stopStatistics() {
|
|
68
67
|
signalStore.started = false;
|
|
68
|
+
signalStore.collection = {};
|
|
69
69
|
};
|
|
70
70
|
signal.subscribe = function subscribe(dispatchCallback) {
|
|
71
71
|
return store.subscribe(dispatchCallback);
|
package/esm/validation/index.js
CHANGED
|
@@ -46,18 +46,26 @@ function isToken(data) {
|
|
|
46
46
|
}
|
|
47
47
|
return data.tokenIdentifier === tokenIdentifier && data.tokenIdentifier();
|
|
48
48
|
}
|
|
49
|
+
function isStoreIndex(data) {
|
|
50
|
+
if (!data) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
return !!data.key && isModelKey(data.key);
|
|
54
|
+
}
|
|
49
55
|
const validations = {
|
|
50
56
|
isInstanceFromNoStateModel,
|
|
51
57
|
isModelKey,
|
|
52
58
|
isModelStore,
|
|
53
59
|
isModelUsage,
|
|
54
|
-
isToken
|
|
60
|
+
isToken,
|
|
61
|
+
isStoreIndex
|
|
55
62
|
};
|
|
56
63
|
export {
|
|
57
64
|
createNoStateModel,
|
|
58
65
|
isModelKey,
|
|
59
66
|
isModelStore,
|
|
60
67
|
isModelUsage,
|
|
68
|
+
isStoreIndex,
|
|
61
69
|
isToken,
|
|
62
70
|
validations
|
|
63
71
|
};
|