@kardalum/plugin-sdk 0.15.0 → 0.17.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 (204) hide show
  1. package/CHANGELOG.md +49 -1
  2. package/README.md +10 -0
  3. package/dist/admin-section-registry.d.ts +14 -5
  4. package/dist/admin-section-registry.js +14 -4
  5. package/dist/built-in-value-schemas.js +1 -1
  6. package/dist/built-ins.js +2 -2
  7. package/dist/capabilities.d.ts +8 -78
  8. package/dist/capabilities.js +23 -322
  9. package/dist/host-entry.d.ts +1 -1
  10. package/dist/host-entry.js +1 -1
  11. package/dist/index.d.ts +5 -5
  12. package/dist/index.js +13 -12
  13. package/dist/license-verdict-keys.d.ts +4 -3
  14. package/dist/license-verdict-keys.js +6 -5
  15. package/dist/manifest-entry.d.ts +3 -3
  16. package/dist/manifest-entry.js +2 -2
  17. package/dist/manifest-schema.d.ts +113 -56
  18. package/dist/manifest-schema.js +192 -295
  19. package/dist/manifest.d.ts +145 -112
  20. package/dist/manifest.js +13 -36
  21. package/dist/media/media-picker.js +21 -12
  22. package/dist/media/upload-error.d.ts +1 -1
  23. package/dist/media/upload-error.js +1 -1
  24. package/dist/plugin-context.d.ts +7 -0
  25. package/dist/plugin-context.js +7 -0
  26. package/dist/plugin-screen-context.d.ts +44 -3
  27. package/dist/plugin-screen-context.js +27 -2
  28. package/dist/read-all-pages.d.ts +23 -0
  29. package/dist/read-all-pages.js +30 -0
  30. package/dist/richtext/block-panel.js +6 -6
  31. package/dist/richtext/insert-menu.js +4 -4
  32. package/dist/richtext/style-listbox.js +4 -4
  33. package/dist/tokens/tokens.css +1 -0
  34. package/dist/tokens/tokens.json +2 -1
  35. package/dist/type-equality.d.ts +2 -0
  36. package/dist/type-equality.js +1 -0
  37. package/dist/views/content-list-view.js +2 -2
  38. package/dist/views/html-view.js +1 -1
  39. package/dist/views/image-view.js +24 -39
  40. package/dist/views/rich-text-view.js +3 -3
  41. package/node_modules/@kardalum/api-schemas/dist/api-error.schema.d.ts +12 -0
  42. package/node_modules/@kardalum/api-schemas/dist/api-error.schema.js +19 -0
  43. package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.d.ts +43 -25
  44. package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.js +60 -8
  45. package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.d.ts +90 -0
  46. package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +33 -2
  47. package/node_modules/@kardalum/api-schemas/dist/asset.schema.d.ts +22 -1
  48. package/node_modules/@kardalum/api-schemas/dist/asset.schema.js +50 -15
  49. package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.d.ts +204 -0
  50. package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.js +134 -0
  51. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +5 -0
  52. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +18 -13
  53. package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +2 -2
  54. package/node_modules/@kardalum/api-schemas/dist/content-list.schema.js +1 -1
  55. package/node_modules/@kardalum/api-schemas/dist/content-path.js +11 -7
  56. package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.d.ts +4 -0
  57. package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.js +3 -0
  58. package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.d.ts +1 -0
  59. package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.js +2 -1
  60. package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +143 -57
  61. package/node_modules/@kardalum/api-schemas/dist/core-actions.js +110 -60
  62. package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +1 -0
  63. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +2 -0
  64. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +1 -1
  65. package/node_modules/@kardalum/api-schemas/dist/index.d.ts +67 -40
  66. package/node_modules/@kardalum/api-schemas/dist/index.js +35 -19
  67. package/node_modules/@kardalum/api-schemas/dist/install-warnings.schema.d.ts +4 -0
  68. package/node_modules/@kardalum/api-schemas/dist/install-warnings.schema.js +8 -0
  69. package/node_modules/@kardalum/api-schemas/dist/issue-list.d.ts +6 -0
  70. package/node_modules/@kardalum/api-schemas/dist/issue-list.js +6 -0
  71. package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.d.ts +73 -0
  72. package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.js +104 -0
  73. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +356 -16
  74. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +93 -10
  75. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +10 -0
  76. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +38 -30
  77. package/node_modules/@kardalum/api-schemas/dist/media-rendition.schema.js +2 -2
  78. package/node_modules/@kardalum/api-schemas/dist/media.schema.js +1 -1
  79. package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.d.ts +6 -2
  80. package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.js +8 -6
  81. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +69 -4
  82. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.js +4 -0
  83. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +76 -9
  84. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +84 -24
  85. package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.d.ts +17 -7
  86. package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.js +18 -8
  87. package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.d.ts +69 -0
  88. package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.js +59 -0
  89. package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +597 -0
  90. package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +503 -0
  91. package/node_modules/@kardalum/api-schemas/dist/plugin-labels.d.ts +60 -0
  92. package/node_modules/@kardalum/api-schemas/dist/plugin-labels.js +116 -0
  93. package/node_modules/@kardalum/api-schemas/dist/plugin-locales.d.ts +82 -0
  94. package/node_modules/@kardalum/api-schemas/dist/plugin-locales.js +228 -0
  95. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +33 -4
  96. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +28 -2
  97. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +11 -3
  98. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +17 -4
  99. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +58 -0
  100. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +198 -0
  101. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-fields.d.ts +64 -0
  102. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-fields.js +134 -0
  103. package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.d.ts +2 -0
  104. package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.js +4 -0
  105. package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.d.ts +74 -0
  106. package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.js +132 -0
  107. package/node_modules/@kardalum/api-schemas/dist/plugin-vocabulary.d.ts +13 -0
  108. package/node_modules/@kardalum/api-schemas/dist/plugin-vocabulary.js +15 -0
  109. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +8 -0
  110. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +23 -4
  111. package/node_modules/@kardalum/api-schemas/dist/render-editing.d.ts +4 -4
  112. package/node_modules/@kardalum/api-schemas/dist/role.schema.d.ts +17 -0
  113. package/node_modules/@kardalum/api-schemas/dist/role.schema.js +13 -0
  114. package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.d.ts +44 -0
  115. package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.js +97 -0
  116. package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.d.ts +126 -0
  117. package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.js +70 -0
  118. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +36 -6
  119. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +17 -5
  120. package/node_modules/@kardalum/api-schemas/dist/sites.schema.d.ts +52 -33
  121. package/node_modules/@kardalum/api-schemas/dist/sites.schema.js +195 -56
  122. package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +19 -3
  123. package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.js +16 -0
  124. package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +1 -1
  125. package/node_modules/@kardalum/api-schemas/dist/strict-url.d.ts +12 -0
  126. package/node_modules/@kardalum/api-schemas/dist/strict-url.js +31 -0
  127. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +105 -1
  128. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +47 -7
  129. package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +30 -2
  130. package/node_modules/@kardalum/api-schemas/dist/template.schema.js +19 -5
  131. package/node_modules/@kardalum/api-schemas/dist/trash-cursor.schema.d.ts +4 -0
  132. package/node_modules/@kardalum/api-schemas/dist/trash-cursor.schema.js +29 -0
  133. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +15 -3
  134. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +8 -0
  135. package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.d.ts +19 -0
  136. package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.js +22 -0
  137. package/node_modules/@kardalum/api-schemas/package.json +2 -2
  138. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +1 -0
  139. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +2 -0
  140. package/node_modules/@kardalum/design-tokens/dist/tokens.css +1 -0
  141. package/node_modules/@kardalum/design-tokens/dist/tokens.js +3 -0
  142. package/node_modules/@kardalum/design-tokens/dist/tokens.json +2 -1
  143. package/node_modules/@kardalum/design-tokens/dist/types.d.ts +1 -0
  144. package/node_modules/@kardalum/plugin-package/README.md +4 -1
  145. package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +96 -0
  146. package/node_modules/@kardalum/plugin-package/dist/build-reference.js +66 -0
  147. package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +103 -0
  148. package/node_modules/@kardalum/plugin-package/dist/capabilities.js +346 -0
  149. package/node_modules/@kardalum/plugin-package/dist/client-bundle.d.ts +4 -0
  150. package/node_modules/@kardalum/plugin-package/dist/client-bundle.js +25 -0
  151. package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.d.ts +25 -0
  152. package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.js +203 -0
  153. package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.d.ts +3 -0
  154. package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.js +73 -0
  155. package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.d.ts +5 -0
  156. package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +60 -0
  157. package/node_modules/@kardalum/plugin-package/dist/delivery/icon-names.generated.d.ts +1 -0
  158. package/node_modules/@kardalum/plugin-package/dist/delivery/icon-names.generated.js +2052 -0
  159. package/node_modules/@kardalum/plugin-package/dist/delivery/icons.d.ts +2 -0
  160. package/node_modules/@kardalum/plugin-package/dist/delivery/icons.js +51 -0
  161. package/node_modules/@kardalum/plugin-package/dist/delivery/index.d.ts +8 -0
  162. package/node_modules/@kardalum/plugin-package/dist/delivery/index.js +7 -0
  163. package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.d.ts +17 -0
  164. package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.js +119 -0
  165. package/node_modules/@kardalum/plugin-package/dist/delivery/limits.d.ts +14 -0
  166. package/node_modules/@kardalum/plugin-package/dist/delivery/limits.js +21 -0
  167. package/node_modules/@kardalum/plugin-package/dist/delivery/locales.d.ts +5 -0
  168. package/node_modules/@kardalum/plugin-package/dist/delivery/locales.js +148 -0
  169. package/node_modules/@kardalum/plugin-package/dist/delivery/package-files.d.ts +5 -0
  170. package/node_modules/@kardalum/plugin-package/dist/delivery/package-files.js +76 -0
  171. package/node_modules/@kardalum/plugin-package/dist/delivery/registry.d.ts +22 -0
  172. package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +133 -0
  173. package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.d.ts +3 -0
  174. package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.js +90 -0
  175. package/node_modules/@kardalum/plugin-package/dist/delivery/support.d.ts +24 -0
  176. package/node_modules/@kardalum/plugin-package/dist/delivery/support.js +55 -0
  177. package/node_modules/@kardalum/plugin-package/dist/delivery/templates.d.ts +6 -0
  178. package/node_modules/@kardalum/plugin-package/dist/delivery/templates.js +158 -0
  179. package/node_modules/@kardalum/plugin-package/dist/delivery/types.d.ts +53 -0
  180. package/node_modules/@kardalum/plugin-package/dist/delivery/types.js +1 -0
  181. package/node_modules/@kardalum/plugin-package/dist/docs-contract.d.ts +3 -2
  182. package/node_modules/@kardalum/plugin-package/dist/docs-contract.js +4 -2
  183. package/node_modules/@kardalum/plugin-package/dist/extract.d.ts +92 -3
  184. package/node_modules/@kardalum/plugin-package/dist/extract.js +251 -41
  185. package/node_modules/@kardalum/plugin-package/dist/index.d.ts +11 -2
  186. package/node_modules/@kardalum/plugin-package/dist/index.js +8 -2
  187. package/node_modules/@kardalum/plugin-package/dist/manifest-entry.d.ts +5 -0
  188. package/node_modules/@kardalum/plugin-package/dist/manifest-entry.js +20 -0
  189. package/node_modules/@kardalum/plugin-package/dist/reference-entry.d.ts +3 -0
  190. package/node_modules/@kardalum/plugin-package/dist/reference-entry.js +7 -0
  191. package/node_modules/@kardalum/plugin-package/dist/sample-content.d.ts +38 -1
  192. package/node_modules/@kardalum/plugin-package/dist/sample-content.js +84 -16
  193. package/node_modules/@kardalum/plugin-package/dist/shipped-files.d.ts +39 -0
  194. package/node_modules/@kardalum/plugin-package/dist/shipped-files.js +133 -0
  195. package/node_modules/@kardalum/plugin-package/dist/shipped-locales.d.ts +7 -0
  196. package/node_modules/@kardalum/plugin-package/dist/shipped-locales.js +27 -0
  197. package/node_modules/@kardalum/plugin-package/dist/types.d.ts +4 -6
  198. package/node_modules/@kardalum/plugin-package/dist/types.js +15 -1
  199. package/node_modules/@kardalum/plugin-package/package.json +9 -2
  200. package/node_modules/@kardalum/ui/dist/components/checkbox.js +2 -2
  201. package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +2 -2
  202. package/node_modules/@kardalum/ui/dist/components/property-field.js +4 -1
  203. package/node_modules/@kardalum/ui/package.json +1 -1
  204. package/package.json +6 -6
