@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.
- package/CHANGELOG.md +2 -0
- package/build/actions.js +69 -134
- package/build/actions.js.map +1 -1
- package/build/batch/create-batch.js +0 -22
- package/build/batch/create-batch.js.map +1 -1
- package/build/batch/default-processor.js +3 -15
- package/build/batch/default-processor.js.map +1 -1
- package/build/batch/index.js +0 -3
- package/build/batch/index.js.map +1 -1
- package/build/entities.js +109 -36
- package/build/entities.js.map +1 -1
- package/build/entity-provider.js +34 -53
- package/build/entity-provider.js.map +1 -1
- package/build/entity-types/attachment.js.map +1 -1
- package/build/entity-types/base-entity-records.js +0 -3
- package/build/entity-types/base-entity-records.js.map +1 -1
- package/build/entity-types/comment.js.map +1 -1
- package/build/entity-types/helpers.js.map +1 -1
- package/build/entity-types/index.js.map +1 -1
- package/build/entity-types/menu-location.js.map +1 -1
- package/build/entity-types/nav-menu-item.js.map +1 -1
- package/build/entity-types/nav-menu.js.map +1 -1
- package/build/entity-types/page.js.map +1 -1
- package/build/entity-types/plugin.js.map +1 -1
- package/build/entity-types/post.js.map +1 -1
- package/build/entity-types/settings.js.map +1 -1
- package/build/entity-types/sidebar.js.map +1 -1
- package/build/entity-types/taxonomy.js.map +1 -1
- package/build/entity-types/theme.js.map +1 -1
- package/build/entity-types/type.js.map +1 -1
- package/build/entity-types/user.js.map +1 -1
- package/build/entity-types/widget-type.js.map +1 -1
- package/build/entity-types/widget.js.map +1 -1
- package/build/entity-types/wp-template-part.js.map +1 -1
- package/build/entity-types/wp-template.js.map +1 -1
- package/build/fetch/__experimental-fetch-link-suggestions.js +14 -20
- package/build/fetch/__experimental-fetch-link-suggestions.js.map +1 -1
- package/build/fetch/__experimental-fetch-url-data.js +4 -13
- package/build/fetch/__experimental-fetch-url-data.js.map +1 -1
- package/build/fetch/index.js +0 -3
- package/build/fetch/index.js.map +1 -1
- package/build/hooks/constants.js +4 -5
- package/build/hooks/constants.js.map +1 -1
- package/build/hooks/index.js +0 -5
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/memoize.js +0 -3
- package/build/hooks/memoize.js.map +1 -1
- package/build/hooks/use-entity-record.js +0 -9
- package/build/hooks/use-entity-record.js.map +1 -1
- package/build/hooks/use-entity-records.js +2 -9
- package/build/hooks/use-entity-records.js.map +1 -1
- package/build/hooks/use-query-select.js +1 -13
- package/build/hooks/use-query-select.js.map +1 -1
- package/build/hooks/use-resource-permissions.js +0 -15
- package/build/hooks/use-resource-permissions.js.map +1 -1
- package/build/index.js +9 -41
- package/build/index.js.map +1 -1
- package/build/locks/actions.js +1 -6
- package/build/locks/actions.js.map +1 -1
- package/build/locks/engine.js +1 -9
- package/build/locks/engine.js.map +1 -1
- package/build/locks/reducer.js +8 -9
- package/build/locks/reducer.js.map +1 -1
- package/build/locks/selectors.js +8 -11
- package/build/locks/selectors.js.map +1 -1
- package/build/locks/utils.js +4 -19
- package/build/locks/utils.js.map +1 -1
- package/build/name.js +0 -1
- package/build/name.js.map +1 -1
- package/build/private-apis.js +1 -2
- package/build/private-apis.js.map +1 -1
- package/build/private-selectors.js +2 -5
- package/build/private-selectors.js.map +1 -1
- package/build/queried-data/actions.js +4 -6
- package/build/queried-data/actions.js.map +1 -1
- package/build/queried-data/get-query-parts.js +11 -24
- package/build/queried-data/get-query-parts.js.map +1 -1
- package/build/queried-data/index.js +0 -6
- package/build/queried-data/index.js.map +1 -1
- package/build/queried-data/reducer.js +33 -51
- package/build/queried-data/reducer.js.map +1 -1
- package/build/queried-data/selectors.js +4 -25
- package/build/queried-data/selectors.js.map +1 -1
- package/build/reducer.js +76 -128
- package/build/reducer.js.map +1 -1
- package/build/resolvers.js +91 -133
- package/build/resolvers.js.map +1 -1
- package/build/selectors.js +51 -145
- package/build/selectors.js.map +1 -1
- package/build/sync.js +19 -0
- package/build/sync.js.map +1 -0
- package/build/types.js.map +1 -1
- package/build/utils/conservative-map-item.js +3 -10
- package/build/utils/conservative-map-item.js.map +1 -1
- package/build/utils/forward-resolver.js +0 -2
- package/build/utils/forward-resolver.js.map +1 -1
- package/build/utils/get-normalized-comma-separable.js +0 -3
- package/build/utils/get-normalized-comma-separable.js.map +1 -1
- package/build/utils/if-matching-action.js +0 -3
- package/build/utils/if-matching-action.js.map +1 -1
- package/build/utils/index.js +0 -10
- package/build/utils/index.js.map +1 -1
- package/build/utils/is-raw-attribute.js +0 -1
- package/build/utils/is-raw-attribute.js.map +1 -1
- package/build/utils/on-sub-key.js +5 -9
- package/build/utils/on-sub-key.js.map +1 -1
- package/build/utils/replace-action.js +0 -2
- package/build/utils/replace-action.js.map +1 -1
- package/build/utils/set-nested-value.js +0 -4
- package/build/utils/set-nested-value.js.map +1 -1
- package/build/utils/with-weak-map-cache.js +3 -6
- package/build/utils/with-weak-map-cache.js.map +1 -1
- package/build-module/actions.js +72 -95
- package/build-module/actions.js.map +1 -1
- package/build-module/batch/create-batch.js +1 -20
- package/build-module/batch/create-batch.js.map +1 -1
- package/build-module/batch/default-processor.js +4 -13
- package/build-module/batch/default-processor.js.map +1 -1
- package/build-module/batch/index.js.map +1 -1
- package/build-module/entities.js +109 -25
- package/build-module/entities.js.map +1 -1
- package/build-module/entity-provider.js +35 -45
- package/build-module/entity-provider.js.map +1 -1
- package/build-module/entity-types/attachment.js.map +1 -1
- package/build-module/entity-types/base-entity-records.js +0 -2
- package/build-module/entity-types/base-entity-records.js.map +1 -1
- package/build-module/entity-types/comment.js.map +1 -1
- package/build-module/entity-types/helpers.js.map +1 -1
- package/build-module/entity-types/index.js.map +1 -1
- package/build-module/entity-types/menu-location.js.map +1 -1
- package/build-module/entity-types/nav-menu-item.js.map +1 -1
- package/build-module/entity-types/nav-menu.js.map +1 -1
- package/build-module/entity-types/page.js.map +1 -1
- package/build-module/entity-types/plugin.js.map +1 -1
- package/build-module/entity-types/post.js.map +1 -1
- package/build-module/entity-types/settings.js.map +1 -1
- package/build-module/entity-types/sidebar.js.map +1 -1
- package/build-module/entity-types/taxonomy.js.map +1 -1
- package/build-module/entity-types/theme.js.map +1 -1
- package/build-module/entity-types/type.js.map +1 -1
- package/build-module/entity-types/user.js.map +1 -1
- package/build-module/entity-types/widget-type.js.map +1 -1
- package/build-module/entity-types/widget.js.map +1 -1
- package/build-module/entity-types/wp-template-part.js.map +1 -1
- package/build-module/entity-types/wp-template.js.map +1 -1
- package/build-module/fetch/__experimental-fetch-link-suggestions.js +15 -15
- package/build-module/fetch/__experimental-fetch-link-suggestions.js.map +1 -1
- package/build-module/fetch/__experimental-fetch-url-data.js +5 -10
- package/build-module/fetch/__experimental-fetch-url-data.js.map +1 -1
- package/build-module/fetch/index.js.map +1 -1
- package/build-module/hooks/constants.js +3 -4
- package/build-module/hooks/constants.js.map +1 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/memoize.js +2 -1
- package/build-module/hooks/memoize.js.map +1 -1
- package/build-module/hooks/use-entity-record.js +1 -3
- package/build-module/hooks/use-entity-record.js.map +1 -1
- package/build-module/hooks/use-entity-records.js +2 -3
- package/build-module/hooks/use-entity-records.js.map +1 -1
- package/build-module/hooks/use-query-select.js +1 -9
- package/build-module/hooks/use-query-select.js.map +1 -1
- package/build-module/hooks/use-resource-permissions.js +1 -10
- package/build-module/hooks/use-resource-permissions.js.map +1 -1
- package/build-module/index.js +11 -19
- package/build-module/index.js.map +1 -1
- package/build-module/locks/actions.js +0 -3
- package/build-module/locks/actions.js.map +1 -1
- package/build-module/locks/engine.js +0 -5
- package/build-module/locks/engine.js.map +1 -1
- package/build-module/locks/reducer.js +7 -7
- package/build-module/locks/reducer.js.map +1 -1
- package/build-module/locks/selectors.js +7 -8
- package/build-module/locks/selectors.js.map +1 -1
- package/build-module/locks/utils.js +4 -14
- package/build-module/locks/utils.js.map +1 -1
- package/build-module/name.js.map +1 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-selectors.js +2 -2
- package/build-module/private-selectors.js.map +1 -1
- package/build-module/queried-data/actions.js +4 -3
- package/build-module/queried-data/actions.js.map +1 -1
- package/build-module/queried-data/get-query-parts.js +13 -21
- package/build-module/queried-data/get-query-parts.js.map +1 -1
- package/build-module/queried-data/index.js.map +1 -1
- package/build-module/queried-data/reducer.js +33 -42
- package/build-module/queried-data/reducer.js.map +1 -1
- package/build-module/queried-data/selectors.js +6 -21
- package/build-module/queried-data/selectors.js.map +1 -1
- package/build-module/reducer.js +79 -104
- package/build-module/reducer.js.map +1 -1
- package/build-module/resolvers.js +94 -96
- package/build-module/resolvers.js.map +1 -1
- package/build-module/selectors.js +56 -92
- package/build-module/selectors.js.map +1 -1
- package/build-module/sync.js +12 -0
- package/build-module/sync.js.map +1 -0
- package/build-module/types.js.map +1 -1
- package/build-module/utils/conservative-map-item.js +4 -8
- package/build-module/utils/conservative-map-item.js.map +1 -1
- package/build-module/utils/forward-resolver.js +0 -1
- package/build-module/utils/forward-resolver.js.map +1 -1
- package/build-module/utils/get-normalized-comma-separable.js +0 -2
- package/build-module/utils/get-normalized-comma-separable.js.map +1 -1
- package/build-module/utils/if-matching-action.js +0 -2
- package/build-module/utils/if-matching-action.js.map +1 -1
- package/build-module/utils/index.js.map +1 -1
- package/build-module/utils/is-raw-attribute.js.map +1 -1
- package/build-module/utils/on-sub-key.js +5 -7
- package/build-module/utils/on-sub-key.js.map +1 -1
- package/build-module/utils/replace-action.js +0 -1
- package/build-module/utils/replace-action.js.map +1 -1
- package/build-module/utils/set-nested-value.js +0 -3
- package/build-module/utils/set-nested-value.js.map +1 -1
- package/build-module/utils/with-weak-map-cache.js +3 -5
- package/build-module/utils/with-weak-map-cache.js.map +1 -1
- package/build-types/actions.d.ts.map +1 -1
- package/build-types/entities.d.ts +53 -0
- package/build-types/entities.d.ts.map +1 -1
- package/build-types/entity-provider.d.ts +1 -1
- package/build-types/entity-provider.d.ts.map +1 -1
- package/build-types/hooks/memoize.d.ts +1 -1
- package/build-types/hooks/memoize.d.ts.map +1 -1
- package/build-types/index.d.ts +3 -3
- package/build-types/index.d.ts.map +1 -1
- package/build-types/resolvers.d.ts.map +1 -1
- package/build-types/sync.d.ts +2 -0
- package/build-types/sync.d.ts.map +1 -0
- package/package.json +17 -15
- package/src/actions.js +24 -14
- package/src/entities.js +91 -0
- package/src/entity-provider.js +11 -2
- package/src/resolvers.js +89 -41
- package/src/sync.js +18 -0
- package/src/test/entity-provider.js +272 -0
- package/tsconfig.json +1 -0
- 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: {
|
|
122
|
+
actions: {
|
|
123
|
+
...actions,
|
|
157
124
|
...entityActions,
|
|
158
125
|
...(0, _actions2.default)()
|
|
159
126
|
},
|
|
160
|
-
selectors: {
|
|
127
|
+
selectors: {
|
|
128
|
+
...selectors,
|
|
161
129
|
...entitySelectors
|
|
162
130
|
},
|
|
163
|
-
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);
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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 './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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,"
|
|
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"}
|
package/build/locks/engine.js
CHANGED
|
@@ -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,"
|
|
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"}
|
package/build/locks/reducer.js
CHANGED
|
@@ -4,12 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: 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 {
|
|
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 {
|
|
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 {
|
|
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,"
|
|
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,sB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N,GAAGJ,KAAK;UACRH,IAAI,EAAEW;QACP,CAAC;MACF;EACD;EAEA,OAAOR,KAAK;AACb"}
|
package/build/locks/selectors.js
CHANGED
|
@@ -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;
|
|
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
|
-
}
|
|
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
|
-
}
|
|
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,"
|
|
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"}
|
package/build/locks/utils.js
CHANGED
|
@@ -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 = {
|
|
12
|
+
const newTree = {
|
|
13
|
+
...tree
|
|
14
14
|
};
|
|
15
15
|
let currentNode = newTree;
|
|
16
|
-
|
|
17
16
|
for (const branchName of path) {
|
|
18
|
-
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
|
package/build/locks/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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,OAA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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
package/build/name.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/core-data/src/name.js"],"
|
|
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"}
|
package/build/private-apis.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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
|
}
|