@kardalum/plugin-sdk 0.15.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +49 -1
- package/README.md +10 -0
- package/dist/admin-section-registry.d.ts +14 -5
- package/dist/admin-section-registry.js +14 -4
- package/dist/built-in-value-schemas.js +1 -1
- package/dist/built-ins.js +2 -2
- package/dist/capabilities.d.ts +8 -78
- package/dist/capabilities.js +23 -322
- package/dist/host-entry.d.ts +1 -1
- package/dist/host-entry.js +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +13 -12
- package/dist/license-verdict-keys.d.ts +4 -3
- package/dist/license-verdict-keys.js +6 -5
- package/dist/manifest-entry.d.ts +3 -3
- package/dist/manifest-entry.js +2 -2
- package/dist/manifest-schema.d.ts +113 -56
- package/dist/manifest-schema.js +192 -295
- package/dist/manifest.d.ts +145 -112
- package/dist/manifest.js +13 -36
- package/dist/media/media-picker.js +21 -12
- package/dist/media/upload-error.d.ts +1 -1
- package/dist/media/upload-error.js +1 -1
- package/dist/plugin-context.d.ts +7 -0
- package/dist/plugin-context.js +7 -0
- package/dist/plugin-screen-context.d.ts +44 -3
- package/dist/plugin-screen-context.js +27 -2
- package/dist/read-all-pages.d.ts +23 -0
- package/dist/read-all-pages.js +30 -0
- package/dist/richtext/block-panel.js +6 -6
- package/dist/richtext/insert-menu.js +4 -4
- package/dist/richtext/style-listbox.js +4 -4
- package/dist/tokens/tokens.css +1 -0
- package/dist/tokens/tokens.json +2 -1
- package/dist/type-equality.d.ts +2 -0
- package/dist/type-equality.js +1 -0
- package/dist/views/content-list-view.js +2 -2
- package/dist/views/html-view.js +1 -1
- package/dist/views/image-view.js +24 -39
- package/dist/views/rich-text-view.js +3 -3
- package/node_modules/@kardalum/api-schemas/dist/api-error.schema.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/api-error.schema.js +19 -0
- package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.d.ts +43 -25
- package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.js +60 -8
- package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.d.ts +90 -0
- package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +33 -2
- package/node_modules/@kardalum/api-schemas/dist/asset.schema.d.ts +22 -1
- package/node_modules/@kardalum/api-schemas/dist/asset.schema.js +50 -15
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.d.ts +204 -0
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.js +134 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +18 -13
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +2 -2
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/content-path.js +11 -7
- package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.js +3 -0
- package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.js +2 -1
- package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +143 -57
- package/node_modules/@kardalum/api-schemas/dist/core-actions.js +110 -60
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/index.d.ts +67 -40
- package/node_modules/@kardalum/api-schemas/dist/index.js +35 -19
- package/node_modules/@kardalum/api-schemas/dist/install-warnings.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/install-warnings.schema.js +8 -0
- package/node_modules/@kardalum/api-schemas/dist/issue-list.d.ts +6 -0
- package/node_modules/@kardalum/api-schemas/dist/issue-list.js +6 -0
- package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.d.ts +73 -0
- package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.js +104 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +356 -16
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +93 -10
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +10 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +38 -30
- package/node_modules/@kardalum/api-schemas/dist/media-rendition.schema.js +2 -2
- package/node_modules/@kardalum/api-schemas/dist/media.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.d.ts +6 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.js +8 -6
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +69 -4
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.js +4 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +76 -9
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +84 -24
- package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.d.ts +17 -7
- package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.js +18 -8
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.d.ts +69 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.js +59 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +597 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +503 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-labels.d.ts +60 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-labels.js +116 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-locales.d.ts +82 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-locales.js +228 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +33 -4
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +28 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +11 -3
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +17 -4
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +58 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +198 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-fields.d.ts +64 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-fields.js +134 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.js +4 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.d.ts +74 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.js +132 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-vocabulary.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-vocabulary.js +15 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +8 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +23 -4
- package/node_modules/@kardalum/api-schemas/dist/render-editing.d.ts +4 -4
- package/node_modules/@kardalum/api-schemas/dist/role.schema.d.ts +17 -0
- package/node_modules/@kardalum/api-schemas/dist/role.schema.js +13 -0
- package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.d.ts +44 -0
- package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.js +97 -0
- package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.d.ts +126 -0
- package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.js +70 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +36 -6
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +17 -5
- package/node_modules/@kardalum/api-schemas/dist/sites.schema.d.ts +52 -33
- package/node_modules/@kardalum/api-schemas/dist/sites.schema.js +195 -56
- package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +19 -3
- package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.js +16 -0
- package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/strict-url.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/strict-url.js +31 -0
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +105 -1
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +47 -7
- package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +30 -2
- package/node_modules/@kardalum/api-schemas/dist/template.schema.js +19 -5
- package/node_modules/@kardalum/api-schemas/dist/trash-cursor.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/trash-cursor.schema.js +29 -0
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +15 -3
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +8 -0
- package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.d.ts +19 -0
- package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.js +22 -0
- package/node_modules/@kardalum/api-schemas/package.json +2 -2
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +1 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +2 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.css +1 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.js +3 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.json +2 -1
- package/node_modules/@kardalum/design-tokens/dist/types.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/README.md +4 -1
- package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +96 -0
- package/node_modules/@kardalum/plugin-package/dist/build-reference.js +66 -0
- package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +103 -0
- package/node_modules/@kardalum/plugin-package/dist/capabilities.js +346 -0
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.d.ts +4 -0
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.js +25 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.d.ts +25 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.js +203 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.js +73 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.d.ts +5 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +60 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/icon-names.generated.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/icon-names.generated.js +2052 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/icons.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/icons.js +51 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.d.ts +8 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.js +7 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.d.ts +17 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.js +119 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/limits.d.ts +14 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/limits.js +21 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/locales.d.ts +5 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/locales.js +148 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/package-files.d.ts +5 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/package-files.js +76 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/registry.d.ts +22 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +133 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.js +90 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/support.d.ts +24 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/support.js +55 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.d.ts +6 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.js +158 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/types.d.ts +53 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/types.js +1 -0
- package/node_modules/@kardalum/plugin-package/dist/docs-contract.d.ts +3 -2
- package/node_modules/@kardalum/plugin-package/dist/docs-contract.js +4 -2
- package/node_modules/@kardalum/plugin-package/dist/extract.d.ts +92 -3
- package/node_modules/@kardalum/plugin-package/dist/extract.js +251 -41
- package/node_modules/@kardalum/plugin-package/dist/index.d.ts +11 -2
- package/node_modules/@kardalum/plugin-package/dist/index.js +8 -2
- package/node_modules/@kardalum/plugin-package/dist/manifest-entry.d.ts +5 -0
- package/node_modules/@kardalum/plugin-package/dist/manifest-entry.js +20 -0
- package/node_modules/@kardalum/plugin-package/dist/reference-entry.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/reference-entry.js +7 -0
- package/node_modules/@kardalum/plugin-package/dist/sample-content.d.ts +38 -1
- package/node_modules/@kardalum/plugin-package/dist/sample-content.js +84 -16
- package/node_modules/@kardalum/plugin-package/dist/shipped-files.d.ts +39 -0
- package/node_modules/@kardalum/plugin-package/dist/shipped-files.js +133 -0
- package/node_modules/@kardalum/plugin-package/dist/shipped-locales.d.ts +7 -0
- package/node_modules/@kardalum/plugin-package/dist/shipped-locales.js +27 -0
- package/node_modules/@kardalum/plugin-package/dist/types.d.ts +4 -6
- package/node_modules/@kardalum/plugin-package/dist/types.js +15 -1
- package/node_modules/@kardalum/plugin-package/package.json +9 -2
- package/node_modules/@kardalum/ui/dist/components/checkbox.js +2 -2
- package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +2 -2
- package/node_modules/@kardalum/ui/dist/components/property-field.js +4 -1
- package/node_modules/@kardalum/ui/package.json +1 -1
- package/package.json +6 -6
|
@@ -1,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
|
+
}
|
|
227
|
+
/**
|
|
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.
|
|
232
|
+
*/
|
|
233
|
+
export function siteDomainOrigin(domain, scheme) {
|
|
234
|
+
if (domain.startsWith("https://") || domain.startsWith("http://"))
|
|
235
|
+
return domain;
|
|
236
|
+
return `${scheme}://${domain}`;
|
|
237
|
+
}
|
|
99
238
|
/**
|
|
100
|
-
* One domain of a site. Parses through `
|
|
101
|
-
*
|
|
239
|
+
* One domain of a site. Parses through `parseSiteDomain`, so the output is
|
|
240
|
+
* the stored form, and a stored domain parses to itself.
|
|
102
241
|
*/
|
|
103
|
-
export const
|
|
104
|
-
const
|
|
105
|
-
if (
|
|
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
|
|
@@ -135,14 +274,14 @@ export const SitesSettingsSchema = z.object({
|
|
|
135
274
|
defaultSiteId: z.string().min(1).nullable(),
|
|
136
275
|
sites: z.array(SiteHostnamesSchema).default([]),
|
|
137
276
|
});
|
|
138
|
-
/** The body of PUT /api/settings/sites/default. Null clears the pin. */
|
|
277
|
+
/** The body of PUT /api/manage/v1/settings/sites/default. Null clears the pin. */
|
|
139
278
|
export const SetDefaultSiteRequestSchema = z.object({ defaultSiteId: z.string().min(1).nullable() });
|
|
140
279
|
/**
|
|
141
|
-
* The body of PUT /api/settings/sites/:siteId/hostnames: the site's whole
|
|
280
|
+
* The body of PUT /api/manage/v1/settings/sites/:siteId/hostnames: the site's whole
|
|
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
|
|
@@ -159,7 +298,7 @@ export const SiteSummarySchema = z.object({
|
|
|
159
298
|
isDefault: z.boolean(),
|
|
160
299
|
});
|
|
161
300
|
/**
|
|
162
|
-
* What GET /api/settings/sites and the two writes answer: the stored pin,
|
|
301
|
+
* What GET /api/manage/v1/settings/sites and the two writes answer: the stored pin,
|
|
163
302
|
* and beside it the default site that pin (or, with nothing pinned, tree
|
|
164
303
|
* order) gives a visitor right now. Null when there is none: a pin whose
|
|
165
304
|
* node is in the trash or not published, or a tree with nothing published.
|
|
@@ -169,7 +308,7 @@ export const SiteSummarySchema = z.object({
|
|
|
169
308
|
* `sites` is every site that has at least one domain, plus the default
|
|
170
309
|
* site even when it has none: the stored record, which is what an address
|
|
171
310
|
* is worked out from. It is bounded by that record and is not a list of
|
|
172
|
-
* every top-level page; GET /api/sites is that list. `requestHost` is the
|
|
311
|
+
* every top-level page; GET /api/manage/v1/sites is that list. `requestHost` is the
|
|
173
312
|
* host the server sees for this very request (spec D10): behind a proxy
|
|
174
313
|
* that does not pass the domain on it differs from the browser's, and
|
|
175
314
|
* that is the one place it shows.
|
|
@@ -190,9 +329,9 @@ export const SitesSettingsResponseSchema = z.object({
|
|
|
190
329
|
defaultAddressHost: z.string().nullable(),
|
|
191
330
|
});
|
|
192
331
|
/**
|
|
193
|
-
* The query of GET /api/sites. The cursor is the id of the previous page's
|
|
332
|
+
* The query of GET /api/manage/v1/sites. The cursor is the id of the previous page's
|
|
194
333
|
* last row, the convention of the content tree's own lists
|
|
195
|
-
* (GET /api/content/roots).
|
|
334
|
+
* (GET /api/manage/v1/content/roots).
|
|
196
335
|
*/
|
|
197
336
|
export const SiteListQuerySchema = z.object({
|
|
198
337
|
cursor: z.string().uuid().optional(),
|
|
@@ -213,7 +352,7 @@ export const SiteListRowSchema = z.object({
|
|
|
213
352
|
isDefault: z.boolean(),
|
|
214
353
|
published: z.boolean(),
|
|
215
354
|
});
|
|
216
|
-
/** What GET /api/sites answers: one page of top-level pages in tree order. */
|
|
355
|
+
/** What GET /api/manage/v1/sites answers: one page of top-level pages in tree order. */
|
|
217
356
|
export const SiteListResponseSchema = z.object({
|
|
218
357
|
items: z.array(SiteListRowSchema),
|
|
219
358
|
// null = no more pages.
|
|
@@ -261,7 +400,7 @@ export function siteAddress(site, defaultHost, storedPath, options = {}) {
|
|
|
261
400
|
return placeOnSite(site, defaultHost, storedPath, options.shortPathTaken === true);
|
|
262
401
|
}
|
|
263
402
|
/**
|
|
264
|
-
* The address of a stored path, worked out from what GET /api/settings/sites
|
|
403
|
+
* The address of a stored path, worked out from what GET /api/manage/v1/settings/sites
|
|
265
404
|
* answers, for a page the server cannot be asked about because nothing is
|
|
266
405
|
* stored at it yet (a page being created, a name being typed).
|
|
267
406
|
*
|
|
@@ -8,8 +8,8 @@ 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
11
|
createdBy: z.ZodString;
|
|
12
|
+
label: z.ZodString;
|
|
13
13
|
description: z.ZodNullable<z.ZodString>;
|
|
14
14
|
}, z.core.$strip>;
|
|
15
15
|
}, z.core.$strip>;
|
|
@@ -23,8 +23,8 @@ 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
26
|
createdBy: z.ZodString;
|
|
27
|
+
label: z.ZodString;
|
|
28
28
|
description: z.ZodNullable<z.ZodString>;
|
|
29
29
|
}, z.core.$strip>>;
|
|
30
30
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
@@ -34,10 +34,26 @@ 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
37
|
createdBy: z.ZodString;
|
|
38
|
+
label: z.ZodString;
|
|
39
39
|
description: z.ZodNullable<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>;
|
|
56
|
+
export declare const SnapshotParamsSchema: z.ZodObject<{
|
|
57
|
+
id: z.ZodString;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
export type SnapshotParams = z.infer<typeof SnapshotParamsSchema>;
|
|
@@ -23,3 +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
|
+
});
|
|
40
|
+
// S301: the params of POST /snapshots/:id/restore, moved here from the route file.
|
|
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
26
|
createdBy: z.ZodString;
|
|
27
|
+
label: z.ZodString;
|
|
28
28
|
description: z.ZodNullable<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
|
+
}
|
|
@@ -79,6 +79,20 @@ export declare const TemplateListQuerySchema: z.ZodObject<{
|
|
|
79
79
|
documentTypeId: z.ZodOptional<z.ZodString>;
|
|
80
80
|
}, z.core.$strip>;
|
|
81
81
|
export type TemplateListQuery = z.infer<typeof TemplateListQuerySchema>;
|
|
82
|
+
export declare const TemplateListItemSchema: z.ZodObject<{
|
|
83
|
+
id: z.ZodString;
|
|
84
|
+
name: z.ZodString;
|
|
85
|
+
alias: z.ZodString;
|
|
86
|
+
kind: z.ZodEnum<{
|
|
87
|
+
page: "page";
|
|
88
|
+
layout: "layout";
|
|
89
|
+
partial: "partial";
|
|
90
|
+
}>;
|
|
91
|
+
documentTypeId: z.ZodNullable<z.ZodString>;
|
|
92
|
+
currentVersion: z.ZodNumber;
|
|
93
|
+
ownedBy: z.ZodNullable<z.ZodString>;
|
|
94
|
+
}, z.core.$strict>;
|
|
95
|
+
export type TemplateListItem = z.infer<typeof TemplateListItemSchema>;
|
|
82
96
|
export declare const TemplateListResponseSchema: z.ZodObject<{
|
|
83
97
|
items: z.ZodArray<z.ZodObject<{
|
|
84
98
|
id: z.ZodString;
|
|
@@ -91,6 +105,7 @@ export declare const TemplateListResponseSchema: z.ZodObject<{
|
|
|
91
105
|
}>;
|
|
92
106
|
documentTypeId: z.ZodNullable<z.ZodString>;
|
|
93
107
|
currentVersion: z.ZodNumber;
|
|
108
|
+
ownedBy: z.ZodNullable<z.ZodString>;
|
|
94
109
|
}, z.core.$strict>>;
|
|
95
110
|
nextCursor: z.ZodNullable<z.ZodString>;
|
|
96
111
|
}, z.core.$strip>;
|
|
@@ -107,6 +122,95 @@ export declare const TemplateSyncReportSchema: z.ZodObject<{
|
|
|
107
122
|
version: z.ZodNumber;
|
|
108
123
|
}, z.core.$strip>>;
|
|
109
124
|
healed: z.ZodArray<z.ZodString>;
|
|
110
|
-
|
|
125
|
+
adopted: z.ZodArray<z.ZodObject<{
|
|
126
|
+
id: z.ZodString;
|
|
127
|
+
file: z.ZodString;
|
|
128
|
+
alias: z.ZodString;
|
|
129
|
+
kind: z.ZodEnum<{
|
|
130
|
+
page: "page";
|
|
131
|
+
layout: "layout";
|
|
132
|
+
partial: "partial";
|
|
133
|
+
}>;
|
|
134
|
+
}, z.core.$strip>>;
|
|
135
|
+
skipped: z.ZodArray<z.ZodObject<{
|
|
136
|
+
file: z.ZodString;
|
|
137
|
+
reason: z.ZodString;
|
|
138
|
+
}, z.core.$strip>>;
|
|
111
139
|
}, z.core.$strip>;
|
|
112
140
|
export type TemplateSyncReport = z.infer<typeof TemplateSyncReportSchema>;
|
|
141
|
+
export declare const TemplateVersionParamsSchema: z.ZodObject<{
|
|
142
|
+
id: z.ZodString;
|
|
143
|
+
version: z.ZodCoercedNumber<unknown>;
|
|
144
|
+
}, z.core.$strip>;
|
|
145
|
+
export type TemplateVersionParams = z.infer<typeof TemplateVersionParamsSchema>;
|
|
146
|
+
export declare const TemplateVersionListResponseSchema: z.ZodObject<{
|
|
147
|
+
items: z.ZodArray<z.ZodObject<{
|
|
148
|
+
id: z.ZodString;
|
|
149
|
+
createdAt: z.ZodString;
|
|
150
|
+
source: z.ZodEnum<{
|
|
151
|
+
admin: "admin";
|
|
152
|
+
"plugin-install": "plugin-install";
|
|
153
|
+
"file-sync": "file-sync";
|
|
154
|
+
}>;
|
|
155
|
+
templateId: z.ZodString;
|
|
156
|
+
version: z.ZodNumber;
|
|
157
|
+
hash: z.ZodString;
|
|
158
|
+
}, z.core.$strict>>;
|
|
159
|
+
nextCursor: z.ZodNullable<z.ZodNumber>;
|
|
160
|
+
}, z.core.$strip>;
|
|
161
|
+
export type TemplateVersionListResponse = z.infer<typeof TemplateVersionListResponseSchema>;
|
|
162
|
+
export declare const TemplateVersionResponseSchema: z.ZodObject<{
|
|
163
|
+
version: z.ZodObject<{
|
|
164
|
+
id: z.ZodString;
|
|
165
|
+
templateId: z.ZodString;
|
|
166
|
+
version: z.ZodNumber;
|
|
167
|
+
content: z.ZodString;
|
|
168
|
+
hash: z.ZodString;
|
|
169
|
+
source: z.ZodEnum<{
|
|
170
|
+
admin: "admin";
|
|
171
|
+
"plugin-install": "plugin-install";
|
|
172
|
+
"file-sync": "file-sync";
|
|
173
|
+
}>;
|
|
174
|
+
createdAt: z.ZodString;
|
|
175
|
+
}, z.core.$strict>;
|
|
176
|
+
}, z.core.$strip>;
|
|
177
|
+
export type TemplateVersionResponse = z.infer<typeof TemplateVersionResponseSchema>;
|
|
178
|
+
export declare const TemplateTrashListQuerySchema: z.ZodObject<{
|
|
179
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
180
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
181
|
+
}, z.core.$strip>;
|
|
182
|
+
export type TemplateTrashListQuery = z.infer<typeof TemplateTrashListQuerySchema>;
|
|
183
|
+
export declare const TemplateTrashListResponseSchema: z.ZodObject<{
|
|
184
|
+
items: z.ZodArray<z.ZodObject<{
|
|
185
|
+
id: z.ZodString;
|
|
186
|
+
name: z.ZodString;
|
|
187
|
+
alias: z.ZodString;
|
|
188
|
+
kind: z.ZodEnum<{
|
|
189
|
+
page: "page";
|
|
190
|
+
layout: "layout";
|
|
191
|
+
partial: "partial";
|
|
192
|
+
}>;
|
|
193
|
+
documentTypeId: z.ZodNullable<z.ZodString>;
|
|
194
|
+
currentVersion: z.ZodNumber;
|
|
195
|
+
deletedAt: z.ZodString;
|
|
196
|
+
}, z.core.$strict>>;
|
|
197
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
198
|
+
}, z.core.$strip>;
|
|
199
|
+
export type TemplateTrashListResponse = z.infer<typeof TemplateTrashListResponseSchema>;
|
|
200
|
+
export declare const RestoreTemplateResponseSchema: z.ZodObject<{
|
|
201
|
+
template: z.ZodObject<{
|
|
202
|
+
id: z.ZodString;
|
|
203
|
+
name: z.ZodString;
|
|
204
|
+
alias: z.ZodString;
|
|
205
|
+
kind: z.ZodEnum<{
|
|
206
|
+
page: "page";
|
|
207
|
+
layout: "layout";
|
|
208
|
+
partial: "partial";
|
|
209
|
+
}>;
|
|
210
|
+
documentTypeId: z.ZodNullable<z.ZodString>;
|
|
211
|
+
currentVersion: z.ZodNumber;
|
|
212
|
+
}, z.core.$strict>;
|
|
213
|
+
content: z.ZodString;
|
|
214
|
+
foldedFile: z.ZodBoolean;
|
|
215
|
+
}, z.core.$strip>;
|
|
216
|
+
export type RestoreTemplateResponse = z.infer<typeof RestoreTemplateResponseSchema>;
|