@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
@@ -8,8 +8,8 @@ export declare const SnapshotResponseSchema: z.ZodObject<{
8
8
  snapshot: z.ZodObject<{
9
9
  id: z.ZodString;
10
10
  createdAt: z.ZodString;
11
- label: z.ZodString;
12
11
  createdBy: z.ZodString;
12
+ label: z.ZodString;
13
13
  description: z.ZodNullable<z.ZodString>;
14
14
  }, z.core.$strip>;
15
15
  }, z.core.$strip>;
@@ -23,8 +23,8 @@ export declare const SnapshotListResponseSchema: z.ZodObject<{
23
23
  items: z.ZodArray<z.ZodObject<{
24
24
  id: z.ZodString;
25
25
  createdAt: z.ZodString;
26
- label: z.ZodString;
27
26
  createdBy: z.ZodString;
27
+ label: z.ZodString;
28
28
  description: z.ZodNullable<z.ZodString>;
29
29
  }, z.core.$strip>>;
30
30
  nextCursor: z.ZodNullable<z.ZodString>;
@@ -34,13 +34,25 @@ export declare const RestoreSnapshotResponseSchema: z.ZodObject<{
34
34
  snapshot: z.ZodObject<{
35
35
  id: z.ZodString;
36
36
  createdAt: z.ZodString;
37
- label: z.ZodString;
38
37
  createdBy: z.ZodString;
38
+ label: z.ZodString;
39
39
  description: z.ZodNullable<z.ZodString>;
40
40
  }, z.core.$strip>;
41
41
  restoredItems: z.ZodNumber;
42
42
  }, z.core.$strip>;
43
43
  export type RestoreSnapshotResponse = z.infer<typeof RestoreSnapshotResponseSchema>;
44
+ export declare const RestoreSnapshotRequestSchema: z.ZodOptional<z.ZodNullable<z.ZodObject<{
45
+ confirm: z.ZodOptional<z.ZodBoolean>;
46
+ }, z.core.$strip>>>;
47
+ export type RestoreSnapshotRequest = NonNullable<z.infer<typeof RestoreSnapshotRequestSchema>>;
48
+ export declare const RestoreSnapshotConfirmationSchema: z.ZodObject<{
49
+ requiresConfirmation: z.ZodLiteral<true>;
50
+ label: z.ZodString;
51
+ itemCount: z.ZodNumber;
52
+ nodeCount: z.ZodNumber;
53
+ message: z.ZodString;
54
+ }, z.core.$strip>;
55
+ export type RestoreSnapshotConfirmation = z.infer<typeof RestoreSnapshotConfirmationSchema>;
44
56
  export declare const SnapshotParamsSchema: z.ZodObject<{
45
57
  id: z.ZodString;
46
58
  }, z.core.$strip>;
@@ -23,5 +23,19 @@ 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
+ // S308: restoring a snapshot repoints every captured page at once, so the route
27
+ // asks first. Nullish because Fastify hands a missing body to the validator as
28
+ // null (the note RestoreBodySchema carries); an empty or `confirm: false` body is
29
+ // the unconfirmed call and answers the plan, never the restore.
30
+ export const RestoreSnapshotRequestSchema = z.object({ confirm: z.boolean().optional() }).nullish();
31
+ // The 409 plan. itemCount is the node and culture pairs the restore writes (what
32
+ // restoredItems reports afterwards); nodeCount is the distinct pages among them.
33
+ export const RestoreSnapshotConfirmationSchema = z.object({
34
+ requiresConfirmation: z.literal(true),
35
+ label: z.string(),
36
+ itemCount: z.number().int().nonnegative(),
37
+ nodeCount: z.number().int().nonnegative(),
38
+ message: z.string(),
39
+ });
26
40
  // S301: the params of POST /snapshots/:id/restore, moved here from the route file.
27
41
  export const SnapshotParamsSchema = z.object({ id: z.string().uuid() });
@@ -23,8 +23,8 @@ export type Snapshot = z.infer<typeof SnapshotSchema>;
23
23
  export declare const SnapshotMetaSchema: z.ZodObject<{
24
24
  id: z.ZodString;
25
25
  createdAt: z.ZodString;
26
- label: z.ZodString;
27
26
  createdBy: z.ZodString;
27
+ label: z.ZodString;
28
28
  description: z.ZodNullable<z.ZodString>;
29
29
  }, z.core.$strip>;
30
30
  export type SnapshotMeta = z.infer<typeof SnapshotMetaSchema>;
@@ -0,0 +1,12 @@
1
+ import { z } from "zod";
2
+ /** True when the value holds no C0 control character and no DEL. */
3
+ export declare function hasNoControlCharacter(value: string): boolean;
4
+ export interface StrictUrlOptions {
5
+ /** The protocols the URL may name, as zod's URL check takes them (`/^https?$/`). */
6
+ protocol?: RegExp;
7
+ /** The message for a control character and for a value the URL check refuses. */
8
+ error?: string;
9
+ /** The longest value accepted, in characters. */
10
+ max?: number;
11
+ }
12
+ export declare function strictUrl(options?: StrictUrlOptions): z.ZodPipe<z.ZodString, z.ZodURL>;
@@ -0,0 +1,31 @@
1
+ import { z } from "zod";
2
+ // S314e (spec C6): one strict URL field for every URL the schemas take.
3
+ // Zod's own URL check (zod 4.6) strips a tab or a line break from a value
4
+ // before it parses it, and the WHATWG URL parser does the same, so a value
5
+ // with an embedded or trailing line feed or tab passed the check and reached
6
+ // the caller unchanged. This helper refuses every C0 control character
7
+ // (U+0000 to U+001F) and DEL (U+007F) on the raw string first, then hands the
8
+ // string to zod's URL check. The `format: uri` the URL check would have given
9
+ // the generated document is restated on the input side, where the document
10
+ // generator reads a request body from, and the output side keeps it from the
11
+ // URL check itself.
12
+ /** True when the value holds no C0 control character and no DEL. */
13
+ export function hasNoControlCharacter(value) {
14
+ for (let index = 0; index < value.length; index += 1) {
15
+ const code = value.charCodeAt(index);
16
+ if (code < 0x20 || code === 0x7f)
17
+ return false;
18
+ }
19
+ return true;
20
+ }
21
+ const CONTROL_CHARACTER_MESSAGE = "A URL must not contain control characters";
22
+ export function strictUrl(options = {}) {
23
+ const raw = options.max === undefined ? z.string() : z.string().max(options.max);
24
+ return raw
25
+ .meta({ format: "uri" })
26
+ .refine(hasNoControlCharacter, options.error ?? CONTROL_CHARACTER_MESSAGE)
27
+ .pipe(z.url({
28
+ ...(options.protocol ? { protocol: options.protocol } : {}),
29
+ ...(options.error ? { error: options.error } : {}),
30
+ }));
31
+ }
@@ -79,6 +79,20 @@ export declare const TemplateListQuerySchema: z.ZodObject<{
79
79
  documentTypeId: z.ZodOptional<z.ZodString>;
80
80
  }, z.core.$strip>;
81
81
  export type TemplateListQuery = z.infer<typeof TemplateListQuerySchema>;
82
+ export declare const TemplateListItemSchema: z.ZodObject<{
83
+ id: z.ZodString;
84
+ name: z.ZodString;
85
+ alias: z.ZodString;
86
+ kind: z.ZodEnum<{
87
+ page: "page";
88
+ layout: "layout";
89
+ partial: "partial";
90
+ }>;
91
+ documentTypeId: z.ZodNullable<z.ZodString>;
92
+ currentVersion: z.ZodNumber;
93
+ ownedBy: z.ZodNullable<z.ZodString>;
94
+ }, z.core.$strict>;
95
+ export type TemplateListItem = z.infer<typeof TemplateListItemSchema>;
82
96
  export declare const TemplateListResponseSchema: z.ZodObject<{
83
97
  items: z.ZodArray<z.ZodObject<{
84
98
  id: z.ZodString;
@@ -91,6 +105,7 @@ export declare const TemplateListResponseSchema: z.ZodObject<{
91
105
  }>;
92
106
  documentTypeId: z.ZodNullable<z.ZodString>;
93
107
  currentVersion: z.ZodNumber;
108
+ ownedBy: z.ZodNullable<z.ZodString>;
94
109
  }, z.core.$strict>>;
95
110
  nextCursor: z.ZodNullable<z.ZodString>;
96
111
  }, z.core.$strip>;
@@ -107,6 +122,95 @@ export declare const TemplateSyncReportSchema: z.ZodObject<{
107
122
  version: z.ZodNumber;
108
123
  }, z.core.$strip>>;
109
124
  healed: z.ZodArray<z.ZodString>;
110
- unmatched: z.ZodArray<z.ZodString>;
125
+ adopted: z.ZodArray<z.ZodObject<{
126
+ id: z.ZodString;
127
+ file: z.ZodString;
128
+ alias: z.ZodString;
129
+ kind: z.ZodEnum<{
130
+ page: "page";
131
+ layout: "layout";
132
+ partial: "partial";
133
+ }>;
134
+ }, z.core.$strip>>;
135
+ skipped: z.ZodArray<z.ZodObject<{
136
+ file: z.ZodString;
137
+ reason: z.ZodString;
138
+ }, z.core.$strip>>;
111
139
  }, z.core.$strip>;
