@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,29 +1,32 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var on_sub_key_exports = {};
20
+ __export(on_sub_key_exports, {
21
+ default: () => on_sub_key_default,
22
+ onSubKey: () => onSubKey
5
23
  });
6
- exports.onSubKey = exports.default = void 0;
7
- /** @typedef {import('../types').AnyFunction} AnyFunction */
8
-
9
- /**
10
- * Higher-order reducer creator which creates a combined reducer object, keyed
11
- * by a property on the action object.
12
- *
13
- * @param {string} actionProperty Action property by which to key object.
14
- *
15
- * @return {AnyFunction} Higher-order reducer.
16
- */
17
- const onSubKey = actionProperty => reducer => (state = {}, action) => {
18
- // Retrieve subkey from action. Do not track if undefined; useful for cases
19
- // where reducer is scoped by action shape.
24
+ module.exports = __toCommonJS(on_sub_key_exports);
25
+ const onSubKey = (actionProperty) => (reducer) => (state = {}, action) => {
20
26
  const key = action[actionProperty];
21
- if (key === undefined) {
27
+ if (key === void 0) {
22
28
  return state;
23
29
  }
24
-
25
- // Avoid updating state if unchanged. Note that this also accounts for a
26
- // reducer which returns undefined on a key which is not yet tracked.
27
30
  const nextKeyState = reducer(state[key], action);
28
31
  if (nextKeyState === state[key]) {
29
32
  return state;
@@ -33,6 +36,9 @@ const onSubKey = actionProperty => reducer => (state = {}, action) => {
33
36
  [key]: nextKeyState
34
37
  };
35
38
  };
36
- exports.onSubKey = onSubKey;
37
- var _default = exports.default = onSubKey;
38
- //# sourceMappingURL=on-sub-key.js.map
39
+ var on_sub_key_default = onSubKey;
40
+ // Annotate the CommonJS export names for ESM import in node:
41
+ 0 && (module.exports = {
42
+ onSubKey
43
+ });
44
+ //# sourceMappingURL=on-sub-key.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["onSubKey","actionProperty","reducer","state","action","key","undefined","nextKeyState","exports","_default","default"],"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;AACO,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;AAACC,OAAA,CAAAR,QAAA,GAAAA,QAAA;AAAA,IAAAS,QAAA,GAAAD,OAAA,CAAAE,OAAA,GAEYV,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": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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,8 +1,31 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var receive_intermediate_results_exports = {};
20
+ __export(receive_intermediate_results_exports, {
21
+ RECEIVE_INTERMEDIATE_RESULTS: () => RECEIVE_INTERMEDIATE_RESULTS
5
22
  });
6
- exports.RECEIVE_INTERMEDIATE_RESULTS = void 0;
7
- const RECEIVE_INTERMEDIATE_RESULTS = exports.RECEIVE_INTERMEDIATE_RESULTS = Symbol('RECEIVE_INTERMEDIATE_RESULTS');
8
- //# sourceMappingURL=receive-intermediate-results.js.map
23
+ module.exports = __toCommonJS(receive_intermediate_results_exports);
24
+ const RECEIVE_INTERMEDIATE_RESULTS = Symbol(
25
+ "RECEIVE_INTERMEDIATE_RESULTS"
26
+ );
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ RECEIVE_INTERMEDIATE_RESULTS
30
+ });
31
+ //# sourceMappingURL=receive-intermediate-results.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["RECEIVE_INTERMEDIATE_RESULTS","exports","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":";;;;;;AAAO,MAAMA,4BAA4B,GAAAC,OAAA,CAAAD,4BAAA,GAAGE,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": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,+BAA+B;AAAA,EAC3C;AACD;",
6
+ "names": []
7
+ }
@@ -1,21 +1,28 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var replace_action_exports = {};
20
+ __export(replace_action_exports, {
21
+ default: () => replace_action_default
5
22
  });
