@wordpress/core-data 7.34.0 → 7.34.1-next.2f1c7c01b.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 (300) hide show
  1. package/build/actions.js +12 -10
  2. package/build/actions.js.map +1 -1
  3. package/build/batch/create-batch.js +4 -2
  4. package/build/batch/create-batch.js.map +1 -1
  5. package/build/batch/default-processor.js +3 -1
  6. package/build/batch/default-processor.js.map +1 -1
  7. package/build/batch/index.js +2 -0
  8. package/build/batch/index.js.map +1 -1
  9. package/build/dynamic-entities.js +4 -2
  10. package/build/dynamic-entities.js.map +1 -1
  11. package/build/entities.js +10 -8
  12. package/build/entities.js.map +1 -1
  13. package/build/entity-context.js +3 -1
  14. package/build/entity-context.js.map +1 -1
  15. package/build/entity-provider.js +3 -1
  16. package/build/entity-provider.js.map +1 -1
  17. package/build/entity-types/attachment.js +2 -0
  18. package/build/entity-types/attachment.js.map +1 -1
  19. package/build/entity-types/base-entity-records.js +2 -0
  20. package/build/entity-types/base-entity-records.js.map +1 -1
  21. package/build/entity-types/base.js +2 -0
  22. package/build/entity-types/base.js.map +1 -1
  23. package/build/entity-types/comment.js +2 -0
  24. package/build/entity-types/comment.js.map +1 -1
  25. package/build/entity-types/global-styles-revision.js +2 -0
  26. package/build/entity-types/global-styles-revision.js.map +1 -1
  27. package/build/entity-types/helpers.js +2 -0
  28. package/build/entity-types/helpers.js.map +1 -1
  29. package/build/entity-types/index.js +2 -0
  30. package/build/entity-types/index.js.map +1 -1
  31. package/build/entity-types/menu-location.js +2 -0
  32. package/build/entity-types/menu-location.js.map +1 -1
  33. package/build/entity-types/nav-menu-item.js +2 -0
  34. package/build/entity-types/nav-menu-item.js.map +1 -1
  35. package/build/entity-types/nav-menu.js +2 -0
  36. package/build/entity-types/nav-menu.js.map +1 -1
  37. package/build/entity-types/page.js +2 -0
  38. package/build/entity-types/page.js.map +1 -1
  39. package/build/entity-types/plugin.js +2 -0
  40. package/build/entity-types/plugin.js.map +1 -1
  41. package/build/entity-types/post-revision.js +2 -0
  42. package/build/entity-types/post-revision.js.map +1 -1
  43. package/build/entity-types/post-status.js +2 -0
  44. package/build/entity-types/post-status.js.map +1 -1
  45. package/build/entity-types/post.js +2 -0
  46. package/build/entity-types/post.js.map +1 -1
  47. package/build/entity-types/settings.js +2 -0
  48. package/build/entity-types/settings.js.map +1 -1
  49. package/build/entity-types/sidebar.js +2 -0
  50. package/build/entity-types/sidebar.js.map +1 -1
  51. package/build/entity-types/taxonomy.js +2 -0
  52. package/build/entity-types/taxonomy.js.map +1 -1
  53. package/build/entity-types/term.js +2 -0
  54. package/build/entity-types/term.js.map +1 -1
  55. package/build/entity-types/theme.js +2 -0
  56. package/build/entity-types/theme.js.map +1 -1
  57. package/build/entity-types/type.js +2 -0
  58. package/build/entity-types/type.js.map +1 -1
  59. package/build/entity-types/user.js +2 -0
  60. package/build/entity-types/user.js.map +1 -1
  61. package/build/entity-types/widget-type.js +2 -0
  62. package/build/entity-types/widget-type.js.map +1 -1
  63. package/build/entity-types/widget.js +2 -0
  64. package/build/entity-types/widget.js.map +1 -1
  65. package/build/entity-types/wp-template-part.js +2 -0
  66. package/build/entity-types/wp-template-part.js.map +1 -1
  67. package/build/entity-types/wp-template.js +2 -0
  68. package/build/entity-types/wp-template.js.map +1 -1
  69. package/build/fetch/__experimental-fetch-link-suggestions.js +2 -0
  70. package/build/fetch/__experimental-fetch-link-suggestions.js.map +1 -1
  71. package/build/fetch/__experimental-fetch-url-data.js +4 -2
  72. package/build/fetch/__experimental-fetch-url-data.js.map +1 -1
  73. package/build/fetch/index.js +2 -0
  74. package/build/fetch/index.js.map +1 -1
  75. package/build/footnotes/get-footnotes-order.js +3 -1
  76. package/build/footnotes/get-footnotes-order.js.map +1 -1
  77. package/build/footnotes/get-rich-text-values-cached.js +4 -2
  78. package/build/footnotes/get-rich-text-values-cached.js.map +1 -1
  79. package/build/footnotes/index.js +3 -1
  80. package/build/footnotes/index.js.map +1 -1
  81. package/build/hooks/constants.js +2 -0
  82. package/build/hooks/constants.js.map +1 -1
  83. package/build/hooks/index.js +2 -0
  84. package/build/hooks/index.js.map +1 -1
  85. package/build/hooks/memoize.js +2 -0
  86. package/build/hooks/memoize.js.map +1 -1
  87. package/build/hooks/use-entity-block-editor.js +4 -2
  88. package/build/hooks/use-entity-block-editor.js.map +1 -1
  89. package/build/hooks/use-entity-id.js +2 -0
  90. package/build/hooks/use-entity-id.js.map +1 -1
  91. package/build/hooks/use-entity-prop.js +2 -0
  92. package/build/hooks/use-entity-prop.js.map +1 -1
  93. package/build/hooks/use-entity-record.js +3 -1
  94. package/build/hooks/use-entity-record.js.map +1 -1
  95. package/build/hooks/use-entity-records.js +3 -1
  96. package/build/hooks/use-entity-records.js.map +1 -1
  97. package/build/hooks/use-query-select.js +4 -2
  98. package/build/hooks/use-query-select.js.map +1 -1
  99. package/build/hooks/use-resource-permissions.js +2 -0
  100. package/build/hooks/use-resource-permissions.js.map +1 -1
  101. package/build/index.js +8 -6
  102. package/build/index.js.map +1 -1
  103. package/build/lock-unlock.js +3 -1
  104. package/build/lock-unlock.js.map +1 -1
  105. package/build/locks/actions.js +2 -0
  106. package/build/locks/actions.js.map +1 -1
  107. package/build/locks/engine.js +2 -0
  108. package/build/locks/engine.js.map +1 -1
  109. package/build/locks/reducer.js +3 -1
  110. package/build/locks/reducer.js.map +1 -1
  111. package/build/locks/selectors.js +2 -0
  112. package/build/locks/selectors.js.map +1 -1
  113. package/build/locks/utils.js +2 -0
  114. package/build/locks/utils.js.map +1 -1
  115. package/build/name.js +3 -1
  116. package/build/name.js.map +1 -1
  117. package/build/private-actions.js +3 -1
  118. package/build/private-actions.js.map +1 -1
  119. package/build/private-apis.js +3 -1
  120. package/build/private-apis.js.map +1 -1
  121. package/build/private-selectors.js +7 -5
  122. package/build/private-selectors.js.map +1 -1
  123. package/build/queried-data/actions.js +2 -0
  124. package/build/queried-data/actions.js.map +1 -1
  125. package/build/queried-data/get-query-parts.js +2 -0
  126. package/build/queried-data/get-query-parts.js.map +1 -1
  127. package/build/queried-data/index.js +2 -0
  128. package/build/queried-data/index.js.map +1 -1
  129. package/build/queried-data/reducer.js +4 -2
  130. package/build/queried-data/reducer.js.map +1 -1
  131. package/build/queried-data/selectors.js +4 -2
  132. package/build/queried-data/selectors.js.map +1 -1
  133. package/build/reducer.js +4 -2
  134. package/build/reducer.js.map +1 -1
  135. package/build/resolvers.js +30 -28
  136. package/build/resolvers.js.map +1 -1
  137. package/build/selectors.js +18 -16
  138. package/build/selectors.js.map +1 -1
  139. package/build/sync.js +3 -1
  140. package/build/sync.js.map +1 -1
  141. package/build/types.js +2 -0
  142. package/build/types.js.map +1 -1
  143. package/build/utils/conservative-map-item.js +2 -0
  144. package/build/utils/conservative-map-item.js.map +1 -1
  145. package/build/utils/crdt-blocks.js +4 -2
  146. package/build/utils/crdt-blocks.js.map +1 -1
  147. package/build/utils/crdt.js +5 -3
  148. package/build/utils/crdt.js.map +1 -1
  149. package/build/utils/forward-resolver.js +3 -1
  150. package/build/utils/forward-resolver.js.map +1 -1
  151. package/build/utils/get-nested-value.js +2 -0
  152. package/build/utils/get-nested-value.js.map +1 -1
  153. package/build/utils/get-normalized-comma-separable.js +2 -0
  154. package/build/utils/get-normalized-comma-separable.js.map +1 -1
  155. package/build/utils/if-matching-action.js +3 -1
  156. package/build/utils/if-matching-action.js.map +1 -1
  157. package/build/utils/index.js +2 -0
  158. package/build/utils/index.js.map +1 -1
  159. package/build/utils/is-numeric-id.js +2 -0
  160. package/build/utils/is-numeric-id.js.map +1 -1
  161. package/build/utils/is-raw-attribute.js +2 -0
  162. package/build/utils/is-raw-attribute.js.map +1 -1
  163. package/build/utils/log-entity-deprecation.js +3 -1
  164. package/build/utils/log-entity-deprecation.js.map +1 -1
  165. package/build/utils/on-sub-key.js +3 -1
  166. package/build/utils/on-sub-key.js.map +1 -1
  167. package/build/utils/receive-intermediate-results.js +3 -1
  168. package/build/utils/receive-intermediate-results.js.map +1 -1
  169. package/build/utils/replace-action.js +3 -1
  170. package/build/utils/replace-action.js.map +1 -1
  171. package/build/utils/set-nested-value.js +2 -0
  172. package/build/utils/set-nested-value.js.map +1 -1
  173. package/build/utils/user-permissions.js +3 -1
  174. package/build/utils/user-permissions.js.map +1 -1
  175. package/build/utils/with-weak-map-cache.js +2 -0
  176. package/build/utils/with-weak-map-cache.js.map +1 -1
  177. package/build-module/actions.js +11 -10
  178. package/build-module/actions.js.map +1 -1
  179. package/build-module/batch/create-batch.js +3 -2
  180. package/build-module/batch/create-batch.js.map +1 -1
  181. package/build-module/batch/default-processor.js +2 -1
  182. package/build-module/batch/default-processor.js.map +1 -1
  183. package/build-module/batch/index.js +1 -0
  184. package/build-module/batch/index.js.map +1 -1
  185. package/build-module/dynamic-entities.js +3 -2
  186. package/build-module/dynamic-entities.js.map +1 -1
  187. package/build-module/entities.js +9 -8
  188. package/build-module/entities.js.map +1 -1
  189. package/build-module/entity-context.js +2 -1
  190. package/build-module/entity-context.js.map +1 -1
  191. package/build-module/entity-provider.js +2 -1
  192. package/build-module/entity-provider.js.map +1 -1
  193. package/build-module/fetch/__experimental-fetch-link-suggestions.js +1 -0
  194. package/build-module/fetch/__experimental-fetch-link-suggestions.js.map +1 -1
  195. package/build-module/fetch/__experimental-fetch-url-data.js +3 -2
  196. package/build-module/fetch/__experimental-fetch-url-data.js.map +1 -1
  197. package/build-module/fetch/index.js +1 -0
  198. package/build-module/fetch/index.js.map +1 -1
  199. package/build-module/footnotes/get-footnotes-order.js +2 -1
  200. package/build-module/footnotes/get-footnotes-order.js.map +1 -1
  201. package/build-module/footnotes/get-rich-text-values-cached.js +3 -2
  202. package/build-module/footnotes/get-rich-text-values-cached.js.map +1 -1
  203. package/build-module/footnotes/index.js +2 -1
  204. package/build-module/footnotes/index.js.map +1 -1
  205. package/build-module/hooks/constants.js +1 -0
  206. package/build-module/hooks/constants.js.map +1 -1
  207. package/build-module/hooks/index.js +1 -0
  208. package/build-module/hooks/index.js.map +1 -1
  209. package/build-module/hooks/memoize.js +1 -0
  210. package/build-module/hooks/memoize.js.map +1 -1
  211. package/build-module/hooks/use-entity-block-editor.js +3 -2
  212. package/build-module/hooks/use-entity-block-editor.js.map +1 -1
  213. package/build-module/hooks/use-entity-id.js +1 -0
  214. package/build-module/hooks/use-entity-id.js.map +1 -1
  215. package/build-module/hooks/use-entity-prop.js +1 -0
  216. package/build-module/hooks/use-entity-prop.js.map +1 -1
  217. package/build-module/hooks/use-entity-record.js +2 -1
  218. package/build-module/hooks/use-entity-record.js.map +1 -1
  219. package/build-module/hooks/use-entity-records.js +2 -1
  220. package/build-module/hooks/use-entity-records.js.map +1 -1
  221. package/build-module/hooks/use-query-select.js +3 -2
  222. package/build-module/hooks/use-query-select.js.map +1 -1
  223. package/build-module/hooks/use-resource-permissions.js +1 -0
  224. package/build-module/hooks/use-resource-permissions.js.map +1 -1
  225. package/build-module/index.js +13 -12
  226. package/build-module/index.js.map +1 -1
  227. package/build-module/lock-unlock.js +2 -1
  228. package/build-module/lock-unlock.js.map +1 -1
  229. package/build-module/locks/actions.js +1 -0
  230. package/build-module/locks/actions.js.map +1 -1
  231. package/build-module/locks/engine.js +1 -0
  232. package/build-module/locks/engine.js.map +1 -1
  233. package/build-module/locks/reducer.js +2 -1
  234. package/build-module/locks/reducer.js.map +1 -1
  235. package/build-module/locks/selectors.js +1 -0
  236. package/build-module/locks/selectors.js.map +1 -1
  237. package/build-module/locks/utils.js +1 -0
  238. package/build-module/locks/utils.js.map +1 -1
  239. package/build-module/name.js +2 -1
  240. package/build-module/name.js.map +1 -1
  241. package/build-module/private-actions.js +2 -1
  242. package/build-module/private-actions.js.map +1 -1
  243. package/build-module/private-apis.js +2 -1
  244. package/build-module/private-apis.js.map +1 -1
  245. package/build-module/private-selectors.js +6 -5
  246. package/build-module/private-selectors.js.map +1 -1
  247. package/build-module/queried-data/actions.js +1 -0
  248. package/build-module/queried-data/actions.js.map +1 -1
  249. package/build-module/queried-data/get-query-parts.js +1 -0
  250. package/build-module/queried-data/get-query-parts.js.map +1 -1
  251. package/build-module/queried-data/index.js +1 -0
  252. package/build-module/queried-data/index.js.map +1 -1
  253. package/build-module/queried-data/reducer.js +3 -2
  254. package/build-module/queried-data/reducer.js.map +1 -1
  255. package/build-module/queried-data/selectors.js +3 -2
  256. package/build-module/queried-data/selectors.js.map +1 -1
  257. package/build-module/reducer.js +3 -2
  258. package/build-module/reducer.js.map +1 -1
  259. package/build-module/resolvers.js +29 -28
  260. package/build-module/resolvers.js.map +1 -1
  261. package/build-module/selectors.js +17 -16
  262. package/build-module/selectors.js.map +1 -1
  263. package/build-module/sync.js +2 -1
  264. package/build-module/sync.js.map +1 -1
  265. package/build-module/utils/conservative-map-item.js +1 -0
  266. package/build-module/utils/conservative-map-item.js.map +1 -1
  267. package/build-module/utils/crdt-blocks.js +3 -2
  268. package/build-module/utils/crdt-blocks.js.map +1 -1
  269. package/build-module/utils/crdt.js +4 -3
  270. package/build-module/utils/crdt.js.map +1 -1
  271. package/build-module/utils/forward-resolver.js +2 -1
  272. package/build-module/utils/forward-resolver.js.map +1 -1
  273. package/build-module/utils/get-nested-value.js +1 -0
  274. package/build-module/utils/get-nested-value.js.map +1 -1
  275. package/build-module/utils/get-normalized-comma-separable.js +1 -0
  276. package/build-module/utils/get-normalized-comma-separable.js.map +1 -1
  277. package/build-module/utils/if-matching-action.js +2 -1
  278. package/build-module/utils/if-matching-action.js.map +1 -1
  279. package/build-module/utils/index.js +1 -0
  280. package/build-module/utils/index.js.map +1 -1
  281. package/build-module/utils/is-numeric-id.js +1 -0
  282. package/build-module/utils/is-numeric-id.js.map +1 -1
  283. package/build-module/utils/is-raw-attribute.js +1 -0
  284. package/build-module/utils/is-raw-attribute.js.map +1 -1
  285. package/build-module/utils/log-entity-deprecation.js +2 -1
  286. package/build-module/utils/log-entity-deprecation.js.map +1 -1
  287. package/build-module/utils/on-sub-key.js +2 -1
  288. package/build-module/utils/on-sub-key.js.map +1 -1
  289. package/build-module/utils/receive-intermediate-results.js +2 -1
  290. package/build-module/utils/receive-intermediate-results.js.map +1 -1
  291. package/build-module/utils/replace-action.js +2 -1
  292. package/build-module/utils/replace-action.js.map +1 -1
  293. package/build-module/utils/set-nested-value.js +1 -0
  294. package/build-module/utils/set-nested-value.js.map +1 -1
  295. package/build-module/utils/user-permissions.js +2 -1
  296. package/build-module/utils/user-permissions.js.map +1 -1
  297. package/build-module/utils/with-weak-map-cache.js +1 -0
  298. package/build-module/utils/with-weak-map-cache.js.map +1 -1
  299. package/package.json +18 -18
  300. package/src/test/resolvers.js +78 -0
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/index.js"],
4
4
  "sourcesContent": ["export { default as conservativeMapItem } from './conservative-map-item';\nexport { default as getNormalizedCommaSeparable } from './get-normalized-comma-separable';\nexport { default as ifMatchingAction } from './if-matching-action';\nexport { default as forwardResolver } from './forward-resolver';\nexport { default as onSubKey } from './on-sub-key';\nexport { default as replaceAction } from './replace-action';\nexport { default as withWeakMapCache } from './with-weak-map-cache';\nexport { default as isRawAttribute } from './is-raw-attribute';\nexport { default as setNestedValue } from './set-nested-value';\nexport { default as getNestedValue } from './get-nested-value';\nexport { default as isNumericID } from './is-numeric-id';\nexport {\n\tgetUserPermissionCacheKey,\n\tgetUserPermissionsFromAllowHeader,\n\tALLOWED_RESOURCE_ACTIONS,\n} from './user-permissions';\nexport { RECEIVE_INTERMEDIATE_RESULTS } from './receive-intermediate-results';\n"],
