@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
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { PluginActionDeclarationSchema } from "./plugin-actions.schema.js";
|
|
3
|
+
import { InstallAnswersSchema, InstallInterfaceSchema } from "./plugin-install.js";
|
|
4
|
+
import { hasNoControlCharacter, strictUrl } from "./strict-url.js";
|
|
5
|
+
// S313: the body and the answer of POST /api/manage/v1/sandbox/local-plugin,
|
|
6
|
+
// the route a server started by `kardalum dev` registers
|
|
7
|
+
// (KARDALUM_SANDBOX_ATTACH, never under NODE_ENV=production). Every path names
|
|
8
|
+
// a directory on the server's own disk: the sandbox and the server it starts
|
|
9
|
+
// share one machine.
|
|
10
|
+
// A control character has no place in a path or a URL the server opens.
|
|
11
|
+
const LocalPath = z.string().min(1).max(4096).refine(hasNoControlCharacter, "A path must not contain control characters");
|
|
12
|
+
// The row stores remoteUrl and the admin loads it as a federation remote, so
|
|
13
|
+
// it is an http or https URL and nothing else. The URL parser drops a tab or a
|
|
14
|
+
// line break silently, and zod's own URL check strips one as well (zod 4.6),
|
|
15
|
+
// so the strict URL helper refuses every control character on the raw string,
|
|
16
|
+
// ahead of the URL check (S314e, spec C6): a URL with a trailing newline or tab
|
|
17
|
+
// was accepted before and is refused now.
|
|
18
|
+
// Fastify prefixes the field ("body/remoteUrl"), so the message does not name it.
|
|
19
|
+
const REMOTE_URL_MESSAGE = "must be an http or https URL";
|
|
20
|
+
const RemoteUrl = strictUrl({ protocol: /^https?$/, error: REMOTE_URL_MESSAGE, max: 2048 });
|
|
21
|
+
// S313b (W1): "ready" is the attach that installed nothing: no registry row for
|
|
22
|
+
// the plugin and no answers file, so the sandbox admin's install screen asks.
|
|
23
|
+
export const SANDBOX_ATTACH_OUTCOMES = ["installed", "activated", "already-active", "updated", "ready"];
|
|
24
|
+
export const SandboxAttachRequestSchema = z
|
|
25
|
+
.object({
|
|
26
|
+
pluginDir: LocalPath.describe("The plugin project's root, as an absolute path. Its install facts, templates, public files and sample content are read from here."),
|
|
27
|
+
bundleDir: LocalPath.describe("An absolute path to a directory holding server/plugin.js and the docs files beside it, as `kardalum plugin bundle-server` writes them. Use a new directory for every bundle: a module already imported from a path is answered from memory."),
|
|
28
|
+
remoteUrl: RemoteUrl.describe("The http or https URL the plugin's federation remote (remoteEntry.js) is served from."),
|
|
29
|
+
answersPath: LocalPath.optional().describe("An absolute path to the project's install-answers.json, read on a fresh install and, at a version bump, for the options the install record does not cover."),
|
|
30
|
+
})
|
|
31
|
+
.strict();
|
|
32
|
+
export const SandboxAttachResponseSchema = z.object({
|
|
33
|
+
pluginId: z.string(),
|
|
34
|
+
version: z.string(),
|
|
35
|
+
outcome: z.enum(SANDBOX_ATTACH_OUTCOMES),
|
|
36
|
+
/** The bundle directory the registry row now names. */
|
|
37
|
+
packagePath: z.string(),
|
|
38
|
+
});
|
|
39
|
+
// S313b (W2): what GET /api/manage/v1/sandbox/local-plugin answers: the bundle
|
|
40
|
+
// the last attach since the server started handed over, the install interface
|
|
41
|
+
// installInterfaceFor computes for it (the one a marketplace listing carries),
|
|
42
|
+
// the actions it declares (so the install screen names the rights an offered
|
|
43
|
+
// role grants by their labels), and whether a registry row exists for it.
|
|
44
|
+
// S313b fix wave C (C1): attachId numbers the attach the description comes
|
|
45
|
+
// from (one more for each attach, and above every number an earlier server
|
|
46
|
+
// process handed out, fix wave E, E1: a restart must not give an install
|
|
47
|
+
// screen opened before it the number of the next process's first attach); the
|
|
48
|
+
// install screen sends it back, and the install route refuses a screen built
|
|
49
|
+
// from an older attach.
|
|
50
|
+
const AttachId = z.number().int().positive();
|
|
51
|
+
export const SandboxLocalPluginSchema = z
|
|
52
|
+
.object({
|
|
53
|
+
pluginId: z.string(),
|
|
54
|
+
name: z.string(),
|
|
55
|
+
version: z.string(),
|
|
56
|
+
attachId: AttachId.describe("Numbers the attach this description comes from: send it back with the install screen's answers."),
|
|
57
|
+
installed: z.boolean(),
|
|
58
|
+
installInterface: InstallInterfaceSchema,
|
|
59
|
+
actions: z.array(PluginActionDeclarationSchema),
|
|
60
|
+
})
|
|
61
|
+
.strict();
|
|
62
|
+
// S313b (W2): the body of POST /api/manage/v1/sandbox/local-plugin/install: the
|
|
63
|
+
// install screen's answers, the same object every install route takes, and
|
|
64
|
+
// (fix wave C, C1) the attach id of the description the screen was built from.
|
|
65
|
+
export const SandboxLocalPluginInstallRequestSchema = z
|
|
66
|
+
.object({
|
|
67
|
+
attachId: AttachId.describe("The attachId of the GET answer the install screen was built from."),
|
|
68
|
+
answers: InstallAnswersSchema,
|
|
69
|
+
})
|
|
70
|
+
.strict();
|
|
@@ -5,6 +5,9 @@ export declare const BundledTemplateSchema: z.ZodObject<{
|
|
|
5
5
|
name: z.ZodString;
|
|
6
6
|
description: z.ZodOptional<z.ZodString>;
|
|
7
7
|
sampleContent: z.ZodBoolean;
|
|
8
|
+
sampleContentDescription: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
|
|
9
|
+
en: z.ZodString;
|
|
10
|
+
}, z.core.$catchall<z.ZodString>>, unknown>>;
|
|
8
11
|
}, z.core.$strip>;
|
|
9
12
|
export type BundledTemplate = z.infer<typeof BundledTemplateSchema>;
|
|
10
13
|
export declare const SetupStatusResponseSchema: z.ZodObject<{
|
|
@@ -15,14 +18,21 @@ export declare const SetupStatusResponseSchema: z.ZodObject<{
|
|
|
15
18
|
name: z.ZodString;
|
|
16
19
|
description: z.ZodOptional<z.ZodString>;
|
|
17
20
|
sampleContent: z.ZodBoolean;
|
|
21
|
+
sampleContentDescription: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
|
|
22
|
+
en: z.ZodString;
|
|
23
|
+
}, z.core.$catchall<z.ZodString>>, unknown>>;
|
|
18
24
|
}, z.core.$strip>>;
|
|
19
25
|
databaseConfigured: z.ZodBoolean;
|
|
20
26
|
}, z.core.$strip>;
|
|
21
27
|
export type SetupStatusResponse = z.infer<typeof SetupStatusResponseSchema>;
|
|
22
28
|
export declare const SetupStarterSelectionSchema: z.ZodObject<{
|
|
23
29
|
pluginId: z.ZodString;
|
|
24
|
-
|
|
25
|
-
|
|
30
|
+
answers: z.ZodOptional<z.ZodObject<{
|
|
31
|
+
sampleContent: z.ZodOptional<z.ZodBoolean>;
|
|
32
|
+
roles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
33
|
+
options: z.ZodOptional<z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodArray<z.ZodString>]>>, unknown>>;
|
|
34
|
+
}, z.core.$strict>>;
|
|
35
|
+
}, z.core.$strict>;
|
|
26
36
|
export type SetupStarterSelection = z.infer<typeof SetupStarterSelectionSchema>;
|
|
27
37
|
export declare const SetupCompleteRequestSchema: z.ZodObject<{
|
|
28
38
|
admin: z.ZodObject<{
|
|
@@ -50,15 +60,19 @@ export declare const SetupCompleteRequestSchema: z.ZodObject<{
|
|
|
50
60
|
}, z.core.$strip>], "dialect">>;
|
|
51
61
|
starter: z.ZodOptional<z.ZodObject<{
|
|
52
62
|
pluginId: z.ZodString;
|
|
53
|
-
|
|
54
|
-
|
|
63
|
+
answers: z.ZodOptional<z.ZodObject<{
|
|
64
|
+
sampleContent: z.ZodOptional<z.ZodBoolean>;
|
|
65
|
+
roles: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
66
|
+
options: z.ZodOptional<z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodArray<z.ZodString>]>>, unknown>>;
|
|
67
|
+
}, z.core.$strict>>;
|
|
68
|
+
}, z.core.$strict>>;
|
|
55
69
|
}, z.core.$strip>;
|
|
56
70
|
export type SetupCompleteRequest = z.infer<typeof SetupCompleteRequestSchema>;
|
|
57
71
|
export declare const SetupStarterResultSchema: z.ZodObject<{
|
|
58
72
|
pluginId: z.ZodString;
|
|
59
73
|
outcome: z.ZodEnum<{
|
|
60
|
-
installed: "installed";
|
|
61
74
|
failed: "failed";
|
|
75
|
+
installed: "installed";
|
|
62
76
|
}>;
|
|
63
77
|
reason: z.ZodOptional<z.ZodString>;
|
|
64
78
|
sampleContent: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -76,6 +90,14 @@ export declare const SetupStarterResultSchema: z.ZodObject<{
|
|
|
76
90
|
status: z.ZodLiteral<"added">;
|
|
77
91
|
count: z.ZodNumber;
|
|
78
92
|
}, z.core.$strip>], "status">>;
|
|
93
|
+
roles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
94
|
+
id: z.ZodString;
|
|
95
|
+
outcome: z.ZodEnum<{
|
|
96
|
+
failed: "failed";
|
|
97
|
+
created: "created";
|
|
98
|
+
"already-exists": "already-exists";
|
|
99
|
+
}>;
|
|
100
|
+
}, z.core.$strip>>>;
|
|
79
101
|
}, z.core.$strip>;
|
|
80
102
|
export type SetupStarterResult = z.infer<typeof SetupStarterResultSchema>;
|
|
81
103
|
export declare const SetupCompleteResponseSchema: z.ZodObject<{
|
|
@@ -83,8 +105,8 @@ export declare const SetupCompleteResponseSchema: z.ZodObject<{
|
|
|
83
105
|
starter: z.ZodOptional<z.ZodObject<{
|
|
84
106
|
pluginId: z.ZodString;
|
|
85
107
|
outcome: z.ZodEnum<{
|
|
86
|
-
installed: "installed";
|
|
87
108
|
failed: "failed";
|
|
109
|
+
installed: "installed";
|
|
88
110
|
}>;
|
|
89
111
|
reason: z.ZodOptional<z.ZodString>;
|
|
90
112
|
sampleContent: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
@@ -102,6 +124,14 @@ export declare const SetupCompleteResponseSchema: z.ZodObject<{
|
|
|
102
124
|
status: z.ZodLiteral<"added">;
|
|
103
125
|
count: z.ZodNumber;
|
|
104
126
|
}, z.core.$strip>], "status">>;
|
|
127
|
+
roles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
128
|
+
id: z.ZodString;
|
|
129
|
+
outcome: z.ZodEnum<{
|
|
130
|
+
failed: "failed";
|
|
131
|
+
created: "created";
|
|
132
|
+
"already-exists": "already-exists";
|
|
133
|
+
}>;
|
|
134
|
+
}, z.core.$strip>>>;
|
|
105
135
|
}, z.core.$strip>>;
|
|
106
136
|
configWarning: z.ZodOptional<z.ZodString>;
|
|
107
137
|
}, z.core.$strip>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { InstallAnswersSchema, InstallDescriptionSchema } from "./plugin-install.js";
|
|
3
|
+
import { InstallRoleOutcomeSchema } from "./plugin-install-record.schema.js";
|
|
2
4
|
import { SampleContentOutcomeSchema } from "./sample-content-outcome.schema.js";
|
|
3
5
|
// One bundled first-party starter template (currently only the blog
|
|
4
6
|
// template — apps/server/src/setup/bundled-templates.ts) offered from the
|
|
@@ -14,6 +16,9 @@ export const BundledTemplateSchema = z.object({
|
|
|
14
16
|
name: z.string().min(1),
|
|
15
17
|
description: z.string().min(1).optional(),
|
|
16
18
|
sampleContent: z.boolean(),
|
|
19
|
+
// S293: the template's sample-content.json `description`, for the wizard's
|
|
20
|
+
// checkbox.
|
|
21
|
+
sampleContentDescription: InstallDescriptionSchema.optional(),
|
|
17
22
|
});
|
|
18
23
|
export const SetupStatusResponseSchema = z.object({
|
|
19
24
|
setupRequired: z.boolean(),
|
|
@@ -40,12 +45,16 @@ const ServerDialectSelectionSchema = z.object({
|
|
|
40
45
|
password: z.string(),
|
|
41
46
|
});
|
|
42
47
|
// The wizard's optional starter step (Session 151): which bundled template
|
|
43
|
-
// to install during setup completion
|
|
44
|
-
//
|
|
45
|
-
|
|
48
|
+
// to install during setup completion. Absent entirely = skip, never null.
|
|
49
|
+
// S293: the starter's install answers (the wizard sends `sampleContent`), the
|
|
50
|
+
// same object every install door takes; strict, so a caller still sending
|
|
51
|
+
// `includeSampleContent` is refused rather than seeded by default.
|
|
52
|
+
export const SetupStarterSelectionSchema = z
|
|
53
|
+
.object({
|
|
46
54
|
pluginId: z.string().min(1),
|
|
47
|
-
|
|
48
|
-
})
|
|
55
|
+
answers: InstallAnswersSchema.optional(),
|
|
56
|
+
})
|
|
57
|
+
.strict();
|
|
49
58
|
export const SetupCompleteRequestSchema = z.object({
|
|
50
59
|
admin: z.object({
|
|
51
60
|
email: z.string().email(),
|
|
@@ -79,6 +88,9 @@ export const SetupStarterResultSchema = z.object({
|
|
|
79
88
|
// sample content was asked for and the starter ships some. The starter
|
|
80
89
|
// counts as installed whatever this says.
|
|
81
90
|
sampleContent: SampleContentOutcomeSchema.optional(),
|
|
91
|
+
// S293: what the install did with each offered role its answers named;
|
|
92
|
+
// absent when they named none.
|
|
93
|
+
roles: z.array(InstallRoleOutcomeSchema).optional(),
|
|
82
94
|
});
|
|
83
95
|
export const SetupCompleteResponseSchema = z.object({
|
|
84
96
|
success: z.literal(true),
|
|
@@ -1,37 +1,56 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
/** A site's domain in parts: what `parseSiteDomain` reads and `formatSiteDomain` writes. */
|
|
3
|
+
export interface SiteDomain {
|
|
4
|
+
/** Present only when it was typed. It is never matched, only printed (D4). */
|
|
5
|
+
scheme?: "http" | "https";
|
|
6
|
+
/** A host name or an IPv4 address, lower case, no trailing dot. */
|
|
7
|
+
host: string;
|
|
8
|
+
/** Present only when it was typed, and never the scheme's own port (nor 80 or 443 without a scheme). */
|
|
9
|
+
port?: number;
|
|
10
|
+
}
|
|
2
11
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
12
|
+
* Reads what a person pastes into a site's domain field (S314i D1):
|
|
13
|
+
* `example.com`, `www.example.com`, `http://example.com`,
|
|
14
|
+
* `https://www.example.com:2136`, `localhost`, `localhost:3000`,
|
|
15
|
+
* `127.0.0.1:3100`, a one-word host, with or without a trailing slash.
|
|
16
|
+
* Trims, takes an `http://` or `https://` in any letter case, drops one
|
|
17
|
+
* trailing slash, then reads `host[:port]`. Returns null for anything else:
|
|
18
|
+
* a path, a query, a fragment, a user, a wildcard, an IPv6 address, another
|
|
19
|
+
* scheme, a port outside 1 to 65535 or written with a leading zero.
|
|
10
20
|
*
|
|
11
|
-
*
|
|
12
|
-
* (
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* An IP address is refused: a site's domain is a name, and the server's IP
|
|
19
|
-
* is an unclaimed address, which shows the default site. A name whose last
|
|
20
|
-
* label is a number is how an IPv4 address reads to a browser and to some
|
|
21
|
-
* resolvers (the WHATWG URL rule), and a number there is all digits or
|
|
22
|
-
* begins with "0x". So a name is refused when its last label is all digits
|
|
23
|
-
* or begins with "0x" or "0X", whatever follows: "0x7f000001" is
|
|
24
|
-
* 127.0.0.1 to a browser. No registered top-level domain begins that way.
|
|
21
|
+
* `www.` is kept as typed: a domain is matched as written. A port equal to
|
|
22
|
+
* the scheme's own (80 for http, 443 for https) is dropped, because a
|
|
23
|
+
* browser never sends it and the domain would otherwise match nothing.
|
|
24
|
+
* Without a scheme, 80 and 443 are both dropped for the same reason, so
|
|
25
|
+
* "example.com:443" is "example.com" and cannot sit beside
|
|
26
|
+
* "https://example.com" on another site. A port that is not the given
|
|
27
|
+
* scheme's own ("http://example.com:443") is kept: a browser sends it.
|
|
25
28
|
*
|
|
26
29
|
* Written with string functions only, behind a length cap, because the
|
|
27
30
|
* input is whatever somebody typed or sent: no pattern is ever run over it.
|
|
28
31
|
*/
|
|
29
|
-
export declare function
|
|
32
|
+
export declare function parseSiteDomain(input: string): SiteDomain | null;
|
|
33
|
+
/** The stored string of a domain: `[scheme://]host[:port]`. */
|
|
34
|
+
export declare function formatSiteDomain(domain: SiteDomain): string;
|
|
35
|
+
/**
|
|
36
|
+
* A stored domain without its scheme: `host[:port]`. This is what a domain
|
|
37
|
+
* is matched by and counted by (S314i D2, D3): `http://a.test` and
|
|
38
|
+
* `https://a.test` are one domain. A value with no scheme (the host of
|
|
39
|
+
* KARDALUM_PUBLIC_URL) comes back as it is.
|
|
40
|
+
*/
|
|
41
|
+
export declare function siteDomainAuthority(domain: string): string;
|
|
42
|
+
/**
|
|
43
|
+
* The origin a link or a redirect to a stored domain is written with
|
|
44
|
+
* (S314i D4): the domain as stored when it carries a scheme, otherwise
|
|
45
|
+
* `scheme` (the request's, or KARDALUM_PUBLIC_URL's) in front of it. The
|
|
46
|
+
* port is the stored one, or none.
|
|
47
|
+
*/
|
|
48
|
+
export declare function siteDomainOrigin(domain: string, scheme: "http" | "https"): string;
|
|
30
49
|
/**
|
|
31
|
-
* One domain of a site. Parses through `
|
|
32
|
-
*
|
|
50
|
+
* One domain of a site. Parses through `parseSiteDomain`, so the output is
|
|
51
|
+
* the stored form, and a stored domain parses to itself.
|
|
33
52
|
*/
|
|
34
|
-
export declare const
|
|
53
|
+
export declare const SiteDomainSchema: z.ZodType<string, string>;
|
|
35
54
|
export declare const MAX_HOSTNAMES_PER_SITE = 20;
|
|
36
55
|
/**
|
|
37
56
|
* The domains of one site, in order: the first is the site's address, and
|
|
@@ -61,13 +80,13 @@ export declare const SitesSettingsSchema: z.ZodObject<{
|
|
|
61
80
|
}, z.core.$strip>>>;
|
|
62
81
|
}, z.core.$strip>;
|
|
63
82
|
export type SitesSettings = z.infer<typeof SitesSettingsSchema>;
|
|
64
|
-
/** The body of PUT /api/settings/sites/default. Null clears the pin. */
|
|
83
|
+
/** The body of PUT /api/manage/v1/settings/sites/default. Null clears the pin. */
|
|
65
84
|
export declare const SetDefaultSiteRequestSchema: z.ZodObject<{
|
|
66
85
|
defaultSiteId: z.ZodNullable<z.ZodString>;
|
|
67
86
|
}, z.core.$strip>;
|
|
68
87
|
export type SetDefaultSiteRequest = z.infer<typeof SetDefaultSiteRequestSchema>;
|
|
69
88
|
/**
|
|
70
|
-
* The body of PUT /api/settings/sites/:siteId/hostnames: the site's whole
|
|
89
|
+
* The body of PUT /api/manage/v1/settings/sites/:siteId/hostnames: the site's whole
|
|
71
90
|
* list, in order. An empty list takes every domain off the site.
|
|
72
91
|
*/
|
|
73
92
|
export declare const SetSiteHostnamesRequestSchema: z.ZodObject<{
|
|
@@ -94,7 +113,7 @@ export declare const SiteSummarySchema: z.ZodObject<{
|
|
|
94
113
|
}, z.core.$strip>;
|
|
95
114
|
export type SiteSummary = z.infer<typeof SiteSummarySchema>;
|
|
96
115
|
/**
|
|
97
|
-
* What GET /api/settings/sites and the two writes answer: the stored pin,
|
|
116
|
+
* What GET /api/manage/v1/settings/sites and the two writes answer: the stored pin,
|
|
98
117
|
* and beside it the default site that pin (or, with nothing pinned, tree
|
|
99
118
|
* order) gives a visitor right now. Null when there is none: a pin whose
|
|
100
119
|
* node is in the trash or not published, or a tree with nothing published.
|
|
@@ -104,7 +123,7 @@ export type SiteSummary = z.infer<typeof SiteSummarySchema>;
|
|
|
104
123
|
* `sites` is every site that has at least one domain, plus the default
|
|
105
124
|
* site even when it has none: the stored record, which is what an address
|
|
106
125
|
* is worked out from. It is bounded by that record and is not a list of
|
|
107
|
-
* every top-level page; GET /api/sites is that list. `requestHost` is the
|
|
126
|
+
* every top-level page; GET /api/manage/v1/sites is that list. `requestHost` is the
|
|
108
127
|
* host the server sees for this very request (spec D10): behind a proxy
|
|
109
128
|
* that does not pass the domain on it differs from the browser's, and
|
|
110
129
|
* that is the one place it shows.
|
|
@@ -135,9 +154,9 @@ export declare const SitesSettingsResponseSchema: z.ZodObject<{
|
|
|
135
154
|
}, z.core.$strip>;
|
|
136
155
|
export type SitesSettingsResponse = z.infer<typeof SitesSettingsResponseSchema>;
|
|
137
156
|
/**
|
|
138
|
-
* The query of GET /api/sites. The cursor is the id of the previous page's
|
|
157
|
+
* The query of GET /api/manage/v1/sites. The cursor is the id of the previous page's
|
|
139
158
|
* last row, the convention of the content tree's own lists
|
|
140
|
-
* (GET /api/content/roots).
|
|
159
|
+
* (GET /api/manage/v1/content/roots).
|
|
141
160
|
*/
|
|
142
161
|
export declare const SiteListQuerySchema: z.ZodObject<{
|
|
143
162
|
cursor: z.ZodOptional<z.ZodString>;
|
|
@@ -160,7 +179,7 @@ export declare const SiteListRowSchema: z.ZodObject<{
|
|
|
160
179
|
published: z.ZodBoolean;
|
|
161
180
|
}, z.core.$strip>;
|
|
162
181
|
export type SiteListRow = z.infer<typeof SiteListRowSchema>;
|
|
163
|
-
/** What GET /api/sites answers: one page of top-level pages in tree order. */
|
|
182
|
+
/** What GET /api/manage/v1/sites answers: one page of top-level pages in tree order. */
|
|
164
183
|
export declare const SiteListResponseSchema: z.ZodObject<{
|
|
165
184
|
items: z.ZodArray<z.ZodObject<{
|
|
166
185
|
siteId: z.ZodString;
|
|
@@ -223,7 +242,7 @@ export declare function siteAddress(site: {
|
|
|
223
242
|
isDefault: boolean;
|
|
224
243
|
}, defaultHost: string | null, storedPath: string, options?: SiteAddressOptions): SiteAddress | null;
|
|
225
244
|
/**
|
|
226
|
-
* The address of a stored path, worked out from what GET /api/settings/sites
|
|
245
|
+
* The address of a stored path, worked out from what GET /api/manage/v1/settings/sites
|
|
227
246
|
* answers, for a page the server cannot be asked about because nothing is
|
|
228
247
|
* stored at it yet (a page being created, a name being typed).
|
|
229
248
|
*
|