@wordpress/core-data 4.2.0 → 4.4.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 +8 -0
- package/README.md +68 -11
- package/build/actions.js +61 -41
- package/build/actions.js.map +1 -1
- package/build/batch/default-processor.js +1 -1
- package/build/batch/default-processor.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 +48 -11
- 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 +14 -2
- package/build/hooks/use-entity-records.js.map +1 -1
- package/build/hooks/use-query-select.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 +77 -25
- package/build/reducer.js.map +1 -1
- package/build/resolvers.js +48 -24
- package/build/resolvers.js.map +1 -1
- package/build/selectors.js +122 -55
- package/build/selectors.js.map +1 -1
- package/build/types.js +6 -0
- package/build/types.js.map +1 -0
- package/build/utils/conservative-map-item.js +1 -1
- package/build/utils/conservative-map-item.js.map +1 -1
- package/build/utils/if-matching-action.js +4 -2
- package/build/utils/if-matching-action.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/utils/on-sub-key.js +3 -1
- package/build/utils/on-sub-key.js.map +1 -1
- package/build/utils/replace-action.js +4 -2
- package/build/utils/replace-action.js.map +1 -1
- package/build-module/actions.js +62 -42
- package/build-module/actions.js.map +1 -1
- package/build-module/batch/default-processor.js +1 -1
- package/build-module/batch/default-processor.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 +48 -11
- 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 +14 -2
- package/build-module/hooks/use-entity-records.js.map +1 -1
- package/build-module/hooks/use-query-select.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 +75 -26
- package/build-module/reducer.js.map +1 -1
- package/build-module/resolvers.js +42 -24
- package/build-module/resolvers.js.map +1 -1
- package/build-module/selectors.js +114 -55
- package/build-module/selectors.js.map +1 -1
- package/build-module/types.js +2 -0
- package/build-module/types.js.map +1 -0
- 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/if-matching-action.js +4 -2
- package/build-module/utils/if-matching-action.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/build-module/utils/on-sub-key.js +3 -1
- package/build-module/utils/on-sub-key.js.map +1 -1
- package/build-module/utils/replace-action.js +4 -2
- package/build-module/utils/replace-action.js.map +1 -1
- package/package.json +11 -11
- package/src/actions.js +62 -42
- package/src/batch/default-processor.js +1 -0
- package/src/{entities.js → entities.ts} +50 -21
- 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 +56 -20
- package/src/fetch/__experimental-fetch-url-data.js +1 -0
- package/src/fetch/test/__experimental-fetch-link-suggestions.js +39 -1
- package/src/hooks/use-entity-record.ts +19 -8
- package/src/hooks/use-entity-records.ts +23 -6
- package/src/hooks/use-query-select.ts +12 -7
- 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 +67 -24
- package/src/resolvers.js +39 -30
- package/src/{selectors.js → selectors.ts} +118 -57
- 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/types.ts +3 -0
- package/src/utils/conservative-map-item.js +1 -1
- package/src/utils/if-matching-action.js +4 -2
- package/src/utils/is-raw-attribute.js +1 -1
- package/src/utils/on-sub-key.js +3 -1
- package/src/utils/replace-action.js +4 -2
- 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
|
@@ -84,8 +84,9 @@ export const getUserQueryResults = createSelector((state, queryID) => {
|
|
|
84
84
|
return map(queryResults, id => state.users.byId[id]);
|
|
85
85
|
}, (state, queryID) => [state.users.queries[queryID], state.users.byId]);
|
|
86
86
|
/**
|
|
87
|
-
* Returns
|
|
87
|
+
* Returns the loaded entities for the given kind.
|
|
88
88
|
*
|
|
89
|
+
* @deprecated since WordPress 6.0. Use getEntitiesConfig instead
|
|
89
90
|
* @param {Object} state Data state.
|
|
90
91
|
* @param {string} kind Entity kind.
|
|
91
92
|
*
|
|
@@ -93,21 +94,55 @@ export const getUserQueryResults = createSelector((state, queryID) => {
|
|
|
93
94
|
*/
|
|
94
95
|
|
|
95
96
|
export function getEntitiesByKind(state, kind) {
|
|
97
|
+
deprecated("wp.data.select( 'core' ).getEntitiesByKind()", {
|
|
98
|
+
since: '6.0',
|
|
99
|
+
alternative: "wp.data.select( 'core' ).getEntitiesConfig()"
|
|
100
|
+
});
|
|
101
|
+
return getEntitiesConfig(state, kind);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Returns the loaded entities for the given kind.
|
|
105
|
+
*
|
|
106
|
+
* @param {Object} state Data state.
|
|
107
|
+
* @param {string} kind Entity kind.
|
|
108
|
+
*
|
|
109
|
+
* @return {Array<Object>} Array of entities with config matching kind.
|
|
110
|
+
*/
|
|
111
|
+
|
|
112
|
+
export function getEntitiesConfig(state, kind) {
|
|
96
113
|
return filter(state.entities.config, {
|
|
97
114
|
kind
|
|
98
115
|
});
|
|
99
116
|
}
|
|
100
117
|
/**
|
|
101
|
-
* Returns the entity
|
|
118
|
+
* Returns the entity config given its kind and name.
|
|
102
119
|
*
|
|
120
|
+
* @deprecated since WordPress 6.0. Use getEntityConfig instead
|
|
103
121
|
* @param {Object} state Data state.
|
|
104
122
|
* @param {string} kind Entity kind.
|
|
105
123
|
* @param {string} name Entity name.
|
|
106
124
|
*
|
|
107
|
-
* @return {Object} Entity
|
|
125
|
+
* @return {Object} Entity config
|
|
108
126
|
*/
|
|
109
127
|
|
|
110
128
|
export function getEntity(state, kind, name) {
|
|
129
|
+
deprecated("wp.data.select( 'core' ).getEntity()", {
|
|
130
|
+
since: '6.0',
|
|
131
|
+
alternative: "wp.data.select( 'core' ).getEntityConfig()"
|
|
132
|
+
});
|
|
133
|
+
return getEntityConfig(state, kind, name);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Returns the entity config given its kind and name.
|
|
137
|
+
*
|
|
138
|
+
* @param {Object} state Data state.
|
|
139
|
+
* @param {string} kind Entity kind.
|
|
140
|
+
* @param {string} name Entity name.
|
|
141
|
+
*
|
|
142
|
+
* @return {Object} Entity config
|
|
143
|
+
*/
|
|
144
|
+
|
|
145
|
+
export function getEntityConfig(state, kind, name) {
|
|
111
146
|
return find(state.entities.config, {
|
|
112
147
|
kind,
|
|
113
148
|
name
|
|
@@ -124,13 +159,13 @@ export function getEntity(state, kind, name) {
|
|
|
124
159
|
* @param {number} key Record's key
|
|
125
160
|
* @param {?Object} query Optional query.
|
|
126
161
|
*
|
|
127
|
-
* @return {Object
|
|
162
|
+
* @return {Object|undefined} Record.
|
|
128
163
|
*/
|
|
129
164
|
|
|
130
165
|
export const getEntityRecord = createSelector((state, kind, name, key, query) => {
|
|
131
166
|
var _query$context, _queriedState$items$c;
|
|
132
167
|
|
|
133
|
-
const queriedState = get(state.entities.
|
|
168
|
+
const queriedState = get(state.entities.records, [kind, name, 'queriedData']);
|
|
134
169
|
|
|
135
170
|
if (!queriedState) {
|
|
136
171
|
return undefined;
|
|
@@ -152,8 +187,10 @@ export const getEntityRecord = createSelector((state, kind, name, key, query) =>
|
|
|
152
187
|
const item = (_queriedState$items$c = queriedState.items[context]) === null || _queriedState$items$c === void 0 ? void 0 : _queriedState$items$c[key];
|
|
153
188
|
|
|
154
189
|
if (item && query._fields) {
|
|
190
|
+
var _getNormalizedCommaSe;
|
|
191
|
+
|
|
155
192
|
const filteredItem = {};
|
|
156
|
-
const fields = getNormalizedCommaSeparable(query._fields);
|
|
193
|
+
const fields = (_getNormalizedCommaSe = getNormalizedCommaSeparable(query._fields)) !== null && _getNormalizedCommaSe !== void 0 ? _getNormalizedCommaSe : [];
|
|
157
194
|
|
|
158
195
|
for (let f = 0; f < fields.length; f++) {
|
|
159
196
|
const field = fields[f].split('.');
|
|
@@ -169,10 +206,10 @@ export const getEntityRecord = createSelector((state, kind, name, key, query) =>
|
|
|
169
206
|
var _query$context2;
|
|
170
207
|
|
|
171
208
|
const context = (_query$context2 = query === null || query === void 0 ? void 0 : query.context) !== null && _query$context2 !== void 0 ? _query$context2 : 'default';
|
|
172
|
-
return [get(state.entities.
|
|
209
|
+
return [get(state.entities.records, [kind, name, 'queriedData', 'items', context, recordId]), get(state.entities.records, [kind, name, 'queriedData', 'itemIsComplete', context, recordId])];
|
|
173
210
|
});
|
|
174
211
|
/**
|
|
175
|
-
* 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.
|
|
212
|
+
* 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.
|
|
176
213
|
*
|
|
177
214
|
* @param {Object} state State tree
|
|
178
215
|
* @param {string} kind Entity kind.
|
|
@@ -200,7 +237,7 @@ export function __experimentalGetEntityRecordNoResolver(state, kind, name, key)
|
|
|
200
237
|
export const getRawEntityRecord = createSelector((state, kind, name, key) => {
|
|
201
238
|
const record = getEntityRecord(state, kind, name, key);
|
|
202
239
|
return record && Object.keys(record).reduce((accumulator, _key) => {
|
|
203
|
-
if (isRawAttribute(
|
|
240
|
+
if (isRawAttribute(getEntityConfig(state, kind, name), _key)) {
|
|
204
241
|
// Because edits are the "raw" attribute values,
|
|
205
242
|
// we return those from record selectors to make rendering,
|
|
206
243
|
// comparisons, and joins with edits easier.
|
|
@@ -215,7 +252,7 @@ export const getRawEntityRecord = createSelector((state, kind, name, key) => {
|
|
|
215
252
|
var _query$context3;
|
|
216
253
|
|
|
217
254
|
const context = (_query$context3 = query === null || query === void 0 ? void 0 : query.context) !== null && _query$context3 !== void 0 ? _query$context3 : 'default';
|
|
218
|
-
return [state.entities.config, get(state.entities.
|
|
255
|
+
return [state.entities.config, get(state.entities.records, [kind, name, 'queriedData', 'items', context, recordId]), get(state.entities.records, [kind, name, 'queriedData', 'itemIsComplete', context, recordId])];
|
|
219
256
|
});
|
|
220
257
|
/**
|
|
221
258
|
* Returns true if records have been received for the given set of parameters,
|
|
@@ -246,7 +283,7 @@ export function hasEntityRecords(state, kind, name, query) {
|
|
|
246
283
|
export function getEntityRecords(state, kind, name, query) {
|
|
247
284
|
// Queried data state is prepopulated for all known entities. If this is not
|
|
248
285
|
// assigned for the given parameters, then it is known to not exist.
|
|
249
|
-
const queriedState = get(state.entities.
|
|
286
|
+
const queriedState = get(state.entities.records, [kind, name, 'queriedData']);
|
|
250
287
|
|
|
251
288
|
if (!queriedState) {
|
|
252
289
|
return null;
|
|
@@ -265,27 +302,27 @@ export function getEntityRecords(state, kind, name, query) {
|
|
|
265
302
|
export const __experimentalGetDirtyEntityRecords = createSelector(state => {
|
|
266
303
|
const {
|
|
267
304
|
entities: {
|
|
268
|
-
|
|
305
|
+
records
|
|
269
306
|
}
|
|
270
307
|
} = state;
|
|
271
308
|
const dirtyRecords = [];
|
|
272
|
-
Object.keys(
|
|
273
|
-
Object.keys(
|
|
274
|
-
const primaryKeys = Object.keys(
|
|
309
|
+
Object.keys(records).forEach(kind => {
|
|
310
|
+
Object.keys(records[kind]).forEach(name => {
|
|
311
|
+
const primaryKeys = Object.keys(records[kind][name].edits).filter(primaryKey => // The entity record must exist (not be deleted),
|
|
275
312
|
// and it must have edits.
|
|
276
313
|
getEntityRecord(state, kind, name, primaryKey) && hasEditsForEntityRecord(state, kind, name, primaryKey));
|
|
277
314
|
|
|
278
315
|
if (primaryKeys.length) {
|
|
279
|
-
const
|
|
316
|
+
const entityConfig = getEntityConfig(state, kind, name);
|
|
280
317
|
primaryKeys.forEach(primaryKey => {
|
|
281
|
-
var
|
|
318
|
+
var _entityConfig$getTitl;
|
|
282
319
|
|
|
283
320
|
const entityRecord = getEditedEntityRecord(state, kind, name, primaryKey);
|
|
284
321
|
dirtyRecords.push({
|
|
285
322
|
// We avoid using primaryKey because it's transformed into a string
|
|
286
323
|
// when it's used as an object key.
|
|
287
|
-
key: entityRecord[
|
|
288
|
-
title: (
|
|
324
|
+
key: entityRecord[entityConfig.key || DEFAULT_ENTITY_KEY],
|
|
325
|
+
title: (entityConfig === null || entityConfig === void 0 ? void 0 : (_entityConfig$getTitl = entityConfig.getTitle) === null || _entityConfig$getTitl === void 0 ? void 0 : _entityConfig$getTitl.call(entityConfig, entityRecord)) || '',
|
|
289
326
|
name,
|
|
290
327
|
kind
|
|
291
328
|
});
|
|
@@ -294,7 +331,7 @@ export const __experimentalGetDirtyEntityRecords = createSelector(state => {
|
|
|
294
331
|
});
|
|
295
332
|
});
|
|
296
333
|
return dirtyRecords;
|
|
297
|
-
}, state => [state.entities.
|
|
334
|
+
}, state => [state.entities.records]);
|
|
298
335
|
/**
|
|
299
336
|
* Returns the list of entities currently being saved.
|
|
300
337
|
*
|
|
@@ -306,25 +343,25 @@ export const __experimentalGetDirtyEntityRecords = createSelector(state => {
|
|
|
306
343
|
export const __experimentalGetEntitiesBeingSaved = createSelector(state => {
|
|
307
344
|
const {
|
|
308
345
|
entities: {
|
|
309
|
-
|
|
346
|
+
records
|
|
310
347
|
}
|
|
311
348
|
} = state;
|
|
312
349
|
const recordsBeingSaved = [];
|
|
313
|
-
Object.keys(
|
|
314
|
-
Object.keys(
|
|
315
|
-
const primaryKeys = Object.keys(
|
|
350
|
+
Object.keys(records).forEach(kind => {
|
|
351
|
+
Object.keys(records[kind]).forEach(name => {
|
|
352
|
+
const primaryKeys = Object.keys(records[kind][name].saving).filter(primaryKey => isSavingEntityRecord(state, kind, name, primaryKey));
|
|
316
353
|
|
|
317
354
|
if (primaryKeys.length) {
|
|
318
|
-
const
|
|
355
|
+
const entityConfig = getEntityConfig(state, kind, name);
|
|
319
356
|
primaryKeys.forEach(primaryKey => {
|
|
320
|
-
var
|
|
357
|
+
var _entityConfig$getTitl2;
|
|
321
358
|
|
|
322
359
|
const entityRecord = getEditedEntityRecord(state, kind, name, primaryKey);
|
|
323
360
|
recordsBeingSaved.push({
|
|
324
361
|
// We avoid using primaryKey because it's transformed into a string
|
|
325
362
|
// when it's used as an object key.
|
|
326
|
-
key: entityRecord[
|
|
327
|
-
title: (
|
|
363
|
+
key: entityRecord[entityConfig.key || DEFAULT_ENTITY_KEY],
|
|
364
|
+
title: (entityConfig === null || entityConfig === void 0 ? void 0 : (_entityConfig$getTitl2 = entityConfig.getTitle) === null || _entityConfig$getTitl2 === void 0 ? void 0 : _entityConfig$getTitl2.call(entityConfig, entityRecord)) || '',
|
|
328
365
|
name,
|
|
329
366
|
kind
|
|
330
367
|
});
|
|
@@ -333,7 +370,7 @@ export const __experimentalGetEntitiesBeingSaved = createSelector(state => {
|
|
|
333
370
|
});
|
|
334
371
|
});
|
|
335
372
|
return recordsBeingSaved;
|
|
336
|
-
}, state => [state.entities.
|
|
373
|
+
}, state => [state.entities.records]);
|
|
337
374
|
/**
|
|
338
375
|
* Returns the specified entity record's edits.
|
|
339
376
|
*
|
|
@@ -346,7 +383,7 @@ export const __experimentalGetEntitiesBeingSaved = createSelector(state => {
|
|
|
346
383
|
*/
|
|
347
384
|
|
|
348
385
|
export function getEntityRecordEdits(state, kind, name, recordId) {
|
|
349
|
-
return get(state.entities.
|
|
386
|
+
return get(state.entities.records, [kind, name, 'edits', recordId]);
|
|
350
387
|
}
|
|
351
388
|
/**
|
|
352
389
|
* Returns the specified entity record's non transient edits.
|
|
@@ -366,7 +403,7 @@ export function getEntityRecordEdits(state, kind, name, recordId) {
|
|
|
366
403
|
export const getEntityRecordNonTransientEdits = createSelector((state, kind, name, recordId) => {
|
|
367
404
|
const {
|
|
368
405
|
transientEdits
|
|
369
|
-
} =
|
|
406
|
+
} = getEntityConfig(state, kind, name) || {};
|
|
370
407
|
const edits = getEntityRecordEdits(state, kind, name, recordId) || {};
|
|
371
408
|
|
|
372
409
|
if (!transientEdits) {
|
|
@@ -380,15 +417,15 @@ export const getEntityRecordNonTransientEdits = createSelector((state, kind, nam
|
|
|
380
417
|
|
|
381
418
|
return acc;
|
|
382
419
|
}, {});
|
|
383
|
-
}, (state, kind, name, recordId) => [state.entities.config, get(state.entities.
|
|
420
|
+
}, (state, kind, name, recordId) => [state.entities.config, get(state.entities.records, [kind, name, 'edits', recordId])]);
|
|
384
421
|
/**
|
|
385
422
|
* Returns true if the specified entity record has edits,
|
|
386
423
|
* and false otherwise.
|
|
387
424
|
*
|
|
388
|
-
* @param {Object}
|
|
389
|
-
* @param {string}
|
|
390
|
-
* @param {string}
|
|
391
|
-
* @param {number} recordId Record ID.
|
|
425
|
+
* @param {Object} state State tree.
|
|
426
|
+
* @param {string} kind Entity kind.
|
|
427
|
+
* @param {string} name Entity name.
|
|
428
|
+
* @param {number|string} recordId Record ID.
|
|
392
429
|
*
|
|
393
430
|
* @return {boolean} Whether the entity record has edits or not.
|
|
394
431
|
*/
|
|
@@ -399,10 +436,10 @@ export function hasEditsForEntityRecord(state, kind, name, recordId) {
|
|
|
399
436
|
/**
|
|
400
437
|
* Returns the specified entity record, merged with its edits.
|
|
401
438
|
*
|
|
402
|
-
* @param {Object}
|
|
403
|
-
* @param {string}
|
|
404
|
-
* @param {string}
|
|
405
|
-
* @param {number} recordId Record ID.
|
|
439
|
+
* @param {Object} state State tree.
|
|
440
|
+
* @param {string} kind Entity kind.
|
|
441
|
+
* @param {string} name Entity name.
|
|
442
|
+
* @param {number|string} recordId Record ID.
|
|
406
443
|
*
|
|
407
444
|
* @return {Object?} The entity record, merged with its edits.
|
|
408
445
|
*/
|
|
@@ -413,7 +450,7 @@ export const getEditedEntityRecord = createSelector((state, kind, name, recordId
|
|
|
413
450
|
var _query$context4;
|
|
414
451
|
|
|
415
452
|
const context = (_query$context4 = query === null || query === void 0 ? void 0 : query.context) !== null && _query$context4 !== void 0 ? _query$context4 : 'default';
|
|
416
|
-
return [state.entities.config, get(state.entities.
|
|
453
|
+
return [state.entities.config, get(state.entities.records, [kind, name, 'queriedData', 'items', context, recordId]), get(state.entities.records, [kind, name, 'queriedData', 'itemIsComplete', context, recordId]), get(state.entities.records, [kind, name, 'edits', recordId])];
|
|
417
454
|
});
|
|
418
455
|
/**
|
|
419
456
|
* Returns true if the specified entity record is autosaving, and false otherwise.
|
|
@@ -430,22 +467,22 @@ export function isAutosavingEntityRecord(state, kind, name, recordId) {
|
|
|
430
467
|
const {
|
|
431
468
|
pending,
|
|
432
469
|
isAutosave
|
|
433
|
-
} = get(state.entities.
|
|
470
|
+
} = get(state.entities.records, [kind, name, 'saving', recordId], {});
|
|
434
471
|
return Boolean(pending && isAutosave);
|
|
435
472
|
}
|
|
436
473
|
/**
|
|
437
474
|
* Returns true if the specified entity record is saving, and false otherwise.
|
|
438
475
|
*
|
|
439
|
-
* @param {Object}
|
|
440
|
-
* @param {string}
|
|
441
|
-
* @param {string}
|
|
442
|
-
* @param {number} recordId Record ID.
|
|
476
|
+
* @param {Object} state State tree.
|
|
477
|
+
* @param {string} kind Entity kind.
|
|
478
|
+
* @param {string} name Entity name.
|
|
479
|
+
* @param {number|string} recordId Record ID.
|
|
443
480
|
*
|
|
444
481
|
* @return {boolean} Whether the entity record is saving or not.
|
|
445
482
|
*/
|
|
446
483
|
|
|
447
484
|
export function isSavingEntityRecord(state, kind, name, recordId) {
|
|
448
|
-
return get(state.entities.
|
|
485
|
+
return get(state.entities.records, [kind, name, 'saving', recordId, 'pending'], false);
|
|
449
486
|
}
|
|
450
487
|
/**
|
|
451
488
|
* Returns true if the specified entity record is deleting, and false otherwise.
|
|
@@ -459,7 +496,7 @@ export function isSavingEntityRecord(state, kind, name, recordId) {
|
|
|
459
496
|
*/
|
|
460
497
|
|
|
461
498
|
export function isDeletingEntityRecord(state, kind, name, recordId) {
|
|
462
|
-
return get(state.entities.
|
|
499
|
+
return get(state.entities.records, [kind, name, 'deleting', recordId, 'pending'], false);
|
|
463
500
|
}
|
|
464
501
|
/**
|
|
465
502
|
* Returns the specified entity record's last save error.
|
|
@@ -473,7 +510,7 @@ export function isDeletingEntityRecord(state, kind, name, recordId) {
|
|
|
473
510
|
*/
|
|
474
511
|
|
|
475
512
|
export function getLastEntitySaveError(state, kind, name, recordId) {
|
|
476
|
-
return get(state.entities.
|
|
513
|
+
return get(state.entities.records, [kind, name, 'saving', recordId, 'error']);
|
|
477
514
|
}
|
|
478
515
|
/**
|
|
479
516
|
* Returns the specified entity record's last delete error.
|
|
@@ -487,7 +524,7 @@ export function getLastEntitySaveError(state, kind, name, recordId) {
|
|
|
487
524
|
*/
|
|
488
525
|
|
|
489
526
|
export function getLastEntityDeleteError(state, kind, name, recordId) {
|
|
490
|
-
return get(state.entities.
|
|
527
|
+
return get(state.entities.records, [kind, name, 'deleting', recordId, 'error']);
|
|
491
528
|
}
|
|
492
529
|
/**
|
|
493
530
|
* Returns the current undo offset for the
|
|
@@ -662,13 +699,13 @@ export function canUser(state, action, resource, id) {
|
|
|
662
699
|
*/
|
|
663
700
|
|
|
664
701
|
export function canUserEditEntityRecord(state, kind, name, recordId) {
|
|
665
|
-
const
|
|
702
|
+
const entityConfig = getEntityConfig(state, kind, name);
|
|
666
703
|
|
|
667
|
-
if (!
|
|
704
|
+
if (!entityConfig) {
|
|
668
705
|
return false;
|
|
669
706
|
}
|
|
670
707
|
|
|
671
|
-
const resource =
|
|
708
|
+
const resource = entityConfig.__unstable_rest_base;
|
|
672
709
|
return canUser(state, 'update', resource, recordId);
|
|
673
710
|
}
|
|
674
711
|
/**
|
|
@@ -767,7 +804,7 @@ export function __experimentalGetTemplateForLink(state, link) {
|
|
|
767
804
|
*
|
|
768
805
|
* @param {Object} state Editor state.
|
|
769
806
|
*
|
|
770
|
-
* @return {Object
|
|
807
|
+
* @return {Object|null} The Global Styles object.
|
|
771
808
|
*/
|
|
772
809
|
|
|
773
810
|
export function __experimentalGetCurrentThemeBaseGlobalStyles(state) {
|
|
@@ -784,7 +821,7 @@ export function __experimentalGetCurrentThemeBaseGlobalStyles(state) {
|
|
|
784
821
|
*
|
|
785
822
|
* @param {Object} state Data state.
|
|
786
823
|
*
|
|
787
|
-
* @return {string} The current global styles ID.
|
|
824
|
+
* @return {string|null} The current global styles ID.
|
|
788
825
|
*/
|
|
789
826
|
|
|
790
827
|
export function __experimentalGetCurrentThemeGlobalStylesVariations(state) {
|
|
@@ -796,4 +833,26 @@ export function __experimentalGetCurrentThemeGlobalStylesVariations(state) {
|
|
|
796
833
|
|
|
797
834
|
return state.themeGlobalStyleVariations[currentTheme.stylesheet];
|
|
798
835
|
}
|
|
836
|
+
/**
|
|
837
|
+
* Retrieve the list of registered block patterns.
|
|
838
|
+
*
|
|
839
|
+
* @param {Object} state Data state.
|
|
840
|
+
*
|
|
841
|
+
* @return {Array} Block pattern list.
|
|
842
|
+
*/
|
|
843
|
+
|
|
844
|
+
export function getBlockPatterns(state) {
|
|
845
|
+
return state.blockPatterns;
|
|
846
|
+
}
|
|
847
|
+
/**
|
|
848
|
+
* Retrieve the list of registered block pattern categories.
|
|
849
|
+
*
|
|
850
|
+
* @param {Object} state Data state.
|
|
851
|
+
*
|
|
852
|
+
* @return {Array} Block pattern category list.
|
|
853
|
+
*/
|
|
854
|
+
|
|
855
|
+
export function getBlockPatternCategories(state) {
|
|
856
|
+
return state.blockPatternCategories;
|
|
857
|
+
}
|
|
799
858
|
//# sourceMappingURL=selectors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/core-data/src/selectors.js"],"names":["createSelector","set","map","find","get","filter","compact","createRegistrySelector","addQueryArgs","deprecated","STORE_NAME","getQueriedItems","DEFAULT_ENTITY_KEY","getNormalizedCommaSeparable","isRawAttribute","EMPTY_OBJECT","isRequestingEmbedPreview","select","state","url","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","primaryKey","hasEditsForEntityRecord","entity","entityRecord","getEditedEntityRecord","push","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":"AAAA;AACA;AACA;AACA,OAAOA,cAAP,MAA2B,QAA3B;AACA,SAASC,GAAT,EAAcC,GAAd,EAAmBC,IAAnB,EAAyBC,GAAzB,EAA8BC,MAA9B,EAAsCC,OAAtC,QAAqD,QAArD;AAEA;AACA;AACA;;AACA,SAASC,sBAAT,QAAuC,iBAAvC;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,QAA3B;AACA,SAASC,eAAT,QAAgC,gBAAhC;AACA,SAASC,kBAAT,QAAmC,YAAnC;AACA,SAASC,2BAAT,EAAsCC,cAAtC,QAA4D,SAA5D;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,YAAY,GAAG,EAArB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,wBAAwB,GAAGT,sBAAsB,CAC3DU,MAAF,IAAc,CAAEC,KAAF,EAASC,GAAT,KAAkB;AAC/B,SAAOF,MAAM,CAAEP,UAAF,CAAN,CAAqBU,WAArB,CAAkC,iBAAlC,EAAqD,CAAED,GAAF,CAArD,CAAP;AACA,CAH4D,CAAvD;AAMP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASE,UAAT,CAAqBH,KAArB,EAA4BI,KAA5B,EAAoC;AAC1Cb,EAAAA,UAAU,CAAE,+BAAF,EAAmC;AAC5Cc,IAAAA,KAAK,EAAE,KADqC;AAE5CC,IAAAA,WAAW,EAAE;AAF+B,GAAnC,CAAV;AAKA,QAAMC,IAAI,GAAGjB,YAAY,CACxB,wCADwB,EAExBc,KAFwB,CAAzB;AAIA,SAAOI,mBAAmB,CAAER,KAAF,EAASO,IAAT,CAA1B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SA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K,CAAC0H,qBAAN,CAA6BjC,YAAY,CAACkC,UAA1C,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,mDAAT,CAA8D5H,KAA9D,EAAsE;AAC5E,QAAMyF,YAAY,GAAGD,eAAe,CAAExF,KAAF,CAApC;;AACA,MAAK,CAAEyF,YAAP,EAAsB;AACrB,WAAO,IAAP;AACA;;AACD,SAAOzF,KAAK,CAAC6H,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.ts"],"names":["createSelector","set","map","find","get","filter","compact","createRegistrySelector","addQueryArgs","deprecated","STORE_NAME","getQueriedItems","DEFAULT_ENTITY_KEY","getNormalizedCommaSeparable","isRawAttribute","EMPTY_OBJECT","isRequestingEmbedPreview","select","state","url","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","primaryKey","hasEditsForEntityRecord","entityConfig","entityRecord","getEditedEntityRecord","push","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","getBlockPatterns","blockPatterns","getBlockPatternCategories","blockPatternCategories"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,cAAP,MAA2B,QAA3B;AACA,SAASC,GAAT,EAAcC,GAAd,EAAmBC,IAAnB,EAAyBC,GAAzB,EAA8BC,MAA9B,EAAsCC,OAAtC,QAAqD,QAArD;AAEA;AACA;AACA;;AACA,SAASC,sBAAT,QAAuC,iBAAvC;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,OAAOC,UAAP,MAAuB,uBAAvB;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,QAA3B;AACA,SAASC,eAAT,QAAgC,gBAAhC;AACA,SAASC,kBAAT,QAAmC,YAAnC;AACA,SAASC,2BAAT,EAAsCC,cAAtC,QAA4D,SAA5D;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,MAAMC,YAAY,GAAG,EAArB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,wBAAwB,GAAGT,sBAAsB,CAC3DU,MAAF,IAAc,CAAEC,KAAF,EAASC,GAAT,KAAkB;AAC/B,SAAOF,MAAM,CAAE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CAAC2H,qBAAN,CAA6BhC,YAAY,CAACiC,UAA1C,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,mDAAT,CAA8D7H,KAA9D,EAAsE;AAC5E,QAAM2F,YAAY,GAAGD,eAAe,CAAE1F,KAAF,CAApC;;AACA,MAAK,CAAE2F,YAAP,EAAsB;AACrB,WAAO,IAAP;AACA;;AACD,SAAO3F,KAAK,CAAC8H,0BAAN,CAAkCnC,YAAY,CAACiC,UAA/C,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,gBAAT,CAA2B/H,KAA3B,EAAmC;AACzC,SAAOA,KAAK,CAACgI,aAAb;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,yBAAT,CAAoCjI,KAApC,EAA4C;AAClD,SAAOA,KAAK,CAACkI,sBAAb;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|string} 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\n/**\n * Retrieve the list of registered block patterns.\n *\n * @param {Object} state Data state.\n *\n * @return {Array} Block pattern list.\n */\nexport function getBlockPatterns( state ) {\n\treturn state.blockPatterns;\n}\n\n/**\n * Retrieve the list of registered block pattern categories.\n *\n * @param {Object} state Data state.\n *\n * @return {Array} Block pattern category list.\n */\nexport function getBlockPatternCategories( state ) {\n\treturn state.blockPatternCategories;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|