@kardalum/plugin-sdk 0.15.0 → 0.16.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 (101) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/README.md +10 -0
  3. package/dist/built-in-value-schemas.js +1 -1
  4. package/dist/built-ins.js +2 -2
  5. package/dist/capabilities.d.ts +8 -78
  6. package/dist/capabilities.js +23 -319
  7. package/dist/index.d.ts +4 -4
  8. package/dist/index.js +5 -4
  9. package/dist/license-verdict-keys.js +4 -0
  10. package/dist/manifest-entry.d.ts +2 -2
  11. package/dist/manifest-entry.js +1 -1
  12. package/dist/manifest-schema.d.ts +81 -13
  13. package/dist/manifest-schema.js +108 -59
  14. package/dist/manifest.d.ts +105 -40
  15. package/dist/media/media-picker.js +21 -12
  16. package/dist/media/upload-error.d.ts +1 -1
  17. package/dist/media/upload-error.js +1 -1
  18. package/dist/plugin-context.d.ts +7 -0
  19. package/dist/plugin-context.js +7 -0
  20. package/dist/plugin-screen-context.d.ts +33 -2
  21. package/dist/plugin-screen-context.js +27 -2
  22. package/dist/read-all-pages.d.ts +23 -0
  23. package/dist/read-all-pages.js +30 -0
  24. package/dist/richtext/block-panel.js +4 -4
  25. package/dist/richtext/insert-menu.js +3 -3
  26. package/dist/views/content-list-view.js +2 -2
  27. package/dist/views/image-view.js +24 -39
  28. package/dist/views/rich-text-view.js +2 -2
  29. package/node_modules/@kardalum/api-schemas/dist/api-error.schema.d.ts +12 -0
  30. package/node_modules/@kardalum/api-schemas/dist/api-error.schema.js +19 -0
  31. package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.d.ts +43 -25
  32. package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.js +60 -8
  33. package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +1 -1
  34. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +5 -0
  35. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +12 -8
  36. package/node_modules/@kardalum/api-schemas/dist/content-list.schema.js +1 -1
  37. package/node_modules/@kardalum/api-schemas/dist/content-path.js +11 -7
  38. package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.d.ts +1 -0
  39. package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +107 -57
  40. package/node_modules/@kardalum/api-schemas/dist/core-actions.js +96 -60
  41. package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +1 -0
  42. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +2 -0
  43. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +1 -1
  44. package/node_modules/@kardalum/api-schemas/dist/index.d.ts +39 -28
  45. package/node_modules/@kardalum/api-schemas/dist/index.js +19 -13
  46. package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.d.ts +73 -0
  47. package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.js +104 -0
  48. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +302 -1
  49. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +78 -6
  50. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +10 -0
  51. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +38 -30
  52. package/node_modules/@kardalum/api-schemas/dist/media-rendition.schema.js +2 -2
  53. package/node_modules/@kardalum/api-schemas/dist/media.schema.js +1 -1
  54. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +82 -2
  55. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.js +4 -0
  56. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +88 -5
  57. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +79 -17
  58. package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.d.ts +69 -0
  59. package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.js +59 -0
  60. package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +585 -0
  61. package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +536 -0
  62. package/node_modules/@kardalum/api-schemas/dist/plugin-locales.d.ts +75 -0
  63. package/node_modules/@kardalum/api-schemas/dist/plugin-locales.js +213 -0
  64. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +25 -3
  65. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +21 -1
  66. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +7 -0
  67. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +16 -3
  68. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +44 -0
  69. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +162 -0
  70. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +8 -0
  71. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +11 -1
  72. package/node_modules/@kardalum/api-schemas/dist/render-editing.d.ts +4 -4
  73. package/node_modules/@kardalum/api-schemas/dist/role.schema.d.ts +6 -0
  74. package/node_modules/@kardalum/api-schemas/dist/role.schema.js +6 -0
  75. package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.d.ts +35 -0
  76. package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.js +79 -0
  77. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +36 -6
  78. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +17 -5
  79. package/node_modules/@kardalum/api-schemas/dist/sites.schema.d.ts +8 -8
  80. package/node_modules/@kardalum/api-schemas/dist/sites.schema.js +8 -8
  81. package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +4 -0
  82. package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.js +2 -0
  83. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +4 -4
  84. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +11 -3
  85. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +5 -0
  86. package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +111 -0
  87. package/node_modules/@kardalum/plugin-package/dist/build-reference.js +61 -0
  88. package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +103 -0
  89. package/node_modules/@kardalum/plugin-package/dist/capabilities.js +351 -0
  90. package/node_modules/@kardalum/plugin-package/dist/index.d.ts +3 -1
  91. package/node_modules/@kardalum/plugin-package/dist/index.js +2 -1
  92. package/node_modules/@kardalum/plugin-package/dist/reference-entry.d.ts +2 -0
  93. package/node_modules/@kardalum/plugin-package/dist/reference-entry.js +6 -0
  94. package/node_modules/@kardalum/plugin-package/dist/sample-content.d.ts +20 -1
  95. package/node_modules/@kardalum/plugin-package/dist/sample-content.js +56 -16
  96. package/node_modules/@kardalum/plugin-package/dist/types.d.ts +4 -6
  97. package/node_modules/@kardalum/plugin-package/dist/types.js +15 -1
  98. package/node_modules/@kardalum/plugin-package/package.json +5 -0
  99. package/node_modules/@kardalum/ui/dist/components/checkbox.js +2 -2
  100. package/node_modules/@kardalum/ui/dist/components/property-field.js +4 -1
  101. package/package.json +2 -2
