@wordpress/core-data 7.32.0 → 7.32.1-next.ff1cebbba.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 (383) hide show
  1. package/build/actions.js +375 -632
  2. package/build/actions.js.map +7 -1
  3. package/build/batch/create-batch.js +49 -62
  4. package/build/batch/create-batch.js.map +7 -1
  5. package/build/batch/default-processor.js +43 -39
  6. package/build/batch/default-processor.js.map +7 -1
  7. package/build/batch/index.js +38 -17
  8. package/build/batch/index.js.map +7 -1
  9. package/build/dynamic-entities.js +30 -32
  10. package/build/dynamic-entities.js.map +7 -1
  11. package/build/entities.js +298 -410
  12. package/build/entities.js.map +7 -1
  13. package/build/entity-context.js +29 -12
  14. package/build/entity-context.js.map +7 -1
  15. package/build/entity-provider.js +38 -46
  16. package/build/entity-provider.js.map +7 -1
  17. package/build/entity-types/attachment.js +16 -5
  18. package/build/entity-types/attachment.js.map +7 -1
  19. package/build/entity-types/base-entity-records.js +16 -42
  20. package/build/entity-types/base-entity-records.js.map +7 -1
  21. package/build/entity-types/base.js +16 -5
  22. package/build/entity-types/base.js.map +7 -1
  23. package/build/entity-types/comment.js +16 -5
  24. package/build/entity-types/comment.js.map +7 -1
  25. package/build/entity-types/global-styles-revision.js +16 -5
  26. package/build/entity-types/global-styles-revision.js.map +7 -1
  27. package/build/entity-types/helpers.js +16 -5
  28. package/build/entity-types/helpers.js.map +7 -1
  29. package/build/entity-types/index.js +16 -5
  30. package/build/entity-types/index.js.map +7 -1
  31. package/build/entity-types/menu-location.js +16 -5
  32. package/build/entity-types/menu-location.js.map +7 -1
  33. package/build/entity-types/nav-menu-item.js +16 -5
  34. package/build/entity-types/nav-menu-item.js.map +7 -1
  35. package/build/entity-types/nav-menu.js +16 -5
  36. package/build/entity-types/nav-menu.js.map +7 -1
  37. package/build/entity-types/page.js +16 -5
  38. package/build/entity-types/page.js.map +7 -1
  39. package/build/entity-types/plugin.js +16 -5
  40. package/build/entity-types/plugin.js.map +7 -1
  41. package/build/entity-types/post-revision.js +16 -5
  42. package/build/entity-types/post-revision.js.map +7 -1
  43. package/build/entity-types/post-status.js +16 -5
  44. package/build/entity-types/post-status.js.map +7 -1
  45. package/build/entity-types/post.js +16 -5
  46. package/build/entity-types/post.js.map +7 -1
  47. package/build/entity-types/settings.js +16 -5
  48. package/build/entity-types/settings.js.map +7 -1
  49. package/build/entity-types/sidebar.js +16 -5
  50. package/build/entity-types/sidebar.js.map +7 -1
  51. package/build/entity-types/taxonomy.js +16 -5
  52. package/build/entity-types/taxonomy.js.map +7 -1
  53. package/build/entity-types/term.js +16 -5
  54. package/build/entity-types/term.js.map +7 -1
  55. package/build/entity-types/theme.js +16 -5
  56. package/build/entity-types/theme.js.map +7 -1
  57. package/build/entity-types/type.js +16 -5
  58. package/build/entity-types/type.js.map +7 -1
  59. package/build/entity-types/user.js +16 -5
  60. package/build/entity-types/user.js.map +7 -1
  61. package/build/entity-types/widget-type.js +16 -5
  62. package/build/entity-types/widget-type.js.map +7 -1
  63. package/build/entity-types/widget.js +16 -5
  64. package/build/entity-types/widget.js.map +7 -1
  65. package/build/entity-types/wp-template-part.js +16 -5
  66. package/build/entity-types/wp-template-part.js.map +7 -1
  67. package/build/entity-types/wp-template.js +16 -5
  68. package/build/entity-types/wp-template.js.map +7 -1
  69. package/build/fetch/__experimental-fetch-link-suggestions.js +141 -154
  70. package/build/fetch/__experimental-fetch-link-suggestions.js.map +7 -1
  71. package/build/fetch/__experimental-fetch-url-data.js +47 -59
  72. package/build/fetch/__experimental-fetch-url-data.js.map +7 -1
  73. package/build/fetch/index.js +53 -32
  74. package/build/fetch/index.js.map +7 -1
  75. package/build/footnotes/get-footnotes-order.js +38 -25
  76. package/build/footnotes/get-footnotes-order.js.map +7 -1
  77. package/build/footnotes/get-rich-text-values-cached.js +26 -27
  78. package/build/footnotes/get-rich-text-values-cached.js.map +7 -1
  79. package/build/footnotes/index.js +68 -55
  80. package/build/footnotes/index.js.map +7 -1
  81. package/build/hooks/constants.js +33 -12
  82. package/build/hooks/constants.js.map +7 -1
  83. package/build/hooks/index.js +59 -68
  84. package/build/hooks/index.js.map +7 -1
  85. package/build/hooks/memoize.js +34 -12
  86. package/build/hooks/memoize.js.map +7 -1
  87. package/build/hooks/use-entity-block-editor.js +111 -119
  88. package/build/hooks/use-entity-block-editor.js.map +7 -1
  89. package/build/hooks/use-entity-id.js +25 -23
  90. package/build/hooks/use-entity-id.js.map +7 -1
  91. package/build/hooks/use-entity-prop.js +59 -60
  92. package/build/hooks/use-entity-prop.js.map +7 -1
  93. package/build/hooks/use-entity-record.js +95 -155
  94. package/build/hooks/use-entity-record.js.map +7 -1
  95. package/build/hooks/use-entity-records.js +131 -139
  96. package/build/hooks/use-entity-records.js.map +7 -1
  97. package/build/hooks/use-query-select.js +65 -84
  98. package/build/hooks/use-query-select.js.map +7 -1
  99. package/build/hooks/use-resource-permissions.js +92 -145
  100. package/build/hooks/use-resource-permissions.js.map +7 -1
  101. package/build/index.js +96 -153
  102. package/build/index.js.map +7 -1
  103. package/build/lock-unlock.js +31 -14
  104. package/build/lock-unlock.js.map +7 -1
  105. package/build/locks/actions.js +36 -19
  106. package/build/locks/actions.js.map +7 -1
  107. package/build/locks/engine.js +48 -47
  108. package/build/locks/engine.js.map +7 -1
  109. package/build/locks/reducer.js +54 -63
  110. package/build/locks/reducer.js.map +7 -1
  111. package/build/locks/selectors.js +35 -30
  112. package/build/locks/selectors.js.map +7 -1
  113. package/build/locks/utils.js +37 -16
  114. package/build/locks/utils.js.map +7 -1
  115. package/build/name.js +27 -12
  116. package/build/name.js.map +7 -1
  117. package/build/private-actions.js +67 -75
  118. package/build/private-actions.js.map +7 -1
  119. package/build/private-apis.js +33 -16
  120. package/build/private-apis.js.map +7 -1
  121. package/build/private-selectors.js +204 -184
  122. package/build/private-selectors.js.map +7 -1
  123. package/build/queried-data/actions.js +32 -41
  124. package/build/queried-data/actions.js.map +7 -1
  125. package/build/queried-data/get-query-parts.js +41 -79
  126. package/build/queried-data/get-query-parts.js.map +7 -1
  127. package/build/queried-data/index.js +39 -36
  128. package/build/queried-data/index.js.map +7 -1
  129. package/build/queried-data/reducer.js +162 -193
  130. package/build/queried-data/reducer.js.map +7 -1
  131. package/build/queried-data/selectors.js +57 -85
  132. package/build/queried-data/selectors.js.map +7 -1
  133. package/build/reducer.js +279 -404
  134. package/build/reducer.js.map +7 -1
  135. package/build/resolvers.js +553 -600
  136. package/build/resolvers.js.map +7 -1
  137. package/build/selectors.js +456 -981
  138. package/build/selectors.js.map +7 -1
  139. package/build/sync.js +34 -22
  140. package/build/sync.js.map +7 -1
  141. package/build/types.js +16 -5
  142. package/build/types.js.map +7 -1
  143. package/build/utils/conservative-map-item.js +34 -27
  144. package/build/utils/conservative-map-item.js.map +7 -1
  145. package/build/utils/crdt-blocks.js +289 -0
  146. package/build/utils/crdt-blocks.js.map +7 -0
  147. package/build/utils/crdt.js +202 -0
  148. package/build/utils/crdt.js.map +7 -0
  149. package/build/utils/forward-resolver.js +24 -16
  150. package/build/utils/forward-resolver.js.map +7 -1
  151. package/build/utils/get-nested-value.js +26 -21
  152. package/build/utils/get-nested-value.js.map +7 -1
  153. package/build/utils/get-normalized-comma-separable.js +25 -17
  154. package/build/utils/get-normalized-comma-separable.js.map +7 -1
  155. package/build/utils/if-matching-action.js +25 -19
  156. package/build/utils/if-matching-action.js.map +7 -1
  157. package/build/utils/index.js +77 -108
  158. package/build/utils/index.js.map +7 -1
  159. package/build/utils/is-numeric-id.js +22 -12
  160. package/build/utils/is-numeric-id.js.map +7 -1
  161. package/build/utils/is-raw-attribute.js +22 -13
  162. package/build/utils/is-raw-attribute.js.map +7 -1
  163. package/build/utils/log-entity-deprecation.js +37 -38
  164. package/build/utils/log-entity-deprecation.js.map +7 -1
  165. package/build/utils/on-sub-key.js +30 -24
  166. package/build/utils/on-sub-key.js.map +7 -1
  167. package/build/utils/receive-intermediate-results.js +29 -6
  168. package/build/utils/receive-intermediate-results.js.map +7 -1
  169. package/build/utils/replace-action.js +24 -17
  170. package/build/utils/replace-action.js.map +7 -1
  171. package/build/utils/set-nested-value.js +25 -30
  172. package/build/utils/set-nested-value.js.map +7 -1
  173. package/build/utils/user-permissions.js +41 -13
  174. package/build/utils/user-permissions.js.map +7 -1
  175. package/build/utils/with-weak-map-cache.js +26 -22
  176. package/build/utils/with-weak-map-cache.js.map +7 -1
  177. package/build-module/actions.js +322 -601
  178. package/build-module/actions.js.map +7 -1
  179. package/build-module/batch/create-batch.js +21 -57
  180. package/build-module/batch/create-batch.js.map +7 -1
  181. package/build-module/batch/default-processor.js +14 -33
  182. package/build-module/batch/default-processor.js.map +7 -1
  183. package/build-module/batch/index.js +7 -3
  184. package/build-module/batch/index.js.map +7 -1
  185. package/build-module/dynamic-entities.js +7 -28
  186. package/build-module/dynamic-entities.js.map +7 -1
  187. package/build-module/entities.js +263 -399
  188. package/build-module/entities.js.map +7 -1
  189. package/build-module/entity-context.js +7 -7
  190. package/build-module/entity-context.js.map +7 -1
  191. package/build-module/entity-provider.js +19 -42
  192. package/build-module/entity-provider.js.map +7 -1
  193. package/build-module/entity-types/attachment.js +1 -2
  194. package/build-module/entity-types/attachment.js.map +7 -1
  195. package/build-module/entity-types/base-entity-records.js +1 -37
  196. package/build-module/entity-types/base-entity-records.js.map +7 -1
  197. package/build-module/entity-types/base.js +1 -2
  198. package/build-module/entity-types/base.js.map +7 -1
  199. package/build-module/entity-types/comment.js +1 -2
  200. package/build-module/entity-types/comment.js.map +7 -1
  201. package/build-module/entity-types/global-styles-revision.js +1 -2
  202. package/build-module/entity-types/global-styles-revision.js.map +7 -1
  203. package/build-module/entity-types/helpers.js +1 -2
  204. package/build-module/entity-types/helpers.js.map +7 -1
  205. package/build-module/entity-types/index.js +1 -2
  206. package/build-module/entity-types/index.js.map +7 -1
  207. package/build-module/entity-types/menu-location.js +1 -2
  208. package/build-module/entity-types/menu-location.js.map +7 -1
  209. package/build-module/entity-types/nav-menu-item.js +1 -2
  210. package/build-module/entity-types/nav-menu-item.js.map +7 -1
  211. package/build-module/entity-types/nav-menu.js +1 -2
  212. package/build-module/entity-types/nav-menu.js.map +7 -1
  213. package/build-module/entity-types/page.js +1 -2
  214. package/build-module/entity-types/page.js.map +7 -1
  215. package/build-module/entity-types/plugin.js +1 -2
  216. package/build-module/entity-types/plugin.js.map +7 -1
  217. package/build-module/entity-types/post-revision.js +1 -2
  218. package/build-module/entity-types/post-revision.js.map +7 -1
  219. package/build-module/entity-types/post-status.js +1 -2
  220. package/build-module/entity-types/post-status.js.map +7 -1
  221. package/build-module/entity-types/post.js +1 -2
  222. package/build-module/entity-types/post.js.map +7 -1
  223. package/build-module/entity-types/settings.js +1 -2
  224. package/build-module/entity-types/settings.js.map +7 -1
  225. package/build-module/entity-types/sidebar.js +1 -2
  226. package/build-module/entity-types/sidebar.js.map +7 -1
  227. package/build-module/entity-types/taxonomy.js +1 -2
  228. package/build-module/entity-types/taxonomy.js.map +7 -1
  229. package/build-module/entity-types/term.js +1 -2
  230. package/build-module/entity-types/term.js.map +7 -1
  231. package/build-module/entity-types/theme.js +1 -2
  232. package/build-module/entity-types/theme.js.map +7 -1
  233. package/build-module/entity-types/type.js +1 -2
  234. package/build-module/entity-types/type.js.map +7 -1
  235. package/build-module/entity-types/user.js +1 -2
  236. package/build-module/entity-types/user.js.map +7 -1
  237. package/build-module/entity-types/widget-type.js +1 -2
  238. package/build-module/entity-types/widget-type.js.map +7 -1
  239. package/build-module/entity-types/widget.js +1 -2
  240. package/build-module/entity-types/widget.js.map +7 -1
  241. package/build-module/entity-types/wp-template-part.js +1 -2
  242. package/build-module/entity-types/wp-template-part.js.map +7 -1
  243. package/build-module/entity-types/wp-template.js +1 -2
  244. package/build-module/entity-types/wp-template.js.map +7 -1
  245. package/build-module/fetch/__experimental-fetch-link-suggestions.js +111 -149
  246. package/build-module/fetch/__experimental-fetch-link-suggestions.js.map +7 -1
  247. package/build-module/fetch/__experimental-fetch-url-data.js +20 -49
  248. package/build-module/fetch/__experimental-fetch-url-data.js.map +7 -1
  249. package/build-module/fetch/index.js +20 -15
  250. package/build-module/fetch/index.js.map +7 -1
  251. package/build-module/footnotes/get-footnotes-order.js +10 -19
  252. package/build-module/footnotes/get-footnotes-order.js.map +7 -1
  253. package/build-module/footnotes/get-rich-text-values-cached.js +8 -23
  254. package/build-module/footnotes/get-rich-text-values-cached.js.map +7 -1
  255. package/build-module/footnotes/index.js +34 -47
  256. package/build-module/footnotes/index.js.map +7 -1
  257. package/build-module/hooks/constants.js +11 -8
  258. package/build-module/hooks/constants.js.map +7 -1
  259. package/build-module/hooks/index.js +27 -15
  260. package/build-module/hooks/index.js.map +7 -1
  261. package/build-module/hooks/memoize.js +6 -8
  262. package/build-module/hooks/memoize.js.map +7 -1
  263. package/build-module/hooks/use-entity-block-editor.js +80 -110
  264. package/build-module/hooks/use-entity-block-editor.js.map +7 -1
  265. package/build-module/hooks/use-entity-id.js +7 -19
  266. package/build-module/hooks/use-entity-id.js.map +7 -1
  267. package/build-module/hooks/use-entity-prop.js +31 -55
  268. package/build-module/hooks/use-entity-prop.js.map +7 -1
  269. package/build-module/hooks/use-entity-record.js +63 -148
  270. package/build-module/hooks/use-entity-record.js.map +7 -1
  271. package/build-module/hooks/use-entity-records.js +98 -131
  272. package/build-module/hooks/use-entity-records.js.map +7 -1
  273. package/build-module/hooks/use-query-select.js +27 -71
  274. package/build-module/hooks/use-query-select.js.map +7 -1
  275. package/build-module/hooks/use-resource-permissions.js +57 -136
  276. package/build-module/hooks/use-resource-permissions.js.map +7 -1
  277. package/build-module/index.js +49 -71
  278. package/build-module/index.js.map +7 -1
  279. package/build-module/lock-unlock.js +8 -7
  280. package/build-module/lock-unlock.js.map +7 -1
  281. package/build-module/locks/actions.js +8 -13
  282. package/build-module/locks/actions.js.map +7 -1
  283. package/build-module/locks/engine.js +17 -38
  284. package/build-module/locks/engine.js.map +7 -1
  285. package/build-module/locks/reducer.js +37 -59
  286. package/build-module/locks/reducer.js.map +7 -1
  287. package/build-module/locks/selectors.js +16 -23
  288. package/build-module/locks/selectors.js.map +7 -1
  289. package/build-module/locks/utils.js +15 -12
  290. package/build-module/locks/utils.js.map +7 -1
  291. package/build-module/name.js +5 -8
  292. package/build-module/name.js.map +7 -1
  293. package/build-module/private-actions.js +35 -69
  294. package/build-module/private-actions.js.map +7 -1
  295. package/build-module/private-apis.js +8 -8
  296. package/build-module/private-apis.js.map +7 -1
  297. package/build-module/private-selectors.js +167 -174
  298. package/build-module/private-selectors.js.map +7 -1
  299. package/build-module/queried-data/actions.js +11 -38
  300. package/build-module/queried-data/actions.js.map +7 -1
  301. package/build-module/queried-data/get-query-parts.js +20 -75
  302. package/build-module/queried-data/get-query-parts.js.map +7 -1
  303. package/build-module/queried-data/index.js +7 -4
  304. package/build-module/queried-data/index.js.map +7 -1
  305. package/build-module/queried-data/reducer.js +134 -185
  306. package/build-module/queried-data/reducer.js.map +7 -1
  307. package/build-module/queried-data/selectors.js +23 -78
  308. package/build-module/queried-data/selectors.js.map +7 -1
  309. package/build-module/reducer.js +243 -393
  310. package/build-module/reducer.js.map +7 -1
  311. package/build-module/resolvers.js +478 -549
  312. package/build-module/resolvers.js.map +7 -1
  313. package/build-module/selectors.js +410 -953
  314. package/build-module/selectors.js.map +7 -1
  315. package/build-module/sync.js +14 -17
  316. package/build-module/sync.js.map +7 -1
  317. package/build-module/types.js +1 -2
  318. package/build-module/types.js.map +7 -1
  319. package/build-module/utils/conservative-map-item.js +6 -22
  320. package/build-module/utils/conservative-map-item.js.map +7 -1
  321. package/build-module/utils/crdt-blocks.js +255 -0
  322. package/build-module/utils/crdt-blocks.js.map +7 -0
  323. package/build-module/utils/crdt.js +167 -0
  324. package/build-module/utils/crdt.js.map +7 -0
  325. package/build-module/utils/forward-resolver.js +6 -12
  326. package/build-module/utils/forward-resolver.js.map +7 -1
  327. package/build-module/utils/get-nested-value.js +9 -18
  328. package/build-module/utils/get-nested-value.js.map +7 -1
  329. package/build-module/utils/get-normalized-comma-separable.js +7 -13
  330. package/build-module/utils/get-normalized-comma-separable.js.map +7 -1
  331. package/build-module/utils/if-matching-action.js +7 -15
  332. package/build-module/utils/if-matching-action.js.map +7 -1
  333. package/build-module/utils/index.js +35 -14
  334. package/build-module/utils/index.js.map +7 -1
  335. package/build-module/utils/is-numeric-id.js +5 -9
  336. package/build-module/utils/is-numeric-id.js.map +7 -1
  337. package/build-module/utils/is-raw-attribute.js +5 -10
  338. package/build-module/utils/is-raw-attribute.js.map +7 -1
  339. package/build-module/utils/log-entity-deprecation.js +8 -31
  340. package/build-module/utils/log-entity-deprecation.js.map +7 -1
  341. package/build-module/utils/on-sub-key.js +8 -19
  342. package/build-module/utils/on-sub-key.js.map +7 -1
  343. package/build-module/utils/receive-intermediate-results.js +7 -2
  344. package/build-module/utils/receive-intermediate-results.js.map +7 -1
  345. package/build-module/utils/replace-action.js +6 -13
  346. package/build-module/utils/replace-action.js.map +7 -1
  347. package/build-module/utils/set-nested-value.js +8 -27
  348. package/build-module/utils/set-nested-value.js.map +7 -1
  349. package/build-module/utils/user-permissions.js +19 -9
  350. package/build-module/utils/user-permissions.js.map +7 -1
  351. package/build-module/utils/with-weak-map-cache.js +8 -18
  352. package/build-module/utils/with-weak-map-cache.js.map +7 -1
  353. package/build-types/actions.d.ts.map +1 -1
  354. package/build-types/entities.d.ts +0 -56
  355. package/build-types/entities.d.ts.map +1 -1
  356. package/build-types/index.d.ts.map +1 -1
  357. package/build-types/private-selectors.d.ts.map +1 -1
  358. package/build-types/resolvers.d.ts +3 -0
  359. package/build-types/resolvers.d.ts.map +1 -1
  360. package/build-types/selectors.d.ts.map +1 -1
  361. package/build-types/sync.d.ts +6 -1
  362. package/build-types/sync.d.ts.map +1 -1
  363. package/build-types/types.d.ts +9 -0
  364. package/build-types/types.d.ts.map +1 -1
  365. package/build-types/utils/crdt-blocks.d.ts +30 -0
  366. package/build-types/utils/crdt-blocks.d.ts.map +1 -0
  367. package/build-types/utils/crdt.d.ts +49 -0
  368. package/build-types/utils/crdt.d.ts.map +1 -0
  369. package/package.json +26 -19
  370. package/src/actions.js +56 -74
  371. package/src/entities.js +59 -113
  372. package/src/private-selectors.ts +32 -7
  373. package/src/resolvers.js +173 -120
  374. package/src/selectors.ts +0 -13
  375. package/src/sync.ts +12 -0
  376. package/src/test/resolvers.js +183 -0
  377. package/src/types.ts +12 -0
  378. package/src/utils/crdt-blocks.ts +503 -0
  379. package/src/utils/crdt.ts +310 -0
  380. package/src/utils/test/crdt-blocks.ts +375 -0
  381. package/src/utils/test/crdt.ts +254 -0
  382. package/tsconfig.tsbuildinfo +1 -1
  383. package/src/sync.js +0 -27