5
- "mappings": "AAAA,SAAoB,WAAXA,gBAAsC;AAC/C,SAAoB,WAAXA,gBAA8C;AACvD,SAAoB,WAAXA,gBAAmC;AAC5C,SAAoB,WAAXA,gBAAkC;AAC3C,SAAoB,WAAXA,gBAA2B;AACpC,SAAoB,WAAXA,gBAAgC;AACzC,SAAoB,WAAXA,gBAAmC;AAC5C,SAAoB,WAAXA,gBAAiC;AAC1C,SAAoB,WAAXA,iBAAiC;AAC1C,SAAoB,WAAXA,iBAAiC;AAC1C,SAAoB,WAAXA,iBAA8B;AACvC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,oCAAoC;",
5
+ "mappings": ";AAAA,SAAoB,WAAXA,gBAAsC;AAC/C,SAAoB,WAAXA,gBAA8C;AACvD,SAAoB,WAAXA,gBAAmC;AAC5C,SAAoB,WAAXA,gBAAkC;AAC3C,SAAoB,WAAXA,gBAA2B;AACpC,SAAoB,WAAXA,gBAAgC;AACzC,SAAoB,WAAXA,gBAAmC;AAC5C,SAAoB,WAAXA,gBAAiC;AAC1C,SAAoB,WAAXA,iBAAiC;AAC1C,SAAoB,WAAXA,iBAAiC;AAC1C,SAAoB,WAAXA,iBAA8B;AACvC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,oCAAoC;",
6
6
  "names": ["default"]
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/core-data/src/utils/is-numeric-id.js
1
2
  function isNumericID(id) {
2
3
  return /^\s*\d+\s*$/.test(id);
3
4
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/is-numeric-id.js"],
4
4
  "sourcesContent": ["/**\n * Checks argument to determine if it's a numeric ID.\n * For example, '123' is a numeric ID, but '123abc' is not.\n *\n * @param {any} id the argument to determine if it's a numeric ID.\n * @return {boolean} true if the string is a numeric ID, false otherwise.\n */\nexport default function isNumericID( id ) {\n\treturn /^\\s*\\d+\\s*$/.test( id );\n}\n"],
5
- "mappings": "AAOe,SAAR,YAA8B,IAAK;AACzC,SAAO,cAAc,KAAM,EAAG;AAC/B;",
5
+ "mappings": ";AAOe,SAAR,YAA8B,IAAK;AACzC,SAAO,cAAc,KAAM,EAAG;AAC/B;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/core-data/src/utils/is-raw-attribute.js
1
2
  function isRawAttribute(entity, attribute) {
2
3
  return (entity.rawAttributes || []).includes(attribute);
3
4
  }
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/is-raw-attribute.js"],
4
4
  "sourcesContent": ["/**\n * Checks whether the attribute is a \"raw\" attribute or not.\n *\n * @param {Object} entity Entity record.\n * @param {string} attribute Attribute name.\n *\n * @return {boolean} Is the attribute raw\n */\nexport default function isRawAttribute( entity, attribute ) {\n\treturn ( entity.rawAttributes || [] ).includes( attribute );\n}\n"],
5
- "mappings": "AAQe,SAAR,eAAiC,QAAQ,WAAY;AAC3D,UAAS,OAAO,iBAAiB,CAAC,GAAI,SAAU,SAAU;AAC3D;",
5
+ "mappings": ";AAQe,SAAR,eAAiC,QAAQ,WAAY;AAC3D,UAAS,OAAO,iBAAiB,CAAC,GAAI,SAAU,SAAU;AAC3D;",
6
6
  "names": []
7
7
  }
