@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.
Files changed (158) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +1 -1
  3. package/build/actions.js +1 -1
  4. package/build/actions.js.map +1 -1
  5. package/build/hooks/constants.js +18 -0
  6. package/build/hooks/constants.js.map +1 -0
  7. package/build/hooks/memoize.js +18 -0
  8. package/build/hooks/memoize.js.map +1 -0
  9. package/build/hooks/use-entity-record.js +60 -0
  10. package/build/hooks/use-entity-record.js.map +1 -0
  11. package/build/hooks/use-entity-records.js +67 -0
  12. package/build/hooks/use-entity-records.js.map +1 -0
  13. package/build/hooks/use-query-select.js +130 -0
  14. package/build/hooks/use-query-select.js.map +1 -0
  15. package/build/index.js +34 -3
  16. package/build/index.js.map +1 -1
  17. package/build/resolvers.js +2 -17
  18. package/build/resolvers.js.map +1 -1
  19. package/build/types/attachment.js +6 -0
  20. package/build/types/attachment.js.map +1 -0
  21. package/build/types/base-entity-types.js +47 -0
  22. package/build/types/base-entity-types.js.map +1 -0
  23. package/build/types/comment.js +6 -0
  24. package/build/types/comment.js.map +1 -0
  25. package/build/types/helpers.js +6 -0
  26. package/build/types/helpers.js.map +1 -0
  27. package/build/types/index.js +6 -0
  28. package/build/types/index.js.map +1 -0
  29. package/build/types/menu-location.js +6 -0
  30. package/build/types/menu-location.js.map +1 -0
  31. package/build/types/nav-menu-item.js +6 -0
  32. package/build/types/nav-menu-item.js.map +1 -0
  33. package/build/types/nav-menu.js +6 -0
  34. package/build/types/nav-menu.js.map +1 -0
  35. package/build/types/navigation-area.js +6 -0
  36. package/build/types/navigation-area.js.map +1 -0
  37. package/build/types/page.js +6 -0
  38. package/build/types/page.js.map +1 -0
  39. package/build/types/plugin.js +6 -0
  40. package/build/types/plugin.js.map +1 -0
  41. package/build/types/post.js +6 -0
  42. package/build/types/post.js.map +1 -0
  43. package/build/types/settings.js +6 -0
  44. package/build/types/settings.js.map +1 -0
  45. package/build/types/sidebar.js +6 -0
  46. package/build/types/sidebar.js.map +1 -0
  47. package/build/types/taxonomy.js +6 -0
  48. package/build/types/taxonomy.js.map +1 -0
  49. package/build/types/theme.js +6 -0
  50. package/build/types/theme.js.map +1 -0
  51. package/build/types/type.js +6 -0
  52. package/build/types/type.js.map +1 -0
  53. package/build/types/user.js +6 -0
  54. package/build/types/user.js.map +1 -0
  55. package/build/types/widget-type.js +6 -0
  56. package/build/types/widget-type.js.map +1 -0
  57. package/build/types/widget.js +6 -0
  58. package/build/types/widget.js.map +1 -0
  59. package/build/types/wp-template-part.js +6 -0
  60. package/build/types/wp-template-part.js.map +1 -0
  61. package/build/types/wp-template.js +6 -0
  62. package/build/types/wp-template.js.map +1 -0
  63. package/build-module/actions.js +1 -1
  64. package/build-module/actions.js.map +1 -1
  65. package/build-module/hooks/constants.js +10 -0
  66. package/build-module/hooks/constants.js.map +1 -0
  67. package/build-module/hooks/memoize.js +7 -0
  68. package/build-module/hooks/memoize.js.map +1 -0
  69. package/build-module/hooks/use-entity-record.js +49 -0
  70. package/build-module/hooks/use-entity-record.js.map +1 -0
  71. package/build-module/hooks/use-entity-records.js +56 -0
  72. package/build-module/hooks/use-entity-records.js.map +1 -0
  73. package/build-module/hooks/use-query-select.js +116 -0
  74. package/build-module/hooks/use-query-select.js.map +1 -0
  75. package/build-module/index.js +4 -2
  76. package/build-module/index.js.map +1 -1
  77. package/build-module/resolvers.js +3 -18
  78. package/build-module/resolvers.js.map +1 -1
  79. package/build-module/types/attachment.js +2 -0
  80. package/build-module/types/attachment.js.map +1 -0
  81. package/build-module/types/base-entity-types.js +39 -0
  82. package/build-module/types/base-entity-types.js.map +1 -0
  83. package/build-module/types/comment.js +2 -0
  84. package/build-module/types/comment.js.map +1 -0
  85. package/build-module/types/helpers.js +2 -0
  86. package/build-module/types/helpers.js.map +1 -0
  87. package/build-module/types/index.js +2 -0
  88. package/build-module/types/index.js.map +1 -0
  89. package/build-module/types/menu-location.js +2 -0
  90. package/build-module/types/menu-location.js.map +1 -0
  91. package/build-module/types/nav-menu-item.js +2 -0
  92. package/build-module/types/nav-menu-item.js.map +1 -0
  93. package/build-module/types/nav-menu.js +2 -0
  94. package/build-module/types/nav-menu.js.map +1 -0
  95. package/build-module/types/navigation-area.js +2 -0
  96. package/build-module/types/navigation-area.js.map +1 -0
  97. package/build-module/types/page.js +2 -0
  98. package/build-module/types/page.js.map +1 -0
  99. package/build-module/types/plugin.js +2 -0
  100. package/build-module/types/plugin.js.map +1 -0
  101. package/build-module/types/post.js +2 -0
  102. package/build-module/types/post.js.map +1 -0
  103. package/build-module/types/settings.js +2 -0
  104. package/build-module/types/settings.js.map +1 -0
  105. package/build-module/types/sidebar.js +2 -0
  106. package/build-module/types/sidebar.js.map +1 -0
  107. package/build-module/types/taxonomy.js +2 -0
  108. package/build-module/types/taxonomy.js.map +1 -0
  109. package/build-module/types/theme.js +2 -0
  110. package/build-module/types/theme.js.map +1 -0
  111. package/build-module/types/type.js +2 -0
  112. package/build-module/types/type.js.map +1 -0
  113. package/build-module/types/user.js +2 -0
  114. package/build-module/types/user.js.map +1 -0
  115. package/build-module/types/widget-type.js +2 -0
  116. package/build-module/types/widget-type.js.map +1 -0
  117. package/build-module/types/widget.js +2 -0
  118. package/build-module/types/widget.js.map +1 -0
  119. package/build-module/types/wp-template-part.js +2 -0
  120. package/build-module/types/wp-template-part.js.map +1 -0
  121. package/build-module/types/wp-template.js +2 -0
  122. package/build-module/types/wp-template.js.map +1 -0
  123. package/package.json +5 -4
  124. package/src/actions.js +1 -1
  125. package/src/hooks/constants.ts +7 -0
  126. package/src/hooks/memoize.js +7 -0
  127. package/src/hooks/test/use-entity-record.js +74 -0
  128. package/src/hooks/test/use-entity-records.js +78 -0
  129. package/src/hooks/test/use-query-select.js +194 -0
  130. package/src/hooks/use-entity-record.ts +72 -0
  131. package/src/hooks/use-entity-records.ts +79 -0
  132. package/src/hooks/use-query-select.ts +131 -0
  133. package/src/index.js +3 -1
  134. package/src/resolvers.js +3 -17
  135. package/src/test/resolvers.js +4 -10
  136. package/src/types/README.md +193 -0
  137. package/src/types/attachment.ts +146 -0
  138. package/src/types/base-entity-types.ts +36 -0
  139. package/src/types/comment.ts +96 -0
  140. package/src/types/helpers.ts +153 -0
  141. package/src/types/index.ts +72 -0
  142. package/src/types/menu-location.ts +29 -0
  143. package/src/types/nav-menu-item.ts +106 -0
  144. package/src/types/nav-menu.ts +53 -0
  145. package/src/types/navigation-area.ts +29 -0
  146. package/src/types/page.ts +144 -0
  147. package/src/types/plugin.ts +74 -0
  148. package/src/types/post.ts +153 -0
  149. package/src/types/settings.ts +93 -0
  150. package/src/types/sidebar.ts +60 -0
  151. package/src/types/taxonomy.ts +92 -0
  152. package/src/types/theme.ts +222 -0
  153. package/src/types/type.ts +80 -0
  154. package/src/types/user.ts +109 -0
  155. package/src/types/widget-type.ts +37 -0
  156. package/src/types/widget.ts +64 -0
  157. package/src/types/wp-template-part.ts +94 -0
  158. 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
+ >;