@kardalum/plugin-sdk 0.15.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/CHANGELOG.md +49 -1
  2. package/README.md +10 -0
  3. package/dist/admin-section-registry.d.ts +14 -5
  4. package/dist/admin-section-registry.js +14 -4
  5. package/dist/built-in-value-schemas.js +1 -1
  6. package/dist/built-ins.js +2 -2
  7. package/dist/capabilities.d.ts +8 -78
  8. package/dist/capabilities.js +23 -322
  9. package/dist/host-entry.d.ts +1 -1
  10. package/dist/host-entry.js +1 -1
  11. package/dist/index.d.ts +5 -5
  12. package/dist/index.js +13 -12
  13. package/dist/license-verdict-keys.d.ts +4 -3
  14. package/dist/license-verdict-keys.js +6 -5
  15. package/dist/manifest-entry.d.ts +3 -3
  16. package/dist/manifest-entry.js +2 -2
  17. package/dist/manifest-schema.d.ts +113 -56
  18. package/dist/manifest-schema.js +192 -295
  19. package/dist/manifest.d.ts +145 -112
  20. package/dist/manifest.js +13 -36
  21. package/dist/media/media-picker.js +21 -12
  22. package/dist/media/upload-error.d.ts +1 -1
  23. package/dist/media/upload-error.js +1 -1
  24. package/dist/plugin-context.d.ts +7 -0
  25. package/dist/plugin-context.js +7 -0
  26. package/dist/plugin-screen-context.d.ts +44 -3
  27. package/dist/plugin-screen-context.js +27 -2
  28. package/dist/read-all-pages.d.ts +23 -0
  29. package/dist/read-all-pages.js +30 -0
  30. package/dist/richtext/block-panel.js +6 -6
  31. package/dist/richtext/insert-menu.js +4 -4
  32. package/dist/richtext/style-listbox.js +4 -4
  33. package/dist/tokens/tokens.css +1 -0
  34. package/dist/tokens/tokens.json +2 -1
  35. package/dist/type-equality.d.ts +2 -0
  36. package/dist/type-equality.js +1 -0
  37. package/dist/views/content-list-view.js +2 -2
  38. package/dist/views/html-view.js +1 -1
  39. package/dist/views/image-view.js +24 -39
  40. package/dist/views/rich-text-view.js +3 -3
  41. package/node_modules/@kardalum/api-schemas/dist/api-error.schema.d.ts +12 -0
  42. package/node_modules/@kardalum/api-schemas/dist/api-error.schema.js +19 -0
  43. package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.d.ts +43 -25
  44. package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.js +60 -8
  45. package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.d.ts +90 -0
  46. package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +33 -2
  47. package/node_modules/@kardalum/api-schemas/dist/asset.schema.d.ts +22 -1
  48. package/node_modules/@kardalum/api-schemas/dist/asset.schema.js +50 -15
  49. package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.d.ts +204 -0
  50. package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.js +134 -0
  51. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +5 -0
  52. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +18 -13
  53. package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +2 -2
  54. package/node_modules/@kardalum/api-schemas/dist/content-list.schema.js +1 -1
  55. package/node_modules/@kardalum/api-schemas/dist/content-path.js +11 -7
  56. package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.d.ts +4 -0
  57. package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.js +3 -0
  58. package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.d.ts +1 -0
  59. package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.js +2 -1
  60. package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +143 -57
  61. package/node_modules/@kardalum/api-schemas/dist/core-actions.js +110 -60
  62. package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +1 -0
  63. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +2 -0
  64. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +1 -1
  65. package/node_modules/@kardalum/api-schemas/dist/index.d.ts +67 -40
  66. package/node_modules/@kardalum/api-schemas/dist/index.js +35 -19
  67. package/node_modules/@kardalum/api-schemas/dist/install-warnings.schema.d.ts +4 -0
  68. package/node_modules/@kardalum/api-schemas/dist/install-warnings.schema.js +8 -0
  69. package/node_modules/@kardalum/api-schemas/dist/issue-list.d.ts +6 -0
  70. package/node_modules/@kardalum/api-schemas/dist/issue-list.js +6 -0
  71. package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.d.ts +73 -0
  72. package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.js +104 -0
  73. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +356 -16
  74. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +93 -10
  75. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +10 -0
  76. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +38 -30
  77. package/node_modules/@kardalum/api-schemas/dist/media-rendition.schema.js +2 -2
  78. package/node_modules/@kardalum/api-schemas/dist/media.schema.js +1 -1
  79. package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.d.ts +6 -2
  80. package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.js +8 -6
  81. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +69 -4
  82. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.js +4 -0
  83. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +76 -9
  84. package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +84 -24
  85. package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.d.ts +17 -7
  86. package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.js +18 -8
  87. package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.d.ts +69 -0
  88. package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.js +59 -0
  89. package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +597 -0
  90. package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +503 -0
  91. package/node_modules/@kardalum/api-schemas/dist/plugin-labels.d.ts +60 -0
  92. package/node_modules/@kardalum/api-schemas/dist/plugin-labels.js +116 -0
  93. package/node_modules/@kardalum/api-schemas/dist/plugin-locales.d.ts +82 -0
  94. package/node_modules/@kardalum/api-schemas/dist/plugin-locales.js +228 -0
  95. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +33 -4
  96. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +28 -2
  97. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +11 -3
  98. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +17 -4
  99. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +58 -0
  100. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +198 -0
  101. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-fields.d.ts +64 -0
  102. package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-fields.js +134 -0
  103. package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.d.ts +2 -0
  104. package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.js +4 -0
  105. package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.d.ts +74 -0
  106. package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.js +132 -0
  107. package/node_modules/@kardalum/api-schemas/dist/plugin-vocabulary.d.ts +13 -0
  108. package/node_modules/@kardalum/api-schemas/dist/plugin-vocabulary.js +15 -0
  109. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +8 -0
  110. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +23 -4
  111. package/node_modules/@kardalum/api-schemas/dist/render-editing.d.ts +4 -4
  112. package/node_modules/@kardalum/api-schemas/dist/role.schema.d.ts +17 -0
  113. package/node_modules/@kardalum/api-schemas/dist/role.schema.js +13 -0
  114. package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.d.ts +44 -0
  115. package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.js +97 -0
  116. package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.d.ts +126 -0
  117. package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.js +70 -0
  118. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +36 -6
  119. package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +17 -5
  120. package/node_modules/@kardalum/api-schemas/dist/sites.schema.d.ts +52 -33
  121. package/node_modules/@kardalum/api-schemas/dist/sites.schema.js +195 -56
  122. package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +19 -3
  123. package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.js +16 -0
  124. package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +1 -1
  125. package/node_modules/@kardalum/api-schemas/dist/strict-url.d.ts +12 -0
  126. package/node_modules/@kardalum/api-schemas/dist/strict-url.js +31 -0
  127. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +105 -1
  128. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +47 -7
  129. package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +30 -2
  130. package/node_modules/@kardalum/api-schemas/dist/template.schema.js +19 -5
  131. package/node_modules/@kardalum/api-schemas/dist/trash-cursor.schema.d.ts +4 -0
  132. package/node_modules/@kardalum/api-schemas/dist/trash-cursor.schema.js +29 -0
  133. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +15 -3
  134. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +8 -0
  135. package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.d.ts +19 -0
  136. package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.js +22 -0
  137. package/node_modules/@kardalum/api-schemas/package.json +2 -2
  138. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +1 -0
  139. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +2 -0
  140. package/node_modules/@kardalum/design-tokens/dist/tokens.css +1 -0
  141. package/node_modules/@kardalum/design-tokens/dist/tokens.js +3 -0
  142. package/node_modules/@kardalum/design-tokens/dist/tokens.json +2 -1
  143. package/node_modules/@kardalum/design-tokens/dist/types.d.ts +1 -0
  144. package/node_modules/@kardalum/plugin-package/README.md +4 -1
  145. package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +96 -0
  146. package/node_modules/@kardalum/plugin-package/dist/build-reference.js +66 -0
  147. package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +103 -0
  148. package/node_modules/@kardalum/plugin-package/dist/capabilities.js +346 -0
  149. package/node_modules/@kardalum/plugin-package/dist/client-bundle.d.ts +4 -0
  150. package/node_modules/@kardalum/plugin-package/dist/client-bundle.js +25 -0
  151. package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.d.ts +25 -0
  152. package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.js +203 -0
  153. package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.d.ts +3 -0
  154. package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.js +73 -0
  155. package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.d.ts +5 -0
  156. package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +60 -0
  157. package/node_modules/@kardalum/plugin-package/dist/delivery/icon-names.generated.d.ts +1 -0
  158. package/node_modules/@kardalum/plugin-package/dist/delivery/icon-names.generated.js +2052 -0
  159. package/node_modules/@kardalum/plugin-package/dist/delivery/icons.d.ts +2 -0
  160. package/node_modules/@kardalum/plugin-package/dist/delivery/icons.js +51 -0
  161. package/node_modules/@kardalum/plugin-package/dist/delivery/index.d.ts +8 -0
  162. package/node_modules/@kardalum/plugin-package/dist/delivery/index.js +7 -0
  163. package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.d.ts +17 -0
  164. package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.js +119 -0
  165. package/node_modules/@kardalum/plugin-package/dist/delivery/limits.d.ts +14 -0
  166. package/node_modules/@kardalum/plugin-package/dist/delivery/limits.js +21 -0
  167. package/node_modules/@kardalum/plugin-package/dist/delivery/locales.d.ts +5 -0
  168. package/node_modules/@kardalum/plugin-package/dist/delivery/locales.js +148 -0
  169. package/node_modules/@kardalum/plugin-package/dist/delivery/package-files.d.ts +5 -0
  170. package/node_modules/@kardalum/plugin-package/dist/delivery/package-files.js +76 -0
  171. package/node_modules/@kardalum/plugin-package/dist/delivery/registry.d.ts +22 -0
  172. package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +133 -0
  173. package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.d.ts +3 -0
  174. package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.js +90 -0
  175. package/node_modules/@kardalum/plugin-package/dist/delivery/support.d.ts +24 -0
  176. package/node_modules/@kardalum/plugin-package/dist/delivery/support.js +55 -0
  177. package/node_modules/@kardalum/plugin-package/dist/delivery/templates.d.ts +6 -0
  178. package/node_modules/@kardalum/plugin-package/dist/delivery/templates.js +158 -0
  179. package/node_modules/@kardalum/plugin-package/dist/delivery/types.d.ts +53 -0
  180. package/node_modules/@kardalum/plugin-package/dist/delivery/types.js +1 -0
  181. package/node_modules/@kardalum/plugin-package/dist/docs-contract.d.ts +3 -2
  182. package/node_modules/@kardalum/plugin-package/dist/docs-contract.js +4 -2
  183. package/node_modules/@kardalum/plugin-package/dist/extract.d.ts +92 -3
  184. package/node_modules/@kardalum/plugin-package/dist/extract.js +251 -41
  185. package/node_modules/@kardalum/plugin-package/dist/index.d.ts +11 -2
  186. package/node_modules/@kardalum/plugin-package/dist/index.js +8 -2
  187. package/node_modules/@kardalum/plugin-package/dist/manifest-entry.d.ts +5 -0
  188. package/node_modules/@kardalum/plugin-package/dist/manifest-entry.js +20 -0
  189. package/node_modules/@kardalum/plugin-package/dist/reference-entry.d.ts +3 -0
  190. package/node_modules/@kardalum/plugin-package/dist/reference-entry.js +7 -0
  191. package/node_modules/@kardalum/plugin-package/dist/sample-content.d.ts +38 -1
  192. package/node_modules/@kardalum/plugin-package/dist/sample-content.js +84 -16
  193. package/node_modules/@kardalum/plugin-package/dist/shipped-files.d.ts +39 -0
  194. package/node_modules/@kardalum/plugin-package/dist/shipped-files.js +133 -0
  195. package/node_modules/@kardalum/plugin-package/dist/shipped-locales.d.ts +7 -0
  196. package/node_modules/@kardalum/plugin-package/dist/shipped-locales.js +27 -0
  197. package/node_modules/@kardalum/plugin-package/dist/types.d.ts +4 -6
  198. package/node_modules/@kardalum/plugin-package/dist/types.js +15 -1
  199. package/node_modules/@kardalum/plugin-package/package.json +9 -2
  200. package/node_modules/@kardalum/ui/dist/components/checkbox.js +2 -2
  201. package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +2 -2
  202. package/node_modules/@kardalum/ui/dist/components/property-field.js +4 -1
  203. package/node_modules/@kardalum/ui/package.json +1 -1
  204. package/package.json +6 -6