112
140
  export type TemplateSyncReport = z.infer<typeof TemplateSyncReportSchema>;
141
+ export declare const TemplateVersionParamsSchema: z.ZodObject<{
142
+ id: z.ZodString;
143
+ version: z.ZodCoercedNumber<unknown>;
144
+ }, z.core.$strip>;
145
+ export type TemplateVersionParams = z.infer<typeof TemplateVersionParamsSchema>;
146
+ export declare const TemplateVersionListResponseSchema: z.ZodObject<{
147
+ items: z.ZodArray<z.ZodObject<{
148
+ id: z.ZodString;
149
+ createdAt: z.ZodString;
150
+ source: z.ZodEnum<{
151
+ admin: "admin";
152
+ "plugin-install": "plugin-install";
153
+ "file-sync": "file-sync";
154
+ }>;
155
+ templateId: z.ZodString;
156
+ version: z.ZodNumber;
157
+ hash: z.ZodString;
158
+ }, z.core.$strict>>;
159
+ nextCursor: z.ZodNullable<z.ZodNumber>;
160
+ }, z.core.$strip>;
161
+ export type TemplateVersionListResponse = z.infer<typeof TemplateVersionListResponseSchema>;
162
+ export declare const TemplateVersionResponseSchema: z.ZodObject<{
163
+ version: z.ZodObject<{
164
+ id: z.ZodString;
165
+ templateId: z.ZodString;
166
+ version: z.ZodNumber;
167
+ content: z.ZodString;
168
+ hash: z.ZodString;
169
+ source: z.ZodEnum<{
170
+ admin: "admin";
171
+ "plugin-install": "plugin-install";
172
+ "file-sync": "file-sync";
173
+ }>;
174
+ createdAt: z.ZodString;
175
+ }, z.core.$strict>;
176
+ }, z.core.$strip>;
177
+ export type TemplateVersionResponse = z.infer<typeof TemplateVersionResponseSchema>;
178
+ export declare const TemplateTrashListQuerySchema: z.ZodObject<{
179
+ cursor: z.ZodOptional<z.ZodString>;
180
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
181
+ }, z.core.$strip>;
182
+ export type TemplateTrashListQuery = z.infer<typeof TemplateTrashListQuerySchema>;
183
+ export declare const TemplateTrashListResponseSchema: z.ZodObject<{
184
+ items: z.ZodArray<z.ZodObject<{
185
+ id: z.ZodString;
186
+ name: z.ZodString;
187
+ alias: z.ZodString;
188
+ kind: z.ZodEnum<{
189
+ page: "page";
190
+ layout: "layout";
191
+ partial: "partial";
192
+ }>;
193
+ documentTypeId: z.ZodNullable<z.ZodString>;
194
+ currentVersion: z.ZodNumber;
195
+ deletedAt: z.ZodString;
196
+ }, z.core.$strict>>;
197
+ nextCursor: z.ZodNullable<z.ZodString>;
198
+ }, z.core.$strip>;
199
+ export type TemplateTrashListResponse = z.infer<typeof TemplateTrashListResponseSchema>;
200
+ export declare const RestoreTemplateResponseSchema: z.ZodObject<{
201
+ template: z.ZodObject<{
202
+ id: z.ZodString;
203
+ name: z.ZodString;
204
+ alias: z.ZodString;
205
+ kind: z.ZodEnum<{
206
+ page: "page";
207
+ layout: "layout";
208
+ partial: "partial";
209
+ }>;
210
+ documentTypeId: z.ZodNullable<z.ZodString>;
211
+ currentVersion: z.ZodNumber;
212
+ }, z.core.$strict>;
213
+ content: z.ZodString;
214
+ foldedFile: z.ZodBoolean;
215
+ }, z.core.$strip>;
216
+ export type RestoreTemplateResponse = z.infer<typeof RestoreTemplateResponseSchema>;
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
- import { TemplateAliasSchema, TemplateDefinitionSchema, TemplateKindSchema, } from "./template.schema.js";
2
+ import { TrashCursorSchema } from "./trash-cursor.schema.js";
3
+ import { TemplateAliasSchema, TemplateDefinitionSchema, TemplateKindSchema, TemplateVersionMetaSchema, TemplateVersionSchema, TrashedTemplateSchema, } from "./template.schema.js";
3
4
  // One template source file is capped at 1MB — kin of the render budget:
