@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
@@ -0,0 +1,70 @@
1
+ import { z } from "zod";
2
+ import { PluginActionDeclarationSchema } from "./plugin-actions.schema.js";
3
+ import { InstallAnswersSchema, InstallInterfaceSchema } from "./plugin-install.js";
4
+ import { hasNoControlCharacter, strictUrl } from "./strict-url.js";
5
+ // S313: the body and the answer of POST /api/manage/v1/sandbox/local-plugin,
6
+ // the route a server started by `kardalum dev` registers
7
+ // (KARDALUM_SANDBOX_ATTACH, never under NODE_ENV=production). Every path names
8
+ // a directory on the server's own disk: the sandbox and the server it starts
9
+ // share one machine.
10
+ // A control character has no place in a path or a URL the server opens.
11
+ const LocalPath = z.string().min(1).max(4096).refine(hasNoControlCharacter, "A path must not contain control characters");
12
+ // The row stores remoteUrl and the admin loads it as a federation remote, so
13
+ // it is an http or https URL and nothing else. The URL parser drops a tab or a
14
+ // line break silently, and zod's own URL check strips one as well (zod 4.6),
15
+ // so the strict URL helper refuses every control character on the raw string,
16
+ // ahead of the URL check (S314e, spec C6): a URL with a trailing newline or tab
17
+ // was accepted before and is refused now.
18
+ // Fastify prefixes the field ("body/remoteUrl"), so the message does not name it.
19
+ const REMOTE_URL_MESSAGE = "must be an http or https URL";
20
+ const RemoteUrl = strictUrl({ protocol: /^https?$/, error: REMOTE_URL_MESSAGE, max: 2048 });
21
+ // S313b (W1): "ready" is the attach that installed nothing: no registry row for
22
+ // the plugin and no answers file, so the sandbox admin's install screen asks.
23
+ export const SANDBOX_ATTACH_OUTCOMES = ["installed", "activated", "already-active", "updated", "ready"];
24
+ export const SandboxAttachRequestSchema = z
25
+ .object({
26
+ pluginDir: LocalPath.describe("The plugin project's root, as an absolute path. Its install facts, templates, public files and sample content are read from here."),
27
+ bundleDir: LocalPath.describe("An absolute path to a directory holding server/plugin.js and the docs files beside it, as `kardalum plugin bundle-server` writes them. Use a new directory for every bundle: a module already imported from a path is answered from memory."),
28
+ remoteUrl: RemoteUrl.describe("The http or https URL the plugin's federation remote (remoteEntry.js) is served from."),
29
+ answersPath: LocalPath.optional().describe("An absolute path to the project's install-answers.json, read on a fresh install and, at a version bump, for the options the install record does not cover."),
30
+ })
31
+ .strict();
32
+ export const SandboxAttachResponseSchema = z.object({
33
+ pluginId: z.string(),
34
+ version: z.string(),
35
+ outcome: z.enum(SANDBOX_ATTACH_OUTCOMES),
36
+ /** The bundle directory the registry row now names. */
37
+ packagePath: z.string(),
38
+ });
39
+ // S313b (W2): what GET /api/manage/v1/sandbox/local-plugin answers: the bundle
40
+ // the last attach since the server started handed over, the install interface
41
+ // installInterfaceFor computes for it (the one a marketplace listing carries),
42
+ // the actions it declares (so the install screen names the rights an offered
43
+ // role grants by their labels), and whether a registry row exists for it.
44
+ // S313b fix wave C (C1): attachId numbers the attach the description comes
45
+ // from (one more for each attach, and above every number an earlier server
46
+ // process handed out, fix wave E, E1: a restart must not give an install
47
+ // screen opened before it the number of the next process's first attach); the
48
+ // install screen sends it back, and the install route refuses a screen built
49
+ // from an older attach.
50
+ const AttachId = z.number().int().positive();
51
+ export const SandboxLocalPluginSchema = z
52
+ .object({
53
+ pluginId: z.string(),
54
+ name: z.string(),
55
+ version: z.string(),
56
+ attachId: AttachId.describe("Numbers the attach this description comes from: send it back with the install screen's answers."),
57
+ installed: z.boolean(),
58
+ installInterface: InstallInterfaceSchema,
59
+ actions: z.array(PluginActionDeclarationSchema),
60
+ })
61
+ .strict();
62
+ // S313b (W2): the body of POST /api/manage/v1/sandbox/local-plugin/install: the
63
+ // install screen's answers, the same object every install route takes, and
64
+ // (fix wave C, C1) the attach id of the description the screen was built from.
65
+ export const SandboxLocalPluginInstallRequestSchema = z
66
+ .object({
67
+ attachId: AttachId.describe("The attachId of the GET answer the install screen was built from."),
68
+ answers: InstallAnswersSchema,
69
+ })
70
+ .strict();
@@ -5,6 +5,9 @@ export declare const BundledTemplateSchema: z.ZodObject<{
5
5
  name: z.ZodString;
6
6
  description: z.ZodOptional<z.ZodString>;
7
7
  sampleContent: z.ZodBoolean;
8
+ sampleContentDescription: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
9
+ en: z.ZodString;
10
+ }, z.core.$catchall<z.ZodString>>, unknown>>;
8
11
  }, z.core.$strip>;