@@ -1,6 +1,7 @@
1
+ // packages/core-data/src/utils/log-entity-deprecation.ts
1
2
  import deprecated from "@wordpress/deprecated";
2
3
  import { deprecatedEntities } from "../entities";
3
- let loggedAlready = false;
4
+ var loggedAlready = false;
4
5
  function logEntityDeprecation(kind, name, functionName, {
5
6
  alternativeFunctionName,
6
7
  isShorthandSelector = false
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/log-entity-deprecation.ts"],
4
4
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { deprecatedEntities } from '../entities';\n\nlet loggedAlready = false;\n\n/**\n * Logs a deprecation warning for an entity, if it's deprecated.\n *\n * @param kind The kind of the entity.\n * @param name The name of the entity.\n * @param functionName The name of the function that was called with a deprecated entity.\n * @param options The options for the deprecation warning.\n * @param options.alternativeFunctionName The name of the alternative function that should be used instead.\n * @param options.isShorthandSelector Whether the function is a shorthand selector.\n */\nexport default function logEntityDeprecation(\n\tkind: string,\n\tname: string,\n\tfunctionName: string,\n\t{\n\t\talternativeFunctionName,\n\t\tisShorthandSelector = false,\n\t}: {\n\t\talternativeFunctionName?: string;\n\t\tisShorthandSelector?: boolean;\n\t} = {}\n) {\n\tconst deprecation = deprecatedEntities[ kind ]?.[ name ];\n\tif ( ! deprecation ) {\n\t\treturn;\n\t}\n\n\tif ( ! loggedAlready ) {\n\t\tconst { alternative } = deprecation;\n\n\t\tconst message = isShorthandSelector\n\t\t\t? `'${ functionName }'`\n\t\t\t: `The '${ kind }', '${ name }' entity (used via '${ functionName }')`;\n\n\t\tlet alternativeMessage = `the '${ alternative.kind }', '${ alternative.name }' entity`;\n\t\tif ( alternativeFunctionName ) {\n\t\t\talternativeMessage += ` via the '${ alternativeFunctionName }' function`;\n\t\t}\n\n\t\tdeprecated( message, {\n\t\t\t...deprecation,\n\t\t\talternative: alternativeMessage,\n\t\t} );\n\t}\n\n\t// Only log an entity deprecation once per call stack,\n\t// else there's spurious logging when selections or actions call through to other selectors or actions.\n\t// Note: this won't prevent the deprecation warning being logged if a selector or action makes an async call\n\t// to another selector or action, but this is probably the best we can do.\n\tloggedAlready = true;\n\t// At the end of the call stack, reset the flag.\n\tsetTimeout( () => {\n\t\tloggedAlready = false;\n\t}, 0 );\n}\n"],
5
- "mappings": "AAGA,OAAO,gBAAgB;AAKvB,SAAS,0BAA0B;AAEnC,IAAI,gBAAgB;AAYL,SAAR,qBACN,MACA,MACA,cACA;AAAA,EACC;AAAA,EACA,sBAAsB;AACvB,IAGI,CAAC,GACJ;AACD,QAAM,cAAc,mBAAoB,IAAK,IAAK,IAAK;AACvD,MAAK,CAAE,aAAc;AACpB;AAAA,EACD;AAEA,MAAK,CAAE,eAAgB;AACtB,UAAM,EAAE,YAAY,IAAI;AAExB,UAAM,UAAU,sBACb,IAAK,YAAa,MAClB,QAAS,IAAK,OAAQ,IAAK,uBAAwB,YAAa;AAEnE,QAAI,qBAAqB,QAAS,YAAY,IAAK,OAAQ,YAAY,IAAK;AAC5E,QAAK,yBAA0B;AAC9B,4BAAsB,aAAc,uBAAwB;AAAA,IAC7D;AAEA,eAAY,SAAS;AAAA,MACpB,GAAG;AAAA,MACH,aAAa;AAAA,IACd,CAAE;AAAA,EACH;AAMA,kBAAgB;AAEhB,aAAY,MAAM;AACjB,oBAAgB;AAAA,EACjB,GAAG,CAAE;AACN;",
5
+ "mappings": ";AAGA,OAAO,gBAAgB;AAKvB,SAAS,0BAA0B;AAEnC,IAAI,gBAAgB;AAYL,SAAR,qBACN,MACA,MACA,cACA;AAAA,EACC;AAAA,EACA,sBAAsB;AACvB,IAGI,CAAC,GACJ;AACD,QAAM,cAAc,mBAAoB,IAAK,IAAK,IAAK;AACvD,MAAK,CAAE,aAAc;AACpB;AAAA,EACD;AAEA,MAAK,CAAE,eAAgB;AACtB,UAAM,EAAE,YAAY,IAAI;AAExB,UAAM,UAAU,sBACb,IAAK,YAAa,MAClB,QAAS,IAAK,OAAQ,IAAK,uBAAwB,YAAa;AAEnE,QAAI,qBAAqB,QAAS,YAAY,IAAK,OAAQ,YAAY,IAAK;AAC5E,QAAK,yBAA0B;AAC9B,4BAAsB,aAAc,uBAAwB;AAAA,IAC7D;AAEA,eAAY,SAAS;AAAA,MACpB,GAAG;AAAA,MACH,aAAa;AAAA,IACd,CAAE;AAAA,EACH;AAMA,kBAAgB;AAEhB,aAAY,MAAM;AACjB,oBAAgB;AAAA,EACjB,GAAG,CAAE;AACN;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,5 @@
1
- const onSubKey = (actionProperty) => (reducer) => (state = {}, action) => {
1
+ // packages/core-data/src/utils/on-sub-key.js
2
+ var onSubKey = (actionProperty) => (reducer) => (state = {}, action) => {
2
3
  const key = action[actionProperty];
3
4
  if (key === void 0) {
4
5
  return state;
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/on-sub-key.js"],
4
4
  "sourcesContent": ["/** @typedef {import('../types').AnyFunction} AnyFunction */\n\n/**\n * Higher-order reducer creator which creates a combined reducer object, keyed\n * by a property on the action object.\n *\n * @param {string} actionProperty Action property by which to key object.\n *\n * @return {AnyFunction} Higher-order reducer.\n */\nexport const onSubKey =\n\t( actionProperty ) =>\n\t( reducer ) =>\n\t( state = {}, action ) => {\n\t\t// Retrieve subkey from action. Do not track if undefined; useful for cases\n\t\t// where reducer is scoped by action shape.\n\t\tconst key = action[ actionProperty ];\n\t\tif ( key === undefined ) {\n\t\t\treturn state;\n\t\t}\n\n\t\t// Avoid updating state if unchanged. Note that this also accounts for a\n\t\t// reducer which returns undefined on a key which is not yet tracked.\n\t\tconst nextKeyState = reducer( state[ key ], action );\n\t\tif ( nextKeyState === state[ key ] ) {\n\t\t\treturn state;\n\t\t}\n\n\t\treturn {\n\t\t\t...state,\n\t\t\t[ key ]: nextKeyState,\n\t\t};\n\t};\n\nexport default onSubKey;\n"],
5
- "mappings": "AAUO,MAAM,WACZ,CAAE,mBACF,CAAE,YACF,CAAE,QAAQ,CAAC,GAAG,WAAY;AAGzB,QAAM,MAAM,OAAQ,cAAe;AACnC,MAAK,QAAQ,QAAY;AACxB,WAAO;AAAA,EACR;AAIA,QAAM,eAAe,QAAS,MAAO,GAAI,GAAG,MAAO;AACnD,MAAK,iBAAiB,MAAO,GAAI,GAAI;AACpC,WAAO;AAAA,EACR;AAEA,SAAO;AAAA,IACN,GAAG;AAAA,IACH,CAAE,GAAI,GAAG;AAAA,EACV;AACD;AAED,IAAO,qBAAQ;",
5
+ "mappings": ";AAUO,IAAM,WACZ,CAAE,mBACF,CAAE,YACF,CAAE,QAAQ,CAAC,GAAG,WAAY;AAGzB,QAAM,MAAM,OAAQ,cAAe;AACnC,MAAK,QAAQ,QAAY;AACxB,WAAO;AAAA,EACR;AAIA,QAAM,eAAe,QAAS,MAAO,GAAI,GAAG,MAAO;AACnD,MAAK,iBAAiB,MAAO,GAAI,GAAI;AACpC,WAAO;AAAA,EACR;AAEA,SAAO;AAAA,IACN,GAAG;AAAA,IACH,CAAE,GAAI,GAAG;AAAA,EACV;AACD;AAED,IAAO,qBAAQ;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,5 @@
1
- const RECEIVE_INTERMEDIATE_RESULTS = Symbol(
1
+ // packages/core-data/src/utils/receive-intermediate-results.js
2
+ var RECEIVE_INTERMEDIATE_RESULTS = Symbol(
2
3
  "RECEIVE_INTERMEDIATE_RESULTS"
3
4
  );
4
5
  export {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/receive-intermediate-results.js"],
4
4
  "sourcesContent": ["export const RECEIVE_INTERMEDIATE_RESULTS = Symbol(\n\t'RECEIVE_INTERMEDIATE_RESULTS'\n);\n"],
5
- "mappings": "AAAO,MAAM,+BAA+B;AAAA,EAC3C;AACD;",
5
+ "mappings": ";AAAO,IAAM,+BAA+B;AAAA,EAC3C;AACD;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,5 @@
1
- const replaceAction = (replacer) => (reducer) => (state, action) => {
1
+ // packages/core-data/src/utils/replace-action.js
2
+ var replaceAction = (replacer) => (reducer) => (state, action) => {
2
3
  return reducer(state, replacer(action));
3
4
  };
4
5
  var replace_action_default = replaceAction;
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/replace-action.js"],
4
4
  "sourcesContent": ["/** @typedef {import('../types').AnyFunction} AnyFunction */\n\n/**\n * Higher-order reducer creator which substitutes the action object before\n * passing to the original reducer.\n *\n * @param {AnyFunction} replacer Function mapping original action to replacement.\n *\n * @return {AnyFunction} Higher-order reducer.\n */\nconst replaceAction = ( replacer ) => ( reducer ) => ( state, action ) => {\n\treturn reducer( state, replacer( action ) );\n};\n\nexport default replaceAction;\n"],
5
- "mappings": "AAUA,MAAM,gBAAgB,CAAE,aAAc,CAAE,YAAa,CAAE,OAAO,WAAY;AACzE,SAAO,QAAS,OAAO,SAAU,MAAO,CAAE;AAC3C;AAEA,IAAO,yBAAQ;",
5
+ "mappings": ";AAUA,IAAM,gBAAgB,CAAE,aAAc,CAAE,YAAa,CAAE,OAAO,WAAY;AACzE,SAAO,QAAS,OAAO,SAAU,MAAO,CAAE;AAC3C;AAEA,IAAO,yBAAQ;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/core-data/src/utils/set-nested-value.js
1
2
  function setNestedValue(object, path, value) {
2
3
  if (!object || typeof object !== "object") {
3
4
  return object;
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/set-nested-value.js"],
4
4
  "sourcesContent": ["/**\n * Sets the value at path of object.\n * If a portion of path doesn\u2019t exist, it\u2019s created.\n * Arrays are created for missing index properties while objects are created\n * for all other missing properties.\n *\n * Path is specified as either:\n * - a string of properties, separated by dots, for example: \"x.y\".\n * - an array of properties, for example `[ 'x', 'y' ]`.\n *\n * This function intentionally mutates the input object.\n *\n * Inspired by _.set().\n *\n * @see https://lodash.com/docs/4.17.15#set\n *\n * @todo Needs to be deduplicated with its copy in `@wordpress/edit-site`.\n *\n * @param {Object} object Object to modify\n * @param {Array|string} path Path of the property to set.\n * @param {*} value Value to set.\n */\nexport default function setNestedValue( object, path, value ) {\n\tif ( ! object || typeof object !== 'object' ) {\n\t\treturn object;\n\t}\n\n\tconst normalizedPath = Array.isArray( path ) ? path : path.split( '.' );\n\n\tnormalizedPath.reduce( ( acc, key, idx ) => {\n\t\tif ( acc[ key ] === undefined ) {\n\t\t\tif ( Number.isInteger( normalizedPath[ idx + 1 ] ) ) {\n\t\t\t\tacc[ key ] = [];\n\t\t\t} else {\n\t\t\t\tacc[ key ] = {};\n\t\t\t}\n\t\t}\n\t\tif ( idx === normalizedPath.length - 1 ) {\n\t\t\tacc[ key ] = value;\n\t\t}\n\t\treturn acc[ key ];\n\t}, object );\n\n\treturn object;\n}\n"],
5
- "mappings": "AAsBe,SAAR,eAAiC,QAAQ,MAAM,OAAQ;AAC7D,MAAK,CAAE,UAAU,OAAO,WAAW,UAAW;AAC7C,WAAO;AAAA,EACR;AAEA,QAAM,iBAAiB,MAAM,QAAS,IAAK,IAAI,OAAO,KAAK,MAAO,GAAI;AAEtE,iBAAe,OAAQ,CAAE,KAAK,KAAK,QAAS;AAC3C,QAAK,IAAK,GAAI,MAAM,QAAY;AAC/B,UAAK,OAAO,UAAW,eAAgB,MAAM,CAAE,CAAE,GAAI;AACpD,YAAK,GAAI,IAAI,CAAC;AAAA,MACf,OAAO;AACN,YAAK,GAAI,IAAI,CAAC;AAAA,MACf;AAAA,IACD;AACA,QAAK,QAAQ,eAAe,SAAS,GAAI;AACxC,UAAK,GAAI,IAAI;AAAA,IACd;AACA,WAAO,IAAK,GAAI;AAAA,EACjB,GAAG,MAAO;AAEV,SAAO;AACR;",
5
+ "mappings": ";AAsBe,SAAR,eAAiC,QAAQ,MAAM,OAAQ;AAC7D,MAAK,CAAE,UAAU,OAAO,WAAW,UAAW;AAC7C,WAAO;AAAA,EACR;AAEA,QAAM,iBAAiB,MAAM,QAAS,IAAK,IAAI,OAAO,KAAK,MAAO,GAAI;AAEtE,iBAAe,OAAQ,CAAE,KAAK,KAAK,QAAS;AAC3C,QAAK,IAAK,GAAI,MAAM,QAAY;AAC/B,UAAK,OAAO,UAAW,eAAgB,MAAM,CAAE,CAAE,GAAI;AACpD,YAAK,GAAI,IAAI,CAAC;AAAA,MACf,OAAO;AACN,YAAK,GAAI,IAAI,CAAC;AAAA,MACf;AAAA,IACD;AACA,QAAK,QAAQ,eAAe,SAAS,GAAI;AACxC,UAAK,GAAI,IAAI;AAAA,IACd;AACA,WAAO,IAAK,GAAI;AAAA,EACjB,GAAG,MAAO;AAEV,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -1,4 +1,5 @@
1
- const ALLOWED_RESOURCE_ACTIONS = [
1
+ // packages/core-data/src/utils/user-permissions.js
2
+ var ALLOWED_RESOURCE_ACTIONS = [
2
3
  "create",
3
4
  "read",
4
5
  "update",
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/user-permissions.js"],
4
4
  "sourcesContent": ["export const ALLOWED_RESOURCE_ACTIONS = [\n\t'create',\n\t'read',\n\t'update',\n\t'delete',\n];\n\nexport function getUserPermissionsFromAllowHeader( allowedMethods ) {\n\tconst permissions = {};\n\tif ( ! allowedMethods ) {\n\t\treturn permissions;\n\t}\n\n\tconst methods = {\n\t\tcreate: 'POST',\n\t\tread: 'GET',\n\t\tupdate: 'PUT',\n\t\tdelete: 'DELETE',\n\t};\n\tfor ( const [ actionName, methodName ] of Object.entries( methods ) ) {\n\t\tpermissions[ actionName ] = allowedMethods.includes( methodName );\n\t}\n\n\treturn permissions;\n}\n\nexport function getUserPermissionCacheKey( action, resource, id ) {\n\tconst key = (\n\t\ttypeof resource === 'object'\n\t\t\t? [ action, resource.kind, resource.name, resource.id ]\n\t\t\t: [ action, resource, id ]\n\t)\n\t\t.filter( Boolean )\n\t\t.join( '/' );\n\n\treturn key;\n}\n"],
5
- "mappings": "AAAO,MAAM,2BAA2B;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEO,SAAS,kCAAmC,gBAAiB;AACnE,QAAM,cAAc,CAAC;AACrB,MAAK,CAAE,gBAAiB;AACvB,WAAO;AAAA,EACR;AAEA,QAAM,UAAU;AAAA,IACf,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,QAAQ;AAAA,EACT;AACA,aAAY,CAAE,YAAY,UAAW,KAAK,OAAO,QAAS,OAAQ,GAAI;AACrE,gBAAa,UAAW,IAAI,eAAe,SAAU,UAAW;AAAA,EACjE;AAEA,SAAO;AACR;AAEO,SAAS,0BAA2B,QAAQ,UAAU,IAAK;AACjE,QAAM,OACL,OAAO,aAAa,WACjB,CAAE,QAAQ,SAAS,MAAM,SAAS,MAAM,SAAS,EAAG,IACpD,CAAE,QAAQ,UAAU,EAAG,GAEzB,OAAQ,OAAQ,EAChB,KAAM,GAAI;AAEZ,SAAO;AACR;",
5
+ "mappings": ";AAAO,IAAM,2BAA2B;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAEO,SAAS,kCAAmC,gBAAiB;AACnE,QAAM,cAAc,CAAC;AACrB,MAAK,CAAE,gBAAiB;AACvB,WAAO;AAAA,EACR;AAEA,QAAM,UAAU;AAAA,IACf,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,QAAQ;AAAA,EACT;AACA,aAAY,CAAE,YAAY,UAAW,KAAK,OAAO,QAAS,OAAQ,GAAI;AACrE,gBAAa,UAAW,IAAI,eAAe,SAAU,UAAW;AAAA,EACjE;AAEA,SAAO;AACR;AAEO,SAAS,0BAA2B,QAAQ,UAAU,IAAK;AACjE,QAAM,OACL,OAAO,aAAa,WACjB,CAAE,QAAQ,SAAS,MAAM,SAAS,MAAM,SAAS,EAAG,IACpD,CAAE,QAAQ,UAAU,EAAG,GAEzB,OAAQ,OAAQ,EAChB,KAAM,GAAI;AAEZ,SAAO;AACR;",
6
6
  "names": []
7
7
  }
@@ -1,3 +1,4 @@
1
+ // packages/core-data/src/utils/with-weak-map-cache.js
1
2
  function withWeakMapCache(fn) {
2
3
  const cache = /* @__PURE__ */ new WeakMap();
3
4
  return (key) => {
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../src/utils/with-weak-map-cache.js"],
4
4
  "sourcesContent": ["/**\n * Given a function, returns an enhanced function which caches the result and\n * tracks in WeakMap. The result is only cached if the original function is\n * passed a valid object-like argument (requirement for WeakMap key).\n *\n * @param {Function} fn Original function.\n *\n * @return {Function} Enhanced caching function.\n */\nfunction withWeakMapCache( fn ) {\n\tconst cache = new WeakMap();\n\n\treturn ( key ) => {\n\t\tlet value;\n\t\tif ( cache.has( key ) ) {\n\t\t\tvalue = cache.get( key );\n\t\t} else {\n\t\t\tvalue = fn( key );\n\n\t\t\t// Can reach here if key is not valid for WeakMap, since `has`\n\t\t\t// will return false for invalid key. Since `set` will throw,\n\t\t\t// ensure that key is valid before setting into cache.\n\t\t\tif ( key !== null && typeof key === 'object' ) {\n\t\t\t\tcache.set( key, value );\n\t\t\t}\n\t\t}\n\n\t\treturn value;\n\t};\n}\n\nexport default withWeakMapCache;\n"],
5
- "mappings": "AASA,SAAS,iBAAkB,IAAK;AAC/B,QAAM,QAAQ,oBAAI,QAAQ;AAE1B,SAAO,CAAE,QAAS;AACjB,QAAI;AACJ,QAAK,MAAM,IAAK,GAAI,GAAI;AACvB,cAAQ,MAAM,IAAK,GAAI;AAAA,IACxB,OAAO;AACN,cAAQ,GAAI,GAAI;AAKhB,UAAK,QAAQ,QAAQ,OAAO,QAAQ,UAAW;AAC9C,cAAM,IAAK,KAAK,KAAM;AAAA,MACvB;AAAA,IACD;AAEA,WAAO;AAAA,EACR;AACD;AAEA,IAAO,8BAAQ;",
5
+ "mappings": ";AASA,SAAS,iBAAkB,IAAK;AAC/B,QAAM,QAAQ,oBAAI,QAAQ;AAE1B,SAAO,CAAE,QAAS;AACjB,QAAI;AACJ,QAAK,MAAM,IAAK,GAAI,GAAI;AACvB,cAAQ,MAAM,IAAK,GAAI;AAAA,IACxB,OAAO;AACN,cAAQ,GAAI,GAAI;AAKhB,UAAK,QAAQ,QAAQ,OAAO,QAAQ,UAAW;AAC9C,cAAM,IAAK,KAAK,KAAM;AAAA,MACvB;AAAA,IACD;AAEA,WAAO;AAAA,EACR;AACD;AAEA,IAAO,8BAAQ;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/core-data",
3
- "version": "7.34.0",
3
+ "version": "7.34.1-next.2f1c7c01b.0",
4
4
  "description": "Access to and manipulation of core WordPress entities.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -40,22 +40,22 @@
40
40
  "{src,build,build-module}/index.js"
41
41
  ],
42
42
  "dependencies": {
43
- "@wordpress/api-fetch": "^7.34.0",
44
- "@wordpress/block-editor": "^15.7.0",
45
- "@wordpress/blocks": "^15.7.0",
46
- "@wordpress/compose": "^7.34.0",
47
- "@wordpress/data": "^10.34.0",
48
- "@wordpress/deprecated": "^4.34.0",
49
- "@wordpress/element": "^6.34.0",
50
- "@wordpress/html-entities": "^4.34.0",
51
- "@wordpress/i18n": "^6.7.0",
52
- "@wordpress/is-shallow-equal": "^5.34.0",
53
- "@wordpress/private-apis": "^1.34.0",
54
- "@wordpress/rich-text": "^7.34.0",
55
- "@wordpress/sync": "^1.34.0",
56
- "@wordpress/undo-manager": "^1.34.0",
57
- "@wordpress/url": "^4.34.0",
58
- "@wordpress/warning": "^3.34.0",
43
+ "@wordpress/api-fetch": "^7.34.1-next.2f1c7c01b.0",
44
+ "@wordpress/block-editor": "^15.7.1-next.2f1c7c01b.0",
45
+ "@wordpress/blocks": "^15.7.1-next.2f1c7c01b.0",
46
+ "@wordpress/compose": "^7.34.1-next.2f1c7c01b.0",
47
+ "@wordpress/data": "^10.34.1-next.2f1c7c01b.0",
48
+ "@wordpress/deprecated": "^4.34.1-next.2f1c7c01b.0",
49
+ "@wordpress/element": "^6.34.1-next.2f1c7c01b.0",
50
+ "@wordpress/html-entities": "^4.34.1-next.2f1c7c01b.0",
51
+ "@wordpress/i18n": "^6.7.1-next.2f1c7c01b.0",
52
+ "@wordpress/is-shallow-equal": "^5.34.1-next.2f1c7c01b.0",
53
+ "@wordpress/private-apis": "^1.34.1-next.2f1c7c01b.0",
54
+ "@wordpress/rich-text": "^7.34.1-next.2f1c7c01b.0",
55
+ "@wordpress/sync": "^1.34.1-next.2f1c7c01b.0",
56
+ "@wordpress/undo-manager": "^1.34.1-next.2f1c7c01b.0",
57
+ "@wordpress/url": "^4.34.1-next.2f1c7c01b.0",
58
+ "@wordpress/warning": "^3.34.1-next.2f1c7c01b.0",
59
59
  "change-case": "^4.1.2",
60
60
  "equivalent-key-map": "^0.2.2",
61
61
  "fast-deep-equal": "^3.1.3",
@@ -69,5 +69,5 @@
69
69
  "publishConfig": {
70
70
  "access": "public"
71
71
  },
72
- "gitHead": "ceebff807958d2e8fc755b5a20473939c78b4d1d"
72
+ "gitHead": "c6ddcdf455bc02567a2c9e03de6862a2061b85e8"
73
73
  }
@@ -24,6 +24,7 @@ import {
24
24
  getAutosaves,
25
25
  getCurrentUser,
26
26
  } from '../resolvers';
27
+ import { RECEIVE_INTERMEDIATE_RESULTS } from '../utils';
27
28
 
28
29
  describe( 'getEntityRecord', () => {
29
30
  const POST_TYPE = { slug: 'post' };
@@ -326,6 +327,11 @@ describe( 'getEntityRecords', () => {
326
327
  baseURL: '/wp/v2/posts',
327
328
  baseURLParams: { context: 'edit' },
328
329
  },
330
+ {
331
+ name: 'attachment',
332
+ kind: 'postType',
333
+ supportsPagination: true,
334
+ },
329
335
  ];
330
336
  const registry = { batch: ( callback ) => callback() };
331
337
  const resolveSelect = { getEntitiesConfig: jest.fn( () => ENTITIES ) };
@@ -516,6 +522,78 @@ describe( 'getEntityRecords', () => {
516
522
  expect.any( Array )
517
523
  );
518
524
  } );
525
+
526
+ it( 'provides pagination metadata and progressive loading during intermediate results fetching', async () => {
527
+ const dispatch = Object.assign( jest.fn(), {
528
+ receiveEntityRecords: jest.fn(),
529
+ __unstableAcquireStoreLock: jest.fn(),
530
+ __unstableReleaseStoreLock: jest.fn(),
531
+ finishResolutions: jest.fn(),
532
+ } );
533
+
534
+ const mockPages = [
535
+ [ { id: 1 }, { id: 2 } ],
536
+ [ { id: 3 }, { id: 4 } ],
537
+ [ { id: 5 } ],
538
+ ];
539
+
540
+ let callCount = 0;
541
+ triggerFetch.mockImplementation( () => {
542
+ const data = mockPages[ callCount % mockPages.length ];
543
+ callCount++;
544
+ return Promise.resolve( {
545
+ json: () => Promise.resolve( data ),
546
+ headers: new Map( [
547
+ [ 'X-WP-Total', '5' ],
548
+ [ 'X-WP-TotalPages', '3' ],
549
+ ] ),
550
+ } );
551
+ } );
552
+
553
+ await getEntityRecords( 'postType', 'attachment', {
554
+ per_page: -1,
555
+ [ RECEIVE_INTERMEDIATE_RESULTS ]: true,
556
+ } )( { dispatch, registry, resolveSelect } );
557
+
558
+ // 3 calls for intermediate results (one per page), plus 1 final call with complete records
559
+ expect( dispatch.receiveEntityRecords ).toHaveBeenCalledTimes( 4 );
560
+
561
+ // Check that the first call already includes pagination metadata
562
+ expect( dispatch.receiveEntityRecords ).toHaveBeenCalledWith(
563
+ 'postType',
564
+ 'attachment',
565
+ expect.any( Array ),
566
+ { per_page: -1, [ RECEIVE_INTERMEDIATE_RESULTS ]: true },
567
+ false,
568
+ undefined,
569
+ expect.objectContaining( { totalItems: 5, totalPages: 1 } )
570
+ );
571
+
572
+ // Check that all calls include pagination metadata
573
+ dispatch.receiveEntityRecords.mock.calls.forEach( ( call ) => {
574
+ // 7th parameter is the pagination metadata
575
+ expect( call[ 6 ] ).toEqual(
576
+ expect.objectContaining( { totalItems: 5, totalPages: 1 } )
577
+ );
578
+ } );
579
+
580
+ // Should process all the data from the 3 mock pages (2+2+1=5 records total)
581
+ expect( dispatch.receiveEntityRecords ).toHaveBeenLastCalledWith(
582
+ 'postType',
583
+ 'attachment',
584
+ expect.arrayContaining( [
585
+ expect.objectContaining( { id: 1 } ),
586
+ expect.objectContaining( { id: 2 } ),
587
+ expect.objectContaining( { id: 3 } ),
588
+ expect.objectContaining( { id: 4 } ),
589
+ expect.objectContaining( { id: 5 } ),
590
+ ] ),
591
+ { per_page: -1, [ RECEIVE_INTERMEDIATE_RESULTS ]: true },
592
+ false,
593
+ undefined,
594
+ expect.objectContaining( { totalItems: 5, totalPages: 1 } )
595
+ );
596
+ } );
519
597
  } );
520
598
 
521
599
  describe( 'taxonomy pagination', () => {