state-decorator 7.0.0-beta.9-dev → 7.0.0-rc10
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 +71 -93
- package/development.d.ts +10 -0
- package/development.js +2 -0
- package/development.js.map +1 -0
- package/es/development.d.ts +10 -0
- package/es/development.js +2 -0
- package/es/development.js.map +1 -0
- package/es/graph.d.ts +8 -0
- package/es/helpers.d.ts +10 -9
- package/es/helpers.js +1 -162
- package/es/helpers.js.map +1 -1
- package/es/impl.d.ts +20 -32
- package/es/impl.js +1 -963
- package/es/impl.js.map +1 -1
- package/es/index.d.ts +19 -24
- package/es/index.js +1 -1013
- package/es/index.js.map +1 -1
- package/es/middlewares.d.ts +0 -23
- package/es/middlewares.js +1 -519
- package/es/middlewares.js.map +1 -1
- package/es/shallow.d.ts +0 -14
- package/es/test.d.ts +7 -21
- package/es/test.js +1 -349
- package/es/test.js.map +1 -1
- package/es/types.d.ts +73 -72
- package/es/v5.d.ts +5 -18
- package/es/v5.js +1 -301
- package/es/v5.js.map +1 -1
- package/es/v5_test.d.ts +4 -17
- package/es/v5_test.js +1 -392
- package/es/v5_test.js.map +1 -1
- package/es/v5_types.d.ts +15 -29
- package/es/v6.d.ts +7 -3
- package/es/v6.js +1 -96
- package/es/v6.js.map +1 -1
- package/graph.d.ts +8 -0
- package/helpers.d.ts +10 -9
- package/helpers.js +1 -174
- package/helpers.js.map +1 -1
- package/impl.d.ts +20 -32
- package/impl.js +1 -996
- package/impl.js.map +1 -1
- package/index.d.ts +19 -24
- package/index.js +1 -1044
- package/index.js.map +1 -1
- package/middlewares.d.ts +0 -23
- package/middlewares.js +1 -526
- package/middlewares.js.map +1 -1
- package/package.json +1 -1
- package/shallow.d.ts +0 -14
- package/test.d.ts +7 -21
- package/test.js +1 -358
- package/test.js.map +1 -1
- package/types.d.ts +73 -72
- package/v5.d.ts +5 -18
- package/v5.js +1 -322
- package/v5.js.map +1 -1
- package/v5_test.d.ts +4 -17
- package/v5_test.js +1 -416
- package/v5_test.js.map +1 -1
- package/v5_types.d.ts +15 -29
- package/v6.d.ts +7 -3
- package/v6.js +1 -120
- package/v6.js.map +1 -1
package/README.md
CHANGED
|
@@ -19,14 +19,14 @@ The StateDecorator is a set of Reacts hook that manages a complex component stat
|
|
|
19
19
|
|
|
20
20
|
# V7: Partial state and new hooks
|
|
21
21
|
|
|
22
|
-
- React
|
|
22
|
+
- React 18 support
|
|
23
23
|
- All effects can now return a partial state that will be merged with current state.
|
|
24
24
|
- More documentation on global and local store use cases.
|
|
25
25
|
- **useLocalStore** and **useStore** now have a parameter to specify if the React component must re-rerender after a state change.
|
|
26
26
|
- New **useStoreContextSlice** hook was added to get a slice of a store in a context.
|
|
27
27
|
- New **onMountDeferred** to execute initialization code after initial render
|
|
28
28
|
- New effect helpers
|
|
29
|
-
-
|
|
29
|
+
- See migration details in [migration section](#migration).
|
|
30
30
|
|
|
31
31
|
# 🏎️ V6: The Store
|
|
32
32
|
|
|
@@ -153,7 +153,7 @@ export function App(props: Props) => {
|
|
|
153
153
|
| Hook | Purpose | Returns | Is component refreshed on store change? | Is store destroyed on unmount? |
|
|
154
154
|
| -------------------- | --------------------------------------------------- | ------- | --------------------------------------- | ------------------------------ |
|
|
155
155
|
| useLocalStore | Create a store and binds it to the react component. | Store | if **refreshOnUpdate** is set | Y |
|
|
156
|
-
| useStore | Binds a store instance to the react component. | Store |
|
|
156
|
+
| useStore | Binds a store instance to the react component. | Store | yes | N |
|
|
157
157
|
| useStoreSlice | Get a slice of a store. | Slice | If slice has changed only | N |
|
|
158
158
|
| useStoreContextSlice | Get a slice of a store stored in a context | Slice | If slice has changed only | N |
|
|
159
159
|
|
|
@@ -250,7 +250,7 @@ const config: StoreConfig<State, Actions, Props> = {
|
|
|
250
250
|
};
|
|
251
251
|
```
|
|
252
252
|
|
|
253
|
-
[](https://codesandbox.io/s/debounce-
|
|
253
|
+
[](https://codesandbox.io/s/debounce-v7-i5om2e?file=/src/Debounce.tsx)
|
|
254
254
|
|
|
255
255
|
## Recipes
|
|
256
256
|
|
|
@@ -486,7 +486,7 @@ It can takes the following values (use **ConflictPolicy** enum), choose the one
|
|
|
486
486
|
- A **getPromiseId** function must be provided to assign an identifier to each call from call arguments.
|
|
487
487
|
- The **isLoading** function will return the loading state for each promise identifier.
|
|
488
488
|
|
|
489
|
-
[](https://codesandbox.io/s/conflictpolicy-
|
|
489
|
+
[](https://codesandbox.io/s/conflictpolicy-v7-1bcwht?file=/src/ConflictPolicy.tsx)
|
|
490
490
|
|
|
491
491
|
## Retry
|
|
492
492
|
|
|
@@ -558,7 +558,7 @@ const config: StoreConfig<State, Actions, Props> = {
|
|
|
558
558
|
};
|
|
559
559
|
```
|
|
560
560
|
|
|
561
|
-
[](https://codesandbox.io/s/optimistic-actions-
|
|
561
|
+
[](https://codesandbox.io/s/optimistic-actions-v7-w3b8ht?file=/src/Optimistic.tsx)
|
|
562
562
|
|
|
563
563
|
**Notes**:
|
|
564
564
|
|
|
@@ -606,7 +606,7 @@ const config: StoreConfig<State, Actions, Props> = {
|
|
|
606
606
|
|
|
607
607
|
Note: ongoing abortable actions will be automatically aborted on store destruction (during React component unmount for example). The list of aborted actions is available in the **onUnmount** callback in the store's options.
|
|
608
608
|
|
|
609
|
-
[](https://codesandbox.io/s/abort-
|
|
609
|
+
[](https://codesandbox.io/s/abort-v7-ts0wrm?file=/src/ParallelAbort.tsx)
|
|
610
610
|
|
|
611
611
|
## Helper effect functions
|
|
612
612
|
|
|
@@ -695,75 +695,6 @@ const config: StoreConfig<State, Actions, Props> = {
|
|
|
695
695
|
};
|
|
696
696
|
```
|
|
697
697
|
|
|
698
|
-
## State sharing and slices
|
|
699
|
-
|
|
700
|
-
- Declare a store and bind it to a component using _useStore_ or _useBindStore_ hooks.
|
|
701
|
-
- Deeper in the tree component, use _useStoreSlice_ to get a store slice.
|
|
702
|
-
- Component using slices will be refreshed only if their store slice changes.
|
|
703
|
-
|
|
704
|
-
```typescript
|
|
705
|
-
import React from 'react';
|
|
706
|
-
import { useStore, useStoreSlice, StoreActions } from 'state-decorator';
|
|
707
|
-
|
|
708
|
-
// Declare typings & actions as above
|
|
709
|
-
|
|
710
|
-
// Create a store
|
|
711
|
-
|
|
712
|
-
export const store = createStore(config);
|
|
713
|
-
|
|
714
|
-
// Bind to react component
|
|
715
|
-
|
|
716
|
-
export function Container(prop: Props) {
|
|
717
|
-
const { state, actions } = useStore(store, props);
|
|
718
|
-
|
|
719
|
-
// or
|
|
720
|
-
// useBindStore(store, props);
|
|
721
|
-
// if you are not interested in getting the state here
|
|
722
|
-
|
|
723
|
-
return <div />;
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
// Components deeper in the component tree will be refreshed if, and only if,
|
|
727
|
-
// slice is changed (here: text property)
|
|
728
|
-
|
|
729
|
-
export function SubComponent2() {
|
|
730
|
-
const s = useStoreSlice(store, ['text']);
|
|
731
|
-
return <div>{s.text}</div>;
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
export function SubComponent() {
|
|
735
|
-
const s = useStoreSlice(store, (s) => ({ text: s.text }));
|
|
736
|
-
return <div>{s.text}</div>;
|
|
737
|
-
}
|
|
738
|
-
```
|
|
739
|
-
|
|
740
|
-
[](https://codesandbox.io/s/slices-v6-eg471?file=/src/SliceView.tsx)
|
|
741
|
-
|
|
742
|
-
# Update store when props change
|
|
743
|
-
|
|
744
|
-
## Getting started
|
|
745
|
-
|
|
746
|
-
```typescript
|
|
747
|
-
import { createStore } from 'state-decorator';
|
|
748
|
-
|
|
749
|
-
const config: StoreConfig<State, Actions, Props> = {
|
|
750
|
-
getInitialState,
|
|
751
|
-
actions,
|
|
752
|
-
onPropsChange: {
|
|
753
|
-
// list of depedencies that should trigger effects & side effects if changed
|
|
754
|
-
getDeps: (p) => [p.id],
|
|
755
|
-
// state changes, indices contains the indices of dependencies that have changed
|
|
756
|
-
effects: ({ props, indices, isInit }) => ({ selectedId: props.id }),
|
|
757
|
-
// other changes (use short aliases)
|
|
758
|
-
sideEffects: ({ p, a, indices, isInit }) => {
|
|
759
|
-
a.loadItem(p.id);
|
|
760
|
-
},
|
|
761
|
-
// whether apply effects & side effects on mount
|
|
762
|
-
onMount: true,
|
|
763
|
-
},
|
|
764
|
-
};
|
|
765
|
-
```
|
|
766
|
-
|
|
767
698
|
## Multiple props change configuration
|
|
768
699
|
|
|
769
700
|
The store can manage several props change configurations to have a better granularity.
|
|
@@ -866,11 +797,11 @@ There are two types of stores:
|
|
|
866
797
|
|
|
867
798
|
- store is created as an instance (**createStore**) and it is exported from the JS module.
|
|
868
799
|
- it can be imported in any other JS module.
|
|
869
|
-
- store lifespan is equal to the application one.
|
|
800
|
+
- store lifespan is equal to the application one (ie. it's a singleton).
|
|
870
801
|
|
|
871
802
|
- Local store:
|
|
872
803
|
- store is created by a hook (**useLocalStore**) and is bound to a React component (each instance of this component owns its own store).
|
|
873
|
-
-
|
|
804
|
+
- state and actions can be shared using props or sharing the store itself (see example below)
|
|
874
805
|
- store is destroyed when its owner React component is unmounted.
|
|
875
806
|
|
|
876
807
|
## Using props
|
|
@@ -959,7 +890,7 @@ The problem is that if the context contains a complex state with lots of props,
|
|
|
959
890
|
|
|
960
891
|
To overcome this problem, the StateDecorator provides a **useStoreSlice** and **useStoreContextSlice** hook that allow to define and extracts a slice of the state and trigger a re-render of the React component only if the slice has changed.
|
|
961
892
|
|
|
962
|
-
[](
|
|
893
|
+
[](hhttps://codesandbox.io/s/local-state-slices-v7-ehmj6f?file=/src/SliceView.tsx)
|
|
963
894
|
|
|
964
895
|
## Global Store
|
|
965
896
|
|
|
@@ -999,6 +930,8 @@ function Subtitle(props: { subtitle: string }) {
|
|
|
999
930
|
|
|
1000
931
|
## Local Store
|
|
1001
932
|
|
|
933
|
+
**IMPORTANT**: the context children _MUST_ be with no prop and memoized to prevent refreshes (React can display warning on the console)
|
|
934
|
+
|
|
1002
935
|
```typescript
|
|
1003
936
|
// ------- stores/MyStore.ts --------
|
|
1004
937
|
|
|
@@ -1059,7 +992,7 @@ function Subtitle(props: { subtitle: string }) {
|
|
|
1059
992
|
|
|
1060
993
|
# Derived state
|
|
1061
994
|
|
|
1062
|
-
A derived state is a state that can be deduced from state
|
|
995
|
+
A derived state is a state that can be deduced from state, props or derived state.
|
|
1063
996
|
|
|
1064
997
|
```typescript
|
|
1065
998
|
import { createStore } from 'state-decorator';
|
|
@@ -1078,6 +1011,8 @@ type Props = {
|
|
|
1078
1011
|
|
|
1079
1012
|
type DerivedState = {
|
|
1080
1013
|
derivedProp: number;
|
|
1014
|
+
derivedProp2: number;
|
|
1015
|
+
derivedProp3: number;
|
|
1081
1016
|
};
|
|
1082
1017
|
|
|
1083
1018
|
const store = createStore<State, Actions, Props, DerivedState>({
|
|
@@ -1093,13 +1028,29 @@ const store = createStore<State, Actions, Props, DerivedState>({
|
|
|
1093
1028
|
// compute derived state from state & props (use short aliases)
|
|
1094
1029
|
get: ({ s, p }) => s.value * p.propIn,
|
|
1095
1030
|
},
|
|
1031
|
+
derivedProp2: {
|
|
1032
|
+
// derived prop from another derived prop
|
|
1033
|
+
derivedDeps: ['derivedProp'],
|
|
1034
|
+
// compute derived state from state & props (use short aliases)
|
|
1035
|
+
get: ({ ds }) => ds.derivedProp * 2,
|
|
1036
|
+
},
|
|
1037
|
+
derivedProp2: {
|
|
1038
|
+
// depends on state, props and another derived state
|
|
1039
|
+
getDeps: ({ s, p }) => [s.value, p.propIn],
|
|
1040
|
+
derivedDeps: ['derivedProp'],
|
|
1041
|
+
get: ({ s, p, ds }) => s.value * p.propIn * ds.derivedProp,
|
|
1042
|
+
},
|
|
1096
1043
|
},
|
|
1097
1044
|
});
|
|
1098
1045
|
|
|
1099
1046
|
export function App(props: Props) {
|
|
1100
1047
|
const { state } = useStore(store, props);
|
|
1101
1048
|
// state contains the store state and derived state
|
|
1102
|
-
return
|
|
1049
|
+
return (
|
|
1050
|
+
<div>
|
|
1051
|
+
{state.derivedProp} {state.derivedProp2} {state.derivedProp3}
|
|
1052
|
+
</div>
|
|
1053
|
+
);
|
|
1103
1054
|
}
|
|
1104
1055
|
```
|
|
1105
1056
|
|
|
@@ -1136,14 +1087,18 @@ setGlobalConfig({
|
|
|
1136
1087
|
});
|
|
1137
1088
|
```
|
|
1138
1089
|
|
|
1139
|
-
#
|
|
1090
|
+
# Trace actions
|
|
1091
|
+
|
|
1092
|
+
To easily trace effects, use **logEnabled** option, that will automatically add a detailed logger.
|
|
1093
|
+
|
|
1094
|
+
To trace effects, add a logger development middleware to the store.
|
|
1140
1095
|
|
|
1141
|
-
|
|
1096
|
+
These middlewares are deactivated if the `NODE_ENV` during the build is not `development` or `test`.
|
|
1142
1097
|
|
|
1143
1098
|
## Concise logger
|
|
1144
1099
|
|
|
1145
1100
|
```typescript
|
|
1146
|
-
import { logEffects } from 'state-decorator/
|
|
1101
|
+
import { logEffects } from 'state-decorator/development';
|
|
1147
1102
|
|
|
1148
1103
|
function Container(props: Props) {
|
|
1149
1104
|
const { state, actions } = useLocalStore({ getInitialState, actions, middlewares: [logEffects()] });
|
|
@@ -1173,7 +1128,7 @@ Example:
|
|
|
1173
1128
|
## Detailed Logger
|
|
1174
1129
|
|
|
1175
1130
|
```typescript
|
|
1176
|
-
import { logDetailedEffects } from 'state-decorator/
|
|
1131
|
+
import { logDetailedEffects } from 'state-decorator/development';
|
|
1177
1132
|
|
|
1178
1133
|
function Container(props: Props) {
|
|
1179
1134
|
const { state, actions } = useLocalStore({ getInitialState, actions, middlewares: [logDetailedEffects()] });
|
|
@@ -1197,12 +1152,14 @@ Example:
|
|
|
1197
1152
|
║ calendarEndDate : null => 2018-08-19T22:00:00.000Z
|
|
1198
1153
|
```
|
|
1199
1154
|
|
|
1155
|
+
Note: In v7, it can be activated by adding `logEnabled: true` in the configuration.
|
|
1156
|
+
|
|
1200
1157
|
## Redux devtools
|
|
1201
1158
|
|
|
1202
1159
|
You can connect any StateDecorator store to [Chrome Redux devtools extension](https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd?hl=en) by adding the `devtools` middleware to the store.
|
|
1203
1160
|
|
|
1204
1161
|
```typescript
|
|
1205
|
-
import { devtools } from 'state-decorator/
|
|
1162
|
+
import { devtools } from 'state-decorator/development';
|
|
1206
1163
|
|
|
1207
1164
|
function Container(props: Props) {
|
|
1208
1165
|
const { state, actions } = useLocalStore({ getInitialState, actions, middlewares: [devtools()] });
|
|
@@ -1671,6 +1628,12 @@ TypeError: Cannot set property 'crash' of null
|
|
|
1671
1628
|
|
|
1672
1629
|
## API
|
|
1673
1630
|
|
|
1631
|
+
### Create mock store
|
|
1632
|
+
|
|
1633
|
+
| Name | Parameters | |
|
|
1634
|
+
| --------------- | ------------------------------------------------ | --------------------------------- |
|
|
1635
|
+
| createMockStore | (config: StoreConfig, props: Props) => MockStore | Create a mock store from a config |
|
|
1636
|
+
|
|
1674
1637
|
### MockStore
|
|
1675
1638
|
|
|
1676
1639
|
| Function | Arguments | Returns | Description |
|
|
@@ -1710,6 +1673,20 @@ TypeError: Cannot set property 'crash' of null
|
|
|
1710
1673
|
- Immutability: each effects **must** return a new state instance (or `null` if there's no change).
|
|
1711
1674
|
- I recommend using [Immer](https://github.com/immerjs/immer) to manage complex cases (deep nesting). A **immerizeActions** action decorator is provided to decorate each effect with Immer.
|
|
1712
1675
|
|
|
1676
|
+
# Build
|
|
1677
|
+
|
|
1678
|
+
This library provides CJS and ES files.
|
|
1679
|
+
|
|
1680
|
+
Webpack users should add this alias rule to prevent importing both (especially when importing another file than `index.js`):
|
|
1681
|
+
|
|
1682
|
+
```js
|
|
1683
|
+
resolve: {
|
|
1684
|
+
alias: {
|
|
1685
|
+
'state-decorator': 'state-decorator/es',
|
|
1686
|
+
},
|
|
1687
|
+
},
|
|
1688
|
+
```
|
|
1689
|
+
|
|
1713
1690
|
# Limitations
|
|
1714
1691
|
|
|
1715
1692
|
- Due to bundle size constraints and used in specific use cases only, a basic function is used to clone state / props / arguments in conflicting actions and optimistic effects use cases. In some edge cases (like clone moment objects, class instances), you must provide a clone implementation like Lodash cloneDeep implementation.
|
|
@@ -1724,16 +1701,17 @@ TypeError: Cannot set property 'crash' of null
|
|
|
1724
1701
|
|
|
1725
1702
|
### Step 1: V6 compatibility layer
|
|
1726
1703
|
|
|
1704
|
+
Only **useLocalStore** is supported by compatiblity layer.
|
|
1705
|
+
|
|
1727
1706
|
```diff
|
|
1728
1707
|
-import useLocalStore from 'state-decorator';
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
+import { useLocalStoreV6 } from 'state-decorator';
|
|
1708
|
+
+import useLocalStore from 'state-decorator/v6';
|
|
1732
1709
|
```
|
|
1733
1710
|
|
|
1734
1711
|
### Step 2: Migrate code
|
|
1735
1712
|
|
|
1736
|
-
|
|
1713
|
+
- Merge _getInitialState_, _actions_, _options_ in a single object.
|
|
1714
|
+
- Remove state spread in effects
|
|
1737
1715
|
|
|
1738
1716
|
```diff
|
|
1739
1717
|
- const getInitialState: (p:Props) => ({myProp: ''});
|
|
@@ -1927,13 +1905,13 @@ Choose one of _useLocalStore_, _useStore_, _useBindStore_ or _useStoreSlice_.
|
|
|
1927
1905
|
|
|
1928
1906
|
## TodoApp
|
|
1929
1907
|
|
|
1930
|
-
[](https://codesandbox.io/s/todo-
|
|
1908
|
+
[](https://codesandbox.io/s/todo-v7-m94sm2?file=/src/TodoApp.tsx)
|
|
1931
1909
|
|
|
1932
1910
|
## Conflicting actions
|
|
1933
1911
|
|
|
1934
1912
|
Show various ways of handling conflicting actions, ie. asynchronous actions triggered when a previous action of same type is still ongoing.
|
|
1935
1913
|
|
|
1936
|
-
[](https://codesandbox.io/s/conflictpolicy-
|
|
1914
|
+
[](https://codesandbox.io/s/conflictpolicy-v7-1bcwht?file=/src/ConflictPolicy.tsx)
|
|
1937
1915
|
|
|
1938
1916
|
## Parallel actions
|
|
1939
1917
|
|
|
@@ -1953,7 +1931,7 @@ const parallelActions: StoreActions<State, Actions> = {
|
|
|
1953
1931
|
};
|
|
1954
1932
|
```
|
|
1955
1933
|
|
|
1956
|
-
[](https://codesandbox.io/s/conflictpolicy-
|
|
1934
|
+
[](https://codesandbox.io/s/conflictpolicy-v7-1bcwht?file=/src/Parallel.tsxx)
|
|
1957
1935
|
|
|
1958
1936
|
# Visual Studio Code user snippet
|
|
1959
1937
|
|
package/development.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DecoratedActions, MiddlewareFactory } from './types';
|
|
2
|
+
export type Logger = {
|
|
3
|
+
log: (...args: any[]) => void;
|
|
4
|
+
group: (...args: any[]) => void;
|
|
5
|
+
groupCollapsed: (...args: any[]) => void;
|
|
6
|
+
groupEnd: (...args: any[]) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare let logEffects: <S, A extends DecoratedActions, P>(log?: (...msg: any[]) => void) => MiddlewareFactory<S, A, P>;
|
|
9
|
+
export declare let logDetailedEffects: <S, A extends DecoratedActions, P>(logger?: Logger) => MiddlewareFactory<S, A, P>;
|
|
10
|
+
export declare let devtools: <S, A extends DecoratedActions, P>() => MiddlewareFactory<S, A, P>;
|
package/development.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=function(){return e=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},e.apply(this,arguments)},t=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var o,r,l;if(Array.isArray(t)){if((o=t.length)!=n.length)return!1;for(r=o;0!=r--;)if(!e(t[r],n[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((o=(l=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(r=o;0!=r--;)if(!Object.prototype.hasOwnProperty.call(n,l[r]))return!1;for(r=o;0!=r--;){var i=l[r];if(!e(t[i],n[i]))return!1}return!0}return t!=t&&n!=n};if(exports.logEffects=null,exports.logDetailedEffects=null,exports.devtools=null,"development"===process.env.NODE_ENV||"test"===process.env.NODE_ENV){exports.logEffects=function(e){void 0===e&&(e=console.log);return function(){var t=e,n="";return{init:function(e){var o,r;n=(null===(o=e.options)||void 0===o?void 0:o.name)?"[".concat(null===(r=e.options)||void 0===r?void 0:r.name,"]"):"";var l=e.state;t(n,"initialState",l)},destroy:null,effects:function(e,o,r,l){return t(n,e.name,e.type,null===r?"no effect":r,e.isAsync?"preEffects"!==e.type||l?"loading: ".concat(l):"Promise cancelled":""),null}}}},exports.logDetailedEffects=function(e){return void 0===e&&(e=console),function(){var n="",o=e,r=function(e,n){var o;if(n!==e){var r=null!=e?typeof e:typeof n;if("number"===r||"string"===r||"boolean"===r)o="".concat(e," => ").concat(""===n?'""':n);else if(e&&e.length||n&&n.length)if(null==e)o="was ".concat(e,", now contains ").concat(n.length," element(s)");else if(null==n)o="contained ".concat(e.length," element(s), now is ").concat(n);else if(0===e.length)o="was empty, now contains ".concat(n.length," elements");else if(0===n.length)o="contained ".concat(e.length," elements, now is empty");else{var l=n.filter((function(n){return!e.find((function(e){return t(n,e)}))})),i=e.filter((function(e){return!n.find((function(n){return t(e,n)}))}));l.length>10&&(l="".concat(l.length," element(s) added")),i.length>10&&(i="".concat(i.length," element(s) removed")),o={added:l,removed:i}}else o=n}return o},l=function(e){return"string"==typeof e?'"'.concat(e,'"'):e};return{init:function(t){var r,i;n=(null===(r=t.options)||void 0===r?void 0:r.name)?"[".concat(null===(i=t.options)||void 0===i?void 0:i.name,"]"):"";var c=t.state;e.group(n,"initialState"),Object.keys(c).forEach((function(e){o.log(e,":",l(c[e]))})),e.groupEnd()},destroy:null,effects:function(e,t,i,c){var u,a=null===(u=e.context)||void 0===u?void 0:u.args,s=[n,e.name.toString()];if(e.isAsync&&("preEffects"===e.type?s.push(c?"START":"CANCELLED"):"effects"===e.type?s.push("DONE"):s.push("FAILED")),null!=i||a&&0!==Object.keys(a).length?o.group.apply(o,s):o.log.apply(o,s),a&&Object.keys(a).length>0&&(o.group("Arguments"),a.forEach((function(e){o.log(e,":",l(e))})),o.groupEnd()),null!=i){if(o.groupCollapsed("Before"),null==t)o.log("was null");else Object.keys(t).forEach((function(e){o.log(e,":",l(t[e]))}));if(o.groupEnd(),o.groupCollapsed("After"),null==i)o.log("was null");else Object.keys(i).forEach((function(e){o.log(e,":",l(i[e]))}));if(o.groupEnd(),null!=i){o.group("Diff");var f=function(e,t){var n={};return e&&Object.keys(e).forEach((function(o){if(t.hasOwnProperty(o)){var l=e[o],i=t[o],c=r(l,i);c&&(n[o]=c)}else n[o]="was deleted"})),Object.keys(t).forEach((function(o){if(null==e||!e.hasOwnProperty(o)){var l=t[o];n[o]=r(void 0,l)}})),n}(t,i);Object.keys(f).forEach((function(e){return o.log(e,":",f[e])})),o.groupEnd()}}return o.groupEnd(),null}}}},exports.devtools=function(){return function(){var t,n,o;try{t=window.__REDUX_DEVTOOLS_EXTENSION__||window.top.__REDUX_DEVTOOLS_EXTENSION__}catch(e){}return t?{init:function(e){var r,l;(n=t.connect({name:null!==(l=null===(r=e.options)||void 0===r?void 0:r.name)&&void 0!==l?l:"StateDecorator"})).init(e.state);var i=null,c=e.state;o=n.subscribe((function(t){var n,o,r,l;if("DISPATCH"===t.type&&t.state&&"ROLLBACK"!==(null===(n=t.payload)||void 0===n?void 0:n.type)){var u=JSON.parse(t.state);e.setState(u)}else"COMMIT"===(null===(o=t.payload)||void 0===o?void 0:o.type)?i=e.state:"ROLLBACK"===(null===(r=t.payload)||void 0===r?void 0:r.type)?null!=i&&e.setState(i):"RESET"===(null===(l=t.payload)||void 0===l?void 0:l.type)&&e.setState(c)}))},effects:function(t,o,r){if(null!=r){var l=e({},t.context);delete l.a,delete l.s,delete l.p,delete l.res,delete l.err,delete l.ds,n.send({type:"".concat(t.name.toString()," ").concat(t.type),args:l.args,context:l},r)}return null},destroy:function(){o(),n=null}}:{init:function(){},destroy:null,effects:function(){return null}}}}}
|
|
2
|
+
//# sourceMappingURL=development.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"development.js","sources":["../node_modules/tslib/tslib.es6.js","../node_modules/fast-deep-equal/index.js"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","'use strict';\n\n// do not edit .js files directly - edit src/index.jst\n\n\n\nmodule.exports = function equal(a, b) {\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n\n for (i = length; i-- !== 0;) {\n var key = keys[i];\n\n if (!equal(a[key], b[key])) return false;\n }\n\n return true;\n }\n\n // true if both NaN, false otherwise\n return a!==a && b!==b;\n};\n"],"names":["__assign","Object","assign","t","s","i","n","arguments","length","p","prototype","hasOwnProperty","call","apply","this","equal","a","b","constructor","keys","Array","isArray","RegExp","source","flags","valueOf","toString","key"],"mappings":"oEA+BO,IAAIA,EAAW,WAQlB,OAPAA,EAAWC,OAAOC,QAAU,SAAkBC,GAC1C,IAAK,IAAIC,EAAGC,EAAI,EAAGC,EAAIC,UAAUC,OAAQH,EAAIC,EAAGD,IAE5C,IAAK,IAAII,KADTL,EAAIG,UAAUF,GACOJ,OAAOS,UAAUC,eAAeC,KAAKR,EAAGK,KAAIN,EAAEM,GAAKL,EAAEK,IAE9E,OAAON,GAEJH,EAASa,MAAMC,KAAMP,UAChC,IClCiB,SAASQ,EAAMC,EAAGC,GACjC,GAAID,IAAMC,EAAG,OAAO,EAEpB,GAAID,GAAKC,GAAiB,iBAALD,GAA6B,iBAALC,EAAe,CAC1D,GAAID,EAAEE,cAAgBD,EAAEC,YAAa,OAAO,EAE5C,IAAIV,EAAQH,EAAGc,EACf,GAAIC,MAAMC,QAAQL,GAAI,CAEpB,IADAR,EAASQ,EAAER,SACGS,EAAET,OAAQ,OAAO,EAC/B,IAAKH,EAAIG,EAAgB,GAARH,KACf,IAAKU,EAAMC,EAAEX,GAAIY,EAAEZ,IAAK,OAAO,EACjC,OAAO,EAKT,GAAIW,EAAEE,cAAgBI,OAAQ,OAAON,EAAEO,SAAWN,EAAEM,QAAUP,EAAEQ,QAAUP,EAAEO,MAC5E,GAAIR,EAAES,UAAYxB,OAAOS,UAAUe,QAAS,OAAOT,EAAES,YAAcR,EAAEQ,UACrE,GAAIT,EAAEU,WAAazB,OAAOS,UAAUgB,SAAU,OAAOV,EAAEU,aAAeT,EAAES,WAIxE,IADAlB,GADAW,EAAOlB,OAAOkB,KAAKH,IACLR,UACCP,OAAOkB,KAAKF,GAAGT,OAAQ,OAAO,EAE7C,IAAKH,EAAIG,EAAgB,GAARH,KACf,IAAKJ,OAAOS,UAAUC,eAAeC,KAAKK,EAAGE,EAAKd,IAAK,OAAO,EAEhE,IAAKA,EAAIG,EAAgB,GAARH,KAAY,CAC3B,IAAIsB,EAAMR,EAAKd,GAEf,IAAKU,EAAMC,EAAEW,GAAMV,EAAEU,IAAO,OAAO,EAGrC,OAAO,EAIT,OAAOX,GAAIA,GAAKC,GAAIA,CACtB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DecoratedActions, MiddlewareFactory } from './types';
|
|
2
|
+
export type Logger = {
|
|
3
|
+
log: (...args: any[]) => void;
|
|
4
|
+
group: (...args: any[]) => void;
|
|
5
|
+
groupCollapsed: (...args: any[]) => void;
|
|
6
|
+
groupEnd: (...args: any[]) => void;
|
|
7
|
+
};
|
|
8
|
+
export declare let logEffects: <S, A extends DecoratedActions, P>(log?: (...msg: any[]) => void) => MiddlewareFactory<S, A, P>;
|
|
9
|
+
export declare let logDetailedEffects: <S, A extends DecoratedActions, P>(logger?: Logger) => MiddlewareFactory<S, A, P>;
|
|
10
|
+
export declare let devtools: <S, A extends DecoratedActions, P>() => MiddlewareFactory<S, A, P>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e=function(){return e=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},e.apply(this,arguments)},t=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;var o,r,l;if(Array.isArray(t)){if((o=t.length)!=n.length)return!1;for(r=o;0!=r--;)if(!e(t[r],n[r]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((o=(l=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(r=o;0!=r--;)if(!Object.prototype.hasOwnProperty.call(n,l[r]))return!1;for(r=o;0!=r--;){var i=l[r];if(!e(t[i],n[i]))return!1}return!0}return t!=t&&n!=n},n=null,o=null,r=null;if("development"===process.env.NODE_ENV||"test"===process.env.NODE_ENV){n=function(e){void 0===e&&(e=console.log);return function(){var t=e,n="";return{init:function(e){var o,r;n=(null===(o=e.options)||void 0===o?void 0:o.name)?"[".concat(null===(r=e.options)||void 0===r?void 0:r.name,"]"):"";var l=e.state;t(n,"initialState",l)},destroy:null,effects:function(e,o,r,l){return t(n,e.name,e.type,null===r?"no effect":r,e.isAsync?"preEffects"!==e.type||l?"loading: ".concat(l):"Promise cancelled":""),null}}}},o=function(e){return void 0===e&&(e=console),function(){var n="",o=e,r=function(e,n){var o;if(n!==e){var r=null!=e?typeof e:typeof n;if("number"===r||"string"===r||"boolean"===r)o="".concat(e," => ").concat(""===n?'""':n);else if(e&&e.length||n&&n.length)if(null==e)o="was ".concat(e,", now contains ").concat(n.length," element(s)");else if(null==n)o="contained ".concat(e.length," element(s), now is ").concat(n);else if(0===e.length)o="was empty, now contains ".concat(n.length," elements");else if(0===n.length)o="contained ".concat(e.length," elements, now is empty");else{var l=n.filter((function(n){return!e.find((function(e){return t(n,e)}))})),i=e.filter((function(e){return!n.find((function(n){return t(e,n)}))}));l.length>10&&(l="".concat(l.length," element(s) added")),i.length>10&&(i="".concat(i.length," element(s) removed")),o={added:l,removed:i}}else o=n}return o},l=function(e){return"string"==typeof e?'"'.concat(e,'"'):e};return{init:function(t){var r,i;n=(null===(r=t.options)||void 0===r?void 0:r.name)?"[".concat(null===(i=t.options)||void 0===i?void 0:i.name,"]"):"";var u=t.state;e.group(n,"initialState"),Object.keys(u).forEach((function(e){o.log(e,":",l(u[e]))})),e.groupEnd()},destroy:null,effects:function(e,t,i,u){var c,a=null===(c=e.context)||void 0===c?void 0:c.args,f=[n,e.name.toString()];if(e.isAsync&&("preEffects"===e.type?f.push(u?"START":"CANCELLED"):"effects"===e.type?f.push("DONE"):f.push("FAILED")),null!=i||a&&0!==Object.keys(a).length?o.group.apply(o,f):o.log.apply(o,f),a&&Object.keys(a).length>0&&(o.group("Arguments"),a.forEach((function(e){o.log(e,":",l(e))})),o.groupEnd()),null!=i){if(o.groupCollapsed("Before"),null==t)o.log("was null");else Object.keys(t).forEach((function(e){o.log(e,":",l(t[e]))}));if(o.groupEnd(),o.groupCollapsed("After"),null==i)o.log("was null");else Object.keys(i).forEach((function(e){o.log(e,":",l(i[e]))}));if(o.groupEnd(),null!=i){o.group("Diff");var s=function(e,t){var n={};return e&&Object.keys(e).forEach((function(o){if(t.hasOwnProperty(o)){var l=e[o],i=t[o],u=r(l,i);u&&(n[o]=u)}else n[o]="was deleted"})),Object.keys(t).forEach((function(o){if(null==e||!e.hasOwnProperty(o)){var l=t[o];n[o]=r(void 0,l)}})),n}(t,i);Object.keys(s).forEach((function(e){return o.log(e,":",s[e])})),o.groupEnd()}}return o.groupEnd(),null}}}},r=function(){return function(){var t,n,o;try{t=window.__REDUX_DEVTOOLS_EXTENSION__||window.top.__REDUX_DEVTOOLS_EXTENSION__}catch(e){}return t?{init:function(e){var r,l;(n=t.connect({name:null!==(l=null===(r=e.options)||void 0===r?void 0:r.name)&&void 0!==l?l:"StateDecorator"})).init(e.state);var i=null,u=e.state;o=n.subscribe((function(t){var n,o,r,l;if("DISPATCH"===t.type&&t.state&&"ROLLBACK"!==(null===(n=t.payload)||void 0===n?void 0:n.type)){var c=JSON.parse(t.state);e.setState(c)}else"COMMIT"===(null===(o=t.payload)||void 0===o?void 0:o.type)?i=e.state:"ROLLBACK"===(null===(r=t.payload)||void 0===r?void 0:r.type)?null!=i&&e.setState(i):"RESET"===(null===(l=t.payload)||void 0===l?void 0:l.type)&&e.setState(u)}))},effects:function(t,o,r){if(null!=r){var l=e({},t.context);delete l.a,delete l.s,delete l.p,delete l.res,delete l.err,delete l.ds,n.send({type:"".concat(t.name.toString()," ").concat(t.type),args:l.args,context:l},r)}return null},destroy:function(){o(),n=null}}:{init:function(){},destroy:null,effects:function(){return null}}}}}export{r as devtools,o as logDetailedEffects,n as logEffects};
|
|
2
|
+
//# sourceMappingURL=development.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"development.js","sources":["../../node_modules/tslib/tslib.es6.js","../../node_modules/fast-deep-equal/index.js"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","'use strict';\n\n// do not edit .js files directly - edit src/index.jst\n\n\n\nmodule.exports = function equal(a, b) {\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n\n for (i = length; i-- !== 0;) {\n var key = keys[i];\n\n if (!equal(a[key], b[key])) return false;\n }\n\n return true;\n }\n\n // true if both NaN, false otherwise\n return a!==a && b!==b;\n};\n"],"names":["__assign","Object","assign","t","s","i","n","arguments","length","p","prototype","hasOwnProperty","call","apply","this","equal","a","b","constructor","keys","Array","isArray","RegExp","source","flags","valueOf","toString","key"],"mappings":"AA+BO,IAAIA,EAAW,WAQlB,OAPAA,EAAWC,OAAOC,QAAU,SAAkBC,GAC1C,IAAK,IAAIC,EAAGC,EAAI,EAAGC,EAAIC,UAAUC,OAAQH,EAAIC,EAAGD,IAE5C,IAAK,IAAII,KADTL,EAAIG,UAAUF,GACOJ,OAAOS,UAAUC,eAAeC,KAAKR,EAAGK,KAAIN,EAAEM,GAAKL,EAAEK,IAE9E,OAAON,GAEJH,EAASa,MAAMC,KAAMP,UAChC,IClCiB,SAASQ,EAAMC,EAAGC,GACjC,GAAID,IAAMC,EAAG,OAAO,EAEpB,GAAID,GAAKC,GAAiB,iBAALD,GAA6B,iBAALC,EAAe,CAC1D,GAAID,EAAEE,cAAgBD,EAAEC,YAAa,OAAO,EAE5C,IAAIV,EAAQH,EAAGc,EACf,GAAIC,MAAMC,QAAQL,GAAI,CAEpB,IADAR,EAASQ,EAAER,SACGS,EAAET,OAAQ,OAAO,EAC/B,IAAKH,EAAIG,EAAgB,GAARH,KACf,IAAKU,EAAMC,EAAEX,GAAIY,EAAEZ,IAAK,OAAO,EACjC,OAAO,EAKT,GAAIW,EAAEE,cAAgBI,OAAQ,OAAON,EAAEO,SAAWN,EAAEM,QAAUP,EAAEQ,QAAUP,EAAEO,MAC5E,GAAIR,EAAES,UAAYxB,OAAOS,UAAUe,QAAS,OAAOT,EAAES,YAAcR,EAAEQ,UACrE,GAAIT,EAAEU,WAAazB,OAAOS,UAAUgB,SAAU,OAAOV,EAAEU,aAAeT,EAAES,WAIxE,IADAlB,GADAW,EAAOlB,OAAOkB,KAAKH,IACLR,UACCP,OAAOkB,KAAKF,GAAGT,OAAQ,OAAO,EAE7C,IAAKH,EAAIG,EAAgB,GAARH,KACf,IAAKJ,OAAOS,UAAUC,eAAeC,KAAKK,EAAGE,EAAKd,IAAK,OAAO,EAEhE,IAAKA,EAAIG,EAAgB,GAARH,KAAY,CAC3B,IAAIsB,EAAMR,EAAKd,GAEf,IAAKU,EAAMC,EAAEW,GAAMV,EAAEU,IAAO,OAAO,EAGrC,OAAO,EAIT,OAAOX,GAAIA,GAAKC,GAAIA,CACtB"}
|
package/es/graph.d.ts
ADDED
package/es/helpers.d.ts
CHANGED
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Effect function that sets the first action argument to the specified prop.
|
|
3
|
+
* if dirtyProp is set
|
|
3
4
|
*/
|
|
4
|
-
export declare function setArgIn<S, K extends keyof S>(propName: K): (ctx: {
|
|
5
|
+
export declare function setArgIn<S, K extends keyof S, K2 extends keyof S>(propName: K, dirtyProp?: K2): (ctx: {
|
|
5
6
|
s: S;
|
|
6
7
|
args: [S[K]];
|
|
7
8
|
}) => Partial<S>;
|
|
8
9
|
/**
|
|
9
10
|
* Effect function that sets <code>true</code> in the specified prop.
|
|
10
11
|
*/
|
|
11
|
-
export declare function setTrueIn<S, K extends keyof S>(propName: K): (ctx: {
|
|
12
|
+
export declare function setTrueIn<S, K extends keyof S, K2 extends keyof S>(propName: K, dirtyProp?: K2): (ctx: {
|
|
12
13
|
s: S;
|
|
13
14
|
}) => Partial<S>;
|
|
14
15
|
/**
|
|
15
16
|
* Effect function that sets <code>false</code> in the specified prop.
|
|
16
17
|
*/
|
|
17
|
-
export declare function setFalseIn<S, K extends keyof S>(propName: K): (ctx: {
|
|
18
|
+
export declare function setFalseIn<S, K extends keyof S, K2 extends keyof S>(propName: K, dirtyProp?: K2): (ctx: {
|
|
18
19
|
s: S;
|
|
19
20
|
}) => Partial<S>;
|
|
20
21
|
/**
|
|
21
22
|
* Effect function that sets toggles the boolean value of the specified prop.
|
|
22
23
|
*/
|
|
23
|
-
export declare function toggleProp<S, K extends keyof S>(propName: K): (ctx: {
|
|
24
|
+
export declare function toggleProp<S, K extends keyof S, K2 extends keyof S>(propName: K, dirtyProp?: K2): (ctx: {
|
|
24
25
|
s: S;
|
|
25
26
|
}) => Partial<S>;
|
|
26
27
|
/**
|
|
27
28
|
* Effect function that sets the update the specifed prop as an array using first action argument as index
|
|
28
29
|
* and second as value to set.
|
|
29
30
|
*/
|
|
30
|
-
export declare function setArgsInMap<S, K extends keyof S, T>(propName: K): (ctx: {
|
|
31
|
+
export declare function setArgsInMap<S, K extends keyof S, K2 extends keyof S, T>(propName: K, dirtyProp?: K2): (ctx: {
|
|
31
32
|
s: S;
|
|
32
33
|
args: [string, T];
|
|
33
34
|
}) => Partial<S>;
|
|
@@ -35,14 +36,14 @@ export declare function setArgsInMap<S, K extends keyof S, T>(propName: K): (ctx
|
|
|
35
36
|
* Effect function that sets the update the specifed prop as an array using first action argument as index
|
|
36
37
|
* and second as value to set.
|
|
37
38
|
*/
|
|
38
|
-
export declare function setArgsInArray<S, K extends keyof S, T>(propName: K): (ctx: {
|
|
39
|
+
export declare function setArgsInArray<S, K extends keyof S, K2 extends keyof S, T>(propName: K, dirtyProp?: K2): (ctx: {
|
|
39
40
|
s: S;
|
|
40
41
|
args: [number, T];
|
|
41
42
|
}) => Partial<S>;
|
|
42
43
|
/**
|
|
43
44
|
* Effect function that sets the asynchronous action result to the specified prop.
|
|
44
45
|
*/
|
|
45
|
-
export declare function setResIn<S, K extends keyof S>(propName: K): (ctx: {
|
|
46
|
+
export declare function setResIn<S, K extends keyof S, K2 extends keyof S>(propName: K, dirtyProp?: K2): (ctx: {
|
|
46
47
|
s: S;
|
|
47
48
|
res: S[K];
|
|
48
49
|
}) => Partial<S>;
|
|
@@ -50,7 +51,7 @@ export declare function setResIn<S, K extends keyof S>(propName: K): (ctx: {
|
|
|
50
51
|
* Effect function that sets the update the specifed prop as an array using first action argument as index
|
|
51
52
|
* and second as value to set.
|
|
52
53
|
*/
|
|
53
|
-
export declare function setResInArray<S, K extends keyof S, T>(propName: K): (ctx: {
|
|
54
|
+
export declare function setResInArray<S, K extends keyof S, K2 extends keyof S, T>(propName: K, dirtyProp?: K2): (ctx: {
|
|
54
55
|
s: S;
|
|
55
56
|
args: [number];
|
|
56
57
|
res: T;
|
|
@@ -59,7 +60,7 @@ export declare function setResInArray<S, K extends keyof S, T>(propName: K): (ct
|
|
|
59
60
|
* Effect function that sets the update the specifed prop as an array using first action argument as index
|
|
60
61
|
* and second as value to set.
|
|
61
62
|
*/
|
|
62
|
-
export declare function setResInMap<S, K extends keyof S, T>(propName: K): (ctx: {
|
|
63
|
+
export declare function setResInMap<S, K extends keyof S, K2 extends keyof S, T>(propName: K, dirtyProp?: K2): (ctx: {
|
|
63
64
|
s: S;
|
|
64
65
|
args: [string];
|
|
65
66
|
res: T;
|