9
12
  export type BundledTemplate = z.infer<typeof BundledTemplateSchema>;
10
13
  export declare const SetupStatusResponseSchema: z.ZodObject<{
@@ -15,14 +18,21 @@ export declare const SetupStatusResponseSchema: z.ZodObject<{
15
18
  name: z.ZodString;
16
19
  description: z.ZodOptional<z.ZodString>;
17
20
  sampleContent: z.ZodBoolean;
21
+ sampleContentDescription: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
22
+ en: z.ZodString;
23
+ }, z.core.$catchall<z.ZodString>>, unknown>>;
18
24
  }, z.core.$strip>>;
19
25
  databaseConfigured: z.ZodBoolean;
20
26
  }, z.core.$strip>;
21
27
  export type SetupStatusResponse = z.infer<typeof SetupStatusResponseSchema>;
22
28
  export declare const SetupStarterSelectionSchema: z.ZodObject<{
23
29
  pluginId: z.ZodString;
24
- includeSampleContent: z.ZodBoolean;
25
- }, z.core.$strip>;
30
+ answers: z.ZodOptional<z.ZodObject<{
31
+ sampleContent: z.ZodOptional<z.ZodBoolean>;
32
+ roles: z.ZodOptional<z.ZodArray<z.ZodString>>;
33
+ options: z.ZodOptional<z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodArray<z.ZodString>]>>, unknown>>;
34
+ }, z.core.$strict>>;
35
+ }, z.core.$strict>;
26
36
  export type SetupStarterSelection = z.infer<typeof SetupStarterSelectionSchema>;
27
37
  export declare const SetupCompleteRequestSchema: z.ZodObject<{
28
38
  admin: z.ZodObject<{
@@ -50,15 +60,19 @@ export declare const SetupCompleteRequestSchema: z.ZodObject<{
50
60
  }, z.core.$strip>], "dialect">>;
51
61
  starter: z.ZodOptional<z.ZodObject<{
52
62
  pluginId: z.ZodString;
53
- includeSampleContent: z.ZodBoolean;
54
- }, z.core.$strip>>;
63
+ answers: z.ZodOptional<z.ZodObject<{
64
+ sampleContent: z.ZodOptional<z.ZodBoolean>;
65
+ roles: z.ZodOptional<z.ZodArray<z.ZodString>>;
66
+ options: z.ZodOptional<z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodArray<z.ZodString>]>>, unknown>>;
67
+ }, z.core.$strict>>;
68
+ }, z.core.$strict>>;
55
69
  }, z.core.$strip>;
56
70
  export type SetupCompleteRequest = z.infer<typeof SetupCompleteRequestSchema>;
57
71
  export declare const SetupStarterResultSchema: z.ZodObject<{
58
72
  pluginId: z.ZodString;
59
73
  outcome: z.ZodEnum<{
60
- installed: "installed";
61
74
  failed: "failed";
75
+ installed: "installed";
62
76
  }>;
63
77
  reason: z.ZodOptional<z.ZodString>;
64
78
  sampleContent: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -76,6 +90,14 @@ export declare const SetupStarterResultSchema: z.ZodObject<{
76
90
  status: z.ZodLiteral<"added">;
77
91
  count: z.ZodNumber;
78
92
  }, z.core.$strip>], "status">>;
93
+ roles: z.ZodOptional<z.ZodArray<z.ZodObject<{
94
+ id: z.ZodString;
95
+ outcome: z.ZodEnum<{
96
+ failed: "failed";
97
+ created: "created";
98
+ "already-exists": "already-exists";
99
+ }>;
100
+ }, z.core.$strip>>>;
79
101
  }, z.core.$strip>;
80
102
  export type SetupStarterResult = z.infer<typeof SetupStarterResultSchema>;
