@wordpress/core-data 4.1.1 → 4.1.2
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 +6 -0
- package/README.md +1 -1
- package/build/actions.js +1 -1
- package/build/actions.js.map +1 -1
- package/build/hooks/constants.js +18 -0
- package/build/hooks/constants.js.map +1 -0
- package/build/hooks/memoize.js +18 -0
- package/build/hooks/memoize.js.map +1 -0
- package/build/hooks/use-entity-record.js +60 -0
- package/build/hooks/use-entity-record.js.map +1 -0
- package/build/hooks/use-entity-records.js +67 -0
- package/build/hooks/use-entity-records.js.map +1 -0
- package/build/hooks/use-query-select.js +130 -0
- package/build/hooks/use-query-select.js.map +1 -0
- package/build/index.js +34 -3
- package/build/index.js.map +1 -1
- package/build/resolvers.js +2 -17
- package/build/resolvers.js.map +1 -1
- package/build/types/attachment.js +6 -0
- package/build/types/attachment.js.map +1 -0
- package/build/types/base-entity-types.js +47 -0
- package/build/types/base-entity-types.js.map +1 -0
- package/build/types/comment.js +6 -0
- package/build/types/comment.js.map +1 -0
- package/build/types/helpers.js +6 -0
- package/build/types/helpers.js.map +1 -0
- package/build/types/index.js +6 -0
- package/build/types/index.js.map +1 -0
- package/build/types/menu-location.js +6 -0
- package/build/types/menu-location.js.map +1 -0
- package/build/types/nav-menu-item.js +6 -0
- package/build/types/nav-menu-item.js.map +1 -0
- package/build/types/nav-menu.js +6 -0
- package/build/types/nav-menu.js.map +1 -0
- package/build/types/navigation-area.js +6 -0
- package/build/types/navigation-area.js.map +1 -0
- package/build/types/page.js +6 -0
- package/build/types/page.js.map +1 -0
- package/build/types/plugin.js +6 -0
- package/build/types/plugin.js.map +1 -0
- package/build/types/post.js +6 -0
- package/build/types/post.js.map +1 -0
- package/build/types/settings.js +6 -0
- package/build/types/settings.js.map +1 -0
- package/build/types/sidebar.js +6 -0
- package/build/types/sidebar.js.map +1 -0
- package/build/types/taxonomy.js +6 -0
- package/build/types/taxonomy.js.map +1 -0
- package/build/types/theme.js +6 -0
- package/build/types/theme.js.map +1 -0
- package/build/types/type.js +6 -0
- package/build/types/type.js.map +1 -0
- package/build/types/user.js +6 -0
- package/build/types/user.js.map +1 -0
- package/build/types/widget-type.js +6 -0
- package/build/types/widget-type.js.map +1 -0
- package/build/types/widget.js +6 -0
- package/build/types/widget.js.map +1 -0
- package/build/types/wp-template-part.js +6 -0
- package/build/types/wp-template-part.js.map +1 -0
- package/build/types/wp-template.js +6 -0
- package/build/types/wp-template.js.map +1 -0
- package/build-module/actions.js +1 -1
- package/build-module/actions.js.map +1 -1
- package/build-module/hooks/constants.js +10 -0
- package/build-module/hooks/constants.js.map +1 -0
- package/build-module/hooks/memoize.js +7 -0
- package/build-module/hooks/memoize.js.map +1 -0
- package/build-module/hooks/use-entity-record.js +49 -0
- package/build-module/hooks/use-entity-record.js.map +1 -0
- package/build-module/hooks/use-entity-records.js +56 -0
- package/build-module/hooks/use-entity-records.js.map +1 -0
- package/build-module/hooks/use-query-select.js +116 -0
- package/build-module/hooks/use-query-select.js.map +1 -0
- package/build-module/index.js +4 -2
- package/build-module/index.js.map +1 -1
- package/build-module/resolvers.js +3 -18
- package/build-module/resolvers.js.map +1 -1
- package/build-module/types/attachment.js +2 -0
- package/build-module/types/attachment.js.map +1 -0
- package/build-module/types/base-entity-types.js +39 -0
- package/build-module/types/base-entity-types.js.map +1 -0
- package/build-module/types/comment.js +2 -0
- package/build-module/types/comment.js.map +1 -0
- package/build-module/types/helpers.js +2 -0
- package/build-module/types/helpers.js.map +1 -0
- package/build-module/types/index.js +2 -0
- package/build-module/types/index.js.map +1 -0
- package/build-module/types/menu-location.js +2 -0
- package/build-module/types/menu-location.js.map +1 -0
- package/build-module/types/nav-menu-item.js +2 -0
- package/build-module/types/nav-menu-item.js.map +1 -0
- package/build-module/types/nav-menu.js +2 -0
- package/build-module/types/nav-menu.js.map +1 -0
- package/build-module/types/navigation-area.js +2 -0
- package/build-module/types/navigation-area.js.map +1 -0
- package/build-module/types/page.js +2 -0
- package/build-module/types/page.js.map +1 -0
- package/build-module/types/plugin.js +2 -0
- package/build-module/types/plugin.js.map +1 -0
- package/build-module/types/post.js +2 -0
- package/build-module/types/post.js.map +1 -0
- package/build-module/types/settings.js +2 -0
- package/build-module/types/settings.js.map +1 -0
- package/build-module/types/sidebar.js +2 -0
- package/build-module/types/sidebar.js.map +1 -0
- package/build-module/types/taxonomy.js +2 -0
- package/build-module/types/taxonomy.js.map +1 -0
- package/build-module/types/theme.js +2 -0
- package/build-module/types/theme.js.map +1 -0
- package/build-module/types/type.js +2 -0
- package/build-module/types/type.js.map +1 -0
- package/build-module/types/user.js +2 -0
- package/build-module/types/user.js.map +1 -0
- package/build-module/types/widget-type.js +2 -0
- package/build-module/types/widget-type.js.map +1 -0
- package/build-module/types/widget.js +2 -0
- package/build-module/types/widget.js.map +1 -0
- package/build-module/types/wp-template-part.js +2 -0
- package/build-module/types/wp-template-part.js.map +1 -0
- package/build-module/types/wp-template.js +2 -0
- package/build-module/types/wp-template.js.map +1 -0
- package/package.json +5 -4
- package/src/actions.js +1 -1
- package/src/hooks/constants.ts +7 -0
- package/src/hooks/memoize.js +7 -0
- package/src/hooks/test/use-entity-record.js +74 -0
- package/src/hooks/test/use-entity-records.js +78 -0
- package/src/hooks/test/use-query-select.js +194 -0
- package/src/hooks/use-entity-record.ts +72 -0
- package/src/hooks/use-entity-records.ts +79 -0
- package/src/hooks/use-query-select.ts +131 -0
- package/src/index.js +3 -1
- package/src/resolvers.js +3 -17
- package/src/test/resolvers.js +4 -10
- package/src/types/README.md +193 -0
- package/src/types/attachment.ts +146 -0
- package/src/types/base-entity-types.ts +36 -0
- package/src/types/comment.ts +96 -0
- package/src/types/helpers.ts +153 -0
- package/src/types/index.ts +72 -0
- package/src/types/menu-location.ts +29 -0
- package/src/types/nav-menu-item.ts +106 -0
- package/src/types/nav-menu.ts +53 -0
- package/src/types/navigation-area.ts +29 -0
- package/src/types/page.ts +144 -0
- package/src/types/plugin.ts +74 -0
- package/src/types/post.ts +153 -0
- package/src/types/settings.ts +93 -0
- package/src/types/sidebar.ts +60 -0
- package/src/types/taxonomy.ts +92 -0
- package/src/types/theme.ts +222 -0
- package/src/types/type.ts +80 -0
- package/src/types/user.ts +109 -0
- package/src/types/widget-type.ts +37 -0
- package/src/types/widget.ts +64 -0
- package/src/types/wp-template-part.ts +94 -0
- package/src/types/wp-template.ts +94 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
Context,
|
|
6
|
+
PostStatus,
|
|
7
|
+
RenderedText,
|
|
8
|
+
OmitNevers,
|
|
9
|
+
ContextualField,
|
|
10
|
+
} from './helpers';
|
|
11
|
+
|
|
12
|
+
import { BaseEntityTypes as _BaseEntityTypes } from './base-entity-types';
|
|
13
|
+
|
|
14
|
+
declare module './base-entity-types' {
|
|
15
|
+
export namespace BaseEntityTypes {
|
|
16
|
+
export interface WpTemplatePart< C extends Context > {
|
|
17
|
+
/**
|
|
18
|
+
* ID of template.
|
|
19
|
+
*/
|
|
20
|
+
id: string;
|
|
21
|
+
/**
|
|
22
|
+
* Unique slug identifying the template.
|
|
23
|
+
*/
|
|
24
|
+
slug: string;
|
|
25
|
+
/**
|
|
26
|
+
* Theme identifier for the template.
|
|
27
|
+
*/
|
|
28
|
+
theme: string;
|
|
29
|
+
/**
|
|
30
|
+
* Type of template.
|
|
31
|
+
*/
|
|
32
|
+
type: string;
|
|
33
|
+
/**
|
|
34
|
+
* Source of template
|
|
35
|
+
*/
|
|
36
|
+
source: string;
|
|
37
|
+
/**
|
|
38
|
+
* Source of a customized template
|
|
39
|
+
*/
|
|
40
|
+
origin: string;
|
|
41
|
+
/**
|
|
42
|
+
* Content of template.
|
|
43
|
+
*
|
|
44
|
+
* This field never has a `rendered` property when reading but still uses
|
|
45
|
+
* the RenderedText type so it can be set as a string when sending updates to
|
|
46
|
+
* the server.
|
|
47
|
+
*
|
|
48
|
+
* TODO: Figure out how to mesh this with `RenderedText<C>`
|
|
49
|
+
*/
|
|
50
|
+
content: ContextualField<
|
|
51
|
+
RenderedText< C > & {
|
|
52
|
+
/**
|
|
53
|
+
* Version of the content block format used by the template.
|
|
54
|
+
*/
|
|
55
|
+
block_version: ContextualField< number, 'edit', C >;
|
|
56
|
+
},
|
|
57
|
+
'view' | 'edit',
|
|
58
|
+
C
|
|
59
|
+
>;
|
|
60
|
+
/**
|
|
61
|
+
* Title of template.
|
|
62
|
+
*/
|
|
63
|
+
title: RenderedText< 'edit' >;
|
|
64
|
+
/**
|
|
65
|
+
* Description of template.
|
|
66
|
+
*/
|
|
67
|
+
description: string;
|
|
68
|
+
/**
|
|
69
|
+
* Status of template.
|
|
70
|
+
*/
|
|
71
|
+
status: PostStatus;
|
|
72
|
+
/**
|
|
73
|
+
* Post ID.
|
|
74
|
+
*/
|
|
75
|
+
wp_id: number;
|
|
76
|
+
/**
|
|
77
|
+
* Theme file exists.
|
|
78
|
+
*/
|
|
79
|
+
has_theme_file: Record< string, string >;
|
|
80
|
+
/**
|
|
81
|
+
* The ID for the author of the template.
|
|
82
|
+
*/
|
|
83
|
+
author: number;
|
|
84
|
+
/**
|
|
85
|
+
* Where the template part is intended for use (header, footer, etc.)
|
|
86
|
+
*/
|
|
87
|
+
area: string;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export type WpTemplatePart< C extends Context > = OmitNevers<
|
|
93
|
+
_BaseEntityTypes.WpTemplatePart< C >
|
|
94
|
+
>;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
Context,
|
|
6
|
+
PostStatus,
|
|
7
|
+
RenderedText,
|
|
8
|
+
OmitNevers,
|
|
9
|
+
ContextualField,
|
|
10
|
+
} from './helpers';
|
|
11
|
+
|
|
12
|
+
import { BaseEntityTypes as _BaseEntityTypes } from './base-entity-types';
|
|
13
|
+
|
|
14
|
+
declare module './base-entity-types' {
|
|
15
|
+
export namespace BaseEntityTypes {
|
|
16
|
+
export interface WpTemplate< C extends Context > {
|
|
17
|
+
/**
|
|
18
|
+
* ID of template.
|
|
19
|
+
*/
|
|
20
|
+
id: string;
|
|
21
|
+
/**
|
|
22
|
+
* Unique slug identifying the template.
|
|
23
|
+
*/
|
|
24
|
+
slug: string;
|
|
25
|
+
/**
|
|
26
|
+
* Theme identifier for the template.
|
|
27
|
+
*/
|
|
28
|
+
theme: string;
|
|
29
|
+
/**
|
|
30
|
+
* Type of template.
|
|
31
|
+
*/
|
|
32
|
+
type: string;
|
|
33
|
+
/**
|
|
34
|
+
* Source of template
|
|
35
|
+
*/
|
|
36
|
+
source: string;
|
|
37
|
+
/**
|
|
38
|
+
* Source of a customized template
|
|
39
|
+
*/
|
|
40
|
+
origin: string;
|
|
41
|
+
/**
|
|
42
|
+
* Content of template.
|
|
43
|
+
*
|
|
44
|
+
* This field never has a `rendered` property when reading but still uses
|
|
45
|
+
* the RenderedText type so it can be set as a string when sending updates to
|
|
46
|
+
* the server.
|
|
47
|
+
*
|
|
48
|
+
* TODO: Figure out how to mesh this with `RenderedText<C>`
|
|
49
|
+
*/
|
|
50
|
+
content: ContextualField<
|
|
51
|
+
RenderedText< C > & {
|
|
52
|
+
/**
|
|
53
|
+
* Version of the content block format used by the template.
|
|
54
|
+
*/
|
|
55
|
+
block_version: ContextualField< number, 'edit', C >;
|
|
56
|
+
},
|
|
57
|
+
'view' | 'edit',
|
|
58
|
+
C
|
|
59
|
+
>;
|
|
60
|
+
/**
|
|
61
|
+
* Title of template.
|
|
62
|
+
*/
|
|
63
|
+
title: RenderedText< 'edit' >;
|
|
64
|
+
/**
|
|
65
|
+
* Description of template.
|
|
66
|
+
*/
|
|
67
|
+
description: string;
|
|
68
|
+
/**
|
|
69
|
+
* Status of template.
|
|
70
|
+
*/
|
|
71
|
+
status: PostStatus;
|
|
72
|
+
/**
|
|
73
|
+
* Post ID.
|
|
74
|
+
*/
|
|
75
|
+
wp_id: number;
|
|
76
|
+
/**
|
|
77
|
+
* Theme file exists.
|
|
78
|
+
*/
|
|
79
|
+
has_theme_file: Record< string, string >;
|
|
80
|
+
/**
|
|
81
|
+
* The ID for the author of the template.
|
|
82
|
+
*/
|
|
83
|
+
author: number;
|
|
84
|
+
/**
|
|
85
|
+
* Whether a template is a custom template.
|
|
86
|
+
*/
|
|
87
|
+
is_custom: Record< string, string >;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export type WpTemplate< C extends Context > = OmitNevers<
|
|
93
|
+
_BaseEntityTypes.WpTemplate< C >
|
|
94
|
+
>;
|