@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.
Files changed (59) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +22 -0
  3. package/dist/api-error.schema.d.ts +5 -0
  4. package/dist/api-error.schema.js +6 -0
  5. package/dist/api-key-api.schema.d.ts +50 -0
  6. package/dist/api-key-api.schema.js +29 -0
  7. package/dist/auth.schema.d.ts +40 -0
  8. package/dist/auth.schema.js +30 -0
  9. package/dist/content-api.schema.d.ts +188 -0
  10. package/dist/content-api.schema.js +121 -0
  11. package/dist/content-trash-api.schema.d.ts +20 -0
  12. package/dist/content-trash-api.schema.js +23 -0
  13. package/dist/content-trash.schema.d.ts +31 -0
  14. package/dist/content-trash.schema.js +26 -0
  15. package/dist/content-version.schema.d.ts +11 -0
  16. package/dist/content-version.schema.js +10 -0
  17. package/dist/content.schema.d.ts +15 -0
  18. package/dist/content.schema.js +14 -0
  19. package/dist/data-type-api.schema.d.ts +36 -0
  20. package/dist/data-type-api.schema.js +32 -0
  21. package/dist/data-type-config.schema.d.ts +9 -0
  22. package/dist/data-type-config.schema.js +32 -0
  23. package/dist/document-type-api.schema.d.ts +202 -0
  24. package/dist/document-type-api.schema.js +86 -0
  25. package/dist/document-type.schema.d.ts +90 -0
  26. package/dist/document-type.schema.js +103 -0
  27. package/dist/health.schema.d.ts +6 -0
  28. package/dist/health.schema.js +5 -0
  29. package/dist/index.d.ts +54 -0
  30. package/dist/index.js +27 -0
  31. package/dist/marketplace-listing-api.schema.d.ts +205 -0
  32. package/dist/marketplace-listing-api.schema.js +115 -0
  33. package/dist/media-api.schema.d.ts +36 -0
  34. package/dist/media-api.schema.js +23 -0
  35. package/dist/media.schema.d.ts +11 -0
  36. package/dist/media.schema.js +10 -0
  37. package/dist/plugin-management-api.schema.d.ts +145 -0
  38. package/dist/plugin-management-api.schema.js +186 -0
  39. package/dist/plugin-registry-api.schema.d.ts +31 -0
  40. package/dist/plugin-registry-api.schema.js +25 -0
  41. package/dist/plugin-storage-api.schema.d.ts +15 -0
  42. package/dist/plugin-storage-api.schema.js +24 -0
  43. package/dist/public-api.schema.d.ts +211 -0
  44. package/dist/public-api.schema.js +185 -0
  45. package/dist/setup-api.schema.d.ts +78 -0
  46. package/dist/setup-api.schema.js +88 -0
  47. package/dist/snapshot-api.schema.d.ts +43 -0
  48. package/dist/snapshot-api.schema.js +25 -0
  49. package/dist/snapshot.schema.d.ts +28 -0
  50. package/dist/snapshot.schema.js +17 -0
  51. package/dist/template-api.schema.d.ts +33 -0
  52. package/dist/template-api.schema.js +28 -0
  53. package/dist/template.schema.d.ts +7 -0
  54. package/dist/template.schema.js +13 -0
  55. package/dist/theme-api.schema.d.ts +21 -0
  56. package/dist/theme-api.schema.js +14 -0
  57. package/dist/user-api.schema.d.ts +79 -0
  58. package/dist/user-api.schema.js +36 -0
  59. package/package.json +26 -0
