@wordpress/core-data 6.16.0 → 6.17.1

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 (236) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/actions.js +69 -134
  3. package/build/actions.js.map +1 -1
  4. package/build/batch/create-batch.js +0 -22
  5. package/build/batch/create-batch.js.map +1 -1
  6. package/build/batch/default-processor.js +3 -15
  7. package/build/batch/default-processor.js.map +1 -1
  8. package/build/batch/index.js +0 -3
  9. package/build/batch/index.js.map +1 -1
  10. package/build/entities.js +109 -36
  11. package/build/entities.js.map +1 -1
  12. package/build/entity-provider.js +34 -53
  13. package/build/entity-provider.js.map +1 -1
  14. package/build/entity-types/attachment.js.map +1 -1
  15. package/build/entity-types/base-entity-records.js +0 -3
  16. package/build/entity-types/base-entity-records.js.map +1 -1
  17. package/build/entity-types/comment.js.map +1 -1
  18. package/build/entity-types/helpers.js.map +1 -1
  19. package/build/entity-types/index.js.map +1 -1
  20. package/build/entity-types/menu-location.js.map +1 -1
  21. package/build/entity-types/nav-menu-item.js.map +1 -1
  22. package/build/entity-types/nav-menu.js.map +1 -1
  23. package/build/entity-types/page.js.map +1 -1
  24. package/build/entity-types/plugin.js.map +1 -1
  25. package/build/entity-types/post.js.map +1 -1
  26. package/build/entity-types/settings.js.map +1 -1
  27. package/build/entity-types/sidebar.js.map +1 -1
  28. package/build/entity-types/taxonomy.js.map +1 -1
  29. package/build/entity-types/theme.js.map +1 -1
  30. package/build/entity-types/type.js.map +1 -1
  31. package/build/entity-types/user.js.map +1 -1
  32. package/build/entity-types/widget-type.js.map +1 -1
  33. package/build/entity-types/widget.js.map +1 -1
  34. package/build/entity-types/wp-template-part.js.map +1 -1
  35. package/build/entity-types/wp-template.js.map +1 -1
  36. package/build/fetch/__experimental-fetch-link-suggestions.js +14 -20
  37. package/build/fetch/__experimental-fetch-link-suggestions.js.map +1 -1
  38. package/build/fetch/__experimental-fetch-url-data.js +4 -13
  39. package/build/fetch/__experimental-fetch-url-data.js.map +1 -1
  40. package/build/fetch/index.js +0 -3
  41. package/build/fetch/index.js.map +1 -1
  42. package/build/hooks/constants.js +4 -5
  43. package/build/hooks/constants.js.map +1 -1
  44. package/build/hooks/index.js +0 -5
  45. package/build/hooks/index.js.map +1 -1
  46. package/build/hooks/memoize.js +0 -3
  47. package/build/hooks/memoize.js.map +1 -1
  48. package/build/hooks/use-entity-record.js +0 -9
  49. package/build/hooks/use-entity-record.js.map +1 -1
  50. package/build/hooks/use-entity-records.js +2 -9
  51. package/build/hooks/use-entity-records.js.map +1 -1
  52. package/build/hooks/use-query-select.js +1 -13
  53. package/build/hooks/use-query-select.js.map +1 -1
  54. package/build/hooks/use-resource-permissions.js +0 -15
  55. package/build/hooks/use-resource-permissions.js.map +1 -1
  56. package/build/index.js +9 -41
  57. package/build/index.js.map +1 -1
  58. package/build/locks/actions.js +1 -6
  59. package/build/locks/actions.js.map +1 -1
  60. package/build/locks/engine.js +1 -9
  61. package/build/locks/engine.js.map +1 -1
  62. package/build/locks/reducer.js +8 -9
  63. package/build/locks/reducer.js.map +1 -1
  64. package/build/locks/selectors.js +8 -11
  65. package/build/locks/selectors.js.map +1 -1
  66. package/build/locks/utils.js +4 -19
  67. package/build/locks/utils.js.map +1 -1
  68. package/build/name.js +0 -1
  69. package/build/name.js.map +1 -1
  70. package/build/private-apis.js +1 -2
  71. package/build/private-apis.js.map +1 -1
  72. package/build/private-selectors.js +2 -5
  73. package/build/private-selectors.js.map +1 -1
  74. package/build/queried-data/actions.js +4 -6
  75. package/build/queried-data/actions.js.map +1 -1
  76. package/build/queried-data/get-query-parts.js +11 -24
  77. package/build/queried-data/get-query-parts.js.map +1 -1
  78. package/build/queried-data/index.js +0 -6
  79. package/build/queried-data/index.js.map +1 -1
  80. package/build/queried-data/reducer.js +33 -51
  81. package/build/queried-data/reducer.js.map +1 -1
  82. package/build/queried-data/selectors.js +4 -25
  83. package/build/queried-data/selectors.js.map +1 -1
  84. package/build/reducer.js +76 -128
  85. package/build/reducer.js.map +1 -1
  86. package/build/resolvers.js +91 -133
  87. package/build/resolvers.js.map +1 -1
  88. package/build/selectors.js +51 -145
  89. package/build/selectors.js.map +1 -1
  90. package/build/sync.js +19 -0
  91. package/build/sync.js.map +1 -0
  92. package/build/types.js.map +1 -1
  93. package/build/utils/conservative-map-item.js +3 -10
  94. package/build/utils/conservative-map-item.js.map +1 -1
  95. package/build/utils/forward-resolver.js +0 -2
  96. package/build/utils/forward-resolver.js.map +1 -1
  97. package/build/utils/get-normalized-comma-separable.js +0 -3
  98. package/build/utils/get-normalized-comma-separable.js.map +1 -1
  99. package/build/utils/if-matching-action.js +0 -3
  100. package/build/utils/if-matching-action.js.map +1 -1
  101. package/build/utils/index.js +0 -10
  102. package/build/utils/index.js.map +1 -1
  103. package/build/utils/is-raw-attribute.js +0 -1
  104. package/build/utils/is-raw-attribute.js.map +1 -1
  105. package/build/utils/on-sub-key.js +5 -9
  106. package/build/utils/on-sub-key.js.map +1 -1
  107. package/build/utils/replace-action.js +0 -2
  108. package/build/utils/replace-action.js.map +1 -1
  109. package/build/utils/set-nested-value.js +0 -4
  110. package/build/utils/set-nested-value.js.map +1 -1
  111. package/build/utils/with-weak-map-cache.js +3 -6
  112. package/build/utils/with-weak-map-cache.js.map +1 -1
  113. package/build-module/actions.js +72 -95
  114. package/build-module/actions.js.map +1 -1
  115. package/build-module/batch/create-batch.js +1 -20
  116. package/build-module/batch/create-batch.js.map +1 -1
  117. package/build-module/batch/default-processor.js +4 -13
  118. package/build-module/batch/default-processor.js.map +1 -1
  119. package/build-module/batch/index.js.map +1 -1
  120. package/build-module/entities.js +109 -25
  121. package/build-module/entities.js.map +1 -1
  122. package/build-module/entity-provider.js +35 -45
  123. package/build-module/entity-provider.js.map +1 -1
  124. package/build-module/entity-types/attachment.js.map +1 -1
  125. package/build-module/entity-types/base-entity-records.js +0 -2
  126. package/build-module/entity-types/base-entity-records.js.map +1 -1
  127. package/build-module/entity-types/comment.js.map +1 -1
  128. package/build-module/entity-types/helpers.js.map +1 -1
  129. package/build-module/entity-types/index.js.map +1 -1
  130. package/build-module/entity-types/menu-location.js.map +1 -1
  131. package/build-module/entity-types/nav-menu-item.js.map +1 -1
  132. package/build-module/entity-types/nav-menu.js.map +1 -1
  133. package/build-module/entity-types/page.js.map +1 -1
  134. package/build-module/entity-types/plugin.js.map +1 -1
  135. package/build-module/entity-types/post.js.map +1 -1
  136. package/build-module/entity-types/settings.js.map +1 -1
  137. package/build-module/entity-types/sidebar.js.map +1 -1
  138. package/build-module/entity-types/taxonomy.js.map +1 -1
  139. package/build-module/entity-types/theme.js.map +1 -1
  140. package/build-module/entity-types/type.js.map +1 -1
  141. package/build-module/entity-types/user.js.map +1 -1
  142. package/build-module/entity-types/widget-type.js.map +1 -1
  143. package/build-module/entity-types/widget.js.map +1 -1
  144. package/build-module/entity-types/wp-template-part.js.map +1 -1
  145. package/build-module/entity-types/wp-template.js.map +1 -1
  146. package/build-module/fetch/__experimental-fetch-link-suggestions.js +15 -15
  147. package/build-module/fetch/__experimental-fetch-link-suggestions.js.map +1 -1
  148. package/build-module/fetch/__experimental-fetch-url-data.js +5 -10
  149. package/build-module/fetch/__experimental-fetch-url-data.js.map +1 -1
  150. package/build-module/fetch/index.js.map +1 -1
  151. package/build-module/hooks/constants.js +3 -4
  152. package/build-module/hooks/constants.js.map +1 -1
  153. package/build-module/hooks/index.js.map +1 -1
  154. package/build-module/hooks/memoize.js +2 -1
  155. package/build-module/hooks/memoize.js.map +1 -1
  156. package/build-module/hooks/use-entity-record.js +1 -3
  157. package/build-module/hooks/use-entity-record.js.map +1 -1
  158. package/build-module/hooks/use-entity-records.js +2 -3
  159. package/build-module/hooks/use-entity-records.js.map +1 -1
  160. package/build-module/hooks/use-query-select.js +1 -9
  161. package/build-module/hooks/use-query-select.js.map +1 -1
  162. package/build-module/hooks/use-resource-permissions.js +1 -10
  163. package/build-module/hooks/use-resource-permissions.js.map +1 -1
  164. package/build-module/index.js +11 -19
  165. package/build-module/index.js.map +1 -1
  166. package/build-module/locks/actions.js +0 -3
  167. package/build-module/locks/actions.js.map +1 -1
  168. package/build-module/locks/engine.js +0 -5
  169. package/build-module/locks/engine.js.map +1 -1
  170. package/build-module/locks/reducer.js +7 -7
  171. package/build-module/locks/reducer.js.map +1 -1
  172. package/build-module/locks/selectors.js +7 -8
  173. package/build-module/locks/selectors.js.map +1 -1
  174. package/build-module/locks/utils.js +4 -14
  175. package/build-module/locks/utils.js.map +1 -1
  176. package/build-module/name.js.map +1 -1
  177. package/build-module/private-apis.js.map +1 -1
  178. package/build-module/private-selectors.js +2 -2
  179. package/build-module/private-selectors.js.map +1 -1
  180. package/build-module/queried-data/actions.js +4 -3
  181. package/build-module/queried-data/actions.js.map +1 -1
  182. package/build-module/queried-data/get-query-parts.js +13 -21
  183. package/build-module/queried-data/get-query-parts.js.map +1 -1
  184. package/build-module/queried-data/index.js.map +1 -1
  185. package/build-module/queried-data/reducer.js +33 -42
  186. package/build-module/queried-data/reducer.js.map +1 -1
  187. package/build-module/queried-data/selectors.js +6 -21
  188. package/build-module/queried-data/selectors.js.map +1 -1
  189. package/build-module/reducer.js +79 -104
  190. package/build-module/reducer.js.map +1 -1
  191. package/build-module/resolvers.js +94 -96
  192. package/build-module/resolvers.js.map +1 -1
  193. package/build-module/selectors.js +56 -92
  194. package/build-module/selectors.js.map +1 -1
  195. package/build-module/sync.js +12 -0
  196. package/build-module/sync.js.map +1 -0
  197. package/build-module/types.js.map +1 -1
  198. package/build-module/utils/conservative-map-item.js +4 -8
  199. package/build-module/utils/conservative-map-item.js.map +1 -1
  200. package/build-module/utils/forward-resolver.js +0 -1
  201. package/build-module/utils/forward-resolver.js.map +1 -1
  202. package/build-module/utils/get-normalized-comma-separable.js +0 -2
  203. package/build-module/utils/get-normalized-comma-separable.js.map +1 -1
  204. package/build-module/utils/if-matching-action.js +0 -2
  205. package/build-module/utils/if-matching-action.js.map +1 -1
  206. package/build-module/utils/index.js.map +1 -1
  207. package/build-module/utils/is-raw-attribute.js.map +1 -1
  208. package/build-module/utils/on-sub-key.js +5 -7
  209. package/build-module/utils/on-sub-key.js.map +1 -1
  210. package/build-module/utils/replace-action.js +0 -1
  211. package/build-module/utils/replace-action.js.map +1 -1
  212. package/build-module/utils/set-nested-value.js +0 -3
  213. package/build-module/utils/set-nested-value.js.map +1 -1
  214. package/build-module/utils/with-weak-map-cache.js +3 -5
  215. package/build-module/utils/with-weak-map-cache.js.map +1 -1
  216. package/build-types/actions.d.ts.map +1 -1
  217. package/build-types/entities.d.ts +53 -0
  218. package/build-types/entities.d.ts.map +1 -1
  219. package/build-types/entity-provider.d.ts +1 -1
  220. package/build-types/entity-provider.d.ts.map +1 -1
  221. package/build-types/hooks/memoize.d.ts +1 -1
  222. package/build-types/hooks/memoize.d.ts.map +1 -1
  223. package/build-types/index.d.ts +3 -3
  224. package/build-types/index.d.ts.map +1 -1
  225. package/build-types/resolvers.d.ts.map +1 -1
  226. package/build-types/sync.d.ts +2 -0
  227. package/build-types/sync.d.ts.map +1 -0
  228. package/package.json +17 -15
  229. package/src/actions.js +24 -14
  230. package/src/entities.js +91 -0
  231. package/src/entity-provider.js +11 -2
  232. package/src/resolvers.js +89 -41
  233. package/src/sync.js +18 -0
  234. package/src/test/entity-provider.js +272 -0
  235. package/tsconfig.json +1 -0
  236. package/tsconfig.tsbuildinfo +1 -1