6
- exports.default = void 0;
7
- /** @typedef {import('../types').AnyFunction} AnyFunction */
8
-
9
- /**
10
- * Higher-order reducer creator which substitutes the action object before
11
- * passing to the original reducer.
12
- *
13
- * @param {AnyFunction} replacer Function mapping original action to replacement.
14
- *
15
- * @return {AnyFunction} Higher-order reducer.
16
- */
17
- const replaceAction = replacer => reducer => (state, action) => {
23
+ module.exports = __toCommonJS(replace_action_exports);
24
+ const replaceAction = (replacer) => (reducer) => (state, action) => {
18
25
  return reducer(state, replacer(action));
19
26
  };
20
- var _default = exports.default = replaceAction;
21
- //# sourceMappingURL=replace-action.js.map
27
+ var replace_action_default = replaceAction;
28
+ //# sourceMappingURL=replace-action.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["replaceAction","replacer","reducer","state","action","_default","exports","default"],"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;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaP,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": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;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,38 +1,33 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var set_nested_value_exports = {};
20
+ __export(set_nested_value_exports, {
21
+ default: () => setNestedValue
5
22
  });
6
- exports.default = setNestedValue;
7
- /**
8
- * Sets the value at path of object.
9
- * If a portion of path doesn’t exist, it’s created.
10
- * Arrays are created for missing index properties while objects are created
11
- * for all other missing properties.
12
- *
13
- * Path is specified as either:
14
- * - a string of properties, separated by dots, for example: "x.y".
15
- * - an array of properties, for example `[ 'x', 'y' ]`.
16
- *
17
- * This function intentionally mutates the input object.
18
- *
19
- * Inspired by _.set().
20
- *
21
- * @see https://lodash.com/docs/4.17.15#set
22
- *
23
- * @todo Needs to be deduplicated with its copy in `@wordpress/edit-site`.
24
- *
25
- * @param {Object} object Object to modify
26
- * @param {Array|string} path Path of the property to set.
27
- * @param {*} value Value to set.
28
- */
23
+ module.exports = __toCommonJS(set_nested_value_exports);
29
24
  function setNestedValue(object, path, value) {
30
- if (!object || typeof object !== 'object') {
25
+ if (!object || typeof object !== "object") {
31
26
  return object;
32
27
  }
33
- const normalizedPath = Array.isArray(path) ? path : path.split('.');
28
+ const normalizedPath = Array.isArray(path) ? path : path.split(".");
34
29
  normalizedPath.reduce((acc, key, idx) => {
35
- if (acc[key] === undefined) {
30
+ if (acc[key] === void 0) {
36
31
  if (Number.isInteger(normalizedPath[idx + 1])) {
37
32
  acc[key] = [];
38
33
  } else {
@@ -46,4 +41,4 @@ function setNestedValue(object, path, value) {
46
41
  }, object);
47
42
  return object;
48
43
  }
49
- //# sourceMappingURL=set-nested-value.js.map
44
+ //# 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;AACe,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": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;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,44 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var user_permissions_exports = {};
20
+ __export(user_permissions_exports, {
21
+ ALLOWED_RESOURCE_ACTIONS: () => ALLOWED_RESOURCE_ACTIONS,
22
+ getUserPermissionCacheKey: () => getUserPermissionCacheKey,
23
+ getUserPermissionsFromAllowHeader: () => getUserPermissionsFromAllowHeader
5
24
  });
6
- exports.ALLOWED_RESOURCE_ACTIONS = void 0;
7
- exports.getUserPermissionCacheKey = getUserPermissionCacheKey;
8
- exports.getUserPermissionsFromAllowHeader = getUserPermissionsFromAllowHeader;
9
- const ALLOWED_RESOURCE_ACTIONS = exports.ALLOWED_RESOURCE_ACTIONS = ['create', 'read', 'update', 'delete'];
25
+ module.exports = __toCommonJS(user_permissions_exports);
26
+ const ALLOWED_RESOURCE_ACTIONS = [
27
+ "create",
28
+ "read",
29
+ "update",
30
+ "delete"
31
+ ];
10
32
  function getUserPermissionsFromAllowHeader(allowedMethods) {
11
33
  const permissions = {};
12
34
  if (!allowedMethods) {
13
35
  return permissions;
14
36
  }
15
37
  const methods = {
16
- create: 'POST',
17
- read: 'GET',
18
- update: 'PUT',
19
- delete: 'DELETE'
38
+ create: "POST",
39
+ read: "GET",
40
+ update: "PUT",
41
+ delete: "DELETE"
20
42
  };
21
43
  for (const [actionName, methodName] of Object.entries(methods)) {
22
44
  permissions[actionName] = allowedMethods.includes(methodName);
@@ -24,7 +46,13 @@ function getUserPermissionsFromAllowHeader(allowedMethods) {
24
46
  return permissions;
25
47
  }
26
48
  function getUserPermissionCacheKey(action, resource, id) {
27
- const key = (typeof resource === 'object' ? [action, resource.kind, resource.name, resource.id] : [action, resource, id]).filter(Boolean).join('/');
49
+ const key = (typeof resource === "object" ? [action, resource.kind, resource.name, resource.id] : [action, resource, id]).filter(Boolean).join("/");
28
50
  return key;
29
51
  }
30
- //# sourceMappingURL=user-permissions.js.map
52
+ // Annotate the CommonJS export names for ESM import in node:
53
+ 0 && (module.exports = {
54
+ ALLOWED_RESOURCE_ACTIONS,
55
+ getUserPermissionCacheKey,
56
+ getUserPermissionsFromAllowHeader
57
+ });
58
+ //# sourceMappingURL=user-permissions.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["ALLOWED_RESOURCE_ACTIONS","exports","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":";;;;;;;;AAAO,MAAMA,wBAAwB,GAAAC,OAAA,CAAAD,wBAAA,GAAG,CACvC,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,QAAQ,CACR;AAEM,SAASE,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;AAEO,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": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;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,36 +1,40 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var with_weak_map_cache_exports = {};
20
+ __export(with_weak_map_cache_exports, {
21
+ default: () => with_weak_map_cache_default
5
22
  });
6
- exports.default = void 0;
7
- /**
8
- * Given a function, returns an enhanced function which caches the result and
9
- * tracks in WeakMap. The result is only cached if the original function is
10
- * passed a valid object-like argument (requirement for WeakMap key).
11
- *
12
- * @param {Function} fn Original function.
13
- *
14
- * @return {Function} Enhanced caching function.
15
- */
23
+ module.exports = __toCommonJS(with_weak_map_cache_exports);
16
24
  function withWeakMapCache(fn) {
17
- const cache = new WeakMap();
18
- return key => {
25
+ const cache = /* @__PURE__ */ new WeakMap();
26
+ return (key) => {
19
27
  let value;
20
28
  if (cache.has(key)) {
21
29
  value = cache.get(key);
22
30
  } else {
23
31
  value = fn(key);
24
-
25
- // Can reach here if key is not valid for WeakMap, since `has`
26
- // will return false for invalid key. Since `set` will throw,
27
- // ensure that key is valid before setting into cache.
28
- if (key !== null && typeof key === 'object') {
32
+ if (key !== null && typeof key === "object") {
29
33
  cache.set(key, value);
30
34
  }
31
35
  }
32
36
  return value;
33
37
  };
34
38
  }
35
- var _default = exports.default = withWeakMapCache;
36
- //# sourceMappingURL=with-weak-map-cache.js.map
39
+ var with_weak_map_cache_default = withWeakMapCache;
40
+ //# sourceMappingURL=with-weak-map-cache.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["withWeakMapCache","fn","cache","WeakMap","key","value","has","get","set","_default","exports","default"],"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;AAAC,IAAAI,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcX,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": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;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
+ }