@wordpress/core-data 4.2.1 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/CHANGELOG.md +5 -0
  2. package/README.md +41 -8
  3. package/build/actions.js +61 -41
  4. package/build/actions.js.map +1 -1
  5. package/build/entities.js +36 -23
  6. package/build/entities.js.map +1 -1
  7. package/build/entity-provider.js +46 -44
  8. package/build/entity-provider.js.map +1 -1
  9. package/build/entity-types/{base-entity-types.js → base-entity-records.js} +9 -9
  10. package/build/entity-types/base-entity-records.js.map +1 -0
  11. package/build/fetch/__experimental-fetch-link-suggestions.js +1 -1
  12. package/build/fetch/__experimental-fetch-link-suggestions.js.map +1 -1
  13. package/build/fetch/__experimental-fetch-url-data.js +1 -1
  14. package/build/fetch/__experimental-fetch-url-data.js.map +1 -1
  15. package/build/hooks/use-entity-record.js +15 -5
  16. package/build/hooks/use-entity-record.js.map +1 -1
  17. package/build/hooks/use-entity-records.js +17 -5
  18. package/build/hooks/use-entity-records.js.map +1 -1
  19. package/build/index.js +9 -21
  20. package/build/index.js.map +1 -1
  21. package/build/queried-data/actions.js +4 -4
  22. package/build/queried-data/actions.js.map +1 -1
  23. package/build/queried-data/get-query-parts.js +7 -3
  24. package/build/queried-data/get-query-parts.js.map +1 -1
  25. package/build/queried-data/reducer.js +8 -6
  26. package/build/queried-data/reducer.js.map +1 -1
  27. package/build/reducer.js +16 -16
  28. package/build/reducer.js.map +1 -1
  29. package/build/resolvers.js +17 -23
  30. package/build/resolvers.js.map +1 -1
  31. package/build/selectors.js +92 -51
  32. package/build/selectors.js.map +1 -1
  33. package/build/utils/conservative-map-item.js +1 -1
  34. package/build/utils/conservative-map-item.js.map +1 -1
  35. package/build/utils/is-raw-attribute.js +1 -1
  36. package/build/utils/is-raw-attribute.js.map +1 -1
  37. package/build-module/actions.js +62 -42
  38. package/build-module/actions.js.map +1 -1
  39. package/build-module/entities.js +32 -19
  40. package/build-module/entities.js.map +1 -1
  41. package/build-module/entity-provider.js +47 -45
  42. package/build-module/entity-provider.js.map +1 -1
  43. package/build-module/entity-types/{base-entity-types.js → base-entity-records.js} +7 -7
  44. package/build-module/entity-types/base-entity-records.js.map +1 -0
  45. package/build-module/fetch/__experimental-fetch-link-suggestions.js +1 -1
  46. package/build-module/fetch/__experimental-fetch-link-suggestions.js.map +1 -1
  47. package/build-module/fetch/__experimental-fetch-url-data.js +1 -1
  48. package/build-module/fetch/__experimental-fetch-url-data.js.map +1 -1
  49. package/build-module/hooks/use-entity-record.js +15 -5
  50. package/build-module/hooks/use-entity-record.js.map +1 -1
  51. package/build-module/hooks/use-entity-records.js +17 -5
  52. package/build-module/hooks/use-entity-records.js.map +1 -1
  53. package/build-module/index.js +10 -22
  54. package/build-module/index.js.map +1 -1
  55. package/build-module/queried-data/actions.js +4 -4
  56. package/build-module/queried-data/actions.js.map +1 -1
  57. package/build-module/queried-data/get-query-parts.js +7 -3
  58. package/build-module/queried-data/get-query-parts.js.map +1 -1
  59. package/build-module/queried-data/reducer.js +8 -6
  60. package/build-module/queried-data/reducer.js.map +1 -1
  61. package/build-module/reducer.js +17 -17
  62. package/build-module/reducer.js.map +1 -1
  63. package/build-module/resolvers.js +18 -24
  64. package/build-module/resolvers.js.map +1 -1
  65. package/build-module/selectors.js +88 -51
  66. package/build-module/selectors.js.map +1 -1
  67. package/build-module/utils/conservative-map-item.js +1 -1
  68. package/build-module/utils/conservative-map-item.js.map +1 -1
  69. package/build-module/utils/is-raw-attribute.js +1 -1
  70. package/build-module/utils/is-raw-attribute.js.map +1 -1
  71. package/package.json +11 -11
  72. package/src/actions.js +62 -42
  73. package/src/entities.js +43 -17
  74. package/src/entity-provider.js +50 -44
  75. package/src/entity-types/attachment.ts +5 -5
  76. package/src/entity-types/{base-entity-types.ts → base-entity-records.ts} +5 -5
  77. package/src/entity-types/comment.ts +5 -5
  78. package/src/entity-types/helpers.ts +1 -1
  79. package/src/entity-types/index.ts +4 -4
  80. package/src/entity-types/menu-location.ts +5 -5
  81. package/src/entity-types/nav-menu-item.ts +10 -5
  82. package/src/entity-types/nav-menu.ts +5 -5
  83. package/src/entity-types/navigation-area.ts +5 -5
  84. package/src/entity-types/page.ts +5 -5
  85. package/src/entity-types/plugin.ts +10 -5
  86. package/src/entity-types/post.ts +5 -5
  87. package/src/entity-types/settings.ts +10 -5
  88. package/src/entity-types/sidebar.ts +6 -7
  89. package/src/entity-types/taxonomy.ts +5 -5
  90. package/src/entity-types/theme.ts +5 -5
  91. package/src/entity-types/type.ts +5 -5
  92. package/src/entity-types/user.ts +10 -5
  93. package/src/entity-types/widget-type.ts +5 -5
  94. package/src/entity-types/widget.ts +5 -5
  95. package/src/entity-types/wp-template-part.ts +5 -5
  96. package/src/entity-types/wp-template.ts +5 -5
  97. package/src/fetch/__experimental-fetch-link-suggestions.js +1 -1
  98. package/src/fetch/__experimental-fetch-url-data.js +1 -0
  99. package/src/hooks/use-entity-record.ts +19 -8
  100. package/src/hooks/use-entity-records.ts +26 -9
  101. package/src/index.js +10 -15
  102. package/src/locks/test/selectors.js +4 -4
  103. package/src/queried-data/actions.js +4 -4
  104. package/src/queried-data/get-query-parts.js +5 -5
  105. package/src/queried-data/reducer.js +6 -6
  106. package/src/reducer.js +17 -17
  107. package/src/resolvers.js +25 -30
  108. package/src/selectors.js +92 -53
  109. package/src/test/actions.js +138 -33
  110. package/src/test/entities.js +11 -11
  111. package/src/test/reducer.js +4 -4
  112. package/src/test/resolvers.js +5 -5
  113. package/src/test/selectors.js +22 -22
  114. package/src/utils/conservative-map-item.js +1 -1
  115. package/src/utils/is-raw-attribute.js +1 -1
  116. package/src/utils/test/is-raw-attribute.js +4 -4
  117. package/build/entity-types/base-entity-types.js.map +0 -1
  118. package/build-module/entity-types/base-entity-types.js.map +0 -1