@@ -13,8 +13,8 @@ export declare const BlockParamTypeSchema: z.ZodEnum<{
13
13
  number: "number";
14
14
  boolean: "boolean";
15
15
  text: "text";
16
- textarea: "textarea";
17
16
  image: "image";
17
+ textarea: "textarea";
18
18
  choice: "choice";
19
19
  }>;
20
20
  export type BlockParamType = z.infer<typeof BlockParamTypeSchema>;
@@ -24,8 +24,8 @@ export declare const BlockParamSchema: z.ZodObject<{
24
24
  number: "number";
25
25
  boolean: "boolean";
26
26
  text: "text";
27
- textarea: "textarea";
28
27
  image: "image";
28
+ textarea: "textarea";
29
29
  choice: "choice";
30
30
  }>;
31
31
  label: z.ZodString;
@@ -41,8 +41,8 @@ export declare const BlockListingSchema: z.ZodObject<{
41
41
  number: "number";
42
42
  boolean: "boolean";
43
43
  text: "text";
44
- textarea: "textarea";
45
44
  image: "image";
45
+ textarea: "textarea";
46
46
  choice: "choice";
47
47
  }>;
48
48
  label: z.ZodString;
@@ -59,8 +59,8 @@ export declare const BlockListResponseSchema: z.ZodArray<z.ZodObject<{
59
59
  number: "number";
60
60
  boolean: "boolean";
61
61
  text: "text";
62
- textarea: "textarea";
63
62
  image: "image";
63
+ textarea: "textarea";
64
64
  choice: "choice";
65
65
  }>;
66
66
  label: z.ZodString;
@@ -21,6 +21,7 @@ export declare const ActionSummarySchema: z.ZodObject<{
21
21
  source: z.ZodString;
22
22
  sourceLabel: z.ZodString;
23
23
  active: z.ZodBoolean;
24
+ keyNote: z.ZodNullable<z.ZodString>;
24
25
  }, z.core.$strip>;
25
26
  export type ActionSummary = z.infer<typeof ActionSummarySchema>;
26
27
  export declare const ActionListResponseSchema: z.ZodObject<{
@@ -30,6 +31,7 @@ export declare const ActionListResponseSchema: z.ZodObject<{
30
31
  source: z.ZodString;
31
32
  sourceLabel: z.ZodString;
32
33
  active: z.ZodBoolean;
34
+ keyNote: z.ZodNullable<z.ZodString>;
33
35
  }, z.core.$strip>>;
34
36
  }, z.core.$strip>;