package/build/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -16,29 +15,17 @@ Object.defineProperty(exports, "EntityProvider", {
16
15
  }
17
16
  });
18
17
  exports.store = void 0;
19
-
20
18
  var _data = require("@wordpress/data");
21
-
22
19
  var _reducer = _interopRequireDefault(require("./reducer"));
23
-
24
20
  var selectors = _interopRequireWildcard(require("./selectors"));
25
-
26
21
  var privateSelectors = _interopRequireWildcard(require("./private-selectors"));
27
-
28
22
  var actions = _interopRequireWildcard(require("./actions"));
29
-
30
23
  var resolvers = _interopRequireWildcard(require("./resolvers"));
31
-
32
24
  var _actions2 = _interopRequireDefault(require("./locks/actions"));
33
-
34
25
  var _entities = require("./entities");
35
-
36
26
  var _name = require("./name");
37
-
38
27
  var _privateApis = require("./private-apis");
39
-
40
28
  var _entityProvider = _interopRequireWildcard(require("./entity-provider"));
41
-
42
29
  Object.keys(_entityProvider).forEach(function (key) {
43
30
  if (key === "default" || key === "__esModule") return;
44
31
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -50,9 +37,7 @@ Object.keys(_entityProvider).forEach(function (key) {
50
37
  }
51
38
  });
52
39
  });
53
-
54
40
  var _entityTypes = require("./entity-types");
55
-
56
41
  Object.keys(_entityTypes).forEach(function (key) {
57
42
  if (key === "default" || key === "__esModule") return;
58
43
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -64,9 +49,7 @@ Object.keys(_entityTypes).forEach(function (key) {
64
49
  }
65
50
  });
66
51
  });
67
-
68
52
  var _fetch = require("./fetch");
69
-
70
53
  Object.keys(_fetch).forEach(function (key) {
71
54
  if (key === "default" || key === "__esModule") return;
72
55
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -78,9 +61,7 @@ Object.keys(_fetch).forEach(function (key) {
78
61
  }
79
62
  });
80
63
  });
81
-
82
64
  var _hooks = require("./hooks");
