@wordpress/core-data 7.6.0 → 7.7.1-next.5368f64a9.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 +2 -2
- package/build/actions.js +39 -16
- package/build/actions.js.map +1 -1
- package/build/footnotes/index.js +5 -1
- package/build/footnotes/index.js.map +1 -1
- package/build/hooks/use-entity-prop.js +4 -4
- package/build/hooks/use-entity-prop.js.map +1 -1
- package/build/reducer.js +5 -0
- package/build/reducer.js.map +1 -1
- package/build/resolvers.js +77 -36
- package/build/resolvers.js.map +1 -1
- package/build/utils/index.js +2 -2
- package/build/utils/index.js.map +1 -1
- package/build/utils/user-permissions.js +5 -7
- package/build/utils/user-permissions.js.map +1 -1
- package/build-module/actions.js +38 -16
- package/build-module/actions.js.map +1 -1
- package/build-module/footnotes/index.js +5 -1
- package/build-module/footnotes/index.js.map +1 -1
- package/build-module/hooks/use-entity-prop.js +4 -4
- package/build-module/hooks/use-entity-prop.js.map +1 -1
- package/build-module/reducer.js +5 -0
- package/build-module/reducer.js.map +1 -1
- package/build-module/resolvers.js +78 -37
- package/build-module/resolvers.js.map +1 -1
- package/build-module/utils/index.js +1 -1
- package/build-module/utils/index.js.map +1 -1
- package/build-module/utils/user-permissions.js +4 -6
- package/build-module/utils/user-permissions.js.map +1 -1
- package/build-types/actions.d.ts +20 -2
- package/build-types/actions.d.ts.map +1 -1
- package/build-types/footnotes/index.d.ts.map +1 -1
- package/build-types/hooks/use-entity-prop.d.ts +5 -5
- package/build-types/hooks/use-entity-prop.d.ts.map +1 -1
- package/build-types/index.d.ts +5 -2
- package/build-types/index.d.ts.map +1 -1
- package/build-types/reducer.d.ts.map +1 -1
- package/build-types/resolvers.d.ts +5 -3
- package/build-types/resolvers.d.ts.map +1 -1
- package/build-types/utils/index.d.ts +1 -1
- package/build-types/utils/user-permissions.d.ts +1 -1
- package/build-types/utils/user-permissions.d.ts.map +1 -1
- package/package.json +18 -18
- package/src/actions.js +38 -16
- package/src/footnotes/index.js +9 -4
- package/src/hooks/test/use-entity-records.js +2 -2
- package/src/hooks/use-entity-prop.js +4 -4
- package/src/reducer.js +5 -0
- package/src/resolvers.js +117 -54
- package/src/test/resolvers.js +5 -12
- package/src/utils/index.js +1 -1
- package/src/utils/user-permissions.js +4 -6
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -9,5 +9,5 @@ export { default as isRawAttribute } from './is-raw-attribute';
|
|
|
9
9
|
export { default as setNestedValue } from './set-nested-value';
|
|
10
10
|
export { default as getNestedValue } from './get-nested-value';
|
|
11
11
|
export { default as isNumericID } from './is-numeric-id';
|
|
12
|
-
export { getUserPermissionCacheKey,
|
|
12
|
+
export { getUserPermissionCacheKey, getUserPermissionsFromAllowHeader, ALLOWED_RESOURCE_ACTIONS } from './user-permissions';
|
|
13
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["default","conservativeMapItem","getNormalizedCommaSeparable","ifMatchingAction","forwardResolver","onSubKey","replaceAction","withWeakMapCache","isRawAttribute","setNestedValue","getNestedValue","isNumericID","getUserPermissionCacheKey","
|
|
1
|
+
{"version":3,"names":["default","conservativeMapItem","getNormalizedCommaSeparable","ifMatchingAction","forwardResolver","onSubKey","replaceAction","withWeakMapCache","isRawAttribute","setNestedValue","getNestedValue","isNumericID","getUserPermissionCacheKey","getUserPermissionsFromAllowHeader","ALLOWED_RESOURCE_ACTIONS"],"sources":["@wordpress/core-data/src/utils/index.js"],"sourcesContent":["export { default as conservativeMapItem } from './conservative-map-item';\nexport { default as getNormalizedCommaSeparable } from './get-normalized-comma-separable';\nexport { default as ifMatchingAction } from './if-matching-action';\nexport { default as forwardResolver } from './forward-resolver';\nexport { default as onSubKey } from './on-sub-key';\nexport { default as replaceAction } from './replace-action';\nexport { default as withWeakMapCache } from './with-weak-map-cache';\nexport { default as isRawAttribute } from './is-raw-attribute';\nexport { default as setNestedValue } from './set-nested-value';\nexport { default as getNestedValue } from './get-nested-value';\nexport { default as isNumericID } from './is-numeric-id';\nexport {\n\tgetUserPermissionCacheKey,\n\tgetUserPermissionsFromAllowHeader,\n\tALLOWED_RESOURCE_ACTIONS,\n} from './user-permissions';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,mBAAmB,QAAQ,yBAAyB;AACxE,SAASD,OAAO,IAAIE,2BAA2B,QAAQ,kCAAkC;AACzF,SAASF,OAAO,IAAIG,gBAAgB,QAAQ,sBAAsB;AAClE,SAASH,OAAO,IAAII,eAAe,QAAQ,oBAAoB;AAC/D,SAASJ,OAAO,IAAIK,QAAQ,QAAQ,cAAc;AAClD,SAASL,OAAO,IAAIM,aAAa,QAAQ,kBAAkB;AAC3D,SAASN,OAAO,IAAIO,gBAAgB,QAAQ,uBAAuB;AACnE,SAASP,OAAO,IAAIQ,cAAc,QAAQ,oBAAoB;AAC9D,SAASR,OAAO,IAAIS,cAAc,QAAQ,oBAAoB;AAC9D,SAAST,OAAO,IAAIU,cAAc,QAAQ,oBAAoB;AAC9D,SAASV,OAAO,IAAIW,WAAW,QAAQ,iBAAiB;AACxD,SACCC,yBAAyB,EACzBC,iCAAiC,EACjCC,wBAAwB,QAClB,oBAAoB","ignoreList":[]}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
export const ALLOWED_RESOURCE_ACTIONS = ['create', 'read', 'update', 'delete'];
|
|
2
|
-
export function
|
|
2
|
+
export function getUserPermissionsFromAllowHeader(allowedMethods) {
|
|
3
3
|
const permissions = {};
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// only return the result, without including response properties like the headers.
|
|
8
|
-
const allowedMethods = response.headers?.get('allow') || '';
|
|
4
|
+
if (!allowedMethods) {
|
|
5
|
+
return permissions;
|
|
6
|
+
}
|
|
9
7
|
const methods = {
|
|
10
8
|
create: 'POST',
|
|
11
9
|
read: 'GET',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ALLOWED_RESOURCE_ACTIONS","
|
|
1
|
+
{"version":3,"names":["ALLOWED_RESOURCE_ACTIONS","getUserPermissionsFromAllowHeader","allowedMethods","permissions","methods","create","read","update","delete","actionName","methodName","Object","entries","includes","getUserPermissionCacheKey","action","resource","id","key","kind","name","filter","Boolean","join"],"sources":["@wordpress/core-data/src/utils/user-permissions.js"],"sourcesContent":["export const ALLOWED_RESOURCE_ACTIONS = [\n\t'create',\n\t'read',\n\t'update',\n\t'delete',\n];\n\nexport function getUserPermissionsFromAllowHeader( allowedMethods ) {\n\tconst permissions = {};\n\tif ( ! allowedMethods ) {\n\t\treturn permissions;\n\t}\n\n\tconst methods = {\n\t\tcreate: 'POST',\n\t\tread: 'GET',\n\t\tupdate: 'PUT',\n\t\tdelete: 'DELETE',\n\t};\n\tfor ( const [ actionName, methodName ] of Object.entries( methods ) ) {\n\t\tpermissions[ actionName ] = allowedMethods.includes( methodName );\n\t}\n\n\treturn permissions;\n}\n\nexport function getUserPermissionCacheKey( action, resource, id ) {\n\tconst key = (\n\t\ttypeof resource === 'object'\n\t\t\t? [ action, resource.kind, resource.name, resource.id ]\n\t\t\t: [ action, resource, id ]\n\t)\n\t\t.filter( Boolean )\n\t\t.join( '/' );\n\n\treturn key;\n}\n"],"mappings":"AAAA,OAAO,MAAMA,wBAAwB,GAAG,CACvC,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,QAAQ,CACR;AAED,OAAO,SAASC,iCAAiCA,CAAEC,cAAc,EAAG;EACnE,MAAMC,WAAW,GAAG,CAAC,CAAC;EACtB,IAAK,CAAED,cAAc,EAAG;IACvB,OAAOC,WAAW;EACnB;EAEA,MAAMC,OAAO,GAAG;IACfC,MAAM,EAAE,MAAM;IACdC,IAAI,EAAE,KAAK;IACXC,MAAM,EAAE,KAAK;IACbC,MAAM,EAAE;EACT,CAAC;EACD,KAAM,MAAM,CAAEC,UAAU,EAAEC,UAAU,CAAE,IAAIC,MAAM,CAACC,OAAO,CAAER,OAAQ,CAAC,EAAG;IACrED,WAAW,CAAEM,UAAU,CAAE,GAAGP,cAAc,CAACW,QAAQ,CAAEH,UAAW,CAAC;EAClE;EAEA,OAAOP,WAAW;AACnB;AAEA,OAAO,SAASW,yBAAyBA,CAAEC,MAAM,EAAEC,QAAQ,EAAEC,EAAE,EAAG;EACjE,MAAMC,GAAG,GAAG,CACX,OAAOF,QAAQ,KAAK,QAAQ,GACzB,CAAED,MAAM,EAAEC,QAAQ,CAACG,IAAI,EAAEH,QAAQ,CAACI,IAAI,EAAEJ,QAAQ,CAACC,EAAE,CAAE,GACrD,CAAEF,MAAM,EAAEC,QAAQ,EAAEC,EAAE,CAAE,EAE1BI,MAAM,CAAEC,OAAQ,CAAC,CACjBC,IAAI,CAAE,GAAI,CAAC;EAEb,OAAOL,GAAG;AACX","ignoreList":[]}
|
package/build-types/actions.d.ts
CHANGED
|
@@ -146,6 +146,24 @@ export function receiveUploadPermissions(hasUploadPermissions: boolean): any;
|
|
|
146
146
|
* @return {Object} Action object.
|
|
147
147
|
*/
|
|
148
148
|
export function receiveUserPermission(key: string, isAllowed: boolean): any;
|
|
149
|
+
/**
|
|
150
|
+
* Returns an action object used in signalling that the current user has
|
|
151
|
+
* permission to perform an action on a REST resource. Ignored from
|
|
152
|
+
* documentation as it's internal to the data store.
|
|
153
|
+
*
|
|
154
|
+
* @ignore
|
|
155
|
+
*
|
|
156
|
+
* @param {Object<string, boolean>} permissions An object where keys represent
|
|
157
|
+
* actions and REST resources, and
|
|
158
|
+
* values indicate whether the user
|
|
159
|
+
* is allowed to perform the
|
|
160
|
+
* action.
|
|
161
|
+
*
|
|
162
|
+
* @return {Object} Action object.
|
|
163
|
+
*/
|
|
164
|
+
export function receiveUserPermissions(permissions: {
|
|
165
|
+
[x: string]: boolean;
|
|
166
|
+
}): any;
|
|
149
167
|
/**
|
|
150
168
|
* Returns an action object used in signalling that the autosaves for a
|
|
151
169
|
* post have been received.
|
|
@@ -176,7 +194,7 @@ export function receiveNavigationFallbackId(fallbackId: integer): any;
|
|
|
176
194
|
* @return {Object} Action object.
|
|
177
195
|
*/
|
|
178
196
|
export function receiveDefaultTemplateId(query: any, templateId: string): any;
|
|
179
|
-
export function deleteEntityRecord(kind: string, name: string, recordId: string, query: any | null, { __unstableFetch, throwOnError }?: {
|
|
197
|
+
export function deleteEntityRecord(kind: string, name: string, recordId: number | string, query: any | null, { __unstableFetch, throwOnError }?: {
|
|
180
198
|
__unstableFetch?: Function | undefined;
|
|
181
199
|
throwOnError?: boolean | undefined;
|
|
182
200
|
} | undefined): ({ dispatch }: {
|
|
@@ -208,7 +226,7 @@ export function saveEditedEntityRecord(kind: string, name: string, recordId: any
|
|
|
208
226
|
select: any;
|
|
209
227
|
dispatch: any;
|
|
210
228
|
}) => Promise<any>;
|
|
211
|
-
export function __experimentalSaveSpecifiedEntityEdits(kind: string, name: string, recordId:
|
|
229
|
+
export function __experimentalSaveSpecifiedEntityEdits(kind: string, name: string, recordId: number | string, itemsToSave: any[], options: any): ({ select, dispatch }: {
|
|
212
230
|
select: any;
|
|
213
231
|
dispatch: any;
|
|
214
232
|
}) => Promise<any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.js"],"names":[],"mappings":"AAuBA;;;;;;;;;;GAUG;AACH,0CALW,MAAM,SACN,WAAY,OAUtB;AAED;;;;;;;;;GASG;AACH,0DAKC;AAED;;;;;;GAMG;AACH,kDAKC;AAED;;;;;;;;;;;GAWG;AACH,2CATW,MAAM,QACN,MAAM,WACN,WAAY,SACZ,UAAO,oBACN,OAAO,OAAA,sBACR,UAAO,QACP,UAAO,OAmCjB;AAED;;;;;;;;;GASG;AACH,4DAKC;AAED;;;;;;;;;GASG;AACH,kFAJW,MAAM,OAWhB;AAED;;;;;;;;;;GAUG;AACH,uEALW,MAAM,0BAchB;AAED;;;;;;;;;;GAUG;AACH,4EALW,MAAM,0BAchB;AAED;;;;;;GAMG;AACH,4CAQC;AAED;;;;;;;;;;;;GAYG;AACH,4DALW,MAAM,yBAkBhB;AAED;;;;;;;;;;;GAWG;AACH,yCALW,MAAM,WACN,GAAC,OAUX;AA8kBD;;;;;;;;GAQG;AACH,+DAJW,OAAO,OAWjB;AAED;;;;;;;;;;;GAWG;AACH,2CALW,MAAM,aACN,OAAO,OAUjB;AAED;;;;;;;;;;;GAWG;AACH,yCALW,MAAM,aACN,WAAY,OAUtB;AAED;;;;;;GAMG;AACH,wDAHW,OAAO,OAQjB;AAED;;;;;;;GAOG;AACH,iEAJW,MAAM,OAUhB;
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.js"],"names":[],"mappings":"AAuBA;;;;;;;;;;GAUG;AACH,0CALW,MAAM,SACN,WAAY,OAUtB;AAED;;;;;;;;;GASG;AACH,0DAKC;AAED;;;;;;GAMG;AACH,kDAKC;AAED;;;;;;;;;;;GAWG;AACH,2CATW,MAAM,QACN,MAAM,WACN,WAAY,SACZ,UAAO,oBACN,OAAO,OAAA,sBACR,UAAO,QACP,UAAO,OAmCjB;AAED;;;;;;;;;GASG;AACH,4DAKC;AAED;;;;;;;;;GASG;AACH,kFAJW,MAAM,OAWhB;AAED;;;;;;;;;;GAUG;AACH,uEALW,MAAM,0BAchB;AAED;;;;;;;;;;GAUG;AACH,4EALW,MAAM,0BAchB;AAED;;;;;;GAMG;AACH,4CAQC;AAED;;;;;;;;;;;;GAYG;AACH,4DALW,MAAM,yBAkBhB;AAED;;;;;;;;;;;GAWG;AACH,yCALW,MAAM,WACN,GAAC,OAUX;AA8kBD;;;;;;;;GAQG;AACH,+DAJW,OAAO,OAWjB;AAED;;;;;;;;;;;GAWG;AACH,2CALW,MAAM,aACN,OAAO,OAUjB;AAED;;;;;;;;;;;;;;GAcG;AACH,oDARW;QAAO,MAAM,GAAE,OAAO;CAAC,OAajC;AAED;;;;;;;;;;;GAWG;AACH,yCALW,MAAM,aACN,WAAY,OAUtB;AAED;;;;;;GAMG;AACH,wDAHW,OAAO,OAQjB;AAED;;;;;;;GAOG;AACH,iEAJW,MAAM,OAUhB;AAzqBM,yCAZI,MAAM,QACN,MAAM,YACN,MAAM,GAAC,MAAM,SACb,UAAO;;;;;mCA6EhB;AAeK,uCATI,MAAM,QACN,MAAM,YACN,MAAM,GAAC,MAAM,wBAGrB;IAAgC,UAAU;CAE1C,OAwED;AAMK;;;WAWL;AAMK;;;WAWL;AAOK,iDAIL;AAgBK,uCAXI,MAAM,QACN,MAAM,gEAGd;IAA2B,UAAU;IACV,eAAe;IAGf,YAAY;CAEzC;;;;mBA0NC;AAwBK,sDAHK,CAAC,SAAS,KAAQ,iBAAY,CAuCxC;AAUK,6CALI,MAAM,QACN,MAAM,2BAEN,eAAO;;;mBAwBhB;AAWK,6DANI,MAAM,QACN,MAAM,YACN,MAAM,GAAC,MAAM;;;mBAyCtB;AA2HK,uCARI,MAAM,QACN,MAAM,aACN,MAAM,GAAC,MAAM,WACb,WAAY,SACZ,UAAO,oBACN,OAAO,OAAA,qBACR,UAAO;;oBAyBhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/footnotes/index.js"],"names":[],"mappings":"AAYA;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/footnotes/index.js"],"names":[],"mappings":"AAYA;;EAkIC"}
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
* specified property of the nearest provided
|
|
4
4
|
* entity of the specified type.
|
|
5
5
|
*
|
|
6
|
-
* @param {string}
|
|
7
|
-
* @param {string}
|
|
8
|
-
* @param {string}
|
|
9
|
-
* @param {string} [_id] An entity ID to use instead of the context-provided one.
|
|
6
|
+
* @param {string} kind The entity kind.
|
|
7
|
+
* @param {string} name The entity name.
|
|
8
|
+
* @param {string} prop The property name.
|
|
9
|
+
* @param {number|string} [_id] An entity ID to use instead of the context-provided one.
|
|
10
10
|
*
|
|
11
11
|
* @return {[*, Function, *]} An array where the first item is the
|
|
12
12
|
* property value, the second is the
|
|
@@ -15,5 +15,5 @@
|
|
|
15
15
|
* information like `raw`, `rendered` and
|
|
16
16
|
* `protected` props.
|
|
17
17
|
*/
|
|
18
|
-
export default function useEntityProp(kind: string, name: string, prop: string, _id?: string | undefined): [any, Function, any];
|
|
18
|
+
export default function useEntityProp(kind: string, name: string, prop: string, _id?: string | number | undefined): [any, Function, any];
|
|
19
19
|
//# sourceMappingURL=use-entity-prop.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-entity-prop.d.ts","sourceRoot":"","sources":["../../src/hooks/use-entity-prop.js"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;;GAgBG;AACH,4CAZW,MAAM,QACN,MAAM,QACN,MAAM,
|
|
1
|
+
{"version":3,"file":"use-entity-prop.d.ts","sourceRoot":"","sources":["../../src/hooks/use-entity-prop.js"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;;GAgBG;AACH,4CAZW,MAAM,QACN,MAAM,QACN,MAAM,sCAGL,CAAC,GAAC,YAAY,GAAC,CAAC,CAqC3B"}
|
package/build-types/index.d.ts
CHANGED
|
@@ -21,10 +21,13 @@ export const store: import("@wordpress/data/build-types/types").StoreDescriptor<
|
|
|
21
21
|
receiveEmbedPreview(url: string, preview: any): any;
|
|
22
22
|
receiveUploadPermissions(hasUploadPermissions: boolean): any;
|
|
23
23
|
receiveUserPermission(key: string, isAllowed: boolean): any;
|
|
24
|
+
receiveUserPermissions(permissions: {
|
|
25
|
+
[x: string]: boolean;
|
|
26
|
+
}): any;
|
|
24
27
|
receiveAutosaves(postId: number, autosaves: any[] | any): any;
|
|
25
28
|
receiveNavigationFallbackId(fallbackId: integer): any;
|
|
26
29
|
receiveDefaultTemplateId(query: any, templateId: string): any;
|
|
27
|
-
deleteEntityRecord: (kind: string, name: string, recordId: string, query: any | null, { __unstableFetch, throwOnError }?: {
|
|
30
|
+
deleteEntityRecord: (kind: string, name: string, recordId: number | string, query: any | null, { __unstableFetch, throwOnError }?: {
|
|
28
31
|
__unstableFetch?: Function | undefined;
|
|
29
32
|
throwOnError?: boolean | undefined;
|
|
30
33
|
} | undefined) => ({ dispatch }: {
|
|
@@ -56,7 +59,7 @@ export const store: import("@wordpress/data/build-types/types").StoreDescriptor<
|
|
|
56
59
|
select: any;
|
|
57
60
|
dispatch: any;
|
|
58
61
|
}) => Promise<any>;
|
|
59
|
-
__experimentalSaveSpecifiedEntityEdits: (kind: string, name: string, recordId:
|
|
62
|
+
__experimentalSaveSpecifiedEntityEdits: (kind: string, name: string, recordId: number | string, itemsToSave: any[], options: any) => ({ select, dispatch }: {
|
|
60
63
|
select: any;
|
|
61
64
|
dispatch: any;
|
|
62
65
|
}) => Promise<any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AA0EA;;;;GAIG;AACH
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AA0EA;;;;GAIG;AACH;;;;;;;;;;;;;;;;;;;;;;4CAUsprB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAV1lrB;;;;;;;2BAtExC,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../src/reducer.js"],"names":[],"mappings":"AAmBA,2DAA2D;AAE3D;;;;;;;;;;GAUG;AACH,gEAUC;AAED;;;;;;;GAOG;AACH,gEAuBC;AAED;;;;;;;GAOG;AACH,sEAOC;AAED;;;;;;;GAOG;AACH,qEAOC;AAED;;;;;;;GAOG;AACH,oCALW,MAAM,GAAC,SAAS,gBAGf,MAAM,GAAC,SAAS,CAS3B;AAED;;;;;;;GAOG;AACH,6CALW,MAAM,GAAC,SAAS,gBAGf,MAAM,GAAC,SAAS,CAS3B;AAED;;;;;;;GAOG;AACH,6CALW,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,4BAGrB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAYjC;AAED;;;;;;;GAOG;AACH,kDALW,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,4BAGrB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAYjC;AAiND;;;;;;;GAOG;AACH,yEAOC;AA+DD;;GAEG;AACH,sKAEC;AAED,uEAQC;AAED;;;;;;;GAOG;AACH,wEAUC;AAED;;;;;;;;GAQG;AACH,
|
|
1
|
+
{"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../src/reducer.js"],"names":[],"mappings":"AAmBA,2DAA2D;AAE3D;;;;;;;;;;GAUG;AACH,gEAUC;AAED;;;;;;;GAOG;AACH,gEAuBC;AAED;;;;;;;GAOG;AACH,sEAOC;AAED;;;;;;;GAOG;AACH,qEAOC;AAED;;;;;;;GAOG;AACH,oCALW,MAAM,GAAC,SAAS,gBAGf,MAAM,GAAC,SAAS,CAS3B;AAED;;;;;;;GAOG;AACH,6CALW,MAAM,GAAC,SAAS,gBAGf,MAAM,GAAC,SAAS,CAS3B;AAED;;;;;;;GAOG;AACH,6CALW,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,4BAGrB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAYjC;AAED;;;;;;;GAOG;AACH,kDALW,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,4BAGrB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAYjC;AAiND;;;;;;;GAOG;AACH,yEAOC;AA+DD;;GAEG;AACH,sKAEC;AAED,uEAQC;AAED;;;;;;;GAOG;AACH,wEAUC;AAED;;;;;;;;GAQG;AACH,0EAeC;AAED;;;;;;;GAOG;AACH,oEAYC;AAED,0EAOC;AAED,mFAOC;AAED,kFAMC;AAED,gFAOC;AAED;;;;;;;GAOG;AACH,iDALW,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,4BAGrB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAYjC;AAED;;;;;;;GAOG;AACH,wCALW,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,4BAGrB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAYjC;AAnNM,mEAmDN;;;;;;;;;;;;;;;;;;;;;;;;0BAjca,OAAO,SAAS,EAAE,WAAW"}
|
|
@@ -39,7 +39,7 @@ export function canUser(requestedAction: string, resource: string | any, id: str
|
|
|
39
39
|
dispatch: any;
|
|
40
40
|
registry: any;
|
|
41
41
|
}) => Promise<void>;
|
|
42
|
-
export function canUserEditEntityRecord(kind: string, name: string, recordId: string): ({ dispatch }: {
|
|
42
|
+
export function canUserEditEntityRecord(kind: string, name: string, recordId: number | string): ({ dispatch }: {
|
|
43
43
|
dispatch: any;
|
|
44
44
|
}) => Promise<void>;
|
|
45
45
|
export function getAutosaves(postType: string, postId: number): ({ dispatch, resolveSelect }: {
|
|
@@ -85,15 +85,17 @@ export function getUserPatternCategories(): ({ dispatch, resolveSelect }: {
|
|
|
85
85
|
dispatch: any;
|
|
86
86
|
resolveSelect: any;
|
|
87
87
|
}) => Promise<void>;
|
|
88
|
-
export function getNavigationFallbackId(): ({ dispatch, select }: {
|
|
88
|
+
export function getNavigationFallbackId(): ({ dispatch, select, registry }: {
|
|
89
89
|
dispatch: any;
|
|
90
90
|
select: any;
|
|
91
|
+
registry: any;
|
|
91
92
|
}) => Promise<void>;
|
|
92
93
|
export function getDefaultTemplateId(query: any): ({ dispatch }: {
|
|
93
94
|
dispatch: any;
|
|
94
95
|
}) => Promise<void>;
|
|
95
|
-
export function getRevisions(kind: string, name: string, recordKey: number | string, query?: any | undefined): ({ dispatch }: {
|
|
96
|
+
export function getRevisions(kind: string, name: string, recordKey: number | string, query?: any | undefined): ({ dispatch, registry }: {
|
|
96
97
|
dispatch: any;
|
|
98
|
+
registry: any;
|
|
97
99
|
}) => Promise<void>;
|
|
98
100
|
export namespace getRevisions {
|
|
99
101
|
function shouldInvalidate(action: any, kind: any, name: any, recordKey: any): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../src/resolvers.js"],"names":[],"mappings":"AAiCO,kCAHI,MAAO,SAAS;;oBAYzB;AAKK;;oBAKL;AAYK,sCAPI,MAAM,QACN,MAAM,QACN,MAAM,GAAC,MAAM,sBACb,MAAO,SAAS;;;;
|
|
1
|
+
{"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../src/resolvers.js"],"names":[],"mappings":"AAiCO,kCAHI,MAAO,SAAS;;oBAYzB;AAKK;;oBAKL;AAYK,sCAPI,MAAM,QACN,MAAM,QACN,MAAM,GAAC,MAAM,sBACb,MAAO,SAAS;;;;oBAsJzB;AAEF;;GAEG;AACH,0CAAuE;AAEvE;;GAEG;AACH,6CAA0E;AAUnE,uCALI,MAAM,QACN,MAAM,UACN,UAAO;;;oBAgJhB;;IAEF,kEAOC;;AAKM;;;oBAUL;AAEF;;GAEG;AACH,wCAAqE;AAO9D,qCAFI,MAAM;;oBAcf;AAYK,yCANI,MAAM,YAEN,MAAM,MAAO,MAEZ,MAAM,OAAA;;;oBAqFhB;AAUK,8CAJI,MAAM,QACN,MAAM,YACN,MAAM,GAAC,MAAM;;oBAMtB;AAQK,uCAHI,MAAM,UACN,MAAM;;;oBAcf;AAWK,sCAHI,MAAM,UACN,MAAM;;oBAMf;AAOK,uDAFI,MAAM;;;oBAsCf;;IAEF,4CAOC;;AAEM;;;oBAuBL;AAEK;;;oBAWL;AAEK;;;oBAWL;AAKK;;;oBA+BL;;IAEF,gDAOC;;AAEM;;oBAKL;AAEK;;oBAOL;AAEK;;;oBAwBL;AAEK;;;;oBA0CL;AAEK;;oBAUL;AAYK,mCAPI,MAAM,QACN,MAAM,aACN,MAAM,GAAC,MAAM,UACb,MAAO,SAAS;;;oBAwGzB;;IAGF,sFAK8B;;AAavB,kCARI,MAAM,QACN,MAAM,aACN,MAAM,GAAC,MAAM,eACb,MAAM,GAAC,MAAM,SACb,MAAO,SAAS;;oBA+CzB"}
|
|
@@ -9,5 +9,5 @@ export { default as isRawAttribute } from "./is-raw-attribute";
|
|
|
9
9
|
export { default as setNestedValue } from "./set-nested-value";
|
|
10
10
|
export { default as getNestedValue } from "./get-nested-value";
|
|
11
11
|
export { default as isNumericID } from "./is-numeric-id";
|
|
12
|
-
export { getUserPermissionCacheKey,
|
|
12
|
+
export { getUserPermissionCacheKey, getUserPermissionsFromAllowHeader, ALLOWED_RESOURCE_ACTIONS } from "./user-permissions";
|
|
13
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function
|
|
1
|
+
export function getUserPermissionsFromAllowHeader(allowedMethods: any): {};
|
|
2
2
|
export function getUserPermissionCacheKey(action: any, resource: any, id: any): string;
|
|
3
3
|
export const ALLOWED_RESOURCE_ACTIONS: string[];
|
|
4
4
|
//# sourceMappingURL=user-permissions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user-permissions.d.ts","sourceRoot":"","sources":["../../src/utils/user-permissions.js"],"names":[],"mappings":"AAOA,
|
|
1
|
+
{"version":3,"file":"user-permissions.d.ts","sourceRoot":"","sources":["../../src/utils/user-permissions.js"],"names":[],"mappings":"AAOA,2EAiBC;AAED,uFAUC;AApCD,gDAKE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/core-data",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.7.1-next.5368f64a9.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",
|
|
@@ -32,22 +32,22 @@
|
|
|
32
32
|
],
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "^7.16.0",
|
|
35
|
-
"@wordpress/api-fetch": "^7.
|
|
36
|
-
"@wordpress/block-editor": "^14.1.0",
|
|
37
|
-
"@wordpress/blocks": "^13.
|
|
38
|
-
"@wordpress/compose": "^7.
|
|
39
|
-
"@wordpress/data": "^10.
|
|
40
|
-
"@wordpress/deprecated": "^4.
|
|
41
|
-
"@wordpress/element": "^6.
|
|
42
|
-
"@wordpress/html-entities": "^4.
|
|
43
|
-
"@wordpress/i18n": "^5.
|
|
44
|
-
"@wordpress/is-shallow-equal": "^5.
|
|
45
|
-
"@wordpress/private-apis": "^1.
|
|
46
|
-
"@wordpress/rich-text": "^7.
|
|
47
|
-
"@wordpress/sync": "^1.
|
|
48
|
-
"@wordpress/undo-manager": "^1.
|
|
49
|
-
"@wordpress/url": "^4.
|
|
50
|
-
"@wordpress/warning": "^3.
|
|
35
|
+
"@wordpress/api-fetch": "^7.7.1-next.5368f64a9.0",
|
|
36
|
+
"@wordpress/block-editor": "^14.2.1-next.5368f64a9.0",
|
|
37
|
+
"@wordpress/blocks": "^13.7.1-next.5368f64a9.0",
|
|
38
|
+
"@wordpress/compose": "^7.8.1-next.5368f64a9.0",
|
|
39
|
+
"@wordpress/data": "^10.7.1-next.5368f64a9.0",
|
|
40
|
+
"@wordpress/deprecated": "^4.7.1-next.5368f64a9.0",
|
|
41
|
+
"@wordpress/element": "^6.7.1-next.5368f64a9.0",
|
|
42
|
+
"@wordpress/html-entities": "^4.7.1-next.5368f64a9.0",
|
|
43
|
+
"@wordpress/i18n": "^5.7.1-next.5368f64a9.0",
|
|
44
|
+
"@wordpress/is-shallow-equal": "^5.7.1-next.5368f64a9.0",
|
|
45
|
+
"@wordpress/private-apis": "^1.7.1-next.5368f64a9.0",
|
|
46
|
+
"@wordpress/rich-text": "^7.7.1-next.5368f64a9.0",
|
|
47
|
+
"@wordpress/sync": "^1.7.1-next.5368f64a9.0",
|
|
48
|
+
"@wordpress/undo-manager": "^1.7.1-next.5368f64a9.0",
|
|
49
|
+
"@wordpress/url": "^4.7.1-next.5368f64a9.0",
|
|
50
|
+
"@wordpress/warning": "^3.7.1-next.5368f64a9.0",
|
|
51
51
|
"change-case": "^4.1.2",
|
|
52
52
|
"equivalent-key-map": "^0.2.2",
|
|
53
53
|
"fast-deep-equal": "^3.1.3",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "24934a1f5251bbee15045d1fd953d9c5650317cd"
|
|
65
65
|
}
|
package/src/actions.js
CHANGED
|
@@ -265,17 +265,17 @@ export function receiveEmbedPreview( url, preview ) {
|
|
|
265
265
|
/**
|
|
266
266
|
* Action triggered to delete an entity record.
|
|
267
267
|
*
|
|
268
|
-
* @param {string}
|
|
269
|
-
* @param {string}
|
|
270
|
-
* @param {string}
|
|
271
|
-
* @param {?Object}
|
|
272
|
-
*
|
|
273
|
-
* @param {Object}
|
|
274
|
-
* @param {Function}
|
|
275
|
-
*
|
|
276
|
-
*
|
|
277
|
-
* @param {boolean}
|
|
278
|
-
*
|
|
268
|
+
* @param {string} kind Kind of the deleted entity.
|
|
269
|
+
* @param {string} name Name of the deleted entity.
|
|
270
|
+
* @param {number|string} recordId Record ID of the deleted entity.
|
|
271
|
+
* @param {?Object} query Special query parameters for the
|
|
272
|
+
* DELETE API call.
|
|
273
|
+
* @param {Object} [options] Delete options.
|
|
274
|
+
* @param {Function} [options.__unstableFetch] Internal use only. Function to
|
|
275
|
+
* call instead of `apiFetch()`.
|
|
276
|
+
* Must return a promise.
|
|
277
|
+
* @param {boolean} [options.throwOnError=false] If false, this action suppresses all
|
|
278
|
+
* the exceptions. Defaults to false.
|
|
279
279
|
*/
|
|
280
280
|
export const deleteEntityRecord =
|
|
281
281
|
(
|
|
@@ -805,11 +805,11 @@ export const saveEditedEntityRecord =
|
|
|
805
805
|
/**
|
|
806
806
|
* Action triggered to save only specified properties for the entity.
|
|
807
807
|
*
|
|
808
|
-
* @param {string}
|
|
809
|
-
* @param {string}
|
|
810
|
-
* @param {
|
|
811
|
-
* @param {Array}
|
|
812
|
-
* @param {Object}
|
|
808
|
+
* @param {string} kind Kind of the entity.
|
|
809
|
+
* @param {string} name Name of the entity.
|
|
810
|
+
* @param {number|string} recordId ID of the record.
|
|
811
|
+
* @param {Array} itemsToSave List of entity properties or property paths to save.
|
|
812
|
+
* @param {Object} options Saving options.
|
|
813
813
|
*/
|
|
814
814
|
export const __experimentalSaveSpecifiedEntityEdits =
|
|
815
815
|
( kind, name, recordId, itemsToSave, options ) =>
|
|
@@ -888,6 +888,28 @@ export function receiveUserPermission( key, isAllowed ) {
|
|
|
888
888
|
};
|
|
889
889
|
}
|
|
890
890
|
|
|
891
|
+
/**
|
|
892
|
+
* Returns an action object used in signalling that the current user has
|
|
893
|
+
* permission to perform an action on a REST resource. Ignored from
|
|
894
|
+
* documentation as it's internal to the data store.
|
|
895
|
+
*
|
|
896
|
+
* @ignore
|
|
897
|
+
*
|
|
898
|
+
* @param {Object<string, boolean>} permissions An object where keys represent
|
|
899
|
+
* actions and REST resources, and
|
|
900
|
+
* values indicate whether the user
|
|
901
|
+
* is allowed to perform the
|
|
902
|
+
* action.
|
|
903
|
+
*
|
|
904
|
+
* @return {Object} Action object.
|
|
905
|
+
*/
|
|
906
|
+
export function receiveUserPermissions( permissions ) {
|
|
907
|
+
return {
|
|
908
|
+
type: 'RECEIVE_USER_PERMISSIONS',
|
|
909
|
+
permissions,
|
|
910
|
+
};
|
|
911
|
+
}
|
|
912
|
+
|
|
891
913
|
/**
|
|
892
914
|
* Returns an action object used in signalling that the autosaves for a
|
|
893
915
|
* post have been received.
|
package/src/footnotes/index.js
CHANGED
|
@@ -72,6 +72,8 @@ export function updateFootnotesFromMeta( blocks, meta ) {
|
|
|
72
72
|
? RichTextData.fromHTMLString( value )
|
|
73
73
|
: new RichTextData( value );
|
|
74
74
|
|
|
75
|
+
let hasFootnotes = false;
|
|
76
|
+
|
|
75
77
|
richTextValue.replacements.forEach( ( replacement ) => {
|
|
76
78
|
if ( replacement.type === 'core/footnote' ) {
|
|
77
79
|
const id = replacement.attributes[ 'data-fn' ];
|
|
@@ -92,13 +94,16 @@ export function updateFootnotesFromMeta( blocks, meta ) {
|
|
|
92
94
|
replacement.innerHTML = toHTMLString( {
|
|
93
95
|
value: countValue,
|
|
94
96
|
} );
|
|
97
|
+
hasFootnotes = true;
|
|
95
98
|
}
|
|
96
99
|
} );
|
|
97
100
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
if ( hasFootnotes ) {
|
|
102
|
+
attributes[ key ] =
|
|
103
|
+
typeof value === 'string'
|
|
104
|
+
? richTextValue.toHTMLString()
|
|
105
|
+
: richTextValue;
|
|
106
|
+
}
|
|
102
107
|
}
|
|
103
108
|
|
|
104
109
|
return attributes;
|
|
@@ -15,10 +15,10 @@ import useEntityId from './use-entity-id';
|
|
|
15
15
|
* specified property of the nearest provided
|
|
16
16
|
* entity of the specified type.
|
|
17
17
|
*
|
|
18
|
-
* @param {string}
|
|
19
|
-
* @param {string}
|
|
20
|
-
* @param {string}
|
|
21
|
-
* @param {string} [_id] An entity ID to use instead of the context-provided one.
|
|
18
|
+
* @param {string} kind The entity kind.
|
|
19
|
+
* @param {string} name The entity name.
|
|
20
|
+
* @param {string} prop The property name.
|
|
21
|
+
* @param {number|string} [_id] An entity ID to use instead of the context-provided one.
|
|
22
22
|
*
|
|
23
23
|
* @return {[*, Function, *]} An array where the first item is the
|
|
24
24
|
* property value, the second is the
|
package/src/reducer.js
CHANGED