35
37
  export type ActionListResponse = z.infer<typeof ActionListResponseSchema>;
@@ -88,3 +90,7 @@ export declare const DeleteRoleResponseSchema: z.ZodObject<{
88
90
  deleted: z.ZodLiteral<true>;
89
91
  }, z.core.$strip>;
90
92
  export type DeleteRoleResponse = z.infer<typeof DeleteRoleResponseSchema>;
93
+ export declare const RoleParamsSchema: z.ZodObject<{
94
+ id: z.ZodString;
95
+ }, z.core.$strip>;
96
+ export type RoleParams = z.infer<typeof RoleParamsSchema>;
@@ -27,6 +27,10 @@ export const ActionSummarySchema = z.object({
27
27
  * grants stay, and the editor marks the group inactive. Core is always
28
28
  * active. */
29
29
  active: z.boolean(),
30
+ /** S303: what a holder of an API key should know the action can do, for a
31
+ * core action that has a note; null for the rest and for a plugin's. Shown in
32
+ * the key form only. */
33
+ keyNote: z.string().nullable(),
30
34
  });
31
35
  export const ActionListResponseSchema = z.object({
32
36
  items: z.array(ActionSummarySchema),
@@ -67,3 +71,5 @@ export const UpdateRoleRequestSchema = z
67
71
  });
68
72
  export const RoleResponseSchema = z.object({ role: RoleSchema });
69
73
  export const DeleteRoleResponseSchema = z.object({ deleted: z.literal(true) });