@@ -1 +1,7 @@
1
- {"version":3,"names":["ifMatchingAction","isMatch","reducer","state","action","undefined"],"sources":["@wordpress/core-data/src/utils/if-matching-action.js"],"sourcesContent":["/** @typedef {import('../types').AnyFunction} AnyFunction */\n\n/**\n * A higher-order reducer creator which invokes the original reducer only if\n * the dispatching action matches the given predicate, **OR** if state is\n * initializing (undefined).\n *\n * @param {AnyFunction} isMatch Function predicate for allowing reducer call.\n *\n * @return {AnyFunction} Higher-order reducer.\n */\nconst ifMatchingAction = ( isMatch ) => ( reducer ) => ( state, action ) => {\n\tif ( state === undefined || isMatch( action ) ) {\n\t\treturn reducer( state, action );\n\t}\n\n\treturn state;\n};\n\nexport default ifMatchingAction;\n"],"mappings":"AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,gBAAgB,GAAKC,OAAO,IAAQC,OAAO,IAAM,CAAEC,KAAK,EAAEC,MAAM,KAAM;EAC3E,IAAKD,KAAK,KAAKE,SAAS,IAAIJ,OAAO,CAAEG,MAAO,CAAC,EAAG;IAC/C,OAAOF,OAAO,CAAEC,KAAK,EAAEC,MAAO,CAAC;EAChC;EAEA,OAAOD,KAAK;AACb,CAAC;AAED,eAAeH,gBAAgB","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils/if-matching-action.js"],
4
+ "sourcesContent": ["/** @typedef {import('../types').AnyFunction} AnyFunction */\n\n/**\n * A higher-order reducer creator which invokes the original reducer only if\n * the dispatching action matches the given predicate, **OR** if state is\n * initializing (undefined).\n *\n * @param {AnyFunction} isMatch Function predicate for allowing reducer call.\n *\n * @return {AnyFunction} Higher-order reducer.\n */\nconst ifMatchingAction = ( isMatch ) => ( reducer ) => ( state, action ) => {\n\tif ( state === undefined || isMatch( action ) ) {\n\t\treturn reducer( state, action );\n\t}\n\n\treturn state;\n};\n\nexport default ifMatchingAction;\n"],
5
+ "mappings": "AAWA,MAAM,mBAAmB,CAAE,YAAa,CAAE,YAAa,CAAE,OAAO,WAAY;AAC3E,MAAK,UAAU,UAAa,QAAS,MAAO,GAAI;AAC/C,WAAO,QAAS,OAAO,MAAO;AAAA,EAC/B;AAEA,SAAO;AACR;AAEA,IAAO,6BAAQ;",
6
+ "names": []
7
+ }
@@ -1,14 +1,35 @@
1
- export { default as conservativeMapItem } from './conservative-map-item';
2
- export { default as getNormalizedCommaSeparable } from './get-normalized-comma-separable';
3
- export { default as ifMatchingAction } from './if-matching-action';
4
- export { default as forwardResolver } from './forward-resolver';
5
- export { default as onSubKey } from './on-sub-key';
6
- export { default as replaceAction } from './replace-action';
7
- export { default as withWeakMapCache } from './with-weak-map-cache';
8
- export { default as isRawAttribute } from './is-raw-attribute';
9
- export { default as setNestedValue } from './set-nested-value';
10
- export { default as getNestedValue } from './get-nested-value';
11
- export { default as isNumericID } from './is-numeric-id';
12
- export { getUserPermissionCacheKey, getUserPermissionsFromAllowHeader, ALLOWED_RESOURCE_ACTIONS } from './user-permissions';
13
- export { RECEIVE_INTERMEDIATE_RESULTS } from './receive-intermediate-results';
14
- //# sourceMappingURL=index.js.map
1
+ import { default as default2 } from "./conservative-map-item";
2
+ import { default as default3 } from "./get-normalized-comma-separable";
3
+ import { default as default4 } from "./if-matching-action";
4
+ import { default as default5 } from "./forward-resolver";
5
+ import { default as default6 } from "./on-sub-key";
6
+ import { default as default7 } from "./replace-action";
7
+ import { default as default8 } from "./with-weak-map-cache";
8
+ import { default as default9 } from "./is-raw-attribute";
9
+ import { default as default10 } from "./set-nested-value";
10
+ import { default as default11 } from "./get-nested-value";
11
+ import { default as default12 } from "./is-numeric-id";
12
+ import {
13
+ getUserPermissionCacheKey,
14
+ getUserPermissionsFromAllowHeader,
15
+ ALLOWED_RESOURCE_ACTIONS
16
+ } from "./user-permissions";
17
+ import { RECEIVE_INTERMEDIATE_RESULTS } from "./receive-intermediate-results";
18
+ export {
19
+ ALLOWED_RESOURCE_ACTIONS,
20
+ RECEIVE_INTERMEDIATE_RESULTS,
21
+ default2 as conservativeMapItem,
22
+ default5 as forwardResolver,
23
+ default11 as getNestedValue,
24
+ default3 as getNormalizedCommaSeparable,
25
+ getUserPermissionCacheKey,
26
+ getUserPermissionsFromAllowHeader,
27
+ default4 as ifMatchingAction,
28
+ default12 as isNumericID,
29
+ default9 as isRawAttribute,
30
+ default6 as onSubKey,
31
+ default7 as replaceAction,
32
+ default10 as setNestedValue,
33
+ default8 as withWeakMapCache
34
+ };
35
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["default","conservativeMapItem","getNormalizedCommaSeparable","ifMatchingAction","forwardResolver","onSubKey","replaceAction","withWeakMapCache","isRawAttribute","setNestedValue","getNestedValue","isNumericID","getUserPermissionCacheKey","getUserPermissionsFromAllowHeader","ALLOWED_RESOURCE_ACTIONS","RECEIVE_INTERMEDIATE_RESULTS"],"sources":["@wordpress/core-data/src/utils/index.js"],"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"],"mappings":"AAAA,SAASA,OAAO,IAAIC,mBAAmB,QAAQ,yBAAyB;AACxE,SAASD,OAAO,IAAIE,2BAA2B,QAAQ,kCAAkC;AACzF,SAASF,OAAO,IAAIG,gBAAgB,QAAQ,sBAAsB;AAClE,SAASH,OAAO,IAAII,eAAe,QAAQ,oBAAoB;AAC/D,SAASJ,OAAO,IAAIK,QAAQ,QAAQ,cAAc;AAClD,SAASL,OAAO,IAAIM,aAAa,QAAQ,kBAAkB;AAC3D,SAASN,OAAO,IAAIO,gBAAgB,QAAQ,uBAAuB;AACnE,SAASP,OAAO,IAAIQ,cAAc,QAAQ,oBAAoB;AAC9D,SAASR,OAAO,IAAIS,cAAc,QAAQ,oBAAoB;AAC9D,SAAST,OAAO,IAAIU,cAAc,QAAQ,oBAAoB;AAC9D,SAASV,OAAO,IAAIW,WAAW,QAAQ,iBAAiB;AACxD,SACCC,yBAAyB,EACzBC,iCAAiC,EACjCC,wBAAwB,QAClB,oBAAoB;AAC3B,SAASC,4BAA4B,QAAQ,gCAAgC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils/index.js"],
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;",
6
+ "names": ["default"]
7
+ }
@@ -1,11 +1,7 @@
1
- /**
2
- * Checks argument to determine if it's a numeric ID.
3
- * For example, '123' is a numeric ID, but '123abc' is not.
4
- *
5
- * @param {any} id the argument to determine if it's a numeric ID.
6
- * @return {boolean} true if the string is a numeric ID, false otherwise.
7
- */
8
- export default function isNumericID(id) {
1
+ function isNumericID(id) {
9
2
  return /^\s*\d+\s*$/.test(id);
10
3
  }
11
- //# sourceMappingURL=is-numeric-id.js.map
4
+ export {
5
+ isNumericID as default
6
+ };
7
+ //# sourceMappingURL=is-numeric-id.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["isNumericID","id","test"],"sources":["@wordpress/core-data/src/utils/is-numeric-id.js"],"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"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,WAAWA,CAAEC,EAAE,EAAG;EACzC,OAAO,aAAa,CAACC,IAAI,CAAED,EAAG,CAAC;AAChC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils/is-numeric-id.js"],
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;",
6
+ "names": []
7
+ }
@@ -1,12 +1,7 @@
1
- /**
2
- * Checks whether the attribute is a "raw" attribute or not.
3
- *
4
- * @param {Object} entity Entity record.
5
- * @param {string} attribute Attribute name.
6
- *
7
- * @return {boolean} Is the attribute raw
8
- */
9
- export default function isRawAttribute(entity, attribute) {
1
+ function isRawAttribute(entity, attribute) {
10
2
  return (entity.rawAttributes || []).includes(attribute);
11
3
  }
12
- //# sourceMappingURL=is-raw-attribute.js.map
4
+ export {
5
+ isRawAttribute as default
6
+ };
7
+ //# sourceMappingURL=is-raw-attribute.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["isRawAttribute","entity","attribute","rawAttributes","includes"],"sources":["@wordpress/core-data/src/utils/is-raw-attribute.js"],"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"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,cAAcA,CAAEC,MAAM,EAAEC,SAAS,EAAG;EAC3D,OAAO,CAAED,MAAM,CAACE,aAAa,IAAI,EAAE,EAAGC,QAAQ,CAAEF,SAAU,CAAC;AAC5D","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils/is-raw-attribute.js"],
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;",
6
+ "names": []
7
+ }
@@ -1,25 +1,7 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import deprecated from '@wordpress/deprecated';
5
-
6
- /**
7
- * Internal dependencies
8
- */
9
- import { deprecatedEntities } from '../entities';
1
+ import deprecated from "@wordpress/deprecated";
2
+ import { deprecatedEntities } from "../entities";
10
3
  let loggedAlready = false;