4
5
  // a template is code a human edits, not a data blob.
5
6
  export const MAX_TEMPLATE_CONTENT_BYTES = 1_048_576;
@@ -57,8 +58,13 @@ export const TemplateListQuerySchema = z.object({
57
58
  limit: z.coerce.number().int().min(1).max(100).default(50),
58
59
  documentTypeId: z.string().uuid().optional(),
59
60
  });
61
+ // S314g (P6): a list row names the plugin that ships the template (from the
62
+ // plugin tracking table, read by the route), or null for the operator's own.
63
+ // A route-level field: TemplateDefinitionSchema, and every adapter row mapper
64
+ // behind it, stay as they are.
65
+ export const TemplateListItemSchema = TemplateDefinitionSchema.extend({ ownedBy: z.string().min(1).nullable() });
60
66
  export const TemplateListResponseSchema = z.object({
61
- items: z.array(TemplateDefinitionSchema),
67
+ items: z.array(TemplateListItemSchema),
62
68
  nextCursor: z.string().uuid().nullable(),
63
69
  });
64
70
  // Body for PATCH /api/manage/v1/document-types/:id/default-template.
@@ -66,9 +72,43 @@ export const SetDefaultTemplateRequestSchema = z.object({
66
72
  templateId: z.string().uuid().nullable(),
67
73
  });
