@wordpress/core-data 7.48.2-next.v.202606191442.0 → 7.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/README.md +0 -1
- package/build/hooks/use-entity-record.cjs.map +2 -2
- package/build/private-selectors.cjs.map +2 -2
- package/build/reducer.cjs +7 -2
- package/build/reducer.cjs.map +2 -2
- package/build/resolvers.cjs +7 -2
- package/build/resolvers.cjs.map +2 -2
- package/build-module/hooks/use-entity-record.mjs.map +2 -2
- package/build-module/private-selectors.mjs.map +2 -2
- package/build-module/reducer.mjs +7 -2
- package/build-module/reducer.mjs.map +2 -2
- package/build-module/resolvers.mjs +7 -2
- package/build-module/resolvers.mjs.map +2 -2
- package/build-types/hooks/use-entity-record.d.ts +0 -1
- package/build-types/hooks/use-entity-record.d.ts.map +1 -1
- package/build-types/private-selectors.d.ts +6 -0
- package/build-types/private-selectors.d.ts.map +1 -1
- package/build-types/reducer.d.ts.map +1 -1
- package/build-types/resolvers.d.ts +9 -4
- package/build-types/resolvers.d.ts.map +1 -1
- package/package.json +18 -18
- package/src/hooks/use-entity-record.ts +0 -1
- package/src/private-selectors.ts +6 -0
- package/src/reducer.js +9 -2
- package/src/resolvers.js +14 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/core-data",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.49.0",
|
|
4
4
|
"description": "Access to and manipulation of core WordPress entities.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -48,22 +48,22 @@
|
|
|
48
48
|
"build-module/index.mjs"
|
|
49
49
|
],
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@wordpress/api-fetch": "^7.
|
|
52
|
-
"@wordpress/block-editor": "^15.22.
|
|
53
|
-
"@wordpress/blocks": "^15.
|
|
54
|
-
"@wordpress/compose": "^8.
|
|
55
|
-
"@wordpress/data": "^10.
|
|
56
|
-
"@wordpress/deprecated": "^4.
|
|
57
|
-
"@wordpress/element": "^8.
|
|
58
|
-
"@wordpress/html-entities": "^4.
|
|
59
|
-
"@wordpress/i18n": "^6.
|
|
60
|
-
"@wordpress/is-shallow-equal": "^5.
|
|
61
|
-
"@wordpress/private-apis": "^1.
|
|
62
|
-
"@wordpress/rich-text": "^7.
|
|
63
|
-
"@wordpress/sync": "^1.
|
|
64
|
-
"@wordpress/undo-manager": "^1.
|
|
65
|
-
"@wordpress/url": "^4.
|
|
66
|
-
"@wordpress/warning": "^3.
|
|
51
|
+
"@wordpress/api-fetch": "^7.49.0",
|
|
52
|
+
"@wordpress/block-editor": "^15.22.0",
|
|
53
|
+
"@wordpress/blocks": "^15.22.0",
|
|
54
|
+
"@wordpress/compose": "^8.2.0",
|
|
55
|
+
"@wordpress/data": "^10.49.0",
|
|
56
|
+
"@wordpress/deprecated": "^4.49.0",
|
|
57
|
+
"@wordpress/element": "^8.1.0",
|
|
58
|
+
"@wordpress/html-entities": "^4.49.0",
|
|
59
|
+
"@wordpress/i18n": "^6.22.0",
|
|
60
|
+
"@wordpress/is-shallow-equal": "^5.49.0",
|
|
61
|
+
"@wordpress/private-apis": "^1.49.0",
|
|
62
|
+
"@wordpress/rich-text": "^7.49.0",
|
|
63
|
+
"@wordpress/sync": "^1.49.0",
|
|
64
|
+
"@wordpress/undo-manager": "^1.49.0",
|
|
65
|
+
"@wordpress/url": "^4.49.0",
|
|
66
|
+
"@wordpress/warning": "^3.49.0",
|
|
67
67
|
"change-case": "^4.1.2",
|
|
68
68
|
"equivalent-key-map": "^0.2.2",
|
|
69
69
|
"fast-deep-equal": "^3.1.3",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"publishConfig": {
|
|
92
92
|
"access": "public"
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "0e7112a4f4fde4ea15bd9060489b8f6fe11eb6ca"
|
|
95
95
|
}
|
package/src/private-selectors.ts
CHANGED
|
@@ -316,6 +316,12 @@ export function isCollaborationSupported( state: State ): boolean {
|
|
|
316
316
|
/**
|
|
317
317
|
* Returns the view configuration for the given entity type.
|
|
318
318
|
*
|
|
319
|
+
* An optional fourth argument (e.g. `{ fields }`) may be passed when selecting;
|
|
320
|
+
* it is consumed by the `getViewConfig` resolver to request a subset of the
|
|
321
|
+
* config via the REST API `_fields` parameter and does not affect what is read
|
|
322
|
+
* here. Partial responses are merged in the reducer, so the returned object may
|
|
323
|
+
* accumulate properties across requests for the same entity.
|
|
324
|
+
*
|
|
319
325
|
* @param state Data state.
|
|
320
326
|
* @param kind Entity kind.
|
|
321
327
|
* @param name Entity name.
|
package/src/reducer.js
CHANGED
|
@@ -751,11 +751,18 @@ export function collaborationSupported( state = true, action ) {
|
|
|
751
751
|
*/
|
|
752
752
|
export function viewConfigs( state = {}, action ) {
|
|
753
753
|
switch ( action.type ) {
|
|
754
|
-
case 'RECEIVE_VIEW_CONFIG':
|
|
754
|
+
case 'RECEIVE_VIEW_CONFIG': {
|
|
755
|
+
const key = `${ action.kind }/${ action.name }`;
|
|
756
|
+
// Merge so a partial (`_fields`) response doesn't clobber
|
|
757
|
+
// properties already received for the same entity.
|
|
755
758
|
return {
|
|
756
759
|
...state,
|
|
757
|
-
[
|
|
760
|
+
[ key ]: {
|
|
761
|
+
...state[ key ],
|
|
762
|
+
...action.config,
|
|
763
|
+
},
|
|
758
764
|
};
|
|
765
|
+
}
|
|
759
766
|
}
|
|
760
767
|
return state;
|
|
761
768
|
}
|
package/src/resolvers.js
CHANGED
|
@@ -1355,14 +1355,24 @@ export const getEditorAssets =
|
|
|
1355
1355
|
/**
|
|
1356
1356
|
* Requests view config for a given entity type from the REST API.
|
|
1357
1357
|
*
|
|
1358
|
-
* @param {string}
|
|
1359
|
-
* @param {string}
|
|
1358
|
+
* @param {string} kind Entity kind.
|
|
1359
|
+
* @param {string} name Entity name.
|
|
1360
|
+
* @param {?Object} options Optional options.
|
|
1361
|
+
* @param {?string[]} options.fields Optional subset of top-level config
|
|
1362
|
+
* properties to request, mapped to the REST
|
|
1363
|
+
* API `_fields` parameter. When omitted, the
|
|
1364
|
+
* full config is requested.
|
|
1360
1365
|
*/
|
|
1361
1366
|
export const getViewConfig =
|
|
1362
|
-
( kind, name ) =>
|
|
1367
|
+
( kind, name, options = {} ) =>
|
|
1363
1368
|
async ( { dispatch } ) => {
|
|
1369
|
+
const query = { kind, name };
|
|
1370
|
+
const fields = getNormalizedCommaSeparable( options.fields );
|
|
1371
|
+
if ( fields?.length ) {
|
|
1372
|
+
query._fields = fields.join( ',' );
|
|
1373
|
+
}
|
|
1364
1374
|
const config = await apiFetch( {
|
|
1365
|
-
path: addQueryArgs( '/wp/v2/view-config',
|
|
1375
|
+
path: addQueryArgs( '/wp/v2/view-config', query ),
|
|
1366
1376
|
} );
|
|
1367
1377
|
dispatch.receiveViewConfig( kind, name, config );
|
|
1368
1378
|
};
|