81
103
  export declare const SetupCompleteResponseSchema: z.ZodObject<{
@@ -83,8 +105,8 @@ export declare const SetupCompleteResponseSchema: z.ZodObject<{
83
105
  starter: z.ZodOptional<z.ZodObject<{
84
106
  pluginId: z.ZodString;
85
107
  outcome: z.ZodEnum<{
86
- installed: "installed";
87
108
  failed: "failed";
109
+ installed: "installed";
88
110
  }>;
89
111
  reason: z.ZodOptional<z.ZodString>;
90
112
  sampleContent: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -102,6 +124,14 @@ export declare const SetupCompleteResponseSchema: z.ZodObject<{
102
124
  status: z.ZodLiteral<"added">;
103
125
  count: z.ZodNumber;
104
126
  }, z.core.$strip>], "status">>;
127
+ roles: z.ZodOptional<z.ZodArray<z.ZodObject<{
128
+ id: z.ZodString;
129
+ outcome: z.ZodEnum<{
130
+ failed: "failed";
131
+ created: "created";
132
+ "already-exists": "already-exists";
133
+ }>;
134
+ }, z.core.$strip>>>;
105
135
  }, z.core.$strip>>;
106
136
  configWarning: z.ZodOptional<z.ZodString>;
107
137
  }, z.core.$strip>;
@@ -1,4 +1,6 @@
1
1
  import { z } from "zod";
2
+ import { InstallAnswersSchema, InstallDescriptionSchema } from "./plugin-install.js";
3
+ import { InstallRoleOutcomeSchema } from "./plugin-install-record.schema.js";
2
4
  import { SampleContentOutcomeSchema } from "./sample-content-outcome.schema.js";
3
5
  // One bundled first-party starter template (currently only the blog
4
6
  // template — apps/server/src/setup/bundled-templates.ts) offered from the
@@ -14,6 +16,9 @@ export const BundledTemplateSchema = z.object({
14
16
  name: z.string().min(1),
15
17
  description: z.string().min(1).optional(),
16
18
  sampleContent: z.boolean(),
19
+ // S293: the template's sample-content.json `description`, for the wizard's
20
+ // checkbox.
21
+ sampleContentDescription: InstallDescriptionSchema.optional(),
17
22
  });