package/CHANGELOG.md CHANGED
@@ -8,7 +8,45 @@ Subpaths are noted per entry. `.` is the package index; `./manifest` is the
8
8
  server-safe manifest contract subpath, which pulls in no React and no
9
9
  `@kardalum/ui`.
10
10
 
11
- ## Unreleased (after 0.14.0, the last release under the former scope)
11
+ ## 0.17.0
12
+
13
+ The licence verdict key set shrinks to one, three manifest contributions that
14
+ no admin screen hosted are gone, and display names can be per-language maps.
15
+
16
+ ### Removed
17
+
18
+ - The licence verdict key `a4c4a883bf1392a6` from `LICENSE_VERDICT_PUBLIC_KEYS`
19
+ (`./entitlement`). The list now holds `e72c11dbcdf71e68` alone, so a verdict
20
+ signed with the retired key no longer verifies.
21
+ - `settingsPages`, `contentTreeActions` and `editorToolbar` from
22
+ `PluginContributions` and the manifest schema (`.` and `./manifest`), with
23
+ their types `SettingsPageContribution`, `ContentTreeActionContribution` and
24
+ `EditorToolbarContribution`. A manifest that declares one now fails
25
+ validation. The `admin.settingsPage`, `admin.contentTreeAction` and
26
+ `admin.editorToolbarItem` capability labels went with them.
27
+
28
+ ### Changed
29
+
30
+ - The display name of an action, a role, a dashboard widget, a scheduled task,
31
+ a media processor and an exposed service may be a plain string or a map of
32
+ language code to text with `en` required (`.` and `./manifest`). Existing
33
+ string names stay valid.
34
+ - `PluginScreenContext.slot` (`.`) is a union that gains
35
+ `{ kind: "widget"; sectionId: null; entryId: null; widgetId: string }`, the
36
+ slot of a dashboard widget on the admin's Home page. `navigate` is a no-op
37
+ for a widget.
38
+ - A manifest whose `dashboardWidgets` repeat an id fails validation, as
39
+ sections and rail entries already did (`./manifest`).
40
+
41
+ ### Added
42
+
43
+ - `DATABASE_DIALECTS`, `PLUGIN_TYPES` and `TIER1_DIALECTS` (`.` and
44
+ `./manifest`), the vocabulary the manifest schema checks against.
45
+ - `listDashboardWidgets` and the `RegisteredDashboardWidget` type (`./host`),
46
+ host-only: the Home page's list of registered widgets. `registerPluginSlots`
47
+ now registers a manifest's `dashboardWidgets` too.
48
+
49
+ ## 0.15.0 and 0.16.0 (after 0.14.0, the last release under the former scope)
12
50
 
