@velora-cms/api-schemas 0.9.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/LICENSE +202 -0
- package/README.md +22 -0
- package/dist/api-error.schema.d.ts +5 -0
- package/dist/api-error.schema.js +6 -0
- package/dist/api-key-api.schema.d.ts +50 -0
- package/dist/api-key-api.schema.js +29 -0
- package/dist/auth.schema.d.ts +40 -0
- package/dist/auth.schema.js +30 -0
- package/dist/content-api.schema.d.ts +188 -0
- package/dist/content-api.schema.js +121 -0
- package/dist/content-trash-api.schema.d.ts +20 -0
- package/dist/content-trash-api.schema.js +23 -0
- package/dist/content-trash.schema.d.ts +31 -0
- package/dist/content-trash.schema.js +26 -0
- package/dist/content-version.schema.d.ts +11 -0
- package/dist/content-version.schema.js +10 -0
- package/dist/content.schema.d.ts +15 -0
- package/dist/content.schema.js +14 -0
- package/dist/data-type-api.schema.d.ts +36 -0
- package/dist/data-type-api.schema.js +32 -0
- package/dist/data-type-config.schema.d.ts +9 -0
- package/dist/data-type-config.schema.js +32 -0
- package/dist/document-type-api.schema.d.ts +202 -0
- package/dist/document-type-api.schema.js +86 -0
- package/dist/document-type.schema.d.ts +90 -0
- package/dist/document-type.schema.js +103 -0
- package/dist/health.schema.d.ts +6 -0
- package/dist/health.schema.js +5 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.js +27 -0
- package/dist/marketplace-listing-api.schema.d.ts +205 -0
- package/dist/marketplace-listing-api.schema.js +115 -0
- package/dist/media-api.schema.d.ts +36 -0
- package/dist/media-api.schema.js +23 -0
- package/dist/media.schema.d.ts +11 -0
- package/dist/media.schema.js +10 -0
- package/dist/plugin-management-api.schema.d.ts +145 -0
- package/dist/plugin-management-api.schema.js +186 -0
- package/dist/plugin-registry-api.schema.d.ts +31 -0
- package/dist/plugin-registry-api.schema.js +25 -0
- package/dist/plugin-storage-api.schema.d.ts +15 -0
- package/dist/plugin-storage-api.schema.js +24 -0
- package/dist/public-api.schema.d.ts +211 -0
- package/dist/public-api.schema.js +185 -0
- package/dist/setup-api.schema.d.ts +78 -0
- package/dist/setup-api.schema.js +88 -0
- package/dist/snapshot-api.schema.d.ts +43 -0
- package/dist/snapshot-api.schema.js +25 -0
- package/dist/snapshot.schema.d.ts +28 -0
- package/dist/snapshot.schema.js +17 -0
- package/dist/template-api.schema.d.ts +33 -0
- package/dist/template-api.schema.js +28 -0
- package/dist/template.schema.d.ts +7 -0
- package/dist/template.schema.js +13 -0
- package/dist/theme-api.schema.d.ts +21 -0
- package/dist/theme-api.schema.js +14 -0
- package/dist/user-api.schema.d.ts +79 -0
- package/dist/user-api.schema.js +36 -0
- package/package.json +26 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ContentNodeSchema } from "./content.schema.js";
|
|
3
|
+
import { ContentVersionSchema } from "./content-version.schema.js";
|
|
4
|
+
// createdBy is deliberately absent from mutation request bodies — it comes
|
|
5
|
+
// from the authenticated JWT (sub claim), never from the caller.
|
|
6
|
+
export const CreateContentRequestSchema = z.object({
|
|
7
|
+
documentTypeId: z.string().uuid(),
|
|
8
|
+
parentId: z.string().uuid().nullable(),
|
|
9
|
+
path: z.string().min(1),
|
|
10
|
+
depth: z.number().int().nonnegative(),
|
|
11
|
+
sortOrder: z.number().int(),
|
|
12
|
+
locale: z.string().min(2),
|
|
13
|
+
isDefaultLocale: z.boolean(),
|
|
14
|
+
translationGroupId: z.string().uuid().optional(),
|
|
15
|
+
data: z.record(z.string(), z.unknown()),
|
|
16
|
+
});
|
|
17
|
+
export const ContentItemResponseSchema = z.object({
|
|
18
|
+
node: ContentNodeSchema,
|
|
19
|
+
version: ContentVersionSchema,
|
|
20
|
+
});
|
|
21
|
+
// S156 admin by-path lookup — the admin origin's honest-headless view
|
|
22
|
+
// resolves a pasted URL against the content tree. Drafts ARE visible here
|
|
23
|
+
// (this is the back office); the public no-leak rule lives on the server
|
|
24
|
+
// origin's bridge, not on this authenticated route.
|
|
25
|
+
export const ContentByPathQuerySchema = z.object({
|
|
26
|
+
path: z.string().min(1),
|
|
27
|
+
});
|
|
28
|
+
export const ContentByPathResponseSchema = z.object({
|
|
29
|
+
node: ContentNodeSchema,
|
|
30
|
+
});
|
|
31
|
+
export const SaveContentRequestSchema = z.object({
|
|
32
|
+
data: z.record(z.string(), z.unknown()),
|
|
33
|
+
});
|
|
34
|
+
export const SaveContentResponseSchema = z.object({
|
|
35
|
+
version: ContentVersionSchema,
|
|
36
|
+
});
|
|
37
|
+
// GET /api/content/:id/versions/latest — the newest saved version,
|
|
38
|
+
// regardless of the current_version pointer. This is what the content
|
|
39
|
+
// editor edits: after a draft save, GET /api/content/:id still serves the
|
|
40
|
+
// pointer (published) version by design, so the draft would otherwise be
|
|
41
|
+
// unreachable over REST. Also the response shape of
|
|
42
|
+
// GET /api/content/:id/versions/:version (same "one full version" read).
|
|
43
|
+
export const LatestVersionResponseSchema = z.object({
|
|
44
|
+
version: ContentVersionSchema,
|
|
45
|
+
});
|
|
46
|
+
// Version history list: metadata only — `data` can be arbitrarily large
|
|
47
|
+
// and the history view only needs the row facts; the full snapshot is one
|
|
48
|
+
// GET /api/content/:id/versions/:version away.
|
|
49
|
+
export const ContentVersionMetaSchema = ContentVersionSchema.omit({ data: true });
|
|
50
|
+
// Newest-first pages. Version numbers are contiguous (1..latest, rows are
|
|
51
|
+
// never deleted — immutability), so the cursor is simply the last version
|
|
52
|
+
// number of the previous page.
|
|
53
|
+
export const VersionListQuerySchema = z.object({
|
|
54
|
+
cursor: z.coerce.number().int().positive().optional(),
|
|
55
|
+
limit: z.coerce.number().int().min(1).max(100).default(20),
|
|
56
|
+
});
|
|
57
|
+
export const VersionListResponseSchema = z.object({
|
|
58
|
+
items: z.array(ContentVersionMetaSchema),
|
|
59
|
+
// null = no more pages.
|
|
60
|
+
nextCursor: z.number().int().positive().nullable(),
|
|
61
|
+
});
|
|
62
|
+
export const PublishContentRequestSchema = z.object({
|
|
63
|
+
// Omitted = publish the latest saved version.
|
|
64
|
+
version: z.number().int().positive().optional(),
|
|
65
|
+
});
|
|
66
|
+
export const PublishContentResponseSchema = z.object({
|
|
67
|
+
node: ContentNodeSchema,
|
|
68
|
+
});
|
|
69
|
+
// POST /api/content/:id/preview-token (Session 116) — mints a stateless,
|
|
70
|
+
// short-TTL, single-content-id preview token (see
|
|
71
|
+
// apps/server/src/auth/preview-tokens.ts). Any existing content id may be
|
|
72
|
+
// minted for, published or not; `expiresAt` is an ISO datetime string.
|
|
73
|
+
// Session 117: added `previewUrl` — the full preview URL (including token),
|
|
74
|
+
// or null if VELORA_PREVIEW_BASE_URL is not configured.
|
|
75
|
+
export const PreviewTokenResponseSchema = z.object({
|
|
76
|
+
token: z.string(),
|
|
77
|
+
expiresAt: z.string().datetime(),
|
|
78
|
+
previewUrl: z.string().nullable(),
|
|
79
|
+
});
|
|
80
|
+
// ?locale=fr&fallback=en per api-design.md. Without `locale`, the node is
|
|
81
|
+
// returned as-is and `fallback` is ignored. With `locale` but no
|
|
82
|
+
// `fallback`, only an exact translation matches (404 otherwise).
|
|
83
|
+
export const ContentItemQuerySchema = z.object({
|
|
84
|
+
locale: z.string().min(2).optional(),
|
|
85
|
+
fallback: z.string().min(2).optional(),
|
|
86
|
+
});
|
|
87
|
+
export const ContentChildrenQuerySchema = z.object({
|
|
88
|
+
// Cursor = id of the previous page's last node, same semantics as
|
|
89
|
+
// DatabaseAdapter.getChildren.
|
|
90
|
+
cursor: z.string().uuid().optional(),
|
|
91
|
+
limit: z.coerce.number().int().min(1).max(100).default(50),
|
|
92
|
+
});
|
|
93
|
+
export const ContentChildrenResponseSchema = z.object({
|
|
94
|
+
items: z.array(ContentNodeSchema),
|
|
95
|
+
// null = no more pages.
|
|
96
|
+
nextCursor: z.string().uuid().nullable(),
|
|
97
|
+
});
|
|
98
|
+
// Whole-array reorder (mirrors the document-type fields/tabs pattern) —
|
|
99
|
+
// orderedIds must exactly match the current children of the parent (or
|
|
100
|
+
// root nodes, for /api/content/roots/reorder); the adapter rejects
|
|
101
|
+
// otherwise. Only practical for a fully-loaded sibling list, so the admin
|
|
102
|
+
// UI only offers drag-reorder once every page has loaded.
|
|
103
|
+
export const ReorderNodesRequestSchema = z.object({
|
|
104
|
+
orderedIds: z.array(z.string().uuid()).min(1),
|
|
105
|
+
});
|
|
106
|
+
export const ReorderNodesResponseSchema = z.object({
|
|
107
|
+
success: z.literal(true),
|
|
108
|
+
});
|
|
109
|
+
// The one deliberate exception to ApiErrorSchema's "every route, same
|
|
110
|
+
// shape" rule (api-error.schema.ts) — field validation failures are
|
|
111
|
+
// per-field by nature, and the admin editor needs that structure to
|
|
112
|
+
// eventually highlight the right field/tab, not just show a string.
|
|
113
|
+
export const FieldValidationFailureSchema = z.object({
|
|
114
|
+
fieldId: z.string(),
|
|
115
|
+
key: z.string(),
|
|
116
|
+
params: z.record(z.string(), z.unknown()).optional(),
|
|
117
|
+
});
|
|
118
|
+
export const ContentValidationErrorSchema = z.object({
|
|
119
|
+
message: z.string(),
|
|
120
|
+
fieldErrors: z.array(FieldValidationFailureSchema),
|
|
121
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ContentTrashBodySchema: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
3
|
+
confirm: z.ZodOptional<z.ZodBoolean>;
|
|
4
|
+
}, z.core.$strip>>>;
|
|
5
|
+
export type ContentTrashBody = z.infer<typeof ContentTrashBodySchema>;
|
|
6
|
+
export declare const ContentTrashConfirmationSchema: z.ZodObject<{
|
|
7
|
+
requiresConfirmation: z.ZodLiteral<true>;
|
|
8
|
+
nodeName: z.ZodString;
|
|
9
|
+
descendantCount: z.ZodNumber;
|
|
10
|
+
message: z.ZodString;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
export type ContentTrashConfirmation = z.infer<typeof ContentTrashConfirmationSchema>;
|
|
13
|
+
export declare const ContentTrashResultSchema: z.ZodObject<{
|
|
14
|
+
trashedCount: z.ZodNumber;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export type ContentTrashResult = z.infer<typeof ContentTrashResultSchema>;
|
|
17
|
+
export declare const ContentRestoreResultSchema: z.ZodObject<{
|
|
18
|
+
restoredCount: z.ZodNumber;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export type ContentRestoreResult = z.infer<typeof ContentRestoreResultSchema>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// S154 content trash. The DELETE is two-step like the structured-data
|
|
3
|
+
// uninstall gate: unconfirmed → 409 naming the blast radius (the count
|
|
4
|
+
// the confirm dialog renders), confirmed → trash. Trash is SOFT —
|
|
5
|
+
// reversible via the restore route — so this is a plain confirmation,
|
|
6
|
+
// not the snapshot-gate treatment.
|
|
7
|
+
//
|
|
8
|
+
// Fastify substitutes `null` for a genuinely absent body before handing it
|
|
9
|
+
// to the validator — a DELETE sent with no payload at all lands here as
|
|
10
|
+
// `null`, not `undefined`. `.nullish()` (not `.optional()`) is required so
|
|
11
|
+
// an absent body validates; `request.body?.confirm` in the route handler
|
|
12
|
+
// already tolerates both null and undefined.
|
|
13
|
+
export const ContentTrashBodySchema = z
|
|
14
|
+
.object({ confirm: z.boolean().optional() })
|
|
15
|
+
.nullish();
|
|
16
|
+
export const ContentTrashConfirmationSchema = z.object({
|
|
17
|
+
requiresConfirmation: z.literal(true),
|
|
18
|
+
nodeName: z.string(),
|
|
19
|
+
descendantCount: z.number().int(),
|
|
20
|
+
message: z.string(),
|
|
21
|
+
});
|
|
22
|
+
export const ContentTrashResultSchema = z.object({ trashedCount: z.number().int() });
|
|
23
|
+
export const ContentRestoreResultSchema = z.object({ restoredCount: z.number().int() });
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ContentTrashListQuerySchema: z.ZodObject<{
|
|
3
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
4
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
export declare const TrashedSubtreeSchema: z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
path: z.ZodString;
|
|
9
|
+
documentTypeId: z.ZodString;
|
|
10
|
+
deletedAt: z.ZodString;
|
|
11
|
+
nodeCount: z.ZodNumber;
|
|
12
|
+
orphaned: z.ZodBoolean;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
export declare const ContentTrashListResponseSchema: z.ZodObject<{
|
|
15
|
+
items: z.ZodArray<z.ZodObject<{
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
path: z.ZodString;
|
|
18
|
+
documentTypeId: z.ZodString;
|
|
19
|
+
deletedAt: z.ZodString;
|
|
20
|
+
nodeCount: z.ZodNumber;
|
|
21
|
+
orphaned: z.ZodBoolean;
|
|
22
|
+
}, z.core.$strip>>;
|
|
23
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
export declare const ContentRestoreBlockedSchema: z.ZodObject<{
|
|
26
|
+
message: z.ZodString;
|
|
27
|
+
blockingAncestorPath: z.ZodString;
|
|
28
|
+
}, z.core.$strip>;
|
|
29
|
+
export type ContentTrashListResponse = z.infer<typeof ContentTrashListResponseSchema>;
|
|
30
|
+
export type TrashedSubtreeDto = z.infer<typeof TrashedSubtreeSchema>;
|
|
31
|
+
export type ContentRestoreBlocked = z.infer<typeof ContentRestoreBlockedSchema>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// S161: the trash browse surface. Separate from content-trash-api.schema.ts
|
|
3
|
+
// (S154's trash/restore confirmation bodies) — this file is the list route
|
|
4
|
+
// and the restore-blocked 409, added a session later.
|
|
5
|
+
export const ContentTrashListQuerySchema = z.object({
|
|
6
|
+
cursor: z.string().optional(),
|
|
7
|
+
limit: z.coerce.number().int().min(1).max(100).default(50),
|
|
8
|
+
});
|
|
9
|
+
export const TrashedSubtreeSchema = z.object({
|
|
10
|
+
id: z.string(),
|
|
11
|
+
path: z.string(),
|
|
12
|
+
documentTypeId: z.string(),
|
|
13
|
+
deletedAt: z.string(),
|
|
14
|
+
nodeCount: z.number().int().nonnegative(),
|
|
15
|
+
// True when the node's ancestors were purged rather than trashed —
|
|
16
|
+
// restoring it lands it at the root. The UI must say so before the click.
|
|
17
|
+
orphaned: z.boolean(),
|
|
18
|
+
});
|
|
19
|
+
export const ContentTrashListResponseSchema = z.object({
|
|
20
|
+
items: z.array(TrashedSubtreeSchema),
|
|
21
|
+
nextCursor: z.string().nullable(),
|
|
22
|
+
});
|
|
23
|
+
export const ContentRestoreBlockedSchema = z.object({
|
|
24
|
+
message: z.string(),
|
|
25
|
+
blockingAncestorPath: z.string(),
|
|
26
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ContentVersionSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
contentId: z.ZodString;
|
|
5
|
+
version: z.ZodNumber;
|
|
6
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
7
|
+
createdAt: z.ZodString;
|
|
8
|
+
createdBy: z.ZodString;
|
|
9
|
+
publishedAt: z.ZodNullable<z.ZodString>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export type ContentVersion = z.infer<typeof ContentVersionSchema>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const ContentVersionSchema = z.object({
|
|
3
|
+
id: z.string().uuid(),
|
|
4
|
+
contentId: z.string().uuid(),
|
|
5
|
+
version: z.number().int().positive(),
|
|
6
|
+
data: z.record(z.string(), z.unknown()),
|
|
7
|
+
createdAt: z.string().datetime(),
|
|
8
|
+
createdBy: z.string().uuid(),
|
|
9
|
+
publishedAt: z.string().datetime().nullable(),
|
|
10
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ContentNodeSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
5
|
+
path: z.ZodString;
|
|
6
|
+
depth: z.ZodNumber;
|
|
7
|
+
sortOrder: z.ZodNumber;
|
|
8
|
+
documentTypeId: z.ZodString;
|
|
9
|
+
translationGroupId: z.ZodString;
|
|
10
|
+
locale: z.ZodString;
|
|
11
|
+
isDefaultLocale: z.ZodBoolean;
|
|
12
|
+
publishedAt: z.ZodNullable<z.ZodString>;
|
|
13
|
+
currentVersion: z.ZodNumber;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
export type ContentNode = z.infer<typeof ContentNodeSchema>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const ContentNodeSchema = z.object({
|
|
3
|
+
id: z.string().uuid(),
|
|
4
|
+
parentId: z.string().uuid().nullable(),
|
|
5
|
+
path: z.string().min(1),
|
|
6
|
+
depth: z.number().int().nonnegative(),
|
|
7
|
+
sortOrder: z.number().int(),
|
|
8
|
+
documentTypeId: z.string().uuid(),
|
|
9
|
+
translationGroupId: z.string().uuid(),
|
|
10
|
+
locale: z.string().min(2),
|
|
11
|
+
isDefaultLocale: z.boolean(),
|
|
12
|
+
publishedAt: z.string().datetime().nullable(),
|
|
13
|
+
currentVersion: z.number().int().positive(),
|
|
14
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const CreateDataTypeRequestSchema: z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
editorId: z.ZodString;
|
|
5
|
+
settings: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
6
|
+
}, z.core.$strict>;
|
|
7
|
+
export type CreateDataTypeRequest = z.infer<typeof CreateDataTypeRequestSchema>;
|
|
8
|
+
export declare const UpdateDataTypeRequestSchema: z.ZodObject<{
|
|
9
|
+
name: z.ZodOptional<z.ZodString>;
|
|
10
|
+
settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
11
|
+
}, z.core.$strict>;
|
|
12
|
+
export type UpdateDataTypeRequest = z.infer<typeof UpdateDataTypeRequestSchema>;
|
|
13
|
+
export declare const DataTypeResponseSchema: z.ZodObject<{
|
|
14
|
+
dataType: z.ZodObject<{
|
|
15
|
+
id: z.ZodString;
|
|
16
|
+
name: z.ZodString;
|
|
17
|
+
editorId: z.ZodString;
|
|
18
|
+
settings: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
19
|
+
}, z.core.$strict>;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
export type DataTypeResponse = z.infer<typeof DataTypeResponseSchema>;
|
|
22
|
+
export declare const DataTypeListQuerySchema: z.ZodObject<{
|
|
23
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
24
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
export type DataTypeListQuery = z.infer<typeof DataTypeListQuerySchema>;
|
|
27
|
+
export declare const DataTypeListResponseSchema: z.ZodObject<{
|
|
28
|
+
items: z.ZodArray<z.ZodObject<{
|
|
29
|
+
id: z.ZodString;
|
|
30
|
+
name: z.ZodString;
|
|
31
|
+
editorId: z.ZodString;
|
|
32
|
+
settings: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
33
|
+
}, z.core.$strict>>;
|
|
34
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export type DataTypeListResponse = z.infer<typeof DataTypeListResponseSchema>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { DataTypeConfigSchema } from "./data-type-config.schema.js";
|
|
3
|
+
export const CreateDataTypeRequestSchema = z
|
|
4
|
+
.object({
|
|
5
|
+
name: z.string().min(1),
|
|
6
|
+
editorId: z.string().min(1),
|
|
7
|
+
settings: z.record(z.string(), z.unknown()).default({}),
|
|
8
|
+
})
|
|
9
|
+
.strict();
|
|
10
|
+
// editorId is deliberately absent — immutable after creation (see
|
|
11
|
+
// DataTypeConfigSchema). At least the route merges partial updates onto
|
|
12
|
+
// the loaded config, so both fields are optional here.
|
|
13
|
+
export const UpdateDataTypeRequestSchema = z
|
|
14
|
+
.object({
|
|
15
|
+
name: z.string().min(1).optional(),
|
|
16
|
+
settings: z.record(z.string(), z.unknown()).optional(),
|
|
17
|
+
})
|
|
18
|
+
.strict();
|
|
19
|
+
export const DataTypeResponseSchema = z.object({
|
|
20
|
+
dataType: DataTypeConfigSchema,
|
|
21
|
+
});
|
|
22
|
+
// Ordered name ASC (id ASC tiebreak) for the Settings tree; cursor = id
|
|
23
|
+
// of the previous page's last config.
|
|
24
|
+
export const DataTypeListQuerySchema = z.object({
|
|
25
|
+
cursor: z.string().uuid().optional(),
|
|
26
|
+
limit: z.coerce.number().int().min(1).max(100).default(50),
|
|
27
|
+
});
|
|
28
|
+
export const DataTypeListResponseSchema = z.object({
|
|
29
|
+
items: z.array(DataTypeConfigSchema),
|
|
30
|
+
// null = no more pages.
|
|
31
|
+
nextCursor: z.string().uuid().nullable(),
|
|
32
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const DataTypeConfigSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodString;
|
|
4
|
+
name: z.ZodString;
|
|
5
|
+
editorId: z.ZodString;
|
|
6
|
+
settings: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
7
|
+
}, z.core.$strict>;
|
|
8
|
+
export type DataTypeConfig = z.infer<typeof DataTypeConfigSchema>;
|
|
9
|
+
export declare const BUILT_IN_DATA_TYPE_CONFIGS: readonly DataTypeConfig[];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// A Data Type is a named, admin-created CONFIGURATION of a registry
|
|
3
|
+
// editor (Umbraco's split: the editor is the input-control code shipped
|
|
4
|
+
// by core/plugins; the Data Type is "Richtext — limited toolbar").
|
|
5
|
+
// Document type fields reference a Data Type's id — configure once,
|
|
6
|
+
// reuse across document types. Settings are validated against the
|
|
7
|
+
// editor's settingsSchema when the plugin settings pipeline lands
|
|
8
|
+
// (Month 6); until then they are a free-form record.
|
|
9
|
+
export const DataTypeConfigSchema = z
|
|
10
|
+
.object({
|
|
11
|
+
id: z.string().uuid(),
|
|
12
|
+
name: z.string().min(1),
|
|
13
|
+
// Registry editor id, e.g. 'com.velora.richtext'. Immutable after
|
|
14
|
+
// creation — swapping the editor under fields that already store
|
|
15
|
+
// values in the old editor's shape is a data footgun.
|
|
16
|
+
editorId: z.string().min(1),
|
|
17
|
+
settings: z.record(z.string(), z.unknown()).default({}),
|
|
18
|
+
})
|
|
19
|
+
.strict();
|
|
20
|
+
// Every built-in editor seeds one default config in migration
|
|
21
|
+
// 0006_data_types, with these FIXED ids — the single source of truth
|
|
22
|
+
// shared by the migrations, tests, and any code that needs "the plain
|
|
23
|
+
// Text data type" without a lookup. Version-4/variant-8 shaped so
|
|
24
|
+
// z.string().uuid() accepts them.
|
|
25
|
+
export const BUILT_IN_DATA_TYPE_CONFIGS = [
|
|
26
|
+
{ id: "b1e00000-0000-4000-8000-000000000001", name: "Text", editorId: "com.velora.text", settings: {} },
|
|
27
|
+
{ id: "b1e00000-0000-4000-8000-000000000002", name: "Number", editorId: "com.velora.number", settings: {} },
|
|
28
|
+
{ id: "b1e00000-0000-4000-8000-000000000003", name: "Boolean", editorId: "com.velora.boolean", settings: {} },
|
|
29
|
+
{ id: "b1e00000-0000-4000-8000-000000000004", name: "Date", editorId: "com.velora.date", settings: {} },
|
|
30
|
+
{ id: "b1e00000-0000-4000-8000-000000000005", name: "Image", editorId: "com.velora.image", settings: {} },
|
|
31
|
+
{ id: "b1e00000-0000-4000-8000-000000000006", name: "Rich Text", editorId: "com.velora.richtext", settings: {} },
|
|
32
|
+
];
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const CreateDocumentTypeRequestSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3
|
+
name: z.ZodString;
|
|
4
|
+
icon: z.ZodString;
|
|
5
|
+
kind: z.ZodLiteral<"page">;
|
|
6
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
name: z.ZodString;
|
|
9
|
+
datatypeId: z.ZodString;
|
|
10
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
11
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
12
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
17
|
+
}, z.core.$strict>>;
|
|
18
|
+
tabId: z.ZodOptional<z.ZodString>;
|
|
19
|
+
}, z.core.$strict>>;
|
|
20
|
+
treeRules: z.ZodObject<{
|
|
21
|
+
allowedAtRoot: z.ZodBoolean;
|
|
22
|
+
allowedParentTypes: z.ZodArray<z.ZodString>;
|
|
23
|
+
allowedChildTypes: z.ZodArray<z.ZodString>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
tabs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
26
|
+
id: z.ZodString;
|
|
27
|
+
name: z.ZodString;
|
|
28
|
+
}, z.core.$strict>>>;
|
|
29
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
30
|
+
name: z.ZodString;
|
|
31
|
+
icon: z.ZodString;
|
|
32
|
+
kind: z.ZodLiteral<"element">;
|
|
33
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
34
|
+
id: z.ZodString;
|
|
35
|
+
name: z.ZodString;
|
|
36
|
+
datatypeId: z.ZodString;
|
|
37
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
38
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
39
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
42
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
44
|
+
}, z.core.$strict>>;
|
|
45
|
+
tabId: z.ZodOptional<z.ZodString>;
|
|
46
|
+
}, z.core.$strict>>;
|
|
47
|
+
tabs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
48
|
+
id: z.ZodString;
|
|
49
|
+
name: z.ZodString;
|
|
50
|
+
}, z.core.$strict>>>;
|
|
51
|
+
}, z.core.$strict>], "kind">;
|
|
52
|
+
export type CreateDocumentTypeRequest = z.infer<typeof CreateDocumentTypeRequestSchema>;
|
|
53
|
+
export declare const UpdateDocumentTypeRequestSchema: z.ZodObject<{
|
|
54
|
+
name: z.ZodString;
|
|
55
|
+
icon: z.ZodString;
|
|
56
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
57
|
+
id: z.ZodString;
|
|
58
|
+
name: z.ZodString;
|
|
59
|
+
datatypeId: z.ZodString;
|
|
60
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
61
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
62
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
63
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
64
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
65
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
66
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
67
|
+
}, z.core.$strict>>;
|
|
68
|
+
tabId: z.ZodOptional<z.ZodString>;
|
|
69
|
+
}, z.core.$strict>>;
|
|
70
|
+
tabs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
71
|
+
id: z.ZodString;
|
|
72
|
+
name: z.ZodString;
|
|
73
|
+
}, z.core.$strict>>>;
|
|
74
|
+
treeRules: z.ZodOptional<z.ZodObject<{
|
|
75
|
+
allowedAtRoot: z.ZodBoolean;
|
|
76
|
+
allowedParentTypes: z.ZodArray<z.ZodString>;
|
|
77
|
+
allowedChildTypes: z.ZodArray<z.ZodString>;
|
|
78
|
+
}, z.core.$strip>>;
|
|
79
|
+
}, z.core.$strict>;
|
|
80
|
+
export type UpdateDocumentTypeRequest = z.infer<typeof UpdateDocumentTypeRequestSchema>;
|
|
81
|
+
export declare const CreateDocumentTypeResponseSchema: z.ZodObject<{
|
|
82
|
+
documentType: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
83
|
+
id: z.ZodString;
|
|
84
|
+
name: z.ZodString;
|
|
85
|
+
icon: z.ZodString;
|
|
86
|
+
kind: z.ZodLiteral<"page">;
|
|
87
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
88
|
+
id: z.ZodString;
|
|
89
|
+
name: z.ZodString;
|
|
90
|
+
datatypeId: z.ZodString;
|
|
91
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
92
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
93
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
94
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
95
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
96
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
97
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
98
|
+
}, z.core.$strict>>;
|
|
99
|
+
tabId: z.ZodOptional<z.ZodString>;
|
|
100
|
+
}, z.core.$strict>>;
|
|
101
|
+
treeRules: z.ZodObject<{
|
|
102
|
+
allowedAtRoot: z.ZodBoolean;
|
|
103
|
+
allowedParentTypes: z.ZodArray<z.ZodString>;
|
|
104
|
+
allowedChildTypes: z.ZodArray<z.ZodString>;
|
|
105
|
+
}, z.core.$strip>;
|
|
106
|
+
tabs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
107
|
+
id: z.ZodString;
|
|
108
|
+
name: z.ZodString;
|
|
109
|
+
}, z.core.$strict>>>;
|
|
110
|
+
defaultTemplateId: z.ZodOptional<z.ZodString>;
|
|
111
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
112
|
+
id: z.ZodString;
|
|
113
|
+
name: z.ZodString;
|
|
114
|
+
icon: z.ZodString;
|
|
115
|
+
kind: z.ZodLiteral<"element">;
|
|
116
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
117
|
+
id: z.ZodString;
|
|
118
|
+
name: z.ZodString;
|
|
119
|
+
datatypeId: z.ZodString;
|
|
120
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
121
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
122
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
123
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
124
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
125
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
126
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
127
|
+
}, z.core.$strict>>;
|
|
128
|
+
tabId: z.ZodOptional<z.ZodString>;
|
|
129
|
+
}, z.core.$strict>>;
|
|
130
|
+
tabs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
131
|
+
id: z.ZodString;
|
|
132
|
+
name: z.ZodString;
|
|
133
|
+
}, z.core.$strict>>>;
|
|
134
|
+
}, z.core.$strict>], "kind">;
|
|
135
|
+
}, z.core.$strip>;
|
|
136
|
+
export type CreateDocumentTypeResponse = z.infer<typeof CreateDocumentTypeResponseSchema>;
|
|
137
|
+
export declare const DocumentTypeListQuerySchema: z.ZodObject<{
|
|
138
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
139
|
+
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
140
|
+
}, z.core.$strip>;
|
|
141
|
+
export type DocumentTypeListQuery = z.infer<typeof DocumentTypeListQuerySchema>;
|
|
142
|
+
export declare const DocumentTypeListResponseSchema: z.ZodObject<{
|
|
143
|
+
items: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
144
|
+
id: z.ZodString;
|
|
145
|
+
name: z.ZodString;
|
|
146
|
+
icon: z.ZodString;
|
|
147
|
+
kind: z.ZodLiteral<"page">;
|
|
148
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
149
|
+
id: z.ZodString;
|
|
150
|
+
name: z.ZodString;
|
|
151
|
+
datatypeId: z.ZodString;
|
|
152
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
153
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
154
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
155
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
156
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
157
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
158
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
159
|
+
}, z.core.$strict>>;
|
|
160
|
+
tabId: z.ZodOptional<z.ZodString>;
|
|
161
|
+
}, z.core.$strict>>;
|
|
162
|
+
treeRules: z.ZodObject<{
|
|
163
|
+
allowedAtRoot: z.ZodBoolean;
|
|
164
|
+
allowedParentTypes: z.ZodArray<z.ZodString>;
|
|
165
|
+
allowedChildTypes: z.ZodArray<z.ZodString>;
|
|
166
|
+
}, z.core.$strip>;
|
|
167
|
+
tabs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
168
|
+
id: z.ZodString;
|
|
169
|
+
name: z.ZodString;
|
|
170
|
+
}, z.core.$strict>>>;
|
|
171
|
+
defaultTemplateId: z.ZodOptional<z.ZodString>;
|
|
172
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
173
|
+
id: z.ZodString;
|
|
174
|
+
name: z.ZodString;
|
|
175
|
+
icon: z.ZodString;
|
|
176
|
+
kind: z.ZodLiteral<"element">;
|
|
177
|
+
fields: z.ZodArray<z.ZodObject<{
|
|
178
|
+
id: z.ZodString;
|
|
179
|
+
name: z.ZodString;
|
|
180
|
+
datatypeId: z.ZodString;
|
|
181
|
+
validation: z.ZodOptional<z.ZodObject<{
|
|
182
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
183
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
184
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
185
|
+
min: z.ZodOptional<z.ZodNumber>;
|
|
186
|
+
max: z.ZodOptional<z.ZodNumber>;
|
|
187
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
188
|
+
}, z.core.$strict>>;
|
|
189
|
+
tabId: z.ZodOptional<z.ZodString>;
|
|
190
|
+
}, z.core.$strict>>;
|
|
191
|
+
tabs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
192
|
+
id: z.ZodString;
|
|
193
|
+
name: z.ZodString;
|
|
194
|
+
}, z.core.$strict>>>;
|
|
195
|
+
}, z.core.$strict>], "kind">>;
|
|
196
|
+
nextCursor: z.ZodNullable<z.ZodString>;
|
|
197
|
+
}, z.core.$strip>;
|
|
198
|
+
export type DocumentTypeListResponse = z.infer<typeof DocumentTypeListResponseSchema>;
|
|
199
|
+
export declare const DeleteDocumentTypeResponseSchema: z.ZodObject<{
|
|
200
|
+
success: z.ZodLiteral<true>;
|
|
201
|
+
}, z.core.$strip>;
|
|
202
|
+
export type DeleteDocumentTypeResponse = z.infer<typeof DeleteDocumentTypeResponseSchema>;
|