@wordpress/core-data 4.13.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) 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 +59 -39
  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 +59 -39
  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 +75 -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 +80 -45
  193. package/src/selectors.ts +202 -341
  194. package/src/test/resolvers.js +118 -4
  195. package/tsconfig.json +21 -0
  196. package/tsconfig.tsbuildinfo +1 -0
  197. package/build/entity-types/entities.js +0 -6
  198. package/build/entity-types/entities.js.map +0 -1
  199. package/build-module/entity-types/entities.js +0 -2
  200. package/build-module/entity-types/entities.js.map +0 -1
  201. package/src/entities.ts +0 -548
  202. package/src/entity-types/entities.ts +0 -130
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { AvatarUrls, 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 User<C extends Context> {
9
+ /**
10
+ * Unique identifier for the user.
11
+ */
12
+ id: number;
13
+ /**
14
+ * Login name for the user.
15
+ */
16
+ username: ContextualField<string, 'edit', C>;
17
+ /**
18
+ * Display name for the user.
19
+ */
20
+ name: string;
21
+ /**
22
+ * First name for the user.
23
+ */
24
+ first_name: ContextualField<string, 'edit', C>;
25
+ /**
26
+ * Last name for the user.
27
+ */
28
+ last_name: ContextualField<string, 'edit', C>;
29
+ /**
30
+ * The email address for the user.
31
+ */
32
+ email: ContextualField<string, 'edit', C>;
33
+ /**
34
+ * URL of the user.
35
+ */
36
+ url: string;
37
+ /**
38
+ * Description of the user.
39
+ */
40
+ description: string;
41
+ /**
42
+ * Author URL of the user.
43
+ */
44
+ link: string;
45
+ /**
46
+ * Locale for the user.
47
+ */
48
+ locale: ContextualField<string, 'edit', C>;
49
+ /**
50
+ * The nickname for the user.
51
+ */
52
+ nickname: ContextualField<string, 'edit', C>;
53
+ /**
54
+ * An alphanumeric identifier for the user.
55
+ */
56
+ slug: string;
57
+ /**
58
+ * Registration date for the user.
59
+ */
60
+ registered_date: ContextualField<string, 'edit', C>;
61
+ /**
62
+ * Roles assigned to the user.
63
+ */
64
+ roles: ContextualField<string[], 'edit', C>;
65
+ /**
66
+ * Password for the user.
67
+ *
68
+ * This is never sent from the server to the client
69
+ * but exists because we might send an update to the
70
+ * server with a new password to set.
71
+ */
72
+ password?: string;
73
+ /**
74
+ * All capabilities assigned to the user.
75
+ */
76
+ capabilities: ContextualField<Record<string, string>, 'edit', C>;
77
+ /**
78
+ * Any extra capabilities assigned to the user.
79
+ */
80
+ extra_capabilities: ContextualField<Record<string, string>, 'edit', C>;
81
+ /**
82
+ * Avatar URLs for the user.
83
+ */
84
+ avatar_urls: AvatarUrls;
85
+ /**
86
+ * Meta fields.
87
+ */
88
+ meta: ContextualField<Record<string, string>, 'view' | 'edit', C>;
89
+ }
90
+ }
91
+ }
92
+ export declare type User<C extends Context = 'edit'> = OmitNevers<_BaseEntityRecords.User<C>>;
93
+ //# sourceMappingURL=user.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../src/entity-types/user.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EACX,UAAU,EACV,OAAO,EACP,eAAe,EACf,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,EAAE,EAAE,MAAM,CAAC;YACX;;eAEG;YACH,QAAQ,EAAE,eAAe,CAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAE,CAAC;YAC/C;;eAEG;YACH,IAAI,EAAE,MAAM,CAAC;YACb;;eAEG;YACH,UAAU,EAAE,eAAe,CAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAE,CAAC;YACjD;;eAEG;YACH,SAAS,EAAE,eAAe,CAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAE,CAAC;YAChD;;eAEG;YACH,KAAK,EAAE,eAAe,CAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAE,CAAC;YAC5C;;eAEG;YACH,GAAG,EAAE,MAAM,CAAC;YACZ;;eAEG;YACH,WAAW,EAAE,MAAM,CAAC;YACpB;;eAEG;YACH,IAAI,EAAE,MAAM,CAAC;YACb;;eAEG;YACH,MAAM,EAAE,eAAe,CAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAE,CAAC;YAC7C;;eAEG;YACH,QAAQ,EAAE,eAAe,CAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAE,CAAC;YAC/C;;eAEG;YACH,IAAI,EAAE,MAAM,CAAC;YACb;;eAEG;YACH,eAAe,EAAE,eAAe,CAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAE,CAAC;YACtD;;eAEG;YACH,KAAK,EAAE,eAAe,CAAE,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAE,CAAC;YAC9C;;;;;;eAMG;YACH,QAAQ,CAAC,EAAE,MAAM,CAAC;YAClB;;eAEG;YACH,YAAY,EAAE,eAAe,CAC5B,MAAM,CAAE,MAAM,EAAE,MAAM,CAAE,EACxB,MAAM,EACN,CAAC,CACD,CAAC;YACF;;eAEG;YACH,kBAAkB,EAAE,eAAe,CAClC,MAAM,CAAE,MAAM,EAAE,MAAM,CAAE,EACxB,MAAM,EACN,CAAC,CACD,CAAC;YACF;;eAEG;YACH,WAAW,EAAE,UAAU,CAAC;YACxB;;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,IAAI,CAAE,CAAC,SAAS,OAAO,GAAG,MAAM,IAAK,UAAU,CAC1D,kBAAkB,CAAC,IAAI,CAAE,CAAC,CAAE,CAC5B,CAAC"}
@@ -0,0 +1,33 @@
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 WidgetType<C extends Context> {
9
+ /**
10
+ * Unique slug identifying the widget type.
11
+ */
12
+ id: string;
13
+ /**
14
+ * Human-readable name identifying the widget type.
15
+ */
16
+ name: string;
17
+ /**
18
+ * Description of the widget.
19
+ */
20
+ description: string;
21
+ /**
22
+ * Whether the widget supports multiple instances
23
+ */
24
+ is_multi: boolean;
25
+ /**
26
+ * Class name
27
+ */
28
+ classname: string;
29
+ }
30
+ }
31
+ }
32
+ export declare type WidgetType<C extends Context = 'edit'> = OmitNevers<_BaseEntityRecords.WidgetType<C>>;
33
+ //# sourceMappingURL=widget-type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widget-type.d.ts","sourceRoot":"","sources":["../../src/entity-types/widget-type.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,UAAU,CAAE,CAAC,SAAS,OAAO;YAC7C;;eAEG;YACH,EAAE,EAAE,MAAM,CAAC;YACX;;eAEG;YACH,IAAI,EAAE,MAAM,CAAC;YACb;;eAEG;YACH,WAAW,EAAE,MAAM,CAAC;YACpB;;eAEG;YACH,QAAQ,EAAE,OAAO,CAAC;YAClB;;eAEG;YACH,SAAS,EAAE,MAAM,CAAC;SAClB;KACD;CACD;AAED,oBAAY,UAAU,CAAE,CAAC,SAAS,OAAO,GAAG,MAAM,IAAK,UAAU,CAChE,kBAAkB,CAAC,UAAU,CAAE,CAAC,CAAE,CAClC,CAAC"}
@@ -0,0 +1,59 @@
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 Widget<C extends Context> {
9
+ /**
10
+ * Unique identifier for the widget.
11
+ */
12
+ id: string;
13
+ /**
14
+ * The type of the widget. Corresponds to ID in widget-types endpoint.
15
+ */
16
+ id_base: string;
17
+ /**
18
+ * The sidebar the widget belongs to.
19
+ */
20
+ sidebar: string;
21
+ /**
22
+ * HTML representation of the widget.
23
+ */
24
+ rendered: string;
25
+ /**
26
+ * HTML representation of the widget admin form.
27
+ */
28
+ rendered_form: ContextualField<string, 'edit', C>;
29
+ /**
30
+ * Instance settings of the widget, if supported.
31
+ */
32
+ instance: ContextualField<WidgetInstance, 'edit', C>;
33
+ /**
34
+ * URL-encoded form data from the widget admin form. Used
35
+ * to update a widget that does not support instance.
36
+ *
37
+ * This is never sent from the server to the client but exists
38
+ * because we might send an update.
39
+ */
40
+ form_data?: string;
41
+ }
42
+ interface WidgetInstance {
43
+ /**
44
+ * Base64 encoded representation of the instance settings.
45
+ */
46
+ encoded: string;
47
+ /**
48
+ * Cryptographic hash of the instance settings.
49
+ */
50
+ hash: string;
51
+ /**
52
+ * Unencoded instance settings, if supported.
53
+ */
54
+ raw: Record<string, string>;
55
+ }
56
+ }
57
+ }
58
+ export declare type Widget<C extends Context = 'edit'> = OmitNevers<_BaseEntityRecords.Widget<C>>;
59
+ //# sourceMappingURL=widget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widget.d.ts","sourceRoot":"","sources":["../../src/entity-types/widget.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,MAAM,CAAE,CAAC,SAAS,OAAO;YACzC;;eAEG;YACH,EAAE,EAAE,MAAM,CAAC;YACX;;eAEG;YACH,OAAO,EAAE,MAAM,CAAC;YAChB;;eAEG;YACH,OAAO,EAAE,MAAM,CAAC;YAChB;;eAEG;YACH,QAAQ,EAAE,MAAM,CAAC;YACjB;;eAEG;YACH,aAAa,EAAE,eAAe,CAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAE,CAAC;YACpD;;eAEG;YACH,QAAQ,EAAE,eAAe,CAAE,cAAc,EAAE,MAAM,EAAE,CAAC,CAAE,CAAC;YACvD;;;;;;eAMG;YACH,SAAS,CAAC,EAAE,MAAM,CAAC;SACnB;QAED,UAAU,cAAc;YACvB;;eAEG;YACH,OAAO,EAAE,MAAM,CAAC;YAChB;;eAEG;YACH,IAAI,EAAE,MAAM,CAAC;YACb;;eAEG;YACH,GAAG,EAAE,MAAM,CAAE,MAAM,EAAE,MAAM,CAAE,CAAC;SAC9B;KACD;CACD;AAED,oBAAY,MAAM,CAAE,CAAC,SAAS,OAAO,GAAG,MAAM,IAAK,UAAU,CAC5D,kBAAkB,CAAC,MAAM,CAAE,CAAC,CAAE,CAC9B,CAAC"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { Context, PostStatus, RenderedText, OmitNevers, ContextualField } from './helpers';
5
+ import type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';
6
+ declare module './base-entity-records' {
7
+ namespace BaseEntityRecords {
8
+ interface WpTemplatePart<C extends Context> {
9
+ /**
10
+ * ID of template.
11
+ */
12
+ id: string;
13
+ /**
14
+ * Unique slug identifying the template.
15
+ */
16
+ slug: string;
17
+ /**
18
+ * Theme identifier for the template.
19
+ */
20
+ theme: string;
21
+ /**
22
+ * Type of template.
23
+ */
24
+ type: string;
25
+ /**
26
+ * Source of template
27
+ */
28
+ source: string;
29
+ /**
30
+ * Source of a customized template
31
+ */
32
+ origin: string;
33
+ /**
34
+ * Content of template.
35
+ *
36
+ * This field never has a `rendered` property when reading but still uses
37
+ * the RenderedText type so it can be set as a string when sending updates to
38
+ * the server.
39
+ *
40
+ * TODO: Figure out how to mesh this with `RenderedText<C>`
41
+ */
42
+ content: ContextualField<RenderedText<C> & {
43
+ /**
44
+ * Version of the content block format used by the template.
45
+ */
46
+ block_version: ContextualField<number, 'edit', C>;
47
+ }, 'view' | 'edit', C>;
48
+ /**
49
+ * Title of template.
50
+ */
51
+ title: RenderedText<'edit'>;
52
+ /**
53
+ * Description of template.
54
+ */
55
+ description: string;
56
+ /**
57
+ * Status of template.
58
+ */
59
+ status: PostStatus;
60
+ /**
61
+ * Post ID.
62
+ */
63
+ wp_id: number;
64
+ /**
65
+ * Theme file exists.
66
+ */
67
+ has_theme_file: Record<string, string>;
68
+ /**
69
+ * The ID for the author of the template.
70
+ */
71
+ author: number;
72
+ /**
73
+ * Where the template part is intended for use (header, footer, etc.)
74
+ */
75
+ area: string;
76
+ }
77
+ }
78
+ }
79
+ export declare type WpTemplatePart<C extends Context = 'edit'> = OmitNevers<_BaseEntityRecords.WpTemplatePart<C>>;
80
+ //# sourceMappingURL=wp-template-part.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wp-template-part.d.ts","sourceRoot":"","sources":["../../src/entity-types/wp-template-part.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EACX,OAAO,EACP,UAAU,EACV,YAAY,EACZ,UAAU,EACV,eAAe,EACf,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,cAAc,CAAE,CAAC,SAAS,OAAO;YACjD;;eAEG;YACH,EAAE,EAAE,MAAM,CAAC;YACX;;eAEG;YACH,IAAI,EAAE,MAAM,CAAC;YACb;;eAEG;YACH,KAAK,EAAE,MAAM,CAAC;YACd;;eAEG;YACH,IAAI,EAAE,MAAM,CAAC;YACb;;eAEG;YACH,MAAM,EAAE,MAAM,CAAC;YACf;;eAEG;YACH,MAAM,EAAE,MAAM,CAAC;YACf;;;;;;;;eAQG;YACH,OAAO,EAAE,eAAe,CACvB,YAAY,CAAE,CAAC,CAAE,GAAG;gBACnB;;mBAEG;gBACH,aAAa,EAAE,eAAe,CAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAE,CAAC;aACpD,EACD,MAAM,GAAG,MAAM,EACf,CAAC,CACD,CAAC;YACF;;eAEG;YACH,KAAK,EAAE,YAAY,CAAE,MAAM,CAAE,CAAC;YAC9B;;eAEG;YACH,WAAW,EAAE,MAAM,CAAC;YACpB;;eAEG;YACH,MAAM,EAAE,UAAU,CAAC;YACnB;;eAEG;YACH,KAAK,EAAE,MAAM,CAAC;YACd;;eAEG;YACH,cAAc,EAAE,MAAM,CAAE,MAAM,EAAE,MAAM,CAAE,CAAC;YACzC;;eAEG;YACH,MAAM,EAAE,MAAM,CAAC;YACf;;eAEG;YACH,IAAI,EAAE,MAAM,CAAC;SACb;KACD;CACD;AAED,oBAAY,cAAc,CAAE,CAAC,SAAS,OAAO,GAAG,MAAM,IAAK,UAAU,CACpE,kBAAkB,CAAC,cAAc,CAAE,CAAC,CAAE,CACtC,CAAC"}
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import type { Context, PostStatus, RenderedText, OmitNevers, ContextualField } from './helpers';
5
+ import type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';
6
+ declare module './base-entity-records' {
7
+ namespace BaseEntityRecords {
8
+ interface WpTemplate<C extends Context> {
9
+ /**
10
+ * ID of template.
11
+ */
12
+ id: string;
13
+ /**
14
+ * Unique slug identifying the template.
15
+ */
16
+ slug: string;
17
+ /**
18
+ * Theme identifier for the template.
19
+ */
20
+ theme: string;
21
+ /**
22
+ * Type of template.
23
+ */
24
+ type: string;
25
+ /**
26
+ * Source of template
27
+ */
28
+ source: string;
29
+ /**
30
+ * Source of a customized template
31
+ */
32
+ origin: string;
33
+ /**
34
+ * Content of template.
35
+ *
36
+ * This field never has a `rendered` property when reading but still uses
37
+ * the RenderedText type so it can be set as a string when sending updates to
38
+ * the server.
39
+ *
40
+ * TODO: Figure out how to mesh this with `RenderedText<C>`
41
+ */
42
+ content: ContextualField<RenderedText<C> & {
43
+ /**
44
+ * Version of the content block format used by the template.
45
+ */
46
+ block_version: ContextualField<number, 'edit', C>;
47
+ }, 'view' | 'edit', C>;
48
+ /**
49
+ * Title of template.
50
+ */
51
+ title: RenderedText<'edit'>;
52
+ /**
53
+ * Description of template.
54
+ */
55
+ description: string;
56
+ /**
57
+ * Status of template.
58
+ */
59
+ status: PostStatus;
60
+ /**
61
+ * Post ID.
62
+ */
63
+ wp_id: number;
64
+ /**
65
+ * Theme file exists.
66
+ */
67
+ has_theme_file: Record<string, string>;
68
+ /**
69
+ * The ID for the author of the template.
70
+ */
71
+ author: number;
72
+ /**
73
+ * Whether a template is a custom template.
74
+ */
75
+ is_custom: Record<string, string>;
76
+ }
77
+ }
78
+ }
79
+ export declare type WpTemplate<C extends Context = 'edit'> = OmitNevers<_BaseEntityRecords.WpTemplate<C>>;
80
+ //# sourceMappingURL=wp-template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wp-template.d.ts","sourceRoot":"","sources":["../../src/entity-types/wp-template.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EACX,OAAO,EACP,UAAU,EACV,YAAY,EACZ,UAAU,EACV,eAAe,EACf,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,UAAU,CAAE,CAAC,SAAS,OAAO;YAC7C;;eAEG;YACH,EAAE,EAAE,MAAM,CAAC;YACX;;eAEG;YACH,IAAI,EAAE,MAAM,CAAC;YACb;;eAEG;YACH,KAAK,EAAE,MAAM,CAAC;YACd;;eAEG;YACH,IAAI,EAAE,MAAM,CAAC;YACb;;eAEG;YACH,MAAM,EAAE,MAAM,CAAC;YACf;;eAEG;YACH,MAAM,EAAE,MAAM,CAAC;YACf;;;;;;;;eAQG;YACH,OAAO,EAAE,eAAe,CACvB,YAAY,CAAE,CAAC,CAAE,GAAG;gBACnB;;mBAEG;gBACH,aAAa,EAAE,eAAe,CAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAE,CAAC;aACpD,EACD,MAAM,GAAG,MAAM,EACf,CAAC,CACD,CAAC;YACF;;eAEG;YACH,KAAK,EAAE,YAAY,CAAE,MAAM,CAAE,CAAC;YAC9B;;eAEG;YACH,WAAW,EAAE,MAAM,CAAC;YACpB;;eAEG;YACH,MAAM,EAAE,UAAU,CAAC;YACnB;;eAEG;YACH,KAAK,EAAE,MAAM,CAAC;YACd;;eAEG;YACH,cAAc,EAAE,MAAM,CAAE,MAAM,EAAE,MAAM,CAAE,CAAC;YACzC;;eAEG;YACH,MAAM,EAAE,MAAM,CAAC;YACf;;eAEG;YACH,SAAS,EAAE,MAAM,CAAE,MAAM,EAAE,MAAM,CAAE,CAAC;SACpC;KACD;CACD;AAED,oBAAY,UAAU,CAAE,CAAC,SAAS,OAAO,GAAG,MAAM,IAAK,UAAU,CAChE,kBAAkB,CAAC,UAAU,CAAE,CAAC,CAAE,CAClC,CAAC"}
@@ -0,0 +1,139 @@
1
+ export default fetchLinkSuggestions;
2
+ /**
3
+ * Filters the search by type
4
+ */
5
+ export type WPLinkSearchType = 'attachment' | 'post' | 'term' | 'post-format';
6
+ /**
7
+ * A link with an id may be of kind post-type or taxonomy
8
+ */
9
+ export type WPKind = 'post-type' | 'taxonomy';
10
+ export type WPLinkSearchOptions = {
11
+ /**
12
+ * Displays initial search suggestions, when true.
13
+ */
14
+ isInitialSuggestions?: boolean | undefined;
15
+ /**
16
+ * Filters by search type.
17
+ */
18
+ type?: WPLinkSearchType | undefined;
19
+ /**
20
+ * Slug of the post-type or taxonomy.
21
+ */
22
+ subtype?: string | undefined;
23
+ /**
24
+ * Which page of results to return.
25
+ */
26
+ page?: number | undefined;
27
+ /**
28
+ * Search results per page.
29
+ */
30
+ perPage?: number | undefined;
31
+ };
32
+ export type WPLinkSearchResult = {
33
+ /**
34
+ * Post or term id.
35
+ */
36
+ id: number;
37
+ /**
38
+ * Link url.
39
+ */
40
+ url: string;
41
+ /**
42
+ * Title of the link.
43
+ */
44
+ title: string;
45
+ /**
46
+ * The taxonomy or post type slug or type URL.
47
+ */
48
+ type: string;
49
+ /**
50
+ * Link kind of post-type or taxonomy
51
+ */
52
+ kind?: WPKind | undefined;
53
+ };
54
+ export type WPLinkSearchResultAugments = {
55
+ /**
56
+ * Contains kind information.
57
+ */
58
+ meta?: {
59
+ kind: WPKind;
60
+ } | undefined;
61
+ /**
62
+ * Optional subtype if it exists.
63
+ */
64
+ subtype?: WPKind | undefined;
65
+ };
66
+ export type WPLinkSearchResultAugmented = WPLinkSearchResult & WPLinkSearchResultAugments;
67
+ export type WPEditorSettings = {
68
+ /**
69
+ * Disables post formats, when true.
70
+ */
71
+ disablePostFormats?: boolean | undefined;
72
+ };
73
+ /**
74
+ * Filters the search by type
75
+ *
76
+ * @typedef { 'attachment' | 'post' | 'term' | 'post-format' } WPLinkSearchType
77
+ */
78
+ /**
79
+ * A link with an id may be of kind post-type or taxonomy
80
+ *
81
+ * @typedef { 'post-type' | 'taxonomy' } WPKind
82
+ */
83
+ /**
84
+ * @typedef WPLinkSearchOptions
85
+ *
86
+ * @property {boolean} [isInitialSuggestions] Displays initial search suggestions, when true.
87
+ * @property {WPLinkSearchType} [type] Filters by search type.
88
+ * @property {string} [subtype] Slug of the post-type or taxonomy.
89
+ * @property {number} [page] Which page of results to return.
90
+ * @property {number} [perPage] Search results per page.
91
+ */
92
+ /**
93
+ * @typedef WPLinkSearchResult
94
+ *
95
+ * @property {number} id Post or term id.
96
+ * @property {string} url Link url.
97
+ * @property {string} title Title of the link.
98
+ * @property {string} type The taxonomy or post type slug or type URL.
99
+ * @property {WPKind} [kind] Link kind of post-type or taxonomy
100
+ */
101
+ /**
102
+ * @typedef WPLinkSearchResultAugments
103
+ *
104
+ * @property {{kind: WPKind}} [meta] Contains kind information.
105
+ * @property {WPKind} [subtype] Optional subtype if it exists.
106
+ */
107
+ /**
108
+ * @typedef {WPLinkSearchResult & WPLinkSearchResultAugments} WPLinkSearchResultAugmented
109
+ */
110
+ /**
111
+ * @typedef WPEditorSettings
112
+ *
113
+ * @property {boolean} [ disablePostFormats ] Disables post formats, when true.
114
+ */
115
+ /**
116
+ * Fetches link suggestions from the API.
117
+ *
118
+ * @async
119
+ * @param {string} search
120
+ * @param {WPLinkSearchOptions} [searchOptions]
121
+ * @param {WPEditorSettings} [settings]
122
+ *
123
+ * @example
124
+ * ```js
125
+ * import { __experimentalFetchLinkSuggestions as fetchLinkSuggestions } from '@wordpress/core-data';
126
+ *
127
+ * //...
128
+ *
129
+ * export function initialize( id, settings ) {
130
+ *
131
+ * settings.__experimentalFetchLinkSuggestions = (
132
+ * search,
133
+ * searchOptions
134
+ * ) => fetchLinkSuggestions( search, searchOptions, settings );
135
+ * ```
136
+ * @return {Promise< WPLinkSearchResult[] >} List of search suggestions
137
+ */
138
+ declare function fetchLinkSuggestions(search: string, searchOptions?: WPLinkSearchOptions | undefined, settings?: WPEditorSettings | undefined): Promise<WPLinkSearchResult[]>;
139
+ //# sourceMappingURL=__experimental-fetch-link-suggestions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"__experimental-fetch-link-suggestions.d.ts","sourceRoot":"","sources":["../../src/fetch/__experimental-fetch-link-suggestions.js"],"names":[],"mappings":";;;;+BAWc,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,aAAa;;;;qBAM9C,WAAW,GAAG,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;QAgBxB,MAAM;;;;SACN,MAAM;;;;WACN,MAAM;;;;UACN,MAAM;;;;;;;;;;;cAOC,MAAM;;;;;;;0CAKd,kBAAkB,GAAG,0BAA0B;;;;;;;AAxC5D;;;;GAIG;AAEH;;;;GAIG;AAEH;;;;;;;;GAQG;AAEH;;;;;;;;GAQG;AAEH;;;;;GAKG;AAEH;;GAEG;AAEH;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,8CAnBW,MAAM,6FAiBL,QAAS,kBAAkB,EAAE,CAAE,CAiJ1C"}
@@ -0,0 +1,35 @@
1
+ export default fetchUrlData;
2
+ export type WPRemoteUrlData = {
3
+ /**
4
+ * contents of the remote URL's `<title>` tag.
5
+ */
6
+ title: string;
7
+ };
8
+ /**
9
+ * @typedef WPRemoteUrlData
10
+ *
11
+ * @property {string} title contents of the remote URL's `<title>` tag.
12
+ */
13
+ /**
14
+ * Fetches data about a remote URL.
15
+ * eg: <title> tag, favicon...etc.
16
+ *
17
+ * @async
18
+ * @param {string} url the URL to request details from.
19
+ * @param {Object?} options any options to pass to the underlying fetch.
20
+ * @example
21
+ * ```js
22
+ * import { __experimentalFetchUrlData as fetchUrlData } from '@wordpress/core-data';
23
+ *
24
+ * //...
25
+ *
26
+ * export function initialize( id, settings ) {
27
+ *
28
+ * settings.__experimentalFetchUrlData = (
29
+ * url
30
+ * ) => fetchUrlData( url );
31
+ * ```
32
+ * @return {Promise< WPRemoteUrlData[] >} Remote URL data.
33
+ */
34
+ declare function fetchUrlData(url: string, options?: any | null): Promise<WPRemoteUrlData[]>;
35
+ //# sourceMappingURL=__experimental-fetch-url-data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"__experimental-fetch-url-data.d.ts","sourceRoot":"","sources":["../../src/fetch/__experimental-fetch-url-data.js"],"names":[],"mappings":";;;;;WAsBc,MAAM;;AAHpB;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,mCAhBW,MAAM,yBAcL,QAAS,eAAe,EAAE,CAAE,CAuCvC"}
@@ -0,0 +1,3 @@
1
+ export { default as __experimentalFetchLinkSuggestions } from "./__experimental-fetch-link-suggestions";
2
+ export { default as __experimentalFetchUrlData } from "./__experimental-fetch-url-data";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fetch/index.js"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ export declare const enum Status {
2
+ Idle = "IDLE",
3
+ Resolving = "RESOLVING",
4
+ Error = "ERROR",
5
+ Success = "SUCCESS"
6
+ }
7
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/hooks/constants.ts"],"names":[],"mappings":"AAAA,0BAAkB,MAAM;IACvB,IAAI,SAAS;IACb,SAAS,cAAc;IACvB,KAAK,UAAU;IACf,OAAO,YAAY;CACnB"}
@@ -0,0 +1,4 @@
1
+ export { default as useEntityRecord, __experimentalUseEntityRecord, } from './use-entity-record';
2
+ export { default as useEntityRecords, __experimentalUseEntityRecords, } from './use-entity-records';
3
+ export { default as useResourcePermissions, __experimentalUseResourcePermissions, } from './use-resource-permissions';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,OAAO,IAAI,eAAe,EAC1B,6BAA6B,GAC7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,OAAO,IAAI,gBAAgB,EAC3B,8BAA8B,GAC9B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,OAAO,IAAI,sBAAsB,EACjC,oCAAoC,GACpC,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,3 @@
1
+ export default memoize;
2
+ import memoize from "memize";
3
+ //# sourceMappingURL=memoize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memoize.d.ts","sourceRoot":"","sources":["../../src/hooks/memoize.js"],"names":[],"mappings":""}