@@ -0,0 +1,58 @@
1
+ /** The methods an apiRoute may declare: the one list the SDK's manifest schema
2
+ * enforces (and the manual's enum test reads, through the SDK's re-export)
3
+ * and the only methods this rule compares. */
4
+ export declare const API_ROUTE_METHODS: readonly ["GET", "POST", "PUT", "PATCH", "DELETE"];
5
+ /** S297: a route's `schema.response` declares success statuses only, "200" to "299", at most this many. */
6
+ export declare const API_ROUTE_RESPONSE_STATUSES_MAX = 4;
7
+ /** True for a success status code written canonically as a string: "200" to "299". Linear, no pattern. */
8
+ export declare function isApiRouteResponseStatus(key: string): boolean;
9
+ type ApiRouteMethod = (typeof API_ROUTE_METHODS)[number];
10
+ /** The longest declared path, checked before the path is split. */
11
+ export declare const API_ROUTE_PATH_MAX = 200;
12
+ /** The most apiRoutes one manifest declares, which bounds the pairwise check. */
13
+ export declare const API_ROUTES_MAX = 200;
14
+ export declare const isApiRouteMethod: (value: unknown) => value is ApiRouteMethod;
15
+ export interface ApiRouteDeclarationIssue {
16
+ path: (string | number)[];
17
+ message: string;
18
+ }
19
+ /** Why `path` cannot be a declared apiRoute path, or null when it can be. */
20
+ export declare function apiRoutePathProblem(path: string): string | null;
21
+ /** A manifest's apiRoutes, checked as the router will read them, with every
22
+ * issue rooted at the manifest: each path by apiRoutePathProblem; then, among
23
+ * the declarations whose path passed, a GET or PUT the host's storage route
24
+ * answers first, and the first earlier declaration of the same method that
25
+ * the router reads as the same route (a duplicate, reported in preference)
26
+ * or that one request can match too (ambiguous). An entry whose method is
27
+ * not one of API_ROUTE_METHODS, or whose path is not a string, is the
28
+ * schema's to report and is skipped here: the marketplace door runs this on
29
+ * a manifest.json its own schema leaves unvalidated, and a method that is
30
+ * any string must cost no comparison and appear in no message. */
31
+ export declare function checkApiRouteDeclarations(manifest: {
32
+ contributions?: unknown;
33
+ }): ApiRouteDeclarationIssue[];
34
+ /** S299 (2026-10-15-s299-tokens-that-carry-actions-design.md D15): every apiRoute
35
+ * that needs a credential names the action its caller must hold: a session's
36
+ * role on the admin tier (the default, and the tier of any value this code does
37
+ * not recognise, as effectiveAccess reads it) and an API key on the "apiKey"
38
+ * tier. Only a "public" route, which needs no credential, may omit it. One
39
+ * function, so the SDK's manifest schema (and through it install, upload, the
40
+ * boot loader and `kardalum plugin validate`) and the marketplace door cannot
41
+ * disagree. An entry that is not an object is the schema's to report and is
42
+ * skipped; the pairwise comparison checkApiRouteDeclarations runs is not
43
+ * needed, so a manifest past API_ROUTES_MAX is that function's to report. */
44
+ export declare function checkApiRouteActions(manifest: {
45
+ contributions?: unknown;
46
+ }): ApiRouteDeclarationIssue[];
47
+ /** The `:name` parameters of a route path, in order. The one segment parser the
48
+ * SDK's `schema.params` rule and the path rule share. */
49
+ export declare function apiRoutePathParams(path: string): string[];
50
+ /** S311 (S295): the method and tier of every apiRoute, as the SDK's enums
51
+ * enforce them, for the gate that never sees Zod. checkApiRouteDeclarations
52
+ * skips an entry whose method is not in the list because "the schema reports
53
+ * it"; the door has no such schema, so `"get"` published. An absent `access` is
54
+ * the documented default and stays valid; an unknown string is an error. */
55
+ export declare function checkApiRouteTiers(manifest: {
56
+ contributions?: unknown;
57
+ }): ApiRouteDeclarationIssue[];
58
+ export {};
@@ -0,0 +1,198 @@
1
+ import { API_ROUTE_ACCESS_TIERS } from "./plugin-vocabulary.js";
2
+ // S295 (2026-10-14-s295-routes-fastify-knows-about-design.md 3.1): the rule for
3
+ // what a plugin may declare as an apiRoute's address, as plain data, so the
4
+ // SDK's manifest schema (and through it `kardalum plugin validate`), the
5
+ // marketplace's submission gate and the server's route table read one rule.
6
+ // The server routes plugin routes through find-my-way, Fastify's own router;
7
+ // this admits the part of its syntax a plugin needs (static segments and
8
+ // ":name" parameters) and refuses, within one manifest, what that router would
9
+ // read as one route or match by its own precedence.
10
+ /** The methods an apiRoute may declare: the one list the SDK's manifest schema
11
+ * enforces (and the manual's enum test reads, through the SDK's re-export)
12
+ * and the only methods this rule compares. */
13
+ export const API_ROUTE_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE"];
14
+ /** S297: a route's `schema.response` declares success statuses only, "200" to "299", at most this many. */
15
+ export const API_ROUTE_RESPONSE_STATUSES_MAX = 4;
16
+ /** True for a success status code written canonically as a string: "200" to "299". Linear, no pattern. */
17
+ export function isApiRouteResponseStatus(key) {
18
+ const status = Number(key);
19
+ return Number.isInteger(status) && status >= 200 && status <= 299 && String(status) === key;
20
+ }
21
+ /** The longest declared path, checked before the path is split. */
22
+ export const API_ROUTE_PATH_MAX = 200;
23
+ /** The most apiRoutes one manifest declares, which bounds the pairwise check. */
24
+ export const API_ROUTES_MAX = 200;
25
+ // A string of another length fails each of the five comparisons on its length
26
+ // alone, so a hostile method costs five length checks and nothing more.
27
+ export const isApiRouteMethod = (value) => typeof value === "string" && API_ROUTE_METHODS.includes(value);
28
+ // Fixed, anchored, one character class each, so linear on any input. A
29
+ // parameter's name starts with a letter and holds no "-" or ".", which the
30
+ // router reads as the start of a static part inside a parameter segment.
31
+ const STATIC_SEGMENT = /^[A-Za-z0-9_-]+$/;
32
+ const PARAM_SEGMENT = /^:[A-Za-z][A-Za-z0-9_]*$/;
33
+ // The host's plugin storage route owns GET and PUT
34
+ // /api/plugins/:pluginId/storage/:contentId/:fieldId (the server's
35
+ // routes/plugin-storage.ts), and the router tries its static "storage" first.
36
+ const STORAGE_ROUTE_METHODS = new Set(["GET", "PUT"]);
37
+ /** Why `path` cannot be a declared apiRoute path, or null when it can be. */
38
+ export function apiRoutePathProblem(path) {
39
+ if (!path.startsWith("/"))
40
+ return 'path must start with "/"';
41
+ if (path.length > API_ROUTE_PATH_MAX)
42
+ return `path must be at most ${API_ROUTE_PATH_MAX} characters`;
43
+ if (path === "/")
44
+ return 'path must name at least one segment after "/"';
45
+ const names = new Set();
46
+ for (const segment of path.slice(1).split("/")) {
47
+ if (segment === "")
48
+ return `path "${path}" has an empty segment: one "/" between segments, and none at the end`;
49
+ if (PARAM_SEGMENT.test(segment)) {
50
+ const name = segment.slice(1);
51
+ if (names.has(name))
52
+ return `path "${path}" names the parameter ":${name}" twice`;
53
+ names.add(name);
54
+ }
55
+ else if (!STATIC_SEGMENT.test(segment)) {
56
+ return `path segment "${segment}" must be letters, digits, "-" and "_", or a parameter ":name" whose name is a letter followed by letters, digits or "_"`;
57
+ }
58
+ }
59
+ return null;
60
+ }
61
+ const isParam = (segment) => segment.startsWith(":");
62
+ /** One request path reaches both: as many segments, and at every place the
63
+ * same static segment or a parameter on either side. A static segment over
64
+ * 100 characters beside a parameter counts too, although no request reaches
65
+ * both: the router matches a parameter of at most 100 characters (the limit
66
+ * the manual states), and this rule refuses the pair without modelling it. */
67
+ function overlaps(a, b) {
68
+ return a.length === b.length && a.every((x, at) => { const y = b[at]; return x === y || isParam(x) || isParam(y); });
69
+ }
70
+ /** The router reads the two as one route: the same, a parameter's name aside. */
71
+ function sameRoute(a, b) {
72
+ return a.length === b.length && a.every((x, at) => { const y = b[at]; return x === y || (isParam(x) && isParam(y)); });
73
+ }
74
+ /** A manifest's apiRoutes, checked as the router will read them, with every
75
+ * issue rooted at the manifest: each path by apiRoutePathProblem; then, among
76
+ * the declarations whose path passed, a GET or PUT the host's storage route
77
+ * answers first, and the first earlier declaration of the same method that
78
+ * the router reads as the same route (a duplicate, reported in preference)
79
+ * or that one request can match too (ambiguous). An entry whose method is
80
+ * not one of API_ROUTE_METHODS, or whose path is not a string, is the
81
+ * schema's to report and is skipped here: the marketplace door runs this on
82
+ * a manifest.json its own schema leaves unvalidated, and a method that is
83
+ * any string must cost no comparison and appear in no message. */
84
+ export function checkApiRouteDeclarations(manifest) {
85
+ const contributions = manifest.contributions;
86
+ if (!contributions || typeof contributions !== "object")
87
+ return [];
88
+ const routes = contributions.apiRoutes;
89
+ if (!Array.isArray(routes))
90
+ return [];
91
+ if (routes.length > API_ROUTES_MAX) {
92
+ return [{ path: ["contributions", "apiRoutes"], message: `a plugin declares at most ${API_ROUTES_MAX} apiRoutes` }];
93
+ }
94
+ const issues = [];
95
+ const declared = [];
96
+ routes.forEach((entry, index) => {
97
+ const { method, path } = (entry ?? {});
98
+ if (!isApiRouteMethod(method) || typeof path !== "string")
99
+ return;
100
+ const at = ["contributions", "apiRoutes", index, "path"];
101
+ const problem = apiRoutePathProblem(path);
102
+ if (problem !== null) {
103
+ issues.push({ path: at, message: problem });
104
+ return;
105
+ }
106
+ const segments = path.slice(1).split("/");
107
+ if (STORAGE_ROUTE_METHODS.has(method) && segments.length === 3 && segments[0] === "storage") {
108
+ issues.push({
109
+ path: at,
110
+ message: `apiRoute "${method} ${path}" has the address of the host's plugin storage route (${method} /api/plugins/<plugin id>/storage/<contentId>/<fieldId>), which answers it before this plugin's handler could`,
111
+ });
112
+ }
113
+ const sameMethod = declared.filter((other) => other.method === method);
114
+ const duplicate = sameMethod.find((other) => sameRoute(other.segments, segments));
115
+ const earlier = duplicate ?? sameMethod.find((other) => overlaps(other.segments, segments));
116
+ if (earlier) {
117
+ const named = `"${method} ${earlier.path}" (apiRoutes.${earlier.index})`;
118
+ issues.push({
119
+ path: at,
120
+ message: duplicate === undefined
121
+ ? `Ambiguous apiRoute "${method} ${path}": a request can match both it and ${named}, so the router would choose which one answers, not this manifest`
122
+ : duplicate.path === path
123
+ ? `Duplicate apiRoute "${method} ${path}": method+path pairs must be unique within a manifest`
124
+ : `Duplicate apiRoute "${method} ${path}": the router reads it as ${named}, because a parameter's name does not make two paths different`,
125
+ });
126
+ }
127
+ declared.push({ index, method, path, segments });
128
+ });
129
+ return issues;
130
+ }
131
+ /** S299 (2026-10-15-s299-tokens-that-carry-actions-design.md D15): every apiRoute
132
+ * that needs a credential names the action its caller must hold: a session's
133
+ * role on the admin tier (the default, and the tier of any value this code does
134
+ * not recognise, as effectiveAccess reads it) and an API key on the "apiKey"
135
+ * tier. Only a "public" route, which needs no credential, may omit it. One
136
+ * function, so the SDK's manifest schema (and through it install, upload, the
137
+ * boot loader and `kardalum plugin validate`) and the marketplace door cannot
138
+ * disagree. An entry that is not an object is the schema's to report and is
139
+ * skipped; the pairwise comparison checkApiRouteDeclarations runs is not
140
+ * needed, so a manifest past API_ROUTES_MAX is that function's to report. */
141
+ export function checkApiRouteActions(manifest) {
142
+ const contributions = manifest.contributions;
143
+ if (!contributions || typeof contributions !== "object")
144
+ return [];
145
+ const routes = contributions.apiRoutes;
146
+ if (!Array.isArray(routes) || routes.length > API_ROUTES_MAX)
147
+ return [];
148
+ const issues = [];
149
+ routes.forEach((entry, index) => {
150
+ if (entry === null || typeof entry !== "object")
151
+ return;
152
+ const { access, action } = entry;
153
+ if (access === "public")
154
+ return;
155
+ if (typeof action === "string" && action !== "")
156
+ return;
157
+ issues.push({
158
+ path: ["contributions", "apiRoutes", index, "action"],
159
+ message: 'an admin-tier or apiKey-tier apiRoute must declare an "action" (only a "public" route may omit it)',
160
+ });
161
+ });
162
+ return issues;
163
+ }
164
+ /** The `:name` parameters of a route path, in order. The one segment parser the
165
+ * SDK's `schema.params` rule and the path rule share. */
166
+ export function apiRoutePathParams(path) {
167
+ return path
168
+ .split("/")
169
+ .filter((segment) => segment.startsWith(":"))
170
+ .map((segment) => segment.slice(1));
171
+ }
172
+ /** S311 (S295): the method and tier of every apiRoute, as the SDK's enums
173
+ * enforce them, for the gate that never sees Zod. checkApiRouteDeclarations
174
+ * skips an entry whose method is not in the list because "the schema reports
175
+ * it"; the door has no such schema, so `"get"` published. An absent `access` is
176
+ * the documented default and stays valid; an unknown string is an error. */
177
+ export function checkApiRouteTiers(manifest) {
178
+ const contributions = manifest.contributions;
179
+ const routes = contributions !== null && typeof contributions === "object" ? contributions.apiRoutes : undefined;
180
+ if (!Array.isArray(routes))
181
+ return [];
182
+ const issues = [];
183
+ routes.forEach((entry, index) => {
184
+ const base = ["contributions", "apiRoutes", index];
185
+ if (entry === null || typeof entry !== "object" || Array.isArray(entry)) {
186
+ issues.push({ path: base, message: "an apiRoute must be an object" });
187
+ return;
188
+ }
189
+ const route = entry;
190
+ if (!isApiRouteMethod(route.method)) {
191
+ issues.push({ path: [...base, "method"], message: `method must be one of ${API_ROUTE_METHODS.join(", ")}, got ${JSON.stringify(route.method)}` });
192
+ }
193
+ if (route.access !== undefined && !API_ROUTE_ACCESS_TIERS.includes(route.access)) {
194
+ issues.push({ path: [...base, "access"], message: `access must be one of ${API_ROUTE_ACCESS_TIERS.join(", ")}, got ${JSON.stringify(route.access)}` });
195
+ }
196
+ });
197
+ return issues;
198
+ }
@@ -0,0 +1,64 @@
1
+ import { z } from "zod";
2
+ import { PLUGIN_ID_MAX } from "./plugin-id-rules.js";
3
+ import { type DeclarationIssue } from "./plugin-template-payload.js";
4
+ export { PLUGIN_ID_MAX };
5
+ /** The longest version a manifest may declare (S311 second code fix): short
6
+ * enough that every name a version becomes part of fits in FILE_NAME_MAX
7
+ * beside the longest id. The longest of them is the starter download's
8
+ * "<id>-<version>-starter.zip": 255 - 128 (PLUGIN_ID_MAX) - 1 ("-") - 12
9
+ * ("-starter.zip") = 114, room for ordinary build metadata such as
10
+ * "1.0.0+21AF26D3----117B344092BD". The others are shorter: "<id>-<version>.zip.sig" and
11
+ * "<id>-<version>.zip" (pack's archive and the downloads), and on disk the
12
+ * marketplace's "<version>-starter.zip", "<version>.tar.gz.sig" and
13
+ * "<version>.tar.gz" and the server's "<id>/<version>" folder. */
14
+ export declare const PLUGIN_VERSION_MAX: number;
15
+ /** The longest plugin name a listing shows. */
16
+ export declare const PLUGIN_NAME_MAX = 120;
17
+ /** The longest description a listing shows. */
18
+ export declare const PLUGIN_DESCRIPTION_MAX = 2000;
19
+ /** The longest author a listing shows. */
20
+ export declare const PLUGIN_AUTHOR_MAX = 200;
21
+ /** The longest licence text. */
22
+ export declare const PLUGIN_LICENSE_MAX = 100;
23
+ /** The longest CMS version range. */
24
+ export declare const PLUGIN_CMS_VERSION_MAX = 100;
25
+ export declare const PLUGIN_ID_MESSAGE = "must be a reverse-domain id like com.vendor.plugin: every segment is lowercase, starts with a letter, and uses only a-z, 0-9 and hyphens";
26
+ export declare const PLUGIN_ID_SEGMENTS_MESSAGE: string;
27
+ export declare const PLUGIN_VERSION_MESSAGE: string;
28
+ /** Whether `value` is a SemVer 2.0.0 version (MAJOR.MINOR.PATCH, an optional
29
+ * `-prerelease` and `+build`, no `v` prefix, no spaces) of at most
30
+ * PLUGIN_VERSION_MAX characters. The length is checked first, then the text
31
+ * is split at its first `+` and its first `-` and each part read on its own,
32
+ * so the work is linear in a length that is already bounded. */
33
+ export declare function isPluginVersion(value: string): boolean;
34
+ /** A manifest's own id: at most PLUGIN_ID_MAX characters, the reverse-domain
35
+ * rule, and at most MANIFEST_ID_SEGMENT_MAX segments. Also the rule for the
36
+ * ids of other plugins a manifest names (bundled plugins, dependencies),
37
+ * since each of those is some plugin's own id. */
38
+ export declare const PluginManifestIdSchema: z.ZodString;
39
+ export declare const PluginVersionSchema: z.ZodString;
40
+ export declare const PluginNameSchema: z.ZodString;
41
+ export declare const PluginDescriptionSchema: z.ZodString;
42
+ export declare const PluginAuthorSchema: z.ZodString;
43
+ export declare const PluginLicenseSchema: z.ZodString;
44
+ export declare const PluginCmsVersionSchema: z.ZodString;
45
+ /** The identity and listing fields of a manifest, as one shape: the SDK's
46
+ * manifest schema and the door's shape rule each spread it into theirs. */
47
+ export declare const pluginManifestFields: {
48
+ id: z.ZodString;
49
+ version: z.ZodString;
50
+ name: z.ZodString;
51
+ description: z.ZodString;
52
+ author: z.ZodString;
53
+ license: z.ZodString;
54
+ cmsVersion: z.ZodString;
55
+ };
56
+ /** The fields a listing row is written from, by the rules above, for the
57
+ * upload, which writes the row before validation reads the package: each
58
+ * field it refuses, with the rule's message. An absent author is left out
59
+ * (the listing names the publisher instead). */
60
+ export declare function checkPluginListingFields(fields: {
61
+ name: unknown;
62
+ description: unknown;
63
+ author?: unknown;
64
+ }): DeclarationIssue[];
@@ -0,0 +1,134 @@
1
+ import { z } from "zod";
2
+ import { ACTION_SEGMENT_MAX } from "./action.schema.js";
3
+ import { HOSTILE_CHARS_MESSAGE, hasHostileChars } from "./plugin-docs-text.js";
4
+ import { MANIFEST_ID_SEGMENT_MAX, PLUGIN_ID_MAX, PLUGIN_ID_REGEX } from "./plugin-id-rules.js";
5
+ import { FILE_NAME_MAX } from "./plugin-template-payload.js";
6
+ // S311 fix wave (I-A): the rules over a manifest's identity and listing fields,
7
+ // defined once. The SDK's manifest schema (`kardalum plugin validate` and every
8
+ // install) and the marketplace door's shape rule both build these fields from
9
+ // here, and the upload checks the listing fields by them before it writes a
10
+ // listing row, so a manifest `validate` accepts is never refused at the door
11
+ // for its id, version, name, description, author, licence or CMS range. Before
12
+ // this the caps and the semver rule lived in the door alone.
13
+ export { PLUGIN_ID_MAX };
14
+ /** The longest version a manifest may declare (S311 second code fix): short
15
+ * enough that every name a version becomes part of fits in FILE_NAME_MAX
16
+ * beside the longest id. The longest of them is the starter download's
17
+ * "<id>-<version>-starter.zip": 255 - 128 (PLUGIN_ID_MAX) - 1 ("-") - 12
18
+ * ("-starter.zip") = 114, room for ordinary build metadata such as
19
+ * "1.0.0+21AF26D3----117B344092BD". The others are shorter: "<id>-<version>.zip.sig" and
20
+ * "<id>-<version>.zip" (pack's archive and the downloads), and on disk the
21
+ * marketplace's "<version>-starter.zip", "<version>.tar.gz.sig" and
22
+ * "<version>.tar.gz" and the server's "<id>/<version>" folder. */
23
+ export const PLUGIN_VERSION_MAX = FILE_NAME_MAX - PLUGIN_ID_MAX - "-".length - "-starter.zip".length;
24
+ /** The longest plugin name a listing shows. */
25
+ export const PLUGIN_NAME_MAX = 120;
26
+ /** The longest description a listing shows. */
27
+ export const PLUGIN_DESCRIPTION_MAX = 2000;
28
+ /** The longest author a listing shows. */
29
+ export const PLUGIN_AUTHOR_MAX = 200;
30
+ /** The longest licence text. */
31
+ export const PLUGIN_LICENSE_MAX = 100;
32
+ /** The longest CMS version range. */
33
+ export const PLUGIN_CMS_VERSION_MAX = 100;
34
+ export const PLUGIN_ID_MESSAGE = "must be a reverse-domain id like com.vendor.plugin: every segment is lowercase, starts with a letter, and uses only a-z, 0-9 and hyphens";
35
+ export const PLUGIN_ID_SEGMENTS_MESSAGE = `a plugin id has at most ${MANIFEST_ID_SEGMENT_MAX} segments: every action is the plugin id plus an object ` +
36
+ `and a verb, and an action has at most ${ACTION_SEGMENT_MAX} segments, so a longer id could not declare any action`;
37
+ export const PLUGIN_VERSION_MESSAGE = `must be a semver version such as 1.0.0 or 1.0.0-beta.1, at most ${PLUGIN_VERSION_MAX} characters`;
38
+ const IDENTIFIER = /^[0-9A-Za-z-]+$/;
39
+ const NUMERIC = /^[0-9]+$/;
40
+ /** A core part: digits, no leading zero, within the largest safe integer, so
41
+ * every reader of the version (semver, the install's ordering) reads one number. */
42
+ function isCorePart(part) {
43
+ if (!NUMERIC.test(part) || (part.length > 1 && part.startsWith("0")))
44
+ return false;
45
+ return Number(part) <= Number.MAX_SAFE_INTEGER;
46
+ }
47
+ /** A prerelease identifier: letters, digits and hyphens, and a number with no leading zero. */
48
+ function isPrereleasePart(part) {
49
+ if (!IDENTIFIER.test(part))
50
+ return false;
51
+ return !(NUMERIC.test(part) && part.length > 1 && part.startsWith("0"));
52
+ }
53
+ /** A build identifier: letters, digits and hyphens (leading zeros allowed). */
54
+ function isBuildPart(part) {
55
+ return IDENTIFIER.test(part);
56
+ }
57
+ /** Whether `value` is a SemVer 2.0.0 version (MAJOR.MINOR.PATCH, an optional
58
+ * `-prerelease` and `+build`, no `v` prefix, no spaces) of at most
59
+ * PLUGIN_VERSION_MAX characters. The length is checked first, then the text
60
+ * is split at its first `+` and its first `-` and each part read on its own,
61
+ * so the work is linear in a length that is already bounded. */
62
+ export function isPluginVersion(value) {
63
+ if (value.length === 0 || value.length > PLUGIN_VERSION_MAX)
64
+ return false;
65
+ const plus = value.indexOf("+");
66
+ const main = plus === -1 ? value : value.slice(0, plus);
67
+ if (plus !== -1 && !value.slice(plus + 1).split(".").every(isBuildPart))
68
+ return false;
69
+ const dash = main.indexOf("-");
70
+ const core = dash === -1 ? main : main.slice(0, dash);
71
+ if (dash !== -1 && !main.slice(dash + 1).split(".").every(isPrereleasePart))
72
+ return false;
73
+ const parts = core.split(".");
74
+ return parts.length === 3 && parts.every(isCorePart);
75
+ }
76
+ /** A manifest's own id: at most PLUGIN_ID_MAX characters, the reverse-domain
77
+ * rule, and at most MANIFEST_ID_SEGMENT_MAX segments. Also the rule for the
78
+ * ids of other plugins a manifest names (bundled plugins, dependencies),
79
+ * since each of those is some plugin's own id. */
80
+ export const PluginManifestIdSchema = z
81
+ .string()
82
+ .max(PLUGIN_ID_MAX, { message: `is at most ${PLUGIN_ID_MAX} characters` })
83
+ .regex(PLUGIN_ID_REGEX, PLUGIN_ID_MESSAGE)
84
+ .refine((id) => id.split(".").length <= MANIFEST_ID_SEGMENT_MAX, { message: PLUGIN_ID_SEGMENTS_MESSAGE });
85
+ export const PluginVersionSchema = z.string().refine(isPluginVersion, { message: PLUGIN_VERSION_MESSAGE });
86
+ /** Text a listing shows as written: not empty, at most `max` characters, and
87
+ * no control, zero-width or direction-override character (Trojan Source). */
88
+ function listingText(max) {
89
+ return z
90
+ .string()
91
+ .min(1, { message: "must not be empty" })
92
+ .max(max, { message: `is at most ${max} characters` })
93
+ .refine((value) => !hasHostileChars(value), { message: HOSTILE_CHARS_MESSAGE });
94
+ }
95
+ function boundedText(max) {
96
+ return z.string().min(1, { message: "must not be empty" }).max(max, { message: `is at most ${max} characters` });
97
+ }
98
+ export const PluginNameSchema = listingText(PLUGIN_NAME_MAX);
99
+ export const PluginDescriptionSchema = listingText(PLUGIN_DESCRIPTION_MAX);
100
+ export const PluginAuthorSchema = listingText(PLUGIN_AUTHOR_MAX);
101
+ export const PluginLicenseSchema = boundedText(PLUGIN_LICENSE_MAX);
102
+ export const PluginCmsVersionSchema = boundedText(PLUGIN_CMS_VERSION_MAX);
103
+ /** The identity and listing fields of a manifest, as one shape: the SDK's
104
+ * manifest schema and the door's shape rule each spread it into theirs. */
105
+ export const pluginManifestFields = {
106
+ id: PluginManifestIdSchema,
107
+ version: PluginVersionSchema,
108
+ name: PluginNameSchema,
109
+ description: PluginDescriptionSchema,
110
+ author: PluginAuthorSchema,
111
+ license: PluginLicenseSchema,
112
+ cmsVersion: PluginCmsVersionSchema,
113
+ };
114
+ const LISTING_FIELDS = [
115
+ ["name", PluginNameSchema],
116
+ ["description", PluginDescriptionSchema],
117
+ ["author", PluginAuthorSchema],
118
+ ];
119
+ /** The fields a listing row is written from, by the rules above, for the
120
+ * upload, which writes the row before validation reads the package: each
121
+ * field it refuses, with the rule's message. An absent author is left out
122
+ * (the listing names the publisher instead). */
123
+ export function checkPluginListingFields(fields) {
124
+ const issues = [];
125
+ for (const [key, schema] of LISTING_FIELDS) {
126
+ const value = fields[key];
127
+ if (key === "author" && value === undefined)
128
+ continue;
129
+ const parsed = schema.safeParse(value);
130
+ if (!parsed.success)
131
+ issues.push({ path: [key], message: parsed.error.issues[0]?.message ?? "is invalid" });
132
+ }
133
+ return issues;
134
+ }
@@ -8,6 +8,7 @@ export declare const PluginSchema: z.ZodObject<{
8
8
  storageType: z.ZodString;
9
9
  enabled: z.ZodBoolean;
10
10
  remoteUrl: z.ZodNullable<z.ZodString>;
11
+ locales: z.ZodNullable<z.ZodArray<z.ZodString>>;
11
12
  }, z.core.$strip>;
