@kardalum/plugin-sdk 0.16.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 (164) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/admin-section-registry.d.ts +14 -5
  3. package/dist/admin-section-registry.js +14 -4
  4. package/dist/capabilities.js +0 -3
  5. package/dist/host-entry.d.ts +1 -1
  6. package/dist/host-entry.js +1 -1
  7. package/dist/index.d.ts +2 -2
  8. package/dist/index.js +8 -8
  9. package/dist/license-verdict-keys.d.ts +4 -3
  10. package/dist/license-verdict-keys.js +4 -7
  11. package/dist/manifest-entry.d.ts +2 -2
  12. package/dist/manifest-entry.js +1 -1
  13. package/dist/manifest-schema.d.ts +51 -62
  14. package/dist/manifest-schema.js +97 -249
  15. package/dist/manifest.d.ts +41 -73
  16. package/dist/manifest.js +13 -36
  17. package/dist/plugin-screen-context.d.ts +11 -1
  18. package/dist/richtext/block-panel.js +2 -2
  19. package/dist/richtext/insert-menu.js +1 -1
  20. package/dist/richtext/style-listbox.js +4 -4
  21. package/dist/tokens/tokens.css +1 -0
  22. package/dist/tokens/tokens.json +2 -1
  23. package/dist/type-equality.d.ts +2 -0
  24. package/dist/type-equality.js +1 -0
  25. package/dist/views/html-view.js +1 -1
  26. package/dist/views/rich-text-view.js +1 -1
  27. package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.d.ts +90 -0
  28. package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +32 -1
  29. package/node_modules/@kardalum/api-schemas/dist/asset.schema.d.ts +22 -1
  30. package/node_modules/@kardalum/api-schemas/dist/asset.schema.js +50 -15
  31. package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.d.ts +204 -0
  32. package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.js +134 -0
  33. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +6 -5
  34. package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +2 -2
  35. package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.d.ts +4 -0
  36. package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.js +3 -0
  37. package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.js +2 -1
  38. package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +41 -5
  39. package/node_modules/@kardalum/api-schemas/dist/core-actions.js +23 -9
  40. package/node_modules/@kardalum/api-schemas/dist/index.d.ts +36 -20
  41. package/node_modules/@kardalum/api-schemas/dist/index.js +21 -11
  42. package/node_modules/@kardalum/api-schemas/dist/install-warnings.schema.d.ts +4 -0
  43. package/node_modules/@kardalum/api-schemas/dist/install-warnings.schema.js +8 -0
  44. package/node_modules/@kardalum/api-schemas/dist/issue-list.d.ts +6 -0
  45. package/node_modules/@kardalum/api-schemas/dist/issue-list.js +6 -0
  46. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +101 -62
  47. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +15 -4
  48. package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.d.ts +6 -2
  49. package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.js +8 -6
  50. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +1 -16
  51. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +3 -19
  52. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +13 -15
  53. package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.d.ts +17 -7
  54. package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.js +18 -8
  55. package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.d.ts +1 -1
  56. package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +97 -85
  57. package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +35 -68
  58. package/node_modules/@kardalum/api-schemas/dist/plugin-labels.d.ts +60 -0
  59. package/node_modules/@kardalum/api-schemas/dist/plugin-labels.js +116 -0
  60. package/node_modules/@kardalum/api-schemas/dist/plugin-locales.d.ts +9 -2
  61. package/node_modules/@kardalum/api-schemas/dist/plugin-locales.js +22 -7
  62. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +13 -6
  63. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +7 -1
  64. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +4 -3
  65. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +1 -1
  66. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +14 -0
  67. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +37 -1
  68. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-fields.d.ts +64 -0
  69. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-fields.js +134 -0
  70. package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.d.ts +2 -0
  71. package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.js +4 -0
  72. package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.d.ts +74 -0
  73. package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.js +132 -0
  74. package/node_modules/@kardalum/api-schemas/dist/plugin-vocabulary.d.ts +13 -0
  75. package/node_modules/@kardalum/api-schemas/dist/plugin-vocabulary.js +15 -0
  76. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +12 -3
  77. package/node_modules/@kardalum/api-schemas/dist/role.schema.d.ts +11 -0
  78. package/node_modules/@kardalum/api-schemas/dist/role.schema.js +7 -0
  79. package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.d.ts +11 -2
  80. package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.js +21 -3
  81. package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.d.ts +126 -0
  82. package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.js +70 -0
  83. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +6 -6
  84. package/node_modules/@kardalum/api-schemas/dist/sites.schema.d.ts +44 -25
  85. package/node_modules/@kardalum/api-schemas/dist/sites.schema.js +187 -48
  86. package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +15 -3
  87. package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.js +14 -0
  88. package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +1 -1
  89. package/node_modules/@kardalum/api-schemas/dist/strict-url.d.ts +12 -0
  90. package/node_modules/@kardalum/api-schemas/dist/strict-url.js +31 -0
  91. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +105 -1
  92. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +43 -3
  93. package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +30 -2
  94. package/node_modules/@kardalum/api-schemas/dist/template.schema.js +19 -5
  95. package/node_modules/@kardalum/api-schemas/dist/trash-cursor.schema.d.ts +4 -0
  96. package/node_modules/@kardalum/api-schemas/dist/trash-cursor.schema.js +29 -0
  97. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +4 -0
  98. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +3 -0
  99. package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.d.ts +19 -0
  100. package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.js +22 -0
  101. package/node_modules/@kardalum/api-schemas/package.json +2 -2
  102. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +1 -0
  103. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +2 -0
  104. package/node_modules/@kardalum/design-tokens/dist/tokens.css +1 -0
  105. package/node_modules/@kardalum/design-tokens/dist/tokens.js +3 -0
  106. package/node_modules/@kardalum/design-tokens/dist/tokens.json +2 -1
  107. package/node_modules/@kardalum/design-tokens/dist/types.d.ts +1 -0
  108. package/node_modules/@kardalum/plugin-package/README.md +4 -1
  109. package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +6 -21
  110. package/node_modules/@kardalum/plugin-package/dist/build-reference.js +13 -8
  111. package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +4 -4
  112. package/node_modules/@kardalum/plugin-package/dist/capabilities.js +9 -14
  113. package/node_modules/@kardalum/plugin-package/dist/client-bundle.d.ts +4 -0
  114. package/node_modules/@kardalum/plugin-package/dist/client-bundle.js +25 -0
  115. package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.d.ts +25 -0
  116. package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.js +203 -0
  117. package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.d.ts +3 -0
  118. package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.js +73 -0
  119. package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.d.ts +5 -0
  120. package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +60 -0
  121. package/node_modules/@kardalum/plugin-package/dist/delivery/icon-names.generated.d.ts +1 -0
  122. package/node_modules/@kardalum/plugin-package/dist/delivery/icon-names.generated.js +2052 -0
  123. package/node_modules/@kardalum/plugin-package/dist/delivery/icons.d.ts +2 -0
  124. package/node_modules/@kardalum/plugin-package/dist/delivery/icons.js +51 -0
  125. package/node_modules/@kardalum/plugin-package/dist/delivery/index.d.ts +8 -0
  126. package/node_modules/@kardalum/plugin-package/dist/delivery/index.js +7 -0
  127. package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.d.ts +17 -0
  128. package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.js +119 -0
  129. package/node_modules/@kardalum/plugin-package/dist/delivery/limits.d.ts +14 -0
  130. package/node_modules/@kardalum/plugin-package/dist/delivery/limits.js +21 -0
  131. package/node_modules/@kardalum/plugin-package/dist/delivery/locales.d.ts +5 -0
  132. package/node_modules/@kardalum/plugin-package/dist/delivery/locales.js +148 -0
  133. package/node_modules/@kardalum/plugin-package/dist/delivery/package-files.d.ts +5 -0
  134. package/node_modules/@kardalum/plugin-package/dist/delivery/package-files.js +76 -0
  135. package/node_modules/@kardalum/plugin-package/dist/delivery/registry.d.ts +22 -0
  136. package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +133 -0
  137. package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.d.ts +3 -0
  138. package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.js +90 -0
  139. package/node_modules/@kardalum/plugin-package/dist/delivery/support.d.ts +24 -0
  140. package/node_modules/@kardalum/plugin-package/dist/delivery/support.js +55 -0
  141. package/node_modules/@kardalum/plugin-package/dist/delivery/templates.d.ts +6 -0
  142. package/node_modules/@kardalum/plugin-package/dist/delivery/templates.js +158 -0
  143. package/node_modules/@kardalum/plugin-package/dist/delivery/types.d.ts +53 -0
  144. package/node_modules/@kardalum/plugin-package/dist/delivery/types.js +1 -0
  145. package/node_modules/@kardalum/plugin-package/dist/docs-contract.d.ts +3 -2
  146. package/node_modules/@kardalum/plugin-package/dist/docs-contract.js +4 -2
  147. package/node_modules/@kardalum/plugin-package/dist/extract.d.ts +92 -3
  148. package/node_modules/@kardalum/plugin-package/dist/extract.js +251 -41
  149. package/node_modules/@kardalum/plugin-package/dist/index.d.ts +9 -2
  150. package/node_modules/@kardalum/plugin-package/dist/index.js +7 -2
  151. package/node_modules/@kardalum/plugin-package/dist/manifest-entry.d.ts +5 -0
  152. package/node_modules/@kardalum/plugin-package/dist/manifest-entry.js +20 -0
  153. package/node_modules/@kardalum/plugin-package/dist/reference-entry.d.ts +1 -0
  154. package/node_modules/@kardalum/plugin-package/dist/reference-entry.js +1 -0
  155. package/node_modules/@kardalum/plugin-package/dist/sample-content.d.ts +21 -3
  156. package/node_modules/@kardalum/plugin-package/dist/sample-content.js +37 -9
  157. package/node_modules/@kardalum/plugin-package/dist/shipped-files.d.ts +39 -0
  158. package/node_modules/@kardalum/plugin-package/dist/shipped-files.js +133 -0
  159. package/node_modules/@kardalum/plugin-package/dist/shipped-locales.d.ts +7 -0
  160. package/node_modules/@kardalum/plugin-package/dist/shipped-locales.js +27 -0
  161. package/node_modules/@kardalum/plugin-package/package.json +4 -2
  162. package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +2 -2
  163. package/node_modules/@kardalum/ui/package.json +1 -1
  164. package/package.json +6 -6
