@kardalum/plugin-sdk 0.17.0 → 0.18.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 (174) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/README.md +4 -3
  3. package/dist/assets/asset-picker.d.ts +11 -0
  4. package/dist/assets/asset-picker.js +109 -0
  5. package/dist/assets/asset-tree.d.ts +30 -0
  6. package/dist/assets/asset-tree.js +150 -0
  7. package/dist/built-in-editor-ids.d.ts +1 -0
  8. package/dist/built-in-editor-ids.js +20 -0
  9. package/dist/built-in-settings-schemas.d.ts +2 -0
  10. package/dist/built-in-settings-schemas.js +27 -0
  11. package/dist/built-in-value-schemas.js +3 -0
  12. package/dist/built-ins.js +10 -1
  13. package/dist/capabilities.js +5 -0
  14. package/dist/datatype-validation.js +18 -4
  15. package/dist/datatypes-entry.d.ts +1 -0
  16. package/dist/datatypes-entry.js +1 -0
  17. package/dist/entitlement-entry.d.ts +3 -2
  18. package/dist/entitlement-entry.js +13 -1
  19. package/dist/entitlement-gate.d.ts +18 -0
  20. package/dist/entitlement-gate.js +95 -21
  21. package/dist/entitlement-plan.d.ts +21 -0
  22. package/dist/entitlement-plan.js +26 -0
  23. package/dist/entitlement-types.d.ts +21 -4
  24. package/dist/entitlement.d.ts +29 -1
  25. package/dist/entitlement.js +39 -0
  26. package/dist/grid-arrow-step.d.ts +7 -0
  27. package/dist/grid-arrow-step.js +20 -0
  28. package/dist/index.d.ts +6 -1
  29. package/dist/index.js +7 -12
  30. package/dist/manifest-entry.d.ts +4 -0
  31. package/dist/manifest-entry.js +4 -0
  32. package/dist/manifest-schema.d.ts +5 -1
  33. package/dist/manifest-schema.js +7 -1
  34. package/dist/manifest.d.ts +21 -1
  35. package/dist/media/media-picker.js +32 -32
  36. package/dist/notify.d.ts +17 -0
  37. package/dist/notify.js +17 -0
  38. package/dist/richtext/block-panel.js +17 -18
  39. package/dist/richtext/extensions.js +10 -1
  40. package/dist/richtext/insert-menu.js +1 -1
  41. package/dist/richtext/kardalum-block.js +17 -17
  42. package/dist/richtext/style-listbox.js +1 -1
  43. package/dist/richtext-html-entry.d.ts +35 -0
  44. package/dist/richtext-html-entry.js +73 -0
  45. package/dist/structured-storage-types.d.ts +11 -0
  46. package/dist/tailwind.js +10 -3
  47. package/dist/tokens/tailwind-theme.css +176 -0
  48. package/dist/tokens/tokens.css +1 -0
  49. package/dist/tokens/tokens.json +2 -1
  50. package/dist/vendor-check.d.ts +39 -0
  51. package/dist/vendor-check.js +79 -0
  52. package/dist/vendor-entry.d.ts +3 -0
  53. package/dist/vendor-entry.js +9 -0
  54. package/dist/vendor-service.d.ts +20 -0
  55. package/dist/vendor-service.js +20 -0
  56. package/dist/views/asset-view.d.ts +6 -0
  57. package/dist/views/asset-view.js +55 -0
  58. package/dist/views/content-list-settings-view.js +1 -1
  59. package/dist/views/content-list-view.js +1 -1
  60. package/dist/views/html-code-editor.js +0 -1
  61. package/dist/views/image-view.js +1 -1
  62. package/dist/views/rich-text-view.js +30 -30
  63. package/node_modules/@kardalum/api-schemas/README.md +1 -1
  64. package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +16 -14
  65. package/node_modules/@kardalum/api-schemas/dist/asset-field.schema.d.ts +21 -0
  66. package/node_modules/@kardalum/api-schemas/dist/asset-field.schema.js +42 -0
  67. package/node_modules/@kardalum/api-schemas/dist/asset.schema.d.ts +1 -0
  68. package/node_modules/@kardalum/api-schemas/dist/asset.schema.js +10 -3
  69. package/node_modules/@kardalum/api-schemas/dist/checkout-shown.schema.d.ts +36 -0
  70. package/node_modules/@kardalum/api-schemas/dist/checkout-shown.schema.js +46 -0
  71. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +12 -0
  72. package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +16 -1
  73. package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +12 -6
  74. package/node_modules/@kardalum/api-schemas/dist/core-actions.js +11 -6
  75. package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +50 -0
  76. package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +25 -5
  77. package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.d.ts +1 -0
  78. package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +3 -0
  79. package/node_modules/@kardalum/api-schemas/dist/data-type-cursor.d.ts +11 -0
  80. package/node_modules/@kardalum/api-schemas/dist/data-type-cursor.js +28 -0
  81. package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +42 -2
  82. package/node_modules/@kardalum/api-schemas/dist/home.schema.d.ts +130 -0
  83. package/node_modules/@kardalum/api-schemas/dist/home.schema.js +87 -0
  84. package/node_modules/@kardalum/api-schemas/dist/index.d.ts +41 -15
  85. package/node_modules/@kardalum/api-schemas/dist/index.js +30 -10
  86. package/node_modules/@kardalum/api-schemas/dist/kardalum-latest.schema.d.ts +7 -0
  87. package/node_modules/@kardalum/api-schemas/dist/kardalum-latest.schema.js +9 -0
  88. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +115 -1
  89. package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +102 -1
  90. package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.d.ts +17 -0
  91. package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.js +16 -0
  92. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +26 -0
  93. package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +6 -0
  94. package/node_modules/@kardalum/api-schemas/dist/media-reference-use.d.ts +10 -0
  95. package/node_modules/@kardalum/api-schemas/dist/media-reference-use.js +4 -4
  96. package/node_modules/@kardalum/api-schemas/dist/news.schema.d.ts +93 -0
  97. package/node_modules/@kardalum/api-schemas/dist/news.schema.js +86 -0
  98. package/node_modules/@kardalum/api-schemas/dist/node-access.schema.js +13 -0
  99. package/node_modules/@kardalum/api-schemas/dist/notification.schema.d.ts +410 -0
  100. package/node_modules/@kardalum/api-schemas/dist/notification.schema.js +193 -0
  101. package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.d.ts +86 -0
  102. package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.js +92 -0
  103. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +7 -2
  104. package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.js +7 -0
  105. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +227 -0
  106. package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +157 -31
  107. package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.d.ts +19 -0
  108. package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.js +33 -0
  109. package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.d.ts +10 -1
  110. package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.js +24 -4
  111. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +5 -0
  112. package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +23 -20
  113. package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.d.ts +83 -0
  114. package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.js +73 -0
  115. package/node_modules/@kardalum/api-schemas/dist/sites.schema.d.ts +14 -0
  116. package/node_modules/@kardalum/api-schemas/dist/sites.schema.js +7 -0
  117. package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +3 -3
  118. package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +1 -1
  119. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +10 -0
  120. package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +26 -11
  121. package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +7 -0
  122. package/node_modules/@kardalum/api-schemas/dist/template.schema.js +22 -10
  123. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +12 -0
  124. package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +5 -0
  125. package/node_modules/@kardalum/api-schemas/dist/uuid.schema.d.ts +2 -0
  126. package/node_modules/@kardalum/api-schemas/dist/uuid.schema.js +4 -0
  127. package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.d.ts +88 -0
  128. package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.js +100 -0
  129. package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.d.ts +13 -0
  130. package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.js +5 -0
  131. package/node_modules/@kardalum/design-tokens/README.md +1 -1
  132. package/node_modules/@kardalum/design-tokens/dist/build-theme-css.d.ts +16 -0
  133. package/node_modules/@kardalum/design-tokens/dist/build-theme-css.js +76 -0
  134. package/node_modules/@kardalum/design-tokens/dist/generate.js +4 -1
  135. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.css +176 -0
  136. package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +1 -1
  137. package/node_modules/@kardalum/design-tokens/dist/tokens.css +1 -0
  138. package/node_modules/@kardalum/design-tokens/dist/tokens.js +1 -0
  139. package/node_modules/@kardalum/design-tokens/dist/tokens.json +2 -1
  140. package/node_modules/@kardalum/design-tokens/dist/types.d.ts +1 -0
  141. package/node_modules/@kardalum/design-tokens/package.json +6 -3
  142. package/node_modules/@kardalum/plugin-package/README.md +1 -1
  143. package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +4 -4
  144. package/node_modules/@kardalum/plugin-package/dist/capabilities.js +54 -6
  145. package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.js +1 -1
  146. package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.d.ts +3 -0
  147. package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +18 -1
  148. package/node_modules/@kardalum/plugin-package/dist/delivery/limits.d.ts +1 -1
  149. package/node_modules/@kardalum/plugin-package/dist/delivery/limits.js +1 -1
  150. package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +8 -4
  151. package/node_modules/@kardalum/plugin-package/dist/delivery/templates.d.ts +1 -0
  152. package/node_modules/@kardalum/plugin-package/dist/delivery/templates.js +58 -1
  153. package/node_modules/@kardalum/plugin-package/dist/extract.js +1 -1
  154. package/node_modules/@kardalum/plugin-package/dist/index.d.ts +4 -2
  155. package/node_modules/@kardalum/plugin-package/dist/index.js +3 -1
  156. package/node_modules/@kardalum/plugin-package/dist/license-verdict.d.ts +56 -19
  157. package/node_modules/@kardalum/plugin-package/dist/license-verdict.js +119 -25
  158. package/node_modules/@kardalum/plugin-package/dist/vendor-token.d.ts +24 -0
  159. package/node_modules/@kardalum/plugin-package/dist/vendor-token.js +118 -0
  160. package/node_modules/@kardalum/ui/README.md +1 -1
  161. package/node_modules/@kardalum/ui/dist/components/button.js +1 -1
  162. package/node_modules/@kardalum/ui/dist/components/checkbox.js +1 -1
  163. package/node_modules/@kardalum/ui/dist/components/dialog.js +5 -2
  164. package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +2 -2
  165. package/node_modules/@kardalum/ui/dist/components/input.js +1 -1
  166. package/node_modules/@kardalum/ui/dist/components/popover-panel.d.ts +4 -0
  167. package/node_modules/@kardalum/ui/dist/components/popover-panel.js +13 -0
  168. package/node_modules/@kardalum/ui/dist/components/sheet.js +5 -4
  169. package/node_modules/@kardalum/ui/dist/components/switch.js +1 -1
  170. package/node_modules/@kardalum/ui/dist/components/tab-strip.js +1 -1
  171. package/node_modules/@kardalum/ui/dist/components/toast.js +1 -1
  172. package/node_modules/@kardalum/ui/dist/index.d.ts +1 -0
  173. package/node_modules/@kardalum/ui/dist/index.js +1 -0
  174. package/package.json +17 -4
