@kardalum/plugin-sdk 0.18.0 → 0.19.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.
- package/CHANGELOG.md +42 -0
- package/README.md +1 -1
- package/dist/assets/asset-picker.js +3 -3
- package/dist/built-in-serializers.js +1 -1
- package/dist/built-in-settings-schemas.js +4 -4
- package/dist/built-ins.js +10 -10
- package/dist/data-type-plugin.d.ts +2 -2
- package/dist/datatype-validation.d.ts +2 -2
- package/dist/datatype-validation.js +2 -2
- package/dist/define-plugin.d.ts +4 -4
- package/dist/define-plugin.js +5 -5
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/dist/manifest-schema.js +7 -1
- package/dist/media/media-picker.js +4 -4
- package/dist/plugin-context.js +3 -3
- package/dist/register-built-ins.js +6 -6
- package/dist/registry.js +1 -1
- package/dist/richtext/block-panel.js +2 -2
- package/dist/richtext/extensions.js +7 -7
- package/dist/richtext/insert-menu.js +3 -3
- package/dist/richtext/style-listbox.js +1 -1
- package/dist/richtext/text-style-class.js +1 -1
- package/dist/simple-storage-value-provider.js +3 -3
- package/dist/structured-storage-types.d.ts +1 -1
- package/dist/structured-storage-types.js +2 -2
- package/dist/ui-entry.js +3 -3
- package/dist/views/asset-view.js +3 -3
- package/dist/views/date-range-view.js +5 -5
- package/dist/views/html-code-editor.js +2 -2
- package/dist/views/html-view.js +7 -7
- package/dist/views/image-view.js +4 -4
- package/dist/views/rich-text-view.js +4 -3
- package/node_modules/@kardalum/api-schemas/dist/api-error.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/auth.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +14 -8
- package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.js +3 -3
- package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +2 -2
- package/node_modules/@kardalum/api-schemas/dist/core-actions.js +2 -2
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +3 -3
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +90 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +14 -4
- package/node_modules/@kardalum/api-schemas/dist/document-type.schema.js +8 -8
- package/node_modules/@kardalum/api-schemas/dist/index.d.ts +11 -8
- package/node_modules/@kardalum/api-schemas/dist/index.js +6 -4
- package/node_modules/@kardalum/api-schemas/dist/listing-categories.schema.d.ts +46 -0
- package/node_modules/@kardalum/api-schemas/dist/listing-categories.schema.js +52 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +47 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +42 -8
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +9 -9
- package/node_modules/@kardalum/api-schemas/dist/media.schema.js +5 -5
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-text.js +1 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +24 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +39 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-storage-api.schema.js +3 -3
- package/node_modules/@kardalum/api-schemas/dist/render-editing.js +4 -4
- package/node_modules/@kardalum/api-schemas/dist/render-settings-api.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.d.ts +207 -0
- package/node_modules/@kardalum/api-schemas/dist/server-settings-api.schema.js +147 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +11 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +17 -8
- package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/theme-api.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +1 -1
- package/node_modules/@kardalum/design-tokens/dist/build-css.d.ts +1 -1
- package/node_modules/@kardalum/design-tokens/dist/build-css.js +2 -2
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +3 -3
- package/node_modules/@kardalum/design-tokens/dist/theme-css.d.ts +2 -2
- package/node_modules/@kardalum/design-tokens/dist/theme-css.js +2 -2
- package/node_modules/@kardalum/design-tokens/dist/theme-types.d.ts +2 -2
- package/node_modules/@kardalum/design-tokens/dist/themes/dark.d.ts +3 -3
- package/node_modules/@kardalum/design-tokens/dist/themes/dark.js +3 -3
- package/node_modules/@kardalum/design-tokens/dist/themes/light.d.ts +1 -1
- package/node_modules/@kardalum/design-tokens/dist/themes/light.js +1 -1
- package/node_modules/@kardalum/design-tokens/dist/tokens.d.ts +3 -3
- package/node_modules/@kardalum/design-tokens/dist/tokens.js +5 -5
- package/node_modules/@kardalum/design-tokens/dist/types.d.ts +1 -1
- package/node_modules/@kardalum/design-tokens/dist/types.js +1 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +2 -1
- package/node_modules/@kardalum/plugin-package/dist/envelope.d.ts +2 -2
- package/node_modules/@kardalum/plugin-package/dist/envelope.js +2 -2
- package/node_modules/@kardalum/plugin-package/dist/extract.d.ts +3 -3
- package/node_modules/@kardalum/plugin-package/dist/extract.js +9 -9
- package/node_modules/@kardalum/plugin-package/dist/hash.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/hash.js +1 -1
- package/node_modules/@kardalum/plugin-package/dist/package-contract.d.ts +2 -2
- package/node_modules/@kardalum/plugin-package/dist/package-contract.js +5 -5
- package/node_modules/@kardalum/plugin-package/dist/types.d.ts +1 -1
- package/node_modules/@kardalum/ui/dist/components/alert-dialog.d.ts +1 -1
- package/node_modules/@kardalum/ui/dist/components/alert-dialog.js +8 -3
- package/node_modules/@kardalum/ui/dist/components/badge.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/button.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/dialog.d.ts +1 -1
- package/node_modules/@kardalum/ui/dist/components/dialog.js +49 -4
- package/node_modules/@kardalum/ui/dist/components/dropdown-menu.d.ts +5 -1
- package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +18 -5
- package/node_modules/@kardalum/ui/dist/components/empty-state.d.ts +4 -4
- package/node_modules/@kardalum/ui/dist/components/input.js +6 -1
- package/node_modules/@kardalum/ui/dist/components/property-field.js +3 -3
- package/node_modules/@kardalum/ui/dist/components/sheet.d.ts +1 -1
- package/node_modules/@kardalum/ui/dist/components/sheet.js +12 -7
- package/node_modules/@kardalum/ui/dist/components/skeleton.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/tab-strip.d.ts +3 -3
- package/node_modules/@kardalum/ui/dist/components/toast.js +4 -3
- package/node_modules/@kardalum/ui/dist/components/tooltip.d.ts +27 -0
- package/node_modules/@kardalum/ui/dist/components/tooltip.js +82 -0
- package/node_modules/@kardalum/ui/dist/components/truncated-text.d.ts +11 -0
- package/node_modules/@kardalum/ui/dist/components/truncated-text.js +94 -0
- package/node_modules/@kardalum/ui/dist/components/use-toast.js +2 -2
- package/node_modules/@kardalum/ui/dist/index.d.ts +3 -1
- package/node_modules/@kardalum/ui/dist/index.js +3 -1
- package/node_modules/@kardalum/ui/dist/lib/menu-host.d.ts +5 -0
- package/node_modules/@kardalum/ui/dist/lib/menu-host.js +17 -0
- package/node_modules/@kardalum/ui/package.json +8 -6
- package/package.json +7 -6
|
@@ -53,7 +53,7 @@ export const MarketplaceListingVersionSchema = z.object({
|
|
|
53
53
|
// none, and its versions are never held back by the CMS.
|
|
54
54
|
publishedAt: z.string().optional(),
|
|
55
55
|
// F4: some listings legitimately have no downloadable artifact yet
|
|
56
|
-
// (e.g. "available at launch" placeholders)
|
|
56
|
+
// (e.g. "available at launch" placeholders): the marketplace's public
|
|
57
57
|
// portal disables its own Download button for exactly this case. The
|
|
58
58
|
// admin-facing listing API had no way to say so, so the admin marketplace
|
|
59
59
|
// browser rendered an enabled Install button and only found out from the
|
|
@@ -61,6 +61,11 @@ export const MarketplaceListingVersionSchema = z.object({
|
|
|
61
61
|
// `artifactPath != null` (mirrors MarketplaceStarterSchema.hasArchive
|
|
62
62
|
// just below), never guessed client-side.
|
|
63
63
|
hasArtifact: z.boolean(),
|
|
64
|
+
// S366 (spec D5): whether the version declares bundle members, so a CMS can
|
|
65
|
+
// refuse to offer it as an update to a plain plugin from the browse answer
|
|
66
|
+
// and the batched latest versions alone. Optional: a marketplace from before
|
|
67
|
+
// S366 sends none, which reads as unknown, never as true.
|
|
68
|
+
declaresMembers: z.boolean().optional(),
|
|
64
69
|
});
|
|
65
70
|
// S316 (spec 3a, plan P11): a listing sells one to four plans. `shape` is a
|
|
66
71
|
// string, not an enum, so a CMS reading a newer marketplace that adds a
|
|
@@ -75,6 +80,13 @@ export const MarketplacePlanSchema = z.object({
|
|
|
75
80
|
// S321 (P10): positions are 0 and up; the bound also gives the reference example a real value.
|
|
76
81
|
position: z.number().int().nonnegative(),
|
|
77
82
|
});
|
|
83
|
+
// S348 (spec D1): the official marketplace's answer for a listing that a
|
|
84
|
+
// catalogue other than the official marketplace shows: "paid" when it lists the
|
|
85
|
+
// plugin at a price, "free" when it lists it free or does not list it. Set by
|
|
86
|
+
// the CMS's marketplace proxy from its own cached check, never taken from the
|
|
87
|
+
// catalogue. Absent when the catalogue is the official marketplace, and when
|
|
88
|
+
// the official marketplace could not be asked (unknown is not free).
|
|
89
|
+
export const OfficialPriceSchema = z.enum(["paid", "free"]);
|
|
78
90
|
export const MarketplaceListingSchema = z.object({
|
|
79
91
|
pluginId: z.string(),
|
|
80
92
|
name: z.string(),
|
|
@@ -89,7 +101,7 @@ export const MarketplaceListingSchema = z.object({
|
|
|
89
101
|
plans: z.array(MarketplacePlanSchema).optional(),
|
|
90
102
|
coverImagePath: z.string().nullable(),
|
|
91
103
|
latestVersion: MarketplaceListingVersionSchema.nullable(),
|
|
92
|
-
// Computed SERVER-SIDE against this CMS's active dialect
|
|
104
|
+
// Computed SERVER-SIDE against this CMS's active dialect: the admin
|
|
93
105
|
// client never guesses compatibility from raw dialect lists.
|
|
94
106
|
compatible: z.boolean(),
|
|
95
107
|
// S304-94: whether this CMS satisfies the latest version's cmsVersion range,
|
|
@@ -115,13 +127,20 @@ export const MarketplaceListingSchema = z.object({
|
|
|
115
127
|
// of the bundle that installed it: that bundle's plugin id, whose page is
|
|
116
128
|
// where the licence is bought and renewed.
|
|
117
129
|
licenseBundlePluginId: z.string().meta({ example: "com.acme.growth-bundle" }).optional(),
|
|
130
|
+
// S348: see OfficialPriceSchema above.
|
|
131
|
+
officialPrice: OfficialPriceSchema.optional(),
|
|
132
|
+
// S352 (D1): the listing's categories (LISTING_CATEGORIES keys), the chosen
|
|
133
|
+
// ones or, for a listing with none, the one its type files under. A plain
|
|
134
|
+
// string list, not the enum: a CMS reading a newer marketplace that adds a
|
|
135
|
+
// category must not fail the answer. Optional: an older marketplace sends none.
|
|
136
|
+
categories: z.array(z.string()).optional(),
|
|
118
137
|
});
|
|
119
138
|
// S148: a starter frontend the marketplace hosts as a versioned archive
|
|
120
|
-
// (Global Constraints
|
|
139
|
+
// (Global Constraints: a bundledTemplate WITHOUT an archive stays legal,
|
|
121
140
|
// hence hasArchive rather than always assuming a download exists) and the
|
|
122
141
|
// document types a template/section listing provisions on install. Both
|
|
123
142
|
// are projected server-side by the marketplace (starter-projection.ts) and
|
|
124
|
-
// only ever appear on the DETAIL surface, never on browse
|
|
143
|
+
// only ever appear on the DETAIL surface, never on browse: see
|
|
125
144
|
// MarketplaceListingDetailVersionSchema below.
|
|
126
145
|
export const MarketplaceStarterSchema = z.object({
|
|
127
146
|
name: z.string(),
|
|
@@ -133,7 +152,7 @@ export const MarketplaceDocumentTypeSummarySchema = z.object({
|
|
|
133
152
|
name: z.string(),
|
|
134
153
|
fields: z.array(z.string()),
|
|
135
154
|
});
|
|
136
|
-
// S153: a bundle's enriched member projection
|
|
155
|
+
// S153: a bundle's enriched member projection, snapshotted at ingest by
|
|
137
156
|
// the marketplace (bundle-members.ts), detail-only like the S148 starter
|
|
138
157
|
// fields (same extend-don't-widen browse protection below).
|
|
139
158
|
export const MarketplaceBundleMemberSchema = z.object({
|
|
@@ -146,6 +165,11 @@ export const MarketplaceBundleMemberSchema = z.object({
|
|
|
146
165
|
// "monthly", "yearly"). A string, never an enum: a newer marketplace never
|
|
147
166
|
// breaks an older admin (S292). Absent from a marketplace before S322c.
|
|
148
167
|
priceShape: z.string().optional(),
|
|
168
|
+
// S366c spec D2: the official marketplace's paid or free answer for the
|
|
169
|
+
// member, set by the CMS's proxy on the detail answer exactly as
|
|
170
|
+
// OfficialPriceSchema says for a listing (absent when the catalogue is the
|
|
171
|
+
// official marketplace or the answer is not known).
|
|
172
|
+
officialPrice: OfficialPriceSchema.optional(),
|
|
149
173
|
});
|
|
150
174
|
// Extends the base version shape rather than widening it: browse
|
|
151
175
|
// (MarketplaceListingSchema.latestVersion, MarketplaceListResponseSchema)
|
|
@@ -157,7 +181,7 @@ export const MarketplaceListingDetailVersionSchema = MarketplaceListingVersionSc
|
|
|
157
181
|
documentTypesSummary: z.array(MarketplaceDocumentTypeSummarySchema).nullable().optional(),
|
|
158
182
|
bundledMembers: z.array(MarketplaceBundleMemberSchema).nullable().optional(),
|
|
159
183
|
// S210: the package's own README, rendered by @kardalum/markdown in the
|
|
160
|
-
// admin's detail view. Detail-only for the same reason as starter above
|
|
184
|
+
// admin's detail view. Detail-only for the same reason as starter above:
|
|
161
185
|
// extending rather than widening is what keeps it off the browse screen,
|
|
162
186
|
// where the browse handler's response validation strips it back off.
|
|
163
187
|
readme: z.string().nullable().optional(),
|
|
@@ -173,6 +197,11 @@ export const MarketplaceListingDetailSchema = MarketplaceListingSchema.extend({
|
|
|
173
197
|
versions: z.array(MarketplaceListingDetailVersionSchema),
|
|
174
198
|
activeDialect: z.string(),
|
|
175
199
|
marketplaceBaseUrl: z.string(),
|
|
200
|
+
// S348 (P7, the operator's decision, 2026-11-03): the official marketplace's
|
|
201
|
+
// browser origin, present only when officialPrice is "paid", so the admin's
|
|
202
|
+
// Buy link can lead there when the catalogue lists the plugin free. Detail
|
|
203
|
+
// only, like the fields above: browse never carries it.
|
|
204
|
+
officialMarketplaceBaseUrl: z.string().meta({ example: "https://dev.kardalum.com" }).optional(),
|
|
176
205
|
});
|
|
177
206
|
// S288g Task 0: the marketplace's OWN listing API (GET /api/v1/listings and
|
|
178
207
|
// GET /api/v1/listings/:pluginId, upstream of a CMS's proxy) carries the
|
|
@@ -191,6 +220,8 @@ export const MarketplacePublicBaseSchema = z.object({
|
|
|
191
220
|
export const MarketplaceListQuerySchema = z.object({
|
|
192
221
|
q: z.string().optional(),
|
|
193
222
|
type: z.string().optional(),
|
|
223
|
+
// S352: one category key; the marketplace ignores an unknown one.
|
|
224
|
+
category: z.string().optional(),
|
|
194
225
|
db: z.string().optional(),
|
|
195
226
|
cursor: z.string().uuid().optional(),
|
|
196
227
|
limit: z.coerce.number().int().min(1).max(50).default(24),
|
|
@@ -237,6 +268,7 @@ export const MarketplaceLatestVersionSchema = MarketplaceListingVersionSchema.pi
|
|
|
237
268
|
supportedDialects: true,
|
|
238
269
|
hasArtifact: true,
|
|
239
270
|
publishedAt: true,
|
|
271
|
+
declaresMembers: true,
|
|
240
272
|
}).extend({
|
|
241
273
|
// S322b (P15): every plan of the listing, retired ones too (a holder may
|
|
242
274
|
// hold one), live first. Optional: a marketplace from before S322b sends none.
|
|
@@ -300,7 +332,7 @@ export const MarketplaceInstallBodySchema = z
|
|
|
300
332
|
answers: InstallAnswersSchema.optional(),
|
|
301
333
|
})
|
|
302
334
|
.strict();
|
|
303
|
-
// S152: a bundle install reports what its fan-out did per member
|
|
335
|
+
// S152: a bundle install reports what its fan-out did per member:
|
|
304
336
|
// "installed" (this operation installed it, ownership recorded) or
|
|
305
337
|
// "already-installed" (pre-existing, skipped, never claimed). Optional
|
|
306
338
|
// and absent for every non-bundle install, so single-plugin clients are
|
|
@@ -317,7 +349,7 @@ export const MarketplaceInstallHeldBackSchema = z.object({
|
|
|
317
349
|
requestedVersion: z.string(),
|
|
318
350
|
reason: z.literal("term_lapsed"),
|
|
319
351
|
});
|
|
320
|
-
// trustTier is a literal, not the broader TrustTier union
|
|
352
|
+
// trustTier is a literal, not the broader TrustTier union: this door
|
|
321
353
|
// (S138) only ever answers 201 for a "verified" result; a non-"verified"
|
|
322
354
|
// verdict is a 422 failure response (ApiErrorSchema), never this shape.
|
|
323
355
|
export const MarketplaceInstallResponseSchema = z.object({
|
|
@@ -378,4 +410,6 @@ export const MarketplaceInstallDependenciesMissingSchema = z.object({
|
|
|
378
410
|
message: z.string(),
|
|
379
411
|
reason: z.literal("dependencies-missing"),
|
|
380
412
|
missing: z.array(MarketplaceMissingPluginSchema).min(1).max(MARKETPLACE_MISSING_PLUGINS_MAX),
|
|
413
|
+
/** S366 (spec D6): how many of the bundle's rollback steps failed, sent only when any did. */
|
|
414
|
+
rollbackFailures: z.number().int().positive().optional(),
|
|
381
415
|
});
|
|
@@ -5,7 +5,7 @@ import { MediaRenditionSchema } from "./media-rendition.schema.js";
|
|
|
5
5
|
// POST /api/manage/v1/media/folders body (S186e §2): name required, parentId
|
|
6
6
|
// optional (omitted/undefined = create at the library root). Duplicate
|
|
7
7
|
// name under the same parent -> 409, enforced by a real database
|
|
8
|
-
// constraint as of the fix wave (HIGH-1
|
|
8
|
+
// constraint as of the fix wave (HIGH-1: see media-service.ts's
|
|
9
9
|
// MediaFolderNameConflictError doc comment and schema.prisma's
|
|
10
10
|
// MediaFolder comment), surfaced through the service, not validated
|
|
11
11
|
// here.
|
|
@@ -19,7 +19,7 @@ export const CreateMediaFolderRequestSchema = z.object({
|
|
|
19
19
|
// folder. The cycle-guard (a folder cannot move under its own descendant)
|
|
20
20
|
// and the depth cap are enforced in the service, not here. `.refine`
|
|
21
21
|
// restores a 400 on a body with NEITHER field present (F5, final-review
|
|
22
|
-
// follow-up wave)
|
|
22
|
+
// follow-up wave), same reasoning and wording as UpdateMediaRequestSchema
|
|
23
23
|
// below's own `.refine`: an empty `{}` PATCH validates fine on its own and
|
|
24
24
|
// does nothing, which looks like a successful no-op update rather than
|
|
25
25
|
// the mistake it almost certainly is.
|
|
@@ -60,7 +60,7 @@ export const MediaFolderListResponseSchema = z.object({
|
|
|
60
60
|
// response rather than trusted from storage: for a PUBLIC item it's
|
|
61
61
|
// identical to the persisted `url` field (permanent, no query string);
|
|
62
62
|
// for a PRIVATE item it's that same path plus a freshly minted,
|
|
63
|
-
// short-lived `?token=` (S186c §3's signed media link)
|
|
63
|
+
// short-lived `?token=` (S186c §3's signed media link), a new one every
|
|
64
64
|
// response, so this value is for immediate use (rendering an `<img src>`
|
|
65
65
|
// now), not for persisting.
|
|
66
66
|
export const MediaFileResponseSchema = MediaFileSchema.extend({
|
|
@@ -83,18 +83,18 @@ export const MediaDeleteResponseSchema = z.object({
|
|
|
83
83
|
success: z.literal(true),
|
|
84
84
|
});
|
|
85
85
|
// PATCH /api/manage/v1/media/:id body (S186c §2, folderId added S186e §2; renamed
|
|
86
|
-
// from UpdateMediaVisibilityRequestSchema in the fix wave
|
|
86
|
+
// from UpdateMediaVisibilityRequestSchema in the fix wave: it carries
|
|
87
87
|
// both visibility and folderId now, not just visibility, and the old
|
|
88
88
|
// name stopped describing it). Both fields optional and independent, same
|
|
89
89
|
// "absent = don't touch" idiom as UpdateMediaFolderRequestSchema above:
|
|
90
90
|
// visibility absent = don't flip it; folderId absent = don't move the
|
|
91
91
|
// file; folderId null = move to the library root; folderId a uuid = move
|
|
92
|
-
// under that folder (the service validates the folder exists first
|
|
93
|
-
// binding obligation 2 from the S186e Task 1 review
|
|
92
|
+
// under that folder (the service validates the folder exists first,
|
|
93
|
+
// binding obligation 2 from the S186e Task 1 review, rather than letting
|
|
94
94
|
// a bad id 500 out of the FK). `.refine` restores a 400 on a body with
|
|
95
95
|
// NEITHER field present: back when this schema only carried visibility
|
|
96
96
|
// (required, S186c), an empty body already 400'd for free; making both
|
|
97
|
-
// fields optional independently (S186e) silently dropped that
|
|
97
|
+
// fields optional independently (S186e) silently dropped that: an empty
|
|
98
98
|
// `{}` PATCH validated fine and did nothing. This puts it back explicitly
|
|
99
99
|
// rather than leaving a request that changes nothing looking like a
|
|
100
100
|
// successful update.
|
|
@@ -133,9 +133,9 @@ export const UpdateMediaRequestSchema = z
|
|
|
133
133
|
// page's last item. `search` filters by filename substring,
|
|
134
134
|
// case-insensitive. `folderId` (S186e §2) is a folder filter: ABSENT
|
|
135
135
|
// keeps the pre-S186e all-files behavior (compatibility-pinned by a
|
|
136
|
-
// dedicated test
|
|
136
|
+
// dedicated test: existing callers must see no change), "root" matches
|
|
137
137
|
// files with no folder AND files whose folderId dangles (binding
|
|
138
|
-
// obligation 3 from the S186e Task 1 review
|
|
138
|
+
// obligation 3 from the S186e Task 1 review: a damaged folderId must
|
|
139
139
|
// resurface at root, never vanish), a uuid matches exactly that folder.
|
|
140
140
|
export const MediaListQuerySchema = z.object({
|
|
141
141
|
cursor: z.string().uuid().optional(),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
// 'public' | 'private' (S186c §2)
|
|
2
|
+
// 'public' | 'private' (S186c §2): a flag, never a location. Default
|
|
3
3
|
// 'public' matches a CMS's normal case (images in posts) and existing
|
|
4
4
|
// rows' pre-S186c behavior (everything was effectively link-accessible).
|
|
5
5
|
export const MediaVisibilitySchema = z.enum(["public", "private"]);
|
|
@@ -17,10 +17,10 @@ export const MediaFileSchema = z.object({
|
|
|
17
17
|
// version forever.
|
|
18
18
|
url: z.string().min(1),
|
|
19
19
|
visibility: MediaVisibilitySchema,
|
|
20
|
-
// Virtual folder membership (S186e §1)
|
|
20
|
+
// Virtual folder membership (S186e §1): null = library root. A flag on
|
|
21
21
|
// the row only, same spirit as visibility: it never changes `url`
|
|
22
22
|
// above or anything in storage (folders are explicitly excluded from
|
|
23
|
-
// media URLs, spec §4
|
|
23
|
+
// media URLs, spec §4, the permanence guardrail). Moving a file is a
|
|
24
24
|
// metadata write, nothing else.
|
|
25
25
|
folderId: z.string().uuid().nullable(),
|
|
26
26
|
uploadedBy: z.string().uuid(),
|
|
@@ -140,11 +140,11 @@ export const IMAGE_MEDIA_TYPE_ID = "d1e00000-0000-4000-8000-000000000001";
|
|
|
140
140
|
export const FILE_MEDIA_TYPE_ID = "d1e00000-0000-4000-8000-000000000002";
|
|
141
141
|
export const IMAGE_FILE_DATA_TYPE_ID = "b1e00000-0000-4000-8000-000000000008";
|
|
142
142
|
export const ANY_FILE_DATA_TYPE_ID = "b1e00000-0000-4000-8000-000000000009";
|
|
143
|
-
// Virtual media folders (S186e §1)
|
|
143
|
+
// Virtual media folders (S186e §1): organization lives in the database
|
|
144
144
|
// only; folders are deliberately never part of `/media/<id>/v<version>/<filename>`
|
|
145
145
|
// URLs (spec §4). A tree via parentId: null = a top-level folder. Depth
|
|
146
146
|
// (capped at 5) and per-parent name uniqueness are service-layer
|
|
147
|
-
// concerns, not schema-level ones
|
|
147
|
+
// concerns, not schema-level ones; see the MediaFolder Prisma model's
|
|
148
148
|
// comment (apps/server/prisma/schema.prisma) for why a DB/schema
|
|
149
149
|
// constraint can't actually deliver per-parent uniqueness across dialects
|
|
150
150
|
// at the root level.
|
|
@@ -34,6 +34,7 @@ const HOSTILE_CHARS_PATTERN = new RegExp("[\u0000-\u001f\u007f\u200b-\u200f\u202
|
|
|
34
34
|
export function hasHostileChars(text) {
|
|
35
35
|
return HOSTILE_CHARS_PATTERN.test(text);
|
|
36
36
|
}
|
|
37
|
+
// The URL global is declared once for the package, in whatwg-url.d.ts.
|
|
37
38
|
const HAS_SCHEME = /^[a-zA-Z][a-zA-Z0-9+.-]*:/;
|
|
38
39
|
const RENDERABLE_SCHEMES = new Set(["http:", "https:", "mailto:"]);
|
|
39
40
|
/** Whether an absolute link target is one the renderers draw as a link:
|
|
@@ -32,6 +32,7 @@ export declare const ManagedPluginSchema: z.ZodObject<{
|
|
|
32
32
|
}, z.core.$strip>>;
|
|
33
33
|
name: z.ZodString;
|
|
34
34
|
type: z.ZodString;
|
|
35
|
+
bundledPlugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
35
36
|
version: z.ZodString;
|
|
36
37
|
trustTier: z.ZodEnum<{
|
|
37
38
|
verified: "verified";
|
|
@@ -48,6 +49,12 @@ export declare const ManagedPluginSchema: z.ZodObject<{
|
|
|
48
49
|
licenseLastValidatedAt: z.ZodNullable<z.ZodString>;
|
|
49
50
|
licenseLastValidIssuedAt: z.ZodNullable<z.ZodString>;
|
|
50
51
|
licenseLastAttemptError: z.ZodNullable<z.ZodString>;
|
|
52
|
+
licenseSwitchOffAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
53
|
+
licenseLastAttemptKind: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
54
|
+
unreachable: "unreachable";
|
|
55
|
+
rejected: "rejected";
|
|
56
|
+
"site-domain-missing": "site-domain-missing";
|
|
57
|
+
}>>>;
|
|
51
58
|
boundDomain: z.ZodNullable<z.ZodString>;
|
|
52
59
|
lockedFromEnabled: z.ZodNullable<z.ZodBoolean>;
|
|
53
60
|
tamperKind: z.ZodNullable<z.ZodEnum<{
|
|
@@ -99,6 +106,7 @@ export declare const ManagedPluginListResponseSchema: z.ZodObject<{
|
|
|
99
106
|
}, z.core.$strip>>;
|
|
100
107
|
name: z.ZodString;
|
|
101
108
|
type: z.ZodString;
|
|
109
|
+
bundledPlugins: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
102
110
|
version: z.ZodString;
|
|
103
111
|
trustTier: z.ZodEnum<{
|
|
104
112
|
verified: "verified";
|
|
@@ -115,6 +123,12 @@ export declare const ManagedPluginListResponseSchema: z.ZodObject<{
|
|
|
115
123
|
licenseLastValidatedAt: z.ZodNullable<z.ZodString>;
|
|
116
124
|
licenseLastValidIssuedAt: z.ZodNullable<z.ZodString>;
|
|
117
125
|
licenseLastAttemptError: z.ZodNullable<z.ZodString>;
|
|
126
|
+
licenseSwitchOffAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
127
|
+
licenseLastAttemptKind: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
128
|
+
unreachable: "unreachable";
|
|
129
|
+
rejected: "rejected";
|
|
130
|
+
"site-domain-missing": "site-domain-missing";
|
|
131
|
+
}>>>;
|
|
118
132
|
boundDomain: z.ZodNullable<z.ZodString>;
|
|
119
133
|
lockedFromEnabled: z.ZodNullable<z.ZodBoolean>;
|
|
120
134
|
tamperKind: z.ZodNullable<z.ZodEnum<{
|
|
@@ -149,6 +163,7 @@ export declare const ManagedPluginListResponseSchema: z.ZodObject<{
|
|
|
149
163
|
}, z.core.$strip>>;
|
|
150
164
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
151
165
|
licenseGraceDays: z.ZodNumber;
|
|
166
|
+
licenseStaleWarnDays: z.ZodOptional<z.ZodNumber>;
|
|
152
167
|
}, z.core.$strip>;
|
|
153
168
|
export type ManagedPluginListResponse = z.infer<typeof ManagedPluginListResponseSchema>;
|
|
154
169
|
export declare const PluginIdParamsSchema: z.ZodObject<{
|
|
@@ -575,6 +590,15 @@ export declare const PackageRefusedSchema: z.ZodObject<{
|
|
|
575
590
|
reasons: z.ZodArray<z.ZodString>;
|
|
576
591
|
}, z.core.$strip>;
|
|
577
592
|
export type PackageRefused = z.infer<typeof PackageRefusedSchema>;
|
|
593
|
+
/** S357 (D2): the 422 an install or update answers when its rollback did not
|
|
594
|
+
* complete: the refusal's message and how many rollback steps failed (each
|
|
595
|
+
* one's record is kept). Sent only when at least one failed; before
|
|
596
|
+
* ApiErrorSchema in each route's union, which would drop the count. */
|
|
597
|
+
export declare const PluginRollbackIncompleteSchema: z.ZodObject<{
|
|
598
|
+
message: z.ZodString;
|
|
599
|
+
rollbackFailures: z.ZodNumber;
|
|
600
|
+
}, z.core.$strip>;
|
|
601
|
+
export type PluginRollbackIncomplete = z.infer<typeof PluginRollbackIncompleteSchema>;
|
|
578
602
|
/** S274c: the 409 an upload over a verified plugin answers before it stores
|
|
579
603
|
* anything, until the retry carries confirmTrustDowngrade=true. */
|
|
580
604
|
export declare const TrustDowngradeConfirmationSchema: z.ZodObject<{
|
|
@@ -58,6 +58,14 @@ export const ManagedPluginSchema = z.object({
|
|
|
58
58
|
readOnly: PluginReadOnlyNoticeSchema.optional(),
|
|
59
59
|
name: z.string(),
|
|
60
60
|
type: z.string(),
|
|
61
|
+
// S349 (D1): the member plugins this plugin declares
|
|
62
|
+
// (contributions.bundledPlugins), in declaration order. A plugin that
|
|
63
|
+
// declares members is a bundle, whatever its `type`. Optional so an answer
|
|
64
|
+
// from a server before S349 still reads; this server always sends it.
|
|
65
|
+
bundledPlugins: z
|
|
66
|
+
.array(z.string())
|
|
67
|
+
.optional()
|
|
68
|
+
.describe("The member plugins this plugin declares (contributions.bundledPlugins), in declaration order; empty when it declares none. A plugin that declares members is a bundle, whatever its `type`."),
|
|
61
69
|
version: z.string(),
|
|
62
70
|
trustTier: z.enum(["verified", "unverified"]),
|
|
63
71
|
storageType: z.enum(STORAGE_TYPES),
|
|
@@ -76,6 +84,25 @@ export const ManagedPluginSchema = z.object({
|
|
|
76
84
|
// (ISO), the clock the grace period runs on. Null before the first one.
|
|
77
85
|
licenseLastValidIssuedAt: z.string().nullable(),
|
|
78
86
|
licenseLastAttemptError: z.string().nullable(),
|
|
87
|
+
// S351 (spec D2): when a check that reaches no verdict would switch the
|
|
88
|
+
// plugin off as grace_expired (ISO), from the helper the lock itself uses
|
|
89
|
+
// (apps/server/src/licensing/grace-deadline.ts). Null where no grace lock
|
|
90
|
+
// can land or the last check succeeded. Optional so an answer from a server
|
|
91
|
+
// before S351 still reads.
|
|
92
|
+
licenseSwitchOffAt: z
|
|
93
|
+
.string()
|
|
94
|
+
.nullable()
|
|
95
|
+
.optional()
|
|
96
|
+
.describe("When a check that reaches no licence verdict would switch this plugin off (ISO 8601): set on a site with a production KARDALUM_SITE_DOMAIN for a licence whose last check failed. Null when no grace lock can land (no production site domain, a revoked or already switched-off licence) or the last check succeeded."),
|
|
97
|
+
// S351 fix wave: what the last failed licence check ran into, derived on
|
|
98
|
+
// the server from where lastAttemptError was written, so the admin never
|
|
99
|
+
// reads the free text. Null when the last check succeeded; absent from a
|
|
100
|
+
// server before it (the admin then reads it as unreachable).
|
|
101
|
+
licenseLastAttemptKind: z
|
|
102
|
+
.enum(["unreachable", "rejected", "site-domain-missing"])
|
|
103
|
+
.nullable()
|
|
104
|
+
.optional()
|
|
105
|
+
.describe("What the last failed licence check ran into: unreachable (the licence server could not be reached), rejected (it answered, but the answer did not verify) or site-domain-missing (no KARDALUM_SITE_DOMAIN is set, so no request was made). Null when the last check succeeded."),
|
|
79
106
|
boundDomain: z.string().nullable(),
|
|
80
107
|
// S284b: what THIS row's `enabled` was when a grace lock closed (the
|
|
81
108
|
// registry row's own value since the fix wave, so a bundle member keeps
|
|
@@ -139,6 +166,10 @@ export const ManagedPluginListResponseSchema = z.object({
|
|
|
139
166
|
// S284b: the grace period this server applies (KARDALUM_LICENSE_GRACE_DAYS,
|
|
140
167
|
// 1 to 14), so the admin's grace_expired sentence names the real days.
|
|
141
168
|
licenseGraceDays: z.number().int(),
|
|
169
|
+
// S351 (spec D2): the days without a valid verdict after which the admin
|
|
170
|
+
// says the licence server is unreachable (KARDALUM_LICENSE_STALE_WARN_DAYS),
|
|
171
|
+
// so the admin no longer mirrors the default.
|
|
172
|
+
licenseStaleWarnDays: z.number().int().positive().optional(),
|
|
142
173
|
});
|
|
143
174
|
export const PluginIdParamsSchema = z.object({
|
|
144
175
|
pluginId: z.string().min(1),
|
|
@@ -519,6 +550,14 @@ export const PackageRefusedSchema = z.object({
|
|
|
519
550
|
message: z.string(),
|
|
520
551
|
reasons: z.array(z.string()),
|
|
521
552
|
});
|
|
553
|
+
/** S357 (D2): the 422 an install or update answers when its rollback did not
|
|
554
|
+
* complete: the refusal's message and how many rollback steps failed (each
|
|
555
|
+
* one's record is kept). Sent only when at least one failed; before
|
|
556
|
+
* ApiErrorSchema in each route's union, which would drop the count. */
|
|
557
|
+
export const PluginRollbackIncompleteSchema = z.object({
|
|
558
|
+
message: z.string(),
|
|
559
|
+
rollbackFailures: z.number().int().positive(),
|
|
560
|
+
});
|
|
522
561
|
/** S274c: the 409 an upload over a verified plugin answers before it stores
|
|
523
562
|
* anything, until the retry carries confirmTrustDowngrade=true. */
|
|
524
563
|
export const TrustDowngradeConfirmationSchema = z.object({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
// Read-side shape of a plugin_registry row
|
|
2
|
+
// Read-side shape of a plugin_registry row; the ONLY consumer today is
|
|
3
3
|
// the admin's boot-time remote loader (kardalum dev, Session 79), but this
|
|
4
4
|
// is real, permanent infrastructure: any dynamically-installed plugin
|
|
5
5
|
// needs a way for the admin to discover it at boot, sandbox or not.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
// SimpleStorageAPI's HTTP surface (Session 68)
|
|
2
|
+
// SimpleStorageAPI's HTTP surface (Session 68): the SimpleStorageAPI
|
|
3
3
|
// interface is get(contentId, fieldId) / set(contentId, fieldId, value),
|
|
4
4
|
// with pluginId made explicit here as a required 3rd param: this is the
|
|
5
5
|
// lower-level adapter/HTTP surface, not the plugin-facing SDK ergonomics
|
|
6
6
|
// (usePluginValue(), Session 70, resolves pluginId from React context and
|
|
7
7
|
// never asks a plugin author to pass it by hand).
|
|
8
|
-
// Matches FieldDefinition.id's shape (document-type.schema.ts)
|
|
8
|
+
// Matches FieldDefinition.id's shape (document-type.schema.ts), with the same
|
|
9
9
|
// stable key, just scoped to one plugin's stored value for that field.
|
|
10
10
|
const FieldIdSchema = z.string().regex(/^[a-zA-Z][a-zA-Z0-9_]*$/);
|
|
11
11
|
// Deliberately NOT plugin-sdk's stricter reverse-DNS pluginIdSchema:
|
|
@@ -17,7 +17,7 @@ export const PluginStorageParamsSchema = z.object({
|
|
|
17
17
|
contentId: z.string().uuid(),
|
|
18
18
|
fieldId: FieldIdSchema,
|
|
19
19
|
});
|
|
20
|
-
// `value` is z.unknown(), not a record
|
|
20
|
+
// `value` is z.unknown(), not a record: SimpleStorageAPI's value is
|
|
21
21
|
// untyped by design; a plugin can store a string, number, array, or
|
|
22
22
|
// object, not only key-value maps.
|
|
23
23
|
export const SetPluginFieldValueRequestSchema = z.object({ value: z.unknown() }).strict();
|
|
@@ -5,17 +5,17 @@ import { TemplateAliasSchema } from "./template.schema.js";
|
|
|
5
5
|
// (rich-text-view.tsx's useTextStyles, insert-menu.tsx's/block-panel.tsx's
|
|
6
6
|
// useBlockListings); POST .../block renders one embeddable block's live
|
|
7
7
|
// preview (block-panel.tsx's BlockPreviewPopover). Both list responses are
|
|
8
|
-
// bare arrays, not `{items, nextCursor}
|
|
8
|
+
// bare arrays, not `{items, nextCursor}`, deliberately NOT
|
|
9
9
|
// cursor-paginated, unlike api-design.md's list-endpoint rule for content:
|
|
10
10
|
// both sources are small, in-process scans over registered assets/
|
|
11
11
|
// templates (assetMirror.listTextStyles() / templateService.
|
|
12
12
|
// listEmbeddableBlocks(), Task 4), not content, and every existing UI
|
|
13
|
-
// consumer already parses a bare array off `await response.json()
|
|
13
|
+
// consumer already parses a bare array off `await response.json()`. See
|
|
14
14
|
// the three files above.
|
|
15
15
|
export const TextStyleEntrySchema = z.object({ key: z.string(), label: z.string() }).strict();
|
|
16
16
|
export const TextStylesResponseSchema = z.array(TextStyleEntrySchema);
|
|
17
17
|
// Mirrors BlockParamType/BlockParam in apps/server/src/render/
|
|
18
|
-
// block-annotations.ts (the parser that produces these)
|
|
18
|
+
// block-annotations.ts (the parser that produces these), kept as an
|
|
19
19
|
// independent schema here rather than imported, same "server internals
|
|
20
20
|
// don't leak into api-schemas" boundary every other schema in this
|
|
21
21
|
// package respects.
|
|
@@ -37,7 +37,7 @@ export const BlockListingSchema = z
|
|
|
37
37
|
.strict();
|
|
38
38
|
export const BlockListResponseSchema = z.array(BlockListingSchema);
|
|
39
39
|
// params is an arbitrary bag (whatever the block's own declared params
|
|
40
|
-
// require)
|
|
40
|
+
// require), validated against the live template declaration server-side
|
|
41
41
|
// (block-annotations.ts's findInvalidBlockParamKey), not by this schema,
|
|
42
42
|
// so it stays a permissive record here rather than trying to model every
|
|
43
43
|
// possible declared param shape in Zod.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
// Site-level render settings, stored in the (previously unused) Prisma
|
|
3
|
-
// `Setting` key-value model
|
|
3
|
+
// `Setting` key-value model (key "render", value = this object). The
|
|
4
4
|
// catch-all template is the S192 spec §6 step-3 fallback: rendered when a
|
|
5
5
|
// node's document type has no template of its own (the SPA-shell case).
|
|
6
6
|
export const RenderSettingsSchema = z.object({
|