@wordpress/core-data 4.2.0-next.e230fbab09.0 → 4.3.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 +7 -0
- package/README.md +41 -8
- package/build/actions.js +61 -41
- package/build/actions.js.map +1 -1
- package/build/entities.js +36 -23
- package/build/entities.js.map +1 -1
- package/build/entity-provider.js +46 -44
- package/build/entity-provider.js.map +1 -1
- package/build/entity-types/{base-entity-types.js → base-entity-records.js} +9 -9
- package/build/entity-types/base-entity-records.js.map +1 -0
- package/build/fetch/__experimental-fetch-link-suggestions.js +1 -1
- package/build/fetch/__experimental-fetch-link-suggestions.js.map +1 -1
- package/build/fetch/__experimental-fetch-url-data.js +1 -1
- package/build/fetch/__experimental-fetch-url-data.js.map +1 -1
- package/build/hooks/use-entity-record.js +15 -5
- package/build/hooks/use-entity-record.js.map +1 -1
- package/build/hooks/use-entity-records.js +17 -5
- package/build/hooks/use-entity-records.js.map +1 -1
- package/build/index.js +9 -21
- package/build/index.js.map +1 -1
- package/build/queried-data/actions.js +4 -4
- package/build/queried-data/actions.js.map +1 -1
- package/build/queried-data/get-query-parts.js +7 -3
- package/build/queried-data/get-query-parts.js.map +1 -1
- package/build/queried-data/reducer.js +8 -6
- package/build/queried-data/reducer.js.map +1 -1
- package/build/reducer.js +16 -16
- package/build/reducer.js.map +1 -1
- package/build/resolvers.js +17 -23
- package/build/resolvers.js.map +1 -1
- package/build/selectors.js +92 -51
- package/build/selectors.js.map +1 -1
- package/build/utils/conservative-map-item.js +1 -1
- package/build/utils/conservative-map-item.js.map +1 -1
- package/build/utils/is-raw-attribute.js +1 -1
- package/build/utils/is-raw-attribute.js.map +1 -1
- package/build-module/actions.js +62 -42
- package/build-module/actions.js.map +1 -1
- package/build-module/entities.js +32 -19
- package/build-module/entities.js.map +1 -1
- package/build-module/entity-provider.js +47 -45
- package/build-module/entity-provider.js.map +1 -1
- package/build-module/entity-types/{base-entity-types.js → base-entity-records.js} +7 -7
- package/build-module/entity-types/base-entity-records.js.map +1 -0
- package/build-module/fetch/__experimental-fetch-link-suggestions.js +1 -1
- package/build-module/fetch/__experimental-fetch-link-suggestions.js.map +1 -1
- package/build-module/fetch/__experimental-fetch-url-data.js +1 -1
- package/build-module/fetch/__experimental-fetch-url-data.js.map +1 -1
- package/build-module/hooks/use-entity-record.js +15 -5
- package/build-module/hooks/use-entity-record.js.map +1 -1
- package/build-module/hooks/use-entity-records.js +17 -5
- package/build-module/hooks/use-entity-records.js.map +1 -1
- package/build-module/index.js +10 -22
- package/build-module/index.js.map +1 -1
- package/build-module/queried-data/actions.js +4 -4
- package/build-module/queried-data/actions.js.map +1 -1
- package/build-module/queried-data/get-query-parts.js +7 -3
- package/build-module/queried-data/get-query-parts.js.map +1 -1
- package/build-module/queried-data/reducer.js +8 -6
- package/build-module/queried-data/reducer.js.map +1 -1
- package/build-module/reducer.js +17 -17
- package/build-module/reducer.js.map +1 -1
- package/build-module/resolvers.js +18 -24
- package/build-module/resolvers.js.map +1 -1
- package/build-module/selectors.js +88 -51
- package/build-module/selectors.js.map +1 -1
- package/build-module/utils/conservative-map-item.js +1 -1
- package/build-module/utils/conservative-map-item.js.map +1 -1
- package/build-module/utils/is-raw-attribute.js +1 -1
- package/build-module/utils/is-raw-attribute.js.map +1 -1
- package/package.json +11 -11
- package/src/actions.js +62 -42
- package/src/entities.js +43 -17
- package/src/entity-provider.js +50 -44
- package/src/entity-types/attachment.ts +5 -5
- package/src/entity-types/{base-entity-types.ts → base-entity-records.ts} +5 -5
- package/src/entity-types/comment.ts +5 -5
- package/src/entity-types/helpers.ts +1 -1
- package/src/entity-types/index.ts +4 -4
- package/src/entity-types/menu-location.ts +5 -5
- package/src/entity-types/nav-menu-item.ts +10 -5
- package/src/entity-types/nav-menu.ts +5 -5
- package/src/entity-types/navigation-area.ts +5 -5
- package/src/entity-types/page.ts +5 -5
- package/src/entity-types/plugin.ts +10 -5
- package/src/entity-types/post.ts +5 -5
- package/src/entity-types/settings.ts +10 -5
- package/src/entity-types/sidebar.ts +6 -7
- package/src/entity-types/taxonomy.ts +5 -5
- package/src/entity-types/theme.ts +5 -5
- package/src/entity-types/type.ts +5 -5
- package/src/entity-types/user.ts +10 -5
- package/src/entity-types/widget-type.ts +5 -5
- package/src/entity-types/widget.ts +5 -5
- package/src/entity-types/wp-template-part.ts +5 -5
- package/src/entity-types/wp-template.ts +5 -5
- package/src/fetch/__experimental-fetch-link-suggestions.js +1 -1
- package/src/fetch/__experimental-fetch-url-data.js +1 -0
- package/src/hooks/use-entity-record.ts +19 -8
- package/src/hooks/use-entity-records.ts +26 -9
- package/src/index.js +10 -15
- package/src/locks/test/selectors.js +4 -4
- package/src/queried-data/actions.js +4 -4
- package/src/queried-data/get-query-parts.js +5 -5
- package/src/queried-data/reducer.js +6 -6
- package/src/reducer.js +17 -17
- package/src/resolvers.js +25 -30
- package/src/selectors.js +92 -53
- package/src/test/actions.js +138 -33
- package/src/test/entities.js +11 -11
- package/src/test/reducer.js +4 -4
- package/src/test/resolvers.js +5 -5
- package/src/test/selectors.js +22 -22
- package/src/utils/conservative-map-item.js +1 -1
- package/src/utils/is-raw-attribute.js +1 -1
- package/src/utils/test/is-raw-attribute.js +4 -4
- package/build/entity-types/base-entity-types.js.map +0 -1
- package/build-module/entity-types/base-entity-types.js.map +0 -1
package/build/selectors.js
CHANGED
|
@@ -21,7 +21,9 @@ exports.getCurrentUser = getCurrentUser;
|
|
|
21
21
|
exports.getEditedEntityRecord = void 0;
|
|
22
22
|
exports.getEmbedPreview = getEmbedPreview;
|
|
23
23
|
exports.getEntitiesByKind = getEntitiesByKind;
|
|
24
|
+
exports.getEntitiesConfig = getEntitiesConfig;
|
|
24
25
|
exports.getEntity = getEntity;
|
|
26
|
+
exports.getEntityConfig = getEntityConfig;
|
|
25
27
|
exports.getEntityRecord = void 0;
|
|
26
28
|
exports.getEntityRecordEdits = getEntityRecordEdits;
|
|
27
29
|
exports.getEntityRecordNonTransientEdits = void 0;
|
|
@@ -144,8 +146,9 @@ const getUserQueryResults = (0, _rememo.default)((state, queryID) => {
|
|
|
144
146
|
return (0, _lodash.map)(queryResults, id => state.users.byId[id]);
|
|
145
147
|
}, (state, queryID) => [state.users.queries[queryID], state.users.byId]);
|
|
146
148
|
/**
|
|
147
|
-
* Returns
|
|
149
|
+
* Returns the loaded entities for the given kind.
|
|
148
150
|
*
|
|
151
|
+
* @deprecated since WordPress 6.0. Use getEntitiesConfig instead
|
|
149
152
|
* @param {Object} state Data state.
|
|
150
153
|
* @param {string} kind Entity kind.
|
|
151
154
|
*
|
|
@@ -155,22 +158,58 @@ const getUserQueryResults = (0, _rememo.default)((state, queryID) => {
|
|
|
155
158
|
exports.getUserQueryResults = getUserQueryResults;
|
|
156
159
|
|
|
157
160
|
function getEntitiesByKind(state, kind) {
|
|
161
|
+
(0, _deprecated.default)("wp.data.select( 'core' ).getEntitiesByKind()", {
|
|
162
|
+
since: '6.0',
|
|
163
|
+
alternative: "wp.data.select( 'core' ).getEntitiesConfig()"
|
|
164
|
+
});
|
|
165
|
+
return getEntitiesConfig(state, kind);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Returns the loaded entities for the given kind.
|
|
169
|
+
*
|
|
170
|
+
* @param {Object} state Data state.
|
|
171
|
+
* @param {string} kind Entity kind.
|
|
172
|
+
*
|
|
173
|
+
* @return {Array<Object>} Array of entities with config matching kind.
|
|
174
|
+
*/
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
function getEntitiesConfig(state, kind) {
|
|
158
178
|
return (0, _lodash.filter)(state.entities.config, {
|
|
159
179
|
kind
|
|
160
180
|
});
|
|
161
181
|
}
|
|
162
182
|
/**
|
|
163
|
-
* Returns the entity
|
|
183
|
+
* Returns the entity config given its kind and name.
|
|
164
184
|
*
|
|
185
|
+
* @deprecated since WordPress 6.0. Use getEntityConfig instead
|
|
165
186
|
* @param {Object} state Data state.
|
|
166
187
|
* @param {string} kind Entity kind.
|
|
167
188
|
* @param {string} name Entity name.
|
|
168
189
|
*
|
|
169
|
-
* @return {Object} Entity
|
|
190
|
+
* @return {Object} Entity config
|
|
170
191
|
*/
|
|
171
192
|
|
|
172
193
|
|
|
173
194
|
function getEntity(state, kind, name) {
|
|
195
|
+
(0, _deprecated.default)("wp.data.select( 'core' ).getEntity()", {
|
|
196
|
+
since: '6.0',
|
|
197
|
+
alternative: "wp.data.select( 'core' ).getEntityConfig()"
|
|
198
|
+
});
|
|
199
|
+
return getEntityConfig(state, kind, name);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Returns the entity config given its kind and name.
|
|
203
|
+
*
|
|
204
|
+
* @param {Object} state Data state.
|
|
205
|
+
* @param {string} kind Entity kind.
|
|
206
|
+
* @param {string} name Entity name.
|
|
207
|
+
*
|
|
208
|
+
* @return {Object} Entity config
|
|
209
|
+
*/
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
function getEntityConfig(state, kind, name) {
|
|
174
213
|
return (0, _lodash.find)(state.entities.config, {
|
|
175
214
|
kind,
|
|
176
215
|
name
|
|
@@ -187,14 +226,14 @@ function getEntity(state, kind, name) {
|
|
|
187
226
|
* @param {number} key Record's key
|
|
188
227
|
* @param {?Object} query Optional query.
|
|
189
228
|
*
|
|
190
|
-
* @return {Object
|
|
229
|
+
* @return {Object|undefined} Record.
|
|
191
230
|
*/
|
|
192
231
|
|
|
193
232
|
|
|
194
233
|
const getEntityRecord = (0, _rememo.default)((state, kind, name, key, query) => {
|
|
195
234
|
var _query$context, _queriedState$items$c;
|
|
196
235
|
|
|
197
|
-
const queriedState = (0, _lodash.get)(state.entities.
|
|
236
|
+
const queriedState = (0, _lodash.get)(state.entities.records, [kind, name, 'queriedData']);
|
|
198
237
|
|
|
199
238
|
if (!queriedState) {
|
|
200
239
|
return undefined;
|
|
@@ -216,8 +255,10 @@ const getEntityRecord = (0, _rememo.default)((state, kind, name, key, query) =>
|
|
|
216
255
|
const item = (_queriedState$items$c = queriedState.items[context]) === null || _queriedState$items$c === void 0 ? void 0 : _queriedState$items$c[key];
|
|
217
256
|
|
|
218
257
|
if (item && query._fields) {
|
|
258
|
+
var _getNormalizedCommaSe;
|
|
259
|
+
|
|
219
260
|
const filteredItem = {};
|
|
220
|
-
const fields = (0, _utils.getNormalizedCommaSeparable)(query._fields);
|
|
261
|
+
const fields = (_getNormalizedCommaSe = (0, _utils.getNormalizedCommaSeparable)(query._fields)) !== null && _getNormalizedCommaSe !== void 0 ? _getNormalizedCommaSe : [];
|
|
221
262
|
|
|
222
263
|
for (let f = 0; f < fields.length; f++) {
|
|
223
264
|
const field = fields[f].split('.');
|
|
@@ -233,10 +274,10 @@ const getEntityRecord = (0, _rememo.default)((state, kind, name, key, query) =>
|
|
|
233
274
|
var _query$context2;
|
|
234
275
|
|
|
235
276
|
const context = (_query$context2 = query === null || query === void 0 ? void 0 : query.context) !== null && _query$context2 !== void 0 ? _query$context2 : 'default';
|
|
236
|
-
return [(0, _lodash.get)(state.entities.
|
|
277
|
+
return [(0, _lodash.get)(state.entities.records, [kind, name, 'queriedData', 'items', context, recordId]), (0, _lodash.get)(state.entities.records, [kind, name, 'queriedData', 'itemIsComplete', context, recordId])];
|
|
237
278
|
});
|
|
238
279
|
/**
|
|
239
|
-
* Returns the Entity's record object by key. Doesn't trigger a resolver nor requests the entity from the API if the entity record isn't available in the local state.
|
|
280
|
+
* Returns the Entity's record object by key. Doesn't trigger a resolver nor requests the entity records from the API if the entity record isn't available in the local state.
|
|
240
281
|
*
|
|
241
282
|
* @param {Object} state State tree
|
|
242
283
|
* @param {string} kind Entity kind.
|
|
@@ -267,7 +308,7 @@ function __experimentalGetEntityRecordNoResolver(state, kind, name, key) {
|
|
|
267
308
|
const getRawEntityRecord = (0, _rememo.default)((state, kind, name, key) => {
|
|
268
309
|
const record = getEntityRecord(state, kind, name, key);
|
|
269
310
|
return record && Object.keys(record).reduce((accumulator, _key) => {
|
|
270
|
-
if ((0, _utils.isRawAttribute)(
|
|
311
|
+
if ((0, _utils.isRawAttribute)(getEntityConfig(state, kind, name), _key)) {
|
|
271
312
|
// Because edits are the "raw" attribute values,
|
|
272
313
|
// we return those from record selectors to make rendering,
|
|
273
314
|
// comparisons, and joins with edits easier.
|
|
@@ -282,7 +323,7 @@ const getRawEntityRecord = (0, _rememo.default)((state, kind, name, key) => {
|
|
|
282
323
|
var _query$context3;
|
|
283
324
|
|
|
284
325
|
const context = (_query$context3 = query === null || query === void 0 ? void 0 : query.context) !== null && _query$context3 !== void 0 ? _query$context3 : 'default';
|
|
285
|
-
return [state.entities.config, (0, _lodash.get)(state.entities.
|
|
326
|
+
return [state.entities.config, (0, _lodash.get)(state.entities.records, [kind, name, 'queriedData', 'items', context, recordId]), (0, _lodash.get)(state.entities.records, [kind, name, 'queriedData', 'itemIsComplete', context, recordId])];
|
|
286
327
|
});
|
|
287
328
|
/**
|
|
288
329
|
* Returns true if records have been received for the given set of parameters,
|
|
@@ -316,7 +357,7 @@ function hasEntityRecords(state, kind, name, query) {
|
|
|
316
357
|
function getEntityRecords(state, kind, name, query) {
|
|
317
358
|
// Queried data state is prepopulated for all known entities. If this is not
|
|
318
359
|
// assigned for the given parameters, then it is known to not exist.
|
|
319
|
-
const queriedState = (0, _lodash.get)(state.entities.
|
|
360
|
+
const queriedState = (0, _lodash.get)(state.entities.records, [kind, name, 'queriedData']);
|
|
320
361
|
|
|
321
362
|
if (!queriedState) {
|
|
322
363
|
return null;
|
|
@@ -336,27 +377,27 @@ function getEntityRecords(state, kind, name, query) {
|
|
|
336
377
|
const __experimentalGetDirtyEntityRecords = (0, _rememo.default)(state => {
|
|
337
378
|
const {
|
|
338
379
|
entities: {
|
|
339
|
-
|
|
380
|
+
records
|
|
340
381
|
}
|
|
341
382
|
} = state;
|
|
342
383
|
const dirtyRecords = [];
|
|
343
|
-
Object.keys(
|
|
344
|
-
Object.keys(
|
|
345
|
-
const primaryKeys = Object.keys(
|
|
384
|
+
Object.keys(records).forEach(kind => {
|
|
385
|
+
Object.keys(records[kind]).forEach(name => {
|
|
386
|
+
const primaryKeys = Object.keys(records[kind][name].edits).filter(primaryKey => // The entity record must exist (not be deleted),
|
|
346
387
|
// and it must have edits.
|
|
347
388
|
getEntityRecord(state, kind, name, primaryKey) && hasEditsForEntityRecord(state, kind, name, primaryKey));
|
|
348
389
|
|
|
349
390
|
if (primaryKeys.length) {
|
|
350
|
-
const
|
|
391
|
+
const entityConfig = getEntityConfig(state, kind, name);
|
|
351
392
|
primaryKeys.forEach(primaryKey => {
|
|
352
|
-
var
|
|
393
|
+
var _entityConfig$getTitl;
|
|
353
394
|
|
|
354
395
|
const entityRecord = getEditedEntityRecord(state, kind, name, primaryKey);
|
|
355
396
|
dirtyRecords.push({
|
|
356
397
|
// We avoid using primaryKey because it's transformed into a string
|
|
357
398
|
// when it's used as an object key.
|
|
358
|
-
key: entityRecord[
|
|
359
|
-
title: (
|
|
399
|
+
key: entityRecord[entityConfig.key || _entities.DEFAULT_ENTITY_KEY],
|
|
400
|
+
title: (entityConfig === null || entityConfig === void 0 ? void 0 : (_entityConfig$getTitl = entityConfig.getTitle) === null || _entityConfig$getTitl === void 0 ? void 0 : _entityConfig$getTitl.call(entityConfig, entityRecord)) || '',
|
|
360
401
|
name,
|
|
361
402
|
kind
|
|
362
403
|
});
|
|
@@ -365,7 +406,7 @@ const __experimentalGetDirtyEntityRecords = (0, _rememo.default)(state => {
|
|
|
365
406
|
});
|
|
366
407
|
});
|
|
367
408
|
return dirtyRecords;
|
|
368
|
-
}, state => [state.entities.
|
|
409
|
+
}, state => [state.entities.records]);
|
|
369
410
|
/**
|
|
370
411
|
* Returns the list of entities currently being saved.
|
|
371
412
|
*
|
|
@@ -380,25 +421,25 @@ exports.__experimentalGetDirtyEntityRecords = __experimentalGetDirtyEntityRecord
|
|
|
380
421
|
const __experimentalGetEntitiesBeingSaved = (0, _rememo.default)(state => {
|
|
381
422
|
const {
|
|
382
423
|
entities: {
|
|
383
|
-
|
|
424
|
+
records
|
|
384
425
|
}
|
|
385
426
|
} = state;
|
|
386
427
|
const recordsBeingSaved = [];
|
|
387
|
-
Object.keys(
|
|
388
|
-
Object.keys(
|
|
389
|
-
const primaryKeys = Object.keys(
|
|
428
|
+
Object.keys(records).forEach(kind => {
|
|
429
|
+
Object.keys(records[kind]).forEach(name => {
|
|
430
|
+
const primaryKeys = Object.keys(records[kind][name].saving).filter(primaryKey => isSavingEntityRecord(state, kind, name, primaryKey));
|
|
390
431
|
|
|
391
432
|
if (primaryKeys.length) {
|
|
392
|
-
const
|
|
433
|
+
const entityConfig = getEntityConfig(state, kind, name);
|
|
393
434
|
primaryKeys.forEach(primaryKey => {
|
|
394
|
-
var
|
|
435
|
+
var _entityConfig$getTitl2;
|
|
395
436
|
|
|
396
437
|
const entityRecord = getEditedEntityRecord(state, kind, name, primaryKey);
|
|
397
438
|
recordsBeingSaved.push({
|
|
398
439
|
// We avoid using primaryKey because it's transformed into a string
|
|
399
440
|
// when it's used as an object key.
|
|
400
|
-
key: entityRecord[
|
|
401
|
-
title: (
|
|
441
|
+
key: entityRecord[entityConfig.key || _entities.DEFAULT_ENTITY_KEY],
|
|
442
|
+
title: (entityConfig === null || entityConfig === void 0 ? void 0 : (_entityConfig$getTitl2 = entityConfig.getTitle) === null || _entityConfig$getTitl2 === void 0 ? void 0 : _entityConfig$getTitl2.call(entityConfig, entityRecord)) || '',
|
|
402
443
|
name,
|
|
403
444
|
kind
|
|
404
445
|
});
|
|
@@ -407,7 +448,7 @@ const __experimentalGetEntitiesBeingSaved = (0, _rememo.default)(state => {
|
|
|
407
448
|
});
|
|
408
449
|
});
|
|
409
450
|
return recordsBeingSaved;
|
|
410
|
-
}, state => [state.entities.
|
|
451
|
+
}, state => [state.entities.records]);
|
|
411
452
|
/**
|
|
412
453
|
* Returns the specified entity record's edits.
|
|
413
454
|
*
|
|
@@ -423,7 +464,7 @@ const __experimentalGetEntitiesBeingSaved = (0, _rememo.default)(state => {
|
|
|
423
464
|
exports.__experimentalGetEntitiesBeingSaved = __experimentalGetEntitiesBeingSaved;
|
|
424
465
|
|
|
425
466
|
function getEntityRecordEdits(state, kind, name, recordId) {
|
|
426
|
-
return (0, _lodash.get)(state.entities.
|
|
467
|
+
return (0, _lodash.get)(state.entities.records, [kind, name, 'edits', recordId]);
|
|
427
468
|
}
|
|
428
469
|
/**
|
|
429
470
|
* Returns the specified entity record's non transient edits.
|
|
@@ -444,7 +485,7 @@ function getEntityRecordEdits(state, kind, name, recordId) {
|
|
|
444
485
|
const getEntityRecordNonTransientEdits = (0, _rememo.default)((state, kind, name, recordId) => {
|
|
445
486
|
const {
|
|
446
487
|
transientEdits
|
|
447
|
-
} =
|
|
488
|
+
} = getEntityConfig(state, kind, name) || {};
|
|
448
489
|
const edits = getEntityRecordEdits(state, kind, name, recordId) || {};
|
|
449
490
|
|
|
450
491
|
if (!transientEdits) {
|
|
@@ -458,7 +499,7 @@ const getEntityRecordNonTransientEdits = (0, _rememo.default)((state, kind, name
|
|
|
458
499
|
|
|
459
500
|
return acc;
|
|
460
501
|
}, {});
|
|
461
|
-
}, (state, kind, name, recordId) => [state.entities.config, (0, _lodash.get)(state.entities.
|
|
502
|
+
}, (state, kind, name, recordId) => [state.entities.config, (0, _lodash.get)(state.entities.records, [kind, name, 'edits', recordId])]);
|
|
462
503
|
/**
|
|
463
504
|
* Returns true if the specified entity record has edits,
|
|
464
505
|
* and false otherwise.
|
|
@@ -479,10 +520,10 @@ function hasEditsForEntityRecord(state, kind, name, recordId) {
|
|
|
479
520
|
/**
|
|
480
521
|
* Returns the specified entity record, merged with its edits.
|
|
481
522
|
*
|
|
482
|
-
* @param {Object}
|
|
483
|
-
* @param {string}
|
|
484
|
-
* @param {string}
|
|
485
|
-
* @param {number} recordId Record ID.
|
|
523
|
+
* @param {Object} state State tree.
|
|
524
|
+
* @param {string} kind Entity kind.
|
|
525
|
+
* @param {string} name Entity name.
|
|
526
|
+
* @param {number|string} recordId Record ID.
|
|
486
527
|
*
|
|
487
528
|
* @return {Object?} The entity record, merged with its edits.
|
|
488
529
|
*/
|
|
@@ -494,7 +535,7 @@ const getEditedEntityRecord = (0, _rememo.default)((state, kind, name, recordId)
|
|
|
494
535
|
var _query$context4;
|
|
495
536
|
|
|
496
537
|
const context = (_query$context4 = query === null || query === void 0 ? void 0 : query.context) !== null && _query$context4 !== void 0 ? _query$context4 : 'default';
|
|
497
|
-
return [state.entities.config, (0, _lodash.get)(state.entities.
|
|
538
|
+
return [state.entities.config, (0, _lodash.get)(state.entities.records, [kind, name, 'queriedData', 'items', context, recordId]), (0, _lodash.get)(state.entities.records, [kind, name, 'queriedData', 'itemIsComplete', context, recordId]), (0, _lodash.get)(state.entities.records, [kind, name, 'edits', recordId])];
|
|
498
539
|
});
|
|
499
540
|
/**
|
|
500
541
|
* Returns true if the specified entity record is autosaving, and false otherwise.
|
|
@@ -513,23 +554,23 @@ function isAutosavingEntityRecord(state, kind, name, recordId) {
|
|
|
513
554
|
const {
|
|
514
555
|
pending,
|
|
515
556
|
isAutosave
|
|
516
|
-
} = (0, _lodash.get)(state.entities.
|
|
557
|
+
} = (0, _lodash.get)(state.entities.records, [kind, name, 'saving', recordId], {});
|
|
517
558
|
return Boolean(pending && isAutosave);
|
|
518
559
|
}
|
|
519
560
|
/**
|
|
520
561
|
* Returns true if the specified entity record is saving, and false otherwise.
|
|
521
562
|
*
|
|
522
|
-
* @param {Object}
|
|
523
|
-
* @param {string}
|
|
524
|
-
* @param {string}
|
|
525
|
-
* @param {number} recordId Record ID.
|
|
563
|
+
* @param {Object} state State tree.
|
|
564
|
+
* @param {string} kind Entity kind.
|
|
565
|
+
* @param {string} name Entity name.
|
|
566
|
+
* @param {number|string} recordId Record ID.
|
|
526
567
|
*
|
|
527
568
|
* @return {boolean} Whether the entity record is saving or not.
|
|
528
569
|
*/
|
|
529
570
|
|
|
530
571
|
|
|
531
572
|
function isSavingEntityRecord(state, kind, name, recordId) {
|
|
532
|
-
return (0, _lodash.get)(state.entities.
|
|
573
|
+
return (0, _lodash.get)(state.entities.records, [kind, name, 'saving', recordId, 'pending'], false);
|
|
533
574
|
}
|
|
534
575
|
/**
|
|
535
576
|
* Returns true if the specified entity record is deleting, and false otherwise.
|
|
@@ -544,7 +585,7 @@ function isSavingEntityRecord(state, kind, name, recordId) {
|
|
|
544
585
|
|
|
545
586
|
|
|
546
587
|
function isDeletingEntityRecord(state, kind, name, recordId) {
|
|
547
|
-
return (0, _lodash.get)(state.entities.
|
|
588
|
+
return (0, _lodash.get)(state.entities.records, [kind, name, 'deleting', recordId, 'pending'], false);
|
|
548
589
|
}
|
|
549
590
|
/**
|
|
550
591
|
* Returns the specified entity record's last save error.
|
|
@@ -559,7 +600,7 @@ function isDeletingEntityRecord(state, kind, name, recordId) {
|
|
|
559
600
|
|
|
560
601
|
|
|
561
602
|
function getLastEntitySaveError(state, kind, name, recordId) {
|
|
562
|
-
return (0, _lodash.get)(state.entities.
|
|
603
|
+
return (0, _lodash.get)(state.entities.records, [kind, name, 'saving', recordId, 'error']);
|
|
563
604
|
}
|
|
564
605
|
/**
|
|
565
606
|
* Returns the specified entity record's last delete error.
|
|
@@ -574,7 +615,7 @@ function getLastEntitySaveError(state, kind, name, recordId) {
|
|
|
574
615
|
|
|
575
616
|
|
|
576
617
|
function getLastEntityDeleteError(state, kind, name, recordId) {
|
|
577
|
-
return (0, _lodash.get)(state.entities.
|
|
618
|
+
return (0, _lodash.get)(state.entities.records, [kind, name, 'deleting', recordId, 'error']);
|
|
578
619
|
}
|
|
579
620
|
/**
|
|
580
621
|
* Returns the current undo offset for the
|
|
@@ -760,13 +801,13 @@ function canUser(state, action, resource, id) {
|
|
|
760
801
|
|
|
761
802
|
|
|
762
803
|
function canUserEditEntityRecord(state, kind, name, recordId) {
|
|
763
|
-
const
|
|
804
|
+
const entityConfig = getEntityConfig(state, kind, name);
|
|
764
805
|
|
|
765
|
-
if (!
|
|
806
|
+
if (!entityConfig) {
|
|
766
807
|
return false;
|
|
767
808
|
}
|
|
768
809
|
|
|
769
|
-
const resource =
|
|
810
|
+
const resource = entityConfig.__unstable_rest_base;
|
|
770
811
|
return canUser(state, 'update', resource, recordId);
|
|
771
812
|
}
|
|
772
813
|
/**
|
|
@@ -871,7 +912,7 @@ function __experimentalGetTemplateForLink(state, link) {
|
|
|
871
912
|
*
|
|
872
913
|
* @param {Object} state Editor state.
|
|
873
914
|
*
|
|
874
|
-
* @return {Object
|
|
915
|
+
* @return {Object|null} The Global Styles object.
|
|
875
916
|
*/
|
|
876
917
|
|
|
877
918
|
|
|
@@ -889,7 +930,7 @@ function __experimentalGetCurrentThemeBaseGlobalStyles(state) {
|
|
|
889
930
|
*
|
|
890
931
|
* @param {Object} state Data state.
|
|
891
932
|
*
|
|
892
|
-
* @return {string} The current global styles ID.
|
|
933
|
+
* @return {string|null} The current global styles ID.
|
|
893
934
|
*/
|
|
894
935
|
|
|
895
936
|
|
package/build/selectors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/core-data/src/selectors.js"],"names":["EMPTY_OBJECT","isRequestingEmbedPreview","select","state","url","STORE_NAME","isResolving","getAuthors","query","since","alternative","path","getUserQueryResults","getCurrentUser","currentUser","queryID","queryResults","users","queries","id","byId","getEntitiesByKind","kind","entities","config","getEntity","name","getEntityRecord","key","queriedState","data","undefined","context","itemIsComplete","items","item","_fields","filteredItem","fields","f","length","field","split","value","recordId","__experimentalGetEntityRecordNoResolver","getRawEntityRecord","record","Object","keys","reduce","accumulator","_key","hasEntityRecords","Array","isArray","getEntityRecords","__experimentalGetDirtyEntityRecords","dirtyRecords","forEach","primaryKeys","edits","filter","primaryKey","hasEditsForEntityRecord","entity","entityRecord","getEditedEntityRecord","push","DEFAULT_ENTITY_KEY","title","getTitle","__experimentalGetEntitiesBeingSaved","recordsBeingSaved","saving","isSavingEntityRecord","getEntityRecordEdits","getEntityRecordNonTransientEdits","transientEdits","acc","isAutosavingEntityRecord","pending","isAutosave","Boolean","isDeletingEntityRecord","getLastEntitySaveError","getLastEntityDeleteError","getCurrentUndoOffset","undo","offset","getUndoEdit","getRedoEdit","hasUndo","hasRedo","getCurrentTheme","currentTheme","__experimentalGetCurrentGlobalStylesId","currentGlobalStylesId","getThemeSupports","theme_supports","getEmbedPreview","embedPreviews","isPreviewEmbedFallback","preview","oEmbedLinkCheck","html","canUser","action","resource","join","canUserEditEntityRecord","__unstable_rest_base","getAutosaves","postType","postId","autosaves","getAutosave","authorId","author","hasFetchedAutosaves","hasFinishedResolution","getReferenceByDistinctEdits","flattenedUndo","__experimentalGetTemplateForLink","link","records","template","__experimentalGetCurrentThemeBaseGlobalStyles","themeBaseGlobalStyles","stylesheet","__experimentalGetCurrentThemeGlobalStylesVariations","themeGlobalStyleVariations"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAnBA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,YAAY,GAAG,EAArB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,MAAMC,wBAAwB,GAAG,kCACrCC,MAAF,IAAc,CAAEC,KAAF,EAASC,GAAT,KAAkB;AAC/B,SAAOF,MAAM,CAAEG,gBAAF,CAAN,CAAqBC,WAArB,CAAkC,iBAAlC,EAAqD,CAAEF,GAAF,CAArD,CAAP;AACA,CAHsC,CAAjC;AAMP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACO,SAASG,UAAT,CAAqBJ,KAArB,EAA4BK,KAA5B,EAAoC;AAC1C,2BAAY,+BAAZ,EAA6C;AAC5CC,IAAAA,KAAK,EAAE,KADqC;AAE5CC,IAAAA,WAAW,EAAE;AAF+B,GAA7C;AAKA,QAAMC,IAAI,GAAG,uBACZ,wCADY,EAEZH,KAFY,CAAb;AAIA,SAAOI,mBAAmB,CAAET,KAAF,EAASQ,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AWhD,MADC,EAEZrC,KAAK,CAACqF,IAAN,CAAWC,MAFC,EAGZtF,KAAK,CAACqF,IAAN,CAAWkC,aAHC,CAF6B,CAApC;AASP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACO,SAASC,gCAAT,CAA2CxH,KAA3C,EAAkDyH,IAAlD,EAAyD;AAC/D,QAAMC,OAAO,GAAGrE,gBAAgB,CAAErD,KAAF,EAAS,UAAT,EAAqB,aAArB,EAAoC;AACnE,qBAAiByH;AADkD,GAApC,CAAhC;AAIA,QAAME,QAAQ,GAAGD,OAAO,SAAP,IAAAA,OAAO,WAAP,IAAAA,OAAO,CAAErF,MAAT,GAAkBqF,OAAO,CAAE,CAAF,CAAzB,GAAiC,IAAlD;;AACA,MAAKC,QAAL,EAAgB;AACf,WAAO3D,qBAAqB,CAC3BhE,KAD2B,EAE3B,UAF2B,EAG3B,aAH2B,EAI3B2H,QAAQ,CAAC3G,EAJkB,CAA5B;AAMA;;AACD,SAAO2G,QAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,6CAAT,CAAwD5H,KAAxD,EAAgE;AACtE,QAAM4F,YAAY,GAAGD,eAAe,CAAE3F,KAAF,CAApC;;AACA,MAAK,CAAE4F,YAAP,EAAsB;AACrB,WAAO,IAAP;AACA;;AACD,SAAO5F,KAAK,CAAC6H,qBAAN,CAA6BjC,YAAY,CAACkC,UAA1C,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,mDAAT,CAA8D/H,KAA9D,EAAsE;AAC5E,QAAM4F,YAAY,GAAGD,eAAe,CAAE3F,KAAF,CAApC;;AACA,MAAK,CAAE4F,YAAP,EAAsB;AACrB,WAAO,IAAP;AACA;;AACD,SAAO5F,KAAK,CAACgI,0BAAN,CAAkCpC,YAAY,CAACkC,UAA/C,CAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\nimport { set, map, find, get, filter, compact } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport { addQueryArgs } from '@wordpress/url';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME } from './name';\nimport { getQueriedItems } from './queried-data';\nimport { DEFAULT_ENTITY_KEY } from './entities';\nimport { getNormalizedCommaSeparable, isRawAttribute } from './utils';\n\n/**\n * Shared reference to an empty object for cases where it is important to avoid\n * returning a new object reference on every invocation, as in a connected or\n * other pure component which performs `shouldComponentUpdate` check on props.\n * This should be used as a last resort, since the normalized data should be\n * maintained by the reducer result in state.\n */\nconst EMPTY_OBJECT = {};\n\n/**\n * Returns true if a request is in progress for embed preview data, or false\n * otherwise.\n *\n * @param {Object} state Data state.\n * @param {string} url URL the preview would be for.\n *\n * @return {boolean} Whether a request is in progress for an embed preview.\n */\nexport const isRequestingEmbedPreview = createRegistrySelector(\n\t( select ) => ( state, url ) => {\n\t\treturn select( STORE_NAME ).isResolving( 'getEmbedPreview', [ url ] );\n\t}\n);\n\n/**\n * Returns all available authors.\n *\n * @deprecated since 11.3. Callers should use `select( 'core' ).getUsers({ who: 'authors' })` instead.\n *\n * @param {Object} state Data state.\n * @param {Object|undefined} query Optional object of query parameters to\n * include with request.\n * @return {Array} Authors list.\n */\nexport function getAuthors( state, query ) {\n\tdeprecated( \"select( 'core' ).getAuthors()\", {\n\t\tsince: '5.9',\n\t\talternative: \"select( 'core' ).getUsers({ who: 'authors' })\",\n\t} );\n\n\tconst path = addQueryArgs(\n\t\t'/wp/v2/users/?who=authors&per_page=100',\n\t\tquery\n\t);\n\treturn getUserQueryResults( state, path );\n}\n\n/**\n * Returns the current user.\n *\n * @param {Object} state Data state.\n *\n * @return {Object} Current user object.\n */\nexport function getCurrentUser( state ) {\n\treturn state.currentUser;\n}\n\n/**\n * Returns all the users returned by a query ID.\n *\n * @param {Object} state Data state.\n * @param {string} queryID Query ID.\n *\n * @return {Array} Users list.\n */\nexport const getUserQueryResults = createSelector(\n\t( state, queryID ) => {\n\t\tconst queryResults = state.users.queries[ queryID ];\n\n\t\treturn map( queryResults, ( id ) => state.users.byId[ id ] );\n\t},\n\t( state, queryID ) => [ state.users.queries[ queryID ], state.users.byId ]\n);\n\n/**\n * Returns whether the entities for the give kind are loaded.\n *\n * @param {Object} state Data state.\n * @param {string} kind Entity kind.\n *\n * @return {Array<Object>} Array of entities with config matching kind.\n */\nexport function getEntitiesByKind( state, kind ) {\n\treturn filter( state.entities.config, { kind } );\n}\n\n/**\n * Returns the entity object given its kind and name.\n *\n * @param {Object} state Data state.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n *\n * @return {Object} Entity\n */\nexport function getEntity( state, kind, name ) {\n\treturn find( state.entities.config, { kind, name } );\n}\n\n/**\n * Returns the Entity's record object by key. Returns `null` if the value is not\n * yet received, undefined if the value entity is known to not exist, or the\n * entity object if it exists and is received.\n *\n * @param {Object} state State tree\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} key Record's key\n * @param {?Object} query Optional query.\n *\n * @return {Object?} Record.\n */\nexport const getEntityRecord = createSelector(\n\t( state, kind, name, key, query ) => {\n\t\tconst queriedState = get( state.entities.data, [\n\t\t\tkind,\n\t\t\tname,\n\t\t\t'queriedData',\n\t\t] );\n\t\tif ( ! queriedState ) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst context = query?.context ?? 'default';\n\n\t\tif ( query === undefined ) {\n\t\t\t// If expecting a complete item, validate that completeness.\n\t\t\tif ( ! queriedState.itemIsComplete[ context ]?.[ key ] ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\treturn queriedState.items[ context ][ key ];\n\t\t}\n\n\t\tconst item = queriedState.items[ context ]?.[ key ];\n\t\tif ( item && query._fields ) {\n\t\t\tconst filteredItem = {};\n\t\t\tconst fields = getNormalizedCommaSeparable( query._fields );\n\t\t\tfor ( let f = 0; f < fields.length; f++ ) {\n\t\t\t\tconst field = fields[ f ].split( '.' );\n\t\t\t\tconst value = get( item, field );\n\t\t\t\tset( filteredItem, field, value );\n\t\t\t}\n\t\t\treturn filteredItem;\n\t\t}\n\n\t\treturn item;\n\t},\n\t( state, kind, name, recordId, query ) => {\n\t\tconst context = query?.context ?? 'default';\n\t\treturn [\n\t\t\tget( state.entities.data, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'items',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t\tget( state.entities.data, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'itemIsComplete',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t];\n\t}\n);\n\n/**\n * Returns the Entity's record object by key. Doesn't trigger a resolver nor requests the entity from the API if the entity record isn't available in the local state.\n *\n * @param {Object} state State tree\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} key Record's key\n *\n * @return {Object|null} Record.\n */\nexport function __experimentalGetEntityRecordNoResolver(\n\tstate,\n\tkind,\n\tname,\n\tkey\n) {\n\treturn getEntityRecord( state, kind, name, key );\n}\n\n/**\n * Returns the entity's record object by key,\n * with its attributes mapped to their raw values.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} key Record's key.\n *\n * @return {Object?} Object with the entity's raw attributes.\n */\nexport const getRawEntityRecord = createSelector(\n\t( state, kind, name, key ) => {\n\t\tconst record = getEntityRecord( state, kind, name, key );\n\t\treturn (\n\t\t\trecord &&\n\t\t\tObject.keys( record ).reduce( ( accumulator, _key ) => {\n\t\t\t\tif ( isRawAttribute( getEntity( state, kind, name ), _key ) ) {\n\t\t\t\t\t// Because edits are the \"raw\" attribute values,\n\t\t\t\t\t// we return those from record selectors to make rendering,\n\t\t\t\t\t// comparisons, and joins with edits easier.\n\t\t\t\t\taccumulator[ _key ] = get(\n\t\t\t\t\t\trecord[ _key ],\n\t\t\t\t\t\t'raw',\n\t\t\t\t\t\trecord[ _key ]\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\taccumulator[ _key ] = record[ _key ];\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t}, {} )\n\t\t);\n\t},\n\t( state, kind, name, recordId, query ) => {\n\t\tconst context = query?.context ?? 'default';\n\t\treturn [\n\t\t\tstate.entities.config,\n\t\t\tget( state.entities.data, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'items',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t\tget( state.entities.data, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'itemIsComplete',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t];\n\t}\n);\n\n/**\n * Returns true if records have been received for the given set of parameters,\n * or false otherwise.\n *\n * @param {Object} state State tree\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {?Object} query Optional terms query.\n *\n * @return {boolean} Whether entity records have been received.\n */\nexport function hasEntityRecords( state, kind, name, query ) {\n\treturn Array.isArray( getEntityRecords( state, kind, name, query ) );\n}\n\n/**\n * Returns the Entity's records.\n *\n * @param {Object} state State tree\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {?Object} query Optional terms query.\n *\n * @return {?Array} Records.\n */\nexport function getEntityRecords( state, kind, name, query ) {\n\t// Queried data state is prepopulated for all known entities. If this is not\n\t// assigned for the given parameters, then it is known to not exist.\n\tconst queriedState = get( state.entities.data, [\n\t\tkind,\n\t\tname,\n\t\t'queriedData',\n\t] );\n\tif ( ! queriedState ) {\n\t\treturn null;\n\t}\n\treturn getQueriedItems( queriedState, query );\n}\n\n/**\n * Returns the list of dirty entity records.\n *\n * @param {Object} state State tree.\n *\n * @return {[{ title: string, key: string, name: string, kind: string }]} The list of updated records\n */\nexport const __experimentalGetDirtyEntityRecords = createSelector(\n\t( state ) => {\n\t\tconst {\n\t\t\tentities: { data },\n\t\t} = state;\n\t\tconst dirtyRecords = [];\n\t\tObject.keys( data ).forEach( ( kind ) => {\n\t\t\tObject.keys( data[ kind ] ).forEach( ( name ) => {\n\t\t\t\tconst primaryKeys = Object.keys(\n\t\t\t\t\tdata[ kind ][ name ].edits\n\t\t\t\t).filter(\n\t\t\t\t\t( primaryKey ) =>\n\t\t\t\t\t\t// The entity record must exist (not be deleted),\n\t\t\t\t\t\t// and it must have edits.\n\t\t\t\t\t\tgetEntityRecord( state, kind, name, primaryKey ) &&\n\t\t\t\t\t\thasEditsForEntityRecord( state, kind, name, primaryKey )\n\t\t\t\t);\n\n\t\t\t\tif ( primaryKeys.length ) {\n\t\t\t\t\tconst entity = getEntity( state, kind, name );\n\t\t\t\t\tprimaryKeys.forEach( ( primaryKey ) => {\n\t\t\t\t\t\tconst entityRecord = getEditedEntityRecord(\n\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tprimaryKey\n\t\t\t\t\t\t);\n\t\t\t\t\t\tdirtyRecords.push( {\n\t\t\t\t\t\t\t// We avoid using primaryKey because it's transformed into a string\n\t\t\t\t\t\t\t// when it's used as an object key.\n\t\t\t\t\t\t\tkey:\n\t\t\t\t\t\t\t\tentityRecord[\n\t\t\t\t\t\t\t\t\tentity.key || DEFAULT_ENTITY_KEY\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\ttitle: entity?.getTitle?.( entityRecord ) || '',\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t} );\n\n\t\treturn dirtyRecords;\n\t},\n\t( state ) => [ state.entities.data ]\n);\n\n/**\n * Returns the list of entities currently being saved.\n *\n * @param {Object} state State tree.\n *\n * @return {[{ title: string, key: string, name: string, kind: string }]} The list of records being saved.\n */\nexport const __experimentalGetEntitiesBeingSaved = createSelector(\n\t( state ) => {\n\t\tconst {\n\t\t\tentities: { data },\n\t\t} = state;\n\t\tconst recordsBeingSaved = [];\n\t\tObject.keys( data ).forEach( ( kind ) => {\n\t\t\tObject.keys( data[ kind ] ).forEach( ( name ) => {\n\t\t\t\tconst primaryKeys = Object.keys(\n\t\t\t\t\tdata[ kind ][ name ].saving\n\t\t\t\t).filter( ( primaryKey ) =>\n\t\t\t\t\tisSavingEntityRecord( state, kind, name, primaryKey )\n\t\t\t\t);\n\n\t\t\t\tif ( primaryKeys.length ) {\n\t\t\t\t\tconst entity = getEntity( state, kind, name );\n\t\t\t\t\tprimaryKeys.forEach( ( primaryKey ) => {\n\t\t\t\t\t\tconst entityRecord = getEditedEntityRecord(\n\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tprimaryKey\n\t\t\t\t\t\t);\n\t\t\t\t\t\trecordsBeingSaved.push( {\n\t\t\t\t\t\t\t// We avoid using primaryKey because it's transformed into a string\n\t\t\t\t\t\t\t// when it's used as an object key.\n\t\t\t\t\t\t\tkey:\n\t\t\t\t\t\t\t\tentityRecord[\n\t\t\t\t\t\t\t\t\tentity.key || DEFAULT_ENTITY_KEY\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\ttitle: entity?.getTitle?.( entityRecord ) || '',\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t} );\n\t\treturn recordsBeingSaved;\n\t},\n\t( state ) => [ state.entities.data ]\n);\n\n/**\n * Returns the specified entity record's edits.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record's edits.\n */\nexport function getEntityRecordEdits( state, kind, name, recordId ) {\n\treturn get( state.entities.data, [ kind, name, 'edits', recordId ] );\n}\n\n/**\n * Returns the specified entity record's non transient edits.\n *\n * Transient edits don't create an undo level, and\n * are not considered for change detection.\n * They are defined in the entity's config.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record's non transient edits.\n */\nexport const getEntityRecordNonTransientEdits = createSelector(\n\t( state, kind, name, recordId ) => {\n\t\tconst { transientEdits } = getEntity( state, kind, name ) || {};\n\t\tconst edits = getEntityRecordEdits( state, kind, name, recordId ) || {};\n\t\tif ( ! transientEdits ) {\n\t\t\treturn edits;\n\t\t}\n\t\treturn Object.keys( edits ).reduce( ( acc, key ) => {\n\t\t\tif ( ! transientEdits[ key ] ) {\n\t\t\t\tacc[ key ] = edits[ key ];\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, {} );\n\t},\n\t( state, kind, name, recordId ) => [\n\t\tstate.entities.config,\n\t\tget( state.entities.data, [ kind, name, 'edits', recordId ] ),\n\t]\n);\n\n/**\n * Returns true if the specified entity record has edits,\n * and false otherwise.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {boolean} Whether the entity record has edits or not.\n */\nexport function hasEditsForEntityRecord( state, kind, name, recordId ) {\n\treturn (\n\t\tisSavingEntityRecord( state, kind, name, recordId ) ||\n\t\tObject.keys(\n\t\t\tgetEntityRecordNonTransientEdits( state, kind, name, recordId )\n\t\t).length > 0\n\t);\n}\n\n/**\n * Returns the specified entity record, merged with its edits.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record, merged with its edits.\n */\nexport const getEditedEntityRecord = createSelector(\n\t( state, kind, name, recordId ) => ( {\n\t\t...getRawEntityRecord( state, kind, name, recordId ),\n\t\t...getEntityRecordEdits( state, kind, name, recordId ),\n\t} ),\n\t( state, kind, name, recordId, query ) => {\n\t\tconst context = query?.context ?? 'default';\n\t\treturn [\n\t\t\tstate.entities.config,\n\t\t\tget( state.entities.data, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'items',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t\tget( state.entities.data, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'itemIsComplete',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t\tget( state.entities.data, [ kind, name, 'edits', recordId ] ),\n\t\t];\n\t}\n);\n\n/**\n * Returns true if the specified entity record is autosaving, and false otherwise.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {boolean} Whether the entity record is autosaving or not.\n */\nexport function isAutosavingEntityRecord( state, kind, name, recordId ) {\n\tconst { pending, isAutosave } = get(\n\t\tstate.entities.data,\n\t\t[ kind, name, 'saving', recordId ],\n\t\t{}\n\t);\n\treturn Boolean( pending && isAutosave );\n}\n\n/**\n * Returns true if the specified entity record is saving, and false otherwise.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {boolean} Whether the entity record is saving or not.\n */\nexport function isSavingEntityRecord( state, kind, name, recordId ) {\n\treturn get(\n\t\tstate.entities.data,\n\t\t[ kind, name, 'saving', recordId, 'pending' ],\n\t\tfalse\n\t);\n}\n\n/**\n * Returns true if the specified entity record is deleting, and false otherwise.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {boolean} Whether the entity record is deleting or not.\n */\nexport function isDeletingEntityRecord( state, kind, name, recordId ) {\n\treturn get(\n\t\tstate.entities.data,\n\t\t[ kind, name, 'deleting', recordId, 'pending' ],\n\t\tfalse\n\t);\n}\n\n/**\n * Returns the specified entity record's last save error.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record's save error.\n */\nexport function getLastEntitySaveError( state, kind, name, recordId ) {\n\treturn get( state.entities.data, [\n\t\tkind,\n\t\tname,\n\t\t'saving',\n\t\trecordId,\n\t\t'error',\n\t] );\n}\n\n/**\n * Returns the specified entity record's last delete error.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record's save error.\n */\nexport function getLastEntityDeleteError( state, kind, name, recordId ) {\n\treturn get( state.entities.data, [\n\t\tkind,\n\t\tname,\n\t\t'deleting',\n\t\trecordId,\n\t\t'error',\n\t] );\n}\n\n/**\n * Returns the current undo offset for the\n * entity records edits history. The offset\n * represents how many items from the end\n * of the history stack we are at. 0 is the\n * last edit, -1 is the second last, and so on.\n *\n * @param {Object} state State tree.\n *\n * @return {number} The current undo offset.\n */\nfunction getCurrentUndoOffset( state ) {\n\treturn state.undo.offset;\n}\n\n/**\n * Returns the previous edit from the current undo offset\n * for the entity records edits history, if any.\n *\n * @param {Object} state State tree.\n *\n * @return {Object?} The edit.\n */\nexport function getUndoEdit( state ) {\n\treturn state.undo[ state.undo.length - 2 + getCurrentUndoOffset( state ) ];\n}\n\n/**\n * Returns the next edit from the current undo offset\n * for the entity records edits history, if any.\n *\n * @param {Object} state State tree.\n *\n * @return {Object?} The edit.\n */\nexport function getRedoEdit( state ) {\n\treturn state.undo[ state.undo.length + getCurrentUndoOffset( state ) ];\n}\n\n/**\n * Returns true if there is a previous edit from the current undo offset\n * for the entity records edits history, and false otherwise.\n *\n * @param {Object} state State tree.\n *\n * @return {boolean} Whether there is a previous edit or not.\n */\nexport function hasUndo( state ) {\n\treturn Boolean( getUndoEdit( state ) );\n}\n\n/**\n * Returns true if there is a next edit from the current undo offset\n * for the entity records edits history, and false otherwise.\n *\n * @param {Object} state State tree.\n *\n * @return {boolean} Whether there is a next edit or not.\n */\nexport function hasRedo( state ) {\n\treturn Boolean( getRedoEdit( state ) );\n}\n\n/**\n * Return the current theme.\n *\n * @param {Object} state Data state.\n *\n * @return {Object} The current theme.\n */\nexport function getCurrentTheme( state ) {\n\treturn getEntityRecord( state, 'root', 'theme', state.currentTheme );\n}\n\n/**\n * Return the ID of the current global styles object.\n *\n * @param {Object} state Data state.\n *\n * @return {string} The current global styles ID.\n */\nexport function __experimentalGetCurrentGlobalStylesId( state ) {\n\treturn state.currentGlobalStylesId;\n}\n\n/**\n * Return theme supports data in the index.\n *\n * @param {Object} state Data state.\n *\n * @return {*} Index data.\n */\nexport function getThemeSupports( state ) {\n\treturn getCurrentTheme( state )?.theme_supports ?? EMPTY_OBJECT;\n}\n\n/**\n * Returns the embed preview for the given URL.\n *\n * @param {Object} state Data state.\n * @param {string} url Embedded URL.\n *\n * @return {*} Undefined if the preview has not been fetched, otherwise, the preview fetched from the embed preview API.\n */\nexport function getEmbedPreview( state, url ) {\n\treturn state.embedPreviews[ url ];\n}\n\n/**\n * Determines if the returned preview is an oEmbed link fallback.\n *\n * WordPress can be configured to return a simple link to a URL if it is not embeddable.\n * We need to be able to determine if a URL is embeddable or not, based on what we\n * get back from the oEmbed preview API.\n *\n * @param {Object} state Data state.\n * @param {string} url Embedded URL.\n *\n * @return {boolean} Is the preview for the URL an oEmbed link fallback.\n */\nexport function isPreviewEmbedFallback( state, url ) {\n\tconst preview = state.embedPreviews[ url ];\n\tconst oEmbedLinkCheck = '<a href=\"' + url + '\">' + url + '</a>';\n\tif ( ! preview ) {\n\t\treturn false;\n\t}\n\treturn preview.html === oEmbedLinkCheck;\n}\n\n/**\n * Returns whether the current user can perform the given action on the given\n * REST resource.\n *\n * Calling this may trigger an OPTIONS request to the REST API via the\n * `canUser()` resolver.\n *\n * https://developer.wordpress.org/rest-api/reference/\n *\n * @param {Object} state Data state.\n * @param {string} action Action to check. One of: 'create', 'read', 'update', 'delete'.\n * @param {string} resource REST resource to check, e.g. 'media' or 'posts'.\n * @param {string=} id Optional ID of the rest resource to check.\n *\n * @return {boolean|undefined} Whether or not the user can perform the action,\n * or `undefined` if the OPTIONS request is still being made.\n */\nexport function canUser( state, action, resource, id ) {\n\tconst key = compact( [ action, resource, id ] ).join( '/' );\n\treturn get( state, [ 'userPermissions', key ] );\n}\n\n/**\n * Returns whether the current user can edit the given entity.\n *\n * Calling this may trigger an OPTIONS request to the REST API via the\n * `canUser()` resolver.\n *\n * https://developer.wordpress.org/rest-api/reference/\n *\n * @param {Object} state Data state.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {string} recordId Record's id.\n * @return {boolean|undefined} Whether or not the user can edit,\n * or `undefined` if the OPTIONS request is still being made.\n */\nexport function canUserEditEntityRecord( state, kind, name, recordId ) {\n\tconst entity = getEntity( state, kind, name );\n\tif ( ! entity ) {\n\t\treturn false;\n\t}\n\tconst resource = entity.__unstable_rest_base;\n\n\treturn canUser( state, 'update', resource, recordId );\n}\n\n/**\n * Returns the latest autosaves for the post.\n *\n * May return multiple autosaves since the backend stores one autosave per\n * author for each post.\n *\n * @param {Object} state State tree.\n * @param {string} postType The type of the parent post.\n * @param {number} postId The id of the parent post.\n *\n * @return {?Array} An array of autosaves for the post, or undefined if there is none.\n */\nexport function getAutosaves( state, postType, postId ) {\n\treturn state.autosaves[ postId ];\n}\n\n/**\n * Returns the autosave for the post and author.\n *\n * @param {Object} state State tree.\n * @param {string} postType The type of the parent post.\n * @param {number} postId The id of the parent post.\n * @param {number} authorId The id of the author.\n *\n * @return {?Object} The autosave for the post and author.\n */\nexport function getAutosave( state, postType, postId, authorId ) {\n\tif ( authorId === undefined ) {\n\t\treturn;\n\t}\n\n\tconst autosaves = state.autosaves[ postId ];\n\treturn find( autosaves, { author: authorId } );\n}\n\n/**\n * Returns true if the REST request for autosaves has completed.\n *\n * @param {Object} state State tree.\n * @param {string} postType The type of the parent post.\n * @param {number} postId The id of the parent post.\n *\n * @return {boolean} True if the REST request was completed. False otherwise.\n */\nexport const hasFetchedAutosaves = createRegistrySelector(\n\t( select ) => ( state, postType, postId ) => {\n\t\treturn select( STORE_NAME ).hasFinishedResolution( 'getAutosaves', [\n\t\t\tpostType,\n\t\t\tpostId,\n\t\t] );\n\t}\n);\n\n/**\n * Returns a new reference when edited values have changed. This is useful in\n * inferring where an edit has been made between states by comparison of the\n * return values using strict equality.\n *\n * @example\n *\n * ```\n * const hasEditOccurred = (\n * getReferenceByDistinctEdits( beforeState ) !==\n * getReferenceByDistinctEdits( afterState )\n * );\n * ```\n *\n * @param {Object} state Editor state.\n *\n * @return {*} A value whose reference will change only when an edit occurs.\n */\nexport const getReferenceByDistinctEdits = createSelector(\n\t() => [],\n\t( state ) => [\n\t\tstate.undo.length,\n\t\tstate.undo.offset,\n\t\tstate.undo.flattenedUndo,\n\t]\n);\n\n/**\n * Retrieve the frontend template used for a given link.\n *\n * @param {Object} state Editor state.\n * @param {string} link Link.\n *\n * @return {Object?} The template record.\n */\nexport function __experimentalGetTemplateForLink( state, link ) {\n\tconst records = getEntityRecords( state, 'postType', 'wp_template', {\n\t\t'find-template': link,\n\t} );\n\n\tconst template = records?.length ? records[ 0 ] : null;\n\tif ( template ) {\n\t\treturn getEditedEntityRecord(\n\t\t\tstate,\n\t\t\t'postType',\n\t\t\t'wp_template',\n\t\t\ttemplate.id\n\t\t);\n\t}\n\treturn template;\n}\n\n/**\n * Retrieve the current theme's base global styles\n *\n * @param {Object} state Editor state.\n *\n * @return {Object?} The Global Styles object.\n */\nexport function __experimentalGetCurrentThemeBaseGlobalStyles( state ) {\n\tconst currentTheme = getCurrentTheme( state );\n\tif ( ! currentTheme ) {\n\t\treturn null;\n\t}\n\treturn state.themeBaseGlobalStyles[ currentTheme.stylesheet ];\n}\n\n/**\n * Return the ID of the current global styles object.\n *\n * @param {Object} state Data state.\n *\n * @return {string} The current global styles ID.\n */\nexport function __experimentalGetCurrentThemeGlobalStylesVariations( state ) {\n\tconst currentTheme = getCurrentTheme( state );\n\tif ( ! currentTheme ) {\n\t\treturn null;\n\t}\n\treturn state.themeGlobalStyleVariations[ currentTheme.stylesheet ];\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/core-data/src/selectors.js"],"names":["EMPTY_OBJECT","isRequestingEmbedPreview","select","state","url","STORE_NAME","isResolving","getAuthors","query","since","alternative","path","getUserQueryResults","getCurrentUser","currentUser","queryID","queryResults","users","queries","id","byId","getEntitiesByKind","kind","getEntitiesConfig","entities","config","getEntity","name","getEntityConfig","getEntityRecord","key","queriedState","records","undefined","context","itemIsComplete","items","item","_fields","filteredItem","fields","f","length","field","split","value","recordId","__experimentalGetEntityRecordNoResolver","getRawEntityRecord","record","Object","keys","reduce","accumulator","_key","hasEntityRecords","Array","isArray","getEntityRecords","__experimentalGetDirtyEntityRecords","dirtyRecords","forEach","primaryKeys","edits","filter","primaryKey","hasEditsForEntityRecord","entityConfig","entityRecord","getEditedEntityRecord","push","DEFAULT_ENTITY_KEY","title","getTitle","__experimentalGetEntitiesBeingSaved","recordsBeingSaved","saving","isSavingEntityRecord","getEntityRecordEdits","getEntityRecordNonTransientEdits","transientEdits","acc","isAutosavingEntityRecord","pending","isAutosave","Boolean","isDeletingEntityRecord","getLastEntitySaveError","getLastEntityDeleteError","getCurrentUndoOffset","undo","offset","getUndoEdit","getRedoEdit","hasUndo","hasRedo","getCurrentTheme","currentTheme","__experimentalGetCurrentGlobalStylesId","currentGlobalStylesId","getThemeSupports","theme_supports","getEmbedPreview","embedPreviews","isPreviewEmbedFallback","preview","oEmbedLinkCheck","html","canUser","action","resource","join","canUserEditEntityRecord","__unstable_rest_base","getAutosaves","postType","postId","autosaves","getAutosave","authorId","author","hasFetchedAutosaves","hasFinishedResolution","getReferenceByDistinctEdits","flattenedUndo","__experimentalGetTemplateForLink","link","template","__experimentalGetCurrentThemeBaseGlobalStyles","themeBaseGlobalStyles","stylesheet","__experimentalGetCurrentThemeGlobalStylesVariations","themeGlobalStyleVariations"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAnBA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,YAAY,GAAG,EAArB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,MAAMC,wBAAwB,GAAG,kCACrCC,MAAF,IAAc,CAAEC,KAAF,EAASC,GAAT,KAAkB;AAC/B,SAAOF,MAAM,CAAEG,gBAAF,CAAN,CAAqBC,WAArB,CAAkC,iBAAlC,EAAqD,CAAEF,GAAF,CAArD,CAAP;AACA,CAHsC,CAAjC;AAMP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACO,SAASG,UAAT,CAAqBJ,KAArB,EAA4BK,KAA5B,EAAoC;AAC1C,2BAAY,+BAAZ,EAA6C;AAC5CC,IAAAA,KAAK,EAAE,KADqC;AAE5CC,IAAAA,WAAW,EAAE;AAF+B,GAA7C;AAKA,QAAMC,IAAI,GAAG,uBACZ,wCADY,EAEZH,KAFY,CAAb;AAIA,SAAOI,mBAAmB,CAAET,KAAF,EAASQ,IAAT,CAA1B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASE,cAAT,CAAyBV,KAAzB,EAAiC;AACvC,SAAOA,KAAK,CAACW,WAAb;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMF,mBAAmB,GAAG,qBAClC,CAAET,KAAF,EAASY,OAAT,KAAsB;AACrB,QAAMC,YAAY,GAAGb,KAAK,CAACc,KAAN,CAAYC,OAAZ,CAAqBH,OAArB,CAArB;AAEA,SAAO,iBAAKC,YAAL,EAAqBG,EAAF,IAAUhB,KAAK,CAACc,KAAN,CAAYG,IAAZ,CAAkB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,KAA9D,EAAsE;AAC5E,QAAM8F,YAAY,GAAGD,eAAe,CAAE7F,KAAF,CAApC;;AACA,MAAK,CAAE8F,YAAP,EAAsB;AACrB,WAAO,IAAP;AACA;;AACD,SAAO9F,KAAK,CAACiI,0BAAN,CAAkCnC,YAAY,CAACiC,UAA/C,CAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\nimport { set, map, find, get, filter, compact } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport { addQueryArgs } from '@wordpress/url';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME } from './name';\nimport { getQueriedItems } from './queried-data';\nimport { DEFAULT_ENTITY_KEY } from './entities';\nimport { getNormalizedCommaSeparable, isRawAttribute } from './utils';\n\n/**\n * Shared reference to an empty object for cases where it is important to avoid\n * returning a new object reference on every invocation, as in a connected or\n * other pure component which performs `shouldComponentUpdate` check on props.\n * This should be used as a last resort, since the normalized data should be\n * maintained by the reducer result in state.\n */\nconst EMPTY_OBJECT = {};\n\n/**\n * Returns true if a request is in progress for embed preview data, or false\n * otherwise.\n *\n * @param {Object} state Data state.\n * @param {string} url URL the preview would be for.\n *\n * @return {boolean} Whether a request is in progress for an embed preview.\n */\nexport const isRequestingEmbedPreview = createRegistrySelector(\n\t( select ) => ( state, url ) => {\n\t\treturn select( STORE_NAME ).isResolving( 'getEmbedPreview', [ url ] );\n\t}\n);\n\n/**\n * Returns all available authors.\n *\n * @deprecated since 11.3. Callers should use `select( 'core' ).getUsers({ who: 'authors' })` instead.\n *\n * @param {Object} state Data state.\n * @param {Object|undefined} query Optional object of query parameters to\n * include with request.\n * @return {Array} Authors list.\n */\nexport function getAuthors( state, query ) {\n\tdeprecated( \"select( 'core' ).getAuthors()\", {\n\t\tsince: '5.9',\n\t\talternative: \"select( 'core' ).getUsers({ who: 'authors' })\",\n\t} );\n\n\tconst path = addQueryArgs(\n\t\t'/wp/v2/users/?who=authors&per_page=100',\n\t\tquery\n\t);\n\treturn getUserQueryResults( state, path );\n}\n\n/**\n * Returns the current user.\n *\n * @param {Object} state Data state.\n *\n * @return {Object} Current user object.\n */\nexport function getCurrentUser( state ) {\n\treturn state.currentUser;\n}\n\n/**\n * Returns all the users returned by a query ID.\n *\n * @param {Object} state Data state.\n * @param {string} queryID Query ID.\n *\n * @return {Array} Users list.\n */\nexport const getUserQueryResults = createSelector(\n\t( state, queryID ) => {\n\t\tconst queryResults = state.users.queries[ queryID ];\n\n\t\treturn map( queryResults, ( id ) => state.users.byId[ id ] );\n\t},\n\t( state, queryID ) => [ state.users.queries[ queryID ], state.users.byId ]\n);\n\n/**\n * Returns the loaded entities for the given kind.\n *\n * @deprecated since WordPress 6.0. Use getEntitiesConfig instead\n * @param {Object} state Data state.\n * @param {string} kind Entity kind.\n *\n * @return {Array<Object>} Array of entities with config matching kind.\n */\nexport function getEntitiesByKind( state, kind ) {\n\tdeprecated( \"wp.data.select( 'core' ).getEntitiesByKind()\", {\n\t\tsince: '6.0',\n\t\talternative: \"wp.data.select( 'core' ).getEntitiesConfig()\",\n\t} );\n\treturn getEntitiesConfig( state, kind );\n}\n\n/**\n * Returns the loaded entities for the given kind.\n *\n * @param {Object} state Data state.\n * @param {string} kind Entity kind.\n *\n * @return {Array<Object>} Array of entities with config matching kind.\n */\nexport function getEntitiesConfig( state, kind ) {\n\treturn filter( state.entities.config, { kind } );\n}\n\n/**\n * Returns the entity config given its kind and name.\n *\n * @deprecated since WordPress 6.0. Use getEntityConfig instead\n * @param {Object} state Data state.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n *\n * @return {Object} Entity config\n */\nexport function getEntity( state, kind, name ) {\n\tdeprecated( \"wp.data.select( 'core' ).getEntity()\", {\n\t\tsince: '6.0',\n\t\talternative: \"wp.data.select( 'core' ).getEntityConfig()\",\n\t} );\n\treturn getEntityConfig( state, kind, name );\n}\n\n/**\n * Returns the entity config given its kind and name.\n *\n * @param {Object} state Data state.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n *\n * @return {Object} Entity config\n */\nexport function getEntityConfig( state, kind, name ) {\n\treturn find( state.entities.config, { kind, name } );\n}\n\n/**\n * Returns the Entity's record object by key. Returns `null` if the value is not\n * yet received, undefined if the value entity is known to not exist, or the\n * entity object if it exists and is received.\n *\n * @param {Object} state State tree\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} key Record's key\n * @param {?Object} query Optional query.\n *\n * @return {Object|undefined} Record.\n */\nexport const getEntityRecord = createSelector(\n\t( state, kind, name, key, query ) => {\n\t\tconst queriedState = get( state.entities.records, [\n\t\t\tkind,\n\t\t\tname,\n\t\t\t'queriedData',\n\t\t] );\n\t\tif ( ! queriedState ) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst context = query?.context ?? 'default';\n\n\t\tif ( query === undefined ) {\n\t\t\t// If expecting a complete item, validate that completeness.\n\t\t\tif ( ! queriedState.itemIsComplete[ context ]?.[ key ] ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\treturn queriedState.items[ context ][ key ];\n\t\t}\n\n\t\tconst item = queriedState.items[ context ]?.[ key ];\n\t\tif ( item && query._fields ) {\n\t\t\tconst filteredItem = {};\n\t\t\tconst fields = getNormalizedCommaSeparable( query._fields ) ?? [];\n\t\t\tfor ( let f = 0; f < fields.length; f++ ) {\n\t\t\t\tconst field = fields[ f ].split( '.' );\n\t\t\t\tconst value = get( item, field );\n\t\t\t\tset( filteredItem, field, value );\n\t\t\t}\n\t\t\treturn filteredItem;\n\t\t}\n\n\t\treturn item;\n\t},\n\t( state, kind, name, recordId, query ) => {\n\t\tconst context = query?.context ?? 'default';\n\t\treturn [\n\t\t\tget( state.entities.records, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'items',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t\tget( state.entities.records, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'itemIsComplete',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t];\n\t}\n);\n\n/**\n * Returns the Entity's record object by key. Doesn't trigger a resolver nor requests the entity records from the API if the entity record isn't available in the local state.\n *\n * @param {Object} state State tree\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} key Record's key\n *\n * @return {Object|null} Record.\n */\nexport function __experimentalGetEntityRecordNoResolver(\n\tstate,\n\tkind,\n\tname,\n\tkey\n) {\n\treturn getEntityRecord( state, kind, name, key );\n}\n\n/**\n * Returns the entity's record object by key,\n * with its attributes mapped to their raw values.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} key Record's key.\n *\n * @return {Object?} Object with the entity's raw attributes.\n */\nexport const getRawEntityRecord = createSelector(\n\t( state, kind, name, key ) => {\n\t\tconst record = getEntityRecord( state, kind, name, key );\n\t\treturn (\n\t\t\trecord &&\n\t\t\tObject.keys( record ).reduce( ( accumulator, _key ) => {\n\t\t\t\tif (\n\t\t\t\t\tisRawAttribute( getEntityConfig( state, kind, name ), _key )\n\t\t\t\t) {\n\t\t\t\t\t// Because edits are the \"raw\" attribute values,\n\t\t\t\t\t// we return those from record selectors to make rendering,\n\t\t\t\t\t// comparisons, and joins with edits easier.\n\t\t\t\t\taccumulator[ _key ] = get(\n\t\t\t\t\t\trecord[ _key ],\n\t\t\t\t\t\t'raw',\n\t\t\t\t\t\trecord[ _key ]\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\taccumulator[ _key ] = record[ _key ];\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t}, {} )\n\t\t);\n\t},\n\t( state, kind, name, recordId, query ) => {\n\t\tconst context = query?.context ?? 'default';\n\t\treturn [\n\t\t\tstate.entities.config,\n\t\t\tget( state.entities.records, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'items',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t\tget( state.entities.records, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'itemIsComplete',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t];\n\t}\n);\n\n/**\n * Returns true if records have been received for the given set of parameters,\n * or false otherwise.\n *\n * @param {Object} state State tree\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {?Object} query Optional terms query.\n *\n * @return {boolean} Whether entity records have been received.\n */\nexport function hasEntityRecords( state, kind, name, query ) {\n\treturn Array.isArray( getEntityRecords( state, kind, name, query ) );\n}\n\n/**\n * Returns the Entity's records.\n *\n * @param {Object} state State tree\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {?Object} query Optional terms query.\n *\n * @return {?Array} Records.\n */\nexport function getEntityRecords( state, kind, name, query ) {\n\t// Queried data state is prepopulated for all known entities. If this is not\n\t// assigned for the given parameters, then it is known to not exist.\n\tconst queriedState = get( state.entities.records, [\n\t\tkind,\n\t\tname,\n\t\t'queriedData',\n\t] );\n\tif ( ! queriedState ) {\n\t\treturn null;\n\t}\n\treturn getQueriedItems( queriedState, query );\n}\n\n/**\n * Returns the list of dirty entity records.\n *\n * @param {Object} state State tree.\n *\n * @return {[{ title: string, key: string, name: string, kind: string }]} The list of updated records\n */\nexport const __experimentalGetDirtyEntityRecords = createSelector(\n\t( state ) => {\n\t\tconst {\n\t\t\tentities: { records },\n\t\t} = state;\n\t\tconst dirtyRecords = [];\n\t\tObject.keys( records ).forEach( ( kind ) => {\n\t\t\tObject.keys( records[ kind ] ).forEach( ( name ) => {\n\t\t\t\tconst primaryKeys = Object.keys(\n\t\t\t\t\trecords[ kind ][ name ].edits\n\t\t\t\t).filter(\n\t\t\t\t\t( primaryKey ) =>\n\t\t\t\t\t\t// The entity record must exist (not be deleted),\n\t\t\t\t\t\t// and it must have edits.\n\t\t\t\t\t\tgetEntityRecord( state, kind, name, primaryKey ) &&\n\t\t\t\t\t\thasEditsForEntityRecord( state, kind, name, primaryKey )\n\t\t\t\t);\n\n\t\t\t\tif ( primaryKeys.length ) {\n\t\t\t\t\tconst entityConfig = getEntityConfig( state, kind, name );\n\t\t\t\t\tprimaryKeys.forEach( ( primaryKey ) => {\n\t\t\t\t\t\tconst entityRecord = getEditedEntityRecord(\n\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tprimaryKey\n\t\t\t\t\t\t);\n\t\t\t\t\t\tdirtyRecords.push( {\n\t\t\t\t\t\t\t// We avoid using primaryKey because it's transformed into a string\n\t\t\t\t\t\t\t// when it's used as an object key.\n\t\t\t\t\t\t\tkey:\n\t\t\t\t\t\t\t\tentityRecord[\n\t\t\t\t\t\t\t\t\tentityConfig.key || DEFAULT_ENTITY_KEY\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\ttitle:\n\t\t\t\t\t\t\t\tentityConfig?.getTitle?.( entityRecord ) || '',\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t} );\n\n\t\treturn dirtyRecords;\n\t},\n\t( state ) => [ state.entities.records ]\n);\n\n/**\n * Returns the list of entities currently being saved.\n *\n * @param {Object} state State tree.\n *\n * @return {[{ title: string, key: string, name: string, kind: string }]} The list of records being saved.\n */\nexport const __experimentalGetEntitiesBeingSaved = createSelector(\n\t( state ) => {\n\t\tconst {\n\t\t\tentities: { records },\n\t\t} = state;\n\t\tconst recordsBeingSaved = [];\n\t\tObject.keys( records ).forEach( ( kind ) => {\n\t\t\tObject.keys( records[ kind ] ).forEach( ( name ) => {\n\t\t\t\tconst primaryKeys = Object.keys(\n\t\t\t\t\trecords[ kind ][ name ].saving\n\t\t\t\t).filter( ( primaryKey ) =>\n\t\t\t\t\tisSavingEntityRecord( state, kind, name, primaryKey )\n\t\t\t\t);\n\n\t\t\t\tif ( primaryKeys.length ) {\n\t\t\t\t\tconst entityConfig = getEntityConfig( state, kind, name );\n\t\t\t\t\tprimaryKeys.forEach( ( primaryKey ) => {\n\t\t\t\t\t\tconst entityRecord = getEditedEntityRecord(\n\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tprimaryKey\n\t\t\t\t\t\t);\n\t\t\t\t\t\trecordsBeingSaved.push( {\n\t\t\t\t\t\t\t// We avoid using primaryKey because it's transformed into a string\n\t\t\t\t\t\t\t// when it's used as an object key.\n\t\t\t\t\t\t\tkey:\n\t\t\t\t\t\t\t\tentityRecord[\n\t\t\t\t\t\t\t\t\tentityConfig.key || DEFAULT_ENTITY_KEY\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\ttitle:\n\t\t\t\t\t\t\t\tentityConfig?.getTitle?.( entityRecord ) || '',\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t} );\n\t\treturn recordsBeingSaved;\n\t},\n\t( state ) => [ state.entities.records ]\n);\n\n/**\n * Returns the specified entity record's edits.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record's edits.\n */\nexport function getEntityRecordEdits( state, kind, name, recordId ) {\n\treturn get( state.entities.records, [ kind, name, 'edits', recordId ] );\n}\n\n/**\n * Returns the specified entity record's non transient edits.\n *\n * Transient edits don't create an undo level, and\n * are not considered for change detection.\n * They are defined in the entity's config.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record's non transient edits.\n */\nexport const getEntityRecordNonTransientEdits = createSelector(\n\t( state, kind, name, recordId ) => {\n\t\tconst { transientEdits } = getEntityConfig( state, kind, name ) || {};\n\t\tconst edits = getEntityRecordEdits( state, kind, name, recordId ) || {};\n\t\tif ( ! transientEdits ) {\n\t\t\treturn edits;\n\t\t}\n\t\treturn Object.keys( edits ).reduce( ( acc, key ) => {\n\t\t\tif ( ! transientEdits[ key ] ) {\n\t\t\t\tacc[ key ] = edits[ key ];\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, {} );\n\t},\n\t( state, kind, name, recordId ) => [\n\t\tstate.entities.config,\n\t\tget( state.entities.records, [ kind, name, 'edits', recordId ] ),\n\t]\n);\n\n/**\n * Returns true if the specified entity record has edits,\n * and false otherwise.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {boolean} Whether the entity record has edits or not.\n */\nexport function hasEditsForEntityRecord( state, kind, name, recordId ) {\n\treturn (\n\t\tisSavingEntityRecord( state, kind, name, recordId ) ||\n\t\tObject.keys(\n\t\t\tgetEntityRecordNonTransientEdits( state, kind, name, recordId )\n\t\t).length > 0\n\t);\n}\n\n/**\n * Returns the specified entity record, merged with its edits.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number|string} recordId Record ID.\n *\n * @return {Object?} The entity record, merged with its edits.\n */\nexport const getEditedEntityRecord = createSelector(\n\t( state, kind, name, recordId ) => ( {\n\t\t...getRawEntityRecord( state, kind, name, recordId ),\n\t\t...getEntityRecordEdits( state, kind, name, recordId ),\n\t} ),\n\t( state, kind, name, recordId, query ) => {\n\t\tconst context = query?.context ?? 'default';\n\t\treturn [\n\t\t\tstate.entities.config,\n\t\t\tget( state.entities.records, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'items',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t\tget( state.entities.records, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'itemIsComplete',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t\tget( state.entities.records, [ kind, name, 'edits', recordId ] ),\n\t\t];\n\t}\n);\n\n/**\n * Returns true if the specified entity record is autosaving, and false otherwise.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {boolean} Whether the entity record is autosaving or not.\n */\nexport function isAutosavingEntityRecord( state, kind, name, recordId ) {\n\tconst { pending, isAutosave } = get(\n\t\tstate.entities.records,\n\t\t[ kind, name, 'saving', recordId ],\n\t\t{}\n\t);\n\treturn Boolean( pending && isAutosave );\n}\n\n/**\n * Returns true if the specified entity record is saving, and false otherwise.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number|string} recordId Record ID.\n *\n * @return {boolean} Whether the entity record is saving or not.\n */\nexport function isSavingEntityRecord( state, kind, name, recordId ) {\n\treturn get(\n\t\tstate.entities.records,\n\t\t[ kind, name, 'saving', recordId, 'pending' ],\n\t\tfalse\n\t);\n}\n\n/**\n * Returns true if the specified entity record is deleting, and false otherwise.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {boolean} Whether the entity record is deleting or not.\n */\nexport function isDeletingEntityRecord( state, kind, name, recordId ) {\n\treturn get(\n\t\tstate.entities.records,\n\t\t[ kind, name, 'deleting', recordId, 'pending' ],\n\t\tfalse\n\t);\n}\n\n/**\n * Returns the specified entity record's last save error.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record's save error.\n */\nexport function getLastEntitySaveError( state, kind, name, recordId ) {\n\treturn get( state.entities.records, [\n\t\tkind,\n\t\tname,\n\t\t'saving',\n\t\trecordId,\n\t\t'error',\n\t] );\n}\n\n/**\n * Returns the specified entity record's last delete error.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record's save error.\n */\nexport function getLastEntityDeleteError( state, kind, name, recordId ) {\n\treturn get( state.entities.records, [\n\t\tkind,\n\t\tname,\n\t\t'deleting',\n\t\trecordId,\n\t\t'error',\n\t] );\n}\n\n/**\n * Returns the current undo offset for the\n * entity records edits history. The offset\n * represents how many items from the end\n * of the history stack we are at. 0 is the\n * last edit, -1 is the second last, and so on.\n *\n * @param {Object} state State tree.\n *\n * @return {number} The current undo offset.\n */\nfunction getCurrentUndoOffset( state ) {\n\treturn state.undo.offset;\n}\n\n/**\n * Returns the previous edit from the current undo offset\n * for the entity records edits history, if any.\n *\n * @param {Object} state State tree.\n *\n * @return {Object?} The edit.\n */\nexport function getUndoEdit( state ) {\n\treturn state.undo[ state.undo.length - 2 + getCurrentUndoOffset( state ) ];\n}\n\n/**\n * Returns the next edit from the current undo offset\n * for the entity records edits history, if any.\n *\n * @param {Object} state State tree.\n *\n * @return {Object?} The edit.\n */\nexport function getRedoEdit( state ) {\n\treturn state.undo[ state.undo.length + getCurrentUndoOffset( state ) ];\n}\n\n/**\n * Returns true if there is a previous edit from the current undo offset\n * for the entity records edits history, and false otherwise.\n *\n * @param {Object} state State tree.\n *\n * @return {boolean} Whether there is a previous edit or not.\n */\nexport function hasUndo( state ) {\n\treturn Boolean( getUndoEdit( state ) );\n}\n\n/**\n * Returns true if there is a next edit from the current undo offset\n * for the entity records edits history, and false otherwise.\n *\n * @param {Object} state State tree.\n *\n * @return {boolean} Whether there is a next edit or not.\n */\nexport function hasRedo( state ) {\n\treturn Boolean( getRedoEdit( state ) );\n}\n\n/**\n * Return the current theme.\n *\n * @param {Object} state Data state.\n *\n * @return {Object} The current theme.\n */\nexport function getCurrentTheme( state ) {\n\treturn getEntityRecord( state, 'root', 'theme', state.currentTheme );\n}\n\n/**\n * Return the ID of the current global styles object.\n *\n * @param {Object} state Data state.\n *\n * @return {string} The current global styles ID.\n */\nexport function __experimentalGetCurrentGlobalStylesId( state ) {\n\treturn state.currentGlobalStylesId;\n}\n\n/**\n * Return theme supports data in the index.\n *\n * @param {Object} state Data state.\n *\n * @return {*} Index data.\n */\nexport function getThemeSupports( state ) {\n\treturn getCurrentTheme( state )?.theme_supports ?? EMPTY_OBJECT;\n}\n\n/**\n * Returns the embed preview for the given URL.\n *\n * @param {Object} state Data state.\n * @param {string} url Embedded URL.\n *\n * @return {*} Undefined if the preview has not been fetched, otherwise, the preview fetched from the embed preview API.\n */\nexport function getEmbedPreview( state, url ) {\n\treturn state.embedPreviews[ url ];\n}\n\n/**\n * Determines if the returned preview is an oEmbed link fallback.\n *\n * WordPress can be configured to return a simple link to a URL if it is not embeddable.\n * We need to be able to determine if a URL is embeddable or not, based on what we\n * get back from the oEmbed preview API.\n *\n * @param {Object} state Data state.\n * @param {string} url Embedded URL.\n *\n * @return {boolean} Is the preview for the URL an oEmbed link fallback.\n */\nexport function isPreviewEmbedFallback( state, url ) {\n\tconst preview = state.embedPreviews[ url ];\n\tconst oEmbedLinkCheck = '<a href=\"' + url + '\">' + url + '</a>';\n\tif ( ! preview ) {\n\t\treturn false;\n\t}\n\treturn preview.html === oEmbedLinkCheck;\n}\n\n/**\n * Returns whether the current user can perform the given action on the given\n * REST resource.\n *\n * Calling this may trigger an OPTIONS request to the REST API via the\n * `canUser()` resolver.\n *\n * https://developer.wordpress.org/rest-api/reference/\n *\n * @param {Object} state Data state.\n * @param {string} action Action to check. One of: 'create', 'read', 'update', 'delete'.\n * @param {string} resource REST resource to check, e.g. 'media' or 'posts'.\n * @param {string=} id Optional ID of the rest resource to check.\n *\n * @return {boolean|undefined} Whether or not the user can perform the action,\n * or `undefined` if the OPTIONS request is still being made.\n */\nexport function canUser( state, action, resource, id ) {\n\tconst key = compact( [ action, resource, id ] ).join( '/' );\n\treturn get( state, [ 'userPermissions', key ] );\n}\n\n/**\n * Returns whether the current user can edit the given entity.\n *\n * Calling this may trigger an OPTIONS request to the REST API via the\n * `canUser()` resolver.\n *\n * https://developer.wordpress.org/rest-api/reference/\n *\n * @param {Object} state Data state.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {string} recordId Record's id.\n * @return {boolean|undefined} Whether or not the user can edit,\n * or `undefined` if the OPTIONS request is still being made.\n */\nexport function canUserEditEntityRecord( state, kind, name, recordId ) {\n\tconst entityConfig = getEntityConfig( state, kind, name );\n\tif ( ! entityConfig ) {\n\t\treturn false;\n\t}\n\tconst resource = entityConfig.__unstable_rest_base;\n\n\treturn canUser( state, 'update', resource, recordId );\n}\n\n/**\n * Returns the latest autosaves for the post.\n *\n * May return multiple autosaves since the backend stores one autosave per\n * author for each post.\n *\n * @param {Object} state State tree.\n * @param {string} postType The type of the parent post.\n * @param {number} postId The id of the parent post.\n *\n * @return {?Array} An array of autosaves for the post, or undefined if there is none.\n */\nexport function getAutosaves( state, postType, postId ) {\n\treturn state.autosaves[ postId ];\n}\n\n/**\n * Returns the autosave for the post and author.\n *\n * @param {Object} state State tree.\n * @param {string} postType The type of the parent post.\n * @param {number} postId The id of the parent post.\n * @param {number} authorId The id of the author.\n *\n * @return {?Object} The autosave for the post and author.\n */\nexport function getAutosave( state, postType, postId, authorId ) {\n\tif ( authorId === undefined ) {\n\t\treturn;\n\t}\n\n\tconst autosaves = state.autosaves[ postId ];\n\treturn find( autosaves, { author: authorId } );\n}\n\n/**\n * Returns true if the REST request for autosaves has completed.\n *\n * @param {Object} state State tree.\n * @param {string} postType The type of the parent post.\n * @param {number} postId The id of the parent post.\n *\n * @return {boolean} True if the REST request was completed. False otherwise.\n */\nexport const hasFetchedAutosaves = createRegistrySelector(\n\t( select ) => ( state, postType, postId ) => {\n\t\treturn select( STORE_NAME ).hasFinishedResolution( 'getAutosaves', [\n\t\t\tpostType,\n\t\t\tpostId,\n\t\t] );\n\t}\n);\n\n/**\n * Returns a new reference when edited values have changed. This is useful in\n * inferring where an edit has been made between states by comparison of the\n * return values using strict equality.\n *\n * @example\n *\n * ```\n * const hasEditOccurred = (\n * getReferenceByDistinctEdits( beforeState ) !==\n * getReferenceByDistinctEdits( afterState )\n * );\n * ```\n *\n * @param {Object} state Editor state.\n *\n * @return {*} A value whose reference will change only when an edit occurs.\n */\nexport const getReferenceByDistinctEdits = createSelector(\n\t() => [],\n\t( state ) => [\n\t\tstate.undo.length,\n\t\tstate.undo.offset,\n\t\tstate.undo.flattenedUndo,\n\t]\n);\n\n/**\n * Retrieve the frontend template used for a given link.\n *\n * @param {Object} state Editor state.\n * @param {string} link Link.\n *\n * @return {Object?} The template record.\n */\nexport function __experimentalGetTemplateForLink( state, link ) {\n\tconst records = getEntityRecords( state, 'postType', 'wp_template', {\n\t\t'find-template': link,\n\t} );\n\n\tconst template = records?.length ? records[ 0 ] : null;\n\tif ( template ) {\n\t\treturn getEditedEntityRecord(\n\t\t\tstate,\n\t\t\t'postType',\n\t\t\t'wp_template',\n\t\t\ttemplate.id\n\t\t);\n\t}\n\treturn template;\n}\n\n/**\n * Retrieve the current theme's base global styles\n *\n * @param {Object} state Editor state.\n *\n * @return {Object|null} The Global Styles object.\n */\nexport function __experimentalGetCurrentThemeBaseGlobalStyles( state ) {\n\tconst currentTheme = getCurrentTheme( state );\n\tif ( ! currentTheme ) {\n\t\treturn null;\n\t}\n\treturn state.themeBaseGlobalStyles[ currentTheme.stylesheet ];\n}\n\n/**\n * Return the ID of the current global styles object.\n *\n * @param {Object} state Data state.\n *\n * @return {string|null} The current global styles ID.\n */\nexport function __experimentalGetCurrentThemeGlobalStylesVariations( state ) {\n\tconst currentTheme = getCurrentTheme( state );\n\tif ( ! currentTheme ) {\n\t\treturn null;\n\t}\n\treturn state.themeGlobalStyleVariations[ currentTheme.stylesheet ];\n}\n"]}
|
|
@@ -12,7 +12,7 @@ var _lodash = require("lodash");
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* Given the current and next item entity, returns the minimally "modified"
|
|
15
|
+
* Given the current and next item entity record, returns the minimally "modified"
|
|
16
16
|
* result of the next item, preferring value references from the original item
|
|
17
17
|
* if equal. If all values match, the original item is returned.
|
|
18
18
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/core-data/src/utils/conservative-map-item.js"],"names":["conservativeMapItem","item","nextItem","hasChanges","result","key","hasOwnProperty"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,mBAAT,CAA8BC,IAA9B,EAAoCC,QAApC,EAA+C;AAC7D;AACA,MAAK,CAAED,IAAP,EAAc;AACb,WAAOC,QAAP;AACA;;AAED,MAAIC,UAAU,GAAG,KAAjB;AACA,QAAMC,MAAM,GAAG,EAAf;;AACA,OAAM,MAAMC,GAAZ,IAAmBH,QAAnB,EAA8B;AAC7B,QAAK,qBAASD,IAAI,CAAEI,GAAF,CAAb,EAAsBH,QAAQ,CAAEG,GAAF,CAA9B,CAAL,EAA+C;AAC9CD,MAAAA,MAAM,CAAEC,GAAF,CAAN,GAAgBJ,IAAI,CAAEI,GAAF,CAApB;AACA,KAFD,MAEO;AACNF,MAAAA,UAAU,GAAG,IAAb;AACAC,MAAAA,MAAM,CAAEC,GAAF,CAAN,GAAgBH,QAAQ,CAAEG,GAAF,CAAxB;AACA;AACD;;AAED,MAAK,CAAEF,UAAP,EAAoB;AACnB,WAAOF,IAAP;AACA,GAnB4D,CAqB7D;AACA;AACA;;;AACA,OAAM,MAAMI,GAAZ,IAAmBJ,IAAnB,EAA0B;AACzB,QAAK,CAAEG,MAAM,CAACE,cAAP,CAAuBD,GAAvB,CAAP,EAAsC;AACrCD,MAAAA,MAAM,CAAEC,GAAF,CAAN,GAAgBJ,IAAI,CAAEI,GAAF,CAApB;AACA;AACD;;AAED,SAAOD,MAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { isEqual } from 'lodash';\n\n/**\n * Given the current and next item entity, returns the minimally \"modified\"\n * result of the next item, preferring value references from the original item\n * if equal. If all values match, the original item is returned.\n *\n * @param {Object} item Original item.\n * @param {Object} nextItem Next item.\n *\n * @return {Object} Minimally modified merged item.\n */\nexport default function conservativeMapItem( item, nextItem ) {\n\t// Return next item in its entirety if there is no original item.\n\tif ( ! item ) {\n\t\treturn nextItem;\n\t}\n\n\tlet hasChanges = false;\n\tconst result = {};\n\tfor ( const key in nextItem ) {\n\t\tif ( isEqual( item[ key ], nextItem[ key ] ) ) {\n\t\t\tresult[ key ] = item[ key ];\n\t\t} else {\n\t\t\thasChanges = true;\n\t\t\tresult[ key ] = nextItem[ key ];\n\t\t}\n\t}\n\n\tif ( ! hasChanges ) {\n\t\treturn item;\n\t}\n\n\t// Only at this point, backfill properties from the original item which\n\t// weren't explicitly set into the result above. This is an optimization\n\t// to allow `hasChanges` to return early.\n\tfor ( const key in item ) {\n\t\tif ( ! result.hasOwnProperty( key ) ) {\n\t\t\tresult[ key ] = item[ key ];\n\t\t}\n\t}\n\n\treturn result;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/core-data/src/utils/conservative-map-item.js"],"names":["conservativeMapItem","item","nextItem","hasChanges","result","key","hasOwnProperty"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,mBAAT,CAA8BC,IAA9B,EAAoCC,QAApC,EAA+C;AAC7D;AACA,MAAK,CAAED,IAAP,EAAc;AACb,WAAOC,QAAP;AACA;;AAED,MAAIC,UAAU,GAAG,KAAjB;AACA,QAAMC,MAAM,GAAG,EAAf;;AACA,OAAM,MAAMC,GAAZ,IAAmBH,QAAnB,EAA8B;AAC7B,QAAK,qBAASD,IAAI,CAAEI,GAAF,CAAb,EAAsBH,QAAQ,CAAEG,GAAF,CAA9B,CAAL,EAA+C;AAC9CD,MAAAA,MAAM,CAAEC,GAAF,CAAN,GAAgBJ,IAAI,CAAEI,GAAF,CAApB;AACA,KAFD,MAEO;AACNF,MAAAA,UAAU,GAAG,IAAb;AACAC,MAAAA,MAAM,CAAEC,GAAF,CAAN,GAAgBH,QAAQ,CAAEG,GAAF,CAAxB;AACA;AACD;;AAED,MAAK,CAAEF,UAAP,EAAoB;AACnB,WAAOF,IAAP;AACA,GAnB4D,CAqB7D;AACA;AACA;;;AACA,OAAM,MAAMI,GAAZ,IAAmBJ,IAAnB,EAA0B;AACzB,QAAK,CAAEG,MAAM,CAACE,cAAP,CAAuBD,GAAvB,CAAP,EAAsC;AACrCD,MAAAA,MAAM,CAAEC,GAAF,CAAN,GAAgBJ,IAAI,CAAEI,GAAF,CAApB;AACA;AACD;;AAED,SAAOD,MAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { isEqual } from 'lodash';\n\n/**\n * Given the current and next item entity record, returns the minimally \"modified\"\n * result of the next item, preferring value references from the original item\n * if equal. If all values match, the original item is returned.\n *\n * @param {Object} item Original item.\n * @param {Object} nextItem Next item.\n *\n * @return {Object} Minimally modified merged item.\n */\nexport default function conservativeMapItem( item, nextItem ) {\n\t// Return next item in its entirety if there is no original item.\n\tif ( ! item ) {\n\t\treturn nextItem;\n\t}\n\n\tlet hasChanges = false;\n\tconst result = {};\n\tfor ( const key in nextItem ) {\n\t\tif ( isEqual( item[ key ], nextItem[ key ] ) ) {\n\t\t\tresult[ key ] = item[ key ];\n\t\t} else {\n\t\t\thasChanges = true;\n\t\t\tresult[ key ] = nextItem[ key ];\n\t\t}\n\t}\n\n\tif ( ! hasChanges ) {\n\t\treturn item;\n\t}\n\n\t// Only at this point, backfill properties from the original item which\n\t// weren't explicitly set into the result above. This is an optimization\n\t// to allow `hasChanges` to return early.\n\tfor ( const key in item ) {\n\t\tif ( ! result.hasOwnProperty( key ) ) {\n\t\t\tresult[ key ] = item[ key ];\n\t\t}\n\t}\n\n\treturn result;\n}\n"]}
|
|
@@ -8,7 +8,7 @@ exports.default = isRawAttribute;
|
|
|
8
8
|
/**
|
|
9
9
|
* Checks whether the attribute is a "raw" attribute or not.
|
|
10
10
|
*
|
|
11
|
-
* @param {Object} entity Entity
|
|
11
|
+
* @param {Object} entity Entity record.
|
|
12
12
|
* @param {string} attribute Attribute name.
|
|
13
13
|
*
|
|
14
14
|
* @return {boolean} Is the attribute raw
|