@wordpress/core-data 7.2.0 → 7.4.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 +4 -0
- package/README.md +54 -6
- package/build/actions.js +6 -6
- package/build/actions.js.map +1 -1
- package/build/entity-context.js +13 -0
- package/build/entity-context.js.map +1 -0
- package/build/entity-provider.js +4 -189
- package/build/entity-provider.js.map +1 -1
- package/build/entity-types/menu-location.js.map +1 -1
- package/build/entity-types/settings.js.map +1 -1
- package/build/entity-types/theme.js.map +1 -1
- package/build/entity-types/widget-type.js.map +1 -1
- package/build/hooks/index.js +22 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/use-entity-block-editor.js +140 -0
- package/build/hooks/use-entity-block-editor.js.map +1 -0
- package/build/hooks/use-entity-id.js +28 -0
- package/build/hooks/use-entity-id.js.map +1 -0
- package/build/hooks/use-entity-prop.js +65 -0
- package/build/hooks/use-entity-prop.js.map +1 -0
- package/build/hooks/use-resource-permissions.js +25 -8
- package/build/hooks/use-resource-permissions.js.map +1 -1
- package/build/resolvers.js +81 -70
- package/build/resolvers.js.map +1 -1
- package/build/selectors.js +23 -9
- package/build/selectors.js.map +1 -1
- package/build/utils/index.js +19 -0
- package/build/utils/index.js.map +1 -1
- package/build/utils/user-permissions.js +32 -0
- package/build/utils/user-permissions.js.map +1 -0
- package/build-module/actions.js +6 -6
- package/build-module/actions.js.map +1 -1
- package/build-module/entity-context.js +6 -0
- package/build-module/entity-context.js.map +1 -0
- package/build-module/entity-provider.js +3 -185
- package/build-module/entity-provider.js.map +1 -1
- package/build-module/entity-types/menu-location.js.map +1 -1
- package/build-module/entity-types/settings.js.map +1 -1
- package/build-module/entity-types/theme.js.map +1 -1
- package/build-module/entity-types/widget-type.js.map +1 -1
- package/build-module/hooks/index.js +3 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/use-entity-block-editor.js +132 -0
- package/build-module/hooks/use-entity-block-editor.js.map +1 -0
- package/build-module/hooks/use-entity-id.js +22 -0
- package/build-module/hooks/use-entity-id.js.map +1 -0
- package/build-module/hooks/use-entity-prop.js +58 -0
- package/build-module/hooks/use-entity-prop.js.map +1 -0
- package/build-module/hooks/use-resource-permissions.js +25 -8
- package/build-module/hooks/use-resource-permissions.js.map +1 -1
- package/build-module/resolvers.js +82 -71
- package/build-module/resolvers.js.map +1 -1
- package/build-module/selectors.js +24 -10
- package/build-module/selectors.js.map +1 -1
- package/build-module/utils/index.js +1 -0
- package/build-module/utils/index.js.map +1 -1
- package/build-module/utils/user-permissions.js +24 -0
- package/build-module/utils/user-permissions.js.map +1 -0
- package/build-types/actions.d.ts +3 -3
- package/build-types/actions.d.ts.map +1 -1
- package/build-types/batch/create-batch.d.ts.map +1 -1
- package/build-types/entities.d.ts.map +1 -1
- package/build-types/entity-context.d.ts +2 -0
- package/build-types/entity-context.d.ts.map +1 -0
- package/build-types/entity-provider.d.ts +0 -48
- package/build-types/entity-provider.d.ts.map +1 -1
- package/build-types/entity-types/menu-location.d.ts.map +1 -1
- package/build-types/entity-types/settings.d.ts.map +1 -1
- package/build-types/entity-types/theme.d.ts.map +1 -1
- package/build-types/entity-types/widget-type.d.ts.map +1 -1
- package/build-types/fetch/__experimental-fetch-url-data.d.ts.map +1 -1
- package/build-types/hooks/index.d.ts +3 -0
- package/build-types/hooks/index.d.ts.map +1 -1
- package/build-types/hooks/use-entity-block-editor.d.ts +22 -0
- package/build-types/hooks/use-entity-block-editor.d.ts.map +1 -0
- package/build-types/hooks/use-entity-id.d.ts +9 -0
- package/build-types/hooks/use-entity-id.d.ts.map +1 -0
- package/build-types/hooks/use-entity-prop.d.ts +19 -0
- package/build-types/hooks/use-entity-prop.d.ts.map +1 -0
- package/build-types/hooks/use-resource-permissions.d.ts +8 -70
- package/build-types/hooks/use-resource-permissions.d.ts.map +1 -1
- package/build-types/index.d.ts +35 -32
- package/build-types/index.d.ts.map +1 -1
- package/build-types/locks/reducer.d.ts +1 -1
- package/build-types/locks/reducer.d.ts.map +1 -1
- package/build-types/queried-data/actions.d.ts +1 -1
- package/build-types/queried-data/actions.d.ts.map +1 -1
- package/build-types/queried-data/get-query-parts.d.ts.map +1 -1
- package/build-types/queried-data/reducer.d.ts +1 -1
- package/build-types/queried-data/reducer.d.ts.map +1 -1
- package/build-types/queried-data/selectors.d.ts +0 -1
- package/build-types/queried-data/selectors.d.ts.map +1 -1
- package/build-types/reducer.d.ts +13 -13
- package/build-types/reducer.d.ts.map +1 -1
- package/build-types/resolvers.d.ts +3 -2
- package/build-types/resolvers.d.ts.map +1 -1
- package/build-types/selectors.d.ts +11 -6
- package/build-types/selectors.d.ts.map +1 -1
- package/build-types/utils/get-nested-value.d.ts.map +1 -1
- package/build-types/utils/get-normalized-comma-separable.d.ts.map +1 -1
- package/build-types/utils/if-matching-action.d.ts +1 -1
- package/build-types/utils/index.d.ts +1 -0
- package/build-types/utils/on-sub-key.d.ts +1 -1
- package/build-types/utils/replace-action.d.ts +1 -1
- package/build-types/utils/set-nested-value.d.ts.map +1 -1
- package/build-types/utils/user-permissions.d.ts +4 -0
- package/build-types/utils/user-permissions.d.ts.map +1 -0
- package/package.json +18 -17
- package/src/actions.js +6 -6
- package/src/entity-context.js +6 -0
- package/src/entity-provider.js +2 -211
- package/src/entity-types/menu-location.ts +1 -0
- package/src/entity-types/settings.ts +1 -0
- package/src/entity-types/theme.ts +1 -0
- package/src/entity-types/widget-type.ts +1 -0
- package/src/hooks/index.ts +3 -0
- package/src/hooks/test/use-entity-record.js +5 -3
- package/src/hooks/test/use-resource-permissions.js +96 -5
- package/src/hooks/use-entity-block-editor.js +148 -0
- package/src/hooks/use-entity-id.js +21 -0
- package/src/hooks/use-entity-prop.js +60 -0
- package/src/hooks/use-resource-permissions.ts +46 -9
- package/src/resolvers.js +102 -78
- package/src/selectors.ts +24 -9
- package/src/test/entity-provider.js +6 -2
- package/src/test/resolvers.js +221 -50
- package/src/test/selectors.js +18 -55
- package/src/utils/index.js +5 -0
- package/src/utils/user-permissions.js +39 -0
- package/tsconfig.json +2 -2
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook that returns block content getters and setters for
|
|
3
|
+
* the nearest provided entity of the specified type.
|
|
4
|
+
*
|
|
5
|
+
* The return value has the shape `[ blocks, onInput, onChange ]`.
|
|
6
|
+
* `onInput` is for block changes that don't create undo levels
|
|
7
|
+
* or dirty the post, non-persistent changes, and `onChange` is for
|
|
8
|
+
* persistent changes. They map directly to the props of a
|
|
9
|
+
* `BlockEditorProvider` and are intended to be used with it,
|
|
10
|
+
* or similar components or hooks.
|
|
11
|
+
*
|
|
12
|
+
* @param {string} kind The entity kind.
|
|
13
|
+
* @param {string} name The entity name.
|
|
14
|
+
* @param {Object} options
|
|
15
|
+
* @param {string} [options.id] An entity ID to use instead of the context-provided one.
|
|
16
|
+
*
|
|
17
|
+
* @return {[unknown[], Function, Function]} The block array and setters.
|
|
18
|
+
*/
|
|
19
|
+
export default function useEntityBlockEditor(kind: string, name: string, { id: _id }?: {
|
|
20
|
+
id?: string | undefined;
|
|
21
|
+
}): [unknown[], Function, Function];
|
|
22
|
+
//# sourceMappingURL=use-entity-block-editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-entity-block-editor.d.ts","sourceRoot":"","sources":["../../src/hooks/use-entity-block-editor.js"],"names":[],"mappings":"AAiBA;;;;;;;;;;;;;;;;;GAiBG;AACH,mDAPW,MAAM,QACN,MAAM,gBAEd;IAAyB,EAAE;CAE3B,GAAS,CAAC,OAAO,EAAE,qBAAqB,CAkH1C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook that returns the ID for the nearest
|
|
3
|
+
* provided entity of the specified type.
|
|
4
|
+
*
|
|
5
|
+
* @param {string} kind The entity kind.
|
|
6
|
+
* @param {string} name The entity name.
|
|
7
|
+
*/
|
|
8
|
+
export default function useEntityId(kind: string, name: string): any;
|
|
9
|
+
//# sourceMappingURL=use-entity-id.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-entity-id.d.ts","sourceRoot":"","sources":["../../src/hooks/use-entity-id.js"],"names":[],"mappings":"AAUA;;;;;;GAMG;AACH,0CAHW,MAAM,QACN,MAAM,OAKhB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook that returns the value and a setter for the
|
|
3
|
+
* specified property of the nearest provided
|
|
4
|
+
* entity of the specified type.
|
|
5
|
+
*
|
|
6
|
+
* @param {string} kind The entity kind.
|
|
7
|
+
* @param {string} name The entity name.
|
|
8
|
+
* @param {string} prop The property name.
|
|
9
|
+
* @param {string} [_id] An entity ID to use instead of the context-provided one.
|
|
10
|
+
*
|
|
11
|
+
* @return {[*, Function, *]} An array where the first item is the
|
|
12
|
+
* property value, the second is the
|
|
13
|
+
* setter and the third is the full value
|
|
14
|
+
* object from REST API containing more
|
|
15
|
+
* information like `raw`, `rendered` and
|
|
16
|
+
* `protected` props.
|
|
17
|
+
*/
|
|
18
|
+
export default function useEntityProp(kind: string, name: string, prop: string, _id?: string | undefined): [any, Function, any];
|
|
19
|
+
//# sourceMappingURL=use-entity-prop.d.ts.map
|
|
@@ -0,0 +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,6BAGL,CAAC,GAAC,YAAY,GAAC,CAAC,CAqC3B"}
|
|
@@ -25,75 +25,13 @@ type ResourcePermissionsResolution<IdType> = [
|
|
|
25
25
|
HasResolved,
|
|
26
26
|
ResolutionDetails & GlobalResourcePermissionsResolution & (IdType extends void ? SpecificResourcePermissionsResolution : {})
|
|
27
27
|
];
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
* @example
|
|
37
|
-
* ```js
|
|
38
|
-
* import { useResourcePermissions } from '@wordpress/core-data';
|
|
39
|
-
*
|
|
40
|
-
* function PagesList() {
|
|
41
|
-
* const { canCreate, isResolving } = useResourcePermissions( 'pages' );
|
|
42
|
-
*
|
|
43
|
-
* if ( isResolving ) {
|
|
44
|
-
* return 'Loading ...';
|
|
45
|
-
* }
|
|
46
|
-
*
|
|
47
|
-
* return (
|
|
48
|
-
* <div>
|
|
49
|
-
* {canCreate ? (<button>+ Create a new page</button>) : false}
|
|
50
|
-
* // ...
|
|
51
|
-
* </div>
|
|
52
|
-
* );
|
|
53
|
-
* }
|
|
54
|
-
*
|
|
55
|
-
* // Rendered in the application:
|
|
56
|
-
* // <PagesList />
|
|
57
|
-
* ```
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
* ```js
|
|
61
|
-
* import { useResourcePermissions } from '@wordpress/core-data';
|
|
62
|
-
*
|
|
63
|
-
* function Page({ pageId }) {
|
|
64
|
-
* const {
|
|
65
|
-
* canCreate,
|
|
66
|
-
* canUpdate,
|
|
67
|
-
* canDelete,
|
|
68
|
-
* isResolving
|
|
69
|
-
* } = useResourcePermissions( 'pages', pageId );
|
|
70
|
-
*
|
|
71
|
-
* if ( isResolving ) {
|
|
72
|
-
* return 'Loading ...';
|
|
73
|
-
* }
|
|
74
|
-
*
|
|
75
|
-
* return (
|
|
76
|
-
* <div>
|
|
77
|
-
* {canCreate ? (<button>+ Create a new page</button>) : false}
|
|
78
|
-
* {canUpdate ? (<button>Edit page</button>) : false}
|
|
79
|
-
* {canDelete ? (<button>Delete page</button>) : false}
|
|
80
|
-
* // ...
|
|
81
|
-
* </div>
|
|
82
|
-
* );
|
|
83
|
-
* }
|
|
84
|
-
*
|
|
85
|
-
* // Rendered in the application:
|
|
86
|
-
* // <Page pageId={ 15 } />
|
|
87
|
-
* ```
|
|
88
|
-
*
|
|
89
|
-
* In the above example, when `PagesList` is rendered into an
|
|
90
|
-
* application, the appropriate permissions and the resolution details will be retrieved from
|
|
91
|
-
* the store state using `canUser()`, or resolved if missing.
|
|
92
|
-
*
|
|
93
|
-
* @return Entity records data.
|
|
94
|
-
* @template IdType
|
|
95
|
-
*/
|
|
96
|
-
export default function useResourcePermissions<IdType = void>(resource: string, id?: IdType): ResourcePermissionsResolution<IdType>;
|
|
28
|
+
type EntityResource = {
|
|
29
|
+
kind: string;
|
|
30
|
+
name: string;
|
|
31
|
+
id?: string | number;
|
|
32
|
+
};
|
|
33
|
+
declare function useResourcePermissions<IdType = void>(resource: string, id?: IdType): ResourcePermissionsResolution<IdType>;
|
|
34
|
+
declare function useResourcePermissions<IdType = void>(resource: EntityResource, id?: never): ResourcePermissionsResolution<IdType>;
|
|
35
|
+
export default useResourcePermissions;
|
|
97
36
|
export declare function __experimentalUseResourcePermissions(resource: string, id?: unknown): ResourcePermissionsResolution<unknown>;
|
|
98
|
-
export {};
|
|
99
37
|
//# sourceMappingURL=use-resource-permissions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-resource-permissions.d.ts","sourceRoot":"","sources":["../../src/hooks/use-resource-permissions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-resource-permissions.d.ts","sourceRoot":"","sources":["../../src/hooks/use-resource-permissions.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,UAAU,mCAAmC;IAC5C,8DAA8D;IAC9D,SAAS,EAAE,OAAO,CAAC;CACnB;AACD,UAAU,qCAAqC;IAC9C,0DAA0D;IAC1D,SAAS,EAAE,OAAO,CAAC;IACnB,0DAA0D;IAC1D,SAAS,EAAE,OAAO,CAAC;CACnB;AACD,UAAU,iBAAiB;IAC1B,wBAAwB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,KAAK,WAAW,GAAG,OAAO,CAAC;AAE3B,KAAK,6BAA6B,CAAE,MAAM,IAAK;IAC9C,WAAW;IACX,iBAAiB,GAChB,mCAAmC,GACnC,CAAE,MAAM,SAAS,IAAI,GAAG,qCAAqC,GAAG,EAAE,CAAE;CACrE,CAAC;AAEF,KAAK,cAAc,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AAE3E,iBAAS,sBAAsB,CAAE,MAAM,GAAG,IAAI,EAC7C,QAAQ,EAAE,MAAM,EAChB,EAAE,CAAC,EAAE,MAAM,GACT,6BAA6B,CAAE,MAAM,CAAE,CAAC;AAE3C,iBAAS,sBAAsB,CAAE,MAAM,GAAG,IAAI,EAC7C,QAAQ,EAAE,cAAc,EACxB,EAAE,CAAC,EAAE,KAAK,GACR,6BAA6B,CAAE,MAAM,CAAE,CAAC;AA2J3C,eAAe,sBAAsB,CAAC;AAEtC,wBAAgB,oCAAoC,CACnD,QAAQ,EAAE,MAAM,EAChB,EAAE,CAAC,EAAE,OAAO,0CAOZ"}
|
package/build-types/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="rememo" />
|
|
2
1
|
/**
|
|
3
2
|
* Store definition for the code data namespace.
|
|
4
3
|
*
|
|
@@ -9,10 +8,10 @@ export const store: import("@wordpress/data/build-types/types").StoreDescriptor<
|
|
|
9
8
|
exclusive: any;
|
|
10
9
|
}) => () => Promise<any>;
|
|
11
10
|
__unstableReleaseStoreLock: (lock: any) => () => void;
|
|
12
|
-
receiveUserQuery(queryID: string, users: any): any;
|
|
11
|
+
receiveUserQuery(queryID: string, users: any[] | any): any;
|
|
13
12
|
receiveCurrentUser(currentUser: any): any;
|
|
14
13
|
addEntities(entities: any[]): any;
|
|
15
|
-
receiveEntityRecords(kind: string, name: string, records: any, query: any, invalidateCache: boolean | null | undefined, edits: any, meta: any): any;
|
|
14
|
+
receiveEntityRecords(kind: string, name: string, records: any[] | any, query: any | null, invalidateCache: (boolean | null) | undefined, edits: any | null, meta: any | null): any;
|
|
16
15
|
receiveCurrentTheme(currentTheme: any): any;
|
|
17
16
|
__experimentalReceiveCurrentGlobalStylesId(currentGlobalStylesId: string): any;
|
|
18
17
|
__experimentalReceiveThemeBaseGlobalStyles(stylesheet: string, globalStyles: any): any;
|
|
@@ -22,16 +21,16 @@ export const store: import("@wordpress/data/build-types/types").StoreDescriptor<
|
|
|
22
21
|
receiveEmbedPreview(url: string, preview: any): any;
|
|
23
22
|
receiveUploadPermissions(hasUploadPermissions: boolean): any;
|
|
24
23
|
receiveUserPermission(key: string, isAllowed: boolean): any;
|
|
25
|
-
receiveAutosaves(postId: number, autosaves: any): any;
|
|
24
|
+
receiveAutosaves(postId: number, autosaves: any[] | any): any;
|
|
26
25
|
receiveNavigationFallbackId(fallbackId: integer): any;
|
|
27
26
|
receiveDefaultTemplateId(query: any, templateId: string): any;
|
|
28
|
-
deleteEntityRecord: (kind: string, name: string, recordId: string, query: any, { __unstableFetch, throwOnError }?: {
|
|
27
|
+
deleteEntityRecord: (kind: string, name: string, recordId: string, query: any | null, { __unstableFetch, throwOnError }?: {
|
|
29
28
|
__unstableFetch?: Function | undefined;
|
|
30
29
|
throwOnError?: boolean | undefined;
|
|
31
30
|
} | undefined) => ({ dispatch }: {
|
|
32
31
|
dispatch: any;
|
|
33
32
|
}) => Promise<boolean | undefined>;
|
|
34
|
-
editEntityRecord: (kind: string, name: string, recordId:
|
|
33
|
+
editEntityRecord: (kind: string, name: string, recordId: number | string, edits: any, options?: {
|
|
35
34
|
undoIgnore?: boolean | undefined;
|
|
36
35
|
}) => any;
|
|
37
36
|
undo: () => ({ select, dispatch }: {
|
|
@@ -53,7 +52,7 @@ export const store: import("@wordpress/data/build-types/types").StoreDescriptor<
|
|
|
53
52
|
dispatch: any;
|
|
54
53
|
}) => Promise<any>;
|
|
55
54
|
__experimentalBatch: (requests: any[]) => (thunkArgs: any) => Promise<any>;
|
|
56
|
-
saveEditedEntityRecord: (kind: string, name: string, recordId: any, options
|
|
55
|
+
saveEditedEntityRecord: (kind: string, name: string, recordId: any, options?: any | undefined) => ({ select, dispatch }: {
|
|
57
56
|
select: any;
|
|
58
57
|
dispatch: any;
|
|
59
58
|
}) => Promise<any>;
|
|
@@ -61,21 +60,21 @@ export const store: import("@wordpress/data/build-types/types").StoreDescriptor<
|
|
|
61
60
|
select: any;
|
|
62
61
|
dispatch: any;
|
|
63
62
|
}) => Promise<any>;
|
|
64
|
-
receiveRevisions: (kind: string, name: string, recordKey:
|
|
63
|
+
receiveRevisions: (kind: string, name: string, recordKey: number | string, records: any[] | any, query: any | null, invalidateCache: (boolean | null) | undefined, meta: any | null) => ({ dispatch }: {
|
|
65
64
|
dispatch: any;
|
|
66
65
|
}) => Promise<void>;
|
|
67
66
|
}, {
|
|
68
67
|
getAuthors(state: selectors.State, query?: {
|
|
69
68
|
[x: string]: any;
|
|
70
|
-
}
|
|
69
|
+
}): import("./entity-types").User[];
|
|
71
70
|
getCurrentUser(state: selectors.State): import("./entity-types").User<"edit">;
|
|
72
|
-
getEntitiesByKind(state: selectors.State, kind: string): any
|
|
71
|
+
getEntitiesByKind(state: selectors.State, kind: string): Array<any>;
|
|
73
72
|
getEntity(state: selectors.State, kind: string, name: string): any;
|
|
74
73
|
getEntityConfig(state: selectors.State, kind: string, name: string): any;
|
|
75
|
-
__experimentalGetEntityRecordNoResolver<EntityRecord extends import("./entity-types").
|
|
74
|
+
__experimentalGetEntityRecordNoResolver<EntityRecord extends import("./entity-types").EntityRecord<any>>(state: selectors.State, kind: string, name: string, key: string | number): EntityRecord | undefined;
|
|
76
75
|
hasEntityRecords(state: selectors.State, kind: string, name: string, query?: {
|
|
77
76
|
[x: string]: any;
|
|
78
|
-
}
|
|
77
|
+
}): boolean;
|
|
79
78
|
getEntityRecordEdits(state: selectors.State, kind: string, name: string, recordId: string | number): any;
|
|
80
79
|
hasEditsForEntityRecord(state: selectors.State, kind: string, name: string, recordId: string | number): boolean;
|
|
81
80
|
isAutosavingEntityRecord(state: selectors.State, kind: string, name: string, recordId: string | number): boolean;
|
|
@@ -92,28 +91,32 @@ export const store: import("@wordpress/data/build-types/types").StoreDescriptor<
|
|
|
92
91
|
getThemeSupports(state: selectors.State): any;
|
|
93
92
|
getEmbedPreview(state: selectors.State, url: string): any;
|
|
94
93
|
isPreviewEmbedFallback(state: selectors.State, url: string): boolean;
|
|
95
|
-
canUser(state: selectors.State, action: string, resource: string
|
|
94
|
+
canUser(state: selectors.State, action: string, resource: string | {
|
|
95
|
+
kind: string;
|
|
96
|
+
name: string;
|
|
97
|
+
id?: string | number;
|
|
98
|
+
}, id?: string | number): boolean | undefined;
|
|
96
99
|
canUserEditEntityRecord(state: selectors.State, kind: string, name: string, recordId: string | number): boolean | undefined;
|
|
97
|
-
getAutosaves(state: selectors.State, postType: string, postId: string | number): any
|
|
98
|
-
getAutosave<
|
|
100
|
+
getAutosaves(state: selectors.State, postType: string, postId: string | number): Array<any> | undefined;
|
|
101
|
+
getAutosave<EntityRecord extends import("./entity-types").EntityRecord<any>>(state: selectors.State, postType: string, postId: string | number, authorId: string | number): EntityRecord | undefined;
|
|
99
102
|
getReferenceByDistinctEdits(state: any): any;
|
|
100
|
-
__experimentalGetTemplateForLink(state: selectors.State, link: string):
|
|
103
|
+
__experimentalGetTemplateForLink(state: selectors.State, link: string): (import("./entity-types").Updatable<import("./entity-types").WpTemplate> | undefined) | null | false;
|
|
101
104
|
__experimentalGetCurrentThemeBaseGlobalStyles(state: selectors.State): any;
|
|
102
105
|
__experimentalGetCurrentThemeGlobalStylesVariations(state: selectors.State): string | null;
|
|
103
|
-
getBlockPatterns(state: selectors.State): any
|
|
104
|
-
getBlockPatternCategories(state: selectors.State): any
|
|
105
|
-
getUserPatternCategories(state: selectors.State): selectors.UserPatternCategory
|
|
106
|
-
getCurrentThemeGlobalStylesRevisions(state: selectors.State): object
|
|
106
|
+
getBlockPatterns(state: selectors.State): Array<any>;
|
|
107
|
+
getBlockPatternCategories(state: selectors.State): Array<any>;
|
|
108
|
+
getUserPatternCategories(state: selectors.State): Array<selectors.UserPatternCategory>;
|
|
109
|
+
getCurrentThemeGlobalStylesRevisions(state: selectors.State): Array<object> | null;
|
|
107
110
|
getDefaultTemplateId(state: selectors.State, query: {
|
|
108
|
-
slug?: string
|
|
109
|
-
is_custom?: boolean
|
|
110
|
-
ignore_empty?: boolean
|
|
111
|
+
slug?: string;
|
|
112
|
+
is_custom?: boolean;
|
|
113
|
+
ignore_empty?: boolean;
|
|
111
114
|
}): string;
|
|
112
115
|
isRequestingEmbedPreview: Function;
|
|
113
116
|
getUserQueryResults: ((state: selectors.State, queryID: string) => import("./entity-types").User<"edit">[]) & import("rememo").EnhancedSelector;
|
|
114
|
-
getEntitiesConfig: ((state: selectors.State, kind: string) => any
|
|
117
|
+
getEntitiesConfig: ((state: selectors.State, kind: string) => Array<any>) & import("rememo").EnhancedSelector;
|
|
115
118
|
getEntityRecord: selectors.GetEntityRecord;
|
|
116
|
-
getRawEntityRecord: (<
|
|
119
|
+
getRawEntityRecord: (<EntityRecord extends import("./entity-types").EntityRecord<any>>(state: selectors.State, kind: string, name: string, key: string | number) => EntityRecord | undefined) & import("rememo").EnhancedSelector;
|
|
117
120
|
getEntityRecords: selectors.GetEntityRecords;
|
|
118
121
|
getEntityRecordsTotalItems: (state: selectors.State, kind: string, name: string, query: {
|
|
119
122
|
[x: string]: any;
|
|
@@ -121,27 +124,27 @@ export const store: import("@wordpress/data/build-types/types").StoreDescriptor<
|
|
|
121
124
|
getEntityRecordsTotalPages: (state: selectors.State, kind: string, name: string, query: {
|
|
122
125
|
[x: string]: any;
|
|
123
126
|
}) => number | null;
|
|
124
|
-
__experimentalGetDirtyEntityRecords: ((state: selectors.State) => {
|
|
127
|
+
__experimentalGetDirtyEntityRecords: ((state: selectors.State) => Array<{
|
|
125
128
|
title: string;
|
|
126
129
|
key: string | number;
|
|
127
130
|
name: string;
|
|
128
131
|
kind: string;
|
|
129
|
-
}
|
|
130
|
-
__experimentalGetEntitiesBeingSaved: ((state: selectors.State) => {
|
|
132
|
+
}>) & import("rememo").EnhancedSelector;
|
|
133
|
+
__experimentalGetEntitiesBeingSaved: ((state: selectors.State) => Array<{
|
|
131
134
|
title: string;
|
|
132
135
|
key: string | number;
|
|
133
136
|
name: string;
|
|
134
137
|
kind: string;
|
|
135
|
-
}
|
|
138
|
+
}>) & import("rememo").EnhancedSelector;
|
|
136
139
|
getEntityRecordNonTransientEdits: ((state: selectors.State, kind: string, name: string, recordId: string | number) => any) & import("rememo").EnhancedSelector;
|
|
137
|
-
getEditedEntityRecord: (<
|
|
140
|
+
getEditedEntityRecord: (<EntityRecord extends import("./entity-types").EntityRecord<any>>(state: selectors.State, kind: string, name: string, recordId: string | number) => import("./entity-types").Updatable<EntityRecord> | false) & import("rememo").EnhancedSelector;
|
|
138
141
|
hasFetchedAutosaves: Function;
|
|
139
142
|
getRevisions: (state: selectors.State, kind: string, name: string, recordKey: string | number, query?: {
|
|
140
143
|
[x: string]: any;
|
|
141
|
-
}
|
|
144
|
+
}) => (Record<import("./entity-types").Context, Record<number, import("./entity-types").PostRevision>> | Record<import("./entity-types").Context, Record<number, import("./entity-types").GlobalStylesRevision>>)[] | null;
|
|
142
145
|
getRevision: ((state: selectors.State, kind: string, name: string, recordKey: string | number, revisionKey: string | number, query?: {
|
|
143
146
|
[x: string]: any;
|
|
144
|
-
}
|
|
147
|
+
}) => (Record<import("./entity-types").Context, Record<number, import("./entity-types").PostRevision>> | Record<import("./entity-types").Context, Record<number, import("./entity-types").GlobalStylesRevision>>) | Record<PropertyKey, never> | undefined) & import("rememo").EnhancedSelector;
|
|
145
148
|
}>>;
|
|
146
149
|
export { default as EntityProvider } from "./entity-provider";
|
|
147
150
|
export * from "./entity-provider";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":"AA0EA;;;;GAIG;AACH;;;;;;;;;;;;;;;;;;;4CAS42pB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAThzpB;;;;;;2BAtExC,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../src/locks/reducer.js"],"names":[],"mappings":"AAaA;;;;;;;GAOG;AACH,
|
|
1
|
+
{"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../src/locks/reducer.js"],"names":[],"mappings":"AAaA;;;;;;;GAOG;AACH,wEAwCC"}
|
|
@@ -30,5 +30,5 @@ export function removeItems(kind: string, name: string, records: any[] | number
|
|
|
30
30
|
*
|
|
31
31
|
* @return {Object} Action object.
|
|
32
32
|
*/
|
|
33
|
-
export function receiveQueriedItems(items: any[], query: any | null, edits: any | null, meta: any | null): any;
|
|
33
|
+
export function receiveQueriedItems(items: any[], query: (any | null) | undefined, edits: any | null, meta: any | null): any;
|
|
34
34
|
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/queried-data/actions.js"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/queried-data/actions.js"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,kDALW,UAAO,QACP,UAAO,OAWjB;AAED;;;;;;;;;GASG;AACH,kCANW,MAAM,QACN,MAAM,WACN,QAAM,MAAM,GAAC,MAAM,oBACnB,OAAO,OAWjB;AAED;;;;;;;;;;GAUG;AACH,0DANW,UAAO,sBACP,UAAO,QACP,UAAO,OASjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-query-parts.d.ts","sourceRoot":"","sources":["../../src/queried-data/get-query-parts.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;GAQG;AACH,2CAFY,uBAAuB,CAyElC;;;;;;;;;;UA3Fa,MAAM;;;;aACN,MAAM;;;;;eACN,MAAM;;;;;YAEL,CAAC,MAAM,EAAE,CAAC;;;;aAEV,CAAC,MAAM,EAAE,CAAC;;;;;aACX,MAAM"}
|
|
1
|
+
{"version":3,"file":"get-query-parts.d.ts","sourceRoot":"","sources":["../../src/queried-data/get-query-parts.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;GAQG;AACH,2CAFY,uBAAuB,CAyElC;;;;;;;;;;UA3Fa,MAAM;;;;aACN,MAAM;;;;;eACN,MAAM;;;;;YAEL,CAAC,MAAM,EAAE,CAAC,OAAA;;;;aAEV,CAAC,MAAM,EAAE,CAAC,OAAA;;;;;aACX,MAAM"}
|
|
@@ -19,7 +19,7 @@ export function getMergedItemIds(itemIds: Array<number> | null, nextItemIds: num
|
|
|
19
19
|
*
|
|
20
20
|
* @return {Object} Next state.
|
|
21
21
|
*/
|
|
22
|
-
export function items(state: any, action: any): any;
|
|
22
|
+
export function items(state: any | undefined, action: any): any;
|
|
23
23
|
/**
|
|
24
24
|
* Reducer tracking item completeness, keyed by ID. A complete item is one for
|
|
25
25
|
* which all fields are known. This is used in supporting `_fields` queries,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../src/queried-data/reducer.js"],"names":[],"mappings":"AA4BA;;;;;;;;;;GAUG;AACH,0CAPY,
|
|
1
|
+
{"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../src/queried-data/reducer.js"],"names":[],"mappings":"AA4BA;;;;;;;;;;GAUG;AACH,0CAPY,KAAK,CAAC,MAAM,CAAC,OAAA,eACd,MAAM,EAAE,QACR,MAAM,WACN,MAAM,GAEL,MAAM,EAAE,CA+BnB;AAyBD;;;;;;;;GAQG;AACH,gEA8BC;AAED;;;;;;;;;;;GAWG;AACH,sCALW;QAAO,MAAM,GAAC;YAAO,MAAM,GAAC,OAAO;KAAC;CAAC,4BAGpC;QAAO,MAAM,GAAC;YAAO,MAAM,GAAC,OAAO;KAAC;CAAC,CA6ChD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../src/queried-data/selectors.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../src/queried-data/selectors.js"],"names":[],"mappings":"AA+HA,kEAIC;AAED,kEAIC;AAxCD;;;;;;;;;;;;GAYG;AACH,qGAeI"}
|
package/build-types/reducer.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* @return {Object} Updated state.
|
|
12
12
|
*/
|
|
13
|
-
export function terms(state: any, action: any): any;
|
|
13
|
+
export function terms(state: any | undefined, action: any): any;
|
|
14
14
|
/**
|
|
15
15
|
* Reducer managing authors state. Keyed by id.
|
|
16
16
|
*
|
|
@@ -19,7 +19,7 @@ export function terms(state: any, action: any): any;
|
|
|
19
19
|
*
|
|
20
20
|
* @return {Object} Updated state.
|
|
21
21
|
*/
|
|
22
|
-
export function users(state: any, action: any): any;
|
|
22
|
+
export function users(state: any | undefined, action: any): any;
|
|
23
23
|
/**
|
|
24
24
|
* Reducer managing current user state.
|
|
25
25
|
*
|
|
@@ -28,7 +28,7 @@ export function users(state: any, action: any): any;
|
|
|
28
28
|
*
|
|
29
29
|
* @return {Object} Updated state.
|
|
30
30
|
*/
|
|
31
|
-
export function currentUser(state: any, action: any): any;
|
|
31
|
+
export function currentUser(state: any | undefined, action: any): any;
|
|
32
32
|
/**
|
|
33
33
|
* Reducer managing taxonomies.
|
|
34
34
|
*
|
|
@@ -37,7 +37,7 @@ export function currentUser(state: any, action: any): any;
|
|
|
37
37
|
*
|
|
38
38
|
* @return {Object} Updated state.
|
|
39
39
|
*/
|
|
40
|
-
export function taxonomies(state: any, action: any): any;
|
|
40
|
+
export function taxonomies(state: any | undefined, action: any): any;
|
|
41
41
|
/**
|
|
42
42
|
* Reducer managing the current theme.
|
|
43
43
|
*
|
|
@@ -64,7 +64,7 @@ export function currentGlobalStylesId(state: string | undefined, action: any): s
|
|
|
64
64
|
*
|
|
65
65
|
* @return {Record<string, object>} Updated state.
|
|
66
66
|
*/
|
|
67
|
-
export function themeBaseGlobalStyles(state: Record<string,
|
|
67
|
+
export function themeBaseGlobalStyles(state: Record<string, object> | undefined, action: any): Record<string, object>;
|
|
68
68
|
/**
|
|
69
69
|
* Reducer managing the theme global styles variations.
|
|
70
70
|
*
|
|
@@ -73,7 +73,7 @@ export function themeBaseGlobalStyles(state: Record<string, any> | undefined, ac
|
|
|
73
73
|
*
|
|
74
74
|
* @return {Record<string, object>} Updated state.
|
|
75
75
|
*/
|
|
76
|
-
export function themeGlobalStyleVariations(state: Record<string,
|
|
76
|
+
export function themeGlobalStyleVariations(state: Record<string, object> | undefined, action: any): Record<string, object>;
|
|
77
77
|
/**
|
|
78
78
|
* Reducer keeping track of the registered entities.
|
|
79
79
|
*
|
|
@@ -82,7 +82,7 @@ export function themeGlobalStyleVariations(state: Record<string, any> | undefine
|
|
|
82
82
|
*
|
|
83
83
|
* @return {Object} Updated state.
|
|
84
84
|
*/
|
|
85
|
-
export function entitiesConfig(state: any, action: any): any;
|
|
85
|
+
export function entitiesConfig(state: any | undefined, action: any): any;
|
|
86
86
|
/**
|
|
87
87
|
* @type {UndoManager}
|
|
88
88
|
*/
|
|
@@ -96,7 +96,7 @@ export function editsReference(state: {} | undefined, action: any): {};
|
|
|
96
96
|
*
|
|
97
97
|
* @return {Object} Updated state.
|
|
98
98
|
*/
|
|
99
|
-
export function embedPreviews(state: any, action: any): any;
|
|
99
|
+
export function embedPreviews(state: any | undefined, action: any): any;
|
|
100
100
|
/**
|
|
101
101
|
* State which tracks whether the user can perform an action on a REST
|
|
102
102
|
* resource.
|
|
@@ -106,7 +106,7 @@ export function embedPreviews(state: any, action: any): any;
|
|
|
106
106
|
*
|
|
107
107
|
* @return {Object} Updated state.
|
|
108
108
|
*/
|
|
109
|
-
export function userPermissions(state: any, action: any): any;
|
|
109
|
+
export function userPermissions(state: any | undefined, action: any): any;
|
|
110
110
|
/**
|
|
111
111
|
* Reducer returning autosaves keyed by their parent's post id.
|
|
112
112
|
*
|
|
@@ -115,7 +115,7 @@ export function userPermissions(state: any, action: any): any;
|
|
|
115
115
|
*
|
|
116
116
|
* @return {Object} Updated state.
|
|
117
117
|
*/
|
|
118
|
-
export function autosaves(state: any, action: any): any;
|
|
118
|
+
export function autosaves(state: any | undefined, action: any): any;
|
|
119
119
|
export function blockPatterns(state: any[] | undefined, action: any): any;
|
|
120
120
|
export function blockPatternCategories(state: any[] | undefined, action: any): any;
|
|
121
121
|
export function userPatternCategories(state: any[] | undefined, action: any): any;
|
|
@@ -128,7 +128,7 @@ export function navigationFallbackId(state: null | undefined, action: any): any;
|
|
|
128
128
|
*
|
|
129
129
|
* @return {Record<string, object>} Updated state.
|
|
130
130
|
*/
|
|
131
|
-
export function themeGlobalStyleRevisions(state: Record<string,
|
|
131
|
+
export function themeGlobalStyleRevisions(state: Record<string, object> | undefined, action: any): Record<string, object>;
|
|
132
132
|
/**
|
|
133
133
|
* Reducer managing the template lookup per query.
|
|
134
134
|
*
|
|
@@ -138,7 +138,7 @@ export function themeGlobalStyleRevisions(state: Record<string, any> | undefined
|
|
|
138
138
|
* @return {Record<string, string>} Updated state.
|
|
139
139
|
*/
|
|
140
140
|
export function defaultTemplates(state: Record<string, string> | undefined, action: any): Record<string, string>;
|
|
141
|
-
export function entities(state: any, action: any): any;
|
|
141
|
+
export function entities(state: any | undefined, action: any): any;
|
|
142
142
|
declare const _default: import("redux").Reducer<import("redux").CombinedState<{
|
|
143
143
|
terms: any;
|
|
144
144
|
users: any;
|
|
@@ -162,5 +162,5 @@ declare const _default: import("redux").Reducer<import("redux").CombinedState<{
|
|
|
162
162
|
defaultTemplates: Record<string, string>;
|
|
163
163
|
}>, any>;
|
|
164
164
|
export default _default;
|
|
165
|
-
export type AnyFunction = import(
|
|
165
|
+
export type AnyFunction = import("./types").AnyFunction;
|
|
166
166
|
//# sourceMappingURL=reducer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../src/reducer.js"],"names":[],"mappings":"AAmBA,2DAA2D;AAE3D;;;;;;;;;;GAUG;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,0EAUC;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;AA9MM,mEAmDN;;;;;;;;;;;;;;;;;;;;;;;;0BAjca,OAAO,SAAS,EAAE,WAAW"}
|
|
@@ -4,9 +4,10 @@ export function getAuthors(query: any | undefined): ({ dispatch }: {
|
|
|
4
4
|
export function getCurrentUser(): ({ dispatch }: {
|
|
5
5
|
dispatch: any;
|
|
6
6
|
}) => Promise<void>;
|
|
7
|
-
export function getEntityRecord(kind: string, name: string, key:
|
|
7
|
+
export function getEntityRecord(kind: string, name: string, key: (number | string) | undefined, query: any | undefined): ({ select, dispatch, registry }: {
|
|
8
8
|
select: any;
|
|
9
9
|
dispatch: any;
|
|
10
|
+
registry: any;
|
|
10
11
|
}) => Promise<void>;
|
|
11
12
|
/**
|
|
12
13
|
* Requests an entity's record from the REST API.
|
|
@@ -34,7 +35,7 @@ export const getThemeSupports: Function;
|
|
|
34
35
|
export function getEmbedPreview(url: string): ({ dispatch }: {
|
|
35
36
|
dispatch: any;
|
|
36
37
|
}) => Promise<void>;
|
|
37
|
-
export function canUser(requestedAction: string, resource: string, id: string | null): ({ dispatch, registry }: {
|
|
38
|
+
export function canUser(requestedAction: string, resource: string | any, id: string | null): ({ dispatch, registry }: {
|
|
38
39
|
dispatch: any;
|
|
39
40
|
registry: any;
|
|
40
41
|
}) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolvers.d.ts","sourceRoot":"","sources":["../src/resolvers.js"],"names":[],"mappings":"
|
|
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;;;;oBA4IzB;AAEF;;GAEG;AACH,0CAAuE;AAEvE;;GAEG;AACH,6CAA0E;AAUnE,uCALI,MAAM,QACN,MAAM,UACN,UAAO;;;oBAwGhB;;IAEF,kEAOC;;AAKM;;;oBAUL;AAEF;;GAEG;AACH,wCAAqE;AAO9D,qCAFI,MAAM;;oBAcf;AAYK,yCANI,MAAM,YAEN,MAAM,MAAO,MAEZ,MAAM,OAAA;;;oBAgFhB;AAUK,8CAJI,MAAM,QACN,MAAM,YACN,MAAM;;oBAMf;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;;;oBAsCL;AAEK;;oBAUL;AAYK,mCAPI,MAAM,QACN,MAAM,aACN,MAAM,GAAC,MAAM,UACb,MAAO,SAAS;;oBAoGzB;;IAGF,sFAK8B;;AAavB,kCARI,MAAM,QACN,MAAM,aACN,MAAM,GAAC,MAAM,eACb,MAAM,GAAC,MAAM,SACb,MAAO,SAAS;;oBA+CzB"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="rememo" />
|
|
2
1
|
import type * as ET from './entity-types';
|
|
3
2
|
import type { UndoManager } from '@wordpress/undo-manager';
|
|
4
3
|
export interface State {
|
|
@@ -81,6 +80,11 @@ type GetRecordsHttpQuery = Record<string, any>;
|
|
|
81
80
|
* Arguments for EntityRecord selectors.
|
|
82
81
|
*/
|
|
83
82
|
type EntityRecordArgs = [string, string, EntityRecordKey] | [string, string, EntityRecordKey, GetRecordsHttpQuery];
|
|
83
|
+
type EntityResource = {
|
|
84
|
+
kind: string;
|
|
85
|
+
name: string;
|
|
86
|
+
id?: EntityRecordKey;
|
|
87
|
+
};
|
|
84
88
|
/**
|
|
85
89
|
* Returns true if a request is in progress for embed preview data, or false
|
|
86
90
|
* otherwise.
|
|
@@ -118,7 +122,7 @@ export declare function getCurrentUser(state: State): ET.User<'edit'>;
|
|
|
118
122
|
*
|
|
119
123
|
* @return Users list.
|
|
120
124
|
*/
|
|
121
|
-
export declare const getUserQueryResults: ((state: State, queryID: string) => ET.User<
|
|
125
|
+
export declare const getUserQueryResults: ((state: State, queryID: string) => ET.User<"edit">[]) & import("rememo").EnhancedSelector;
|
|
122
126
|
/**
|
|
123
127
|
* Returns the loaded entities for the given kind.
|
|
124
128
|
*
|
|
@@ -225,7 +229,7 @@ export declare function __experimentalGetEntityRecordNoResolver<EntityRecord ext
|
|
|
225
229
|
*
|
|
226
230
|
* @return Object with the entity's raw attributes.
|
|
227
231
|
*/
|
|
228
|
-
export declare const getRawEntityRecord: (<EntityRecord extends ET.
|
|
232
|
+
export declare const getRawEntityRecord: (<EntityRecord extends ET.EntityRecord<any>>(state: State, kind: string, name: string, key: EntityRecordKey) => EntityRecord | undefined) & import("rememo").EnhancedSelector;
|
|
229
233
|
/**
|
|
230
234
|
* Returns true if records have been received for the given set of parameters,
|
|
231
235
|
* or false otherwise.
|
|
@@ -356,7 +360,7 @@ export declare function hasEditsForEntityRecord(state: State, kind: string, name
|
|
|
356
360
|
*
|
|
357
361
|
* @return The entity record, merged with its edits.
|
|
358
362
|
*/
|
|
359
|
-
export declare const getEditedEntityRecord: (<EntityRecord extends ET.
|
|
363
|
+
export declare const getEditedEntityRecord: (<EntityRecord extends ET.EntityRecord<any>>(state: State, kind: string, name: string, recordId: EntityRecordKey) => ET.Updatable<EntityRecord> | false) & import("rememo").EnhancedSelector;
|
|
360
364
|
/**
|
|
361
365
|
* Returns true if the specified entity record is autosaving, and false otherwise.
|
|
362
366
|
*
|
|
@@ -509,13 +513,14 @@ export declare function isPreviewEmbedFallback(state: State, url: string): boole
|
|
|
509
513
|
*
|
|
510
514
|
* @param state Data state.
|
|
511
515
|
* @param action Action to check. One of: 'create', 'read', 'update', 'delete'.
|
|
512
|
-
* @param resource
|
|
516
|
+
* @param resource Entity resource to check. Accepts entity object `{ kind: 'root', name: 'media', id: 1 }`
|
|
517
|
+
* or REST base as a string - `media`.
|
|
513
518
|
* @param id Optional ID of the rest resource to check.
|
|
514
519
|
*
|
|
515
520
|
* @return Whether or not the user can perform the action,
|
|
516
521
|
* or `undefined` if the OPTIONS request is still being made.
|
|
517
522
|
*/
|
|
518
|
-
export declare function canUser(state: State, action: string, resource: string, id?: EntityRecordKey): boolean | undefined;
|
|
523
|
+
export declare function canUser(state: State, action: string, resource: string | EntityResource, id?: EntityRecordKey): boolean | undefined;
|
|
519
524
|
/**
|
|
520
525
|
* Returns whether the current user can edit the given entity.
|
|
521
526
|
*
|