@@ -6,6 +6,7 @@ import { InstallAnswersSchema, InstallInterfaceWireSchema } from "./plugin-insta
6
6
  import { InstallRoleOutcomeSchema } from "./plugin-install-record.schema.js";
7
7
  import { InstallWarningsSchema } from "./install-warnings.schema.js";
8
8
  import { strictUrl } from "./strict-url.js";
9
+ import { PLAN_KEY_MAX, PLAN_NAME_MAX } from "./plan-editor.schema.js";
9
10
  // S268 Task 5: one derived capability, the wire form of the SDK's
10
11
  // `Capability` (packages/plugin-sdk/src/capabilities.ts, which the
11
12
  // marketplace computes at ingest). Deliberately NOT imported from there:
@@ -45,6 +46,12 @@ export const MarketplaceListingVersionSchema = z.object({
45
46
  cmsVersion: z.string(),
46
47
  verified: z.boolean(),
47
48
  createdAt: z.string(),
49
+ // S319 (spec 3b, D3): when the version was released: its publishedAt, or
50
+ // its createdAt for a version published before that was recorded. A CMS
51
+ // compares it with a lapsed licence's term end to tell "update available"
52
+ // from "renew to get it". Optional: a marketplace from before S319 sends
53
+ // none, and its versions are never held back by the CMS.
54
+ publishedAt: z.string().optional(),
48
55
  // F4: some listings legitimately have no downloadable artifact yet
49
56
  // (e.g. "available at launch" placeholders) — the marketplace's public
50
57
  // portal disables its own Download button for exactly this case. The
@@ -55,6 +62,19 @@ export const MarketplaceListingVersionSchema = z.object({
55
62
  // just below), never guessed client-side.
56
63
  hasArtifact: z.boolean(),
57
64
  });
65
+ // S316 (spec 3a, plan P11): a listing sells one to four plans. `shape` is a
66
+ // string, not an enum, so a CMS reading a newer marketplace that adds a
67
+ // shape keeps working (the S292 tolerance rule); the marketplace writes
68
+ // "free", "one_time", "monthly" or "yearly".
69
+ export const MarketplacePlanSchema = z.object({
70
+ key: z.string(),
71
+ name: z.string(),
72
+ description: z.string(),
73
+ shape: z.string(),
74
+ priceCents: z.number().int(),
75
+ // S321 (P10): positions are 0 and up; the bound also gives the reference example a real value.
76
+ position: z.number().int().nonnegative(),
77
+ });
58
78
  export const MarketplaceListingSchema = z.object({
59
79
  pluginId: z.string(),
60
80
  name: z.string(),
@@ -62,6 +82,11 @@ export const MarketplaceListingSchema = z.object({
62
82
  description: z.string(),
63
83
  author: z.string(),
64
84
  priceCents: z.number().int(),
85
+ // S316: priceCents is the lowest live paid plan's price, 0 when the
86
+ // listing has no live paid plan, so "priceCents > 0" means "has a live
87
+ // non-free plan" (what the CMS's isOfficiallyPaid asks). plans lists the
88
+ // live plans; optional, so an older marketplace that sends none validates.
89
+ plans: z.array(MarketplacePlanSchema).optional(),
65
90
  coverImagePath: z.string().nullable(),
66
91
  latestVersion: MarketplaceListingVersionSchema.nullable(),
67
92
  // Computed SERVER-SIDE against this CMS's active dialect — the admin
@@ -81,6 +106,15 @@ export const MarketplaceListingSchema = z.object({
81
106
  // newer by semver, has a package to download and supports this site's
82
107
  // database. A newer or unreadable installed version is never an "update".
83
108
  updateAvailable: z.boolean(),
109
+ // S319 (spec 3c): present, and true, only when the plugin is installed,
110
+ // the listing's latest version is newer, and the plugin's lapsed licence
111
+ // does not cover it (released after the term's end). `updateAvailable` is
112
+ // then false: no update is offered, the admin says "renew to get it".
113
+ renewToUpdate: z.literal(true).optional(),
114
+ // S322c fix wave (I1): present when the installed plugin holds the licence
115
+ // of the bundle that installed it: that bundle's plugin id, whose page is
116
+ // where the licence is bought and renewed.
117
+ licenseBundlePluginId: z.string().meta({ example: "com.acme.growth-bundle" }).optional(),
84
118
  });
85
119
  // S148: a starter frontend the marketplace hosts as a versioned archive
86
120
  // (Global Constraints — a bundledTemplate WITHOUT an archive stays legal,
@@ -108,6 +142,10 @@ export const MarketplaceBundleMemberSchema = z.object({
108
142
  description: z.string().nullable(),
109
143
  type: z.string(),
110
144
  priceCents: z.number().int(),
145
+ // S322c (P9): the member's live from-price shape ("free", "one_time",
146
+ // "monthly", "yearly"). A string, never an enum: a newer marketplace never
147
+ // breaks an older admin (S292). Absent from a marketplace before S322c.
148
+ priceShape: z.string().optional(),
111
149
  });
112
150
  // Extends the base version shape rather than widening it: browse
113
151
  // (MarketplaceListingSchema.latestVersion, MarketplaceListResponseSchema)
@@ -171,13 +209,41 @@ export const MARKETPLACE_VERSIONS_MAX_IDS = 50;
171
209
  * this; the CMS's client therefore sends no id longer than 199 characters,
172
210
  * so that fifty of them and their 49 commas (9,999 characters) always fit. */
173
211
  export const MARKETPLACE_VERSIONS_IDS_MAX_LENGTH = 10_000;
212
+ /** S322b (P15): the most plan names one versions answer item carries. */
213
+ export const MARKETPLACE_PLAN_NAMES_MAX = 32;
214
+ /** S322b (P15): a plan's key and name, so a CMS can name the plan its stored
215
+ * licence verdict carries (the verdict carries the key only). */
216
+ export const MarketplacePlanNameSchema = z.object({ key: z.string().max(PLAN_KEY_MAX), name: z.string().max(PLAN_NAME_MAX) });
217
+ /** Drops each plan name entry the schema refuses and keeps at most
218
+ * MARKETPLACE_PLAN_NAMES_MAX (live plans come first). Anything not a list is
219
+ * passed on for the schema to refuse. */
220
+ function keepReadablePlanNames(value) {
221
+ if (!Array.isArray(value))
222
+ return value;
223
+ const kept = [];
224
+ for (const item of value) {
225
+ if (kept.length === MARKETPLACE_PLAN_NAMES_MAX)
226
+ break;
227
+ if (MarketplacePlanNameSchema.safeParse(item).success)
228
+ kept.push(item);
229
+ }
230
+ return kept;
231
+ }
174
232
  /** What a CMS decides an update with: a listing's latest published version,
175
- * reduced to four facts. */
233
+ * reduced to the facts it compares (S319: and its release date). */
176
234
  export const MarketplaceLatestVersionSchema = MarketplaceListingVersionSchema.pick({
177
235
  version: true,
178
236
  cmsVersion: true,
179
237
  supportedDialects: true,
180
238
  hasArtifact: true,
239
+ publishedAt: true,
240
+ }).extend({
241
+ // S322b (P15): every plan of the listing, retired ones too (a holder may
242
+ // hold one), live first. Optional: a marketplace from before S322b sends none.
243
+ // S322b fix wave (M3): tolerant, so a name past a cap (one side's cap
244
+ // changed before the other's) costs only that entry and a longer list only
245
+ // its tail, never the whole answer and with it every update badge.
246
+ planNames: z.preprocess(keepReadablePlanNames, z.array(MarketplacePlanNameSchema).max(MARKETPLACE_PLAN_NAMES_MAX)).optional(),
181
247
  });
182
248
  /** One item per published listing among the ids asked, in the order asked; an
183
249
  * id with no published version is absent. Not strict: a key a newer
@@ -244,6 +310,13 @@ export const MarketplaceInstallMemberSchema = z.object({
244
310
  version: z.string(),
245
311
  outcome: z.enum(["installed", "already-installed"]),
246
312
  });
313
+ /** S319 (spec 3c, plan P8): a fresh install of a version the licence's
314
+ * lapsed term does not cover installed the newest version it does cover
315
+ * instead; this names the version that was asked for and why. */
316
+ export const MarketplaceInstallHeldBackSchema = z.object({
317
+ requestedVersion: z.string(),
318
+ reason: z.literal("term_lapsed"),
319
+ });
247
320
  // trustTier is a literal, not the broader TrustTier union — this door
248
321
  // (S138) only ever answers 201 for a "verified" result; a non-"verified"
249
322
  // verdict is a 422 failure response (ApiErrorSchema), never this shape.
@@ -266,6 +339,8 @@ export const MarketplaceInstallResponseSchema = z.object({
266
339
  // update did not apply as shipped, or removed. Absent on a fresh install
267
340
  // and when there is nothing to say.
268
341
  warnings: InstallWarningsSchema.optional(),
342
+ // S319: present only when the install held back to a covered version.
343
+ heldBack: MarketplaceInstallHeldBackSchema.optional(),
269
344
  });
270
345
  /** The 409 a marketplace install or update answers. `reason` is present
271
346
  * only for "license-not-recorded" (S284, D4): the plugin IS installed (or
@@ -278,3 +353,29 @@ export const MarketplaceInstallConflictSchema = z.object({
278
353
  reason: z.literal("license-not-recorded").optional(),
279
354
  warnings: InstallWarningsSchema.optional(),
280
355
  });
356
+ /** S319 (spec 3c): the 402 a marketplace install answers when the licence's
357
+ * lapsed term does not cover the version: always for an update, which is
358
+ * never downgraded, and for a fresh install with no older covered version
359
+ * to fall back to. Nothing was installed or changed. */
360
+ export const MarketplaceInstallRenewRequiredSchema = z.object({
361
+ message: z.string(),
362
+ reason: z.literal("renew-required"),
363
+ });
364
+ /** S322c (D5, plan P14): the most plugins a missing-dependency answer names. */
365
+ export const MARKETPLACE_MISSING_PLUGINS_MAX = 32;
366
+ /** One plugin a bundle install needs and the site does not have. `author`
367
+ * and `listingUrl` are null when the marketplace could not say. */
368
+ export const MarketplaceMissingPluginSchema = z.object({
369
+ pluginId: z.string(),
370
+ name: z.string(),
371
+ author: z.string().nullable(),
372
+ listingUrl: z.string().nullable(),
373
+ });
374
+ /** S322c (D5): the 422 a bundle install answers when a member needs a plugin
375
+ * outside the bundle. Nothing was installed; `message` is the whole sentence,
376
+ * `missing` names each plugin for a client that links to it. */
377
+ export const MarketplaceInstallDependenciesMissingSchema = z.object({
378
+ message: z.string(),
379
+ reason: z.literal("dependencies-missing"),
380
+ missing: z.array(MarketplaceMissingPluginSchema).min(1).max(MARKETPLACE_MISSING_PLUGINS_MAX),
381
+ });
@@ -0,0 +1,17 @@
1
+ import { z } from "zod";
2
+ /** S319 (spec 3b): the code a marketplace package or signature download
3
+ * answers, with HTTP 402, when the licence is real but its lapsed term does
4
+ * not cover the version asked for (D1). */
5
+ export declare const PACKAGE_TERM_LAPSED_CODE: "term_lapsed";
6
+ /** The 402 body. `entitledVersion` is the newest published version the
7
+ * licence still covers and can be downloaded, absent when it covers none;
8
+ * `renewUrl` is the listing's page on the marketplace, where a lapsed
9
+ * holder is offered Renew. A plain 402 (no licence, a licence for another
10
+ * plugin, a revoked one) carries `{ message }` only and does not parse. */
11
+ export declare const PackageTermLapsedSchema: z.ZodObject<{
12
+ code: z.ZodLiteral<"term_lapsed">;
13
+ message: z.ZodString;
14
+ entitledVersion: z.ZodOptional<z.ZodString>;
15
+ renewUrl: z.ZodString;
16
+ }, z.core.$strip>;
17
+ export type PackageTermLapsed = z.infer<typeof PackageTermLapsedSchema>;
@@ -0,0 +1,16 @@
1
+ import { z } from "zod";
2
+ /** S319 (spec 3b): the code a marketplace package or signature download
3
+ * answers, with HTTP 402, when the licence is real but its lapsed term does
4
+ * not cover the version asked for (D1). */
5
+ export const PACKAGE_TERM_LAPSED_CODE = "term_lapsed";
6
+ /** The 402 body. `entitledVersion` is the newest published version the
7
+ * licence still covers and can be downloaded, absent when it covers none;
8
+ * `renewUrl` is the listing's page on the marketplace, where a lapsed
9
+ * holder is offered Renew. A plain 402 (no licence, a licence for another
10
+ * plugin, a revoked one) carries `{ message }` only and does not parse. */
11
+ export const PackageTermLapsedSchema = z.object({
12
+ code: z.literal(PACKAGE_TERM_LAPSED_CODE),
13
+ message: z.string(),
14
+ entitledVersion: z.string().min(1).max(256).optional(),
15
+ renewUrl: z.string(),
16
+ });
@@ -47,6 +47,32 @@ export declare const MediaFileResponseSchema: z.ZodObject<{
47
47
  downloadUrl: z.ZodString;
48
48
  }, z.core.$strip>;
49
49
  export type MediaFileResponse = z.infer<typeof MediaFileResponseSchema>;
50
+ export declare const MediaItemSaveResponseSchema: z.ZodObject<{
51
+ id: z.ZodString;
52
+ filename: z.ZodString;
53
+ mimeType: z.ZodString;
54
+ size: z.ZodNumber;
55
+ url: z.ZodString;
56
+ visibility: z.ZodEnum<{
57
+ public: "public";
58
+ private: "private";
59
+ }>;
60
+ folderId: z.ZodNullable<z.ZodString>;
61
+ uploadedBy: z.ZodString;
62
+ uploadedAt: z.ZodString;
63
+ documentTypeId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
64
+ data: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, z.ZodTransform<Record<string, unknown>, Record<string, unknown> | null | undefined>>;
65
+ currentVersion: z.ZodDefault<z.ZodNumber>;
66
+ hasRendition: z.ZodOptional<z.ZodBoolean>;
67
+ deletedAt: z.ZodDefault<z.ZodNullable<z.ZodString>>;
68
+ downloadUrl: z.ZodString;
69
+ readOnlyFields: z.ZodOptional<z.ZodArray<z.ZodObject<{
70
+ fieldAlias: z.ZodString;
71
+ pluginId: z.ZodString;
72
+ message: z.ZodString;
73
+ }, z.core.$strip>>>;
74
+ }, z.core.$strip>;
75
+ export type MediaItemSaveResponse = z.infer<typeof MediaItemSaveResponseSchema>;
50
76
  export declare const MediaLinkResponseSchema: z.ZodObject<{
51
77
  url: z.ZodString;
52
78
  expiresAt: z.ZodString;
@@ -1,3 +1,4 @@
1
+ import { ReadOnlyFieldSchema } from "./plugin-read-only.schema.js";
1
2
  import { z } from "zod";
2
3
  import { MediaFileSchema, MediaFolderSchema, MediaVersionSchema, MediaVisibilitySchema } from "./media.schema.js";
3
4
  import { MediaRenditionSchema } from "./media-rendition.schema.js";
@@ -65,6 +66,11 @@ export const MediaFolderListResponseSchema = z.object({
65
66
  export const MediaFileResponseSchema = MediaFileSchema.extend({
66
67
  downloadUrl: z.string().min(1),
67
68
  });
69
+ // S318b (spec D1): the media PATCH's answer. readOnlyFields names the fields
70
+ // kept because their data type's plugin is read-only; absent when none.
71
+ export const MediaItemSaveResponseSchema = MediaFileResponseSchema.extend({
72
+ readOnlyFields: z.array(ReadOnlyFieldSchema).optional(),
73
+ });
68
74
  // POST /api/manage/v1/media/:id/link response (S186c §3): the admin's "Copy
69
75
  // temporary link" mint: a signed `?token=` URL good until `expiresAt`.
70
76
  // Same stable path as `downloadUrl`, just minted on demand rather than
@@ -44,6 +44,16 @@ export interface MediaReferenceUse {
44
44
  version: number;
45
45
  state: "live" | "history" | "trashed";
46
46
  }
47
+ /**
48
+ * UTF-8 bytes of `str`, using encodeURIComponent to do the actual UTF-8
49
+ * packing (the JS engine's own, not a hand-rolled surrogate-pair walk) and
50
+ * unpacking its %XX escapes into byte values.
51
+ */
52
+ export declare function utf8Bytes(str: string): number[];
53
+ export declare function utf8String(bytes: number[]): string;
54
+ export declare function base64UrlEncode(bytes: number[]): string;
55
+ /** Returns null on any character outside the base64url alphabet. */
56
+ export declare function base64UrlDecode(value: string): number[] | null;
47
57
  /**
48
58
  * The cursor for a media reference listing.
49
59
  *
@@ -9,7 +9,7 @@ const BASE64URL_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
9
9
  * packing (the JS engine's own, not a hand-rolled surrogate-pair walk) and
10
10
  * unpacking its %XX escapes into byte values.
11
11
  */
12
- function utf8Bytes(str) {
12
+ export function utf8Bytes(str) {
13
13
  const escaped = encodeURIComponent(str);
14
14
  const bytes = [];
15
15
  for (let i = 0; i < escaped.length; i += 1) {
@@ -24,13 +24,13 @@ function utf8Bytes(str) {
24
24
  }
25
25
  return bytes;
26
26
  }
27
- function utf8String(bytes) {
27
+ export function utf8String(bytes) {
28
28
  let escaped = "";
29
29
  for (const byte of bytes)
30
30
  escaped += `%${byte.toString(16).padStart(2, "0")}`;
31
31
  return decodeURIComponent(escaped);
32
32
  }
33
- function base64UrlEncode(bytes) {
33
+ export function base64UrlEncode(bytes) {
34
34
  let result = "";
35
35
  let bitBuffer = 0;
36
36
  let bitCount = 0;
@@ -48,7 +48,7 @@ function base64UrlEncode(bytes) {
48
48
  return result;
49
49
  }
50
50
  /** Returns null on any character outside the base64url alphabet. */
51
- function base64UrlDecode(value) {
51
+ export function base64UrlDecode(value) {
52
52
  const bytes = [];
53
53
  let bitBuffer = 0;
54
54
  let bitCount = 0;
@@ -0,0 +1,93 @@
1
+ import { z } from "zod";
2
+ export declare const NEWS_KINDS: readonly ["announcement", "release", "plugin"];
3
+ export declare const NewsKindSchema: z.ZodEnum<{
4
+ announcement: "announcement";
5
+ release: "release";
6
+ plugin: "plugin";
7
+ }>;
8
+ export type NewsKind = z.infer<typeof NewsKindSchema>;
9
+ export declare const NEWS_STATES: readonly ["draft", "published", "unpublished"];
10
+ export declare const NewsStateSchema: z.ZodEnum<{
11
+ published: "published";
12
+ draft: "draft";
13
+ unpublished: "unpublished";
14
+ }>;
15
+ export type NewsState = z.infer<typeof NewsStateSchema>;
16
+ /** The longest title of a news item, in either language. */
17
+ export declare const NEWS_TITLE_MAX = 120;
18
+ /** The longest text of a news item, in either language. */
19
+ export declare const NEWS_TEXT_MAX = 280;
20
+ /** The longest link. */
21
+ export declare const NEWS_URL_MAX = 500;
22
+ /** How many published items the news read serves, newest first. */
23
+ export declare const NEWS_ITEMS_MAX = 3;
24
+ /** What the operator's editor saves: every field of an item but its state and its dates. */
25
+ export declare const NewsItemInputSchema: z.ZodObject<{
26
+ kind: z.ZodEnum<{
27
+ announcement: "announcement";
28
+ release: "release";
29
+ plugin: "plugin";
30
+ }>;
31
+ pluginId: z.ZodNullable<z.ZodString>;
32
+ titleEn: z.ZodString;
33
+ textEn: z.ZodString;
34
+ titleDe: z.ZodNullable<z.ZodString>;
35
+ textDe: z.ZodNullable<z.ZodString>;
36
+ url: z.ZodNullable<z.ZodURL>;
37
+ }, z.core.$strict>;
38
+ export type NewsItemInput = z.infer<typeof NewsItemInputSchema>;
39
+ export declare const MarketplaceNewsItemSchema: z.ZodObject<{
40
+ id: z.ZodString;
41
+ kind: z.ZodEnum<{
42
+ announcement: "announcement";
43
+ release: "release";
44
+ plugin: "plugin";
45
+ }>;
46
+ pluginId: z.ZodNullable<z.ZodString>;
47
+ titleEn: z.ZodString;
48
+ textEn: z.ZodString;
49
+ titleDe: z.ZodNullable<z.ZodString>;
50
+ textDe: z.ZodNullable<z.ZodString>;
51
+ url: z.ZodNullable<z.ZodURL>;
52
+ publishedAt: z.ZodString;
53
+ }, z.core.$strip>;
54
+ export type MarketplaceNewsItem = z.infer<typeof MarketplaceNewsItemSchema>;
55
+ /** What the marketplace's GET /api/v1/news answers (C4): the newest published items. */
56
+ export declare const MarketplaceNewsResponseSchema: z.ZodObject<{
57
+ items: z.ZodArray<z.ZodObject<{
58
+ id: z.ZodString;
59
+ kind: z.ZodEnum<{
60
+ announcement: "announcement";
61
+ release: "release";
62
+ plugin: "plugin";
63
+ }>;
64
+ pluginId: z.ZodNullable<z.ZodString>;
65
+ titleEn: z.ZodString;
66
+ textEn: z.ZodString;
67
+ titleDe: z.ZodNullable<z.ZodString>;
68
+ textDe: z.ZodNullable<z.ZodString>;
69
+ url: z.ZodNullable<z.ZodURL>;
70
+ publishedAt: z.ZodString;
71
+ }, z.core.$strip>>;
72
+ }, z.core.$strip>;
73
+ export type MarketplaceNewsResponse = z.infer<typeof MarketplaceNewsResponseSchema>;
74
+ /** What the CMS's GET /api/manage/v1/home/news answers: the marketplace's items and its address for a browser. */
75
+ export declare const HomeNewsResponseSchema: z.ZodObject<{
76
+ items: z.ZodArray<z.ZodObject<{
77
+ id: z.ZodString;
78
+ kind: z.ZodEnum<{
79
+ announcement: "announcement";
80
+ release: "release";
81
+ plugin: "plugin";
82
+ }>;
83
+ pluginId: z.ZodNullable<z.ZodString>;
84
+ titleEn: z.ZodString;
85
+ textEn: z.ZodString;
86
+ titleDe: z.ZodNullable<z.ZodString>;
87
+ textDe: z.ZodNullable<z.ZodString>;
88
+ url: z.ZodNullable<z.ZodURL>;
89
+ publishedAt: z.ZodString;
90
+ }, z.core.$strip>>;
91
+ marketplaceUrl: z.ZodURL;
92
+ }, z.core.$strip>;
93
+ export type HomeNewsResponse = z.infer<typeof HomeNewsResponseSchema>;
@@ -0,0 +1,86 @@
1
+ import { z } from "zod";
2
+ import { PLUGIN_ID_MAX } from "./plugin-manifest-fields.js";
3
+ // S314n (2026-10-28-s314n-home-with-built-in-widgets-design.md, C4): News from
4
+ // Kardalum, written by the marketplace operator on the portal's News screen.
5
+ // An item has a kind, an English title and text, an optional German version
6
+ // (title and text together) and an optional https link; a New plugin item
7
+ // names a published listing and links to it instead, the CMS building that
8
+ // link from its marketplace's address. The marketplace's public read serves
9
+ // the three newest published items; the CMS hands them to Home with the
10
+ // marketplace's address for a browser.
11
+ export const NEWS_KINDS = ["announcement", "release", "plugin"];
12
+ export const NewsKindSchema = z.enum(NEWS_KINDS, { error: "Pick a kind." });
13
+ export const NEWS_STATES = ["draft", "published", "unpublished"];
14
+ export const NewsStateSchema = z.enum(NEWS_STATES);
15
+ /** The longest title of a news item, in either language. */
16
+ export const NEWS_TITLE_MAX = 120;
17
+ /** The longest text of a news item, in either language. */
18
+ export const NEWS_TEXT_MAX = 280;
19
+ /** The longest link. */
20
+ export const NEWS_URL_MAX = 500;
21
+ /** How many published items the news read serves, newest first. */
22
+ export const NEWS_ITEMS_MAX = 3;
23
+ const newsTitle = () => z.string().trim().min(1, "Write a title.").max(NEWS_TITLE_MAX, `A title has at most ${NEWS_TITLE_MAX} characters.`);
24
+ const newsText = () => z.string().trim().min(1, "Write a text.").max(NEWS_TEXT_MAX, `A text has at most ${NEWS_TEXT_MAX} characters.`);
25
+ /** https only, so an item cannot carry a script or data link to every Home. */
26
+ const httpsUrl = () => z.url({ protocol: /^https$/, error: "A link starts with https://." }).max(NEWS_URL_MAX, `A link has at most ${NEWS_URL_MAX} characters.`);
27
+ const pluginIdField = () => z.string().min(1).max(PLUGIN_ID_MAX);
28
+ function checkNewsItem(item, ctx) {
29
+ if ((item.titleDe === null) !== (item.textDe === null)) {
30
+ ctx.addIssue({
31
+ code: "custom",
32
+ path: [item.titleDe === null ? "titleDe" : "textDe"],
33
+ message: "Write the German title and text together, or leave both empty.",
34
+ });
35
+ }
36
+ if (item.kind === "plugin" && item.pluginId === null) {
37
+ ctx.addIssue({ code: "custom", path: ["pluginId"], message: "A New plugin item names the published plugin it announces." });
38
+ }
39
+ if (item.kind !== "plugin" && item.pluginId !== null) {
40
+ ctx.addIssue({ code: "custom", path: ["pluginId"], message: "Only a New plugin item names a plugin." });
41
+ }
42
+ if (item.kind === "plugin" && item.url !== null) {
43
+ ctx.addIssue({ code: "custom", path: ["url"], message: "A New plugin item links to its listing and takes no link of its own." });
44
+ }
45
+ }
46
+ /** What the operator's editor saves: every field of an item but its state and its dates. */
47
+ export const NewsItemInputSchema = z
48
+ .object({
49
+ kind: NewsKindSchema,
50
+ pluginId: pluginIdField().nullable(),
51
+ titleEn: newsTitle(),
52
+ textEn: newsText(),
53
+ titleDe: newsTitle().nullable(),
54
+ textDe: newsText().nullable(),
55
+ url: httpsUrl().nullable(),
56
+ })
57
+ .strict()
58
+ .superRefine(checkNewsItem);
59
+ /**
60
+ * One published item as the marketplace serves it. Not strict, so a field a
61
+ * later marketplace adds does not break an older CMS. A fresh instance per
62
+ * use: the OpenAPI conversion drops a schema instance two schemas share.
63
+ */
64
+ function newsItem() {
65
+ return z
66
+ .object({
67
+ id: z.string().min(1).max(100),
68
+ kind: NewsKindSchema,
69
+ pluginId: pluginIdField().nullable(),
70
+ titleEn: newsTitle(),
71
+ textEn: newsText(),
72
+ titleDe: newsTitle().nullable(),
73
+ textDe: newsText().nullable(),
74
+ url: httpsUrl().nullable(),
75
+ publishedAt: z.string().datetime(),
76
+ })
77
+ .superRefine(checkNewsItem);
78
+ }
79
+ export const MarketplaceNewsItemSchema = newsItem();
80
+ /** What the marketplace's GET /api/v1/news answers (C4): the newest published items. */
81
+ export const MarketplaceNewsResponseSchema = z.object({ items: z.array(newsItem()).max(NEWS_ITEMS_MAX) });
82
+ /** What the CMS's GET /api/manage/v1/home/news answers: the marketplace's items and its address for a browser. */
83
+ export const HomeNewsResponseSchema = z.object({
84
+ items: z.array(newsItem()).max(NEWS_ITEMS_MAX),
85
+ marketplaceUrl: z.url({ protocol: /^https?$/ }),
86
+ });
@@ -213,6 +213,19 @@ export const SaveNodePermissionsRequestSchema = z
213
213
  ctx.addIssue({ code: "custom", message: "A subject is granted once per entry", path: ["rows", i, "entry", "grants"] });
214
214
  }
215
215
  });
216
+ })
217
+ // S314c6 (D6): a generated array repeats its first item, and five rows of one action are
218
+ // what the refinement refuses; the example names each action once.
219
+ .meta({
220
+ example: {
221
+ rows: [
222
+ { action: "content.read", entry: { mode: "restricted", grants: [{ subjectKind: "role", subjectId: "editor" }] } },
223
+ { action: "content.create", entry: null },
224
+ { action: "content.update", entry: null },
225
+ { action: "content.publish", entry: null },
226
+ { action: "content.delete", entry: null },
227
+ ],
228
+ },
216
229
  });
217
230
  /** The body of a save the server refused. `action` is the row at fault, when
218
231
  * one is. `reason` is what a screen words the refusal by in its own