@data-client/core 0.14.1 → 0.14.2
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 +43 -21
- package/dist/index.umd.min.js +1 -1
- package/legacy/controller/actions/createFetch.js +3 -3
- package/legacy/controller/actions/createOptimistic.js +3 -3
- package/legacy/controller/actions/createSet.js +2 -2
- package/legacy/controller/actions/createSetResponse.js +3 -3
- package/legacy/controller/actions/createSubscription.js +3 -3
- package/legacy/manager/DevtoolsManager.js +24 -2
- package/legacy/manager/applyManager.js +12 -4
- package/legacy/manager/devtoolsTypes.js +1 -1
- package/legacy/state/reducer/fetchReducer.js +2 -9
- package/lib/controller/actions/createFetch.js +3 -3
- package/lib/controller/actions/createOptimistic.js +3 -3
- package/lib/controller/actions/createSet.js +2 -2
- package/lib/controller/actions/createSetResponse.js +3 -3
- package/lib/controller/actions/createSubscription.js +3 -3
- package/lib/manager/DevtoolsManager.d.ts.map +1 -1
- package/lib/manager/DevtoolsManager.js +24 -2
- package/lib/manager/applyManager.d.ts.map +1 -1
- package/lib/manager/applyManager.js +12 -4
- package/lib/manager/devtoolsTypes.d.ts +5 -3
- package/lib/manager/devtoolsTypes.d.ts.map +1 -1
- package/lib/manager/devtoolsTypes.js +1 -1
- package/lib/state/reducer/fetchReducer.d.ts.map +1 -1
- package/lib/state/reducer/fetchReducer.js +2 -9
- package/package.json +1 -1
- package/src/controller/actions/createFetch.ts +2 -2
- package/src/controller/actions/createOptimistic.ts +2 -2
- package/src/controller/actions/createSet.ts +1 -1
- package/src/controller/actions/createSetResponse.ts +2 -2
- package/src/controller/actions/createSubscription.ts +2 -2
- package/src/manager/DevtoolsManager.ts +14 -1
- package/src/manager/__tests__/applyManager.ts +38 -0
- package/src/manager/applyManager.ts +16 -3
- package/src/manager/devtoolsTypes.ts +9 -3
- package/src/state/__tests__/reducer.ts +3 -2
- package/src/state/reducer/fetchReducer.ts +1 -13
- package/ts3.4/manager/devtoolsTypes.d.ts +5 -3
|
@@ -595,7 +595,7 @@ describe('reducer', () => {
|
|
|
595
595
|
const newState = reducer(iniState, action);
|
|
596
596
|
expect(newState.entities).toBe(iniState.entities);
|
|
597
597
|
});
|
|
598
|
-
it('rdc/fetch should console.warn()', () => {
|
|
598
|
+
it('rdc/fetch should not console.warn()', () => {
|
|
599
599
|
const warnspy = jest
|
|
600
600
|
.spyOn(global.console, 'warn')
|
|
601
601
|
.mockImplementation(() => {});
|
|
@@ -618,7 +618,8 @@ describe('reducer', () => {
|
|
|
618
618
|
};
|
|
619
619
|
const newState = reducer(iniState, action);
|
|
620
620
|
expect(newState).toBe(iniState);
|
|
621
|
-
|
|
621
|
+
// moved warns to applyManager() vv
|
|
622
|
+
expect(warnspy.mock.calls.length).toBe(0);
|
|
622
623
|
} finally {
|
|
623
624
|
warnspy.mockRestore();
|
|
624
625
|
}
|
|
@@ -12,18 +12,6 @@ export function fetchReducer(state: State<unknown>, action: FetchAction) {
|
|
|
12
12
|
...state,
|
|
13
13
|
optimistic: [...state.optimistic, setAction],
|
|
14
14
|
};
|
|
15
|
-
} else {
|
|
16
|
-
// If 'fetch' action reaches the reducer there are no middlewares installed to handle it
|
|
17
|
-
/* istanbul ignore next */
|
|
18
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
19
|
-
console.warn(
|
|
20
|
-
'Fetch appears unhandled - you are likely missing the NetworkManager middleware',
|
|
21
|
-
);
|
|
22
|
-
console.warn(
|
|
23
|
-
'See https://dataclient.io/docs/guides/redux for hooking up redux',
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return state;
|
|
28
15
|
}
|
|
16
|
+
return state;
|
|
29
17
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { ActionTypes } from '../actions.js';
|
|
2
|
+
import { State } from '../types.js';
|
|
3
|
+
type Action = ActionTypes;
|
|
2
4
|
type ActionCreator<T> = any;
|
|
3
5
|
export interface EnhancerOptions {
|
|
4
6
|
/**
|
|
@@ -72,7 +74,7 @@ export interface EnhancerOptions {
|
|
|
72
74
|
/**
|
|
73
75
|
* function which takes `state` object and index as arguments, and should return `state` object back.
|
|
74
76
|
*/
|
|
75
|
-
stateSanitizer?: <S
|
|
77
|
+
stateSanitizer?: <S extends State<unknown>>(state: S, index: number) => S;
|
|
76
78
|
/**
|
|
77
79
|
* *string or array of strings as regex* - actions types to be hidden / shown in the monitors (while passed to the reducers).
|
|
78
80
|
* If `actionsWhitelist` specified, `actionsBlacklist` is ignored.
|
|
@@ -99,7 +101,7 @@ export interface EnhancerOptions {
|
|
|
99
101
|
* called for every action before sending, takes `state` and `action` object, and returns `true` in case it allows sending the current data to the monitor.
|
|
100
102
|
* Use it as a more advanced version of `actionsDenylist`/`actionsAllowlist` parameters.
|
|
101
103
|
*/
|
|
102
|
-
predicate?: <S
|
|
104
|
+
predicate?: <S extends State<unknown>, A extends Action>(state: S, action: A) => boolean;
|
|
103
105
|
/**
|
|
104
106
|
* if specified as `false`, it will not record the changes till clicking on `Start recording` button.
|
|
105
107
|
* Available only for Redux enhancer, for others use `autoPause`.
|