83
-
84
65
  Object.keys(_hooks).forEach(function (key) {
85
66
  if (key === "default" || key === "__esModule") return;
86
67
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
@@ -92,11 +73,8 @@ Object.keys(_hooks).forEach(function (key) {
92
73
  }
93
74
  });
94
75
  });
95
-
96
76
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
97
-
98
77
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
99
-
100
78
  /**
101
79
  * WordPress dependencies
102
80
  */
@@ -104,73 +82,63 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
104
82
  /**
105
83
  * Internal dependencies
106
84
  */
85
+
107
86
  // The entity selectors/resolvers and actions are shortcuts to their generic equivalents
108
87
  // (getEntityRecord, getEntityRecords, updateEntityRecord, updateEntityRecords)
109
88
  // Instead of getEntityRecord, the consumer could use more user-friendly named selector: getPostType, getTaxonomy...
110
89
  // The "kind" and the "name" of the entity are combined to generate these shortcuts.
90
+
111
91
  const entitySelectors = _entities.rootEntitiesConfig.reduce((result, entity) => {
112
92
  const {
113
93
  kind,
114
94
  name
115
95
  } = entity;
116
-
117
96
  result[(0, _entities.getMethodName)(kind, name)] = (state, key, query) => selectors.getEntityRecord(state, kind, name, key, query);
118
-
119
97
  result[(0, _entities.getMethodName)(kind, name, 'get', true)] = (state, query) => selectors.getEntityRecords(state, kind, name, query);
120
-
121
98
  return result;
122
99
  }, {});
123
-
124
100
  const entityResolvers = _entities.rootEntitiesConfig.reduce((result, entity) => {
125
101
  const {
126
102
  kind,
127
103
  name
128
104
  } = entity;
129
-
130
105
  result[(0, _entities.getMethodName)(kind, name)] = (key, query) => resolvers.getEntityRecord(kind, name, key, query);
131
-
132
106
  const pluralMethodName = (0, _entities.getMethodName)(kind, name, 'get', true);
133
-
134
107
  result[pluralMethodName] = (...args) => resolvers.getEntityRecords(kind, name, ...args);
135
-
136
108
  result[pluralMethodName].shouldInvalidate = action => resolvers.getEntityRecords.shouldInvalidate(action, kind, name);
137
-
138
109
  return result;
139
110
  }, {});
140
-
141
111
  const entityActions = _entities.rootEntitiesConfig.reduce((result, entity) => {
142
112
  const {
143
113
  kind,
144
114
  name
145
115
  } = entity;
146
-
147
116
  result[(0, _entities.getMethodName)(kind, name, 'save')] = key => actions.saveEntityRecord(kind, name, key);
148
-
149
117
  result[(0, _entities.getMethodName)(kind, name, 'delete')] = (key, query) => actions.deleteEntityRecord(kind, name, key, query);
150
-
151
118
  return result;
152
119
  }, {});
