@wordpress/core-data 7.2.0 → 7.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.
Files changed (131) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/README.md +54 -6
  3. package/build/actions.js +6 -6
  4. package/build/actions.js.map +1 -1
  5. package/build/entity-context.js +13 -0
  6. package/build/entity-context.js.map +1 -0
  7. package/build/entity-provider.js +4 -189
  8. package/build/entity-provider.js.map +1 -1
  9. package/build/entity-types/menu-location.js.map +1 -1
  10. package/build/entity-types/settings.js.map +1 -1
  11. package/build/entity-types/theme.js.map +1 -1
  12. package/build/entity-types/widget-type.js.map +1 -1
  13. package/build/hooks/index.js +22 -0
  14. package/build/hooks/index.js.map +1 -1
  15. package/build/hooks/use-entity-block-editor.js +140 -0
  16. package/build/hooks/use-entity-block-editor.js.map +1 -0
  17. package/build/hooks/use-entity-id.js +28 -0
  18. package/build/hooks/use-entity-id.js.map +1 -0
  19. package/build/hooks/use-entity-prop.js +65 -0
  20. package/build/hooks/use-entity-prop.js.map +1 -0
  21. package/build/hooks/use-resource-permissions.js +25 -8
  22. package/build/hooks/use-resource-permissions.js.map +1 -1
  23. package/build/resolvers.js +81 -70
  24. package/build/resolvers.js.map +1 -1
  25. package/build/selectors.js +23 -9
  26. package/build/selectors.js.map +1 -1
  27. package/build/utils/index.js +19 -0
  28. package/build/utils/index.js.map +1 -1
  29. package/build/utils/user-permissions.js +32 -0
  30. package/build/utils/user-permissions.js.map +1 -0
  31. package/build-module/actions.js +6 -6
  32. package/build-module/actions.js.map +1 -1
  33. package/build-module/entity-context.js +6 -0
  34. package/build-module/entity-context.js.map +1 -0
  35. package/build-module/entity-provider.js +3 -185
  36. package/build-module/entity-provider.js.map +1 -1
  37. package/build-module/entity-types/menu-location.js.map +1 -1
  38. package/build-module/entity-types/settings.js.map +1 -1
  39. package/build-module/entity-types/theme.js.map +1 -1
  40. package/build-module/entity-types/widget-type.js.map +1 -1
  41. package/build-module/hooks/index.js +3 -0
  42. package/build-module/hooks/index.js.map +1 -1
  43. package/build-module/hooks/use-entity-block-editor.js +132 -0
  44. package/build-module/hooks/use-entity-block-editor.js.map +1 -0
  45. package/build-module/hooks/use-entity-id.js +22 -0
  46. package/build-module/hooks/use-entity-id.js.map +1 -0
  47. package/build-module/hooks/use-entity-prop.js +58 -0
  48. package/build-module/hooks/use-entity-prop.js.map +1 -0
  49. package/build-module/hooks/use-resource-permissions.js +25 -8
  50. package/build-module/hooks/use-resource-permissions.js.map +1 -1
  51. package/build-module/resolvers.js +82 -71
  52. package/build-module/resolvers.js.map +1 -1
  53. package/build-module/selectors.js +24 -10
  54. package/build-module/selectors.js.map +1 -1
  55. package/build-module/utils/index.js +1 -0
  56. package/build-module/utils/index.js.map +1 -1
  57. package/build-module/utils/user-permissions.js +24 -0
  58. package/build-module/utils/user-permissions.js.map +1 -0
  59. package/build-types/actions.d.ts +3 -3
  60. package/build-types/actions.d.ts.map +1 -1
  61. package/build-types/batch/create-batch.d.ts.map +1 -1
  62. package/build-types/entities.d.ts.map +1 -1
  63. package/build-types/entity-context.d.ts +2 -0
  64. package/build-types/entity-context.d.ts.map +1 -0
  65. package/build-types/entity-provider.d.ts +0 -48
  66. package/build-types/entity-provider.d.ts.map +1 -1
  67. package/build-types/entity-types/menu-location.d.ts.map +1 -1
  68. package/build-types/entity-types/settings.d.ts.map +1 -1
  69. package/build-types/entity-types/theme.d.ts.map +1 -1
  70. package/build-types/entity-types/widget-type.d.ts.map +1 -1
  71. package/build-types/fetch/__experimental-fetch-url-data.d.ts.map +1 -1
  72. package/build-types/hooks/index.d.ts +3 -0
  73. package/build-types/hooks/index.d.ts.map +1 -1
  74. package/build-types/hooks/use-entity-block-editor.d.ts +22 -0
  75. package/build-types/hooks/use-entity-block-editor.d.ts.map +1 -0
  76. package/build-types/hooks/use-entity-id.d.ts +9 -0
  77. package/build-types/hooks/use-entity-id.d.ts.map +1 -0
  78. package/build-types/hooks/use-entity-prop.d.ts +19 -0
  79. package/build-types/hooks/use-entity-prop.d.ts.map +1 -0
  80. package/build-types/hooks/use-resource-permissions.d.ts +8 -70
  81. package/build-types/hooks/use-resource-permissions.d.ts.map +1 -1
  82. package/build-types/index.d.ts +35 -32
  83. package/build-types/index.d.ts.map +1 -1
  84. package/build-types/locks/reducer.d.ts +1 -1
  85. package/build-types/locks/reducer.d.ts.map +1 -1
  86. package/build-types/queried-data/actions.d.ts +1 -1
  87. package/build-types/queried-data/actions.d.ts.map +1 -1
  88. package/build-types/queried-data/get-query-parts.d.ts.map +1 -1
  89. package/build-types/queried-data/reducer.d.ts +1 -1
  90. package/build-types/queried-data/reducer.d.ts.map +1 -1
  91. package/build-types/queried-data/selectors.d.ts +0 -1
  92. package/build-types/queried-data/selectors.d.ts.map +1 -1
  93. package/build-types/reducer.d.ts +13 -13
  94. package/build-types/reducer.d.ts.map +1 -1
  95. package/build-types/resolvers.d.ts +3 -2
  96. package/build-types/resolvers.d.ts.map +1 -1
  97. package/build-types/selectors.d.ts +11 -6
  98. package/build-types/selectors.d.ts.map +1 -1
  99. package/build-types/utils/get-nested-value.d.ts.map +1 -1
  100. package/build-types/utils/get-normalized-comma-separable.d.ts.map +1 -1
  101. package/build-types/utils/if-matching-action.d.ts +1 -1
  102. package/build-types/utils/index.d.ts +1 -0
  103. package/build-types/utils/on-sub-key.d.ts +1 -1
  104. package/build-types/utils/replace-action.d.ts +1 -1
  105. package/build-types/utils/set-nested-value.d.ts.map +1 -1
  106. package/build-types/utils/user-permissions.d.ts +4 -0
  107. package/build-types/utils/user-permissions.d.ts.map +1 -0
  108. package/package.json +18 -17
  109. package/src/actions.js +6 -6
  110. package/src/entity-context.js +6 -0
  111. package/src/entity-provider.js +2 -211
  112. package/src/entity-types/menu-location.ts +1 -0
  113. package/src/entity-types/settings.ts +1 -0
  114. package/src/entity-types/theme.ts +1 -0
  115. package/src/entity-types/widget-type.ts +1 -0
  116. package/src/hooks/index.ts +3 -0
  117. package/src/hooks/test/use-entity-record.js +5 -3
  118. package/src/hooks/test/use-resource-permissions.js +96 -5
  119. package/src/hooks/use-entity-block-editor.js +148 -0
  120. package/src/hooks/use-entity-id.js +21 -0
  121. package/src/hooks/use-entity-prop.js +60 -0
  122. package/src/hooks/use-resource-permissions.ts +46 -9
  123. package/src/resolvers.js +102 -78
  124. package/src/selectors.ts +24 -9
  125. package/src/test/entity-provider.js +6 -2
  126. package/src/test/resolvers.js +221 -50
  127. package/src/test/selectors.js +18 -55
  128. package/src/utils/index.js +5 -0
  129. package/src/utils/user-permissions.js +39 -0
  130. package/tsconfig.json +2 -2
  131. package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 7.4.0 (2024-07-24)
6
+
7
+ ## 7.3.0 (2024-07-10)
8
+
5
9
  ## 7.2.0 (2024-06-26)
6
10
 
7
11
  ## 7.1.0 (2024-06-15)
package/README.md CHANGED
@@ -299,7 +299,7 @@ _Parameters_
299
299
  - _kind_ `string`: Kind of the entity.
300
300
  - _name_ `string`: Name of the entity.
301
301
  - _recordId_ `Object`: ID of the record.
302
- - _options_ `Object`: Saving options.
302
+ - _options_ `Object=`: Saving options.
303
303
 
304
304
  ### saveEntityRecord
305
305
 
@@ -339,7 +339,7 @@ _Parameters_
339
339
 
340
340
  - _state_ `State`: Data state.
341
341
  - _action_ `string`: Action to check. One of: 'create', 'read', 'update', 'delete'.
342
- - _resource_ `string`: REST resource to check, e.g. 'media' or 'posts'.
342
+ - _resource_ `string | EntityResource`: Entity resource to check. Accepts entity object `{ kind: 'root', name: 'media', id: 1 }` or REST base as a string - `media`.
343
343
  - _id_ `EntityRecordKey`: Optional ID of the rest resource to check.
344
344
 
345
345
  _Returns_