12
13
  export type Plugin = z.infer<typeof PluginSchema>;
13
14
  export declare const PluginListQuerySchema: z.ZodObject<{
@@ -25,6 +26,7 @@ export declare const PluginListResponseSchema: z.ZodObject<{
25
26
  storageType: z.ZodString;
26
27
  enabled: z.ZodBoolean;
27
28
  remoteUrl: z.ZodNullable<z.ZodString>;
29
+ locales: z.ZodNullable<z.ZodArray<z.ZodString>>;
28
30
  }, z.core.$strip>>;
29
31
  nextCursor: z.ZodNullable<z.ZodString>;
30
32
  }, z.core.$strip>;
@@ -12,6 +12,10 @@ export const PluginSchema = z.object({
12
12
  storageType: z.string(),
13
13
  enabled: z.boolean(),
14
14
  remoteUrl: z.string().nullable(),
15
+ // S314c2 (D9): the language codes of the locale files (locales/<code>.json) the plugin's
16
+ // package ships, read at install, update and attach; null when the row records none. The
17
+ // admin asks only for these files.
18
+ locales: z.array(z.string()).max(100).nullable(),
15
19
  });
16
20
  // Cursor-paginated per the non-negotiable list-endpoint rule, mirroring
17
21
  // DataTypeListResponseSchema's exact shape (data-type-api.schema.ts).
