@kardalum/plugin-sdk 0.15.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +49 -1
- package/README.md +10 -0
- package/dist/admin-section-registry.d.ts +14 -5
- package/dist/admin-section-registry.js +14 -4
- package/dist/built-in-value-schemas.js +1 -1
- package/dist/built-ins.js +2 -2
- package/dist/capabilities.d.ts +8 -78
- package/dist/capabilities.js +23 -322
- package/dist/host-entry.d.ts +1 -1
- package/dist/host-entry.js +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +13 -12
- package/dist/license-verdict-keys.d.ts +4 -3
- package/dist/license-verdict-keys.js +6 -5
- package/dist/manifest-entry.d.ts +3 -3
- package/dist/manifest-entry.js +2 -2
- package/dist/manifest-schema.d.ts +113 -56
- package/dist/manifest-schema.js +192 -295
- package/dist/manifest.d.ts +145 -112
- package/dist/manifest.js +13 -36
- package/dist/media/media-picker.js +21 -12
- package/dist/media/upload-error.d.ts +1 -1
- package/dist/media/upload-error.js +1 -1
- package/dist/plugin-context.d.ts +7 -0
- package/dist/plugin-context.js +7 -0
- package/dist/plugin-screen-context.d.ts +44 -3
- package/dist/plugin-screen-context.js +27 -2
- package/dist/read-all-pages.d.ts +23 -0
- package/dist/read-all-pages.js +30 -0
- package/dist/richtext/block-panel.js +6 -6
- package/dist/richtext/insert-menu.js +4 -4
- package/dist/richtext/style-listbox.js +4 -4
- package/dist/tokens/tokens.css +1 -0
- package/dist/tokens/tokens.json +2 -1
- package/dist/type-equality.d.ts +2 -0
- package/dist/type-equality.js +1 -0
- package/dist/views/content-list-view.js +2 -2
- package/dist/views/html-view.js +1 -1
- package/dist/views/image-view.js +24 -39
- package/dist/views/rich-text-view.js +3 -3
- package/node_modules/@kardalum/api-schemas/dist/api-error.schema.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/api-error.schema.js +19 -0
- package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.d.ts +43 -25
- package/node_modules/@kardalum/api-schemas/dist/api-key-api.schema.js +60 -8
- package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.d.ts +90 -0
- package/node_modules/@kardalum/api-schemas/dist/asset-api.schema.js +33 -2
- package/node_modules/@kardalum/api-schemas/dist/asset.schema.d.ts +22 -1
- package/node_modules/@kardalum/api-schemas/dist/asset.schema.js +50 -15
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.d.ts +204 -0
- package/node_modules/@kardalum/api-schemas/dist/audit-api.schema.js +134 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.d.ts +5 -0
- package/node_modules/@kardalum/api-schemas/dist/content-api.schema.js +18 -13
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.d.ts +2 -2
- package/node_modules/@kardalum/api-schemas/dist/content-list.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/content-path.js +11 -7
- package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/content-trash-api.schema.js +3 -0
- package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/content-trash.schema.js +2 -1
- package/node_modules/@kardalum/api-schemas/dist/core-actions.d.ts +143 -57
- package/node_modules/@kardalum/api-schemas/dist/core-actions.js +110 -60
- package/node_modules/@kardalum/api-schemas/dist/data-type-api.schema.d.ts +1 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/document-type-api.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/index.d.ts +67 -40
- package/node_modules/@kardalum/api-schemas/dist/index.js +35 -19
- package/node_modules/@kardalum/api-schemas/dist/install-warnings.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/install-warnings.schema.js +8 -0
- package/node_modules/@kardalum/api-schemas/dist/issue-list.d.ts +6 -0
- package/node_modules/@kardalum/api-schemas/dist/issue-list.js +6 -0
- package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.d.ts +73 -0
- package/node_modules/@kardalum/api-schemas/dist/management-multipart.schema.js +104 -0
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.d.ts +356 -16
- package/node_modules/@kardalum/api-schemas/dist/marketplace-listing-api.schema.js +93 -10
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.d.ts +10 -0
- package/node_modules/@kardalum/api-schemas/dist/media-api.schema.js +38 -30
- package/node_modules/@kardalum/api-schemas/dist/media-rendition.schema.js +2 -2
- package/node_modules/@kardalum/api-schemas/dist/media.schema.js +1 -1
- package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.d.ts +6 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-actions.schema.js +8 -6
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.d.ts +69 -4
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs-api.schema.js +4 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.d.ts +76 -9
- package/node_modules/@kardalum/api-schemas/dist/plugin-docs.js +84 -24
- package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.d.ts +17 -7
- package/node_modules/@kardalum/api-schemas/dist/plugin-id-rules.js +18 -8
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.d.ts +69 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install-record.schema.js +59 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.d.ts +597 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-install.js +503 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-labels.d.ts +60 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-labels.js +116 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-locales.d.ts +82 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-locales.js +228 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.d.ts +33 -4
- package/node_modules/@kardalum/api-schemas/dist/plugin-management-api.schema.js +28 -2
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.d.ts +11 -3
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-actions.js +17 -4
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.d.ts +58 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-api-routes.js +198 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-fields.d.ts +64 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-manifest-fields.js +134 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.d.ts +2 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-registry-api.schema.js +4 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.d.ts +74 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-template-payload.js +132 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-vocabulary.d.ts +13 -0
- package/node_modules/@kardalum/api-schemas/dist/plugin-vocabulary.js +15 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.d.ts +8 -0
- package/node_modules/@kardalum/api-schemas/dist/public-api.schema.js +23 -4
- package/node_modules/@kardalum/api-schemas/dist/render-editing.d.ts +4 -4
- package/node_modules/@kardalum/api-schemas/dist/role.schema.d.ts +17 -0
- package/node_modules/@kardalum/api-schemas/dist/role.schema.js +13 -0
- package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.d.ts +44 -0
- package/node_modules/@kardalum/api-schemas/dist/sample-content.schema.js +97 -0
- package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.d.ts +126 -0
- package/node_modules/@kardalum/api-schemas/dist/sandbox-attach.schema.js +70 -0
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.d.ts +36 -6
- package/node_modules/@kardalum/api-schemas/dist/setup-api.schema.js +17 -5
- package/node_modules/@kardalum/api-schemas/dist/sites.schema.d.ts +52 -33
- package/node_modules/@kardalum/api-schemas/dist/sites.schema.js +195 -56
- package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.d.ts +19 -3
- package/node_modules/@kardalum/api-schemas/dist/snapshot-api.schema.js +16 -0
- package/node_modules/@kardalum/api-schemas/dist/snapshot.schema.d.ts +1 -1
- package/node_modules/@kardalum/api-schemas/dist/strict-url.d.ts +12 -0
- package/node_modules/@kardalum/api-schemas/dist/strict-url.js +31 -0
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.d.ts +105 -1
- package/node_modules/@kardalum/api-schemas/dist/template-api.schema.js +47 -7
- package/node_modules/@kardalum/api-schemas/dist/template.schema.d.ts +30 -2
- package/node_modules/@kardalum/api-schemas/dist/template.schema.js +19 -5
- package/node_modules/@kardalum/api-schemas/dist/trash-cursor.schema.d.ts +4 -0
- package/node_modules/@kardalum/api-schemas/dist/trash-cursor.schema.js +29 -0
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.d.ts +15 -3
- package/node_modules/@kardalum/api-schemas/dist/user-api.schema.js +8 -0
- package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.d.ts +19 -0
- package/node_modules/@kardalum/api-schemas/dist/whoami-api.schema.js +22 -0
- package/node_modules/@kardalum/api-schemas/package.json +2 -2
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.d.ts +1 -0
- package/node_modules/@kardalum/design-tokens/dist/tailwind-theme.js +2 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.css +1 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.js +3 -0
- package/node_modules/@kardalum/design-tokens/dist/tokens.json +2 -1
- package/node_modules/@kardalum/design-tokens/dist/types.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/README.md +4 -1
- package/node_modules/@kardalum/plugin-package/dist/build-reference.d.ts +96 -0
- package/node_modules/@kardalum/plugin-package/dist/build-reference.js +66 -0
- package/node_modules/@kardalum/plugin-package/dist/capabilities.d.ts +103 -0
- package/node_modules/@kardalum/plugin-package/dist/capabilities.js +346 -0
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.d.ts +4 -0
- package/node_modules/@kardalum/plugin-package/dist/client-bundle.js +25 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.d.ts +25 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/archive-names.js +203 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/bundle.js +73 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.d.ts +5 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/contributions.js +60 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/icon-names.generated.d.ts +1 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/icon-names.generated.js +2052 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/icons.d.ts +2 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/icons.js +51 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.d.ts +8 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/index.js +7 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.d.ts +17 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/label-languages.js +119 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/limits.d.ts +14 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/limits.js +21 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/locales.d.ts +5 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/locales.js +148 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/package-files.d.ts +5 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/package-files.js +76 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/registry.d.ts +22 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/registry.js +133 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/sample-content.js +90 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/support.d.ts +24 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/support.js +55 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.d.ts +6 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/templates.js +158 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/types.d.ts +53 -0
- package/node_modules/@kardalum/plugin-package/dist/delivery/types.js +1 -0
- package/node_modules/@kardalum/plugin-package/dist/docs-contract.d.ts +3 -2
- package/node_modules/@kardalum/plugin-package/dist/docs-contract.js +4 -2
- package/node_modules/@kardalum/plugin-package/dist/extract.d.ts +92 -3
- package/node_modules/@kardalum/plugin-package/dist/extract.js +251 -41
- package/node_modules/@kardalum/plugin-package/dist/index.d.ts +11 -2
- package/node_modules/@kardalum/plugin-package/dist/index.js +8 -2
- package/node_modules/@kardalum/plugin-package/dist/manifest-entry.d.ts +5 -0
- package/node_modules/@kardalum/plugin-package/dist/manifest-entry.js +20 -0
- package/node_modules/@kardalum/plugin-package/dist/reference-entry.d.ts +3 -0
- package/node_modules/@kardalum/plugin-package/dist/reference-entry.js +7 -0
- package/node_modules/@kardalum/plugin-package/dist/sample-content.d.ts +38 -1
- package/node_modules/@kardalum/plugin-package/dist/sample-content.js +84 -16
- package/node_modules/@kardalum/plugin-package/dist/shipped-files.d.ts +39 -0
- package/node_modules/@kardalum/plugin-package/dist/shipped-files.js +133 -0
- package/node_modules/@kardalum/plugin-package/dist/shipped-locales.d.ts +7 -0
- package/node_modules/@kardalum/plugin-package/dist/shipped-locales.js +27 -0
- package/node_modules/@kardalum/plugin-package/dist/types.d.ts +4 -6
- package/node_modules/@kardalum/plugin-package/dist/types.js +15 -1
- package/node_modules/@kardalum/plugin-package/package.json +9 -2
- package/node_modules/@kardalum/ui/dist/components/checkbox.js +2 -2
- package/node_modules/@kardalum/ui/dist/components/dropdown-menu.js +2 -2
- package/node_modules/@kardalum/ui/dist/components/property-field.js +4 -1
- package/node_modules/@kardalum/ui/package.json +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,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
|
+
});
|
|
@@ -308,6 +308,10 @@ export declare const PreviewTokenResponseSchema: z.ZodObject<{
|
|
|
308
308
|
previewUrl: z.ZodNullable<z.ZodString>;
|
|
309
309
|
}, z.core.$strip>;
|
|
310
310
|
export type PreviewTokenResponse = z.infer<typeof PreviewTokenResponseSchema>;
|
|
311
|
+
export declare const ContentUrlImpactResponseSchema: z.ZodObject<{
|
|
312
|
+
publishedCount: z.ZodNumber;
|
|
313
|
+
}, z.core.$strip>;
|
|
314
|
+
export type ContentUrlImpactResponse = z.infer<typeof ContentUrlImpactResponseSchema>;
|
|
311
315
|
export declare const ContentItemQuerySchema: z.ZodObject<{
|
|
312
316
|
locale: z.ZodOptional<z.ZodString>;
|
|
313
317
|
}, z.core.$strip>;
|
|
@@ -376,6 +380,7 @@ export declare const CopyContentRequestSchema: z.ZodObject<{
|
|
|
376
380
|
includeChildren: z.ZodDefault<z.ZodBoolean>;
|
|
377
381
|
}, z.core.$strip>;
|
|
378
382
|
export type CopyContentRequest = z.infer<typeof CopyContentRequestSchema>;
|
|
383
|
+
export type CopyContentRequestInput = z.input<typeof CopyContentRequestSchema>;
|
|
379
384
|
export declare const MoveContentRequestSchema: z.ZodObject<{
|
|
380
385
|
targetParentId: z.ZodNullable<z.ZodString>;
|
|
381
386
|
}, z.core.$strip>;
|
|
@@ -68,23 +68,24 @@ export const ContentByPathResponseSchema = z.object({
|
|
|
68
68
|
access: NodeAccessFlagsSchema,
|
|
69
69
|
});
|
|
70
70
|
// S277c: the admin's by-address lookup reads `path` as a visitor's address
|
|
71
|
-
// (GET /api/content/by-address), where by-path reads it as a stored path.
|
|
71
|
+
// (GET /api/manage/v1/content/by-address), where by-path reads it as a stored path.
|
|
72
72
|
// The same answer on purpose: the node it finds is described exactly as
|
|
73
73
|
// by-path describes it, stored path included.
|
|
74
74
|
//
|
|
75
75
|
// S277d: an address is a host and a path once a site can have its own
|
|
76
76
|
// 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
|
-
//
|
|
77
|
+
// address is read on the host this request came to. S314i: it is read as
|
|
78
|
+
// a site's domain is, as the public lookup reads it, so a scheme in front
|
|
79
|
+
// is ignored, a port selects a site whose domain was stored with that
|
|
80
|
+
// port, and a value that is no domain is refused with a 400. The cap is
|
|
81
|
+
// the longest request host the server looks at.
|
|
81
82
|
export const ContentByAddressQuerySchema = z.object({
|
|
82
83
|
path: z.string().min(1),
|
|
83
84
|
host: z
|
|
84
85
|
.string()
|
|
85
86
|
.max(300)
|
|
86
87
|
.optional()
|
|
87
|
-
.describe("The host to read the address on. Defaults to the host of this request."),
|
|
88
|
+
.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
89
|
});
|
|
89
90
|
export const ContentByAddressResponseSchema = ContentByPathResponseSchema;
|
|
90
91
|
export const SaveContentRequestSchema = z.object({
|
|
@@ -116,16 +117,16 @@ export const SaveContentResponseSchema = z.object({
|
|
|
116
117
|
// on a default address that has no name).
|
|
117
118
|
url: z.string().nullable(),
|
|
118
119
|
});
|
|
119
|
-
// GET /api/content/:id/versions/latest
|
|
120
|
+
// GET /api/manage/v1/content/:id/versions/latest: the newest saved version,
|
|
120
121
|
// regardless of the current_version pointer. This is what the content
|
|
121
|
-
// editor edits: after a draft save, GET /api/content/:id still serves the
|
|
122
|
+
// editor edits: after a draft save, GET /api/manage/v1/content/:id still serves the
|
|
122
123
|
// pointer (published) version by design, so the draft would otherwise be
|
|
123
124
|
// unreachable over REST. Also the response shape of
|
|
124
|
-
// GET /api/content/:id/versions/:version (same "one full version" read).
|
|
125
|
+
// GET /api/manage/v1/content/:id/versions/:version (same "one full version" read).
|
|
125
126
|
// S230c: ?locale= reads the newest save's values for one language exactly
|
|
126
127
|
// as stored, for the editor's language tab.
|
|
127
128
|
export const LatestVersionQuerySchema = z.object({ locale: CultureSchema.optional() });
|
|
128
|
-
// S233: GET /api/content/:id/versions/:version takes the same ?locale= the
|
|
129
|
+
// S233: GET /api/manage/v1/content/:id/versions/:version takes the same ?locale= the
|
|
129
130
|
// latest read does, so the editor can load an old version for one language.
|
|
130
131
|
export const VersionQuerySchema = LatestVersionQuerySchema;
|
|
131
132
|
export const LatestVersionResponseSchema = z.object({
|
|
@@ -138,7 +139,7 @@ export const LatestVersionResponseSchema = z.object({
|
|
|
138
139
|
});
|
|
139
140
|
// Version history list: metadata only — `data` can be arbitrarily large
|
|
140
141
|
// and the history view only needs the row facts; the full snapshot is one
|
|
141
|
-
// GET /api/content/:id/versions/:version away.
|
|
142
|
+
// GET /api/manage/v1/content/:id/versions/:version away.
|
|
142
143
|
export const ContentVersionMetaSchema = ContentVersionSchema.omit({ data: true });
|
|
143
144
|
// Newest-first pages. Version numbers are contiguous (1..latest, rows are
|
|
144
145
|
// never deleted — immutability), so the cursor is simply the last version
|
|
@@ -184,7 +185,7 @@ export const PublishAllResultSchema = z.discriminatedUnion("status", [
|
|
|
184
185
|
z.object({ culture: z.string(), status: z.literal("incomplete"), fieldIds: z.array(z.string()) }),
|
|
185
186
|
]);
|
|
186
187
|
export const PublishAllResponseSchema = z.object({ results: z.array(PublishAllResultSchema) });
|
|
187
|
-
// POST /api/content/:id/preview-token (Session 116)
|
|
188
|
+
// POST /api/manage/v1/content/:id/preview-token (Session 116) mints a stateless,
|
|
188
189
|
// short-TTL, single-content-id preview token (see
|
|
189
190
|
// apps/server/src/auth/preview-tokens.ts). Any existing content id may be
|
|
190
191
|
// minted for, published or not; `expiresAt` is an ISO datetime string.
|
|
@@ -195,6 +196,10 @@ export const PreviewTokenResponseSchema = z.object({
|
|
|
195
196
|
expiresAt: z.string().datetime(),
|
|
196
197
|
previewUrl: z.string().nullable(),
|
|
197
198
|
});
|
|
199
|
+
// GET /api/manage/v1/content/:id/url-impact (S300b): how many
|
|
200
|
+
// published pages a rename would move, the node itself plus its published
|
|
201
|
+
// descendants. A draft has no live URL to break, so it is not counted.
|
|
202
|
+
export const ContentUrlImpactResponseSchema = z.object({ publishedCount: z.number().int().min(0) });
|
|
198
203
|
// `locale` selects which culture of the node to read; omitted means the
|
|
199
204
|
// site's default culture. There is no fallback parameter: a field the
|
|
200
205
|
// culture has not translated always falls back to the default culture's
|
|
@@ -275,7 +280,7 @@ export const ContentChildrenResponseSchema = z.object({
|
|
|
275
280
|
});
|
|
276
281
|
// Whole-array reorder (mirrors the document-type fields/tabs pattern) —
|
|
277
282
|
// orderedIds must exactly match the current children of the parent (or
|
|
278
|
-
// root nodes, for /api/content/roots/reorder); the adapter rejects
|
|
283
|
+
// root nodes, for /api/manage/v1/content/roots/reorder); the adapter rejects
|
|
279
284
|
// otherwise. Only practical for a fully-loaded sibling list, so the admin
|
|
280
285
|
// UI only offers drag-reorder once every page has loaded.
|
|
281
286
|
export const ReorderNodesRequestSchema = z.object({
|
|
@@ -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">;
|
|
@@ -84,7 +84,7 @@ export const CONTENT_LIST_DEFAULT_SETTINGS = {
|
|
|
84
84
|
{ kind: "property", property: "url" },
|
|
85
85
|
],
|
|
86
86
|
};
|
|
87
|
-
// GET /api/content/:id/list query (Task 3). Cursor-paginated like every
|
|
87
|
+
// GET /api/manage/v1/content/:id/list query (Task 3). Cursor-paginated like every
|
|
88
88
|
// other content list (api-design.md), plus a name filter and a
|
|
89
89
|
// comma-separated set of field ids so the response only carries the data
|
|
90
90
|
// the configured columns actually need.
|
|
@@ -30,7 +30,8 @@ export const CONTENT_NAME_KEY = "_name";
|
|
|
30
30
|
// CreateContentRequestSchema only require `path: z.string().min(1)`), so
|
|
31
31
|
// this is a generous local ceiling rather than a validated contract: it
|
|
32
32
|
// exists so an unusually long name cannot silently produce an unusably
|
|
33
|
-
// long path segment.
|
|
33
|
+
// long path segment. It counts code points, so a letter outside the BMP is
|
|
34
|
+
// never split.
|
|
34
35
|
const MAX_SLUG_LENGTH = 200;
|
|
35
36
|
/**
|
|
36
37
|
* "About us" -> "about-us", "عن فريقنا" -> "عن-فريقنا".
|
|
@@ -72,21 +73,24 @@ export function slugify(name) {
|
|
|
72
73
|
// introducer) and control characters.
|
|
73
74
|
.replace(/[^\p{L}\p{N}]+/gu, "-")
|
|
74
75
|
.replace(/^-+|-+$/g, "");
|
|
75
|
-
|
|
76
|
+
// Counted and cut in code points: a UTF-16 slice could end inside a
|
|
77
|
+
// surrogate pair and leave a lone surrogate in a path.
|
|
78
|
+
const points = Array.from(slug);
|
|
79
|
+
if (points.length <= MAX_SLUG_LENGTH)
|
|
76
80
|
return slug;
|
|
77
|
-
const truncated =
|
|
81
|
+
const truncated = points.slice(0, MAX_SLUG_LENGTH);
|
|
78
82
|
// The cut already lands between words when the very next character (just
|
|
79
83
|
// past the budget) is a dash or the slug ends there exactly.
|
|
80
|
-
const nextChar =
|
|
84
|
+
const nextChar = points[MAX_SLUG_LENGTH] ?? "";
|
|
81
85
|
if (nextChar === "" || nextChar === "-")
|
|
82
|
-
return truncated.replace(/-+$/g, "");
|
|
86
|
+
return truncated.join("").replace(/-+$/g, "");
|
|
83
87
|
// Otherwise the cut fell mid-word: back up to the last dash boundary so
|
|
84
88
|
// no word is severed, unless that dash is so early it would throw away
|
|
85
89
|
// nearly all of the budget for one very long final word, in which case a
|
|
86
90
|
// mid-word cut is the lesser evil.
|
|
87
91
|
const lastDash = truncated.lastIndexOf("-");
|
|
88
92
|
const cut = lastDash > MAX_SLUG_LENGTH / 2 ? truncated.slice(0, lastDash) : truncated;
|
|
89
|
-
return cut.replace(/-+$/g, "");
|
|
93
|
+
return cut.join("").replace(/-+$/g, "");
|
|
90
94
|
}
|
|
91
95
|
/**
|
|
92
96
|
* S228: the first free name in a "Name", "Name (2)", "Name (3)" series.
|
|
@@ -161,7 +165,7 @@ function numberedSlug(stem, number) {
|
|
|
161
165
|
const whole = slugify(`${stem} (${number})`);
|
|
162
166
|
if (whole === String(number) || whole.endsWith(suffix))
|
|
163
167
|
return whole;
|
|
164
|
-
let head = slugify(stem).slice(0, MAX_SLUG_LENGTH - suffix.length);
|
|
168
|
+
let head = Array.from(slugify(stem)).slice(0, MAX_SLUG_LENGTH - suffix.length).join("");
|
|
165
169
|
while (head.endsWith("-"))
|
|
166
170
|
head = head.slice(0, -1);
|
|
167
171
|
return head === "" ? String(number) : `${head}${suffix}`;
|
|
@@ -18,3 +18,7 @@ export declare const ContentRestoreResultSchema: z.ZodObject<{
|
|
|
18
18
|
restoredCount: z.ZodNumber;
|
|
19
19
|
}, z.core.$strip>;
|
|
20
20
|
export type ContentRestoreResult = z.infer<typeof ContentRestoreResultSchema>;
|
|
21
|
+
export declare const ContentRestoreRequestSchema: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
22
|
+
parentId: z.ZodOptional<z.ZodString>;
|
|
23
|
+
}, z.core.$strip>>>;
|
|
24
|
+
export type ContentRestoreRequest = z.infer<typeof ContentRestoreRequestSchema>;
|
|
@@ -21,3 +21,6 @@ export const ContentTrashConfirmationSchema = z.object({
|
|
|
21
21
|
});
|
|
22
22
|
export const ContentTrashResultSchema = z.object({ trashedCount: z.number().int() });
|
|
23
23
|
export const ContentRestoreResultSchema = z.object({ restoredCount: z.number().int() });
|
|
24
|
+
// S307: restoring an orphan (a page whose parent was permanently removed) under a parent the person
|
|
25
|
+
// chooses. Nullish for the reason the trash body gives: Fastify hands a missing body over as null.
|
|
26
|
+
export const ContentRestoreRequestSchema = z.object({ parentId: z.string().uuid().optional() }).nullish();
|
|
@@ -144,6 +144,7 @@ export declare const ContentRestoreConflictSchema: z.ZodUnion<readonly [z.ZodObj
|
|
|
144
144
|
}, z.core.$strip>, z.ZodObject<{
|
|
145
145
|
message: z.ZodString;
|
|
146
146
|
}, z.core.$strip>]>;
|
|
147
|
+
export type ContentTrashListQuery = z.infer<typeof ContentTrashListQuerySchema>;
|
|
147
148
|
export type ContentTrashListResponse = z.infer<typeof ContentTrashListResponseSchema>;
|
|
148
149
|
export type TrashedSubtreeDto = z.infer<typeof TrashedSubtreeSchema>;
|
|
149
150
|
export type ContentRestoreBlocked = z.infer<typeof ContentRestoreBlockedSchema>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { TrashCursorSchema } from "./trash-cursor.schema.js";
|
|
2
3
|
import { NodeAccessFlagsSchema } from "./node-access.schema.js";
|
|
3
4
|
// S161: the trash browse surface. Separate from content-trash-api.schema.ts
|
|
4
5
|
// (S154's trash/restore confirmation bodies) — this file is the list route
|
|
5
6
|
// and the restore-blocked 409, added a session later.
|
|
6
7
|
export const ContentTrashListQuerySchema = z.object({
|
|
7
|
-
cursor:
|
|
8
|
+
cursor: TrashCursorSchema.optional(),
|
|
8
9
|
limit: z.coerce.number().int().min(1).max(100).default(50),
|
|
9
10
|
});
|
|
10
11
|
export const TrashedSubtreeSchema = z.object({
|