reactant-model 0.109.0 → 0.111.0
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/model.d.ts +1 -1
- package/dist/model.d.ts.map +1 -1
- package/package.json +4 -4
- package/test/index.test.ts +8 -5
package/dist/model.d.ts
CHANGED
|
@@ -7,6 +7,6 @@ interface Scheme<S, A> {
|
|
|
7
7
|
type Actions<T extends Record<string, (...args: any[]) => any>> = {
|
|
8
8
|
[P in keyof T]: (...parameters: Parameters<T[P]>) => void;
|
|
9
9
|
};
|
|
10
|
-
export declare const model: <S extends Record<string, any>, A extends Record<string, (...args: any[]) => (state: S) => void>>(scheme: Scheme<S, A>) =>
|
|
10
|
+
export declare const model: <S extends Record<string, any>, A extends Record<string, (...args: any[]) => (state: S) => void>>(scheme: Scheme<S, A>) => Actions<A> & Service<S> & S;
|
|
11
11
|
export {};
|
|
12
12
|
//# sourceMappingURL=model.d.ts.map
|
package/dist/model.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,OAAO,EASR,MAAM,iBAAiB,CAAC;AAEzB,UAAU,MAAM,CAAC,CAAC,EAAE,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,CAAC,CAAC;IACT,OAAO,EAAE,CAAC,CAAC;CACZ;AAED,KAAK,OAAO,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,IAAI;KAC/D,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI;CAC1D,CAAC;AAEF,eAAO,MAAM,KAAK,qEAEmB,GAAG,EAAE,mBAAmB,IAAI
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,OAAO,EASR,MAAM,iBAAiB,CAAC;AAEzB,UAAU,MAAM,CAAC,CAAC,EAAE,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,CAAC,CAAC;IACT,OAAO,EAAE,CAAC,CAAC;CACZ;AAED,KAAK,OAAO,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,IAAI;KAC/D,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI;CAC1D,CAAC;AAEF,eAAO,MAAM,KAAK,qEAEmB,GAAG,EAAE,mBAAmB,IAAI,WAEvD,OAAO,CAAC,EAAE,CAAC,CAAC,KACnB,QAAQ,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,CA4D5B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reactant-model",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.111.0",
|
|
4
4
|
"description": "A model lib for Reactant",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"unpkg": "dist/index.umd.js",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
],
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"mutative": "^1.0.
|
|
30
|
+
"mutative": "^1.0.6",
|
|
31
31
|
"reactant-module": "*"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"mutative": "^1.0.
|
|
35
|
-
"reactant-module": "^0.
|
|
34
|
+
"mutative": "^1.0.6",
|
|
35
|
+
"reactant-module": "^0.111.0"
|
|
36
36
|
}
|
|
37
37
|
}
|
package/test/index.test.ts
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
createStore,
|
|
8
8
|
ReactantMiddleware,
|
|
9
9
|
PluginModule,
|
|
10
|
-
|
|
10
|
+
getRef,
|
|
11
11
|
} from 'reactant-module';
|
|
12
12
|
import { apply as applyPatches } from 'mutative';
|
|
13
13
|
import { model } from '..';
|
|
@@ -218,7 +218,7 @@ test('base model with `useValue` and `enablePatches`', () => {
|
|
|
218
218
|
enablePatches: true,
|
|
219
219
|
},
|
|
220
220
|
});
|
|
221
|
-
const originalTodoState = foo.todo
|
|
221
|
+
const originalTodoState = getRef(foo.todo).state!;
|
|
222
222
|
expect(Object.values(store.getState())).toEqual([{ todoList: [] }]);
|
|
223
223
|
expect(actionFn.mock.calls.length).toBe(0);
|
|
224
224
|
foo.add('test');
|
|
@@ -240,12 +240,15 @@ test('base model with `useValue` and `enablePatches`', () => {
|
|
|
240
240
|
]);
|
|
241
241
|
expect(
|
|
242
242
|
applyPatches(originalTodoState, actionFn.mock.calls[0][0]._patches)
|
|
243
|
-
).toEqual(foo.todo
|
|
243
|
+
).toEqual(getRef(foo.todo).state);
|
|
244
244
|
expect(
|
|
245
245
|
applyPatches(originalTodoState, actionFn.mock.calls[0][0]._patches) ===
|
|
246
|
-
foo.todo
|
|
246
|
+
getRef(foo.todo).state
|
|
247
247
|
).toBe(false);
|
|
248
248
|
expect(
|
|
249
|
-
applyPatches(
|
|
249
|
+
applyPatches(
|
|
250
|
+
getRef(foo.todo).state!,
|
|
251
|
+
actionFn.mock.calls[0][0]._inversePatches
|
|
252
|
+
)
|
|
250
253
|
).toEqual(originalTodoState);
|
|
251
254
|
});
|