@@ -976,6 +976,47 @@ The following set of react hooks available to import from the `@wordpress/core-d
976
976
 
977
977
  <!-- START TOKEN(Autogenerated hooks|src/hooks/index.ts) -->
978
978
 
979
+ ### useEntityBlockEditor
980
+
981
+ Hook that returns block content getters and setters for the nearest provided entity of the specified type.
982
+
983
+ The return value has the shape `[ blocks, onInput, onChange ]`. `onInput` is for block changes that don't create undo levels or dirty the post, non-persistent changes, and `onChange` is for persistent changes. They map directly to the props of a `BlockEditorProvider` and are intended to be used with it, or similar components or hooks.
984
+
985
+ _Parameters_
986
+
987
+ - _kind_ `string`: The entity kind.
988
+ - _name_ `string`: The entity name.
989
+ - _options_ `Object`:
990
+ - _options.id_ `[string]`: An entity ID to use instead of the context-provided one.
991
+
992
+ _Returns_
993
+
994
+ - `[unknown[], Function, Function]`: The block array and setters.
995
+
996
+ ### useEntityId
997
+
998
+ Hook that returns the ID for the nearest provided entity of the specified type.
999
+
1000
+ _Parameters_
1001
+
1002
+ - _kind_ `string`: The entity kind.
1003
+ - _name_ `string`: The entity name.
1004
+
1005
+ ### useEntityProp
1006
+
1007
+ Hook that returns the value and a setter for the specified property of the nearest provided entity of the specified type.
1008
+
1009
+ _Parameters_
1010
+
1011
+ - _kind_ `string`: The entity kind.
1012
+ - _name_ `string`: The entity name.
1013
+ - _prop_ `string`: The property name.
1014
+ - _\_id_ `[string]`: An entity ID to use instead of the context-provided one.
1015
+
1016
+ _Returns_
1017
+
1018
+ - `[*, Function, *]`: An array where the first item is the property value, the second is the setter and the third is the full value object from REST API containing more information like `raw`, `rendered` and `protected` props.
1019
+
979
1020
  ### useEntityRecord
980
1021
 
981
1022
  Resolves the specified entity record.
@@ -1132,7 +1173,10 @@ _Usage_
1132
1173
  import { useResourcePermissions } from '@wordpress/core-data';
1133
1174
 
1134
1175
  function PagesList() {
1135
- const { canCreate, isResolving } = useResourcePermissions( 'pages' );
1176
+ const { canCreate, isResolving } = useResourcePermissions( {
1177
+ kind: 'postType',
1178
+ name: 'page',
1179
+ } );
1136
1180
 
1137
1181
  if ( isResolving ) {
1138
1182
  return 'Loading ...';
@@ -1155,7 +1199,11 @@ import { useResourcePermissions } from '@wordpress/core-data';
1155
1199
 
1156
1200
  function Page( { pageId } ) {
1157
1201
  const { canCreate, canUpdate, canDelete, isResolving } =
1158
- useResourcePermissions( 'pages', pageId );
1202
+ useResourcePermissions( {
1203
+ kind: 'postType',
1204
+ name: 'page',
1205
+ id: pageId,
1206
+ } );
1159
1207
 
1160
1208
  if ( isResolving ) {
1161
1209
  return 'Loading ...';
@@ -1181,8 +1229,8 @@ the store state using `canUser()`, or resolved if missing.
1181
1229
 
1182
1230
  _Parameters_
1183
1231
 
1184
- - _resource_ `string`: The resource in question, e.g. media.
1185
- - _id_ `IdType`: ID of a specific resource entry, if needed, e.g. 10.
1232
+ - _resource_ `string | EntityResource`: Entity resource to check. Accepts entity object `{ kind: 'root', name: 'media', id: 1 }` or REST base as a string - `media`.
1233
+ - _id_ `IdType`: Optional ID of the resource to check, e.g. 10. Note: This argument is discouraged when using an entity object as a resource to check permissions and will be ignored.
1186
1234
 
1187
1235
  _Returns_
1188
1236
 
package/build/actions.js CHANGED
@@ -291,7 +291,7 @@ const deleteEntityRecord = (kind, name, recordId, query, {
291
291
  const entityConfig = configs.find(config => config.kind === kind && config.name === name);
292
292
  let error;
293
293
  let deletedRecord = false;
294
- if (!entityConfig || entityConfig?.__experimentalNoFetch) {
294
+ if (!entityConfig) {
295
295
  return;
296
296
  }
297
297
  const lock = await dispatch.__unstableAcquireStoreLock(_name.STORE_NAME, ['entities', 'records', kind, name, recordId], {
@@ -484,7 +484,7 @@ const saveEntityRecord = (kind, name, record, {
484
484
  }) => {
485
485
  const configs = await dispatch((0, _entities.getOrLoadEntitiesConfig)(kind, name));
486
486
  const entityConfig = configs.find(config => config.kind === kind && config.name === name);
487
- if (!entityConfig || entityConfig?.__experimentalNoFetch) {
487
+ if (!entityConfig) {
488
488
  return;
489
489
  }
490
490
  const entityIdKey = entityConfig.key || _entities.DEFAULT_ENTITY_KEY;
@@ -672,10 +672,10 @@ const __experimentalBatch = requests => async ({
672
672
  /**
673
673
  * Action triggered to save an entity record's edits.
674
674
  *
675
- * @param {string} kind Kind of the entity.
676
- * @param {string} name Name of the entity.
677
- * @param {Object} recordId ID of the record.
678
- * @param {Object} options Saving options.
675
+ * @param {string} kind Kind of the entity.
676
+ * @param {string} name Name of the entity.
677
+ * @param {Object} recordId ID of the record.
678
+ * @param {Object=} options Saving options.
679
679
  */
680
680
  exports.__experimentalBatch = __experimentalBatch;
681
681
  const saveEditedEntityRecord = (kind, name, recordId, options) => async ({
@@ -1 +1 @@
1
- {"version":3,"names":["_es","_interopRequireDefault","require","_uuid","_apiFetch","_url","_deprecated","_utils","_queriedData","_entities","_batch","_name","_sync","receiveUserQuery","queryID","users","type","Array","isArray","receiveCurrentUser","currentUser","addEntities","entities","receiveEntityRecords","kind","name","records","query","invalidateCache","edits","meta","map","record","status","title","action","receiveQueriedItems","receiveItems","receiveCurrentTheme","currentTheme","__experimentalReceiveCurrentGlobalStylesId","currentGlobalStylesId","id","__experimentalReceiveThemeBaseGlobalStyles","stylesheet","globalStyles","__experimentalReceiveThemeGlobalStyleVariations","variations","receiveThemeSupports","deprecated","since","receiveThemeGlobalStyleRevisions","currentId","revisions","alternative","receiveEmbedPreview","url","preview","deleteEntityRecord","recordId","__unstableFetch","apiFetch","throwOnError","dispatch","configs","getOrLoadEntitiesConfig","entityConfig","find","config","error","deletedRecord","__experimentalNoFetch","lock","__unstableAcquireStoreLock","STORE_NAME","exclusive","hasError","path","baseURL","addQueryArgs","method","removeItems","_error","__unstableReleaseStoreLock","exports","editEntityRecord","options","select","getEntityConfig","Error","mergedEdits","getRawEntityRecord","editedRecord","getEditedEntityRecord","edit","Object","keys","reduce","acc","key","recordValue","editedRecordValue","value","fastDeepEqual","undefined","window","__experimentalEnableSync","syncConfig","globalThis","IS_GUTENBERG_PLUGIN","objectId","getSyncObjectId","getSyncProvider","update","syncObjectType","undoIgnore","getUndoManager","addRecord","changes","from","to","isCached","undo","undoRecord","redo","redoRecord","__unstableCreateUndoLevel","saveEntityRecord","isAutosave","resolveSelect","entityIdKey","DEFAULT_ENTITY_KEY","uuid","entries","evaluatedValue","updatedRecord","persistedRecord","getCurrentUser","currentUserId","autosavePost","getAutosave","data","includes","newRecord","receiveAutosaves","__unstablePrePersist","__experimentalBatch","requests","batch","createBatch","api","add","saveEditedEntityRecord","resultPromises","request","results","Promise","all","run","hasEditsForEntityRecord","getEntityRecordNonTransientEdits","__experimentalSaveSpecifiedEntityEdits","itemsToSave","editsToSave","item","setNestedValue","getNestedValue","receiveUploadPermissions","hasUploadPermissions","receiveUserPermission","isAllowed","postId","autosaves","receiveNavigationFallbackId","fallbackId","receiveDefaultTemplateId","templateId","receiveRevisions","recordKey","revisionKey","items"],"sources":["@wordpress/core-data/src/actions.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\nimport { v4 as uuid } from 'uuid';\n\n/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { getNestedValue, setNestedValue } from './utils';\nimport { receiveItems, removeItems, receiveQueriedItems } from './queried-data';\nimport { getOrLoadEntitiesConfig, DEFAULT_ENTITY_KEY } from './entities';\nimport { createBatch } from './batch';\nimport { STORE_NAME } from './name';\nimport { getSyncProvider } from './sync';\n\n/**\n * Returns an action object used in signalling that authors have been received.\n * Ignored from documentation as it's internal to the data store.\n *\n * @ignore\n *\n * @param {string} queryID Query ID.\n * @param {Array|Object} users Users received.\n *\n * @return {Object} Action object.\n */\nexport function receiveUserQuery( queryID, users ) {\n\treturn {\n\t\ttype: 'RECEIVE_USER_QUERY',\n\t\tusers: Array.isArray( users ) ? users : [ users ],\n\t\tqueryID,\n\t};\n}\n\n/**\n * Returns an action used in signalling that the current user has been received.\n * Ignored from documentation as it's internal to the data store.\n *\n * @ignore\n *\n * @param {Object} currentUser Current user object.\n *\n * @return {Object} Action object.\n */\nexport function receiveCurrentUser( currentUser ) {\n\treturn {\n\t\ttype: 'RECEIVE_CURRENT_USER',\n\t\tcurrentUser,\n\t};\n}\n\n/**\n * Returns an action object used in adding new entities.\n *\n * @param {Array} entities Entities received.\n *\n * @return {Object} Action object.\n */\nexport function addEntities( entities ) {\n\treturn {\n\t\ttype: 'ADD_ENTITIES',\n\t\tentities,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that entity records have been received.\n *\n * @param {string} kind Kind of the received entity record.\n * @param {string} name Name of the received entity record.\n * @param {Array|Object} records Records received.\n * @param {?Object} query Query Object.\n * @param {?boolean} invalidateCache Should invalidate query caches.\n * @param {?Object} edits Edits to reset.\n * @param {?Object} meta Meta information about pagination.\n * @return {Object} Action object.\n */\nexport function receiveEntityRecords(\n\tkind,\n\tname,\n\trecords,\n\tquery,\n\tinvalidateCache = false,\n\tedits,\n\tmeta\n) {\n\t// Auto drafts should not have titles, but some plugins rely on them so we can't filter this\n\t// on the server.\n\tif ( kind === 'postType' ) {\n\t\trecords = ( Array.isArray( records ) ? records : [ records ] ).map(\n\t\t\t( record ) =>\n\t\t\t\trecord.status === 'auto-draft'\n\t\t\t\t\t? { ...record, title: '' }\n\t\t\t\t\t: record\n\t\t);\n\t}\n\tlet action;\n\tif ( query ) {\n\t\taction = receiveQueriedItems( records, query, edits, meta );\n\t} else {\n\t\taction = receiveItems( records, edits, meta );\n\t}\n\n\treturn {\n\t\t...action,\n\t\tkind,\n\t\tname,\n\t\tinvalidateCache,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the current theme has been received.\n * Ignored from documentation as it's internal to the data store.\n *\n * @ignore\n *\n * @param {Object} currentTheme The current theme.\n *\n * @return {Object} Action object.\n */\nexport function receiveCurrentTheme( currentTheme ) {\n\treturn {\n\t\ttype: 'RECEIVE_CURRENT_THEME',\n\t\tcurrentTheme,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the current global styles id has been received.\n * Ignored from documentation as it's internal to the data store.\n *\n * @ignore\n *\n * @param {string} currentGlobalStylesId The current global styles id.\n *\n * @return {Object} Action object.\n */\nexport function __experimentalReceiveCurrentGlobalStylesId(\n\tcurrentGlobalStylesId\n) {\n\treturn {\n\t\ttype: 'RECEIVE_CURRENT_GLOBAL_STYLES_ID',\n\t\tid: currentGlobalStylesId,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the theme base global styles have been received\n * Ignored from documentation as it's internal to the data store.\n *\n * @ignore\n *\n * @param {string} stylesheet The theme's identifier\n * @param {Object} globalStyles The global styles object.\n *\n * @return {Object} Action object.\n */\nexport function __experimentalReceiveThemeBaseGlobalStyles(\n\tstylesheet,\n\tglobalStyles\n) {\n\treturn {\n\t\ttype: 'RECEIVE_THEME_GLOBAL_STYLES',\n\t\tstylesheet,\n\t\tglobalStyles,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the theme global styles variations have been received.\n * Ignored from documentation as it's internal to the data store.\n *\n * @ignore\n *\n * @param {string} stylesheet The theme's identifier\n * @param {Array} variations The global styles variations.\n *\n * @return {Object} Action object.\n */\nexport function __experimentalReceiveThemeGlobalStyleVariations(\n\tstylesheet,\n\tvariations\n) {\n\treturn {\n\t\ttype: 'RECEIVE_THEME_GLOBAL_STYLE_VARIATIONS',\n\t\tstylesheet,\n\t\tvariations,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the index has been received.\n *\n * @deprecated since WP 5.9, this is not useful anymore, use the selector direclty.\n *\n * @return {Object} Action object.\n */\nexport function receiveThemeSupports() {\n\tdeprecated( \"wp.data.dispatch( 'core' ).receiveThemeSupports\", {\n\t\tsince: '5.9',\n\t} );\n\n\treturn {\n\t\ttype: 'DO_NOTHING',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the theme global styles CPT post revisions have been received.\n * Ignored from documentation as it's internal to the data store.\n *\n * @deprecated since WordPress 6.5.0. Callers should use `dispatch( 'core' ).receiveRevision` instead.\n *\n * @ignore\n *\n * @param {number} currentId The post id.\n * @param {Array} revisions The global styles revisions.\n *\n * @return {Object} Action object.\n */\nexport function receiveThemeGlobalStyleRevisions( currentId, revisions ) {\n\tdeprecated(\n\t\t\"wp.data.dispatch( 'core' ).receiveThemeGlobalStyleRevisions()\",\n\t\t{\n\t\t\tsince: '6.5.0',\n\t\t\talternative: \"wp.data.dispatch( 'core' ).receiveRevisions\",\n\t\t}\n\t);\n\treturn {\n\t\ttype: 'RECEIVE_THEME_GLOBAL_STYLE_REVISIONS',\n\t\tcurrentId,\n\t\trevisions,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the preview data for\n * a given URl has been received.\n * Ignored from documentation as it's internal to the data store.\n *\n * @ignore\n *\n * @param {string} url URL to preview the embed for.\n * @param {*} preview Preview data.\n *\n * @return {Object} Action object.\n */\nexport function receiveEmbedPreview( url, preview ) {\n\treturn {\n\t\ttype: 'RECEIVE_EMBED_PREVIEW',\n\t\turl,\n\t\tpreview,\n\t};\n}\n\n/**\n * Action triggered to delete an entity record.\n *\n * @param {string} kind Kind of the deleted entity.\n * @param {string} name Name of the deleted entity.\n * @param {string} recordId Record ID of the deleted entity.\n * @param {?Object} query Special query parameters for the\n * DELETE API call.\n * @param {Object} [options] Delete options.\n * @param {Function} [options.__unstableFetch] Internal use only. Function to\n * call instead of `apiFetch()`.\n * Must return a promise.\n * @param {boolean} [options.throwOnError=false] If false, this action suppresses all\n * the exceptions. Defaults to false.\n */\nexport const deleteEntityRecord =\n\t(\n\t\tkind,\n\t\tname,\n\t\trecordId,\n\t\tquery,\n\t\t{ __unstableFetch = apiFetch, throwOnError = false } = {}\n\t) =>\n\tasync ( { dispatch } ) => {\n\t\tconst configs = await dispatch( getOrLoadEntitiesConfig( kind, name ) );\n\t\tconst entityConfig = configs.find(\n\t\t\t( config ) => config.kind === kind && config.name === name\n\t\t);\n\t\tlet error;\n\t\tlet deletedRecord = false;\n\t\tif ( ! entityConfig || entityConfig?.__experimentalNoFetch ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst lock = await dispatch.__unstableAcquireStoreLock(\n\t\t\tSTORE_NAME,\n\t\t\t[ 'entities', 'records', kind, name, recordId ],\n\t\t\t{ exclusive: true }\n\t\t);\n\n\t\ttry {\n\t\t\tdispatch( {\n\t\t\t\ttype: 'DELETE_ENTITY_RECORD_START',\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\trecordId,\n\t\t\t} );\n\n\t\t\tlet hasError = false;\n\t\t\ttry {\n\t\t\t\tlet path = `${ entityConfig.baseURL }/${ recordId }`;\n\n\t\t\t\tif ( query ) {\n\t\t\t\t\tpath = addQueryArgs( path, query );\n\t\t\t\t}\n\n\t\t\t\tdeletedRecord = await __unstableFetch( {\n\t\t\t\t\tpath,\n\t\t\t\t\tmethod: 'DELETE',\n\t\t\t\t} );\n\n\t\t\t\tawait dispatch( removeItems( kind, name, recordId, true ) );\n\t\t\t} catch ( _error ) {\n\t\t\t\thasError = true;\n\t\t\t\terror = _error;\n\t\t\t}\n\n\t\t\tdispatch( {\n\t\t\t\ttype: 'DELETE_ENTITY_RECORD_FINISH',\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\trecordId,\n\t\t\t\terror,\n\t\t\t} );\n\n\t\t\tif ( hasError && throwOnError ) {\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\treturn deletedRecord;\n\t\t} finally {\n\t\t\tdispatch.__unstableReleaseStoreLock( lock );\n\t\t}\n\t};\n\n/**\n * Returns an action object that triggers an\n * edit to an entity record.\n *\n * @param {string} kind Kind of the edited entity record.\n * @param {string} name Name of the edited entity record.\n * @param {number|string} recordId Record ID of the edited entity record.\n * @param {Object} edits The edits.\n * @param {Object} options Options for the edit.\n * @param {boolean} [options.undoIgnore] Whether to ignore the edit in undo history or not.\n *\n * @return {Object} Action object.\n */\nexport const editEntityRecord =\n\t( kind, name, recordId, edits, options = {} ) =>\n\t( { select, dispatch } ) => {\n\t\tconst entityConfig = select.getEntityConfig( kind, name );\n\t\tif ( ! entityConfig ) {\n\t\t\tthrow new Error(\n\t\t\t\t`The entity being edited (${ kind }, ${ name }) does not have a loaded config.`\n\t\t\t);\n\t\t}\n\t\tconst { mergedEdits = {} } = entityConfig;\n\t\tconst record = select.getRawEntityRecord( kind, name, recordId );\n\t\tconst editedRecord = select.getEditedEntityRecord(\n\t\t\tkind,\n\t\t\tname,\n\t\t\trecordId\n\t\t);\n\n\t\tconst edit = {\n\t\t\tkind,\n\t\t\tname,\n\t\t\trecordId,\n\t\t\t// Clear edits when they are equal to their persisted counterparts\n\t\t\t// so that the property is not considered dirty.\n\t\t\tedits: Object.keys( edits ).reduce( ( acc, key ) => {\n\t\t\t\tconst recordValue = record[ key ];\n\t\t\t\tconst editedRecordValue = editedRecord[ key ];\n\t\t\t\tconst value = mergedEdits[ key ]\n\t\t\t\t\t? { ...editedRecordValue, ...edits[ key ] }\n\t\t\t\t\t: edits[ key ];\n\t\t\t\tacc[ key ] = fastDeepEqual( recordValue, value )\n\t\t\t\t\t? undefined\n\t\t\t\t\t: value;\n\t\t\t\treturn acc;\n\t\t\t}, {} ),\n\t\t};\n\t\tif ( window.__experimentalEnableSync && entityConfig.syncConfig ) {\n\t\t\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t\t\tconst objectId = entityConfig.getSyncObjectId( recordId );\n\t\t\t\tgetSyncProvider().update(\n\t\t\t\t\tentityConfig.syncObjectType + '--edit',\n\t\t\t\t\tobjectId,\n\t\t\t\t\tedit.edits\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\tif ( ! options.undoIgnore ) {\n\t\t\t\tselect.getUndoManager().addRecord(\n\t\t\t\t\t[\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: { kind, name, recordId },\n\t\t\t\t\t\t\tchanges: Object.keys( edits ).reduce(\n\t\t\t\t\t\t\t\t( acc, key ) => {\n\t\t\t\t\t\t\t\t\tacc[ key ] = {\n\t\t\t\t\t\t\t\t\t\tfrom: editedRecord[ key ],\n\t\t\t\t\t\t\t\t\t\tto: edits[ key ],\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\treturn acc;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{}\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\toptions.isCached\n\t\t\t\t);\n\t\t\t}\n\t\t\tdispatch( {\n\t\t\t\ttype: 'EDIT_ENTITY_RECORD',\n\t\t\t\t...edit,\n\t\t\t} );\n\t\t}\n\t};\n\n/**\n * Action triggered to undo the last edit to\n * an entity record, if any.\n */\nexport const undo =\n\t() =>\n\t( { select, dispatch } ) => {\n\t\tconst undoRecord = select.getUndoManager().undo();\n\t\tif ( ! undoRecord ) {\n\t\t\treturn;\n\t\t}\n\t\tdispatch( {\n\t\t\ttype: 'UNDO',\n\t\t\trecord: undoRecord,\n\t\t} );\n\t};\n\n/**\n * Action triggered to redo the last undoed\n * edit to an entity record, if any.\n */\nexport const redo =\n\t() =>\n\t( { select, dispatch } ) => {\n\t\tconst redoRecord = select.getUndoManager().redo();\n\t\tif ( ! redoRecord ) {\n\t\t\treturn;\n\t\t}\n\t\tdispatch( {\n\t\t\ttype: 'REDO',\n\t\t\trecord: redoRecord,\n\t\t} );\n\t};\n\n/**\n * Forces the creation of a new undo level.\n *\n * @return {Object} Action object.\n */\nexport const __unstableCreateUndoLevel =\n\t() =>\n\t( { select } ) => {\n\t\tselect.getUndoManager().addRecord();\n\t};\n\n/**\n * Action triggered to save an entity record.\n *\n * @param {string} kind Kind of the received entity.\n * @param {string} name Name of the received entity.\n * @param {Object} record Record to be saved.\n * @param {Object} options Saving options.\n * @param {boolean} [options.isAutosave=false] Whether this is an autosave.\n * @param {Function} [options.__unstableFetch] Internal use only. Function to\n * call instead of `apiFetch()`.\n * Must return a promise.\n * @param {boolean} [options.throwOnError=false] If false, this action suppresses all\n * the exceptions. Defaults to false.\n */\nexport const saveEntityRecord =\n\t(\n\t\tkind,\n\t\tname,\n\t\trecord,\n\t\t{\n\t\t\tisAutosave = false,\n\t\t\t__unstableFetch = apiFetch,\n\t\t\tthrowOnError = false,\n\t\t} = {}\n\t) =>\n\tasync ( { select, resolveSelect, dispatch } ) => {\n\t\tconst configs = await dispatch( getOrLoadEntitiesConfig( kind, name ) );\n\t\tconst entityConfig = configs.find(\n\t\t\t( config ) => config.kind === kind && config.name === name\n\t\t);\n\t\tif ( ! entityConfig || entityConfig?.__experimentalNoFetch ) {\n\t\t\treturn;\n\t\t}\n\t\tconst entityIdKey = entityConfig.key || DEFAULT_ENTITY_KEY;\n\t\tconst recordId = record[ entityIdKey ];\n\n\t\tconst lock = await dispatch.__unstableAcquireStoreLock(\n\t\t\tSTORE_NAME,\n\t\t\t[ 'entities', 'records', kind, name, recordId || uuid() ],\n\t\t\t{ exclusive: true }\n\t\t);\n\n\t\ttry {\n\t\t\t// Evaluate optimized edits.\n\t\t\t// (Function edits that should be evaluated on save to avoid expensive computations on every edit.)\n\t\t\tfor ( const [ key, value ] of Object.entries( record ) ) {\n\t\t\t\tif ( typeof value === 'function' ) {\n\t\t\t\t\tconst evaluatedValue = value(\n\t\t\t\t\t\tselect.getEditedEntityRecord( kind, name, recordId )\n\t\t\t\t\t);\n\t\t\t\t\tdispatch.editEntityRecord(\n\t\t\t\t\t\tkind,\n\t\t\t\t\t\tname,\n\t\t\t\t\t\trecordId,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t[ key ]: evaluatedValue,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{ undoIgnore: true }\n\t\t\t\t\t);\n\t\t\t\t\trecord[ key ] = evaluatedValue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdispatch( {\n\t\t\t\ttype: 'SAVE_ENTITY_RECORD_START',\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\trecordId,\n\t\t\t\tisAutosave,\n\t\t\t} );\n\t\t\tlet updatedRecord;\n\t\t\tlet error;\n\t\t\tlet hasError = false;\n\t\t\ttry {\n\t\t\t\tconst path = `${ entityConfig.baseURL }${\n\t\t\t\t\trecordId ? '/' + recordId : ''\n\t\t\t\t}`;\n\t\t\t\tconst persistedRecord = select.getRawEntityRecord(\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\trecordId\n\t\t\t\t);\n\n\t\t\t\tif ( isAutosave ) {\n\t\t\t\t\t// Most of this autosave logic is very specific to posts.\n\t\t\t\t\t// This is fine for now as it is the only supported autosave,\n\t\t\t\t\t// but ideally this should all be handled in the back end,\n\t\t\t\t\t// so the client just sends and receives objects.\n\t\t\t\t\tconst currentUser = select.getCurrentUser();\n\t\t\t\t\tconst currentUserId = currentUser\n\t\t\t\t\t\t? currentUser.id\n\t\t\t\t\t\t: undefined;\n\t\t\t\t\tconst autosavePost = await resolveSelect.getAutosave(\n\t\t\t\t\t\tpersistedRecord.type,\n\t\t\t\t\t\tpersistedRecord.id,\n\t\t\t\t\t\tcurrentUserId\n\t\t\t\t\t);\n\t\t\t\t\t// Autosaves need all expected fields to be present.\n\t\t\t\t\t// So we fallback to the previous autosave and then\n\t\t\t\t\t// to the actual persisted entity if the edits don't\n\t\t\t\t\t// have a value.\n\t\t\t\t\tlet data = {\n\t\t\t\t\t\t...persistedRecord,\n\t\t\t\t\t\t...autosavePost,\n\t\t\t\t\t\t...record,\n\t\t\t\t\t};\n\t\t\t\t\tdata = Object.keys( data ).reduce(\n\t\t\t\t\t\t( acc, key ) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t'title',\n\t\t\t\t\t\t\t\t\t'excerpt',\n\t\t\t\t\t\t\t\t\t'content',\n\t\t\t\t\t\t\t\t\t'meta',\n\t\t\t\t\t\t\t\t].includes( key )\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tacc[ key ] = data[ key ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn acc;\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Do not update the `status` if we have edited it when auto saving.\n\t\t\t\t\t\t\t// It's very important to let the user explicitly save this change,\n\t\t\t\t\t\t\t// because it can lead to unexpected results. An example would be to\n\t\t\t\t\t\t\t// have a draft post and change the status to publish.\n\t\t\t\t\t\t\tstatus:\n\t\t\t\t\t\t\t\tdata.status === 'auto-draft'\n\t\t\t\t\t\t\t\t\t? 'draft'\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\tupdatedRecord = await __unstableFetch( {\n\t\t\t\t\t\tpath: `${ path }/autosaves`,\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\tdata,\n\t\t\t\t\t} );\n\n\t\t\t\t\t// An autosave may be processed by the server as a regular save\n\t\t\t\t\t// when its update is requested by the author and the post had\n\t\t\t\t\t// draft or auto-draft status.\n\t\t\t\t\tif ( persistedRecord.id === updatedRecord.id ) {\n\t\t\t\t\t\tlet newRecord = {\n\t\t\t\t\t\t\t...persistedRecord,\n\t\t\t\t\t\t\t...data,\n\t\t\t\t\t\t\t...updatedRecord,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tnewRecord = Object.keys( newRecord ).reduce(\n\t\t\t\t\t\t\t( acc, key ) => {\n\t\t\t\t\t\t\t\t// These properties are persisted in autosaves.\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t[ 'title', 'excerpt', 'content' ].includes(\n\t\t\t\t\t\t\t\t\t\tkey\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tacc[ key ] = newRecord[ key ];\n\t\t\t\t\t\t\t\t} else if ( key === 'status' ) {\n\t\t\t\t\t\t\t\t\t// Status is only persisted in autosaves when going from\n\t\t\t\t\t\t\t\t\t// \"auto-draft\" to \"draft\".\n\t\t\t\t\t\t\t\t\tacc[ key ] =\n\t\t\t\t\t\t\t\t\t\tpersistedRecord.status ===\n\t\t\t\t\t\t\t\t\t\t\t'auto-draft' &&\n\t\t\t\t\t\t\t\t\t\tnewRecord.status === 'draft'\n\t\t\t\t\t\t\t\t\t\t\t? newRecord.status\n\t\t\t\t\t\t\t\t\t\t\t: persistedRecord.status;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t// These properties are not persisted in autosaves.\n\t\t\t\t\t\t\t\t\tacc[ key ] = persistedRecord[ key ];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn acc;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{}\n\t\t\t\t\t\t);\n\t\t\t\t\t\tdispatch.receiveEntityRecords(\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tnewRecord,\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdispatch.receiveAutosaves(\n\t\t\t\t\t\t\tpersistedRecord.id,\n\t\t\t\t\t\t\tupdatedRecord\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tlet edits = record;\n\t\t\t\t\tif ( entityConfig.__unstablePrePersist ) {\n\t\t\t\t\t\tedits = {\n\t\t\t\t\t\t\t...edits,\n\t\t\t\t\t\t\t...entityConfig.__unstablePrePersist(\n\t\t\t\t\t\t\t\tpersistedRecord,\n\t\t\t\t\t\t\t\tedits\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\tupdatedRecord = await __unstableFetch( {\n\t\t\t\t\t\tpath,\n\t\t\t\t\t\tmethod: recordId ? 'PUT' : 'POST',\n\t\t\t\t\t\tdata: edits,\n\t\t\t\t\t} );\n\t\t\t\t\tdispatch.receiveEntityRecords(\n\t\t\t\t\t\tkind,\n\t\t\t\t\t\tname,\n\t\t\t\t\t\tupdatedRecord,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\tedits\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} catch ( _error ) {\n\t\t\t\thasError = true;\n\t\t\t\terror = _error;\n\t\t\t}\n\t\t\tdispatch( {\n\t\t\t\ttype: 'SAVE_ENTITY_RECORD_FINISH',\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\trecordId,\n\t\t\t\terror,\n\t\t\t\tisAutosave,\n\t\t\t} );\n\n\t\t\tif ( hasError && throwOnError ) {\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\treturn updatedRecord;\n\t\t} finally {\n\t\t\tdispatch.__unstableReleaseStoreLock( lock );\n\t\t}\n\t};\n\n/**\n * Runs multiple core-data actions at the same time using one API request.\n *\n * Example:\n *\n * ```\n * const [ savedRecord, updatedRecord, deletedRecord ] =\n * await dispatch( 'core' ).__experimentalBatch( [\n * ( { saveEntityRecord } ) => saveEntityRecord( 'root', 'widget', widget ),\n * ( { saveEditedEntityRecord } ) => saveEntityRecord( 'root', 'widget', 123 ),\n * ( { deleteEntityRecord } ) => deleteEntityRecord( 'root', 'widget', 123, null ),\n * ] );\n * ```\n *\n * @param {Array} requests Array of functions which are invoked simultaneously.\n * Each function is passed an object containing\n * `saveEntityRecord`, `saveEditedEntityRecord`, and\n * `deleteEntityRecord`.\n *\n * @return {(thunkArgs: Object) => Promise} A promise that resolves to an array containing the return\n * values of each function given in `requests`.\n */\nexport const __experimentalBatch =\n\t( requests ) =>\n\tasync ( { dispatch } ) => {\n\t\tconst batch = createBatch();\n\t\tconst api = {\n\t\t\tsaveEntityRecord( kind, name, record, options ) {\n\t\t\t\treturn batch.add( ( add ) =>\n\t\t\t\t\tdispatch.saveEntityRecord( kind, name, record, {\n\t\t\t\t\t\t...options,\n\t\t\t\t\t\t__unstableFetch: add,\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t},\n\t\t\tsaveEditedEntityRecord( kind, name, recordId, options ) {\n\t\t\t\treturn batch.add( ( add ) =>\n\t\t\t\t\tdispatch.saveEditedEntityRecord( kind, name, recordId, {\n\t\t\t\t\t\t...options,\n\t\t\t\t\t\t__unstableFetch: add,\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t},\n\t\t\tdeleteEntityRecord( kind, name, recordId, query, options ) {\n\t\t\t\treturn batch.add( ( add ) =>\n\t\t\t\t\tdispatch.deleteEntityRecord( kind, name, recordId, query, {\n\t\t\t\t\t\t...options,\n\t\t\t\t\t\t__unstableFetch: add,\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t},\n\t\t};\n\t\tconst resultPromises = requests.map( ( request ) => request( api ) );\n\t\tconst [ , ...results ] = await Promise.all( [\n\t\t\tbatch.run(),\n\t\t\t...resultPromises,\n\t\t] );\n\t\treturn results;\n\t};\n\n/**\n * Action triggered to save an entity record's edits.\n *\n * @param {string} kind Kind of the entity.\n * @param {string} name Name of the entity.\n * @param {Object} recordId ID of the record.\n * @param {Object} options Saving options.\n */\nexport const saveEditedEntityRecord =\n\t( kind, name, recordId, options ) =>\n\tasync ( { select, dispatch } ) => {\n\t\tif ( ! select.hasEditsForEntityRecord( kind, name, recordId ) ) {\n\t\t\treturn;\n\t\t}\n\t\tconst configs = await dispatch( getOrLoadEntitiesConfig( kind, name ) );\n\t\tconst entityConfig = configs.find(\n\t\t\t( config ) => config.kind === kind && config.name === name\n\t\t);\n\t\tif ( ! entityConfig ) {\n\t\t\treturn;\n\t\t}\n\t\tconst entityIdKey = entityConfig.key || DEFAULT_ENTITY_KEY;\n\n\t\tconst edits = select.getEntityRecordNonTransientEdits(\n\t\t\tkind,\n\t\t\tname,\n\t\t\trecordId\n\t\t);\n\t\tconst record = { [ entityIdKey ]: recordId, ...edits };\n\t\treturn await dispatch.saveEntityRecord( kind, name, record, options );\n\t};\n\n/**\n * Action triggered to save only specified properties for the entity.\n *\n * @param {string} kind Kind of the entity.\n * @param {string} name Name of the entity.\n * @param {Object} recordId ID of the record.\n * @param {Array} itemsToSave List of entity properties or property paths to save.\n * @param {Object} options Saving options.\n */\nexport const __experimentalSaveSpecifiedEntityEdits =\n\t( kind, name, recordId, itemsToSave, options ) =>\n\tasync ( { select, dispatch } ) => {\n\t\tif ( ! select.hasEditsForEntityRecord( kind, name, recordId ) ) {\n\t\t\treturn;\n\t\t}\n\t\tconst edits = select.getEntityRecordNonTransientEdits(\n\t\t\tkind,\n\t\t\tname,\n\t\t\trecordId\n\t\t);\n\t\tconst editsToSave = {};\n\n\t\tfor ( const item of itemsToSave ) {\n\t\t\tsetNestedValue( editsToSave, item, getNestedValue( edits, item ) );\n\t\t}\n\n\t\tconst configs = await dispatch( getOrLoadEntitiesConfig( kind, name ) );\n\t\tconst entityConfig = configs.find(\n\t\t\t( config ) => config.kind === kind && config.name === name\n\t\t);\n\n\t\tconst entityIdKey = entityConfig?.key || DEFAULT_ENTITY_KEY;\n\n\t\t// If a record key is provided then update the existing record.\n\t\t// This necessitates providing `recordKey` to saveEntityRecord as part of the\n\t\t// `record` argument (here called `editsToSave`) to stop that action creating\n\t\t// a new record and instead cause it to update the existing record.\n\t\tif ( recordId ) {\n\t\t\teditsToSave[ entityIdKey ] = recordId;\n\t\t}\n\t\treturn await dispatch.saveEntityRecord(\n\t\t\tkind,\n\t\t\tname,\n\t\t\teditsToSave,\n\t\t\toptions\n\t\t);\n\t};\n\n/**\n * Returns an action object used in signalling that Upload permissions have been received.\n *\n * @deprecated since WP 5.9, use receiveUserPermission instead.\n *\n * @param {boolean} hasUploadPermissions Does the user have permission to upload files?\n *\n * @return {Object} Action object.\n */\nexport function receiveUploadPermissions( hasUploadPermissions ) {\n\tdeprecated( \"wp.data.dispatch( 'core' ).receiveUploadPermissions\", {\n\t\tsince: '5.9',\n\t\talternative: 'receiveUserPermission',\n\t} );\n\n\treturn receiveUserPermission( 'create/media', hasUploadPermissions );\n}\n\n/**\n * Returns an action object used in signalling that the current user has\n * permission to perform an action on a REST resource.\n * Ignored from documentation as it's internal to the data store.\n *\n * @ignore\n *\n * @param {string} key A key that represents the action and REST resource.\n * @param {boolean} isAllowed Whether or not the user can perform the action.\n *\n * @return {Object} Action object.\n */\nexport function receiveUserPermission( key, isAllowed ) {\n\treturn {\n\t\ttype: 'RECEIVE_USER_PERMISSION',\n\t\tkey,\n\t\tisAllowed,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the autosaves for a\n * post have been received.\n * Ignored from documentation as it's internal to the data store.\n *\n * @ignore\n *\n * @param {number} postId The id of the post that is parent to the autosave.\n * @param {Array|Object} autosaves An array of autosaves or singular autosave object.\n *\n * @return {Object} Action object.\n */\nexport function receiveAutosaves( postId, autosaves ) {\n\treturn {\n\t\ttype: 'RECEIVE_AUTOSAVES',\n\t\tpostId,\n\t\tautosaves: Array.isArray( autosaves ) ? autosaves : [ autosaves ],\n\t};\n}\n\n/**\n * Returns an action object signalling that the fallback Navigation\n * Menu id has been received.\n *\n * @param {integer} fallbackId the id of the fallback Navigation Menu\n * @return {Object} Action object.\n */\nexport function receiveNavigationFallbackId( fallbackId ) {\n\treturn {\n\t\ttype: 'RECEIVE_NAVIGATION_FALLBACK_ID',\n\t\tfallbackId,\n\t};\n}\n\n/**\n * Returns an action object used to set the template for a given query.\n *\n * @param {Object} query The lookup query.\n * @param {string} templateId The resolved template id.\n *\n * @return {Object} Action object.\n */\nexport function receiveDefaultTemplateId( query, templateId ) {\n\treturn {\n\t\ttype: 'RECEIVE_DEFAULT_TEMPLATE',\n\t\tquery,\n\t\ttemplateId,\n\t};\n}\n\n/**\n * Action triggered to receive revision items.\n *\n * @param {string} kind Kind of the received entity record revisions.\n * @param {string} name Name of the received entity record revisions.\n * @param {number|string} recordKey The key of the entity record whose revisions you want to fetch.\n * @param {Array|Object} records Revisions received.\n * @param {?Object} query Query Object.\n * @param {?boolean} invalidateCache Should invalidate query caches.\n * @param {?Object} meta Meta information about pagination.\n */\nexport const receiveRevisions =\n\t( kind, name, recordKey, records, query, invalidateCache = false, meta ) =>\n\tasync ( { dispatch } ) => {\n\t\tconst configs = await dispatch( getOrLoadEntitiesConfig( kind, name ) );\n\t\tconst entityConfig = configs.find(\n\t\t\t( config ) => config.kind === kind && config.name === name\n\t\t);\n\t\tconst key =\n\t\t\tentityConfig && entityConfig?.revisionKey\n\t\t\t\t? entityConfig.revisionKey\n\t\t\t\t: DEFAULT_ENTITY_KEY;\n\n\t\tdispatch( {\n\t\t\ttype: 'RECEIVE_ITEM_REVISIONS',\n\t\t\tkey,\n\t\t\titems: Array.isArray( records ) ? records : [ records ],\n\t\t\trecordKey,\n\t\t\tmeta,\n\t\t\tquery,\n\t\t\tkind,\n\t\t\tname,\n\t\t\tinvalidateCache,\n\t\t} );\n\t};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,SAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAL,sBAAA,CAAAC,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,KAAA,GAAAT,OAAA;AACA,IAAAU,KAAA,GAAAV,OAAA;AArBA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASW,gBAAgBA,CAAEC,OAAO,EAAEC,KAAK,EAAG;EAClD,OAAO;IACNC,IAAI,EAAE,oBAAoB;IAC1BD,KAAK,EAAEE,KAAK,CAACC,OAAO,CAAEH,KAAM,CAAC,GAAGA,KAAK,GAAG,CAAEA,KAAK,CAAE;IACjDD;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASK,kBAAkBA,CAAEC,WAAW,EAAG;EACjD,OAAO;IACNJ,IAAI,EAAE,sBAAsB;IAC5BI;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,0CAA0CA,CACzDC,UAAU,EACVC,YAAY,EACX;EACD,OAAO;IACN7B,IAAI,EAAE,6BAA6B;IACnC4B,UAAU;IACVC;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,+CAA+CA,CAC9DF,UAAU,EACVG,UAAU,EACT;EACD,OAAO;IACN/B,IAAI,EAAE,uCAAuC;IAC7C4B,UAAU;IACVG;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,oBAAoBA,CAAA,EAAG;EACtC,IAAAC,mBAAU,EAAE,iDAAiD,EAAE;IAC9DC,KAAK,EAAE;EACR,CAAE,CAAC;EAEH,OAAO;IACNlC,IAAI,EAAE;EACP,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASmC,gCAAgCA,CAAEC,SAAS,EAAEC,SAAS,EAAG;EACxE,IAAAJ,mBAAU,EACT,+DAA+D,EAC/D;IACCC,KAAK,EAAE,OAAO;IACdI,WAAW,EAAE;EACd,CACD,CAAC;EACD,OAAO;IACNtC,IAAI,EAAE,sCAAsC;IAC5CoC,SAAS;IACTC;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,mBAAmBA,CAAEC,GAAG,EAAEC,OAAO,EAAG;EACnD,OAAO;IACNzC,IAAI,EAAE,uBAAuB;IAC7BwC,GAAG;IACHC;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,kBAAkB,GAC9BA,CACClC,IAAI,EACJC,IAAI,EACJkC,QAAQ,EACRhC,KAAK,EACL;EAAEiC,eAAe,GAAGC,iBAAQ;EAAEC,YAA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ACD,MAAM0E,GAAG,GACRjC,YAAY,IAAIA,YAAY,EAAEiH,WAAW,GACtCjH,YAAY,CAACiH,WAAW,GACxBhD,4BAAkB;EAEtBpE,QAAQ,CAAE;IACT/C,IAAI,EAAE,wBAAwB;IAC9BmF,GAAG;IACHiF,KAAK,EAAEnK,KAAK,CAACC,OAAO,CAAEQ,OAAQ,CAAC,GAAGA,OAAO,GAAG,CAAEA,OAAO,CAAE;IACvDwJ,SAAS;IACTpJ,IAAI;IACJH,KAAK;IACLH,IAAI;IACJC,IAAI;IACJG;EACD,CAAE,CAAC;AACJ,CAAC;AAACwD,OAAA,CAAA6F,gBAAA,GAAAA,gBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_es","_interopRequireDefault","require","_uuid","_apiFetch","_url","_deprecated","_utils","_queriedData","_entities","_batch","_name","_sync","receiveUserQuery","queryID","users","type","Array","isArray","receiveCurrentUser","currentUser","addEntities","entities","receiveEntityRecords","kind","name","records","query","invalidateCache","edits","meta","map","record","status","title","action","receiveQueriedItems","receiveItems","receiveCurrentTheme","currentTheme","__experimentalReceiveCurrentGlobalStylesId","currentGlobalStylesId","id","__experimentalReceiveThemeBaseGlobalStyles","stylesheet","globalStyles","__experimentalReceiveThemeGlobalStyleVariations","variations","receiveThemeSupports","deprecated","since","receiveThemeGlobalStyleRevisions","currentId","revisions","alternative","receiveEmbedPreview","url","preview","deleteEntityRecord","recordId","__unstableFetch","apiFetch","throwOnError","dispatch","configs","getOrLoadEntitiesConfig","entityConfig","find","config","error","deletedRecord","lock","__unstableAcquireStoreLock","STORE_NAME","exclusive","hasError","path","baseURL","addQueryArgs","method","removeItems","_error","__unstableReleaseStoreLock","exports","editEntityRecord","options","select","getEntityConfig","Error","mergedEdits","getRawEntityRecord","editedRecord","getEditedEntityRecord","edit","Object","keys","reduce","acc","key","recordValue","editedRecordValue","value","fastDeepEqual","undefined","window","__experimentalEnableSync","syncConfig","globalThis","IS_GUTENBERG_PLUGIN","objectId","getSyncObjectId","getSyncProvider","update","syncObjectType","undoIgnore","getUndoManager","addRecord","changes","from","to","isCached","undo","undoRecord","redo","redoRecord","__unstableCreateUndoLevel","saveEntityRecord","isAutosave","resolveSelect","entityIdKey","DEFAULT_ENTITY_KEY","uuid","entries","evaluatedValue","updatedRecord","persistedRecord","getCurrentUser","currentUserId","autosavePost","getAutosave","data","includes","newRecord","receiveAutosaves","__unstablePrePersist","__experimentalBatch","requests","batch","createBatch","api","add","saveEditedEntityRecord","resultPromises","request","results","Promise","all","run","hasEditsForEntityRecord","getEntityRecordNonTransientEdits","__experimentalSaveSpecifiedEntityEdits","itemsToSave","editsToSave","item","setNestedValue","getNestedValue","receiveUploadPermissions","hasUploadPermissions","receiveUserPermission","isAllowed","postId","autosaves","receiveNavigationFallbackId","fallbackId","receiveDefaultTemplateId","templateId","receiveRevisions","recordKey","revisionKey","items"],"sources":["@wordpress/core-data/src/actions.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\nimport { v4 as uuid } from 'uuid';\n\n/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { getNestedValue, setNestedValue } from './utils';\nimport { receiveItems, removeItems, receiveQueriedItems } from './queried-data';\nimport { getOrLoadEntitiesConfig, DEFAULT_ENTITY_KEY } from './entities';\nimport { createBatch } from './batch';\nimport { STORE_NAME } from './name';\nimport { getSyncProvider } from './sync';\n\n/**\n * Returns an action object used in signalling that authors have been received.\n * Ignored from documentation as it's internal to the data store.\n *\n * @ignore\n *\n * @param {string} queryID Query ID.\n * @param {Array|Object} users Users received.\n *\n * @return {Object} Action object.\n */\nexport function receiveUserQuery( queryID, users ) {\n\treturn {\n\t\ttype: 'RECEIVE_USER_QUERY',\n\t\tusers: Array.isArray( users ) ? users : [ users ],\n\t\tqueryID,\n\t};\n}\n\n/**\n * Returns an action used in signalling that the current user has been received.\n * Ignored from documentation as it's internal to the data store.\n *\n * @ignore\n *\n * @param {Object} currentUser Current user object.\n *\n * @return {Object} Action object.\n */\nexport function receiveCurrentUser( currentUser ) {\n\treturn {\n\t\ttype: 'RECEIVE_CURRENT_USER',\n\t\tcurrentUser,\n\t};\n}\n\n/**\n * Returns an action object used in adding new entities.\n *\n * @param {Array} entities Entities received.\n *\n * @return {Object} Action object.\n */\nexport function addEntities( entities ) {\n\treturn {\n\t\ttype: 'ADD_ENTITIES',\n\t\tentities,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that entity records have been received.\n *\n * @param {string} kind Kind of the received entity record.\n * @param {string} name Name of the received entity record.\n * @param {Array|Object} records Records received.\n * @param {?Object} query Query Object.\n * @param {?boolean} invalidateCache Should invalidate query caches.\n * @param {?Object} edits Edits to reset.\n * @param {?Object} meta Meta information about pagination.\n * @return {Object} Action object.\n */\nexport function receiveEntityRecords(\n\tkind,\n\tname,\n\trecords,\n\tquery,\n\tinvalidateCache = false,\n\tedits,\n\tmeta\n) {\n\t// Auto drafts should not have titles, but some plugins rely on them so we can't filter this\n\t// on the server.\n\tif ( kind === 'postType' ) {\n\t\trecords = ( Array.isArray( records ) ? records : [ records ] ).map(\n\t\t\t( record ) =>\n\t\t\t\trecord.status === 'auto-draft'\n\t\t\t\t\t? { ...record, title: '' }\n\t\t\t\t\t: record\n\t\t);\n\t}\n\tlet action;\n\tif ( query ) {\n\t\taction = receiveQueriedItems( records, query, edits, meta );\n\t} else {\n\t\taction = receiveItems( records, edits, meta );\n\t}\n\n\treturn {\n\t\t...action,\n\t\tkind,\n\t\tname,\n\t\tinvalidateCache,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the current theme has been received.\n * Ignored from documentation as it's internal to the data store.\n *\n * @ignore\n *\n * @param {Object} currentTheme The current theme.\n *\n * @return {Object} Action object.\n */\nexport function receiveCurrentTheme( currentTheme ) {\n\treturn {\n\t\ttype: 'RECEIVE_CURRENT_THEME',\n\t\tcurrentTheme,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the current global styles id has been received.\n * Ignored from documentation as it's internal to the data store.\n *\n * @ignore\n *\n * @param {string} currentGlobalStylesId The current global styles id.\n *\n * @return {Object} Action object.\n */\nexport function __experimentalReceiveCurrentGlobalStylesId(\n\tcurrentGlobalStylesId\n) {\n\treturn {\n\t\ttype: 'RECEIVE_CURRENT_GLOBAL_STYLES_ID',\n\t\tid: currentGlobalStylesId,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the theme base global styles have been received\n * Ignored from documentation as it's internal to the data store.\n *\n * @ignore\n *\n * @param {string} stylesheet The theme's identifier\n * @param {Object} globalStyles The global styles object.\n *\n * @return {Object} Action object.\n */\nexport function __experimentalReceiveThemeBaseGlobalStyles(\n\tstylesheet,\n\tglobalStyles\n) {\n\treturn {\n\t\ttype: 'RECEIVE_THEME_GLOBAL_STYLES',\n\t\tstylesheet,\n\t\tglobalStyles,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the theme global styles variations have been received.\n * Ignored from documentation as it's internal to the data store.\n *\n * @ignore\n *\n * @param {string} stylesheet The theme's identifier\n * @param {Array} variations The global styles variations.\n *\n * @return {Object} Action object.\n */\nexport function __experimentalReceiveThemeGlobalStyleVariations(\n\tstylesheet,\n\tvariations\n) {\n\treturn {\n\t\ttype: 'RECEIVE_THEME_GLOBAL_STYLE_VARIATIONS',\n\t\tstylesheet,\n\t\tvariations,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the index has been received.\n *\n * @deprecated since WP 5.9, this is not useful anymore, use the selector direclty.\n *\n * @return {Object} Action object.\n */\nexport function receiveThemeSupports() {\n\tdeprecated( \"wp.data.dispatch( 'core' ).receiveThemeSupports\", {\n\t\tsince: '5.9',\n\t} );\n\n\treturn {\n\t\ttype: 'DO_NOTHING',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the theme global styles CPT post revisions have been received.\n * Ignored from documentation as it's internal to the data store.\n *\n * @deprecated since WordPress 6.5.0. Callers should use `dispatch( 'core' ).receiveRevision` instead.\n *\n * @ignore\n *\n * @param {number} currentId The post id.\n * @param {Array} revisions The global styles revisions.\n *\n * @return {Object} Action object.\n */\nexport function receiveThemeGlobalStyleRevisions( currentId, revisions ) {\n\tdeprecated(\n\t\t\"wp.data.dispatch( 'core' ).receiveThemeGlobalStyleRevisions()\",\n\t\t{\n\t\t\tsince: '6.5.0',\n\t\t\talternative: \"wp.data.dispatch( 'core' ).receiveRevisions\",\n\t\t}\n\t);\n\treturn {\n\t\ttype: 'RECEIVE_THEME_GLOBAL_STYLE_REVISIONS',\n\t\tcurrentId,\n\t\trevisions,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the preview data for\n * a given URl has been received.\n * Ignored from documentation as it's internal to the data store.\n *\n * @ignore\n *\n * @param {string} url URL to preview the embed for.\n * @param {*} preview Preview data.\n *\n * @return {Object} Action object.\n */\nexport function receiveEmbedPreview( url, preview ) {\n\treturn {\n\t\ttype: 'RECEIVE_EMBED_PREVIEW',\n\t\turl,\n\t\tpreview,\n\t};\n}\n\n/**\n * Action triggered to delete an entity record.\n *\n * @param {string} kind Kind of the deleted entity.\n * @param {string} name Name of the deleted entity.\n * @param {string} recordId Record ID of the deleted entity.\n * @param {?Object} query Special query parameters for the\n * DELETE API call.\n * @param {Object} [options] Delete options.\n * @param {Function} [options.__unstableFetch] Internal use only. Function to\n * call instead of `apiFetch()`.\n * Must return a promise.\n * @param {boolean} [options.throwOnError=false] If false, this action suppresses all\n * the exceptions. Defaults to false.\n */\nexport const deleteEntityRecord =\n\t(\n\t\tkind,\n\t\tname,\n\t\trecordId,\n\t\tquery,\n\t\t{ __unstableFetch = apiFetch, throwOnError = false } = {}\n\t) =>\n\tasync ( { dispatch } ) => {\n\t\tconst configs = await dispatch( getOrLoadEntitiesConfig( kind, name ) );\n\t\tconst entityConfig = configs.find(\n\t\t\t( config ) => config.kind === kind && config.name === name\n\t\t);\n\t\tlet error;\n\t\tlet deletedRecord = false;\n\t\tif ( ! entityConfig ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst lock = await dispatch.__unstableAcquireStoreLock(\n\t\t\tSTORE_NAME,\n\t\t\t[ 'entities', 'records', kind, name, recordId ],\n\t\t\t{ exclusive: true }\n\t\t);\n\n\t\ttry {\n\t\t\tdispatch( {\n\t\t\t\ttype: 'DELETE_ENTITY_RECORD_START',\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\trecordId,\n\t\t\t} );\n\n\t\t\tlet hasError = false;\n\t\t\ttry {\n\t\t\t\tlet path = `${ entityConfig.baseURL }/${ recordId }`;\n\n\t\t\t\tif ( query ) {\n\t\t\t\t\tpath = addQueryArgs( path, query );\n\t\t\t\t}\n\n\t\t\t\tdeletedRecord = await __unstableFetch( {\n\t\t\t\t\tpath,\n\t\t\t\t\tmethod: 'DELETE',\n\t\t\t\t} );\n\n\t\t\t\tawait dispatch( removeItems( kind, name, recordId, true ) );\n\t\t\t} catch ( _error ) {\n\t\t\t\thasError = true;\n\t\t\t\terror = _error;\n\t\t\t}\n\n\t\t\tdispatch( {\n\t\t\t\ttype: 'DELETE_ENTITY_RECORD_FINISH',\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\trecordId,\n\t\t\t\terror,\n\t\t\t} );\n\n\t\t\tif ( hasError && throwOnError ) {\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\treturn deletedRecord;\n\t\t} finally {\n\t\t\tdispatch.__unstableReleaseStoreLock( lock );\n\t\t}\n\t};\n\n/**\n * Returns an action object that triggers an\n * edit to an entity record.\n *\n * @param {string} kind Kind of the edited entity record.\n * @param {string} name Name of the edited entity record.\n * @param {number|string} recordId Record ID of the edited entity record.\n * @param {Object} edits The edits.\n * @param {Object} options Options for the edit.\n * @param {boolean} [options.undoIgnore] Whether to ignore the edit in undo history or not.\n *\n * @return {Object} Action object.\n */\nexport const editEntityRecord =\n\t( kind, name, recordId, edits, options = {} ) =>\n\t( { select, dispatch } ) => {\n\t\tconst entityConfig = select.getEntityConfig( kind, name );\n\t\tif ( ! entityConfig ) {\n\t\t\tthrow new Error(\n\t\t\t\t`The entity being edited (${ kind }, ${ name }) does not have a loaded config.`\n\t\t\t);\n\t\t}\n\t\tconst { mergedEdits = {} } = entityConfig;\n\t\tconst record = select.getRawEntityRecord( kind, name, recordId );\n\t\tconst editedRecord = select.getEditedEntityRecord(\n\t\t\tkind,\n\t\t\tname,\n\t\t\trecordId\n\t\t);\n\n\t\tconst edit = {\n\t\t\tkind,\n\t\t\tname,\n\t\t\trecordId,\n\t\t\t// Clear edits when they are equal to their persisted counterparts\n\t\t\t// so that the property is not considered dirty.\n\t\t\tedits: Object.keys( edits ).reduce( ( acc, key ) => {\n\t\t\t\tconst recordValue = record[ key ];\n\t\t\t\tconst editedRecordValue = editedRecord[ key ];\n\t\t\t\tconst value = mergedEdits[ key ]\n\t\t\t\t\t? { ...editedRecordValue, ...edits[ key ] }\n\t\t\t\t\t: edits[ key ];\n\t\t\t\tacc[ key ] = fastDeepEqual( recordValue, value )\n\t\t\t\t\t? undefined\n\t\t\t\t\t: value;\n\t\t\t\treturn acc;\n\t\t\t}, {} ),\n\t\t};\n\t\tif ( window.__experimentalEnableSync && entityConfig.syncConfig ) {\n\t\t\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t\t\tconst objectId = entityConfig.getSyncObjectId( recordId );\n\t\t\t\tgetSyncProvider().update(\n\t\t\t\t\tentityConfig.syncObjectType + '--edit',\n\t\t\t\t\tobjectId,\n\t\t\t\t\tedit.edits\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\tif ( ! options.undoIgnore ) {\n\t\t\t\tselect.getUndoManager().addRecord(\n\t\t\t\t\t[\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tid: { kind, name, recordId },\n\t\t\t\t\t\t\tchanges: Object.keys( edits ).reduce(\n\t\t\t\t\t\t\t\t( acc, key ) => {\n\t\t\t\t\t\t\t\t\tacc[ key ] = {\n\t\t\t\t\t\t\t\t\t\tfrom: editedRecord[ key ],\n\t\t\t\t\t\t\t\t\t\tto: edits[ key ],\n\t\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t\t\treturn acc;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{}\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t\toptions.isCached\n\t\t\t\t);\n\t\t\t}\n\t\t\tdispatch( {\n\t\t\t\ttype: 'EDIT_ENTITY_RECORD',\n\t\t\t\t...edit,\n\t\t\t} );\n\t\t}\n\t};\n\n/**\n * Action triggered to undo the last edit to\n * an entity record, if any.\n */\nexport const undo =\n\t() =>\n\t( { select, dispatch } ) => {\n\t\tconst undoRecord = select.getUndoManager().undo();\n\t\tif ( ! undoRecord ) {\n\t\t\treturn;\n\t\t}\n\t\tdispatch( {\n\t\t\ttype: 'UNDO',\n\t\t\trecord: undoRecord,\n\t\t} );\n\t};\n\n/**\n * Action triggered to redo the last undoed\n * edit to an entity record, if any.\n */\nexport const redo =\n\t() =>\n\t( { select, dispatch } ) => {\n\t\tconst redoRecord = select.getUndoManager().redo();\n\t\tif ( ! redoRecord ) {\n\t\t\treturn;\n\t\t}\n\t\tdispatch( {\n\t\t\ttype: 'REDO',\n\t\t\trecord: redoRecord,\n\t\t} );\n\t};\n\n/**\n * Forces the creation of a new undo level.\n *\n * @return {Object} Action object.\n */\nexport const __unstableCreateUndoLevel =\n\t() =>\n\t( { select } ) => {\n\t\tselect.getUndoManager().addRecord();\n\t};\n\n/**\n * Action triggered to save an entity record.\n *\n * @param {string} kind Kind of the received entity.\n * @param {string} name Name of the received entity.\n * @param {Object} record Record to be saved.\n * @param {Object} options Saving options.\n * @param {boolean} [options.isAutosave=false] Whether this is an autosave.\n * @param {Function} [options.__unstableFetch] Internal use only. Function to\n * call instead of `apiFetch()`.\n * Must return a promise.\n * @param {boolean} [options.throwOnError=false] If false, this action suppresses all\n * the exceptions. Defaults to false.\n */\nexport const saveEntityRecord =\n\t(\n\t\tkind,\n\t\tname,\n\t\trecord,\n\t\t{\n\t\t\tisAutosave = false,\n\t\t\t__unstableFetch = apiFetch,\n\t\t\tthrowOnError = false,\n\t\t} = {}\n\t) =>\n\tasync ( { select, resolveSelect, dispatch } ) => {\n\t\tconst configs = await dispatch( getOrLoadEntitiesConfig( kind, name ) );\n\t\tconst entityConfig = configs.find(\n\t\t\t( config ) => config.kind === kind && config.name === name\n\t\t);\n\t\tif ( ! entityConfig ) {\n\t\t\treturn;\n\t\t}\n\t\tconst entityIdKey = entityConfig.key || DEFAULT_ENTITY_KEY;\n\t\tconst recordId = record[ entityIdKey ];\n\n\t\tconst lock = await dispatch.__unstableAcquireStoreLock(\n\t\t\tSTORE_NAME,\n\t\t\t[ 'entities', 'records', kind, name, recordId || uuid() ],\n\t\t\t{ exclusive: true }\n\t\t);\n\n\t\ttry {\n\t\t\t// Evaluate optimized edits.\n\t\t\t// (Function edits that should be evaluated on save to avoid expensive computations on every edit.)\n\t\t\tfor ( const [ key, value ] of Object.entries( record ) ) {\n\t\t\t\tif ( typeof value === 'function' ) {\n\t\t\t\t\tconst evaluatedValue = value(\n\t\t\t\t\t\tselect.getEditedEntityRecord( kind, name, recordId )\n\t\t\t\t\t);\n\t\t\t\t\tdispatch.editEntityRecord(\n\t\t\t\t\t\tkind,\n\t\t\t\t\t\tname,\n\t\t\t\t\t\trecordId,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t[ key ]: evaluatedValue,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{ undoIgnore: true }\n\t\t\t\t\t);\n\t\t\t\t\trecord[ key ] = evaluatedValue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdispatch( {\n\t\t\t\ttype: 'SAVE_ENTITY_RECORD_START',\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\trecordId,\n\t\t\t\tisAutosave,\n\t\t\t} );\n\t\t\tlet updatedRecord;\n\t\t\tlet error;\n\t\t\tlet hasError = false;\n\t\t\ttry {\n\t\t\t\tconst path = `${ entityConfig.baseURL }${\n\t\t\t\t\trecordId ? '/' + recordId : ''\n\t\t\t\t}`;\n\t\t\t\tconst persistedRecord = select.getRawEntityRecord(\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\trecordId\n\t\t\t\t);\n\n\t\t\t\tif ( isAutosave ) {\n\t\t\t\t\t// Most of this autosave logic is very specific to posts.\n\t\t\t\t\t// This is fine for now as it is the only supported autosave,\n\t\t\t\t\t// but ideally this should all be handled in the back end,\n\t\t\t\t\t// so the client just sends and receives objects.\n\t\t\t\t\tconst currentUser = select.getCurrentUser();\n\t\t\t\t\tconst currentUserId = currentUser\n\t\t\t\t\t\t? currentUser.id\n\t\t\t\t\t\t: undefined;\n\t\t\t\t\tconst autosavePost = await resolveSelect.getAutosave(\n\t\t\t\t\t\tpersistedRecord.type,\n\t\t\t\t\t\tpersistedRecord.id,\n\t\t\t\t\t\tcurrentUserId\n\t\t\t\t\t);\n\t\t\t\t\t// Autosaves need all expected fields to be present.\n\t\t\t\t\t// So we fallback to the previous autosave and then\n\t\t\t\t\t// to the actual persisted entity if the edits don't\n\t\t\t\t\t// have a value.\n\t\t\t\t\tlet data = {\n\t\t\t\t\t\t...persistedRecord,\n\t\t\t\t\t\t...autosavePost,\n\t\t\t\t\t\t...record,\n\t\t\t\t\t};\n\t\t\t\t\tdata = Object.keys( data ).reduce(\n\t\t\t\t\t\t( acc, key ) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\t\t'title',\n\t\t\t\t\t\t\t\t\t'excerpt',\n\t\t\t\t\t\t\t\t\t'content',\n\t\t\t\t\t\t\t\t\t'meta',\n\t\t\t\t\t\t\t\t].includes( key )\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tacc[ key ] = data[ key ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn acc;\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// Do not update the `status` if we have edited it when auto saving.\n\t\t\t\t\t\t\t// It's very important to let the user explicitly save this change,\n\t\t\t\t\t\t\t// because it can lead to unexpected results. An example would be to\n\t\t\t\t\t\t\t// have a draft post and change the status to publish.\n\t\t\t\t\t\t\tstatus:\n\t\t\t\t\t\t\t\tdata.status === 'auto-draft'\n\t\t\t\t\t\t\t\t\t? 'draft'\n\t\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t\tupdatedRecord = await __unstableFetch( {\n\t\t\t\t\t\tpath: `${ path }/autosaves`,\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\tdata,\n\t\t\t\t\t} );\n\n\t\t\t\t\t// An autosave may be processed by the server as a regular save\n\t\t\t\t\t// when its update is requested by the author and the post had\n\t\t\t\t\t// draft or auto-draft status.\n\t\t\t\t\tif ( persistedRecord.id === updatedRecord.id ) {\n\t\t\t\t\t\tlet newRecord = {\n\t\t\t\t\t\t\t...persistedRecord,\n\t\t\t\t\t\t\t...data,\n\t\t\t\t\t\t\t...updatedRecord,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tnewRecord = Object.keys( newRecord ).reduce(\n\t\t\t\t\t\t\t( acc, key ) => {\n\t\t\t\t\t\t\t\t// These properties are persisted in autosaves.\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t[ 'title', 'excerpt', 'content' ].includes(\n\t\t\t\t\t\t\t\t\t\tkey\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tacc[ key ] = newRecord[ key ];\n\t\t\t\t\t\t\t\t} else if ( key === 'status' ) {\n\t\t\t\t\t\t\t\t\t// Status is only persisted in autosaves when going from\n\t\t\t\t\t\t\t\t\t// \"auto-draft\" to \"draft\".\n\t\t\t\t\t\t\t\t\tacc[ key ] =\n\t\t\t\t\t\t\t\t\t\tpersistedRecord.status ===\n\t\t\t\t\t\t\t\t\t\t\t'auto-draft' &&\n\t\t\t\t\t\t\t\t\t\tnewRecord.status === 'draft'\n\t\t\t\t\t\t\t\t\t\t\t? newRecord.status\n\t\t\t\t\t\t\t\t\t\t\t: persistedRecord.status;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t// These properties are not persisted in autosaves.\n\t\t\t\t\t\t\t\t\tacc[ key ] = persistedRecord[ key ];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn acc;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{}\n\t\t\t\t\t\t);\n\t\t\t\t\t\tdispatch.receiveEntityRecords(\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tnewRecord,\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdispatch.receiveAutosaves(\n\t\t\t\t\t\t\tpersistedRecord.id,\n\t\t\t\t\t\t\tupdatedRecord\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tlet edits = record;\n\t\t\t\t\tif ( entityConfig.__unstablePrePersist ) {\n\t\t\t\t\t\tedits = {\n\t\t\t\t\t\t\t...edits,\n\t\t\t\t\t\t\t...entityConfig.__unstablePrePersist(\n\t\t\t\t\t\t\t\tpersistedRecord,\n\t\t\t\t\t\t\t\tedits\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\tupdatedRecord = await __unstableFetch( {\n\t\t\t\t\t\tpath,\n\t\t\t\t\t\tmethod: recordId ? 'PUT' : 'POST',\n\t\t\t\t\t\tdata: edits,\n\t\t\t\t\t} );\n\t\t\t\t\tdispatch.receiveEntityRecords(\n\t\t\t\t\t\tkind,\n\t\t\t\t\t\tname,\n\t\t\t\t\t\tupdatedRecord,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\tedits\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} catch ( _error ) {\n\t\t\t\thasError = true;\n\t\t\t\terror = _error;\n\t\t\t}\n\t\t\tdispatch( {\n\t\t\t\ttype: 'SAVE_ENTITY_RECORD_FINISH',\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\trecordId,\n\t\t\t\terror,\n\t\t\t\tisAutosave,\n\t\t\t} );\n\n\t\t\tif ( hasError && throwOnError ) {\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\treturn updatedRecord;\n\t\t} finally {\n\t\t\tdispatch.__unstableReleaseStoreLock( lock );\n\t\t}\n\t};\n\n/**\n * Runs multiple core-data actions at the same time using one API request.\n *\n * Example:\n *\n * ```\n * const [ savedRecord, updatedRecord, deletedRecord ] =\n * await dispatch( 'core' ).__experimentalBatch( [\n * ( { saveEntityRecord } ) => saveEntityRecord( 'root', 'widget', widget ),\n * ( { saveEditedEntityRecord } ) => saveEntityRecord( 'root', 'widget', 123 ),\n * ( { deleteEntityRecord } ) => deleteEntityRecord( 'root', 'widget', 123, null ),\n * ] );\n * ```\n *\n * @param {Array} requests Array of functions which are invoked simultaneously.\n * Each function is passed an object containing\n * `saveEntityRecord`, `saveEditedEntityRecord`, and\n * `deleteEntityRecord`.\n *\n * @return {(thunkArgs: Object) => Promise} A promise that resolves to an array containing the return\n * values of each function given in `requests`.\n */\nexport const __experimentalBatch =\n\t( requests ) =>\n\tasync ( { dispatch } ) => {\n\t\tconst batch = createBatch();\n\t\tconst api = {\n\t\t\tsaveEntityRecord( kind, name, record, options ) {\n\t\t\t\treturn batch.add( ( add ) =>\n\t\t\t\t\tdispatch.saveEntityRecord( kind, name, record, {\n\t\t\t\t\t\t...options,\n\t\t\t\t\t\t__unstableFetch: add,\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t},\n\t\t\tsaveEditedEntityRecord( kind, name, recordId, options ) {\n\t\t\t\treturn batch.add( ( add ) =>\n\t\t\t\t\tdispatch.saveEditedEntityRecord( kind, name, recordId, {\n\t\t\t\t\t\t...options,\n\t\t\t\t\t\t__unstableFetch: add,\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t},\n\t\t\tdeleteEntityRecord( kind, name, recordId, query, options ) {\n\t\t\t\treturn batch.add( ( add ) =>\n\t\t\t\t\tdispatch.deleteEntityRecord( kind, name, recordId, query, {\n\t\t\t\t\t\t...options,\n\t\t\t\t\t\t__unstableFetch: add,\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t},\n\t\t};\n\t\tconst resultPromises = requests.map( ( request ) => request( api ) );\n\t\tconst [ , ...results ] = await Promise.all( [\n\t\t\tbatch.run(),\n\t\t\t...resultPromises,\n\t\t] );\n\t\treturn results;\n\t};\n\n/**\n * Action triggered to save an entity record's edits.\n *\n * @param {string} kind Kind of the entity.\n * @param {string} name Name of the entity.\n * @param {Object} recordId ID of the record.\n * @param {Object=} options Saving options.\n */\nexport const saveEditedEntityRecord =\n\t( kind, name, recordId, options ) =>\n\tasync ( { select, dispatch } ) => {\n\t\tif ( ! select.hasEditsForEntityRecord( kind, name, recordId ) ) {\n\t\t\treturn;\n\t\t}\n\t\tconst configs = await dispatch( getOrLoadEntitiesConfig( kind, name ) );\n\t\tconst entityConfig = configs.find(\n\t\t\t( config ) => config.kind === kind && config.name === name\n\t\t);\n\t\tif ( ! entityConfig ) {\n\t\t\treturn;\n\t\t}\n\t\tconst entityIdKey = entityConfig.key || DEFAULT_ENTITY_KEY;\n\n\t\tconst edits = select.getEntityRecordNonTransientEdits(\n\t\t\tkind,\n\t\t\tname,\n\t\t\trecordId\n\t\t);\n\t\tconst record = { [ entityIdKey ]: recordId, ...edits };\n\t\treturn await dispatch.saveEntityRecord( kind, name, record, options );\n\t};\n\n/**\n * Action triggered to save only specified properties for the entity.\n *\n * @param {string} kind Kind of the entity.\n * @param {string} name Name of the entity.\n * @param {Object} recordId ID of the record.\n * @param {Array} itemsToSave List of entity properties or property paths to save.\n * @param {Object} options Saving options.\n */\nexport const __experimentalSaveSpecifiedEntityEdits =\n\t( kind, name, recordId, itemsToSave, options ) =>\n\tasync ( { select, dispatch } ) => {\n\t\tif ( ! select.hasEditsForEntityRecord( kind, name, recordId ) ) {\n\t\t\treturn;\n\t\t}\n\t\tconst edits = select.getEntityRecordNonTransientEdits(\n\t\t\tkind,\n\t\t\tname,\n\t\t\trecordId\n\t\t);\n\t\tconst editsToSave = {};\n\n\t\tfor ( const item of itemsToSave ) {\n\t\t\tsetNestedValue( editsToSave, item, getNestedValue( edits, item ) );\n\t\t}\n\n\t\tconst configs = await dispatch( getOrLoadEntitiesConfig( kind, name ) );\n\t\tconst entityConfig = configs.find(\n\t\t\t( config ) => config.kind === kind && config.name === name\n\t\t);\n\n\t\tconst entityIdKey = entityConfig?.key || DEFAULT_ENTITY_KEY;\n\n\t\t// If a record key is provided then update the existing record.\n\t\t// This necessitates providing `recordKey` to saveEntityRecord as part of the\n\t\t// `record` argument (here called `editsToSave`) to stop that action creating\n\t\t// a new record and instead cause it to update the existing record.\n\t\tif ( recordId ) {\n\t\t\teditsToSave[ entityIdKey ] = recordId;\n\t\t}\n\t\treturn await dispatch.saveEntityRecord(\n\t\t\tkind,\n\t\t\tname,\n\t\t\teditsToSave,\n\t\t\toptions\n\t\t);\n\t};\n\n/**\n * Returns an action object used in signalling that Upload permissions have been received.\n *\n * @deprecated since WP 5.9, use receiveUserPermission instead.\n *\n * @param {boolean} hasUploadPermissions Does the user have permission to upload files?\n *\n * @return {Object} Action object.\n */\nexport function receiveUploadPermissions( hasUploadPermissions ) {\n\tdeprecated( \"wp.data.dispatch( 'core' ).receiveUploadPermissions\", {\n\t\tsince: '5.9',\n\t\talternative: 'receiveUserPermission',\n\t} );\n\n\treturn receiveUserPermission( 'create/media', hasUploadPermissions );\n}\n\n/**\n * Returns an action object used in signalling that the current user has\n * permission to perform an action on a REST resource.\n * Ignored from documentation as it's internal to the data store.\n *\n * @ignore\n *\n * @param {string} key A key that represents the action and REST resource.\n * @param {boolean} isAllowed Whether or not the user can perform the action.\n *\n * @return {Object} Action object.\n */\nexport function receiveUserPermission( key, isAllowed ) {\n\treturn {\n\t\ttype: 'RECEIVE_USER_PERMISSION',\n\t\tkey,\n\t\tisAllowed,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the autosaves for a\n * post have been received.\n * Ignored from documentation as it's internal to the data store.\n *\n * @ignore\n *\n * @param {number} postId The id of the post that is parent to the autosave.\n * @param {Array|Object} autosaves An array of autosaves or singular autosave object.\n *\n * @return {Object} Action object.\n */\nexport function receiveAutosaves( postId, autosaves ) {\n\treturn {\n\t\ttype: 'RECEIVE_AUTOSAVES',\n\t\tpostId,\n\t\tautosaves: Array.isArray( autosaves ) ? autosaves : [ autosaves ],\n\t};\n}\n\n/**\n * Returns an action object signalling that the fallback Navigation\n * Menu id has been received.\n *\n * @param {integer} fallbackId the id of the fallback Navigation Menu\n * @return {Object} Action object.\n */\nexport function receiveNavigationFallbackId( fallbackId ) {\n\treturn {\n\t\ttype: 'RECEIVE_NAVIGATION_FALLBACK_ID',\n\t\tfallbackId,\n\t};\n}\n\n/**\n * Returns an action object used to set the template for a given query.\n *\n * @param {Object} query The lookup query.\n * @param {string} templateId The resolved template id.\n *\n * @return {Object} Action object.\n */\nexport function receiveDefaultTemplateId( query, templateId ) {\n\treturn {\n\t\ttype: 'RECEIVE_DEFAULT_TEMPLATE',\n\t\tquery,\n\t\ttemplateId,\n\t};\n}\n\n/**\n * Action triggered to receive revision items.\n *\n * @param {string} kind Kind of the received entity record revisions.\n * @param {string} name Name of the received entity record revisions.\n * @param {number|string} recordKey The key of the entity record whose revisions you want to fetch.\n * @param {Array|Object} records Revisions received.\n * @param {?Object} query Query Object.\n * @param {?boolean} invalidateCache Should invalidate query caches.\n * @param {?Object} meta Meta information about pagination.\n */\nexport const receiveRevisions =\n\t( kind, name, recordKey, records, query, invalidateCache = false, meta ) =>\n\tasync ( { dispatch } ) => {\n\t\tconst configs = await dispatch( getOrLoadEntitiesConfig( kind, name ) );\n\t\tconst entityConfig = configs.find(\n\t\t\t( config ) => config.kind === kind && config.name === name\n\t\t);\n\t\tconst key =\n\t\t\tentityConfig && entityConfig?.revisionKey\n\t\t\t\t? entityConfig.revisionKey\n\t\t\t\t: DEFAULT_ENTITY_KEY;\n\n\t\tdispatch( {\n\t\t\ttype: 'RECEIVE_ITEM_REVISIONS',\n\t\t\tkey,\n\t\t\titems: Array.isArray( records ) ? records : [ records ],\n\t\t\trecordKey,\n\t\t\tmeta,\n\t\t\tquery,\n\t\t\tkind,\n\t\t\tname,\n\t\t\tinvalidateCache,\n\t\t} );\n\t};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,SAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAL,sBAAA,CAAAC,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,KAAA,GAAAT,OAAA;AACA,IAAAU,KAAA,GAAAV,OAAA;AArBA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASW,gBAAgBA,CAAEC,OAAO,EAAEC,KAAK,EAAG;EAClD,OAAO;IACNC,IAAI,EAAE,oBAAoB;IAC1BD,KAAK,EAAEE,KAAK,CAACC,OAAO,CAAEH,KAAM,CAAC,GAAGA,KAAK,GAAG,CAAEA,KAAK,CAAE;IACjDD;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASK,kBAAkBA,CA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CA,CACzDC,qBAAqB,EACpB;EACD,OAAO;IACNzB,IAAI,EAAE,kCAAkC;IACxC0B,EAAE,EAAED;EACL,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,0CAA0CA,CACzDC,UAAU,EACVC,YAAY,EACX;EACD,OAAO;IACN7B,IAAI,EAAE,6BAA6B;IACnC4B,UAAU;IACVC;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,+CAA+CA,CAC9DF,UAAU,EACVG,UAAU,EACT;EACD,OAAO;IACN/B,IAAI,EAAE,uCAAuC;IAC7C4B,UAAU;IACVG;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,oBAAoBA,CAAA,EAAG;EACtC,IAAAC,mBAAU,EAAE,iDAAiD,EAAE;IAC9DC,KAAK,EAAE;EACR,CAAE,CAAC;EAEH,OAAO;IACNlC,IAAI,EAAE;EACP,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASmC,gCAAgCA,CAAEC,SAAS,EAAEC,SAAS,EAAG;EACxE,IAAAJ,mBAAU,EACT,+DAA+D,EAC/D;IACCC,KAAK,EAAE,OAAO;IACdI,WAAW,EAAE;EACd,CACD,CAAC;EACD,OAAO;IACNtC,IAAI,EAAE,sCAAsC;IAC5CoC,SAAS;IACTC;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,mBAAmBA,CAAEC,GAAG,EAAEC,OAAO,EAAG;EACnD,OAAO;IACNzC,IAAI,EAAE,uBAAuB;IAC7BwC,GAAG;IACHC;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,kBA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KAAKA,IAAI,IAAI4C,MAAM,CAAC3C,IAAI,KAAKA,IACvD,CAAC;EACD,MAAMyE,GAAG,GACRhC,YAAY,IAAIA,YAAY,EAAEgH,WAAW,GACtChH,YAAY,CAACgH,WAAW,GACxBhD,4BAAkB;EAEtBnE,QAAQ,CAAE;IACT/C,IAAI,EAAE,wBAAwB;IAC9BkF,GAAG;IACHiF,KAAK,EAAElK,KAAK,CAACC,OAAO,CAAEQ,OAAQ,CAAC,GAAGA,OAAO,GAAG,CAAEA,OAAO,CAAE;IACvDuJ,SAAS;IACTnJ,IAAI;IACJH,KAAK;IACLH,IAAI;IACJC,IAAI;IACJG;EACD,CAAE,CAAC;AACJ,CAAC;AAACuD,OAAA,CAAA6F,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EntityContext = void 0;
7
+ var _element = require("@wordpress/element");
8
+ /**
9
+ * WordPress dependencies
10
+ */
11
+
12
+ const EntityContext = exports.EntityContext = (0, _element.createContext)({});
13
+ //# sourceMappingURL=entity-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_element","require","EntityContext","exports","createContext"],"sources":["@wordpress/core-data/src/entity-context.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext } from '@wordpress/element';\n\nexport const EntityContext = createContext( {} );\n"],"mappings":";;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGO,MAAMC,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAG,IAAAE,sBAAa,EAAE,CAAC,CAAE,CAAC","ignoreList":[]}
@@ -4,14 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = EntityProvider;
7
- exports.useEntityBlockEditor = useEntityBlockEditor;
8
- exports.useEntityId = useEntityId;
9
- exports.useEntityProp = useEntityProp;
10
7
  var _element = require("@wordpress/element");
11
- var _data = require("@wordpress/data");
12
- var _blocks2 = require("@wordpress/blocks");
13
- var _name = require("./name");
14
- var _footnotes = require("./footnotes");
8
+ var _entityContext = require("./entity-context");
15
9
  var _jsxRuntime = require("react/jsx-runtime");
16
10
  /**
17
11
  * WordPress dependencies
@@ -21,9 +15,6 @@ var _jsxRuntime = require("react/jsx-runtime");
21
15
  * Internal dependencies
22
16
  */
23
17
 
24
- /** @typedef {import('@wordpress/blocks').WPBlock} WPBlock */const EMPTY_ARRAY = [];
25
- const EntityContext = (0, _element.createContext)({});
26
-
27
18
  /**
28
19
  * Context provider component for providing
29
20
  * an entity for a specific entity.
@@ -36,14 +27,13 @@ const EntityContext = (0, _element.createContext)({});
36
27
  *
37
28
  * @return {Object} The provided children, wrapped with
38
29
  * the entity's context provider.
39
- */
40
- function EntityProvider({
30
+ */function EntityProvider({
41
31
  kind,
42
32
  type: name,
43
33
  id,
44
34
  children
45
35
  }) {
46
- const parent = (0, _element.useContext)(EntityContext);
36
+ const parent = (0, _element.useContext)(_entityContext.EntityContext);
47
37
  const childContext = (0, _element.useMemo)(() => ({
48
38
  ...parent,
49
39
  [kind]: {
@@ -51,184 +41,9 @@ function EntityProvider({
51
41
  [name]: id
52
42
  }
53
43
  }), [parent, kind, name, id]);
54
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(EntityContext.Provider, {
44
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_entityContext.EntityContext.Provider, {
55
45
  value: childContext,
56
46
  children: children
57
47
  });
58
48
  }
59
-
60
- /**
61
- * Hook that returns the ID for the nearest
62
- * provided entity of the specified type.
63
- *
64
- * @param {string} kind The entity kind.
65
- * @param {string} name The entity name.
66
- */
67
- function useEntityId(kind, name) {
68
- const context = (0, _element.useContext)(EntityContext);
69
- return context?.[kind]?.[name];
70
- }
71
-
72
- /**
73
- * Hook that returns the value and a setter for the
74
- * specified property of the nearest provided
75
- * entity of the specified type.
76
- *
77
- * @param {string} kind The entity kind.
78
- * @param {string} name The entity name.
79
- * @param {string} prop The property name.
80
- * @param {string} [_id] An entity ID to use instead of the context-provided one.
81
- *
82
- * @return {[*, Function, *]} An array where the first item is the
83
- * property value, the second is the
84
- * setter and the third is the full value
85
- * object from REST API containing more
86
- * information like `raw`, `rendered` and
87
- * `protected` props.
88
- */
89
- function useEntityProp(kind, name, prop, _id) {
90
- const providerId = useEntityId(kind, name);
91
- const id = _id !== null && _id !== void 0 ? _id : providerId;
92
- const {
93
- value,
94
- fullValue
95
- } = (0, _data.useSelect)(select => {
96
- const {
97
- getEntityRecord,
98
- getEditedEntityRecord
99
- } = select(_name.STORE_NAME);
100
- const record = getEntityRecord(kind, name, id); // Trigger resolver.
101
- const editedRecord = getEditedEntityRecord(kind, name, id);
102
- return record && editedRecord ? {
103
- value: editedRecord[prop],
104
- fullValue: record[prop]
105
- } : {};
106
- }, [kind, name, id, prop]);
107
- const {
108
- editEntityRecord
109
- } = (0, _data.useDispatch)(_name.STORE_NAME);
110
- const setValue = (0, _element.useCallback)(newValue => {
111
- editEntityRecord(kind, name, id, {
112
- [prop]: newValue
113
- });
114
- }, [editEntityRecord, kind, name, id, prop]);
115
- return [value, setValue, fullValue];
116
- }
117
- const parsedBlocksCache = new WeakMap();
118
-
119
- /**
120
- * Hook that returns block content getters and setters for
121
- * the nearest provided entity of the specified type.
122
- *
123
- * The return value has the shape `[ blocks, onInput, onChange ]`.
124
- * `onInput` is for block changes that don't create undo levels
125
- * or dirty the post, non-persistent changes, and `onChange` is for
126
- * persistent changes. They map directly to the props of a
127
- * `BlockEditorProvider` and are intended to be used with it,
128
- * or similar components or hooks.
129
- *
130
- * @param {string} kind The entity kind.
131
- * @param {string} name The entity name.
132
- * @param {Object} options
133
- * @param {string} [options.id] An entity ID to use instead of the context-provided one.
134
- *
135
- * @return {[WPBlock[], Function, Function]} The block array and setters.
136
- */
137
- function useEntityBlockEditor(kind, name, {
138
- id: _id
139
- } = {}) {
140
- const providerId = useEntityId(kind, name);
141
- const id = _id !== null && _id !== void 0 ? _id : providerId;
142
- const {
143
- getEntityRecord,
144
- getEntityRecordEdits
145
- } = (0, _data.useSelect)(_name.STORE_NAME);
146
- const {
147
- content,
148
- editedBlocks,
149
- meta
150
- } = (0, _data.useSelect)(select => {
151
- if (!id) {
152
- return {};
153
- }
154
- const {
155
- getEditedEntityRecord
156
- } = select(_name.STORE_NAME);
157
- const editedRecord = getEditedEntityRecord(kind, name, id);
158
- return {
159
- editedBlocks: editedRecord.blocks,
160
- content: editedRecord.content,
161
- meta: editedRecord.meta
162
- };
163
- }, [kind, name, id]);
164
- const {
165
- __unstableCreateUndoLevel,
166
- editEntityRecord
167
- } = (0, _data.useDispatch)(_name.STORE_NAME);
168
- const blocks = (0, _element.useMemo)(() => {
169
- if (!id) {
170
- return undefined;
171
- }
172
- if (editedBlocks) {
173
- return editedBlocks;
174
- }
175
- if (!content || typeof content !== 'string') {
176
- return EMPTY_ARRAY;
177
- }
178
-
179
- // If there's an edit, cache the parsed blocks by the edit.
180
- // If not, cache by the original enity record.
181
- const edits = getEntityRecordEdits(kind, name, id);
182
- const isUnedited = !edits || !Object.keys(edits).length;
183
- const cackeKey = isUnedited ? getEntityRecord(kind, name, id) : edits;
184
- let _blocks = parsedBlocksCache.get(cackeKey);
185
- if (!_blocks) {
186
- _blocks = (0, _blocks2.parse)(content);
187
- parsedBlocksCache.set(cackeKey, _blocks);
188
- }
189
- return _blocks;
190
- }, [kind, name, id, editedBlocks, content, getEntityRecord, getEntityRecordEdits]);
191
- const updateFootnotes = (0, _element.useCallback)(_blocks => (0, _footnotes.updateFootnotesFromMeta)(_blocks, meta), [meta]);
192
- const onChange = (0, _element.useCallback)((newBlocks, options) => {
193
- const noChange = blocks === newBlocks;
194
- if (noChange) {
195
- return __unstableCreateUndoLevel(kind, name, id);
196
- }
197
- const {
198
- selection,
199
- ...rest
200
- } = options;
201
-
202
- // We create a new function here on every persistent edit
203
- // to make sure the edit makes the post dirty and creates
204
- // a new undo level.
205
- const edits = {
206
- selection,
207
- content: ({
208
- blocks: blocksForSerialization = []
209
- }) => (0, _blocks2.__unstableSerializeAndClean)(blocksForSerialization),
210
- ...updateFootnotes(newBlocks)
211
- };
212
- editEntityRecord(kind, name, id, edits, {
213
- isCached: false,
214
- ...rest
215
- });
216
- }, [kind, name, id, blocks, updateFootnotes, __unstableCreateUndoLevel, editEntityRecord]);
217
- const onInput = (0, _element.useCallback)((newBlocks, options) => {
218
- const {
219
- selection,
220
- ...rest
221
- } = options;
222
- const footnotesChanges = updateFootnotes(newBlocks);
223
- const edits = {
224
- selection,
225
- ...footnotesChanges
226
- };
227
- editEntityRecord(kind, name, id, edits, {
228
- isCached: true,
229
- ...rest
230
- });
231
- }, [kind, name, id, updateFootnotes, editEntityRecord]);
232
- return [blocks, onInput, onChange];
233
- }
234
49
  //# sourceMappingURL=entity-provider.js.map