@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":["_data","require","_reducer","_interopRequireDefault","selectors","_interopRequireWildcard","privateSelectors","actions","privateActions","resolvers","_actions2","_entities","_name","_lockUnlock","_dynamicEntities","_logEntityDeprecation","_entityProvider","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_entityTypes","_fetch","_hooks","_privateApis","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","n","__proto__","a","getOwnPropertyDescriptor","u","i","set","entitiesConfig","rootEntitiesConfig","additionalEntityConfigLoaders","filter","config","name","entitySelectors","reduce","result","entity","kind","plural","getEntityRecordMethodName","getMethodName","state","query","logEntityDeprecation","isShorthandSelector","alternativeFunctionName","getEntityRecord","getEntityRecordsMethodName","getEntityRecords","entityResolvers","args","shouldInvalidate","action","entityActions","saveEntityRecordMethodName","record","options","saveEntityRecord","deleteEntityRecordMethodName","deleteEntityRecord","storeConfig","reducer","dynamicActions","createLocksActions","dynamicSelectors","store","createReduxStore","STORE_NAME","unlock","registerPrivateSelectors","registerPrivateActions","register"],"sources":["@wordpress/core-data/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as selectors from './selectors';\nimport * as privateSelectors from './private-selectors';\nimport * as actions from './actions';\nimport * as privateActions from './private-actions';\nimport * as resolvers from './resolvers';\nimport createLocksActions from './locks/actions';\nimport {\n\trootEntitiesConfig,\n\tadditionalEntityConfigLoaders,\n\tgetMethodName,\n} from './entities';\nimport { STORE_NAME } from './name';\nimport { unlock } from './lock-unlock';\nimport { dynamicActions, dynamicSelectors } from './dynamic-entities';\nimport logEntityDeprecation from './utils/log-entity-deprecation';\n\n// The entity selectors/resolvers and actions are shortcuts to their generic equivalents\n// (getEntityRecord, getEntityRecords, updateEntityRecord, updateEntityRecords)\n// Instead of getEntityRecord, the consumer could use more user-friendly named selector: getPostType, getTaxonomy...\n// The \"kind\" and the \"name\" of the entity are combined to generate these shortcuts.\nconst entitiesConfig = [\n\t...rootEntitiesConfig,\n\t...additionalEntityConfigLoaders.filter( ( config ) => !! config.name ),\n];\n\nconst entitySelectors = entitiesConfig.reduce( ( result, entity ) => {\n\tconst { kind, name, plural } = entity;\n\n\tconst getEntityRecordMethodName = getMethodName( kind, name );\n\tresult[ getEntityRecordMethodName ] = ( state, key, query ) => {\n\t\tlogEntityDeprecation( kind, name, getEntityRecordMethodName, {\n\t\t\tisShorthandSelector: true,\n\t\t\talternativeFunctionName: 'getEntityRecord',\n\t\t} );\n\t\treturn selectors.getEntityRecord( state, kind, name, key, query );\n\t};\n\n\tif ( plural ) {\n\t\tconst getEntityRecordsMethodName = getMethodName( kind, plural, 'get' );\n\t\tresult[ getEntityRecordsMethodName ] = ( state, query ) => {\n\t\t\tlogEntityDeprecation( kind, name, getEntityRecordsMethodName, {\n\t\t\t\tisShorthandSelector: true,\n\t\t\t\talternativeFunctionName: 'getEntityRecords',\n\t\t\t} );\n\t\t\treturn selectors.getEntityRecords( state, kind, name, query );\n\t\t};\n\t}\n\treturn result;\n}, {} );\n\nconst entityResolvers = entitiesConfig.reduce( ( result, entity ) => {\n\tconst { kind, name, plural } = entity;\n\tconst getEntityRecordMethodName = getMethodName( kind, name );\n\tresult[ getEntityRecordMethodName ] = ( key, query ) => {\n\t\tlogEntityDeprecation( kind, name, getEntityRecordMethodName, {\n\t\t\tisShorthandSelector: true,\n\t\t\talternativeFunctionName: 'getEntityRecord',\n\t\t} );\n\t\treturn resolvers.getEntityRecord( kind, name, key, query );\n\t};\n\n\tif ( plural ) {\n\t\tconst getEntityRecordsMethodName = getMethodName( kind, plural, 'get' );\n\t\tresult[ getEntityRecordsMethodName ] = ( ...args ) => {\n\t\t\tlogEntityDeprecation( kind, plural, getEntityRecordsMethodName, {\n\t\t\t\tisShorthandSelector: true,\n\t\t\t\talternativeFunctionName: 'getEntityRecords',\n\t\t\t} );\n\t\t\treturn resolvers.getEntityRecords( kind, name, ...args );\n\t\t};\n\t\tresult[ getEntityRecordsMethodName ].shouldInvalidate = ( action ) =>\n\t\t\tresolvers.getEntityRecords.shouldInvalidate( action, kind, name );\n\t}\n\treturn result;\n}, {} );\n\nconst entityActions = entitiesConfig.reduce( ( result, entity ) => {\n\tconst { kind, name } = entity;\n\n\tconst saveEntityRecordMethodName = getMethodName( kind, name, 'save' );\n\tresult[ saveEntityRecordMethodName ] = ( record, options ) => {\n\t\tlogEntityDeprecation( kind, name, saveEntityRecordMethodName, {\n\t\t\tisShorthandSelector: true,\n\t\t\talternativeFunctionName: 'saveEntityRecord',\n\t\t} );\n\t\treturn actions.saveEntityRecord( kind, name, record, options );\n\t};\n\n\tconst deleteEntityRecordMethodName = getMethodName( kind, name, 'delete' );\n\tresult[ deleteEntityRecordMethodName ] = ( key, query, options ) => {\n\t\tlogEntityDeprecation( kind, name, deleteEntityRecordMethodName, {\n\t\t\tisShorthandSelector: true,\n\t\t\talternativeFunctionName: 'deleteEntityRecord',\n\t\t} );\n\t\treturn actions.deleteEntityRecord( kind, name, key, query, options );\n\t};\n\n\treturn result;\n}, {} );\n\nconst storeConfig = () => ( {\n\treducer,\n\tactions: {\n\t\t...dynamicActions,\n\t\t...actions,\n\t\t...entityActions,\n\t\t...createLocksActions(),\n\t},\n\tselectors: {\n\t\t...dynamicSelectors,\n\t\t...selectors,\n\t\t...entitySelectors,\n\t},\n\tresolvers: { ...resolvers, ...entityResolvers },\n} );\n\n/**\n * Store definition for the code data namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n */\nexport const store = createReduxStore( STORE_NAME, storeConfig() );\nunlock( store ).registerPrivateSelectors( privateSelectors );\nunlock( store ).registerPrivateActions( privateActions );\nregister( store ); // Register store after unlocking private selectors to allow resolvers to use them.\n\nexport { default as EntityProvider } from './entity-provider';\nexport * from './entity-provider';\nexport * from './entity-types';\nexport * from './fetch';\nexport * from './hooks';\nexport * from './private-apis';\n"],"mappings":";;;;;;;;;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,SAAA,GAAAC,uBAAA,CAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAD,uBAAA,CAAAJ,OAAA;AACA,IAAAM,OAAA,GAAAF,uBAAA,CAAAJ,OAAA;AACA,IAAAO,cAAA,GAAAH,uBAAA,CAAAJ,OAAA;AACA,IAAAQ,SAAA,GAAAJ,uBAAA,CAAAJ,OAAA;AACA,IAAAS,SAAA,GAAAP,sBAAA,CAAAF,OAAA;AACA,IAAAU,SAAA,GAAAV,OAAA;AAKA,IAAAW,KAAA,GAAAX,OAAA;AACA,IAAAY,WAAA,GAAAZ,OAAA;AACA,IAAAa,gBAAA,GAAAb,OAAA;AACA,IAAAc,qBAAA,GAAAZ,sBAAA,CAAAF,OAAA;AAgHA,IAAAe,eAAA,GAAAX,uBAAA,CAAAJ,OAAA;AACAgB,MAAA,CAAAC,IAAA,CAAAF,eAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA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ore, register } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as selectors from './selectors';\nimport * as privateSelectors from './private-selectors';\nimport * as actions from './actions';\nimport * as privateActions from './private-actions';\nimport * as resolvers from './resolvers';\nimport createLocksActions from './locks/actions';\nimport {\n\trootEntitiesConfig,\n\tadditionalEntityConfigLoaders,\n\tgetMethodName,\n} from './entities';\nimport { STORE_NAME } from './name';\nimport { unlock } from './lock-unlock';\nimport { dynamicActions, dynamicSelectors } from './dynamic-entities';\nimport logEntityDeprecation from './utils/log-entity-deprecation';\n\n// The entity selectors/resolvers and actions are shortcuts to their generic equivalents\n// (getEntityRecord, getEntityRecords, updateEntityRecord, updateEntityRecords)\n// Instead of getEntityRecord, the consumer could use more user-friendly named selector: getPostType, getTaxonomy...\n// The \"kind\" and the \"name\" of the entity are combined to generate these shortcuts.\nconst entitiesConfig = [\n\t...rootEntitiesConfig,\n\t...additionalEntityConfigLoaders.filter( ( config ) => !! config.name ),\n];\n\nconst entitySelectors = entitiesConfig.reduce( ( result, entity ) => {\n\tconst { kind, name, plural } = entity;\n\n\tconst getEntityRecordMethodName = getMethodName( kind, name );\n\tresult[ getEntityRecordMethodName ] = ( state, key, query ) => {\n\t\tlogEntityDeprecation( kind, name, getEntityRecordMethodName, {\n\t\t\tisShorthandSelector: true,\n\t\t\talternativeFunctionName: 'getEntityRecord',\n\t\t} );\n\t\treturn selectors.getEntityRecord( state, kind, name, key, query );\n\t};\n\n\tif ( plural ) {\n\t\tconst getEntityRecordsMethodName = getMethodName( kind, plural, 'get' );\n\t\tresult[ getEntityRecordsMethodName ] = ( state, query ) => {\n\t\t\tlogEntityDeprecation( kind, name, getEntityRecordsMethodName, {\n\t\t\t\tisShorthandSelector: true,\n\t\t\t\talternativeFunctionName: 'getEntityRecords',\n\t\t\t} );\n\t\t\treturn selectors.getEntityRecords( state, kind, name, query );\n\t\t};\n\t}\n\treturn result;\n}, {} );\n\nconst entityResolvers = entitiesConfig.reduce( ( result, entity ) => {\n\tconst { kind, name, plural } = entity;\n\tconst getEntityRecordMethodName = getMethodName( kind, name );\n\tresult[ getEntityRecordMethodName ] = ( key, query ) => {\n\t\tlogEntityDeprecation( kind, name, getEntityRecordMethodName, {\n\t\t\tisShorthandSelector: true,\n\t\t\talternativeFunctionName: 'getEntityRecord',\n\t\t} );\n\t\treturn resolvers.getEntityRecord( kind, name, key, query );\n\t};\n\n\tif ( plural ) {\n\t\tconst getEntityRecordsMethodName = getMethodName( kind, plural, 'get' );\n\t\tresult[ getEntityRecordsMethodName ] = ( ...args ) => {\n\t\t\tlogEntityDeprecation( kind, plural, getEntityRecordsMethodName, {\n\t\t\t\tisShorthandSelector: true,\n\t\t\t\talternativeFunctionName: 'getEntityRecords',\n\t\t\t} );\n\t\t\treturn resolvers.getEntityRecords( kind, name, ...args );\n\t\t};\n\t\tresult[ getEntityRecordsMethodName ].shouldInvalidate = ( action ) =>\n\t\t\tresolvers.getEntityRecords.shouldInvalidate( action, kind, name );\n\t}\n\treturn result;\n}, {} );\n\nconst entityActions = entitiesConfig.reduce( ( result, entity ) => {\n\tconst { kind, name } = entity;\n\n\tconst saveEntityRecordMethodName = getMethodName( kind, name, 'save' );\n\tresult[ saveEntityRecordMethodName ] = ( record, options ) => {\n\t\tlogEntityDeprecation( kind, name, saveEntityRecordMethodName, {\n\t\t\tisShorthandSelector: true,\n\t\t\talternativeFunctionName: 'saveEntityRecord',\n\t\t} );\n\t\treturn actions.saveEntityRecord( kind, name, record, options );\n\t};\n\n\tconst deleteEntityRecordMethodName = getMethodName( kind, name, 'delete' );\n\tresult[ deleteEntityRecordMethodName ] = ( key, query, options ) => {\n\t\tlogEntityDeprecation( kind, name, deleteEntityRecordMethodName, {\n\t\t\tisShorthandSelector: true,\n\t\t\talternativeFunctionName: 'deleteEntityRecord',\n\t\t} );\n\t\treturn actions.deleteEntityRecord( kind, name, key, query, options );\n\t};\n\n\treturn result;\n}, {} );\n\nconst storeConfig = () => ( {\n\treducer,\n\tactions: {\n\t\t...dynamicActions,\n\t\t...actions,\n\t\t...entityActions,\n\t\t...createLocksActions(),\n\t},\n\tselectors: {\n\t\t...dynamicSelectors,\n\t\t...selectors,\n\t\t...entitySelectors,\n\t},\n\tresolvers: { ...resolvers, ...entityResolvers },\n} );\n\n/**\n * Store definition for the code data namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n */\nexport const store = createReduxStore( STORE_NAME, storeConfig() );\nunlock( store ).registerPrivateSelectors( privateSelectors );\nunlock( store ).registerPrivateActions( privateActions );\nregister( store ); // Register store after unlocking private selectors to allow resolvers to use them.\n\nexport { default as EntityProvider } from './entity-provider';\nexport * from './entity-provider';\nexport * from './entity-types';\nexport * from './fetch';\nexport * from './hooks';\nexport * from './private-apis';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA2C;AAK3C,qBAAoB;AACpB,gBAA2B;AAC3B,uBAAkC;AAClC,cAAyB;AACzB,qBAAgC;AAChC,gBAA2B;AAC3B,qBAA+B;AAC/B,sBAIO;AACP,kBAA2B;AAC3B,yBAAuB;AACvB,8BAAiD;AACjD,oCAAiC;AAgHjC,6BAA0C;AAC1C,0BAAc,8BAxId;AAyIA,0BAAc,2BAzId;AA0IA,0BAAc,oBA1Id;AA2IA,0BAAc,oBA3Id;AA4IA,0BAAc,2BA5Id;AA6BA,MAAM,iBAAiB;AAAA,EACtB,GAAG;AAAA,EACH,GAAG,8CAA8B,OAAQ,CAAE,WAAY,CAAC,CAAE,OAAO,IAAK;AACvE;AAEA,MAAM,kBAAkB,eAAe,OAAQ,CAAE,QAAQ,WAAY;AACpE,QAAM,EAAE,MAAM,MAAM,OAAO,IAAI;AAE/B,QAAM,gCAA4B,+BAAe,MAAM,IAAK;AAC5D,SAAQ,yBAA0B,IAAI,CAAE,OAAO,KAAK,UAAW;AAC9D,sCAAAA,SAAsB,MA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: 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 lock_unlock_exports = {};
20
+ __export(lock_unlock_exports, {
21
+ lock: () => lock,
22
+ unlock: () => unlock
5
23
  });
