@wordpress/core-data 4.14.1-next.d6164808d3.0 → 5.0.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 +7 -1
- package/README.md +73 -61
- package/build/entities.js +31 -46
- package/build/entities.js.map +1 -1
- package/build/hooks/use-entity-record.js +4 -2
- package/build/hooks/use-entity-record.js.map +1 -1
- package/build/hooks/use-entity-records.js +2 -0
- package/build/hooks/use-entity-records.js.map +1 -1
- package/build/hooks/use-query-select.js +5 -2
- package/build/hooks/use-query-select.js.map +1 -1
- package/build/hooks/use-resource-permissions.js +22 -6
- package/build/hooks/use-resource-permissions.js.map +1 -1
- package/build/index.js +0 -2
- package/build/index.js.map +1 -1
- package/build/resolvers.js +45 -21
- package/build/resolvers.js.map +1 -1
- package/build/selectors.js +9 -46
- package/build/selectors.js.map +1 -1
- package/build-module/entities.js +31 -46
- package/build-module/entities.js.map +1 -1
- package/build-module/hooks/use-entity-record.js +4 -2
- package/build-module/hooks/use-entity-record.js.map +1 -1
- package/build-module/hooks/use-entity-records.js +2 -0
- package/build-module/hooks/use-entity-records.js.map +1 -1
- package/build-module/hooks/use-query-select.js +4 -1
- package/build-module/hooks/use-query-select.js.map +1 -1
- package/build-module/hooks/use-resource-permissions.js +22 -6
- package/build-module/hooks/use-resource-permissions.js.map +1 -1
- package/build-module/index.js +0 -2
- package/build-module/index.js.map +1 -1
- package/build-module/resolvers.js +45 -21
- package/build-module/resolvers.js.map +1 -1
- package/build-module/selectors.js +7 -44
- package/build-module/selectors.js.map +1 -1
- package/build-types/actions.d.ts +188 -0
- package/build-types/actions.d.ts.map +1 -0
- package/build-types/batch/create-batch.d.ts +71 -0
- package/build-types/batch/create-batch.d.ts.map +1 -0
- package/build-types/batch/default-processor.d.ts +11 -0
- package/build-types/batch/default-processor.d.ts.map +1 -0
- package/build-types/batch/index.d.ts +3 -0
- package/build-types/batch/index.d.ts.map +1 -0
- package/build-types/entities.d.ts +128 -0
- package/build-types/entities.d.ts.map +1 -0
- package/build-types/entity-provider.d.ts +68 -0
- package/build-types/entity-provider.d.ts.map +1 -0
- package/build-types/entity-types/attachment.d.ts +121 -0
- package/build-types/entity-types/attachment.d.ts.map +1 -0
- package/build-types/entity-types/base-entity-records.d.ts +37 -0
- package/build-types/entity-types/base-entity-records.d.ts.map +1 -0
- package/build-types/entity-types/comment.d.ts +82 -0
- package/build-types/entity-types/comment.d.ts.map +1 -0
- package/build-types/entity-types/helpers.d.ts +123 -0
- package/build-types/entity-types/helpers.d.ts.map +1 -0
- package/build-types/entity-types/index.d.ts +64 -0
- package/build-types/entity-types/index.d.ts.map +1 -0
- package/build-types/entity-types/menu-location.d.ts +25 -0
- package/build-types/entity-types/menu-location.d.ts.map +1 -0
- package/build-types/entity-types/nav-menu-item.d.ts +88 -0
- package/build-types/entity-types/nav-menu-item.d.ts.map +1 -0
- package/build-types/entity-types/nav-menu.d.ts +45 -0
- package/build-types/entity-types/nav-menu.d.ts.map +1 -0
- package/build-types/entity-types/page.d.ts +120 -0
- package/build-types/entity-types/page.d.ts.map +1 -0
- package/build-types/entity-types/plugin.d.ts +62 -0
- package/build-types/entity-types/plugin.d.ts.map +1 -0
- package/build-types/entity-types/post.d.ts +128 -0
- package/build-types/entity-types/post.d.ts.map +1 -0
- package/build-types/entity-types/settings.d.ts +89 -0
- package/build-types/entity-types/settings.d.ts.map +1 -0
- package/build-types/entity-types/sidebar.d.ts +55 -0
- package/build-types/entity-types/sidebar.d.ts.map +1 -0
- package/build-types/entity-types/taxonomy.d.ts +83 -0
- package/build-types/entity-types/taxonomy.d.ts.map +1 -0
- package/build-types/entity-types/theme.d.ts +206 -0
- package/build-types/entity-types/theme.d.ts.map +1 -0
- package/build-types/entity-types/type.d.ts +71 -0
- package/build-types/entity-types/type.d.ts.map +1 -0
- package/build-types/entity-types/user.d.ts +93 -0
- package/build-types/entity-types/user.d.ts.map +1 -0
- package/build-types/entity-types/widget-type.d.ts +33 -0
- package/build-types/entity-types/widget-type.d.ts.map +1 -0
- package/build-types/entity-types/widget.d.ts +59 -0
- package/build-types/entity-types/widget.d.ts.map +1 -0
- package/build-types/entity-types/wp-template-part.d.ts +80 -0
- package/build-types/entity-types/wp-template-part.d.ts.map +1 -0
- package/build-types/entity-types/wp-template.d.ts +80 -0
- package/build-types/entity-types/wp-template.d.ts.map +1 -0
- package/build-types/fetch/__experimental-fetch-link-suggestions.d.ts +139 -0
- package/build-types/fetch/__experimental-fetch-link-suggestions.d.ts.map +1 -0
- package/build-types/fetch/__experimental-fetch-url-data.d.ts +35 -0
- package/build-types/fetch/__experimental-fetch-url-data.d.ts.map +1 -0
- package/build-types/fetch/index.d.ts +3 -0
- package/build-types/fetch/index.d.ts.map +1 -0
- package/build-types/hooks/constants.d.ts +7 -0
- package/build-types/hooks/constants.d.ts.map +1 -0
- package/build-types/hooks/index.d.ts +4 -0
- package/build-types/hooks/index.d.ts.map +1 -0
- package/build-types/hooks/memoize.d.ts +3 -0
- package/build-types/hooks/memoize.d.ts.map +1 -0
- package/build-types/hooks/use-entity-record.d.ts +124 -0
- package/build-types/hooks/use-entity-record.d.ts.map +1 -0
- package/build-types/hooks/use-entity-records.d.ts +49 -0
- package/build-types/hooks/use-entity-records.d.ts.map +1 -0
- package/build-types/hooks/use-query-select.d.ts +46 -0
- package/build-types/hooks/use-query-select.d.ts.map +1 -0
- package/build-types/hooks/use-resource-permissions.d.ts +99 -0
- package/build-types/hooks/use-resource-permissions.d.ts.map +1 -0
- package/build-types/index.d.ts +131 -0
- package/build-types/index.d.ts.map +1 -0
- package/build-types/locks/actions.d.ts +7 -0
- package/build-types/locks/actions.d.ts.map +1 -0
- package/build-types/locks/engine.d.ts +5 -0
- package/build-types/locks/engine.d.ts.map +1 -0
- package/build-types/locks/reducer.d.ts +10 -0
- package/build-types/locks/reducer.d.ts.map +1 -0
- package/build-types/locks/selectors.d.ts +5 -0
- package/build-types/locks/selectors.d.ts.map +1 -0
- package/build-types/locks/utils.d.ts +8 -0
- package/build-types/locks/utils.d.ts.map +1 -0
- package/build-types/name.d.ts +8 -0
- package/build-types/name.d.ts.map +1 -0
- package/build-types/queried-data/actions.d.ts +32 -0
- package/build-types/queried-data/actions.d.ts.map +1 -0
- package/build-types/queried-data/get-query-parts.d.ts +60 -0
- package/build-types/queried-data/get-query-parts.d.ts.map +1 -0
- package/build-types/queried-data/index.d.ts +4 -0
- package/build-types/queried-data/index.d.ts.map +1 -0
- package/build-types/queried-data/reducer.d.ts +54 -0
- package/build-types/queried-data/reducer.d.ts.map +1 -0
- package/build-types/queried-data/selectors.d.ts +16 -0
- package/build-types/queried-data/selectors.d.ts.map +1 -0
- package/build-types/reducer.d.ts +156 -0
- package/build-types/reducer.d.ts.map +1 -0
- package/build-types/resolvers.d.ts +75 -0
- package/build-types/resolvers.d.ts.map +1 -0
- package/build-types/selectors.d.ts +524 -0
- package/build-types/selectors.d.ts.map +1 -0
- package/build-types/types.d.ts +4 -0
- package/build-types/types.d.ts.map +1 -0
- package/build-types/utils/conservative-map-item.d.ts +12 -0
- package/build-types/utils/conservative-map-item.d.ts.map +1 -0
- package/build-types/utils/forward-resolver.d.ts +10 -0
- package/build-types/utils/forward-resolver.d.ts.map +1 -0
- package/build-types/utils/get-normalized-comma-separable.d.ts +12 -0
- package/build-types/utils/get-normalized-comma-separable.d.ts.map +1 -0
- package/build-types/utils/if-matching-action.d.ts +14 -0
- package/build-types/utils/if-matching-action.d.ts.map +1 -0
- package/build-types/utils/index.d.ts +9 -0
- package/build-types/utils/index.d.ts.map +1 -0
- package/build-types/utils/is-raw-attribute.d.ts +10 -0
- package/build-types/utils/is-raw-attribute.d.ts.map +1 -0
- package/build-types/utils/on-sub-key.d.ts +4 -0
- package/build-types/utils/on-sub-key.d.ts.map +1 -0
- package/build-types/utils/replace-action.d.ts +13 -0
- package/build-types/utils/replace-action.d.ts.map +1 -0
- package/build-types/utils/with-weak-map-cache.d.ts +12 -0
- package/build-types/utils/with-weak-map-cache.d.ts.map +1 -0
- package/package.json +12 -11
- package/src/entities.js +325 -0
- package/src/entity-types/attachment.ts +3 -4
- package/src/entity-types/comment.ts +3 -4
- package/src/entity-types/index.ts +31 -88
- package/src/entity-types/menu-location.ts +3 -4
- package/src/entity-types/nav-menu-item.ts +3 -4
- package/src/entity-types/nav-menu.ts +3 -3
- package/src/entity-types/page.ts +3 -3
- package/src/entity-types/plugin.ts +3 -3
- package/src/entity-types/post.ts +3 -3
- package/src/entity-types/settings.ts +3 -3
- package/src/entity-types/sidebar.ts +3 -4
- package/src/entity-types/taxonomy.ts +3 -4
- package/src/entity-types/theme.ts +3 -3
- package/src/entity-types/type.ts +3 -3
- package/src/entity-types/user.ts +3 -3
- package/src/entity-types/widget-type.ts +3 -4
- package/src/entity-types/widget.ts +3 -3
- package/src/entity-types/wp-template-part.ts +3 -4
- package/src/entity-types/wp-template.ts +3 -4
- package/src/hooks/test/use-entity-record.js +41 -1
- package/src/hooks/test/use-resource-permissions.js +4 -0
- package/src/hooks/use-entity-record.ts +12 -2
- package/src/hooks/use-entity-records.ts +2 -0
- package/src/hooks/use-query-select.ts +4 -1
- package/src/hooks/use-resource-permissions.ts +28 -6
- package/src/index.js +0 -2
- package/src/resolvers.js +46 -23
- package/src/selectors.ts +202 -341
- package/src/test/resolvers.js +118 -4
- package/tsconfig.json +21 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/build/entity-types/entities.js +0 -6
- package/build/entity-types/entities.js.map +0 -1
- package/build-module/entity-types/entities.js +0 -2
- package/build-module/entity-types/entities.js.map +0 -1
- package/src/entities.ts +0 -550
- package/src/entity-types/entities.ts +0 -130
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import type { Status } from './constants';
|
|
2
|
+
export interface EntityRecordResolution<RecordType> {
|
|
3
|
+
/** The requested entity record */
|
|
4
|
+
record: RecordType | null;
|
|
5
|
+
/** The edited entity record */
|
|
6
|
+
editedRecord: Partial<RecordType>;
|
|
7
|
+
/** Apply local (in-browser) edits to the edited entity record */
|
|
8
|
+
edit: (diff: Partial<RecordType>) => void;
|
|
9
|
+
/** Persist the edits to the server */
|
|
10
|
+
save: () => Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Is the record still being resolved?
|
|
13
|
+
*/
|
|
14
|
+
isResolving: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Does the record have any local edits?
|
|
17
|
+
*/
|
|
18
|
+
hasEdits: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Is the record resolved by now?
|
|
21
|
+
*/
|
|
22
|
+
hasResolved: boolean;
|
|
23
|
+
/** Resolution status */
|
|
24
|
+
status: Status;
|
|
25
|
+
}
|
|
26
|
+
export interface Options {
|
|
27
|
+
/**
|
|
28
|
+
* Whether to run the query or short-circuit and return null.
|
|
29
|
+
*
|
|
30
|
+
* @default true
|
|
31
|
+
*/
|
|
32
|
+
enabled: boolean;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Resolves the specified entity record.
|
|
36
|
+
*
|
|
37
|
+
* @since 6.1.0 Introduced in WordPress core.
|
|
38
|
+
*
|
|
39
|
+
* @param kind Kind of the entity, e.g. `root` or a `postType`. See rootEntitiesConfig in ../entities.ts for a list of available kinds.
|
|
40
|
+
* @param name Name of the entity, e.g. `plugin` or a `post`. See rootEntitiesConfig in ../entities.ts for a list of available names.
|
|
41
|
+
* @param recordId ID of the requested entity record.
|
|
42
|
+
* @param options Optional hook options.
|
|
43
|
+
* @example
|
|
44
|
+
* ```js
|
|
45
|
+
* import { useEntityRecord } from '@wordpress/core-data';
|
|
46
|
+
*
|
|
47
|
+
* function PageTitleDisplay( { id } ) {
|
|
48
|
+
* const { record, isResolving } = useEntityRecord( 'postType', 'page', id );
|
|
49
|
+
*
|
|
50
|
+
* if ( isResolving ) {
|
|
51
|
+
* return 'Loading...';
|
|
52
|
+
* }
|
|
53
|
+
*
|
|
54
|
+
* return record.title;
|
|
55
|
+
* }
|
|
56
|
+
*
|
|
57
|
+
* // Rendered in the application:
|
|
58
|
+
* // <PageTitleDisplay id={ 1 } />
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* In the above example, when `PageTitleDisplay` is rendered into an
|
|
62
|
+
* application, the page and the resolution details will be retrieved from
|
|
63
|
+
* the store state using `getEntityRecord()`, or resolved if missing.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```js
|
|
67
|
+
* import { useDispatch } from '@wordpress/data';
|
|
68
|
+
* import { useCallback } from '@wordpress/element';
|
|
69
|
+
* import { __ } from '@wordpress/i18n';
|
|
70
|
+
* import { TextControl } from '@wordpress/components';
|
|
71
|
+
* import { store as noticeStore } from '@wordpress/notices';
|
|
72
|
+
* import { useEntityRecord } from '@wordpress/core-data';
|
|
73
|
+
*
|
|
74
|
+
* function PageRenameForm( { id } ) {
|
|
75
|
+
* const page = useEntityRecord( 'postType', 'page', id );
|
|
76
|
+
* const { createSuccessNotice, createErrorNotice } =
|
|
77
|
+
* useDispatch( noticeStore );
|
|
78
|
+
*
|
|
79
|
+
* const setTitle = useCallback( ( title ) => {
|
|
80
|
+
* page.edit( { title } );
|
|
81
|
+
* }, [ page.edit ] );
|
|
82
|
+
*
|
|
83
|
+
* if ( page.isResolving ) {
|
|
84
|
+
* return 'Loading...';
|
|
85
|
+
* }
|
|
86
|
+
*
|
|
87
|
+
* async function onRename( event ) {
|
|
88
|
+
* event.preventDefault();
|
|
89
|
+
* try {
|
|
90
|
+
* await page.save();
|
|
91
|
+
* createSuccessNotice( __( 'Page renamed.' ), {
|
|
92
|
+
* type: 'snackbar',
|
|
93
|
+
* } );
|
|
94
|
+
* } catch ( error ) {
|
|
95
|
+
* createErrorNotice( error.message, { type: 'snackbar' } );
|
|
96
|
+
* }
|
|
97
|
+
* }
|
|
98
|
+
*
|
|
99
|
+
* return (
|
|
100
|
+
* <form onSubmit={ onRename }>
|
|
101
|
+
* <TextControl
|
|
102
|
+
* label={ __( 'Name' ) }
|
|
103
|
+
* value={ page.editedRecord.title }
|
|
104
|
+
* onChange={ setTitle }
|
|
105
|
+
* />
|
|
106
|
+
* <button type="submit">{ __( 'Save' ) }</button>
|
|
107
|
+
* </form>
|
|
108
|
+
* );
|
|
109
|
+
* }
|
|
110
|
+
*
|
|
111
|
+
* // Rendered in the application:
|
|
112
|
+
* // <PageRenameForm id={ 1 } />
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* In the above example, updating and saving the page title is handled
|
|
116
|
+
* via the `edit()` and `save()` mutation helpers provided by
|
|
117
|
+
* `useEntityRecord()`;
|
|
118
|
+
*
|
|
119
|
+
* @return Entity record data.
|
|
120
|
+
* @template RecordType
|
|
121
|
+
*/
|
|
122
|
+
export default function useEntityRecord<RecordType>(kind: string, name: string, recordId: string | number, options?: Options): EntityRecordResolution<RecordType>;
|
|
123
|
+
export declare function __experimentalUseEntityRecord(kind: string, name: string, recordId: any, options: any): EntityRecordResolution<unknown>;
|
|
124
|
+
//# sourceMappingURL=use-entity-record.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-entity-record.d.ts","sourceRoot":"","sources":["../../src/hooks/use-entity-record.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,WAAW,sBAAsB,CAAE,UAAU;IAClD,kCAAkC;IAClC,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;IAE1B,+BAA+B;IAC/B,YAAY,EAAE,OAAO,CAAE,UAAU,CAAE,CAAC;IAEpC,iEAAiE;IACjE,IAAI,EAAE,CAAE,IAAI,EAAE,OAAO,CAAE,UAAU,CAAE,KAAM,IAAI,CAAC;IAE9C,sCAAsC;IACtC,IAAI,EAAE,MAAM,OAAO,CAAE,IAAI,CAAE,CAAC;IAE5B;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;IAErB,wBAAwB;IACxB,MAAM,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,OAAO;IACvB;;;;OAIG;IACH,OAAO,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuFG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAE,UAAU,EAClD,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GAAG,MAAM,EACzB,OAAO,GAAE,OAA2B,GAClC,sBAAsB,CAAE,UAAU,CAAE,CAkDtC;AAED,wBAAgB,6BAA6B,CAC5C,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,GAAG,EACb,OAAO,EAAE,GAAG,mCAOZ"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Options, EntityRecordResolution } from './use-entity-record';
|
|
2
|
+
declare type EntityRecordsResolution<RecordType> = Omit<EntityRecordResolution<RecordType>, 'record'> & {
|
|
3
|
+
/** The requested entity record */
|
|
4
|
+
records: RecordType[] | null;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Resolves the specified entity records.
|
|
8
|
+
*
|
|
9
|
+
* @since 6.1.0 Introduced in WordPress core.
|
|
10
|
+
*
|
|
11
|
+
* @param kind Kind of the entity, e.g. `root` or a `postType`. See rootEntitiesConfig in ../entities.ts for a list of available kinds.
|
|
12
|
+
* @param name Name of the entity, e.g. `plugin` or a `post`. See rootEntitiesConfig in ../entities.ts for a list of available names.
|
|
13
|
+
* @param queryArgs Optional HTTP query description for how to fetch the data, passed to the requested API endpoint.
|
|
14
|
+
* @param options Optional hook options.
|
|
15
|
+
* @example
|
|
16
|
+
* ```js
|
|
17
|
+
* import { useEntityRecord } from '@wordpress/core-data';
|
|
18
|
+
*
|
|
19
|
+
* function PageTitlesList() {
|
|
20
|
+
* const { records, isResolving } = useEntityRecords( 'postType', 'page' );
|
|
21
|
+
*
|
|
22
|
+
* if ( isResolving ) {
|
|
23
|
+
* return 'Loading...';
|
|
24
|
+
* }
|
|
25
|
+
*
|
|
26
|
+
* return (
|
|
27
|
+
* <ul>
|
|
28
|
+
* {records.map(( page ) => (
|
|
29
|
+
* <li>{ page.title }</li>
|
|
30
|
+
* ))}
|
|
31
|
+
* </ul>
|
|
32
|
+
* );
|
|
33
|
+
* }
|
|
34
|
+
*
|
|
35
|
+
* // Rendered in the application:
|
|
36
|
+
* // <PageTitlesList />
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* In the above example, when `PageTitlesList` is rendered into an
|
|
40
|
+
* application, the list of records and the resolution details will be retrieved from
|
|
41
|
+
* the store state using `getEntityRecords()`, or resolved if missing.
|
|
42
|
+
*
|
|
43
|
+
* @return Entity records data.
|
|
44
|
+
* @template RecordType
|
|
45
|
+
*/
|
|
46
|
+
export default function useEntityRecords<RecordType>(kind: string, name: string, queryArgs?: Record<string, unknown>, options?: Options): EntityRecordsResolution<RecordType>;
|
|
47
|
+
export declare function __experimentalUseEntityRecords(kind: string, name: string, queryArgs: any, options: any): EntityRecordsResolution<unknown>;
|
|
48
|
+
export {};
|
|
49
|
+
//# sourceMappingURL=use-entity-records.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-entity-records.d.ts","sourceRoot":"","sources":["../../src/hooks/use-entity-records.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE3E,aAAK,uBAAuB,CAAE,UAAU,IAAK,IAAI,CAChD,sBAAsB,CAAE,UAAU,CAAE,EACpC,QAAQ,CACR,GAAG;IACH,kCAAkC;IAClC,OAAO,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;CAC7B,CAAC;AAIF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAE,UAAU,EACnD,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,SAAS,GAAE,MAAM,CAAE,MAAM,EAAE,OAAO,CAAO,EACzC,OAAO,GAAE,OAA2B,GAClC,uBAAuB,CAAE,UAAU,CAAE,CAwBvC;AAED,wBAAgB,8BAA8B,CAC7C,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,GAAG,EACd,OAAO,EAAE,GAAG,oCAOZ"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export declare const META_SELECTORS: string[];
|
|
2
|
+
/**
|
|
3
|
+
* Like useSelect, but the selectors return objects containing
|
|
4
|
+
* both the original data AND the resolution info.
|
|
5
|
+
*
|
|
6
|
+
* @since 6.1.0 Introduced in WordPress core.
|
|
7
|
+
* @private
|
|
8
|
+
*
|
|
9
|
+
* @param {Function} mapQuerySelect see useSelect
|
|
10
|
+
* @param {Array} deps see useSelect
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```js
|
|
14
|
+
* import { useQuerySelect } from '@wordpress/data';
|
|
15
|
+
* import { store as coreDataStore } from '@wordpress/core-data';
|
|
16
|
+
*
|
|
17
|
+
* function PageTitleDisplay( { id } ) {
|
|
18
|
+
* const { data: page, isResolving } = useQuerySelect( ( query ) => {
|
|
19
|
+
* return query( coreDataStore ).getEntityRecord( 'postType', 'page', id )
|
|
20
|
+
* }, [ id ] );
|
|
21
|
+
*
|
|
22
|
+
* if ( isResolving ) {
|
|
23
|
+
* return 'Loading...';
|
|
24
|
+
* }
|
|
25
|
+
*
|
|
26
|
+
* return page.title;
|
|
27
|
+
* }
|
|
28
|
+
*
|
|
29
|
+
* // Rendered in the application:
|
|
30
|
+
* // <PageTitleDisplay id={ 10 } />
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* In the above example, when `PageTitleDisplay` is rendered into an
|
|
34
|
+
* application, the page and the resolution details will be retrieved from
|
|
35
|
+
* the store state using the `mapSelect` callback on `useQuerySelect`.
|
|
36
|
+
*
|
|
37
|
+
* If the id prop changes then any page in the state for that id is
|
|
38
|
+
* retrieved. If the id prop doesn't change and other props are passed in
|
|
39
|
+
* that do change, the title will not change because the dependency is just
|
|
40
|
+
* the id.
|
|
41
|
+
* @see useSelect
|
|
42
|
+
*
|
|
43
|
+
* @return {QuerySelectResponse} Queried data.
|
|
44
|
+
*/
|
|
45
|
+
export default function useQuerySelect(mapQuerySelect: any, deps: any): any;
|
|
46
|
+
//# sourceMappingURL=use-query-select.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-query-select.d.ts","sourceRoot":"","sources":["../../src/hooks/use-query-select.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,cAAc,UAM1B,CAAC;AAgBF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAE,cAAc,KAAA,EAAE,IAAI,KAAA,OAK3D"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Status } from './constants';
|
|
2
|
+
interface GlobalResourcePermissionsResolution {
|
|
3
|
+
/** Can the current user create new resources of this type? */
|
|
4
|
+
canCreate: boolean;
|
|
5
|
+
}
|
|
6
|
+
interface SpecificResourcePermissionsResolution {
|
|
7
|
+
/** Can the current user update resources of this type? */
|
|
8
|
+
canUpdate: boolean;
|
|
9
|
+
/** Can the current user delete resources of this type? */
|
|
10
|
+
canDelete: boolean;
|
|
11
|
+
}
|
|
12
|
+
interface ResolutionDetails {
|
|
13
|
+
/** Resolution status */
|
|
14
|
+
status: Status;
|
|
15
|
+
/**
|
|
16
|
+
* Is the data still being resolved?
|
|
17
|
+
*/
|
|
18
|
+
isResolving: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Is the data resolved by now?
|
|
22
|
+
*/
|
|
23
|
+
declare type HasResolved = boolean;
|
|
24
|
+
declare type ResourcePermissionsResolution<IdType> = [
|
|
25
|
+
HasResolved,
|
|
26
|
+
ResolutionDetails & GlobalResourcePermissionsResolution & (IdType extends void ? SpecificResourcePermissionsResolution : {})
|
|
27
|
+
];
|
|
28
|
+
/**
|
|
29
|
+
* Resolves resource permissions.
|
|
30
|
+
*
|
|
31
|
+
* @since 6.1.0 Introduced in WordPress core.
|
|
32
|
+
*
|
|
33
|
+
* @param resource The resource in question, e.g. media.
|
|
34
|
+
* @param id ID of a specific resource entry, if needed, e.g. 10.
|
|
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>;
|
|
97
|
+
export declare function __experimentalUseResourcePermissions(resource: string, id?: unknown): ResourcePermissionsResolution<unknown>;
|
|
98
|
+
export {};
|
|
99
|
+
//# sourceMappingURL=use-resource-permissions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-resource-permissions.d.ts","sourceRoot":"","sources":["../../src/hooks/use-resource-permissions.ts"],"names":[],"mappings":"AASA,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,aAAK,WAAW,GAAG,OAAO,CAAC;AAE3B,aAAK,6BAA6B,CAAE,MAAM,IAAK;IAC9C,WAAW;IACX,iBAAiB,GAChB,mCAAmC,GACnC,CAAE,MAAM,SAAS,IAAI,GAAG,qCAAqC,GAAG,EAAE,CAAE;CACrE,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AACH,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAE,MAAM,GAAG,IAAI,EAC5D,QAAQ,EAAE,MAAM,EAChB,EAAE,CAAC,EAAE,MAAM,GACT,6BAA6B,CAAE,MAAM,CAAE,CA0DzC;AAED,wBAAgB,oCAAoC,CACnD,QAAQ,EAAE,MAAM,EAChB,EAAE,CAAC,EAAE,OAAO,0CAOZ"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/// <reference types="rememo" />
|
|
2
|
+
/**
|
|
3
|
+
* Store definition for the code data namespace.
|
|
4
|
+
*
|
|
5
|
+
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
|
|
6
|
+
*/
|
|
7
|
+
export const store: import("@wordpress/data/build-types/types").StoreDescriptor<import("@wordpress/data/build-types/types").ReduxStoreConfig<any, {
|
|
8
|
+
__unstableAcquireStoreLock: (store: any, path: any, { exclusive }: {
|
|
9
|
+
exclusive: any;
|
|
10
|
+
}) => () => Promise<any>;
|
|
11
|
+
__unstableReleaseStoreLock: (lock: any) => () => void;
|
|
12
|
+
receiveUserQuery(queryID: string, users: any): any;
|
|
13
|
+
receiveCurrentUser(currentUser: any): any;
|
|
14
|
+
addEntities(entities: any[]): any;
|
|
15
|
+
receiveEntityRecords(kind: string, name: string, records: any, query: any, invalidateCache: boolean | null | undefined, edits: any): any;
|
|
16
|
+
receiveCurrentTheme(currentTheme: any): any;
|
|
17
|
+
__experimentalReceiveCurrentGlobalStylesId(currentGlobalStylesId: string): any;
|
|
18
|
+
__experimentalReceiveThemeBaseGlobalStyles(stylesheet: string, globalStyles: any): any;
|
|
19
|
+
__experimentalReceiveThemeGlobalStyleVariations(stylesheet: string, variations: any[]): any;
|
|
20
|
+
receiveThemeSupports(): any;
|
|
21
|
+
receiveEmbedPreview(url: string, preview: any): any;
|
|
22
|
+
__unstableCreateUndoLevel(): any;
|
|
23
|
+
receiveUploadPermissions(hasUploadPermissions: boolean): any;
|
|
24
|
+
receiveUserPermission(key: string, isAllowed: boolean): any;
|
|
25
|
+
receiveAutosaves(postId: number, autosaves: any): any;
|
|
26
|
+
deleteEntityRecord: (kind: string, name: string, recordId: string, query: any, { __unstableFetch, throwOnError }?: {
|
|
27
|
+
__unstableFetch?: Function | undefined;
|
|
28
|
+
throwOnError?: boolean | undefined;
|
|
29
|
+
} | undefined) => ({ dispatch }: {
|
|
30
|
+
dispatch: any;
|
|
31
|
+
}) => Promise<boolean | undefined>;
|
|
32
|
+
editEntityRecord: (kind: string, name: string, recordId: number, edits: any, options?: {
|
|
33
|
+
undoIgnore?: boolean | undefined;
|
|
34
|
+
}) => any;
|
|
35
|
+
undo: () => ({ select, dispatch }: {
|
|
36
|
+
select: any;
|
|
37
|
+
dispatch: any;
|
|
38
|
+
}) => void;
|
|
39
|
+
redo: () => ({ select, dispatch }: {
|
|
40
|
+
select: any;
|
|
41
|
+
dispatch: any;
|
|
42
|
+
}) => void;
|
|
43
|
+
saveEntityRecord: (kind: string, name: string, record: any, { isAutosave, __unstableFetch, throwOnError, }?: {
|
|
44
|
+
isAutosave?: boolean | undefined;
|
|
45
|
+
__unstableFetch?: Function | undefined;
|
|
46
|
+
throwOnError?: boolean | undefined;
|
|
47
|
+
}) => ({ select, resolveSelect, dispatch }: {
|
|
48
|
+
select: any;
|
|
49
|
+
resolveSelect: any;
|
|
50
|
+
dispatch: any;
|
|
51
|
+
}) => Promise<any>;
|
|
52
|
+
__experimentalBatch: (requests: any[]) => (thunkArgs: any) => Promise<any>;
|
|
53
|
+
saveEditedEntityRecord: (kind: string, name: string, recordId: any, options: any) => ({ select, dispatch }: {
|
|
54
|
+
select: any;
|
|
55
|
+
dispatch: any;
|
|
56
|
+
}) => Promise<any>;
|
|
57
|
+
__experimentalSaveSpecifiedEntityEdits: (kind: string, name: string, recordId: any, itemsToSave: any[], options: any) => ({ select, dispatch }: {
|
|
58
|
+
select: any;
|
|
59
|
+
dispatch: any;
|
|
60
|
+
}) => Promise<any>;
|
|
61
|
+
}, {
|
|
62
|
+
getAuthors(state: selectors.State, query?: {
|
|
63
|
+
[x: string]: any;
|
|
64
|
+
} | undefined): import("./entity-types").User<"edit">[];
|
|
65
|
+
getCurrentUser(state: selectors.State): import("./entity-types").User<"edit">;
|
|
66
|
+
getEntitiesByKind(state: selectors.State, kind: string): any[];
|
|
67
|
+
getEntitiesConfig(state: selectors.State, kind: string): any[];
|
|
68
|
+
getEntity(state: selectors.State, kind: string, name: string): any;
|
|
69
|
+
getEntityConfig(state: selectors.State, kind: string, name: string): any;
|
|
70
|
+
__experimentalGetEntityRecordNoResolver<EntityRecord extends import("./entity-types").Attachment<any> | import("./entity-types").Comment<any> | import("./entity-types").MenuLocation<any> | import("./entity-types").NavMenu<any> | import("./entity-types").NavMenuItem<any> | import("./entity-types").Page<any> | import("./entity-types").Plugin<any> | import("./entity-types").Post<any> | import("./entity-types").Settings<any> | import("./entity-types").Sidebar<any> | import("./entity-types").Taxonomy<any> | import("./entity-types").Theme<any> | import("./entity-types").User<any> | import("./entity-types").Type<any> | import("./entity-types").Widget<any> | import("./entity-types").WidgetType<any> | import("./entity-types").WpTemplate<any> | import("./entity-types").WpTemplatePart<any>>(state: selectors.State, kind: string, name: string, key: string | number): EntityRecord | undefined;
|
|
71
|
+
hasEntityRecords(state: selectors.State, kind: string, name: string, query?: {
|
|
72
|
+
[x: string]: any;
|
|
73
|
+
} | undefined): boolean;
|
|
74
|
+
getEntityRecordEdits(state: selectors.State, kind: string, name: string, recordId: string | number): any;
|
|
75
|
+
hasEditsForEntityRecord(state: selectors.State, kind: string, name: string, recordId: string | number): boolean;
|
|
76
|
+
isAutosavingEntityRecord(state: selectors.State, kind: string, name: string, recordId: string | number): boolean;
|
|
77
|
+
isSavingEntityRecord(state: selectors.State, kind: string, name: string, recordId: string | number): boolean;
|
|
78
|
+
isDeletingEntityRecord(state: selectors.State, kind: string, name: string, recordId: string | number): boolean;
|
|
79
|
+
getLastEntitySaveError(state: selectors.State, kind: string, name: string, recordId: string | number): any;
|
|
80
|
+
getLastEntityDeleteError(state: selectors.State, kind: string, name: string, recordId: string | number): any;
|
|
81
|
+
getUndoEdit(state: selectors.State): any;
|
|
82
|
+
getRedoEdit(state: selectors.State): any;
|
|
83
|
+
hasUndo(state: selectors.State): boolean;
|
|
84
|
+
hasRedo(state: selectors.State): boolean;
|
|
85
|
+
getCurrentTheme(state: selectors.State): any;
|
|
86
|
+
__experimentalGetCurrentGlobalStylesId(state: selectors.State): string;
|
|
87
|
+
getThemeSupports(state: selectors.State): any;
|
|
88
|
+
getEmbedPreview(state: selectors.State, url: string): any;
|
|
89
|
+
isPreviewEmbedFallback(state: selectors.State, url: string): boolean;
|
|
90
|
+
canUser(state: selectors.State, action: string, resource: string, id?: (string | number) | undefined): boolean | undefined;
|
|
91
|
+
canUserEditEntityRecord(state: selectors.State, kind: string, name: string, recordId: string | number): boolean | undefined;
|
|
92
|
+
getAutosaves(state: selectors.State, postType: string, postId: string | number): any[] | undefined;
|
|
93
|
+
getAutosave<EntityRecord_1 extends import("./entity-types").Attachment<any> | import("./entity-types").Comment<any> | import("./entity-types").MenuLocation<any> | import("./entity-types").NavMenu<any> | import("./entity-types").NavMenuItem<any> | import("./entity-types").Page<any> | import("./entity-types").Plugin<any> | import("./entity-types").Post<any> | import("./entity-types").Settings<any> | import("./entity-types").Sidebar<any> | import("./entity-types").Taxonomy<any> | import("./entity-types").Theme<any> | import("./entity-types").User<any> | import("./entity-types").Type<any> | import("./entity-types").Widget<any> | import("./entity-types").WidgetType<any> | import("./entity-types").WpTemplate<any> | import("./entity-types").WpTemplatePart<any>>(state: selectors.State, postType: string, postId: string | number, authorId: string | number): EntityRecord_1 | undefined;
|
|
94
|
+
__experimentalGetTemplateForLink(state: selectors.State, link: string): (import("./entity-types").Updatable<import("./entity-types").WpTemplate<"edit">> | undefined) | null;
|
|
95
|
+
__experimentalGetCurrentThemeBaseGlobalStyles(state: selectors.State): any;
|
|
96
|
+
__experimentalGetCurrentThemeGlobalStylesVariations(state: selectors.State): string | null;
|
|
97
|
+
getBlockPatterns(state: selectors.State): any[];
|
|
98
|
+
getBlockPatternCategories(state: selectors.State): any[];
|
|
99
|
+
isRequestingEmbedPreview: Function;
|
|
100
|
+
getUserQueryResults: ((state: selectors.State, queryID: string) => import("./entity-types").User<"edit">[]) & import("rememo").EnhancedSelector;
|
|
101
|
+
getEntityRecord: (<EntityRecord_2 extends import("./entity-types").Attachment<any> | import("./entity-types").Comment<any> | import("./entity-types").MenuLocation<any> | import("./entity-types").NavMenu<any> | import("./entity-types").NavMenuItem<any> | import("./entity-types").Page<any> | import("./entity-types").Plugin<any> | import("./entity-types").Post<any> | import("./entity-types").Settings<any> | import("./entity-types").Sidebar<any> | import("./entity-types").Taxonomy<any> | import("./entity-types").Theme<any> | import("./entity-types").User<any> | import("./entity-types").Type<any> | import("./entity-types").Widget<any> | import("./entity-types").WidgetType<any> | import("./entity-types").WpTemplate<any> | import("./entity-types").WpTemplatePart<any> | Partial<import("./entity-types").Attachment<any> | import("./entity-types").Comment<any> | import("./entity-types").MenuLocation<any> | import("./entity-types").NavMenu<any> | import("./entity-types").NavMenuItem<any> | import("./entity-types").Page<any> | import("./entity-types").Plugin<any> | import("./entity-types").Post<any> | import("./entity-types").Settings<any> | import("./entity-types").Sidebar<any> | import("./entity-types").Taxonomy<any> | import("./entity-types").Theme<any> | import("./entity-types").User<any> | import("./entity-types").Type<any> | import("./entity-types").Widget<any> | import("./entity-types").WidgetType<any> | import("./entity-types").WpTemplate<any> | import("./entity-types").WpTemplatePart<any>>>(state: selectors.State, kind: string, name: string, key: string | number, query?: {
|
|
102
|
+
[x: string]: any;
|
|
103
|
+
} | undefined) => EntityRecord_2 | undefined) & import("rememo").EnhancedSelector;
|
|
104
|
+
getRawEntityRecord: (<EntityRecord_3 extends import("./entity-types").Attachment<any> | import("./entity-types").Comment<any> | import("./entity-types").MenuLocation<any> | import("./entity-types").NavMenu<any> | import("./entity-types").NavMenuItem<any> | import("./entity-types").Page<any> | import("./entity-types").Plugin<any> | import("./entity-types").Post<any> | import("./entity-types").Settings<any> | import("./entity-types").Sidebar<any> | import("./entity-types").Taxonomy<any> | import("./entity-types").Theme<any> | import("./entity-types").User<any> | import("./entity-types").Type<any> | import("./entity-types").Widget<any> | import("./entity-types").WidgetType<any> | import("./entity-types").WpTemplate<any> | import("./entity-types").WpTemplatePart<any>>(state: selectors.State, kind: string, name: string, key: string | number) => EntityRecord_3 | undefined) & import("rememo").EnhancedSelector;
|
|
105
|
+
getEntityRecords: <EntityRecord_4 extends import("./entity-types").Attachment<any> | import("./entity-types").Comment<any> | import("./entity-types").MenuLocation<any> | import("./entity-types").NavMenu<any> | import("./entity-types").NavMenuItem<any> | import("./entity-types").Page<any> | import("./entity-types").Plugin<any> | import("./entity-types").Post<any> | import("./entity-types").Settings<any> | import("./entity-types").Sidebar<any> | import("./entity-types").Taxonomy<any> | import("./entity-types").Theme<any> | import("./entity-types").User<any> | import("./entity-types").Type<any> | import("./entity-types").Widget<any> | import("./entity-types").WidgetType<any> | import("./entity-types").WpTemplate<any> | import("./entity-types").WpTemplatePart<any> | Partial<import("./entity-types").Attachment<any> | import("./entity-types").Comment<any> | import("./entity-types").MenuLocation<any> | import("./entity-types").NavMenu<any> | import("./entity-types").NavMenuItem<any> | import("./entity-types").Page<any> | import("./entity-types").Plugin<any> | import("./entity-types").Post<any> | import("./entity-types").Settings<any> | import("./entity-types").Sidebar<any> | import("./entity-types").Taxonomy<any> | import("./entity-types").Theme<any> | import("./entity-types").User<any> | import("./entity-types").Type<any> | import("./entity-types").Widget<any> | import("./entity-types").WidgetType<any> | import("./entity-types").WpTemplate<any> | import("./entity-types").WpTemplatePart<any>>>(state: selectors.State, kind: string, name: string, query?: {
|
|
106
|
+
[x: string]: any;
|
|
107
|
+
} | undefined) => EntityRecord_4[] | null;
|
|
108
|
+
__experimentalGetDirtyEntityRecords: ((state: selectors.State) => {
|
|
109
|
+
title: string;
|
|
110
|
+
key: string | number;
|
|
111
|
+
name: string;
|
|
112
|
+
kind: string;
|
|
113
|
+
}[]) & import("rememo").EnhancedSelector;
|
|
114
|
+
__experimentalGetEntitiesBeingSaved: ((state: selectors.State) => {
|
|
115
|
+
title: string;
|
|
116
|
+
key: string | number;
|
|
117
|
+
name: string;
|
|
118
|
+
kind: string;
|
|
119
|
+
}[]) & import("rememo").EnhancedSelector;
|
|
120
|
+
getEntityRecordNonTransientEdits: ((state: selectors.State, kind: string, name: string, recordId: string | number) => any) & import("rememo").EnhancedSelector;
|
|
121
|
+
getEditedEntityRecord: (<EntityRecord_5 extends import("./entity-types").Attachment<any> | import("./entity-types").Comment<any> | import("./entity-types").MenuLocation<any> | import("./entity-types").NavMenu<any> | import("./entity-types").NavMenuItem<any> | import("./entity-types").Page<any> | import("./entity-types").Plugin<any> | import("./entity-types").Post<any> | import("./entity-types").Settings<any> | import("./entity-types").Sidebar<any> | import("./entity-types").Taxonomy<any> | import("./entity-types").Theme<any> | import("./entity-types").User<any> | import("./entity-types").Type<any> | import("./entity-types").Widget<any> | import("./entity-types").WidgetType<any> | import("./entity-types").WpTemplate<any> | import("./entity-types").WpTemplatePart<any>>(state: selectors.State, kind: string, name: string, recordId: string | number) => import("./entity-types").Updatable<EntityRecord_5> | undefined) & import("rememo").EnhancedSelector;
|
|
122
|
+
hasFetchedAutosaves: Function;
|
|
123
|
+
getReferenceByDistinctEdits: ((state: selectors.State) => never[]) & import("rememo").EnhancedSelector;
|
|
124
|
+
}>>;
|
|
125
|
+
export { default as EntityProvider } from "./entity-provider";
|
|
126
|
+
export * from "./entity-provider";
|
|
127
|
+
export * from "./entity-types";
|
|
128
|
+
export * from "./fetch";
|
|
129
|
+
export * from "./hooks";
|
|
130
|
+
import * as selectors from "./selectors";
|
|
131
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":";AA0DA;;;;GAIG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAAmE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/locks/actions.js"],"names":[],"mappings":"AAKA;;;;;EAYC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/locks/engine.js"],"names":[],"mappings":"AAMA;;;EAoCC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reducer returning locks.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} state Current state.
|
|
5
|
+
* @param {Object} action Dispatched action.
|
|
6
|
+
*
|
|
7
|
+
* @return {Object} Updated state.
|
|
8
|
+
*/
|
|
9
|
+
export default function locks(state: any, action: any): any;
|
|
10
|
+
//# sourceMappingURL=reducer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../src/locks/reducer.js"],"names":[],"mappings":"AAaA;;;;;;;GAOG;AACH,4DAwCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../src/locks/selectors.js"],"names":[],"mappings":"AAUA,wDAEC;AAED;;YA0BC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function deepCopyLocksTreePath(tree: any, path: any): any;
|
|
2
|
+
export function getNode(tree: any, path: any): any;
|
|
3
|
+
export function iteratePath(tree: any, path: any): Generator<any, void, unknown>;
|
|
4
|
+
export function iterateDescendants(node: any): Generator<any, void, unknown>;
|
|
5
|
+
export function hasConflictingLock({ exclusive }: {
|
|
6
|
+
exclusive: any;
|
|
7
|
+
}, locks: any): boolean;
|
|
8
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/locks/utils.js"],"names":[],"mappings":"AAAA,iEAeC;AAED,mDAUC;AAED,iFAWC;AAED,6EAOC;AAED;;wBAUC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"name.d.ts","sourceRoot":"","sources":["../src/name.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,yBAFU,MAAM,CAEiB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns an action object used in signalling that items have been received.
|
|
3
|
+
*
|
|
4
|
+
* @param {Array} items Items received.
|
|
5
|
+
* @param {?Object} edits Optional edits to reset.
|
|
6
|
+
*
|
|
7
|
+
* @return {Object} Action object.
|
|
8
|
+
*/
|
|
9
|
+
export function receiveItems(items: any[], edits: any | null): any;
|
|
10
|
+
/**
|
|
11
|
+
* Returns an action object used in signalling that entity records have been
|
|
12
|
+
* deleted and they need to be removed from entities state.
|
|
13
|
+
*
|
|
14
|
+
* @param {string} kind Kind of the removed entities.
|
|
15
|
+
* @param {string} name Name of the removed entities.
|
|
16
|
+
* @param {Array|number|string} records Record IDs of the removed entities.
|
|
17
|
+
* @param {boolean} invalidateCache Controls whether we want to invalidate the cache.
|
|
18
|
+
* @return {Object} Action object.
|
|
19
|
+
*/
|
|
20
|
+
export function removeItems(kind: string, name: string, records: any[] | number | string, invalidateCache?: boolean): any;
|
|
21
|
+
/**
|
|
22
|
+
* Returns an action object used in signalling that queried data has been
|
|
23
|
+
* received.
|
|
24
|
+
*
|
|
25
|
+
* @param {Array} items Queried items received.
|
|
26
|
+
* @param {?Object} query Optional query object.
|
|
27
|
+
* @param {?Object} edits Optional edits to reset.
|
|
28
|
+
*
|
|
29
|
+
* @return {Object} Action object.
|
|
30
|
+
*/
|
|
31
|
+
export function receiveQueriedItems(items: any[], query: any | null, edits: any | null): any;
|
|
32
|
+
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/queried-data/actions.js"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AACH,mEAMC;AAED;;;;;;;;;GASG;AACH,kCANW,MAAM,QACN,MAAM,WACN,QAAM,MAAM,GAAC,MAAM,oBACnB,OAAO,OAWjB;AAED;;;;;;;;;GASG;AACH,6FAKC"}
|