@wordpress/core-data 4.13.0 → 5.0.1-next.957ca95e4c.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 (201) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +148 -65
  3. package/build/entities.js +38 -51
  4. package/build/entities.js.map +1 -1
  5. package/build/hooks/index.js +14 -0
  6. package/build/hooks/index.js.map +1 -1
  7. package/build/hooks/use-entity-record.js +10 -6
  8. package/build/hooks/use-entity-record.js.map +1 -1
  9. package/build/hooks/use-entity-records.js +2 -0
  10. package/build/hooks/use-entity-records.js.map +1 -1
  11. package/build/hooks/use-query-select.js +5 -2
  12. package/build/hooks/use-query-select.js.map +1 -1
  13. package/build/hooks/use-resource-permissions.js +74 -11
  14. package/build/hooks/use-resource-permissions.js.map +1 -1
  15. package/build/index.js +1 -30
  16. package/build/index.js.map +1 -1
  17. package/build/resolvers.js +17 -21
  18. package/build/resolvers.js.map +1 -1
  19. package/build/selectors.js +9 -46
  20. package/build/selectors.js.map +1 -1
  21. package/build-module/entities.js +38 -52
  22. package/build-module/entities.js.map +1 -1
  23. package/build-module/hooks/index.js +1 -0
  24. package/build-module/hooks/index.js.map +1 -1
  25. package/build-module/hooks/use-entity-record.js +10 -6
  26. package/build-module/hooks/use-entity-record.js.map +1 -1
  27. package/build-module/hooks/use-entity-records.js +2 -0
  28. package/build-module/hooks/use-entity-records.js.map +1 -1
  29. package/build-module/hooks/use-query-select.js +4 -1
  30. package/build-module/hooks/use-query-select.js.map +1 -1
  31. package/build-module/hooks/use-resource-permissions.js +70 -10
  32. package/build-module/hooks/use-resource-permissions.js.map +1 -1
  33. package/build-module/index.js +0 -5
  34. package/build-module/index.js.map +1 -1
  35. package/build-module/resolvers.js +17 -21
  36. package/build-module/resolvers.js.map +1 -1
  37. package/build-module/selectors.js +7 -44
  38. package/build-module/selectors.js.map +1 -1
  39. package/build-types/actions.d.ts +188 -0
  40. package/build-types/actions.d.ts.map +1 -0
  41. package/build-types/batch/create-batch.d.ts +71 -0
  42. package/build-types/batch/create-batch.d.ts.map +1 -0
  43. package/build-types/batch/default-processor.d.ts +11 -0
  44. package/build-types/batch/default-processor.d.ts.map +1 -0
  45. package/build-types/batch/index.d.ts +3 -0
  46. package/build-types/batch/index.d.ts.map +1 -0
  47. package/build-types/entities.d.ts +128 -0
  48. package/build-types/entities.d.ts.map +1 -0
  49. package/build-types/entity-provider.d.ts +68 -0
  50. package/build-types/entity-provider.d.ts.map +1 -0
  51. package/build-types/entity-types/attachment.d.ts +121 -0
  52. package/build-types/entity-types/attachment.d.ts.map +1 -0
  53. package/build-types/entity-types/base-entity-records.d.ts +37 -0
  54. package/build-types/entity-types/base-entity-records.d.ts.map +1 -0
  55. package/build-types/entity-types/comment.d.ts +82 -0
  56. package/build-types/entity-types/comment.d.ts.map +1 -0
  57. package/build-types/entity-types/helpers.d.ts +123 -0
  58. package/build-types/entity-types/helpers.d.ts.map +1 -0
  59. package/build-types/entity-types/index.d.ts +64 -0
  60. package/build-types/entity-types/index.d.ts.map +1 -0
  61. package/build-types/entity-types/menu-location.d.ts +25 -0
  62. package/build-types/entity-types/menu-location.d.ts.map +1 -0
  63. package/build-types/entity-types/nav-menu-item.d.ts +88 -0
  64. package/build-types/entity-types/nav-menu-item.d.ts.map +1 -0
  65. package/build-types/entity-types/nav-menu.d.ts +45 -0
  66. package/build-types/entity-types/nav-menu.d.ts.map +1 -0
  67. package/build-types/entity-types/page.d.ts +120 -0
  68. package/build-types/entity-types/page.d.ts.map +1 -0
  69. package/build-types/entity-types/plugin.d.ts +62 -0
  70. package/build-types/entity-types/plugin.d.ts.map +1 -0
  71. package/build-types/entity-types/post.d.ts +128 -0
  72. package/build-types/entity-types/post.d.ts.map +1 -0
  73. package/build-types/entity-types/settings.d.ts +89 -0
  74. package/build-types/entity-types/settings.d.ts.map +1 -0
  75. package/build-types/entity-types/sidebar.d.ts +55 -0
  76. package/build-types/entity-types/sidebar.d.ts.map +1 -0
  77. package/build-types/entity-types/taxonomy.d.ts +83 -0
  78. package/build-types/entity-types/taxonomy.d.ts.map +1 -0
  79. package/build-types/entity-types/theme.d.ts +206 -0
  80. package/build-types/entity-types/theme.d.ts.map +1 -0
  81. package/build-types/entity-types/type.d.ts +71 -0
  82. package/build-types/entity-types/type.d.ts.map +1 -0
  83. package/build-types/entity-types/user.d.ts +93 -0
  84. package/build-types/entity-types/user.d.ts.map +1 -0
  85. package/build-types/entity-types/widget-type.d.ts +33 -0
  86. package/build-types/entity-types/widget-type.d.ts.map +1 -0
  87. package/build-types/entity-types/widget.d.ts +59 -0
  88. package/build-types/entity-types/widget.d.ts.map +1 -0
  89. package/build-types/entity-types/wp-template-part.d.ts +80 -0
  90. package/build-types/entity-types/wp-template-part.d.ts.map +1 -0
  91. package/build-types/entity-types/wp-template.d.ts +80 -0
  92. package/build-types/entity-types/wp-template.d.ts.map +1 -0
  93. package/build-types/fetch/__experimental-fetch-link-suggestions.d.ts +139 -0
  94. package/build-types/fetch/__experimental-fetch-link-suggestions.d.ts.map +1 -0
  95. package/build-types/fetch/__experimental-fetch-url-data.d.ts +35 -0
  96. package/build-types/fetch/__experimental-fetch-url-data.d.ts.map +1 -0
  97. package/build-types/fetch/index.d.ts +3 -0
  98. package/build-types/fetch/index.d.ts.map +1 -0
  99. package/build-types/hooks/constants.d.ts +7 -0
  100. package/build-types/hooks/constants.d.ts.map +1 -0
  101. package/build-types/hooks/index.d.ts +4 -0
  102. package/build-types/hooks/index.d.ts.map +1 -0
  103. package/build-types/hooks/memoize.d.ts +3 -0
  104. package/build-types/hooks/memoize.d.ts.map +1 -0
  105. package/build-types/hooks/use-entity-record.d.ts +124 -0
  106. package/build-types/hooks/use-entity-record.d.ts.map +1 -0
  107. package/build-types/hooks/use-entity-records.d.ts +49 -0
  108. package/build-types/hooks/use-entity-records.d.ts.map +1 -0
  109. package/build-types/hooks/use-query-select.d.ts +46 -0
  110. package/build-types/hooks/use-query-select.d.ts.map +1 -0
  111. package/build-types/hooks/use-resource-permissions.d.ts +99 -0
  112. package/build-types/hooks/use-resource-permissions.d.ts.map +1 -0
  113. package/build-types/index.d.ts +131 -0
  114. package/build-types/index.d.ts.map +1 -0
  115. package/build-types/locks/actions.d.ts +7 -0
  116. package/build-types/locks/actions.d.ts.map +1 -0
  117. package/build-types/locks/engine.d.ts +5 -0
  118. package/build-types/locks/engine.d.ts.map +1 -0
  119. package/build-types/locks/reducer.d.ts +10 -0
  120. package/build-types/locks/reducer.d.ts.map +1 -0
  121. package/build-types/locks/selectors.d.ts +5 -0
  122. package/build-types/locks/selectors.d.ts.map +1 -0
  123. package/build-types/locks/utils.d.ts +8 -0
  124. package/build-types/locks/utils.d.ts.map +1 -0
  125. package/build-types/name.d.ts +8 -0
  126. package/build-types/name.d.ts.map +1 -0
  127. package/build-types/queried-data/actions.d.ts +32 -0
  128. package/build-types/queried-data/actions.d.ts.map +1 -0
  129. package/build-types/queried-data/get-query-parts.d.ts +60 -0
  130. package/build-types/queried-data/get-query-parts.d.ts.map +1 -0
  131. package/build-types/queried-data/index.d.ts +4 -0
  132. package/build-types/queried-data/index.d.ts.map +1 -0
  133. package/build-types/queried-data/reducer.d.ts +54 -0
  134. package/build-types/queried-data/reducer.d.ts.map +1 -0
  135. package/build-types/queried-data/selectors.d.ts +16 -0
  136. package/build-types/queried-data/selectors.d.ts.map +1 -0
  137. package/build-types/reducer.d.ts +156 -0
  138. package/build-types/reducer.d.ts.map +1 -0
  139. package/build-types/resolvers.d.ts +74 -0
  140. package/build-types/resolvers.d.ts.map +1 -0
  141. package/build-types/selectors.d.ts +524 -0
  142. package/build-types/selectors.d.ts.map +1 -0
  143. package/build-types/types.d.ts +4 -0
  144. package/build-types/types.d.ts.map +1 -0
  145. package/build-types/utils/conservative-map-item.d.ts +12 -0
  146. package/build-types/utils/conservative-map-item.d.ts.map +1 -0
  147. package/build-types/utils/forward-resolver.d.ts +10 -0
  148. package/build-types/utils/forward-resolver.d.ts.map +1 -0
  149. package/build-types/utils/get-normalized-comma-separable.d.ts +12 -0
  150. package/build-types/utils/get-normalized-comma-separable.d.ts.map +1 -0
  151. package/build-types/utils/if-matching-action.d.ts +14 -0
  152. package/build-types/utils/if-matching-action.d.ts.map +1 -0
  153. package/build-types/utils/index.d.ts +9 -0
  154. package/build-types/utils/index.d.ts.map +1 -0
  155. package/build-types/utils/is-raw-attribute.d.ts +10 -0
  156. package/build-types/utils/is-raw-attribute.d.ts.map +1 -0
  157. package/build-types/utils/on-sub-key.d.ts +4 -0
  158. package/build-types/utils/on-sub-key.d.ts.map +1 -0
  159. package/build-types/utils/replace-action.d.ts +13 -0
  160. package/build-types/utils/replace-action.d.ts.map +1 -0
  161. package/build-types/utils/with-weak-map-cache.d.ts +12 -0
  162. package/build-types/utils/with-weak-map-cache.d.ts.map +1 -0
  163. package/package.json +13 -11
  164. package/src/entities.js +325 -0
  165. package/src/entity-types/attachment.ts +3 -4
  166. package/src/entity-types/comment.ts +3 -4
  167. package/src/entity-types/index.ts +31 -88
  168. package/src/entity-types/menu-location.ts +3 -4
  169. package/src/entity-types/nav-menu-item.ts +3 -4
  170. package/src/entity-types/nav-menu.ts +3 -3
  171. package/src/entity-types/page.ts +3 -3
  172. package/src/entity-types/plugin.ts +3 -3
  173. package/src/entity-types/post.ts +3 -3
  174. package/src/entity-types/settings.ts +3 -3
  175. package/src/entity-types/sidebar.ts +3 -4
  176. package/src/entity-types/taxonomy.ts +3 -4
  177. package/src/entity-types/theme.ts +7 -3
  178. package/src/entity-types/type.ts +3 -3
  179. package/src/entity-types/user.ts +3 -3
  180. package/src/entity-types/widget-type.ts +3 -4
  181. package/src/entity-types/widget.ts +3 -3
  182. package/src/entity-types/wp-template-part.ts +3 -4
  183. package/src/entity-types/wp-template.ts +3 -4
  184. package/src/hooks/index.ts +4 -0
  185. package/src/hooks/test/use-entity-record.js +41 -1
  186. package/src/hooks/test/use-resource-permissions.js +32 -36
  187. package/src/hooks/use-entity-record.ts +18 -6
  188. package/src/hooks/use-entity-records.ts +2 -0
  189. package/src/hooks/use-query-select.ts +4 -1
  190. package/src/hooks/use-resource-permissions.ts +84 -20
  191. package/src/index.js +0 -5
  192. package/src/resolvers.js +36 -24
  193. package/src/selectors.ts +202 -341
  194. package/tsconfig.json +21 -0
  195. package/tsconfig.tsbuildinfo +1 -0
  196. package/build/entity-types/entities.js +0 -6
  197. package/build/entity-types/entities.js.map +0 -1
  198. package/build-module/entity-types/entities.js +0 -2
  199. package/build-module/entity-types/entities.js.map +0 -1
  200. package/src/entities.ts +0 -548
  201. package/src/entity-types/entities.ts +0 -130
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/core-data/src/selectors.ts"],"names":["EMPTY_OBJECT","isRequestingEmbedPreview","select","state","url","STORE_NAME","isResolving","getAuthors","query","since","alternative","path","getUserQueryResults","getCurrentUser","currentUser","queryID","queryResults","users","queries","id","byId","getEntitiesByKind","kind","getEntitiesConfig","entities","config","getEntity","name","getEntityConfig","getEntityRecord","key","queriedState","records","undefined","context","itemIsComplete","items","item","_fields","filteredItem","fields","f","length","field","split","value","recordId","__experimentalGetEntityRecordNoResolver","getRawEntityRecord","record","Object","keys","reduce","accumulator","_key","hasEntityRecords","Array","isArray","getEntityRecords","__experimentalGetDirtyEntityRecords","dirtyRecords","forEach","primaryKeys","edits","filter","primaryKey","hasEditsForEntityRecord","entityConfig","entityRecord","getEditedEntityRecord","push","DEFAULT_ENTITY_KEY","title","getTitle","__experimentalGetEntitiesBeingSaved","recordsBeingSaved","saving","isSavingEntityRecord","getEntityRecordEdits","getEntityRecordNonTransientEdits","transientEdits","acc","isAutosavingEntityRecord","pending","isAutosave","Boolean","isDeletingEntityRecord","getLastEntitySaveError","getLastEntityDeleteError","getCurrentUndoOffset","undo","offset","getUndoEdit","getRedoEdit","hasUndo","hasRedo","getCurrentTheme","currentTheme","__experimentalGetCurrentGlobalStylesId","currentGlobalStylesId","getThemeSupports","theme_supports","getEmbedPreview","embedPreviews","isPreviewEmbedFallback","preview","oEmbedLinkCheck","html","canUser","action","resource","join","canUserEditEntityRecord","__unstable_rest_base","getAutosaves","postType","postId","autosaves","getAutosave","authorId","author","hasFetchedAutosaves","hasFinishedResolution","getReferenceByDistinctEdits","flattenedUndo","__experimentalGetTemplateForLink","link","template","__experimentalGetCurrentThemeBaseGlobalStyles","themeBaseGlobalStyles","stylesheet","__experimentalGetCurrentThemeGlobalStylesVariations","themeGlobalStyleVariations","getBlockPatterns","blockPatterns","getBlockPatternCategories","blockPatternCategories"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAnBA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;;AAoFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,YAAY,GAAG,EAArB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,MAAMC,wBAAwB,GAAG,kCACrCC,MAAF,IACC,CAAEC,KAAF,EAAgBC,GAAhB,KAA0C;AACzC,SAAOF,MAAM,CAAEG,gBAAF,CAAN,CAAqBC,WAArB,CAAkC,iBAAlC,EAAqD,CAC3DF,GAD2D,CAArD,CAAP;AAGA,CANqC,CAAjC;AASP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACO,SAASG,UAAT,CACNJ,KADM,EAENK,KAFM,EAGa;AACnB,2BAAY,+BAAZ,EAA6C;AAC5CC,IAAAA,KAAK,EAAE,KADqC;AAE5CC,IAAAA,WAAW,EAAE;AAF+B,GAA7C;AAKA,QAAMC,IAAI,GAAG,uBACZ,wCADY,EAEZH,KAFY,CAAb;AAIA,SAAOI,mBAAmB,CAAET,KAAF,EAASQ,IAAT,CAA1B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASE,cAAT,CAAyBV,KAAzB,EAAwD;AAC9D,SAAOA,KAAK,CAACW,WAAb;AACA;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,EAG3B,aAH2B,EAI3B4H,QAAQ,CAAC5G,EAJkB,CAA5B;AAMA;;AACD,SAAO4G,QAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,6CAAT,CACN7H,KADM,EAEA;AACN,QAAM8F,YAAY,GAAGD,eAAe,CAAE7F,KAAF,CAApC;;AACA,MAAK,CAAE8F,YAAP,EAAsB;AACrB,WAAO,IAAP;AACA;;AACD,SAAO9F,KAAK,CAAC8H,qBAAN,CAA6BhC,YAAY,CAACiC,UAA1C,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,mDAAT,CACNhI,KADM,EAEU;AAChB,QAAM8F,YAAY,GAAGD,eAAe,CAAE7F,KAAF,CAApC;;AACA,MAAK,CAAE8F,YAAP,EAAsB;AACrB,WAAO,IAAP;AACA;;AACD,SAAO9F,KAAK,CAACiI,0BAAN,CAAkCnC,YAAY,CAACiC,UAA/C,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASG,gBAAT,CAA2BlI,KAA3B,EAAwD;AAC9D,SAAOA,KAAK,CAACmI,aAAb;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,yBAAT,CAAoCpI,KAApC,EAAiE;AACvE,SAAOA,KAAK,CAACqI,sBAAb;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\nimport { set, map, find, get, filter } 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';\nimport type {\n\tContext,\n\tDefaultContextOf,\n\tEntityRecordOf,\n\tKeyOf,\n\tKind,\n\tKindOf,\n\tName,\n\tNameOf,\n\tUser,\n\tWpTemplate,\n} from './entity-types';\n\n// This is an incomplete, high-level approximation of the State type.\n// It makes the selectors slightly more safe, but is intended to evolve\n// into a more detailed representation over time.\n// See https://github.com/WordPress/gutenberg/pull/40025#discussion_r865410589 for more context.\ninterface State {\n\tautosaves: Record< string | number, Array< unknown > >;\n\tblockPatterns: Array< unknown >;\n\tblockPatternCategories: Array< unknown >;\n\tcurrentGlobalStylesId: string;\n\tcurrentTheme: string;\n\tcurrentUser: User< 'edit' >;\n\tembedPreviews: Record< string, { html: string } >;\n\tentities: EntitiesState;\n\tthemeBaseGlobalStyles: Record< string, Object >;\n\tthemeGlobalStyleVariations: Record< string, string >;\n\tundo: UndoState;\n\tusers: UserState;\n}\n\ninterface EntitiesState {\n\tconfig: EntityConfig[];\n\trecords: Record< Kind, Record< Name, EntityState< Kind, Name > > >;\n}\n\ninterface EntityState< K extends Kind, N extends Name > {\n\tedits: Record< KeyOf< K, N >, Partial< EntityRecordOf< K, N > > >;\n\tsaving: Record< KeyOf< K, N >, { pending: boolean } >;\n}\n\ninterface EntityConfig {\n\tname: Name;\n\tkind: Kind;\n}\n\ninterface UndoState extends Array< Object > {\n\tflattenedUndo: unknown;\n\toffset: number;\n}\n\ninterface UserState {\n\tqueries: Record< string, GenericRecordKey[] >;\n\tbyId: Record< GenericRecordKey, User< 'edit' > >;\n}\n\ntype GenericRecordKey = number | string;\ntype EntityRecord = any;\ntype Optional< T > = T | undefined;\n\n/**\n * HTTP Query parameters sent with the API request to fetch the entity records.\n */\nexport type EntityQuery<\n\tC extends Context,\n\tWithFields extends boolean = true\n> = Omit< Record< string, any >, '_fields' > & {\n\tcontext?: C;\n} & ( WithFields extends true\n\t\t? {\n\t\t\t\t/**\n\t\t\t\t * The requested fields. If specified, the REST API will remove from the response\n\t\t\t\t * any fields not on that list.\n\t\t\t\t */\n\t\t\t\t_fields: string[];\n\t\t }\n\t\t: {} );\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 state Data state.\n * @param url URL the preview would be for.\n *\n * @return Whether a request is in progress for an embed preview.\n */\nexport const isRequestingEmbedPreview = createRegistrySelector(\n\t( select ) =>\n\t\t( state: State, url: string ): boolean => {\n\t\t\treturn select( STORE_NAME ).isResolving( 'getEmbedPreview', [\n\t\t\t\turl,\n\t\t\t] );\n\t\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 state Data state.\n * @param query Optional object of query parameters to\n * include with request.\n * @return Authors list.\n */\nexport function getAuthors(\n\tstate: State,\n\tquery?: EntityQuery< any >\n): User< 'edit' >[] {\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 state Data state.\n *\n * @return Current user object.\n */\nexport function getCurrentUser( state: State ): User< 'edit' > {\n\treturn state.currentUser;\n}\n\n/**\n * Returns all the users returned by a query ID.\n *\n * @param state Data state.\n * @param queryID Query ID.\n *\n * @return Users list.\n */\nexport const getUserQueryResults = createSelector(\n\t( state: State, queryID: string ): User< 'edit' >[] => {\n\t\tconst queryResults = state.users.queries[ queryID ];\n\n\t\treturn map( queryResults, ( id ) => state.users.byId[ id ] );\n\t},\n\t( state: State, queryID: string ) => [\n\t\tstate.users.queries[ queryID ],\n\t\tstate.users.byId,\n\t]\n);\n\n/**\n * Returns the loaded entities for the given kind.\n *\n * @deprecated since WordPress 6.0. Use getEntitiesConfig instead\n * @param state Data state.\n * @param kind Entity kind.\n *\n * @return Array of entities with config matching kind.\n */\nexport function getEntitiesByKind( state: State, kind: Kind ): Array< any > {\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 state Data state.\n * @param kind Entity kind.\n *\n * @return Array of entities with config matching kind.\n */\nexport function getEntitiesConfig( state: State, kind: Kind ): Array< any > {\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 state Data state.\n * @param kind Entity kind.\n * @param name Entity name.\n *\n * @return Entity config\n */\nexport function getEntity( state: State, kind: Kind, name: Name ): any {\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 state Data state.\n * @param kind Entity kind.\n * @param name Entity name.\n *\n * @return Entity config\n */\nexport function getEntityConfig( state: State, kind: Kind, name: Name ): any {\n\treturn find( state.entities.config, { kind, name } );\n}\n\n/**\n * GetEntityRecord is declared as an *interface*, but it actually describes\n * the specifies the getEntityRecord *function* signature. It may seem unusual,\n * but it's just how TypeScript implements function overloading.\n *\n * More accurately, GetEntityRecord distinguishes between two different signatures\n * the getEntityRecord selector has:\n *\n * 1. When query._fields is not given, the returned type is EntityRecordOf< K, N, C >\n * 2. When query._fields is given, the returned type is Partial<EntityRecordOf< K, N, C >>\n *\n * Unfortunately, due to a TypeScript limitation (https://github.com/microsoft/TypeScript/issues/23132)\n * we can't use a single function signature with a return type such as:\n *\n * Fields extends undefined\n * \t ? EntityRecordOf< K, N, C >\n * \t\t : Partial< EntityRecordOf< K, N, C > >\n */\ninterface GetEntityRecord {\n\t<\n\t\tR extends EntityRecordOf< K, N >,\n\t\tC extends Context = DefaultContextOf< R >,\n\t\tK extends Kind = KindOf< R >,\n\t\tN extends Name = NameOf< R >\n\t>(\n\t\tstate: State,\n\t\tkind: K,\n\t\tname: N,\n\t\tkey: KeyOf< K, N >,\n\t\tquery: EntityQuery< C, true >\n\t): Partial< EntityRecordOf< K, N, C > > | null | undefined;\n\n\t<\n\t\tR extends EntityRecordOf< K, N >,\n\t\tC extends Context = DefaultContextOf< R >,\n\t\tK extends Kind = KindOf< R >,\n\t\tN extends Name = NameOf< R >\n\t>(\n\t\tstate: State,\n\t\tkind: K,\n\t\tname: N,\n\t\tkey: KeyOf< K, N >,\n\t\tquery?: EntityQuery< C, false >\n\t): EntityRecordOf< K, N, C > | null | undefined;\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 state State tree\n * @param kind Entity kind.\n * @param name Entity name.\n * @param key Record's key\n * @param query Optional query. If requesting specific\n * fields, fields must always include the ID.\n *\n * @return Record.\n */\nexport const getEntityRecord: GetEntityRecord = createSelector(\n\t<\n\t\tR extends EntityRecordOf< K, N >,\n\t\tC extends Context = DefaultContextOf< R >,\n\t\tK extends Kind = KindOf< R >,\n\t\tN extends Name = NameOf< R >\n\t>(\n\t\tstate: State,\n\t\tkind: K,\n\t\tname: N,\n\t\tkey: KeyOf< R >,\n\t\tquery\n\t) => {\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: 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 state State tree\n * @param kind Entity kind.\n * @param name Entity name.\n * @param key Record's key\n *\n * @return Record.\n */\nexport function __experimentalGetEntityRecordNoResolver<\n\tK extends Kind,\n\tN extends Name\n>( state: State, kind: K, name: N, key: KeyOf< K, 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 state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param key Record's key.\n *\n * @return Object with the entity's raw attributes.\n */\nexport const getRawEntityRecord = createSelector(\n\t< K extends Kind, N extends Name >(\n\t\tstate: State,\n\t\tkind: K,\n\t\tname: N,\n\t\tkey: KeyOf< K, N >\n\t): EntityRecord | undefined => {\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(\n\t\tstate: State,\n\t\tkind: Kind,\n\t\tname: Name,\n\t\trecordId: GenericRecordKey,\n\t\tquery?: EntityQuery< any >\n\t) => {\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 state State tree\n * @param kind Entity kind.\n * @param name Entity name.\n * @param query Optional terms query.\n *\n * @return Whether entity records have been received.\n */\nexport function hasEntityRecords<\n\tR extends EntityRecordOf< K, N >,\n\tC extends Context = DefaultContextOf< R >,\n\tK extends Kind = KindOf< R >,\n\tN extends Name = NameOf< R >\n>( state: State, kind: K, name: N, query?: EntityQuery< C > ): boolean {\n\treturn Array.isArray( getEntityRecords( state, kind, name, query ) );\n}\n\n/**\n * GetEntityRecord is declared as an *interface*, but it actually describes\n * the specifies the getEntityRecord *function* signature. It may seem unusual,\n * but it's just how TypeScript implements function overloading.\n *\n * More accurately, GetEntityRecord distinguishes between two different signatures\n * the getEntityRecord selector has:\n *\n * 1. When query._fields is not given, the returned type is EntityRecordOf< K, N, C >[]\n * 2. When query._fields is given, the returned type is Partial<EntityRecordOf< K, N, C >>[]\n *\n * Unfortunately, due to a TypeScript limitation (https://github.com/microsoft/TypeScript/issues/23132)\n * we can't use a single function signature with a return type such as:\n *\n * Fields extends undefined\n * \t ? EntityRecordOf< K, N, C >[]\n * \t\t : Partial< EntityRecordOf< K, N, C > >[]\n */\ninterface GetEntityRecords {\n\t<\n\t\tR extends EntityRecordOf< K, N >,\n\t\tC extends Context = DefaultContextOf< R >,\n\t\tK extends Kind = KindOf< R >,\n\t\tN extends Name = NameOf< R >\n\t>(\n\t\tstate: State,\n\t\tkind: K,\n\t\tname: N,\n\t\tquery: EntityQuery< C, true >\n\t): Partial< EntityRecordOf< K, N, C > >[] | null | undefined;\n\n\t<\n\t\tR extends EntityRecordOf< K, N >,\n\t\tC extends Context = DefaultContextOf< R >,\n\t\tK extends Kind = KindOf< R >,\n\t\tN extends Name = NameOf< R >\n\t>(\n\t\tstate: State,\n\t\tkind: K,\n\t\tname: N,\n\t\tquery?: EntityQuery< C, false >\n\t): EntityRecordOf< K, N, C >[] | null | undefined;\n}\n\n/**\n * Returns the Entity's records.\n *\n * @param state State tree\n * @param kind Entity kind.\n * @param name Entity name.\n * @param query Optional terms query. If requesting specific\n * fields, fields must always include the ID.\n *\n * @return Records.\n */\nexport const getEntityRecords: GetEntityRecords = <\n\tR extends EntityRecordOf< K, N >,\n\tC extends Context = DefaultContextOf< R >,\n\tK extends Kind = KindOf< R >,\n\tN extends Name = NameOf< R >\n>(\n\tstate: State,\n\tkind: K,\n\tname: N,\n\tquery\n) => {\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\ntype DirtyEntityRecord = {\n\ttitle: string;\n\tkey: GenericRecordKey;\n\tname: Name;\n\tkind: Kind;\n};\n/**\n * Returns the list of dirty entity records.\n *\n * @param state State tree.\n *\n * @return The list of updated records\n */\nexport const __experimentalGetDirtyEntityRecords = createSelector(\n\t( state: State ): Array< DirtyEntityRecord > => {\n\t\tconst {\n\t\t\tentities: { records },\n\t\t} = state;\n\t\tconst dirtyRecords: DirtyEntityRecord[] = [];\n\t\t( Object.keys( records ) as Kind[] ).forEach(\n\t\t\t< K extends Kind >( kind: K ) => {\n\t\t\t\t( Object.keys( records[ kind ] ) as Name[] ).forEach(\n\t\t\t\t\t< N extends Name >( name: N ) => {\n\t\t\t\t\t\tconst primaryKeys = (\n\t\t\t\t\t\t\tObject.keys(\n\t\t\t\t\t\t\t\trecords[ kind ][ name ].edits\n\t\t\t\t\t\t\t) as KeyOf< K, N >[]\n\t\t\t\t\t\t ).filter(\n\t\t\t\t\t\t\t( primaryKey ) =>\n\t\t\t\t\t\t\t\t// The entity record must exist (not be deleted),\n\t\t\t\t\t\t\t\t// and it must have edits.\n\t\t\t\t\t\t\t\tgetEntityRecord(\n\t\t\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\t\tprimaryKey\n\t\t\t\t\t\t\t\t) &&\n\t\t\t\t\t\t\t\thasEditsForEntityRecord(\n\t\t\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\t\tprimaryKey\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tif ( primaryKeys.length ) {\n\t\t\t\t\t\t\tconst entityConfig = getEntityConfig(\n\t\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tprimaryKeys.forEach( ( primaryKey ) => {\n\t\t\t\t\t\t\t\tconst entityRecord = getEditedEntityRecord(\n\t\t\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\t\tprimaryKey\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tdirtyRecords.push( {\n\t\t\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\t\t// when it's used as an object key.\n\t\t\t\t\t\t\t\t\tkey: entityRecord[\n\t\t\t\t\t\t\t\t\t\tentityConfig.key || DEFAULT_ENTITY_KEY\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\ttitle:\n\t\t\t\t\t\t\t\t\t\tentityConfig?.getTitle?.(\n\t\t\t\t\t\t\t\t\t\t\tentityRecord\n\t\t\t\t\t\t\t\t\t\t) || '',\n\t\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\t\tkind,\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);\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 state State tree.\n *\n * @return The list of records being saved.\n */\nexport const __experimentalGetEntitiesBeingSaved = createSelector(\n\t( state: State ): Array< DirtyEntityRecord > => {\n\t\tconst {\n\t\t\tentities: { records },\n\t\t} = state;\n\t\tconst recordsBeingSaved: DirtyEntityRecord[] = [];\n\t\t( Object.keys( records ) as Kind[] ).forEach(\n\t\t\t< K extends Kind >( kind: K ) => {\n\t\t\t\t( Object.keys( records[ kind ] ) as Name[] ).forEach(\n\t\t\t\t\t< N extends Name >( name: N ) => {\n\t\t\t\t\t\tconst primaryKeys = (\n\t\t\t\t\t\t\tObject.keys(\n\t\t\t\t\t\t\t\trecords[ kind ][ name ].saving\n\t\t\t\t\t\t\t) as KeyOf< K, N >[]\n\t\t\t\t\t\t ).filter( ( primaryKey ) =>\n\t\t\t\t\t\t\tisSavingEntityRecord(\n\t\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\tprimaryKey\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tif ( primaryKeys.length ) {\n\t\t\t\t\t\t\tconst entityConfig = getEntityConfig(\n\t\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\t\tname\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tprimaryKeys.forEach( ( primaryKey ) => {\n\t\t\t\t\t\t\t\tconst entityRecord = getEditedEntityRecord(\n\t\t\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\t\t\tkind,\n\t\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\t\tprimaryKey\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\trecordsBeingSaved.push( {\n\t\t\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\t\t// when it's used as an object key.\n\t\t\t\t\t\t\t\t\tkey: entityRecord[\n\t\t\t\t\t\t\t\t\t\tentityConfig.key || DEFAULT_ENTITY_KEY\n\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\t\ttitle:\n\t\t\t\t\t\t\t\t\t\tentityConfig?.getTitle?.(\n\t\t\t\t\t\t\t\t\t\t\tentityRecord\n\t\t\t\t\t\t\t\t\t\t) || '',\n\t\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\t\tkind,\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);\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 state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return The entity record's edits.\n */\nexport function getEntityRecordEdits< K extends Kind, N extends Name >(\n\tstate: State,\n\tkind: K,\n\tname: N,\n\trecordId: KeyOf< K, N >\n): Optional< any > {\n\treturn get( state.entities.records, [\n\t\tkind,\n\t\tname,\n\t\t'edits',\n\t\trecordId as string | number,\n\t] );\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 state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return The entity record's non transient edits.\n */\nexport const getEntityRecordNonTransientEdits = createSelector(\n\t< K extends Kind, N extends Name >(\n\t\tstate: State,\n\t\tkind: K,\n\t\tname: N,\n\t\trecordId: KeyOf< K, N >\n\t): Optional< any > => {\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: State, kind: Kind, name: Name, recordId: GenericRecordKey ) => [\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 state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return Whether the entity record has edits or not.\n */\nexport function hasEditsForEntityRecord< K extends Kind, N extends Name >(\n\tstate: State,\n\tkind: K,\n\tname: N,\n\trecordId: KeyOf< K, N >\n): boolean {\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 state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return The entity record, merged with its edits.\n */\nexport const getEditedEntityRecord = createSelector(\n\t< K extends Kind, N extends Name >(\n\t\tstate: State,\n\t\tkind: K,\n\t\tname: N,\n\t\trecordId: KeyOf< K, N >\n\t): EntityRecord | undefined => ( {\n\t\t...getRawEntityRecord( state, kind, name, recordId ),\n\t\t...getEntityRecordEdits( state, kind, name, recordId ),\n\t} ),\n\t(\n\t\tstate: State,\n\t\tkind: Kind,\n\t\tname: Name,\n\t\trecordId: GenericRecordKey,\n\t\tquery?: EntityQuery< any >\n\t) => {\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 state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return Whether the entity record is autosaving or not.\n */\nexport function isAutosavingEntityRecord(\n\tstate: State,\n\tkind: Kind,\n\tname: Name,\n\trecordId: GenericRecordKey\n): boolean {\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 state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return Whether the entity record is saving or not.\n */\nexport function isSavingEntityRecord< K extends Kind, N extends Name >(\n\tstate: State,\n\tkind: K,\n\tname: N,\n\trecordId: KeyOf< K, N >\n): boolean {\n\treturn get(\n\t\tstate.entities.records,\n\t\t[ kind, name, 'saving', recordId as GenericRecordKey, '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 state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return Whether the entity record is deleting or not.\n */\nexport function isDeletingEntityRecord(\n\tstate: State,\n\tkind: Kind,\n\tname: Name,\n\trecordId: GenericRecordKey\n): boolean {\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 state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return The entity record's save error.\n */\nexport function getLastEntitySaveError(\n\tstate: State,\n\tkind: Kind,\n\tname: Name,\n\trecordId: GenericRecordKey\n): any {\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 state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return The entity record's save error.\n */\nexport function getLastEntityDeleteError(\n\tstate: State,\n\tkind: Kind,\n\tname: Name,\n\trecordId: GenericRecordKey\n): any {\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 state State tree.\n *\n * @return The current undo offset.\n */\nfunction getCurrentUndoOffset( state: State ): number {\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 state State tree.\n *\n * @return The edit.\n */\nexport function getUndoEdit( state: State ): Optional< any > {\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 state State tree.\n *\n * @return The edit.\n */\nexport function getRedoEdit( state: State ): Optional< any > {\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 state State tree.\n *\n * @return Whether there is a previous edit or not.\n */\nexport function hasUndo( state: State ): boolean {\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 state State tree.\n *\n * @return Whether there is a next edit or not.\n */\nexport function hasRedo( state: State ): boolean {\n\treturn Boolean( getRedoEdit( state ) );\n}\n\n/**\n * Return the current theme.\n *\n * @param state Data state.\n *\n * @return The current theme.\n */\nexport function getCurrentTheme( state: State ): any {\n\treturn getEntityRecord( state, 'root', 'theme', state.currentTheme );\n}\n\n/**\n * Return the ID of the current global styles object.\n *\n * @param state Data state.\n *\n * @return The current global styles ID.\n */\nexport function __experimentalGetCurrentGlobalStylesId( state: State ): string {\n\treturn state.currentGlobalStylesId;\n}\n\n/**\n * Return theme supports data in the index.\n *\n * @param state Data state.\n *\n * @return Index data.\n */\nexport function getThemeSupports( state: State ): any {\n\treturn getCurrentTheme( state )?.theme_supports ?? EMPTY_OBJECT;\n}\n\n/**\n * Returns the embed preview for the given URL.\n *\n * @param state Data state.\n * @param 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: State, url: string ): any {\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 state Data state.\n * @param url Embedded URL.\n *\n * @return Is the preview for the URL an oEmbed link fallback.\n */\nexport function isPreviewEmbedFallback( state: State, url: string ): boolean {\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 state Data state.\n * @param action Action to check. One of: 'create', 'read', 'update', 'delete'.\n * @param resource REST resource to check, e.g. 'media' or 'posts'.\n * @param id Optional ID of the rest resource to check.\n *\n * @return Whether or not the user can perform the action,\n * or `undefined` if the OPTIONS request is still being made.\n */\nexport function canUser(\n\tstate: State,\n\taction: string,\n\tresource: string,\n\tid?: GenericRecordKey\n): boolean | undefined {\n\tconst key = [ action, resource, id ].filter( Boolean ).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 state Data state.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record's id.\n * @return Whether or not the user can edit,\n * or `undefined` if the OPTIONS request is still being made.\n */\nexport function canUserEditEntityRecord(\n\tstate: State,\n\tkind: Kind,\n\tname: Name,\n\trecordId: GenericRecordKey\n): boolean | undefined {\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 state State tree.\n * @param postType The type of the parent post.\n * @param postId The id of the parent post.\n *\n * @return An array of autosaves for the post, or undefined if there is none.\n */\nexport function getAutosaves(\n\tstate: State,\n\tpostType: string,\n\tpostId: GenericRecordKey\n): Array< any > | undefined {\n\treturn state.autosaves[ postId ];\n}\n\n/**\n * Returns the autosave for the post and author.\n *\n * @param state State tree.\n * @param postType The type of the parent post.\n * @param postId The id of the parent post.\n * @param authorId The id of the author.\n *\n * @return The autosave for the post and author.\n */\nexport function getAutosave(\n\tstate: State,\n\tpostType: string,\n\tpostId: GenericRecordKey,\n\tauthorId: GenericRecordKey\n): EntityRecord | undefined {\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 state State tree.\n * @param postType The type of the parent post.\n * @param postId The id of the parent post.\n *\n * @return True if the REST request was completed. False otherwise.\n */\nexport const hasFetchedAutosaves = createRegistrySelector(\n\t( select ) =>\n\t\t(\n\t\t\tstate: State,\n\t\t\tpostType: string,\n\t\t\tpostId: GenericRecordKey\n\t\t): boolean => {\n\t\t\treturn select( STORE_NAME ).hasFinishedResolution( 'getAutosaves', [\n\t\t\t\tpostType,\n\t\t\t\tpostId,\n\t\t\t] );\n\t\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 state Editor state.\n *\n * @return A value whose reference will change only when an edit occurs.\n */\nexport const getReferenceByDistinctEdits = createSelector(\n\t// This unused state argument is listed here for the documentation generating tool (docgen).\n\t( state: State ) => [],\n\t( state: 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 state Editor state.\n * @param link Link.\n *\n * @return The template record.\n */\nexport function __experimentalGetTemplateForLink(\n\tstate: State,\n\tlink: string\n): WpTemplate< 'edit' > | null {\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 state Editor state.\n *\n * @return The Global Styles object.\n */\nexport function __experimentalGetCurrentThemeBaseGlobalStyles(\n\tstate: State\n): any {\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 state Data state.\n *\n * @return The current global styles ID.\n */\nexport function __experimentalGetCurrentThemeGlobalStylesVariations(\n\tstate: State\n): string | null {\n\tconst currentTheme = getCurrentTheme( state );\n\tif ( ! currentTheme ) {\n\t\treturn null;\n\t}\n\treturn state.themeGlobalStyleVariations[ currentTheme.stylesheet ];\n}\n\n/**\n * Retrieve the list of registered block patterns.\n *\n * @param state Data state.\n *\n * @return Block pattern list.\n */\nexport function getBlockPatterns( state: State ): Array< any > {\n\treturn state.blockPatterns;\n}\n\n/**\n * Retrieve the list of registered block pattern categories.\n *\n * @param state Data state.\n *\n * @return Block pattern category list.\n */\nexport function getBlockPatternCategories( state: State ): Array< any > {\n\treturn state.blockPatternCategories;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/core-data/src/selectors.ts"],"names":["EMPTY_OBJECT","isRequestingEmbedPreview","select","state","url","STORE_NAME","isResolving","getAuthors","query","since","alternative","path","getUserQueryResults","getCurrentUser","currentUser","queryID","queryResults","users","queries","id","byId","getEntitiesByKind","kind","getEntitiesConfig","entities","config","getEntity","name","getEntityConfig","getEntityRecord","key","queriedState","records","undefined","context","itemIsComplete","items","item","_fields","filteredItem","fields","f","length","field","split","value","recordId","__experimentalGetEntityRecordNoResolver","getRawEntityRecord","record","Object","keys","reduce","accumulator","_key","hasEntityRecords","Array","isArray","getEntityRecords","__experimentalGetDirtyEntityRecords","dirtyRecords","forEach","primaryKeys","edits","filter","primaryKey","hasEditsForEntityRecord","entityConfig","entityRecord","getEditedEntityRecord","push","DEFAULT_ENTITY_KEY","title","getTitle","__experimentalGetEntitiesBeingSaved","recordsBeingSaved","saving","isSavingEntityRecord","getEntityRecordEdits","getEntityRecordNonTransientEdits","transientEdits","acc","isAutosavingEntityRecord","pending","isAutosave","Boolean","isDeletingEntityRecord","getLastEntitySaveError","getLastEntityDeleteError","getCurrentUndoOffset","undo","offset","getUndoEdit","getRedoEdit","hasUndo","hasRedo","getCurrentTheme","currentTheme","__experimentalGetCurrentGlobalStylesId","currentGlobalStylesId","getThemeSupports","theme_supports","getEmbedPreview","embedPreviews","isPreviewEmbedFallback","preview","oEmbedLinkCheck","html","canUser","action","resource","join","canUserEditEntityRecord","__unstable_rest_base","getAutosaves","postType","postId","autosaves","getAutosave","authorId","author","hasFetchedAutosaves","hasFinishedResolution","getReferenceByDistinctEdits","flattenedUndo","__experimentalGetTemplateForLink","link","__experimentalGetCurrentThemeBaseGlobalStyles","themeBaseGlobalStyles","stylesheet","__experimentalGetCurrentThemeGlobalStylesVariations","themeGlobalStyleVariations","getBlockPatterns","blockPatterns","getBlockPatternCategories","blockPatternCategories"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAnBA;AACA;AACA;;AAIA;AACA;AACA;;AAKA;AACA;AACA;;AA4DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,YAAY,GAAG,EAArB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACO,MAAMC,wBAAwB,GAAG,kCACrCC,MAAF,IACC,CAAEC,KAAF,EAAgBC,GAAhB,KAA0C;AACzC,SAAOF,MAAM,CAAEG,gBAAF,CAAN,CAAqBC,WAArB,CAAkC,iBAAlC,EAAqD,CAC3DF,GAD2D,CAArD,CAAP;AAGA,CANqC,CAAjC;AASP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACO,SAASG,UAAT,CACNJ,KADM,EAENK,KAFM,EAGM;AACZ,2BAAY,+BAAZ,EAA6C;AAC5CC,IAAAA,KAAK,EAAE,KADqC;AAE5CC,IAAAA,WAAW,EAAE;AAF+B,GAA7C;AAKA,QAAMC,IAAI,GAAG,uBACZ,wCADY,EAEZH,KAFY,CAAb;AAIA,SAAOI,mBAAmB,CAAET,KAAF,EAASQ,IAAT,CAA1B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASE,cAAT,CAAyBV,KAAzB,EAA2D;AACjE,SAAOA,KAAK,CAACW,WAAb;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,MAAMF,mBAAmB,GAAG,qBAClC,CAAET,KAAF,EAAgBY,OAAhB,KAA0D;AACzD,QAAMC,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;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,mDAAT,CACN/H,KADM,EAEU;AAChB,QAAM8F,YAAY,GAAGD,eAAe,CAAE7F,KAAF,CAApC;;AACA,MAAK,CAAE8F,YAAP,EAAsB;AACrB,WAAO,IAAP;AACA;;AACD,SAAO9F,KAAK,CAACgI,0BAAN,CAAkClC,YAAY,CAACgC,UAA/C,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASG,gBAAT,CAA2BjI,KAA3B,EAAwD;AAC9D,SAAOA,KAAK,CAACkI,aAAb;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASC,yBAAT,CAAoCnI,KAApC,EAAiE;AACvE,SAAOA,KAAK,CAACoI,sBAAb;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport createSelector from 'rememo';\nimport { set, map, find, get, filter } 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';\nimport type * as ET from './entity-types';\n\n// This is an incomplete, high-level approximation of the State type.\n// It makes the selectors slightly more safe, but is intended to evolve\n// into a more detailed representation over time.\n// See https://github.com/WordPress/gutenberg/pull/40025#discussion_r865410589 for more context.\nexport interface State {\n\tautosaves: Record< string | number, Array< unknown > >;\n\tblockPatterns: Array< unknown >;\n\tblockPatternCategories: Array< unknown >;\n\tcurrentGlobalStylesId: string;\n\tcurrentTheme: string;\n\tcurrentUser: ET.User< 'edit' >;\n\tembedPreviews: Record< string, { html: string } >;\n\tentities: EntitiesState;\n\tthemeBaseGlobalStyles: Record< string, Object >;\n\tthemeGlobalStyleVariations: Record< string, string >;\n\tundo: UndoState;\n\tusers: UserState;\n}\n\ntype EntityRecordKey = string | number;\n\ninterface EntitiesState {\n\tconfig: EntityConfig[];\n\trecords: Record< string, Record< string, EntityState< ET.EntityRecord > > >;\n}\n\ninterface EntityState< EntityRecord extends ET.EntityRecord > {\n\tedits: Record< string, Partial< EntityRecord > >;\n\tsaving: Record< string, { pending: boolean } >;\n}\n\ninterface EntityConfig {\n\tname: string;\n\tkind: string;\n}\n\ninterface UndoState extends Array< Object > {\n\tflattenedUndo: unknown;\n\toffset: number;\n}\n\ninterface UserState {\n\tqueries: Record< string, EntityRecordKey[] >;\n\tbyId: Record< EntityRecordKey, ET.User< 'edit' > >;\n}\n\ntype Optional< T > = T | undefined;\n\n/**\n * HTTP Query parameters sent with the API request to fetch the entity records.\n */\ntype GetRecordsHttpQuery = Record< string, any >;\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 state Data state.\n * @param url URL the preview would be for.\n *\n * @return Whether a request is in progress for an embed preview.\n */\nexport const isRequestingEmbedPreview = createRegistrySelector(\n\t( select: any ) =>\n\t\t( state: State, url: string ): boolean => {\n\t\t\treturn select( STORE_NAME ).isResolving( 'getEmbedPreview', [\n\t\t\t\turl,\n\t\t\t] );\n\t\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 state Data state.\n * @param query Optional object of query parameters to\n * include with request.\n * @return Authors list.\n */\nexport function getAuthors(\n\tstate: State,\n\tquery?: GetRecordsHttpQuery\n): ET.User[] {\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 state Data state.\n *\n * @return Current user object.\n */\nexport function getCurrentUser( state: State ): ET.User< 'edit' > {\n\treturn state.currentUser;\n}\n\n/**\n * Returns all the users returned by a query ID.\n *\n * @param state Data state.\n * @param queryID Query ID.\n *\n * @return Users list.\n */\nexport const getUserQueryResults = createSelector(\n\t( state: State, queryID: string ): ET.User< 'edit' >[] => {\n\t\tconst queryResults = state.users.queries[ queryID ];\n\n\t\treturn map( queryResults, ( id ) => state.users.byId[ id ] );\n\t},\n\t( state: State, queryID: string ) => [\n\t\tstate.users.queries[ queryID ],\n\t\tstate.users.byId,\n\t]\n);\n\n/**\n * Returns the loaded entities for the given kind.\n *\n * @deprecated since WordPress 6.0. Use getEntitiesConfig instead\n * @param state Data state.\n * @param kind Entity kind.\n *\n * @return Array of entities with config matching kind.\n */\nexport function getEntitiesByKind( state: State, kind: string ): Array< any > {\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 state Data state.\n * @param kind Entity kind.\n *\n * @return Array of entities with config matching kind.\n */\nexport function getEntitiesConfig( state: State, kind: string ): Array< any > {\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 state Data state.\n * @param kind Entity kind.\n * @param name Entity name.\n *\n * @return Entity config\n */\nexport function getEntity( state: State, kind: string, name: string ): any {\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 state Data state.\n * @param kind Entity kind.\n * @param name Entity name.\n *\n * @return Entity config\n */\nexport function getEntityConfig(\n\tstate: State,\n\tkind: string,\n\tname: string\n): any {\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 state State tree\n * @param kind Entity kind.\n * @param name Entity name.\n * @param key Record's key\n * @param query Optional query. If requesting specific\n * fields, fields must always include the ID.\n *\n * @return Record.\n */\nexport const getEntityRecord = createSelector(\n\t<\n\t\tEntityRecord extends\n\t\t\t| ET.EntityRecord< any >\n\t\t\t| Partial< ET.EntityRecord< any > >\n\t>(\n\t\tstate: State,\n\t\tkind: string,\n\t\tname: string,\n\t\tkey: EntityRecordKey,\n\t\tquery?: GetRecordsHttpQuery\n\t): EntityRecord | undefined => {\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 as EntityRecord;\n\t\t}\n\n\t\treturn item;\n\t},\n\t( state: 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 state State tree\n * @param kind Entity kind.\n * @param name Entity name.\n * @param key Record's key\n *\n * @return Record.\n */\nexport function __experimentalGetEntityRecordNoResolver<\n\tEntityRecord extends ET.EntityRecord< any >\n>( state: State, kind: string, name: string, key: EntityRecordKey ) {\n\treturn getEntityRecord< EntityRecord >( 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 state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param key Record's key.\n *\n * @return Object with the entity's raw attributes.\n */\nexport const getRawEntityRecord = createSelector(\n\t< EntityRecord extends ET.EntityRecord< any > >(\n\t\tstate: State,\n\t\tkind: string,\n\t\tname: string,\n\t\tkey: EntityRecordKey\n\t): EntityRecord | undefined => {\n\t\tconst record = getEntityRecord< EntityRecord >(\n\t\t\tstate,\n\t\t\tkind,\n\t\t\tname,\n\t\t\tkey\n\t\t);\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}, {} as any )\n\t\t);\n\t},\n\t(\n\t\tstate: State,\n\t\tkind: string,\n\t\tname: string,\n\t\trecordId: EntityRecordKey,\n\t\tquery?: GetRecordsHttpQuery\n\t) => {\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 state State tree\n * @param kind Entity kind.\n * @param name Entity name.\n * @param query Optional terms query.\n *\n * @return Whether entity records have been received.\n */\nexport function hasEntityRecords(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\tquery?: GetRecordsHttpQuery\n): boolean {\n\treturn Array.isArray( getEntityRecords( state, kind, name, query ) );\n}\n\n/**\n * Returns the Entity's records.\n *\n * @param state State tree\n * @param kind Entity kind.\n * @param name Entity name.\n * @param query Optional terms query. If requesting specific\n * fields, fields must always include the ID.\n *\n * @return Records.\n */\nexport const getEntityRecords = <\n\tEntityRecord extends\n\t\t| ET.EntityRecord< any >\n\t\t| Partial< ET.EntityRecord< any > >\n>(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\tquery?: GetRecordsHttpQuery\n): EntityRecord[] | null => {\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\ntype DirtyEntityRecord = {\n\ttitle: string;\n\tkey: EntityRecordKey;\n\tname: string;\n\tkind: string;\n};\n/**\n * Returns the list of dirty entity records.\n *\n * @param state State tree.\n *\n * @return The list of updated records\n */\nexport const __experimentalGetDirtyEntityRecords = createSelector(\n\t( state: State ): Array< DirtyEntityRecord > => {\n\t\tconst {\n\t\t\tentities: { records },\n\t\t} = state;\n\t\tconst dirtyRecords: DirtyEntityRecord[] = [];\n\t\tObject.keys( records ).forEach( ( kind ) => {\n\t\t\tObject.keys( records[ kind ] ).forEach( ( name ) => {\n\t\t\t\tconst primaryKeys = (\n\t\t\t\t\tObject.keys( records[ kind ][ name ].edits ) as string[]\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: entityRecord\n\t\t\t\t\t\t\t\t? entityRecord[\n\t\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\t\t: undefined,\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 state State tree.\n *\n * @return The list of records being saved.\n */\nexport const __experimentalGetEntitiesBeingSaved = createSelector(\n\t( state: State ): Array< DirtyEntityRecord > => {\n\t\tconst {\n\t\t\tentities: { records },\n\t\t} = state;\n\t\tconst recordsBeingSaved: DirtyEntityRecord[] = [];\n\t\tObject.keys( records ).forEach( ( kind ) => {\n\t\t\tObject.keys( records[ kind ] ).forEach( ( name ) => {\n\t\t\t\tconst primaryKeys = (\n\t\t\t\t\tObject.keys( records[ kind ][ name ].saving ) as string[]\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: entityRecord\n\t\t\t\t\t\t\t\t? entityRecord[\n\t\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\t\t: undefined,\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 state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return The entity record's edits.\n */\nexport function getEntityRecordEdits(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\trecordId: EntityRecordKey\n): Optional< any > {\n\treturn get( state.entities.records, [\n\t\tkind,\n\t\tname,\n\t\t'edits',\n\t\trecordId as string | number,\n\t] );\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 state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return The entity record's non transient edits.\n */\nexport const getEntityRecordNonTransientEdits = createSelector(\n\t(\n\t\tstate: State,\n\t\tkind: string,\n\t\tname: string,\n\t\trecordId: EntityRecordKey\n\t): Optional< any > => {\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: State, kind: string, name: string, recordId: EntityRecordKey ) => [\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 state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return Whether the entity record has edits or not.\n */\nexport function hasEditsForEntityRecord(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\trecordId: EntityRecordKey\n): boolean {\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 state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return The entity record, merged with its edits.\n */\nexport const getEditedEntityRecord = createSelector(\n\t< EntityRecord extends ET.EntityRecord< any > >(\n\t\tstate: State,\n\t\tkind: string,\n\t\tname: string,\n\t\trecordId: EntityRecordKey\n\t): ET.Updatable< EntityRecord > | undefined => ( {\n\t\t...getRawEntityRecord( state, kind, name, recordId ),\n\t\t...getEntityRecordEdits( state, kind, name, recordId ),\n\t} ),\n\t(\n\t\tstate: State,\n\t\tkind: string,\n\t\tname: string,\n\t\trecordId: EntityRecordKey,\n\t\tquery?: GetRecordsHttpQuery\n\t) => {\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 state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return Whether the entity record is autosaving or not.\n */\nexport function isAutosavingEntityRecord(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\trecordId: EntityRecordKey\n): boolean {\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 state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return Whether the entity record is saving or not.\n */\nexport function isSavingEntityRecord(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\trecordId: EntityRecordKey\n): boolean {\n\treturn get(\n\t\tstate.entities.records,\n\t\t[ kind, name, 'saving', recordId as EntityRecordKey, '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 state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return Whether the entity record is deleting or not.\n */\nexport function isDeletingEntityRecord(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\trecordId: EntityRecordKey\n): boolean {\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 state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return The entity record's save error.\n */\nexport function getLastEntitySaveError(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\trecordId: EntityRecordKey\n): any {\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 state State tree.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record ID.\n *\n * @return The entity record's save error.\n */\nexport function getLastEntityDeleteError(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\trecordId: EntityRecordKey\n): any {\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 state State tree.\n *\n * @return The current undo offset.\n */\nfunction getCurrentUndoOffset( state: State ): number {\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 state State tree.\n *\n * @return The edit.\n */\nexport function getUndoEdit( state: State ): Optional< any > {\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 state State tree.\n *\n * @return The edit.\n */\nexport function getRedoEdit( state: State ): Optional< any > {\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 state State tree.\n *\n * @return Whether there is a previous edit or not.\n */\nexport function hasUndo( state: State ): boolean {\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 state State tree.\n *\n * @return Whether there is a next edit or not.\n */\nexport function hasRedo( state: State ): boolean {\n\treturn Boolean( getRedoEdit( state ) );\n}\n\n/**\n * Return the current theme.\n *\n * @param state Data state.\n *\n * @return The current theme.\n */\nexport function getCurrentTheme( state: State ): any {\n\treturn getEntityRecord( state, 'root', 'theme', state.currentTheme );\n}\n\n/**\n * Return the ID of the current global styles object.\n *\n * @param state Data state.\n *\n * @return The current global styles ID.\n */\nexport function __experimentalGetCurrentGlobalStylesId( state: State ): string {\n\treturn state.currentGlobalStylesId;\n}\n\n/**\n * Return theme supports data in the index.\n *\n * @param state Data state.\n *\n * @return Index data.\n */\nexport function getThemeSupports( state: State ): any {\n\treturn getCurrentTheme( state )?.theme_supports ?? EMPTY_OBJECT;\n}\n\n/**\n * Returns the embed preview for the given URL.\n *\n * @param state Data state.\n * @param 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: State, url: string ): any {\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 state Data state.\n * @param url Embedded URL.\n *\n * @return Is the preview for the URL an oEmbed link fallback.\n */\nexport function isPreviewEmbedFallback( state: State, url: string ): boolean {\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 state Data state.\n * @param action Action to check. One of: 'create', 'read', 'update', 'delete'.\n * @param resource REST resource to check, e.g. 'media' or 'posts'.\n * @param id Optional ID of the rest resource to check.\n *\n * @return Whether or not the user can perform the action,\n * or `undefined` if the OPTIONS request is still being made.\n */\nexport function canUser(\n\tstate: State,\n\taction: string,\n\tresource: string,\n\tid?: EntityRecordKey\n): boolean | undefined {\n\tconst key = [ action, resource, id ].filter( Boolean ).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 state Data state.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param recordId Record's id.\n * @return Whether or not the user can edit,\n * or `undefined` if the OPTIONS request is still being made.\n */\nexport function canUserEditEntityRecord(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\trecordId: EntityRecordKey\n): boolean | undefined {\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 state State tree.\n * @param postType The type of the parent post.\n * @param postId The id of the parent post.\n *\n * @return An array of autosaves for the post, or undefined if there is none.\n */\nexport function getAutosaves(\n\tstate: State,\n\tpostType: string,\n\tpostId: EntityRecordKey\n): Array< any > | undefined {\n\treturn state.autosaves[ postId ];\n}\n\n/**\n * Returns the autosave for the post and author.\n *\n * @param state State tree.\n * @param postType The type of the parent post.\n * @param postId The id of the parent post.\n * @param authorId The id of the author.\n *\n * @return The autosave for the post and author.\n */\nexport function getAutosave< EntityRecord extends ET.EntityRecord< any > >(\n\tstate: State,\n\tpostType: string,\n\tpostId: EntityRecordKey,\n\tauthorId: EntityRecordKey\n): EntityRecord | undefined {\n\tif ( authorId === undefined ) {\n\t\treturn;\n\t}\n\n\tconst autosaves = state.autosaves[ postId ];\n\treturn find( autosaves, { author: authorId } ) as EntityRecord | undefined;\n}\n\n/**\n * Returns true if the REST request for autosaves has completed.\n *\n * @param state State tree.\n * @param postType The type of the parent post.\n * @param postId The id of the parent post.\n *\n * @return True if the REST request was completed. False otherwise.\n */\nexport const hasFetchedAutosaves = createRegistrySelector(\n\t( select ) =>\n\t\t(\n\t\t\tstate: State,\n\t\t\tpostType: string,\n\t\t\tpostId: EntityRecordKey\n\t\t): boolean => {\n\t\t\treturn select( STORE_NAME ).hasFinishedResolution( 'getAutosaves', [\n\t\t\t\tpostType,\n\t\t\t\tpostId,\n\t\t\t] );\n\t\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 state Editor state.\n *\n * @return A value whose reference will change only when an edit occurs.\n */\nexport const getReferenceByDistinctEdits = createSelector(\n\t// This unused state argument is listed here for the documentation generating tool (docgen).\n\t( state: State ) => [],\n\t( state: 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 state Editor state.\n * @param link Link.\n *\n * @return The template record.\n */\nexport function __experimentalGetTemplateForLink(\n\tstate: State,\n\tlink: string\n): Optional< ET.Updatable< ET.WpTemplate > > | null {\n\tconst records = getEntityRecords< ET.WpTemplate >(\n\t\tstate,\n\t\t'postType',\n\t\t'wp_template',\n\t\t{\n\t\t\t'find-template': link,\n\t\t}\n\t);\n\n\tif ( records?.length ) {\n\t\treturn getEditedEntityRecord< ET.WpTemplate >(\n\t\t\tstate,\n\t\t\t'postType',\n\t\t\t'wp_template',\n\t\t\trecords[ 0 ].id\n\t\t);\n\t}\n\treturn null;\n}\n\n/**\n * Retrieve the current theme's base global styles\n *\n * @param state Editor state.\n *\n * @return The Global Styles object.\n */\nexport function __experimentalGetCurrentThemeBaseGlobalStyles(\n\tstate: State\n): any {\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 state Data state.\n *\n * @return The current global styles ID.\n */\nexport function __experimentalGetCurrentThemeGlobalStylesVariations(\n\tstate: State\n): string | null {\n\tconst currentTheme = getCurrentTheme( state );\n\tif ( ! currentTheme ) {\n\t\treturn null;\n\t}\n\treturn state.themeGlobalStyleVariations[ currentTheme.stylesheet ];\n}\n\n/**\n * Retrieve the list of registered block patterns.\n *\n * @param state Data state.\n *\n * @return Block pattern list.\n */\nexport function getBlockPatterns( state: State ): Array< any > {\n\treturn state.blockPatterns;\n}\n\n/**\n * Retrieve the list of registered block pattern categories.\n *\n * @param state Data state.\n *\n * @return Block pattern category list.\n */\nexport function getBlockPatternCategories( state: State ): Array< any > {\n\treturn state.blockPatternCategories;\n}\n"]}
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { upperFirst, camelCase, map, find, get, startCase } from 'lodash';
4
+ import { capitalCase, pascalCase } from 'change-case';
5
+ import { map, find, get } from 'lodash';
5
6
  /**
6
7
  * WordPress dependencies
7
8
  */
@@ -15,18 +16,15 @@ import { __ } from '@wordpress/i18n';
15
16
  import { addEntities } from './actions';
16
17
  export const DEFAULT_ENTITY_KEY = 'id';
17
18
  const POST_RAW_ATTRIBUTES = ['title', 'excerpt', 'content'];
18
- const attachmentConfig = {
19
- name: 'media',
19
+ export const rootEntitiesConfig = [{
20
+ label: __('Base'),
20
21
  kind: 'root',
21
- baseURL: '/wp/v2/media',
22
+ name: '__unstableBase',
23
+ baseURL: '/',
22
24
  baseURLParams: {
23
- context: 'edit'
24
- },
25
- plural: 'mediaItems',
26
- label: __('Media'),
27
- rawAttributes: ['caption', 'title', 'description']
28
- };
29
- const siteConfig = {
25
+ _fields: ['description', 'gmt_offset', 'home', 'name', 'site_icon', 'site_icon_url', 'site_logo', 'timezone_string', 'url'].join(',')
26
+ }
27
+ }, {
30
28
  label: __('Site'),
31
29
  name: 'site',
32
30
  kind: 'root',
@@ -34,8 +32,7 @@ const siteConfig = {
34
32
  getTitle: record => {
35
33
  return get(record, ['title'], __('Site Title'));
36
34
  }
37
- };
38
- const postTypeConfig = {
35
+ }, {
39
36
  label: __('Post Type'),
40
37
  name: 'postType',
41
38
  kind: 'root',
@@ -44,8 +41,17 @@ const postTypeConfig = {
44
41
  baseURLParams: {
45
42
  context: 'edit'
46
43
  }
47
- };
48
- const taxonomyConfig = {
44
+ }, {
45
+ name: 'media',
46
+ kind: 'root',
47
+ baseURL: '/wp/v2/media',
48
+ baseURLParams: {
49
+ context: 'edit'
50
+ },
51
+ plural: 'mediaItems',
52
+ label: __('Media'),
53
+ rawAttributes: ['caption', 'title', 'description']
54
+ }, {
49
55
  name: 'taxonomy',
50
56
  kind: 'root',
51
57
  key: 'slug',
@@ -55,8 +61,7 @@ const taxonomyConfig = {
55
61
  },
56
62
  plural: 'taxonomies',
57
63
  label: __('Taxonomy')
58
- };
59
- const sidebarConfig = {
64
+ }, {
60
65
  name: 'sidebar',
61
66
  kind: 'root',
62
67
  baseURL: '/wp/v2/sidebars',
@@ -68,8 +73,7 @@ const sidebarConfig = {
68
73
  blocks: true
69
74
  },
70
75
  label: __('Widget areas')
71
- };
72
- const widgetConfig = {
76
+ }, {
73
77
  name: 'widget',
74
78
  kind: 'root',
75
79
  baseURL: '/wp/v2/widgets',
@@ -81,8 +85,7 @@ const widgetConfig = {
81
85
  blocks: true
82
86
  },
83
87
  label: __('Widgets')
84
- };
85
- const widgetTypeConfig = {
88
+ }, {
86
89
  name: 'widgetType',
87
90
  kind: 'root',
88
91
  baseURL: '/wp/v2/widget-types',
@@ -91,8 +94,7 @@ const widgetTypeConfig = {
91
94
  },
92
95
  plural: 'widgetTypes',
93
96
  label: __('Widget types')
94
- };
95
- const userConfig = {
97
+ }, {
96
98
  label: __('User'),
97
99
  name: 'user',
98
100
  kind: 'root',
@@ -101,8 +103,7 @@ const userConfig = {
101
103
  context: 'edit'
102
104
  },
103
105
  plural: 'users'
104
- };
105
- const commentConfig = {
106
+ }, {
106
107
  name: 'comment',
107
108
  kind: 'root',
108
109
  baseURL: '/wp/v2/comments',
@@ -111,8 +112,7 @@ const commentConfig = {
111
112
  },
112
113
  plural: 'comments',
113
114
  label: __('Comment')
114
- };
115
- const menuConfig = {
115
+ }, {
116
116
  name: 'menu',
117
117
  kind: 'root',
118
118
  baseURL: '/wp/v2/menus',
@@ -121,8 +121,7 @@ const menuConfig = {
121
121
  },
122
122
  plural: 'menus',
123
123
  label: __('Menu')
124
- };
125
- const menuItemConfig = {
124
+ }, {
126
125
  name: 'menuItem',
127
126
  kind: 'root',
128
127
  baseURL: '/wp/v2/menu-items',
@@ -132,8 +131,7 @@ const menuItemConfig = {
132
131
  plural: 'menuItems',
133
132
  label: __('Menu Item'),
134
133
  rawAttributes: ['title']
135
- };
136
- const menuLocationConfig = {
134
+ }, {
137
135
  name: 'menuLocation',
138
136
  kind: 'root',
139
137
  baseURL: '/wp/v2/menu-locations',
@@ -143,8 +141,7 @@ const menuLocationConfig = {
143
141
  plural: 'menuLocations',
144
142
  label: __('Menu Location'),
145
143
  key: 'name'
146
- };
147
- const globalStyleConfig = {
144
+ }, {
148
145
  label: __('Global Styles'),
149
146
  name: 'globalStyles',
150
147
  kind: 'root',
@@ -159,8 +156,7 @@ const globalStyleConfig = {
159
156
 
160
157
  return (record === null || record === void 0 ? void 0 : (_record$title = record.title) === null || _record$title === void 0 ? void 0 : _record$title.rendered) || (record === null || record === void 0 ? void 0 : record.title);
161
158
  }
162
- };
163
- const themeConfig = {
159
+ }, {
164
160
  label: __('Themes'),
165
161
  name: 'theme',
166
162
  kind: 'root',
@@ -169,8 +165,7 @@ const themeConfig = {
169
165
  context: 'edit'
170
166
  },
171
167
  key: 'stylesheet'
172
- };
173
- const pluginConfig = {
168
+ }, {
174
169
  label: __('Plugins'),
175
170
  name: 'plugin',
176
171
  kind: 'root',
@@ -179,16 +174,7 @@ const pluginConfig = {
179
174
  context: 'edit'
180
175
  },
181
176
  key: 'plugin'
182
- };
183
- export const rootEntitiesConfig = [{
184
- label: __('Base'),
185
- kind: 'root',
186
- name: '__unstableBase',
187
- baseURL: '/',
188
- baseURLParams: {
189
- _fields: ['description', 'gmt_offset', 'home', 'name', 'site_icon', 'site_icon_url', 'site_logo', 'timezone_string', 'url'].join(',')
190
- }
191
- }, siteConfig, postTypeConfig, attachmentConfig, taxonomyConfig, sidebarConfig, widgetConfig, widgetTypeConfig, userConfig, commentConfig, menuConfig, menuItemConfig, menuLocationConfig, globalStyleConfig, themeConfig, pluginConfig];
177
+ }];
192
178
  export const additionalEntityConfigLoaders = [{
193
179
  kind: 'postType',
194
180
  loadEntities: loadPostTypeEntities
@@ -253,9 +239,9 @@ async function loadPostTypeEntities() {
253
239
  },
254
240
  rawAttributes: POST_RAW_ATTRIBUTES,
255
241
  getTitle: record => {
256
- var _record$title2;
242
+ var _record$title2, _record$slug;
257
243
 
258
- return (record === null || record === void 0 ? void 0 : (_record$title2 = record.title) === null || _record$title2 === void 0 ? void 0 : _record$title2.rendered) || (record === null || record === void 0 ? void 0 : record.title) || (isTemplate ? startCase(record.slug) : String(record.id));
244
+ return (record === null || record === void 0 ? void 0 : (_record$title2 = record.title) === null || _record$title2 === void 0 ? void 0 : _record$title2.rendered) || (record === null || record === void 0 ? void 0 : record.title) || (isTemplate ? capitalCase((_record$slug = record.slug) !== null && _record$slug !== void 0 ? _record$slug : '') : String(record.id));
259
245
  },
260
246
  __unstablePrePersist: isTemplate ? undefined : prePersistPostType,
261
247
  __unstable_rest_base: postType.rest_base
@@ -316,9 +302,9 @@ export const getMethodName = function (kind, name) {
316
302
  kind,
317
303
  name
318
304
  });
319
- const kindPrefix = kind === 'root' ? '' : upperFirst(camelCase(kind));
320
- const nameSuffix = upperFirst(camelCase(name)) + (usePlural ? 's' : '');
321
- const suffix = usePlural && 'plural' in entityConfig && entityConfig !== null && entityConfig !== void 0 && entityConfig.plural ? upperFirst(camelCase(entityConfig.plural)) : nameSuffix;
305
+ const kindPrefix = kind === 'root' ? '' : pascalCase(kind);
306
+ const nameSuffix = pascalCase(name) + (usePlural ? 's' : '');
307
+ const suffix = usePlural && 'plural' in entityConfig && entityConfig !== null && entityConfig !== void 0 && entityConfig.plural ? pascalCase(entityConfig.plural) : nameSuffix;
322
308
  return `${prefix}${kindPrefix}${suffix}`;
323
309
  };
324
310
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/core-data/src/entities.ts"],"names":["upperFirst","camelCase","map","find","get","startCase","apiFetch","__","addEntities","DEFAULT_ENTITY_KEY","POST_RAW_ATTRIBUTES","attachmentConfig","name","kind","baseURL","baseURLParams","context","plural","label","rawAttributes","siteConfig","getTitle","record","postTypeConfig","key","taxonomyConfig","sidebarConfig","transientEdits","blocks","widgetConfig","widgetTypeConfig","userConfig","commentConfig","menuConfig","menuItemConfig","menuLocationConfig","globalStyleConfig","title","rendered","themeConfig","pluginConfig","rootEntitiesConfig","_fields","join","additionalEntityConfigLoaders","loadEntities","loadPostTypeEntities","loadTaxonomyEntities","prePersistPostType","persistedRecord","edits","newEdits","status","postTypes","path","postType","isTemplate","includes","namespace","rest_namespace","rest_base","selection","mergedEdits","meta","slug","String","id","__unstablePrePersist","undefined","__unstable_rest_base","taxonomies","taxonomy","getMethodName","prefix","usePlural","entityConfig","kindPrefix","nameSuffix","suffix","getOrLoadEntitiesConfig","select","dispatch","configs","getEntitiesConfig","length","loader"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,UAAT,EAAqBC,SAArB,EAAgCC,GAAhC,EAAqCC,IAArC,EAA2CC,GAA3C,EAAgDC,SAAhD,QAAiE,QAAjE;AAEA;AACA;AACA;;AACA,OAAOC,QAAP,MAAqB,sBAArB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,WAAT,QAA4B,WAA5B;AAWA,OAAO,MAAMC,kBAAkB,GAAG,IAA3B;AAEP,MAAMC,mBAAmB,GAAG,CAAE,OAAF,EAAW,SAAX,EAAsB,SAAtB,CAA5B;AAYA,MAAMC,gBAA8C,GAAG;AACtDC,EAAAA,IAAI,EAAE,OADgD;AAEtDC,EAAAA,IAAI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OAAO,GAAG,MAAMG,MAAM,CAACxC,YAAP,EAAhB;AACAoC,EAAAA,QAAQ,CAAEzE,WAAW,CAAE0E,OAAF,CAAb,CAAR;AAEA,SAAOA,OAAP;AACA,CAjBK","sourcesContent":["/**\n * External dependencies\n */\nimport { upperFirst, camelCase, map, find, get, startCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { addEntities } from './actions';\nimport type * as Records from './entity-types';\nimport type {\n\tEntityType,\n\tContext,\n\tPost,\n\tTaxonomy,\n\tType,\n\tUpdatable,\n} from './entity-types';\n\nexport const DEFAULT_ENTITY_KEY = 'id';\n\nconst POST_RAW_ATTRIBUTES = [ 'title', 'excerpt', 'content' ];\n\ntype AttachmentEntity< C extends Context = Context > = EntityType<\n\t{\n\t\tname: 'media';\n\t\tkind: 'root';\n\t\tbaseURLParams: { context: 'edit' };\n\t},\n\tRecords.Attachment< C >,\n\tC\n>;\n\nconst attachmentConfig: AttachmentEntity[ 'config' ] = {\n\tname: 'media',\n\tkind: 'root',\n\tbaseURL: '/wp/v2/media',\n\tbaseURLParams: { context: 'edit' },\n\tplural: 'mediaItems',\n\tlabel: __( 'Media' ),\n\trawAttributes: [ 'caption', 'title', 'description' ],\n};\n\ntype SiteEntity< C extends Context = Context > = EntityType<\n\t{\n\t\tname: 'site';\n\t\tkind: 'root';\n\t},\n\tRecords.Settings< C >,\n\tC\n>;\n\nconst siteConfig: SiteEntity[ 'config' ] = {\n\tlabel: __( 'Site' ),\n\tname: 'site',\n\tkind: 'root',\n\tbaseURL: '/wp/v2/settings',\n\tgetTitle: ( record: Records.Settings< 'edit' > ) => {\n\t\treturn get( record, [ 'title' ], __( 'Site Title' ) );\n\t},\n};\n\ntype PostTypeEntity< C extends Context = Context > = EntityType<\n\t{\n\t\tname: 'postType';\n\t\tkind: 'root';\n\t\tkey: 'slug';\n\t\tbaseURLParams: { context: 'edit' };\n\t},\n\tRecords.Type< C >,\n\tC\n>;\n\nconst postTypeConfig: PostTypeEntity[ 'config' ] = {\n\tlabel: __( 'Post Type' ),\n\tname: 'postType',\n\tkind: 'root',\n\tkey: 'slug',\n\tbaseURL: '/wp/v2/types',\n\tbaseURLParams: { context: 'edit' },\n};\n\ntype TaxonomyEntity< C extends Context = Context > = EntityType<\n\t{\n\t\tname: 'taxonomy';\n\t\tkind: 'root';\n\t\tkey: 'slug';\n\t\tbaseURLParams: { context: 'edit' };\n\t},\n\tRecords.Taxonomy< C >,\n\tC\n>;\n\nconst taxonomyConfig: TaxonomyEntity[ 'config' ] = {\n\tname: 'taxonomy',\n\tkind: 'root',\n\tkey: 'slug',\n\tbaseURL: '/wp/v2/taxonomies',\n\tbaseURLParams: { context: 'edit' },\n\tplural: 'taxonomies',\n\tlabel: __( 'Taxonomy' ),\n};\n\ntype SidebarEntity< C extends Context = Context > = EntityType<\n\t{\n\t\tname: 'sidebar';\n\t\tkind: 'root';\n\t\tbaseURLParams: { context: 'edit' };\n\t},\n\tRecords.Sidebar< C >,\n\tC\n>;\n\nconst sidebarConfig: SidebarEntity[ 'config' ] = {\n\tname: 'sidebar',\n\tkind: 'root',\n\tbaseURL: '/wp/v2/sidebars',\n\tbaseURLParams: { context: 'edit' },\n\tplural: 'sidebars',\n\ttransientEdits: { blocks: true },\n\tlabel: __( 'Widget areas' ),\n};\n\ntype WidgetEntity< C extends Context = Context > = EntityType<\n\t{\n\t\tname: 'widget';\n\t\tkind: 'root';\n\t\tbaseURLParams: { context: 'edit' };\n\t},\n\tRecords.Widget< C >,\n\tC\n>;\nconst widgetConfig: WidgetEntity[ 'config' ] = {\n\tname: 'widget',\n\tkind: 'root',\n\tbaseURL: '/wp/v2/widgets',\n\tbaseURLParams: { context: 'edit' },\n\tplural: 'widgets',\n\ttransientEdits: { blocks: true },\n\tlabel: __( 'Widgets' ),\n};\n\ntype WidgetTypeEntity< C extends Context = Context > = EntityType<\n\t{\n\t\tname: 'widgetType';\n\t\tkind: 'root';\n\t\tbaseURLParams: { context: 'edit' };\n\t},\n\tRecords.WidgetType< C >,\n\tC\n>;\nconst widgetTypeConfig: WidgetTypeEntity[ 'config' ] = {\n\tname: 'widgetType',\n\tkind: 'root',\n\tbaseURL: '/wp/v2/widget-types',\n\tbaseURLParams: { context: 'edit' },\n\tplural: 'widgetTypes',\n\tlabel: __( 'Widget types' ),\n};\n\ntype UserEntity< C extends Context = Context > = EntityType<\n\t{\n\t\tname: 'user';\n\t\tkind: 'root';\n\t\tbaseURLParams: { context: 'edit' };\n\t},\n\tRecords.User< C >,\n\tC\n>;\nconst userConfig: UserEntity[ 'config' ] = {\n\tlabel: __( 'User' ),\n\tname: 'user',\n\tkind: 'root',\n\tbaseURL: '/wp/v2/users',\n\tbaseURLParams: { context: 'edit' },\n\tplural: 'users',\n};\n\ntype CommentEntity< C extends Context = Context > = EntityType<\n\t{\n\t\tname: 'comment';\n\t\tkind: 'root';\n\t\tbaseURLParams: { context: 'edit' };\n\t},\n\tRecords.Comment< C >,\n\tC\n>;\nconst commentConfig: CommentEntity[ 'config' ] = {\n\tname: 'comment',\n\tkind: 'root',\n\tbaseURL: '/wp/v2/comments',\n\tbaseURLParams: { context: 'edit' },\n\tplural: 'comments',\n\tlabel: __( 'Comment' ),\n};\n\ntype NavMenuEntity< C extends Context = Context > = EntityType<\n\t{\n\t\tname: 'menu';\n\t\tkind: 'root';\n\t\tbaseURLParams: { context: 'edit' };\n\t},\n\tRecords.NavMenu< C >,\n\tC\n>;\n\nconst menuConfig: NavMenuEntity[ 'config' ] = {\n\tname: 'menu',\n\tkind: 'root',\n\tbaseURL: '/wp/v2/menus',\n\tbaseURLParams: { context: 'edit' },\n\tplural: 'menus',\n\tlabel: __( 'Menu' ),\n};\n\ntype NavMenuItemEntity< C extends Context = Context > = EntityType<\n\t{\n\t\tname: 'menuItem';\n\t\tkind: 'root';\n\t\tbaseURLParams: { context: 'edit' };\n\t},\n\tRecords.NavMenuItem< C >,\n\tC\n>;\n\nconst menuItemConfig: NavMenuItemEntity[ 'config' ] = {\n\tname: 'menuItem',\n\tkind: 'root',\n\tbaseURL: '/wp/v2/menu-items',\n\tbaseURLParams: { context: 'edit' },\n\tplural: 'menuItems',\n\tlabel: __( 'Menu Item' ),\n\trawAttributes: [ 'title' ],\n};\n\ntype MenuLocationEntity< C extends Context = Context > = EntityType<\n\t{\n\t\tname: 'menuLocation';\n\t\tkind: 'root';\n\t\tkey: 'name';\n\t\tbaseURLParams: { context: 'edit' };\n\t},\n\tRecords.MenuLocation< C >,\n\tC\n>;\n\nconst menuLocationConfig: MenuLocationEntity[ 'config' ] = {\n\tname: 'menuLocation',\n\tkind: 'root',\n\tbaseURL: '/wp/v2/menu-locations',\n\tbaseURLParams: { context: 'edit' },\n\tplural: 'menuLocations',\n\tlabel: __( 'Menu Location' ),\n\tkey: 'name',\n};\n\nconst globalStyleConfig = {\n\tlabel: __( 'Global Styles' ),\n\tname: 'globalStyles',\n\tkind: 'root',\n\tbaseURL: '/wp/v2/global-styles',\n\tbaseURLParams: { context: 'edit' },\n\tplural: 'globalStylesVariations', // Should be different than name.\n\tgetTitle: ( record ) => record?.title?.rendered || record?.title,\n};\n\ntype ThemeEntity< C extends Context = Context > = EntityType<\n\t{\n\t\tname: 'theme';\n\t\tkind: 'root';\n\t\tbaseURLParams: { context: 'edit' };\n\t\tkey: 'stylesheet';\n\t},\n\tRecords.Theme< C >,\n\tC\n>;\n\nconst themeConfig: ThemeEntity[ 'config' ] = {\n\tlabel: __( 'Themes' ),\n\tname: 'theme',\n\tkind: 'root',\n\tbaseURL: '/wp/v2/themes',\n\tbaseURLParams: { context: 'edit' },\n\tkey: 'stylesheet',\n};\n\ntype PluginEntity< C extends Context = Context > = EntityType<\n\t{\n\t\tname: 'plugin';\n\t\tkind: 'root';\n\t\tbaseURLParams: { context: 'edit' };\n\t\tkey: 'plugin';\n\t},\n\tRecords.Plugin< C >,\n\tC\n>;\nconst pluginConfig: PluginEntity[ 'config' ] = {\n\tlabel: __( 'Plugins' ),\n\tname: 'plugin',\n\tkind: 'root',\n\tbaseURL: '/wp/v2/plugins',\n\tbaseURLParams: { context: 'edit' },\n\tkey: 'plugin',\n};\n\nexport const rootEntitiesConfig = [\n\t{\n\t\tlabel: __( 'Base' ),\n\t\tkind: 'root',\n\t\tname: '__unstableBase',\n\t\tbaseURL: '/',\n\t\tbaseURLParams: {\n\t\t\t_fields: [\n\t\t\t\t'description',\n\t\t\t\t'gmt_offset',\n\t\t\t\t'home',\n\t\t\t\t'name',\n\t\t\t\t'site_icon',\n\t\t\t\t'site_icon_url',\n\t\t\t\t'site_logo',\n\t\t\t\t'timezone_string',\n\t\t\t\t'url',\n\t\t\t].join( ',' ),\n\t\t},\n\t},\n\tsiteConfig,\n\tpostTypeConfig,\n\tattachmentConfig,\n\ttaxonomyConfig,\n\tsidebarConfig,\n\twidgetConfig,\n\twidgetTypeConfig,\n\tuserConfig,\n\tcommentConfig,\n\tmenuConfig,\n\tmenuItemConfig,\n\tmenuLocationConfig,\n\tglobalStyleConfig,\n\tthemeConfig,\n\tpluginConfig,\n];\n\ntype PostTypeConfig = {\n\tkind: 'postType';\n\tkey: 'id';\n\tdefaultContext: 'edit';\n};\n\ntype PostEntity< C extends Context = Context > = EntityType<\n\tPostTypeConfig & { name: 'post' },\n\tRecords.Post< C >,\n\tC\n>;\ntype PageEntity< C extends Context > = EntityType<\n\tPostTypeConfig & { name: 'page' },\n\tRecords.Page< C >,\n\tC\n>;\ntype WpTemplateEntity< C extends Context > = EntityType<\n\tPostTypeConfig & { name: 'wp_template' },\n\tRecords.WpTemplate< C >,\n\tC\n>;\ntype WpTemplatePartEntity< C extends Context > = EntityType<\n\tPostTypeConfig & { name: 'wp_template_part' },\n\tRecords.WpTemplatePart< C >,\n\tC\n>;\n\nexport type CoreEntities< C extends Context > =\n\t| SiteEntity< C >\n\t| PostTypeEntity< C >\n\t| AttachmentEntity< C >\n\t| TaxonomyEntity< C >\n\t| SidebarEntity< C >\n\t| WidgetEntity< C >\n\t| WidgetTypeEntity< C >\n\t| UserEntity< C >\n\t| CommentEntity< C >\n\t| NavMenuEntity< C >\n\t| NavMenuItemEntity< C >\n\t| MenuLocationEntity< C >\n\t| ThemeEntity< C >\n\t| PluginEntity< C >\n\t| PostEntity< C >\n\t| PageEntity< C >\n\t| WpTemplateEntity< C >\n\t| WpTemplatePartEntity< C >;\n\nexport const additionalEntityConfigLoaders = [\n\t{ kind: 'postType', loadEntities: loadPostTypeEntities },\n\t{ kind: 'taxonomy', loadEntities: loadTaxonomyEntities },\n];\n\n/**\n * Returns a function to be used to retrieve extra edits to apply before persisting a post type.\n *\n * @param {Object} persistedRecord Already persisted Post\n * @param {Object} edits Edits.\n * @return {Object} Updated edits.\n */\nexport const prePersistPostType = ( persistedRecord, edits ) => {\n\tconst newEdits = {} as Partial< Updatable< Post< 'edit' > > >;\n\n\tif ( persistedRecord?.status === 'auto-draft' ) {\n\t\t// Saving an auto-draft should create a draft by default.\n\t\tif ( ! edits.status && ! newEdits.status ) {\n\t\t\tnewEdits.status = 'draft';\n\t\t}\n\n\t\t// Fix the auto-draft default title.\n\t\tif (\n\t\t\t( ! edits.title || edits.title === 'Auto Draft' ) &&\n\t\t\t! newEdits.title &&\n\t\t\t( ! persistedRecord?.title ||\n\t\t\t\tpersistedRecord?.title === 'Auto Draft' )\n\t\t) {\n\t\t\tnewEdits.title = '';\n\t\t}\n\t}\n\n\treturn newEdits;\n};\n\n/**\n * Returns the list of post type entities.\n *\n * @return {Promise} Entities promise\n */\nasync function loadPostTypeEntities() {\n\tconst postTypes = ( await apiFetch( {\n\t\tpath: '/wp/v2/types?context=view',\n\t} ) ) as Record< string, Type< 'view' > >;\n\treturn map( postTypes, ( postType, name ) => {\n\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\tname\n\t\t);\n\t\tconst namespace = postType?.rest_namespace ?? 'wp/v2';\n\t\treturn {\n\t\t\tkind: 'postType',\n\t\t\tbaseURL: `/${ namespace }/${ postType.rest_base }`,\n\t\t\tbaseURLParams: { context: 'edit' },\n\t\t\tname,\n\t\t\tlabel: postType.name,\n\t\t\ttransientEdits: {\n\t\t\t\tblocks: true,\n\t\t\t\tselection: true,\n\t\t\t},\n\t\t\tmergedEdits: { meta: true },\n\t\t\trawAttributes: POST_RAW_ATTRIBUTES,\n\t\t\tgetTitle: ( record ) =>\n\t\t\t\trecord?.title?.rendered ||\n\t\t\t\trecord?.title ||\n\t\t\t\t( isTemplate ? startCase( record.slug ) : String( record.id ) ),\n\t\t\t__unstablePrePersist: isTemplate ? undefined : prePersistPostType,\n\t\t\t__unstable_rest_base: postType.rest_base,\n\t\t};\n\t} );\n}\n\n/**\n * Returns the list of the taxonomies entities.\n *\n * @return {Promise} Entities promise\n */\nasync function loadTaxonomyEntities() {\n\tconst taxonomies = ( await apiFetch( {\n\t\tpath: '/wp/v2/taxonomies?context=view',\n\t} ) ) as Record< string, Taxonomy< 'view' > >;\n\treturn map( taxonomies, ( taxonomy, name ) => {\n\t\tconst namespace = taxonomy?.rest_namespace ?? 'wp/v2';\n\t\treturn {\n\t\t\tkind: 'taxonomy',\n\t\t\tbaseURL: `/${ namespace }/${ taxonomy.rest_base }`,\n\t\t\tbaseURLParams: { context: 'edit' },\n\t\t\tname,\n\t\t\tlabel: taxonomy.name,\n\t\t};\n\t} );\n}\n\n/**\n * Returns the entity's getter method name given its kind and name.\n *\n * @example\n * ```js\n * const nameSingular = getMethodName( 'root', 'theme', 'get' );\n * // nameSingular is getRootTheme\n *\n * const namePlural = getMethodName( 'root', 'theme', 'set' );\n * // namePlural is setRootThemes\n * ```\n *\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {string} prefix Function prefix.\n * @param {boolean} usePlural Whether to use the plural form or not.\n *\n * @return {string} Method name\n */\nexport const getMethodName = (\n\tkind,\n\tname,\n\tprefix = 'get',\n\tusePlural = false\n) => {\n\tconst entityConfig = find( rootEntitiesConfig, { kind, name } );\n\tconst kindPrefix = kind === 'root' ? '' : upperFirst( camelCase( kind ) );\n\tconst nameSuffix =\n\t\tupperFirst( camelCase( name ) ) + ( usePlural ? 's' : '' );\n\tconst suffix =\n\t\tusePlural && 'plural' in entityConfig! && entityConfig?.plural\n\t\t\t? upperFirst( camelCase( entityConfig.plural ) )\n\t\t\t: nameSuffix;\n\treturn `${ prefix }${ kindPrefix }${ suffix }`;\n};\n\n/**\n * Loads the kind entities into the store.\n *\n * @param {string} kind Kind\n *\n * @return {(thunkArgs: object) => Promise<Array>} Entities\n */\nexport const getOrLoadEntitiesConfig =\n\t( kind ) =>\n\tasync ( { select, dispatch } ) => {\n\t\tlet configs = select.getEntitiesConfig( kind );\n\t\tif ( configs && configs.length !== 0 ) {\n\t\t\treturn configs;\n\t\t}\n\n\t\tconst loader = find( additionalEntityConfigLoaders, { kind } );\n\t\tif ( ! loader ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconfigs = await loader.loadEntities();\n\t\tdispatch( addEntities( configs ) );\n\n\t\treturn configs;\n\t};\n"]}
1
+ {"version":3,"sources":["@wordpress/core-data/src/entities.js"],"names":["capitalCase","pascalCase","map","find","get","apiFetch","__","addEntities","DEFAULT_ENTITY_KEY","POST_RAW_ATTRIBUTES","rootEntitiesConfig","label","kind","name","baseURL","baseURLParams","_fields","join","getTitle","record","key","context","plural","rawAttributes","transientEdits","blocks","title","rendered","additionalEntityConfigLoaders","loadEntities","loadPostTypeEntities","loadTaxonomyEntities","prePersistPostType","persistedRecord","edits","newEdits","status","postTypes","path","postType","isTemplate","includes","namespace","rest_namespace","rest_base","selection","mergedEdits","meta","slug","String","id","__unstablePrePersist","undefined","__unstable_rest_base","taxonomies","taxonomy","getMethodName","prefix","usePlural","entityConfig","kindPrefix","nameSuffix","suffix","getOrLoadEntitiesConfig","select","dispatch","configs","getEntitiesConfig","length","loader"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAT,EAAsBC,UAAtB,QAAwC,aAAxC;AACA,SAASC,GAAT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,SAAS,IAAI,YAAYC,YAAzB,IAAyCA,YAAzC,aAAyCA,YAAzC,eAAyCA,YAAY,CAAErC,MAAvD,GACGrB,UAAU,CAAE0D,YAAY,CAACrC,MAAf,CADb,GAEGuC,UAHJ;AAIA,SAAQ,GAAGJ,MAAQ,GAAGG,UAAY,GAAGE,MAAQ,EAA7C;AACA,CAdM;AAgBP;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,uBAAuB,GACjCnD,IAAF,IACA,cAAkC;AAAA,MAA1B;AAAEoD,IAAAA,MAAF;AAAUC,IAAAA;AAAV,GAA0B;AACjC,MAAIC,OAAO,GAAGF,MAAM,CAACG,iBAAP,CAA0BvD,IAA1B,CAAd;;AACA,MAAKsD,OAAO,IAAIA,OAAO,CAACE,MAAR,KAAmB,CAAnC,EAAuC;AACtC,WAAOF,OAAP;AACA;;AAED,QAAMG,MAAM,GAAGlE,IAAI,CAAEyB,6BAAF,EAAiC;AAAEhB,IAAAA;AAAF,GAAjC,CAAnB;;AACA,MAAK,CAAEyD,MAAP,EAAgB;AACf,WAAO,EAAP;AACA;;AAEDH,EAAAA,OAAO,GAAG,MAAMG,MAAM,CAACxC,YAAP,EAAhB;AACAoC,EAAAA,QAAQ,CAAE1D,WAAW,CAAE2D,OAAF,CAAb,CAAR;AAEA,SAAOA,OAAP;AACA,CAjBK","sourcesContent":["/**\n * External dependencies\n */\nimport { capitalCase, pascalCase } from 'change-case';\nimport { map, find, get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { addEntities } from './actions';\n\nexport const DEFAULT_ENTITY_KEY = 'id';\n\nconst POST_RAW_ATTRIBUTES = [ 'title', 'excerpt', 'content' ];\n\nexport const rootEntitiesConfig = [\n\t{\n\t\tlabel: __( 'Base' ),\n\t\tkind: 'root',\n\t\tname: '__unstableBase',\n\t\tbaseURL: '/',\n\t\tbaseURLParams: {\n\t\t\t_fields: [\n\t\t\t\t'description',\n\t\t\t\t'gmt_offset',\n\t\t\t\t'home',\n\t\t\t\t'name',\n\t\t\t\t'site_icon',\n\t\t\t\t'site_icon_url',\n\t\t\t\t'site_logo',\n\t\t\t\t'timezone_string',\n\t\t\t\t'url',\n\t\t\t].join( ',' ),\n\t\t},\n\t},\n\t{\n\t\tlabel: __( 'Site' ),\n\t\tname: 'site',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/settings',\n\t\tgetTitle: ( record ) => {\n\t\t\treturn get( record, [ 'title' ], __( 'Site Title' ) );\n\t\t},\n\t},\n\t{\n\t\tlabel: __( 'Post Type' ),\n\t\tname: 'postType',\n\t\tkind: 'root',\n\t\tkey: 'slug',\n\t\tbaseURL: '/wp/v2/types',\n\t\tbaseURLParams: { context: 'edit' },\n\t},\n\t{\n\t\tname: 'media',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/media',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'mediaItems',\n\t\tlabel: __( 'Media' ),\n\t\trawAttributes: [ 'caption', 'title', 'description' ],\n\t},\n\t{\n\t\tname: 'taxonomy',\n\t\tkind: 'root',\n\t\tkey: 'slug',\n\t\tbaseURL: '/wp/v2/taxonomies',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'taxonomies',\n\t\tlabel: __( 'Taxonomy' ),\n\t},\n\t{\n\t\tname: 'sidebar',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/sidebars',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'sidebars',\n\t\ttransientEdits: { blocks: true },\n\t\tlabel: __( 'Widget areas' ),\n\t},\n\t{\n\t\tname: 'widget',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/widgets',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'widgets',\n\t\ttransientEdits: { blocks: true },\n\t\tlabel: __( 'Widgets' ),\n\t},\n\t{\n\t\tname: 'widgetType',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/widget-types',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'widgetTypes',\n\t\tlabel: __( 'Widget types' ),\n\t},\n\t{\n\t\tlabel: __( 'User' ),\n\t\tname: 'user',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/users',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'users',\n\t},\n\t{\n\t\tname: 'comment',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/comments',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'comments',\n\t\tlabel: __( 'Comment' ),\n\t},\n\t{\n\t\tname: 'menu',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/menus',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'menus',\n\t\tlabel: __( 'Menu' ),\n\t},\n\t{\n\t\tname: 'menuItem',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/menu-items',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'menuItems',\n\t\tlabel: __( 'Menu Item' ),\n\t\trawAttributes: [ 'title' ],\n\t},\n\t{\n\t\tname: 'menuLocation',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/menu-locations',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'menuLocations',\n\t\tlabel: __( 'Menu Location' ),\n\t\tkey: 'name',\n\t},\n\t{\n\t\tlabel: __( 'Global Styles' ),\n\t\tname: 'globalStyles',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/global-styles',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tplural: 'globalStylesVariations', // Should be different than name.\n\t\tgetTitle: ( record ) => record?.title?.rendered || record?.title,\n\t},\n\t{\n\t\tlabel: __( 'Themes' ),\n\t\tname: 'theme',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/themes',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tkey: 'stylesheet',\n\t},\n\t{\n\t\tlabel: __( 'Plugins' ),\n\t\tname: 'plugin',\n\t\tkind: 'root',\n\t\tbaseURL: '/wp/v2/plugins',\n\t\tbaseURLParams: { context: 'edit' },\n\t\tkey: 'plugin',\n\t},\n];\n\nexport const additionalEntityConfigLoaders = [\n\t{ kind: 'postType', loadEntities: loadPostTypeEntities },\n\t{ kind: 'taxonomy', loadEntities: loadTaxonomyEntities },\n];\n\n/**\n * Returns a function to be used to retrieve extra edits to apply before persisting a post type.\n *\n * @param {Object} persistedRecord Already persisted Post\n * @param {Object} edits Edits.\n * @return {Object} Updated edits.\n */\nexport const prePersistPostType = ( persistedRecord, edits ) => {\n\tconst newEdits = {};\n\n\tif ( persistedRecord?.status === 'auto-draft' ) {\n\t\t// Saving an auto-draft should create a draft by default.\n\t\tif ( ! edits.status && ! newEdits.status ) {\n\t\t\tnewEdits.status = 'draft';\n\t\t}\n\n\t\t// Fix the auto-draft default title.\n\t\tif (\n\t\t\t( ! edits.title || edits.title === 'Auto Draft' ) &&\n\t\t\t! newEdits.title &&\n\t\t\t( ! persistedRecord?.title ||\n\t\t\t\tpersistedRecord?.title === 'Auto Draft' )\n\t\t) {\n\t\t\tnewEdits.title = '';\n\t\t}\n\t}\n\n\treturn newEdits;\n};\n\n/**\n * Returns the list of post type entities.\n *\n * @return {Promise} Entities promise\n */\nasync function loadPostTypeEntities() {\n\tconst postTypes = await apiFetch( {\n\t\tpath: '/wp/v2/types?context=view',\n\t} );\n\treturn map( postTypes, ( postType, name ) => {\n\t\tconst isTemplate = [ 'wp_template', 'wp_template_part' ].includes(\n\t\t\tname\n\t\t);\n\t\tconst namespace = postType?.rest_namespace ?? 'wp/v2';\n\t\treturn {\n\t\t\tkind: 'postType',\n\t\t\tbaseURL: `/${ namespace }/${ postType.rest_base }`,\n\t\t\tbaseURLParams: { context: 'edit' },\n\t\t\tname,\n\t\t\tlabel: postType.name,\n\t\t\ttransientEdits: {\n\t\t\t\tblocks: true,\n\t\t\t\tselection: true,\n\t\t\t},\n\t\t\tmergedEdits: { meta: true },\n\t\t\trawAttributes: POST_RAW_ATTRIBUTES,\n\t\t\tgetTitle: ( record ) =>\n\t\t\t\trecord?.title?.rendered ||\n\t\t\t\trecord?.title ||\n\t\t\t\t( isTemplate\n\t\t\t\t\t? capitalCase( record.slug ?? '' )\n\t\t\t\t\t: String( record.id ) ),\n\t\t\t__unstablePrePersist: isTemplate ? undefined : prePersistPostType,\n\t\t\t__unstable_rest_base: postType.rest_base,\n\t\t};\n\t} );\n}\n\n/**\n * Returns the list of the taxonomies entities.\n *\n * @return {Promise} Entities promise\n */\nasync function loadTaxonomyEntities() {\n\tconst taxonomies = await apiFetch( {\n\t\tpath: '/wp/v2/taxonomies?context=view',\n\t} );\n\treturn map( taxonomies, ( taxonomy, name ) => {\n\t\tconst namespace = taxonomy?.rest_namespace ?? 'wp/v2';\n\t\treturn {\n\t\t\tkind: 'taxonomy',\n\t\t\tbaseURL: `/${ namespace }/${ taxonomy.rest_base }`,\n\t\t\tbaseURLParams: { context: 'edit' },\n\t\t\tname,\n\t\t\tlabel: taxonomy.name,\n\t\t};\n\t} );\n}\n\n/**\n * Returns the entity's getter method name given its kind and name.\n *\n * @example\n * ```js\n * const nameSingular = getMethodName( 'root', 'theme', 'get' );\n * // nameSingular is getRootTheme\n *\n * const namePlural = getMethodName( 'root', 'theme', 'set' );\n * // namePlural is setRootThemes\n * ```\n *\n * @param {string} kind Entity kind.\n * @param {string} name Entity name.\n * @param {string} prefix Function prefix.\n * @param {boolean} usePlural Whether to use the plural form or not.\n *\n * @return {string} Method name\n */\nexport const getMethodName = (\n\tkind,\n\tname,\n\tprefix = 'get',\n\tusePlural = false\n) => {\n\tconst entityConfig = find( rootEntitiesConfig, { kind, name } );\n\tconst kindPrefix = kind === 'root' ? '' : pascalCase( kind );\n\tconst nameSuffix = pascalCase( name ) + ( usePlural ? 's' : '' );\n\tconst suffix =\n\t\tusePlural && 'plural' in entityConfig && entityConfig?.plural\n\t\t\t? pascalCase( entityConfig.plural )\n\t\t\t: nameSuffix;\n\treturn `${ prefix }${ kindPrefix }${ suffix }`;\n};\n\n/**\n * Loads the kind entities into the store.\n *\n * @param {string} kind Kind\n *\n * @return {(thunkArgs: object) => Promise<Array>} Entities\n */\nexport const getOrLoadEntitiesConfig =\n\t( kind ) =>\n\tasync ( { select, dispatch } ) => {\n\t\tlet configs = select.getEntitiesConfig( kind );\n\t\tif ( configs && configs.length !== 0 ) {\n\t\t\treturn configs;\n\t\t}\n\n\t\tconst loader = find( additionalEntityConfigLoaders, { kind } );\n\t\tif ( ! loader ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconfigs = await loader.loadEntities();\n\t\tdispatch( addEntities( configs ) );\n\n\t\treturn configs;\n\t};\n"]}
@@ -1,3 +1,4 @@
1
1
  export { default as useEntityRecord, __experimentalUseEntityRecord } from './use-entity-record';
2
2
  export { default as useEntityRecords, __experimentalUseEntityRecords } from './use-entity-records';
3
+ export { default as useResourcePermissions, __experimentalUseResourcePermissions } from './use-resource-permissions';
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/core-data/src/hooks/index.ts"],"names":["default","useEntityRecord","__experimentalUseEntityRecord","useEntityRecords","__experimentalUseEntityRecords"],"mappings":"AAAA,SACCA,OAAO,IAAIC,eADZ,EAECC,6BAFD,QAGO,qBAHP;AAIA,SACCF,OAAO,IAAIG,gBADZ,EAECC,8BAFD,QAGO,sBAHP","sourcesContent":["export {\n\tdefault as useEntityRecord,\n\t__experimentalUseEntityRecord,\n} from './use-entity-record';\nexport {\n\tdefault as useEntityRecords,\n\t__experimentalUseEntityRecords,\n} from './use-entity-records';\n"]}
1
+ {"version":3,"sources":["@wordpress/core-data/src/hooks/index.ts"],"names":["default","useEntityRecord","__experimentalUseEntityRecord","useEntityRecords","__experimentalUseEntityRecords","useResourcePermissions","__experimentalUseResourcePermissions"],"mappings":"AAAA,SACCA,OAAO,IAAIC,eADZ,EAECC,6BAFD,QAGO,qBAHP;AAIA,SACCF,OAAO,IAAIG,gBADZ,EAECC,8BAFD,QAGO,sBAHP;AAIA,SACCJ,OAAO,IAAIK,sBADZ,EAECC,oCAFD,QAGO,4BAHP","sourcesContent":["export {\n\tdefault as useEntityRecord,\n\t__experimentalUseEntityRecord,\n} from './use-entity-record';\nexport {\n\tdefault as useEntityRecords,\n\t__experimentalUseEntityRecords,\n} from './use-entity-records';\nexport {\n\tdefault as useResourcePermissions,\n\t__experimentalUseResourcePermissions,\n} from './use-resource-permissions';\n"]}