6
- exports.unlock = exports.lock = void 0;
7
- var _privateApis = require("@wordpress/private-apis");
8
- /**
9
- * WordPress dependencies
10
- */
11
-
12
- const {
24
+ module.exports = __toCommonJS(lock_unlock_exports);
25
+ var import_private_apis = require("@wordpress/private-apis");
26
+ const { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)(
27
+ "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
28
+ "@wordpress/core-data"
29
+ );
30
+ // Annotate the CommonJS export names for ESM import in node:
31
+ 0 && (module.exports = {
13
32
  lock,
14
33
  unlock
15
- } = (0, _privateApis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/core-data');
16
- exports.unlock = unlock;
17
- exports.lock = lock;
18
- //# sourceMappingURL=lock-unlock.js.map
34
+ });
35
+ //# sourceMappingURL=lock-unlock.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_privateApis","require","lock","unlock","__dangerousOptInToUnstableAPIsOnlyForCoreModules","exports"],"sources":["@wordpress/core-data/src/lock-unlock.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',\n\t\t'@wordpress/core-data'\n\t);\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGO,MAAM;EAAEC,IAAI;EAAEC;AAAO,CAAC,GAC5B,IAAAC,6DAAgD,EAC/C,+HAA+H,EAC/H,sBACD,CAAC;AAACC,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAAAE,OAAA,CAAAH,IAAA,GAAAA,IAAA","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/lock-unlock.ts"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',\n\t\t'@wordpress/core-data'\n\t);\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAAiE;AAE1D,MAAM,EAAE,MAAM,OAAO,QAC3B;AAAA,EACC;AAAA,EACA;AACD;",
6
+ "names": []
7
+ }
@@ -1,28 +1,45 @@
1
1
  "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var actions_exports = {};