68
74
  // POST /api/manage/v1/templates/sync: the "Sync files" action's report.
75
+ // S314j (D3, D4, D7): `adopted` lists the .liquid files no template owned that
76
+ // became templates (the file as found, the alias it took, the kind its top
77
+ // folder gave it); `skipped` lists every file the walk did not adopt, with
78
+ // why (an alias taken, a name that cannot be an alias, over 1 MiB, too deep,
79
+ // an .html file, the folder's entry cap).
69
80
  export const TemplateSyncReportSchema = z.object({
70
81
  checked: z.number().int().min(0),
71
82
  updated: z.array(z.object({ id: z.string().uuid(), alias: z.string(), version: z.number().int() })),
72
83
  healed: z.array(z.string()),
73
- unmatched: z.array(z.string()),
84
+ adopted: z.array(z.object({ id: z.string().uuid(), file: z.string(), alias: z.string(), kind: TemplateKindSchema })),
85
+ skipped: z.array(z.object({ file: z.string(), reason: z.string() })),
74
86
  });
87
+ // S314g (D5, P3): a template's history. The list is metadata, newest first, a
88
+ // page at a time; its query is content's VersionListQuerySchema (cursor = the
89
+ // last version number of the previous page, limit 1..100, default 20) and its
90
+ // nextCursor is null once version 1 was returned.
91
+ export const TemplateVersionParamsSchema = z.object({
92
+ id: z.string().uuid(),
93
+ version: z.coerce.number().int().positive(),
94
+ });
95
+ export const TemplateVersionListResponseSchema = z.object({
96
+ items: z.array(TemplateVersionMetaSchema),
97
+ nextCursor: z.number().int().positive().nullable(),
98
+ });
99
+ // One version with its text, as content's version read answers `{ version }`.
100
+ export const TemplateVersionResponseSchema = z.object({ version: TemplateVersionSchema });
101
+ // The templates trash, newest first; the cursor is `${deletedAt}|${id}`.
102
+ export const TemplateTrashListQuerySchema = z.object({
103
+ cursor: TrashCursorSchema.optional(),
104
+ limit: z.coerce.number().int().min(1).max(100).default(50),
105
+ });
106
+ export const TemplateTrashListResponseSchema = z.object({
107
+ items: z.array(TrashedTemplateSchema),
108
+ nextCursor: z.string().nullable(),
109
+ });
110
+ // POST /templates/:id/restore. `foldedFile` is true when a file found at the
111
+ // template's alias held other text than the restored version: that text was
112
+ // kept as a file-sync version after the newest before the file was written
113
+ // back from the restored one (S314g fix wave).
114
+ export const RestoreTemplateResponseSchema = TemplateResponseSchema.extend({ foldedFile: z.boolean() });
@@ -5,6 +5,7 @@ export declare const TemplateKindSchema: z.ZodEnum<{
5
5
  partial: "partial";
6
6
  }>;