@@ -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,QAA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K,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.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","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"],"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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SAAO3F,KAAK,CAAC8H,0BAAN,CAAkCnC,YAAY,CAACiC,UAA/C,CAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\nimport { set, map, find, get, filter, compact } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { createRegistrySelector } from '@wordpress/data';\nimport { addQueryArgs } from '@wordpress/url';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME } from './name';\nimport { getQueriedItems } from './queried-data';\nimport { DEFAULT_ENTITY_KEY } from './entities';\nimport { getNormalizedCommaSeparable, isRawAttribute } from './utils';\n\n/**\n * Shared reference to an empty object for cases where it is important to avoid\n * returning a new object reference on every invocation, as in a connected or\n * other pure component which performs `shouldComponentUpdate` check on props.\n * This should be used as a last resort, since the normalized data should be\n * maintained by the reducer result in state.\n */\nconst EMPTY_OBJECT = {};\n\n/**\n * Returns true if a request is in progress for embed preview data, or false\n * otherwise.\n *\n * @param {Object} state Data state.\n * @param {string} url URL the preview would be for.\n *\n * @return {boolean} Whether a request is in progress for an embed preview.\n */\nexport const isRequestingEmbedPreview = createRegistrySelector(\n\t( select ) => ( state, url ) => {\n\t\treturn select( STORE_NAME ).isResolving( 'getEmbedPreview', [ url ] );\n\t}\n);\n\n/**\n * Returns all available authors.\n *\n * @deprecated since 11.3. Callers should use `select( 'core' ).getUsers({ who: 'authors' })` instead.\n *\n * @param {Object} state Data state.\n * @param {Object|undefined} query Optional object of query parameters to\n * include with request.\n * @return {Array} Authors list.\n */\nexport function getAuthors( state, query ) {\n\tdeprecated( \"select( 'core' ).getAuthors()\", {\n\t\tsince: '5.9',\n\t\talternative: \"select( 'core' ).getUsers({ who: 'authors' })\",\n\t} );\n\n\tconst path = addQueryArgs(\n\t\t'/wp/v2/users/?who=authors&per_page=100',\n\t\tquery\n\t);\n\treturn getUserQueryResults( state, path );\n}\n\n/**\n * Returns the current user.\n *\n * @param {Object} state Data state.\n *\n * @return {Object} Current user object.\n */\nexport function getCurrentUser( state ) {\n\treturn state.currentUser;\n}\n\n/**\n * Returns all the users returned by a query ID.\n *\n * @param {Object} state Data state.\n * @param {string} queryID Query ID.\n *\n * @return {Array} Users list.\n */\nexport const getUserQueryResults = createSelector(\n\t( state, queryID ) => {\n\t\tconst queryResults = state.users.queries[ queryID ];\n\n\t\treturn map( queryResults, ( id ) => state.users.byId[ id ] );\n\t},\n\t( state, queryID ) => [ state.users.queries[ queryID ], state.users.byId ]\n);\n\n/**\n * Returns the loaded entities for the given kind.\n *\n * @deprecated since WordPress 6.0. Use getEntitiesConfig instead\n * @param {Object} state Data state.\n * @param {string} kind Entity kind.\n *\n * @return {Array<Object>} Array of entities with config matching kind.\n */\nexport function getEntitiesByKind( state, kind ) {\n\tdeprecated( \"wp.data.select( 'core' ).getEntitiesByKind()\", {\n\t\tsince: '6.0',\n\t\talternative: \"wp.data.select( 'core' ).getEntitiesConfig()\",\n\t} );\n\treturn getEntitiesConfig( state, kind );\n}\n\n/**\n * Returns the loaded entities for the given kind.\n *\n * @param {Object} state Data state.\n * @param {string} kind Entity kind.\n *\n * @return {Array<Object>} Array of entities with config matching kind.\n */\nexport function getEntitiesConfig( state, kind ) {\n\treturn filter( state.entities.config, { kind } );\n}\n\n/**\n * Returns the entity config given its kind and name.\n *\n * @deprecated since WordPress 6.0. Use getEntityConfig instead\n * @param {Object} state Data state.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n *\n * @return {Object} Entity config\n */\nexport function getEntity( state, kind, name ) {\n\tdeprecated( \"wp.data.select( 'core' ).getEntity()\", {\n\t\tsince: '6.0',\n\t\talternative: \"wp.data.select( 'core' ).getEntityConfig()\",\n\t} );\n\treturn getEntityConfig( state, kind, name );\n}\n\n/**\n * Returns the entity config given its kind and name.\n *\n * @param {Object} state Data state.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n *\n * @return {Object} Entity config\n */\nexport function getEntityConfig( state, kind, name ) {\n\treturn find( state.entities.config, { kind, name } );\n}\n\n/**\n * Returns the Entity's record object by key. Returns `null` if the value is not\n * yet received, undefined if the value entity is known to not exist, or the\n * entity object if it exists and is received.\n *\n * @param {Object} state State tree\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} key Record's key\n * @param {?Object} query Optional query.\n *\n * @return {Object|undefined} Record.\n */\nexport const getEntityRecord = createSelector(\n\t( state, kind, name, key, query ) => {\n\t\tconst queriedState = get( state.entities.records, [\n\t\t\tkind,\n\t\t\tname,\n\t\t\t'queriedData',\n\t\t] );\n\t\tif ( ! queriedState ) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst context = query?.context ?? 'default';\n\n\t\tif ( query === undefined ) {\n\t\t\t// If expecting a complete item, validate that completeness.\n\t\t\tif ( ! queriedState.itemIsComplete[ context ]?.[ key ] ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\treturn queriedState.items[ context ][ key ];\n\t\t}\n\n\t\tconst item = queriedState.items[ context ]?.[ key ];\n\t\tif ( item && query._fields ) {\n\t\t\tconst filteredItem = {};\n\t\t\tconst fields = getNormalizedCommaSeparable( query._fields ) ?? [];\n\t\t\tfor ( let f = 0; f < fields.length; f++ ) {\n\t\t\t\tconst field = fields[ f ].split( '.' );\n\t\t\t\tconst value = get( item, field );\n\t\t\t\tset( filteredItem, field, value );\n\t\t\t}\n\t\t\treturn filteredItem;\n\t\t}\n\n\t\treturn item;\n\t},\n\t( state, kind, name, recordId, query ) => {\n\t\tconst context = query?.context ?? 'default';\n\t\treturn [\n\t\t\tget( state.entities.records, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'items',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t\tget( state.entities.records, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'itemIsComplete',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t];\n\t}\n);\n\n/**\n * Returns the Entity's record object by key. Doesn't trigger a resolver nor requests the entity records from the API if the entity record isn't available in the local state.\n *\n * @param {Object} state State tree\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} key Record's key\n *\n * @return {Object|null} Record.\n */\nexport function __experimentalGetEntityRecordNoResolver(\n\tstate,\n\tkind,\n\tname,\n\tkey\n) {\n\treturn getEntityRecord( state, kind, name, key );\n}\n\n/**\n * Returns the entity's record object by key,\n * with its attributes mapped to their raw values.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} key Record's key.\n *\n * @return {Object?} Object with the entity's raw attributes.\n */\nexport const getRawEntityRecord = createSelector(\n\t( state, kind, name, key ) => {\n\t\tconst record = getEntityRecord( state, kind, name, key );\n\t\treturn (\n\t\t\trecord &&\n\t\t\tObject.keys( record ).reduce( ( accumulator, _key ) => {\n\t\t\t\tif (\n\t\t\t\t\tisRawAttribute( getEntityConfig( state, kind, name ), _key )\n\t\t\t\t) {\n\t\t\t\t\t// Because edits are the \"raw\" attribute values,\n\t\t\t\t\t// we return those from record selectors to make rendering,\n\t\t\t\t\t// comparisons, and joins with edits easier.\n\t\t\t\t\taccumulator[ _key ] = get(\n\t\t\t\t\t\trecord[ _key ],\n\t\t\t\t\t\t'raw',\n\t\t\t\t\t\trecord[ _key ]\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\taccumulator[ _key ] = record[ _key ];\n\t\t\t\t}\n\t\t\t\treturn accumulator;\n\t\t\t}, {} )\n\t\t);\n\t},\n\t( state, kind, name, recordId, query ) => {\n\t\tconst context = query?.context ?? 'default';\n\t\treturn [\n\t\t\tstate.entities.config,\n\t\t\tget( state.entities.records, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'items',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t\tget( state.entities.records, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'itemIsComplete',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t];\n\t}\n);\n\n/**\n * Returns true if records have been received for the given set of parameters,\n * or false otherwise.\n *\n * @param {Object} state State tree\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {?Object} query Optional terms query.\n *\n * @return {boolean} Whether entity records have been received.\n */\nexport function hasEntityRecords( state, kind, name, query ) {\n\treturn Array.isArray( getEntityRecords( state, kind, name, query ) );\n}\n\n/**\n * Returns the Entity's records.\n *\n * @param {Object} state State tree\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {?Object} query Optional terms query.\n *\n * @return {?Array} Records.\n */\nexport function getEntityRecords( state, kind, name, query ) {\n\t// Queried data state is prepopulated for all known entities. If this is not\n\t// assigned for the given parameters, then it is known to not exist.\n\tconst queriedState = get( state.entities.records, [\n\t\tkind,\n\t\tname,\n\t\t'queriedData',\n\t] );\n\tif ( ! queriedState ) {\n\t\treturn null;\n\t}\n\treturn getQueriedItems( queriedState, query );\n}\n\n/**\n * Returns the list of dirty entity records.\n *\n * @param {Object} state State tree.\n *\n * @return {[{ title: string, key: string, name: string, kind: string }]} The list of updated records\n */\nexport const __experimentalGetDirtyEntityRecords = createSelector(\n\t( state ) => {\n\t\tconst {\n\t\t\tentities: { records },\n\t\t} = state;\n\t\tconst dirtyRecords = [];\n\t\tObject.keys( records ).forEach( ( kind ) => {\n\t\t\tObject.keys( records[ kind ] ).forEach( ( name ) => {\n\t\t\t\tconst primaryKeys = Object.keys(\n\t\t\t\t\trecords[ kind ][ name ].edits\n\t\t\t\t).filter(\n\t\t\t\t\t( primaryKey ) =>\n\t\t\t\t\t\t// The entity record must exist (not be deleted),\n\t\t\t\t\t\t// and it must have edits.\n\t\t\t\t\t\tgetEntityRecord( state, kind, name, primaryKey ) &&\n\t\t\t\t\t\thasEditsForEntityRecord( state, kind, name, primaryKey )\n\t\t\t\t);\n\n\t\t\t\tif ( primaryKeys.length ) {\n\t\t\t\t\tconst entityConfig = getEntityConfig( state, kind, name );\n\t\t\t\t\tprimaryKeys.forEach( ( primaryKey ) => {\n\t\t\t\t\t\tconst entityRecord = getEditedEntityRecord(\n\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tprimaryKey\n\t\t\t\t\t\t);\n\t\t\t\t\t\tdirtyRecords.push( {\n\t\t\t\t\t\t\t// We avoid using primaryKey because it's transformed into a string\n\t\t\t\t\t\t\t// when it's used as an object key.\n\t\t\t\t\t\t\tkey:\n\t\t\t\t\t\t\t\tentityRecord[\n\t\t\t\t\t\t\t\t\tentityConfig.key || DEFAULT_ENTITY_KEY\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\ttitle:\n\t\t\t\t\t\t\t\tentityConfig?.getTitle?.( entityRecord ) || '',\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t} );\n\n\t\treturn dirtyRecords;\n\t},\n\t( state ) => [ state.entities.records ]\n);\n\n/**\n * Returns the list of entities currently being saved.\n *\n * @param {Object} state State tree.\n *\n * @return {[{ title: string, key: string, name: string, kind: string }]} The list of records being saved.\n */\nexport const __experimentalGetEntitiesBeingSaved = createSelector(\n\t( state ) => {\n\t\tconst {\n\t\t\tentities: { records },\n\t\t} = state;\n\t\tconst recordsBeingSaved = [];\n\t\tObject.keys( records ).forEach( ( kind ) => {\n\t\t\tObject.keys( records[ kind ] ).forEach( ( name ) => {\n\t\t\t\tconst primaryKeys = Object.keys(\n\t\t\t\t\trecords[ kind ][ name ].saving\n\t\t\t\t).filter( ( primaryKey ) =>\n\t\t\t\t\tisSavingEntityRecord( state, kind, name, primaryKey )\n\t\t\t\t);\n\n\t\t\t\tif ( primaryKeys.length ) {\n\t\t\t\t\tconst entityConfig = getEntityConfig( state, kind, name );\n\t\t\t\t\tprimaryKeys.forEach( ( primaryKey ) => {\n\t\t\t\t\t\tconst entityRecord = getEditedEntityRecord(\n\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tprimaryKey\n\t\t\t\t\t\t);\n\t\t\t\t\t\trecordsBeingSaved.push( {\n\t\t\t\t\t\t\t// We avoid using primaryKey because it's transformed into a string\n\t\t\t\t\t\t\t// when it's used as an object key.\n\t\t\t\t\t\t\tkey:\n\t\t\t\t\t\t\t\tentityRecord[\n\t\t\t\t\t\t\t\t\tentityConfig.key || DEFAULT_ENTITY_KEY\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\ttitle:\n\t\t\t\t\t\t\t\tentityConfig?.getTitle?.( entityRecord ) || '',\n\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t} );\n\t\t} );\n\t\treturn recordsBeingSaved;\n\t},\n\t( state ) => [ state.entities.records ]\n);\n\n/**\n * Returns the specified entity record's edits.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record's edits.\n */\nexport function getEntityRecordEdits( state, kind, name, recordId ) {\n\treturn get( state.entities.records, [ kind, name, 'edits', recordId ] );\n}\n\n/**\n * Returns the specified entity record's non transient edits.\n *\n * Transient edits don't create an undo level, and\n * are not considered for change detection.\n * They are defined in the entity's config.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record's non transient edits.\n */\nexport const getEntityRecordNonTransientEdits = createSelector(\n\t( state, kind, name, recordId ) => {\n\t\tconst { transientEdits } = getEntityConfig( state, kind, name ) || {};\n\t\tconst edits = getEntityRecordEdits( state, kind, name, recordId ) || {};\n\t\tif ( ! transientEdits ) {\n\t\t\treturn edits;\n\t\t}\n\t\treturn Object.keys( edits ).reduce( ( acc, key ) => {\n\t\t\tif ( ! transientEdits[ key ] ) {\n\t\t\t\tacc[ key ] = edits[ key ];\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, {} );\n\t},\n\t( state, kind, name, recordId ) => [\n\t\tstate.entities.config,\n\t\tget( state.entities.records, [ kind, name, 'edits', recordId ] ),\n\t]\n);\n\n/**\n * Returns true if the specified entity record has edits,\n * and false otherwise.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {boolean} Whether the entity record has edits or not.\n */\nexport function hasEditsForEntityRecord( state, kind, name, recordId ) {\n\treturn (\n\t\tisSavingEntityRecord( state, kind, name, recordId ) ||\n\t\tObject.keys(\n\t\t\tgetEntityRecordNonTransientEdits( state, kind, name, recordId )\n\t\t).length > 0\n\t);\n}\n\n/**\n * Returns the specified entity record, merged with its edits.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number|string} recordId Record ID.\n *\n * @return {Object?} The entity record, merged with its edits.\n */\nexport const getEditedEntityRecord = createSelector(\n\t( state, kind, name, recordId ) => ( {\n\t\t...getRawEntityRecord( state, kind, name, recordId ),\n\t\t...getEntityRecordEdits( state, kind, name, recordId ),\n\t} ),\n\t( state, kind, name, recordId, query ) => {\n\t\tconst context = query?.context ?? 'default';\n\t\treturn [\n\t\t\tstate.entities.config,\n\t\t\tget( state.entities.records, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'items',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t\tget( state.entities.records, [\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\t'queriedData',\n\t\t\t\t'itemIsComplete',\n\t\t\t\tcontext,\n\t\t\t\trecordId,\n\t\t\t] ),\n\t\t\tget( state.entities.records, [ kind, name, 'edits', recordId ] ),\n\t\t];\n\t}\n);\n\n/**\n * Returns true if the specified entity record is autosaving, and false otherwise.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {boolean} Whether the entity record is autosaving or not.\n */\nexport function isAutosavingEntityRecord( state, kind, name, recordId ) {\n\tconst { pending, isAutosave } = get(\n\t\tstate.entities.records,\n\t\t[ kind, name, 'saving', recordId ],\n\t\t{}\n\t);\n\treturn Boolean( pending && isAutosave );\n}\n\n/**\n * Returns true if the specified entity record is saving, and false otherwise.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number|string} recordId Record ID.\n *\n * @return {boolean} Whether the entity record is saving or not.\n */\nexport function isSavingEntityRecord( state, kind, name, recordId ) {\n\treturn get(\n\t\tstate.entities.records,\n\t\t[ kind, name, 'saving', recordId, 'pending' ],\n\t\tfalse\n\t);\n}\n\n/**\n * Returns true if the specified entity record is deleting, and false otherwise.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {boolean} Whether the entity record is deleting or not.\n */\nexport function isDeletingEntityRecord( state, kind, name, recordId ) {\n\treturn get(\n\t\tstate.entities.records,\n\t\t[ kind, name, 'deleting', recordId, 'pending' ],\n\t\tfalse\n\t);\n}\n\n/**\n * Returns the specified entity record's last save error.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record's save error.\n */\nexport function getLastEntitySaveError( state, kind, name, recordId ) {\n\treturn get( state.entities.records, [\n\t\tkind,\n\t\tname,\n\t\t'saving',\n\t\trecordId,\n\t\t'error',\n\t] );\n}\n\n/**\n * Returns the specified entity record's last delete error.\n *\n * @param {Object} state State tree.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {number} recordId Record ID.\n *\n * @return {Object?} The entity record's save error.\n */\nexport function getLastEntityDeleteError( state, kind, name, recordId ) {\n\treturn get( state.entities.records, [\n\t\tkind,\n\t\tname,\n\t\t'deleting',\n\t\trecordId,\n\t\t'error',\n\t] );\n}\n\n/**\n * Returns the current undo offset for the\n * entity records edits history. The offset\n * represents how many items from the end\n * of the history stack we are at. 0 is the\n * last edit, -1 is the second last, and so on.\n *\n * @param {Object} state State tree.\n *\n * @return {number} The current undo offset.\n */\nfunction getCurrentUndoOffset( state ) {\n\treturn state.undo.offset;\n}\n\n/**\n * Returns the previous edit from the current undo offset\n * for the entity records edits history, if any.\n *\n * @param {Object} state State tree.\n *\n * @return {Object?} The edit.\n */\nexport function getUndoEdit( state ) {\n\treturn state.undo[ state.undo.length - 2 + getCurrentUndoOffset( state ) ];\n}\n\n/**\n * Returns the next edit from the current undo offset\n * for the entity records edits history, if any.\n *\n * @param {Object} state State tree.\n *\n * @return {Object?} The edit.\n */\nexport function getRedoEdit( state ) {\n\treturn state.undo[ state.undo.length + getCurrentUndoOffset( state ) ];\n}\n\n/**\n * Returns true if there is a previous edit from the current undo offset\n * for the entity records edits history, and false otherwise.\n *\n * @param {Object} state State tree.\n *\n * @return {boolean} Whether there is a previous edit or not.\n */\nexport function hasUndo( state ) {\n\treturn Boolean( getUndoEdit( state ) );\n}\n\n/**\n * Returns true if there is a next edit from the current undo offset\n * for the entity records edits history, and false otherwise.\n *\n * @param {Object} state State tree.\n *\n * @return {boolean} Whether there is a next edit or not.\n */\nexport function hasRedo( state ) {\n\treturn Boolean( getRedoEdit( state ) );\n}\n\n/**\n * Return the current theme.\n *\n * @param {Object} state Data state.\n *\n * @return {Object} The current theme.\n */\nexport function getCurrentTheme( state ) {\n\treturn getEntityRecord( state, 'root', 'theme', state.currentTheme );\n}\n\n/**\n * Return the ID of the current global styles object.\n *\n * @param {Object} state Data state.\n *\n * @return {string} The current global styles ID.\n */\nexport function __experimentalGetCurrentGlobalStylesId( state ) {\n\treturn state.currentGlobalStylesId;\n}\n\n/**\n * Return theme supports data in the index.\n *\n * @param {Object} state Data state.\n *\n * @return {*} Index data.\n */\nexport function getThemeSupports( state ) {\n\treturn getCurrentTheme( state )?.theme_supports ?? EMPTY_OBJECT;\n}\n\n/**\n * Returns the embed preview for the given URL.\n *\n * @param {Object} state Data state.\n * @param {string} url Embedded URL.\n *\n * @return {*} Undefined if the preview has not been fetched, otherwise, the preview fetched from the embed preview API.\n */\nexport function getEmbedPreview( state, url ) {\n\treturn state.embedPreviews[ url ];\n}\n\n/**\n * Determines if the returned preview is an oEmbed link fallback.\n *\n * WordPress can be configured to return a simple link to a URL if it is not embeddable.\n * We need to be able to determine if a URL is embeddable or not, based on what we\n * get back from the oEmbed preview API.\n *\n * @param {Object} state Data state.\n * @param {string} url Embedded URL.\n *\n * @return {boolean} Is the preview for the URL an oEmbed link fallback.\n */\nexport function isPreviewEmbedFallback( state, url ) {\n\tconst preview = state.embedPreviews[ url ];\n\tconst oEmbedLinkCheck = '<a href=\"' + url + '\">' + url + '</a>';\n\tif ( ! preview ) {\n\t\treturn false;\n\t}\n\treturn preview.html === oEmbedLinkCheck;\n}\n\n/**\n * Returns whether the current user can perform the given action on the given\n * REST resource.\n *\n * Calling this may trigger an OPTIONS request to the REST API via the\n * `canUser()` resolver.\n *\n * https://developer.wordpress.org/rest-api/reference/\n *\n * @param {Object} state Data state.\n * @param {string} action Action to check. One of: 'create', 'read', 'update', 'delete'.\n * @param {string} resource REST resource to check, e.g. 'media' or 'posts'.\n * @param {string=} id Optional ID of the rest resource to check.\n *\n * @return {boolean|undefined} Whether or not the user can perform the action,\n * or `undefined` if the OPTIONS request is still being made.\n */\nexport function canUser( state, action, resource, id ) {\n\tconst key = compact( [ action, resource, id ] ).join( '/' );\n\treturn get( state, [ 'userPermissions', key ] );\n}\n\n/**\n * Returns whether the current user can edit the given entity.\n *\n * Calling this may trigger an OPTIONS request to the REST API via the\n * `canUser()` resolver.\n *\n * https://developer.wordpress.org/rest-api/reference/\n *\n * @param {Object} state Data state.\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {string} recordId Record's id.\n * @return {boolean|undefined} Whether or not the user can edit,\n * or `undefined` if the OPTIONS request is still being made.\n */\nexport function canUserEditEntityRecord( state, kind, name, recordId ) {\n\tconst entityConfig = getEntityConfig( state, kind, name );\n\tif ( ! entityConfig ) {\n\t\treturn false;\n\t}\n\tconst resource = entityConfig.__unstable_rest_base;\n\n\treturn canUser( state, 'update', resource, recordId );\n}\n\n/**\n * Returns the latest autosaves for the post.\n *\n * May return multiple autosaves since the backend stores one autosave per\n * author for each post.\n *\n * @param {Object} state State tree.\n * @param {string} postType The type of the parent post.\n * @param {number} postId The id of the parent post.\n *\n * @return {?Array} An array of autosaves for the post, or undefined if there is none.\n */\nexport function getAutosaves( state, postType, postId ) {\n\treturn state.autosaves[ postId ];\n}\n\n/**\n * Returns the autosave for the post and author.\n *\n * @param {Object} state State tree.\n * @param {string} postType The type of the parent post.\n * @param {number} postId The id of the parent post.\n * @param {number} authorId The id of the author.\n *\n * @return {?Object} The autosave for the post and author.\n */\nexport function getAutosave( state, postType, postId, authorId ) {\n\tif ( authorId === undefined ) {\n\t\treturn;\n\t}\n\n\tconst autosaves = state.autosaves[ postId ];\n\treturn find( autosaves, { author: authorId } );\n}\n\n/**\n * Returns true if the REST request for autosaves has completed.\n *\n * @param {Object} state State tree.\n * @param {string} postType The type of the parent post.\n * @param {number} postId The id of the parent post.\n *\n * @return {boolean} True if the REST request was completed. False otherwise.\n */\nexport const hasFetchedAutosaves = createRegistrySelector(\n\t( select ) => ( state, postType, postId ) => {\n\t\treturn select( STORE_NAME ).hasFinishedResolution( 'getAutosaves', [\n\t\t\tpostType,\n\t\t\tpostId,\n\t\t] );\n\t}\n);\n\n/**\n * Returns a new reference when edited values have changed. This is useful in\n * inferring where an edit has been made between states by comparison of the\n * return values using strict equality.\n *\n * @example\n *\n * ```\n * const hasEditOccurred = (\n * getReferenceByDistinctEdits( beforeState ) !==\n * getReferenceByDistinctEdits( afterState )\n * );\n * ```\n *\n * @param {Object} state Editor state.\n *\n * @return {*} A value whose reference will change only when an edit occurs.\n */\nexport const getReferenceByDistinctEdits = createSelector(\n\t() => [],\n\t( state ) => [\n\t\tstate.undo.length,\n\t\tstate.undo.offset,\n\t\tstate.undo.flattenedUndo,\n\t]\n);\n\n/**\n * Retrieve the frontend template used for a given link.\n *\n * @param {Object} state Editor state.\n * @param {string} link Link.\n *\n * @return {Object?} The template record.\n */\nexport function __experimentalGetTemplateForLink( state, link ) {\n\tconst records = getEntityRecords( state, 'postType', 'wp_template', {\n\t\t'find-template': link,\n\t} );\n\n\tconst template = records?.length ? records[ 0 ] : null;\n\tif ( template ) {\n\t\treturn getEditedEntityRecord(\n\t\t\tstate,\n\t\t\t'postType',\n\t\t\t'wp_template',\n\t\t\ttemplate.id\n\t\t);\n\t}\n\treturn template;\n}\n\n/**\n * Retrieve the current theme's base global styles\n *\n * @param {Object} state Editor state.\n *\n * @return {Object|null} The Global Styles object.\n */\nexport function __experimentalGetCurrentThemeBaseGlobalStyles( state ) {\n\tconst currentTheme = getCurrentTheme( state );\n\tif ( ! currentTheme ) {\n\t\treturn null;\n\t}\n\treturn state.themeBaseGlobalStyles[ currentTheme.stylesheet ];\n}\n\n/**\n * Return the ID of the current global styles object.\n *\n * @param {Object} state Data state.\n *\n * @return {string|null} The current global styles ID.\n */\nexport function __experimentalGetCurrentThemeGlobalStylesVariations( state ) {\n\tconst currentTheme = getCurrentTheme( state );\n\tif ( ! currentTheme ) {\n\t\treturn null;\n\t}\n\treturn state.themeGlobalStyleVariations[ currentTheme.stylesheet ];\n}\n"]}
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { isEqual } from 'lodash';
5
5
  /**
6
- * Given the current and next item entity, returns the minimally "modified"
6
+ * Given the current and next item entity record, returns the minimally "modified"
7
7
  * result of the next item, preferring value references from the original item
8
8
  * if equal. If all values match, the original item is returned.
9
9
  *
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/core-data/src/utils/conservative-map-item.js"],"names":["isEqual","conservativeMapItem","item","nextItem","hasChanges","result","key","hasOwnProperty"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,QAAxB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,mBAAT,CAA8BC,IAA9B,EAAoCC,QAApC,EAA+C;AAC7D;AACA,MAAK,CAAED,IAAP,EAAc;AACb,WAAOC,QAAP;AACA;;AAED,MAAIC,UAAU,GAAG,KAAjB;AACA,QAAMC,MAAM,GAAG,EAAf;;AACA,OAAM,MAAMC,GAAZ,IAAmBH,QAAnB,EAA8B;AAC7B,QAAKH,OAAO,CAAEE,IAAI,CAAEI,GAAF,CAAN,EAAeH,QAAQ,CAAEG,GAAF,CAAvB,CAAZ,EAA+C;AAC9CD,MAAAA,MAAM,CAAEC,GAAF,CAAN,GAAgBJ,IAAI,CAAEI,GAAF,CAApB;AACA,KAFD,MAEO;AACNF,MAAAA,UAAU,GAAG,IAAb;AACAC,MAAAA,MAAM,CAAEC,GAAF,CAAN,GAAgBH,QAAQ,CAAEG,GAAF,CAAxB;AACA;AACD;;AAED,MAAK,CAAEF,UAAP,EAAoB;AACnB,WAAOF,IAAP;AACA,GAnB4D,CAqB7D;AACA;AACA;;;AACA,OAAM,MAAMI,GAAZ,IAAmBJ,IAAnB,EAA0B;AACzB,QAAK,CAAEG,MAAM,CAACE,cAAP,CAAuBD,GAAvB,CAAP,EAAsC;AACrCD,MAAAA,MAAM,CAAEC,GAAF,CAAN,GAAgBJ,IAAI,CAAEI,GAAF,CAApB;AACA;AACD;;AAED,SAAOD,MAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { isEqual } from 'lodash';\n\n/**\n * Given the current and next item entity, returns the minimally \"modified\"\n * result of the next item, preferring value references from the original item\n * if equal. If all values match, the original item is returned.\n *\n * @param {Object} item Original item.\n * @param {Object} nextItem Next item.\n *\n * @return {Object} Minimally modified merged item.\n */\nexport default function conservativeMapItem( item, nextItem ) {\n\t// Return next item in its entirety if there is no original item.\n\tif ( ! item ) {\n\t\treturn nextItem;\n\t}\n\n\tlet hasChanges = false;\n\tconst result = {};\n\tfor ( const key in nextItem ) {\n\t\tif ( isEqual( item[ key ], nextItem[ key ] ) ) {\n\t\t\tresult[ key ] = item[ key ];\n\t\t} else {\n\t\t\thasChanges = true;\n\t\t\tresult[ key ] = nextItem[ key ];\n\t\t}\n\t}\n\n\tif ( ! hasChanges ) {\n\t\treturn item;\n\t}\n\n\t// Only at this point, backfill properties from the original item which\n\t// weren't explicitly set into the result above. This is an optimization\n\t// to allow `hasChanges` to return early.\n\tfor ( const key in item ) {\n\t\tif ( ! result.hasOwnProperty( key ) ) {\n\t\t\tresult[ key ] = item[ key ];\n\t\t}\n\t}\n\n\treturn result;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/core-data/src/utils/conservative-map-item.js"],"names":["isEqual","conservativeMapItem","item","nextItem","hasChanges","result","key","hasOwnProperty"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,QAAxB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,mBAAT,CAA8BC,IAA9B,EAAoCC,QAApC,EAA+C;AAC7D;AACA,MAAK,CAAED,IAAP,EAAc;AACb,WAAOC,QAAP;AACA;;AAED,MAAIC,UAAU,GAAG,KAAjB;AACA,QAAMC,MAAM,GAAG,EAAf;;AACA,OAAM,MAAMC,GAAZ,IAAmBH,QAAnB,EAA8B;AAC7B,QAAKH,OAAO,CAAEE,IAAI,CAAEI,GAAF,CAAN,EAAeH,QAAQ,CAAEG,GAAF,CAAvB,CAAZ,EAA+C;AAC9CD,MAAAA,MAAM,CAAEC,GAAF,CAAN,GAAgBJ,IAAI,CAAEI,GAAF,CAApB;AACA,KAFD,MAEO;AACNF,MAAAA,UAAU,GAAG,IAAb;AACAC,MAAAA,MAAM,CAAEC,GAAF,CAAN,GAAgBH,QAAQ,CAAEG,GAAF,CAAxB;AACA;AACD;;AAED,MAAK,CAAEF,UAAP,EAAoB;AACnB,WAAOF,IAAP;AACA,GAnB4D,CAqB7D;AACA;AACA;;;AACA,OAAM,MAAMI,GAAZ,IAAmBJ,IAAnB,EAA0B;AACzB,QAAK,CAAEG,MAAM,CAACE,cAAP,CAAuBD,GAAvB,CAAP,EAAsC;AACrCD,MAAAA,MAAM,CAAEC,GAAF,CAAN,GAAgBJ,IAAI,CAAEI,GAAF,CAApB;AACA;AACD;;AAED,SAAOD,MAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { isEqual } from 'lodash';\n\n/**\n * Given the current and next item entity record, returns the minimally \"modified\"\n * result of the next item, preferring value references from the original item\n * if equal. If all values match, the original item is returned.\n *\n * @param {Object} item Original item.\n * @param {Object} nextItem Next item.\n *\n * @return {Object} Minimally modified merged item.\n */\nexport default function conservativeMapItem( item, nextItem ) {\n\t// Return next item in its entirety if there is no original item.\n\tif ( ! item ) {\n\t\treturn nextItem;\n\t}\n\n\tlet hasChanges = false;\n\tconst result = {};\n\tfor ( const key in nextItem ) {\n\t\tif ( isEqual( item[ key ], nextItem[ key ] ) ) {\n\t\t\tresult[ key ] = item[ key ];\n\t\t} else {\n\t\t\thasChanges = true;\n\t\t\tresult[ key ] = nextItem[ key ];\n\t\t}\n\t}\n\n\tif ( ! hasChanges ) {\n\t\treturn item;\n\t}\n\n\t// Only at this point, backfill properties from the original item which\n\t// weren't explicitly set into the result above. This is an optimization\n\t// to allow `hasChanges` to return early.\n\tfor ( const key in item ) {\n\t\tif ( ! result.hasOwnProperty( key ) ) {\n\t\t\tresult[ key ] = item[ key ];\n\t\t}\n\t}\n\n\treturn result;\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Checks whether the attribute is a "raw" attribute or not.
3
3
  *
4
- * @param {Object} entity Entity data.
4
+ * @param {Object} entity Entity record.
5
5
  * @param {string} attribute Attribute name.
6
6
  *
7
7
  * @return {boolean} Is the attribute raw
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/core-data/src/utils/is-raw-attribute.js"],"names":["isRawAttribute","entity","attribute","rawAttributes","includes"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,cAAT,CAAyBC,MAAzB,EAAiCC,SAAjC,EAA6C;AAC3D,SAAO,CAAED,MAAM,CAACE,aAAP,IAAwB,EAA1B,EAA+BC,QAA/B,CAAyCF,SAAzC,CAAP;AACA","sourcesContent":["/**\n * Checks whether the attribute is a \"raw\" attribute or not.\n *\n * @param {Object} entity Entity data.\n * @param {string} attribute Attribute name.\n *\n * @return {boolean} Is the attribute raw\n */\nexport default function isRawAttribute( entity, attribute ) {\n\treturn ( entity.rawAttributes || [] ).includes( attribute );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/core-data/src/utils/is-raw-attribute.js"],"names":["isRawAttribute","entity","attribute","rawAttributes","includes"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,cAAT,CAAyBC,MAAzB,EAAiCC,SAAjC,EAA6C;AAC3D,SAAO,CAAED,MAAM,CAACE,aAAP,IAAwB,EAA1B,EAA+BC,QAA/B,CAAyCF,SAAzC,CAAP;AACA","sourcesContent":["/**\n * Checks whether the attribute is a \"raw\" attribute or not.\n *\n * @param {Object} entity Entity record.\n * @param {string} attribute Attribute name.\n *\n * @return {boolean} Is the attribute raw\n */\nexport default function isRawAttribute( entity, attribute ) {\n\treturn ( entity.rawAttributes || [] ).includes( attribute );\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/core-data",
3
- "version": "4.2.1",
3
+ "version": "4.3.0",
4
4
  "description": "Access to and manipulation of core WordPress entities.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -30,15 +30,15 @@
30
30
  ],
31
31
  "dependencies": {
32
32
  "@babel/runtime": "^7.16.0",
33
- "@wordpress/api-fetch": "^6.1.1",
34
- "@wordpress/blocks": "^11.3.1",
35
- "@wordpress/data": "^6.4.1",
36
- "@wordpress/deprecated": "^3.4.1",
37
- "@wordpress/element": "^4.2.1",
38
- "@wordpress/html-entities": "^3.4.1",
39
- "@wordpress/i18n": "^4.4.1",
40
- "@wordpress/is-shallow-equal": "^4.4.1",
41
- "@wordpress/url": "^3.5.1",
33
+ "@wordpress/api-fetch": "^6.2.0",
34
+ "@wordpress/blocks": "^11.4.0",
35
+ "@wordpress/data": "^6.5.0",
36
+ "@wordpress/deprecated": "^3.5.0",
37
+ "@wordpress/element": "^4.3.0",
38
+ "@wordpress/html-entities": "^3.5.0",
39
+ "@wordpress/i18n": "^4.5.0",
40
+ "@wordpress/is-shallow-equal": "^4.5.0",
41
+ "@wordpress/url": "^3.6.0",
42
42
  "equivalent-key-map": "^0.2.2",
43
43
  "lodash": "^4.17.21",
44
44
  "memize": "^1.1.0",
@@ -51,5 +51,5 @@
51
51
  "publishConfig": {
52
52
  "access": "public"
53
53
  },
54
- "gitHead": "3494eafea7cb345728166c902b3d1223c4a8db6f"
54
+ "gitHead": "aa003c3634016cc4ab6348b2106907e371c648e1"
55
55
  }
package/src/actions.js CHANGED
@@ -15,7 +15,7 @@ import deprecated from '@wordpress/deprecated';
15
15
  * Internal dependencies
16
16
  */
17
17
  import { receiveItems, removeItems, receiveQueriedItems } from './queried-data';
18
- import { getKindEntities, DEFAULT_ENTITY_KEY } from './entities';
18
+ import { getOrLoadEntitiesConfig, DEFAULT_ENTITY_KEY } from './entities';
19
19
  import { createBatch } from './batch';
20
20
  import { STORE_NAME } from './name';
21
21
 
@@ -66,8 +66,8 @@ export function addEntities( entities ) {
66
66
  /**
67
67
  * Returns an action object used in signalling that entity records have been received.
68
68
  *
69
- * @param {string} kind Kind of the received entity.
70
- * @param {string} name Name of the received entity.
69
+ * @param {string} kind Kind of the received entity record.
70
+ * @param {string} name Name of the received entity record.
71
71
  * @param {Array|Object} records Records received.
72
72
  * @param {?Object} query Query Object.
73
73
  * @param {?boolean} invalidateCache Should invalidate query caches.
@@ -209,34 +209,36 @@ export function receiveEmbedPreview( url, preview ) {
209
209
  /**
210
210
  * Action triggered to delete an entity record.
211
211
  *
212
- * @param {string} kind Kind of the deleted entity.
213
- * @param {string} name Name of the deleted entity.
214
- * @param {string} recordId Record ID of the deleted entity.
215
- * @param {?Object} query Special query parameters for the
216
- * DELETE API call.
217
- * @param {Object} [options] Delete options.
218
- * @param {Function} [options.__unstableFetch] Internal use only. Function to
219
- * call instead of `apiFetch()`.
220
- * Must return a promise.
212
+ * @param {string} kind Kind of the deleted entity.
213
+ * @param {string} name Name of the deleted entity.
214
+ * @param {string} recordId Record ID of the deleted entity.
215
+ * @param {?Object} query Special query parameters for the
216
+ * DELETE API call.
217
+ * @param {Object} [options] Delete options.
218
+ * @param {Function} [options.__unstableFetch] Internal use only. Function to
219
+ * call instead of `apiFetch()`.
220
+ * Must return a promise.
221
+ * @param {boolean} [options.throwOnError=false] If false, this action suppresses all
222
+ * the exceptions. Defaults to false.
221
223
  */
222
224
  export const deleteEntityRecord = (
223
225
  kind,
224
226
  name,
225
227
  recordId,
226
228
  query,
227
- { __unstableFetch = apiFetch } = {}
229
+ { __unstableFetch = apiFetch, throwOnError = false } = {}
228
230
  ) => async ( { dispatch } ) => {
229
- const entities = await dispatch( getKindEntities( kind ) );
230
- const entity = find( entities, { kind, name } );
231
+ const configs = await dispatch( getOrLoadEntitiesConfig( kind ) );
232
+ const entityConfig = find( configs, { kind, name } );
231
233
  let error;
232
234
  let deletedRecord = false;
233
- if ( ! entity || entity?.__experimentalNoFetch ) {
235
+ if ( ! entityConfig || entityConfig?.__experimentalNoFetch ) {
234
236
  return;
235
237
  }
236
238
 
237
239
  const lock = await dispatch.__unstableAcquireStoreLock(
238
240
  STORE_NAME,
239
- [ 'entities', 'data', kind, name, recordId ],
241
+ [ 'entities', 'records', kind, name, recordId ],
240
242
  { exclusive: true }
241
243
  );
242
244
 
@@ -248,8 +250,9 @@ export const deleteEntityRecord = (
248
250
  recordId,
249
251
  } );
250
252
 
253
+ let hasError = false;
251
254
  try {
252
- let path = `${ entity.baseURL }/${ recordId }`;
255
+ let path = `${ entityConfig.baseURL }/${ recordId }`;
253
256
 
254
257
  if ( query ) {
255
258
  path = addQueryArgs( path, query );
@@ -262,6 +265,7 @@ export const deleteEntityRecord = (
262
265
 
263
266
  await dispatch( removeItems( kind, name, recordId, true ) );
264
267
  } catch ( _error ) {
268
+ hasError = true;
265
269
  error = _error;
266
270
  }
267
271
 
@@ -273,6 +277,10 @@ export const deleteEntityRecord = (
273
277
  error,
274
278
  } );
275
279
 
280
+ if ( hasError && throwOnError ) {
281
+ throw error;
282
+ }
283
+
276
284
  return deletedRecord;
277
285
  } finally {
278
286
  dispatch.__unstableReleaseStoreLock( lock );
@@ -299,13 +307,13 @@ export const editEntityRecord = (
299
307
  edits,
300
308
  options = {}
301
309
  ) => ( { select, dispatch } ) => {
302
- const entity = select.getEntity( kind, name );
303
- if ( ! entity ) {
310
+ const entityConfig = select.getEntityConfig( kind, name );
311
+ if ( ! entityConfig ) {
304
312
  throw new Error(
305
313
  `The entity being edited (${ kind }, ${ name }) does not have a loaded config.`
306
314
  );
307
315
  }
308
- const { transientEdits = {}, mergedEdits = {} } = entity;
316
+ const { transientEdits = {}, mergedEdits = {} } = entityConfig;
309
317
  const record = select.getRawEntityRecord( kind, name, recordId );
310
318
  const editedRecord = select.getEditedEntityRecord( kind, name, recordId );
311
319
 
@@ -386,32 +394,38 @@ export function __unstableCreateUndoLevel() {
386
394
  /**
387
395
  * Action triggered to save an entity record.
388
396
  *
389
- * @param {string} kind Kind of the received entity.
390
- * @param {string} name Name of the received entity.
391
- * @param {Object} record Record to be saved.
392
- * @param {Object} options Saving options.
393
- * @param {boolean} [options.isAutosave=false] Whether this is an autosave.
394
- * @param {Function} [options.__unstableFetch] Internal use only. Function to
395
- * call instead of `apiFetch()`.
396
- * Must return a promise.
397
+ * @param {string} kind Kind of the received entity.
398
+ * @param {string} name Name of the received entity.
399
+ * @param {Object} record Record to be saved.
400
+ * @param {Object} options Saving options.
401
+ * @param {boolean} [options.isAutosave=false] Whether this is an autosave.
402
+ * @param {Function} [options.__unstableFetch] Internal use only. Function to
403
+ * call instead of `apiFetch()`.
404
+ * Must return a promise.
405
+ * @param {boolean} [options.throwOnError=false] If false, this action suppresses all
406
+ * the exceptions. Defaults to false.
397
407
  */
398
408
  export const saveEntityRecord = (
399
409
  kind,
400
410
  name,
401
411
  record,
402
- { isAutosave = false, __unstableFetch = apiFetch } = {}
412
+ {
413
+ isAutosave = false,
414
+ __unstableFetch = apiFetch,
415
+ throwOnError = false,
416
+ } = {}
403
417
  ) => async ( { select, resolveSelect, dispatch } ) => {
404
- const entities = await dispatch( getKindEntities( kind ) );
405
- const entity = find( entities, { kind, name } );
406
- if ( ! entity || entity?.__experimentalNoFetch ) {
418
+ const configs = await dispatch( getOrLoadEntitiesConfig( kind ) );
419
+ const entityConfig = find( configs, { kind, name } );
420
+ if ( ! entityConfig || entityConfig?.__experimentalNoFetch ) {
407
421
  return;
408
422
  }
409
- const entityIdKey = entity.key || DEFAULT_ENTITY_KEY;
423
+ const entityIdKey = entityConfig.key || DEFAULT_ENTITY_KEY;
410
424
  const recordId = record[ entityIdKey ];
411
425
 
412
426
  const lock = await dispatch.__unstableAcquireStoreLock(
413
427
  STORE_NAME,
414
- [ 'entities', 'data', kind, name, recordId || uuid() ],
428
+ [ 'entities', 'records', kind, name, recordId || uuid() ],
415
429
  { exclusive: true }
416
430
  );
417
431
 
@@ -445,8 +459,9 @@ export const saveEntityRecord = (
445
459
  } );
446
460
  let updatedRecord;
447
461
  let error;
462
+ let hasError = false;
448
463
  try {
449
- const path = `${ entity.baseURL }${
464
+ const path = `${ entityConfig.baseURL }${
450
465
  recordId ? '/' + recordId : ''
451
466
  }`;
452
467
  const persistedRecord = select.getRawEntityRecord(
@@ -543,10 +558,10 @@ export const saveEntityRecord = (
543
558
  }
544
559
  } else {
545
560
  let edits = record;
546
- if ( entity.__unstablePrePersist ) {
561
+ if ( entityConfig.__unstablePrePersist ) {
547
562
  edits = {
548
563
  ...edits,
549
- ...entity.__unstablePrePersist(
564
+ ...entityConfig.__unstablePrePersist(
550
565
  persistedRecord,
551
566
  edits
552
567
  ),
@@ -567,6 +582,7 @@ export const saveEntityRecord = (
567
582
  );
568
583
  }
569
584
  } catch ( _error ) {
585
+ hasError = true;
570
586
  error = _error;
571
587
  }
572
588
  dispatch( {
@@ -578,6 +594,10 @@ export const saveEntityRecord = (
578
594
  isAutosave,
579
595
  } );
580
596
 
597
+ if ( hasError && throwOnError ) {
598
+ throw error;
599
+ }
600
+
581
601
  return updatedRecord;
582
602
  } finally {
583
603
  dispatch.__unstableReleaseStoreLock( lock );
@@ -659,12 +679,12 @@ export const saveEditedEntityRecord = (
659
679
  if ( ! select.hasEditsForEntityRecord( kind, name, recordId ) ) {
660
680
  return;
661
681
  }
662
- const entities = await dispatch( getKindEntities( kind ) );
663
- const entity = find( entities, { kind, name } );
664
- if ( ! entity ) {
682
+ const configs = await dispatch( getOrLoadEntitiesConfig( kind ) );
683
+ const entityConfig = find( configs, { kind, name } );
684
+ if ( ! entityConfig ) {
665
685
  return;
666
686
  }
667
- const entityIdKey = entity.key || DEFAULT_ENTITY_KEY;
687
+ const entityIdKey = entityConfig.key || DEFAULT_ENTITY_KEY;
668
688
 
669
689
  const edits = select.getEntityRecordNonTransientEdits(
670
690
  kind,