@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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { PluginReadOnlyNoticeSchema } from "./plugin-read-only.schema.js";
|
|
2
3
|
import { PluginRoleOfferSchema } from "./plugin-actions.schema.js";
|
|
3
4
|
import { InstallRoleOutcomeSchema } from "./plugin-install-record.schema.js";
|
|
4
5
|
import { SampleContentOutcomeSchema } from "./sample-content-outcome.schema.js";
|
|
@@ -7,8 +8,8 @@ import { STORAGE_TYPES } from "./plugin-vocabulary.js";
|
|
|
7
8
|
// The ADMIN management view of the registry (S135): unlike the public
|
|
8
9
|
// GET /api/plugins (enabled-only, boot-loader metadata), this surface
|
|
9
10
|
// lists every installed plugin, disabled included. licenseStatus reflects
|
|
10
|
-
// the PluginLicense row's last verdict ("valid" | "
|
|
11
|
-
// "domain_mismatch" | "unknown" | "grace_expired"), or null when the plugin has no license
|
|
11
|
+
// the PluginLicense row's last verdict ("valid" | "past_due" | "lapsed" |
|
|
12
|
+
// "revoked" | "domain_mismatch" | "unknown" | "grace_expired"), or null when the plugin has no license
|
|
12
13
|
// row at all (free plugins, or a paid plugin never validated yet,
|
|
13
14
|
// S138/S139). The three fields below (S139 Task 5) ride along so the
|
|
14
15
|
// admin's license cell can render an honest state without a second
|
|
@@ -16,28 +17,28 @@ import { STORAGE_TYPES } from "./plugin-vocabulary.js";
|
|
|
16
17
|
// server's explanation for a non-valid verdict), licenseLastValidatedAt
|
|
17
18
|
// mirrors lastValidatedAt (the last SUCCESSFUL verdict), and
|
|
18
19
|
// licenseLastAttemptError mirrors lastAttemptError (why the most recent
|
|
19
|
-
// ATTEMPT
|
|
20
|
+
// ATTEMPT (successful or not) failed to reach a verdict; null when it
|
|
20
21
|
// didn't). Together the last two let the cell compute "unreachable since"
|
|
21
22
|
// itself. boundDomain mirrors PluginLicense.boundDomain (the domain this
|
|
22
23
|
// site bound the license to at S138 install; never mutated by later
|
|
23
|
-
// revalidation
|
|
24
|
+
// revalidation; see revalidate-license.ts) so a domain_mismatch warning
|
|
24
25
|
// can name the actual bound domain instead of the raw upstream reason
|
|
25
|
-
// token (S139 fix wave, spec section 6). Never add `key` here
|
|
26
|
+
// token (S139 fix wave, spec section 6). Never add `key` here; see the
|
|
26
27
|
// route's comment on the same prisma select.
|
|
27
28
|
// licenseLocked / buyHref (S209 Task 7, hardened by the S209 criticals
|
|
28
|
-
// fix): whether THIS production domain has locked the plugin's admin UI
|
|
29
|
+
// fix): whether THIS production domain has locked the plugin's admin UI,
|
|
29
30
|
// distinct from licenseStatus === "domain_mismatch" on its own, which also
|
|
30
31
|
// covers the plain warn-only case (localhost, or any domain the license
|
|
31
32
|
// server hasn't been asked to lock on production for). True for either of
|
|
32
|
-
// two reasons: a stored domain_mismatch verdict, or
|
|
33
|
+
// two reasons: a stored domain_mismatch verdict, or (closing the gap a
|
|
33
34
|
// paid plugin side-loaded through the ZIP door left open, since that door
|
|
34
|
-
// never writes a PluginLicense row at all
|
|
35
|
+
// never writes a PluginLicense row at all) a plugin pluginRequiresLicense()
|
|
35
36
|
// (apps/server/src/licensing/entitlement.ts) reports as a paid marketplace
|
|
36
37
|
// listing with no valid licence on record. Computed at read time from the
|
|
37
38
|
// stored license row (plus, for the no-row case, a cached marketplace
|
|
38
39
|
// lookup) and the CURRENT request's own domain
|
|
39
40
|
// (apps/server/src/licensing/production-domain.ts's isProductionDomain),
|
|
40
|
-
// never persisted
|
|
41
|
+
// never persisted: a licensed plugin re-checked from a different admin
|
|
41
42
|
// domain must never keep yesterday's lock. `revoked` never sets this: that
|
|
42
43
|
// status already deactivates the plugin outright (see revalidate-license.ts),
|
|
43
44
|
// which is a different, harder consequence than a lock. buyHref is the
|
|
@@ -53,8 +54,18 @@ export const ManagedPluginRoleOfferSchema = PluginRoleOfferSchema.extend({ creat
|
|
|
53
54
|
export const PluginTamperKindSchema = z.enum(["foreign-package", "sideloaded", "modified-on-disk"]);
|
|
54
55
|
export const ManagedPluginSchema = z.object({
|
|
55
56
|
pluginId: z.string(),
|
|
57
|
+
// S318: present only when the licence term lapsed (the plugin is read-only).
|
|
58
|
+
readOnly: PluginReadOnlyNoticeSchema.optional(),
|
|
56
59
|
name: z.string(),
|
|
57
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`."),
|
|
58
69
|
version: z.string(),
|
|
59
70
|
trustTier: z.enum(["verified", "unverified"]),
|
|
60
71
|
storageType: z.enum(STORAGE_TYPES),
|
|
@@ -62,7 +73,7 @@ export const ManagedPluginSchema = z.object({
|
|
|
62
73
|
licenseStatus: z
|
|
63
74
|
.string()
|
|
64
75
|
.nullable()
|
|
65
|
-
.describe('The licence row\'s last verdict: "valid", "revoked", "domain_mismatch", "unknown", or "grace_expired" (no valid verdict within the grace period, so the plugin is switched off until one arrives). Null when the plugin has no licence row.'),
|
|
76
|
+
.describe('The licence row\'s last verdict: "valid", "past_due" (a renewal failed; the plugin works during 14 days of grace), "lapsed" (the term ended unpaid or cancelled; the plugin is read-only: it renders, its writes are refused), "revoked", "domain_mismatch", "unknown", or "grace_expired" (no valid verdict within the grace period, so the plugin is switched off until one arrives). Null when the plugin has no licence row.'),
|
|
66
77
|
licenseReason: z.string().nullable(),
|
|
67
78
|
// S284b fix wave: the signed `detail` of the latest verdict, today the
|
|
68
79
|
// marketplace operator's reason for a `domain_blocked` answer, which the
|
|
@@ -73,6 +84,25 @@ export const ManagedPluginSchema = z.object({
|
|
|
73
84
|
// (ISO), the clock the grace period runs on. Null before the first one.
|
|
74
85
|
licenseLastValidIssuedAt: z.string().nullable(),
|
|
75
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."),
|
|
76
106
|
boundDomain: z.string().nullable(),
|
|
77
107
|
// S284b: what THIS row's `enabled` was when a grace lock closed (the
|
|
78
108
|
// registry row's own value since the fix wave, so a bundle member keeps
|
|
@@ -86,6 +116,21 @@ export const ManagedPluginSchema = z.object({
|
|
|
86
116
|
// record (both above) and, since S284b, a grace_expired lock.
|
|
87
117
|
licenseLocked: z.boolean(),
|
|
88
118
|
buyHref: z.string().nullable(),
|
|
119
|
+
// S322b (P15): the plan the stored licence verdict names (its key, S317)
|
|
120
|
+
// and its name as the marketplace last named it, null when it never did.
|
|
121
|
+
// Absent when the verdict carries no plan (no licence, or one from before S317).
|
|
122
|
+
// S322c fix wave (M1): `bundle` is present when the licence is a bundle's
|
|
123
|
+
// (the member holds the bundle's key): the plan is then the bundle's.
|
|
124
|
+
licensePlan: z
|
|
125
|
+
.object({
|
|
126
|
+
key: z.string(),
|
|
127
|
+
name: z.string().nullable(),
|
|
128
|
+
bundle: z.object({ pluginId: z.string(), name: z.string() }).optional(),
|
|
129
|
+
})
|
|
130
|
+
// S322b polish (M11): a real plan, not the generator's page-name guess.
|
|
131
|
+
.meta({ example: { key: "basic", name: "Basic" } })
|
|
132
|
+
.optional()
|
|
133
|
+
.describe("The plan of this site's licence for the plugin: the verdict's plan key and the marketplace's name for it (null when unknown). Absent when no verdict names a plan. For a member holding the licence of the bundle that installed it, the plan is the bundle's and `bundle` names that bundle."),
|
|
89
134
|
// S273: the roles this plugin's attached manifest offers, so an uploaded
|
|
90
135
|
// or sideloaded plugin, which has no install screen, can have an offer
|
|
91
136
|
// accepted from the installed-plugins view. Empty when the manifest is
|
|
@@ -102,7 +147,14 @@ export const ManagedPluginSchema = z.object({
|
|
|
102
147
|
// before (a cold cache). The lookup fails open: a version learned earlier
|
|
103
148
|
// is served through a failure and its backoff, and while a lookup slower
|
|
104
149
|
// than the list's two-second wait runs.
|
|
105
|
-
|
|
150
|
+
// S319 (spec 3c, plan P7): `renewToUpdate` is present, and true, when the
|
|
151
|
+
// plugin's lapsed licence does not cover that version (released after the
|
|
152
|
+
// term's end): the admin says "renew to get it" and offers no update.
|
|
153
|
+
// `renewHref` is the listing's page on the marketplace, present with it
|
|
154
|
+
// when a marketplace is configured.
|
|
155
|
+
updateAvailable: z
|
|
156
|
+
.object({ version: z.string(), renewToUpdate: z.literal(true).optional(), renewHref: z.string().optional() })
|
|
157
|
+
.nullable(),
|
|
106
158
|
});
|
|
107
159
|
export const ManagedPluginListQuerySchema = z.object({
|
|
108
160
|
cursor: z.string().uuid().optional(),
|
|
@@ -114,13 +166,17 @@ export const ManagedPluginListResponseSchema = z.object({
|
|
|
114
166
|
// S284b: the grace period this server applies (KARDALUM_LICENSE_GRACE_DAYS,
|
|
115
167
|
// 1 to 14), so the admin's grace_expired sentence names the real days.
|
|
116
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(),
|
|
117
173
|
});
|
|
118
174
|
export const PluginIdParamsSchema = z.object({
|
|
119
175
|
pluginId: z.string().min(1),
|
|
120
176
|
});
|
|
121
177
|
// Fastify substitutes `null` for a genuinely absent body before handing it
|
|
122
178
|
// to the validator (lib/validation.js's validateParam: `isUndefined ? null
|
|
123
|
-
// : request[paramName]`)
|
|
179
|
+
// : request[paramName]`); a DELETE sent with no payload at all lands here
|
|
124
180
|
// as `null`, not `undefined`. `.nullish()` (not `.optional()`) is required
|
|
125
181
|
// so an absent body validates; `request.body?.confirmStructuredDataCleanup`
|
|
126
182
|
// in the route handler already tolerates both null and undefined.
|
|
@@ -136,14 +192,14 @@ export const UninstallPluginBodySchema = z
|
|
|
136
192
|
// dropped as an unknown key would be read as consent to remove.
|
|
137
193
|
.strict()
|
|
138
194
|
.nullish();
|
|
139
|
-
// 409 payload when a structured plugin's uninstall needs confirmation
|
|
195
|
+
// 409 payload when a structured plugin's uninstall needs confirmation:
|
|
140
196
|
// the snapshot has ALREADY been taken (S87's safe-to-retry design).
|
|
141
197
|
export const UninstallConfirmationRequiredSchema = z.object({
|
|
142
198
|
requiresConfirmation: z.literal(true),
|
|
143
199
|
snapshotGroupId: z.string(),
|
|
144
200
|
message: z.string(),
|
|
145
201
|
});
|
|
146
|
-
// S152: the BUNDLE uninstall's aggregated 409
|
|
202
|
+
// S152: the BUNDLE uninstall's aggregated 409: one snapshot group per
|
|
147
203
|
// structured plugin in the removal set (owned members, and the bundle
|
|
148
204
|
// itself if structured). A separate schema rather than widening
|
|
149
205
|
// UninstallConfirmationRequiredSchema: the single-plugin contract
|
|
@@ -158,14 +214,14 @@ export const BundleUninstallConfirmationRequiredSchema = z.object({
|
|
|
158
214
|
})),
|
|
159
215
|
message: z.string(),
|
|
160
216
|
});
|
|
161
|
-
// F1 QA fix wave: the content-guard 409
|
|
217
|
+
// F1 QA fix wave: the content-guard 409: a single-plugin uninstall()
|
|
162
218
|
// blocked because one or more of its tracked document types still have
|
|
163
219
|
// content or templates referencing them. Distinct from the two
|
|
164
220
|
// confirmation schemas above (those are "confirm to proceed," this is a
|
|
165
221
|
// terminal refusal the caller must resolve by hand, never retried with a
|
|
166
222
|
// flag) and from the bare ApiErrorSchema (that still covers every OTHER
|
|
167
223
|
// refusal this route can throw, e.g. a bundle member blocked by an outside
|
|
168
|
-
// dependent)
|
|
224
|
+
// dependent); a separate shape so `blockedBy` only ever appears when the
|
|
169
225
|
// server actually has a list of named blockers to put in it.
|
|
170
226
|
// contentCount is optional: the guard only knows a count for the
|
|
171
227
|
// "has-content" reason, not "has-templates" (document-type-service.ts's
|
|
@@ -177,15 +233,21 @@ export const UninstallBlockedByDocumentTypesSchema = z.object({
|
|
|
177
233
|
contentCount: z.number().int().nonnegative().optional(),
|
|
178
234
|
})),
|
|
179
235
|
});
|
|
180
|
-
// Task 6: the 200 success body for a single-plugin DELETE
|
|
236
|
+
// Task 6: the 200 success body for a single-plugin DELETE: the CONFIRMED
|
|
181
237
|
// pass's freshly-minted snapshotGroupId (the gate site already took it;
|
|
182
238
|
// this just stops discarding it), null for a simple-storage plugin (never
|
|
183
239
|
// snapshotted) or for the earlier PluginRegistry.uninstall() callers that
|
|
184
240
|
// route around the HTTP layer entirely.
|
|
241
|
+
// S314o3 (D4): the uninstall also removes the plugin's unused data types after writing them into
|
|
242
|
+
// a snapshot of their own; the answer names them and that snapshot group (null when the plugin
|
|
243
|
+
// had none), so a client can say where the record is. Optional for the PluginRegistry callers
|
|
244
|
+
// that answer without them.
|
|
185
245
|
export const UninstallSucceededSchema = z.object({
|
|
186
246
|
snapshotGroupId: z.string().nullable(),
|
|
247
|
+
dataTypesSnapshotGroupId: z.string().nullable().optional(),
|
|
248
|
+
removedDataTypes: z.array(z.string()).optional(),
|
|
187
249
|
});
|
|
188
|
-
// Task 6: the 200 success body for a BUNDLE DELETE
|
|
250
|
+
// Task 6: the 200 success body for a BUNDLE DELETE: one entry per
|
|
189
251
|
// structured plugin in the cascade (owned members, and the bundle itself
|
|
190
252
|
// if structured) that got a fresh snapshot on this confirmed pass. Simple-
|
|
191
253
|
// storage members never appear here, same as the 409 aggregate above.
|
|
@@ -194,8 +256,20 @@ export const BundleUninstallSucceededSchema = z.object({
|
|
|
194
256
|
pluginId: z.string(),
|
|
195
257
|
snapshotGroupId: z.string(),
|
|
196
258
|
})),
|
|
259
|
+
// S314o3 (D4): the data types the cascade removed, by name, and one entry per plugin of the set
|
|
260
|
+
// whose uninstall wrote a data type snapshot, with that group.
|
|
261
|
+
removedDataTypes: z.array(z.string()).optional(),
|
|
262
|
+
dataTypesSnapshots: z
|
|
263
|
+
.array(z.object({
|
|
264
|
+
pluginId: z.string(),
|
|
265
|
+
snapshotGroupId: z.string(),
|
|
266
|
+
}))
|
|
267
|
+
.optional(),
|
|
268
|
+
// S314c5: a member's data type the cascade kept for another member and then could not remove,
|
|
269
|
+
// because a field outside the bundle started using it meanwhile. It stays, by name.
|
|
270
|
+
leftDataTypes: z.array(z.string()).optional(),
|
|
197
271
|
});
|
|
198
|
-
// S180: whether this instance has a marketplace to browse at all
|
|
272
|
+
// S180: whether this instance has a marketplace to browse at all:
|
|
199
273
|
// `getMarketplaceBaseUrl()` returning undefined (KARDALUM_MARKETPLACE_URL
|
|
200
274
|
// explicitly set to "off", or blank) means `configured: false`. Distinct
|
|
201
275
|
// from the marketplace being unreachable (a `configured: true` instance
|
|
@@ -210,15 +284,19 @@ export const MarketplaceStatusResponseSchema = z.object({
|
|
|
210
284
|
// RevalidationOutcome, flattened for the wire. `checked: false` covers
|
|
211
285
|
// every fail-open case that still has a license row to report on
|
|
212
286
|
// (unreachable license server, no KARDALUM_SITE_DOMAIN, no marketplace
|
|
213
|
-
// configured)
|
|
287
|
+
// configured): `status` and `lastValidatedAt` stay null in that shape
|
|
214
288
|
// since nothing was verified. A plugin with no license row at all gets a
|
|
215
|
-
// 404 instead of this body (ApiErrorSchema)
|
|
289
|
+
// 404 instead of this body (ApiErrorSchema), as there's nothing to recheck.
|
|
216
290
|
export const LicenseRecheckResponseSchema = z.object({
|
|
217
291
|
pluginId: z.string(),
|
|
218
292
|
checked: z.boolean(),
|
|
219
293
|
status: z.string().nullable(),
|
|
220
294
|
reason: z.string().nullable(),
|
|
221
295
|
lastValidatedAt: z.string().nullable(),
|
|
296
|
+
// S324 (spec item 9): why a `checked: false` answer checked nothing, when the
|
|
297
|
+
// server knows: "site-domain-missing" (no KARDALUM_SITE_DOMAIN). A string, not
|
|
298
|
+
// an enum, so a newer server's reason never breaks an older admin (S292).
|
|
299
|
+
skipped: z.string().optional(),
|
|
222
300
|
});
|
|
223
301
|
// S284b (design 3.2): the host's latest licence verdict for a plugin, valid
|
|
224
302
|
// or not, handed to the plugin's own code unchanged so the plugin can verify
|
|
@@ -226,6 +304,25 @@ export const LicenseRecheckResponseSchema = z.object({
|
|
|
226
304
|
// @kardalum/plugin-package's LicenseVerdictEnvelope; a verdict is public
|
|
227
305
|
// and signed, never a secret (the licence key never appears in it, only its
|
|
228
306
|
// hash).
|
|
307
|
+
// S317: the term a verdict carries, signed by its termSignature. `state` is
|
|
308
|
+
// a string, not an enum, so a host keeps serving a verdict whose state a
|
|
309
|
+
// newer marketplace added (the S292 tolerance rule); the marketplace writes
|
|
310
|
+
// "active", "renewing", "past_due" or "lapsed".
|
|
311
|
+
export const LicenseVerdictTermSchema = z.object({
|
|
312
|
+
state: z.string(),
|
|
313
|
+
endsAt: z.string().nullable(),
|
|
314
|
+
renewalAmountCents: z.number().int().nullable(),
|
|
315
|
+
cancelAtPeriodEnd: z.boolean(),
|
|
316
|
+
});
|
|
317
|
+
// S317: a live plan of the listing, as a non-production host hands it to
|
|
318
|
+
// the plugin for its local evaluation (entitlementPlan's highest plan).
|
|
319
|
+
export const ListingPlanSummarySchema = z.object({
|
|
320
|
+
key: z.string(),
|
|
321
|
+
shape: z.string(),
|
|
322
|
+
priceCents: z.number().int(),
|
|
323
|
+
// S321 (P10): positions are 0 and up; the bound also gives the reference example a real value.
|
|
324
|
+
position: z.number().int().nonnegative(),
|
|
325
|
+
});
|
|
229
326
|
export const LicenseVerdictEnvelopeSchema = z.object({
|
|
230
327
|
v: z.literal(1),
|
|
231
328
|
alg: z.literal("ed25519"),
|
|
@@ -243,6 +340,10 @@ export const LicenseVerdictEnvelopeSchema = z.object({
|
|
|
243
340
|
tamper: PluginTamperKindSchema.optional(),
|
|
244
341
|
// The signed human sentence explaining `reason` (a domain block's reason).
|
|
245
342
|
detail: z.string().max(500).optional(),
|
|
343
|
+
// S317: the plan key and the term, covered by the verdict's termSignature
|
|
344
|
+
// (never by `signature`); absent on a verdict from before S317.
|
|
345
|
+
planId: z.string().max(64).optional(),
|
|
346
|
+
term: LicenseVerdictTermSchema.optional(),
|
|
246
347
|
});
|
|
247
348
|
// The tagged entitlement (S284b fix wave), the same value plugin server code
|
|
248
349
|
// receives on `context.entitlement`: `exempt` on a non-production install
|
|
@@ -250,12 +351,18 @@ export const LicenseVerdictEnvelopeSchema = z.object({
|
|
|
250
351
|
// no verdict for the plugin (the plugin's check refuses with `missing`), and
|
|
251
352
|
// `verdict` with the stored verdict to verify.
|
|
252
353
|
export const EntitlementSchema = z.discriminatedUnion("kind", [
|
|
253
|
-
z.object({
|
|
354
|
+
z.object({
|
|
355
|
+
kind: z.literal("exempt"),
|
|
356
|
+
reason: z.literal("non-production"),
|
|
357
|
+
listingPlans: z.array(ListingPlanSummarySchema).optional(),
|
|
358
|
+
}),
|
|
254
359
|
z.object({
|
|
255
360
|
kind: z.literal("verdict"),
|
|
256
361
|
envelope: LicenseVerdictEnvelopeSchema,
|
|
257
362
|
/** base64 Ed25519 signature over the envelope's canonical form. */
|
|
258
363
|
signature: z.string(),
|
|
364
|
+
/** S317: base64 Ed25519 signature over the envelope with its plan and term appended; absent when it carries neither. */
|
|
365
|
+
termSignature: z.string().optional(),
|
|
259
366
|
}),
|
|
260
367
|
z.object({ kind: z.literal("none") }),
|
|
261
368
|
]);
|
|
@@ -270,6 +377,8 @@ export const EntitlementSchema = z.discriminatedUnion("kind", [
|
|
|
270
377
|
export const EntitlementResponseSchema = z.object({
|
|
271
378
|
entitlement: EntitlementSchema,
|
|
272
379
|
valid: z.boolean(),
|
|
380
|
+
// S318: present only when the plugin is read-only.
|
|
381
|
+
readOnly: PluginReadOnlyNoticeSchema.optional(),
|
|
273
382
|
});
|
|
274
383
|
// The 403 a plugin API route answers when its handler throws the SDK's
|
|
275
384
|
// EntitlementError (`requireEntitlement` refused the verdict). `reason` is
|
|
@@ -281,13 +390,13 @@ export const EntitlementRefusalSchema = z.object({
|
|
|
281
390
|
});
|
|
282
391
|
// S154 Task 4: a plugin's structured-data snapshot GROUPS, derived from
|
|
283
392
|
// PluginStructuredSnapshot (GROUP BY snapshotGroupId) rather than tracked
|
|
284
|
-
// by their own table
|
|
393
|
+
// by their own table; see apps/server/src/plugins/snapshot-groups.ts for
|
|
285
394
|
// the derivation. takenAt is the group's earliest row's createdAt (every
|
|
286
395
|
// row in a group is written in one snapshotPluginTables() call, so in
|
|
287
|
-
// practice they're all within the same transaction-ish burst
|
|
396
|
+
// practice they're all within the same transaction-ish burst, and min is a
|
|
288
397
|
// defensive, not load-bearing, choice). trigger rides along from Task 3's
|
|
289
398
|
// column ("uninstall", "restore", or null for pre-Task-3 rows). status
|
|
290
|
-
// compares the group's own tableNames against totalTableCount
|
|
399
|
+
// compares the group's own tableNames against totalTableCount, the
|
|
291
400
|
// UNION of distinct tableNames across ALL of the plugin's snapshot rows,
|
|
292
401
|
// the only denominator that survives an uninstall (which deletes the
|
|
293
402
|
// PluginStructuredTable tracking rows, never the snapshots themselves).
|
|
@@ -308,7 +417,7 @@ export const SnapshotGroupListResponseSchema = z.object({
|
|
|
308
417
|
items: z.array(SnapshotGroupSchema), // newest first
|
|
309
418
|
nextCursor: z.string().nullable(),
|
|
310
419
|
});
|
|
311
|
-
// S154 Task 5: the UNION restore plan
|
|
420
|
+
// S154 Task 5: the UNION restore plan: the newest available snapshot copy
|
|
312
421
|
// of each DISTINCT table this plugin has ever snapshotted, chosen
|
|
313
422
|
// independently per table across every group (not "pick one group and use
|
|
314
423
|
// only its tables"). This is what makes restore recover from the S87
|
|
@@ -319,12 +428,12 @@ export const RestorePlanEntrySchema = z.object({
|
|
|
319
428
|
snapshotGroupId: z.string(),
|
|
320
429
|
groupTakenAt: z.string(),
|
|
321
430
|
});
|
|
322
|
-
// 409 payload for an unconfirmed restore
|
|
431
|
+
// 409 payload for an unconfirmed restore: nothing has been touched yet,
|
|
323
432
|
// the plan is offered for the admin to review before confirming. planHash
|
|
324
433
|
// (S161, S154 rider) is a stable digest of this exact plan: the confirm
|
|
325
434
|
// request must echo it back, and the handler refuses to proceed if a fresh
|
|
326
435
|
// re-plan hashes differently (a snapshot landed between the operator
|
|
327
|
-
// seeing this plan and confirming it)
|
|
436
|
+
// seeing this plan and confirming it), closing the requestRestorePlan ->
|
|
328
437
|
// confirmRestore TOCTOU. A mismatch response reuses this same schema, with
|
|
329
438
|
// a fresh plan/planHash and a message explaining the plan changed.
|
|
330
439
|
export const RestoreConfirmationRequiredSchema = z.object({
|
|
@@ -334,7 +443,7 @@ export const RestoreConfirmationRequiredSchema = z.object({
|
|
|
334
443
|
message: z.string(),
|
|
335
444
|
});
|
|
336
445
|
export const RestoreSucceededSchema = z.object({
|
|
337
|
-
// The pre-restore safety snapshot's group id
|
|
446
|
+
// The pre-restore safety snapshot's group id, null only when the
|
|
338
447
|
// plugin had no live tracked tables to protect (restoring onto empty).
|
|
339
448
|
preRestoreSnapshotGroupId: z.string().nullable(),
|
|
340
449
|
restoredTables: z.array(z.string()),
|
|
@@ -345,7 +454,7 @@ export const RestoreSucceededSchema = z.object({
|
|
|
345
454
|
// (not `.optional()`) is required for an absent body to validate at all.
|
|
346
455
|
// planHash (S161, S154 rider) is optional at the schema level only
|
|
347
456
|
// because the SAME body shape covers the unconfirmed call (`{}`, no plan
|
|
348
|
-
// to hash yet)
|
|
457
|
+
// to hash yet), so the route handler enforces it as effectively required
|
|
349
458
|
// whenever confirmRestore is true: a confirm with a missing or stale
|
|
350
459
|
// planHash is refused exactly the same way (409, fresh plan reissued).
|
|
351
460
|
export const RestoreBodySchema = z
|
|
@@ -354,9 +463,42 @@ export const RestoreBodySchema = z
|
|
|
354
463
|
planHash: z.string().optional(),
|
|
355
464
|
})
|
|
356
465
|
.nullish();
|
|
466
|
+
// S314c5 (D1, D2): restoring the data types an uninstall recorded (the row under the trigger
|
|
467
|
+
// "uninstall-data-types" in the snapshot table), in the two-step form of the table restore above:
|
|
468
|
+
// an unconfirmed call answers 409 with the plan and its hash, a confirmed call with that hash
|
|
469
|
+
// writes. A data type that cannot come back is skipped with its reason and every other one is
|
|
470
|
+
// restored: its id or its name exists again, its editor's plugin is missing or switched off, or
|
|
471
|
+
// its settings no longer pass its editor's settings schema.
|
|
472
|
+
export const DataTypeRestoreSkipReasonSchema = z.enum(["id-exists", "name-taken", "editor-missing", "editor-inactive", "settings-invalid"]);
|
|
473
|
+
export const DataTypeRestoreEntrySchema = z.object({ id: z.string(), name: z.string() });
|
|
474
|
+
export const DataTypeRestoreSkipSchema = DataTypeRestoreEntrySchema.extend({ reason: DataTypeRestoreSkipReasonSchema });
|
|
475
|
+
export const DataTypeRestorePlanSchema = z.object({
|
|
476
|
+
snapshotGroupId: z.string(),
|
|
477
|
+
restore: z.array(DataTypeRestoreEntrySchema),
|
|
478
|
+
skip: z.array(DataTypeRestoreSkipSchema),
|
|
479
|
+
});
|
|
480
|
+
export const DataTypeRestoreConfirmationRequiredSchema = DataTypeRestorePlanSchema.extend({
|
|
481
|
+
requiresConfirmation: z.literal(true),
|
|
482
|
+
planHash: z.string(),
|
|
483
|
+
message: z.string(),
|
|
484
|
+
});
|
|
485
|
+
export const DataTypeRestoreSucceededSchema = z.object({
|
|
486
|
+
snapshotGroupId: z.string(),
|
|
487
|
+
restored: z.array(DataTypeRestoreEntrySchema),
|
|
488
|
+
skipped: z.array(DataTypeRestoreSkipSchema),
|
|
489
|
+
});
|
|
490
|
+
// Nullish for the reason RestoreBodySchema is: an absent body lands as null. snapshotGroupId names
|
|
491
|
+
// a record other than the latest; planHash is required in effect whenever confirmRestore is true.
|
|
492
|
+
export const DataTypeRestoreBodySchema = z
|
|
493
|
+
.object({
|
|
494
|
+
snapshotGroupId: z.string().min(1).max(191).optional(),
|
|
495
|
+
confirmRestore: z.boolean().optional(),
|
|
496
|
+
planHash: z.string().optional(),
|
|
497
|
+
})
|
|
498
|
+
.nullish();
|
|
357
499
|
// The second install door (Task 4): POST /api/manage/v1/plugins/upload lands an
|
|
358
500
|
// admin-uploaded .zip through the same installPackageArchive spine the
|
|
359
|
-
// marketplace uses, but with no marketplace signature to check
|
|
501
|
+
// marketplace uses, but with no marketplace signature to check, so trust is
|
|
360
502
|
// always the literal "unregistered" here, never the registry's own
|
|
361
503
|
// "verified" | "unverified" tier (ManagedPluginSchema.trustTier above).
|
|
362
504
|
// That tier answers "did a signature check pass"; `trust: "unregistered"`
|
|
@@ -408,6 +550,14 @@ export const PackageRefusedSchema = z.object({
|
|
|
408
550
|
message: z.string(),
|
|
409
551
|
reasons: z.array(z.string()),
|
|
410
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
|
+
});
|
|
411
561
|
/** S274c: the 409 an upload over a verified plugin answers before it stores
|
|
412
562
|
* anything, until the retry carries confirmTrustDowngrade=true. */
|
|
413
563
|
export const TrustDowngradeConfirmationSchema = z.object({
|
|
@@ -417,3 +567,18 @@ export const TrustDowngradeConfirmationSchema = z.object({
|
|
|
417
567
|
pluginName: z.string(),
|
|
418
568
|
message: z.string(),
|
|
419
569
|
});
|
|
570
|
+
// S314o3 (D3): the 409 of a switch-off or an uninstall refused because document type fields still
|
|
571
|
+
// use one of the plugin's data types (outside the plugin's own document types, which go with it).
|
|
572
|
+
// A key of its own beside `blockedBy`, which keeps meaning "still has content". `kind` lets a
|
|
573
|
+
// client link to the right editor; `dataType` is the data type's name, or the editor id for a
|
|
574
|
+
// field written before named data types.
|
|
575
|
+
export const DataTypeFieldBlockerSchema = z.object({
|
|
576
|
+
documentTypeId: z.string(),
|
|
577
|
+
documentType: z.string(),
|
|
578
|
+
kind: z.enum(["page", "element", "media"]),
|
|
579
|
+
fields: z.array(z.object({ id: z.string(), name: z.string(), dataType: z.string() })),
|
|
580
|
+
});
|
|
581
|
+
export const PluginDataTypesInUseSchema = z.object({
|
|
582
|
+
message: z.string(),
|
|
583
|
+
blockedByFields: z.array(DataTypeFieldBlockerSchema),
|
|
584
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const PLUGIN_READ_ONLY_CODE: "plugin_read_only";
|
|
3
|
+
export declare const PluginReadOnlyNoticeSchema: z.ZodObject<{
|
|
4
|
+
code: z.ZodLiteral<"plugin_read_only">;
|
|
5
|
+
pluginId: z.ZodString;
|
|
6
|
+
pluginName: z.ZodString;
|
|
7
|
+
canRenew: z.ZodBoolean;
|
|
8
|
+
message: z.ZodString;
|
|
9
|
+
renewUrl: z.ZodOptional<z.ZodString>;
|
|
10
|
+
lapsedAt: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
export type PluginReadOnlyNotice = z.infer<typeof PluginReadOnlyNoticeSchema>;
|
|
13
|
+
export declare function isPluginReadOnlyNotice(value: unknown): value is PluginReadOnlyNotice;
|
|
14
|
+
export declare const ReadOnlyFieldSchema: z.ZodObject<{
|
|
15
|
+
fieldAlias: z.ZodString;
|
|
16
|
+
pluginId: z.ZodString;
|
|
17
|
+
message: z.ZodString;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export type ReadOnlyField = z.infer<typeof ReadOnlyFieldSchema>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// S318 (spec D7): what a refused write of a lapsed plugin answers, and what the
|
|
3
|
+
// plugin list, the entitlement route and the data type list carry for one.
|
|
4
|
+
// `message` is English for API readers; the admin words the notice in its own
|
|
5
|
+
// language from the other fields (plan P3). `canRenew` says whether the caller
|
|
6
|
+
// holds plugins.update (spec D2), which the server always knows; `renewUrl` and
|
|
7
|
+
// `lapsedAt` are only present when it does, and even then only when the
|
|
8
|
+
// marketplace is configured and the verdict carried the term's end.
|
|
9
|
+
export const PLUGIN_READ_ONLY_CODE = "plugin_read_only";
|
|
10
|
+
export const PluginReadOnlyNoticeSchema = z.object({
|
|
11
|
+
code: z.literal(PLUGIN_READ_ONLY_CODE),
|
|
12
|
+
pluginId: z.string(),
|
|
13
|
+
pluginName: z.string(),
|
|
14
|
+
/** Whether the caller may renew (holds plugins.update): the admin words the notice on this. */
|
|
15
|
+
canRenew: z.boolean(),
|
|
16
|
+
message: z.string(),
|
|
17
|
+
renewUrl: z.string().optional(),
|
|
18
|
+
/** The lapsed term's end (ISO). */
|
|
19
|
+
lapsedAt: z.string().optional(),
|
|
20
|
+
});
|
|
21
|
+
export function isPluginReadOnlyNotice(value) {
|
|
22
|
+
return PluginReadOnlyNoticeSchema.safeParse(value).success;
|
|
23
|
+
}
|
|
24
|
+
// S318 (spec 3b): a field a save tried to change while its data type's plugin
|
|
25
|
+
// is read-only. Its stored value was kept. `fieldAlias` is the field's id.
|
|
26
|
+
// `message` is worded for the caller the way the notice is (spec D2): the
|
|
27
|
+
// content and public API write routes reword it for a caller holding
|
|
28
|
+
// plugins.update.
|
|
29
|
+
export const ReadOnlyFieldSchema = z.object({
|
|
30
|
+
fieldAlias: z.string(),
|
|
31
|
+
pluginId: z.string(),
|
|
32
|
+
message: z.string(),
|
|
33
|
+
});
|
|
@@ -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();
|
|
@@ -23,6 +23,15 @@ export declare const RESERVED_ASSET_ROOTS: readonly ["kardalum", "api", "docs",
|
|
|
23
23
|
/** A registered asset is read as UTF-8 text and kept with version history; a
|
|
24
24
|
* binary would be mangled. Binaries ship as unregistered public/ files. */
|
|
25
25
|
export declare const REGISTERED_ASSET_TEXT_EXTENSIONS: readonly ["css", "js", "mjs", "json", "svg", "txt", "md"];
|
|
26
|
+
/** S314c3 (fix wave): the extensions a site reads as text under public/ (the
|
|
27
|
+
* asset editor's files), each held to the asset limit wherever it lands: the
|
|
28
|
+
* upload route, the install pre-check and the build check, from this one list
|
|
29
|
+
* so the three cannot drift. Wider than the registered list: an undeclared
|
|
30
|
+
* file may be any of these. */
|
|
31
|
+
export declare const ASSET_TEXT_EXTENSIONS: readonly ["css", "js", "mjs", "cjs", "json", "svg", "txt", "md", "html", "htm", "xml", "map", "webmanifest"];
|
|
32
|
+
/** Whether a public/ path is a text file by its extension (ASSET_TEXT_EXTENSIONS);
|
|
33
|
+
* a name with no extension, or a dotfile with none of its own, is not. */
|
|
34
|
+
export declare function isAssetTextPath(path: string): boolean;
|
|
26
35
|
export declare function hasRegisteredAssetTextExtension(value: string): boolean;
|
|
27
36
|
export declare const PluginTemplateAliasSchema: z.ZodString;
|
|
28
37
|
export declare const PluginTemplateFileSchema: z.ZodString;
|
|
@@ -58,7 +67,7 @@ export interface DeclarationIssue {
|
|
|
58
67
|
path: (string | number)[];
|
|
59
68
|
message: string;
|
|
60
69
|
}
|
|
61
|
-
/** The cross-entry rules: unique
|
|
70
|
+
/** The cross-entry rules: aliases unique per kind, unique files and asset paths, and a page
|
|
62
71
|
* template's documentType resolving against this manifest's own documentTypes. */
|
|
63
72
|
export declare function checkTemplateAndAssetDeclarations(value: {
|
|
64
73
|
templates?: ReadonlyArray<{
|
|
@@ -33,12 +33,27 @@ export const RESERVED_ASSET_ROOTS = RESERVED_ROOT_SLUGS;
|
|
|
33
33
|
/** A registered asset is read as UTF-8 text and kept with version history; a
|
|
34
34
|
* binary would be mangled. Binaries ship as unregistered public/ files. */
|
|
35
35
|
export const REGISTERED_ASSET_TEXT_EXTENSIONS = ["css", "js", "mjs", "json", "svg", "txt", "md"];
|
|
36
|
+
/** S314c3 (fix wave): the extensions a site reads as text under public/ (the
|
|
37
|
+
* asset editor's files), each held to the asset limit wherever it lands: the
|
|
38
|
+
* upload route, the install pre-check and the build check, from this one list
|
|
39
|
+
* so the three cannot drift. Wider than the registered list: an undeclared
|
|
40
|
+
* file may be any of these. */
|
|
41
|
+
export const ASSET_TEXT_EXTENSIONS = ["css", "js", "mjs", "cjs", "json", "svg", "txt", "md", "html", "htm", "xml", "map", "webmanifest"];
|
|
36
42
|
const TEMPLATE_ALIAS_REGEX = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
37
43
|
// Starts alphanumeric, then alphanumeric, dot, dash, underscore: this alone
|
|
38
44
|
// rejects "." and ".." segments, so no separate traversal check is needed.
|
|
39
45
|
const PATH_SEGMENT_REGEX = /^[a-z0-9][a-z0-9._-]*$/i;
|
|
40
46
|
const isRelativeSlashPath = (value) => value.length > 0 && !value.startsWith("/") && !value.includes("\\");
|
|
41
47
|
const hasValidSegments = (value) => value.split("/").every((segment) => PATH_SEGMENT_REGEX.test(segment));
|
|
48
|
+
/** Whether a public/ path is a text file by its extension (ASSET_TEXT_EXTENSIONS);
|
|
49
|
+
* a name with no extension, or a dotfile with none of its own, is not. */
|
|
50
|
+
export function isAssetTextPath(path) {
|
|
51
|
+
const base = path.split("/").pop() ?? path;
|
|
52
|
+
const dot = base.lastIndexOf(".");
|
|
53
|
+
if (dot <= 0)
|
|
54
|
+
return false;
|
|
55
|
+
return ASSET_TEXT_EXTENSIONS.includes(base.slice(dot + 1).toLowerCase());
|
|
56
|
+
}
|
|
42
57
|
export function hasRegisteredAssetTextExtension(value) {
|
|
43
58
|
const base = value.split("/").pop() ?? value;
|
|
44
59
|
const dot = base.lastIndexOf(".");
|
|
@@ -90,7 +105,7 @@ export const PluginTemplatePayloadSchema = z
|
|
|
90
105
|
assets: z.array(PluginAssetPathSchema).optional(),
|
|
91
106
|
})
|
|
92
107
|
.passthrough();
|
|
93
|
-
/** The cross-entry rules: unique
|
|
108
|
+
/** The cross-entry rules: aliases unique per kind, unique files and asset paths, and a page
|
|
94
109
|
* template's documentType resolving against this manifest's own documentTypes. */
|
|
95
110
|
export function checkTemplateAndAssetDeclarations(value) {
|
|
96
111
|
const issues = [];
|
|
@@ -98,10 +113,15 @@ export function checkTemplateAndAssetDeclarations(value) {
|
|
|
98
113
|
const seenAliases = new Set();
|
|
99
114
|
const seenFiles = new Set();
|
|
100
115
|
(value.templates ?? []).forEach((template, index) => {
|
|
101
|
-
|
|
102
|
-
|
|
116
|
+
// S314o2 (D2): an alias is unique per kind, as on the server, so a page and a partial may share one.
|
|
117
|
+
const aliasKey = `${template.kind}:${template.alias}`;
|
|
118
|
+
if (seenAliases.has(aliasKey)) {
|
|
119
|
+
issues.push({
|
|
120
|
+
path: ["templates", index, "alias"],
|
|
121
|
+
message: `Duplicate template alias "${template.alias}" among the ${template.kind} templates: aliases must be unique per kind within a manifest`,
|
|
122
|
+
});
|
|
103
123
|
}
|
|
104
|
-
seenAliases.add(
|
|
124
|
+
seenAliases.add(aliasKey);
|
|
105
125
|
if (seenFiles.has(template.file)) {
|
|
106
126
|
issues.push({ path: ["templates", index, "file"], message: `Duplicate template file "${template.file}": files must be unique within a manifest` });
|
|
107
127
|
}
|
|
@@ -239,6 +239,11 @@ export declare const PublicTemplateListResponseSchema: z.ZodObject<{
|
|
|
239
239
|
}, z.core.$strip>;
|
|
240
240
|
export type PublicTemplateListResponse = z.infer<typeof PublicTemplateListResponseSchema>;
|
|
241
241
|
export declare const PublicContentWriteResponseSchema: z.ZodObject<{
|
|
242
|
+
readOnlyFields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
243
|
+
fieldAlias: z.ZodString;
|
|
244
|
+
pluginId: z.ZodString;
|
|
245
|
+
message: z.ZodString;
|
|
246
|
+
}, z.core.$strip>>>;
|
|
242
247
|
id: z.ZodString;
|
|
243
248
|
documentTypeId: z.ZodString;
|
|
244
249
|
parentId: z.ZodNullable<z.ZodString>;
|