7
7
  export type TemplateKind = z.infer<typeof TemplateKindSchema>;
8
+ export declare const TEMPLATE_ALIAS_MAX_SEGMENTS = 8;
8
9
  export declare const TemplateAliasSchema: z.ZodString;
9
10
  export declare const TemplateDefinitionSchema: z.ZodObject<{
10
11
  id: z.ZodString;
@@ -20,8 +21,8 @@ export declare const TemplateDefinitionSchema: z.ZodObject<{
20
21
  }, z.core.$strict>;
21
22
  export type TemplateDefinition = z.infer<typeof TemplateDefinitionSchema>;
22
23
  export declare const TemplateVersionSourceSchema: z.ZodEnum<{
23
- "plugin-install": "plugin-install";
24
24
  admin: "admin";
25
+ "plugin-install": "plugin-install";
25
26
  "file-sync": "file-sync";
26
27
  }>;
27
28
  export type TemplateVersionSource = z.infer<typeof TemplateVersionSourceSchema>;
@@ -32,10 +33,37 @@ export declare const TemplateVersionSchema: z.ZodObject<{
32
33
  content: z.ZodString;
33
34
  hash: z.ZodString;
34
35
  source: z.ZodEnum<{
35
- "plugin-install": "plugin-install";
36
36
  admin: "admin";
37
+ "plugin-install": "plugin-install";
37
38
  "file-sync": "file-sync";
38
39
  }>;
39
40
  createdAt: z.ZodString;
40
41
  }, z.core.$strict>;
41
42
  export type TemplateVersion = z.infer<typeof TemplateVersionSchema>;
43
+ export declare const TemplateVersionMetaSchema: z.ZodObject<{
44
+ id: z.ZodString;
45
+ createdAt: z.ZodString;
46
+ source: z.ZodEnum<{
47
+ admin: "admin";
48
+ "plugin-install": "plugin-install";
49
+ "file-sync": "file-sync";
50
+ }>;
51
+ templateId: z.ZodString;
52
+ version: z.ZodNumber;
53
+ hash: z.ZodString;
54
+ }, z.core.$strict>;
55
+ export type TemplateVersionMeta = z.infer<typeof TemplateVersionMetaSchema>;
56
+ export declare const TrashedTemplateSchema: z.ZodObject<{
57
+ id: z.ZodString;
58
+ name: z.ZodString;
59
+ alias: z.ZodString;
60
+ kind: z.ZodEnum<{
61
+ page: "page";
62
+ layout: "layout";
63
+ partial: "partial";
64
+ }>;
65
+ documentTypeId: z.ZodNullable<z.ZodString>;
66
+ currentVersion: z.ZodNumber;
67
+ deletedAt: z.ZodString;
68
+ }, z.core.$strict>;
69
+ export type TrashedTemplate = z.infer<typeof TrashedTemplateSchema>;
@@ -1,18 +1,26 @@
1
1
  import { z } from "zod";
2
+ import { TEMPLATE_KINDS } from "./plugin-vocabulary.js";
2
3
  // A template's persisted identity. Content does NOT live here: the source
3
4
  // of a template is its file (`templates/<alias>.liquid`) mirrored into
4
5
  // immutable template_versions rows — see the S192 spec §5. currentVersion
5
6
  // is a pointer, exactly like content_nodes.current_version.
6
- export const TemplateKindSchema = z.enum(["page", "layout", "partial"]);
7
+ export const TemplateKindSchema = z.enum(TEMPLATE_KINDS);
7
8
  // The alias is the cross-reference key ({% layout 'x' %} / {% render 'x' %})
8
- // AND the file stem (<alias>.liquid). The regex is deliberately narrow —
9
- // lowercase kebab only — so an alias can never traverse paths or collide
10
- // case-insensitively on Windows filesystems.
9
+ // AND the file's path under templates/ (<alias>.liquid). S314j (D6, P3): it
10
+ // may name folders, "pages/about": segments of lowercase kebab joined by "/",
11
+ // at most TEMPLATE_ALIAS_MAX_SEGMENTS of them, 120 characters in all. No
12
+ // dots, no empty segment, no leading or trailing "/", so an alias can never
13
+ // traverse paths or collide case-insensitively on Windows filesystems; the
14
+ // template service still asserts the joined path stays inside its folder.
15
+ // Plugin manifests keep flat aliases (PluginTemplateAliasSchema).
16
+ export const TEMPLATE_ALIAS_MAX_SEGMENTS = 8;
17
+ const ALIAS_SEGMENT = "[a-z0-9]+(?:-[a-z0-9]+)*";
18
+ const TEMPLATE_ALIAS_REGEX = new RegExp(`^${ALIAS_SEGMENT}(?:/${ALIAS_SEGMENT}){0,${TEMPLATE_ALIAS_MAX_SEGMENTS - 1}}$`);
11
19
  export const TemplateAliasSchema = z
12
20
  .string()
13
21
  .min(1)
14
22
  .max(120)
15
- .regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, "lowercase kebab-case only");
23
+ .regex(TEMPLATE_ALIAS_REGEX, "lowercase kebab-case segments joined by /, at most 8");
16
24
  export const TemplateDefinitionSchema = z
