@kardalum/plugin-sdk 0.16.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 +105 -0
- package/README.md +4 -3
- package/dist/admin-section-registry.d.ts +14 -5
- package/dist/admin-section-registry.js +14 -4
- 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 -3
- 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/host-entry.d.ts +1 -1
- package/dist/host-entry.js +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.js +13 -18
- package/dist/license-verdict-keys.d.ts +4 -3
- package/dist/license-verdict-keys.js +4 -7
- package/dist/manifest-entry.d.ts +6 -2
- package/dist/manifest-entry.js +5 -1
- package/dist/manifest-schema.d.ts +56 -63
- package/dist/manifest-schema.js +103 -249
- package/dist/manifest.d.ts +61 -73
- package/dist/manifest.js +13 -36
- package/dist/media/media-picker.js +32 -32
- package/dist/notify.d.ts +17 -0
- package/dist/notify.js +17 -0
- package/dist/plugin-screen-context.d.ts +11 -1
- package/dist/richtext/block-panel.js +19 -20
- 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 +4 -4
- 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 +2 -0
- package/dist/tokens/tokens.json +4 -2
- package/dist/type-equality.d.ts +2 -0
- package/dist/type-equality.js +1 -0
- 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/html-view.js +1 -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.d.ts +90 -0
- package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +43 -10
- 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 +23 -1
- package/node_modules/@kardalum/api-schemas/dist/asset.schema.js +60 -18
- 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/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 +22 -6
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +2 -2
- 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.js +2 -1
- package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +52 -10
- package/node_modules/@kardalum/api-schemas/dist/core-actions.js +33 -14
- 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 +73 -31
- package/node_modules/@kardalum/api-schemas/dist/index.js +47 -17
- 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/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 +216 -63
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +117 -5
- 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-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 +8 -18
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.js +7 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +3 -19
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +13 -15
- 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 +1 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +97 -85
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +35 -68
- 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 +9 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-locales.js +22 -7
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +240 -6
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +164 -32
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +4 -3
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +14 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +37 -1
- 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-read-only.schema.d.ts +19 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-read-only.schema.js +33 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.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 +83 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.js +152 -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 +5 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +35 -23
- 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/role.schema.d.ts +11 -0
- package/node_modules/@kardalum/api-schemas/dist/role.schema.js +7 -0
- package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.d.ts +11 -2
- package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.js +21 -3
- 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 +6 -6
- package/node_modules/@kardalum/api-schemas/dist/sites.schema.d.ts +58 -25
- package/node_modules/@kardalum/api-schemas/dist/sites.schema.js +194 -48
- package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +18 -6
- package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.js +14 -0
- package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +2 -2
- 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 +115 -1
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +65 -10
- package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +37 -2
- package/node_modules/@kardalum/api-schemas/dist/template.schema.js +34 -8
- 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 +16 -0
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +8 -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 +32 -0
- package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.js +27 -0
- package/node_modules/@kardalum/api-schemas/package.json +2 -2
- 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 +2 -1
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +2 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.css +2 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.js +4 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.json +4 -2
- package/node_modules/@kardalum/design-tokens/dist/types.d.ts +2 -0
- package/node_modules/@kardalum/design-tokens/package.json +6 -3
- package/node_modules/@kardalum/plugin-package/README.md +5 -2
- package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +6 -21
- package/node_modules/@kardalum/plugin-package/dist/build-reference.js +13 -8
- package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +4 -4
- package/node_modules/@kardalum/plugin-package/dist/capabilities.js +59 -16
- 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 +8 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +77 -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 +137 -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 +7 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.js +215 -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 +13 -4
- package/node_modules/@kardalum/plugin-package/dist/index.js +10 -3
- 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/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 +1 -0
- package/node_modules/@kardalum/plugin-package/dist/reference-entry.js +1 -0
- package/node_modules/@kardalum/plugin-package/dist/sample-content.d.ts +21 -3
- package/node_modules/@kardalum/plugin-package/dist/sample-content.js +37 -9
- 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/vendor-token.d.ts +24 -0
- package/node_modules/@kardalum/plugin-package/dist/vendor-token.js +118 -0
- package/node_modules/@kardalum/plugin-package/package.json +4 -2
- 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 +3 -3
- 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/node_modules/@kardalum/ui/package.json +1 -1
- package/package.json +19 -6
|
@@ -7,7 +7,7 @@ export declare const BundledTemplateSchema: z.ZodObject<{
|
|
|
7
7
|
sampleContent: z.ZodBoolean;
|
|
8
8
|
sampleContentDescription: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
|
|
9
9
|
en: z.ZodString;
|
|
10
|
-
}, z.core.$catchall<z.ZodString
|
|
10
|
+
}, z.core.$catchall<z.ZodString>>, unknown>>;
|
|
11
11
|
}, z.core.$strip>;
|
|
12
12
|
export type BundledTemplate = z.infer<typeof BundledTemplateSchema>;
|
|
13
13
|
export declare const SetupStatusResponseSchema: z.ZodObject<{
|
|
@@ -20,7 +20,7 @@ export declare const SetupStatusResponseSchema: z.ZodObject<{
|
|
|
20
20
|
sampleContent: z.ZodBoolean;
|
|
21
21
|
sampleContentDescription: z.ZodOptional<z.ZodPreprocess<z.ZodObject<{
|
|
22
22
|
en: z.ZodString;
|
|
23
|
-
}, z.core.$catchall<z.ZodString
|
|
23
|
+
}, z.core.$catchall<z.ZodString>>, unknown>>;
|
|
24
24
|
}, z.core.$strip>>;
|
|
25
25
|
databaseConfigured: z.ZodBoolean;
|
|
26
26
|
}, z.core.$strip>;
|
|
@@ -30,7 +30,7 @@ export declare const SetupStarterSelectionSchema: z.ZodObject<{
|
|
|
30
30
|
answers: z.ZodOptional<z.ZodObject<{
|
|
31
31
|
sampleContent: z.ZodOptional<z.ZodBoolean>;
|
|
32
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>]
|
|
33
|
+
options: z.ZodOptional<z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodArray<z.ZodString>]>>, unknown>>;
|
|
34
34
|
}, z.core.$strict>>;
|
|
35
35
|
}, z.core.$strict>;
|
|
36
36
|
export type SetupStarterSelection = z.infer<typeof SetupStarterSelectionSchema>;
|
|
@@ -63,7 +63,7 @@ export declare const SetupCompleteRequestSchema: z.ZodObject<{
|
|
|
63
63
|
answers: z.ZodOptional<z.ZodObject<{
|
|
64
64
|
sampleContent: z.ZodOptional<z.ZodBoolean>;
|
|
65
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>]
|
|
66
|
+
options: z.ZodOptional<z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodArray<z.ZodString>]>>, unknown>>;
|
|
67
67
|
}, z.core.$strict>>;
|
|
68
68
|
}, z.core.$strict>>;
|
|
69
69
|
}, z.core.$strip>;
|
|
@@ -93,9 +93,9 @@ export declare const SetupStarterResultSchema: z.ZodObject<{
|
|
|
93
93
|
roles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
94
94
|
id: z.ZodString;
|
|
95
95
|
outcome: z.ZodEnum<{
|
|
96
|
+
failed: "failed";
|
|
96
97
|
created: "created";
|
|
97
98
|
"already-exists": "already-exists";
|
|
98
|
-
failed: "failed";
|
|
99
99
|
}>;
|
|
100
100
|
}, z.core.$strip>>>;
|
|
101
101
|
}, z.core.$strip>;
|
|
@@ -127,9 +127,9 @@ export declare const SetupCompleteResponseSchema: z.ZodObject<{
|
|
|
127
127
|
roles: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
128
128
|
id: z.ZodString;
|
|
129
129
|
outcome: z.ZodEnum<{
|
|
130
|
+
failed: "failed";
|
|
130
131
|
created: "created";
|
|
131
132
|
"already-exists": "already-exists";
|
|
132
|
-
failed: "failed";
|
|
133
133
|
}>;
|
|
134
134
|
}, z.core.$strip>>>;
|
|
135
135
|
}, z.core.$strip>>;
|
|
@@ -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
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* An internationalised domain is entered in its ASCII form
|
|
12
|
-
* ("xn--bcher-kva.example"); a name with a non-ASCII character is refused.
|
|
13
|
-
* The characters are tested BEFORE lower-casing, because lower-casing can
|
|
14
|
-
* turn a character that is not a letter of a hostname into one (U+212A,
|
|
15
|
-
* the Kelvin sign, becomes "k"), and two entries would then mean one host.
|
|
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.
|
|
16
20
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
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;
|
|
30
35
|
/**
|
|
31
|
-
*
|
|
32
|
-
* is
|
|
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.
|
|
33
40
|
*/
|
|
34
|
-
export declare
|
|
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;
|
|
49
|
+
/**
|
|
50
|
+
* One domain of a site. Parses through `parseSiteDomain`, so the output is
|
|
51
|
+
* the stored form, and a stored domain parses to itself.
|
|
52
|
+
*/
|
|
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
|
|
@@ -93,6 +112,16 @@ export declare const SiteSummarySchema: z.ZodObject<{
|
|
|
93
112
|
isDefault: z.ZodBoolean;
|
|
94
113
|
}, z.core.$strip>;
|
|
95
114
|
export type SiteSummary = z.infer<typeof SiteSummarySchema>;
|
|
115
|
+
/**
|
|
116
|
+
* S314n (D6, P2): whether this server renders pages (KARDALUM_RENDER) and
|
|
117
|
+
* serves the headless delivery API (KARDALUM_HEADLESS). Both are deploy-time
|
|
118
|
+
* switches, read on every answer.
|
|
119
|
+
*/
|
|
120
|
+
export declare const SiteRenderingSchema: z.ZodObject<{
|
|
121
|
+
pages: z.ZodBoolean;
|
|
122
|
+
headless: z.ZodBoolean;
|
|
123
|
+
}, z.core.$strip>;
|
|
124
|
+
export type SiteRendering = z.infer<typeof SiteRenderingSchema>;
|
|
96
125
|
/**
|
|
97
126
|
* What GET /api/manage/v1/settings/sites and the two writes answer: the stored pin,
|
|
98
127
|
* and beside it the default site that pin (or, with nothing pinned, tree
|
|
@@ -132,6 +161,10 @@ export declare const SitesSettingsResponseSchema: z.ZodObject<{
|
|
|
132
161
|
}, z.core.$strip>>;
|
|
133
162
|
requestHost: z.ZodString;
|
|
134
163
|
defaultAddressHost: z.ZodNullable<z.ZodString>;
|
|
164
|
+
rendering: z.ZodOptional<z.ZodObject<{
|
|
165
|
+
pages: z.ZodBoolean;
|
|
166
|
+
headless: z.ZodBoolean;
|
|
167
|
+
}, z.core.$strip>>;
|
|
135
168
|
}, z.core.$strip>;
|
|
136
169
|
export type SitesSettingsResponse = z.infer<typeof SitesSettingsResponseSchema>;
|
|
137
170
|
/**
|
|
@@ -1,18 +1,31 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { firstSegment, publicPath } from "./content-path.js";
|
|
3
3
|
// S277d: a site (a top-level node) can have its own domains. Everything
|
|
4
|
-
// here is the shape of that record and the rule for one
|
|
5
|
-
|
|
4
|
+
// here is the shape of that record and the rule for one domain.
|
|
5
|
+
//
|
|
6
|
+
// S314i: a domain is a host with an optional port and an optional scheme,
|
|
7
|
+
// stored as one string `[scheme://]host[:port]`. The admin's field, the
|
|
8
|
+
// route that writes the record, the server's match and the public lookup
|
|
9
|
+
// by address all read it through `parseSiteDomain`, so one rule decides.
|
|
10
|
+
/** The longest a host name may be (RFC 1035), without a trailing dot. */
|
|
6
11
|
const MAX_HOSTNAME_LENGTH = 253;
|
|
7
|
-
/** The longest one label of a
|
|
12
|
+
/** The longest one label of a host name may be. */
|
|
8
13
|
const MAX_LABEL_LENGTH = 63;
|
|
9
14
|
/**
|
|
10
|
-
* The longest input that is looked at at all. Twice the longest
|
|
11
|
-
* leaves room for surrounding whitespace
|
|
12
|
-
*
|
|
13
|
-
* costs the same whatever its length.
|
|
15
|
+
* The longest input that is looked at at all. Twice the longest host name
|
|
16
|
+
* leaves room for a scheme, a port, surrounding whitespace, a trailing dot
|
|
17
|
+
* and a trailing slash; anything longer is refused before a single
|
|
18
|
+
* character is read, so a hostile input costs the same whatever its length.
|
|
14
19
|
*/
|
|
15
|
-
const
|
|
20
|
+
const MAX_SITE_DOMAIN_INPUT_LENGTH = MAX_HOSTNAME_LENGTH * 2;
|
|
21
|
+
/** The highest port there is. */
|
|
22
|
+
const MAX_PORT = 65535;
|
|
23
|
+
/** "65535" has five digits. */
|
|
24
|
+
const MAX_PORT_DIGITS = 5;
|
|
25
|
+
/** The highest value of one part of an IPv4 address. */
|
|
26
|
+
const MAX_OCTET = 255;
|
|
27
|
+
/** The port a browser leaves out of the Host for each scheme. */
|
|
28
|
+
const DEFAULT_PORT = { http: 80, https: 443 };
|
|
16
29
|
const CODE_0 = 48;
|
|
17
30
|
const CODE_9 = 57;
|
|
18
31
|
const CODE_UPPER_A = 65;
|
|
@@ -22,6 +35,8 @@ const CODE_LOWER_Z = 122;
|
|
|
22
35
|
const CODE_DASH = 45;
|
|
23
36
|
const CODE_UPPER_X = 88;
|
|
24
37
|
const CODE_LOWER_X = 120;
|
|
38
|
+
/** Upper case to lower case, for A-Z. */
|
|
39
|
+
const ASCII_CASE_OFFSET = 32;
|
|
25
40
|
function isDigit(code) {
|
|
26
41
|
return code >= CODE_0 && code <= CODE_9;
|
|
27
42
|
}
|
|
@@ -31,39 +46,71 @@ function isLabelCharacter(code) {
|
|
|
31
46
|
isDigit(code) ||
|
|
32
47
|
code === CODE_DASH);
|
|
33
48
|
}
|
|
49
|
+
function isAllDigits(text) {
|
|
50
|
+
if (text.length === 0)
|
|
51
|
+
return false;
|
|
52
|
+
for (let i = 0; i < text.length; i += 1) {
|
|
53
|
+
if (!isDigit(text.charCodeAt(i)))
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
34
58
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
|
|
59
|
+
* Whether `text` begins with `prefix` (lower case ASCII) in any letter
|
|
60
|
+
* case. Character by character, so no character outside A-Z is ever
|
|
61
|
+
* folded into one of the prefix's.
|
|
62
|
+
*/
|
|
63
|
+
function startsWithIgnoringAsciiCase(text, prefix) {
|
|
64
|
+
if (text.length < prefix.length)
|
|
65
|
+
return false;
|
|
66
|
+
for (let i = 0; i < prefix.length; i += 1) {
|
|
67
|
+
let code = text.charCodeAt(i);
|
|
68
|
+
if (code >= CODE_UPPER_A && code <= CODE_UPPER_Z)
|
|
69
|
+
code += ASCII_CASE_OFFSET;
|
|
70
|
+
if (code !== prefix.charCodeAt(i))
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
/** Four decimal parts, each 0 to 255, none written with a leading zero. */
|
|
76
|
+
function isIpv4(labels) {
|
|
77
|
+
if (labels.length !== 4)
|
|
78
|
+
return false;
|
|
79
|
+
for (const label of labels) {
|
|
80
|
+
if (!isAllDigits(label) || label.length > 3)
|
|
81
|
+
return false;
|
|
82
|
+
if (label.length > 1 && label.charCodeAt(0) === CODE_0)
|
|
83
|
+
return false;
|
|
84
|
+
if (Number(label) > MAX_OCTET)
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Drops one trailing dot and lower-cases. Returns null when the result is
|
|
91
|
+
* neither a host name nor an IPv4 address.
|
|
39
92
|
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
93
|
+
* A host name is one or more labels of a-z, 0-9 and "-" joined by dots, no
|
|
94
|
+
* label empty, longer than 63, or starting or ending with a dash, the
|
|
95
|
+
* whole name no longer than 253. So no scheme, port, path, wildcard, user
|
|
96
|
+
* or space gets through: each needs a character a label cannot hold.
|
|
42
97
|
*
|
|
43
98
|
* An internationalised domain is entered in its ASCII form
|
|
44
99
|
* ("xn--bcher-kva.example"); a name with a non-ASCII character is refused.
|
|
45
100
|
* The characters are tested BEFORE lower-casing, because lower-casing can
|
|
46
|
-
* turn a character that is not a letter of a
|
|
101
|
+
* turn a character that is not a letter of a host name into one (U+212A,
|
|
47
102
|
* the Kelvin sign, becomes "k"), and two entries would then mean one host.
|
|
48
103
|
*
|
|
49
104
|
* A single label such as "localhost" is accepted: a local setup needs it.
|
|
50
|
-
* An
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* resolvers (the WHATWG URL rule), and a number there is all digits
|
|
54
|
-
* begins with "0x". So
|
|
55
|
-
*
|
|
56
|
-
* 127.0.0.1 to a browser. No registered top-level domain begins that way.
|
|
57
|
-
*
|
|
58
|
-
* Written with string functions only, behind a length cap, because the
|
|
59
|
-
* input is whatever somebody typed or sent: no pattern is ever run over it.
|
|
105
|
+
* An IPv4 address (four parts, each 0 to 255, no leading zero) is accepted
|
|
106
|
+
* (S314i D1). Any other name whose last label is a number is refused: that
|
|
107
|
+
* is how an IPv4 address in another spelling reads to a browser and to
|
|
108
|
+
* some resolvers (the WHATWG URL rule), and a number there is all digits
|
|
109
|
+
* or begins with "0x". So "10.1" and "0x7f000001" are refused, and no
|
|
110
|
+
* registered top-level domain begins that way.
|
|
60
111
|
*/
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return null;
|
|
64
|
-
if (input.length > MAX_HOSTNAME_INPUT_LENGTH)
|
|
65
|
-
return null;
|
|
66
|
-
let name = input.trim();
|
|
112
|
+
function normalizeHost(input) {
|
|
113
|
+
let name = input;
|
|
67
114
|
if (name.endsWith("."))
|
|
68
115
|
name = name.slice(0, -1);
|
|
69
116
|
if (name.length === 0 || name.length > MAX_HOSTNAME_LENGTH)
|
|
@@ -79,15 +126,11 @@ export function normalizeHostname(input) {
|
|
|
79
126
|
return null;
|
|
80
127
|
}
|
|
81
128
|
}
|
|
129
|
+
// Digits and dots only: nothing to lower-case.
|
|
130
|
+
if (isIpv4(labels))
|
|
131
|
+
return name;
|
|
82
132
|
const last = labels[labels.length - 1];
|
|
83
|
-
|
|
84
|
-
for (let i = 0; i < last.length; i += 1) {
|
|
85
|
-
if (!isDigit(last.charCodeAt(i))) {
|
|
86
|
-
allDigits = false;
|
|
87
|
-
break;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
if (allDigits)
|
|
133
|
+
if (isAllDigits(last))
|
|
91
134
|
return null;
|
|
92
135
|
// "0x" or "0X" first: a hexadecimal number to the same readers.
|
|
93
136
|
if (last.charCodeAt(0) === CODE_0 && (last.charCodeAt(1) === CODE_LOWER_X || last.charCodeAt(1) === CODE_UPPER_X)) {
|
|
@@ -96,20 +139,116 @@ export function normalizeHostname(input) {
|
|
|
96
139
|
// Every character is ASCII by now, so this changes A-Z and nothing else.
|
|
97
140
|
return name.toLowerCase();
|
|
98
141
|
}
|
|
142
|
+
/** 1 to 65535, written in digits without a leading zero; null otherwise. */
|
|
143
|
+
function parsePort(text) {
|
|
144
|
+
if (text.length === 0 || text.length > MAX_PORT_DIGITS)
|
|
145
|
+
return null;
|
|
146
|
+
if (!isAllDigits(text) || text.charCodeAt(0) === CODE_0)
|
|
147
|
+
return null;
|
|
148
|
+
const port = Number(text);
|
|
149
|
+
return port >= 1 && port <= MAX_PORT ? port : null;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Reads what a person pastes into a site's domain field (S314i D1):
|
|
153
|
+
* `example.com`, `www.example.com`, `http://example.com`,
|
|
154
|
+
* `https://www.example.com:2136`, `localhost`, `localhost:3000`,
|
|
155
|
+
* `127.0.0.1:3100`, a one-word host, with or without a trailing slash.
|
|
156
|
+
* Trims, takes an `http://` or `https://` in any letter case, drops one
|
|
157
|
+
* trailing slash, then reads `host[:port]`. Returns null for anything else:
|
|
158
|
+
* a path, a query, a fragment, a user, a wildcard, an IPv6 address, another
|
|
159
|
+
* scheme, a port outside 1 to 65535 or written with a leading zero.
|
|
160
|
+
*
|
|
161
|
+
* `www.` is kept as typed: a domain is matched as written. A port equal to
|
|
162
|
+
* the scheme's own (80 for http, 443 for https) is dropped, because a
|
|
163
|
+
* browser never sends it and the domain would otherwise match nothing.
|
|
164
|
+
* Without a scheme, 80 and 443 are both dropped for the same reason, so
|
|
165
|
+
* "example.com:443" is "example.com" and cannot sit beside
|
|
166
|
+
* "https://example.com" on another site. A port that is not the given
|
|
167
|
+
* scheme's own ("http://example.com:443") is kept: a browser sends it.
|
|
168
|
+
*
|
|
169
|
+
* Written with string functions only, behind a length cap, because the
|
|
170
|
+
* input is whatever somebody typed or sent: no pattern is ever run over it.
|
|
171
|
+
*/
|
|
172
|
+
export function parseSiteDomain(input) {
|
|
173
|
+
if (typeof input !== "string")
|
|
174
|
+
return null;
|
|
175
|
+
if (input.length > MAX_SITE_DOMAIN_INPUT_LENGTH)
|
|
176
|
+
return null;
|
|
177
|
+
let rest = input.trim();
|
|
178
|
+
let scheme;
|
|
179
|
+
if (startsWithIgnoringAsciiCase(rest, "https://")) {
|
|
180
|
+
scheme = "https";
|
|
181
|
+
rest = rest.slice("https://".length);
|
|
182
|
+
}
|
|
183
|
+
else if (startsWithIgnoringAsciiCase(rest, "http://")) {
|
|
184
|
+
scheme = "http";
|
|
185
|
+
rest = rest.slice("http://".length);
|
|
186
|
+
}
|
|
187
|
+
if (rest.endsWith("/"))
|
|
188
|
+
rest = rest.slice(0, -1);
|
|
189
|
+
let hostText = rest;
|
|
190
|
+
let port;
|
|
191
|
+
const colon = rest.indexOf(":");
|
|
192
|
+
if (colon !== -1) {
|
|
193
|
+
hostText = rest.slice(0, colon);
|
|
194
|
+
const parsed = parsePort(rest.slice(colon + 1));
|
|
195
|
+
if (parsed === null)
|
|
196
|
+
return null;
|
|
197
|
+
port = parsed;
|
|
198
|
+
}
|
|
199
|
+
const host = normalizeHost(hostText);
|
|
200
|
+
if (host === null)
|
|
201
|
+
return null;
|
|
202
|
+
// With a scheme, its own port goes; without one, either goes (S314i C3).
|
|
203
|
+
const isDefaultPort = scheme === undefined ? port === DEFAULT_PORT.http || port === DEFAULT_PORT.https : port === DEFAULT_PORT[scheme];
|
|
204
|
+
if (isDefaultPort)
|
|
205
|
+
port = undefined;
|
|
206
|
+
return { ...(scheme !== undefined ? { scheme } : {}), host, ...(port !== undefined ? { port } : {}) };
|
|
207
|
+
}
|
|
208
|
+
/** The stored string of a domain: `[scheme://]host[:port]`. */
|
|
209
|
+
export function formatSiteDomain(domain) {
|
|
210
|
+
const scheme = domain.scheme === undefined ? "" : `${domain.scheme}://`;
|
|
211
|
+
const port = domain.port === undefined ? "" : `:${domain.port}`;
|
|
212
|
+
return `${scheme}${domain.host}${port}`;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* A stored domain without its scheme: `host[:port]`. This is what a domain
|
|
216
|
+
* is matched by and counted by (S314i D2, D3): `http://a.test` and
|
|
217
|
+
* `https://a.test` are one domain. A value with no scheme (the host of
|
|
218
|
+
* KARDALUM_PUBLIC_URL) comes back as it is.
|
|
219
|
+
*/
|
|
220
|
+
export function siteDomainAuthority(domain) {
|
|
221
|
+
if (domain.startsWith("https://"))
|
|
222
|
+
return domain.slice("https://".length);
|
|
223
|
+
if (domain.startsWith("http://"))
|
|
224
|
+
return domain.slice("http://".length);
|
|
225
|
+
return domain;
|
|
226
|
+
}
|
|
99
227
|
/**
|
|
100
|
-
*
|
|
101
|
-
*
|
|
228
|
+
* The origin a link or a redirect to a stored domain is written with
|
|
229
|
+
* (S314i D4): the domain as stored when it carries a scheme, otherwise
|
|
230
|
+
* `scheme` (the request's, or KARDALUM_PUBLIC_URL's) in front of it. The
|
|
231
|
+
* port is the stored one, or none.
|
|
102
232
|
*/
|
|
103
|
-
export
|
|
104
|
-
|
|
105
|
-
|
|
233
|
+
export function siteDomainOrigin(domain, scheme) {
|
|
234
|
+
if (domain.startsWith("https://") || domain.startsWith("http://"))
|
|
235
|
+
return domain;
|
|
236
|
+
return `${scheme}://${domain}`;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* One domain of a site. Parses through `parseSiteDomain`, so the output is
|
|
240
|
+
* the stored form, and a stored domain parses to itself.
|
|
241
|
+
*/
|
|
242
|
+
export const SiteDomainSchema = z.string().transform((value, ctx) => {
|
|
243
|
+
const domain = parseSiteDomain(value);
|
|
244
|
+
if (domain === null) {
|
|
106
245
|
ctx.addIssue({
|
|
107
246
|
code: "custom",
|
|
108
|
-
message: 'A domain is a
|
|
247
|
+
message: 'A domain is a host name or an IPv4 address, with an optional port and an optional http:// or https:// in front, such as "example.com", "localhost:3000", "127.0.0.1:3100" or "https://www.example.com:2136". A path, a query, a wildcard and an IPv6 address are refused.',
|
|
109
248
|
});
|
|
110
249
|
return z.NEVER;
|
|
111
250
|
}
|
|
112
|
-
return
|
|
251
|
+
return formatSiteDomain(domain);
|
|
113
252
|
});
|
|
114
253
|
export const MAX_HOSTNAMES_PER_SITE = 20;
|
|
115
254
|
/**
|
|
@@ -118,7 +257,7 @@ export const MAX_HOSTNAMES_PER_SITE = 20;
|
|
|
118
257
|
*/
|
|
119
258
|
export const SiteHostnamesSchema = z.object({
|
|
120
259
|
siteId: z.string().min(1),
|
|
121
|
-
hostnames: z.array(
|
|
260
|
+
hostnames: z.array(SiteDomainSchema).max(MAX_HOSTNAMES_PER_SITE),
|
|
122
261
|
});
|
|
123
262
|
/**
|
|
124
263
|
* The install's sites setting (the `sites` settings row): which top-level
|
|
@@ -142,7 +281,7 @@ export const SetDefaultSiteRequestSchema = z.object({ defaultSiteId: z.string().
|
|
|
142
281
|
* list, in order. An empty list takes every domain off the site.
|
|
143
282
|
*/
|
|
144
283
|
export const SetSiteHostnamesRequestSchema = z.object({
|
|
145
|
-
hostnames: z.array(
|
|
284
|
+
hostnames: z.array(SiteDomainSchema).max(MAX_HOSTNAMES_PER_SITE),
|
|
146
285
|
});
|
|
147
286
|
/**
|
|
148
287
|
* The default site as a visitor meets it: the top-level node whose own
|
|
@@ -158,6 +297,12 @@ export const SiteSummarySchema = z.object({
|
|
|
158
297
|
hostnames: z.array(z.string()),
|
|
159
298
|
isDefault: z.boolean(),
|
|
160
299
|
});
|
|
300
|
+
/**
|
|
301
|
+
* S314n (D6, P2): whether this server renders pages (KARDALUM_RENDER) and
|
|
302
|
+
* serves the headless delivery API (KARDALUM_HEADLESS). Both are deploy-time
|
|
303
|
+
* switches, read on every answer.
|
|
304
|
+
*/
|
|
305
|
+
export const SiteRenderingSchema = z.object({ pages: z.boolean(), headless: z.boolean() });
|
|
161
306
|
/**
|
|
162
307
|
* What GET /api/manage/v1/settings/sites and the two writes answer: the stored pin,
|
|
163
308
|
* and beside it the default site that pin (or, with nothing pinned, tree
|
|
@@ -188,6 +333,7 @@ export const SitesSettingsResponseSchema = z.object({
|
|
|
188
333
|
sites: z.array(SiteSummarySchema),
|
|
189
334
|
requestHost: z.string(),
|
|
190
335
|
defaultAddressHost: z.string().nullable(),
|
|
336
|
+
rendering: SiteRenderingSchema.optional(),
|
|
191
337
|
});
|
|
192
338
|
/**
|
|
193
339
|
* The query of GET /api/manage/v1/sites. The cursor is the id of the previous page's
|
|
@@ -8,9 +8,9 @@ export declare const SnapshotResponseSchema: z.ZodObject<{
|
|
|
8
8
|
snapshot: z.ZodObject<{
|
|
9
9
|
id: z.ZodString;
|
|
10
10
|
createdAt: z.ZodString;
|
|
11
|
-
label: z.ZodString;
|
|
12
|
-
createdBy: z.ZodString;
|
|
13
11
|
description: z.ZodNullable<z.ZodString>;
|
|
12
|
+
createdBy: z.ZodString;
|
|
13
|
+
label: z.ZodString;
|
|
14
14
|
}, z.core.$strip>;
|
|
15
15
|
}, z.core.$strip>;
|
|
16
16
|
export type SnapshotResponse = z.infer<typeof SnapshotResponseSchema>;
|
|
@@ -23,9 +23,9 @@ export declare const SnapshotListResponseSchema: z.ZodObject<{
|
|
|
23
23
|
items: z.ZodArray<z.ZodObject<{
|
|
24
24
|
id: z.ZodString;
|
|
25
25
|
createdAt: z.ZodString;
|
|
26
|
-
label: z.ZodString;
|
|
27
|
-
createdBy: z.ZodString;
|
|
28
26
|
description: z.ZodNullable<z.ZodString>;
|
|
27
|
+
createdBy: z.ZodString;
|
|
28
|
+
label: z.ZodString;
|
|
29
29
|
}, z.core.$strip>>;
|
|
30
30
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
31
31
|
}, z.core.$strip>;
|
|
@@ -34,13 +34,25 @@ export declare const RestoreSnapshotResponseSchema: z.ZodObject<{
|
|
|
34
34
|
snapshot: z.ZodObject<{
|
|
35
35
|
id: z.ZodString;
|
|
36
36
|
createdAt: z.ZodString;
|
|
37
|
-
label: z.ZodString;
|
|
38
|
-
createdBy: z.ZodString;
|
|
39
37
|
description: z.ZodNullable<z.ZodString>;
|
|
38
|
+
createdBy: z.ZodString;
|
|
39
|
+
label: z.ZodString;
|
|
40
40
|
}, z.core.$strip>;
|
|
41
41
|
restoredItems: z.ZodNumber;
|
|
42
42
|
}, z.core.$strip>;
|
|
43
43
|
export type RestoreSnapshotResponse = z.infer<typeof RestoreSnapshotResponseSchema>;
|
|
44
|
+
export declare const RestoreSnapshotRequestSchema: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
45
|
+
confirm: z.ZodOptional<z.ZodBoolean>;
|
|
46
|
+
}, z.core.$strip>>>;
|
|
47
|
+
export type RestoreSnapshotRequest = NonNullable<z.infer<typeof RestoreSnapshotRequestSchema>>;
|
|
48
|
+
export declare const RestoreSnapshotConfirmationSchema: z.ZodObject<{
|
|
49
|
+
requiresConfirmation: z.ZodLiteral<true>;
|
|
50
|
+
label: z.ZodString;
|
|
51
|
+
itemCount: z.ZodNumber;
|
|
52
|
+
nodeCount: z.ZodNumber;
|
|
53
|
+
message: z.ZodString;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
export type RestoreSnapshotConfirmation = z.infer<typeof RestoreSnapshotConfirmationSchema>;
|
|
44
56
|
export declare const SnapshotParamsSchema: z.ZodObject<{
|
|
45
57
|
id: z.ZodString;
|
|
46
58
|
}, z.core.$strip>;
|
|
@@ -23,5 +23,19 @@ export const RestoreSnapshotResponseSchema = z.object({
|
|
|
23
23
|
// How many content nodes had their pointers repointed.
|
|
24
24
|
restoredItems: z.number().int().nonnegative(),
|
|
25
25
|
});
|
|
26
|
+
// S308: restoring a snapshot repoints every captured page at once, so the route
|
|
27
|
+
// asks first. Nullish because Fastify hands a missing body to the validator as
|
|
28
|
+
// null (the note RestoreBodySchema carries); an empty or `confirm: false` body is
|
|
29
|
+
// the unconfirmed call and answers the plan, never the restore.
|
|
30
|
+
export const RestoreSnapshotRequestSchema = z.object({ confirm: z.boolean().optional() }).nullish();
|
|
31
|
+
// The 409 plan. itemCount is the node and culture pairs the restore writes (what
|
|
32
|
+
// restoredItems reports afterwards); nodeCount is the distinct pages among them.
|
|
33
|
+
export const RestoreSnapshotConfirmationSchema = z.object({
|
|
34
|
+
requiresConfirmation: z.literal(true),
|
|
35
|
+
label: z.string(),
|
|
36
|
+
itemCount: z.number().int().nonnegative(),
|
|
37
|
+
nodeCount: z.number().int().nonnegative(),
|
|
38
|
+
message: z.string(),
|
|
39
|
+
});
|
|
26
40
|
// S301: the params of POST /snapshots/:id/restore, moved here from the route file.
|
|
27
41
|
export const SnapshotParamsSchema = z.object({ id: z.string().uuid() });
|
|
@@ -23,8 +23,8 @@ export type Snapshot = z.infer<typeof SnapshotSchema>;
|
|
|
23
23
|
export declare const SnapshotMetaSchema: z.ZodObject<{
|
|
24
24
|
id: z.ZodString;
|
|
25
25
|
createdAt: z.ZodString;
|
|
26
|
-
label: z.ZodString;
|
|
27
|
-
createdBy: z.ZodString;
|
|
28
26
|
description: z.ZodNullable<z.ZodString>;
|
|
27
|
+
createdBy: z.ZodString;
|
|
28
|
+
label: z.ZodString;
|
|
29
29
|
}, z.core.$strip>;
|
|
30
30
|
export type SnapshotMeta = z.infer<typeof SnapshotMetaSchema>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** True when the value holds no C0 control character and no DEL. */
|
|
3
|
+
export declare function hasNoControlCharacter(value: string): boolean;
|
|
4
|
+
export interface StrictUrlOptions {
|
|
5
|
+
/** The protocols the URL may name, as zod's URL check takes them (`/^https?$/`). */
|
|
6
|
+
protocol?: RegExp;
|
|
7
|
+
/** The message for a control character and for a value the URL check refuses. */
|
|
8
|
+
error?: string;
|
|
9
|
+
/** The longest value accepted, in characters. */
|
|
10
|
+
max?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function strictUrl(options?: StrictUrlOptions): z.ZodPipe<z.ZodString, z.ZodURL>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// S314e (spec C6): one strict URL field for every URL the schemas take.
|
|
3
|
+
// Zod's own URL check (zod 4.6) strips a tab or a line break from a value
|
|
4
|
+
// before it parses it, and the WHATWG URL parser does the same, so a value
|
|
5
|
+
// with an embedded or trailing line feed or tab passed the check and reached
|
|
6
|
+
// the caller unchanged. This helper refuses every C0 control character
|
|
7
|
+
// (U+0000 to U+001F) and DEL (U+007F) on the raw string first, then hands the
|
|
8
|
+
// string to zod's URL check. The `format: uri` the URL check would have given
|
|
9
|
+
// the generated document is restated on the input side, where the document
|
|
10
|
+
// generator reads a request body from, and the output side keeps it from the
|
|
11
|
+
// URL check itself.
|
|
12
|
+
/** True when the value holds no C0 control character and no DEL. */
|
|
13
|
+
export function hasNoControlCharacter(value) {
|
|
14
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
15
|
+
const code = value.charCodeAt(index);
|
|
16
|
+
if (code < 0x20 || code === 0x7f)
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
const CONTROL_CHARACTER_MESSAGE = "A URL must not contain control characters";
|
|
22
|
+
export function strictUrl(options = {}) {
|
|
23
|
+
const raw = options.max === undefined ? z.string() : z.string().max(options.max);
|
|
24
|
+
return raw
|
|
25
|
+
.meta({ format: "uri" })
|
|
26
|
+
.refine(hasNoControlCharacter, options.error ?? CONTROL_CHARACTER_MESSAGE)
|
|
27
|
+
.pipe(z.url({
|
|
28
|
+
...(options.protocol ? { protocol: options.protocol } : {}),
|
|
29
|
+
...(options.error ? { error: options.error } : {}),
|
|
30
|
+
}));
|
|
31
|
+
}
|