74
+ // S301: the params of PATCH and DELETE /roles/:id, moved here from the route file.
75
+ export const RoleParamsSchema = z.object({ id: RoleIdSchema });
@@ -0,0 +1,35 @@
1
+ import { z } from "zod";
2
+ /** media[].file: "media/" plus a flat, traversal-free file name. Without it,
3
+ * a file of "../../.env" would resolve outside the package and be uploaded
4
+ * as a public media record. One character class, no nesting. */
5
+ export declare const SAMPLE_CONTENT_MEDIA_FILE_PATTERN: RegExp;
6
+ export declare const SampleContentFileSchema: z.ZodObject<{
7
+ description: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
8
+ en: z.ZodString;
9
+ }, z.core.$catchall<z.ZodString>>>>;
10
+ nodes: z.ZodArray<z.ZodObject<{
11
+ documentType: z.ZodString;
12
+ slug: z.ZodString;
13
+ parent: z.ZodNullable<z.ZodString>;
14
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
15
+ }, z.core.$strict>>;
16
+ media: z.ZodOptional<z.ZodArray<z.ZodObject<{
17
+ key: z.ZodString;
18
+ file: z.ZodString;
19
+ mimeType: z.ZodString;
20
+ }, z.core.$strip>>>;
21
+ }, z.core.$strict>;
22
+ export type SampleContentFile = z.infer<typeof SampleContentFileSchema>;
23
+ export type ParsedSampleContentFile = {
24
+ ok: true;
25
+ file: SampleContentFile;
26
+ } | {
27
+ ok: false;
28
+ errors: string[];
29
+ };
30
+ /** Parsed JSON through SampleContentFileSchema, each refusal written as
31
+ * "path: message" (or the message alone at the root). A root that is not
32
+ * an object is answered here rather than by an `error` on the schema: that
33
+ * would also answer .strict()'s unknown root key, and a misspelt key would
34
+ * read "must be a JSON object" instead of being named. */
35
+ export declare function parseSampleContentFile(raw: unknown): ParsedSampleContentFile;
@@ -0,0 +1,79 @@
1
+ import { z } from "zod";
2
+ import { InstallDescriptionSchema } from "./plugin-install.js";
3
+ // S292 (2026-10-13-s292-what-the-wizard-may-ask-design.md, design 3.5):
4
+ // sample-content.json, the sample pages a plugin package may ship at its root
5
+ // beside manifest.json. Its schema used to live in the server's seeder, with
6
+ // a hand-rolled copy in the CLI and a third, best-effort reader in the build's
7
+ // media copy; it is package data read on both sides of an install, which is
8
+ // what a schema here is for. The shape is the seeder's exactly, plus
9
+ // `description`: the plugin's own words for its sample, which the install
10
+ // interface shows with the "add the sample content" question.
11
+ /** media[].file: "media/" plus a flat, traversal-free file name. Without it,
12
+ * a file of "../../.env" would resolve outside the package and be uploaded
13
+ * as a public media record. One character class, no nesting. */
14
+ export const SAMPLE_CONTENT_MEDIA_FILE_PATTERN = /^media\/[A-Za-z0-9._-]+$/;
15
+ /** media[].key: exactly what the seeder's {{media:key}} tokens can match. */
16
+ const SAMPLE_CONTENT_MEDIA_KEY_PATTERN = /^[A-Za-z0-9_-]+$/;
17
+ const NON_EMPTY = "must be a non-empty string";
18
+ const ROOT_RULE = "sample-content.json must be a JSON object";
19
+ const MEDIA_KEY_RULE = 'must be letters, digits, "_" or "-"';
20
+ const MEDIA_FILE_RULE = 'must be "media/" followed by a file name of letters, digits, ".", "_" or "-"';
21
+ /** A node or a media entry that is not an object reads "must be an object".
22
+ * The function answers only that: an unknown key on a node keeps zod's own
23
+ * words, which name the key. */
24
+ function mustBeAnObject(issue) {
25
+ return issue.code === "invalid_type" ? "must be an object" : undefined;
26
+ }
27
+ const SampleContentNodeSchema = z
28
+ .object({
29
+ documentType: z.string({ error: NON_EMPTY }).min(1, { message: NON_EMPTY }),
30
+ // Never empty, for any node (S277c). No node is stored at "/": a
31
+ // template's home page is an ordinary top-level node with a slug of its
32
+ // own, and an empty slug on a deeper node would collapse it onto its
33
+ // parent's path.
34
+ slug: z.string({ error: NON_EMPTY }).min(1, { message: NON_EMPTY }),
35
+ parent: z.string({ error: "must be a string or null" }).nullable(),
36
+ data: z.record(z.string(), z.unknown(), { error: "must be an object" }),
37
+ }, { error: mustBeAnObject })
38
+ .strict();
39
+ export const SampleContentFileSchema = z
40
+ .object({
41
+ description: InstallDescriptionSchema.optional(),
42
+ nodes: z.array(SampleContentNodeSchema, { error: "must be an array" }),
43
+ // S199: files inside the package that the install uploads into the
44
+ // media library, referenced from node data as {{media:key}} (the id)
45
+ // or {{media:key:url}} (the url). Not strict, as the seeder's never
46
+ // was: an unknown key on an entry is dropped.
47
+ media: z
48
+ .array(z.object({
49
+ key: z.string({ error: MEDIA_KEY_RULE }).regex(SAMPLE_CONTENT_MEDIA_KEY_PATTERN, { message: MEDIA_KEY_RULE }),
50
+ file: z.string({ error: MEDIA_FILE_RULE }).regex(SAMPLE_CONTENT_MEDIA_FILE_PATTERN, { message: MEDIA_FILE_RULE }),
51
+ mimeType: z.string({ error: NON_EMPTY }).min(1, { message: NON_EMPTY }),
52
+ }, { error: mustBeAnObject }), { error: "must be an array" })
53
+ .optional(),
54
+ })
55
+ .strict();
56
+ /** A Zod path the way an author reads it: nodes[0].slug. */
57
+ function pathText(path) {
58
+ let text = "";
59
+ for (const step of path) {
60
+ if (typeof step === "number")
61
+ text += `[${step}]`;
62
+ else
63
+ text += text === "" ? String(step) : `.${String(step)}`;
64
+ }
65
+ return text;
66
+ }
67
+ /** Parsed JSON through SampleContentFileSchema, each refusal written as
68
+ * "path: message" (or the message alone at the root). A root that is not
69
+ * an object is answered here rather than by an `error` on the schema: that
70
+ * would also answer .strict()'s unknown root key, and a misspelt key would
71
+ * read "must be a JSON object" instead of being named. */
72
+ export function parseSampleContentFile(raw) {
73
+ if (typeof raw !== "object" || raw === null || Array.isArray(raw))
74
+ return { ok: false, errors: [ROOT_RULE] };
75
+ const result = SampleContentFileSchema.safeParse(raw);
76
+ if (result.success)
77
+ return { ok: true, file: result.data };
78
+ return { ok: false, errors: result.error.issues.map((issue) => (issue.path.length > 0 ? `${pathText(issue.path)}: ${issue.message}` : issue.message)) };
79
+ }
@@ -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>>>>;
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>>>>;
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>]>>>>;
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>]>>>>;
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
+ created: "created";
97
+ "already-exists": "already-exists";
98
+ failed: "failed";
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
+ created: "created";
131
+ "already-exists": "already-exists";
132
+ failed: "failed";
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),
@@ -61,13 +61,13 @@ export declare const SitesSettingsSchema: z.ZodObject<{
61
61
  }, z.core.$strip>>>;