@@ -0,0 +1,74 @@
1
+ import { z } from "zod";
2
+ /** The longest path an entry of a package archive may have: Windows' MAX_PATH.
3
+ * A longer path cannot be written on a Windows host, wherever the package
4
+ * installs, since the install's own folder only adds to it. The entry gate
5
+ * in @kardalum/plugin-package (ENTRY_NAME_MAX) reads it from here (S311). */
6
+ export declare const PACKAGE_PATH_MAX = 260;
7
+ /** The longest file or folder name, one segment of a path, that NTFS, APFS and
8
+ * ext4 take. */
9
+ export declare const FILE_NAME_MAX = 255;
10
+ export declare const TEMPLATE_ALIAS_MAX = 120;
11
+ /** A template file lands at templates/<file>, so it may take PACKAGE_PATH_MAX
12
+ * less that folder (S311 third code fix): a longer one is named here, by the
13
+ * declarations check, not later by the archive's name rule. */
14
+ export declare const TEMPLATE_FILE_MAX: number;
15
+ /** A registered asset lands at public/<path>: PACKAGE_PATH_MAX less that folder. */
16
+ export declare const ASSET_PATH_MAX: number;
17
+ /** Templates and public/ together: the budget the install pipeline copes with. */
18
+ export declare const MAX_TEMPLATE_PAYLOAD_ENTRIES = 1800;
19
+ /** First path segments the request pipeline owns (compared case-insensitively):
20
+ * the server's reserved root slugs, the one list (S311 fix wave), so a root
21
+ * the server adds, such as the edit-on-page route's, is refused here too. */
22
+ export declare const RESERVED_ASSET_ROOTS: readonly ["kardalum", "api", "docs", "plugin-assets", "media", "kardalum-edit"];
23
+ /** A registered asset is read as UTF-8 text and kept with version history; a
24
+ * binary would be mangled. Binaries ship as unregistered public/ files. */
25
+ export declare const REGISTERED_ASSET_TEXT_EXTENSIONS: readonly ["css", "js", "mjs", "json", "svg", "txt", "md"];
26
+ export declare function hasRegisteredAssetTextExtension(value: string): boolean;
27
+ export declare const PluginTemplateAliasSchema: z.ZodString;
28
+ export declare const PluginTemplateFileSchema: z.ZodString;
29
+ export declare const PluginAssetPathSchema: z.ZodString;
30
+ export declare const PluginTemplateEntrySchema: z.ZodObject<{
31
+ file: z.ZodString;
32
+ name: z.ZodString;
33
+ alias: z.ZodString;
34
+ kind: z.ZodEnum<{
35
+ page: "page";
36
+ layout: "layout";
37
+ partial: "partial";
38
+ }>;
39
+ documentType: z.ZodOptional<z.ZodString>;
40
+ }, z.core.$strict>;
41
+ export type PluginTemplateEntry = z.infer<typeof PluginTemplateEntrySchema>;
42
+ /** The two fields an install re-reads, whatever else the contributions hold. */
43
+ export declare const PluginTemplatePayloadSchema: z.ZodObject<{
44
+ templates: z.ZodOptional<z.ZodArray<z.ZodObject<{
45
+ file: z.ZodString;
46
+ name: z.ZodString;
47
+ alias: z.ZodString;
48
+ kind: z.ZodEnum<{
49
+ page: "page";
50
+ layout: "layout";
51
+ partial: "partial";
52
+ }>;
53
+ documentType: z.ZodOptional<z.ZodString>;
54
+ }, z.core.$strict>>>;
55
+ assets: z.ZodOptional<z.ZodArray<z.ZodString>>;
56
+ }, z.core.$loose>;
57
+ export interface DeclarationIssue {
58
+ path: (string | number)[];
59
+ message: string;
60
+ }
61
+ /** The cross-entry rules: unique aliases, files and asset paths, and a page
62
+ * template's documentType resolving against this manifest's own documentTypes. */
63
+ export declare function checkTemplateAndAssetDeclarations(value: {
64
+ templates?: ReadonlyArray<{
65
+ file: string;
66
+ alias: string;
67
+ kind: string;
68
+ documentType?: string;
69
+ }>;
70
+ assets?: ReadonlyArray<string>;
71
+ documentTypes?: ReadonlyArray<{
72
+ name: string;
73
+ }>;
74
+ }): DeclarationIssue[];