30
+ __export(actions_exports, {
31
+ default: () => createLocksActions
6
32
  });
7
- exports.default = createLocksActions;
8
- var _engine = _interopRequireDefault(require("./engine"));
9
- /**
10
- * Internal dependencies
11
- */
12
-
33
+ module.exports = __toCommonJS(actions_exports);
34
+ var import_engine = __toESM(require("./engine"));
13
35
  function createLocksActions() {
14
- const locks = (0, _engine.default)();
15
- function __unstableAcquireStoreLock(store, path, {
16
- exclusive
17
- }) {
36
+ const locks = (0, import_engine.default)();
37
+ function __unstableAcquireStoreLock(store, path, { exclusive }) {
18
38
  return () => locks.acquire(store, path, exclusive);
19
39
  }
20
40
  function __unstableReleaseStoreLock(lock) {
21
41
  return () => locks.release(lock);
22
42
  }
23
- return {
24
- __unstableAcquireStoreLock,
25
- __unstableReleaseStoreLock
26
- };
43
+ return { __unstableAcquireStoreLock, __unstableReleaseStoreLock };
27
44
  }
28
- //# sourceMappingURL=actions.js.map
45
+ //# sourceMappingURL=actions.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_engine","_interopRequireDefault","require","createLocksActions","locks","createLocks","__unstableAcquireStoreLock","store","path","exclusive","acquire","__unstableReleaseStoreLock","lock","release"],"sources":["@wordpress/core-data/src/locks/actions.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport createLocks from './engine';\n\nexport default function createLocksActions() {\n\tconst locks = createLocks();\n\n\tfunction __unstableAcquireStoreLock( store, path, { exclusive } ) {\n\t\treturn () => locks.acquire( store, path, exclusive );\n\t}\n\n\tfunction __unstableReleaseStoreLock( lock ) {\n\t\treturn () => locks.release( lock );\n\t}\n\n\treturn { __unstableAcquireStoreLock, __unstableReleaseStoreLock };\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAHA;AACA;AACA;;AAGe,SAASC,kBAAkBA,CAAA,EAAG;EAC5C,MAAMC,KAAK,GAAG,IAAAC,eAAW,EAAC,CAAC;EAE3B,SAASC,0BAA0BA,CAAEC,KAAK,EAAEC,IAAI,EAAE;IAAEC;EAAU,CAAC,EAAG;IACjE,OAAO,MAAML,KAAK,CAACM,OAAO,CAAEH,KAAK,EAAEC,IAAI,EAAEC,SAAU,CAAC;EACrD;EAEA,SAASE,0BAA0BA,CAAEC,IAAI,EAAG;IAC3C,OAAO,MAAMR,KAAK,CAACS,OAAO,CAAED,IAAK,CAAC;EACnC;EAEA,OAAO;IAAEN,0BAA0B;IAAEK;EAA2B,CAAC;AAClE","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/locks/actions.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport createLocks from './engine';\n\nexport default function createLocksActions() {\n\tconst locks = createLocks();\n\n\tfunction __unstableAcquireStoreLock( store, path, { exclusive } ) {\n\t\treturn () => locks.acquire( store, path, exclusive );\n\t}\n\n\tfunction __unstableReleaseStoreLock( lock ) {\n\t\treturn () => locks.release( lock );\n\t}\n\n\treturn { __unstableAcquireStoreLock, __unstableReleaseStoreLock };\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAwB;AAET,SAAR,qBAAsC;AAC5C,QAAM,YAAQ,cAAAA,SAAY;AAE1B,WAAS,2BAA4B,OAAO,MAAM,EAAE,UAAU,GAAI;AACjE,WAAO,MAAM,MAAM,QAAS,OAAO,MAAM,SAAU;AAAA,EACpD;AAEA,WAAS,2BAA4B,MAAO;AAC3C,WAAO,MAAM,MAAM,QAAS,IAAK;AAAA,EAClC;AAEA,SAAO,EAAE,4BAA4B,2BAA2B;AACjE;",
6
+ "names": ["createLocks"]
7
+ }
@@ -1,38 +1,47 @@
1
1
  "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var engine_exports = {};
