@wordpress/core-data 6.16.0 → 6.17.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/CHANGELOG.md +2 -0
- package/build/actions.js +69 -134
- package/build/actions.js.map +1 -1
- package/build/batch/create-batch.js +0 -22
- package/build/batch/create-batch.js.map +1 -1
- package/build/batch/default-processor.js +3 -15
- package/build/batch/default-processor.js.map +1 -1
- package/build/batch/index.js +0 -3
- package/build/batch/index.js.map +1 -1
- package/build/entities.js +109 -36
- package/build/entities.js.map +1 -1
- package/build/entity-provider.js +34 -53
- package/build/entity-provider.js.map +1 -1
- package/build/entity-types/attachment.js.map +1 -1
- package/build/entity-types/base-entity-records.js +0 -3
- package/build/entity-types/base-entity-records.js.map +1 -1
- package/build/entity-types/comment.js.map +1 -1
- package/build/entity-types/helpers.js.map +1 -1
- package/build/entity-types/index.js.map +1 -1
- package/build/entity-types/menu-location.js.map +1 -1
- package/build/entity-types/nav-menu-item.js.map +1 -1
- package/build/entity-types/nav-menu.js.map +1 -1
- package/build/entity-types/page.js.map +1 -1
- package/build/entity-types/plugin.js.map +1 -1
- package/build/entity-types/post.js.map +1 -1
- package/build/entity-types/settings.js.map +1 -1
- package/build/entity-types/sidebar.js.map +1 -1
- package/build/entity-types/taxonomy.js.map +1 -1
- package/build/entity-types/theme.js.map +1 -1
- package/build/entity-types/type.js.map +1 -1
- package/build/entity-types/user.js.map +1 -1
- package/build/entity-types/widget-type.js.map +1 -1
- package/build/entity-types/widget.js.map +1 -1
- package/build/entity-types/wp-template-part.js.map +1 -1
- package/build/entity-types/wp-template.js.map +1 -1
- package/build/fetch/__experimental-fetch-link-suggestions.js +14 -20
- package/build/fetch/__experimental-fetch-link-suggestions.js.map +1 -1
- package/build/fetch/__experimental-fetch-url-data.js +4 -13
- package/build/fetch/__experimental-fetch-url-data.js.map +1 -1
- package/build/fetch/index.js +0 -3
- package/build/fetch/index.js.map +1 -1
- package/build/hooks/constants.js +4 -5
- package/build/hooks/constants.js.map +1 -1
- package/build/hooks/index.js +0 -5
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/memoize.js +0 -3
- package/build/hooks/memoize.js.map +1 -1
- package/build/hooks/use-entity-record.js +0 -9
- package/build/hooks/use-entity-record.js.map +1 -1
- package/build/hooks/use-entity-records.js +2 -9
- package/build/hooks/use-entity-records.js.map +1 -1
- package/build/hooks/use-query-select.js +1 -13
- package/build/hooks/use-query-select.js.map +1 -1
- package/build/hooks/use-resource-permissions.js +0 -15
- package/build/hooks/use-resource-permissions.js.map +1 -1
- package/build/index.js +9 -41
- package/build/index.js.map +1 -1
- package/build/locks/actions.js +1 -6
- package/build/locks/actions.js.map +1 -1
- package/build/locks/engine.js +1 -9
- package/build/locks/engine.js.map +1 -1
- package/build/locks/reducer.js +8 -9
- package/build/locks/reducer.js.map +1 -1
- package/build/locks/selectors.js +8 -11
- package/build/locks/selectors.js.map +1 -1
- package/build/locks/utils.js +4 -19
- package/build/locks/utils.js.map +1 -1
- package/build/name.js +0 -1
- package/build/name.js.map +1 -1
- package/build/private-apis.js +1 -2
- package/build/private-apis.js.map +1 -1
- package/build/private-selectors.js +2 -5
- package/build/private-selectors.js.map +1 -1
- package/build/queried-data/actions.js +4 -6
- package/build/queried-data/actions.js.map +1 -1
- package/build/queried-data/get-query-parts.js +11 -24
- package/build/queried-data/get-query-parts.js.map +1 -1
- package/build/queried-data/index.js +0 -6
- package/build/queried-data/index.js.map +1 -1
- package/build/queried-data/reducer.js +33 -51
- package/build/queried-data/reducer.js.map +1 -1
- package/build/queried-data/selectors.js +4 -25
- package/build/queried-data/selectors.js.map +1 -1
- package/build/reducer.js +76 -128
- package/build/reducer.js.map +1 -1
- package/build/resolvers.js +91 -133
- package/build/resolvers.js.map +1 -1
- package/build/selectors.js +51 -145
- package/build/selectors.js.map +1 -1
- package/build/sync.js +19 -0
- package/build/sync.js.map +1 -0
- package/build/types.js.map +1 -1
- package/build/utils/conservative-map-item.js +3 -10
- package/build/utils/conservative-map-item.js.map +1 -1
- package/build/utils/forward-resolver.js +0 -2
- package/build/utils/forward-resolver.js.map +1 -1
- package/build/utils/get-normalized-comma-separable.js +0 -3
- package/build/utils/get-normalized-comma-separable.js.map +1 -1
- package/build/utils/if-matching-action.js +0 -3
- package/build/utils/if-matching-action.js.map +1 -1
- package/build/utils/index.js +0 -10
- package/build/utils/index.js.map +1 -1
- package/build/utils/is-raw-attribute.js +0 -1
- package/build/utils/is-raw-attribute.js.map +1 -1
- package/build/utils/on-sub-key.js +5 -9
- package/build/utils/on-sub-key.js.map +1 -1
- package/build/utils/replace-action.js +0 -2
- package/build/utils/replace-action.js.map +1 -1
- package/build/utils/set-nested-value.js +0 -4
- package/build/utils/set-nested-value.js.map +1 -1
- package/build/utils/with-weak-map-cache.js +3 -6
- package/build/utils/with-weak-map-cache.js.map +1 -1
- package/build-module/actions.js +72 -95
- package/build-module/actions.js.map +1 -1
- package/build-module/batch/create-batch.js +1 -20
- package/build-module/batch/create-batch.js.map +1 -1
- package/build-module/batch/default-processor.js +4 -13
- package/build-module/batch/default-processor.js.map +1 -1
- package/build-module/batch/index.js.map +1 -1
- package/build-module/entities.js +109 -25
- package/build-module/entities.js.map +1 -1
- package/build-module/entity-provider.js +35 -45
- package/build-module/entity-provider.js.map +1 -1
- package/build-module/entity-types/attachment.js.map +1 -1
- package/build-module/entity-types/base-entity-records.js +0 -2
- package/build-module/entity-types/base-entity-records.js.map +1 -1
- package/build-module/entity-types/comment.js.map +1 -1
- package/build-module/entity-types/helpers.js.map +1 -1
- package/build-module/entity-types/index.js.map +1 -1
- package/build-module/entity-types/menu-location.js.map +1 -1
- package/build-module/entity-types/nav-menu-item.js.map +1 -1
- package/build-module/entity-types/nav-menu.js.map +1 -1
- package/build-module/entity-types/page.js.map +1 -1
- package/build-module/entity-types/plugin.js.map +1 -1
- package/build-module/entity-types/post.js.map +1 -1
- package/build-module/entity-types/settings.js.map +1 -1
- package/build-module/entity-types/sidebar.js.map +1 -1
- package/build-module/entity-types/taxonomy.js.map +1 -1
- package/build-module/entity-types/theme.js.map +1 -1
- package/build-module/entity-types/type.js.map +1 -1
- package/build-module/entity-types/user.js.map +1 -1
- package/build-module/entity-types/widget-type.js.map +1 -1
- package/build-module/entity-types/widget.js.map +1 -1
- package/build-module/entity-types/wp-template-part.js.map +1 -1
- package/build-module/entity-types/wp-template.js.map +1 -1
- package/build-module/fetch/__experimental-fetch-link-suggestions.js +15 -15
- package/build-module/fetch/__experimental-fetch-link-suggestions.js.map +1 -1
- package/build-module/fetch/__experimental-fetch-url-data.js +5 -10
- package/build-module/fetch/__experimental-fetch-url-data.js.map +1 -1
- package/build-module/fetch/index.js.map +1 -1
- package/build-module/hooks/constants.js +3 -4
- package/build-module/hooks/constants.js.map +1 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/memoize.js +2 -1
- package/build-module/hooks/memoize.js.map +1 -1
- package/build-module/hooks/use-entity-record.js +1 -3
- package/build-module/hooks/use-entity-record.js.map +1 -1
- package/build-module/hooks/use-entity-records.js +2 -3
- package/build-module/hooks/use-entity-records.js.map +1 -1
- package/build-module/hooks/use-query-select.js +1 -9
- package/build-module/hooks/use-query-select.js.map +1 -1
- package/build-module/hooks/use-resource-permissions.js +1 -10
- package/build-module/hooks/use-resource-permissions.js.map +1 -1
- package/build-module/index.js +11 -19
- package/build-module/index.js.map +1 -1
- package/build-module/locks/actions.js +0 -3
- package/build-module/locks/actions.js.map +1 -1
- package/build-module/locks/engine.js +0 -5
- package/build-module/locks/engine.js.map +1 -1
- package/build-module/locks/reducer.js +7 -7
- package/build-module/locks/reducer.js.map +1 -1
- package/build-module/locks/selectors.js +7 -8
- package/build-module/locks/selectors.js.map +1 -1
- package/build-module/locks/utils.js +4 -14
- package/build-module/locks/utils.js.map +1 -1
- package/build-module/name.js.map +1 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-selectors.js +2 -2
- package/build-module/private-selectors.js.map +1 -1
- package/build-module/queried-data/actions.js +4 -3
- package/build-module/queried-data/actions.js.map +1 -1
- package/build-module/queried-data/get-query-parts.js +13 -21
- package/build-module/queried-data/get-query-parts.js.map +1 -1
- package/build-module/queried-data/index.js.map +1 -1
- package/build-module/queried-data/reducer.js +33 -42
- package/build-module/queried-data/reducer.js.map +1 -1
- package/build-module/queried-data/selectors.js +6 -21
- package/build-module/queried-data/selectors.js.map +1 -1
- package/build-module/reducer.js +79 -104
- package/build-module/reducer.js.map +1 -1
- package/build-module/resolvers.js +94 -96
- package/build-module/resolvers.js.map +1 -1
- package/build-module/selectors.js +56 -92
- package/build-module/selectors.js.map +1 -1
- package/build-module/sync.js +12 -0
- package/build-module/sync.js.map +1 -0
- package/build-module/types.js.map +1 -1
- package/build-module/utils/conservative-map-item.js +4 -8
- package/build-module/utils/conservative-map-item.js.map +1 -1
- package/build-module/utils/forward-resolver.js +0 -1
- package/build-module/utils/forward-resolver.js.map +1 -1
- package/build-module/utils/get-normalized-comma-separable.js +0 -2
- package/build-module/utils/get-normalized-comma-separable.js.map +1 -1
- package/build-module/utils/if-matching-action.js +0 -2
- package/build-module/utils/if-matching-action.js.map +1 -1
- package/build-module/utils/index.js.map +1 -1
- package/build-module/utils/is-raw-attribute.js.map +1 -1
- package/build-module/utils/on-sub-key.js +5 -7
- package/build-module/utils/on-sub-key.js.map +1 -1
- package/build-module/utils/replace-action.js +0 -1
- package/build-module/utils/replace-action.js.map +1 -1
- package/build-module/utils/set-nested-value.js +0 -3
- package/build-module/utils/set-nested-value.js.map +1 -1
- package/build-module/utils/with-weak-map-cache.js +3 -5
- package/build-module/utils/with-weak-map-cache.js.map +1 -1
- package/build-types/actions.d.ts.map +1 -1
- package/build-types/entities.d.ts +53 -0
- package/build-types/entities.d.ts.map +1 -1
- package/build-types/entity-provider.d.ts +1 -1
- package/build-types/entity-provider.d.ts.map +1 -1
- package/build-types/hooks/memoize.d.ts +1 -1
- package/build-types/hooks/memoize.d.ts.map +1 -1
- package/build-types/index.d.ts +3 -3
- package/build-types/index.d.ts.map +1 -1
- package/build-types/resolvers.d.ts.map +1 -1
- package/build-types/sync.d.ts +2 -0
- package/build-types/sync.d.ts.map +1 -0
- package/package.json +17 -15
- package/src/actions.js +24 -14
- package/src/entities.js +91 -0
- package/src/entity-provider.js +11 -2
- package/src/resolvers.js +89 -41
- package/src/sync.js +18 -0
- package/src/test/entity-provider.js +272 -0
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
package/build/actions.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -25,25 +24,16 @@ exports.receiveUploadPermissions = receiveUploadPermissions;
|
|
|
25
24
|
exports.receiveUserPermission = receiveUserPermission;
|
|
26
25
|
exports.receiveUserQuery = receiveUserQuery;
|
|
27
26
|
exports.undo = exports.saveEntityRecord = exports.saveEditedEntityRecord = exports.redo = void 0;
|
|
28
|
-
|
|
29
27
|
var _es = _interopRequireDefault(require("fast-deep-equal/es6"));
|
|
30
|
-
|
|
31
28
|
var _uuid = require("uuid");
|
|
32
|
-
|
|
33
29
|
var _apiFetch = _interopRequireDefault(require("@wordpress/api-fetch"));
|
|
34
|
-
|
|
35
30
|
var _url = require("@wordpress/url");
|
|
36
|
-
|
|
37
31
|
var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
|
|
38
|
-
|
|
39
32
|
var _queriedData = require("./queried-data");
|
|
40
|
-
|
|
41
33
|
var _entities = require("./entities");
|
|
42
|
-
|
|
43
34
|
var _batch = require("./batch");
|
|
44
|
-
|
|
45
35
|
var _name = require("./name");
|
|
46
|
-
|
|
36
|
+
var _sync = require("./sync");
|
|
47
37
|
/**
|
|
48
38
|
* External dependencies
|
|
49
39
|
*/
|
|
@@ -74,6 +64,7 @@ function receiveUserQuery(queryID, users) {
|
|
|
74
64
|
queryID
|
|
75
65
|
};
|
|
76
66
|
}
|
|
67
|
+
|
|
77
68
|
/**
|
|
78
69
|
* Returns an action used in signalling that the current user has been received.
|
|
79
70
|
* Ignored from documentation as it's internal to the data store.
|
|
@@ -84,14 +75,13 @@ function receiveUserQuery(queryID, users) {
|
|
|
84
75
|
*
|
|
85
76
|
* @return {Object} Action object.
|
|
86
77
|
*/
|
|
87
|
-
|
|
88
|
-
|
|
89
78
|
function receiveCurrentUser(currentUser) {
|
|
90
79
|
return {
|
|
91
80
|
type: 'RECEIVE_CURRENT_USER',
|
|
92
81
|
currentUser
|
|
93
82
|
};
|
|
94
83
|
}
|
|
84
|
+
|
|
95
85
|
/**
|
|
96
86
|
* Returns an action object used in adding new entities.
|
|
97
87
|
*
|
|
@@ -99,14 +89,13 @@ function receiveCurrentUser(currentUser) {
|
|
|
99
89
|
*
|
|
100
90
|
* @return {Object} Action object.
|
|
101
91
|
*/
|
|
102
|
-
|
|
103
|
-
|
|
104
92
|
function addEntities(entities) {
|
|
105
93
|
return {
|
|
106
94
|
type: 'ADD_ENTITIES',
|
|
107
95
|
entities
|
|
108
96
|
};
|
|
109
97
|
}
|
|
98
|
+
|
|
110
99
|
/**
|
|
111
100
|
* Returns an action object used in signalling that entity records have been received.
|
|
112
101
|
*
|
|
@@ -118,31 +107,29 @@ function addEntities(entities) {
|
|
|
118
107
|
* @param {?Object} edits Edits to reset.
|
|
119
108
|
* @return {Object} Action object.
|
|
120
109
|
*/
|
|
121
|
-
|
|
122
|
-
|
|
123
110
|
function receiveEntityRecords(kind, name, records, query, invalidateCache = false, edits) {
|
|
124
111
|
// Auto drafts should not have titles, but some plugins rely on them so we can't filter this
|
|
125
112
|
// on the server.
|
|
126
113
|
if (kind === 'postType') {
|
|
127
|
-
records = (Array.isArray(records) ? records : [records]).map(record => record.status === 'auto-draft' ? {
|
|
114
|
+
records = (Array.isArray(records) ? records : [records]).map(record => record.status === 'auto-draft' ? {
|
|
115
|
+
...record,
|
|
128
116
|
title: ''
|
|
129
117
|
} : record);
|
|
130
118
|
}
|
|
131
|
-
|
|
132
119
|
let action;
|
|
133
|
-
|
|
134
120
|
if (query) {
|
|
135
121
|
action = (0, _queriedData.receiveQueriedItems)(records, query, edits);
|
|
136
122
|
} else {
|
|
137
123
|
action = (0, _queriedData.receiveItems)(records, edits);
|
|
138
124
|
}
|
|
139
|
-
|
|
140
|
-
|
|
125
|
+
return {
|
|
126
|
+
...action,
|
|
141
127
|
kind,
|
|
142
128
|
name,
|
|
143
129
|
invalidateCache
|
|
144
130
|
};
|
|
145
131
|
}
|
|
132
|
+
|
|
146
133
|
/**
|
|
147
134
|
* Returns an action object used in signalling that the current theme has been received.
|
|
148
135
|
* Ignored from documentation as it's internal to the data store.
|
|
@@ -153,14 +140,13 @@ function receiveEntityRecords(kind, name, records, query, invalidateCache = fals
|
|
|
153
140
|
*
|
|
154
141
|
* @return {Object} Action object.
|
|
155
142
|
*/
|
|
156
|
-
|
|
157
|
-
|
|
158
143
|
function receiveCurrentTheme(currentTheme) {
|
|
159
144
|
return {
|
|
160
145
|
type: 'RECEIVE_CURRENT_THEME',
|
|
161
146
|
currentTheme
|
|
162
147
|
};
|
|
163
148
|
}
|
|
149
|
+
|
|
164
150
|
/**
|
|
165
151
|
* Returns an action object used in signalling that the current global styles id has been received.
|
|
166
152
|
* Ignored from documentation as it's internal to the data store.
|
|
@@ -171,14 +157,13 @@ function receiveCurrentTheme(currentTheme) {
|
|
|
171
157
|
*
|
|
172
158
|
* @return {Object} Action object.
|
|
173
159
|
*/
|
|
174
|
-
|
|
175
|
-
|
|
176
160
|
function __experimentalReceiveCurrentGlobalStylesId(currentGlobalStylesId) {
|
|
177
161
|
return {
|
|
178
162
|
type: 'RECEIVE_CURRENT_GLOBAL_STYLES_ID',
|
|
179
163
|
id: currentGlobalStylesId
|
|
180
164
|
};
|
|
181
165
|
}
|
|
166
|
+
|
|
182
167
|
/**
|
|
183
168
|
* Returns an action object used in signalling that the theme base global styles have been received
|
|
184
169
|
* Ignored from documentation as it's internal to the data store.
|
|
@@ -190,8 +175,6 @@ function __experimentalReceiveCurrentGlobalStylesId(currentGlobalStylesId) {
|
|
|
190
175
|
*
|
|
191
176
|
* @return {Object} Action object.
|
|
192
177
|
*/
|
|
193
|
-
|
|
194
|
-
|
|
195
178
|
function __experimentalReceiveThemeBaseGlobalStyles(stylesheet, globalStyles) {
|
|
196
179
|
return {
|
|
197
180
|
type: 'RECEIVE_THEME_GLOBAL_STYLES',
|
|
@@ -199,6 +182,7 @@ function __experimentalReceiveThemeBaseGlobalStyles(stylesheet, globalStyles) {
|
|
|
199
182
|
globalStyles
|
|
200
183
|
};
|
|
201
184
|
}
|
|
185
|
+
|
|
202
186
|
/**
|
|
203
187
|
* Returns an action object used in signalling that the theme global styles variations have been received.
|
|
204
188
|
* Ignored from documentation as it's internal to the data store.
|
|
@@ -210,8 +194,6 @@ function __experimentalReceiveThemeBaseGlobalStyles(stylesheet, globalStyles) {
|
|
|
210
194
|
*
|
|
211
195
|
* @return {Object} Action object.
|
|
212
196
|
*/
|
|
213
|
-
|
|
214
|
-
|
|
215
197
|
function __experimentalReceiveThemeGlobalStyleVariations(stylesheet, variations) {
|
|
216
198
|
return {
|
|
217
199
|
type: 'RECEIVE_THEME_GLOBAL_STYLE_VARIATIONS',
|
|
@@ -219,6 +201,7 @@ function __experimentalReceiveThemeGlobalStyleVariations(stylesheet, variations)
|
|
|
219
201
|
variations
|
|
220
202
|
};
|
|
221
203
|
}
|
|
204
|
+
|
|
222
205
|
/**
|
|
223
206
|
* Returns an action object used in signalling that the index has been received.
|
|
224
207
|
*
|
|
@@ -226,8 +209,6 @@ function __experimentalReceiveThemeGlobalStyleVariations(stylesheet, variations)
|
|
|
226
209
|
*
|
|
227
210
|
* @return {Object} Action object.
|
|
228
211
|
*/
|
|
229
|
-
|
|
230
|
-
|
|
231
212
|
function receiveThemeSupports() {
|
|
232
213
|
(0, _deprecated.default)("wp.data.dispatch( 'core' ).receiveThemeSupports", {
|
|
233
214
|
since: '5.9'
|
|
@@ -236,6 +217,7 @@ function receiveThemeSupports() {
|
|
|
236
217
|
type: 'DO_NOTHING'
|
|
237
218
|
};
|
|
238
219
|
}
|
|
220
|
+
|
|
239
221
|
/**
|
|
240
222
|
* Returns an action object used in signalling that the theme global styles CPT post revisions have been received.
|
|
241
223
|
* Ignored from documentation as it's internal to the data store.
|
|
@@ -247,8 +229,6 @@ function receiveThemeSupports() {
|
|
|
247
229
|
*
|
|
248
230
|
* @return {Object} Action object.
|
|
249
231
|
*/
|
|
250
|
-
|
|
251
|
-
|
|
252
232
|
function receiveThemeGlobalStyleRevisions(currentId, revisions) {
|
|
253
233
|
return {
|
|
254
234
|
type: 'RECEIVE_THEME_GLOBAL_STYLE_REVISIONS',
|
|
@@ -256,6 +236,7 @@ function receiveThemeGlobalStyleRevisions(currentId, revisions) {
|
|
|
256
236
|
revisions
|
|
257
237
|
};
|
|
258
238
|
}
|
|
239
|
+
|
|
259
240
|
/**
|
|
260
241
|
* Returns an action object used in signalling that the preview data for
|
|
261
242
|
* a given URl has been received.
|
|
@@ -268,8 +249,6 @@ function receiveThemeGlobalStyleRevisions(currentId, revisions) {
|
|
|
268
249
|
*
|
|
269
250
|
* @return {Object} Action object.
|
|
270
251
|
*/
|
|
271
|
-
|
|
272
|
-
|
|
273
252
|
function receiveEmbedPreview(url, preview) {
|
|
274
253
|
return {
|
|
275
254
|
type: 'RECEIVE_EMBED_PREVIEW',
|
|
@@ -277,6 +256,7 @@ function receiveEmbedPreview(url, preview) {
|
|
|
277
256
|
preview
|
|
278
257
|
};
|
|
279
258
|
}
|
|
259
|
+
|
|
280
260
|
/**
|
|
281
261
|
* Action triggered to delete an entity record.
|
|
282
262
|
*
|
|
@@ -292,8 +272,6 @@ function receiveEmbedPreview(url, preview) {
|
|
|
292
272
|
* @param {boolean} [options.throwOnError=false] If false, this action suppresses all
|
|
293
273
|
* the exceptions. Defaults to false.
|
|
294
274
|
*/
|
|
295
|
-
|
|
296
|
-
|
|
297
275
|
const deleteEntityRecord = (kind, name, recordId, query, {
|
|
298
276
|
__unstableFetch = _apiFetch.default,
|
|
299
277
|
throwOnError = false
|
|
@@ -304,15 +282,12 @@ const deleteEntityRecord = (kind, name, recordId, query, {
|
|
|
304
282
|
const entityConfig = configs.find(config => config.kind === kind && config.name === name);
|
|
305
283
|
let error;
|
|
306
284
|
let deletedRecord = false;
|
|
307
|
-
|
|
308
285
|
if (!entityConfig || entityConfig?.__experimentalNoFetch) {
|
|
309
286
|
return;
|
|
310
287
|
}
|
|
311
|
-
|
|
312
288
|
const lock = await dispatch.__unstableAcquireStoreLock(_name.STORE_NAME, ['entities', 'records', kind, name, recordId], {
|
|
313
289
|
exclusive: true
|
|
314
290
|
});
|
|
315
|
-
|
|
316
291
|
try {
|
|
317
292
|
dispatch({
|
|
318
293
|
type: 'DELETE_ENTITY_RECORD_START',
|
|
@@ -321,14 +296,11 @@ const deleteEntityRecord = (kind, name, recordId, query, {
|
|
|
321
296
|
recordId
|
|
322
297
|
});
|
|
323
298
|
let hasError = false;
|
|
324
|
-
|
|
325
299
|
try {
|
|
326
300
|
let path = `${entityConfig.baseURL}/${recordId}`;
|
|
327
|
-
|
|
328
301
|
if (query) {
|
|
329
302
|
path = (0, _url.addQueryArgs)(path, query);
|
|
330
303
|
}
|
|
331
|
-
|
|
332
304
|
deletedRecord = await __unstableFetch({
|
|
333
305
|
path,
|
|
334
306
|
method: 'DELETE'
|
|
@@ -338,7 +310,6 @@ const deleteEntityRecord = (kind, name, recordId, query, {
|
|
|
338
310
|
hasError = true;
|
|
339
311
|
error = _error;
|
|
340
312
|
}
|
|
341
|
-
|
|
342
313
|
dispatch({
|
|
343
314
|
type: 'DELETE_ENTITY_RECORD_FINISH',
|
|
344
315
|
kind,
|
|
@@ -346,16 +317,15 @@ const deleteEntityRecord = (kind, name, recordId, query, {
|
|
|
346
317
|
recordId,
|
|
347
318
|
error
|
|
348
319
|
});
|
|
349
|
-
|
|
350
320
|
if (hasError && throwOnError) {
|
|
351
321
|
throw error;
|
|
352
322
|
}
|
|
353
|
-
|
|
354
323
|
return deletedRecord;
|
|
355
324
|
} finally {
|
|
356
325
|
dispatch.__unstableReleaseStoreLock(lock);
|
|
357
326
|
}
|
|
358
327
|
};
|
|
328
|
+
|
|
359
329
|
/**
|
|
360
330
|
* Returns an action object that triggers an
|
|
361
331
|
* edit to an entity record.
|
|
@@ -369,20 +339,15 @@ const deleteEntityRecord = (kind, name, recordId, query, {
|
|
|
369
339
|
*
|
|
370
340
|
* @return {Object} Action object.
|
|
371
341
|
*/
|
|
372
|
-
|
|
373
|
-
|
|
374
342
|
exports.deleteEntityRecord = deleteEntityRecord;
|
|
375
|
-
|
|
376
343
|
const editEntityRecord = (kind, name, recordId, edits, options = {}) => ({
|
|
377
344
|
select,
|
|
378
345
|
dispatch
|
|
379
346
|
}) => {
|
|
380
347
|
const entityConfig = select.getEntityConfig(kind, name);
|
|
381
|
-
|
|
382
348
|
if (!entityConfig) {
|
|
383
349
|
throw new Error(`The entity being edited (${kind}, ${name}) does not have a loaded config.`);
|
|
384
350
|
}
|
|
385
|
-
|
|
386
351
|
const {
|
|
387
352
|
mergedEdits = {}
|
|
388
353
|
} = entityConfig;
|
|
@@ -397,88 +362,86 @@ const editEntityRecord = (kind, name, recordId, edits, options = {}) => ({
|
|
|
397
362
|
edits: Object.keys(edits).reduce((acc, key) => {
|
|
398
363
|
const recordValue = record[key];
|
|
399
364
|
const editedRecordValue = editedRecord[key];
|
|
400
|
-
const value = mergedEdits[key] ? {
|
|
365
|
+
const value = mergedEdits[key] ? {
|
|
366
|
+
...editedRecordValue,
|
|
401
367
|
...edits[key]
|
|
402
368
|
} : edits[key];
|
|
403
369
|
acc[key] = (0, _es.default)(recordValue, value) ? undefined : value;
|
|
404
370
|
return acc;
|
|
405
371
|
}, {})
|
|
406
372
|
};
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
373
|
+
if (window.__experimentalEnableSync && entityConfig.syncConfig) {
|
|
374
|
+
const objectId = entityConfig.getSyncObjectId(recordId);
|
|
375
|
+
(0, _sync.getSyncProvider)().update(entityConfig.syncObjectType + '--edit', objectId, edit.edits);
|
|
376
|
+
} else {
|
|
377
|
+
dispatch({
|
|
378
|
+
type: 'EDIT_ENTITY_RECORD',
|
|
379
|
+
...edit,
|
|
380
|
+
meta: {
|
|
381
|
+
undo: !options.undoIgnore && {
|
|
382
|
+
...edit,
|
|
383
|
+
// Send the current values for things like the first undo stack entry.
|
|
384
|
+
edits: Object.keys(edits).reduce((acc, key) => {
|
|
385
|
+
acc[key] = editedRecord[key];
|
|
386
|
+
return acc;
|
|
387
|
+
}, {}),
|
|
388
|
+
isCached: options.isCached
|
|
389
|
+
}
|
|
418
390
|
}
|
|
419
|
-
}
|
|
420
|
-
}
|
|
391
|
+
});
|
|
392
|
+
}
|
|
421
393
|
};
|
|
394
|
+
|
|
422
395
|
/**
|
|
423
396
|
* Action triggered to undo the last edit to
|
|
424
397
|
* an entity record, if any.
|
|
425
398
|
*/
|
|
426
|
-
|
|
427
|
-
|
|
428
399
|
exports.editEntityRecord = editEntityRecord;
|
|
429
|
-
|
|
430
400
|
const undo = () => ({
|
|
431
401
|
select,
|
|
432
402
|
dispatch
|
|
433
403
|
}) => {
|
|
434
404
|
const undoEdit = select.getUndoEdits();
|
|
435
|
-
|
|
436
405
|
if (!undoEdit) {
|
|
437
406
|
return;
|
|
438
407
|
}
|
|
439
|
-
|
|
440
408
|
dispatch({
|
|
441
409
|
type: 'UNDO',
|
|
442
410
|
stackedEdits: undoEdit
|
|
443
411
|
});
|
|
444
412
|
};
|
|
413
|
+
|
|
445
414
|
/**
|
|
446
415
|
* Action triggered to redo the last undoed
|
|
447
416
|
* edit to an entity record, if any.
|
|
448
417
|
*/
|
|
449
|
-
|
|
450
|
-
|
|
451
418
|
exports.undo = undo;
|
|
452
|
-
|
|
453
419
|
const redo = () => ({
|
|
454
420
|
select,
|
|
455
421
|
dispatch
|
|
456
422
|
}) => {
|
|
457
423
|
const redoEdit = select.getRedoEdits();
|
|
458
|
-
|
|
459
424
|
if (!redoEdit) {
|
|
460
425
|
return;
|
|
461
426
|
}
|
|
462
|
-
|
|
463
427
|
dispatch({
|
|
464
428
|
type: 'REDO',
|
|
465
429
|
stackedEdits: redoEdit
|
|
466
430
|
});
|
|
467
431
|
};
|
|
432
|
+
|
|
468
433
|
/**
|
|
469
434
|
* Forces the creation of a new undo level.
|
|
470
435
|
*
|
|
471
436
|
* @return {Object} Action object.
|
|
472
437
|
*/
|
|
473
|
-
|
|
474
|
-
|
|
475
438
|
exports.redo = redo;
|
|
476
|
-
|
|
477
439
|
function __unstableCreateUndoLevel() {
|
|
478
440
|
return {
|
|
479
441
|
type: 'CREATE_UNDO_LEVEL'
|
|
480
442
|
};
|
|
481
443
|
}
|
|
444
|
+
|
|
482
445
|
/**
|
|
483
446
|
* Action triggered to save an entity record.
|
|
484
447
|
*
|
|
@@ -493,8 +456,6 @@ function __unstableCreateUndoLevel() {
|
|
|
493
456
|
* @param {boolean} [options.throwOnError=false] If false, this action suppresses all
|
|
494
457
|
* the exceptions. Defaults to false.
|
|
495
458
|
*/
|
|
496
|
-
|
|
497
|
-
|
|
498
459
|
const saveEntityRecord = (kind, name, record, {
|
|
499
460
|
isAutosave = false,
|
|
500
461
|
__unstableFetch = _apiFetch.default,
|
|
@@ -506,17 +467,14 @@ const saveEntityRecord = (kind, name, record, {
|
|
|
506
467
|
}) => {
|
|
507
468
|
const configs = await dispatch((0, _entities.getOrLoadEntitiesConfig)(kind));
|
|
508
469
|
const entityConfig = configs.find(config => config.kind === kind && config.name === name);
|
|
509
|
-
|
|
510
470
|
if (!entityConfig || entityConfig?.__experimentalNoFetch) {
|
|
511
471
|
return;
|
|
512
472
|
}
|
|
513
|
-
|
|
514
473
|
const entityIdKey = entityConfig.key || _entities.DEFAULT_ENTITY_KEY;
|
|
515
474
|
const recordId = record[entityIdKey];
|
|
516
475
|
const lock = await dispatch.__unstableAcquireStoreLock(_name.STORE_NAME, ['entities', 'records', kind, name, recordId || (0, _uuid.v4)()], {
|
|
517
476
|
exclusive: true
|
|
518
477
|
});
|
|
519
|
-
|
|
520
478
|
try {
|
|
521
479
|
// Evaluate optimized edits.
|
|
522
480
|
// (Function edits that should be evaluated on save to avoid expensive computations on every edit.)
|
|
@@ -531,7 +489,6 @@ const saveEntityRecord = (kind, name, record, {
|
|
|
531
489
|
record[key] = evaluatedValue;
|
|
532
490
|
}
|
|
533
491
|
}
|
|
534
|
-
|
|
535
492
|
dispatch({
|
|
536
493
|
type: 'SAVE_ENTITY_RECORD_START',
|
|
537
494
|
kind,
|
|
@@ -542,11 +499,9 @@ const saveEntityRecord = (kind, name, record, {
|
|
|
542
499
|
let updatedRecord;
|
|
543
500
|
let error;
|
|
544
501
|
let hasError = false;
|
|
545
|
-
|
|
546
502
|
try {
|
|
547
503
|
const path = `${entityConfig.baseURL}${recordId ? '/' + recordId : ''}`;
|
|
548
504
|
const persistedRecord = select.getRawEntityRecord(kind, name, recordId);
|
|
549
|
-
|
|
550
505
|
if (isAutosave) {
|
|
551
506
|
// Most of this autosave logic is very specific to posts.
|
|
552
507
|
// This is fine for now as it is the only supported autosave,
|
|
@@ -554,12 +509,13 @@ const saveEntityRecord = (kind, name, record, {
|
|
|
554
509
|
// so the client just sends and receives objects.
|
|
555
510
|
const currentUser = select.getCurrentUser();
|
|
556
511
|
const currentUserId = currentUser ? currentUser.id : undefined;
|
|
557
|
-
const autosavePost = await resolveSelect.getAutosave(persistedRecord.type, persistedRecord.id, currentUserId);
|
|
512
|
+
const autosavePost = await resolveSelect.getAutosave(persistedRecord.type, persistedRecord.id, currentUserId);
|
|
513
|
+
// Autosaves need all expected fields to be present.
|
|
558
514
|
// So we fallback to the previous autosave and then
|
|
559
515
|
// to the actual persisted entity if the edits don't
|
|
560
516
|
// have a value.
|
|
561
|
-
|
|
562
|
-
|
|
517
|
+
let data = {
|
|
518
|
+
...persistedRecord,
|
|
563
519
|
...autosavePost,
|
|
564
520
|
...record
|
|
565
521
|
};
|
|
@@ -567,7 +523,6 @@ const saveEntityRecord = (kind, name, record, {
|
|
|
567
523
|
if (['title', 'excerpt', 'content', 'meta'].includes(key)) {
|
|
568
524
|
acc[key] = data[key];
|
|
569
525
|
}
|
|
570
|
-
|
|
571
526
|
return acc;
|
|
572
527
|
}, {
|
|
573
528
|
status: data.status === 'auto-draft' ? 'draft' : data.status
|
|
@@ -576,12 +531,14 @@ const saveEntityRecord = (kind, name, record, {
|
|
|
576
531
|
path: `${path}/autosaves`,
|
|
577
532
|
method: 'POST',
|
|
578
533
|
data
|
|
579
|
-
});
|
|
534
|
+
});
|
|
535
|
+
|
|
536
|
+
// An autosave may be processed by the server as a regular save
|
|
580
537
|
// when its update is requested by the author and the post had
|
|
581
538
|
// draft or auto-draft status.
|
|
582
|
-
|
|
583
539
|
if (persistedRecord.id === updatedRecord.id) {
|
|
584
|
-
let newRecord = {
|
|
540
|
+
let newRecord = {
|
|
541
|
+
...persistedRecord,
|
|
585
542
|
...data,
|
|
586
543
|
...updatedRecord
|
|
587
544
|
};
|
|
@@ -597,7 +554,6 @@ const saveEntityRecord = (kind, name, record, {
|
|
|
597
554
|
// These properties are not persisted in autosaves.
|
|
598
555
|
acc[key] = persistedRecord[key];
|
|
599
556
|
}
|
|
600
|
-
|
|
601
557
|
return acc;
|
|
602
558
|
}, {});
|
|
603
559
|
dispatch.receiveEntityRecords(kind, name, newRecord, undefined, true);
|
|
@@ -606,13 +562,12 @@ const saveEntityRecord = (kind, name, record, {
|
|
|
606
562
|
}
|
|
607
563
|
} else {
|
|
608
564
|
let edits = record;
|
|
609
|
-
|
|
610
565
|
if (entityConfig.__unstablePrePersist) {
|
|
611
|
-
edits = {
|
|
566
|
+
edits = {
|
|
567
|
+
...edits,
|
|
612
568
|
...entityConfig.__unstablePrePersist(persistedRecord, edits)
|
|
613
569
|
};
|
|
614
570
|
}
|
|
615
|
-
|
|
616
571
|
updatedRecord = await __unstableFetch({
|
|
617
572
|
path,
|
|
618
573
|
method: recordId ? 'PUT' : 'POST',
|
|
@@ -624,7 +579,6 @@ const saveEntityRecord = (kind, name, record, {
|
|
|
624
579
|
hasError = true;
|
|
625
580
|
error = _error;
|
|
626
581
|
}
|
|
627
|
-
|
|
628
582
|
dispatch({
|
|
629
583
|
type: 'SAVE_ENTITY_RECORD_FINISH',
|
|
630
584
|
kind,
|
|
@@ -633,16 +587,15 @@ const saveEntityRecord = (kind, name, record, {
|
|
|
633
587
|
error,
|
|
634
588
|
isAutosave
|
|
635
589
|
});
|
|
636
|
-
|
|
637
590
|
if (hasError && throwOnError) {
|
|
638
591
|
throw error;
|
|
639
592
|
}
|
|
640
|
-
|
|
641
593
|
return updatedRecord;
|
|
642
594
|
} finally {
|
|
643
595
|
dispatch.__unstableReleaseStoreLock(lock);
|
|
644
596
|
}
|
|
645
597
|
};
|
|
598
|
+
|
|
646
599
|
/**
|
|
647
600
|
* Runs multiple core-data actions at the same time using one API request.
|
|
648
601
|
*
|
|
@@ -665,38 +618,36 @@ const saveEntityRecord = (kind, name, record, {
|
|
|
665
618
|
* @return {(thunkArgs: Object) => Promise} A promise that resolves to an array containing the return
|
|
666
619
|
* values of each function given in `requests`.
|
|
667
620
|
*/
|
|
668
|
-
|
|
669
|
-
|
|
670
621
|
exports.saveEntityRecord = saveEntityRecord;
|
|
671
|
-
|
|
672
622
|
const __experimentalBatch = requests => async ({
|
|
673
623
|
dispatch
|
|
674
624
|
}) => {
|
|
675
625
|
const batch = (0, _batch.createBatch)();
|
|
676
626
|
const api = {
|
|
677
627
|
saveEntityRecord(kind, name, record, options) {
|
|
678
|
-
return batch.add(add => dispatch.saveEntityRecord(kind, name, record, {
|
|
628
|
+
return batch.add(add => dispatch.saveEntityRecord(kind, name, record, {
|
|
629
|
+
...options,
|
|
679
630
|
__unstableFetch: add
|
|
680
631
|
}));
|
|
681
632
|
},
|
|
682
|
-
|
|
683
633
|
saveEditedEntityRecord(kind, name, recordId, options) {
|
|
684
|
-
return batch.add(add => dispatch.saveEditedEntityRecord(kind, name, recordId, {
|
|
634
|
+
return batch.add(add => dispatch.saveEditedEntityRecord(kind, name, recordId, {
|
|
635
|
+
...options,
|
|
685
636
|
__unstableFetch: add
|
|
686
637
|
}));
|
|
687
638
|
},
|
|
688
|
-
|
|
689
639
|
deleteEntityRecord(kind, name, recordId, query, options) {
|
|
690
|
-
return batch.add(add => dispatch.deleteEntityRecord(kind, name, recordId, query, {
|
|
640
|
+
return batch.add(add => dispatch.deleteEntityRecord(kind, name, recordId, query, {
|
|
641
|
+
...options,
|
|
691
642
|
__unstableFetch: add
|
|
692
643
|
}));
|
|
693
644
|
}
|
|
694
|
-
|
|
695
645
|
};
|
|
696
646
|
const resultPromises = requests.map(request => request(api));
|
|
697
647
|
const [, ...results] = await Promise.all([batch.run(), ...resultPromises]);
|
|
698
648
|
return results;
|
|
699
649
|
};
|
|
650
|
+
|
|
700
651
|
/**
|
|
701
652
|
* Action triggered to save an entity record's edits.
|
|
702
653
|
*
|
|
@@ -705,10 +656,7 @@ const __experimentalBatch = requests => async ({
|
|
|
705
656
|
* @param {Object} recordId ID of the record.
|
|
706
657
|
* @param {Object} options Saving options.
|
|
707
658
|
*/
|
|
708
|
-
|
|
709
|
-
|
|
710
659
|
exports.__experimentalBatch = __experimentalBatch;
|
|
711
|
-
|
|
712
660
|
const saveEditedEntityRecord = (kind, name, recordId, options) => async ({
|
|
713
661
|
select,
|
|
714
662
|
dispatch
|
|
@@ -716,14 +664,11 @@ const saveEditedEntityRecord = (kind, name, recordId, options) => async ({
|
|
|
716
664
|
if (!select.hasEditsForEntityRecord(kind, name, recordId)) {
|
|
717
665
|
return;
|
|
718
666
|
}
|
|
719
|
-
|
|
720
667
|
const configs = await dispatch((0, _entities.getOrLoadEntitiesConfig)(kind));
|
|
721
668
|
const entityConfig = configs.find(config => config.kind === kind && config.name === name);
|
|
722
|
-
|
|
723
669
|
if (!entityConfig) {
|
|
724
670
|
return;
|
|
725
671
|
}
|
|
726
|
-
|
|
727
672
|
const entityIdKey = entityConfig.key || _entities.DEFAULT_ENTITY_KEY;
|
|
728
673
|
const edits = select.getEntityRecordNonTransientEdits(kind, name, recordId);
|
|
729
674
|
const record = {
|
|
@@ -732,6 +677,7 @@ const saveEditedEntityRecord = (kind, name, recordId, options) => async ({
|
|
|
732
677
|
};
|
|
733
678
|
return await dispatch.saveEntityRecord(kind, name, record, options);
|
|
734
679
|
};
|
|
680
|
+
|
|
735
681
|
/**
|
|
736
682
|
* Action triggered to save only specified properties for the entity.
|
|
737
683
|
*
|
|
@@ -741,10 +687,7 @@ const saveEditedEntityRecord = (kind, name, recordId, options) => async ({
|
|
|
741
687
|
* @param {Array} itemsToSave List of entity properties to save.
|
|
742
688
|
* @param {Object} options Saving options.
|
|
743
689
|
*/
|
|
744
|
-
|
|
745
|
-
|
|
746
690
|
exports.saveEditedEntityRecord = saveEditedEntityRecord;
|
|
747
|
-
|
|
748
691
|
const __experimentalSaveSpecifiedEntityEdits = (kind, name, recordId, itemsToSave, options) => async ({
|
|
749
692
|
select,
|
|
750
693
|
dispatch
|
|
@@ -752,29 +695,27 @@ const __experimentalSaveSpecifiedEntityEdits = (kind, name, recordId, itemsToSav
|
|
|
752
695
|
if (!select.hasEditsForEntityRecord(kind, name, recordId)) {
|
|
753
696
|
return;
|
|
754
697
|
}
|
|
755
|
-
|
|
756
698
|
const edits = select.getEntityRecordNonTransientEdits(kind, name, recordId);
|
|
757
699
|
const editsToSave = {};
|
|
758
|
-
|
|
759
700
|
for (const edit in edits) {
|
|
760
701
|
if (itemsToSave.some(item => item === edit)) {
|
|
761
702
|
editsToSave[edit] = edits[edit];
|
|
762
703
|
}
|
|
763
704
|
}
|
|
764
|
-
|
|
765
705
|
const configs = await dispatch((0, _entities.getOrLoadEntitiesConfig)(kind));
|
|
766
706
|
const entityConfig = configs.find(config => config.kind === kind && config.name === name);
|
|
767
|
-
const entityIdKey = entityConfig?.key || _entities.DEFAULT_ENTITY_KEY;
|
|
707
|
+
const entityIdKey = entityConfig?.key || _entities.DEFAULT_ENTITY_KEY;
|
|
708
|
+
|
|
709
|
+
// If a record key is provided then update the existing record.
|
|
768
710
|
// This necessitates providing `recordKey` to saveEntityRecord as part of the
|
|
769
711
|
// `record` argument (here called `editsToSave`) to stop that action creating
|
|
770
712
|
// a new record and instead cause it to update the existing record.
|
|
771
|
-
|
|
772
713
|
if (recordId) {
|
|
773
714
|
editsToSave[entityIdKey] = recordId;
|
|
774
715
|
}
|
|
775
|
-
|
|
776
716
|
return await dispatch.saveEntityRecord(kind, name, editsToSave, options);
|
|
777
717
|
};
|
|
718
|
+
|
|
778
719
|
/**
|
|
779
720
|
* Returns an action object used in signalling that Upload permissions have been received.
|
|
780
721
|
*
|
|
@@ -784,10 +725,7 @@ const __experimentalSaveSpecifiedEntityEdits = (kind, name, recordId, itemsToSav
|
|
|
784
725
|
*
|
|
785
726
|
* @return {Object} Action object.
|
|
786
727
|
*/
|
|
787
|
-
|
|
788
|
-
|
|
789
728
|
exports.__experimentalSaveSpecifiedEntityEdits = __experimentalSaveSpecifiedEntityEdits;
|
|
790
|
-
|
|
791
729
|
function receiveUploadPermissions(hasUploadPermissions) {
|
|
792
730
|
(0, _deprecated.default)("wp.data.dispatch( 'core' ).receiveUploadPermissions", {
|
|
793
731
|
since: '5.9',
|
|
@@ -795,6 +733,7 @@ function receiveUploadPermissions(hasUploadPermissions) {
|
|
|
795
733
|
});
|
|
796
734
|
return receiveUserPermission('create/media', hasUploadPermissions);
|
|
797
735
|
}
|
|
736
|
+
|
|
798
737
|
/**
|
|
799
738
|
* Returns an action object used in signalling that the current user has
|
|
800
739
|
* permission to perform an action on a REST resource.
|
|
@@ -807,8 +746,6 @@ function receiveUploadPermissions(hasUploadPermissions) {
|
|
|
807
746
|
*
|
|
808
747
|
* @return {Object} Action object.
|
|
809
748
|
*/
|
|
810
|
-
|
|
811
|
-
|
|
812
749
|
function receiveUserPermission(key, isAllowed) {
|
|
813
750
|
return {
|
|
814
751
|
type: 'RECEIVE_USER_PERMISSION',
|
|
@@ -816,6 +753,7 @@ function receiveUserPermission(key, isAllowed) {
|
|
|
816
753
|
isAllowed
|
|
817
754
|
};
|
|
818
755
|
}
|
|
756
|
+
|
|
819
757
|
/**
|
|
820
758
|
* Returns an action object used in signalling that the autosaves for a
|
|
821
759
|
* post have been received.
|
|
@@ -828,8 +766,6 @@ function receiveUserPermission(key, isAllowed) {
|
|
|
828
766
|
*
|
|
829
767
|
* @return {Object} Action object.
|
|
830
768
|
*/
|
|
831
|
-
|
|
832
|
-
|
|
833
769
|
function receiveAutosaves(postId, autosaves) {
|
|
834
770
|
return {
|
|
835
771
|
type: 'RECEIVE_AUTOSAVES',
|
|
@@ -837,6 +773,7 @@ function receiveAutosaves(postId, autosaves) {
|
|
|
837
773
|
autosaves: Array.isArray(autosaves) ? autosaves : [autosaves]
|
|
838
774
|
};
|
|
839
775
|
}
|
|
776
|
+
|
|
840
777
|
/**
|
|
841
778
|
* Returns an action object signalling that the fallback Navigation
|
|
842
779
|
* Menu id has been received.
|
|
@@ -844,8 +781,6 @@ function receiveAutosaves(postId, autosaves) {
|
|
|
844
781
|
* @param {integer} fallbackId the id of the fallback Navigation Menu
|
|
845
782
|
* @return {Object} Action object.
|
|
846
783
|
*/
|
|
847
|
-
|
|
848
|
-
|
|
849
784
|
function receiveNavigationFallbackId(fallbackId) {
|
|
850
785
|
return {
|
|
851
786
|
type: 'RECEIVE_NAVIGATION_FALLBACK_ID',
|