@kardalum/plugin-sdk 0.17.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 +109 -0
- package/README.md +4 -3
- package/dist/assets/asset-picker.d.ts +11 -0
- package/dist/assets/asset-picker.js +109 -0
- package/dist/assets/asset-tree.d.ts +30 -0
- package/dist/assets/asset-tree.js +150 -0
- package/dist/built-in-editor-ids.d.ts +1 -0
- package/dist/built-in-editor-ids.js +20 -0
- package/dist/built-in-serializers.js +1 -1
- package/dist/built-in-settings-schemas.d.ts +2 -0
- package/dist/built-in-settings-schemas.js +31 -4
- package/dist/built-in-value-schemas.js +3 -0
- package/dist/built-ins.js +20 -11
- package/dist/capabilities.js +5 -0
- package/dist/data-type-plugin.d.ts +2 -2
- package/dist/datatype-validation.d.ts +2 -2
- package/dist/datatype-validation.js +20 -6
- package/dist/datatypes-entry.d.ts +1 -0
- package/dist/datatypes-entry.js +1 -0
- package/dist/define-plugin.d.ts +4 -4
- package/dist/define-plugin.js +5 -5
- package/dist/entitlement-entry.d.ts +3 -2
- package/dist/entitlement-entry.js +13 -1
- package/dist/entitlement-gate.d.ts +18 -0
- package/dist/entitlement-gate.js +95 -21
- package/dist/entitlement-plan.d.ts +21 -0
- package/dist/entitlement-plan.js +26 -0
- package/dist/entitlement-types.d.ts +21 -4
- package/dist/entitlement.d.ts +29 -1
- package/dist/entitlement.js +39 -0
- package/dist/grid-arrow-step.d.ts +7 -0
- package/dist/grid-arrow-step.js +20 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.js +11 -12
- package/dist/manifest-entry.d.ts +4 -0
- package/dist/manifest-entry.js +4 -0
- package/dist/manifest-schema.d.ts +5 -1
- package/dist/manifest-schema.js +14 -2
- package/dist/manifest.d.ts +21 -1
- package/dist/media/media-picker.js +34 -34
- package/dist/notify.d.ts +17 -0
- package/dist/notify.js +17 -0
- 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 +19 -20
- package/dist/richtext/extensions.js +17 -8
- package/dist/richtext/insert-menu.js +4 -4
- package/dist/richtext/kardalum-block.js +17 -17
- package/dist/richtext/style-listbox.js +2 -2
- package/dist/richtext/text-style-class.js +1 -1
- package/dist/richtext-html-entry.d.ts +35 -0
- package/dist/richtext-html-entry.js +73 -0
- package/dist/simple-storage-value-provider.js +3 -3
- package/dist/structured-storage-types.d.ts +12 -1
- package/dist/structured-storage-types.js +2 -2
- package/dist/tailwind.js +10 -3
- package/dist/tokens/tailwind-theme.css +176 -0
- package/dist/tokens/tokens.css +1 -0
- package/dist/tokens/tokens.json +2 -1
- package/dist/ui-entry.js +3 -3
- package/dist/vendor-check.d.ts +39 -0
- package/dist/vendor-check.js +79 -0
- package/dist/vendor-entry.d.ts +3 -0
- package/dist/vendor-entry.js +9 -0
- package/dist/vendor-service.d.ts +20 -0
- package/dist/vendor-service.js +20 -0
- package/dist/views/asset-view.d.ts +6 -0
- package/dist/views/asset-view.js +55 -0
- package/dist/views/content-list-settings-view.js +1 -1
- package/dist/views/content-list-view.js +1 -1
- package/dist/views/date-range-view.js +5 -5
- package/dist/views/html-code-editor.js +2 -3
- package/dist/views/html-view.js +7 -7
- package/dist/views/image-view.js +5 -5
- package/dist/views/rich-text-view.js +33 -32
- package/node_modules/@kardalum/api-schemas/README.md +1 -1
- package/node_modules/@kardalum/api-schemas/dist/api-error.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +17 -15
- package/node_modules/@kardalum/api-schemas/dist/asset-field.schema.d.ts +21 -0
- package/node_modules/@kardalum/api-schemas/dist/asset-field.schema.js +42 -0
- package/node_modules/@kardalum/api-schemas/dist/asset.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/asset.schema.js +10 -3
- package/node_modules/@kardalum/api-schemas/dist/auth.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/checkout-shown.schema.d.ts +36 -0
- package/node_modules/@kardalum/api-schemas/dist/checkout-shown.schema.js +46 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +30 -9
- 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 +12 -6
- package/node_modules/@kardalum/api-schemas/dist/core-actions.js +11 -6
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +50 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.js +26 -6
- package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-config.schema.js +6 -3
- package/node_modules/@kardalum/api-schemas/dist/data-type-cursor.d.ts +11 -0
- package/node_modules/@kardalum/api-schemas/dist/data-type-cursor.js +28 -0
- 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 +56 -6
- package/node_modules/@kardalum/api-schemas/dist/document-type.schema.js +8 -8
- package/node_modules/@kardalum/api-schemas/dist/home.schema.d.ts +130 -0
- package/node_modules/@kardalum/api-schemas/dist/home.schema.js +87 -0
- package/node_modules/@kardalum/api-schemas/dist/index.d.ts +48 -19
- package/node_modules/@kardalum/api-schemas/dist/index.js +34 -12
- package/node_modules/@kardalum/api-schemas/dist/kardalum-latest.schema.d.ts +7 -0
- package/node_modules/@kardalum/api-schemas/dist/kardalum-latest.schema.js +9 -0
- 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 +162 -1
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +144 -9
- package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.d.ts +17 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-package-api.schema.js +16 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +26 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +15 -9
- package/node_modules/@kardalum/api-schemas/dist/media-reference-use.d.ts +10 -0
- package/node_modules/@kardalum/api-schemas/dist/media-reference-use.js +4 -4
- package/node_modules/@kardalum/api-schemas/dist/media.schema.js +5 -5
- package/node_modules/@kardalum/api-schemas/dist/news.schema.d.ts +93 -0
- package/node_modules/@kardalum/api-schemas/dist/news.schema.js +86 -0
- package/node_modules/@kardalum/api-schemas/dist/node-access.schema.js +13 -0
- package/node_modules/@kardalum/api-schemas/dist/notification.schema.d.ts +410 -0
- package/node_modules/@kardalum/api-schemas/dist/notification.schema.js +193 -0
- package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.d.ts +86 -0
- package/node_modules/@kardalum/api-schemas/dist/plan-editor.schema.js +92 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +7 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.js +7 -0
- 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 +251 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +196 -31
- package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.d.ts +19 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.js +33 -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/plugin-template-payload.d.ts +10 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.js +24 -4
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +23 -20
- 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/revenue-view.schema.d.ts +83 -0
- package/node_modules/@kardalum/api-schemas/dist/revenue-view.schema.js +73 -0
- 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/sites.schema.d.ts +14 -0
- package/node_modules/@kardalum/api-schemas/dist/sites.schema.js +7 -0
- package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +3 -3
- package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +10 -0
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +27 -12
- package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +7 -0
- package/node_modules/@kardalum/api-schemas/dist/template.schema.js +22 -10
- 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.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +6 -1
- package/node_modules/@kardalum/api-schemas/dist/uuid.schema.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/uuid.schema.js +4 -0
- package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.d.ts +88 -0
- package/node_modules/@kardalum/api-schemas/dist/vendor-service.schema.js +100 -0
- package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.js +5 -0
- package/node_modules/@kardalum/design-tokens/README.md +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/build-theme-css.d.ts +16 -0
- package/node_modules/@kardalum/design-tokens/dist/build-theme-css.js +76 -0
- package/node_modules/@kardalum/design-tokens/dist/generate.js +4 -1
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.css +176 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +1 -1
- 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.css +1 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.d.ts +3 -3
- package/node_modules/@kardalum/design-tokens/dist/tokens.js +6 -5
- package/node_modules/@kardalum/design-tokens/dist/tokens.json +2 -1
- package/node_modules/@kardalum/design-tokens/dist/types.d.ts +2 -1
- package/node_modules/@kardalum/design-tokens/dist/types.js +1 -1
- package/node_modules/@kardalum/design-tokens/package.json +6 -3
- package/node_modules/@kardalum/plugin-package/README.md +1 -1
- package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +4 -4
- package/node_modules/@kardalum/plugin-package/dist/capabilities.js +54 -6
- package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.js +1 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +18 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/limits.d.ts +1 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/limits.js +1 -1
- package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +9 -4
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.js +58 -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 +10 -10
- 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/index.d.ts +4 -2
- package/node_modules/@kardalum/plugin-package/dist/index.js +3 -1
- package/node_modules/@kardalum/plugin-package/dist/license-verdict.d.ts +56 -19
- package/node_modules/@kardalum/plugin-package/dist/license-verdict.js +119 -25
- 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/plugin-package/dist/vendor-token.d.ts +24 -0
- package/node_modules/@kardalum/plugin-package/dist/vendor-token.js +118 -0
- package/node_modules/@kardalum/ui/README.md +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 +2 -2
- package/node_modules/@kardalum/ui/dist/components/checkbox.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/dialog.d.ts +1 -1
- package/node_modules/@kardalum/ui/dist/components/dialog.js +52 -4
- package/node_modules/@kardalum/ui/dist/components/dropdown-menu.d.ts +5 -1
- package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +20 -7
- 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/popover-panel.d.ts +4 -0
- package/node_modules/@kardalum/ui/dist/components/popover-panel.js +13 -0
- 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 +15 -9
- package/node_modules/@kardalum/ui/dist/components/skeleton.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/switch.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/tab-strip.d.ts +3 -3
- package/node_modules/@kardalum/ui/dist/components/tab-strip.js +1 -1
- 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 +4 -1
- package/node_modules/@kardalum/ui/dist/index.js +4 -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 +21 -7
|
@@ -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,8 +46,14 @@ 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
|
-
// (e.g. "available at launch" placeholders)
|
|
56
|
+
// (e.g. "available at launch" placeholders): the marketplace's public
|
|
50
57
|
// portal disables its own Download button for exactly this case. The
|
|
51
58
|
// admin-facing listing API had no way to say so, so the admin marketplace
|
|
52
59
|
// browser rendered an enabled Install button and only found out from the
|
|
@@ -54,7 +61,32 @@ export const MarketplaceListingVersionSchema = z.object({
|
|
|
54
61
|
// `artifactPath != null` (mirrors MarketplaceStarterSchema.hasArchive
|
|
55
62
|
// just below), never guessed client-side.
|
|
56
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(),
|
|
57
69
|
});
|
|
70
|
+
// S316 (spec 3a, plan P11): a listing sells one to four plans. `shape` is a
|
|
71
|
+
// string, not an enum, so a CMS reading a newer marketplace that adds a
|
|
72
|
+
// shape keeps working (the S292 tolerance rule); the marketplace writes
|
|
73
|
+
// "free", "one_time", "monthly" or "yearly".
|
|
74
|
+
export const MarketplacePlanSchema = z.object({
|
|
75
|
+
key: z.string(),
|
|
76
|
+
name: z.string(),
|
|
77
|
+
description: z.string(),
|
|
78
|
+
shape: z.string(),
|
|
79
|
+
priceCents: z.number().int(),
|
|
80
|
+
// S321 (P10): positions are 0 and up; the bound also gives the reference example a real value.
|
|
81
|
+
position: z.number().int().nonnegative(),
|
|
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"]);
|
|
58
90
|
export const MarketplaceListingSchema = z.object({
|
|
59
91
|
pluginId: z.string(),
|
|
60
92
|
name: z.string(),
|
|
@@ -62,9 +94,14 @@ export const MarketplaceListingSchema = z.object({
|
|
|
62
94
|
description: z.string(),
|
|
63
95
|
author: z.string(),
|
|
64
96
|
priceCents: z.number().int(),
|
|
97
|
+
// S316: priceCents is the lowest live paid plan's price, 0 when the
|
|
98
|
+
// listing has no live paid plan, so "priceCents > 0" means "has a live
|
|
99
|
+
// non-free plan" (what the CMS's isOfficiallyPaid asks). plans lists the
|
|
100
|
+
// live plans; optional, so an older marketplace that sends none validates.
|
|
101
|
+
plans: z.array(MarketplacePlanSchema).optional(),
|
|
65
102
|
coverImagePath: z.string().nullable(),
|
|
66
103
|
latestVersion: MarketplaceListingVersionSchema.nullable(),
|
|
67
|
-
// Computed SERVER-SIDE against this CMS's active dialect
|
|
104
|
+
// Computed SERVER-SIDE against this CMS's active dialect: the admin
|
|
68
105
|
// client never guesses compatibility from raw dialect lists.
|
|
69
106
|
compatible: z.boolean(),
|
|
70
107
|
// S304-94: whether this CMS satisfies the latest version's cmsVersion range,
|
|
@@ -81,13 +118,29 @@ export const MarketplaceListingSchema = z.object({
|
|
|
81
118
|
// newer by semver, has a package to download and supports this site's
|
|
82
119
|
// database. A newer or unreadable installed version is never an "update".
|
|
83
120
|
updateAvailable: z.boolean(),
|
|
121
|
+
// S319 (spec 3c): present, and true, only when the plugin is installed,
|
|
122
|
+
// the listing's latest version is newer, and the plugin's lapsed licence
|
|
123
|
+
// does not cover it (released after the term's end). `updateAvailable` is
|
|
124
|
+
// then false: no update is offered, the admin says "renew to get it".
|
|
125
|
+
renewToUpdate: z.literal(true).optional(),
|
|
126
|
+
// S322c fix wave (I1): present when the installed plugin holds the licence
|
|
127
|
+
// of the bundle that installed it: that bundle's plugin id, whose page is
|
|
128
|
+
// where the licence is bought and renewed.
|
|
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(),
|
|
84
137
|
});
|
|
85
138
|
// S148: a starter frontend the marketplace hosts as a versioned archive
|
|
86
|
-
// (Global Constraints
|
|
139
|
+
// (Global Constraints: a bundledTemplate WITHOUT an archive stays legal,
|
|
87
140
|
// hence hasArchive rather than always assuming a download exists) and the
|
|
88
141
|
// document types a template/section listing provisions on install. Both
|
|
89
142
|
// are projected server-side by the marketplace (starter-projection.ts) and
|
|
90
|
-
// only ever appear on the DETAIL surface, never on browse
|
|
143
|
+
// only ever appear on the DETAIL surface, never on browse: see
|
|
91
144
|
// MarketplaceListingDetailVersionSchema below.
|
|
92
145
|
export const MarketplaceStarterSchema = z.object({
|
|
93
146
|
name: z.string(),
|
|
@@ -99,7 +152,7 @@ export const MarketplaceDocumentTypeSummarySchema = z.object({
|
|
|
99
152
|
name: z.string(),
|
|
100
153
|
fields: z.array(z.string()),
|
|
101
154
|
});
|
|
102
|
-
// S153: a bundle's enriched member projection
|
|
155
|
+
// S153: a bundle's enriched member projection, snapshotted at ingest by
|
|
103
156
|
// the marketplace (bundle-members.ts), detail-only like the S148 starter
|
|
104
157
|
// fields (same extend-don't-widen browse protection below).
|
|
105
158
|
export const MarketplaceBundleMemberSchema = z.object({
|
|
@@ -108,6 +161,15 @@ export const MarketplaceBundleMemberSchema = z.object({
|
|
|
108
161
|
description: z.string().nullable(),
|
|
109
162
|
type: z.string(),
|
|
110
163
|
priceCents: z.number().int(),
|
|
164
|
+
// S322c (P9): the member's live from-price shape ("free", "one_time",
|
|
165
|
+
// "monthly", "yearly"). A string, never an enum: a newer marketplace never
|
|
166
|
+
// breaks an older admin (S292). Absent from a marketplace before S322c.
|
|
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(),
|
|
111
173
|
});
|
|
112
174
|
// Extends the base version shape rather than widening it: browse
|
|
113
175
|
// (MarketplaceListingSchema.latestVersion, MarketplaceListResponseSchema)
|
|
@@ -119,7 +181,7 @@ export const MarketplaceListingDetailVersionSchema = MarketplaceListingVersionSc
|
|
|
119
181
|
documentTypesSummary: z.array(MarketplaceDocumentTypeSummarySchema).nullable().optional(),
|
|
120
182
|
bundledMembers: z.array(MarketplaceBundleMemberSchema).nullable().optional(),
|
|
121
183
|
// S210: the package's own README, rendered by @kardalum/markdown in the
|
|
122
|
-
// 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:
|
|
123
185
|
// extending rather than widening is what keeps it off the browse screen,
|
|
124
186
|
// where the browse handler's response validation strips it back off.
|
|
125
187
|
readme: z.string().nullable().optional(),
|
|
@@ -135,6 +197,11 @@ export const MarketplaceListingDetailSchema = MarketplaceListingSchema.extend({
|
|
|
135
197
|
versions: z.array(MarketplaceListingDetailVersionSchema),
|
|
136
198
|
activeDialect: z.string(),
|
|
137
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(),
|
|
138
205
|
});
|
|
139
206
|
// S288g Task 0: the marketplace's OWN listing API (GET /api/v1/listings and
|
|
140
207
|
// GET /api/v1/listings/:pluginId, upstream of a CMS's proxy) carries the
|
|
@@ -153,6 +220,8 @@ export const MarketplacePublicBaseSchema = z.object({
|
|
|
153
220
|
export const MarketplaceListQuerySchema = z.object({
|
|
154
221
|
q: z.string().optional(),
|
|
155
222
|
type: z.string().optional(),
|
|
223
|
+
// S352: one category key; the marketplace ignores an unknown one.
|
|
224
|
+
category: z.string().optional(),
|
|
156
225
|
db: z.string().optional(),
|
|
157
226
|
cursor: z.string().uuid().optional(),
|
|
158
227
|
limit: z.coerce.number().int().min(1).max(50).default(24),
|
|
@@ -171,13 +240,42 @@ export const MARKETPLACE_VERSIONS_MAX_IDS = 50;
|
|
|
171
240
|
* this; the CMS's client therefore sends no id longer than 199 characters,
|
|
172
241
|
* so that fifty of them and their 49 commas (9,999 characters) always fit. */
|
|
173
242
|
export const MARKETPLACE_VERSIONS_IDS_MAX_LENGTH = 10_000;
|
|
243
|
+
/** S322b (P15): the most plan names one versions answer item carries. */
|
|
244
|
+
export const MARKETPLACE_PLAN_NAMES_MAX = 32;
|
|
245
|
+
/** S322b (P15): a plan's key and name, so a CMS can name the plan its stored
|
|
246
|
+
* licence verdict carries (the verdict carries the key only). */
|
|
247
|
+
export const MarketplacePlanNameSchema = z.object({ key: z.string().max(PLAN_KEY_MAX), name: z.string().max(PLAN_NAME_MAX) });
|
|
248
|
+
/** Drops each plan name entry the schema refuses and keeps at most
|
|
249
|
+
* MARKETPLACE_PLAN_NAMES_MAX (live plans come first). Anything not a list is
|
|
250
|
+
* passed on for the schema to refuse. */
|
|
251
|
+
function keepReadablePlanNames(value) {
|
|
252
|
+
if (!Array.isArray(value))
|
|
253
|
+
return value;
|
|
254
|
+
const kept = [];
|
|
255
|
+
for (const item of value) {
|
|
256
|
+
if (kept.length === MARKETPLACE_PLAN_NAMES_MAX)
|
|
257
|
+
break;
|
|
258
|
+
if (MarketplacePlanNameSchema.safeParse(item).success)
|
|
259
|
+
kept.push(item);
|
|
260
|
+
}
|
|
261
|
+
return kept;
|
|
262
|
+
}
|
|
174
263
|
/** What a CMS decides an update with: a listing's latest published version,
|
|
175
|
-
* reduced to
|
|
264
|
+
* reduced to the facts it compares (S319: and its release date). */
|
|
176
265
|
export const MarketplaceLatestVersionSchema = MarketplaceListingVersionSchema.pick({
|
|
177
266
|
version: true,
|
|
178
267
|
cmsVersion: true,
|
|
179
268
|
supportedDialects: true,
|
|
180
269
|
hasArtifact: true,
|
|
270
|
+
publishedAt: true,
|
|
271
|
+
declaresMembers: true,
|
|
272
|
+
}).extend({
|
|
273
|
+
// S322b (P15): every plan of the listing, retired ones too (a holder may
|
|
274
|
+
// hold one), live first. Optional: a marketplace from before S322b sends none.
|
|
275
|
+
// S322b fix wave (M3): tolerant, so a name past a cap (one side's cap
|
|
276
|
+
// changed before the other's) costs only that entry and a longer list only
|
|
277
|
+
// its tail, never the whole answer and with it every update badge.
|
|
278
|
+
planNames: z.preprocess(keepReadablePlanNames, z.array(MarketplacePlanNameSchema).max(MARKETPLACE_PLAN_NAMES_MAX)).optional(),
|
|
181
279
|
});
|
|
182
280
|
/** One item per published listing among the ids asked, in the order asked; an
|
|
183
281
|
* id with no published version is absent. Not strict: a key a newer
|
|
@@ -234,7 +332,7 @@ export const MarketplaceInstallBodySchema = z
|
|
|
234
332
|
answers: InstallAnswersSchema.optional(),
|
|
235
333
|
})
|
|
236
334
|
.strict();
|
|
237
|
-
// 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:
|
|
238
336
|
// "installed" (this operation installed it, ownership recorded) or
|
|
239
337
|
// "already-installed" (pre-existing, skipped, never claimed). Optional
|
|
240
338
|
// and absent for every non-bundle install, so single-plugin clients are
|
|
@@ -244,7 +342,14 @@ export const MarketplaceInstallMemberSchema = z.object({
|
|
|
244
342
|
version: z.string(),
|
|
245
343
|
outcome: z.enum(["installed", "already-installed"]),
|
|
246
344
|
});
|
|
247
|
-
|
|
345
|
+
/** S319 (spec 3c, plan P8): a fresh install of a version the licence's
|
|
346
|
+
* lapsed term does not cover installed the newest version it does cover
|
|
347
|
+
* instead; this names the version that was asked for and why. */
|
|
348
|
+
export const MarketplaceInstallHeldBackSchema = z.object({
|
|
349
|
+
requestedVersion: z.string(),
|
|
350
|
+
reason: z.literal("term_lapsed"),
|
|
351
|
+
});
|
|
352
|
+
// trustTier is a literal, not the broader TrustTier union: this door
|
|
248
353
|
// (S138) only ever answers 201 for a "verified" result; a non-"verified"
|
|
249
354
|
// verdict is a 422 failure response (ApiErrorSchema), never this shape.
|
|
250
355
|
export const MarketplaceInstallResponseSchema = z.object({
|
|
@@ -266,6 +371,8 @@ export const MarketplaceInstallResponseSchema = z.object({
|
|
|
266
371
|
// update did not apply as shipped, or removed. Absent on a fresh install
|
|
267
372
|
// and when there is nothing to say.
|
|
268
373
|
warnings: InstallWarningsSchema.optional(),
|
|
374
|
+
// S319: present only when the install held back to a covered version.
|
|
375
|
+
heldBack: MarketplaceInstallHeldBackSchema.optional(),
|
|
269
376
|
});
|
|
270
377
|
/** The 409 a marketplace install or update answers. `reason` is present
|
|
271
378
|
* only for "license-not-recorded" (S284, D4): the plugin IS installed (or
|
|
@@ -278,3 +385,31 @@ export const MarketplaceInstallConflictSchema = z.object({
|
|
|
278
385
|
reason: z.literal("license-not-recorded").optional(),
|
|
279
386
|
warnings: InstallWarningsSchema.optional(),
|
|
280
387
|
});
|
|
388
|
+
/** S319 (spec 3c): the 402 a marketplace install answers when the licence's
|
|
389
|
+
* lapsed term does not cover the version: always for an update, which is
|
|
390
|
+
* never downgraded, and for a fresh install with no older covered version
|
|
391
|
+
* to fall back to. Nothing was installed or changed. */
|
|
392
|
+
export const MarketplaceInstallRenewRequiredSchema = z.object({
|
|
393
|
+
message: z.string(),
|
|
394
|
+
reason: z.literal("renew-required"),
|
|
395
|
+
});
|
|
396
|
+
/** S322c (D5, plan P14): the most plugins a missing-dependency answer names. */
|
|
397
|
+
export const MARKETPLACE_MISSING_PLUGINS_MAX = 32;
|
|
398
|
+
/** One plugin a bundle install needs and the site does not have. `author`
|
|
399
|
+
* and `listingUrl` are null when the marketplace could not say. */
|
|
400
|
+
export const MarketplaceMissingPluginSchema = z.object({
|
|
401
|
+
pluginId: z.string(),
|
|
402
|
+
name: z.string(),
|
|
403
|
+
author: z.string().nullable(),
|
|
404
|
+
listingUrl: z.string().nullable(),
|
|
405
|
+
});
|
|
406
|
+
/** S322c (D5): the 422 a bundle install answers when a member needs a plugin
|
|
407
|
+
* outside the bundle. Nothing was installed; `message` is the whole sentence,
|
|
408
|
+
* `missing` names each plugin for a client that links to it. */
|
|
409
|
+
export const MarketplaceInstallDependenciesMissingSchema = z.object({
|
|
410
|
+
message: z.string(),
|
|
411
|
+
reason: z.literal("dependencies-missing"),
|
|
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(),
|
|
415
|
+
});
|
|
@@ -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,10 +1,11 @@
|
|
|
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";
|
|
4
5
|
// POST /api/manage/v1/media/folders body (S186e §2): name required, parentId
|
|
5
6
|
// optional (omitted/undefined = create at the library root). Duplicate
|
|
6
7
|
// name under the same parent -> 409, enforced by a real database
|
|
7
|
-
// constraint as of the fix wave (HIGH-1
|
|
8
|
+
// constraint as of the fix wave (HIGH-1: see media-service.ts's
|
|
8
9
|
// MediaFolderNameConflictError doc comment and schema.prisma's
|
|
9
10
|
// MediaFolder comment), surfaced through the service, not validated
|
|
10
11
|
// here.
|
|
@@ -18,7 +19,7 @@ export const CreateMediaFolderRequestSchema = z.object({
|
|
|
18
19
|
// folder. The cycle-guard (a folder cannot move under its own descendant)
|
|
19
20
|
// and the depth cap are enforced in the service, not here. `.refine`
|
|
20
21
|
// restores a 400 on a body with NEITHER field present (F5, final-review
|
|
21
|
-
// follow-up wave)
|
|
22
|
+
// follow-up wave), same reasoning and wording as UpdateMediaRequestSchema
|
|
22
23
|
// below's own `.refine`: an empty `{}` PATCH validates fine on its own and
|
|
23
24
|
// does nothing, which looks like a successful no-op update rather than
|
|
24
25
|
// the mistake it almost certainly is.
|
|
@@ -59,12 +60,17 @@ export const MediaFolderListResponseSchema = z.object({
|
|
|
59
60
|
// response rather than trusted from storage: for a PUBLIC item it's
|
|
60
61
|
// identical to the persisted `url` field (permanent, no query string);
|
|
61
62
|
// for a PRIVATE item it's that same path plus a freshly minted,
|
|
62
|
-
// short-lived `?token=` (S186c §3's signed media link)
|
|
63
|
+
// short-lived `?token=` (S186c §3's signed media link), a new one every
|
|
63
64
|
// response, so this value is for immediate use (rendering an `<img src>`
|
|
64
65
|
// now), not for persisting.
|
|
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
|
|
@@ -77,18 +83,18 @@ export const MediaDeleteResponseSchema = z.object({
|
|
|
77
83
|
success: z.literal(true),
|
|
78
84
|
});
|
|
79
85
|
// PATCH /api/manage/v1/media/:id body (S186c §2, folderId added S186e §2; renamed
|
|
80
|
-
// from UpdateMediaVisibilityRequestSchema in the fix wave
|
|
86
|
+
// from UpdateMediaVisibilityRequestSchema in the fix wave: it carries
|
|
81
87
|
// both visibility and folderId now, not just visibility, and the old
|
|
82
88
|
// name stopped describing it). Both fields optional and independent, same
|
|
83
89
|
// "absent = don't touch" idiom as UpdateMediaFolderRequestSchema above:
|
|
84
90
|
// visibility absent = don't flip it; folderId absent = don't move the
|
|
85
91
|
// file; folderId null = move to the library root; folderId a uuid = move
|
|
86
|
-
// under that folder (the service validates the folder exists first
|
|
87
|
-
// 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
|
|
88
94
|
// a bad id 500 out of the FK). `.refine` restores a 400 on a body with
|
|
89
95
|
// NEITHER field present: back when this schema only carried visibility
|
|
90
96
|
// (required, S186c), an empty body already 400'd for free; making both
|
|
91
|
-
// fields optional independently (S186e) silently dropped that
|
|
97
|
+
// fields optional independently (S186e) silently dropped that: an empty
|
|
92
98
|
// `{}` PATCH validated fine and did nothing. This puts it back explicitly
|
|
93
99
|
// rather than leaving a request that changes nothing looking like a
|
|
94
100
|
// successful update.
|
|
@@ -127,9 +133,9 @@ export const UpdateMediaRequestSchema = z
|
|
|
127
133
|
// page's last item. `search` filters by filename substring,
|
|
128
134
|
// case-insensitive. `folderId` (S186e §2) is a folder filter: ABSENT
|
|
129
135
|
// keeps the pre-S186e all-files behavior (compatibility-pinned by a
|
|
130
|
-
// dedicated test
|
|
136
|
+
// dedicated test: existing callers must see no change), "root" matches
|
|
131
137
|
// files with no folder AND files whose folderId dangles (binding
|
|
132
|
-
// obligation 3 from the S186e Task 1 review
|
|
138
|
+
// obligation 3 from the S186e Task 1 review: a damaged folderId must
|
|
133
139
|
// resurface at root, never vanish), a uuid matches exactly that folder.
|
|
134
140
|
export const MediaListQuerySchema = z.object({
|
|
135
141
|
cursor: z.string().uuid().optional(),
|
|
@@ -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;
|
|
@@ -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.
|
|
@@ -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>;
|