redux-clerk2 2.0.10 → 2.0.15
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/lib/actions/Fetch.js +6 -6
- package/lib/reducers/bulk.js +6 -2
- package/lib/reducers/create.js +6 -2
- package/lib/reducers/fetch.js +2 -1
- package/lib/reducers/perform.js +10 -2
- package/lib/reducers/remove.js +3 -1
- package/lib/reducers/update.js +6 -2
- package/package.json +1 -1
- package/src/actions/Fetch.js +6 -6
- package/src/reducers/bulk.js +4 -0
- package/src/reducers/create.js +5 -1
- package/src/reducers/fetch.js +2 -1
- package/src/reducers/perform.js +9 -1
- package/src/reducers/remove.js +3 -1
- package/src/reducers/update.js +6 -2
- package/CHANGELOG.md +0 -79
package/lib/actions/Fetch.js
CHANGED
|
@@ -76,11 +76,11 @@ var Fetch = exports.Fetch = function (_BaseAction) {
|
|
|
76
76
|
normalizationSettings = _this$config.normalizationSettings;
|
|
77
77
|
|
|
78
78
|
|
|
79
|
-
var data = { instance: instance, uidField: uidField, options: options, normalizationSettings: normalizationSettings };
|
|
79
|
+
var data = { instance: instance, uidField: uidField, options: options, normalizationSettings: normalizationSettings, params: params };
|
|
80
80
|
var msguid = uuidv1();
|
|
81
81
|
|
|
82
82
|
// Call BaseAction.start with dispatch
|
|
83
|
-
_this.start(dispatch, data
|
|
83
|
+
_this.start(dispatch, data);
|
|
84
84
|
|
|
85
85
|
if (actionSettings !== undefined) {
|
|
86
86
|
var notify = notificationActions.notify,
|
|
@@ -147,11 +147,11 @@ var Fetch = exports.Fetch = function (_BaseAction) {
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
var parameters = _extends({
|
|
150
|
-
page: params.page || 1,
|
|
151
|
-
query: params.query || undefined,
|
|
152
|
-
order: params.order || undefined,
|
|
150
|
+
page: params && params.page || 1,
|
|
151
|
+
query: params && params.query || undefined,
|
|
152
|
+
order: params && params.order || undefined,
|
|
153
153
|
sort: sort_order || undefined,
|
|
154
|
-
limit: params.limit || 10
|
|
154
|
+
limit: params && params.limit || 10
|
|
155
155
|
}, additionalData.filters);
|
|
156
156
|
apiparams = _pickBy(parameters, _identity);
|
|
157
157
|
|
package/lib/reducers/bulk.js
CHANGED
|
@@ -95,7 +95,9 @@ var start = exports.start = function start(state, action) {
|
|
|
95
95
|
state = state.mergeIn(['instances', action.instance, 'additionalData'], _immutable2.default.fromJS(_extends({}, action.additionalData, {
|
|
96
96
|
error: false,
|
|
97
97
|
errorMessage: null,
|
|
98
|
-
isSaving: true
|
|
98
|
+
isSaving: true,
|
|
99
|
+
isFetching: false,
|
|
100
|
+
isFetchingSingle: false
|
|
99
101
|
})));
|
|
100
102
|
//}
|
|
101
103
|
return state;
|
|
@@ -125,7 +127,9 @@ var start = exports.start = function start(state, action) {
|
|
|
125
127
|
map.mergeIn(['instances', action.instance, 'additionalData'], _immutable2.default.fromJS(_extends({}, action.additionalData, {
|
|
126
128
|
error: false,
|
|
127
129
|
errorMessage: null,
|
|
128
|
-
isSaving: true
|
|
130
|
+
isSaving: true,
|
|
131
|
+
isFetching: false,
|
|
132
|
+
isFetchingSingle: false
|
|
129
133
|
})));
|
|
130
134
|
} else {
|
|
131
135
|
// Optimistically update the record
|
package/lib/reducers/create.js
CHANGED
|
@@ -62,7 +62,9 @@ var start = exports.start = function start(state, action) {
|
|
|
62
62
|
state = state.mergeIn(['instances', action.instance, 'additionalData'], _immutable2.default.fromJS(_extends({}, action.additionalData, {
|
|
63
63
|
error: false,
|
|
64
64
|
errorMessage: null,
|
|
65
|
-
isSaving: true
|
|
65
|
+
isSaving: true,
|
|
66
|
+
isFetching: false,
|
|
67
|
+
isFetchingSingle: false
|
|
66
68
|
})));
|
|
67
69
|
|
|
68
70
|
return state;
|
|
@@ -102,7 +104,9 @@ var start = exports.start = function start(state, action) {
|
|
|
102
104
|
map.mergeIn(['instances', action.instance, 'additionalData'], _immutable2.default.fromJS(_extends({}, action.additionalData, {
|
|
103
105
|
error: false,
|
|
104
106
|
errorMessage: null,
|
|
105
|
-
isSaving: true
|
|
107
|
+
isSaving: true,
|
|
108
|
+
isFetching: false,
|
|
109
|
+
isFetchingSingle: false
|
|
106
110
|
})));
|
|
107
111
|
});
|
|
108
112
|
}
|
package/lib/reducers/fetch.js
CHANGED
|
@@ -32,7 +32,8 @@ var uniqEs6 = function uniqEs6(arrArg) {
|
|
|
32
32
|
*
|
|
33
33
|
* @return {Immutable.Map} - updated state
|
|
34
34
|
*/
|
|
35
|
-
var start = exports.start = function start(state, action
|
|
35
|
+
var start = exports.start = function start(state, action) {
|
|
36
|
+
var params = action.params;
|
|
36
37
|
return state.withMutations(function (map) {
|
|
37
38
|
|
|
38
39
|
// Add additional data if provided
|
package/lib/reducers/perform.js
CHANGED
|
@@ -29,7 +29,9 @@ var start = exports.start = function start(state, action) {
|
|
|
29
29
|
map.mergeIn(['instances', action.instance, 'additionalData'], _immutable2.default.fromJS(_extends({}, action.additionalData, {
|
|
30
30
|
error: false,
|
|
31
31
|
errorMessage: null,
|
|
32
|
-
isSaving: true
|
|
32
|
+
isSaving: true,
|
|
33
|
+
isFetching: false,
|
|
34
|
+
isFetchingSingle: false
|
|
33
35
|
})));
|
|
34
36
|
}
|
|
35
37
|
});
|
|
@@ -86,7 +88,13 @@ var success = exports.success = function success(state, action) {
|
|
|
86
88
|
map.set('raw', state.get('raw').merge(newRecord));
|
|
87
89
|
|
|
88
90
|
// Add new record to instance array using permanent uid
|
|
89
|
-
map.
|
|
91
|
+
var instanceData = map.getIn(['instances', action.instance, 'data'], (0, _immutable.List)());
|
|
92
|
+
// Check if key already present in instance
|
|
93
|
+
if (!(instanceData.indexOf(uid) !== -1)) {
|
|
94
|
+
map.setIn(['instances', action.instance, 'data'], instanceData.push(uid));
|
|
95
|
+
}
|
|
96
|
+
// OLD method
|
|
97
|
+
//map.setIn(['instances', action.instance, 'data'], map.getIn(['instances', action.instance, 'data']).push(uid));
|
|
90
98
|
|
|
91
99
|
// UPDATE TOTAL COUNT FOR THIS INSTANCE
|
|
92
100
|
map.setIn(['instances', action.instance, 'additionalData', 'total'], map.getIn(['instances', action.instance, 'additionalData', 'total']) + 1);
|
package/lib/reducers/remove.js
CHANGED
|
@@ -63,7 +63,9 @@ var start = exports.start = function start(state, action) {
|
|
|
63
63
|
state = state.mergeIn(['instances', action.instance, 'additionalData'], _immutable2.default.fromJS(_extends({}, action.additionalData, {
|
|
64
64
|
error: false,
|
|
65
65
|
errorMessage: null,
|
|
66
|
-
isDeleting: true
|
|
66
|
+
isDeleting: true,
|
|
67
|
+
isFetching: false,
|
|
68
|
+
isFetchingSingle: false
|
|
67
69
|
})));
|
|
68
70
|
|
|
69
71
|
return state;
|
package/lib/reducers/update.js
CHANGED
|
@@ -64,7 +64,9 @@ var start = exports.start = function start(state, action) {
|
|
|
64
64
|
state = state.mergeIn(['instances', action.instance, 'additionalData'], _immutable2.default.fromJS(_extends({}, action.additionalData, {
|
|
65
65
|
error: false,
|
|
66
66
|
errorMessage: null,
|
|
67
|
-
isSaving: true
|
|
67
|
+
isSaving: true,
|
|
68
|
+
isFetching: false,
|
|
69
|
+
isFetchingSingle: false
|
|
68
70
|
})));
|
|
69
71
|
|
|
70
72
|
return state;
|
|
@@ -100,7 +102,9 @@ var start = exports.start = function start(state, action) {
|
|
|
100
102
|
map.mergeIn(['instances', action.instance, 'additionalData'], _immutable2.default.fromJS(_extends({}, action.additionalData, {
|
|
101
103
|
error: false,
|
|
102
104
|
errorMessage: null,
|
|
103
|
-
isSaving: true
|
|
105
|
+
isSaving: true,
|
|
106
|
+
isFetching: false,
|
|
107
|
+
isFetchingSingle: false
|
|
104
108
|
})));
|
|
105
109
|
});
|
|
106
110
|
}
|
package/package.json
CHANGED
package/src/actions/Fetch.js
CHANGED
|
@@ -55,11 +55,11 @@ export class Fetch extends BaseAction {
|
|
|
55
55
|
// Create data object to be dispatched with actions
|
|
56
56
|
const { uidField, actionSettings, api, notificationActions, normalizationSettings } = this.config;
|
|
57
57
|
|
|
58
|
-
const data = { instance, uidField, options, normalizationSettings };
|
|
58
|
+
const data = { instance, uidField, options, normalizationSettings, params };
|
|
59
59
|
const msguid = uuidv1();
|
|
60
60
|
|
|
61
61
|
// Call BaseAction.start with dispatch
|
|
62
|
-
this.start(dispatch, data
|
|
62
|
+
this.start(dispatch, data);
|
|
63
63
|
|
|
64
64
|
if(actionSettings !== undefined){
|
|
65
65
|
const { notify, notifyDismiss } = notificationActions;
|
|
@@ -124,11 +124,11 @@ export class Fetch extends BaseAction {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
const parameters = {
|
|
127
|
-
page: params.page || 1
|
|
128
|
-
,query: params.query || undefined
|
|
129
|
-
,order: params.order || undefined
|
|
127
|
+
page: params && params.page || 1
|
|
128
|
+
,query: params && params.query || undefined
|
|
129
|
+
,order: params && params.order || undefined
|
|
130
130
|
,sort: sort_order || undefined
|
|
131
|
-
,limit: params.limit || 10
|
|
131
|
+
,limit: params && params.limit || 10
|
|
132
132
|
,...additionalData.filters
|
|
133
133
|
}
|
|
134
134
|
apiparams = _pickBy(parameters, _identity);
|
package/src/reducers/bulk.js
CHANGED
|
@@ -81,6 +81,8 @@ export const start = (state, action) => {
|
|
|
81
81
|
error: false,
|
|
82
82
|
errorMessage: null,
|
|
83
83
|
isSaving: true,
|
|
84
|
+
isFetching: false,
|
|
85
|
+
isFetchingSingle: false,
|
|
84
86
|
})));
|
|
85
87
|
//}
|
|
86
88
|
return state;
|
|
@@ -112,6 +114,8 @@ export const start = (state, action) => {
|
|
|
112
114
|
error: false,
|
|
113
115
|
errorMessage: null,
|
|
114
116
|
isSaving: true,
|
|
117
|
+
isFetching: false,
|
|
118
|
+
isFetchingSingle: false,
|
|
115
119
|
})));
|
|
116
120
|
|
|
117
121
|
}
|
package/src/reducers/create.js
CHANGED
|
@@ -49,6 +49,8 @@ export const start = (state, action) => {
|
|
|
49
49
|
error: false,
|
|
50
50
|
errorMessage: null,
|
|
51
51
|
isSaving: true,
|
|
52
|
+
isFetching: false,
|
|
53
|
+
isFetchingSingle: false,
|
|
52
54
|
})));
|
|
53
55
|
|
|
54
56
|
return state;
|
|
@@ -89,7 +91,9 @@ export const start = (state, action) => {
|
|
|
89
91
|
map.mergeIn(['instances', action.instance, 'additionalData'], Immutable.fromJS(Object.assign({}, action.additionalData, {
|
|
90
92
|
error: false,
|
|
91
93
|
errorMessage: null,
|
|
92
|
-
isSaving: true
|
|
94
|
+
isSaving: true,
|
|
95
|
+
isFetching: false,
|
|
96
|
+
isFetchingSingle: false,
|
|
93
97
|
})));
|
|
94
98
|
|
|
95
99
|
})
|
package/src/reducers/fetch.js
CHANGED
|
@@ -15,7 +15,8 @@ const uniqEs6 = (arrArg) => {
|
|
|
15
15
|
*
|
|
16
16
|
* @return {Immutable.Map} - updated state
|
|
17
17
|
*/
|
|
18
|
-
export const start = (state, action
|
|
18
|
+
export const start = (state, action) => {
|
|
19
|
+
const params = action.params;
|
|
19
20
|
return state.withMutations(map => {
|
|
20
21
|
|
|
21
22
|
// Add additional data if provided
|
package/src/reducers/perform.js
CHANGED
|
@@ -17,6 +17,8 @@ export const start = (state, action) => {
|
|
|
17
17
|
error: false,
|
|
18
18
|
errorMessage: null,
|
|
19
19
|
isSaving: true,
|
|
20
|
+
isFetching: false,
|
|
21
|
+
isFetchingSingle: false,
|
|
20
22
|
})));
|
|
21
23
|
}
|
|
22
24
|
})
|
|
@@ -73,7 +75,13 @@ export const start = (state, action) => {
|
|
|
73
75
|
map.set('raw', state.get('raw').merge(newRecord))
|
|
74
76
|
|
|
75
77
|
// Add new record to instance array using permanent uid
|
|
76
|
-
|
|
78
|
+
const instanceData = map.getIn(['instances', action.instance, 'data'], List());
|
|
79
|
+
// Check if key already present in instance
|
|
80
|
+
if(!instanceData.includes(uid)){
|
|
81
|
+
map.setIn(['instances', action.instance, 'data'], instanceData.push(uid));
|
|
82
|
+
}
|
|
83
|
+
// OLD method
|
|
84
|
+
//map.setIn(['instances', action.instance, 'data'], map.getIn(['instances', action.instance, 'data']).push(uid));
|
|
77
85
|
|
|
78
86
|
// UPDATE TOTAL COUNT FOR THIS INSTANCE
|
|
79
87
|
map.setIn(['instances', action.instance, 'additionalData', 'total'], map.getIn(['instances', action.instance, 'additionalData', 'total']) + 1 );
|
package/src/reducers/remove.js
CHANGED
|
@@ -51,7 +51,9 @@ export const start = (state, action) => {
|
|
|
51
51
|
state = state.mergeIn(['instances', action.instance, 'additionalData'], Immutable.fromJS(Object.assign({}, action.additionalData, {
|
|
52
52
|
error: false,
|
|
53
53
|
errorMessage: null,
|
|
54
|
-
isDeleting: true
|
|
54
|
+
isDeleting: true,
|
|
55
|
+
isFetching: false,
|
|
56
|
+
isFetchingSingle: false,
|
|
55
57
|
})));
|
|
56
58
|
|
|
57
59
|
return state;
|
package/src/reducers/update.js
CHANGED
|
@@ -54,7 +54,9 @@ export const start = (state, action) => {
|
|
|
54
54
|
state = state.mergeIn(['instances', action.instance, 'additionalData'], Immutable.fromJS(Object.assign({}, action.additionalData, {
|
|
55
55
|
error: false,
|
|
56
56
|
errorMessage: null,
|
|
57
|
-
isSaving: true
|
|
57
|
+
isSaving: true,
|
|
58
|
+
isFetching: false,
|
|
59
|
+
isFetchingSingle: false,
|
|
58
60
|
})));
|
|
59
61
|
|
|
60
62
|
return state;
|
|
@@ -92,7 +94,9 @@ export const start = (state, action) => {
|
|
|
92
94
|
map.mergeIn(['instances', action.instance, 'additionalData'], Immutable.fromJS(Object.assign({}, action.additionalData, {
|
|
93
95
|
error: false,
|
|
94
96
|
errorMessage: null,
|
|
95
|
-
isSaving: true
|
|
97
|
+
isSaving: true,
|
|
98
|
+
isFetching: false,
|
|
99
|
+
isFetchingSingle: false,
|
|
96
100
|
})));
|
|
97
101
|
|
|
98
102
|
})
|
package/CHANGELOG.md
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
## 1.0.0
|
|
2
|
-
###### _August 10, 2017_
|
|
3
|
-
|
|
4
|
-
- Convert responseData to Immutable data structure before adding to store ([#51](https://github.com/GetAmbassador/redux-clerk/pull/51))
|
|
5
|
-
|
|
6
|
-
## 1.0.0-rc.4
|
|
7
|
-
###### _May 2, 2017_
|
|
8
|
-
|
|
9
|
-
- Accept responseData in handleSuccess for the update action ([#48](https://github.com/GetAmbassador/redux-clerk/pull/48))
|
|
10
|
-
- Update docs to reflect optional optimism ([#47](https://github.com/GetAmbassador/redux-clerk/pull/47))
|
|
11
|
-
|
|
12
|
-
## 1.0.0-rc.3
|
|
13
|
-
###### _April 10, 2017_
|
|
14
|
-
|
|
15
|
-
- Cast all raw ids to strings ([#44](https://github.com/GetAmbassador/redux-clerk/pull/44))
|
|
16
|
-
- Update selectors to handle optional optimism ([#43](https://github.com/GetAmbassador/redux-clerk/pull/43))
|
|
17
|
-
- Make optimistic updates optional ([#41](https://github.com/GetAmbassador/redux-clerk/pull/41))
|
|
18
|
-
|
|
19
|
-
## 1.0.0-rc.2
|
|
20
|
-
###### _March 23, 2017_
|
|
21
|
-
|
|
22
|
-
- Added pre action hooks ([#38](https://github.com/GetAmbassador/redux-clerk/pull/38))
|
|
23
|
-
|
|
24
|
-
## 1.0.0-rc.1
|
|
25
|
-
###### _March 22, 2017_
|
|
26
|
-
|
|
27
|
-
- Added post action hooks ([#36](https://github.com/GetAmbassador/redux-clerk/pull/36))
|
|
28
|
-
- Rename delete action to remove to avoid reserved word conflicts ([#35](https://github.com/GetAmbassador/redux-clerk/pull/35))
|
|
29
|
-
|
|
30
|
-
## 0.3.0
|
|
31
|
-
###### _March 15, 2017_
|
|
32
|
-
|
|
33
|
-
- Fetch response will now deep merge response data into raw data ([#33](https://github.com/GetAmbassador/redux-clerk/pull/33))
|
|
34
|
-
|
|
35
|
-
## 0.2.8
|
|
36
|
-
###### _February 21, 2017_
|
|
37
|
-
|
|
38
|
-
- Cast uid to int in record selector ([#31](https://github.com/GetAmbassador/redux-clerk/pull/31))
|
|
39
|
-
|
|
40
|
-
## 0.2.7
|
|
41
|
-
###### _February 16, 2017_
|
|
42
|
-
|
|
43
|
-
- Added the get selector ([#29](https://github.com/GetAmbassador/redux-clerk/pull/29))
|
|
44
|
-
|
|
45
|
-
## 0.2.6
|
|
46
|
-
###### _January 11, 2017_
|
|
47
|
-
|
|
48
|
-
- Added the datasetProperty selector ([#27](https://github.com/GetAmbassador/redux-clerk/pull/27))
|
|
49
|
-
|
|
50
|
-
## 0.2.5
|
|
51
|
-
###### _January 3, 2017_
|
|
52
|
-
|
|
53
|
-
- Return Map instead of List for empty dataset ([#25](https://github.com/GetAmbassador/redux-clerk/pull/25))
|
|
54
|
-
- Ensure data is properly converted between actions and reducers ([#24](https://github.com/GetAmbassador/redux-clerk/pull/24))
|
|
55
|
-
|
|
56
|
-
## 0.2.4
|
|
57
|
-
###### _December 15, 2016_
|
|
58
|
-
|
|
59
|
-
- uidField option has been removed for the reducer (it is not longer needed) ([#22](https://github.com/GetAmbassador/redux-clerk/pull/22))
|
|
60
|
-
|
|
61
|
-
## 0.2.3
|
|
62
|
-
###### _December 14, 2016_
|
|
63
|
-
|
|
64
|
-
- Records are now added while updating if not already in state ([#20](https://github.com/GetAmbassador/redux-clerk/pull/20))
|
|
65
|
-
|
|
66
|
-
## 0.2.2
|
|
67
|
-
###### _December 13, 2016_
|
|
68
|
-
|
|
69
|
-
- Added the ability to return fetch response as an object or array ([#18](https://github.com/GetAmbassador/redux-clerk/pull/18))
|
|
70
|
-
|
|
71
|
-
## 0.2.1
|
|
72
|
-
###### _December 7, 2016_
|
|
73
|
-
|
|
74
|
-
- Added the ability to pass additional data with fetch, create and delete actions ([#16](https://github.com/GetAmbassador/redux-clerk/pull/16))
|
|
75
|
-
|
|
76
|
-
## 0.2.0
|
|
77
|
-
###### _December 5, 2016_
|
|
78
|
-
|
|
79
|
-
- Initial Release
|