62
62
  }, z.core.$strip>;
63
63
  export type SitesSettings = z.infer<typeof SitesSettingsSchema>;
64
- /** The body of PUT /api/settings/sites/default. Null clears the pin. */
64
+ /** The body of PUT /api/manage/v1/settings/sites/default. Null clears the pin. */
65
65
  export declare const SetDefaultSiteRequestSchema: z.ZodObject<{
66
66
  defaultSiteId: z.ZodNullable<z.ZodString>;
67
67
  }, z.core.$strip>;
68
68
  export type SetDefaultSiteRequest = z.infer<typeof SetDefaultSiteRequestSchema>;
69
69
  /**
70
- * The body of PUT /api/settings/sites/:siteId/hostnames: the site's whole
70
+ * The body of PUT /api/manage/v1/settings/sites/:siteId/hostnames: the site's whole
71
71
  * list, in order. An empty list takes every domain off the site.
72
72
  */
73
73
  export declare const SetSiteHostnamesRequestSchema: z.ZodObject<{
@@ -94,7 +94,7 @@ export declare const SiteSummarySchema: z.ZodObject<{
94
94
  }, z.core.$strip>;
95
95
  export type SiteSummary = z.infer<typeof SiteSummarySchema>;
96
96
  /**
97
- * What GET /api/settings/sites and the two writes answer: the stored pin,
97
+ * What GET /api/manage/v1/settings/sites and the two writes answer: the stored pin,
98
98
  * and beside it the default site that pin (or, with nothing pinned, tree
99
99
  * order) gives a visitor right now. Null when there is none: a pin whose
100
100
  * node is in the trash or not published, or a tree with nothing published.
@@ -104,7 +104,7 @@ export type SiteSummary = z.infer<typeof SiteSummarySchema>;
104
104
  * `sites` is every site that has at least one domain, plus the default
105
105
  * site even when it has none: the stored record, which is what an address
106
106
  * 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
107
+ * every top-level page; GET /api/manage/v1/sites is that list. `requestHost` is the
108
108
  * host the server sees for this very request (spec D10): behind a proxy
109
109
  * that does not pass the domain on it differs from the browser's, and
110
110
  * that is the one place it shows.
@@ -135,9 +135,9 @@ export declare const SitesSettingsResponseSchema: z.ZodObject<{
135
135
  }, z.core.$strip>;
136
136
  export type SitesSettingsResponse = z.infer<typeof SitesSettingsResponseSchema>;
137
137
  /**
138
- * The query of GET /api/sites. The cursor is the id of the previous page's
138
+ * The query of GET /api/manage/v1/sites. The cursor is the id of the previous page's
139
139
  * last row, the convention of the content tree's own lists
140
- * (GET /api/content/roots).
140
+ * (GET /api/manage/v1/content/roots).
141
141
  */
142
142
  export declare const SiteListQuerySchema: z.ZodObject<{
143
143
  cursor: z.ZodOptional<z.ZodString>;
@@ -160,7 +160,7 @@ export declare const SiteListRowSchema: z.ZodObject<{
160
160
  published: z.ZodBoolean;
161
161
  }, z.core.$strip>;
162
162
  export type SiteListRow = z.infer<typeof SiteListRowSchema>;
163
- /** What GET /api/sites answers: one page of top-level pages in tree order. */
163
+ /** What GET /api/manage/v1/sites answers: one page of top-level pages in tree order. */
164
164
  export declare const SiteListResponseSchema: z.ZodObject<{
165
165
  items: z.ZodArray<z.ZodObject<{
166
166
  siteId: z.ZodString;
@@ -223,7 +223,7 @@ export declare function siteAddress(site: {
223
223
  isDefault: boolean;
224
224
  }, defaultHost: string | null, storedPath: string, options?: SiteAddressOptions): SiteAddress | null;
225
225
  /**
226
- * The address of a stored path, worked out from what GET /api/settings/sites
226
+ * The address of a stored path, worked out from what GET /api/manage/v1/settings/sites
227
227
  * answers, for a page the server cannot be asked about because nothing is
228
228
  * stored at it yet (a page being created, a name being typed).
229
229
  *
@@ -135,10 +135,10 @@ export const SitesSettingsSchema = z.object({
135
135
  defaultSiteId: z.string().min(1).nullable(),
136
136
  sites: z.array(SiteHostnamesSchema).default([]),
137
137
  });
138
- /** The body of PUT /api/settings/sites/default. Null clears the pin. */
138
+ /** The body of PUT /api/manage/v1/settings/sites/default. Null clears the pin. */
139
139
  export const SetDefaultSiteRequestSchema = z.object({ defaultSiteId: z.string().min(1).nullable() });
140
140
  /**
141
- * The body of PUT /api/settings/sites/:siteId/hostnames: the site's whole
141
+ * The body of PUT /api/manage/v1/settings/sites/:siteId/hostnames: the site's whole
142
142
  * list, in order. An empty list takes every domain off the site.
143
143
  */
144
144
  export const SetSiteHostnamesRequestSchema = z.object({
@@ -159,7 +159,7 @@ export const SiteSummarySchema = z.object({
159
159
  isDefault: z.boolean(),
160
160
  });
161
161
  /**
162
- * What GET /api/settings/sites and the two writes answer: the stored pin,
162
+ * What GET /api/manage/v1/settings/sites and the two writes answer: the stored pin,
163
163
  * and beside it the default site that pin (or, with nothing pinned, tree
164
164
  * order) gives a visitor right now. Null when there is none: a pin whose
165
165
  * node is in the trash or not published, or a tree with nothing published.
@@ -169,7 +169,7 @@ export const SiteSummarySchema = z.object({
169
169
  * `sites` is every site that has at least one domain, plus the default
170
170
  * site even when it has none: the stored record, which is what an address
171
171
  * is worked out from. It is bounded by that record and is not a list of
172
- * every top-level page; GET /api/sites is that list. `requestHost` is the
172
+ * every top-level page; GET /api/manage/v1/sites is that list. `requestHost` is the
173
173
  * host the server sees for this very request (spec D10): behind a proxy
174
174
  * that does not pass the domain on it differs from the browser's, and
175
175
  * that is the one place it shows.
@@ -190,9 +190,9 @@ export const SitesSettingsResponseSchema = z.object({
190
190
  defaultAddressHost: z.string().nullable(),
191
191
  });
192
192
  /**
193
- * The query of GET /api/sites. The cursor is the id of the previous page's
193
+ * The query of GET /api/manage/v1/sites. The cursor is the id of the previous page's
194
194
  * last row, the convention of the content tree's own lists
195
- * (GET /api/content/roots).
195
+ * (GET /api/manage/v1/content/roots).
196
196
  */
197
197
  export const SiteListQuerySchema = z.object({
198
198
  cursor: z.string().uuid().optional(),
@@ -213,7 +213,7 @@ export const SiteListRowSchema = z.object({
213
213
  isDefault: z.boolean(),
214
214
  published: z.boolean(),
215
215
  });
216
- /** What GET /api/sites answers: one page of top-level pages in tree order. */
216
+ /** What GET /api/manage/v1/sites answers: one page of top-level pages in tree order. */
217
217
  export const SiteListResponseSchema = z.object({
218
218
  items: z.array(SiteListRowSchema),
219
219
  // null = no more pages.
@@ -261,7 +261,7 @@ export function siteAddress(site, defaultHost, storedPath, options = {}) {
261
261
  return placeOnSite(site, defaultHost, storedPath, options.shortPathTaken === true);
262
262
  }
263
263
  /**
264
- * The address of a stored path, worked out from what GET /api/settings/sites
264
+ * The address of a stored path, worked out from what GET /api/manage/v1/settings/sites
265
265
  * answers, for a page the server cannot be asked about because nothing is
266
266
  * stored at it yet (a page being created, a name being typed).
267
267
  *
@@ -41,3 +41,7 @@ export declare const RestoreSnapshotResponseSchema: z.ZodObject<{
41
41
  restoredItems: z.ZodNumber;
42
42
  }, z.core.$strip>;
43
43
  export type RestoreSnapshotResponse = z.infer<typeof RestoreSnapshotResponseSchema>;
44
+ export declare const SnapshotParamsSchema: z.ZodObject<{
45
+ id: z.ZodString;
46
+ }, z.core.$strip>;
47
+ export type SnapshotParams = z.infer<typeof SnapshotParamsSchema>;
@@ -23,3 +23,5 @@ export const RestoreSnapshotResponseSchema = z.object({
23
23
  // How many content nodes had their pointers repointed.
24
24
  restoredItems: z.number().int().nonnegative(),
25
25
  });
26
+ // S301: the params of POST /snapshots/:id/restore, moved here from the route file.
27
+ export const SnapshotParamsSchema = z.object({ id: z.string().uuid() });
@@ -32,7 +32,7 @@ export const TemplateConflictResponseSchema = z.object({
32
32
  message: z.string(),
33
33
  currentVersion: z.number().int().min(1),
34
34
  });
35
- // DELETE /api/templates/:id two-step confirm gate, same shape as content
35
+ // DELETE /api/manage/v1/templates/:id two-step confirm gate, same shape as content
36
36
  // trash / plugin uninstall: 409 names the blast radius, then a literal
37
37
  // "true" query string confirm re-issues the delete.
38
38
  export const TemplateDeleteBlockedResponseSchema = z.object({
@@ -46,7 +46,7 @@ export const TemplateResponseSchema = z.object({
46
46
  template: TemplateDefinitionSchema,
47
47
  content: z.string(),
48
48
  });
49
- // Same shape under the historical name — POST /api/templates responds 201
49
+ // Same shape under the historical name: POST /api/manage/v1/templates responds 201
50
50
  // with it and the admin UI imports this name today.
51
51
  export const CreateTemplateResponseSchema = TemplateResponseSchema;
52
52
  // Per api-design.md, list endpoints are always cursor-paginated. The
@@ -61,11 +61,11 @@ export const TemplateListResponseSchema = z.object({
61
61
  items: z.array(TemplateDefinitionSchema),
62
62
  nextCursor: z.string().uuid().nullable(),
63
63
  });
64
- // Body for PATCH /api/document-types/:id/default-template.
64
+ // Body for PATCH /api/manage/v1/document-types/:id/default-template.
65
65
  export const SetDefaultTemplateRequestSchema = z.object({
66
66
  templateId: z.string().uuid().nullable(),
67
67
  });
68
- // POST /api/templates/sync — the "Sync files" action's report.
68
+ // POST /api/manage/v1/templates/sync: the "Sync files" action's report.
69
69
  export const TemplateSyncReportSchema = z.object({
70
70
  checked: z.number().int().min(0),
71
71
  updated: z.array(z.object({ id: z.string().uuid(), alias: z.string(), version: z.number().int() })),
@@ -5,8 +5,13 @@ export declare const UserSummarySchema: z.ZodObject<{
5
5
  name: z.ZodNullable<z.ZodString>;
6
6
  role: z.ZodString;
7
7
  createdAt: z.ZodString;
8
+ system: z.ZodBoolean;
8
9
  }, z.core.$strip>;
9
10
  export type UserSummary = z.infer<typeof UserSummarySchema>;
11
+ export declare const UserParamsSchema: z.ZodObject<{
12
+ id: z.ZodString;
13
+ }, z.core.$strip>;
14
+ export type UserParams = z.infer<typeof UserParamsSchema>;
10
15
  export declare const UserListQuerySchema: z.ZodObject<{
11
16
  cursor: z.ZodOptional<z.ZodString>;
12
17
  limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
@@ -19,6 +24,7 @@ export declare const UserListResponseSchema: z.ZodObject<{
19
24
  name: z.ZodNullable<z.ZodString>;
20
25
  role: z.ZodString;
21
26
  createdAt: z.ZodString;
27
+ system: z.ZodBoolean;
22
28
  }, z.core.$strip>>;
23
29
  nextCursor: z.ZodNullable<z.ZodString>;
24
30
  }, z.core.$strip>;
@@ -37,6 +43,7 @@ export declare const CreateUserResponseSchema: z.ZodObject<{
37
43
  name: z.ZodNullable<z.ZodString>;
38
44
  role: z.ZodString;
39
45
  createdAt: z.ZodString;
46
+ system: z.ZodBoolean;
40
47
  }, z.core.$strip>;
41
48
  }, z.core.$strip>;
42
49
  export type CreateUserResponse = z.infer<typeof CreateUserResponseSchema>;
@@ -51,15 +58,16 @@ export declare const UpdateUserRoleResponseSchema: z.ZodObject<{
51
58
  name: z.ZodNullable<z.ZodString>;
52
59
  role: z.ZodString;
53
60
  createdAt: z.ZodString;
61
+ system: z.ZodBoolean;
54
62
  }, z.core.$strip>;
55
63
  }, z.core.$strip>;
56
64
  export type UpdateUserRoleResponse = z.infer<typeof UpdateUserRoleResponseSchema>;
57
65
  export declare const ADMIN_LOCALES: readonly ["en", "de"];
58
66
  export type AdminLocale = (typeof ADMIN_LOCALES)[number];
59
67
  export declare const ThemeModeSchema: z.ZodEnum<{
68
+ system: "system";
60
69
  light: "light";
61
70
  dark: "dark";
62
- system: "system";
63
71
  }>;
64
72
  export declare const UserPreferencesSchema: z.ZodObject<{
65
73
  locale: z.ZodNullable<z.ZodEnum<{
@@ -67,9 +75,9 @@ export declare const UserPreferencesSchema: z.ZodObject<{
67
75
  de: "de";
68
76
  }>>;
69
77
  themeMode: z.ZodNullable<z.ZodEnum<{
78
+ system: "system";
70
79
  light: "light";
71
80
  dark: "dark";
72
- system: "system";
73
81
  }>>;
74
82
  themeId: z.ZodNullable<z.ZodString>;
75
83
  }, z.core.$strip>;
@@ -80,9 +88,9 @@ export declare const UpdateUserPreferencesSchema: z.ZodObject<{
80
88
  de: "de";
81
89
  }>>>;
82
90
  themeMode: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
91
+ system: "system";
83
92
  light: "light";
84
93
  dark: "dark";
85
- system: "system";
86
94
  }>>>;
87
95
  themeId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
88
96
  }, z.core.$strip>;
@@ -9,7 +9,12 @@ export const UserSummarySchema = z.object({
9
9
  name: z.string().nullable(),
10
10
  role: RoleIdSchema,
11
11
  createdAt: z.string().datetime(),
12
+ // S301: true for the one account the server writes under for an API key (the
13
+ // system account, api-author@kardalum.internal). A person's account is false.
14
+ system: z.boolean(),
12
15
  });
16
+ // S301: the params of PATCH /users/:id/role, moved here from the route file.
17
+ export const UserParamsSchema = z.object({ id: z.string().uuid() });
13
18
  export const UserListQuerySchema = z.object({
14
19
  cursor: z.string().uuid().optional(),
15
20
  limit: z.coerce.number().int().min(1).max(100).default(50),