153
-
154
120
  const storeConfig = () => ({
155
121
  reducer: _reducer.default,
156
- actions: { ...actions,
122
+ actions: {
123
+ ...actions,
157
124
  ...entityActions,
158
125
  ...(0, _actions2.default)()
159
126
  },
160
- selectors: { ...selectors,
127
+ selectors: {
128
+ ...selectors,
161
129
  ...entitySelectors
162
130
  },
163
- resolvers: { ...resolvers,
131
+ resolvers: {
132
+ ...resolvers,
164
133
  ...entityResolvers
165
134
  }
166
135
  });
136
+
167
137
  /**
168
138
  * Store definition for the code data namespace.
169
139
  *
170
140
  * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
171
141
  */
172
-
173
-
174
142
  const store = (0, _data.createReduxStore)(_name.STORE_NAME, storeConfig());
175
143
  exports.store = store;
176
144
  (0, _privateApis.unlock)(store).registerPrivateSelectors(privateSelectors);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/core-data/src/index.js"],"names":["entitySelectors","rootEntitiesConfig","reduce","result","entity","kind","name","state","key","query","selectors","getEntityRecord","getEntityRecords","entityResolvers","resolvers","pluralMethodName","args","shouldInvalidate","action","entityActions","actions","saveEntityRecord","deleteEntityRecord","storeConfig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,EAAwCE,GAAxC,EAA6CC,KAA7C,CADD;;AAEA,SAAON,MAAP;AACA,CAPqB,EAOnB,EAPmB,CAAtB;;AASA,MAAMoB,WAAW,GAAG,OAAQ;AAC3BC,EAAAA,OAAO,EAAPA,gBAD2B;AAE3BJ,EAAAA,OAAO,EAAE,EAAE,GAAGA,OAAL;AAAc,OAAGD,aAAjB;AAAgC,OAAG;AAAnC,GAFkB;AAG3BT,EAAAA,SAAS,EAAE,EAAE,GAAGA,SAAL;AAAgB,OAAGV;AAAnB,GAHgB;AAI3Bc,EAAAA,SAAS,EAAE,EAAE,GAAGA,SAAL;AAAgB,OAAGD;AAAnB;AAJgB,CAAR,CAApB;AAOA;AACA;AACA;AACA;AACA;;;AACO,MAAMY,KAAK,GAAG,4BAAkBC,gBAAlB,EAA8BH,WAAW,EAAzC,CAAd;;AACP,yBAAQE,KAAR,EAAgBE,wBAAhB,CAA0CC,gBAA1C;AACA,oBAAUH,KAAV,E,CAAmB","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 resolvers from './resolvers';\nimport createLocksActions from './locks/actions';\nimport { rootEntitiesConfig, getMethodName } from './entities';\nimport { STORE_NAME } from './name';\nimport { unlock } from './private-apis';\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.\n\nconst entitySelectors = rootEntitiesConfig.reduce( ( result, entity ) => {\n\tconst { kind, name } = entity;\n\tresult[ getMethodName( kind, name ) ] = ( state, key, query ) =>\n\t\tselectors.getEntityRecord( state, kind, name, key, query );\n\tresult[ getMethodName( kind, name, 'get', true ) ] = ( state, query ) =>\n\t\tselectors.getEntityRecords( state, kind, name, query );\n\treturn result;\n}, {} );\n\nconst entityResolvers = rootEntitiesConfig.reduce( ( result, entity ) => {\n\tconst { kind, name } = entity;\n\tresult[ getMethodName( kind, name ) ] = ( key, query ) =>\n\t\tresolvers.getEntityRecord( kind, name, key, query );\n\tconst pluralMethodName = getMethodName( kind, name, 'get', true );\n\tresult[ pluralMethodName ] = ( ...args ) =>\n\t\tresolvers.getEntityRecords( kind, name, ...args );\n\tresult[ pluralMethodName ].shouldInvalidate = ( action ) =>\n\t\tresolvers.getEntityRecords.shouldInvalidate( action, kind, name );\n\treturn result;\n}, {} );\n\nconst entityActions = rootEntitiesConfig.reduce( ( result, entity ) => {\n\tconst { kind, name } = entity;\n\tresult[ getMethodName( kind, name, 'save' ) ] = ( key ) =>\n\t\tactions.saveEntityRecord( kind, name, key );\n\tresult[ getMethodName( kind, name, 'delete' ) ] = ( key, query ) =>\n\t\tactions.deleteEntityRecord( kind, name, key, query );\n\treturn result;\n}, {} );\n\nconst storeConfig = () => ( {\n\treducer,\n\tactions: { ...actions, ...entityActions, ...createLocksActions() },\n\tselectors: { ...selectors, ...entitySelectors },\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 );\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';\n"]}
1
+ {"version":3,"names":["_data","require","_reducer","_interopRequireDefault","selectors","_interopRequireWildcard","privateSelectors","actions","resolvers","_actions2","_entities","_name","_privateApis","_entityProvider","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_entityTypes","_fetch","_hooks","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","newObj","hasPropertyDescriptor","getOwnPropertyDescriptor","desc","set","entitySelectors","rootEntitiesConfig","reduce","result","entity","kind","name","getMethodName","state","query","getEntityRecord","getEntityRecords","entityResolvers","pluralMethodName","args","shouldInvalidate","action","entityActions","saveEntityRecord","deleteEntityRecord","storeConfig","reducer","createLocksActions","store","createReduxStore","STORE_NAME","unlock","registerPrivateSelectors","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 resolvers from './resolvers';\nimport createLocksActions from './locks/actions';\nimport { rootEntitiesConfig, getMethodName } from './entities';\nimport { STORE_NAME } from './name';\nimport { unlock } from './private-apis';\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.\n\nconst entitySelectors = rootEntitiesConfig.reduce( ( result, entity ) => {\n\tconst { kind, name } = entity;\n\tresult[ getMethodName( kind, name ) ] = ( state, key, query ) =>\n\t\tselectors.getEntityRecord( state, kind, name, key, query );\n\tresult[ getMethodName( kind, name, 'get', true ) ] = ( state, query ) =>\n\t\tselectors.getEntityRecords( state, kind, name, query );\n\treturn result;\n}, {} );\n\nconst entityResolvers = rootEntitiesConfig.reduce( ( result, entity ) => {\n\tconst { kind, name } = entity;\n\tresult[ getMethodName( kind, name ) ] = ( key, query ) =>\n\t\tresolvers.getEntityRecord( kind, name, key, query );\n\tconst pluralMethodName = getMethodName( kind, name, 'get', true );\n\tresult[ pluralMethodName ] = ( ...args ) =>\n\t\tresolvers.getEntityRecords( kind, name, ...args );\n\tresult[ pluralMethodName ].shouldInvalidate = ( action ) =>\n\t\tresolvers.getEntityRecords.shouldInvalidate( action, kind, name );\n\treturn result;\n}, {} );\n\nconst entityActions = rootEntitiesConfig.reduce( ( result, entity ) => {\n\tconst { kind, name } = entity;\n\tresult[ getMethodName( kind, name, 'save' ) ] = ( key ) =>\n\t\tactions.saveEntityRecord( kind, name, key );\n\tresult[ getMethodName( kind, name, 'delete' ) ] = ( key, query ) =>\n\t\tactions.deleteEntityRecord( kind, name, key, query );\n\treturn result;\n}, {} );\n\nconst storeConfig = () => ( {\n\treducer,\n\tactions: { ...actions, ...entityActions, ...createLocksActions() },\n\tselectors: { ...selectors, ...entitySelectors },\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 );\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';\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,SAAA,GAAAH,uBAAA,CAAAJ,OAAA;AACA,IAAAQ,SAAA,GAAAN,sBAAA,CAAAF,OAAA;AACA,IAAAS,SAAA,GAAAT,OAAA;AACA,IAAAU,KAAA,GAAAV,OAAA;AACA,IAAAW,YAAA,GAAAX,OAAA;AAqDA,IAAAY,eAAA,GAA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ACrD,OAAON,MAAM;AACd,CAAC,EAAE,CAAC,CAAE,CAAC;AAEP,MAAMiB,WAAW,GAAGA,CAAA,MAAQ;EAC3BC,OAAO,EAAPA,gBAAO;EACP1D,OAAO,EAAE;IAAE,GAAGA,OAAO;IAAE,GAAGsD,aAAa;IAAE,GAAG,IAAAK,iBAAkB,EAAC;EAAE,CAAC;EAClE9D,SAAS,EAAE;IAAE,GAAGA,SAAS;IAAE,GAAGwC;EAAgB,CAAC;EAC/CpC,SAAS,EAAE;IAAE,GAAGA,SAAS;IAAE,GAAGgD;EAAgB;AAC/C,CAAC,CAAE;;AAEH;AACA;AACA;AACA;AACA;AACO,MAAMW,KAAK,GAAG,IAAAC,sBAAgB,EAAEC,gBAAU,EAAEL,WAAW,CAAC,CAAE,CAAC;AAAC1C,OAAA,CAAA6C,KAAA,GAAAA,KAAA;AACnE,IAAAG,mBAAM,EAAEH,KAAM,CAAC,CAACI,wBAAwB,CAAEjE,gBAAiB,CAAC;AAC5D,IAAAkE,cAAQ,EAAEL,KAAM,CAAC,CAAC,CAAC"}
@@ -1,30 +1,25 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = createLocksActions;
9
-
10
8
  var _engine = _interopRequireDefault(require("./engine"));
11
-
12
9
  /**
13
10
  * Internal dependencies
14
11
  */
12
+
15
13
  function createLocksActions() {
16
14
  const locks = (0, _engine.default)();
17
-
18
15
  function __unstableAcquireStoreLock(store, path, {
19
16
  exclusive
20
17
  }) {
21
18
  return () => locks.acquire(store, path, exclusive);
22
19
  }
23
-
24
20
  function __unstableReleaseStoreLock(lock) {
25
21
  return () => locks.release(lock);
26
22
  }
27
-
28
23
  return {
29
24
  __unstableAcquireStoreLock,
30
25
  __unstableReleaseStoreLock
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/core-data/src/locks/actions.js"],"names":["createLocksActions","locks","__unstableAcquireStoreLock","store","path","exclusive","acquire","__unstableReleaseStoreLock","lock","release"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;AAGe,SAASA,kBAAT,GAA8B;AAC5C,QAAMC,KAAK,GAAG,sBAAd;;AAEA,WAASC,0BAAT,CAAqCC,KAArC,EAA4CC,IAA5C,EAAkD;AAAEC,IAAAA;AAAF,GAAlD,EAAkE;AACjE,WAAO,MAAMJ,KAAK,CAACK,OAAN,CAAeH,KAAf,EAAsBC,IAAtB,EAA4BC,SAA5B,CAAb;AACA;;AAED,WAASE,0BAAT,CAAqCC,IAArC,EAA4C;AAC3C,WAAO,MAAMP,KAAK,CAACQ,OAAN,CAAeD,IAAf,CAAb;AACA;;AAED,SAAO;AAAEN,IAAAA,0BAAF;AAA8BK,IAAAA;AAA9B,GAAP;AACA","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"]}
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"}
@@ -1,24 +1,20 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = createLocks;
9
-
10
8
  var _reducer = _interopRequireDefault(require("./reducer"));
11
-
12
9
  var _selectors = require("./selectors");
13
-
14
10
  /**
15
11
  * Internal dependencies
16
12
  */
13
+
17
14
  function createLocks() {
18
15
  let state = (0, _reducer.default)(undefined, {
19
16
  type: '@@INIT'
20
17
  });
21
-
22
18
  function processPendingLockRequests() {
23
19
  for (const request of (0, _selectors.getPendingLockRequests)(state)) {
24
20
  const {
@@ -27,7 +23,6 @@ function createLocks() {
27
23
  exclusive,
28
24
  notifyAcquired
29
25
  } = request;
30
-
31
26
  if ((0, _selectors.isLockAvailable)(state, store, path, {
32
27
  exclusive
33
28
  })) {
@@ -45,7 +40,6 @@ function createLocks() {
45
40
  }
46
41
  }
47
42
  }
48
-
49
43
  function acquire(store, path, exclusive) {
50
44
  return new Promise(resolve => {
51
45
  state = (0, _reducer.default)(state, {
@@ -60,7 +54,6 @@ function createLocks() {
60
54
  processPendingLockRequests();
61
55
  });
62
56
  }
63
-
64
57
  function release(lock) {
65
58
  state = (0, _reducer.default)(state, {
66
59
  type: 'RELEASE_LOCK',
@@ -68,7 +61,6 @@ function createLocks() {
68
61
  });
69
62
  processPendingLockRequests();
70
63
  }
71
-
72
64
  return {
73
65
  acquire,
74
66
  release
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/core-data/src/locks/engine.js"],"names":["createLocks","state","undefined","type","processPendingLockRequests","request","store","path","exclusive","notifyAcquired","lock","acquire","Promise","resolve","release"],"mappings":";;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIe,SAASA,WAAT,GAAuB;AACrC,MAAIC,KAAK,GAAG,sBAASC,SAAT,EAAoB;AAAEC,IAAAA,IAAI,EAAE;AAAR,GAApB,CAAZ;;AAEA,WAASC,0BAAT,GAAsC;AACrC,SAAM,MAAMC,OAAZ,IAAuB,uCAAwBJ,KAAxB,CAAvB,EAAyD;AACxD,YAAM;AAAEK,QAAAA,KAAF;AAASC,QAAAA,IAAT;AAAeC,QAAAA,SAAf;AAA0BC,QAAAA;AAA1B,UAA6CJ,OAAnD;;AACA,UAAK,gCAAiBJ,KAAjB,EAAwBK,KAAxB,EAA+BC,IAA/B,EAAqC;AAAEC,QAAAA;AAAF,OAArC,CAAL,EAA4D;AAC3D,cAAME,IAAI,GAAG;AAAEJ,UAAAA,KAAF;AAASC,UAAAA,IAAT;AAAeC,UAAAA;AAAf,SAAb;AACAP,QAAAA,KAAK,GAAG,sBAASA,KAAT,EAAgB;AACvBE,UAAAA,IAAI,EAAE,oBADiB;AAEvBO,UAAAA,IAFuB;AAGvBL,UAAAA;AAHuB,SAAhB,CAAR;AAKAI,QAAAA,cAAc,CAAEC,IAAF,CAAd;AACA;AACD;AACD;;AAED,WAASC,OAAT,CAAkBL,KAAlB,EAAyBC,IAAzB,EAA+BC,SAA/B,EAA2C;AAC1C,WAAO,IAAII,OAAJ,CAAeC,OAAF,IAAe;AAClCZ,MAAAA,KAAK,GAAG,sBAASA,KAAT,EAAgB;AACvBE,QAAAA,IAAI,EAAE,sBADiB;AAEvBE,QAAAA,OAAO,EAAE;AAAEC,UAAAA,KAAF;AAASC,UAAAA,IAAT;AAAeC,UAAAA,SAAf;AAA0BC,UAAAA,cAAc,EAAEI;AAA1C;AAFc,OAAhB,CAAR;AAIAT,MAAAA,0BAA0B;AAC1B,KANM,CAAP;AAOA;;AACD,WAASU,OAAT,CAAkBJ,IAAlB,EAAyB;AACxBT,IAAAA,KAAK,GAAG,sBAASA,KAAT,EAAgB;AACvBE,MAAAA,IAAI,EAAE,cADiB;AAEvBO,MAAAA;AAFuB,KAAhB,CAAR;AAIAN,IAAAA,0BAA0B;AAC1B;;AAED,SAAO;AAAEO,IAAAA,OAAF;AAAWG,IAAAA;AAAX,GAAP;AACA","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"]}
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,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true
5
5
  });
6
6
  exports.default = locks;
7
-
8
7
  var _utils = require("./utils");
9
-
10
8
  /**
11
9
  * Internal dependencies
12
10
  */
11
+
13
12
  const DEFAULT_STATE = {
14
13
  requests: [],
15
14
  tree: {
@@ -17,6 +16,7 @@ const DEFAULT_STATE = {
17
16
  children: {}
18
17
  }
19
18
  };
19
+
20
20
  /**
21
21
  * Reducer returning locks.
22
22
  *
@@ -25,7 +25,6 @@ const DEFAULT_STATE = {
25
25
  *
26
26
  * @return {Object} Updated state.
27
27
  */
28
-
29
28
  function locks(state = DEFAULT_STATE, action) {
30
29
  switch (action.type) {
31
30
  case 'ENQUEUE_LOCK_REQUEST':
@@ -33,11 +32,11 @@ function locks(state = DEFAULT_STATE, action) {
33
32
  const {
34
33
  request
35
34
  } = action;
36
- return { ...state,
35
+ return {
36
+ ...state,
37
37
  requests: [request, ...state.requests]
38
38
  };
39
39
  }
40
-
41
40
  case 'GRANT_LOCK_REQUEST':
42
41
  {
43
42
  const {
@@ -52,12 +51,12 @@ function locks(state = DEFAULT_STATE, action) {
52
51
  const newTree = (0, _utils.deepCopyLocksTreePath)(state.tree, storePath);
53
52
  const node = (0, _utils.getNode)(newTree, storePath);
54
53
  node.locks = [...node.locks, lock];
55
- return { ...state,
54
+ return {
55
+ ...state,
56
56
  requests: state.requests.filter(r => r !== request),
57
57
  tree: newTree
58
58
  };
59
59
  }
60
-
61
60
  case 'RELEASE_LOCK':
62
61
  {
63
62
  const {
@@ -67,12 +66,12 @@ function locks(state = DEFAULT_STATE, action) {
67
66
  const newTree = (0, _utils.deepCopyLocksTreePath)(state.tree, storePath);
68
67
  const node = (0, _utils.getNode)(newTree, storePath);
69
68
  node.locks = node.locks.filter(l => l !== lock);
70
- return { ...state,
69
+ return {
70
+ ...state,
71
71
  tree: newTree
72
72
  };
73
73
  }
74
74
  }
75
-
76
75
  return state;
77
76
  }
78
77
  //# sourceMappingURL=reducer.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/core-data/src/locks/reducer.js"],"names":["DEFAULT_STATE","requests","tree","locks","children","state","action","type","request","lock","store","path","storePath","newTree","node","filter","r","l"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGA,MAAMA,aAAa,GAAG;AACrBC,EAAAA,QAAQ,EAAE,EADW;AAErBC,EAAAA,IAAI,EAAE;AACLC,IAAAA,KAAK,EAAE,EADF;AAELC,IAAAA,QAAQ,EAAE;AAFL;AAFe,CAAtB;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACe,SAASD,KAAT,CAAgBE,KAAK,GAAGL,aAAxB,EAAuCM,MAAvC,EAAgD;AAC9D,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,sBAAL;AAA6B;AAC5B,cAAM;AAAEC,UAAAA;AAAF,YAAcF,MAApB;AACA,eAAO,EACN,GAAGD,KADG;AAENJ,UAAAA,QAAQ,EAAE,CAAEO,OAAF,EAAW,GAAGH,KAAK,CAACJ,QAApB;AAFJ,SAAP;AAIA;;AACD,SAAK,oBAAL;AAA2B;AAC1B,cAAM;AAAEQ,UAAAA,IAAF;AAAQD,UAAAA;AAAR,YAAoBF,MAA1B;AACA,cAAM;AAAEI,UAAAA,KAAF;AAASC,UAAAA;AAAT,YAAkBH,OAAxB;AACA,cAAMI,SAAS,GAAG,CAAEF,KAAF,EAAS,GAAGC,IAAZ,CAAlB;AAEA,cAAME,OAAO,GAAG,kCAAuBR,KAAK,CAACH,IAA7B,EAAmCU,SAAnC,CAAhB;AACA,cAAME,IAAI,GAAG,oBAASD,OAAT,EAAkBD,SAAlB,CAAb;AACAE,QAAAA,IAAI,CAACX,KAAL,GAAa,CAAE,GAAGW,IAAI,CAACX,KAAV,EAAiBM,IAAjB,CAAb;AAEA,eAAO,EACN,GAAGJ,KADG;AAENJ,UAAAA,QAAQ,EAAEI,KAAK,CAACJ,QAAN,CAAec,MAAf,CAAyBC,CAAF,IAASA,CAAC,KAAKR,OAAtC,CAFJ;AAGNN,UAAAA,IAAI,EAAEW;AAHA,SAAP;AAKA;;AACD,SAAK,cAAL;AAAqB;AACpB,cAAM;AAAEJ,UAAAA;AAAF,YAAWH,MAAjB;AACA,cAAMM,SAAS,GAAG,CAAEH,IAAI,CAACC,KAAP,EAAc,GAAGD,IAAI,CAACE,IAAtB,CAAlB;AAEA,cAAME,OAAO,GAAG,kCAAuBR,KAAK,CAACH,IAA7B,EAAmCU,SAAnC,CAAhB;AACA,cAAME,IAAI,GAAG,oBAASD,OAAT,EAAkBD,SAAlB,CAAb;AACAE,QAAAA,IAAI,CAACX,KAAL,GAAaW,IAAI,CAACX,KAAL,CAAWY,MAAX,CAAqBE,CAAF,IAASA,CAAC,KAAKR,IAAlC,CAAb;AAEA,eAAO,EACN,GAAGJ,KADG;AAENH,UAAAA,IAAI,EAAEW;AAFA,SAAP;AAIA;AAnCF;;AAsCA,SAAOR,KAAP;AACA","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"]}
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,CAAEO,OAAO,EAAE,GAAGH,KAAK,CAACJ,QAAQ;QACvC,CAAC;MACF;IACA,KAAK,oBAAoB;MAAE;QAC1B,MAAM;UAAEQ,IAAI;UAAED;QAAQ,CAAC,GAAGF,MAAM;QAChC,MAAM;UAAEI,KAAK;UAAEC;QAAK,CAAC,GAAGH,OAAO;QAC/B,MAAMI,SAAS,GAAG,CAAEF,KAAK,EAAE,GAAGC,IAAI,CAAE;QAEpC,MAAME,OAAO,GAAG,IAAAC,4BAAqB,EAAET,KAAK,CAACH,IAAI,EAAEU,SAAU,CAAC;QAC9D,MAAMG,IAAI,GAAG,IAAAC,cAAO,EAAEH,OAAO,EAAED,SAAU,CAAC;QAC1CG,IAAI,CAACZ,KAAK,GAAG,CAAE,GAAGY,IAAI,CAACZ,KAAK,EAAEM,IAAI,CAAE;QAEpC,OAAO;UACN,GAAGJ,KAAK;UACRJ,QAAQ,EAAEI,KAAK,CAACJ,QAAQ,CAACgB,MAAM,CAAIC,CAAC,IAAMA,CAAC,KAAKV,OAAQ,CAAC;UACzDN,IAAI,EAAEW;QACP,CAAC;MACF;IACA,KAAK,cAAc;MAAE;QACpB,MAAM;UAAEJ;QAAK,CAAC,GAAGH,MAAM;QACvB,MAAMM,SAAS,GAAG,CAAEH,IAAI,CAACC,KAAK,EAAE,GAAGD,IAAI,CAACE,IAAI,CAAE;QAE9C,MAAME,OAAO,GAAG,IAAAC,4BAAqB,EAAET,KAAK,CAACH,IAAI,EAAEU,SAAU,CAAC;QAC9D,MAAMG,IAAI,GAAG,IAAAC,cAAO,EAAEH,OAAO,EAAED,SAAU,CAAC;QAC1CG,IAAI,CAACZ,KAAK,GAAGY,IAAI,CAACZ,KAAK,CAACc,MAAM,CAAIE,CAAC,IAAMA,CAAC,KAAKV,IAAK,CAAC;QAErD,OAAO;UACN,GAAGJ,KAAK;UACRH,IAAI,EAAEW;QACP,CAAC;MACF;EACD;EAEA,OAAOR,KAAK;AACb"}
@@ -5,39 +5,37 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.getPendingLockRequests = getPendingLockRequests;
7
7
  exports.isLockAvailable = isLockAvailable;
8
-
9
8
  var _utils = require("./utils");
10
-
11
9
  /**
12
10
  * Internal dependencies
13
11
  */
12
+
14
13
  function getPendingLockRequests(state) {
15
14
  return state.requests;
16
15
  }
17
-
18
16
  function isLockAvailable(state, store, path, {
19
17
  exclusive
20
18
  }) {
21
19
  const storePath = [store, ...path];
22
- const locks = state.tree; // Validate all parents and the node itself
20
+ const locks = state.tree;
23
21
 
22
+ // Validate all parents and the node itself
24
23
  for (const node of (0, _utils.iteratePath)(locks, storePath)) {
25
24
  if ((0, _utils.hasConflictingLock)({
26
25
  exclusive
27
26
  }, node.locks)) {
28
27
  return false;
29
28
  }
30
- } // iteratePath terminates early if path is unreachable, let's
31
- // re-fetch the node and check it exists in the tree.
32
-
29
+ }
33
30
 
31
+ // iteratePath terminates early if path is unreachable, let's
32
+ // re-fetch the node and check it exists in the tree.
34
33
  const node = (0, _utils.getNode)(locks, storePath);
35
-
36
34
  if (!node) {
37
35
  return true;
38
- } // Validate all nested nodes
39
-
36
+ }
40
37
 
38
+ // Validate all nested nodes
41
39
  for (const descendant of (0, _utils.iterateDescendants)(node)) {
42
40
  if ((0, _utils.hasConflictingLock)({
43
41
  exclusive
@@ -45,7 +43,6 @@ function isLockAvailable(state, store, path, {
45
43
  return false;
46
44
  }
47
45
  }
48
-
49
46
  return true;
50
47
  }
51
48
  //# sourceMappingURL=selectors.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/core-data/src/locks/selectors.js"],"names":["getPendingLockRequests","state","requests","isLockAvailable","store","path","exclusive","storePath","locks","tree","node","descendant"],"mappings":";;;;;;;;AAGA;;AAHA;AACA;AACA;AAQO,SAASA,sBAAT,CAAiCC,KAAjC,EAAyC;AAC/C,SAAOA,KAAK,CAACC,QAAb;AACA;;AAEM,SAASC,eAAT,CAA0BF,KAA1B,EAAiCG,KAAjC,EAAwCC,IAAxC,EAA8C;AAAEC,EAAAA;AAAF,CAA9C,EAA8D;AACpE,QAAMC,SAAS,GAAG,CAAEH,KAAF,EAAS,GAAGC,IAAZ,CAAlB;AACA,QAAMG,KAAK,GAAGP,KAAK,CAACQ,IAApB,CAFoE,CAIpE;;AACA,OAAM,MAAMC,IAAZ,IAAoB,wBAAaF,KAAb,EAAoBD,SAApB,CAApB,EAAsD;AACrD,QAAK,+BAAoB;AAAED,MAAAA;AAAF,KAApB,EAAmCI,IAAI,CAACF,KAAxC,CAAL,EAAuD;AACtD,aAAO,KAAP;AACA;AACD,GATmE,CAWpE;AACA;;;AACA,QAAME,IAAI,GAAG,oBAASF,KAAT,EAAgBD,SAAhB,CAAb;;AACA,MAAK,CAAEG,IAAP,EAAc;AACb,WAAO,IAAP;AACA,GAhBmE,CAkBpE;;;AACA,OAAM,MAAMC,UAAZ,IAA0B,+BAAoBD,IAApB,CAA1B,EAAuD;AACtD,QAAK,+BAAoB;AAAEJ,MAAAA;AAAF,KAApB,EAAmCK,UAAU,CAACH,KAA9C,CAAL,EAA6D;AAC5D,aAAO,KAAP;AACA;AACD;;AAED,SAAO,IAAP;AACA","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"]}
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"}
@@ -8,14 +8,14 @@ exports.getNode = getNode;
8
8
  exports.hasConflictingLock = hasConflictingLock;
9
9
  exports.iterateDescendants = iterateDescendants;
10
10
  exports.iteratePath = iteratePath;
11
-
12
11
  function deepCopyLocksTreePath(tree, path) {
13
- const newTree = { ...tree
12
+ const newTree = {
13
+ ...tree
14
14
  };
15
15
  let currentNode = newTree;
16
-
17
16
  for (const branchName of path) {
18
- currentNode.children = { ...currentNode.children,
17
+ currentNode.children = {
18
+ ...currentNode.children,
19
19
  [branchName]: {
20
20
  locks: [],
21
21
  children: {},
@@ -24,63 +24,48 @@ function deepCopyLocksTreePath(tree, path) {
24
24
  };
25
25
  currentNode = currentNode.children[branchName];
26
26
  }
27
-
28
27
  return newTree;
29
28
  }
30
-
31
29
  function getNode(tree, path) {
32
30
  let currentNode = tree;
33
-
34
31
  for (const branchName of path) {
35
32
  const nextNode = currentNode.children[branchName];
36
-
37
33
  if (!nextNode) {
38
34
  return null;
39
35
  }
40
-
41
36
  currentNode = nextNode;
42
37
  }
43
-
44
38
  return currentNode;
45
39
  }
46
-
47
40
  function* iteratePath(tree, path) {
48
41
  let currentNode = tree;
49
42
  yield currentNode;
50
-
51
43
  for (const branchName of path) {
52
44
  const nextNode = currentNode.children[branchName];
53
-
54
45
  if (!nextNode) {
55
46
  break;
56
47
  }
57
-
58
48
  yield nextNode;
59
49
  currentNode = nextNode;
60
50
  }
61
51
  }
62
-
63
52
  function* iterateDescendants(node) {
64
53
  const stack = Object.values(node.children);
65
-
66
54
  while (stack.length) {
67
55
  const childNode = stack.pop();
68
56
  yield childNode;
69
57
  stack.push(...Object.values(childNode.children));
70
58
  }
71
59
  }
72
-
73
60
  function hasConflictingLock({
74
61
  exclusive
75
62
  }, locks) {
76
63
  if (exclusive && locks.length) {
77
64
  return true;
78
65
  }
79
-
80
66
  if (!exclusive && locks.filter(lock => lock.exclusive).length) {
81
67
  return true;
82
68
  }
83
-
84
69
  return false;
85
70
  }
86
71
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/core-data/src/locks/utils.js"],"names":["deepCopyLocksTreePath","tree","path","newTree","currentNode","branchName","children","locks","getNode","nextNode","iteratePath","iterateDescendants","node","stack","Object","values","length","childNode","pop","push","hasConflictingLock","exclusive","filter","lock"],"mappings":";;;;;;;;;;;AAAO,SAASA,qBAAT,CAAgCC,IAAhC,EAAsCC,IAAtC,EAA6C;AACnD,QAAMC,OAAO,GAAG,EAAE,GAAGF;AAAL,GAAhB;AACA,MAAIG,WAAW,GAAGD,OAAlB;;AACA,OAAM,MAAME,UAAZ,IAA0BH,IAA1B,EAAiC;AAChCE,IAAAA,WAAW,CAACE,QAAZ,GAAuB,EACtB,GAAGF,WAAW,CAACE,QADO;AAEtB,OAAED,UAAF,GAAgB;AACfE,QAAAA,KAAK,EAAE,EADQ;AAEfD,QAAAA,QAAQ,EAAE,EAFK;AAGf,WAAGF,WAAW,CAACE,QAAZ,CAAsBD,UAAtB;AAHY;AAFM,KAAvB;AAQAD,IAAAA,WAAW,GAAGA,WAAW,CAACE,QAAZ,CAAsBD,UAAtB,CAAd;AACA;;AACD,SAAOF,OAAP;AACA;;AAEM,SAASK,OAAT,CAAkBP,IAAlB,EAAwBC,IAAxB,EAA+B;AACrC,MAAIE,WAAW,GAAGH,IAAlB;;AACA,OAAM,MAAMI,UAAZ,IAA0BH,IAA1B,EAAiC;AAChC,UAAMO,QAAQ,GAAGL,WAAW,CAACE,QAAZ,CAAsBD,UAAtB,CAAjB;;AACA,QAAK,CAAEI,QAAP,EAAkB;AACjB,aAAO,IAAP;AACA;;AACDL,IAAAA,WAAW,GAAGK,QAAd;AACA;;AACD,SAAOL,WAAP;AACA;;AAEM,UAAUM,WAAV,CAAuBT,IAAvB,EAA6BC,IAA7B,EAAoC;AAC1C,MAAIE,WAAW,GAAGH,IAAlB;AACA,QAAMG,WAAN;;AACA,OAAM,MAAMC,UAAZ,IAA0BH,IAA1B,EAAiC;AAChC,UAAMO,QAAQ,GAAGL,WAAW,CAACE,QAAZ,CAAsBD,UAAtB,CAAjB;;AACA,QAAK,CAAEI,QAAP,EAAkB;AACjB;AACA;;AACD,UAAMA,QAAN;AACAL,IAAAA,WAAW,GAAGK,QAAd;AACA;AACD;;AAEM,UAAUE,kBAAV,CAA8BC,IAA9B,EAAqC;AAC3C,QAAMC,KAAK,GAAGC,MAAM,CAACC,MAAP,CAAeH,IAAI,CAACN,QAApB,CAAd;;AACA,SAAQO,KAAK,CAACG,MAAd,EAAuB;AACtB,UAAMC,SAAS,GAAGJ,KAAK,CAACK,GAAN,EAAlB;AACA,UAAMD,SAAN;AACAJ,IAAAA,KAAK,CAACM,IAAN,CAAY,GAAGL,MAAM,CAACC,MAAP,CAAeE,SAAS,CAACX,QAAzB,CAAf;AACA;AACD;;AAEM,SAASc,kBAAT,CAA6B;AAAEC,EAAAA;AAAF,CAA7B,EAA4Cd,KAA5C,EAAoD;AAC1D,MAAKc,SAAS,IAAId,KAAK,CAACS,MAAxB,EAAiC;AAChC,WAAO,IAAP;AACA;;AAED,MAAK,CAAEK,SAAF,IAAed,KAAK,CAACe,MAAN,CAAgBC,IAAF,IAAYA,IAAI,CAACF,SAA/B,EAA2CL,MAA/D,EAAwE;AACvE,WAAO,IAAP;AACA;;AAED,SAAO,KAAP;AACA","sourcesContent":["export function deepCopyLocksTreePath( tree, path ) {\n\tconst newTree = { ...tree };\n\tlet currentNode = newTree;\n\tfor ( const branchName of path ) {\n\t\tcurrentNode.children = {\n\t\t\t...currentNode.children,\n\t\t\t[ branchName ]: {\n\t\t\t\tlocks: [],\n\t\t\t\tchildren: {},\n\t\t\t\t...currentNode.children[ branchName ],\n\t\t\t},\n\t\t};\n\t\tcurrentNode = currentNode.children[ branchName ];\n\t}\n\treturn newTree;\n}\n\nexport function getNode( tree, path ) {\n\tlet currentNode = tree;\n\tfor ( const branchName of path ) {\n\t\tconst nextNode = currentNode.children[ branchName ];\n\t\tif ( ! nextNode ) {\n\t\t\treturn null;\n\t\t}\n\t\tcurrentNode = nextNode;\n\t}\n\treturn currentNode;\n}\n\nexport function* iteratePath( tree, path ) {\n\tlet currentNode = tree;\n\tyield currentNode;\n\tfor ( const branchName of path ) {\n\t\tconst nextNode = currentNode.children[ branchName ];\n\t\tif ( ! nextNode ) {\n\t\t\tbreak;\n\t\t}\n\t\tyield nextNode;\n\t\tcurrentNode = nextNode;\n\t}\n}\n\nexport function* iterateDescendants( node ) {\n\tconst stack = Object.values( node.children );\n\twhile ( stack.length ) {\n\t\tconst childNode = stack.pop();\n\t\tyield childNode;\n\t\tstack.push( ...Object.values( childNode.children ) );\n\t}\n}\n\nexport function hasConflictingLock( { exclusive }, locks ) {\n\tif ( exclusive && locks.length ) {\n\t\treturn true;\n\t}\n\n\tif ( ! exclusive && locks.filter( ( lock ) => lock.exclusive ).length ) {\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n"]}
1
+ {"version":3,"names":["deepCopyLocksTreePath","tree","path","newTree","currentNode","branchName","children","locks","getNode","nextNode","iteratePath","iterateDescendants","node","stack","Object","values","length","childNode","pop","push","hasConflictingLock","exclusive","filter","lock"],"sources":["@wordpress/core-data/src/locks/utils.js"],"sourcesContent":["export function deepCopyLocksTreePath( tree, path ) {\n\tconst newTree = { ...tree };\n\tlet currentNode = newTree;\n\tfor ( const branchName of path ) {\n\t\tcurrentNode.children = {\n\t\t\t...currentNode.children,\n\t\t\t[ branchName ]: {\n\t\t\t\tlocks: [],\n\t\t\t\tchildren: {},\n\t\t\t\t...currentNode.children[ branchName ],\n\t\t\t},\n\t\t};\n\t\tcurrentNode = currentNode.children[ branchName ];\n\t}\n\treturn newTree;\n}\n\nexport function getNode( tree, path ) {\n\tlet currentNode = tree;\n\tfor ( const branchName of path ) {\n\t\tconst nextNode = currentNode.children[ branchName ];\n\t\tif ( ! nextNode ) {\n\t\t\treturn null;\n\t\t}\n\t\tcurrentNode = nextNode;\n\t}\n\treturn currentNode;\n}\n\nexport function* iteratePath( tree, path ) {\n\tlet currentNode = tree;\n\tyield currentNode;\n\tfor ( const branchName of path ) {\n\t\tconst nextNode = currentNode.children[ branchName ];\n\t\tif ( ! nextNode ) {\n\t\t\tbreak;\n\t\t}\n\t\tyield nextNode;\n\t\tcurrentNode = nextNode;\n\t}\n}\n\nexport function* iterateDescendants( node ) {\n\tconst stack = Object.values( node.children );\n\twhile ( stack.length ) {\n\t\tconst childNode = stack.pop();\n\t\tyield childNode;\n\t\tstack.push( ...Object.values( childNode.children ) );\n\t}\n}\n\nexport function hasConflictingLock( { exclusive }, locks ) {\n\tif ( exclusive && locks.length ) {\n\t\treturn true;\n\t}\n\n\tif ( ! exclusive && locks.filter( ( lock ) => lock.exclusive ).length ) {\n\t\treturn true;\n\t}\n\n\treturn false;\n}\n"],"mappings":";;;;;;;;;;AAAO,SAASA,qBAAqBA,CAAEC,IAAI,EAAEC,IAAI,EAAG;EACnD,MAAMC,OAAO,GAAG;IAAE,GAAGF;EAAK,CAAC;EAC3B,IAAIG,WAAW,GAAGD,OAAO;EACzB,KAAM,MAAME,UAAU,IAAIH,IAAI,EAAG;IAChCE,WAAW,CAACE,QAAQ,GAAG;MACtB,GAAGF,WAAW,CAACE,QAAQ;MACvB,CAAED,UAAU,GAAI;QACfE,KAAK,EAAE,EAAE;QACTD,QAAQ,EAAE,CAAC,CAAC;QACZ,GAAGF,WAAW,CAACE,QAAQ,CAAED,UAAU;MACpC;IACD,CAAC;IACDD,WAAW,GAAGA,WAAW,CAACE,QAAQ,CAAED,UAAU,CAAE;EACjD;EACA,OAAOF,OAAO;AACf;AAEO,SAASK,OAAOA,CAAEP,IAAI,EAAEC,IAAI,EAAG;EACrC,IAAIE,WAAW,GAAGH,IAAI;EACtB,KAAM,MAAMI,UAAU,IAAIH,IAAI,EAAG;IAChC,MAAMO,QAAQ,GAAGL,WAAW,CAACE,QAAQ,CAAED,UAAU,CAAE;IACnD,IAAK,CAAEI,QAAQ,EAAG;MACjB,OAAO,IAAI;IACZ;IACAL,WAAW,GAAGK,QAAQ;EACvB;EACA,OAAOL,WAAW;AACnB;AAEO,UAAUM,WAAWA,CAAET,IAAI,EAAEC,IAAI,EAAG;EAC1C,IAAIE,WAAW,GAAGH,IAAI;EACtB,MAAMG,WAAW;EACjB,KAAM,MAAMC,UAAU,IAAIH,IAAI,EAAG;IAChC,MAAMO,QAAQ,GAAGL,WAAW,CAACE,QAAQ,CAAED,UAAU,CAAE;IACnD,IAAK,CAAEI,QAAQ,EAAG;MACjB;IACD;IACA,MAAMA,QAAQ;IACdL,WAAW,GAAGK,QAAQ;EACvB;AACD;AAEO,UAAUE,kBAAkBA,CAAEC,IAAI,EAAG;EAC3C,MAAMC,KAAK,GAAGC,MAAM,CAACC,MAAM,CAAEH,IAAI,CAACN,QAAS,CAAC;EAC5C,OAAQO,KAAK,CAACG,MAAM,EAAG;IACtB,MAAMC,SAAS,GAAGJ,KAAK,CAACK,GAAG,CAAC,CAAC;IAC7B,MAAMD,SAAS;IACfJ,KAAK,CAACM,IAAI,CAAE,GAAGL,MAAM,CAACC,MAAM,CAAEE,SAAS,CAACX,QAAS,CAAE,CAAC;EACrD;AACD;AAEO,SAASc,kBAAkBA,CAAE;EAAEC;AAAU,CAAC,EAAEd,KAAK,EAAG;EAC1D,IAAKc,SAAS,IAAId,KAAK,CAACS,MAAM,EAAG;IAChC,OAAO,IAAI;EACZ;EAEA,IAAK,CAAEK,SAAS,IAAId,KAAK,CAACe,MAAM,CAAIC,IAAI,IAAMA,IAAI,CAACF,SAAU,CAAC,CAACL,MAAM,EAAG;IACvE,OAAO,IAAI;EACZ;EAEA,OAAO,KAAK;AACb"}
package/build/name.js CHANGED
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.STORE_NAME = void 0;
7
-
8
7
  /**
9
8
  * The reducer key used by core data in store registration.
10
9
  * This is defined in a separate file to avoid cycle-dependency
package/build/name.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/core-data/src/name.js"],"names":["STORE_NAME"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,UAAU,GAAG,MAAnB","sourcesContent":["/**\n * The reducer key used by core data in store registration.\n * This is defined in a separate file to avoid cycle-dependency\n *\n * @type {string}\n */\nexport const STORE_NAME = 'core';\n"]}
1
+ {"version":3,"names":["STORE_NAME","exports"],"sources":["@wordpress/core-data/src/name.js"],"sourcesContent":["/**\n * The reducer key used by core data in store registration.\n * This is defined in a separate file to avoid cycle-dependency\n *\n * @type {string}\n */\nexport const STORE_NAME = 'core';\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,UAAU,GAAG,MAAM;AAACC,OAAA,CAAAD,UAAA,GAAAA,UAAA"}
@@ -4,12 +4,11 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.unlock = exports.lock = void 0;
7
-
8
7
  var _privateApis = require("@wordpress/private-apis");
9
-
10
8
  /**
11
9
  * WordPress dependencies
12
10
  */
11
+
13
12
  const {
14
13
  lock,
15
14
  unlock
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/core-data/src/private-apis.js"],"names":["lock","unlock"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,MAAM;AAAEA,EAAAA,IAAF;AAAQC,EAAAA;AAAR,IACZ,mEACC,8GADD,EAEC,sBAFD,CADM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',\n\t\t'@wordpress/core-data'\n\t);\n"]}
1
+ {"version":3,"names":["_privateApis","require","lock","unlock","__dangerousOptInToUnstableAPIsOnlyForCoreModules","exports"],"sources":["@wordpress/core-data/src/private-apis.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',\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,8GAA8G,EAC9G,sBACD,CAAC;AAACC,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAAAE,OAAA,CAAAH,IAAA,GAAAA,IAAA"}
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getNavigationFallbackId = getNavigationFallbackId;
7
7
  exports.getRedoEdits = getRedoEdits;
8
8
  exports.getUndoEdits = getUndoEdits;
9
-
10
9
  /**
11
10
  * Internal dependencies
12
11
  */
@@ -22,6 +21,7 @@ exports.getUndoEdits = getUndoEdits;
22
21
  function getUndoEdits(state) {
23
22
  return state.undo.list[state.undo.list.length - 1 + state.undo.offset];
24
23
  }
24
+
25
25
  /**
26
26
  * Returns the next edit from the current undo offset
27
27
  * for the entity records edits history, if any.
@@ -30,19 +30,16 @@ function getUndoEdits(state) {
30
30
  *
31
31
  * @return The edit.
32
32
  */
33
-
34
-
35
33
  function getRedoEdits(state) {
36
34
  return state.undo.list[state.undo.list.length + state.undo.offset];
37
35
  }
36
+
38
37
  /**
39
38
  * Retrieve the fallback Navigation.
40
39
  *
41
40
  * @param state Data state.
42
41
  * @return The ID for the fallback Navigation post.
43
42
  */
44
-
45
-
46
43
  function getNavigationFallbackId(state) {
47
44
  return state.navigationFallbackId;
48
45
  }