13
51
  The plugin manifest is no longer a discriminated union on `type`. One
14
52
  `PluginManifest` carries a single ungated `contributions` object, and
@@ -89,6 +127,16 @@ The plugin manifest is no longer a discriminated union on `type`. One
89
127
  - `VIEW_BEARING_CONTRIBUTIONS` and the `ViewBearingContribution` type
90
128
  (`./manifest`), the six contribution keys that imply a client bundle.
91
129
 
130
+ ### Changed
131
+
132
+ - An apiRoute's `path` takes `:name` parameters, each matching one segment
133
+ of the request, and every other segment is letters, digits, `-` and `_`
134
+ (`./manifest`). `CMSPluginSchema` and `validatePluginManifest` refuse two
135
+ routes of one method that the router reads as one route or that one
136
+ request matches both of, a `GET` or `PUT` at the host's plugin storage
137
+ address (`/storage/<segment>/<segment>`), more than 200 routes, and a path
138
+ over 200 characters.
139
+
92
140
  ### Two additions that will be awkward to change later
93
141
 
94
142
  Recorded here rather than left for whoever has to change them.
package/README.md CHANGED
@@ -59,6 +59,16 @@ the root; the subpaths below are bundled into whatever imports them.
59
59
  Two more entries in `exports`, `./datatype-validation` and
60
60
  `./register-built-ins`, are host and server internals a plugin never imports.
61
61
 
