@kardalum/plugin-sdk 0.15.0 → 0.17.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 +49 -1
- package/README.md +10 -0
- package/dist/admin-section-registry.d.ts +14 -5
- package/dist/admin-section-registry.js +14 -4
- package/dist/built-in-value-schemas.js +1 -1
- package/dist/built-ins.js +2 -2
- package/dist/capabilities.d.ts +8 -78
- package/dist/capabilities.js +23 -322
- package/dist/host-entry.d.ts +1 -1
- package/dist/host-entry.js +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +13 -12
- package/dist/license-verdict-keys.d.ts +4 -3
- package/dist/license-verdict-keys.js +6 -5
- package/dist/manifest-entry.d.ts +3 -3
- package/dist/manifest-entry.js +2 -2
- package/dist/manifest-schema.d.ts +113 -56
- package/dist/manifest-schema.js +192 -295
- package/dist/manifest.d.ts +145 -112
- package/dist/manifest.js +13 -36
- package/dist/media/media-picker.js +21 -12
- package/dist/media/upload-error.d.ts +1 -1
- package/dist/media/upload-error.js +1 -1
- package/dist/plugin-context.d.ts +7 -0
- package/dist/plugin-context.js +7 -0
- package/dist/plugin-screen-context.d.ts +44 -3
- package/dist/plugin-screen-context.js +27 -2
- package/dist/read-all-pages.d.ts +23 -0
- package/dist/read-all-pages.js +30 -0
- package/dist/richtext/block-panel.js +6 -6
- package/dist/richtext/insert-menu.js +4 -4
- package/dist/richtext/style-listbox.js +4 -4
- package/dist/tokens/tokens.css +1 -0
- package/dist/tokens/tokens.json +2 -1
- package/dist/type-equality.d.ts +2 -0
- package/dist/type-equality.js +1 -0
- package/dist/views/content-list-view.js +2 -2
- package/dist/views/html-view.js +1 -1
- package/dist/views/image-view.js +24 -39
- package/dist/views/rich-text-view.js +3 -3
- package/node_modules/@kardalum/api-schemas/dist/api-error.schema.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/api-error.schema.js +19 -0
- package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.d.ts +43 -25
- package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.js +60 -8
- package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.d.ts +90 -0
- package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +33 -2
- package/node_modules/@kardalum/api-schemas/dist/asset.schema.d.ts +22 -1
- package/node_modules/@kardalum/api-schemas/dist/asset.schema.js +50 -15
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.d.ts +204 -0
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.js +134 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +18 -13
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +2 -2
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/content-path.js +11 -7
- package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.js +3 -0
- package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.js +2 -1
- package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +143 -57
- package/node_modules/@kardalum/api-schemas/dist/core-actions.js +110 -60
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/index.d.ts +67 -40
- package/node_modules/@kardalum/api-schemas/dist/index.js +35 -19
- package/node_modules/@kardalum/api-schemas/dist/install-warnings.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/install-warnings.schema.js +8 -0
- package/node_modules/@kardalum/api-schemas/dist/issue-list.d.ts +6 -0
- package/node_modules/@kardalum/api-schemas/dist/issue-list.js +6 -0
- package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.d.ts +73 -0
- package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.js +104 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +356 -16
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +93 -10
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +10 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +38 -30
- package/node_modules/@kardalum/api-schemas/dist/media-rendition.schema.js +2 -2
- package/node_modules/@kardalum/api-schemas/dist/media.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.d.ts +6 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.js +8 -6
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +69 -4
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.js +4 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +76 -9
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +84 -24
- package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.d.ts +17 -7
- package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.js +18 -8
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.d.ts +69 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.js +59 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +597 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +503 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-labels.d.ts +60 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-labels.js +116 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-locales.d.ts +82 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-locales.js +228 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +33 -4
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +28 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +11 -3
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +17 -4
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +58 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +198 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-fields.d.ts +64 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-fields.js +134 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.js +4 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.d.ts +74 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.js +132 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-vocabulary.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-vocabulary.js +15 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +8 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +23 -4
- package/node_modules/@kardalum/api-schemas/dist/render-editing.d.ts +4 -4
- package/node_modules/@kardalum/api-schemas/dist/role.schema.d.ts +17 -0
- package/node_modules/@kardalum/api-schemas/dist/role.schema.js +13 -0
- package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.d.ts +44 -0
- package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.js +97 -0
- package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.d.ts +126 -0
- package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.js +70 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +36 -6
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +17 -5
- package/node_modules/@kardalum/api-schemas/dist/sites.schema.d.ts +52 -33
- package/node_modules/@kardalum/api-schemas/dist/sites.schema.js +195 -56
- package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +19 -3
- package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.js +16 -0
- package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/strict-url.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/strict-url.js +31 -0
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +105 -1
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +47 -7
- package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +30 -2
- package/node_modules/@kardalum/api-schemas/dist/template.schema.js +19 -5
- package/node_modules/@kardalum/api-schemas/dist/trash-cursor.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/trash-cursor.schema.js +29 -0
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +15 -3
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +8 -0
- package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.d.ts +19 -0
- package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.js +22 -0
- package/node_modules/@kardalum/api-schemas/package.json +2 -2
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +1 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +2 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.css +1 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.js +3 -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/plugin-package/README.md +4 -1
- package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +96 -0
- package/node_modules/@kardalum/plugin-package/dist/build-reference.js +66 -0
- package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +103 -0
- package/node_modules/@kardalum/plugin-package/dist/capabilities.js +346 -0
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.d.ts +4 -0
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.js +25 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.d.ts +25 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.js +203 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.js +73 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.d.ts +5 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +60 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/icon-names.generated.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/icon-names.generated.js +2052 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/icons.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/icons.js +51 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.d.ts +8 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.js +7 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.d.ts +17 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.js +119 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/limits.d.ts +14 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/limits.js +21 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/locales.d.ts +5 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/locales.js +148 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/package-files.d.ts +5 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/package-files.js +76 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/registry.d.ts +22 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +133 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.js +90 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/support.d.ts +24 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/support.js +55 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.d.ts +6 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.js +158 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/types.d.ts +53 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/types.js +1 -0
- package/node_modules/@kardalum/plugin-package/dist/docs-contract.d.ts +3 -2
- package/node_modules/@kardalum/plugin-package/dist/docs-contract.js +4 -2
- package/node_modules/@kardalum/plugin-package/dist/extract.d.ts +92 -3
- package/node_modules/@kardalum/plugin-package/dist/extract.js +251 -41
- package/node_modules/@kardalum/plugin-package/dist/index.d.ts +11 -2
- package/node_modules/@kardalum/plugin-package/dist/index.js +8 -2
- package/node_modules/@kardalum/plugin-package/dist/manifest-entry.d.ts +5 -0
- package/node_modules/@kardalum/plugin-package/dist/manifest-entry.js +20 -0
- package/node_modules/@kardalum/plugin-package/dist/reference-entry.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/reference-entry.js +7 -0
- package/node_modules/@kardalum/plugin-package/dist/sample-content.d.ts +38 -1
- package/node_modules/@kardalum/plugin-package/dist/sample-content.js +84 -16
- package/node_modules/@kardalum/plugin-package/dist/shipped-files.d.ts +39 -0
- package/node_modules/@kardalum/plugin-package/dist/shipped-files.js +133 -0
- package/node_modules/@kardalum/plugin-package/dist/shipped-locales.d.ts +7 -0
- package/node_modules/@kardalum/plugin-package/dist/shipped-locales.js +27 -0
- package/node_modules/@kardalum/plugin-package/dist/types.d.ts +4 -6
- package/node_modules/@kardalum/plugin-package/dist/types.js +15 -1
- package/node_modules/@kardalum/plugin-package/package.json +9 -2
- package/node_modules/@kardalum/ui/dist/components/checkbox.js +2 -2
- package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +2 -2
- package/node_modules/@kardalum/ui/dist/components/property-field.js +4 -1
- package/node_modules/@kardalum/ui/package.json +1 -1
- package/package.json +6 -6
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { PluginActionDeclarationSchema, PluginRoleOfferSchema } from "./plugin-actions.schema.js";
|
|
3
3
|
import { HOSTILE_CHARS_MESSAGE, hasHostileChars } from "./plugin-docs-text.js";
|
|
4
|
+
import { PluginLabelStringSchema } from "./plugin-labels.js";
|
|
4
5
|
// S286, the docs contract (2026-10-04-s285-the-docs-contract-design.md).
|
|
5
6
|
// The contract's pure parts live here so the SDK's manifest schema, the
|
|
6
7
|
// CLI and the package door run the same definitions.
|
|
@@ -69,7 +70,7 @@ function present(value) {
|
|
|
69
70
|
return value.length > 0;
|
|
70
71
|
return value === true;
|
|
71
72
|
}
|
|
72
|
-
/** Reads the
|
|
73
|
+
/** Reads the four facts from a live manifest or from manifest.json. The
|
|
73
74
|
* summary keeps each contribution list as a list of redacted entries,
|
|
74
75
|
* reduces migrations to their ids, and says `paid: true` where the live
|
|
75
76
|
* manifest has a price above 0: the amount itself never reaches
|
|
@@ -83,7 +84,6 @@ export function docsFactsFrom(manifest) {
|
|
|
83
84
|
hasDependencies: present(source.pluginDependencies),
|
|
84
85
|
hasPrice: (typeof source.price === "number" && source.price > 0) || source.paid === true,
|
|
85
86
|
hasDocumentTypes: present(contributions.documentTypes),
|
|
86
|
-
hasSettingsPages: present(contributions.settingsPages),
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
89
|
/** Which roles the door requires, each with the declaration that requires
|
|
@@ -98,37 +98,97 @@ export function requiredDocRoles(facts) {
|
|
|
98
98
|
].filter((reason) => reason !== null);
|
|
99
99
|
if (setup.length > 0)
|
|
100
100
|
required.push({ role: "setup", because: setup.join(", ") });
|
|
101
|
-
if (facts.hasSettingsPages)
|
|
102
|
-
required.push({ role: "configuration", because: "settingsPages" });
|
|
103
101
|
return required;
|
|
104
102
|
}
|
|
105
103
|
// reference.json: the serialisable facts the generated Reference pages are
|
|
106
|
-
// rendered from (
|
|
107
|
-
//
|
|
108
|
-
//
|
|
104
|
+
// rendered from (S285 section 7, widened to seven pages by S289, six since S313b). Written by
|
|
105
|
+
// `kardalum plugin build` through buildReference in
|
|
106
|
+
// @kardalum/plugin-package/reference; built live from the attached manifest
|
|
107
|
+
// by the server for an installed plugin. JSON schemas and field definitions
|
|
108
|
+
// are carried as plain data, never validated here beyond being JSON. Every
|
|
109
|
+
// string is shown as text, never as markup.
|
|
110
|
+
/** A slot label as reference.json carries it: language code to text, with
|
|
111
|
+
* the English text every slot label must have. */
|
|
112
|
+
export const ReferenceLabelMapSchema = z
|
|
113
|
+
.record(z.string(), z.string())
|
|
114
|
+
.refine((label) => typeof label.en === "string" && label.en.trim().length > 0, 'a label carries its English text under "en"');
|
|
115
|
+
const gated = { id: z.string(), action: z.string() };
|
|
116
|
+
// S311 (D3): a manifest may write an action's or a role's label as a language
|
|
117
|
+
// map; the builder writes its English text, so the reference carries one string
|
|
118
|
+
// per label, as the generated pages print it.
|
|
119
|
+
const ReferenceActionSchema = PluginActionDeclarationSchema.extend({ label: PluginLabelStringSchema });
|
|
120
|
+
const ReferenceRoleSchema = PluginRoleOfferSchema.extend({ label: PluginLabelStringSchema });
|
|
121
|
+
// S292: one row per option a manifest's `install` declares, carrying its
|
|
122
|
+
// step's label, for the lifecycle page's "Install asks" table. `required` is
|
|
123
|
+
// installOptionNeedsAnswer's answer, which buildReference writes inline (it
|
|
124
|
+
// may take only types from this package). The list defaults to empty, so a
|
|
125
|
+
// reference.json written by a CLI older than S292 still parses.
|
|
126
|
+
const ReferenceInstallOptionSchema = z
|
|
127
|
+
.object({
|
|
128
|
+
step: ReferenceLabelMapSchema,
|
|
129
|
+
id: z.string(),
|
|
130
|
+
label: ReferenceLabelMapSchema,
|
|
131
|
+
kind: z.string(),
|
|
132
|
+
choices: z.array(z.object({ id: z.string(), label: ReferenceLabelMapSchema }).strict()),
|
|
133
|
+
default: z.union([z.boolean(), z.string(), z.array(z.string())]).nullable(),
|
|
134
|
+
required: z.boolean(),
|
|
135
|
+
})
|
|
136
|
+
.strict();
|
|
109
137
|
export const PluginReferenceSchema = z
|
|
110
138
|
.object({
|
|
111
|
-
actions: z.array(
|
|
112
|
-
roles: z.array(
|
|
139
|
+
actions: z.array(ReferenceActionSchema),
|
|
140
|
+
roles: z.array(ReferenceRoleSchema),
|
|
113
141
|
apiRoutes: z.array(z.object({ method: z.string(), path: z.string(), access: z.string(), action: z.string().optional() }).strict()),
|
|
114
|
-
capabilities: z.array(z
|
|
142
|
+
capabilities: z.array(z
|
|
143
|
+
.object({
|
|
144
|
+
id: z.string(),
|
|
145
|
+
mediation: z.enum(["mediated", "promised"]),
|
|
146
|
+
payload: z.object({ count: z.number().int().nonnegative(), details: z.array(z.string()) }).strict(),
|
|
147
|
+
})
|
|
148
|
+
.strict()),
|
|
115
149
|
documentTypes: z.array(z.object({ name: z.string(), kind: z.string(), fields: z.array(z.unknown()) }).passthrough()),
|
|
116
150
|
dataTypes: z.array(z.object({ id: z.string(), name: z.string() }).passthrough()),
|
|
117
|
-
|
|
151
|
+
templates: z.array(z.object({ name: z.string(), alias: z.string(), kind: z.string(), documentType: z.string().optional() }).strict()),
|
|
152
|
+
adminSections: z.array(z.object({ ...gated, label: ReferenceLabelMapSchema, rail: z.array(z.object({ ...gated, label: ReferenceLabelMapSchema }).strict()) }).strict()),
|
|
153
|
+
railEntries: z.array(z.object({ ...gated, label: ReferenceLabelMapSchema, section: z.string() }).strict()),
|
|
154
|
+
dashboardWidgets: z.array(z.object({ ...gated, name: z.string() }).strict()),
|
|
155
|
+
hooks: z.array(z.string()),
|
|
156
|
+
scheduledTasks: z.array(z.object({ id: z.string(), name: z.string(), cron: z.string() }).strict()),
|
|
157
|
+
migrations: z.array(z.object({ id: z.string(), name: z.string() }).strict()),
|
|
158
|
+
assertions: z.array(z.object({ key: z.string(), reason: z.string() }).strict()),
|
|
159
|
+
installOptions: z.array(ReferenceInstallOptionSchema).default([]),
|
|
118
160
|
})
|
|
119
161
|
.strict();
|
|
120
|
-
export
|
|
121
|
-
|
|
162
|
+
export function emptyPluginReference() {
|
|
163
|
+
return {
|
|
164
|
+
actions: [], roles: [], apiRoutes: [], capabilities: [], documentTypes: [], dataTypes: [], templates: [],
|
|
165
|
+
adminSections: [], railEntries: [], dashboardWidgets: [], hooks: [], scheduledTasks: [], migrations: [], assertions: [], installOptions: [],
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
export const REFERENCE_PAGE_SLUGS = ["permissions", "api-routes", "capabilities", "content", "admin-surfaces", "lifecycle"];
|
|
169
|
+
/** Which lists each page's tables are drawn from. Every list belongs to
|
|
170
|
+
* exactly one page (pinned by plugin-docs.test.ts), so a list added to the
|
|
171
|
+
* schema without a page is a red test, not a fact nobody sees. */
|
|
172
|
+
export const REFERENCE_PAGE_TABLES = {
|
|
173
|
+
permissions: ["actions", "roles"],
|
|
174
|
+
"api-routes": ["apiRoutes"],
|
|
175
|
+
capabilities: ["capabilities"],
|
|
176
|
+
content: ["documentTypes", "dataTypes", "templates"],
|
|
177
|
+
"admin-surfaces": ["adminSections", "railEntries", "dashboardWidgets"],
|
|
178
|
+
lifecycle: ["installOptions", "hooks", "scheduledTasks", "migrations", "assertions"],
|
|
179
|
+
};
|
|
180
|
+
export function isReferencePageSlug(slug) {
|
|
181
|
+
return REFERENCE_PAGE_SLUGS.includes(slug);
|
|
182
|
+
}
|
|
183
|
+
/** The one rule (S289): a reference page exists when at least one of its
|
|
184
|
+
* tables has a row. The renderer, the admin, the server, the door, the
|
|
185
|
+
* marketplace and its sitemap all ask this function. */
|
|
186
|
+
export function referencePageHasContent(reference, slug) {
|
|
187
|
+
if (!isReferencePageSlug(slug))
|
|
188
|
+
return false;
|
|
189
|
+
return REFERENCE_PAGE_TABLES[slug].some((list) => reference[list].length > 0);
|
|
190
|
+
}
|
|
191
|
+
/** The generated pages this plugin gets, in their fixed order. */
|
|
122
192
|
export function referencePageSlugs(reference) {
|
|
123
|
-
|
|
124
|
-
if (reference.actions.length > 0 || reference.roles.length > 0)
|
|
125
|
-
slugs.push("permissions");
|
|
126
|
-
if (reference.apiRoutes.length > 0)
|
|
127
|
-
slugs.push("api-routes");
|
|
128
|
-
slugs.push("capabilities");
|
|
129
|
-
if (reference.documentTypes.length > 0 || reference.dataTypes.length > 0)
|
|
130
|
-
slugs.push("content");
|
|
131
|
-
if (reference.settingsPages.length > 0)
|
|
132
|
-
slugs.push("settings");
|
|
133
|
-
return slugs;
|
|
193
|
+
return REFERENCE_PAGE_SLUGS.filter((slug) => referencePageHasContent(reference, slug));
|
|
134
194
|
}
|
|
@@ -12,13 +12,23 @@ export declare const PLUGIN_ID_REGEX: RegExp;
|
|
|
12
12
|
*/
|
|
13
13
|
export declare const MANIFEST_ID_SEGMENT_MAX: number;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* (
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
15
|
+
* The longest a plugin manifest's own id may be. The id names the plugin's
|
|
16
|
+
* folder at every install and is part of every file name a version is (see
|
|
17
|
+
* PLUGIN_VERSION_MAX), so the cap is checked before the pattern ever reads it
|
|
18
|
+
* (S311 fix wave). A reverse-domain id of at most MANIFEST_ID_SEGMENT_MAX (4)
|
|
19
|
+
* segments never comes near it in practice: "com.vendor.plugin-name" is 22
|
|
20
|
+
* characters. 128 (S311 third code fix, from npm's 214) leaves the version
|
|
21
|
+
* room beside it.
|
|
22
|
+
*/
|
|
23
|
+
export declare const PLUGIN_ID_MAX = 128;
|
|
24
|
+
/**
|
|
25
|
+
* Whether `id` is an id a plugin manifest may have: at most PLUGIN_ID_MAX
|
|
26
|
+
* characters, PLUGIN_ID_REGEX and at most MANIFEST_ID_SEGMENT_MAX segments,
|
|
27
|
+
* exactly what the SDK's manifest validator applies. Every door that turns a
|
|
28
|
+
* plugin id into a directory name (an install, an upload, a marketplace
|
|
29
|
+
* submission) runs this first, so an id the validator would refuse never
|
|
30
|
+
* reaches the filesystem: a lookalike such as "COM.KARDALUM.SEO" names another
|
|
31
|
+
* plugin's folder on a case-insensitive filesystem (S283).
|
|
22
32
|
*/
|
|
23
33
|
export declare function isPluginManifestId(id: string): boolean;
|
|
24
34
|
/**
|
|
@@ -17,16 +17,26 @@ export const PLUGIN_ID_REGEX = /^[a-z][a-z0-9-]*(\.[a-z][a-z0-9-]*)+$/;
|
|
|
17
17
|
*/
|
|
18
18
|
export const MANIFEST_ID_SEGMENT_MAX = ACTION_SEGMENT_MAX - 2;
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* (
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
20
|
+
* The longest a plugin manifest's own id may be. The id names the plugin's
|
|
21
|
+
* folder at every install and is part of every file name a version is (see
|
|
22
|
+
* PLUGIN_VERSION_MAX), so the cap is checked before the pattern ever reads it
|
|
23
|
+
* (S311 fix wave). A reverse-domain id of at most MANIFEST_ID_SEGMENT_MAX (4)
|
|
24
|
+
* segments never comes near it in practice: "com.vendor.plugin-name" is 22
|
|
25
|
+
* characters. 128 (S311 third code fix, from npm's 214) leaves the version
|
|
26
|
+
* room beside it.
|
|
27
|
+
*/
|
|
28
|
+
export const PLUGIN_ID_MAX = 128;
|
|
29
|
+
/**
|
|
30
|
+
* Whether `id` is an id a plugin manifest may have: at most PLUGIN_ID_MAX
|
|
31
|
+
* characters, PLUGIN_ID_REGEX and at most MANIFEST_ID_SEGMENT_MAX segments,
|
|
32
|
+
* exactly what the SDK's manifest validator applies. Every door that turns a
|
|
33
|
+
* plugin id into a directory name (an install, an upload, a marketplace
|
|
34
|
+
* submission) runs this first, so an id the validator would refuse never
|
|
35
|
+
* reaches the filesystem: a lookalike such as "COM.KARDALUM.SEO" names another
|
|
36
|
+
* plugin's folder on a case-insensitive filesystem (S283).
|
|
27
37
|
*/
|
|
28
38
|
export function isPluginManifestId(id) {
|
|
29
|
-
return PLUGIN_ID_REGEX.test(id) && id.split(".").length <= MANIFEST_ID_SEGMENT_MAX;
|
|
39
|
+
return id.length <= PLUGIN_ID_MAX && PLUGIN_ID_REGEX.test(id) && id.split(".").length <= MANIFEST_ID_SEGMENT_MAX;
|
|
30
40
|
}
|
|
31
41
|
/**
|
|
32
42
|
* A slot's id (S280): a segment of its screen's URL, so lowercase letters,
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** What the install itself created; a role whose id was already taken is never here. */
|
|
3
|
+
export declare const PluginInstallCreatedSchema: z.ZodObject<{
|
|
4
|
+
sampleContentNodeIds: z.ZodArray<z.ZodString>;
|
|
5
|
+
mediaIds: z.ZodArray<z.ZodString>;
|
|
6
|
+
roleIds: z.ZodArray<z.ZodString>;
|
|
7
|
+
}, z.core.$strict>;
|
|
8
|
+
export declare const PluginInstallRecordSchema: z.ZodObject<{
|
|
9
|
+
answers: z.ZodObject<{
|
|
10
|
+
sampleContent: z.ZodBoolean;
|
|
11
|
+
roles: z.ZodArray<z.ZodString>;
|
|
12
|
+
options: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
13
|
+
}, z.core.$strict>;
|
|
14
|
+
created: z.ZodObject<{
|
|
15
|
+
sampleContentNodeIds: z.ZodArray<z.ZodString>;
|
|
16
|
+
mediaIds: z.ZodArray<z.ZodString>;
|
|
17
|
+
roleIds: z.ZodArray<z.ZodString>;
|
|
18
|
+
}, z.core.$strict>;
|
|
19
|
+
}, z.core.$strict>;
|
|
20
|
+
export type PluginInstallRecord = z.infer<typeof PluginInstallRecordSchema>;
|
|
21
|
+
/** A fresh `created`, never a shared one. */
|
|
22
|
+
export declare function emptyInstallCreated(): PluginInstallRecord["created"];
|
|
23
|
+
/** The stored column through the schema: null for a plugin installed before
|
|
24
|
+
* S293 (the column is null) or a value that does not parse. */
|
|
25
|
+
export declare function readInstallRecord(value: unknown): PluginInstallRecord | null;
|
|
26
|
+
/** What the install did with each offered role its answers named. */
|
|
27
|
+
export declare const INSTALL_ROLE_OUTCOMES: readonly ["created", "already-exists", "failed"];
|
|
28
|
+
export declare const InstallRoleOutcomeSchema: z.ZodObject<{
|
|
29
|
+
id: z.ZodString;
|
|
30
|
+
outcome: z.ZodEnum<{
|
|
31
|
+
failed: "failed";
|
|
32
|
+
created: "created";
|
|
33
|
+
"already-exists": "already-exists";
|
|
34
|
+
}>;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export type InstallRoleOutcome = z.infer<typeof InstallRoleOutcomeSchema>;
|
|
37
|
+
/** The 400 every install door answers for answers it refuses, every issue at
|
|
38
|
+
* once: `message` is "The answers were refused: " and the reasons joined with
|
|
39
|
+
* "; ", each reason "path: message". */
|
|
40
|
+
export declare const InstallAnswersRefusedSchema: z.ZodObject<{
|
|
41
|
+
message: z.ZodString;
|
|
42
|
+
reason: z.ZodLiteral<"answers-refused">;
|
|
43
|
+
reasons: z.ZodArray<z.ZodString>;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
export type InstallAnswersRefused = z.infer<typeof InstallAnswersRefusedSchema>;
|
|
46
|
+
/** The most page titles a record summary names. */
|
|
47
|
+
export declare const INSTALL_RECORD_SUMMARY_TITLES = 20;
|
|
48
|
+
/** What the admin is told about a plugin's record (the uninstall dialog, an update). */
|
|
49
|
+
export declare const PluginInstallRecordSummarySchema: z.ZodObject<{
|
|
50
|
+
answers: z.ZodNullable<z.ZodObject<{
|
|
51
|
+
sampleContent: z.ZodBoolean;
|
|
52
|
+
roles: z.ZodArray<z.ZodString>;
|
|
53
|
+
options: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
54
|
+
}, z.core.$strict>>;
|
|
55
|
+
pages: z.ZodObject<{
|
|
56
|
+
liveCount: z.ZodNumber;
|
|
57
|
+
titles: z.ZodArray<z.ZodObject<{
|
|
58
|
+
id: z.ZodString;
|
|
59
|
+
title: z.ZodString;
|
|
60
|
+
}, z.core.$strip>>;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
mediaCount: z.ZodNumber;
|
|
63
|
+
roles: z.ZodArray<z.ZodObject<{
|
|
64
|
+
id: z.ZodString;
|
|
65
|
+
label: z.ZodString;
|
|
66
|
+
userCount: z.ZodNumber;
|
|
67
|
+
}, z.core.$strip>>;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
export type PluginInstallRecordSummary = z.infer<typeof PluginInstallRecordSummarySchema>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ResolvedInstallAnswersSchema } from "./plugin-install.js";
|
|
3
|
+
import { RoleIdSchema } from "./role.schema.js";
|
|
4
|
+
// S293 (2026-10-13-s293-the-wizard-installed-design.md 3.1): what a plugin's
|
|
5
|
+
// install is remembered by, on its registry row (PluginRegistry.installRecord):
|
|
6
|
+
// the answers it was installed with, every default filled, and what the install
|
|
7
|
+
// itself created, so an update can carry the answers over and an uninstall can
|
|
8
|
+
// offer to remove exactly that. Written by the server only.
|
|
9
|
+
/** What the install itself created; a role whose id was already taken is never here. */
|
|
10
|
+
export const PluginInstallCreatedSchema = z
|
|
11
|
+
.object({
|
|
12
|
+
/** The sample's pages, in the order the seeder created them (parents first). */
|
|
13
|
+
sampleContentNodeIds: z.array(z.string().min(1)),
|
|
14
|
+
/** The media items the sample's `media` section uploaded. */
|
|
15
|
+
mediaIds: z.array(z.string().min(1)),
|
|
16
|
+
/** The offered roles this install created. */
|
|
17
|
+
roleIds: z.array(RoleIdSchema),
|
|
18
|
+
})
|
|
19
|
+
.strict();
|
|
20
|
+
export const PluginInstallRecordSchema = z
|
|
21
|
+
.object({ answers: ResolvedInstallAnswersSchema, created: PluginInstallCreatedSchema })
|
|
22
|
+
.strict();
|
|
23
|
+
/** A fresh `created`, never a shared one. */
|
|
24
|
+
export function emptyInstallCreated() {
|
|
25
|
+
return { sampleContentNodeIds: [], mediaIds: [], roleIds: [] };
|
|
26
|
+
}
|
|
27
|
+
/** The stored column through the schema: null for a plugin installed before
|
|
28
|
+
* S293 (the column is null) or a value that does not parse. */
|
|
29
|
+
export function readInstallRecord(value) {
|
|
30
|
+
const parsed = PluginInstallRecordSchema.safeParse(value);
|
|
31
|
+
return parsed.success ? parsed.data : null;
|
|
32
|
+
}
|
|
33
|
+
/** What the install did with each offered role its answers named. */
|
|
34
|
+
export const INSTALL_ROLE_OUTCOMES = ["created", "already-exists", "failed"];
|
|
35
|
+
export const InstallRoleOutcomeSchema = z.object({ id: RoleIdSchema, outcome: z.enum(INSTALL_ROLE_OUTCOMES) });
|
|
36
|
+
/** The 400 every install door answers for answers it refuses, every issue at
|
|
37
|
+
* once: `message` is "The answers were refused: " and the reasons joined with
|
|
38
|
+
* "; ", each reason "path: message". */
|
|
39
|
+
export const InstallAnswersRefusedSchema = z.object({
|
|
40
|
+
message: z.string(),
|
|
41
|
+
reason: z.literal("answers-refused"),
|
|
42
|
+
reasons: z.array(z.string()),
|
|
43
|
+
});
|
|
44
|
+
/** The most page titles a record summary names. */
|
|
45
|
+
export const INSTALL_RECORD_SUMMARY_TITLES = 20;
|
|
46
|
+
/** What the admin is told about a plugin's record (the uninstall dialog, an update). */
|
|
47
|
+
export const PluginInstallRecordSummarySchema = z.object({
|
|
48
|
+
/** Null for a plugin installed before S293. */
|
|
49
|
+
answers: ResolvedInstallAnswersSchema.nullable(),
|
|
50
|
+
pages: z.object({
|
|
51
|
+
/** Recorded pages not in the Recycle Bin. */
|
|
52
|
+
liveCount: z.number().int().nonnegative(),
|
|
53
|
+
titles: z.array(z.object({ id: z.string(), title: z.string() })).max(INSTALL_RECORD_SUMMARY_TITLES),
|
|
54
|
+
}),
|
|
55
|
+
/** Recorded media not in the media Recycle Bin; an uninstall keeps them. */
|
|
56
|
+
mediaCount: z.number().int().nonnegative(),
|
|
57
|
+
/** The recorded roles that still exist. */
|
|
58
|
+
roles: z.array(z.object({ id: RoleIdSchema, label: z.string(), userCount: z.number().int().nonnegative() })),
|
|
59
|
+
});
|