30
+ __export(engine_exports, {
31
+ default: () => createLocks
6
32
  });
7
- exports.default = createLocks;
8
- var _reducer = _interopRequireDefault(require("./reducer"));
9
- var _selectors = require("./selectors");
10
- /**
11
- * Internal dependencies
12
- */
13
-
33
+ module.exports = __toCommonJS(engine_exports);
34
+ var import_reducer = __toESM(require("./reducer"));
35
+ var import_selectors = require("./selectors");
14
36
  function createLocks() {
15
- let state = (0, _reducer.default)(undefined, {
16
- type: '@@INIT'
17
- });
37
+ let state = (0, import_reducer.default)(void 0, { type: "@@INIT" });
18
38
  function processPendingLockRequests() {
19
- for (const request of (0, _selectors.getPendingLockRequests)(state)) {
20
- const {
21
- store,
22
- path,
23
- exclusive,
24
- notifyAcquired
25
- } = request;
26
- if ((0, _selectors.isLockAvailable)(state, store, path, {
27
- exclusive
28
- })) {
29
- const lock = {
30
- store,
31
- path,
32
- exclusive
33
- };
34
- state = (0, _reducer.default)(state, {
35
- type: 'GRANT_LOCK_REQUEST',
39
+ for (const request of (0, import_selectors.getPendingLockRequests)(state)) {
40
+ const { store, path, exclusive, notifyAcquired } = request;
41
+ if ((0, import_selectors.isLockAvailable)(state, store, path, { exclusive })) {
42
+ const lock = { store, path, exclusive };
43
+ state = (0, import_reducer.default)(state, {
44
+ type: "GRANT_LOCK_REQUEST",
36
45
  lock,
37
46
  request
38
47
  });
@@ -41,29 +50,21 @@ function createLocks() {
41
50
  }
42
51
  }
43
52
  function acquire(store, path, exclusive) {
44
- return new Promise(resolve => {
45
- state = (0, _reducer.default)(state, {
46
- type: 'ENQUEUE_LOCK_REQUEST',
47
- request: {
48
- store,
49
- path,
50
- exclusive,
51
- notifyAcquired: resolve
52
- }
53
+ return new Promise((resolve) => {
54
+ state = (0, import_reducer.default)(state, {
55
+ type: "ENQUEUE_LOCK_REQUEST",
56
+ request: { store, path, exclusive, notifyAcquired: resolve }
53
57
  });
54
58
  processPendingLockRequests();
55
59
  });
56
60
  }
57
61
  function release(lock) {
58
- state = (0, _reducer.default)(state, {
59
- type: 'RELEASE_LOCK',
62
+ state = (0, import_reducer.default)(state, {
63
+ type: "RELEASE_LOCK",
60
64
  lock
61
65
  });
62
66
  processPendingLockRequests();
63
67
  }
64
- return {
65
- acquire,
66
- release
67
- };
68
+ return { acquire, release };
68
69
  }
69
- //# sourceMappingURL=engine.js.map
70
+ //# sourceMappingURL=engine.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_reducer","_interopRequireDefault","require","_selectors","createLocks","state","reducer","undefined","type","processPendingLockRequests","request","getPendingLockRequests","store","path","exclusive","notifyAcquired","isLockAvailable","lock","acquire","Promise","resolve","release"],"sources":["@wordpress/core-data/src/locks/engine.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport { isLockAvailable, getPendingLockRequests } from './selectors';\n\nexport default function createLocks() {\n\tlet state = reducer( undefined, { type: '@@INIT' } );\n\n\tfunction processPendingLockRequests() {\n\t\tfor ( const request of getPendingLockRequests( state ) ) {\n\t\t\tconst { store, path, exclusive, notifyAcquired } = request;\n\t\t\tif ( isLockAvailable( state, store, path, { exclusive } ) ) {\n\t\t\t\tconst lock = { store, path, exclusive };\n\t\t\t\tstate = reducer( state, {\n\t\t\t\t\ttype: 'GRANT_LOCK_REQUEST',\n\t\t\t\t\tlock,\n\t\t\t\t\trequest,\n\t\t\t\t} );\n\t\t\t\tnotifyAcquired( lock );\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction acquire( store, path, exclusive ) {\n\t\treturn new Promise( ( resolve ) => {\n\t\t\tstate = reducer( state, {\n\t\t\t\ttype: 'ENQUEUE_LOCK_REQUEST',\n\t\t\t\trequest: { store, path, exclusive, notifyAcquired: resolve },\n\t\t\t} );\n\t\t\tprocessPendingLockRequests();\n\t\t} );\n\t}\n\tfunction release( lock ) {\n\t\tstate = reducer( state, {\n\t\t\ttype: 'RELEASE_LOCK',\n\t\t\tlock,\n\t\t} );\n\t\tprocessPendingLockRequests();\n\t}\n\n\treturn { acquire, release };\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIe,SAASE,WAAWA,CAAA,EAAG;EACrC,IAAIC,KAAK,GAAG,IAAAC,gBAAO,EAAEC,SAAS,EAAE;IAAEC,IAAI,EAAE;EAAS,CAAE,CAAC;EAEpD,SAASC,0BAA0BA,CAAA,EAAG;IACrC,KAAM,MAAMC,OAAO,IAAI,IAAAC,iCAAsB,EAAEN,KAAM,CAAC,EAAG;MACxD,MAAM;QAAEO,KAAK;QAAEC,IAAI;QAAEC,SAAS;QAAEC;MAAe,CAAC,GAAGL,OAAO;MAC1D,IAAK,IAAAM,0BAAe,EAAEX,KAAK,EAAEO,KAAK,EAAEC,IAAI,EAAE;QAAEC;MAAU,CAAE,CAAC,EAAG;QAC3D,MAAMG,IAAI,GAAG;UAAEL,KAAK;UAAEC,IAAI;UAAEC;QAAU,CAAC;QACvCT,KAAK,GAAG,IAAAC,gBAAO,EAAED,KAAK,EAAE;UACvBG,IAAI,EAAE,oBAAoB;UAC1BS,IAAI;UACJP;QACD,CAAE,CAAC;QACHK,cAAc,CAAEE,IAAK,CAAC;MACvB;IACD;EACD;EAEA,SAASC,OAAOA,CAAEN,KAAK,EAAEC,IAAI,EAAEC,SAAS,EAAG;IAC1C,OAAO,IAAIK,OAAO,CAAIC,OAAO,IAAM;MAClCf,KAAK,GAAG,IAAAC,gBAAO,EAAED,KAAK,EAAE;QACvBG,IAAI,EAAE,sBAAsB;QAC5BE,OAAO,EAAE;UAAEE,KAAK;UAAEC,IAAI;UAAEC,SAAS;UAAEC,cAAc,EAAEK;QAAQ;MAC5D,CAAE,CAAC;MACHX,0BAA0B,CAAC,CAAC;IAC7B,CAAE,CAAC;EACJ;EACA,SAASY,OAAOA,CAAEJ,IAAI,EAAG;IACxBZ,KAAK,GAAG,IAAAC,gBAAO,EAAED,KAAK,EAAE;MACvBG,IAAI,EAAE,cAAc;MACpBS;IACD,CAAE,CAAC;IACHR,0BAA0B,CAAC,CAAC;EAC7B;EAEA,OAAO;IAAES,OAAO;IAAEG;EAAQ,CAAC;AAC5B","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/locks/engine.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport { isLockAvailable, getPendingLockRequests } from './selectors';\n\nexport default function createLocks() {\n\tlet state = reducer( undefined, { type: '@@INIT' } );\n\n\tfunction processPendingLockRequests() {\n\t\tfor ( const request of getPendingLockRequests( state ) ) {\n\t\t\tconst { store, path, exclusive, notifyAcquired } = request;\n\t\t\tif ( isLockAvailable( state, store, path, { exclusive } ) ) {\n\t\t\t\tconst lock = { store, path, exclusive };\n\t\t\t\tstate = reducer( state, {\n\t\t\t\t\ttype: 'GRANT_LOCK_REQUEST',\n\t\t\t\t\tlock,\n\t\t\t\t\trequest,\n\t\t\t\t} );\n\t\t\t\tnotifyAcquired( lock );\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction acquire( store, path, exclusive ) {\n\t\treturn new Promise( ( resolve ) => {\n\t\t\tstate = reducer( state, {\n\t\t\t\ttype: 'ENQUEUE_LOCK_REQUEST',\n\t\t\t\trequest: { store, path, exclusive, notifyAcquired: resolve },\n\t\t\t} );\n\t\t\tprocessPendingLockRequests();\n\t\t} );\n\t}\n\tfunction release( lock ) {\n\t\tstate = reducer( state, {\n\t\t\ttype: 'RELEASE_LOCK',\n\t\t\tlock,\n\t\t} );\n\t\tprocessPendingLockRequests();\n\t}\n\n\treturn { acquire, release };\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAoB;AACpB,uBAAwD;AAEzC,SAAR,cAA+B;AACrC,MAAI,YAAQ,eAAAA,SAAS,QAAW,EAAE,MAAM,SAAS,CAAE;AAEnD,WAAS,6BAA6B;AACrC,eAAY,eAAW,yCAAwB,KAAM,GAAI;AACxD,YAAM,EAAE,OAAO,MAAM,WAAW,eAAe,IAAI;AACnD,cAAK,kCAAiB,OAAO,OAAO,MAAM,EAAE,UAAU,CAAE,GAAI;AAC3D,cAAM,OAAO,EAAE,OAAO,MAAM,UAAU;AACtC,oBAAQ,eAAAA,SAAS,OAAO;AAAA,UACvB,MAAM;AAAA,UACN;AAAA,UACA;AAAA,QACD,CAAE;AACF,uBAAgB,IAAK;AAAA,MACtB;AAAA,IACD;AAAA,EACD;AAEA,WAAS,QAAS,OAAO,MAAM,WAAY;AAC1C,WAAO,IAAI,QAAS,CAAE,YAAa;AAClC,kBAAQ,eAAAA,SAAS,OAAO;AAAA,QACvB,MAAM;AAAA,QACN,SAAS,EAAE,OAAO,MAAM,WAAW,gBAAgB,QAAQ;AAAA,MAC5D,CAAE;AACF,iCAA2B;AAAA,IAC5B,CAAE;AAAA,EACH;AACA,WAAS,QAAS,MAAO;AACxB,gBAAQ,eAAAA,SAAS,OAAO;AAAA,MACvB,MAAM;AAAA,MACN;AAAA,IACD,CAAE;AACF,+BAA2B;AAAA,EAC5B;AAEA,SAAO,EAAE,SAAS,QAAQ;AAC3B;",
6
+ "names": ["reducer"]
7
+ }
@@ -1,14 +1,27 @@
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 reducer_exports = {};
20
+ __export(reducer_exports, {
21
+ default: () => locks
5
22
  });
6
- exports.default = locks;
7
- var _utils = require("./utils");
8
- /**
9
- * Internal dependencies
10
- */
11
-
23
+ module.exports = __toCommonJS(reducer_exports);
24
+ var import_utils = require("./utils");
12
25
  const DEFAULT_STATE = {
13
26
  requests: [],
14
27
  tree: {
@@ -16,62 +29,40 @@ const DEFAULT_STATE = {
16
29
  children: {}
17
30
  }
18
31
  };
19
-
20
- /**
21
- * Reducer returning locks.
22
- *
23
- * @param {Object} state Current state.
24
- * @param {Object} action Dispatched action.
25
- *
26
- * @return {Object} Updated state.
27
- */
28
32
  function locks(state = DEFAULT_STATE, action) {
29
33
  switch (action.type) {
30
- case 'ENQUEUE_LOCK_REQUEST':
31
- {
32
- const {
33
- request
34
- } = action;
35
- return {
36
- ...state,
37
- requests: [request, ...state.requests]
38
- };
39
- }
40
- case 'GRANT_LOCK_REQUEST':
41
- {
42
- const {
43
- lock,
44
- request
45
- } = action;
46
- const {
47
- store,
48
- path
49
- } = request;
50
- const storePath = [store, ...path];
51
- const newTree = (0, _utils.deepCopyLocksTreePath)(state.tree, storePath);
52
- const node = (0, _utils.getNode)(newTree, storePath);
53
- node.locks = [...node.locks, lock];
54
- return {
55
- ...state,
56
- requests: state.requests.filter(r => r !== request),
57
- tree: newTree
58
- };
59
- }
60
- case 'RELEASE_LOCK':
61
- {
62
- const {
63
- lock
64
- } = action;
65
- const storePath = [lock.store, ...lock.path];
66
- const newTree = (0, _utils.deepCopyLocksTreePath)(state.tree, storePath);
67
- const node = (0, _utils.getNode)(newTree, storePath);
68
- node.locks = node.locks.filter(l => l !== lock);
69
- return {
70
- ...state,
71
- tree: newTree
72
- };
73
- }
34
+ case "ENQUEUE_LOCK_REQUEST": {
35
+ const { request } = action;
36
+ return {
37
+ ...state,
38
+ requests: [request, ...state.requests]
39
+ };
40
+ }
41
+ case "GRANT_LOCK_REQUEST": {
42
+ const { lock, request } = action;
43
+ const { store, path } = request;
44
+ const storePath = [store, ...path];
45
+ const newTree = (0, import_utils.deepCopyLocksTreePath)(state.tree, storePath);
46
+ const node = (0, import_utils.getNode)(newTree, storePath);
47
+ node.locks = [...node.locks, lock];
48
+ return {
49
+ ...state,
50
+ requests: state.requests.filter((r) => r !== request),
51
+ tree: newTree
52
+ };
53
+ }
54
+ case "RELEASE_LOCK": {
55
+ const { lock } = action;
56
+ const storePath = [lock.store, ...lock.path];
57
+ const newTree = (0, import_utils.deepCopyLocksTreePath)(state.tree, storePath);
58
+ const node = (0, import_utils.getNode)(newTree, storePath);
59
+ node.locks = node.locks.filter((l) => l !== lock);
60
+ return {
61
+ ...state,
62
+ tree: newTree
63
+ };
64
+ }
74
65
  }
75
66
  return state;
76
67
  }
77
- //# sourceMappingURL=reducer.js.map
68
+ //# sourceMappingURL=reducer.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_utils","require","DEFAULT_STATE","requests","tree","locks","children","state","action","type","request","lock","store","path","storePath","newTree","deepCopyLocksTreePath","node","getNode","filter","r","l"],"sources":["@wordpress/core-data/src/locks/reducer.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { getNode, deepCopyLocksTreePath } from './utils';\n\nconst DEFAULT_STATE = {\n\trequests: [],\n\ttree: {\n\t\tlocks: [],\n\t\tchildren: {},\n\t},\n};\n\n/**\n * Reducer returning locks.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport default function locks( state = DEFAULT_STATE, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'ENQUEUE_LOCK_REQUEST': {\n\t\t\tconst { request } = action;\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\trequests: [ request, ...state.requests ],\n\t\t\t};\n\t\t}\n\t\tcase 'GRANT_LOCK_REQUEST': {\n\t\t\tconst { lock, request } = action;\n\t\t\tconst { store, path } = request;\n\t\t\tconst storePath = [ store, ...path ];\n\n\t\t\tconst newTree = deepCopyLocksTreePath( state.tree, storePath );\n\t\t\tconst node = getNode( newTree, storePath );\n\t\t\tnode.locks = [ ...node.locks, lock ];\n\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\trequests: state.requests.filter( ( r ) => r !== request ),\n\t\t\t\ttree: newTree,\n\t\t\t};\n\t\t}\n\t\tcase 'RELEASE_LOCK': {\n\t\t\tconst { lock } = action;\n\t\t\tconst storePath = [ lock.store, ...lock.path ];\n\n\t\t\tconst newTree = deepCopyLocksTreePath( state.tree, storePath );\n\t\t\tconst node = getNode( newTree, storePath );\n\t\t\tnode.locks = node.locks.filter( ( l ) => l !== lock );\n\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\ttree: newTree,\n\t\t\t};\n\t\t}\n\t}\n\n\treturn state;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA,MAAMC,aAAa,GAAG;EACrBC,QAAQ,EAAE,EAAE;EACZC,IAAI,EAAE;IACLC,KAAK,EAAE,EAAE;IACTC,QAAQ,EAAE,CAAC;EACZ;AACD,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASD,KAAKA,CAAEE,KAAK,GAAGL,aAAa,EAAEM,MAAM,EAAG;EAC9D,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,sBAAsB;MAAE;QAC5B,MAAM;UAAEC;QAAQ,CAAC,GAAGF,MAAM;QAC1B,OAAO;UACN,GAAGD,KAAK;UACRJ,QAAQ,EAAE,CAAE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+ "sources": ["../../src/locks/reducer.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { getNode, deepCopyLocksTreePath } from './utils';\n\nconst DEFAULT_STATE = {\n\trequests: [],\n\ttree: {\n\t\tlocks: [],\n\t\tchildren: {},\n\t},\n};\n\n/**\n * Reducer returning locks.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport default function locks( state = DEFAULT_STATE, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'ENQUEUE_LOCK_REQUEST': {\n\t\t\tconst { request } = action;\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\trequests: [ request, ...state.requests ],\n\t\t\t};\n\t\t}\n\t\tcase 'GRANT_LOCK_REQUEST': {\n\t\t\tconst { lock, request } = action;\n\t\t\tconst { store, path } = request;\n\t\t\tconst storePath = [ store, ...path ];\n\n\t\t\tconst newTree = deepCopyLocksTreePath( state.tree, storePath );\n\t\t\tconst node = getNode( newTree, storePath );\n\t\t\tnode.locks = [ ...node.locks, lock ];\n\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\trequests: state.requests.filter( ( r ) => r !== request ),\n\t\t\t\ttree: newTree,\n\t\t\t};\n\t\t}\n\t\tcase 'RELEASE_LOCK': {\n\t\t\tconst { lock } = action;\n\t\t\tconst storePath = [ lock.store, ...lock.path ];\n\n\t\t\tconst newTree = deepCopyLocksTreePath( state.tree, storePath );\n\t\t\tconst node = getNode( newTree, storePath );\n\t\t\tnode.locks = node.locks.filter( ( l ) => l !== lock );\n\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\ttree: newTree,\n\t\t\t};\n\t\t}\n\t}\n\n\treturn state;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAA+C;AAE/C,MAAM,gBAAgB;AAAA,EACrB,UAAU,CAAC;AAAA,EACX,MAAM;AAAA,IACL,OAAO,CAAC;AAAA,IACR,UAAU,CAAC;AAAA,EACZ;AACD;AAUe,SAAR,MAAwB,QAAQ,eAAe,QAAS;AAC9D,UAAS,OAAO,MAAO;AAAA,IACtB,KAAK,wBAAwB;AAC5B,YAAM,EAAE,QAAQ,IAAI;AACpB,aAAO;AAAA,QACN,GAAG;AAAA,QACH,UAAU,CAAE,SAAS,GAAG,MAAM,QAAS;AAAA,MACxC;AAAA,IACD;AAAA,IACA,KAAK,sBAAsB;AAC1B,YAAM,EAAE,MAAM,QAAQ,IAAI;AAC1B,YAAM,EAAE,OAAO,KAAK,IAAI;AACxB,YAAM,YAAY,CAAE,OAAO,GAAG,IAAK;AAEnC,YAAM,cAAU,oCAAuB,MAAM,MAAM,SAAU;AAC7D,YAAM,WAAO,sBAAS,SAAS,SAAU;AACzC,WAAK,QAAQ,CAAE,GAAG,KAAK,OAAO,IAAK;AAEnC,aAAO;AAAA,QACN,GAAG;AAAA,QACH,UAAU,MAAM,SAAS,OAAQ,CAAE,MAAO,MAAM,OAAQ;AAAA,QACxD,MAAM;AAAA,MACP;AAAA,IACD;AAAA,IACA,KAAK,gBAAgB;AACpB,YAAM,EAAE,KAAK,IAAI;AACjB,YAAM,YAAY,CAAE,KAAK,OAAO,GAAG,KAAK,IAAK;AAE7C,YAAM,cAAU,oCAAuB,MAAM,MAAM,SAAU;AAC7D,YAAM,WAAO,sBAAS,SAAS,SAAU;AACzC,WAAK,QAAQ,KAAK,MAAM,OAAQ,CAAE,MAAO,MAAM,IAAK;AAEpD,aAAO;AAAA,QACN,GAAG;AAAA,QACH,MAAM;AAAA,MACP;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AACR;",
6
+ "names": []
7
+ }
@@ -1,48 +1,53 @@
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 selectors_exports = {};
20
+ __export(selectors_exports, {
21
+ getPendingLockRequests: () => getPendingLockRequests,
22
+ isLockAvailable: () => isLockAvailable
5
23
  });
6
- exports.getPendingLockRequests = getPendingLockRequests;
7
- exports.isLockAvailable = isLockAvailable;
8
- var _utils = require("./utils");
9
- /**
10
- * Internal dependencies
11
- */
12
-
24
+ module.exports = __toCommonJS(selectors_exports);
25
+ var import_utils = require("./utils");
13
26
  function getPendingLockRequests(state) {
14
27
  return state.requests;
15
28
  }
16
- function isLockAvailable(state, store, path, {
17
- exclusive
18
- }) {
29
+ function isLockAvailable(state, store, path, { exclusive }) {
19
30
  const storePath = [store, ...path];
20
31
  const locks = state.tree;
21
-
22
- // Validate all parents and the node itself
23
- for (const node of (0, _utils.iteratePath)(locks, storePath)) {
24
- if ((0, _utils.hasConflictingLock)({
25
- exclusive
26
- }, node.locks)) {
32
+ for (const node2 of (0, import_utils.iteratePath)(locks, storePath)) {
33
+ if ((0, import_utils.hasConflictingLock)({ exclusive }, node2.locks)) {
27
34
  return false;
28
35
  }
29
36
  }
30
-
31
- // iteratePath terminates early if path is unreachable, let's
32
- // re-fetch the node and check it exists in the tree.
33
- const node = (0, _utils.getNode)(locks, storePath);
37
+ const node = (0, import_utils.getNode)(locks, storePath);
34
38
  if (!node) {
35
39
  return true;
36
40
  }
37
-
38
- // Validate all nested nodes
39
- for (const descendant of (0, _utils.iterateDescendants)(node)) {
40
- if ((0, _utils.hasConflictingLock)({
41
- exclusive
42
- }, descendant.locks)) {
41
+ for (const descendant of (0, import_utils.iterateDescendants)(node)) {
42
+ if ((0, import_utils.hasConflictingLock)({ exclusive }, descendant.locks)) {
43
43
  return false;
44
44
  }
45
45
  }
46
46
  return true;
47
47
  }
48
- //# sourceMappingURL=selectors.js.map
48
+ // Annotate the CommonJS export names for ESM import in node:
49
+ 0 && (module.exports = {
50
+ getPendingLockRequests,
51
+ isLockAvailable
52
+ });
53
+ //# sourceMappingURL=selectors.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_utils","require","getPendingLockRequests","state","requests","isLockAvailable","store","path","exclusive","storePath","locks","tree","node","iteratePath","hasConflictingLock","getNode","descendant","iterateDescendants"],"sources":["@wordpress/core-data/src/locks/selectors.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\titerateDescendants,\n\titeratePath,\n\thasConflictingLock,\n\tgetNode,\n} from './utils';\n\nexport function getPendingLockRequests( state ) {\n\treturn state.requests;\n}\n\nexport function isLockAvailable( state, store, path, { exclusive } ) {\n\tconst storePath = [ store, ...path ];\n\tconst locks = state.tree;\n\n\t// Validate all parents and the node itself\n\tfor ( const node of iteratePath( locks, storePath ) ) {\n\t\tif ( hasConflictingLock( { exclusive }, node.locks ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t// iteratePath terminates early if path is unreachable, let's\n\t// re-fetch the node and check it exists in the tree.\n\tconst node = getNode( locks, storePath );\n\tif ( ! node ) {\n\t\treturn true;\n\t}\n\n\t// Validate all nested nodes\n\tfor ( const descendant of iterateDescendants( node ) ) {\n\t\tif ( hasConflictingLock( { exclusive }, descendant.locks ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAQO,SAASC,sBAAsBA,CAAEC,KAAK,EAAG;EAC/C,OAAOA,KAAK,CAACC,QAAQ;AACtB;AAEO,SAASC,eAAeA,CAAEF,KAAK,EAAEG,KAAK,EAAEC,IAAI,EAAE;EAAEC;AAAU,CAAC,EAAG;EACpE,MAAMC,SAAS,GAAG,CAAEH,KAAK,EAAE,GAAGC,IAAI,CAAE;EACpC,MAAMG,KAAK,GAAGP,KAAK,CAACQ,IAAI;;EAExB;EACA,KAAM,MAAMC,IAAI,IAAI,IAAAC,kBAAW,EAAEH,KAAK,EAAED,SAAU,CAAC,EAAG;IACrD,IAAK,IAAAK,yBAAkB,EAAE;MAAEN;IAAU,CAAC,EAAEI,IAAI,CAACF,KAAM,CAAC,EAAG;MACtD,OAAO,KAAK;IACb;EACD;;EAEA;EACA;EACA,MAAME,IAAI,GAAG,IAAAG,cAAO,EAAEL,KAAK,EAAED,SAAU,CAAC;EACxC,IAAK,CAAEG,IAAI,EAAG;IACb,OAAO,IAAI;EACZ;;EAEA;EACA,KAAM,MAAMI,UAAU,IAAI,IAAAC,yBAAkB,EAAEL,IAAK,CAAC,EAAG;IACtD,IAAK,IAAAE,yBAAkB,EAAE;MAAEN;IAAU,CAAC,EAAEQ,UAAU,CAACN,KAAM,CAAC,EAAG;MAC5D,OAAO,KAAK;IACb;EACD;EAEA,OAAO,IAAI;AACZ","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/locks/selectors.js"],
4
+ "sourcesContent": ["/**\n * Internal dependencies\n */\nimport {\n\titerateDescendants,\n\titeratePath,\n\thasConflictingLock,\n\tgetNode,\n} from './utils';\n\nexport function getPendingLockRequests( state ) {\n\treturn state.requests;\n}\n\nexport function isLockAvailable( state, store, path, { exclusive } ) {\n\tconst storePath = [ store, ...path ];\n\tconst locks = state.tree;\n\n\t// Validate all parents and the node itself\n\tfor ( const node of iteratePath( locks, storePath ) ) {\n\t\tif ( hasConflictingLock( { exclusive }, node.locks ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t// iteratePath terminates early if path is unreachable, let's\n\t// re-fetch the node and check it exists in the tree.\n\tconst node = getNode( locks, storePath );\n\tif ( ! node ) {\n\t\treturn true;\n\t}\n\n\t// Validate all nested nodes\n\tfor ( const descendant of iterateDescendants( node ) ) {\n\t\tif ( hasConflictingLock( { exclusive }, descendant.locks ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAKO;AAEA,SAAS,uBAAwB,OAAQ;AAC/C,SAAO,MAAM;AACd;AAEO,SAAS,gBAAiB,OAAO,OAAO,MAAM,EAAE,UAAU,GAAI;AACpE,QAAM,YAAY,CAAE,OAAO,GAAG,IAAK;AACnC,QAAM,QAAQ,MAAM;AAGpB,aAAYA,aAAQ,0BAAa,OAAO,SAAU,GAAI;AACrD,YAAK,iCAAoB,EAAE,UAAU,GAAGA,MAAK,KAAM,GAAI;AACtD,aAAO;AAAA,IACR;AAAA,EACD;AAIA,QAAM,WAAO,sBAAS,OAAO,SAAU;AACvC,MAAK,CAAE,MAAO;AACb,WAAO;AAAA,EACR;AAGA,aAAY,kBAAc,iCAAoB,IAAK,GAAI;AACtD,YAAK,iCAAoB,EAAE,UAAU,GAAG,WAAW,KAAM,GAAI;AAC5D,aAAO;AAAA,IACR;AAAA,EACD;AAEA,SAAO;AACR;",
6
+ "names": ["node"]
7
+ }