@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
|
@@ -3,36 +3,74 @@ import { isReservedRootSlug } from "./reserved-slugs.js";
|
|
|
3
3
|
import { TemplateVersionSourceSchema } from "./template.schema.js";
|
|
4
4
|
// A registered asset: a text file under public/ whose edits are mirrored
|
|
5
5
|
// into immutable asset_versions rows (S192 spec §5). Unregistered files
|
|
6
|
-
// under public/ are just files
|
|
6
|
+
// under public/ are just files: they never get rows here.
|
|
7
7
|
//
|
|
8
|
-
// Path rules: relative, forward slashes,
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
|
|
8
|
+
// Path rules (S314j, D2 and P1): relative, forward slashes, every segment
|
|
9
|
+
// made of what a URL path segment can carry (letters and digits of any
|
|
10
|
+
// script, space, and _ - . ~ @ + , ( ) ! $ ' = ; &), in any position except
|
|
11
|
+
// a leading dot: a dot-name is a hidden file the asset tree (walkPublicDir)
|
|
12
|
+
// never lists, so a write there would be an invisible orphan. Refused:
|
|
13
|
+
// control characters, "\", "%", "?", "#", an empty segment and the dot
|
|
14
|
+
// segments. Never rooted at any RESERVED_ROOT_SLUGS segment (kardalum, api,
|
|
15
|
+
// docs, plugin-assets, media, kardalum-edit): the tree hides every one of
|
|
16
|
+
// those roots for the same reason. A browser percent-encodes such names in a
|
|
17
|
+
// link. A segment is at most 255 UTF-8 bytes and never begins or ends with a
|
|
18
|
+
// space nor ends with a dot (fix wave 1, A2). Each rule carries its own
|
|
19
|
+
// message, because the first failing rule's message is the reason the tree
|
|
20
|
+
// gives for a name it does not list.
|
|
21
|
+
const FORBIDDEN_CHARACTER = /[\u0000-\u001f\u007f\\%?#]/;
|
|
22
|
+
const SEGMENT_CHARACTERS = /^[\p{L}\p{M}\p{N} _\-.~@+,()!$'=;&]+$/u;
|
|
23
|
+
const isPlainSegment = (segment) => segment !== "" && segment !== "." && segment !== ".." && !segment.startsWith(".");
|
|
24
|
+
// A file name on ext4 (NAME_MAX) and most file systems is at most 255 bytes;
|
|
25
|
+
// a longer segment passes the 400-character path cap and then throws
|
|
26
|
+
// ENAMETOOLONG after the row is created.
|
|
27
|
+
const MAX_SEGMENT_BYTES = 255;
|
|
28
|
+
// Counted by code point (this package has no TextEncoder type; see
|
|
29
|
+
// media-reference-use.ts): 1 to 4 bytes each, a lone surrogate as the 3 bytes
|
|
30
|
+
// of its replacement character.
|
|
31
|
+
const utf8Length = (segment) => {
|
|
32
|
+
let bytes = 0;
|
|
33
|
+
for (const ch of segment) {
|
|
34
|
+
const code = ch.codePointAt(0) ?? 0;
|
|
35
|
+
bytes += code < 0x80 ? 1 : code < 0x800 ? 2 : code < 0x10000 ? 3 : 4;
|
|
36
|
+
}
|
|
37
|
+
return bytes;
|
|
38
|
+
};
|
|
39
|
+
const segmentFitsFileSystem = (segment) => utf8Length(segment) <= MAX_SEGMENT_BYTES;
|
|
40
|
+
// Windows strips a trailing dot or space from a file name, so the stored path
|
|
41
|
+
// and the file would differ; a leading space is refused beside it, as no tool
|
|
42
|
+
// keeps one reliably.
|
|
43
|
+
const segmentKeepsItsName = (segment) => segment === "" || (!segment.startsWith(" ") && !segment.endsWith(" ") && !segment.endsWith("."));
|
|
15
44
|
export const AssetPathSchema = z
|
|
16
45
|
.string()
|
|
17
|
-
.min(1)
|
|
18
|
-
.max(400)
|
|
19
|
-
.refine((p) => !
|
|
20
|
-
.refine((p) => p.split("/").every(
|
|
21
|
-
|
|
22
|
-
|
|
46
|
+
.min(1, "an empty path")
|
|
47
|
+
.max(400, "longer than 400 characters")
|
|
48
|
+
.refine((p) => !FORBIDDEN_CHARACTER.test(p), "contains \\, %, ?, # or a control character, which an asset name cannot carry")
|
|
49
|
+
.refine((p) => p.split("/").every(isPlainSegment), 'an empty, "." or ".." segment, or a name that starts with a dot (a hidden file)')
|
|
50
|
+
.refine((p) => p.split("/").every((segment) => segment === "" || SEGMENT_CHARACTERS.test(segment)), "a character other than letters, digits, spaces and _ - . ~ @ + , ( ) ! $ ' = ; &")
|
|
51
|
+
.refine((p) => p.split("/").every(segmentFitsFileSystem), "a name longer than 255 bytes (UTF-8), which a file system cannot store")
|
|
52
|
+
.refine((p) => p.split("/").every(segmentKeepsItsName), "a name that begins or ends with a space or ends with a dot, which Windows strips from a file name")
|
|
23
53
|
.refine((p) => !isReservedRootSlug(p.split("/")[0] ?? ""), {
|
|
24
54
|
message: "this path root is reserved for the server (see RESERVED_ROOT_SLUGS)",
|
|
25
|
-
})
|
|
55
|
+
})
|
|
56
|
+
.describe("A path under public/: segments of letters, digits, spaces and _ - . ~ @ + , ( ) ! $ ' = ; & joined by /, none starting with a dot or ending with a dot or space, each at most 255 bytes, never under a reserved root.");
|
|
57
|
+
// S314c6 (D6): the generator's name rule gives a `path` field "/about-us", whose leading slash
|
|
58
|
+
// is the empty segment the refinements refuse. A route's path field carries a valid example;
|
|
59
|
+
// the shared AssetPathSchema stays without one, because the asset field's settings
|
|
60
|
+
// (startFolder, mirrored in the plugin SDK) reuse it for a folder.
|
|
61
|
+
export const AssetRoutePathSchema = AssetPathSchema.meta({ example: "css/site.css" });
|
|
26
62
|
export const AssetDefinitionSchema = z
|
|
27
63
|
.object({
|
|
28
64
|
id: z.string().uuid(),
|
|
29
|
-
path:
|
|
65
|
+
path: AssetRoutePathSchema,
|
|
30
66
|
pluginId: z.string().min(1).nullable(),
|
|
31
67
|
currentVersion: z.number().int().min(1),
|
|
32
68
|
})
|
|
33
69
|
.strict();
|
|
34
|
-
//
|
|
35
|
-
//
|
|
70
|
+
// S314c3 (D8): the default of a site's asset limit, in UTF-8 bytes. The server holds every
|
|
71
|
+
// write to KARDALUM_MAX_ASSET_BYTES (this number unless raised); the plugin build holds a
|
|
72
|
+
// package to this number (D10). The request schemas carry no maximum of their own, so the
|
|
73
|
+
// configured limit is enforced in one place.
|
|
36
74
|
export const MAX_ASSET_CONTENT_BYTES = 5_242_880;
|
|
37
75
|
export const AssetVersionSchema = z
|
|
38
76
|
.object({
|
|
@@ -45,3 +83,7 @@ export const AssetVersionSchema = z
|
|
|
45
83
|
createdAt: z.string().min(1),
|
|
46
84
|
})
|
|
47
85
|
.strict();
|
|
86
|
+
// S314g: as TemplateVersionMetaSchema and TrashedTemplateSchema, for a
|
|
87
|
+
// registered text asset.
|
|
88
|
+
export const AssetVersionMetaSchema = AssetVersionSchema.omit({ content: true });
|
|
89
|
+
export const TrashedAssetSchema = AssetDefinitionSchema.extend({ deletedAt: z.string().min(1) });
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** The width every text value of an entry is capped to before the insert: VARCHAR(191) on MySQL. */
|
|
3
|
+
export declare const AUDIT_TEXT_MAX = 191;
|
|
4
|
+
/** The address column's width: an IPv6 address in its longest written form, an IPv4-mapped one. */
|
|
5
|
+
export declare const AUDIT_IP_MAX = 45;
|
|
6
|
+
/** The method column's width: every method the server routes fits in it. */
|
|
7
|
+
export declare const AUDIT_METHOD_MAX = 8;
|
|
8
|
+
/** The request id column's width: `<boot id>.<per-request part>` fits with room to spare. */
|
|
9
|
+
export declare const AUDIT_REQUEST_ID_MAX = 64;
|
|
10
|
+
/** The most bytes an entry's summary takes, serialized as JSON. Past it, keys are dropped from the end and `truncated: true` is set. */
|
|
11
|
+
export declare const AUDIT_SUMMARY_MAX_BYTES = 2048;
|
|
12
|
+
/** A month as an entry's `period` and the export's query spell it: `2026-10`. */
|
|
13
|
+
export declare const AUDIT_PERIOD_PATTERN: RegExp;
|
|
14
|
+
/** Who made the request: a signed-in person, an API key, the site's own server code (the in-process handle), or nobody verified. */
|
|
15
|
+
export declare const AuditActorKindSchema: z.ZodEnum<{
|
|
16
|
+
key: "key";
|
|
17
|
+
session: "session";
|
|
18
|
+
site: "site";
|
|
19
|
+
anonymous: "anonymous";
|
|
20
|
+
}>;
|
|
21
|
+
export type AuditActorKind = z.infer<typeof AuditActorKindSchema>;
|
|
22
|
+
/** How a request ended, by its status: success below 400, refused from 400 to 499, failed from 500. */
|
|
23
|
+
export declare const AuditOutcomeSchema: z.ZodEnum<{
|
|
24
|
+
success: "success";
|
|
25
|
+
refused: "refused";
|
|
26
|
+
failed: "failed";
|
|
27
|
+
}>;
|
|
28
|
+
export type AuditOutcome = z.infer<typeof AuditOutcomeSchema>;
|
|
29
|
+
/** One value of a summary: plain values and lists of strings only, so a request body can never ride along. */
|
|
30
|
+
export declare const AuditSummaryValueSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodArray<z.ZodString>]>;
|
|
31
|
+
export type AuditSummaryValue = z.infer<typeof AuditSummaryValueSchema>;
|
|
32
|
+
export declare const AuditEntrySchema: z.ZodObject<{
|
|
33
|
+
id: z.ZodString;
|
|
34
|
+
at: z.ZodString;
|
|
35
|
+
period: z.ZodString;
|
|
36
|
+
requestId: z.ZodString;
|
|
37
|
+
actorKind: z.ZodEnum<{
|
|
38
|
+
key: "key";
|
|
39
|
+
session: "session";
|
|
40
|
+
site: "site";
|
|
41
|
+
anonymous: "anonymous";
|
|
42
|
+
}>;
|
|
43
|
+
userId: z.ZodNullable<z.ZodString>;
|
|
44
|
+
userName: z.ZodNullable<z.ZodString>;
|
|
45
|
+
userEmail: z.ZodNullable<z.ZodString>;
|
|
46
|
+
userRole: z.ZodNullable<z.ZodString>;
|
|
47
|
+
keyId: z.ZodNullable<z.ZodString>;
|
|
48
|
+
keyName: z.ZodNullable<z.ZodString>;
|
|
49
|
+
keyOwnerId: z.ZodNullable<z.ZodString>;
|
|
50
|
+
keyOwnerName: z.ZodNullable<z.ZodString>;
|
|
51
|
+
keyOwnerEmail: z.ZodNullable<z.ZodString>;
|
|
52
|
+
ip: z.ZodString;
|
|
53
|
+
method: z.ZodString;
|
|
54
|
+
route: z.ZodString;
|
|
55
|
+
action: z.ZodNullable<z.ZodString>;
|
|
56
|
+
targetType: z.ZodNullable<z.ZodString>;
|
|
57
|
+
targetId: z.ZodNullable<z.ZodString>;
|
|
58
|
+
status: z.ZodNumber;
|
|
59
|
+
summary: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodArray<z.ZodString>]>>>;
|
|
60
|
+
}, z.core.$strip>;
|
|
61
|
+
export type AuditEntry = z.infer<typeof AuditEntrySchema>;
|
|
62
|
+
export declare const AuditListQuerySchema: z.ZodObject<{
|
|
63
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
64
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
65
|
+
from: z.ZodOptional<z.ZodString>;
|
|
66
|
+
to: z.ZodOptional<z.ZodString>;
|
|
67
|
+
actorKind: z.ZodOptional<z.ZodEnum<{
|
|
68
|
+
key: "key";
|
|
69
|
+
session: "session";
|
|
70
|
+
site: "site";
|
|
71
|
+
anonymous: "anonymous";
|
|
72
|
+
}>>;
|
|
73
|
+
userId: z.ZodOptional<z.ZodString>;
|
|
74
|
+
keyId: z.ZodOptional<z.ZodString>;
|
|
75
|
+
ip: z.ZodOptional<z.ZodString>;
|
|
76
|
+
method: z.ZodOptional<z.ZodString>;
|
|
77
|
+
route: z.ZodOptional<z.ZodString>;
|
|
78
|
+
action: z.ZodOptional<z.ZodString>;
|
|
79
|
+
status: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
80
|
+
outcome: z.ZodOptional<z.ZodEnum<{
|
|
81
|
+
success: "success";
|
|
82
|
+
refused: "refused";
|
|
83
|
+
failed: "failed";
|
|
84
|
+
}>>;
|
|
85
|
+
targetType: z.ZodOptional<z.ZodString>;
|
|
86
|
+
targetId: z.ZodOptional<z.ZodString>;
|
|
87
|
+
requestId: z.ZodOptional<z.ZodString>;
|
|
88
|
+
}, z.core.$strip>;
|
|
89
|
+
export type AuditListQuery = z.infer<typeof AuditListQuerySchema>;
|
|
90
|
+
export declare const AuditListResponseSchema: z.ZodObject<{
|
|
91
|
+
items: z.ZodArray<z.ZodObject<{
|
|
92
|
+
id: z.ZodString;
|
|
93
|
+
at: z.ZodString;
|
|
94
|
+
period: z.ZodString;
|
|
95
|
+
requestId: z.ZodString;
|
|
96
|
+
actorKind: z.ZodEnum<{
|
|
97
|
+
key: "key";
|
|
98
|
+
session: "session";
|
|
99
|
+
site: "site";
|
|
100
|
+
anonymous: "anonymous";
|
|
101
|
+
}>;
|
|
102
|
+
userId: z.ZodNullable<z.ZodString>;
|
|
103
|
+
userName: z.ZodNullable<z.ZodString>;
|
|
104
|
+
userEmail: z.ZodNullable<z.ZodString>;
|
|
105
|
+
userRole: z.ZodNullable<z.ZodString>;
|
|
106
|
+
keyId: z.ZodNullable<z.ZodString>;
|
|
107
|
+
keyName: z.ZodNullable<z.ZodString>;
|
|
108
|
+
keyOwnerId: z.ZodNullable<z.ZodString>;
|
|
109
|
+
keyOwnerName: z.ZodNullable<z.ZodString>;
|
|
110
|
+
keyOwnerEmail: z.ZodNullable<z.ZodString>;
|
|
111
|
+
ip: z.ZodString;
|
|
112
|
+
method: z.ZodString;
|
|
113
|
+
route: z.ZodString;
|
|
114
|
+
action: z.ZodNullable<z.ZodString>;
|
|
115
|
+
targetType: z.ZodNullable<z.ZodString>;
|
|
116
|
+
targetId: z.ZodNullable<z.ZodString>;
|
|
117
|
+
status: z.ZodNumber;
|
|
118
|
+
summary: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodArray<z.ZodString>]>>>;
|
|
119
|
+
}, z.core.$strip>>;
|
|
120
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
121
|
+
displaced: z.ZodNumber;
|
|
122
|
+
}, z.core.$strip>;
|
|
123
|
+
export type AuditListResponse = z.infer<typeof AuditListResponseSchema>;
|
|
124
|
+
export declare const AuditExportQuerySchema: z.ZodObject<{
|
|
125
|
+
period: z.ZodString;
|
|
126
|
+
}, z.core.$strip>;
|
|
127
|
+
export type AuditExportQuery = z.infer<typeof AuditExportQuerySchema>;
|
|
128
|
+
/** The most months retention keeps besides the current one: ten years. */
|
|
129
|
+
export declare const AUDIT_RETENTION_MAX_MONTHS = 120;
|
|
130
|
+
export declare const AuditRetentionSchema: z.ZodObject<{
|
|
131
|
+
retentionMonths: z.ZodNumber;
|
|
132
|
+
}, z.core.$strict>;
|
|
133
|
+
export type AuditRetention = z.infer<typeof AuditRetentionSchema>;
|
|
134
|
+
/** Why a pass did nothing: retention is 0, no archive folder is set, the audit log is off, or its database reads failed (`error`; the server log and the pass's own entry say why). */
|
|
135
|
+
export declare const AuditRetentionReasonSchema: z.ZodEnum<{
|
|
136
|
+
error: "error";
|
|
137
|
+
"retention-off": "retention-off";
|
|
138
|
+
"folder-unset": "folder-unset";
|
|
139
|
+
"log-off": "log-off";
|
|
140
|
+
}>;
|
|
141
|
+
export type AuditRetentionReason = z.infer<typeof AuditRetentionReasonSchema>;
|
|
142
|
+
/** What one retention pass did (S314b2, D4, D5): the months it archived, the months whose entries it removed, and the months that keep entries, with why. */
|
|
143
|
+
export declare const AuditPruneResponseSchema: z.ZodObject<{
|
|
144
|
+
startedAt: z.ZodString;
|
|
145
|
+
finishedAt: z.ZodString;
|
|
146
|
+
retentionMonths: z.ZodNumber;
|
|
147
|
+
reason: z.ZodNullable<z.ZodEnum<{
|
|
148
|
+
error: "error";
|
|
149
|
+
"retention-off": "retention-off";
|
|
150
|
+
"folder-unset": "folder-unset";
|
|
151
|
+
"log-off": "log-off";
|
|
152
|
+
}>>;
|
|
153
|
+
archived: z.ZodArray<z.ZodObject<{
|
|
154
|
+
period: z.ZodString;
|
|
155
|
+
rows: z.ZodNumber;
|
|
156
|
+
file: z.ZodString;
|
|
157
|
+
}, z.core.$strip>>;
|
|
158
|
+
pruned: z.ZodArray<z.ZodObject<{
|
|
159
|
+
period: z.ZodString;
|
|
160
|
+
rows: z.ZodNumber;
|
|
161
|
+
}, z.core.$strip>>;
|
|
162
|
+
refused: z.ZodArray<z.ZodObject<{
|
|
163
|
+
period: z.ZodString;
|
|
164
|
+
message: z.ZodString;
|
|
165
|
+
}, z.core.$strip>>;
|
|
166
|
+
rows: z.ZodNumber;
|
|
167
|
+
}, z.core.$strip>;
|
|
168
|
+
export type AuditPruneResponse = z.infer<typeof AuditPruneResponseSchema>;
|
|
169
|
+
export declare const AuditRetentionResponseSchema: z.ZodObject<{
|
|
170
|
+
retentionMonths: z.ZodNumber;
|
|
171
|
+
folderConfigured: z.ZodBoolean;
|
|
172
|
+
lastPass: z.ZodNullable<z.ZodObject<{
|
|
173
|
+
startedAt: z.ZodString;
|
|
174
|
+
finishedAt: z.ZodString;
|
|
175
|
+
retentionMonths: z.ZodNumber;
|
|
176
|
+
reason: z.ZodNullable<z.ZodEnum<{
|
|
177
|
+
error: "error";
|
|
178
|
+
"retention-off": "retention-off";
|
|
179
|
+
"folder-unset": "folder-unset";
|
|
180
|
+
"log-off": "log-off";
|
|
181
|
+
}>>;
|
|
182
|
+
archived: z.ZodArray<z.ZodObject<{
|
|
183
|
+
period: z.ZodString;
|
|
184
|
+
rows: z.ZodNumber;
|
|
185
|
+
file: z.ZodString;
|
|
186
|
+
}, z.core.$strip>>;
|
|
187
|
+
pruned: z.ZodArray<z.ZodObject<{
|
|
188
|
+
period: z.ZodString;
|
|
189
|
+
rows: z.ZodNumber;
|
|
190
|
+
}, z.core.$strip>>;
|
|
191
|
+
refused: z.ZodArray<z.ZodObject<{
|
|
192
|
+
period: z.ZodString;
|
|
193
|
+
message: z.ZodString;
|
|
194
|
+
}, z.core.$strip>>;
|
|
195
|
+
rows: z.ZodNumber;
|
|
196
|
+
}, z.core.$strip>>;
|
|
197
|
+
}, z.core.$strip>;
|
|
198
|
+
export type AuditRetentionResponse = z.infer<typeof AuditRetentionResponseSchema>;
|
|
199
|
+
/** The 409 of Run now while a pass runs: the message and when that pass started. */
|
|
200
|
+
export declare const AuditPruneBusySchema: z.ZodObject<{
|
|
201
|
+
message: z.ZodString;
|
|
202
|
+
startedAt: z.ZodString;
|
|
203
|
+
}, z.core.$strip>;
|
|
204
|
+
export type AuditPruneBusy = z.infer<typeof AuditPruneBusySchema>;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// S314b (P7, P11, P13): the audit log as the management API answers it. An entry
|
|
3
|
+
// records one write attempt, or one audit export, with who made it copied as values:
|
|
4
|
+
// nothing in it links to a users or api_keys row, so deleting either leaves the entry
|
|
5
|
+
// whole. The server caps every text value at AUDIT_TEXT_MAX before the insert, except
|
|
6
|
+
// three columns narrower than 191 (AUDIT_IP_MAX, AUDIT_METHOD_MAX, AUDIT_REQUEST_ID_MAX),
|
|
7
|
+
// and the summary at AUDIT_SUMMARY_MAX_BYTES. A route states its summary itself, and a summary
|
|
8
|
+
// never holds a password, a key secret, a licence key, a token or a request body.
|
|
9
|
+
/** The width every text value of an entry is capped to before the insert: VARCHAR(191) on MySQL. */
|
|
10
|
+
export const AUDIT_TEXT_MAX = 191;
|
|
11
|
+
/** The address column's width: an IPv6 address in its longest written form, an IPv4-mapped one. */
|
|
12
|
+
export const AUDIT_IP_MAX = 45;
|
|
13
|
+
/** The method column's width: every method the server routes fits in it. */
|
|
14
|
+
export const AUDIT_METHOD_MAX = 8;
|
|
15
|
+
/** The request id column's width: `<boot id>.<per-request part>` fits with room to spare. */
|
|
16
|
+
export const AUDIT_REQUEST_ID_MAX = 64;
|
|
17
|
+
/** The most bytes an entry's summary takes, serialized as JSON. Past it, keys are dropped from the end and `truncated: true` is set. */
|
|
18
|
+
export const AUDIT_SUMMARY_MAX_BYTES = 2048;
|
|
19
|
+
/** A month as an entry's `period` and the export's query spell it: `2026-10`. */
|
|
20
|
+
export const AUDIT_PERIOD_PATTERN = /^\d{4}-(0[1-9]|1[0-2])$/;
|
|
21
|
+
/** Who made the request: a signed-in person, an API key, the site's own server code (the in-process handle), or nobody verified. */
|
|
22
|
+
export const AuditActorKindSchema = z.enum(["session", "key", "site", "anonymous"]);
|
|
23
|
+
/** How a request ended, by its status: success below 400, refused from 400 to 499, failed from 500. */
|
|
24
|
+
export const AuditOutcomeSchema = z.enum(["success", "refused", "failed"]);
|
|
25
|
+
/** One value of a summary: plain values and lists of strings only, so a request body can never ride along. */
|
|
26
|
+
export const AuditSummaryValueSchema = z.union([z.string(), z.number(), z.boolean(), z.null(), z.array(z.string())]);
|
|
27
|
+
export const AuditEntrySchema = z.object({
|
|
28
|
+
id: z.string().uuid(),
|
|
29
|
+
// When the reply was sent.
|
|
30
|
+
at: z.string().datetime(),
|
|
31
|
+
// The month of `at` in UTC, which the export selects by.
|
|
32
|
+
period: z.string().regex(AUDIT_PERIOD_PATTERN),
|
|
33
|
+
// The request's id in the server log (`reqId`), unique across restarts and instances.
|
|
34
|
+
requestId: z.string(),
|
|
35
|
+
actorKind: AuditActorKindSchema,
|
|
36
|
+
// A session's user as the users row read at that moment; the role is the stored role.
|
|
37
|
+
userId: z.string().nullable(),
|
|
38
|
+
userName: z.string().nullable(),
|
|
39
|
+
userEmail: z.string().nullable(),
|
|
40
|
+
userRole: z.string().nullable(),
|
|
41
|
+
// The key, also a refused one whose row matched (revoked, expired, or a live key on a session-only route).
|
|
42
|
+
keyId: z.string().nullable(),
|
|
43
|
+
keyName: z.string().nullable(),
|
|
44
|
+
// The key's creator at that moment; null for a key with no creator.
|
|
45
|
+
keyOwnerId: z.string().nullable(),
|
|
46
|
+
keyOwnerName: z.string().nullable(),
|
|
47
|
+
keyOwnerEmail: z.string().nullable(),
|
|
48
|
+
// The caller's address as the server resolved it: KARDALUM_TRUST_PROXY decides whether a proxy's header counts.
|
|
49
|
+
ip: z.string(),
|
|
50
|
+
method: z.string(),
|
|
51
|
+
// The registered route pattern, `/api/manage/v1/content/:id/publish`.
|
|
52
|
+
route: z.string(),
|
|
53
|
+
// The action a gate asked, or null where no gate asked one.
|
|
54
|
+
action: z.string().nullable(),
|
|
55
|
+
targetType: z.string().nullable(),
|
|
56
|
+
targetId: z.string().nullable(),
|
|
57
|
+
status: z.number().int().min(100).max(599),
|
|
58
|
+
summary: z.record(z.string(), AuditSummaryValueSchema).nullable(),
|
|
59
|
+
});
|
|
60
|
+
/** An exact-match filter: the value an entry holds, at most as wide as the column. */
|
|
61
|
+
const exactMatch = (max) => z.string().min(1).max(max).optional();
|
|
62
|
+
export const AuditListQuerySchema = z.object({
|
|
63
|
+
cursor: z.string().uuid().optional(),
|
|
64
|
+
limit: z.coerce.number().int().min(1).max(100).default(50),
|
|
65
|
+
// An inclusive range on `at`.
|
|
66
|
+
from: z.string().datetime().optional(),
|
|
67
|
+
to: z.string().datetime().optional(),
|
|
68
|
+
actorKind: AuditActorKindSchema.optional(),
|
|
69
|
+
userId: exactMatch(AUDIT_TEXT_MAX),
|
|
70
|
+
keyId: exactMatch(AUDIT_TEXT_MAX),
|
|
71
|
+
ip: exactMatch(AUDIT_IP_MAX),
|
|
72
|
+
method: exactMatch(AUDIT_METHOD_MAX),
|
|
73
|
+
route: exactMatch(AUDIT_TEXT_MAX),
|
|
74
|
+
action: exactMatch(AUDIT_TEXT_MAX),
|
|
75
|
+
status: z.coerce.number().int().min(100).max(599).optional(),
|
|
76
|
+
outcome: AuditOutcomeSchema.optional(),
|
|
77
|
+
targetType: exactMatch(AUDIT_TEXT_MAX),
|
|
78
|
+
targetId: exactMatch(AUDIT_TEXT_MAX),
|
|
79
|
+
requestId: exactMatch(AUDIT_REQUEST_ID_MAX),
|
|
80
|
+
});
|
|
81
|
+
export const AuditListResponseSchema = z.object({
|
|
82
|
+
// Newest first.
|
|
83
|
+
items: z.array(AuditEntrySchema),
|
|
84
|
+
// null = no more pages.
|
|
85
|
+
nextCursor: z.string().uuid().nullable(),
|
|
86
|
+
// How many entries this server process could not write since it started (D8): the write went through, its entry did not.
|
|
87
|
+
displaced: z.number().int().nonnegative(),
|
|
88
|
+
});
|
|
89
|
+
export const AuditExportQuerySchema = z.object({
|
|
90
|
+
period: z.string().regex(AUDIT_PERIOD_PATTERN, "period must be a month, YYYY-MM"),
|
|
91
|
+
});
|
|
92
|
+
/** The most months retention keeps besides the current one: ten years. */
|
|
93
|
+
export const AUDIT_RETENTION_MAX_MONTHS = 120;
|
|
94
|
+
// S314b2 (D1, P6): how many months of entries the log keeps besides the current month. 0
|
|
95
|
+
// keeps every entry and is the default. The archive folder is not part of the setting: it
|
|
96
|
+
// comes from the server's environment (KARDALUM_AUDIT_ARCHIVE_DIR), never from a request,
|
|
97
|
+
// so the strict object refuses any other field.
|
|
98
|
+
export const AuditRetentionSchema = z
|
|
99
|
+
.object({
|
|
100
|
+
retentionMonths: z.number().int().min(0).max(AUDIT_RETENTION_MAX_MONTHS),
|
|
101
|
+
})
|
|
102
|
+
.strict();
|
|
103
|
+
/** Why a pass did nothing: retention is 0, no archive folder is set, the audit log is off, or its database reads failed (`error`; the server log and the pass's own entry say why). */
|
|
104
|
+
export const AuditRetentionReasonSchema = z.enum(["retention-off", "folder-unset", "log-off", "error"]);
|
|
105
|
+
const AuditPeriodSchema = z.string().regex(AUDIT_PERIOD_PATTERN);
|
|
106
|
+
/** What one retention pass did (S314b2, D4, D5): the months it archived, the months whose entries it removed, and the months that keep entries, with why. */
|
|
107
|
+
export const AuditPruneResponseSchema = z.object({
|
|
108
|
+
startedAt: z.string().datetime(),
|
|
109
|
+
finishedAt: z.string().datetime(),
|
|
110
|
+
// The setting the pass ran with.
|
|
111
|
+
retentionMonths: z.number().int().min(0).max(AUDIT_RETENTION_MAX_MONTHS),
|
|
112
|
+
// Set when the pass did nothing at all.
|
|
113
|
+
reason: AuditRetentionReasonSchema.nullable(),
|
|
114
|
+
// Months this pass wrote to a verified file: the entries in it and the file's name in the archive folder.
|
|
115
|
+
archived: z.array(z.object({ period: AuditPeriodSchema, rows: z.number().int().nonnegative(), file: z.string() })),
|
|
116
|
+
// Months whose archived entries this pass removed from the table, with how many.
|
|
117
|
+
pruned: z.array(z.object({ period: AuditPeriodSchema, rows: z.number().int().nonnegative() })),
|
|
118
|
+
// Months that keep entries, and why: a file that did not verify, a write that failed, entries the file does not list.
|
|
119
|
+
refused: z.array(z.object({ period: AuditPeriodSchema, message: z.string() })),
|
|
120
|
+
// Entries removed in all.
|
|
121
|
+
rows: z.number().int().nonnegative(),
|
|
122
|
+
});
|
|
123
|
+
export const AuditRetentionResponseSchema = z.object({
|
|
124
|
+
retentionMonths: z.number().int().min(0).max(AUDIT_RETENTION_MAX_MONTHS),
|
|
125
|
+
// Whether KARDALUM_AUDIT_ARCHIVE_DIR is set. While it is not, no entry is ever removed.
|
|
126
|
+
folderConfigured: z.boolean(),
|
|
127
|
+
// What the last pass of this server process did; null after a restart.
|
|
128
|
+
lastPass: AuditPruneResponseSchema.nullable(),
|
|
129
|
+
});
|
|
130
|
+
/** The 409 of Run now while a pass runs: the message and when that pass started. */
|
|
131
|
+
export const AuditPruneBusySchema = z.object({
|
|
132
|
+
message: z.string(),
|
|
133
|
+
startedAt: z.string().datetime(),
|
|
134
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type PlanShapeValue } from "./plan-editor.schema.js";
|
|
3
|
+
/** At most 7 digits: the plan cap is 1 000 000 cents. */
|
|
4
|
+
export declare const SHOWN_PRICE_DIGITS_MAX = 7;
|
|
5
|
+
/**
|
|
6
|
+
* Whole cents written as decimal digits. A linear scan with the length
|
|
7
|
+
* checked first, never a regex (a form field is untrusted text). Null unless
|
|
8
|
+
* it is a whole number from 0 to PLAN_MAX_PRICE_CENTS.
|
|
9
|
+
*/
|
|
10
|
+
export declare function parseShownCents(text: string): number | null;
|
|
11
|
+
export type ShownPlan = {
|
|
12
|
+
priceCents: number;
|
|
13
|
+
shape: PlanShapeValue;
|
|
14
|
+
};
|
|
15
|
+
export declare const ShownPlanFieldsSchema: z.ZodPipe<z.ZodObject<{
|
|
16
|
+
shownPriceCents: z.ZodString;
|
|
17
|
+
shownShape: z.ZodEnum<{
|
|
18
|
+
free: "free";
|
|
19
|
+
one_time: "one_time";
|
|
20
|
+
monthly: "monthly";
|
|
21
|
+
yearly: "yearly";
|
|
22
|
+
}>;
|
|
23
|
+
}, z.core.$strip>, z.ZodTransform<ShownPlan, {
|
|
24
|
+
shownPriceCents: string;
|
|
25
|
+
shownShape: "free" | "one_time" | "monthly" | "yearly";
|
|
26
|
+
}>>;
|
|
27
|
+
/** The two form fields, or null when either is missing or unreadable (read as a mismatch). */
|
|
28
|
+
export declare function readShownPlan(fields: {
|
|
29
|
+
shownPriceCents: unknown;
|
|
30
|
+
shownShape: unknown;
|
|
31
|
+
}): ShownPlan | null;
|
|
32
|
+
/** The plan still costs what the buyer was shown, in the kind they were shown. */
|
|
33
|
+
export declare function shownPlanMatches(shown: ShownPlan, plan: {
|
|
34
|
+
shape: string;
|
|
35
|
+
priceCents: number;
|
|
36
|
+
}): boolean;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { PLAN_MAX_PRICE_CENTS, PlanShapeSchema } from "./plan-editor.schema.js";
|
|
3
|
+
// S322 (spec D3, 3a): what a buyer was shown, carried by every form that can
|
|
4
|
+
// charge or schedule a charge. The marketplace action compares it with the
|
|
5
|
+
// plan and refuses on a mismatch before any checkout or schedule exists.
|
|
6
|
+
/** At most 7 digits: the plan cap is 1 000 000 cents. */
|
|
7
|
+
export const SHOWN_PRICE_DIGITS_MAX = 7;
|
|
8
|
+
/**
|
|
9
|
+
* Whole cents written as decimal digits. A linear scan with the length
|
|
10
|
+
* checked first, never a regex (a form field is untrusted text). Null unless
|
|
11
|
+
* it is a whole number from 0 to PLAN_MAX_PRICE_CENTS.
|
|
12
|
+
*/
|
|
13
|
+
export function parseShownCents(text) {
|
|
14
|
+
if (text.length < 1 || text.length > SHOWN_PRICE_DIGITS_MAX)
|
|
15
|
+
return null;
|
|
16
|
+
let cents = 0;
|
|
17
|
+
for (let i = 0; i < text.length; i++) {
|
|
18
|
+
const c = text.charCodeAt(i);
|
|
19
|
+
if (c < 48 || c > 57)
|
|
20
|
+
return null;
|
|
21
|
+
cents = cents * 10 + (c - 48);
|
|
22
|
+
}
|
|
23
|
+
return cents <= PLAN_MAX_PRICE_CENTS ? cents : null;
|
|
24
|
+
}
|
|
25
|
+
export const ShownPlanFieldsSchema = z
|
|
26
|
+
.object({
|
|
27
|
+
shownPriceCents: z.string().max(SHOWN_PRICE_DIGITS_MAX),
|
|
28
|
+
shownShape: PlanShapeSchema,
|
|
29
|
+
})
|
|
30
|
+
.transform((fields, ctx) => {
|
|
31
|
+
const priceCents = parseShownCents(fields.shownPriceCents);
|
|
32
|
+
if (priceCents === null) {
|
|
33
|
+
ctx.addIssue({ code: "custom", message: "The shown price is not a whole number of cents", path: ["shownPriceCents"] });
|
|
34
|
+
return z.NEVER;
|
|
35
|
+
}
|
|
36
|
+
return { priceCents, shape: fields.shownShape };
|
|
37
|
+
});
|
|
38
|
+
/** The two form fields, or null when either is missing or unreadable (read as a mismatch). */
|
|
39
|
+
export function readShownPlan(fields) {
|
|
40
|
+
const parsed = ShownPlanFieldsSchema.safeParse(fields);
|
|
41
|
+
return parsed.success ? parsed.data : null;
|
|
42
|
+
}
|
|
43
|
+
/** The plan still costs what the buyer was shown, in the kind they were shown. */
|
|
44
|
+
export function shownPlanMatches(shown, plan) {
|
|
45
|
+
return shown.shape === plan.shape && shown.priceCents === plan.priceCents;
|
|
46
|
+
}
|
|
@@ -11,6 +11,11 @@ export declare const CreateContentRequestSchema: z.ZodObject<{
|
|
|
11
11
|
}, z.core.$strip>;
|
|
12
12
|
export type CreateContentRequest = z.infer<typeof CreateContentRequestSchema>;
|
|
13
13
|
export declare const ContentItemResponseSchema: z.ZodObject<{
|
|
14
|
+
readOnlyFields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
15
|
+
fieldAlias: z.ZodString;
|
|
16
|
+
pluginId: z.ZodString;
|
|
17
|
+
message: z.ZodString;
|
|
18
|
+
}, z.core.$strip>>>;
|
|
14
19
|
node: z.ZodObject<{
|
|
15
20
|
id: z.ZodString;
|
|
16
21
|
parentId: z.ZodNullable<z.ZodString>;
|
|
@@ -19,6 +24,7 @@ export declare const ContentItemResponseSchema: z.ZodObject<{
|
|
|
19
24
|
sortOrder: z.ZodNumber;
|
|
20
25
|
documentTypeId: z.ZodString;
|
|
21
26
|
publishedAt: z.ZodNullable<z.ZodString>;
|
|
27
|
+
name: z.ZodOptional<z.ZodString>;
|
|
22
28
|
}, z.core.$strip>;
|
|
23
29
|
url: z.ZodNullable<z.ZodString>;
|
|
24
30
|
version: z.ZodObject<{
|
|
@@ -185,6 +191,11 @@ export declare const SaveContentRequestSchema: z.ZodObject<{
|
|
|
185
191
|
}, z.core.$strip>;
|
|
186
192
|
export type SaveContentRequest = z.infer<typeof SaveContentRequestSchema>;
|
|
187
193
|
export declare const SaveContentResponseSchema: z.ZodObject<{
|
|
194
|
+
readOnlyFields: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
195
|
+
fieldAlias: z.ZodString;
|
|
196
|
+
pluginId: z.ZodString;
|
|
197
|
+
message: z.ZodString;
|
|
198
|
+
}, z.core.$strip>>>;
|
|
188
199
|
version: z.ZodObject<{
|
|
189
200
|
id: z.ZodString;
|
|
190
201
|
contentId: z.ZodString;
|
|
@@ -224,6 +235,7 @@ export declare const LatestVersionResponseSchema: z.ZodObject<{
|
|
|
224
235
|
createdAt: z.ZodString;
|
|
225
236
|
createdBy: z.ZodString;
|
|
226
237
|
}, z.core.$strip>;
|
|
238
|
+
defaultCulture: z.ZodOptional<z.ZodString>;
|
|
227
239
|
fellBack: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
228
240
|
}, z.core.$strip>;
|
|
229
241
|
export type LatestVersionResponse = z.infer<typeof LatestVersionResponseSchema>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { ReadOnlyFieldSchema } from "./plugin-read-only.schema.js";
|
|
2
3
|
import { RESERVED_ROOT_SLUGS, isReservedRootSlug } from "./reserved-slugs.js";
|
|
3
4
|
import { ContentNodeSchema, NodeCultureSchema } from "./content.schema.js";
|
|
4
5
|
import { ContentVersionSchema } from "./content-version.schema.js";
|
|
@@ -36,7 +37,13 @@ export const CreateContentRequestSchema = z.object({
|
|
|
36
37
|
path: ["slug"],
|
|
37
38
|
});
|
|
38
39
|
export const ContentItemResponseSchema = z.object({
|
|
39
|
-
|
|
40
|
+
// S318: fields kept because their plugin is read-only.
|
|
41
|
+
readOnlyFields: z.array(ReadOnlyFieldSchema).optional(),
|
|
42
|
+
// S314o (D3): the node with the display name the list rows carry
|
|
43
|
+
// (ContentNodeWithNameSchema), so a create, a read by id and a copy
|
|
44
|
+
// answer the name where a list does. Optional, and absent rather than
|
|
45
|
+
// empty, for the same reason as there.
|
|
46
|
+
node: ContentNodeSchema.extend({ name: z.string().min(1).optional() }),
|
|
40
47
|
// S277c: the address a visitor would use for this node in the culture
|
|
41
48
|
// this response is for: the stored path with the default site's own
|
|
42
49
|
// segment hidden, and the culture prefix on a site with more than one
|
|
@@ -74,17 +81,18 @@ export const ContentByPathResponseSchema = z.object({
|
|
|
74
81
|
//
|
|
75
82
|
// S277d: an address is a host and a path once a site can have its own
|
|
76
83
|
// domain. `host` is the host to read the address on; without it the
|
|
77
|
-
// address is read on the host this request came to.
|
|
78
|
-
//
|
|
79
|
-
// is
|
|
80
|
-
//
|
|
84
|
+
// address is read on the host this request came to. S314i: it is read as
|
|
85
|
+
// a site's domain is, as the public lookup reads it, so a scheme in front
|
|
86
|
+
// is ignored, a port selects a site whose domain was stored with that
|
|
87
|
+
// port, and a value that is no domain is refused with a 400. The cap is
|
|
88
|
+
// the longest request host the server looks at.
|
|
81
89
|
export const ContentByAddressQuerySchema = z.object({
|
|
82
90
|
path: z.string().min(1),
|
|
83
91
|
host: z
|
|
84
92
|
.string()
|
|
85
93
|
.max(300)
|
|
86
94
|
.optional()
|
|
87
|
-
.describe("The host to read the address on. Defaults to the host of this request."),
|
|
95
|
+
.describe("The host to read the address on: a host name or an IPv4 address with an optional port. A port selects a site whose domain was stored with that port; a scheme in front is ignored. Defaults to the host of this request."),
|
|
88
96
|
});
|
|
89
97
|
export const ContentByAddressResponseSchema = ContentByPathResponseSchema;
|
|
90
98
|
export const SaveContentRequestSchema = z.object({
|
|
@@ -101,6 +109,8 @@ export const SaveContentRequestSchema = z.object({
|
|
|
101
109
|
baseVersion: z.number().int().positive().optional(),
|
|
102
110
|
});
|
|
103
111
|
export const SaveContentResponseSchema = z.object({
|
|
112
|
+
// S318: fields kept because their plugin is read-only.
|
|
113
|
+
readOnlyFields: z.array(ReadOnlyFieldSchema).optional(),
|
|
104
114
|
version: ContentVersionSchema,
|
|
105
115
|
// S277e: the node as it is after this save. A save can rename the node,
|
|
106
116
|
// which moves its stored path, so the editor replaces the node it holds
|
|
@@ -130,6 +140,12 @@ export const LatestVersionQuerySchema = z.object({ locale: CultureSchema.optiona
|
|
|
130
140
|
export const VersionQuerySchema = LatestVersionQuerySchema;
|
|
131
141
|
export const LatestVersionResponseSchema = z.object({
|
|
132
142
|
version: ContentVersionSchema,
|
|
143
|
+
// S314o (D1): the site's default culture, so a client that patches the
|
|
144
|
+
// newest save (the CLI's --field) knows which culture's view it merges
|
|
145
|
+
// over without asking settings.read. This server always answers it, on
|
|
146
|
+
// the latest read and on the one-version read alike; it is optional so a
|
|
147
|
+
// client reading an older server, or a test double, need not carry it.
|
|
148
|
+
defaultCulture: CultureSchema.optional(),
|
|
133
149
|
// With ?locale=: the varying field ids this language has no value for,
|
|
134
150
|
// whether or not the default language has one. Unlike the public read,
|
|
135
151
|
// where fellBack lists only the fields actually filled from the default.
|
|
@@ -16,9 +16,9 @@ export declare const ContentListColumnSchema: z.ZodDiscriminatedUnion<[z.ZodObje
|
|
|
16
16
|
url: "url";
|
|
17
17
|
id: "id";
|
|
18
18
|
name: "name";
|
|
19
|
-
updatedAt: "updatedAt";
|
|
20
19
|
publishedAt: "publishedAt";
|
|
21
20
|
status: "status";
|
|
21
|
+
updatedAt: "updatedAt";
|
|
22
22
|
}>;
|
|
23
23
|
}, z.core.$strict>, z.ZodObject<{
|
|
24
24
|
kind: z.ZodLiteral<"field">;
|
|
@@ -33,9 +33,9 @@ export declare const ContentListSettingsSchema: z.ZodObject<{
|
|
|
33
33
|
url: "url";
|
|
34
34
|
id: "id";
|
|
35
35
|
name: "name";
|
|
36
|
-
updatedAt: "updatedAt";
|
|
37
36
|
publishedAt: "publishedAt";
|
|
38
37
|
status: "status";
|
|
38
|
+
updatedAt: "updatedAt";
|
|
39
39
|
}>;
|
|
40
40
|
}, z.core.$strict>, z.ZodObject<{
|
|
41
41
|
kind: z.ZodLiteral<"field">;
|