17
25
  .object({
18
26
  id: z.string().uuid(),
@@ -37,3 +45,9 @@ export const TemplateVersionSchema = z
37
45
  createdAt: z.string().min(1),
38
46
  })
39
47
  .strict();
48
+ // S314g: a version's facts without its text, for a history list (one read
49
+ // away from the text). Strict, as TemplateVersionSchema is.
50
+ export const TemplateVersionMetaSchema = TemplateVersionSchema.omit({ content: true });
51
+ // S314g: a template in the trash, with the moment it went there; what the
52
+ // trash list shows and what a restore reads first.
53
+ export const TrashedTemplateSchema = TemplateDefinitionSchema.extend({ deletedAt: z.string().min(1) });
@@ -0,0 +1,4 @@
1
+ import { z } from "zod";
2
+ export declare const TRASH_CURSOR_MAX = 300;
3
+ export declare function isTrashCursor(value: string): boolean;
4
+ export declare const TrashCursorSchema: z.ZodString;
@@ -0,0 +1,29 @@
1
+ import { z } from "zod";
2
+ // S314c2 (D14): the one cursor of the three trash lists (content, templates, assets). A list
3
+ // answers `${deletedAt}|${id}` as `nextCursor` (an ISO timestamp, a bar, the row's id); the
4
+ // adapters split it on the first bar (splitTrashCursor) and bind both halves into the keyset
5
+ // comparison. Checked here, a cursor that is not one answers 400 at the route before any
6
+ // dialect reads it; it used to reach a timestamp comparison and answer 500.
7
+ export const TRASH_CURSOR_MAX = 300;
8
+ // S314c2 (fix wave 1): within what every dialect stores, so PostgreSQL's TIMESTAMPTZ never refuses
9
+ // the bound half: a four-digit year from 1000 to 9999 (z.iso.datetime takes 0000) and an offset of
10
+ // at most 14 hours either way (it takes up to 23:59).
11
+ const OFFSET_MAX_MINUTES = 14 * 60;
12
+ function withinStoredRange(stamp) {
13
+ const year = Number(stamp.slice(0, 4));
14
+ if (year < 1000 || year > 9999)
15
+ return false;
16
+ const offset = /([+-])(\d{2}):?(\d{2})$/.exec(stamp);
17
+ return offset === null || Number(offset[2]) * 60 + Number(offset[3]) <= OFFSET_MAX_MINUTES;
18
+ }
19
+ const IsoTimestampSchema = z.iso.datetime({ offset: true }).refine(withinStoredRange);
20
+ export function isTrashCursor(value) {
21
+ const at = value.indexOf("|");
22
+ if (at <= 0 || at === value.length - 1)
23
+ return false;
24
+ return IsoTimestampSchema.safeParse(value.slice(0, at)).success;
25
+ }
26
+ export const TrashCursorSchema = z
27
+ .string()
28
+ .max(TRASH_CURSOR_MAX)
29
+ .refine(isTrashCursor, { message: "cursor must be a nextCursor this list answered: an ISO timestamp, a bar (|) and an id" });
@@ -62,6 +62,10 @@ export declare const UpdateUserRoleResponseSchema: z.ZodObject<{
62
62
  }, z.core.$strip>;