@@ -1,5 +1,7 @@
1
1
  import { z } from "zod";
2
- import { AssetPathSchema, MAX_ASSET_CONTENT_BYTES } from "./asset.schema.js";
2
+ import { TrashCursorSchema } from "./trash-cursor.schema.js";
3
+ import { AssetPathSchema, AssetVersionMetaSchema, AssetVersionSchema, MAX_ASSET_CONTENT_BYTES, TrashedAssetSchema } from "./asset.schema.js";
4
+ import { VersionListQuerySchema } from "./content-api.schema.js";
3
5
  // S192 asset tree browser: caps mirror the content-tree pagination
4
6
  // philosophy (never load an unbounded subtree) even though the tree
5
7
  // walk itself isn't cursor-paginated — depth/entry caps bound the work.
@@ -14,9 +16,13 @@ export const AssetTreeEntrySchema = z.object({
14
16
  registered: z.boolean(),
15
17
  pluginId: z.string().min(1).nullable(),
16
18
  });
19
+ // S314j (D1, P2): a name under public/ the walk left out, with the rule of
20
+ // AssetPathSchema it broke. Present only when the walk left something out.
21
+ export const AssetTreeSkipSchema = z.object({ path: z.string(), reason: z.string() });
17
22
  export const AssetTreeResponseSchema = z.object({
18
23
  entries: z.array(AssetTreeEntrySchema),
19
24
  truncated: z.boolean(),
25
+ skipped: z.array(AssetTreeSkipSchema).optional(),
20
26
  });