11
-
12
- /**
13
- * Logs a deprecation warning for an entity, if it's deprecated.
14
- *
15
- * @param kind The kind of the entity.
16
- * @param name The name of the entity.
17
- * @param functionName The name of the function that was called with a deprecated entity.
18
- * @param options The options for the deprecation warning.
19
- * @param options.alternativeFunctionName The name of the alternative function that should be used instead.
20
- * @param options.isShorthandSelector Whether the function is a shorthand selector.
21
- */
22
- export default function logEntityDeprecation(kind, name, functionName, {
4
+ function logEntityDeprecation(kind, name, functionName, {
23
5
  alternativeFunctionName,
24
6
  isShorthandSelector = false
25
7
  } = {}) {
@@ -28,9 +10,7 @@ export default function logEntityDeprecation(kind, name, functionName, {
28
10
  return;
29
11
  }
30
12
  if (!loggedAlready) {
31
- const {
32
- alternative
33
- } = deprecation;
13
+ const { alternative } = deprecation;
34
14
  const message = isShorthandSelector ? `'${functionName}'` : `The '${kind}', '${name}' entity (used via '${functionName}')`;
35
15
  let alternativeMessage = `the '${alternative.kind}', '${alternative.name}' entity`;
36
16
  if (alternativeFunctionName) {
@@ -41,15 +21,12 @@ export default function logEntityDeprecation(kind, name, functionName, {
41
21
  alternative: alternativeMessage
42
22
  });
43
23
  }
44
-
45
- // Only log an entity deprecation once per call stack,
46
- // else there's spurious logging when selections or actions call through to other selectors or actions.
47
- // Note: this won't prevent the deprecation warning being logged if a selector or action makes an async call
48
- // to another selector or action, but this is probably the best we can do.
49
24
  loggedAlready = true;
50
- // At the end of the call stack, reset the flag.
51
25
  setTimeout(() => {
52
26
  loggedAlready = false;
53
27
  }, 0);
54
28
  }
55
- //# sourceMappingURL=log-entity-deprecation.js.map
29
+ export {
30
+ logEntityDeprecation as default
31
+ };
32
+ //# sourceMappingURL=log-entity-deprecation.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["deprecated","deprecatedEntities","loggedAlready","logEntityDeprecation","kind","name","functionName","alternativeFunctionName","isShorthandSelector","deprecation","alternative","message","alternativeMessage","setTimeout"],"sources":["@wordpress/core-data/src/utils/log-entity-deprecation.ts"],"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"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,uBAAuB;;AAE9C;AACA;AACA;AACA,SAASC,kBAAkB,QAAQ,aAAa;AAEhD,IAAIC,aAAa,GAAG,KAAK;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,oBAAoBA,CAC3CC,IAAY,EACZC,IAAY,EACZC,YAAoB,EACpB;EACCC,uBAAuB;EACvBC,mBAAmB,GAAG;AAIvB,CAAC,GAAG,CAAC,CAAC,EACL;EACD,MAAMC,WAAW,GAAGR,kBAAkB,CAAEG,IAAI,CAAE,GAAIC,IAAI,CAAE;EACxD,IAAK,CAAEI,WAAW,EAAG;IACpB;EACD;EAEA,IAAK,CAAEP,aAAa,EAAG;IACtB,MAAM;MAAEQ;IAAY,CAAC,GAAGD,WAAW;IAEnC,MAAME,OAAO,GAAGH,mBAAmB,GAChC,IAAKF,YAAY,GAAI,GACrB,QAASF,IAAI,OAASC,IAAI,uBAAyBC,YAAY,IAAK;IAEvE,IAAIM,kBAAkB,GAAG,QAASF,WAAW,CAACN,IAAI,OAASM,WAAW,CAACL,IAAI,UAAW;IACtF,IAAKE,uBAAuB,EAAG;MAC9BK,kBAAkB,IAAI,aAAcL,uBAAuB,YAAa;IACzE;IAEAP,UAAU,CAAEW,OAAO,EAAE;MACpB,GAAGF,WAAW;MACdC,WAAW,EAAEE;IACd,CAAE,CAAC;EACJ;;EAEA;EACA;EACA;EACA;EACAV,aAAa,GAAG,IAAI;EACpB;EACAW,UAAU,CAAE,MAAM;IACjBX,aAAa,GAAG,KAAK;EACtB,CAAC,EAAE,CAAE,CAAC;AACP","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils/log-entity-deprecation.ts"],
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;",
6
+ "names": []
7
+ }
@@ -1,23 +1,8 @@
1
- /** @typedef {import('../types').AnyFunction} AnyFunction */
2
-
3
- /**
4
- * Higher-order reducer creator which creates a combined reducer object, keyed
5
- * by a property on the action object.
6
- *
7
- * @param {string} actionProperty Action property by which to key object.
8
- *
9
- * @return {AnyFunction} Higher-order reducer.
10
- */
11
- export const onSubKey = actionProperty => reducer => (state = {}, action) => {
12
- // Retrieve subkey from action. Do not track if undefined; useful for cases
13
- // where reducer is scoped by action shape.
1
+ const onSubKey = (actionProperty) => (reducer) => (state = {}, action) => {
14
2
  const key = action[actionProperty];
15
- if (key === undefined) {
3
+ if (key === void 0) {
16
4
  return state;
17
5
  }
18
-
19
- // Avoid updating state if unchanged. Note that this also accounts for a
20
- // reducer which returns undefined on a key which is not yet tracked.
21
6
  const nextKeyState = reducer(state[key], action);
22
7
  if (nextKeyState === state[key]) {
23
8
  return state;
@@ -27,5 +12,9 @@ export const onSubKey = actionProperty => reducer => (state = {}, action) => {
27
12
  [key]: nextKeyState
28
13
  };
29
14
  };
30
- export default onSubKey;
31
- //# sourceMappingURL=on-sub-key.js.map
15
+ var on_sub_key_default = onSubKey;
16
+ export {
17
+ on_sub_key_default as default,
18
+ onSubKey
19
+ };
20
+ //# sourceMappingURL=on-sub-key.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["onSubKey","actionProperty","reducer","state","action","key","undefined","nextKeyState"],"sources":["@wordpress/core-data/src/utils/on-sub-key.js"],"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"],"mappings":"AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,QAAQ,GAClBC,cAAc,IACdC,OAAO,IACT,CAAEC,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,KAAM;EACzB;EACA;EACA,MAAMC,GAAG,GAAGD,MAAM,CAAEH,cAAc,CAAE;EACpC,IAAKI,GAAG,KAAKC,SAAS,EAAG;IACxB,OAAOH,KAAK;EACb;;EAEA;EACA;EACA,MAAMI,YAAY,GAAGL,OAAO,CAAEC,KAAK,CAAEE,GAAG,CAAE,EAAED,MAAO,CAAC;EACpD,IAAKG,YAAY,KAAKJ,KAAK,CAAEE,GAAG,CAAE,EAAG;IACpC,OAAOF,KAAK;EACb;EAEA,OAAO;IACN,GAAGA,KAAK;IACR,CAAEE,GAAG,GAAIE;EACV,CAAC;AACF,CAAC;AAEF,eAAeP,QAAQ","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils/on-sub-key.js"],
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;",
6
+ "names": []
7
+ }
@@ -1,2 +1,7 @@
1
- export const RECEIVE_INTERMEDIATE_RESULTS = Symbol('RECEIVE_INTERMEDIATE_RESULTS');
2
- //# sourceMappingURL=receive-intermediate-results.js.map
1
+ const RECEIVE_INTERMEDIATE_RESULTS = Symbol(
2
+ "RECEIVE_INTERMEDIATE_RESULTS"
3
+ );
4
+ export {
5
+ RECEIVE_INTERMEDIATE_RESULTS
6
+ };
7
+ //# sourceMappingURL=receive-intermediate-results.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["RECEIVE_INTERMEDIATE_RESULTS","Symbol"],"sources":["@wordpress/core-data/src/utils/receive-intermediate-results.js"],"sourcesContent":["export const RECEIVE_INTERMEDIATE_RESULTS = Symbol(\n\t'RECEIVE_INTERMEDIATE_RESULTS'\n);\n"],"mappings":"AAAA,OAAO,MAAMA,4BAA4B,GAAGC,MAAM,CACjD,8BACD,CAAC","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils/receive-intermediate-results.js"],
4
+ "sourcesContent": ["export const RECEIVE_INTERMEDIATE_RESULTS = Symbol(\n\t'RECEIVE_INTERMEDIATE_RESULTS'\n);\n"],
5
+ "mappings": "AAAO,MAAM,+BAA+B;AAAA,EAC3C;AACD;",
6
+ "names": []
7
+ }
@@ -1,15 +1,8 @@
1
- /** @typedef {import('../types').AnyFunction} AnyFunction */
2
-
3
- /**
4
- * Higher-order reducer creator which substitutes the action object before
5
- * passing to the original reducer.
6
- *
7
- * @param {AnyFunction} replacer Function mapping original action to replacement.
8
- *
9
- * @return {AnyFunction} Higher-order reducer.
10
- */
11
- const replaceAction = replacer => reducer => (state, action) => {
1
+ const replaceAction = (replacer) => (reducer) => (state, action) => {
12
2
  return reducer(state, replacer(action));
13
3
  };
14
- export default replaceAction;
15
- //# sourceMappingURL=replace-action.js.map
4
+ var replace_action_default = replaceAction;
5
+ export {
6
+ replace_action_default as default
7
+ };
8
+ //# sourceMappingURL=replace-action.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["replaceAction","replacer","reducer","state","action"],"sources":["@wordpress/core-data/src/utils/replace-action.js"],"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"],"mappings":"AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,aAAa,GAAKC,QAAQ,IAAQC,OAAO,IAAM,CAAEC,KAAK,EAAEC,MAAM,KAAM;EACzE,OAAOF,OAAO,CAAEC,KAAK,EAAEF,QAAQ,CAAEG,MAAO,CAAE,CAAC;AAC5C,CAAC;AAED,eAAeJ,aAAa","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils/replace-action.js"],
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;",
6
+ "names": []
7
+ }
@@ -1,32 +1,10 @@
1
- /**
2
- * Sets the value at path of object.
3
- * If a portion of path doesn’t exist, it’s created.
4
- * Arrays are created for missing index properties while objects are created
5
- * for all other missing properties.
6
- *
7
- * Path is specified as either:
8
- * - a string of properties, separated by dots, for example: "x.y".
9
- * - an array of properties, for example `[ 'x', 'y' ]`.
10
- *
11
- * This function intentionally mutates the input object.
12
- *
13
- * Inspired by _.set().
14
- *
15
- * @see https://lodash.com/docs/4.17.15#set
16
- *
17
- * @todo Needs to be deduplicated with its copy in `@wordpress/edit-site`.
18
- *
19
- * @param {Object} object Object to modify
20
- * @param {Array|string} path Path of the property to set.
21
- * @param {*} value Value to set.
22
- */
23
- export default function setNestedValue(object, path, value) {
24
- if (!object || typeof object !== 'object') {
1
+ function setNestedValue(object, path, value) {
2
+ if (!object || typeof object !== "object") {
25
3
  return object;
26
4
  }
27
- const normalizedPath = Array.isArray(path) ? path : path.split('.');
5
+ const normalizedPath = Array.isArray(path) ? path : path.split(".");
28
6
  normalizedPath.reduce((acc, key, idx) => {
29
- if (acc[key] === undefined) {
7
+ if (acc[key] === void 0) {
30
8
  if (Number.isInteger(normalizedPath[idx + 1])) {
31
9
  acc[key] = [];
32
10
  } else {
@@ -40,4 +18,7 @@ export default function setNestedValue(object, path, value) {
40
18
  }, object);
41
19
  return object;
42
20
  }
43
- //# sourceMappingURL=set-nested-value.js.map
21
+ export {
22
+ setNestedValue as default
23
+ };
24
+ //# sourceMappingURL=set-nested-value.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["setNestedValue","object","path","value","normalizedPath","Array","isArray","split","reduce","acc","key","idx","undefined","Number","isInteger","length"],"sources":["@wordpress/core-data/src/utils/set-nested-value.js"],"sourcesContent":["/**\n * Sets the value at path of object.\n * If a portion of path doesn’t exist, it’s 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"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,cAAcA,CAAEC,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAG;EAC7D,IAAK,CAAEF,MAAM,IAAI,OAAOA,MAAM,KAAK,QAAQ,EAAG;IAC7C,OAAOA,MAAM;EACd;EAEA,MAAMG,cAAc,GAAGC,KAAK,CAACC,OAAO,CAAEJ,IAAK,CAAC,GAAGA,IAAI,GAAGA,IAAI,CAACK,KAAK,CAAE,GAAI,CAAC;EAEvEH,cAAc,CAACI,MAAM,CAAE,CAAEC,GAAG,EAAEC,GAAG,EAAEC,GAAG,KAAM;IAC3C,IAAKF,GAAG,CAAEC,GAAG,CAAE,KAAKE,SAAS,EAAG;MAC/B,IAAKC,MAAM,CAACC,SAAS,CAAEV,cAAc,CAAEO,GAAG,GAAG,CAAC,CAAG,CAAC,EAAG;QACpDF,GAAG,CAAEC,GAAG,CAAE,GAAG,EAAE;MAChB,CAAC,MAAM;QACND,GAAG,CAAEC,GAAG,CAAE,GAAG,CAAC,CAAC;MAChB;IACD;IACA,IAAKC,GAAG,KAAKP,cAAc,CAACW,MAAM,GAAG,CAAC,EAAG;MACxCN,GAAG,CAAEC,GAAG,CAAE,GAAGP,KAAK;IACnB;IACA,OAAOM,GAAG,CAAEC,GAAG,CAAE;EAClB,CAAC,EAAET,MAAO,CAAC;EAEX,OAAOA,MAAM;AACd","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils/set-nested-value.js"],
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;",
6
+ "names": []
7
+ }
@@ -1,22 +1,32 @@
1
- export const ALLOWED_RESOURCE_ACTIONS = ['create', 'read', 'update', 'delete'];
2
- export function getUserPermissionsFromAllowHeader(allowedMethods) {
1
+ const ALLOWED_RESOURCE_ACTIONS = [
2
+ "create",
3
+ "read",
4
+ "update",
5
+ "delete"
6
+ ];
7
+ function getUserPermissionsFromAllowHeader(allowedMethods) {
3
8
  const permissions = {};
4
9
  if (!allowedMethods) {
5
10
  return permissions;
6
11
  }
7
12
  const methods = {
8
- create: 'POST',
9
- read: 'GET',
10
- update: 'PUT',
11
- delete: 'DELETE'
13
+ create: "POST",
14
+ read: "GET",
15
+ update: "PUT",
16
+ delete: "DELETE"
12
17
  };
13
18
  for (const [actionName, methodName] of Object.entries(methods)) {
14
19
  permissions[actionName] = allowedMethods.includes(methodName);
15
20
  }
16
21
  return permissions;
17
22
  }
18
- export function getUserPermissionCacheKey(action, resource, id) {
19
- const key = (typeof resource === 'object' ? [action, resource.kind, resource.name, resource.id] : [action, resource, id]).filter(Boolean).join('/');
23
+ function getUserPermissionCacheKey(action, resource, id) {
24
+ const key = (typeof resource === "object" ? [action, resource.kind, resource.name, resource.id] : [action, resource, id]).filter(Boolean).join("/");
20
25
  return key;
21
26
  }
22
- //# sourceMappingURL=user-permissions.js.map
27
+ export {
28
+ ALLOWED_RESOURCE_ACTIONS,
29
+ getUserPermissionCacheKey,
30
+ getUserPermissionsFromAllowHeader
31
+ };
32
+ //# sourceMappingURL=user-permissions.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["ALLOWED_RESOURCE_ACTIONS","getUserPermissionsFromAllowHeader","allowedMethods","permissions","methods","create","read","update","delete","actionName","methodName","Object","entries","includes","getUserPermissionCacheKey","action","resource","id","key","kind","name","filter","Boolean","join"],"sources":["@wordpress/core-data/src/utils/user-permissions.js"],"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"],"mappings":"AAAA,OAAO,MAAMA,wBAAwB,GAAG,CACvC,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,QAAQ,CACR;AAED,OAAO,SAASC,iCAAiCA,CAAEC,cAAc,EAAG;EACnE,MAAMC,WAAW,GAAG,CAAC,CAAC;EACtB,IAAK,CAAED,cAAc,EAAG;IACvB,OAAOC,WAAW;EACnB;EAEA,MAAMC,OAAO,GAAG;IACfC,MAAM,EAAE,MAAM;IACdC,IAAI,EAAE,KAAK;IACXC,MAAM,EAAE,KAAK;IACbC,MAAM,EAAE;EACT,CAAC;EACD,KAAM,MAAM,CAAEC,UAAU,EAAEC,UAAU,CAAE,IAAIC,MAAM,CAACC,OAAO,CAAER,OAAQ,CAAC,EAAG;IACrED,WAAW,CAAEM,UAAU,CAAE,GAAGP,cAAc,CAACW,QAAQ,CAAEH,UAAW,CAAC;EAClE;EAEA,OAAOP,WAAW;AACnB;AAEA,OAAO,SAASW,yBAAyBA,CAAEC,MAAM,EAAEC,QAAQ,EAAEC,EAAE,EAAG;EACjE,MAAMC,GAAG,GAAG,CACX,OAAOF,QAAQ,KAAK,QAAQ,GACzB,CAAED,MAAM,EAAEC,QAAQ,CAACG,IAAI,EAAEH,QAAQ,CAACI,IAAI,EAAEJ,QAAQ,CAACC,EAAE,CAAE,GACrD,CAAEF,MAAM,EAAEC,QAAQ,EAAEC,EAAE,CAAE,EAE1BI,MAAM,CAAEC,OAAQ,CAAC,CACjBC,IAAI,CAAE,GAAI,CAAC;EAEb,OAAOL,GAAG;AACX","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils/user-permissions.js"],
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;",
6
+ "names": []
7
+ }
@@ -1,30 +1,20 @@
1
- /**
2
- * Given a function, returns an enhanced function which caches the result and
3
- * tracks in WeakMap. The result is only cached if the original function is
4
- * passed a valid object-like argument (requirement for WeakMap key).
5
- *
6
- * @param {Function} fn Original function.
7
- *
8
- * @return {Function} Enhanced caching function.
9
- */
10
1
  function withWeakMapCache(fn) {
11
- const cache = new WeakMap();
12
- return key => {
2
+ const cache = /* @__PURE__ */ new WeakMap();
3
+ return (key) => {
13
4
  let value;
14
5
  if (cache.has(key)) {
15
6
  value = cache.get(key);
16
7
  } else {
17
8
  value = fn(key);
18
-
19
- // Can reach here if key is not valid for WeakMap, since `has`
20
- // will return false for invalid key. Since `set` will throw,
21
- // ensure that key is valid before setting into cache.
22
- if (key !== null && typeof key === 'object') {
9
+ if (key !== null && typeof key === "object") {
23
10
  cache.set(key, value);
24
11
  }
25
12
  }
26
13
  return value;
27
14
  };
28
15
  }
29
- export default withWeakMapCache;
30
- //# sourceMappingURL=with-weak-map-cache.js.map
16
+ var with_weak_map_cache_default = withWeakMapCache;
17
+ export {
18
+ with_weak_map_cache_default as default
19
+ };
20
+ //# sourceMappingURL=with-weak-map-cache.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["withWeakMapCache","fn","cache","WeakMap","key","value","has","get","set"],"sources":["@wordpress/core-data/src/utils/with-weak-map-cache.js"],"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"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,gBAAgBA,CAAEC,EAAE,EAAG;EAC/B,MAAMC,KAAK,GAAG,IAAIC,OAAO,CAAC,CAAC;EAE3B,OAASC,GAAG,IAAM;IACjB,IAAIC,KAAK;IACT,IAAKH,KAAK,CAACI,GAAG,CAAEF,GAAI,CAAC,EAAG;MACvBC,KAAK,GAAGH,KAAK,CAACK,GAAG,CAAEH,GAAI,CAAC;IACzB,CAAC,MAAM;MACNC,KAAK,GAAGJ,EAAE,CAAEG,GAAI,CAAC;;MAEjB;MACA;MACA;MACA,IAAKA,GAAG,KAAK,IAAI,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAG;QAC9CF,KAAK,CAACM,GAAG,CAAEJ,GAAG,EAAEC,KAAM,CAAC;MACxB;IACD;IAEA,OAAOA,KAAK;EACb,CAAC;AACF;AAEA,eAAeL,gBAAgB","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/utils/with-weak-map-cache.js"],
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;",
6
+ "names": []
7
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.js"],"names":[],"mappings":"AAwBA;;;;;;;;;;GAUG;AACH,0CALW,MAAM,SACN,WAAY,OAUtB;AAED;;;;;;;;;GASG;AACH,0DAKC;AAED;;;;;;GAMG;AACH,kDAKC;AAED;;;;;;;;;;;GAWG;AACH,2CATW,MAAM,QACN,MAAM,WACN,WAAY,SACZ,UAAO,oBACN,OAAO,OAAA,sBACR,UAAO,QACP,UAAO,OA6CjB;AAED;;;;;;;;;GASG;AACH,4DAKC;AAED;;;;;;;;;GASG;AACH,kFAJW,MAAM,OAWhB;AAED;;;;;;;;;;GAUG;AACH,uEALW,MAAM,0BAchB;AAED;;;;;;;;;;GAUG;AACH,4EALW,MAAM,0BAchB;AAED;;;;;;GAMG;AACH,4CAQC;AAED;;;;;;;;;;;;GAYG;AACH,4DALW,MAAM,yBAkBhB;AAED;;;;;;;;;;;GAWG;AACH,yCALW,MAAM,WACN,GAAC,OAUX;AAooBD;;;;;;;;GAQG;AACH,+DAJW,OAAO,OAWjB;AAED;;;;;;;;;;;GAWG;AACH,2CALW,MAAM,aACN,OAAO,OAUjB;AAED;;;;;;;;;;;;;;GAcG;AACH;;QAKC;AAED;;;;;;;;;;;GAWG;AACH,yCALW,MAAM,aACN,WAAY,OAUtB;AAED;;;;;;GAMG;AACH,wDAHW,OAAO,OAQjB;AAED;;;;;;;GAOG;AACH,iEAJW,MAAM,OAUhB;AA/tBM,yCAZI,MAAM,QACN,MAAM,YACN,MAAM,GAAC,MAAM,SACb,UAAO,sCAGf;IAAgC,eAAe;IAGf,YAAY;CAE9C;;;mCAsEC;AAeK,uCATI,MAAM,QACN,MAAM,YACN,MAAM,GAAC,MAAM,wBAGrB;IAAgC,UAAU;CAE1C,OAyED;AAMK;;;WAWL;AAMK;;;WAWL;AAOK,iDAIL;AAgBK,uCAXI,MAAM,QACN,MAAM,gEAGd;IAA2B,UAAU;IACV,eAAe;IAGf,YAAY;CAEzC;;;;mBAwQC;AAwBK,sDAHK,CAAC,SAAS,KAAQ,iBAAY,CAuCxC;AAUK,6CALI,MAAM,QACN,MAAM,2BAEN,eAAO;;;;mBAyBhB;AAWK,6DANI,MAAM,QACN,MAAM,YACN,MAAM,GAAC,MAAM;;;;mBA8CtB;AA2HK,uCARI,MAAM,QACN,MAAM,aACN,MAAM,GAAC,MAAM,WACb,WAAY,SACZ,UAAO,oBACN,OAAO,OAAA,qBACR,UAAO;;;oBA0BhB"}
1
+ {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.js"],"names":[],"mappings":"AAwBA;;;;;;;;;;GAUG;AACH,0CALW,MAAM,SACN,WAAY,OAUtB;AAED;;;;;;;;;GASG;AACH,0DAKC;AAED;;;;;;GAMG;AACH,kDAKC;AAED;;;;;;;;;;;GAWG;AACH,2CATW,MAAM,QACN,MAAM,WACN,WAAY,SACZ,UAAO,oBACN,OAAO,OAAA,sBACR,UAAO,QACP,UAAO,OA6CjB;AAED;;;;;;;;;GASG;AACH,4DAKC;AAED;;;;;;;;;GASG;AACH,kFAJW,MAAM,OAWhB;AAED;;;;;;;;;;GAUG;AACH,uEALW,MAAM,0BAchB;AAED;;;;;;;;;;GAUG;AACH,4EALW,MAAM,0BAchB;AAED;;;;;;GAMG;AACH,4CAQC;AAED;;;;;;;;;;;;GAYG;AACH,4DALW,MAAM,yBAkBhB;AAED;;;;;;;;;;;GAWG;AACH,yCALW,MAAM,WACN,GAAC,OAUX;AAknBD;;;;;;;;GAQG;AACH,+DAJW,OAAO,OAWjB;AAED;;;;;;;;;;;GAWG;AACH,2CALW,MAAM,aACN,OAAO,OAUjB;AAED;;;;;;;;;;;;;;GAcG;AACH;;QAKC;AAED;;;;;;;;;;;GAWG;AACH,yCALW,MAAM,aACN,WAAY,OAUtB;AAED;;;;;;GAMG;AACH,wDAHW,OAAO,OAQjB;AAED;;;;;;;GAOG;AACH,iEAJW,MAAM,OAUhB;AA7sBM,yCAZI,MAAM,QACN,MAAM,YACN,MAAM,GAAC,MAAM,SACb,UAAO,sCAGf;IAAgC,eAAe;IAGf,YAAY;CAE9C;;;mCAkFC;AAeK,uCATI,MAAM,QACN,MAAM,YACN,MAAM,GAAC,MAAM,wBAGrB;IAAgC,UAAU;CAE1C,OAwED;AAMK;;;WAWL;AAMK;;;WAWL;AAOK,iDAIL;AAgBK,uCAXI,MAAM,QACN,MAAM,gEAGd;IAA2B,UAAU;IACV,eAAe;IAGf,YAAY;CAEzC;;;;mBA2OC;AAwBK,sDAHK,CAAC,SAAS,KAAQ,iBAAY,CAuCxC;AAUK,6CALI,MAAM,QACN,MAAM,2BAEN,eAAO;;;;mBAyBhB;AAWK,6DANI,MAAM,QACN,MAAM,YACN,MAAM,GAAC,MAAM;;;;mBA8CtB;AA2HK,uCARI,MAAM,QACN,MAAM,aACN,MAAM,GAAC,MAAM,WACb,WAAY,SACZ,UAAO,oBACN,OAAO,OAAA,qBACR,UAAO;;;oBA0BhB"}