63
63
  }, z.core.$strip>;
64
64
  export type UpdateUserRoleResponse = z.infer<typeof UpdateUserRoleResponseSchema>;
65
+ export declare const DeleteUserResponseSchema: z.ZodObject<{
66
+ deleted: z.ZodLiteral<true>;
67
+ }, z.core.$strip>;
68
+ export type DeleteUserResponse = z.infer<typeof DeleteUserResponseSchema>;
65
69
  export declare const ADMIN_LOCALES: readonly ["en", "de"];
66
70
  export type AdminLocale = (typeof ADMIN_LOCALES)[number];
67
71
  export declare const ThemeModeSchema: z.ZodEnum<{
@@ -39,6 +39,9 @@ export const UpdateUserRoleRequestSchema = z.object({
39
39
  export const UpdateUserRoleResponseSchema = z.object({
40
40
  user: UserSummarySchema,
41
41
  });
42
+ // S309: DELETE /users/:id answers this. The delete removes the account, ends its
43
+ // sessions and moves its uploads to the system account; it rewrites no authored row.
44
+ export const DeleteUserResponseSchema = z.object({ deleted: z.literal(true) });
42
45
  // The admin interface languages that actually ship. ONE list, here,
43
46
  // because three consumers have to agree: the server validates against
44
47
  // it, the admin registers a bundle per entry, and the user menu offers
@@ -0,0 +1,19 @@
1
+ import { z } from "zod";
2
+ export declare const WhoamiResponseSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
3
+ kind: z.ZodLiteral<"key">;
4
+ actions: z.ZodArray<z.ZodString>;
5
+ key: z.ZodObject<{
6
+ id: z.ZodString;
7
+ name: z.ZodString;
8
+ expiresAt: z.ZodNullable<z.ZodString>;
9
+ }, z.core.$strip>;
10
+ }, z.core.$strip>, z.ZodObject<{
11
+ kind: z.ZodLiteral<"session">;
12
+ actions: z.ZodArray<z.ZodString>;
13
+ user: z.ZodObject<{
14
+ id: z.ZodString;
15
+ name: z.ZodNullable<z.ZodString>;
16
+ role: z.ZodString;
17
+ }, z.core.$strip>;
18
+ }, z.core.$strip>], "kind">;
19
+ export type WhoamiResponse = z.infer<typeof WhoamiResponseSchema>;
@@ -0,0 +1,22 @@
1
+ import { z } from "zod";
2
+ // GET /api/manage/v1/whoami: what the calling credential is and what it may do
3
+ // (2026-10-19-s306-the-cli-skeleton-design.md section 3). Never a hash, a
4
+ // plaintext key or an email: the key is described by id, name and expiry, the
5
+ // user by id, name and role. One branch per kind, so an answer always carries
6
+ // exactly the description that matches it.
7
+ export const WhoamiResponseSchema = z.discriminatedUnion("kind", [
8
+ z.object({
9
+ kind: z.literal("key"),
10
+ // Exactly the actions the credential holds, sorted. For a key this includes
11
+ // managementApi.use, because a key that reaches the route holds it.
12
+ actions: z.array(z.string()),
13
+ key: z.object({ id: z.string().uuid(), name: z.string(), expiresAt: z.string().datetime().nullable() }),
14
+ }),
15
+ z.object({
16
+ kind: z.literal("session"),
17
+ // Exactly the actions the session holds, sorted.
18
+ actions: z.array(z.string()),
19
+ // The name is null for a user who never set one.
20
+ user: z.object({ id: z.string(), name: z.string().nullable(), role: z.string() }),
21
+ }),
22
+ ]);
@@ -23,10 +23,10 @@
23
23
  },
