@wordpress/core-data 4.2.1 → 4.4.1

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 (147) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +68 -11
  3. package/build/actions.js +61 -41
  4. package/build/actions.js.map +1 -1
  5. package/build/batch/default-processor.js +1 -1
  6. package/build/batch/default-processor.js.map +1 -1
  7. package/build/entities.js +36 -23
  8. package/build/entities.js.map +1 -1
  9. package/build/entity-provider.js +46 -44
  10. package/build/entity-provider.js.map +1 -1
  11. package/build/entity-types/{base-entity-types.js → base-entity-records.js} +9 -9
  12. package/build/entity-types/base-entity-records.js.map +1 -0
  13. package/build/fetch/__experimental-fetch-link-suggestions.js +48 -11
  14. package/build/fetch/__experimental-fetch-link-suggestions.js.map +1 -1
  15. package/build/fetch/__experimental-fetch-url-data.js +1 -1
  16. package/build/fetch/__experimental-fetch-url-data.js.map +1 -1
  17. package/build/hooks/use-entity-record.js +15 -5
  18. package/build/hooks/use-entity-record.js.map +1 -1
  19. package/build/hooks/use-entity-records.js +14 -2
  20. package/build/hooks/use-entity-records.js.map +1 -1
  21. package/build/hooks/use-query-select.js.map +1 -1
  22. package/build/index.js +9 -21
  23. package/build/index.js.map +1 -1
  24. package/build/queried-data/actions.js +4 -4
  25. package/build/queried-data/actions.js.map +1 -1
  26. package/build/queried-data/get-query-parts.js +7 -3
  27. package/build/queried-data/get-query-parts.js.map +1 -1
  28. package/build/queried-data/reducer.js +8 -6
  29. package/build/queried-data/reducer.js.map +1 -1
  30. package/build/reducer.js +77 -25
  31. package/build/reducer.js.map +1 -1
  32. package/build/resolvers.js +60 -24
  33. package/build/resolvers.js.map +1 -1
  34. package/build/selectors.js +122 -55
  35. package/build/selectors.js.map +1 -1
  36. package/build/types.js +6 -0
  37. package/build/types.js.map +1 -0
  38. package/build/utils/conservative-map-item.js +1 -1
  39. package/build/utils/conservative-map-item.js.map +1 -1
  40. package/build/utils/if-matching-action.js +4 -2
  41. package/build/utils/if-matching-action.js.map +1 -1
  42. package/build/utils/is-raw-attribute.js +1 -1
  43. package/build/utils/is-raw-attribute.js.map +1 -1
  44. package/build/utils/on-sub-key.js +3 -1
  45. package/build/utils/on-sub-key.js.map +1 -1
  46. package/build/utils/replace-action.js +4 -2
  47. package/build/utils/replace-action.js.map +1 -1
  48. package/build-module/actions.js +62 -42
  49. package/build-module/actions.js.map +1 -1
  50. package/build-module/batch/default-processor.js +1 -1
  51. package/build-module/batch/default-processor.js.map +1 -1
  52. package/build-module/entities.js +32 -19
  53. package/build-module/entities.js.map +1 -1
  54. package/build-module/entity-provider.js +47 -45
  55. package/build-module/entity-provider.js.map +1 -1
  56. package/build-module/entity-types/{base-entity-types.js → base-entity-records.js} +7 -7
  57. package/build-module/entity-types/base-entity-records.js.map +1 -0
  58. package/build-module/fetch/__experimental-fetch-link-suggestions.js +48 -11
  59. package/build-module/fetch/__experimental-fetch-link-suggestions.js.map +1 -1
  60. package/build-module/fetch/__experimental-fetch-url-data.js +1 -1
  61. package/build-module/fetch/__experimental-fetch-url-data.js.map +1 -1
  62. package/build-module/hooks/use-entity-record.js +15 -5
  63. package/build-module/hooks/use-entity-record.js.map +1 -1
  64. package/build-module/hooks/use-entity-records.js +14 -2
  65. package/build-module/hooks/use-entity-records.js.map +1 -1
  66. package/build-module/hooks/use-query-select.js.map +1 -1
  67. package/build-module/index.js +10 -22
  68. package/build-module/index.js.map +1 -1
  69. package/build-module/queried-data/actions.js +4 -4
  70. package/build-module/queried-data/actions.js.map +1 -1
  71. package/build-module/queried-data/get-query-parts.js +7 -3
  72. package/build-module/queried-data/get-query-parts.js.map +1 -1
  73. package/build-module/queried-data/reducer.js +8 -6
  74. package/build-module/queried-data/reducer.js.map +1 -1
  75. package/build-module/reducer.js +75 -26
  76. package/build-module/reducer.js.map +1 -1
  77. package/build-module/resolvers.js +55 -25
  78. package/build-module/resolvers.js.map +1 -1
  79. package/build-module/selectors.js +114 -55
  80. package/build-module/selectors.js.map +1 -1
  81. package/build-module/types.js +2 -0
  82. package/build-module/types.js.map +1 -0
  83. package/build-module/utils/conservative-map-item.js +1 -1
  84. package/build-module/utils/conservative-map-item.js.map +1 -1
  85. package/build-module/utils/if-matching-action.js +4 -2
  86. package/build-module/utils/if-matching-action.js.map +1 -1
  87. package/build-module/utils/is-raw-attribute.js +1 -1
  88. package/build-module/utils/is-raw-attribute.js.map +1 -1
  89. package/build-module/utils/on-sub-key.js +3 -1
  90. package/build-module/utils/on-sub-key.js.map +1 -1
  91. package/build-module/utils/replace-action.js +4 -2
  92. package/build-module/utils/replace-action.js.map +1 -1
  93. package/package.json +11 -11
  94. package/src/actions.js +62 -42
  95. package/src/batch/default-processor.js +1 -0
  96. package/src/{entities.js → entities.ts} +50 -21
  97. package/src/entity-provider.js +50 -44
  98. package/src/entity-types/attachment.ts +5 -5
  99. package/src/entity-types/{base-entity-types.ts → base-entity-records.ts} +5 -5
  100. package/src/entity-types/comment.ts +5 -5
  101. package/src/entity-types/helpers.ts +1 -1
  102. package/src/entity-types/index.ts +4 -4
  103. package/src/entity-types/menu-location.ts +5 -5
  104. package/src/entity-types/nav-menu-item.ts +10 -5
  105. package/src/entity-types/nav-menu.ts +5 -5
  106. package/src/entity-types/navigation-area.ts +5 -5
  107. package/src/entity-types/page.ts +5 -5
  108. package/src/entity-types/plugin.ts +10 -5
  109. package/src/entity-types/post.ts +5 -5
  110. package/src/entity-types/settings.ts +10 -5
  111. package/src/entity-types/sidebar.ts +6 -7
  112. package/src/entity-types/taxonomy.ts +5 -5
  113. package/src/entity-types/theme.ts +5 -5
  114. package/src/entity-types/type.ts +5 -5
  115. package/src/entity-types/user.ts +10 -5
  116. package/src/entity-types/widget-type.ts +5 -5
  117. package/src/entity-types/widget.ts +5 -5
  118. package/src/entity-types/wp-template-part.ts +5 -5
  119. package/src/entity-types/wp-template.ts +5 -5
  120. package/src/fetch/__experimental-fetch-link-suggestions.js +56 -20
  121. package/src/fetch/__experimental-fetch-url-data.js +1 -0
  122. package/src/fetch/test/__experimental-fetch-link-suggestions.js +39 -1
  123. package/src/hooks/use-entity-record.ts +19 -8
  124. package/src/hooks/use-entity-records.ts +23 -6
  125. package/src/hooks/use-query-select.ts +12 -7
  126. package/src/index.js +10 -15
  127. package/src/locks/test/selectors.js +4 -4
  128. package/src/queried-data/actions.js +4 -4
  129. package/src/queried-data/get-query-parts.js +5 -5
  130. package/src/queried-data/reducer.js +6 -6
  131. package/src/reducer.js +67 -24
  132. package/src/resolvers.js +52 -31
  133. package/src/{selectors.js → selectors.ts} +118 -57
  134. package/src/test/actions.js +138 -33
  135. package/src/test/entities.js +11 -11
  136. package/src/test/reducer.js +4 -4
  137. package/src/test/resolvers.js +5 -5
  138. package/src/test/selectors.js +22 -22
  139. package/src/types.ts +3 -0
  140. package/src/utils/conservative-map-item.js +1 -1
  141. package/src/utils/if-matching-action.js +4 -2
  142. package/src/utils/is-raw-attribute.js +1 -1
  143. package/src/utils/on-sub-key.js +3 -1
  144. package/src/utils/replace-action.js +4 -2
  145. package/src/utils/test/is-raw-attribute.js +4 -4
  146. package/build/entity-types/base-entity-types.js.map +0 -1
  147. package/build-module/entity-types/base-entity-types.js.map +0 -1
