@kardalum/plugin-sdk 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +67 -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-settings-schemas.d.ts +2 -0
- package/dist/built-in-settings-schemas.js +27 -0
- package/dist/built-in-value-schemas.js +3 -0
- package/dist/built-ins.js +10 -1
- package/dist/capabilities.js +5 -0
- package/dist/datatype-validation.js +18 -4
- package/dist/datatypes-entry.d.ts +1 -0
- package/dist/datatypes-entry.js +1 -0
- 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 +6 -1
- package/dist/index.js +7 -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 +7 -1
- package/dist/manifest.d.ts +21 -1
- package/dist/media/media-picker.js +32 -32
- package/dist/notify.d.ts +17 -0
- package/dist/notify.js +17 -0
- package/dist/richtext/block-panel.js +17 -18
- package/dist/richtext/extensions.js +10 -1
- package/dist/richtext/insert-menu.js +1 -1
- package/dist/richtext/kardalum-block.js +17 -17
- package/dist/richtext/style-listbox.js +1 -1
- package/dist/richtext-html-entry.d.ts +35 -0
- package/dist/richtext-html-entry.js +73 -0
- package/dist/structured-storage-types.d.ts +11 -0
- 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/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/html-code-editor.js +0 -1
- package/dist/views/image-view.js +1 -1
- package/dist/views/rich-text-view.js +30 -30
- package/node_modules/@kardalum/api-schemas/README.md +1 -1
- package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +16 -14
- 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/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 +12 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +16 -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 +25 -5
- 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 +3 -0
- 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.js +42 -2
- 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 +41 -15
- package/node_modules/@kardalum/api-schemas/dist/index.js +30 -10
- 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/marketplace-listing-api.schema.d.ts +115 -1
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +102 -1
- 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 +6 -0
- 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/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-management-api.schema.d.ts +227 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +157 -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-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/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/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/template-api.schema.d.ts +10 -0
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +26 -11
- 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/user-api.schema.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +5 -0
- 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-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/tokens.css +1 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.js +1 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.json +2 -1
- package/node_modules/@kardalum/design-tokens/dist/types.d.ts +1 -0
- 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 +8 -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/extract.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/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/button.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/checkbox.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/dialog.js +5 -2
- package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +2 -2
- package/node_modules/@kardalum/ui/dist/components/input.js +1 -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/sheet.js +5 -4
- package/node_modules/@kardalum/ui/dist/components/switch.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/tab-strip.js +1 -1
- package/node_modules/@kardalum/ui/dist/components/toast.js +1 -1
- package/node_modules/@kardalum/ui/dist/index.d.ts +1 -0
- package/node_modules/@kardalum/ui/dist/index.js +1 -0
- package/package.json +17 -4
|
@@ -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,6 +54,8 @@ 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(),
|
|
58
61
|
version: z.string(),
|
|
@@ -62,7 +65,7 @@ export const ManagedPluginSchema = z.object({
|
|
|
62
65
|
licenseStatus: z
|
|
63
66
|
.string()
|
|
64
67
|
.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.'),
|
|
68
|
+
.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
69
|
licenseReason: z.string().nullable(),
|
|
67
70
|
// S284b fix wave: the signed `detail` of the latest verdict, today the
|
|
68
71
|
// marketplace operator's reason for a `domain_blocked` answer, which the
|
|
@@ -86,6 +89,21 @@ export const ManagedPluginSchema = z.object({
|
|
|
86
89
|
// record (both above) and, since S284b, a grace_expired lock.
|
|
87
90
|
licenseLocked: z.boolean(),
|
|
88
91
|
buyHref: z.string().nullable(),
|
|
92
|
+
// S322b (P15): the plan the stored licence verdict names (its key, S317)
|
|
93
|
+
// and its name as the marketplace last named it, null when it never did.
|
|
94
|
+
// Absent when the verdict carries no plan (no licence, or one from before S317).
|
|
95
|
+
// S322c fix wave (M1): `bundle` is present when the licence is a bundle's
|
|
96
|
+
// (the member holds the bundle's key): the plan is then the bundle's.
|
|
97
|
+
licensePlan: z
|
|
98
|
+
.object({
|
|
99
|
+
key: z.string(),
|
|
100
|
+
name: z.string().nullable(),
|
|
101
|
+
bundle: z.object({ pluginId: z.string(), name: z.string() }).optional(),
|
|
102
|
+
})
|
|
103
|
+
// S322b polish (M11): a real plan, not the generator's page-name guess.
|
|
104
|
+
.meta({ example: { key: "basic", name: "Basic" } })
|
|
105
|
+
.optional()
|
|
106
|
+
.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
107
|
// S273: the roles this plugin's attached manifest offers, so an uploaded
|
|
90
108
|
// or sideloaded plugin, which has no install screen, can have an offer
|
|
91
109
|
// accepted from the installed-plugins view. Empty when the manifest is
|
|
@@ -102,7 +120,14 @@ export const ManagedPluginSchema = z.object({
|
|
|
102
120
|
// before (a cold cache). The lookup fails open: a version learned earlier
|
|
103
121
|
// is served through a failure and its backoff, and while a lookup slower
|
|
104
122
|
// than the list's two-second wait runs.
|
|
105
|
-
|
|
123
|
+
// S319 (spec 3c, plan P7): `renewToUpdate` is present, and true, when the
|
|
124
|
+
// plugin's lapsed licence does not cover that version (released after the
|
|
125
|
+
// term's end): the admin says "renew to get it" and offers no update.
|
|
126
|
+
// `renewHref` is the listing's page on the marketplace, present with it
|
|
127
|
+
// when a marketplace is configured.
|
|
128
|
+
updateAvailable: z
|
|
129
|
+
.object({ version: z.string(), renewToUpdate: z.literal(true).optional(), renewHref: z.string().optional() })
|
|
130
|
+
.nullable(),
|
|
106
131
|
});
|
|
107
132
|
export const ManagedPluginListQuerySchema = z.object({
|
|
108
133
|
cursor: z.string().uuid().optional(),
|
|
@@ -120,7 +145,7 @@ export const PluginIdParamsSchema = z.object({
|
|
|
120
145
|
});
|
|
121
146
|
// Fastify substitutes `null` for a genuinely absent body before handing it
|
|
122
147
|
// to the validator (lib/validation.js's validateParam: `isUndefined ? null
|
|
123
|
-
// : request[paramName]`)
|
|
148
|
+
// : request[paramName]`); a DELETE sent with no payload at all lands here
|
|
124
149
|
// as `null`, not `undefined`. `.nullish()` (not `.optional()`) is required
|
|
125
150
|
// so an absent body validates; `request.body?.confirmStructuredDataCleanup`
|
|
126
151
|
// in the route handler already tolerates both null and undefined.
|
|
@@ -136,14 +161,14 @@ export const UninstallPluginBodySchema = z
|
|
|
136
161
|
// dropped as an unknown key would be read as consent to remove.
|
|
137
162
|
.strict()
|
|
138
163
|
.nullish();
|
|
139
|
-
// 409 payload when a structured plugin's uninstall needs confirmation
|
|
164
|
+
// 409 payload when a structured plugin's uninstall needs confirmation:
|
|
140
165
|
// the snapshot has ALREADY been taken (S87's safe-to-retry design).
|
|
141
166
|
export const UninstallConfirmationRequiredSchema = z.object({
|
|
142
167
|
requiresConfirmation: z.literal(true),
|
|
143
168
|
snapshotGroupId: z.string(),
|
|
144
169
|
message: z.string(),
|
|
145
170
|
});
|
|
146
|
-
// S152: the BUNDLE uninstall's aggregated 409
|
|
171
|
+
// S152: the BUNDLE uninstall's aggregated 409: one snapshot group per
|
|
147
172
|
// structured plugin in the removal set (owned members, and the bundle
|
|
148
173
|
// itself if structured). A separate schema rather than widening
|
|
149
174
|
// UninstallConfirmationRequiredSchema: the single-plugin contract
|
|
@@ -158,14 +183,14 @@ export const BundleUninstallConfirmationRequiredSchema = z.object({
|
|
|
158
183
|
})),
|
|
159
184
|
message: z.string(),
|
|
160
185
|
});
|
|
161
|
-
// F1 QA fix wave: the content-guard 409
|
|
186
|
+
// F1 QA fix wave: the content-guard 409: a single-plugin uninstall()
|
|
162
187
|
// blocked because one or more of its tracked document types still have
|
|
163
188
|
// content or templates referencing them. Distinct from the two
|
|
164
189
|
// confirmation schemas above (those are "confirm to proceed," this is a
|
|
165
190
|
// terminal refusal the caller must resolve by hand, never retried with a
|
|
166
191
|
// flag) and from the bare ApiErrorSchema (that still covers every OTHER
|
|
167
192
|
// refusal this route can throw, e.g. a bundle member blocked by an outside
|
|
168
|
-
// dependent)
|
|
193
|
+
// dependent); a separate shape so `blockedBy` only ever appears when the
|
|
169
194
|
// server actually has a list of named blockers to put in it.
|
|
170
195
|
// contentCount is optional: the guard only knows a count for the
|
|
171
196
|
// "has-content" reason, not "has-templates" (document-type-service.ts's
|
|
@@ -177,15 +202,21 @@ export const UninstallBlockedByDocumentTypesSchema = z.object({
|
|
|
177
202
|
contentCount: z.number().int().nonnegative().optional(),
|
|
178
203
|
})),
|
|
179
204
|
});
|
|
180
|
-
// Task 6: the 200 success body for a single-plugin DELETE
|
|
205
|
+
// Task 6: the 200 success body for a single-plugin DELETE: the CONFIRMED
|
|
181
206
|
// pass's freshly-minted snapshotGroupId (the gate site already took it;
|
|
182
207
|
// this just stops discarding it), null for a simple-storage plugin (never
|
|
183
208
|
// snapshotted) or for the earlier PluginRegistry.uninstall() callers that
|
|
184
209
|
// route around the HTTP layer entirely.
|
|
210
|
+
// S314o3 (D4): the uninstall also removes the plugin's unused data types after writing them into
|
|
211
|
+
// a snapshot of their own; the answer names them and that snapshot group (null when the plugin
|
|
212
|
+
// had none), so a client can say where the record is. Optional for the PluginRegistry callers
|
|
213
|
+
// that answer without them.
|
|
185
214
|
export const UninstallSucceededSchema = z.object({
|
|
186
215
|
snapshotGroupId: z.string().nullable(),
|
|
216
|
+
dataTypesSnapshotGroupId: z.string().nullable().optional(),
|
|
217
|
+
removedDataTypes: z.array(z.string()).optional(),
|
|
187
218
|
});
|
|
188
|
-
// Task 6: the 200 success body for a BUNDLE DELETE
|
|
219
|
+
// Task 6: the 200 success body for a BUNDLE DELETE: one entry per
|
|
189
220
|
// structured plugin in the cascade (owned members, and the bundle itself
|
|
190
221
|
// if structured) that got a fresh snapshot on this confirmed pass. Simple-
|
|
191
222
|
// storage members never appear here, same as the 409 aggregate above.
|
|
@@ -194,8 +225,20 @@ export const BundleUninstallSucceededSchema = z.object({
|
|
|
194
225
|
pluginId: z.string(),
|
|
195
226
|
snapshotGroupId: z.string(),
|
|
196
227
|
})),
|
|
228
|
+
// S314o3 (D4): the data types the cascade removed, by name, and one entry per plugin of the set
|
|
229
|
+
// whose uninstall wrote a data type snapshot, with that group.
|
|
230
|
+
removedDataTypes: z.array(z.string()).optional(),
|
|
231
|
+
dataTypesSnapshots: z
|
|
232
|
+
.array(z.object({
|
|
233
|
+
pluginId: z.string(),
|
|
234
|
+
snapshotGroupId: z.string(),
|
|
235
|
+
}))
|
|
236
|
+
.optional(),
|
|
237
|
+
// S314c5: a member's data type the cascade kept for another member and then could not remove,
|
|
238
|
+
// because a field outside the bundle started using it meanwhile. It stays, by name.
|
|
239
|
+
leftDataTypes: z.array(z.string()).optional(),
|
|
197
240
|
});
|
|
198
|
-
// S180: whether this instance has a marketplace to browse at all
|
|
241
|
+
// S180: whether this instance has a marketplace to browse at all:
|
|
199
242
|
// `getMarketplaceBaseUrl()` returning undefined (KARDALUM_MARKETPLACE_URL
|
|
200
243
|
// explicitly set to "off", or blank) means `configured: false`. Distinct
|
|
201
244
|
// from the marketplace being unreachable (a `configured: true` instance
|
|
@@ -210,15 +253,19 @@ export const MarketplaceStatusResponseSchema = z.object({
|
|
|
210
253
|
// RevalidationOutcome, flattened for the wire. `checked: false` covers
|
|
211
254
|
// every fail-open case that still has a license row to report on
|
|
212
255
|
// (unreachable license server, no KARDALUM_SITE_DOMAIN, no marketplace
|
|
213
|
-
// configured)
|
|
256
|
+
// configured): `status` and `lastValidatedAt` stay null in that shape
|
|
214
257
|
// since nothing was verified. A plugin with no license row at all gets a
|
|
215
|
-
// 404 instead of this body (ApiErrorSchema)
|
|
258
|
+
// 404 instead of this body (ApiErrorSchema), as there's nothing to recheck.
|
|
216
259
|
export const LicenseRecheckResponseSchema = z.object({
|
|
217
260
|
pluginId: z.string(),
|
|
218
261
|
checked: z.boolean(),
|
|
219
262
|
status: z.string().nullable(),
|
|
220
263
|
reason: z.string().nullable(),
|
|
221
264
|
lastValidatedAt: z.string().nullable(),
|
|
265
|
+
// S324 (spec item 9): why a `checked: false` answer checked nothing, when the
|
|
266
|
+
// server knows: "site-domain-missing" (no KARDALUM_SITE_DOMAIN). A string, not
|
|
267
|
+
// an enum, so a newer server's reason never breaks an older admin (S292).
|
|
268
|
+
skipped: z.string().optional(),
|
|
222
269
|
});
|
|
223
270
|
// S284b (design 3.2): the host's latest licence verdict for a plugin, valid
|
|
224
271
|
// or not, handed to the plugin's own code unchanged so the plugin can verify
|
|
@@ -226,6 +273,25 @@ export const LicenseRecheckResponseSchema = z.object({
|
|
|
226
273
|
// @kardalum/plugin-package's LicenseVerdictEnvelope; a verdict is public
|
|
227
274
|
// and signed, never a secret (the licence key never appears in it, only its
|
|
228
275
|
// hash).
|
|
276
|
+
// S317: the term a verdict carries, signed by its termSignature. `state` is
|
|
277
|
+
// a string, not an enum, so a host keeps serving a verdict whose state a
|
|
278
|
+
// newer marketplace added (the S292 tolerance rule); the marketplace writes
|
|
279
|
+
// "active", "renewing", "past_due" or "lapsed".
|
|
280
|
+
export const LicenseVerdictTermSchema = z.object({
|
|
281
|
+
state: z.string(),
|
|
282
|
+
endsAt: z.string().nullable(),
|
|
283
|
+
renewalAmountCents: z.number().int().nullable(),
|
|
284
|
+
cancelAtPeriodEnd: z.boolean(),
|
|
285
|
+
});
|
|
286
|
+
// S317: a live plan of the listing, as a non-production host hands it to
|
|
287
|
+
// the plugin for its local evaluation (entitlementPlan's highest plan).
|
|
288
|
+
export const ListingPlanSummarySchema = z.object({
|
|
289
|
+
key: z.string(),
|
|
290
|
+
shape: z.string(),
|
|
291
|
+
priceCents: z.number().int(),
|
|
292
|
+
// S321 (P10): positions are 0 and up; the bound also gives the reference example a real value.
|
|
293
|
+
position: z.number().int().nonnegative(),
|
|
294
|
+
});
|
|
229
295
|
export const LicenseVerdictEnvelopeSchema = z.object({
|
|
230
296
|
v: z.literal(1),
|
|
231
297
|
alg: z.literal("ed25519"),
|
|
@@ -243,6 +309,10 @@ export const LicenseVerdictEnvelopeSchema = z.object({
|
|
|
243
309
|
tamper: PluginTamperKindSchema.optional(),
|
|
244
310
|
// The signed human sentence explaining `reason` (a domain block's reason).
|
|
245
311
|
detail: z.string().max(500).optional(),
|
|
312
|
+
// S317: the plan key and the term, covered by the verdict's termSignature
|
|
313
|
+
// (never by `signature`); absent on a verdict from before S317.
|
|
314
|
+
planId: z.string().max(64).optional(),
|
|
315
|
+
term: LicenseVerdictTermSchema.optional(),
|
|
246
316
|
});
|
|
247
317
|
// The tagged entitlement (S284b fix wave), the same value plugin server code
|
|
248
318
|
// receives on `context.entitlement`: `exempt` on a non-production install
|
|
@@ -250,12 +320,18 @@ export const LicenseVerdictEnvelopeSchema = z.object({
|
|
|
250
320
|
// no verdict for the plugin (the plugin's check refuses with `missing`), and
|
|
251
321
|
// `verdict` with the stored verdict to verify.
|
|
252
322
|
export const EntitlementSchema = z.discriminatedUnion("kind", [
|
|
253
|
-
z.object({
|
|
323
|
+
z.object({
|
|
324
|
+
kind: z.literal("exempt"),
|
|
325
|
+
reason: z.literal("non-production"),
|
|
326
|
+
listingPlans: z.array(ListingPlanSummarySchema).optional(),
|
|
327
|
+
}),
|
|
254
328
|
z.object({
|
|
255
329
|
kind: z.literal("verdict"),
|
|
256
330
|
envelope: LicenseVerdictEnvelopeSchema,
|
|
257
331
|
/** base64 Ed25519 signature over the envelope's canonical form. */
|
|
258
332
|
signature: z.string(),
|
|
333
|
+
/** S317: base64 Ed25519 signature over the envelope with its plan and term appended; absent when it carries neither. */
|
|
334
|
+
termSignature: z.string().optional(),
|
|
259
335
|
}),
|
|
260
336
|
z.object({ kind: z.literal("none") }),
|
|
261
337
|
]);
|
|
@@ -270,6 +346,8 @@ export const EntitlementSchema = z.discriminatedUnion("kind", [
|
|
|
270
346
|
export const EntitlementResponseSchema = z.object({
|
|
271
347
|
entitlement: EntitlementSchema,
|
|
272
348
|
valid: z.boolean(),
|
|
349
|
+
// S318: present only when the plugin is read-only.
|
|
350
|
+
readOnly: PluginReadOnlyNoticeSchema.optional(),
|
|
273
351
|
});
|
|
274
352
|
// The 403 a plugin API route answers when its handler throws the SDK's
|
|
275
353
|
// EntitlementError (`requireEntitlement` refused the verdict). `reason` is
|
|
@@ -281,13 +359,13 @@ export const EntitlementRefusalSchema = z.object({
|
|
|
281
359
|
});
|
|
282
360
|
// S154 Task 4: a plugin's structured-data snapshot GROUPS, derived from
|
|
283
361
|
// PluginStructuredSnapshot (GROUP BY snapshotGroupId) rather than tracked
|
|
284
|
-
// by their own table
|
|
362
|
+
// by their own table; see apps/server/src/plugins/snapshot-groups.ts for
|
|
285
363
|
// the derivation. takenAt is the group's earliest row's createdAt (every
|
|
286
364
|
// row in a group is written in one snapshotPluginTables() call, so in
|
|
287
|
-
// practice they're all within the same transaction-ish burst
|
|
365
|
+
// practice they're all within the same transaction-ish burst, and min is a
|
|
288
366
|
// defensive, not load-bearing, choice). trigger rides along from Task 3's
|
|
289
367
|
// column ("uninstall", "restore", or null for pre-Task-3 rows). status
|
|
290
|
-
// compares the group's own tableNames against totalTableCount
|
|
368
|
+
// compares the group's own tableNames against totalTableCount, the
|
|
291
369
|
// UNION of distinct tableNames across ALL of the plugin's snapshot rows,
|
|
292
370
|
// the only denominator that survives an uninstall (which deletes the
|
|
293
371
|
// PluginStructuredTable tracking rows, never the snapshots themselves).
|
|
@@ -308,7 +386,7 @@ export const SnapshotGroupListResponseSchema = z.object({
|
|
|
308
386
|
items: z.array(SnapshotGroupSchema), // newest first
|
|
309
387
|
nextCursor: z.string().nullable(),
|
|
310
388
|
});
|
|
311
|
-
// S154 Task 5: the UNION restore plan
|
|
389
|
+
// S154 Task 5: the UNION restore plan: the newest available snapshot copy
|
|
312
390
|
// of each DISTINCT table this plugin has ever snapshotted, chosen
|
|
313
391
|
// independently per table across every group (not "pick one group and use
|
|
314
392
|
// only its tables"). This is what makes restore recover from the S87
|
|
@@ -319,12 +397,12 @@ export const RestorePlanEntrySchema = z.object({
|
|
|
319
397
|
snapshotGroupId: z.string(),
|
|
320
398
|
groupTakenAt: z.string(),
|
|
321
399
|
});
|
|
322
|
-
// 409 payload for an unconfirmed restore
|
|
400
|
+
// 409 payload for an unconfirmed restore: nothing has been touched yet,
|
|
323
401
|
// the plan is offered for the admin to review before confirming. planHash
|
|
324
402
|
// (S161, S154 rider) is a stable digest of this exact plan: the confirm
|
|
325
403
|
// request must echo it back, and the handler refuses to proceed if a fresh
|
|
326
404
|
// re-plan hashes differently (a snapshot landed between the operator
|
|
327
|
-
// seeing this plan and confirming it)
|
|
405
|
+
// seeing this plan and confirming it), closing the requestRestorePlan ->
|
|
328
406
|
// confirmRestore TOCTOU. A mismatch response reuses this same schema, with
|
|
329
407
|
// a fresh plan/planHash and a message explaining the plan changed.
|
|
330
408
|
export const RestoreConfirmationRequiredSchema = z.object({
|
|
@@ -334,7 +412,7 @@ export const RestoreConfirmationRequiredSchema = z.object({
|
|
|
334
412
|
message: z.string(),
|
|
335
413
|
});
|
|
336
414
|
export const RestoreSucceededSchema = z.object({
|
|
337
|
-
// The pre-restore safety snapshot's group id
|
|
415
|
+
// The pre-restore safety snapshot's group id, null only when the
|
|
338
416
|
// plugin had no live tracked tables to protect (restoring onto empty).
|
|
339
417
|
preRestoreSnapshotGroupId: z.string().nullable(),
|
|
340
418
|
restoredTables: z.array(z.string()),
|
|
@@ -345,7 +423,7 @@ export const RestoreSucceededSchema = z.object({
|
|
|
345
423
|
// (not `.optional()`) is required for an absent body to validate at all.
|
|
346
424
|
// planHash (S161, S154 rider) is optional at the schema level only
|
|
347
425
|
// because the SAME body shape covers the unconfirmed call (`{}`, no plan
|
|
348
|
-
// to hash yet)
|
|
426
|
+
// to hash yet), so the route handler enforces it as effectively required
|
|
349
427
|
// whenever confirmRestore is true: a confirm with a missing or stale
|
|
350
428
|
// planHash is refused exactly the same way (409, fresh plan reissued).
|
|
351
429
|
export const RestoreBodySchema = z
|
|
@@ -354,9 +432,42 @@ export const RestoreBodySchema = z
|
|
|
354
432
|
planHash: z.string().optional(),
|
|
355
433
|
})
|
|
356
434
|
.nullish();
|
|
435
|
+
// S314c5 (D1, D2): restoring the data types an uninstall recorded (the row under the trigger
|
|
436
|
+
// "uninstall-data-types" in the snapshot table), in the two-step form of the table restore above:
|
|
437
|
+
// an unconfirmed call answers 409 with the plan and its hash, a confirmed call with that hash
|
|
438
|
+
// writes. A data type that cannot come back is skipped with its reason and every other one is
|
|
439
|
+
// restored: its id or its name exists again, its editor's plugin is missing or switched off, or
|
|
440
|
+
// its settings no longer pass its editor's settings schema.
|
|
441
|
+
export const DataTypeRestoreSkipReasonSchema = z.enum(["id-exists", "name-taken", "editor-missing", "editor-inactive", "settings-invalid"]);
|
|
442
|
+
export const DataTypeRestoreEntrySchema = z.object({ id: z.string(), name: z.string() });
|
|
443
|
+
export const DataTypeRestoreSkipSchema = DataTypeRestoreEntrySchema.extend({ reason: DataTypeRestoreSkipReasonSchema });
|
|
444
|
+
export const DataTypeRestorePlanSchema = z.object({
|
|
445
|
+
snapshotGroupId: z.string(),
|
|
446
|
+
restore: z.array(DataTypeRestoreEntrySchema),
|
|
447
|
+
skip: z.array(DataTypeRestoreSkipSchema),
|
|
448
|
+
});
|
|
449
|
+
export const DataTypeRestoreConfirmationRequiredSchema = DataTypeRestorePlanSchema.extend({
|
|
450
|
+
requiresConfirmation: z.literal(true),
|
|
451
|
+
planHash: z.string(),
|
|
452
|
+
message: z.string(),
|
|
453
|
+
});
|
|
454
|
+
export const DataTypeRestoreSucceededSchema = z.object({
|
|
455
|
+
snapshotGroupId: z.string(),
|
|
456
|
+
restored: z.array(DataTypeRestoreEntrySchema),
|
|
457
|
+
skipped: z.array(DataTypeRestoreSkipSchema),
|
|
458
|
+
});
|
|
459
|
+
// Nullish for the reason RestoreBodySchema is: an absent body lands as null. snapshotGroupId names
|
|
460
|
+
// a record other than the latest; planHash is required in effect whenever confirmRestore is true.
|
|
461
|
+
export const DataTypeRestoreBodySchema = z
|
|
462
|
+
.object({
|
|
463
|
+
snapshotGroupId: z.string().min(1).max(191).optional(),
|
|
464
|
+
confirmRestore: z.boolean().optional(),
|
|
465
|
+
planHash: z.string().optional(),
|
|
466
|
+
})
|
|
467
|
+
.nullish();
|
|
357
468
|
// The second install door (Task 4): POST /api/manage/v1/plugins/upload lands an
|
|
358
469
|
// admin-uploaded .zip through the same installPackageArchive spine the
|
|
359
|
-
// marketplace uses, but with no marketplace signature to check
|
|
470
|
+
// marketplace uses, but with no marketplace signature to check, so trust is
|
|
360
471
|
// always the literal "unregistered" here, never the registry's own
|
|
361
472
|
// "verified" | "unverified" tier (ManagedPluginSchema.trustTier above).
|
|
362
473
|
// That tier answers "did a signature check pass"; `trust: "unregistered"`
|
|
@@ -417,3 +528,18 @@ export const TrustDowngradeConfirmationSchema = z.object({
|
|
|
417
528
|
pluginName: z.string(),
|
|
418
529
|
message: z.string(),
|
|
419
530
|
});
|
|
531
|
+
// S314o3 (D3): the 409 of a switch-off or an uninstall refused because document type fields still
|
|
532
|
+
// use one of the plugin's data types (outside the plugin's own document types, which go with it).
|
|
533
|
+
// A key of its own beside `blockedBy`, which keeps meaning "still has content". `kind` lets a
|
|
534
|
+
// client link to the right editor; `dataType` is the data type's name, or the editor id for a
|
|
535
|
+
// field written before named data types.
|
|
536
|
+
export const DataTypeFieldBlockerSchema = z.object({
|
|
537
|
+
documentTypeId: z.string(),
|
|
538
|
+
documentType: z.string(),
|
|
539
|
+
kind: z.enum(["page", "element", "media"]),
|
|
540
|
+
fields: z.array(z.object({ id: z.string(), name: z.string(), dataType: z.string() })),
|
|
541
|
+
});
|
|
542
|
+
export const PluginDataTypesInUseSchema = z.object({
|
|
543
|
+
message: z.string(),
|
|
544
|
+
blockedByFields: z.array(DataTypeFieldBlockerSchema),
|
|
545
|
+
});
|
|
@@ -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
|
+
});
|
|
@@ -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>;
|