21
27
  export const AssetContentResponseSchema = z.object({
22
28
  path: AssetPathSchema,
@@ -58,3 +64,28 @@ export const AssetSyncReportSchema = z.object({
58
64
  updated: z.array(z.string()),
59
65
  healed: z.array(z.string()),
60
66
  });
67
+ // S314g (D5, P3): a registered text asset's history, addressed by its path as
68
+ // the other asset routes are. Same paging as the template history.
69
+ export const AssetVersionParamsSchema = z.object({ version: z.coerce.number().int().positive() });
70
+ export const AssetVersionListQuerySchema = VersionListQuerySchema.extend({ path: AssetPathSchema });
71
+ export const AssetVersionQuerySchema = z.object({ path: AssetPathSchema });
72
+ export const AssetVersionListResponseSchema = z.object({
73
+ items: z.array(AssetVersionMetaSchema),
74
+ nextCursor: z.number().int().positive().nullable(),
75
+ });
76
+ export const AssetVersionResponseSchema = z.object({ version: AssetVersionSchema });
77
+ export const MakeAssetVersionCurrentRequestSchema = z.object({ path: AssetPathSchema }).strict();
78
+ // The path D5 names, and the trashed row's id from the trash list: 0014 lets
79
+ // several trashed rows share one path, so the path alone cannot say which.
80
+ export const RestoreAssetRequestSchema = z.object({ path: AssetPathSchema, id: z.string().uuid() }).strict();
81
+ // The restore's answer: the asset's content response, and whether a file found
82
+ // at the path was kept as a file-sync version first (as RestoreTemplateResponse).
83
+ export const RestoreAssetResponseSchema = AssetContentResponseSchema.extend({ foldedFile: z.boolean() });
84
+ export const AssetTrashListQuerySchema = z.object({
85
+ cursor: TrashCursorSchema.optional(),
86
+ limit: z.coerce.number().int().min(1).max(100).default(50),
87
+ });
88
+ export const AssetTrashListResponseSchema = z.object({
89
+ items: z.array(TrashedAssetSchema),
90
+ nextCursor: z.string().nullable(),
91
+ });
@@ -15,10 +15,31 @@ export declare const AssetVersionSchema: z.ZodObject<{
15
15
  content: z.ZodString;
16
16
  hash: z.ZodString;
17
17
  source: z.ZodEnum<{
18
- "plugin-install": "plugin-install";
19
18
  admin: "admin";
19
+ "plugin-install": "plugin-install";
20
20
  "file-sync": "file-sync";
21
21
  }>;
22
22
  createdAt: z.ZodString;
23
23
  }, z.core.$strict>;
24
24
  export type AssetVersion = z.infer<typeof AssetVersionSchema>;
25
+ export declare const AssetVersionMetaSchema: z.ZodObject<{
26
+ id: z.ZodString;
27
+ createdAt: z.ZodString;
28
+ source: z.ZodEnum<{
29
+ admin: "admin";
30
+ "plugin-install": "plugin-install";
31
+ "file-sync": "file-sync";
32
+ }>;
33
+ version: z.ZodNumber;
34
+ hash: z.ZodString;
35
+ assetId: z.ZodString;
36
+ }, z.core.$strict>;
37
+ export type AssetVersionMeta = z.infer<typeof AssetVersionMetaSchema>;
38
+ export declare const TrashedAssetSchema: z.ZodObject<{
39
+ id: z.ZodString;
40
+ path: z.ZodString;
41
+ pluginId: z.ZodNullable<z.ZodString>;
42
+ currentVersion: z.ZodNumber;
43
+ deletedAt: z.ZodString;
44
+ }, z.core.$strict>;
45
+ export type TrashedAsset = z.infer<typeof TrashedAssetSchema>;
@@ -3,26 +3,57 @@ import { isReservedRootSlug } from "./reserved-slugs.js";
3
3
  import { TemplateVersionSourceSchema } from "./template.schema.js";
4
4
  // A registered asset: a text file under public/ whose edits are mirrored
5
5
  // into immutable asset_versions rows (S192 spec §5). Unregistered files
6
- // under public/ are just files — they never get rows here.
6
+ // under public/ are just files: they never get rows here.
7
7
  //
8
- // Path rules: relative, forward slashes, no dot-segments, no leading dot
9
- // on any segment (no hidden files), and never rooted at any
10
- // RESERVED_ROOT_SLUGS segment (kardalum, api, docs, plugin-assets, media):
11
- // the asset tree (walkPublicDir) hides every one of those roots, not just
12
- // kardalum/, so writing under e.g. media/ or api/ would create an invisible
13
- // orphan the admin UI can never see or manage again.
14
- const SEGMENT = /^[a-z0-9][a-z0-9._-]*$/i;
8
+ // Path rules (S314j, D2 and P1): relative, forward slashes, every segment
9
+ // made of what a URL path segment can carry (letters and digits of any
10
+ // script, space, and _ - . ~ @ + , ( ) ! $ ' = ; &), in any position except
11
+ // a leading dot: a dot-name is a hidden file the asset tree (walkPublicDir)
12
+ // never lists, so a write there would be an invisible orphan. Refused:
13
+ // control characters, "\", "%", "?", "#", an empty segment and the dot
14
+ // segments. Never rooted at any RESERVED_ROOT_SLUGS segment (kardalum, api,
15
+ // docs, plugin-assets, media, kardalum-edit): the tree hides every one of
16
+ // those roots for the same reason. A browser percent-encodes such names in a
17
+ // link. A segment is at most 255 UTF-8 bytes and never begins or ends with a
18
+ // space nor ends with a dot (fix wave 1, A2). Each rule carries its own
19
+ // message, because the first failing rule's message is the reason the tree
20
+ // gives for a name it does not list.
21
+ const FORBIDDEN_CHARACTER = /[\u0000-\u001f\u007f\\%?#]/;
22
+ const SEGMENT_CHARACTERS = /^[\p{L}\p{M}\p{N} _\-.~@+,()!$'=;&]+$/u;
23
+ const isPlainSegment = (segment) => segment !== "" && segment !== "." && segment !== ".." && !segment.startsWith(".");
24
+ // A file name on ext4 (NAME_MAX) and most file systems is at most 255 bytes;
25
+ // a longer segment passes the 400-character path cap and then throws
26
+ // ENAMETOOLONG after the row is created.
27
+ const MAX_SEGMENT_BYTES = 255;
28
+ // Counted by code point (this package has no TextEncoder type; see
29
+ // media-reference-use.ts): 1 to 4 bytes each, a lone surrogate as the 3 bytes
30
+ // of its replacement character.
31
+ const utf8Length = (segment) => {
32
+ let bytes = 0;
33
+ for (const ch of segment) {
34
+ const code = ch.codePointAt(0) ?? 0;
35
+ bytes += code < 0x80 ? 1 : code < 0x800 ? 2 : code < 0x10000 ? 3 : 4;
36
+ }
37
+ return bytes;
38
+ };
39
+ const segmentFitsFileSystem = (segment) => utf8Length(segment) <= MAX_SEGMENT_BYTES;
40
+ // Windows strips a trailing dot or space from a file name, so the stored path
41
+ // and the file would differ; a leading space is refused beside it, as no tool
42
+ // keeps one reliably.
43
+ const segmentKeepsItsName = (segment) => segment === "" || (!segment.startsWith(" ") && !segment.endsWith(" ") && !segment.endsWith("."));
15
44
  export const AssetPathSchema = z
16
45
  .string()
17
- .min(1)
18
- .max(400)
19
- .refine((p) => !p.includes("\\"), "forward slashes only")
20
- .refine((p) => p.split("/").every((seg) => SEGMENT.test(seg) && seg !== ".." && seg !== "."), {
21
- message: "invalid path segment",
22
- })
46
+ .min(1, "an empty path")
47
+ .max(400, "longer than 400 characters")
48
+ .refine((p) => !FORBIDDEN_CHARACTER.test(p), "contains \\, %, ?, # or a control character, which an asset name cannot carry")
49
+ .refine((p) => p.split("/").every(isPlainSegment), 'an empty, "." or ".." segment, or a name that starts with a dot (a hidden file)')
50
+ .refine((p) => p.split("/").every((segment) => segment === "" || SEGMENT_CHARACTERS.test(segment)), "a character other than letters, digits, spaces and _ - . ~ @ + , ( ) ! $ ' = ; &")
51
+ .refine((p) => p.split("/").every(segmentFitsFileSystem), "a name longer than 255 bytes (UTF-8), which a file system cannot store")
52
+ .refine((p) => p.split("/").every(segmentKeepsItsName), "a name that begins or ends with a space or ends with a dot, which Windows strips from a file name")
23
53
  .refine((p) => !isReservedRootSlug(p.split("/")[0] ?? ""), {
24
54
  message: "this path root is reserved for the server (see RESERVED_ROOT_SLUGS)",
25
- });
55
+ })
56
+ .describe("A path under public/: segments of letters, digits, spaces and _ - . ~ @ + , ( ) ! $ ' = ; & joined by /, none starting with a dot or ending with a dot or space, each at most 255 bytes, never under a reserved root.");
26
57
  export const AssetDefinitionSchema = z
27
58
  .object({
28
59
  id: z.string().uuid(),
@@ -45,3 +76,7 @@ export const AssetVersionSchema = z
45
76
  createdAt: z.string().min(1),
46
77
  })
47
78
  .strict();
79
+ // S314g: as TemplateVersionMetaSchema and TrashedTemplateSchema, for a
80
+ // registered text asset.
81
+ export const AssetVersionMetaSchema = AssetVersionSchema.omit({ content: true });
82
+ export const TrashedAssetSchema = AssetDefinitionSchema.extend({ deletedAt: z.string().min(1) });
@@ -0,0 +1,204 @@
1
+ import { z } from "zod";
2
+ /** The width every text value of an entry is capped to before the insert: VARCHAR(191) on MySQL. */
3
+ export declare const AUDIT_TEXT_MAX = 191;
4
+ /** The address column's width: an IPv6 address in its longest written form, an IPv4-mapped one. */
5
+ export declare const AUDIT_IP_MAX = 45;
6
+ /** The method column's width: every method the server routes fits in it. */
7
+ export declare const AUDIT_METHOD_MAX = 8;
8
+ /** The request id column's width: `<boot id>.<per-request part>` fits with room to spare. */
9
+ export declare const AUDIT_REQUEST_ID_MAX = 64;
10
+ /** The most bytes an entry's summary takes, serialized as JSON. Past it, keys are dropped from the end and `truncated: true` is set. */
11
+ export declare const AUDIT_SUMMARY_MAX_BYTES = 2048;
12
+ /** A month as an entry's `period` and the export's query spell it: `2026-10`. */
13
+ export declare const AUDIT_PERIOD_PATTERN: RegExp;
14
+ /** Who made the request: a signed-in person, an API key, the site's own server code (the in-process handle), or nobody verified. */
15
+ export declare const AuditActorKindSchema: z.ZodEnum<{
16
+ key: "key";
17
+ session: "session";
18
+ site: "site";
19
+ anonymous: "anonymous";
20
+ }>;
21
+ export type AuditActorKind = z.infer<typeof AuditActorKindSchema>;
22
+ /** How a request ended, by its status: success below 400, refused from 400 to 499, failed from 500. */
23
+ export declare const AuditOutcomeSchema: z.ZodEnum<{
24
+ success: "success";
25
+ refused: "refused";
26
+ failed: "failed";
27
+ }>;
28
+ export type AuditOutcome = z.infer<typeof AuditOutcomeSchema>;
29
+ /** One value of a summary: plain values and lists of strings only, so a request body can never ride along. */
30
+ export declare const AuditSummaryValueSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodArray<z.ZodString>]>;
31
+ export type AuditSummaryValue = z.infer<typeof AuditSummaryValueSchema>;
32
+ export declare const AuditEntrySchema: z.ZodObject<{
33
+ id: z.ZodString;
34
+ at: z.ZodString;
35
+ period: z.ZodString;
36
+ requestId: z.ZodString;
37
+ actorKind: z.ZodEnum<{
38
+ key: "key";
39
+ session: "session";
40
+ site: "site";
41
+ anonymous: "anonymous";
42
+ }>;
43
+ userId: z.ZodNullable<z.ZodString>;
44
+ userName: z.ZodNullable<z.ZodString>;
45
+ userEmail: z.ZodNullable<z.ZodString>;
46
+ userRole: z.ZodNullable<z.ZodString>;
47
+ keyId: z.ZodNullable<z.ZodString>;
48
+ keyName: z.ZodNullable<z.ZodString>;
49
+ keyOwnerId: z.ZodNullable<z.ZodString>;
50
+ keyOwnerName: z.ZodNullable<z.ZodString>;
51
+ keyOwnerEmail: z.ZodNullable<z.ZodString>;
52
+ ip: z.ZodString;
53
+ method: z.ZodString;
54
+ route: z.ZodString;
55
+ action: z.ZodNullable<z.ZodString>;
56
+ targetType: z.ZodNullable<z.ZodString>;
57
+ targetId: z.ZodNullable<z.ZodString>;
58
+ status: z.ZodNumber;
59
+ summary: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodArray<z.ZodString>]>>>;
60
+ }, z.core.$strip>;
61
+ export type AuditEntry = z.infer<typeof AuditEntrySchema>;
62
+ export declare const AuditListQuerySchema: z.ZodObject<{
63
+ cursor: z.ZodOptional<z.ZodString>;
64
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
65
+ from: z.ZodOptional<z.ZodString>;
66
+ to: z.ZodOptional<z.ZodString>;
67
+ actorKind: z.ZodOptional<z.ZodEnum<{
68
+ key: "key";
69
+ session: "session";
70
+ site: "site";
71
+ anonymous: "anonymous";
72
+ }>>;
73
+ userId: z.ZodOptional<z.ZodString>;
74
+ keyId: z.ZodOptional<z.ZodString>;
75
+ ip: z.ZodOptional<z.ZodString>;
76
+ method: z.ZodOptional<z.ZodString>;
77
+ route: z.ZodOptional<z.ZodString>;
78
+ action: z.ZodOptional<z.ZodString>;
79
+ status: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
80
+ outcome: z.ZodOptional<z.ZodEnum<{
81
+ success: "success";
82
+ refused: "refused";
83
+ failed: "failed";
84
+ }>>;
85
+ targetType: z.ZodOptional<z.ZodString>;
86
+ targetId: z.ZodOptional<z.ZodString>;
87
+ requestId: z.ZodOptional<z.ZodString>;
88
+ }, z.core.$strip>;
89
+ export type AuditListQuery = z.infer<typeof AuditListQuerySchema>;
90
+ export declare const AuditListResponseSchema: z.ZodObject<{
91
+ items: z.ZodArray<z.ZodObject<{
92
+ id: z.ZodString;
93
+ at: z.ZodString;
94
+ period: z.ZodString;
95
+ requestId: z.ZodString;
96
+ actorKind: z.ZodEnum<{
97
+ key: "key";
98
+ session: "session";
99
+ site: "site";
100
+ anonymous: "anonymous";
101
+ }>;
102
+ userId: z.ZodNullable<z.ZodString>;
103
+ userName: z.ZodNullable<z.ZodString>;
104
+ userEmail: z.ZodNullable<z.ZodString>;
105
+ userRole: z.ZodNullable<z.ZodString>;
106
+ keyId: z.ZodNullable<z.ZodString>;
107
+ keyName: z.ZodNullable<z.ZodString>;
108
+ keyOwnerId: z.ZodNullable<z.ZodString>;
109
+ keyOwnerName: z.ZodNullable<z.ZodString>;
110
+ keyOwnerEmail: z.ZodNullable<z.ZodString>;
111
+ ip: z.ZodString;
112
+ method: z.ZodString;
113
+ route: z.ZodString;
114
+ action: z.ZodNullable<z.ZodString>;
115
+ targetType: z.ZodNullable<z.ZodString>;
116
+ targetId: z.ZodNullable<z.ZodString>;
117
+ status: z.ZodNumber;
118
+ summary: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodArray<z.ZodString>]>>>;
119
+ }, z.core.$strip>>;
120
+ nextCursor: z.ZodNullable<z.ZodString>;
121
+ displaced: z.ZodNumber;
122
+ }, z.core.$strip>;
123
+ export type AuditListResponse = z.infer<typeof AuditListResponseSchema>;
124
+ export declare const AuditExportQuerySchema: z.ZodObject<{
125
+ period: z.ZodString;
126
+ }, z.core.$strip>;
127
+ export type AuditExportQuery = z.infer<typeof AuditExportQuerySchema>;
128
+ /** The most months retention keeps besides the current one: ten years. */
129
+ export declare const AUDIT_RETENTION_MAX_MONTHS = 120;
130
+ export declare const AuditRetentionSchema: z.ZodObject<{
131
+ retentionMonths: z.ZodNumber;
132
+ }, z.core.$strict>;
133
+ export type AuditRetention = z.infer<typeof AuditRetentionSchema>;
134
+ /** Why a pass did nothing: retention is 0, no archive folder is set, the audit log is off, or its database reads failed (`error`; the server log and the pass's own entry say why). */
135
+ export declare const AuditRetentionReasonSchema: z.ZodEnum<{
136
+ error: "error";
137
+ "retention-off": "retention-off";
138
+ "folder-unset": "folder-unset";
139
+ "log-off": "log-off";
140
+ }>;
141
+ export type AuditRetentionReason = z.infer<typeof AuditRetentionReasonSchema>;
142
+ /** What one retention pass did (S314b2, D4, D5): the months it archived, the months whose entries it removed, and the months that keep entries, with why. */
143
+ export declare const AuditPruneResponseSchema: z.ZodObject<{
144
+ startedAt: z.ZodString;
145
+ finishedAt: z.ZodString;
146
+ retentionMonths: z.ZodNumber;
147
+ reason: z.ZodNullable<z.ZodEnum<{
148
+ error: "error";
149
+ "retention-off": "retention-off";
150
+ "folder-unset": "folder-unset";
151
+ "log-off": "log-off";
152
+ }>>;
153
+ archived: z.ZodArray<z.ZodObject<{
154
+ period: z.ZodString;
155
+ rows: z.ZodNumber;
156
+ file: z.ZodString;
157
+ }, z.core.$strip>>;
158
+ pruned: z.ZodArray<z.ZodObject<{
159
+ period: z.ZodString;
160
+ rows: z.ZodNumber;
161
+ }, z.core.$strip>>;
162
+ refused: z.ZodArray<z.ZodObject<{
163
+ period: z.ZodString;
164
+ message: z.ZodString;
165
+ }, z.core.$strip>>;
166
+ rows: z.ZodNumber;
167
+ }, z.core.$strip>;
168
+ export type AuditPruneResponse = z.infer<typeof AuditPruneResponseSchema>;
169
+ export declare const AuditRetentionResponseSchema: z.ZodObject<{
170
+ retentionMonths: z.ZodNumber;
171
+ folderConfigured: z.ZodBoolean;
172
+ lastPass: z.ZodNullable<z.ZodObject<{
173
+ startedAt: z.ZodString;
174
+ finishedAt: z.ZodString;
175
+ retentionMonths: z.ZodNumber;
176
+ reason: z.ZodNullable<z.ZodEnum<{
177
+ error: "error";
178
+ "retention-off": "retention-off";
179
+ "folder-unset": "folder-unset";
180
+ "log-off": "log-off";
181
+ }>>;
182
+ archived: z.ZodArray<z.ZodObject<{
183
+ period: z.ZodString;
184
+ rows: z.ZodNumber;
185
+ file: z.ZodString;
186
+ }, z.core.$strip>>;
187
+ pruned: z.ZodArray<z.ZodObject<{
188
+ period: z.ZodString;
189
+ rows: z.ZodNumber;
190
+ }, z.core.$strip>>;
191
+ refused: z.ZodArray<z.ZodObject<{
192
+ period: z.ZodString;
193
+ message: z.ZodString;
194
+ }, z.core.$strip>>;
195
+ rows: z.ZodNumber;
196
+ }, z.core.$strip>>;
197
+ }, z.core.$strip>;
198
+ export type AuditRetentionResponse = z.infer<typeof AuditRetentionResponseSchema>;
199
+ /** The 409 of Run now while a pass runs: the message and when that pass started. */
200
+ export declare const AuditPruneBusySchema: z.ZodObject<{
201
+ message: z.ZodString;
202
+ startedAt: z.ZodString;
203
+ }, z.core.$strip>;
204
+ export type AuditPruneBusy = z.infer<typeof AuditPruneBusySchema>;
@@ -0,0 +1,134 @@
1
+ import { z } from "zod";
2
+ // S314b (P7, P11, P13): the audit log as the management API answers it. An entry
3
+ // records one write attempt, or one audit export, with who made it copied as values:
4
+ // nothing in it links to a users or api_keys row, so deleting either leaves the entry
5
+ // whole. The server caps every text value at AUDIT_TEXT_MAX before the insert, except
6
+ // three columns narrower than 191 (AUDIT_IP_MAX, AUDIT_METHOD_MAX, AUDIT_REQUEST_ID_MAX),
7
+ // and the summary at AUDIT_SUMMARY_MAX_BYTES. A route states its summary itself, and a summary
8
+ // never holds a password, a key secret, a licence key, a token or a request body.
9
+ /** The width every text value of an entry is capped to before the insert: VARCHAR(191) on MySQL. */
10
+ export const AUDIT_TEXT_MAX = 191;
11
+ /** The address column's width: an IPv6 address in its longest written form, an IPv4-mapped one. */
12
+ export const AUDIT_IP_MAX = 45;
13
+ /** The method column's width: every method the server routes fits in it. */
14
+ export const AUDIT_METHOD_MAX = 8;
15
+ /** The request id column's width: `<boot id>.<per-request part>` fits with room to spare. */
16
+ export const AUDIT_REQUEST_ID_MAX = 64;
17
+ /** The most bytes an entry's summary takes, serialized as JSON. Past it, keys are dropped from the end and `truncated: true` is set. */
18
+ export const AUDIT_SUMMARY_MAX_BYTES = 2048;
19
+ /** A month as an entry's `period` and the export's query spell it: `2026-10`. */
20
+ export const AUDIT_PERIOD_PATTERN = /^\d{4}-(0[1-9]|1[0-2])$/;
21
+ /** Who made the request: a signed-in person, an API key, the site's own server code (the in-process handle), or nobody verified. */
22
+ export const AuditActorKindSchema = z.enum(["session", "key", "site", "anonymous"]);
23
+ /** How a request ended, by its status: success below 400, refused from 400 to 499, failed from 500. */
24
+ export const AuditOutcomeSchema = z.enum(["success", "refused", "failed"]);
25
+ /** One value of a summary: plain values and lists of strings only, so a request body can never ride along. */
26
+ export const AuditSummaryValueSchema = z.union([z.string(), z.number(), z.boolean(), z.null(), z.array(z.string())]);
27
+ export const AuditEntrySchema = z.object({
28
+ id: z.string().uuid(),
29
+ // When the reply was sent.
30
+ at: z.string().datetime(),
31
+ // The month of `at` in UTC, which the export selects by.
32
+ period: z.string().regex(AUDIT_PERIOD_PATTERN),
33
+ // The request's id in the server log (`reqId`), unique across restarts and instances.
34
+ requestId: z.string(),
35
+ actorKind: AuditActorKindSchema,
36
+ // A session's user as the users row read at that moment; the role is the stored role.
37
+ userId: z.string().nullable(),
38
+ userName: z.string().nullable(),
39
+ userEmail: z.string().nullable(),
40
+ userRole: z.string().nullable(),
41
+ // The key, also a refused one whose row matched (revoked, expired, or a live key on a session-only route).
42
+ keyId: z.string().nullable(),
43
+ keyName: z.string().nullable(),
44
+ // The key's creator at that moment; null for a key with no creator.
45
+ keyOwnerId: z.string().nullable(),
46
+ keyOwnerName: z.string().nullable(),
47
+ keyOwnerEmail: z.string().nullable(),
48
+ // The caller's address as the server resolved it: KARDALUM_TRUST_PROXY decides whether a proxy's header counts.
49
+ ip: z.string(),
50
+ method: z.string(),
51
+ // The registered route pattern, `/api/manage/v1/content/:id/publish`.
52
+ route: z.string(),
53
+ // The action a gate asked, or null where no gate asked one.
54
+ action: z.string().nullable(),
55
+ targetType: z.string().nullable(),
56
+ targetId: z.string().nullable(),
57
+ status: z.number().int().min(100).max(599),
58
+ summary: z.record(z.string(), AuditSummaryValueSchema).nullable(),
59
+ });
60
+ /** An exact-match filter: the value an entry holds, at most as wide as the column. */
61
+ const exactMatch = (max) => z.string().min(1).max(max).optional();
62
+ export const AuditListQuerySchema = z.object({
63
+ cursor: z.string().uuid().optional(),
64
+ limit: z.coerce.number().int().min(1).max(100).default(50),
65
+ // An inclusive range on `at`.
66
+ from: z.string().datetime().optional(),
67
+ to: z.string().datetime().optional(),
68
+ actorKind: AuditActorKindSchema.optional(),
69
+ userId: exactMatch(AUDIT_TEXT_MAX),
70
+ keyId: exactMatch(AUDIT_TEXT_MAX),
71
+ ip: exactMatch(AUDIT_IP_MAX),
72
+ method: exactMatch(AUDIT_METHOD_MAX),
73
+ route: exactMatch(AUDIT_TEXT_MAX),
74
+ action: exactMatch(AUDIT_TEXT_MAX),
75
+ status: z.coerce.number().int().min(100).max(599).optional(),
76
+ outcome: AuditOutcomeSchema.optional(),
77
+ targetType: exactMatch(AUDIT_TEXT_MAX),
78
+ targetId: exactMatch(AUDIT_TEXT_MAX),
79
+ requestId: exactMatch(AUDIT_REQUEST_ID_MAX),
80
+ });
81
+ export const AuditListResponseSchema = z.object({
82
+ // Newest first.
83
+ items: z.array(AuditEntrySchema),
84
+ // null = no more pages.
85
+ nextCursor: z.string().uuid().nullable(),
86
+ // How many entries this server process could not write since it started (D8): the write went through, its entry did not.
87
+ displaced: z.number().int().nonnegative(),
88
+ });
89
+ export const AuditExportQuerySchema = z.object({
90
+ period: z.string().regex(AUDIT_PERIOD_PATTERN, "period must be a month, YYYY-MM"),
91
+ });
92
+ /** The most months retention keeps besides the current one: ten years. */
93
+ export const AUDIT_RETENTION_MAX_MONTHS = 120;
94
+ // S314b2 (D1, P6): how many months of entries the log keeps besides the current month. 0
95
+ // keeps every entry and is the default. The archive folder is not part of the setting: it
96
+ // comes from the server's environment (KARDALUM_AUDIT_ARCHIVE_DIR), never from a request,
97
+ // so the strict object refuses any other field.
98
+ export const AuditRetentionSchema = z
99
+ .object({
100
+ retentionMonths: z.number().int().min(0).max(AUDIT_RETENTION_MAX_MONTHS),
101
+ })
102
+ .strict();
103
+ /** Why a pass did nothing: retention is 0, no archive folder is set, the audit log is off, or its database reads failed (`error`; the server log and the pass's own entry say why). */
104
+ export const AuditRetentionReasonSchema = z.enum(["retention-off", "folder-unset", "log-off", "error"]);
105
+ const AuditPeriodSchema = z.string().regex(AUDIT_PERIOD_PATTERN);
106
+ /** What one retention pass did (S314b2, D4, D5): the months it archived, the months whose entries it removed, and the months that keep entries, with why. */
107
+ export const AuditPruneResponseSchema = z.object({
108
+ startedAt: z.string().datetime(),
109
+ finishedAt: z.string().datetime(),
110
+ // The setting the pass ran with.
111
+ retentionMonths: z.number().int().min(0).max(AUDIT_RETENTION_MAX_MONTHS),
112
+ // Set when the pass did nothing at all.
113
+ reason: AuditRetentionReasonSchema.nullable(),
114
+ // Months this pass wrote to a verified file: the entries in it and the file's name in the archive folder.
115
+ archived: z.array(z.object({ period: AuditPeriodSchema, rows: z.number().int().nonnegative(), file: z.string() })),
116
+ // Months whose archived entries this pass removed from the table, with how many.
117
+ pruned: z.array(z.object({ period: AuditPeriodSchema, rows: z.number().int().nonnegative() })),
118
+ // Months that keep entries, and why: a file that did not verify, a write that failed, entries the file does not list.
119
+ refused: z.array(z.object({ period: AuditPeriodSchema, message: z.string() })),
120
+ // Entries removed in all.
121
+ rows: z.number().int().nonnegative(),
122
+ });
123
+ export const AuditRetentionResponseSchema = z.object({
124
+ retentionMonths: z.number().int().min(0).max(AUDIT_RETENTION_MAX_MONTHS),
125
+ // Whether KARDALUM_AUDIT_ARCHIVE_DIR is set. While it is not, no entry is ever removed.
126
+ folderConfigured: z.boolean(),
127
+ // What the last pass of this server process did; null after a restart.
128
+ lastPass: AuditPruneResponseSchema.nullable(),
129
+ });
130
+ /** The 409 of Run now while a pass runs: the message and when that pass started. */
131
+ export const AuditPruneBusySchema = z.object({
132
+ message: z.string(),
133
+ startedAt: z.string().datetime(),
134
+ });
@@ -74,17 +74,18 @@ export const ContentByPathResponseSchema = z.object({
74
74
  //
75
75
  // S277d: an address is a host and a path once a site can have its own
76
76
  // domain. `host` is the host to read the address on; without it the
77
- // address is read on the host this request came to. It is only compared
78
- // with the domains stored on sites, so any text is accepted: a value that
79
- // is no host reads as a host no site has claimed. The cap is the longest
80
- // request host the server looks at.
77
+ // address is read on the host this request came to. S314i: it is read as
78
+ // a site's domain is, as the public lookup reads it, so a scheme in front
79
+ // is ignored, a port selects a site whose domain was stored with that
80
+ // port, and a value that is no domain is refused with a 400. The cap is
81
+ // the longest request host the server looks at.
81
82
  export const ContentByAddressQuerySchema = z.object({
82
83
  path: z.string().min(1),
83
84
  host: z
84
85
  .string()
85
86
  .max(300)
86
87
  .optional()
87
- .describe("The host to read the address on. Defaults to the host of this request."),
88
+ .describe("The host to read the address on: a host name or an IPv4 address with an optional port. A port selects a site whose domain was stored with that port; a scheme in front is ignored. Defaults to the host of this request."),
88
89
  });
89
90
  export const ContentByAddressResponseSchema = ContentByPathResponseSchema;
90
91
  export const SaveContentRequestSchema = z.object({
@@ -16,9 +16,9 @@ export declare const ContentListColumnSchema: z.ZodDiscriminatedUnion<[z.ZodObje
16
16
  url: "url";
17
17
  id: "id";
18
18
  name: "name";
19
- updatedAt: "updatedAt";
20
19
  publishedAt: "publishedAt";
21
20
  status: "status";
21
+ updatedAt: "updatedAt";
22
22
  }>;
23
23
  }, z.core.$strict>, z.ZodObject<{
24
24
  kind: z.ZodLiteral<"field">;
@@ -33,9 +33,9 @@ export declare const ContentListSettingsSchema: z.ZodObject<{
33
33
  url: "url";
34
34
  id: "id";
35
35
  name: "name";
36
- updatedAt: "updatedAt";
37
36
  publishedAt: "publishedAt";
38
37
  status: "status";
38
+ updatedAt: "updatedAt";
39
39
  }>;
40
40
  }, z.core.$strict>, z.ZodObject<{
41
41
  kind: z.ZodLiteral<"field">;
@@ -18,3 +18,7 @@ export declare const ContentRestoreResultSchema: z.ZodObject<{
18
18
  restoredCount: z.ZodNumber;
19
19
  }, z.core.$strip>;
20
20
  export type ContentRestoreResult = z.infer<typeof ContentRestoreResultSchema>;
21
+ export declare const ContentRestoreRequestSchema: z.ZodOptional<z.ZodNullable<z.ZodObject<{
22
+ parentId: z.ZodOptional<z.ZodString>;
23
+ }, z.core.$strip>>>;
24
+ export type ContentRestoreRequest = z.infer<typeof ContentRestoreRequestSchema>;
@@ -21,3 +21,6 @@ export const ContentTrashConfirmationSchema = z.object({
21
21
  });
22
22
  export const ContentTrashResultSchema = z.object({ trashedCount: z.number().int() });
23
23
  export const ContentRestoreResultSchema = z.object({ restoredCount: z.number().int() });
24
+ // S307: restoring an orphan (a page whose parent was permanently removed) under a parent the person
25
+ // chooses. Nullish for the reason the trash body gives: Fastify hands a missing body over as null.
26
+ export const ContentRestoreRequestSchema = z.object({ parentId: z.string().uuid().optional() }).nullish();
@@ -1,10 +1,11 @@
1
1
  import { z } from "zod";
2
+ import { TrashCursorSchema } from "./trash-cursor.schema.js";
2
3
  import { NodeAccessFlagsSchema } from "./node-access.schema.js";
3
4
  // S161: the trash browse surface. Separate from content-trash-api.schema.ts
4
5
  // (S154's trash/restore confirmation bodies) — this file is the list route
5
6
  // and the restore-blocked 409, added a session later.
6
7
  export const ContentTrashListQuerySchema = z.object({
7
- cursor: z.string().optional(),
8
+ cursor: TrashCursorSchema.optional(),
8
9
  limit: z.coerce.number().int().min(1).max(100).default(50),
9
10
  });
10
11
  export const TrashedSubtreeSchema = z.object({