18
23
  export const SetupStatusResponseSchema = z.object({
19
24
  setupRequired: z.boolean(),
@@ -40,12 +45,16 @@ const ServerDialectSelectionSchema = z.object({
40
45
  password: z.string(),
41
46
  });
42
47
  // The wizard's optional starter step (Session 151): which bundled template
43
- // to install during setup completion, and whether its sample-content.json
44
- // tree should be seeded. Absent entirely = skip — never null.
45
- export const SetupStarterSelectionSchema = z.object({
48
+ // to install during setup completion. Absent entirely = skip, never null.
49
+ // S293: the starter's install answers (the wizard sends `sampleContent`), the
50
+ // same object every install door takes; strict, so a caller still sending
51
+ // `includeSampleContent` is refused rather than seeded by default.
52
+ export const SetupStarterSelectionSchema = z
53
+ .object({
46
54
  pluginId: z.string().min(1),
47
- includeSampleContent: z.boolean(),
48
- });
55
+ answers: InstallAnswersSchema.optional(),
56
+ })
57
+ .strict();
49
58
  export const SetupCompleteRequestSchema = z.object({
50
59
  admin: z.object({
51
60
  email: z.string().email(),
@@ -79,6 +88,9 @@ export const SetupStarterResultSchema = z.object({
79
88
  // sample content was asked for and the starter ships some. The starter
80
89
  // counts as installed whatever this says.
81
90
  sampleContent: SampleContentOutcomeSchema.optional(),
91
+ // S293: what the install did with each offered role its answers named;
92
+ // absent when they named none.
93
+ roles: z.array(InstallRoleOutcomeSchema).optional(),
82
94
  });
83
95
  export const SetupCompleteResponseSchema = z.object({
84
96
  success: z.literal(true),
@@ -1,37 +1,56 @@
1
1
  import { z } from "zod";
2
+ /** A site's domain in parts: what `parseSiteDomain` reads and `formatSiteDomain` writes. */
3
+ export interface SiteDomain {
4
+ /** Present only when it was typed. It is never matched, only printed (D4). */
5
+ scheme?: "http" | "https";
6
+ /** A host name or an IPv4 address, lower case, no trailing dot. */
7
+ host: string;
8
+ /** Present only when it was typed, and never the scheme's own port (nor 80 or 443 without a scheme). */
9
+ port?: number;
10
+ }
2
11
  /**
3
- * Lower-cases, trims, drops one trailing dot. Returns null when the result
4
- * is not a plain hostname (spec D3): one or more labels of a-z, 0-9 and
5
- * "-" joined by dots, no label empty, longer than 63, or starting or
6
- * ending with a dash, the whole name no longer than 253.
7
- *
8
- * So no scheme, port, path, wildcard, user or space gets through: each of
9
- * them needs a character a label cannot hold.
12
+ * Reads what a person pastes into a site's domain field (S314i D1):
13
+ * `example.com`, `www.example.com`, `http://example.com`,
14
+ * `https://www.example.com:2136`, `localhost`, `localhost:3000`,
15
+ * `127.0.0.1:3100`, a one-word host, with or without a trailing slash.
16
+ * Trims, takes an `http://` or `https://` in any letter case, drops one
17
+ * trailing slash, then reads `host[:port]`. Returns null for anything else:
18
+ * a path, a query, a fragment, a user, a wildcard, an IPv6 address, another
19
+ * scheme, a port outside 1 to 65535 or written with a leading zero.
10
20
  *
11
- * An internationalised domain is entered in its ASCII form
12
- * ("xn--bcher-kva.example"); a name with a non-ASCII character is refused.
13
- * The characters are tested BEFORE lower-casing, because lower-casing can
14
- * turn a character that is not a letter of a hostname into one (U+212A,
15
- * the Kelvin sign, becomes "k"), and two entries would then mean one host.
16
- *
17
- * A single label such as "localhost" is accepted: a local setup needs it.
18
- * An IP address is refused: a site's domain is a name, and the server's IP
19
- * is an unclaimed address, which shows the default site. A name whose last
20
- * label is a number is how an IPv4 address reads to a browser and to some
21
- * resolvers (the WHATWG URL rule), and a number there is all digits or
22
- * begins with "0x". So a name is refused when its last label is all digits
23
- * or begins with "0x" or "0X", whatever follows: "0x7f000001" is
24
- * 127.0.0.1 to a browser. No registered top-level domain begins that way.
21
+ * `www.` is kept as typed: a domain is matched as written. A port equal to
22
+ * the scheme's own (80 for http, 443 for https) is dropped, because a
23
+ * browser never sends it and the domain would otherwise match nothing.
24
+ * Without a scheme, 80 and 443 are both dropped for the same reason, so
25
+ * "example.com:443" is "example.com" and cannot sit beside
26
+ * "https://example.com" on another site. A port that is not the given
27
+ * scheme's own ("http://example.com:443") is kept: a browser sends it.
25
28
  *
26
29
  * Written with string functions only, behind a length cap, because the
27
30
  * input is whatever somebody typed or sent: no pattern is ever run over it.
28
31
  */
29
- export declare function normalizeHostname(input: string): string | null;
32
+ export declare function parseSiteDomain(input: string): SiteDomain | null;
33
+ /** The stored string of a domain: `[scheme://]host[:port]`. */
34
+ export declare function formatSiteDomain(domain: SiteDomain): string;
35
+ /**
36
+ * A stored domain without its scheme: `host[:port]`. This is what a domain
37
+ * is matched by and counted by (S314i D2, D3): `http://a.test` and
38
+ * `https://a.test` are one domain. A value with no scheme (the host of
39
+ * KARDALUM_PUBLIC_URL) comes back as it is.
40
+ */
41
+ export declare function siteDomainAuthority(domain: string): string;
42
+ /**
43
+ * The origin a link or a redirect to a stored domain is written with
44
+ * (S314i D4): the domain as stored when it carries a scheme, otherwise
45
+ * `scheme` (the request's, or KARDALUM_PUBLIC_URL's) in front of it. The
46
+ * port is the stored one, or none.
47
+ */
48
+ export declare function siteDomainOrigin(domain: string, scheme: "http" | "https"): string;
30
49
  /**
31
- * One domain of a site. Parses through `normalizeHostname`, so the output
32
- * is the stored form: lower-case, no trailing dot.
50
+ * One domain of a site. Parses through `parseSiteDomain`, so the output is
51
+ * the stored form, and a stored domain parses to itself.
33
52
  */
34
- export declare const HostnameSchema: z.ZodType<string, string>;
53
+ export declare const SiteDomainSchema: z.ZodType<string, string>;
35
54
  export declare const MAX_HOSTNAMES_PER_SITE = 20;
36
55
  /**
37
56
  * The domains of one site, in order: the first is the site's address, and
@@ -61,13 +80,13 @@ export declare const SitesSettingsSchema: z.ZodObject<{
61
80
  }, z.core.$strip>>>;
62
81
  }, z.core.$strip>;
63
82
  export type SitesSettings = z.infer<typeof SitesSettingsSchema>;
64
- /** The body of PUT /api/settings/sites/default. Null clears the pin. */
83
+ /** The body of PUT /api/manage/v1/settings/sites/default. Null clears the pin. */
65
84
  export declare const SetDefaultSiteRequestSchema: z.ZodObject<{
66
85
  defaultSiteId: z.ZodNullable<z.ZodString>;
67
86
  }, z.core.$strip>;
68
87
  export type SetDefaultSiteRequest = z.infer<typeof SetDefaultSiteRequestSchema>;
69
88
  /**
70
- * The body of PUT /api/settings/sites/:siteId/hostnames: the site's whole
89
+ * The body of PUT /api/manage/v1/settings/sites/:siteId/hostnames: the site's whole
71
90
  * list, in order. An empty list takes every domain off the site.
72
91
  */
73
92
  export declare const SetSiteHostnamesRequestSchema: z.ZodObject<{
@@ -94,7 +113,7 @@ export declare const SiteSummarySchema: z.ZodObject<{
94
113
  }, z.core.$strip>;
95
114
  export type SiteSummary = z.infer<typeof SiteSummarySchema>;
96
115
  /**
97
- * What GET /api/settings/sites and the two writes answer: the stored pin,
116
+ * What GET /api/manage/v1/settings/sites and the two writes answer: the stored pin,
98
117
  * and beside it the default site that pin (or, with nothing pinned, tree
99
118
  * order) gives a visitor right now. Null when there is none: a pin whose
100
119
  * node is in the trash or not published, or a tree with nothing published.
@@ -104,7 +123,7 @@ export type SiteSummary = z.infer<typeof SiteSummarySchema>;
104
123
  * `sites` is every site that has at least one domain, plus the default
105
124
  * site even when it has none: the stored record, which is what an address
106
125
  * is worked out from. It is bounded by that record and is not a list of
107
- * every top-level page; GET /api/sites is that list. `requestHost` is the
126
+ * every top-level page; GET /api/manage/v1/sites is that list. `requestHost` is the
108
127
  * host the server sees for this very request (spec D10): behind a proxy
109
128
  * that does not pass the domain on it differs from the browser's, and
110
129
  * that is the one place it shows.
@@ -135,9 +154,9 @@ export declare const SitesSettingsResponseSchema: z.ZodObject<{
135
154
  }, z.core.$strip>;
136
155
  export type SitesSettingsResponse = z.infer<typeof SitesSettingsResponseSchema>;
137
156
  /**
138
- * The query of GET /api/sites. The cursor is the id of the previous page's
157
+ * The query of GET /api/manage/v1/sites. The cursor is the id of the previous page's
139
158
  * last row, the convention of the content tree's own lists
140
- * (GET /api/content/roots).
159
+ * (GET /api/manage/v1/content/roots).
141
160
  */
142
161
  export declare const SiteListQuerySchema: z.ZodObject<{
143
162
  cursor: z.ZodOptional<z.ZodString>;
@@ -160,7 +179,7 @@ export declare const SiteListRowSchema: z.ZodObject<{
160
179
  published: z.ZodBoolean;
161
180
  }, z.core.$strip>;
162
181
  export type SiteListRow = z.infer<typeof SiteListRowSchema>;
163
- /** What GET /api/sites answers: one page of top-level pages in tree order. */
182
+ /** What GET /api/manage/v1/sites answers: one page of top-level pages in tree order. */
164
183
  export declare const SiteListResponseSchema: z.ZodObject<{
165
184
  items: z.ZodArray<z.ZodObject<{
166
185
  siteId: z.ZodString;
@@ -223,7 +242,7 @@ export declare function siteAddress(site: {
223
242
  isDefault: boolean;
224
243
  }, defaultHost: string | null, storedPath: string, options?: SiteAddressOptions): SiteAddress | null;
225
244
  /**
226
- * The address of a stored path, worked out from what GET /api/settings/sites
245
+ * The address of a stored path, worked out from what GET /api/manage/v1/settings/sites
227
246
  * answers, for a page the server cannot be asked about because nothing is
228
247
  * stored at it yet (a page being created, a name being typed).
229
248
  *