62
+ ## The management API base
63
+
64
+ The root also exports `MANAGE_API`, the string `/api/manage/v1`: the base of the
65
+ management API that the admin itself calls with the signed-in session. A plugin
66
+ view that calls a CMS family builds its path from it, for example the content
67
+ roots at `/api/manage/v1/content/roots`, and calls its own routes under
68
+ `/api/plugins/:pluginId/`. The
69
+ [management routes](https://docs.kardalum.com/v1/reference/manage/) page lists
70
+ every operation.
71
+
62
72
  ## Docs
63
73
 
64
74
  The plugin guide, the manifest reference and the storage reference are at
@@ -1,4 +1,4 @@
1
- import type { AdminSectionContribution, BuiltInRailEntryContribution, BuiltInRailSection, PluginManifest } from "./manifest.js";
1
+ import type { AdminSectionContribution, BuiltInRailEntryContribution, BuiltInRailSection, DashboardWidgetContribution, PluginManifest } from "./manifest.js";
2
2
  /** @internal A section in the host's registry, with the plugin it came from. */
3
3
  export interface RegisteredSection {
4
4
  pluginId: string;
@@ -9,12 +9,18 @@ export interface RegisteredRailEntry {
9
9
  pluginId: string;
10
10
  entry: BuiltInRailEntryContribution;
11
11
  }
12
+ /** @internal A dashboard widget in the host's registry, with its plugin
13
+ * (S313b, W8). The Home page lists them in registration order. */
14
+ export interface RegisteredDashboardWidget {
15
+ pluginId: string;
16
+ widget: DashboardWidgetContribution;
17
+ }
12
18
  /**
13
19
  * Register every slot a plugin's manifest declares: its top-level sections
14
- * (each with its own rail) and its rail entries in built-in sections.
15
- * Replaces `registerAdminSection`. Throws on a second registration of the
16
- * same plugin id, slots or not, so a caller that boots a plugin twice finds
17
- * out rather than doubling its entries in the app bar.
20
+ * (each with its own rail), its rail entries in built-in sections and its
21
+ * dashboard widgets. Replaces `registerAdminSection`. Throws on a second
22
+ * registration of the same plugin id, slots or not, so a caller that boots a
23
+ * plugin twice finds out rather than doubling its entries in the app bar.
18
24
  *
19
25
  * @internal Host-only: the admin calls it with a validated manifest.
20
26
  */
@@ -29,6 +35,9 @@ export declare function listPluginSections(): RegisteredSection[];
29
35
  export declare function listRailEntries(section: BuiltInRailSection): RegisteredRailEntry[];
30
36
  /** @internal Host-only lookup of one plugin's entry in a built-in rail. */
31
37
  export declare function getRailEntry(section: BuiltInRailSection, pluginId: string, entryId: string): RegisteredRailEntry | undefined;
38
+ /** @internal Every registered dashboard widget, in registration order. A
39
+ * copy: changing it changes nothing registered. */
40
+ export declare function listDashboardWidgets(): RegisteredDashboardWidget[];
32
41
  /** @internal Clears every registered slot and plugin id. Tests only: the
33
42
  * admin registers once per page load. */
34
43
  export declare function resetPluginSlotsForTests(): void;
@@ -1,12 +1,13 @@
1
1
  const registeredPlugins = new Set();
2
2
  const sections = [];
3
3
  const railEntries = [];
4
+ const dashboardWidgets = [];
4
5
  /**
5
6
  * Register every slot a plugin's manifest declares: its top-level sections
6
- * (each with its own rail) and its rail entries in built-in sections.
7
- * Replaces `registerAdminSection`. Throws on a second registration of the
8
- * same plugin id, slots or not, so a caller that boots a plugin twice finds
9
- * out rather than doubling its entries in the app bar.
7
+ * (each with its own rail), its rail entries in built-in sections and its
8
+ * dashboard widgets. Replaces `registerAdminSection`. Throws on a second
9
+ * registration of the same plugin id, slots or not, so a caller that boots a
10
+ * plugin twice finds out rather than doubling its entries in the app bar.
10
11
  *
11
12
  * @internal Host-only: the admin calls it with a validated manifest.
12
13
  */
@@ -21,6 +22,9 @@ export function registerPluginSlots(pluginId, manifest) {
21
22
  for (const entry of manifest.contributions.railEntries ?? []) {
22
23
  railEntries.push({ pluginId, entry });
23
24
  }
25
+ for (const widget of manifest.contributions.dashboardWidgets ?? []) {
26
+ dashboardWidgets.push({ pluginId, widget });
27
+ }
24
28
  }
25
29
  /** @internal Host-only lookup of one plugin's section by its id. */
26
30
  export function getPluginSection(pluginId, sectionId) {
@@ -40,10 +44,16 @@ export function listRailEntries(section) {
40
44
  export function getRailEntry(section, pluginId, entryId) {
41
45
  return railEntries.find((registered) => registered.entry.section === section && registered.pluginId === pluginId && registered.entry.id === entryId);
42
46
  }
47
+ /** @internal Every registered dashboard widget, in registration order. A
48
+ * copy: changing it changes nothing registered. */
49
+ export function listDashboardWidgets() {
50
+ return [...dashboardWidgets];
51
+ }
43
52
  /** @internal Clears every registered slot and plugin id. Tests only: the
44
53
  * admin registers once per page load. */
45
54
  export function resetPluginSlotsForTests() {
46
55
  registeredPlugins.clear();
47
56
  sections.length = 0;
48
57
  railEntries.length = 0;
58
+ dashboardWidgets.length = 0;
49
59
  }
@@ -19,7 +19,7 @@ export const BUILT_IN_VALUE_SCHEMAS = {
19
19
  additionalProperties: false,
20
20
  },
21
21
  // S232. The Content List field stores nothing at all: the table it
22
- // renders reads the page's CHILDREN through GET /api/content/:id/list,
22
+ // renders reads the page's CHILDREN through GET /api/manage/v1/content/:id/list,
23
23
  // so a consumer of the public API learns the honest answer here, that
24
24
  // this field carries no value of its own.
25
25
  "com.kardalum.contentlist": { type: "null" },
package/dist/built-ins.js CHANGED
@@ -146,7 +146,7 @@ registerDataType(builtIn("date", "Date", "calendar", BUILT_IN_VALUE_SCHEMAS["com
146
146
  preview: DateReadOnlyView,
147
147
  }));
148
148
  // Stores a media reference id — the Media Library item itself is
149
- // fetched separately (GET /api/media/:id), not embedded in the field
149
+ // fetched separately (GET /api/manage/v1/media/:id), not embedded in the field
150
150
  // value. S234d gave the view a second way to fill that id: Choose opens
151
151
  // the shared media picker over the library, beside the upload it has had
152
152
  // since Session 42.
@@ -218,7 +218,7 @@ registerDataType(builtIn("daterange", "Date range", "calendar-range", BUILT_IN_V
218
218
  preview: DateRangeReadOnlyView,
219
219
  }));
220
220
  // S232: the first built-in whose field stores NO value. It renders the
221
- // children of the page being edited (GET /api/content/:id/list), so it
221
+ // children of the page being edited (GET /api/manage/v1/content/:id/list), so it
222
222
  // reads a ContentHost rather than a plugin value, and `preview` is a
223
223
  // separate static component instead of the usual alias to `readOnly`:
224
224
  // the document type builder is designing a type, where no page and
@@ -1,83 +1,13 @@
1
- import type { PluginContributions, PluginManifest } from "./manifest.js";
1
+ export { CAPABILITY_IDS, deriveCapabilities, isActionGated, type Capability, type CapabilityMediation, type CapabilityPayload, } from "@kardalum/plugin-package/reference";
2
2
  /**
3
- * What a plugin can do, computed from what it declares (S267, section 3,
4
- * implemented by S268 Task 5).
5
- *
6
- * **A capability is derived, not declared.** The author writes
7
- * `contributions` (concrete, carrying payloads), `assertions` (the short
8
- * list of claims nothing can check) and `databaseCompatibility`. This
9
- * module reads those and produces the list. One source of truth, three
10
- * renderings: the install screen shows it as consent items, marketplace
11
- * review reads it to decide whether a submission needs a person, and the
12
- * generated reference page prints it. An author cannot claim a capability
13
- * they do not have, and cannot quietly have one they did not claim.
14
- *
15
- * **Disclosure, not enforcement** (S267 section 7). Plugin backend code
16
- * runs unsandboxed and in-process, so this list is what the author says
17
- * and what review checks, never what the runtime confines. The mediated
18
- * entries are genuinely enforced, because the host owns the decision. The
19
- * promised ones are promises.
20
- */
21
- /**
22
- * `mediated`: the host bounds the outcome. It decides where the view
23
- * renders, which gate the route sits behind, whether the action passes.
24
- * Review of a mediated capability is automatic.
25
- *
26
- * `promised`: only the plugin's own code can honour it, so a person reads
27
- * it against that code before the submission is approved.
28
- */
29
- export type CapabilityMediation = "mediated" | "promised";
30
- /**
31
- * The part of the declaration that produced a capability which is safe to
32
- * store and to render: never a live function, never a Zod schema.
33
- *
34
- * `details` is a list of plain identifying strings, not sentences, so each
35
- * of the three readers can put its own heading in front of them and none
36
- * has to re-derive them from the manifest. For an assertion the detail IS
37
- * the author's reason, because a reason is the whole content of an
38
- * assertion.
39
- */
40
- export interface CapabilityPayload {
41
- /** How many declarations produced this capability. 1 for a declaration
42
- * that is not a list (themeTokens, an assertion, structured storage). */
43
- count: number;
44
- /** One line per declaration, in declaration order. Empty when the
45
- * declaration carries no readable per-entry detail. */
46
- details: string[];
47
- }
48
- export interface Capability {
49
- /** Stable, dotted, and never reused for a different meaning. Persisted
50
- * on a marketplace version row and rendered by three surfaces, so a
51
- * renamed id is a data migration, not a cosmetic change. */
52
- id: string;
53
- payload: CapabilityPayload;
54
- mediation: CapabilityMediation;
55
- }
56
- /** Whether this contribution kind sits behind a named permission action.
57
- * Lives on CONTRIBUTION_RULES rather than in a separate list, because that
58
- * record is compiler-total over the 19 contribution keys: a twentieth key
59
- * cannot be added without classifying it here. */
60
- export declare function isActionGated(key: keyof PluginContributions): boolean;
61
- /** Every capability id this contract can produce, for the readers that
62
- * need to be pinned against it (the marketplace's static mirror) and for
63
- * the reference page S289 generates. */
64
- export declare const CAPABILITY_IDS: readonly string[];
65
- /**
66
- * Compute a manifest's capability list.
67
- *
68
- * Accepts both a live `PluginManifest` and the redacted, JSON-safe summary
69
- * kardalum plugin writes into a package's `manifest.json`, for the same
70
- * reason `declaresClientBundle` does: the marketplace never executes
71
- * plugin code, so the only manifest it can read is the redacted one, and
72
- * the two sides of an install must not disagree about what a package
73
- * declares.
74
- *
75
- * Defensive about its input rather than trusting it. It is handed parsed
76
- * JSON from an artifact an author built, so a missing or wrongly-shaped
77
- * field degrades to "declares nothing" for that field instead of throwing
78
- * inside a review queue listing.
3
+ * S289 (S347): the one sentence every surface uses for what declaring a
4
+ * promised capability means for review. Every submission that passes
5
+ * validation reaches a reviewer whatever it declares; a promised capability
6
+ * changes what the reviewer reads, not whether one reads. The manual and
7
+ * the plugin rules file quote it verbatim after its subject, and
8
+ * promised-wording.test.ts holds them to it.
79
9
  */
80
- export declare function deriveCapabilities(manifest: PluginManifest | Record<string, unknown> | null | undefined): Capability[];
10
+ export declare const PROMISED_CAPABILITY_SENTENCE = "is a promised capability, so a reviewer reads it against your code";
81
11
  /**
82
12
  * Who is reading. The split is deliberate and predates this module: a
83
13
  * shopper on a public listing is being told what the plugin does, while an
@@ -1,326 +1,30 @@
1
- /**
2
- * Every contribution key, classified. Keyed by `keyof PluginContributions`
3
- * rather than by a loose string, so a contribution added to the contract
4
- * and not classified here is a compile error rather than a capability that
5
- * silently never appears on an install screen.
6
- *
7
- * Classification follows S267 section 6 and its stated principle: a
8
- * capability is automatic when the platform decides the outcome, and needs
9
- * a person when the plugin does. Every contribution below is mediated,
10
- * because every one of them is consumed by the host: it mounts the view,
11
- * dispatches the hook, runs the task, registers the template. The only
12
- * contribution that is not wholly mediated is `apiRoutes`, and only for
13
- * the tiers that let traffic reach a handler without an admin session.
14
- *
15
- * `exposedServices`, `bundledPlugins` and `bundledTemplate` are not named
16
- * in section 6's automatic list, which enumerates a policy rather than the
17
- * contract's keys. They are classified mediated here rather than dropped:
18
- * the marketplace resolves the two bundle keys, and the cross-plugin
19
- * service registry (when it exists) is the host's own lookup.
20
- * `exposedServices` reads promised until you remember that plugin backend
21
- * code is unsandboxed and in-process already, so handing another plugin a
22
- * service adds a lookup rather than a privilege it could not otherwise
23
- * reach. Emitting them changes no review outcome, since mediated is
24
- * automatic, and not emitting them would be the exact failure this design
25
- * exists to prevent, a declaration the install screen does not disclose.
26
- */
27
- const CONTRIBUTION_RULES = {
28
- dataTypes: { derives: "one", id: "content.dataType", mediation: "mediated", actionGated: false },
29
- documentTypes: { derives: "one", id: "content.documentType", mediation: "mediated", actionGated: false },
30
- adminSections: { derives: "one", id: "admin.section", mediation: "mediated", actionGated: true },
31
- // S280: a rail entry in a built-in section. Mediated like a section: the
32
- // host decides where it renders and checks its action before it does. A
33
- // section's own rail entries are part of the section's declaration, so
34
- // they are disclosed under admin.section rather than counted here.
35
- railEntries: { derives: "one", id: "admin.railEntry", mediation: "mediated", actionGated: true },
36
- dashboardWidgets: { derives: "one", id: "admin.dashboardWidget", mediation: "mediated", actionGated: true },
37
- settingsPages: { derives: "one", id: "admin.settingsPage", mediation: "mediated", actionGated: true },
38
- contentTreeActions: { derives: "one", id: "admin.contentTreeAction", mediation: "mediated", actionGated: true },
39
- editorToolbar: { derives: "one", id: "admin.editorToolbarItem", mediation: "mediated", actionGated: true },
40
- templates: { derives: "one", id: "render.template", mediation: "mediated", actionGated: false },
41
- assets: { derives: "one", id: "render.asset", mediation: "mediated", actionGated: false },
42
- themeTokens: { derives: "one", id: "theme.tokens", mediation: "mediated", actionGated: false },
43
- hooks: { derives: "one", id: "server.hook", mediation: "mediated", actionGated: false },
44
- scheduledTasks: { derives: "one", id: "server.scheduledTask", mediation: "mediated", actionGated: false },
45
- mediaProcessors: { derives: "one", id: "media.processor", mediation: "mediated", actionGated: false },
46
- serializers: { derives: "one", id: "api.serializer", mediation: "mediated", actionGated: false },
47
- exposedServices: { derives: "one", id: "service.exposed", mediation: "mediated", actionGated: false },
48
- bundledPlugins: { derives: "one", id: "bundle.plugin", mediation: "mediated", actionGated: false },
49
- bundledTemplate: { derives: "one", id: "bundle.template", mediation: "mediated", actionGated: false },
50
- apiRoutes: { derives: "perApiRouteTier", actionGated: true },
51
- };
52
- /** Whether this contribution kind sits behind a named permission action.
53
- * Lives on CONTRIBUTION_RULES rather than in a separate list, because that
54
- * record is compiler-total over the 19 contribution keys: a twentieth key
55
- * cannot be added without classifying it here. */
56
- export function isActionGated(key) {
57
- return CONTRIBUTION_RULES[key].actionGated;
58
- }
59
- /**
60
- * The order capabilities are emitted in, fixed here rather than taken from
61
- * the manifest's own key order. Two manifests declaring the same things in
62
- * a different order must produce the same list, or the install screen, the
63
- * review queue and the reference page would each print a different
64
- * ordering of one fact.
65
- *
66
- * Storage leads because it is the heaviest thing an operator consents to.
67
- * The assertions trail because they are the claims with nothing behind
68
- * them, and they read as a closing caveat rather than as a feature.
69
- */
70
- const CONTRIBUTION_ORDER = [
71
- "dataTypes",
72
- "documentTypes",
73
- "adminSections",
74
- "railEntries",
75
- "dashboardWidgets",
76
- "settingsPages",
77
- "contentTreeActions",
78
- "editorToolbar",
79
- "templates",
80
- "assets",
81
- "themeTokens",
82
- "hooks",
83
- "scheduledTasks",
84
- "mediaProcessors",
85
- "serializers",
86
- "apiRoutes",
87
- "exposedServices",
88
- "bundledPlugins",
89
- "bundledTemplate",
90
- ];
91
- /**
92
- * The access tiers, in emission order, with the classification S267
93
- * section 6 gives each.
94
- *
95
- * `admin` is mediated: the host checks the JWT admin session before the
96
- * handler runs. `apiKey` and `public` are promised: the host enforces the
97
- * tier, but a route reachable without an admin session is an abuse surface
98
- * whose handling belongs to the author.
99
- */
100
- const API_ROUTE_TIERS = [
101
- { tier: "admin", id: "api.route.admin", mediation: "mediated" },
102
- { tier: "apiKey", id: "api.route.apiKey", mediation: "promised" },
103
- { tier: "public", id: "api.route.public", mediation: "promised" },
104
- ];
105
- /**
106
- * The tier a route actually runs at.
107
- *
108
- * This is a real coupling to `apps/server/src/routes/plugin-api-routes.ts`,
109
- * which resolves `route.access ?? "admin"` and documents that anything
110
- * unrecognised falls back to `admin`, secure by default. If the two
111
- * disagreed, the install screen would promise a gate the runtime does not
112
- * apply, or warn about one it does. The dispatcher is canonical; this
113
- * follows it.
114
- */
115
- function routeTier(access) {
116
- const match = API_ROUTE_TIERS.find((entry) => entry.tier === access);
117
- return match ?? API_ROUTE_TIERS[0];
118
- }
119
- /**
120
- * Capability id per assertion, in emission order. The reason the author
121
- * gave is the capability's only detail, because the reason is the only
122
- * checkable thing an assertion carries.
123
- *
124
- * Keyed by `keyof PluginAssertions` for the same reason
125
- * CONTRIBUTION_RULES is keyed by `keyof PluginContributions`, and with
126
- * more force: an unclassified contribution is at worst an undisclosed
127
- * mediated addition, while an unclassified assertion is an undisclosed
128
- * PROMISE, so it would never reach the consent list and never send the
129
- * submission to a person. A third kind added to the type and not here is
130
- * a compile error.
131
- */
132
- const ASSERTION_RULES = {
133
- externalNetwork: "network.external",
134
- filesystemAccess: "filesystem.access",
135
- };
136
- /** The rules as the derivation walks them. Object key order is stable for
137
- * string keys, so this is the literal's own order rather than a second
138
- * list to keep in step. */
139
- const ASSERTION_ENTRIES = Object.entries(ASSERTION_RULES);
140
- /**
141
- * Derived from `databaseCompatibility.storageType`, and NOT from a
142
- * contribution: `PluginContributions` has no storage-shaped key and the
143
- * contract cannot silently grow one. Declaring structured storage IS the
144
- * declaration that the plugin owns real tables. The server agrees: it
145
- * persists `storageType` on the installed-plugin row, because uninstall
146
- * has to answer that question without the manifest.
147
- */
148
- const STRUCTURED_STORAGE_ID = "storage.structured";
149
- /** Every capability id this contract can produce, for the readers that
150
- * need to be pinned against it (the marketplace's static mirror) and for
151
- * the reference page S289 generates. */
152
- export const CAPABILITY_IDS = [
153
- STRUCTURED_STORAGE_ID,
154
- ...CONTRIBUTION_ORDER.flatMap((key) => {
155
- const rule = CONTRIBUTION_RULES[key];
156
- return rule.derives === "one" ? [rule.id] : API_ROUTE_TIERS.map((entry) => entry.id);
157
- }),
158
- ...ASSERTION_ENTRIES.map(([, id]) => id),
159
- ];
160
- // ---------------------------------------------------------------------------
161
- // Reading a declaration's readable detail
162
- // ---------------------------------------------------------------------------
163
- /** The plain string fields a contribution entry can be named by, in the
164
- * order they are preferred. Every one of them survives the redaction
165
- * kardalum plugin applies when it writes a package's manifest.json, which
166
- * is the only form the marketplace ever sees. */
167
- const ENTRY_NAME_FIELDS = ["name", "label", "alias", "file", "id"];
168
- /** A slot's label is a map of language to text (S280), and the detail is a
169
- * plain identifying string, so a label map reads as its English text, the
170
- * one language every label must carry. A map without readable English
171
- * yields nothing, and the next name field is tried. */
172
- function readableField(value) {
173
- if (typeof value === "string")
174
- return value.trim() ? value : null;
175
- if (value !== null && typeof value === "object" && !Array.isArray(value)) {
176
- const en = value.en;
177
- if (typeof en === "string" && en.trim())
178
- return en;
179
- }
180
- return null;
181
- }
182
- function describeEntry(entry) {
183
- if (typeof entry === "string")
184
- return entry.trim() || null;
185
- if (entry === null || typeof entry !== "object")
186
- return null;
187
- const record = entry;
188
- // An apiRoute is named by what it exposes, not by an id it has no field
189
- // for: "GET /orders" is the thing a reviewer looks up in the code.
190
- if (typeof record.method === "string" && typeof record.path === "string") {
191
- return `${record.method} ${record.path}`;
192
- }
193
- for (const field of ENTRY_NAME_FIELDS) {
194
- const value = readableField(record[field]);
195
- if (value !== null)
196
- return value;
197
- }
198
- return null;
199
- }
200
- /**
201
- * Normalises one declared contribution value into the entries that
202
- * produced it, handling the three shapes the contract uses: a list, the
203
- * `hooks` map (whose keys are the events, and which arrives as a plain key
204
- * array once redacted), and a single object like `themeTokens`.
205
- *
206
- * Returns an empty list for a declaration that declares nothing, which is
207
- * the same rule `declaresClientBundle` applies: a present-but-empty array
208
- * or object buys nothing. The one shape that is NOT nothing is the
209
- * redactor's `true`, which is a declaration stripped of its detail rather
210
- * than an absent one.
211
- */
212
- function declaredEntries(key, value) {
213
- if (value === null || value === undefined)
214
- return [];
215
- if (Array.isArray(value))
216
- return value;
217
- // `true` is what kardalum plugin's redactor writes for a contribution it
218
- // can keep no safe per-entry detail from (`serializers` is the only key
219
- // that lands there today). It means "declared, nothing readable to
220
- // show", which is exactly one entry with no detail, the same answer the
221
- // live object form gives. Reading it as "declares nothing" is what made
222
- // every marketplace surface omit a capability the SDK derived from the
223
- // same plugin.
224
- if (value === true)
225
- return [true];
226
- if (typeof value !== "object")
227
- return [];
228
- // `hooks` is Record<event, handler> live and string[] once redacted; the
229
- // array branch above already covered the redacted form.
230
- if (key === "hooks")
231
- return Object.keys(value);
232
- // A present-but-empty object buys nothing, which is the rule the array
233
- // branch gets for free: `themeTokens: {}` declares no tokens, so it is
234
- // not a theme capability.
235
- return Object.keys(value).length === 0 ? [] : [value];
236
- }
1
+ // S289: the derivation moved to @kardalum/plugin-package/reference so the one
2
+ // reference builder can call it (the SDK depends on plugin-package, never the
3
+ // reverse). The SDK's public names are unchanged; the labels stay here.
4
+ export { CAPABILITY_IDS, deriveCapabilities, isActionGated, } from "@kardalum/plugin-package/reference";
5
+ // A contribution or assertion added to the manifest and not classified in
6
+ // the derivation is a compile error here, as it was before the move.
7
+ const contributionKeysAreTotal = true;
8
+ const assertionKeysAreTotal = true;
9
+ // A manifest change that makes a field the builder already reads
10
+ // incompatible with what it expects is a compile error here (spec D3). A new
11
+ // field the builder does not read is not caught.
12
+ const manifestFeedsTheBuilder = true;
13
+ void contributionKeysAreTotal;
14
+ void assertionKeysAreTotal;
15
+ void manifestFeedsTheBuilder;
237
16
  // ---------------------------------------------------------------------------
238
- // The derivation
17
+ // Labels
239
18
  // ---------------------------------------------------------------------------
240
19
  /**
241
- * Compute a manifest's capability list.
242
- *
243
- * Accepts both a live `PluginManifest` and the redacted, JSON-safe summary
244
- * kardalum plugin writes into a package's `manifest.json`, for the same
245
- * reason `declaresClientBundle` does: the marketplace never executes
246
- * plugin code, so the only manifest it can read is the redacted one, and
247
- * the two sides of an install must not disagree about what a package
248
- * declares.
249
- *
250
- * Defensive about its input rather than trusting it. It is handed parsed
251
- * JSON from an artifact an author built, so a missing or wrongly-shaped
252
- * field degrades to "declares nothing" for that field instead of throwing
253
- * inside a review queue listing.
20
+ * S289 (S347): the one sentence every surface uses for what declaring a
21
+ * promised capability means for review. Every submission that passes
22
+ * validation reaches a reviewer whatever it declares; a promised capability
23
+ * changes what the reviewer reads, not whether one reads. The manual and
24
+ * the plugin rules file quote it verbatim after its subject, and
25
+ * promised-wording.test.ts holds them to it.
254
26
  */
255
- export function deriveCapabilities(manifest) {
256
- if (manifest === null || typeof manifest !== "object")
257
- return [];
258
- const source = manifest;
259
- const capabilities = [];
260
- const databaseCompatibility = source.databaseCompatibility;
261
- const storageType = databaseCompatibility !== null && typeof databaseCompatibility === "object"
262
- ? databaseCompatibility.storageType
263
- : undefined;
264
- if (storageType === "structured") {
265
- capabilities.push({
266
- id: STRUCTURED_STORAGE_ID,
267
- payload: { count: 1, details: [] },
268
- mediation: "promised",
269
- });
270
- }
271
- const contributions = source.contributions !== null && typeof source.contributions === "object"
272
- ? source.contributions
273
- : {};
274
- for (const key of CONTRIBUTION_ORDER) {
275
- const entries = declaredEntries(key, contributions[key]);
276
- if (entries.length === 0)
277
- continue;
278
- const rule = CONTRIBUTION_RULES[key];
279
- if (rule.derives === "one") {
280
- capabilities.push({
281
- id: rule.id,
282
- payload: {
283
- count: entries.length,
284
- details: entries.map(describeEntry).filter((detail) => detail !== null),
285
- },
286
- mediation: rule.mediation,
287
- });
288
- continue;
289
- }
290
- // One contribution, up to three capabilities: the routes are grouped
291
- // by the tier the dispatcher will actually run them at.
292
- for (const tier of API_ROUTE_TIERS) {
293
- const routes = entries.filter((entry) => routeTier(entry !== null && typeof entry === "object" ? entry.access : undefined)
294
- .tier === tier.tier);
295
- if (routes.length === 0)
296
- continue;
297
- capabilities.push({
298
- id: tier.id,
299
- payload: {
300
- count: routes.length,
301
- details: routes.map(describeEntry).filter((detail) => detail !== null),
302
- },
303
- mediation: tier.mediation,
304
- });
305
- }
306
- }
307
- const assertions = source.assertions !== null && typeof source.assertions === "object"
308
- ? source.assertions
309
- : {};
310
- for (const [key, id] of ASSERTION_ENTRIES) {
311
- const declared = assertions[key];
312
- if (declared === null || typeof declared !== "object")
313
- continue;
314
- const reason = declared.reason;
315
- // An assertion without a readable reason is not consentable and not
316
- // checkable, so it is dropped rather than rendered as a blank line.
317
- // The SDK schema refuses it upstream; this guards a parsed artifact.
318
- if (typeof reason !== "string" || !reason.trim())
319
- continue;
320
- capabilities.push({ id, payload: { count: 1, details: [reason] }, mediation: "promised" });
321
- }
322
- return capabilities;
323
- }
27
+ export const PROMISED_CAPABILITY_SENTENCE = "is a promised capability, so a reviewer reads it against your code";
324
28
  export const CAPABILITY_LABELS = {
325
29
  "storage.structured": {
326
30
  operator: "Structured storage",
@@ -331,9 +35,6 @@ export const CAPABILITY_LABELS = {
331
35
  "admin.section": { operator: "Admin sections", shopper: "Adds admin screens" },
332
36
  "admin.railEntry": { operator: "Admin rail entries", shopper: "Adds screens to built-in sections" },
333
37
  "admin.dashboardWidget": { operator: "Dashboard widgets", shopper: "Adds dashboard widgets" },
334
- "admin.settingsPage": { operator: "Settings pages", shopper: "Adds a settings page" },
335
- "admin.contentTreeAction": { operator: "Content tree actions", shopper: "Adds content tree actions" },
336
- "admin.editorToolbarItem": { operator: "Editor toolbar items", shopper: "Adds editor toolbar buttons" },
337
38
  "render.template": { operator: "Render templates", shopper: "Ships render templates" },
338
39
  "render.asset": { operator: "Editable assets", shopper: "Ships editable assets" },
339
40
  "theme.tokens": { operator: "Theme tokens", shopper: "Restyles the admin" },
@@ -1 +1 @@
1
- export { registerPluginSlots, getPluginSection, listPluginSections, listRailEntries, getRailEntry, resetPluginSlotsForTests, type RegisteredSection, type RegisteredRailEntry, } from "./admin-section-registry.js";
1
+ export { registerPluginSlots, getPluginSection, listPluginSections, listRailEntries, getRailEntry, listDashboardWidgets, resetPluginSlotsForTests, type RegisteredSection, type RegisteredRailEntry, type RegisteredDashboardWidget, } from "./admin-section-registry.js";