@wordpress/core-data 4.13.0 → 5.0.1-next.957ca95e4c.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.
Files changed (201) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +148 -65
  3. package/build/entities.js +38 -51
  4. package/build/entities.js.map +1 -1
  5. package/build/hooks/index.js +14 -0
  6. package/build/hooks/index.js.map +1 -1
  7. package/build/hooks/use-entity-record.js +10 -6
  8. package/build/hooks/use-entity-record.js.map +1 -1
  9. package/build/hooks/use-entity-records.js +2 -0
  10. package/build/hooks/use-entity-records.js.map +1 -1
  11. package/build/hooks/use-query-select.js +5 -2
  12. package/build/hooks/use-query-select.js.map +1 -1
  13. package/build/hooks/use-resource-permissions.js +74 -11
  14. package/build/hooks/use-resource-permissions.js.map +1 -1
  15. package/build/index.js +1 -30
  16. package/build/index.js.map +1 -1
  17. package/build/resolvers.js +17 -21
  18. package/build/resolvers.js.map +1 -1
  19. package/build/selectors.js +9 -46
  20. package/build/selectors.js.map +1 -1
  21. package/build-module/entities.js +38 -52
  22. package/build-module/entities.js.map +1 -1
  23. package/build-module/hooks/index.js +1 -0
  24. package/build-module/hooks/index.js.map +1 -1
  25. package/build-module/hooks/use-entity-record.js +10 -6
  26. package/build-module/hooks/use-entity-record.js.map +1 -1
  27. package/build-module/hooks/use-entity-records.js +2 -0
  28. package/build-module/hooks/use-entity-records.js.map +1 -1
  29. package/build-module/hooks/use-query-select.js +4 -1
  30. package/build-module/hooks/use-query-select.js.map +1 -1
  31. package/build-module/hooks/use-resource-permissions.js +70 -10
  32. package/build-module/hooks/use-resource-permissions.js.map +1 -1
  33. package/build-module/index.js +0 -5
  34. package/build-module/index.js.map +1 -1
  35. package/build-module/resolvers.js +17 -21
  36. package/build-module/resolvers.js.map +1 -1
  37. package/build-module/selectors.js +7 -44
  38. package/build-module/selectors.js.map +1 -1
  39. package/build-types/actions.d.ts +188 -0
  40. package/build-types/actions.d.ts.map +1 -0
  41. package/build-types/batch/create-batch.d.ts +71 -0
  42. package/build-types/batch/create-batch.d.ts.map +1 -0
  43. package/build-types/batch/default-processor.d.ts +11 -0
  44. package/build-types/batch/default-processor.d.ts.map +1 -0
  45. package/build-types/batch/index.d.ts +3 -0
  46. package/build-types/batch/index.d.ts.map +1 -0
  47. package/build-types/entities.d.ts +128 -0
  48. package/build-types/entities.d.ts.map +1 -0
  49. package/build-types/entity-provider.d.ts +68 -0
  50. package/build-types/entity-provider.d.ts.map +1 -0
  51. package/build-types/entity-types/attachment.d.ts +121 -0
  52. package/build-types/entity-types/attachment.d.ts.map +1 -0
  53. package/build-types/entity-types/base-entity-records.d.ts +37 -0
  54. package/build-types/entity-types/base-entity-records.d.ts.map +1 -0
  55. package/build-types/entity-types/comment.d.ts +82 -0
  56. package/build-types/entity-types/comment.d.ts.map +1 -0
  57. package/build-types/entity-types/helpers.d.ts +123 -0
  58. package/build-types/entity-types/helpers.d.ts.map +1 -0
  59. package/build-types/entity-types/index.d.ts +64 -0
  60. package/build-types/entity-types/index.d.ts.map +1 -0
  61. package/build-types/entity-types/menu-location.d.ts +25 -0
  62. package/build-types/entity-types/menu-location.d.ts.map +1 -0
  63. package/build-types/entity-types/nav-menu-item.d.ts +88 -0
  64. package/build-types/entity-types/nav-menu-item.d.ts.map +1 -0
  65. package/build-types/entity-types/nav-menu.d.ts +45 -0
  66. package/build-types/entity-types/nav-menu.d.ts.map +1 -0
  67. package/build-types/entity-types/page.d.ts +120 -0
  68. package/build-types/entity-types/page.d.ts.map +1 -0
  69. package/build-types/entity-types/plugin.d.ts +62 -0
  70. package/build-types/entity-types/plugin.d.ts.map +1 -0
  71. package/build-types/entity-types/post.d.ts +128 -0
  72. package/build-types/entity-types/post.d.ts.map +1 -0
  73. package/build-types/entity-types/settings.d.ts +89 -0
  74. package/build-types/entity-types/settings.d.ts.map +1 -0
  75. package/build-types/entity-types/sidebar.d.ts +55 -0
  76. package/build-types/entity-types/sidebar.d.ts.map +1 -0
  77. package/build-types/entity-types/taxonomy.d.ts +83 -0
  78. package/build-types/entity-types/taxonomy.d.ts.map +1 -0
  79. package/build-types/entity-types/theme.d.ts +206 -0
  80. package/build-types/entity-types/theme.d.ts.map +1 -0
  81. package/build-types/entity-types/type.d.ts +71 -0
  82. package/build-types/entity-types/type.d.ts.map +1 -0
  83. package/build-types/entity-types/user.d.ts +93 -0
  84. package/build-types/entity-types/user.d.ts.map +1 -0
  85. package/build-types/entity-types/widget-type.d.ts +33 -0
  86. package/build-types/entity-types/widget-type.d.ts.map +1 -0
  87. package/build-types/entity-types/widget.d.ts +59 -0
  88. package/build-types/entity-types/widget.d.ts.map +1 -0
  89. package/build-types/entity-types/wp-template-part.d.ts +80 -0
  90. package/build-types/entity-types/wp-template-part.d.ts.map +1 -0
  91. package/build-types/entity-types/wp-template.d.ts +80 -0
  92. package/build-types/entity-types/wp-template.d.ts.map +1 -0
  93. package/build-types/fetch/__experimental-fetch-link-suggestions.d.ts +139 -0
  94. package/build-types/fetch/__experimental-fetch-link-suggestions.d.ts.map +1 -0
  95. package/build-types/fetch/__experimental-fetch-url-data.d.ts +35 -0
  96. package/build-types/fetch/__experimental-fetch-url-data.d.ts.map +1 -0
  97. package/build-types/fetch/index.d.ts +3 -0
  98. package/build-types/fetch/index.d.ts.map +1 -0
  99. package/build-types/hooks/constants.d.ts +7 -0
  100. package/build-types/hooks/constants.d.ts.map +1 -0
  101. package/build-types/hooks/index.d.ts +4 -0
  102. package/build-types/hooks/index.d.ts.map +1 -0
  103. package/build-types/hooks/memoize.d.ts +3 -0
  104. package/build-types/hooks/memoize.d.ts.map +1 -0
  105. package/build-types/hooks/use-entity-record.d.ts +124 -0
  106. package/build-types/hooks/use-entity-record.d.ts.map +1 -0
  107. package/build-types/hooks/use-entity-records.d.ts +49 -0
  108. package/build-types/hooks/use-entity-records.d.ts.map +1 -0
  109. package/build-types/hooks/use-query-select.d.ts +46 -0
  110. package/build-types/hooks/use-query-select.d.ts.map +1 -0
  111. package/build-types/hooks/use-resource-permissions.d.ts +99 -0
  112. package/build-types/hooks/use-resource-permissions.d.ts.map +1 -0
  113. package/build-types/index.d.ts +131 -0
  114. package/build-types/index.d.ts.map +1 -0
  115. package/build-types/locks/actions.d.ts +7 -0
  116. package/build-types/locks/actions.d.ts.map +1 -0
  117. package/build-types/locks/engine.d.ts +5 -0
  118. package/build-types/locks/engine.d.ts.map +1 -0
  119. package/build-types/locks/reducer.d.ts +10 -0
  120. package/build-types/locks/reducer.d.ts.map +1 -0
  121. package/build-types/locks/selectors.d.ts +5 -0
  122. package/build-types/locks/selectors.d.ts.map +1 -0
  123. package/build-types/locks/utils.d.ts +8 -0
  124. package/build-types/locks/utils.d.ts.map +1 -0
  125. package/build-types/name.d.ts +8 -0
  126. package/build-types/name.d.ts.map +1 -0
  127. package/build-types/queried-data/actions.d.ts +32 -0
  128. package/build-types/queried-data/actions.d.ts.map +1 -0
  129. package/build-types/queried-data/get-query-parts.d.ts +60 -0
  130. package/build-types/queried-data/get-query-parts.d.ts.map +1 -0
  131. package/build-types/queried-data/index.d.ts +4 -0
  132. package/build-types/queried-data/index.d.ts.map +1 -0
  133. package/build-types/queried-data/reducer.d.ts +54 -0
  134. package/build-types/queried-data/reducer.d.ts.map +1 -0
  135. package/build-types/queried-data/selectors.d.ts +16 -0
  136. package/build-types/queried-data/selectors.d.ts.map +1 -0
  137. package/build-types/reducer.d.ts +156 -0
  138. package/build-types/reducer.d.ts.map +1 -0
  139. package/build-types/resolvers.d.ts +74 -0
  140. package/build-types/resolvers.d.ts.map +1 -0
  141. package/build-types/selectors.d.ts +524 -0
  142. package/build-types/selectors.d.ts.map +1 -0
  143. package/build-types/types.d.ts +4 -0
  144. package/build-types/types.d.ts.map +1 -0
  145. package/build-types/utils/conservative-map-item.d.ts +12 -0
  146. package/build-types/utils/conservative-map-item.d.ts.map +1 -0
  147. package/build-types/utils/forward-resolver.d.ts +10 -0
  148. package/build-types/utils/forward-resolver.d.ts.map +1 -0
  149. package/build-types/utils/get-normalized-comma-separable.d.ts +12 -0
  150. package/build-types/utils/get-normalized-comma-separable.d.ts.map +1 -0
  151. package/build-types/utils/if-matching-action.d.ts +14 -0
  152. package/build-types/utils/if-matching-action.d.ts.map +1 -0
  153. package/build-types/utils/index.d.ts +9 -0
  154. package/build-types/utils/index.d.ts.map +1 -0
  155. package/build-types/utils/is-raw-attribute.d.ts +10 -0
  156. package/build-types/utils/is-raw-attribute.d.ts.map +1 -0
  157. package/build-types/utils/on-sub-key.d.ts +4 -0
  158. package/build-types/utils/on-sub-key.d.ts.map +1 -0
  159. package/build-types/utils/replace-action.d.ts +13 -0
  160. package/build-types/utils/replace-action.d.ts.map +1 -0
  161. package/build-types/utils/with-weak-map-cache.d.ts +12 -0
  162. package/build-types/utils/with-weak-map-cache.d.ts.map +1 -0
  163. package/package.json +13 -11
  164. package/src/entities.js +325 -0
  165. package/src/entity-types/attachment.ts +3 -4
  166. package/src/entity-types/comment.ts +3 -4
  167. package/src/entity-types/index.ts +31 -88
  168. package/src/entity-types/menu-location.ts +3 -4
  169. package/src/entity-types/nav-menu-item.ts +3 -4
  170. package/src/entity-types/nav-menu.ts +3 -3
  171. package/src/entity-types/page.ts +3 -3
  172. package/src/entity-types/plugin.ts +3 -3
  173. package/src/entity-types/post.ts +3 -3
  174. package/src/entity-types/settings.ts +3 -3
  175. package/src/entity-types/sidebar.ts +3 -4
  176. package/src/entity-types/taxonomy.ts +3 -4
  177. package/src/entity-types/theme.ts +7 -3
  178. package/src/entity-types/type.ts +3 -3
  179. package/src/entity-types/user.ts +3 -3
  180. package/src/entity-types/widget-type.ts +3 -4
  181. package/src/entity-types/widget.ts +3 -3
  182. package/src/entity-types/wp-template-part.ts +3 -4
  183. package/src/entity-types/wp-template.ts +3 -4
  184. package/src/hooks/index.ts +4 -0
  185. package/src/hooks/test/use-entity-record.js +41 -1
  186. package/src/hooks/test/use-resource-permissions.js +32 -36
  187. package/src/hooks/use-entity-record.ts +18 -6
  188. package/src/hooks/use-entity-records.ts +2 -0
  189. package/src/hooks/use-query-select.ts +4 -1
  190. package/src/hooks/use-resource-permissions.ts +84 -20
  191. package/src/index.js +0 -5
  192. package/src/resolvers.js +36 -24
  193. package/src/selectors.ts +202 -341
  194. package/tsconfig.json +21 -0
  195. package/tsconfig.tsbuildinfo +1 -0
  196. package/build/entity-types/entities.js +0 -6
  197. package/build/entity-types/entities.js.map +0 -1
  198. package/build-module/entity-types/entities.js +0 -2
  199. package/build-module/entity-types/entities.js.map +0 -1
  200. package/src/entities.ts +0 -548
  201. package/src/entity-types/entities.ts +0 -130
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { AvatarUrls, Context, ContextualField, OmitNevers, RenderedText } from './helpers';
5
+ import type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';
6
+ export declare type CommentStatus = 'hold' | 'approve' | 'spam' | 'trash' | '1' | '0';
7
+ declare module './base-entity-records' {
8
+ namespace BaseEntityRecords {
9
+ interface Comment<C extends Context> {
10
+ /**
11
+ * Unique identifier for the comment.
12
+ */
13
+ id: number;
14
+ /**
15
+ * The ID of the user object, if author was a user.
16
+ */
17
+ author: number;
18
+ /**
19
+ * Email address for the comment author.
20
+ */
21
+ author_email: ContextualField<string, 'edit', C>;
22
+ /**
23
+ * IP address for the comment author.
24
+ */
25
+ author_ip: ContextualField<string, 'edit', C>;
26
+ /**
27
+ * Display name for the comment author.
28
+ */
29
+ author_name: string;
30
+ /**
31
+ * URL for the comment author.
32
+ */
33
+ author_url: string;
34
+ /**
35
+ * User agent for the comment author.
36
+ */
37
+ author_user_agent: ContextualField<string, 'edit', C>;
38
+ /**
39
+ * The content for the comment.
40
+ */
41
+ content: RenderedText<C>;
42
+ /**
43
+ * The date the comment was published, in the site's timezone.
44
+ */
45
+ date: string;
46
+ /**
47
+ * The date the comment was published, as GMT.
48
+ */
49
+ date_gmt: ContextualField<string, 'view' | 'edit', C>;
50
+ /**
51
+ * URL to the comment.
52
+ */
53
+ link: string;
54
+ /**
55
+ * The ID for the parent of the comment.
56
+ */
57
+ parent: number;
58
+ /**
59
+ * The ID of the associated post object.
60
+ */
61
+ post: ContextualField<number, 'view' | 'edit', C>;
62
+ /**
63
+ * State of the comment.
64
+ */
65
+ status: ContextualField<CommentStatus, 'view' | 'edit', C>;
66
+ /**
67
+ * Type of the comment.
68
+ */
69
+ type: string;
70
+ /**
71
+ * Avatar URLs for the comment author.
72
+ */
73
+ author_avatar_urls: AvatarUrls;
74
+ /**
75
+ * Meta fields.
76
+ */
77
+ meta: ContextualField<Record<string, string>, 'view' | 'edit', C>;
78
+ }
79
+ }
80
+ }
81
+ export declare type Comment<C extends Context = 'edit'> = OmitNevers<_BaseEntityRecords.Comment<C>>;
82
+ //# sourceMappingURL=comment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comment.d.ts","sourceRoot":"","sources":["../../src/entity-types/comment.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EACX,UAAU,EACV,OAAO,EACP,eAAe,EACf,UAAU,EACV,YAAY,EACZ,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,iBAAiB,IAAI,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAErF,oBAAY,aAAa,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,GAAG,GAAG,GAAG,CAAC;AAE9E,OAAO,QAAQ,uBAAuB,CAAC;IACtC,UAAiB,iBAAiB,CAAC;QAClC,UAAiB,OAAO,CAAE,CAAC,SAAS,OAAO;YAC1C;;eAEG;YACH,EAAE,EAAE,MAAM,CAAC;YACX;;eAEG;YACH,MAAM,EAAE,MAAM,CAAC;YACf;;eAEG;YACH,YAAY,EAAE,eAAe,CAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAE,CAAC;YACnD;;eAEG;YACH,SAAS,EAAE,eAAe,CAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAE,CAAC;YAChD;;eAEG;YACH,WAAW,EAAE,MAAM,CAAC;YACpB;;eAEG;YACH,UAAU,EAAE,MAAM,CAAC;YACnB;;eAEG;YACH,iBAAiB,EAAE,eAAe,CAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAE,CAAC;YACxD;;eAEG;YACH,OAAO,EAAE,YAAY,CAAE,CAAC,CAAE,CAAC;YAC3B;;eAEG;YACH,IAAI,EAAE,MAAM,CAAC;YACb;;eAEG;YACH,QAAQ,EAAE,eAAe,CAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAE,CAAC;YACxD;;eAEG;YACH,IAAI,EAAE,MAAM,CAAC;YACb;;eAEG;YACH,MAAM,EAAE,MAAM,CAAC;YACf;;eAEG;YACH,IAAI,EAAE,eAAe,CAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAE,CAAC;YACpD;;eAEG;YACH,MAAM,EAAE,eAAe,CAAE,aAAa,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAE,CAAC;YAC7D;;eAEG;YACH,IAAI,EAAE,MAAM,CAAC;YACb;;eAEG;YACH,kBAAkB,EAAE,UAAU,CAAC;YAC/B;;eAEG;YACH,IAAI,EAAE,eAAe,CACpB,MAAM,CAAE,MAAM,EAAE,MAAM,CAAE,EACxB,MAAM,GAAG,MAAM,EACf,CAAC,CACD,CAAC;SACF;KACD;CACD;AAED,oBAAY,OAAO,CAAE,CAAC,SAAS,OAAO,GAAG,MAAM,IAAK,UAAU,CAC7D,kBAAkB,CAAC,OAAO,CAAE,CAAC,CAAE,CAC/B,CAAC"}
@@ -0,0 +1,123 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { EntityRecord } from './index';
5
+ export interface AvatarUrls {
6
+ /**
7
+ * Avatar URL with image size of 24 pixels.
8
+ */
9
+ '24': string;
10
+ /**
11
+ * Avatar URL with image size of 48 pixels.
12
+ */
13
+ '48': string;
14
+ /**
15
+ * Avatar URL with image size of 96 pixels.
16
+ */
17
+ '96': string;
18
+ }
19
+ export declare type MediaType = 'image' | 'file';
20
+ export declare type CommentingStatus = 'open' | 'closed';
21
+ export declare type PingStatus = 'open' | 'closed';
22
+ export declare type PostStatus = 'publish' | 'future' | 'draft' | 'pending' | 'private';
23
+ export declare type PostFormat = 'standard' | 'aside' | 'chat' | 'gallery' | 'link' | 'image' | 'quote' | 'status' | 'video' | 'audio';
24
+ /**
25
+ * The REST API context parameter.
26
+ */
27
+ export declare type Context = 'view' | 'edit' | 'embed';
28
+ /**
29
+ * ContextualField makes the field available only in the specified given contexts,
30
+ * and ensure the field is absent from the object when in a different context.
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * interface Post< C extends Context > {
35
+ * …
36
+ * modified: ContextualField< string, 'edit' | 'view', C >;
37
+ * password: ContextualField< string, 'edit', C >;
38
+ * …
39
+ * }
40
+ *
41
+ * const post: Post<'edit'> = …
42
+ * // post.modified exists as a string
43
+ * // post.password exists as a string
44
+ *
45
+ * const post: Post<'view'> = …
46
+ * // post.modified still exists as a string
47
+ * // post.password is missing, undefined, because we're not in the `edit` context.
48
+ * ```
49
+ */
50
+ export declare type ContextualField<FieldType, AvailableInContexts extends Context, C extends Context> = AvailableInContexts extends C ? FieldType : never;
51
+ /**
52
+ * Removes all the properties of type never, even the deeply nested ones.
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * type MyType = {
57
+ * foo: string;
58
+ * bar: never;
59
+ * nested: {
60
+ * foo: string;
61
+ * bar: never;
62
+ * }
63
+ * }
64
+ * const x = {} as OmitNevers<MyType>;
65
+ * // x is of type { foo: string; nested: { foo: string; }}
66
+ * // The `never` properties were removed entirely
67
+ * ```
68
+ */
69
+ export declare type OmitNevers<T, Nevers = {
70
+ [K in keyof T]: Exclude<T[K], undefined> extends never ? never : T[K] extends Record<string, unknown> ? OmitNevers<T[K]> : T[K];
71
+ }> = Pick<Nevers, {
72
+ [K in keyof Nevers]: Nevers[K] extends never ? never : K;
73
+ }[keyof Nevers]>;
74
+ /**
75
+ * A string that the server renders which often involves
76
+ * modifications from the raw source string.
77
+ *
78
+ * For example, block HTML with the comment delimiters exists
79
+ * in `post_content` but those comments are stripped out when
80
+ * rendering to a page view. Similarly, plugins might modify
81
+ * content or replace shortcodes.
82
+ */
83
+ export interface RenderedText<C extends Context> {
84
+ /**
85
+ * The source string which will be rendered on page views.
86
+ */
87
+ raw: ContextualField<string, 'edit', C>;
88
+ /**
89
+ * The output of the raw source after processing and filtering on the server.
90
+ */
91
+ rendered: string;
92
+ }
93
+ /**
94
+ * Updatable<EntityRecord> is a type describing Edited Entity Records. They are like
95
+ * regular Entity Records, but they have all the local edits applied on top of the REST API data.
96
+ *
97
+ * This turns certain field from an object into a string.
98
+ *
99
+ * Entities like Post have fields that only be rendered on the server, like title, excerpt,
100
+ * and content. The REST API exposes both the raw markup and the rendered version of those fields.
101
+ * For example, in the block editor, content.rendered could used as a visual preview, and
102
+ * content.raw could be used to populate the code editor.
103
+ *
104
+ * When updating these rendered fields, Javascript is not be able to properly render arbitrary block
105
+ * markup. Therefore, it stores only the raw markup without the rendered part. And since that's a string,
106
+ * the entire field becomes a string.
107
+ *
108
+ * @example
109
+ * ```ts
110
+ * type Post< C extends Context > {
111
+ * title: RenderedText< C >;
112
+ * }
113
+ * const post = {} as Post;
114
+ * // post.title is an object with raw and rendered properties
115
+ *
116
+ * const updatablePost = {} as Updatable< Post >;
117
+ * // updatablePost.title is a string
118
+ * ```
119
+ */
120
+ export declare type Updatable<T extends EntityRecord<'edit'>> = {
121
+ [K in keyof T]: T[K] extends RenderedText<any> ? string : T[K];
122
+ };
123
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/entity-types/helpers.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,WAAW,UAAU;IAC1B;;OAEG;IACH,IAAI,EAAE,MAA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AEF;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY,CAAE,CAAC,SAAS,OAAO;IAC/C;;OAEG;IACH,GAAG,EAAE,eAAe,CAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAE,CAAC;IAC1C;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,oBAAY,SAAS,CAAE,CAAC,SAAS,YAAY,CAAE,MAAM,CAAE,IAAK;KACzD,CAAC,IAAI,MAAM,CAAC,GAAI,CAAC,CAAE,CAAC,CAAE,SAAS,YAAY,CAAE,GAAG,CAAE,GAAG,MAAM,GAAG,CAAC,CAAE,CAAC,CAAE;CACtE,CAAC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { Context, Updatable } from './helpers';
5
+ import type { Attachment } from './attachment';
6
+ import type { Comment } from './comment';
7
+ import type { MenuLocation } from './menu-location';
8
+ import type { NavMenu } from './nav-menu';
9
+ import type { NavMenuItem } from './nav-menu-item';
10
+ import type { Page } from './page';
11
+ import type { Plugin } from './plugin';
12
+ import type { Post } from './post';
13
+ import type { Settings } from './settings';
14
+ import type { Sidebar } from './sidebar';
15
+ import type { Taxonomy } from './taxonomy';
16
+ import type { Theme } from './theme';
17
+ import type { User } from './user';
18
+ import type { Type } from './type';
19
+ import type { Widget } from './widget';
20
+ import type { WidgetType } from './widget-type';
21
+ import type { WpTemplate } from './wp-template';
22
+ import type { WpTemplatePart } from './wp-template-part';
23
+ export type { BaseEntityRecords } from './base-entity-records';
24
+ export type { Attachment, Comment, Context, MenuLocation, NavMenu, NavMenuItem, Page, Plugin, Post, Settings, Sidebar, Taxonomy, Theme, Updatable, User, Type, Widget, WidgetType, WpTemplate, WpTemplatePart, };
25
+ /**
26
+ * An interface that may be extended to add types for new entities. Each entry
27
+ * must be a union of entity definitions adhering to the EntityInterface type.
28
+ *
29
+ * Example:
30
+ *
31
+ * ```ts
32
+ * import type { Context } from '@wordpress/core-data';
33
+ * // ...
34
+ *
35
+ * interface Client {
36
+ * id: number;
37
+ * name: string;
38
+ * // ...
39
+ * }
40
+ *
41
+ * interface Order< C extends Context > {
42
+ * id: number;
43
+ * name: string;
44
+ * // ...
45
+ * }
46
+ *
47
+ * declare module '@wordpress/core-data' {
48
+ * export interface PerPackageEntityRecords< C extends Context > {
49
+ * myPlugin: Client | Order<C>>
50
+ * }
51
+ * }
52
+ *
53
+ * const c = getEntityRecord<Order>( 'myPlugin', 'order', 15 );
54
+ * // c is of the type Order
55
+ * ```
56
+ */
57
+ export interface PerPackageEntityRecords<C extends Context> {
58
+ core: Attachment<C> | Comment<C> | MenuLocation<C> | NavMenu<C> | NavMenuItem<C> | Page<C> | Plugin<C> | Post<C> | Settings<C> | Sidebar<C> | Taxonomy<C> | Theme<C> | User<C> | Type<C> | Widget<C> | WidgetType<C> | WpTemplate<C> | WpTemplatePart<C>;
59
+ }
60
+ /**
61
+ * A union of all known record types.
62
+ */
63
+ export declare type EntityRecord<C extends Context = 'edit'> = PerPackageEntityRecords<C>[keyof PerPackageEntityRecords<C>];
64
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/entity-types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACn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CAAE,CAAC,CAAE,GACT,MAAM,CAAE,CAAC,CAAE,GACX,IAAI,CAAE,CAAC,CAAE,GACT,QAAQ,CAAE,CAAC,CAAE,GACb,OAAO,CAAE,CAAC,CAAE,GACZ,QAAQ,CAAE,CAAC,CAAE,GACb,KAAK,CAAE,CAAC,CAAE,GACV,IAAI,CAAE,CAAC,CAAE,GACT,IAAI,CAAE,CAAC,CAAE,GACT,MAAM,CAAE,CAAC,CAAE,GACX,UAAU,CAAE,CAAC,CAAE,GACf,UAAU,CAAE,CAAC,CAAE,GACf,cAAc,CAAE,CAAC,CAAE,CAAC;CACvB;AAED;;GAEG;AACH,oBAAY,YAAY,CAAE,CAAC,SAAS,OAAO,GAAG,MAAM,IACnD,uBAAuB,CAAE,CAAC,CAAE,CAAE,MAAM,uBAAuB,CAAE,CAAC,CAAE,CAAE,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { Context, OmitNevers } from './helpers';
5
+ import type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';
6
+ declare module './base-entity-records' {
7
+ namespace BaseEntityRecords {
8
+ interface MenuLocation<C extends Context> {
9
+ /**
10
+ * The name of the menu location.
11
+ */
12
+ name: string;
13
+ /**
14
+ * The description of the menu location.
15
+ */
16
+ description: string;
17
+ /**
18
+ * The ID of the assigned menu.
19
+ */
20
+ menu: number;
21
+ }
22
+ }
23
+ }
24
+ export declare type MenuLocation<C extends Context = 'edit'> = OmitNevers<_BaseEntityRecords.MenuLocation<C>>;
25
+ //# sourceMappingURL=menu-location.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menu-location.d.ts","sourceRoot":"","sources":["../../src/entity-types/menu-location.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAErD,OAAO,KAAK,EAAE,iBAAiB,IAAI,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAErF,OAAO,QAAQ,uBAAuB,CAAC;IACtC,UAAiB,iBAAiB,CAAC;QAClC,UAAiB,YAAY,CAAE,CAAC,SAAS,OAAO;YAC/C;;eAEG;YACH,IAAI,EAAE,MAAM,CAAC;YACb;;eAEG;YACH,WAAW,EAAE,MAAM,CAAC;YACpB;;eAEG;YACH,IAAI,EAAE,MAAM,CAAC;SACb;KACD;CACD;AAED,oBAAY,YAAY,CAAE,CAAC,SAAS,OAAO,GAAG,MAAM,IAAK,UAAU,CAClE,kBAAkB,CAAC,YAAY,CAAE,CAAC,CAAE,CACpC,CAAC"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { RenderedText, Context, ContextualField, OmitNevers } from './helpers';
5
+ import type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';
6
+ export declare type NavMenuItemType = 'taxonomy' | 'post_type' | 'post_type_archive' | 'custom';
7
+ export declare type NavMenuItemStatus = 'publish' | 'future' | 'draft' | 'pending' | 'private';
8
+ export declare type Target = '_blank' | '';
9
+ declare module './base-entity-records' {
10
+ namespace BaseEntityRecords {
11
+ interface NavMenuItem<C extends Context> {
12
+ /**
13
+ * The title for the object.
14
+ */
15
+ title: RenderedText<C>;
16
+ /**
17
+ * Unique identifier for the object.
18
+ */
19
+ id: number;
20
+ /**
21
+ * The singular label used to describe this type of menu item.
22
+ */
23
+ type_label: string;
24
+ /**
25
+ * The family of objects originally represented, such as "post_type" or "taxonomy".
26
+ */
27
+ type: NavMenuItemType;
28
+ /**
29
+ * A named status for the object.
30
+ */
31
+ status: NavMenuItemStatus;
32
+ /**
33
+ * The ID for the parent of the object.
34
+ */
35
+ parent: number;
36
+ /**
37
+ * Text for the title attribute of the link element for this menu item.
38
+ */
39
+ attr_title: string;
40
+ /**
41
+ * Class names for the link element of this menu item.
42
+ */
43
+ classes: string[];
44
+ /**
45
+ * The description of this menu item.
46
+ */
47
+ description: string;
48
+ /**
49
+ * The DB ID of the nav_menu_item that is this item's menu parent, if any, otherwise 0.
50
+ */
51
+ menu_order: number;
52
+ /**
53
+ * The type of object originally represented, such as "category", "post", or "attachment".
54
+ */
55
+ object: string;
56
+ /**
57
+ * The database ID of the original object this menu item represents, for example the ID for posts or the term_id for categories.
58
+ */
59
+ object_id: number;
60
+ /**
61
+ * The target attribute of the link element for this menu item.
62
+ */
63
+ target: Target;
64
+ /**
65
+ * The URL to which this menu item points.
66
+ */
67
+ url: string;
68
+ /**
69
+ * The XFN relationship expressed in the link of this menu item.
70
+ */
71
+ xfn: string[];
72
+ /**
73
+ * Whether the menu item represents an object that no longer exists.
74
+ */
75
+ invalid: boolean;
76
+ /**
77
+ * The terms assigned to the object in the nav_menu taxonomy.
78
+ */
79
+ menus: ContextualField<number, 'view' | 'edit', C>;
80
+ /**
81
+ * Meta fields.
82
+ */
83
+ meta: ContextualField<Record<string, string>, 'view' | 'edit', C>;
84
+ }
85
+ }
86
+ }
87
+ export declare type NavMenuItem<C extends Context = 'edit'> = OmitNevers<_BaseEntityRecords.NavMenuItem<C>>;
88
+ //# sourceMappingURL=nav-menu-item.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nav-menu-item.d.ts","sourceRoot":"","sources":["../../src/entity-types/nav-menu-item.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EACX,YAAY,EACZ,OAAO,EACP,eAAe,EACf,UAAU,EACV,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,iBAAiB,IAAI,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAErF,oBAAY,eAAe,GACxB,UAAU,GACV,WAAW,GACX,mBAAmB,GACnB,QAAQ,CAAC;AACZ,oBAAY,iBAAiB,GAC1B,SAAS,GACT,QAAQ,GACR,OAAO,GACP,SAAS,GACT,SAAS,CAAC;AACb,oBAAY,MAAM,GAAG,QAAQ,GAAG,EAAE,CAAC;AAEnC,OAAO,QAAQ,uBAAuB,CAAC;IACtC,UAAiB,iBAAiB,CAAC;QAClC,UAAiB,WAAW,CAAE,CAAC,SAAS,OAAO;YAC9C;;eAEG;YACH,KAAK,EAAE,YAAY,CAAE,CAAC,CAAE,CAAC;YACzB;;eAEG;YACH,EAAE,EAAE,MAAM,CAAC;YACX;;eAEG;YACH,UAAU,EAAE,MAAM,CAAC;YACnB;;eAEG;YACH,IAAI,EAAE,eAAe,CAAC;YACtB;;eAEG;YACH,MAAM,EAAE,iBAAiB,CAAC;YAC1B;;eAEG;YACH,MAAM,EAAE,MAAM,CAAC;YACf;;eAEG;YACH,UAAU,EAAE,MAAM,CAAC;YACnB;;eAEG;YACH,OAAO,EAAE,MAAM,EAAE,CAAC;YAClB;;eAEG;YACH,WAAW,EAAE,MAAM,CAAC;YACpB;;eAEG;YACH,UAAU,EAAE,MAAM,CAAC;YACnB;;eAEG;YACH,MAAM,EAAE,MAAM,CAAC;YACf;;eAEG;YACH,SAAS,EAAE,MAAM,CAAC;YAClB;;eAEG;YACH,MAAM,EAAE,MAAM,CAAC;YACf;;eAEG;YACH,GAAG,EAAE,MAAM,CAAC;YACZ;;eAEG;YACH,GAAG,EAAE,MAAM,EAAE,CAAC;YACd;;eAEG;YACH,OAAO,EAAE,OAAO,CAAC;YACjB;;eAEG;YACH,KAAK,EAAE,eAAe,CAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAE,CAAC;YACrD;;eAEG;YACH,IAAI,EAAE,eAAe,CACpB,MAAM,CAAE,MAAM,EAAE,MAAM,CAAE,EACxB,MAAM,GAAG,MAAM,EACf,CAAC,CACD,CAAC;SACF;KACD;CACD;AAED,oBAAY,WAAW,CAAE,CAAC,SAAS,OAAO,GAAG,MAAM,IAAK,UAAU,CACjE,kBAAkB,CAAC,WAAW,CAAE,CAAC,CAAE,CACnC,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { Context, ContextualField, OmitNevers } from './helpers';
5
+ import type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';
6
+ declare module './base-entity-records' {
7
+ namespace BaseEntityRecords {
8
+ interface NavMenu<C extends Context> {
9
+ /**
10
+ * Unique identifier for the term.
11
+ */
12
+ id: number;
13
+ /**
14
+ * HTML description of the term.
15
+ */
16
+ description: ContextualField<string, 'view' | 'edit', C>;
17
+ /**
18
+ * HTML title for the term.
19
+ */
20
+ name: string;
21
+ /**
22
+ * An alphanumeric identifier for the term unique to its type.
23
+ */
24
+ slug: string;
25
+ /**
26
+ * Meta fields.
27
+ */
28
+ meta: ContextualField<Record<string, string>, 'view' | 'edit', C>;
29
+ /**
30
+ * The locations assigned to the menu.
31
+ */
32
+ locations: ContextualField<string[], 'view' | 'edit', C>;
33
+ /**
34
+ * The DB ID of the original object this menu item represents, e . g . ID for posts and term_id for categories.
35
+ */
36
+ object_id: number;
37
+ /**
38
+ * Whether to automatically add top level pages to this menu.
39
+ */
40
+ auto_add: ContextualField<boolean, 'view' | 'edit', C>;
41
+ }
42
+ }
43
+ }
44
+ export declare type NavMenu<C extends Context = 'edit'> = OmitNevers<_BaseEntityRecords.NavMenu<C>>;
45
+ //# sourceMappingURL=nav-menu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nav-menu.d.ts","sourceRoot":"","sources":["../../src/entity-types/nav-menu.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEtE,OAAO,KAAK,EAAE,iBAAiB,IAAI,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAErF,OAAO,QAAQ,uBAAuB,CAAC;IACtC,UAAiB,iBAAiB,CAAC;QAClC,UAAiB,OAAO,CAAE,CAAC,SAAS,OAAO;YAC1C;;eAEG;YACH,EAAE,EAAE,MAAM,CAAC;YACX;;eAEG;YACH,WAAW,EAAE,eAAe,CAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAE,CAAC;YAC3D;;eAEG;YACH,IAAI,EAAE,MAAM,CAAC;YACb;;eAEG;YACH,IAAI,EAAE,MAAM,CAAC;YACb;;eAEG;YACH,IAAI,EAAE,eAAe,CACpB,MAAM,CAAE,MAAM,EAAE,MAAM,CAAE,EACxB,MAAM,GAAG,MAAM,EACf,CAAC,CACD,CAAC;YACF;;eAEG;YACH,SAAS,EAAE,eAAe,CAAE,MAAM,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAE,CAAC;YAC3D;;eAEG;YACH,SAAS,EAAE,MAAM,CAAC;YAClB;;eAEG;YACH,QAAQ,EAAE,eAAe,CAAE,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAE,CAAC;SACzD;KACD;CACD;AAED,oBAAY,OAAO,CAAE,CAAC,SAAS,OAAO,GAAG,MAAM,IAAK,UAAU,CAC7D,kBAAkB,CAAC,OAAO,CAAE,CAAC,CAAE,CAC/B,CAAC"}
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { CommentingStatus, Context, ContextualField, PingStatus, PostStatus, RenderedText, OmitNevers } from './helpers';
5
+ import type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';
6
+ declare module './base-entity-records' {
7
+ namespace BaseEntityRecords {
8
+ interface Page<C extends Context> {
9
+ /**
10
+ * The date the post was published, in the site's timezone.
11
+ */
12
+ date: string | null;
13
+ /**
14
+ * The date the post was published, as GMT.
15
+ */
16
+ date_gmt: ContextualField<string | null, 'view' | 'edit', C>;
17
+ /**
18
+ * The globally unique identifier for the post.
19
+ */
20
+ guid: ContextualField<RenderedText<C>, 'view' | 'edit', C>;
21
+ /**
22
+ * Unique identifier for the post.
23
+ */
24
+ id: number;
25
+ /**
26
+ * URL to the post.
27
+ */
28
+ link: string;
29
+ /**
30
+ * The date the post was last modified, in the site's timezone.
31
+ */
32
+ modified: ContextualField<string, 'view' | 'edit', C>;
33
+ /**
34
+ * The date the post was last modified, as GMT.
35
+ */
36
+ modified_gmt: ContextualField<string, 'view' | 'edit', C>;
37
+ /**
38
+ * An alphanumeric identifier for the post unique to its type.
39
+ */
40
+ slug: string;
41
+ /**
42
+ * A named status for the post.
43
+ */
44
+ status: ContextualField<PostStatus, 'view' | 'edit', C>;
45
+ /**
46
+ * Type of post.
47
+ */
48
+ type: string;
49
+ /**
50
+ * A password to protect access to the content and excerpt.
51
+ */
52
+ password: ContextualField<string, 'edit', C>;
53
+ /**
54
+ * Permalink template for the post.
55
+ */
56
+ permalink_template: ContextualField<string, 'edit', C>;
57
+ /**
58
+ * Slug automatically generated from the post title.
59
+ */
60
+ generated_slug: ContextualField<string, 'edit', C>;
61
+ /**
62
+ * The ID for the parent of the post.
63
+ */
64
+ parent: ContextualField<number, 'view' | 'edit', C>;
65
+ /**
66
+ * The title for the post.
67
+ */
68
+ title: RenderedText<C>;
69
+ /**
70
+ * The content for the post.
71
+ */
72
+ content: ContextualField<RenderedText<C> & {
73
+ /**
74
+ * Whether the content is protected with a password.
75
+ */
76
+ is_protected: boolean;
77
+ /**
78
+ * Version of the content block format used by the page.
79
+ */
80
+ block_version: ContextualField<string, 'edit', C>;
81
+ }, 'view' | 'edit', C>;
82
+ /**
83
+ * The ID for the author of the post.
84
+ */
85
+ author: number;
86
+ /**
87
+ * The excerpt for the post.
88
+ */
89
+ excerpt: RenderedText<C> & {
90
+ protected: boolean;
91
+ };
92
+ /**
93
+ * The ID of the featured media for the post.
94
+ */
95
+ featured_media: number;
96
+ /**
97
+ * Whether or not comments are open on the post.
98
+ */
99
+ comment_status: ContextualField<CommentingStatus, 'view' | 'edit', C>;
100
+ /**
101
+ * Whether or not the post can be pinged.
102
+ */
103
+ ping_status: ContextualField<PingStatus, 'view' | 'edit', C>;
104
+ /**
105
+ * The order of the post in relation to other posts.
106
+ */
107
+ menu_order: ContextualField<number, 'view' | 'edit', C>;
108
+ /**
109
+ * Meta fields.
110
+ */
111
+ meta: ContextualField<Record<string, string>, 'view' | 'edit', C>;
112
+ /**
113
+ * The theme file to use to display the post.
114
+ */
115
+ template: ContextualField<string, 'view' | 'edit', C>;
116
+ }
117
+ }
118
+ }
119
+ export declare type Page<C extends Context = 'edit'> = OmitNevers<_BaseEntityRecords.Page<C>>;
120
+ //# sourceMappingURL=page.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../src/entity-types/page.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EACX,gBAAgB,EAChB,OAAO,EACP,eAAe,EACf,UAAU,EACV,UAAU,EACV,YAAY,EACZ,UAAU,EACV,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,iBAAiB,IAAI,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAErF,OAAO,QAAQ,uBAAuB,CAAC;IACtC,UAAiB,iBAAiB,CAAC;QAClC,UAAiB,IAAI,CAAE,CAAC,SAAS,OAAO;YACvC;;eAEG;YACH,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;YACpB;;eAEG;YACH,QAAQ,EAAE,eAAe,CAAE,MAAM,GAAG,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAE,CAAC;YAC/D;;eAEG;YACH,IAAI,EAAE,eAAe,CAAE,YAAY,CAAE,CAAC,CAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAE,CAAC;YAC/D;;eAEG;YACH,EAAE,EAAE,MAAM,CAAC;YACX;;eAEG;YACH,IAAI,EAAE,MAAM,CAAC;YACb;;eAEG;YACH,QAAQ,EAAE,eAAe,CAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAE,CAAC;YACxD;;eAEG;YACH,YAAY,EAAE,eAAe,CAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAE,CAAC;YAC5D;;eAEG;YACH,IAAI,EAAE,MAAM,CAAC;YACb;;eAEG;YACH,MAAM,EAAE,eAAe,CAAE,UAAU,EAAE,MAAM,GAAG,MAAM,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AAI,EAAE,eAAe,CACpB,MAAM,CAAE,MAAM,EAAE,MAAM,CAAE,EACxB,MAAM,GAAG,MAAM,EACf,CAAC,CACD,CAAC;YACF;;eAEG;YACH,QAAQ,EAAE,eAAe,CAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAE,CAAC;SACxD;KACD;CACD;AAED,oBAAY,IAAI,CAAE,CAAC,SAAS,OAAO,GAAG,MAAM,IAAK,UAAU,CAC1D,kBAAkB,CAAC,IAAI,CAAE,CAAC,CAAE,CAC5B,CAAC"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { Context, ContextualField, RenderedText, OmitNevers } from './helpers';
5
+ import type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';
6
+ declare module './base-entity-records' {
7
+ namespace BaseEntityRecords {
8
+ interface Plugin<C extends Context> {
9
+ /**
10
+ * The plugin file.
11
+ */
12
+ plugin: string;
13
+ /**
14
+ * The plugin activation status.
15
+ */
16
+ status: PluginStatus;
17
+ /**
18
+ * The plugin name.
19
+ */
20
+ name: string;
21
+ /**
22
+ * The plugin's website address.
23
+ */
24
+ plugin_uri: ContextualField<string, 'view' | 'edit', C>;
25
+ /**
26
+ * The plugin author.
27
+ */
28
+ author: ContextualField<Record<string, string>, 'view' | 'edit', C>;
29
+ /**
30
+ * Plugin author's website address.
31
+ */
32
+ author_uri: ContextualField<string, 'view' | 'edit', C>;
33
+ /**
34
+ * The plugin description.
35
+ */
36
+ description: ContextualField<RenderedText<'edit'>, 'view' | 'edit', C>;
37
+ /**
38
+ * The plugin version number.
39
+ */
40
+ version: ContextualField<string, 'view' | 'edit', C>;
41
+ /**
42
+ * Whether the plugin can only be activated network-wide.
43
+ */
44
+ network_only: boolean;
45
+ /**
46
+ * Minimum required version of WordPress.
47
+ */
48
+ requires_wp: string;
49
+ /**
50
+ * Minimum required version of PHP.
51
+ */
52
+ requires_php: string;
53
+ /**
54
+ * The plugin's text domain.
55
+ */
56
+ textdomain: ContextualField<string, 'view' | 'edit', C>;
57
+ }
58
+ }
59
+ }
60
+ export declare type PluginStatus = 'active' | 'inactive';
61
+ export declare type Plugin<C extends Context = 'edit'> = OmitNevers<_BaseEntityRecords.Plugin<C>>;
62
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/entity-types/plugin.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EACX,OAAO,EACP,eAAe,EACf,YAAY,EACZ,UAAU,EACV,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,iBAAiB,IAAI,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAErF,OAAO,QAAQ,uBAAuB,CAAC;IACtC,UAAiB,iBAAiB,CAAC;QAClC,UAAiB,MAAM,CAAE,CAAC,SAAS,OAAO;YACzC;;eAEG;YACH,MAAM,EAAE,MAAM,CAAC;YACf;;eAEG;YACH,MAAM,EAAE,YAAY,CAAC;YACrB;;eAEG;YACH,IAAI,EAAE,MAAM,CAAC;YACb;;eAEG;YACH,UAAU,EAAE,eAAe,CAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAE,CAAC;YAC1D;;eAEG;YACH,MAAM,EAAE,eAAe,CACtB,MAAM,CAAE,MAAM,EAAE,MAAM,CAAE,EACxB,MAAM,GAAG,MAAM,EACf,CAAC,CACD,CAAC;YACF;;eAEG;YACH,UAAU,EAAE,eAAe,CAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAE,CAAC;YAC1D;;eAEG;YACH,WAAW,EAAE,eAAe,CAC3B,YAAY,CAAE,MAAM,CAAE,EACtB,MAAM,GAAG,MAAM,EACf,CAAC,CACD,CAAC;YACF;;eAEG;YACH,OAAO,EAAE,eAAe,CAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAE,CAAC;YACvD;;eAEG;YACH,YAAY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