@@ -15,53 +15,59 @@ import { parse, __unstableSerializeAndClean } from '@wordpress/blocks';
15
15
  */
16
16
  import { STORE_NAME } from './name';
17
17
 
18
+ /** @typedef {import('@wordpress/blocks').WPBlock} WPBlock */
19
+
18
20
  const EMPTY_ARRAY = [];
19
21
 
20
22
  /**
21
23
  * Internal dependencies
22
24
  */
23
- import { defaultEntities, kinds } from './entities';
25
+ import { rootEntitiesConfig, additionalEntityConfigLoaders } from './entities';
24
26
 
25
- const entities = {
26
- ...defaultEntities.reduce( ( acc, entity ) => {
27
- if ( ! acc[ entity.kind ] ) {
28
- acc[ entity.kind ] = {};
27
+ const entityContexts = {
28
+ ...rootEntitiesConfig.reduce( ( acc, loader ) => {
29
+ if ( ! acc[ loader.kind ] ) {
30
+ acc[ loader.kind ] = {};
29
31
  }
30
- acc[ entity.kind ][ entity.name ] = { context: createContext() };
32
+ acc[ loader.kind ][ loader.name ] = {
33
+ context: createContext( undefined ),
34
+ };
31
35
  return acc;
32
36
  }, {} ),
33
- ...kinds.reduce( ( acc, kind ) => {
34
- acc[ kind.name ] = {};
37
+ ...additionalEntityConfigLoaders.reduce( ( acc, loader ) => {
38
+ acc[ loader.kind ] = {};
35
39
  return acc;
36
40
  }, {} ),
37
41
  };
38
- const getEntity = ( kind, type ) => {
39
- if ( ! entities[ kind ] ) {
42
+ const getEntityContext = ( kind, name ) => {
43
+ if ( ! entityContexts[ kind ] ) {
40
44
  throw new Error( `Missing entity config for kind: ${ kind }.` );
41
45
  }
42
46
 
43
- if ( ! entities[ kind ][ type ] ) {
44
- entities[ kind ][ type ] = { context: createContext() };
47
+ if ( ! entityContexts[ kind ][ name ] ) {
48
+ entityContexts[ kind ][ name ] = {
49
+ context: createContext( undefined ),
50
+ };
45
51
  }
46
52
 
47
- return entities[ kind ][ type ];
53
+ return entityContexts[ kind ][ name ].context;
48
54
  };
49
55
 
50
56
  /**
51
57
  * Context provider component for providing
52
- * an entity for a specific entity type.
58
+ * an entity for a specific entity.
53
59
  *
54
60
  * @param {Object} props The component's props.
55
61
  * @param {string} props.kind The entity kind.
56
- * @param {string} props.type The entity type.
62
+ * @param {string} props.type The entity name.
57
63
  * @param {number} props.id The entity ID.
58
64
  * @param {*} props.children The children to wrap.
59
65
  *
60
66
  * @return {Object} The provided children, wrapped with
61
67
  * the entity's context provider.
62
68
  */
63
- export default function EntityProvider( { kind, type, id, children } ) {
64
- const Provider = getEntity( kind, type ).context.Provider;
69
+ export default function EntityProvider( { kind, type: name, id, children } ) {
70
+ const Provider = getEntityContext( kind, name ).Provider;
65
71
  return <Provider value={ id }>{ children }</Provider>;
66
72
  }
67
73
 
@@ -70,10 +76,10 @@ export default function EntityProvider( { kind, type, id, children } ) {
70
76
  * provided entity of the specified type.
71
77
  *
72
78
  * @param {string} kind The entity kind.
73
- * @param {string} type The entity type.
79
+ * @param {string} name The entity name.
74
80
  */
75
- export function useEntityId( kind, type ) {
76
- return useContext( getEntity( kind, type ).context );
81
+ export function useEntityId( kind, name ) {
82
+ return useContext( getEntityContext( kind, name ) );
77
83
  }
78
84
 
79
85
  /**
@@ -82,7 +88,7 @@ export function useEntityId( kind, type ) {
82
88
  * entity of the specified type.
83
89
  *
84
90
  * @param {string} kind The entity kind.
85
- * @param {string} type The entity type.
91
+ * @param {string} name The entity name.
86
92
  * @param {string} prop The property name.
87
93
  * @param {string} [_id] An entity ID to use instead of the context-provided one.
88
94
  *
@@ -93,8 +99,8 @@ export function useEntityId( kind, type ) {
93
99
  * information like `raw`, `rendered` and
94
100
  * `protected` props.
95
101
  */
96
- export function useEntityProp( kind, type, prop, _id ) {
97
- const providerId = useEntityId( kind, type );
102
+ export function useEntityProp( kind, name, prop, _id ) {
103
+ const providerId = useEntityId( kind, name );
98
104
  const id = _id ?? providerId;
99
105
 
100
106
  const { value, fullValue } = useSelect(
@@ -102,25 +108,25 @@ export function useEntityProp( kind, type, prop, _id ) {
102
108
  const { getEntityRecord, getEditedEntityRecord } = select(
103
109
  STORE_NAME
104
110
  );
105
- const entity = getEntityRecord( kind, type, id ); // Trigger resolver.
106
- const editedEntity = getEditedEntityRecord( kind, type, id );
107
- return entity && editedEntity
111
+ const record = getEntityRecord( kind, name, id ); // Trigger resolver.
112
+ const editedRecord = getEditedEntityRecord( kind, name, id );
113
+ return record && editedRecord
108
114
  ? {
109
- value: editedEntity[ prop ],
110
- fullValue: entity[ prop ],
115
+ value: editedRecord[ prop ],
116
+ fullValue: record[ prop ],
111
117
  }
112
118
  : {};
113
119
  },
114
- [ kind, type, id, prop ]
120
+ [ kind, name, id, prop ]
115
121
  );
116
122
  const { editEntityRecord } = useDispatch( STORE_NAME );
117
123
  const setValue = useCallback(
118
124
  ( newValue ) => {
119
- editEntityRecord( kind, type, id, {
125
+ editEntityRecord( kind, name, id, {
120
126
  [ prop ]: newValue,
121
127
  } );
122
128
  },
123
- [ kind, type, id, prop ]
129
+ [ kind, name, id, prop ]
124
130
  );
125
131
 
126
132
  return [ value, setValue, fullValue ];
@@ -138,25 +144,25 @@ export function useEntityProp( kind, type, prop, _id ) {
138
144
  * or similar components or hooks.
139
145
  *
140
146
  * @param {string} kind The entity kind.
141
- * @param {string} type The entity type.
147
+ * @param {string} name The entity name.
142
148
  * @param {Object} options
143
149
  * @param {string} [options.id] An entity ID to use instead of the context-provided one.
144
150
  *
145
151
  * @return {[WPBlock[], Function, Function]} The block array and setters.
146
152
  */
147
- export function useEntityBlockEditor( kind, type, { id: _id } = {} ) {
148
- const providerId = useEntityId( kind, type );
153
+ export function useEntityBlockEditor( kind, name, { id: _id } = {} ) {
154
+ const providerId = useEntityId( kind, name );
149
155
  const id = _id ?? providerId;
150
156
  const { content, blocks } = useSelect(
151
157
  ( select ) => {
152
158
  const { getEditedEntityRecord } = select( STORE_NAME );
153
- const editedEntity = getEditedEntityRecord( kind, type, id );
159
+ const editedRecord = getEditedEntityRecord( kind, name, id );
154
160
  return {
155
- blocks: editedEntity.blocks,
156
- content: editedEntity.content,
161
+ blocks: editedRecord.blocks,
162
+ content: editedRecord.content,
157
163
  };
158
164
  },
159
- [ kind, type, id ]
165
+ [ kind, name, id ]
160
166
  );
161
167
  const { __unstableCreateUndoLevel, editEntityRecord } = useDispatch(
162
168
  STORE_NAME
@@ -170,7 +176,7 @@ export function useEntityBlockEditor( kind, type, { id: _id } = {} ) {
170
176
  const parsedContent = parse( content );
171
177
  editEntityRecord(
172
178
  kind,
173
- type,
179
+ name,
174
180
  id,
175
181
  {
176
182
  blocks: parsedContent,
@@ -187,7 +193,7 @@ export function useEntityBlockEditor( kind, type, { id: _id } = {} ) {
187
193
 
188
194
  const noChange = blocks === edits.blocks;
189
195
  if ( noChange ) {
190
- return __unstableCreateUndoLevel( kind, type, id );
196
+ return __unstableCreateUndoLevel( kind, name, id );
191
197
  }
192
198
 
193
199
  // We create a new function here on every persistent edit
@@ -196,18 +202,18 @@ export function useEntityBlockEditor( kind, type, { id: _id } = {} ) {
196
202
  edits.content = ( { blocks: blocksForSerialization = [] } ) =>
197
203
  __unstableSerializeAndClean( blocksForSerialization );
198
204
 
199
- editEntityRecord( kind, type, id, edits );
205
+ editEntityRecord( kind, name, id, edits );
200
206
  },
201
- [ kind, type, id, blocks ]
207
+ [ kind, name, id, blocks ]
202
208
  );
203
209
 
204
210
  const onInput = useCallback(
205
211
  ( newBlocks, options ) => {
206
212
  const { selection } = options;
207
213
  const edits = { blocks: newBlocks, selection };
208
- editEntityRecord( kind, type, id, edits );
214
+ editEntityRecord( kind, name, id, edits );
209
215
  },
210
- [ kind, type, id ]
216
+ [ kind, name, id ]
211
217
  );
212
218
 
213
219
  return [ blocks ?? EMPTY_ARRAY, onInput, onChange ];
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import {
4
+ import type {
5
5
  Context,
6
6
  ContextualField,
7
7
  MediaType,
@@ -12,10 +12,10 @@ import {
12
12
  PingStatus,
13
13
  } from './helpers';
14
14
 
15
- import { BaseEntityTypes as _BaseEntityTypes } from './base-entity-types';
15
+ import type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';
16
16
 
17
- declare module './base-entity-types' {
18
- export namespace BaseEntityTypes {
17
+ declare module './base-entity-records' {
18
+ export namespace BaseEntityRecords {
19
19
  export interface Attachment< C extends Context > {
20
20
  /**
21
21
  * The date the post was published, in the site's timezone.
@@ -142,5 +142,5 @@ declare module './base-entity-types' {
142
142
  }
143
143
 
144
144
  export type Attachment< C extends Context > = OmitNevers<
145
- _BaseEntityTypes.Attachment< C >
145
+ _BaseEntityRecords.Attachment< C >
146
146
  >;
@@ -1,10 +1,10 @@
1
1
  /**
2
- * This module exists solely to make the BaseEntityTypes namespace extensible
2
+ * This module exists solely to make the BaseEntityRecords namespace extensible
3
3
  * with declaration merging:
4
4
  *
5
5
  * ```ts
6
- * declare module './base-entity-types' {
7
- * export namespace BaseEntityTypes {
6
+ * declare module './base-entity-records' {
7
+ * export namespace BaseEntityRecords {
8
8
  * export interface Comment< C extends Context > {
9
9
  * id: number;
10
10
  * // ...
@@ -19,7 +19,7 @@
19
19
  * ```ts
20
20
  * import type { Context } from '@wordpress/core-data';
21
21
  * declare module '@wordpress/core-data' {
22
- * export namespace BaseEntityTypes {
22
+ * export namespace BaseEntityRecords {
23
23
  * export interface Comment< C extends Context > {
24
24
  * numberOfViews: number;
25
25
  * }
@@ -33,4 +33,4 @@
33
33
  * // c.id is still present
34
34
  * ```
35
35
  */
36
- export namespace BaseEntityTypes {}
36
+ export namespace BaseEntityRecords {}
@@ -1,19 +1,19 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import {
4
+ import type {
5
5
  AvatarUrls,
6
6
  Context,
7
7
  ContextualField,
8
8
  OmitNevers,
9
9
  RenderedText,
10
10
  } from './helpers';
11
- import { BaseEntityTypes as _BaseEntityTypes } from './base-entity-types';
11
+ import type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';
12
12
 
13
13
  export type CommentStatus = 'hold' | 'approve' | 'spam' | 'trash' | '1' | '0';
14
14
 
15
- declare module './base-entity-types' {
16
- export namespace BaseEntityTypes {
15
+ declare module './base-entity-records' {
16
+ export namespace BaseEntityRecords {
17
17
  export interface Comment< C extends Context > {
18
18
  /**
19
19
  * Unique identifier for the comment.
@@ -92,5 +92,5 @@ declare module './base-entity-types' {
92
92
  }
93
93
 
94
94
  export type Comment< C extends Context > = OmitNevers<
95
- _BaseEntityTypes.Comment< C >
95
+ _BaseEntityRecords.Comment< C >
96
96
  >;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import { EntityRecord } from './index';
4
+ import type { EntityRecord } from './index';
5
5
 
6
6
  export interface AvatarUrls {
7
7
  /**
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
+ import type { Context, Updatable } from './helpers';
4
5
  import type { Attachment } from './attachment';
5
6
  import type { Comment } from './comment';
6
7
  import type { MenuLocation } from './menu-location';
@@ -20,15 +21,13 @@ import type { Widget } from './widget';
20
21
  import type { WidgetType } from './widget-type';
21
22
  import type { WpTemplate } from './wp-template';
22
23
  import type { WpTemplatePart } from './wp-template-part';
23
- import type { Context, Updatable } from './helpers';
24
24
 
25
- export type { BaseEntityTypes } from './base-entity-types';
25
+ export type { BaseEntityRecords } from './base-entity-records';
26
26
 
27
27
  export type {
28
- Context,
29
- Updatable,
30
28
  Attachment,
31
29
  Comment,
30
+ Context,
32
31
  MenuLocation,
33
32
  NavMenu,
34
33
  NavMenuItem,
@@ -40,6 +39,7 @@ export type {
40
39
  Sidebar,
41
40
  Taxonomy,
42
41
  Theme,
42
+ Updatable,
43
43
  User,
44
44
  Type,
45
45
  Widget,
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import { Context, OmitNevers } from './helpers';
4
+ import type { Context, OmitNevers } from './helpers';
5
5
 
6
- import { BaseEntityTypes as _BaseEntityTypes } from './base-entity-types';
6
+ import type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';
7
7
 
8
- declare module './base-entity-types' {
9
- export namespace BaseEntityTypes {
8
+ declare module './base-entity-records' {
9
+ export namespace BaseEntityRecords {
10
10
  export interface MenuLocation< C extends Context > {
11
11
  /**
12
12
  * The name of the menu location.
@@ -25,5 +25,5 @@ declare module './base-entity-types' {
25
25
  }
26
26
 
27
27
  export type MenuLocation< C extends Context > = OmitNevers<
28
- _BaseEntityTypes.MenuLocation< C >
28
+ _BaseEntityRecords.MenuLocation< C >
29
29
  >;
@@ -1,9 +1,14 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import { RenderedText, Context, ContextualField, OmitNevers } from './helpers';
4
+ import type {
5
+ RenderedText,
6
+ Context,
7
+ ContextualField,
8
+ OmitNevers,
9
+ } from './helpers';
5
10
 
6
- import { BaseEntityTypes as _BaseEntityTypes } from './base-entity-types';
11
+ import type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';
7
12
 
8
13
  export type NavMenuItemType =
9
14
  | 'taxonomy'
@@ -18,8 +23,8 @@ export type NavMenuItemStatus =
18
23
  | 'private';
19
24
  export type Target = '_blank' | '';
20
25
 
21
- declare module './base-entity-types' {
22
- export namespace BaseEntityTypes {
26
+ declare module './base-entity-records' {
27
+ export namespace BaseEntityRecords {
23
28
  export interface NavMenuItem< C extends Context > {
24
29
  /**
25
30
  * The title for the object.
@@ -102,5 +107,5 @@ declare module './base-entity-types' {
102
107
  }
103
108
 
104
109
  export type NavMenuItem< C extends Context > = OmitNevers<
105
- _BaseEntityTypes.NavMenuItem< C >
110
+ _BaseEntityRecords.NavMenuItem< C >
106
111
  >;
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import { Context, ContextualField, OmitNevers } from './helpers';
4
+ import type { Context, ContextualField, OmitNevers } from './helpers';
5
5
 
6
- import { BaseEntityTypes as _BaseEntityTypes } from './base-entity-types';
6
+ import type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';
7
7
 
8
- declare module './base-entity-types' {
9
- export namespace BaseEntityTypes {
8
+ declare module './base-entity-records' {
9
+ export namespace BaseEntityRecords {
10
10
  export interface NavMenu< C extends Context > {
11
11
  /**
12
12
  * Unique identifier for the term.
@@ -49,5 +49,5 @@ declare module './base-entity-types' {
49
49
  }
50
50
 
51
51
  export type NavMenu< C extends Context > = OmitNevers<
52
- _BaseEntityTypes.NavMenu< C >
52
+ _BaseEntityRecords.NavMenu< C >
53
53
  >;
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import { Context, OmitNevers } from './helpers';
4
+ import type { Context, OmitNevers } from './helpers';
5
5
 
6
- import { BaseEntityTypes as _BaseEntityTypes } from './base-entity-types';
6
+ import type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';
7
7
 
8
- declare module './base-entity-types' {
9
- export namespace BaseEntityTypes {
8
+ declare module './base-entity-records' {
9
+ export namespace BaseEntityRecords {
10
10
  export interface NavigationArea< C extends Context > {
11
11
  /**
12
12
  * The name of the navigation area.
@@ -25,5 +25,5 @@ declare module './base-entity-types' {
25
25
  }
26
26
 
27
27
  export type NavigationArea< C extends Context > = OmitNevers<
28
- _BaseEntityTypes.NavigationArea< C >
28
+ _BaseEntityRecords.NavigationArea< C >
29
29
  >;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import {
4
+ import type {
5
5
  CommentingStatus,
6
6
  Context,
7
7
  ContextualField,
@@ -11,10 +11,10 @@ import {
11
11
  OmitNevers,
12
12
  } from './helpers';
13
13
 
14
- import { BaseEntityTypes as _BaseEntityTypes } from './base-entity-types';
14
+ import type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';
15
15
 
16
- declare module './base-entity-types' {
17
- export namespace BaseEntityTypes {
16
+ declare module './base-entity-records' {
17
+ export namespace BaseEntityRecords {
18
18
  export interface Page< C extends Context > {
19
19
  /**
20
20
  * The date the post was published, in the site's timezone.
@@ -140,5 +140,5 @@ declare module './base-entity-types' {
140
140
  }
141
141
 
142
142
  export type Page< C extends Context > = OmitNevers<
143
- _BaseEntityTypes.Page< C >
143
+ _BaseEntityRecords.Page< C >
144
144
  >;
@@ -1,12 +1,17 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import { Context, ContextualField, RenderedText, OmitNevers } from './helpers';
4
+ import type {
5
+ Context,
6
+ ContextualField,
7
+ RenderedText,
8
+ OmitNevers,
9
+ } from './helpers';
5
10
 
6
- import { BaseEntityTypes as _BaseEntityTypes } from './base-entity-types';
11
+ import type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';
7
12
 
8
- declare module './base-entity-types' {
9
- export namespace BaseEntityTypes {
13
+ declare module './base-entity-records' {
14
+ export namespace BaseEntityRecords {
10
15
  export interface Plugin< C extends Context > {
11
16
  /**
12
17
  * The plugin file.
@@ -70,5 +75,5 @@ declare module './base-entity-types' {
70
75
 
71
76
  export type PluginStatus = 'active' | 'inactive';
72
77
  export type Plugin< C extends Context > = OmitNevers<
73
- _BaseEntityTypes.Plugin< C >
78
+ _BaseEntityRecords.Plugin< C >
74
79
  >;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import {
4
+ import type {
5
5
  CommentingStatus,
6
6
  Context,
7
7
  ContextualField,
@@ -12,10 +12,10 @@ import {
12
12
  OmitNevers,
13
13
  } from './helpers';
14
14
 
15
- import { BaseEntityTypes as _BaseEntityTypes } from './base-entity-types';
15
+ import type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';
16
16
 
17
- declare module './base-entity-types' {
18
- export namespace BaseEntityTypes {
17
+ declare module './base-entity-records' {
18
+ export namespace BaseEntityRecords {
19
19
  export interface Post< C extends Context > {
20
20
  /**
21
21
  * The date the post was published, in the site's timezone.
@@ -149,5 +149,5 @@ declare module './base-entity-types' {
149
149
  }
150
150
 
151
151
  export type Post< C extends Context > = OmitNevers<
152
- _BaseEntityTypes.Post< C >
152
+ _BaseEntityRecords.Post< C >
153
153
  >;
@@ -1,12 +1,17 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import { CommentingStatus, Context, OmitNevers, PingStatus } from './helpers';
4
+ import type {
5
+ CommentingStatus,
6
+ Context,
7
+ OmitNevers,
8
+ PingStatus,
9
+ } from './helpers';
5
10
 
6
- import { BaseEntityTypes as _BaseEntityTypes } from './base-entity-types';
11
+ import type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';
7
12
 
8
- declare module './base-entity-types' {
9
- export namespace BaseEntityTypes {
13
+ declare module './base-entity-records' {
14
+ export namespace BaseEntityRecords {
10
15
  export interface Settings< C extends Context > {
11
16
  /**
12
17
  * What to show on the front page
@@ -89,5 +94,5 @@ declare module './base-entity-types' {
89
94
  }
90
95
 
91
96
  export type Settings< C extends Context > = OmitNevers<
92
- _BaseEntityTypes.Settings< C >
97
+ _BaseEntityRecords.Settings< C >
93
98
  >;
@@ -1,13 +1,12 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import { Widget } from './widget';
5
- import { Context, OmitNevers } from './helpers';
4
+ import type { Context, OmitNevers } from './helpers';
6
5
 
7
- import { BaseEntityTypes as _BaseEntityTypes } from './base-entity-types';
6
+ import type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';
8
7
 
9
- declare module './base-entity-types' {
10
- export namespace BaseEntityTypes {
8
+ declare module './base-entity-records' {
9
+ export namespace BaseEntityRecords {
11
10
  export interface Sidebar< C extends Context > {
12
11
  /**
13
12
  * ID of sidebar.
@@ -48,7 +47,7 @@ declare module './base-entity-types' {
48
47
  /**
49
48
  * Nested widgets.
50
49
  */
51
- widgets: ( Widget< C > | string )[];
50
+ widgets: ( BaseEntityRecords.Widget< C > | string )[];
52
51
  }
53
52
  }
54
53
  }
@@ -56,5 +55,5 @@ declare module './base-entity-types' {
56
55
  type SidebarStatus = 'active' | 'inactive';
57
56
 
58
57
  export type Sidebar< C extends Context > = OmitNevers<
59
- _BaseEntityTypes.Sidebar< C >
58
+ _BaseEntityRecords.Sidebar< C >
60
59
  >;
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import { Context, ContextualField, OmitNevers } from './helpers';
4
+ import type { Context, ContextualField, OmitNevers } from './helpers';
5
5
 
6
- import { BaseEntityTypes as _BaseEntityTypes } from './base-entity-types';
6
+ import type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';
7
7
 
8
- declare module './base-entity-types' {
9
- export namespace BaseEntityTypes {
8
+ declare module './base-entity-records' {
9
+ export namespace BaseEntityRecords {
10
10
  export interface Taxonomy< C extends Context > {
11
11
  /**
12
12
  * All capabilities used by the taxonomy.
@@ -88,5 +88,5 @@ declare module './base-entity-types' {
88
88
  }
89
89
 
90
90
  export type Taxonomy< C extends Context > = OmitNevers<
91
- _BaseEntityTypes.Taxonomy< C >
91
+ _BaseEntityRecords.Taxonomy< C >
92
92
  >;
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import { Context, PostFormat, RenderedText, OmitNevers } from './helpers';
4
+ import type { Context, PostFormat, RenderedText, OmitNevers } from './helpers';
5
5
 
6
- import { BaseEntityTypes as _BaseEntityTypes } from './base-entity-types';
6
+ import type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';
7
7
 
8
- declare module './base-entity-types' {
9
- export namespace BaseEntityTypes {
8
+ declare module './base-entity-records' {
9
+ export namespace BaseEntityRecords {
10
10
  export interface Theme< C extends Context > {
11
11
  /**
12
12
  * The theme's stylesheet. This uniquely identifies the theme.
@@ -218,5 +218,5 @@ declare module './base-entity-types' {
218
218
  }
219
219
 
220
220
  export type Theme< C extends Context > = OmitNevers<
221
- _BaseEntityTypes.Theme< C >
221
+ _BaseEntityRecords.Theme< C >
222
222
  >;