24
24
  "homepage": "https://kardalum.com",
25
25
  "peerDependencies": {
26
- "zod": "4.4.3"
26
+ "zod": "4.6.6"
27
27
  },
28
28
  "devDependencies": {
29
- "zod": "4.4.3"
29
+ "zod": "4.6.6"
30
30
  },
31
31
  "scripts": {
32
32
  "build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p .",
@@ -16,6 +16,7 @@ export declare const tailwindTheme: {
16
16
  artifact: Record<"string" | "base" | "text" | "border" | "strong" | "keyword" | "raised" | "muted" | "highlight", string>;
17
17
  footer: Record<"base" | "text" | "border" | "strong" | "muted", string>;
18
18
  brand: Record<"tile" | "keep", string>;
19
+ canvas: string;
19
20
  };
20
21
  fontFamily: {
21
22
  sans: string;
@@ -37,6 +37,8 @@ export const tailwindTheme = {
37
37
  artifact: scaleRefs(tokens.color.artifact, 'color-artifact'),
38
38
  footer: scaleRefs(tokens.color.footer, 'color-footer'),
39
39
  brand: scaleRefs(tokens.color.brand, 'color-brand'),
40
+ // A single colour, not a group: bg-canvas.
41
+ canvas: 'var(--color-canvas)',
40
42
  },
41
43
  fontFamily: {
42
44
  sans: 'var(--font-family-sans)',
@@ -102,6 +102,7 @@
102
102
  --color-footer-strong: #FFFFFF;
103
103
  --color-brand-tile: #113D5C;
104
104
  --color-brand-keep: #7CC0E8;
105
+ --color-canvas: #FFFFFF;
105
106
  --spacing-0: 0;
106
107
  --spacing-1: 0.25rem;
107
108
  --spacing-2: 0.5rem;
@@ -165,6 +165,9 @@ export const tokens = {
165
165
  tile: '#113D5C',
166
166
  keep: '#7CC0E8',
167
167
  },
168
+ // S314c: the visitor page's ground in the edit-on-page preview, never
169
+ // themed (see types.ts). Dark mode must not paint it.
170
+ canvas: '#FFFFFF',
168
171
  },
169
172
  typography: {
170
173
  fontFamily: {
@@ -126,7 +126,8 @@
126
126
  "brand": {
127
127
  "tile": "#113D5C",
128
128
  "keep": "#7CC0E8"
129
- }
129
+ },
130
+ "canvas": "#FFFFFF"
130
131
  },
131
132
  "typography": {
132
133
  "fontFamily": {
@@ -69,6 +69,7 @@ export interface KardalumDesignTokens {
69
69
  tile: string;
70
70
  keep: string;
71
71
  };
72
+ canvas: string;
72
73
  };
73
74
  typography: {
74
75
  fontFamily: {
@@ -39,7 +39,10 @@ const result = verifyEnvelope({ envelope, signature }, sha256, [{ keyId, publicK
39
39
 
40
40
  **Safe extraction.** `extractArtifact` unpacks a plugin `.zip` with hard
41
41
  limits on entry count, per-entry size, and total size, and rejects
42
- zip-slip-style paths (leading `/`, drive letters, `..` segments) before
42
+ zip-slip-style paths (leading `/`, drive letters, `..` segments), any name
43
+ another filesystem would read differently (a backslash, a colon, a control
44
+ or non-ASCII character, a segment ending in `.` or a space, `~` followed by
45
+ a digit), a second name for an entry, and any path held twice, before
43
46
  anything is written to disk:
44
47
 
45
48
  ```ts