@@ -0,0 +1,33 @@
1
+ import { z } from "zod";
2
+ export declare const CreateTemplateRequestSchema: z.ZodObject<{
3
+ name: z.ZodString;
4
+ documentTypeId: z.ZodString;
5
+ }, z.core.$strict>;
6
+ export type CreateTemplateRequest = z.infer<typeof CreateTemplateRequestSchema>;
7
+ export declare const CreateTemplateResponseSchema: z.ZodObject<{
8
+ template: z.ZodObject<{
9
+ id: z.ZodString;
10
+ name: z.ZodString;
11
+ documentTypeId: z.ZodString;
12
+ }, z.core.$strict>;
13
+ }, z.core.$strip>;
14
+ export type CreateTemplateResponse = z.infer<typeof CreateTemplateResponseSchema>;
15
+ export declare const TemplateListQuerySchema: z.ZodObject<{
16
+ cursor: z.ZodOptional<z.ZodString>;
17
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
18
+ documentTypeId: z.ZodOptional<z.ZodString>;
19
+ }, z.core.$strip>;
20
+ export type TemplateListQuery = z.infer<typeof TemplateListQuerySchema>;
21
+ export declare const TemplateListResponseSchema: z.ZodObject<{
22
+ items: z.ZodArray<z.ZodObject<{
23
+ id: z.ZodString;
24
+ name: z.ZodString;
25
+ documentTypeId: z.ZodString;
26
+ }, z.core.$strict>>;
27
+ nextCursor: z.ZodNullable<z.ZodString>;
28
+ }, z.core.$strip>;
29
+ export type TemplateListResponse = z.infer<typeof TemplateListResponseSchema>;
30
+ export declare const SetDefaultTemplateRequestSchema: z.ZodObject<{
31
+ templateId: z.ZodNullable<z.ZodString>;
32
+ }, z.core.$strip>;
33
+ export type SetDefaultTemplateRequest = z.infer<typeof SetDefaultTemplateRequestSchema>;
@@ -0,0 +1,28 @@
1
+ import { z } from "zod";
2
+ import { TemplateDefinitionSchema } from "./template.schema.js";
3
+ // Same shape as TemplateDefinitionSchema minus `id` — the server mints that.
4
+ export const CreateTemplateRequestSchema = z
5
+ .object({
6
+ name: z.string().min(1),
7
+ documentTypeId: z.string().uuid(),
8
+ })
9
+ .strict();
10
+ export const CreateTemplateResponseSchema = z.object({
11
+ template: TemplateDefinitionSchema,
12
+ });
13
+ // Per api-design.md, list endpoints are always cursor-paginated. The
14
+ // optional documentTypeId filter is what the builder's template picker
15
+ // uses to list "templates for this document type."
16
+ export const TemplateListQuerySchema = z.object({
17
+ cursor: z.string().uuid().optional(),
18
+ limit: z.coerce.number().int().min(1).max(100).default(50),
19
+ documentTypeId: z.string().uuid().optional(),
20
+ });
21
+ export const TemplateListResponseSchema = z.object({
22
+ items: z.array(TemplateDefinitionSchema),
23
+ nextCursor: z.string().uuid().nullable(),
24
+ });
25
+ // Body for PATCH /api/document-types/:id/default-template.
26
+ export const SetDefaultTemplateRequestSchema = z.object({
27
+ templateId: z.string().uuid().nullable(),
28
+ });
@@ -0,0 +1,7 @@
1
+ import { z } from "zod";
2
+ export declare const TemplateDefinitionSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ name: z.ZodString;
5
+ documentTypeId: z.ZodString;
6
+ }, z.core.$strict>;
7
+ export type TemplateDefinition = z.infer<typeof TemplateDefinitionSchema>;
@@ -0,0 +1,13 @@
1
+ import { z } from "zod";
2
+ // A named template record referencing a document type ('page' kind only,
3
+ // enforced at the request-schema level in template-api.schema.ts and at
4
+ // the write path in DatabaseAdapter, not here — this is the persisted
5
+ // shape). Rendering HTML from a template is out of scope: this schema is
6
+ // deliberately inert data, a future rendering engine's job to consume.
7
+ export const TemplateDefinitionSchema = z
8
+ .object({
9
+ id: z.string().uuid(),
10
+ name: z.string().min(1),
11
+ documentTypeId: z.string().uuid(),
12
+ })
13
+ .strict();
@@ -0,0 +1,21 @@
1
+ import { z } from "zod";
2
+ /** GET /api/themes — installed, enabled theme plugins' token overrides.
3
+ * tokens is the manifest's contributions.themeTokens passed through
4
+ * verbatim; its inner shape is validated at install time by the SDK's
5
+ * themeTokensSchema, so here it is an opaque record (color/radius). */
6
+ export declare const ThemeListItemSchema: z.ZodObject<{
7
+ pluginId: z.ZodString;
8
+ name: z.ZodString;
9
+ author: z.ZodString;
10
+ tokens: z.ZodRecord<z.ZodString, z.ZodUnknown>;
11
+ }, z.core.$strip>;
12
+ export declare const ThemeListResponseSchema: z.ZodObject<{
13
+ items: z.ZodArray<z.ZodObject<{
14
+ pluginId: z.ZodString;
15
+ name: z.ZodString;
16
+ author: z.ZodString;
17
+ tokens: z.ZodRecord<z.ZodString, z.ZodUnknown>;
18
+ }, z.core.$strip>>;
19
+ }, z.core.$strip>;
20
+ export type ThemeListItem = z.infer<typeof ThemeListItemSchema>;
21
+ export type ThemeListResponse = z.infer<typeof ThemeListResponseSchema>;
@@ -0,0 +1,14 @@
1
+ import { z } from "zod";
2
+ /** GET /api/themes — installed, enabled theme plugins' token overrides.
3
+ * tokens is the manifest's contributions.themeTokens passed through
4
+ * verbatim; its inner shape is validated at install time by the SDK's
5
+ * themeTokensSchema, so here it is an opaque record (color/radius). */
6
+ export const ThemeListItemSchema = z.object({
7
+ pluginId: z.string(),
8
+ name: z.string(),
9
+ author: z.string(),
10
+ tokens: z.record(z.string(), z.unknown()),
11
+ });
12
+ export const ThemeListResponseSchema = z.object({
13
+ items: z.array(ThemeListItemSchema),
14
+ });
@@ -0,0 +1,79 @@
1
+ import { z } from "zod";
2
+ export declare const UserRoleSchema: z.ZodEnum<{
3
+ admin: "admin";
4
+ editor: "editor";
5
+ }>;
6
+ export type UserRole = z.infer<typeof UserRoleSchema>;
7
+ export declare const UserSummarySchema: z.ZodObject<{
8
+ id: z.ZodString;
9
+ email: z.ZodString;
10
+ name: z.ZodNullable<z.ZodString>;
11
+ role: z.ZodEnum<{
12
+ admin: "admin";
13
+ editor: "editor";
14
+ }>;
15
+ createdAt: z.ZodString;
16
+ }, z.core.$strip>;
17
+ export type UserSummary = z.infer<typeof UserSummarySchema>;
18
+ export declare const UserListQuerySchema: z.ZodObject<{
19
+ cursor: z.ZodOptional<z.ZodString>;
20
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
21
+ }, z.core.$strip>;
22
+ export type UserListQuery = z.infer<typeof UserListQuerySchema>;
23
+ export declare const UserListResponseSchema: z.ZodObject<{
24
+ items: z.ZodArray<z.ZodObject<{
25
+ id: z.ZodString;
26
+ email: z.ZodString;
27
+ name: z.ZodNullable<z.ZodString>;
28
+ role: z.ZodEnum<{
29
+ admin: "admin";
30
+ editor: "editor";
31
+ }>;
32
+ createdAt: z.ZodString;
33
+ }, z.core.$strip>>;
34
+ nextCursor: z.ZodNullable<z.ZodString>;
35
+ }, z.core.$strip>;
36
+ export type UserListResponse = z.infer<typeof UserListResponseSchema>;
37
+ export declare const CreateUserRequestSchema: z.ZodObject<{
38
+ email: z.ZodString;
39
+ name: z.ZodOptional<z.ZodString>;
40
+ password: z.ZodString;
41
+ role: z.ZodEnum<{
42
+ admin: "admin";
43
+ editor: "editor";
44
+ }>;
45
+ }, z.core.$strip>;
46
+ export type CreateUserRequest = z.infer<typeof CreateUserRequestSchema>;
47
+ export declare const CreateUserResponseSchema: z.ZodObject<{
48
+ user: z.ZodObject<{
49
+ id: z.ZodString;
50
+ email: z.ZodString;
51
+ name: z.ZodNullable<z.ZodString>;
52
+ role: z.ZodEnum<{
53
+ admin: "admin";
54
+ editor: "editor";
55
+ }>;
56
+ createdAt: z.ZodString;
57
+ }, z.core.$strip>;
58
+ }, z.core.$strip>;
59
+ export type CreateUserResponse = z.infer<typeof CreateUserResponseSchema>;
60
+ export declare const UpdateUserRoleRequestSchema: z.ZodObject<{
61
+ role: z.ZodEnum<{
62
+ admin: "admin";
63
+ editor: "editor";
64
+ }>;
65
+ }, z.core.$strip>;
66
+ export type UpdateUserRoleRequest = z.infer<typeof UpdateUserRoleRequestSchema>;
67
+ export declare const UpdateUserRoleResponseSchema: z.ZodObject<{
68
+ user: z.ZodObject<{
69
+ id: z.ZodString;
70
+ email: z.ZodString;
71
+ name: z.ZodNullable<z.ZodString>;
72
+ role: z.ZodEnum<{
73
+ admin: "admin";
74
+ editor: "editor";
75
+ }>;
76
+ createdAt: z.ZodString;
77
+ }, z.core.$strip>;
78
+ }, z.core.$strip>;
79
+ export type UpdateUserRoleResponse = z.infer<typeof UpdateUserRoleResponseSchema>;
@@ -0,0 +1,36 @@
1
+ import { z } from "zod";
2
+ // Wire format for roles — matches the Prisma enum values exactly
3
+ // (lowercase on purpose) so no mapping layer exists anywhere.
4
+ export const UserRoleSchema = z.enum(["admin", "editor"]);
5
+ // What user management reads — never the passwordHash.
6
+ export const UserSummarySchema = z.object({
7
+ id: z.string().uuid(),
8
+ email: z.string().email(),
9
+ name: z.string().nullable(),
10
+ role: UserRoleSchema,
11
+ createdAt: z.string().datetime(),
12
+ });
13
+ export const UserListQuerySchema = z.object({
14
+ cursor: z.string().uuid().optional(),
15
+ limit: z.coerce.number().int().min(1).max(100).default(50),
16
+ });
17
+ export const UserListResponseSchema = z.object({
18
+ items: z.array(UserSummarySchema),
19
+ // null = no more pages.
20
+ nextCursor: z.string().uuid().nullable(),
21
+ });
22
+ export const CreateUserRequestSchema = z.object({
23
+ email: z.string().email(),
24
+ name: z.string().min(1).optional(),
25
+ password: z.string().min(8),
26
+ role: UserRoleSchema,
27
+ });
28
+ export const CreateUserResponseSchema = z.object({
29
+ user: UserSummarySchema,
30
+ });
31
+ export const UpdateUserRoleRequestSchema = z.object({
32
+ role: UserRoleSchema,
33
+ });
34
+ export const UpdateUserRoleResponseSchema = z.object({
35
+ user: UserSummarySchema,
36
+ });
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@velora-cms/api-schemas",
3
+ "version": "0.9.0",
4
+ "license": "Apache-2.0",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/velora-cms/velora.git",
14
+ "directory": "packages/api-schemas"
15
+ },
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "dependencies": {
20
+ "zod": "4.4.3"
21
+ },
22
+ "scripts": {
23
+ "build": "tsc -p .",
24
+ "test": "vitest run"
25
+ }
26
+ }