@headless-lms/server 0.1.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 +21 -0
- package/README.md +48 -0
- package/dist/app/container.d.ts +124 -0
- package/dist/app/container.js +312 -0
- package/dist/app/container.js.map +1 -0
- package/dist/app/db.d.ts +2 -0
- package/dist/app/db.js +2 -0
- package/dist/app/integrations.d.ts +7 -0
- package/dist/app/integrations.js +44 -0
- package/dist/app/integrations.js.map +1 -0
- package/dist/app/notifications.d.ts +7 -0
- package/dist/app/notifications.js +23 -0
- package/dist/app/notifications.js.map +1 -0
- package/dist/http/config.d.ts +25 -0
- package/dist/http/config.js +1 -0
- package/dist/http/fastify.d.ts +35 -0
- package/dist/http/plugins/auth.d.ts +11 -0
- package/dist/http/plugins/auth.js +47 -0
- package/dist/http/plugins/auth.js.map +1 -0
- package/dist/http/plugins/cors.d.ts +7 -0
- package/dist/http/plugins/cors.js +22 -0
- package/dist/http/plugins/cors.js.map +1 -0
- package/dist/http/plugins/error-handler.d.ts +6 -0
- package/dist/http/plugins/error-handler.js +64 -0
- package/dist/http/plugins/error-handler.js.map +1 -0
- package/dist/http/plugins/openapi.d.ts +7 -0
- package/dist/http/plugins/openapi.js +63 -0
- package/dist/http/plugins/openapi.js.map +1 -0
- package/dist/http/routes/activities.d.ts +7 -0
- package/dist/http/routes/activities.js +163 -0
- package/dist/http/routes/activities.js.map +1 -0
- package/dist/http/routes/assets.d.ts +7 -0
- package/dist/http/routes/assets.js +168 -0
- package/dist/http/routes/assets.js.map +1 -0
- package/dist/http/routes/automations.d.ts +7 -0
- package/dist/http/routes/automations.js +158 -0
- package/dist/http/routes/automations.js.map +1 -0
- package/dist/http/routes/courses.d.ts +7 -0
- package/dist/http/routes/courses.js +130 -0
- package/dist/http/routes/courses.js.map +1 -0
- package/dist/http/routes/dashboard.d.ts +7 -0
- package/dist/http/routes/dashboard.js +42 -0
- package/dist/http/routes/dashboard.js.map +1 -0
- package/dist/http/routes/discussion.d.ts +7 -0
- package/dist/http/routes/discussion.js +122 -0
- package/dist/http/routes/discussion.js.map +1 -0
- package/dist/http/routes/downloads.d.ts +7 -0
- package/dist/http/routes/downloads.js +208 -0
- package/dist/http/routes/downloads.js.map +1 -0
- package/dist/http/routes/entitlements.d.ts +7 -0
- package/dist/http/routes/entitlements.js +69 -0
- package/dist/http/routes/entitlements.js.map +1 -0
- package/dist/http/routes/identity.d.ts +6 -0
- package/dist/http/routes/identity.js +6 -0
- package/dist/http/routes/identity.js.map +1 -0
- package/dist/http/routes/integrations.d.ts +7 -0
- package/dist/http/routes/integrations.js +210 -0
- package/dist/http/routes/integrations.js.map +1 -0
- package/dist/http/routes/learn/assets.d.ts +8 -0
- package/dist/http/routes/learn/assets.js +32 -0
- package/dist/http/routes/learn/assets.js.map +1 -0
- package/dist/http/routes/learn/comments.d.ts +7 -0
- package/dist/http/routes/learn/comments.js +175 -0
- package/dist/http/routes/learn/comments.js.map +1 -0
- package/dist/http/routes/learn/courses.d.ts +7 -0
- package/dist/http/routes/learn/courses.js +75 -0
- package/dist/http/routes/learn/courses.js.map +1 -0
- package/dist/http/routes/learn/downloads.d.ts +7 -0
- package/dist/http/routes/learn/downloads.js +76 -0
- package/dist/http/routes/learn/downloads.js.map +1 -0
- package/dist/http/routes/learn/index.d.ts +7 -0
- package/dist/http/routes/learn/index.js +19 -0
- package/dist/http/routes/learn/index.js.map +1 -0
- package/dist/http/routes/learn/org.d.ts +7 -0
- package/dist/http/routes/learn/org.js +50 -0
- package/dist/http/routes/learn/org.js.map +1 -0
- package/dist/http/routes/learn/progress.d.ts +7 -0
- package/dist/http/routes/learn/progress.js +63 -0
- package/dist/http/routes/learn/progress.js.map +1 -0
- package/dist/http/routes/organizations.d.ts +7 -0
- package/dist/http/routes/organizations.js +219 -0
- package/dist/http/routes/organizations.js.map +1 -0
- package/dist/http/routes/progress.d.ts +6 -0
- package/dist/http/routes/progress.js +6 -0
- package/dist/http/routes/progress.js.map +1 -0
- package/dist/http/routes/students.d.ts +7 -0
- package/dist/http/routes/students.js +125 -0
- package/dist/http/routes/students.js.map +1 -0
- package/dist/http/routes.d.ts +7 -0
- package/dist/http/routes.js +37 -0
- package/dist/http/routes.js.map +1 -0
- package/dist/http/schemas/activities.d.ts +69 -0
- package/dist/http/schemas/activities.js +25 -0
- package/dist/http/schemas/activities.js.map +1 -0
- package/dist/http/schemas/assets.d.ts +142 -0
- package/dist/http/schemas/assets.js +24 -0
- package/dist/http/schemas/assets.js.map +1 -0
- package/dist/http/schemas/automations.d.ts +154 -0
- package/dist/http/schemas/automations.js +26 -0
- package/dist/http/schemas/automations.js.map +1 -0
- package/dist/http/schemas/content.d.ts +113 -0
- package/dist/http/schemas/content.js +29 -0
- package/dist/http/schemas/content.js.map +1 -0
- package/dist/http/schemas/dashboard.d.ts +26 -0
- package/dist/http/schemas/dashboard.js +18 -0
- package/dist/http/schemas/dashboard.js.map +1 -0
- package/dist/http/schemas/discussion.d.ts +340 -0
- package/dist/http/schemas/discussion.js +78 -0
- package/dist/http/schemas/discussion.js.map +1 -0
- package/dist/http/schemas/downloads.d.ts +110 -0
- package/dist/http/schemas/downloads.js +34 -0
- package/dist/http/schemas/downloads.js.map +1 -0
- package/dist/http/schemas/entitlements.d.ts +97 -0
- package/dist/http/schemas/entitlements.js +41 -0
- package/dist/http/schemas/entitlements.js.map +1 -0
- package/dist/http/schemas/index.d.ts +17 -0
- package/dist/http/schemas/index.js +17 -0
- package/dist/http/schemas/integrations.d.ts +93 -0
- package/dist/http/schemas/integrations.js +47 -0
- package/dist/http/schemas/integrations.js.map +1 -0
- package/dist/http/schemas/invites.d.ts +95 -0
- package/dist/http/schemas/invites.js +62 -0
- package/dist/http/schemas/invites.js.map +1 -0
- package/dist/http/schemas/learn.d.ts +142 -0
- package/dist/http/schemas/learn.js +58 -0
- package/dist/http/schemas/learn.js.map +1 -0
- package/dist/http/schemas/members.d.ts +88 -0
- package/dist/http/schemas/members.js +27 -0
- package/dist/http/schemas/members.js.map +1 -0
- package/dist/http/schemas/organizations.d.ts +22 -0
- package/dist/http/schemas/organizations.js +20 -0
- package/dist/http/schemas/organizations.js.map +1 -0
- package/dist/http/schemas/settings.d.ts +23 -0
- package/dist/http/schemas/settings.js +20 -0
- package/dist/http/schemas/settings.js.map +1 -0
- package/dist/http/schemas/shared.d.ts +57 -0
- package/dist/http/schemas/shared.js +54 -0
- package/dist/http/schemas/shared.js.map +1 -0
- package/dist/http/schemas/students.d.ts +64 -0
- package/dist/http/schemas/students.js +25 -0
- package/dist/http/schemas/students.js.map +1 -0
- package/dist/http/scope.d.ts +22 -0
- package/dist/http/scope.js +28 -0
- package/dist/http/scope.js.map +1 -0
- package/dist/http/server.d.ts +8 -0
- package/dist/http/server.js +33 -0
- package/dist/http/server.js.map +1 -0
- package/dist/http/web-bridge.d.ts +9 -0
- package/dist/http/web-bridge.js +27 -0
- package/dist/http/web-bridge.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/http/schemas/dashboard.d.ts
|
|
3
|
+
declare const OverviewStats: z.ZodObject<{
|
|
4
|
+
publishedCourses: z.ZodNumber;
|
|
5
|
+
draftCourses: z.ZodNumber;
|
|
6
|
+
activeStudents: z.ZodNumber;
|
|
7
|
+
expiringSoon: z.ZodNumber;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
type OverviewStats = z.infer<typeof OverviewStats>;
|
|
10
|
+
declare const EnrollmentPoint: z.ZodObject<{
|
|
11
|
+
date: z.ZodString;
|
|
12
|
+
count: z.ZodNumber;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
type EnrollmentPoint = z.infer<typeof EnrollmentPoint>;
|
|
15
|
+
declare const EnrollmentSeries: z.ZodArray<z.ZodObject<{
|
|
16
|
+
date: z.ZodString;
|
|
17
|
+
count: z.ZodNumber;
|
|
18
|
+
}, z.core.$strip>>;
|
|
19
|
+
type EnrollmentSeries = z.infer<typeof EnrollmentSeries>;
|
|
20
|
+
declare const EnrollmentSeriesQuery: z.ZodObject<{
|
|
21
|
+
days: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
type EnrollmentSeriesQuery = z.infer<typeof EnrollmentSeriesQuery>;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { EnrollmentPoint, EnrollmentSeries, EnrollmentSeriesQuery, OverviewStats };
|
|
26
|
+
//# sourceMappingURL=dashboard.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/http/schemas/dashboard.ts
|
|
3
|
+
const OverviewStats = z.object({
|
|
4
|
+
publishedCourses: z.number().int(),
|
|
5
|
+
draftCourses: z.number().int(),
|
|
6
|
+
activeStudents: z.number().int(),
|
|
7
|
+
expiringSoon: z.number().int()
|
|
8
|
+
});
|
|
9
|
+
const EnrollmentPoint = z.object({
|
|
10
|
+
date: z.string(),
|
|
11
|
+
count: z.number().int()
|
|
12
|
+
});
|
|
13
|
+
const EnrollmentSeries = z.array(EnrollmentPoint);
|
|
14
|
+
const EnrollmentSeriesQuery = z.object({ days: z.coerce.number().int().min(1).max(365).default(30) });
|
|
15
|
+
//#endregion
|
|
16
|
+
export { EnrollmentPoint, EnrollmentSeries, EnrollmentSeriesQuery, OverviewStats };
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=dashboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboard.js","names":[],"sources":["../../../src/http/schemas/dashboard.ts"],"sourcesContent":["// Dashboard / overview resource schemas.\nimport { z } from \"zod\";\n\nexport const OverviewStats = z.object({\n publishedCourses: z.number().int(),\n draftCourses: z.number().int(),\n activeStudents: z.number().int(),\n expiringSoon: z.number().int(),\n});\nexport type OverviewStats = z.infer<typeof OverviewStats>;\n\nexport const EnrollmentPoint = z.object({\n date: z.string(),\n count: z.number().int(),\n});\nexport type EnrollmentPoint = z.infer<typeof EnrollmentPoint>;\n\nexport const EnrollmentSeries = z.array(EnrollmentPoint);\nexport type EnrollmentSeries = z.infer<typeof EnrollmentSeries>;\n\nexport const EnrollmentSeriesQuery = z.object({\n days: z.coerce.number().int().min(1).max(365).default(30),\n});\nexport type EnrollmentSeriesQuery = z.infer<typeof EnrollmentSeriesQuery>;\n"],"mappings":";;AAGA,MAAa,gBAAgB,EAAE,OAAO;CACpC,kBAAkB,EAAE,OAAO,CAAC,CAAC,IAAI;CACjC,cAAc,EAAE,OAAO,CAAC,CAAC,IAAI;CAC7B,gBAAgB,EAAE,OAAO,CAAC,CAAC,IAAI;CAC/B,cAAc,EAAE,OAAO,CAAC,CAAC,IAAI;AAC/B,CAAC;AAGD,MAAa,kBAAkB,EAAE,OAAO;CACtC,MAAM,EAAE,OAAO;CACf,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI;AACxB,CAAC;AAGD,MAAa,mBAAmB,EAAE,MAAM,eAAe;AAGvD,MAAa,wBAAwB,EAAE,OAAO,EAC5C,MAAM,EAAE,OAAO,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,EAC1D,CAAC"}
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/http/schemas/discussion.d.ts
|
|
3
|
+
declare const CommentStatus: z.ZodEnum<{
|
|
4
|
+
published: "published";
|
|
5
|
+
pending: "pending";
|
|
6
|
+
removed: "removed";
|
|
7
|
+
}>;
|
|
8
|
+
type CommentStatus = z.infer<typeof CommentStatus>;
|
|
9
|
+
declare const CommentAuthor: z.ZodObject<{
|
|
10
|
+
id: z.ZodString;
|
|
11
|
+
firstName: z.ZodNullable<z.ZodString>;
|
|
12
|
+
lastName: z.ZodNullable<z.ZodString>;
|
|
13
|
+
image: z.ZodNullable<z.ZodString>;
|
|
14
|
+
role: z.ZodEnum<{
|
|
15
|
+
owner: "owner";
|
|
16
|
+
admin: "admin";
|
|
17
|
+
instructor: "instructor";
|
|
18
|
+
student: "student";
|
|
19
|
+
}>;
|
|
20
|
+
}, z.core.$strict>;
|
|
21
|
+
type CommentAuthor = z.infer<typeof CommentAuthor>;
|
|
22
|
+
/** Any single emoji. Open, so widening the picker needs no schema change. */
|
|
23
|
+
declare const ReactionEmoji: z.ZodString;
|
|
24
|
+
type ReactionEmoji = z.infer<typeof ReactionEmoji>;
|
|
25
|
+
/** Counts by emoji; unused ones are absent, so no reactions serves `{}`. */
|
|
26
|
+
declare const ReactionCounts: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
27
|
+
type ReactionCounts = z.infer<typeof ReactionCounts>;
|
|
28
|
+
declare const CommentView: z.ZodObject<{
|
|
29
|
+
id: z.ZodString;
|
|
30
|
+
activityId: z.ZodString;
|
|
31
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
32
|
+
author: z.ZodObject<{
|
|
33
|
+
id: z.ZodString;
|
|
34
|
+
firstName: z.ZodNullable<z.ZodString>;
|
|
35
|
+
lastName: z.ZodNullable<z.ZodString>;
|
|
36
|
+
image: z.ZodNullable<z.ZodString>;
|
|
37
|
+
role: z.ZodEnum<{
|
|
38
|
+
owner: "owner";
|
|
39
|
+
admin: "admin";
|
|
40
|
+
instructor: "instructor";
|
|
41
|
+
student: "student";
|
|
42
|
+
}>;
|
|
43
|
+
}, z.core.$strict>;
|
|
44
|
+
body: z.ZodNullable<z.ZodString>;
|
|
45
|
+
status: z.ZodEnum<{
|
|
46
|
+
published: "published";
|
|
47
|
+
pending: "pending";
|
|
48
|
+
removed: "removed";
|
|
49
|
+
}>;
|
|
50
|
+
removedBy: z.ZodNullable<z.ZodObject<{
|
|
51
|
+
id: z.ZodString;
|
|
52
|
+
firstName: z.ZodNullable<z.ZodString>;
|
|
53
|
+
lastName: z.ZodNullable<z.ZodString>;
|
|
54
|
+
image: z.ZodNullable<z.ZodString>;
|
|
55
|
+
role: z.ZodEnum<{
|
|
56
|
+
owner: "owner";
|
|
57
|
+
admin: "admin";
|
|
58
|
+
instructor: "instructor";
|
|
59
|
+
student: "student";
|
|
60
|
+
}>;
|
|
61
|
+
}, z.core.$strict>>;
|
|
62
|
+
reactions: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
63
|
+
viewerReaction: z.ZodOptional<z.ZodString>;
|
|
64
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
65
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
66
|
+
}, z.core.$strict>;
|
|
67
|
+
type CommentView = z.infer<typeof CommentView>;
|
|
68
|
+
/** What the reaction write returns, so the client never recomputes a count. */
|
|
69
|
+
declare const CommentReactions: z.ZodObject<{
|
|
70
|
+
reactions: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
71
|
+
viewerReaction: z.ZodOptional<z.ZodString>;
|
|
72
|
+
}, z.core.$strip>;
|
|
73
|
+
type CommentReactions = z.infer<typeof CommentReactions>;
|
|
74
|
+
/** A course's comment settings. Stored under the course, carried on the course
|
|
75
|
+
* payload as `settings.comments`. */
|
|
76
|
+
declare const CommentSettings: z.ZodObject<{
|
|
77
|
+
enabled: z.ZodBoolean;
|
|
78
|
+
threaded: z.ZodBoolean;
|
|
79
|
+
requireReview: z.ZodBoolean;
|
|
80
|
+
reactions: z.ZodBoolean;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
type CommentSettings = z.infer<typeof CommentSettings>;
|
|
83
|
+
/** The course settings with the activity's override applied: `enabled` is the
|
|
84
|
+
* resolved answer for this activity, not the course switch. */
|
|
85
|
+
declare const CommentsConfig: z.ZodObject<{
|
|
86
|
+
enabled: z.ZodBoolean;
|
|
87
|
+
threaded: z.ZodBoolean;
|
|
88
|
+
requireReview: z.ZodBoolean;
|
|
89
|
+
reactions: z.ZodBoolean;
|
|
90
|
+
}, z.core.$strip>;
|
|
91
|
+
type CommentsConfig = z.infer<typeof CommentsConfig>;
|
|
92
|
+
declare const ActivityComments: z.ZodObject<{
|
|
93
|
+
config: z.ZodObject<{
|
|
94
|
+
enabled: z.ZodBoolean;
|
|
95
|
+
threaded: z.ZodBoolean;
|
|
96
|
+
requireReview: z.ZodBoolean;
|
|
97
|
+
reactions: z.ZodBoolean;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
comments: z.ZodArray<z.ZodObject<{
|
|
100
|
+
id: z.ZodString;
|
|
101
|
+
activityId: z.ZodString;
|
|
102
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
103
|
+
author: z.ZodObject<{
|
|
104
|
+
id: z.ZodString;
|
|
105
|
+
firstName: z.ZodNullable<z.ZodString>;
|
|
106
|
+
lastName: z.ZodNullable<z.ZodString>;
|
|
107
|
+
image: z.ZodNullable<z.ZodString>;
|
|
108
|
+
role: z.ZodEnum<{
|
|
109
|
+
owner: "owner";
|
|
110
|
+
admin: "admin";
|
|
111
|
+
instructor: "instructor";
|
|
112
|
+
student: "student";
|
|
113
|
+
}>;
|
|
114
|
+
}, z.core.$strict>;
|
|
115
|
+
body: z.ZodNullable<z.ZodString>;
|
|
116
|
+
status: z.ZodEnum<{
|
|
117
|
+
published: "published";
|
|
118
|
+
pending: "pending";
|
|
119
|
+
removed: "removed";
|
|
120
|
+
}>;
|
|
121
|
+
removedBy: z.ZodNullable<z.ZodObject<{
|
|
122
|
+
id: z.ZodString;
|
|
123
|
+
firstName: z.ZodNullable<z.ZodString>;
|
|
124
|
+
lastName: z.ZodNullable<z.ZodString>;
|
|
125
|
+
image: z.ZodNullable<z.ZodString>;
|
|
126
|
+
role: z.ZodEnum<{
|
|
127
|
+
owner: "owner";
|
|
128
|
+
admin: "admin";
|
|
129
|
+
instructor: "instructor";
|
|
130
|
+
student: "student";
|
|
131
|
+
}>;
|
|
132
|
+
}, z.core.$strict>>;
|
|
133
|
+
reactions: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
134
|
+
viewerReaction: z.ZodOptional<z.ZodString>;
|
|
135
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
136
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
137
|
+
}, z.core.$strict>>;
|
|
138
|
+
}, z.core.$strip>;
|
|
139
|
+
type ActivityComments = z.infer<typeof ActivityComments>;
|
|
140
|
+
declare const PostComment: z.ZodObject<{
|
|
141
|
+
body: z.ZodString;
|
|
142
|
+
parentId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
143
|
+
}, z.core.$strip>;
|
|
144
|
+
type PostComment = z.infer<typeof PostComment>;
|
|
145
|
+
declare const EditComment: z.ZodObject<{
|
|
146
|
+
body: z.ZodString;
|
|
147
|
+
}, z.core.$strip>;
|
|
148
|
+
type EditComment = z.infer<typeof EditComment>;
|
|
149
|
+
/** The staff PATCH writes status and nothing else: publishing covers approving
|
|
150
|
+
* a pending comment and restoring a removed one. Revising the text is the
|
|
151
|
+
* author's own edit, under /api/learn. */
|
|
152
|
+
declare const PatchComment: z.ZodObject<{
|
|
153
|
+
status: z.ZodLiteral<"published">;
|
|
154
|
+
}, z.core.$strip>;
|
|
155
|
+
type PatchComment = z.infer<typeof PatchComment>;
|
|
156
|
+
/** Replaces whatever the reader had. Clearing is DELETE, which carries no body. */
|
|
157
|
+
declare const SetCommentReaction: z.ZodObject<{
|
|
158
|
+
emoji: z.ZodString;
|
|
159
|
+
}, z.core.$strip>;
|
|
160
|
+
type SetCommentReaction = z.infer<typeof SetCommentReaction>;
|
|
161
|
+
/** A moderator's reply, posted from the queue against the comment it answers. */
|
|
162
|
+
declare const ReplyToComment: z.ZodObject<{
|
|
163
|
+
body: z.ZodString;
|
|
164
|
+
}, z.core.$strip>;
|
|
165
|
+
type ReplyToComment = z.infer<typeof ReplyToComment>;
|
|
166
|
+
declare const ReportComment: z.ZodObject<{
|
|
167
|
+
reason: z.ZodDefault<z.ZodString>;
|
|
168
|
+
}, z.core.$strip>;
|
|
169
|
+
type ReportComment = z.infer<typeof ReportComment>;
|
|
170
|
+
declare const Comment: z.ZodObject<{
|
|
171
|
+
id: z.ZodString;
|
|
172
|
+
orgId: z.ZodString;
|
|
173
|
+
activityId: z.ZodString;
|
|
174
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
175
|
+
orgUserId: z.ZodString;
|
|
176
|
+
body: z.ZodString;
|
|
177
|
+
status: z.ZodEnum<{
|
|
178
|
+
published: "published";
|
|
179
|
+
pending: "pending";
|
|
180
|
+
removed: "removed";
|
|
181
|
+
}>;
|
|
182
|
+
removedBy: z.ZodNullable<z.ZodString>;
|
|
183
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
184
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
185
|
+
}, z.core.$strict>;
|
|
186
|
+
type Comment = z.infer<typeof Comment>;
|
|
187
|
+
declare const CommentReport: z.ZodObject<{
|
|
188
|
+
id: z.ZodString;
|
|
189
|
+
commentId: z.ZodString;
|
|
190
|
+
orgUserId: z.ZodString;
|
|
191
|
+
reason: z.ZodString;
|
|
192
|
+
resolvedAt: z.ZodNullable<z.ZodDate>;
|
|
193
|
+
createdAt: z.ZodDate;
|
|
194
|
+
}, z.core.$strip>;
|
|
195
|
+
type CommentReport = z.infer<typeof CommentReport>;
|
|
196
|
+
/** An unresolved report on a listed comment. Resolved ones are history and are
|
|
197
|
+
* never served here. */
|
|
198
|
+
declare const CommentReportSummary: z.ZodObject<{
|
|
199
|
+
reporter: z.ZodObject<{
|
|
200
|
+
id: z.ZodString;
|
|
201
|
+
firstName: z.ZodNullable<z.ZodString>;
|
|
202
|
+
lastName: z.ZodNullable<z.ZodString>;
|
|
203
|
+
image: z.ZodNullable<z.ZodString>;
|
|
204
|
+
role: z.ZodEnum<{
|
|
205
|
+
owner: "owner";
|
|
206
|
+
admin: "admin";
|
|
207
|
+
instructor: "instructor";
|
|
208
|
+
student: "student";
|
|
209
|
+
}>;
|
|
210
|
+
}, z.core.$strict>;
|
|
211
|
+
reason: z.ZodString;
|
|
212
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
213
|
+
}, z.core.$strict>;
|
|
214
|
+
type CommentReportSummary = z.infer<typeof CommentReportSummary>;
|
|
215
|
+
/** One row of the staff comment list: the comment plus the context a
|
|
216
|
+
* moderation decision needs, so the list needs no follow-up request. */
|
|
217
|
+
declare const CommentListItem: z.ZodObject<{
|
|
218
|
+
id: z.ZodString;
|
|
219
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
220
|
+
activityId: z.ZodString;
|
|
221
|
+
activityTitle: z.ZodString;
|
|
222
|
+
courseId: z.ZodString;
|
|
223
|
+
body: z.ZodString;
|
|
224
|
+
status: z.ZodEnum<{
|
|
225
|
+
published: "published";
|
|
226
|
+
pending: "pending";
|
|
227
|
+
removed: "removed";
|
|
228
|
+
}>;
|
|
229
|
+
author: z.ZodObject<{
|
|
230
|
+
id: z.ZodString;
|
|
231
|
+
firstName: z.ZodNullable<z.ZodString>;
|
|
232
|
+
lastName: z.ZodNullable<z.ZodString>;
|
|
233
|
+
image: z.ZodNullable<z.ZodString>;
|
|
234
|
+
role: z.ZodEnum<{
|
|
235
|
+
owner: "owner";
|
|
236
|
+
admin: "admin";
|
|
237
|
+
instructor: "instructor";
|
|
238
|
+
student: "student";
|
|
239
|
+
}>;
|
|
240
|
+
}, z.core.$strict>;
|
|
241
|
+
authorEmail: z.ZodString;
|
|
242
|
+
removedBy: z.ZodNullable<z.ZodString>;
|
|
243
|
+
reports: z.ZodArray<z.ZodObject<{
|
|
244
|
+
reporter: z.ZodObject<{
|
|
245
|
+
id: z.ZodString;
|
|
246
|
+
firstName: z.ZodNullable<z.ZodString>;
|
|
247
|
+
lastName: z.ZodNullable<z.ZodString>;
|
|
248
|
+
image: z.ZodNullable<z.ZodString>;
|
|
249
|
+
role: z.ZodEnum<{
|
|
250
|
+
owner: "owner";
|
|
251
|
+
admin: "admin";
|
|
252
|
+
instructor: "instructor";
|
|
253
|
+
student: "student";
|
|
254
|
+
}>;
|
|
255
|
+
}, z.core.$strict>;
|
|
256
|
+
reason: z.ZodString;
|
|
257
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
258
|
+
}, z.core.$strict>>;
|
|
259
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
260
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
261
|
+
}, z.core.$strict>;
|
|
262
|
+
type CommentListItem = z.infer<typeof CommentListItem>;
|
|
263
|
+
declare const CommentsQuery: z.ZodObject<{
|
|
264
|
+
page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
265
|
+
pageSize: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
266
|
+
search: z.ZodOptional<z.ZodString>;
|
|
267
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
268
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
269
|
+
published: "published";
|
|
270
|
+
pending: "pending";
|
|
271
|
+
removed: "removed";
|
|
272
|
+
}>>;
|
|
273
|
+
reported: z.ZodOptional<z.ZodCodec<z.ZodString, z.ZodBoolean>>;
|
|
274
|
+
courseId: z.ZodOptional<z.ZodString>;
|
|
275
|
+
activityId: z.ZodOptional<z.ZodString>;
|
|
276
|
+
orgUserId: z.ZodOptional<z.ZodString>;
|
|
277
|
+
}, z.core.$strip>;
|
|
278
|
+
type CommentsQuery = z.infer<typeof CommentsQuery>;
|
|
279
|
+
declare const CommentsPage: z.ZodObject<{
|
|
280
|
+
rows: z.ZodArray<z.ZodObject<{
|
|
281
|
+
id: z.ZodString;
|
|
282
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
283
|
+
activityId: z.ZodString;
|
|
284
|
+
activityTitle: z.ZodString;
|
|
285
|
+
courseId: z.ZodString;
|
|
286
|
+
body: z.ZodString;
|
|
287
|
+
status: z.ZodEnum<{
|
|
288
|
+
published: "published";
|
|
289
|
+
pending: "pending";
|
|
290
|
+
removed: "removed";
|
|
291
|
+
}>;
|
|
292
|
+
author: z.ZodObject<{
|
|
293
|
+
id: z.ZodString;
|
|
294
|
+
firstName: z.ZodNullable<z.ZodString>;
|
|
295
|
+
lastName: z.ZodNullable<z.ZodString>;
|
|
296
|
+
image: z.ZodNullable<z.ZodString>;
|
|
297
|
+
role: z.ZodEnum<{
|
|
298
|
+
owner: "owner";
|
|
299
|
+
admin: "admin";
|
|
300
|
+
instructor: "instructor";
|
|
301
|
+
student: "student";
|
|
302
|
+
}>;
|
|
303
|
+
}, z.core.$strict>;
|
|
304
|
+
authorEmail: z.ZodString;
|
|
305
|
+
removedBy: z.ZodNullable<z.ZodString>;
|
|
306
|
+
reports: z.ZodArray<z.ZodObject<{
|
|
307
|
+
reporter: z.ZodObject<{
|
|
308
|
+
id: z.ZodString;
|
|
309
|
+
firstName: z.ZodNullable<z.ZodString>;
|
|
310
|
+
lastName: z.ZodNullable<z.ZodString>;
|
|
311
|
+
image: z.ZodNullable<z.ZodString>;
|
|
312
|
+
role: z.ZodEnum<{
|
|
313
|
+
owner: "owner";
|
|
314
|
+
admin: "admin";
|
|
315
|
+
instructor: "instructor";
|
|
316
|
+
student: "student";
|
|
317
|
+
}>;
|
|
318
|
+
}, z.core.$strict>;
|
|
319
|
+
reason: z.ZodString;
|
|
320
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
321
|
+
}, z.core.$strict>>;
|
|
322
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
323
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
324
|
+
}, z.core.$strict>>;
|
|
325
|
+
total: z.ZodNumber;
|
|
326
|
+
page: z.ZodNumber;
|
|
327
|
+
pageSize: z.ZodNumber;
|
|
328
|
+
}, z.core.$strip>;
|
|
329
|
+
type CommentsPage = z.infer<typeof CommentsPage>;
|
|
330
|
+
declare const DiscussionActivityParam: z.ZodObject<{
|
|
331
|
+
activityId: z.ZodString;
|
|
332
|
+
}, z.core.$strip>;
|
|
333
|
+
type DiscussionActivityParam = z.infer<typeof DiscussionActivityParam>;
|
|
334
|
+
declare const CommentIdParam: z.ZodObject<{
|
|
335
|
+
commentId: z.ZodString;
|
|
336
|
+
}, z.core.$strip>;
|
|
337
|
+
type CommentIdParam = z.infer<typeof CommentIdParam>;
|
|
338
|
+
//#endregion
|
|
339
|
+
export { ActivityComments, Comment, CommentAuthor, CommentIdParam, CommentListItem, CommentReactions, CommentReport, CommentReportSummary, CommentSettings, CommentStatus, CommentView, CommentsConfig, CommentsPage, CommentsQuery, DiscussionActivityParam, EditComment, PatchComment, PostComment, ReactionCounts, ReactionEmoji, ReplyToComment, ReportComment, SetCommentReaction };
|
|
340
|
+
//# sourceMappingURL=discussion.d.ts.map
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ListQuery, paginated } from "./shared.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { commentAuthorSchema, commentListItemSchema, commentReportSummarySchema, commentSchema, commentStatusSchema, commentViewSchema } from "@headless-lms/core/schemas";
|
|
4
|
+
//#region src/http/schemas/discussion.ts
|
|
5
|
+
const CommentStatus = commentStatusSchema;
|
|
6
|
+
const CommentAuthor = commentAuthorSchema;
|
|
7
|
+
/** Any single emoji. Open, so widening the picker needs no schema change. */
|
|
8
|
+
const ReactionEmoji = z.string().min(1).max(16);
|
|
9
|
+
/** Counts by emoji; unused ones are absent, so no reactions serves `{}`. */
|
|
10
|
+
const ReactionCounts = z.record(z.string(), z.number().int());
|
|
11
|
+
const CommentView = commentViewSchema;
|
|
12
|
+
/** What the reaction write returns, so the client never recomputes a count. */
|
|
13
|
+
const CommentReactions = z.object({
|
|
14
|
+
reactions: ReactionCounts,
|
|
15
|
+
viewerReaction: ReactionEmoji.optional()
|
|
16
|
+
});
|
|
17
|
+
/** A course's comment settings. Stored under the course, carried on the course
|
|
18
|
+
* payload as `settings.comments`. */
|
|
19
|
+
const CommentSettings = z.object({
|
|
20
|
+
enabled: z.boolean(),
|
|
21
|
+
threaded: z.boolean(),
|
|
22
|
+
requireReview: z.boolean(),
|
|
23
|
+
reactions: z.boolean()
|
|
24
|
+
});
|
|
25
|
+
/** The course settings with the activity's override applied: `enabled` is the
|
|
26
|
+
* resolved answer for this activity, not the course switch. */
|
|
27
|
+
const CommentsConfig = CommentSettings;
|
|
28
|
+
const ActivityComments = z.object({
|
|
29
|
+
config: CommentsConfig,
|
|
30
|
+
comments: z.array(CommentView)
|
|
31
|
+
});
|
|
32
|
+
const PostComment = z.object({
|
|
33
|
+
body: z.string().min(1).max(1e4),
|
|
34
|
+
parentId: z.string().nullable().default(null)
|
|
35
|
+
});
|
|
36
|
+
const EditComment = z.object({ body: z.string().min(1).max(1e4) });
|
|
37
|
+
/** The staff PATCH writes status and nothing else: publishing covers approving
|
|
38
|
+
* a pending comment and restoring a removed one. Revising the text is the
|
|
39
|
+
* author's own edit, under /api/learn. */
|
|
40
|
+
const PatchComment = z.object({ status: z.literal("published") });
|
|
41
|
+
/** Replaces whatever the reader had. Clearing is DELETE, which carries no body. */
|
|
42
|
+
const SetCommentReaction = z.object({ emoji: ReactionEmoji });
|
|
43
|
+
/** A moderator's reply, posted from the queue against the comment it answers. */
|
|
44
|
+
const ReplyToComment = z.object({ body: z.string().min(1).max(1e4) });
|
|
45
|
+
const ReportComment = z.object({ reason: z.string().max(1e3).default("") });
|
|
46
|
+
const Comment = commentSchema;
|
|
47
|
+
const CommentReport = z.object({
|
|
48
|
+
id: z.string(),
|
|
49
|
+
commentId: z.string(),
|
|
50
|
+
orgUserId: z.string(),
|
|
51
|
+
reason: z.string(),
|
|
52
|
+
resolvedAt: z.date().nullable(),
|
|
53
|
+
createdAt: z.date()
|
|
54
|
+
});
|
|
55
|
+
/** An unresolved report on a listed comment. Resolved ones are history and are
|
|
56
|
+
* never served here. */
|
|
57
|
+
const CommentReportSummary = commentReportSummarySchema;
|
|
58
|
+
/** One row of the staff comment list: the comment plus the context a
|
|
59
|
+
* moderation decision needs, so the list needs no follow-up request. */
|
|
60
|
+
const CommentListItem = commentListItemSchema;
|
|
61
|
+
const CommentsQuery = ListQuery.extend({
|
|
62
|
+
status: CommentStatus.optional(),
|
|
63
|
+
/** true = only comments carrying an unresolved report, false = only those
|
|
64
|
+
* carrying none. `z.stringbool` because query values arrive as strings and
|
|
65
|
+
* `z.coerce.boolean()` would read "false" as true. */
|
|
66
|
+
reported: z.stringbool().optional(),
|
|
67
|
+
courseId: z.string().optional(),
|
|
68
|
+
activityId: z.string().optional(),
|
|
69
|
+
/** Scope to one author (org_users.id). */
|
|
70
|
+
orgUserId: z.string().optional()
|
|
71
|
+
});
|
|
72
|
+
const CommentsPage = paginated(CommentListItem);
|
|
73
|
+
const DiscussionActivityParam = z.object({ activityId: z.string() });
|
|
74
|
+
const CommentIdParam = z.object({ commentId: z.string() });
|
|
75
|
+
//#endregion
|
|
76
|
+
export { ActivityComments, Comment, CommentAuthor, CommentIdParam, CommentListItem, CommentReactions, CommentReport, CommentReportSummary, CommentSettings, CommentStatus, CommentView, CommentsConfig, CommentsPage, CommentsQuery, DiscussionActivityParam, EditComment, PatchComment, PostComment, ReactionCounts, ReactionEmoji, ReplyToComment, ReportComment, SetCommentReaction };
|
|
77
|
+
|
|
78
|
+
//# sourceMappingURL=discussion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discussion.js","names":[],"sources":["../../../src/http/schemas/discussion.ts"],"sourcesContent":["// Discussion resource schemas. Comments attach to an activity; settings are\n// per course, with a per-activity override carried on the activity's own\n// settings blob rather than a resource of its own.\n//\n// The author is the org user's profile minus its email — learners read each\n// other's comments and the list must not be a directory of the cohort's\n// addresses. The staff-facing comment list carries `authorEmail` separately.\nimport type { CommentSettings as DomainCommentSettings } from \"@headless-lms/core/types\";\nimport {\n commentAuthorSchema,\n commentListItemSchema,\n commentReportSummarySchema,\n commentSchema,\n commentStatusSchema,\n commentViewSchema,\n} from \"@headless-lms/core/schemas\";\nimport { z } from \"zod\";\nimport { ListQuery, type Matches, paginated } from \"./shared.js\";\n\nexport const CommentStatus = commentStatusSchema;\nexport type CommentStatus = z.infer<typeof CommentStatus>;\n\nexport const CommentAuthor = commentAuthorSchema;\nexport type CommentAuthor = z.infer<typeof CommentAuthor>;\n\n/** Any single emoji. Open, so widening the picker needs no schema change. */\nexport const ReactionEmoji = z.string().min(1).max(16);\nexport type ReactionEmoji = z.infer<typeof ReactionEmoji>;\n\n/** Counts by emoji; unused ones are absent, so no reactions serves `{}`. */\nexport const ReactionCounts = z.record(z.string(), z.number().int());\nexport type ReactionCounts = z.infer<typeof ReactionCounts>;\n\nexport const CommentView = commentViewSchema;\nexport type CommentView = z.infer<typeof CommentView>;\n\n/** What the reaction write returns, so the client never recomputes a count. */\nexport const CommentReactions = z.object({\n reactions: ReactionCounts,\n viewerReaction: ReactionEmoji.optional(),\n});\nexport type CommentReactions = z.infer<typeof CommentReactions>;\n\n/** A course's comment settings. Stored under the course, carried on the course\n * payload as `settings.comments`. */\nexport const CommentSettings = z.object({\n enabled: z.boolean(),\n threaded: z.boolean(),\n requireReview: z.boolean(),\n reactions: z.boolean(),\n});\nexport type CommentSettings = z.infer<typeof CommentSettings>;\ntype _CommentSettingsMatchesDomain = Matches<DomainCommentSettings, CommentSettings> &\n Matches<CommentSettings, DomainCommentSettings>;\n\n/** The course settings with the activity's override applied: `enabled` is the\n * resolved answer for this activity, not the course switch. */\nexport const CommentsConfig = CommentSettings;\nexport type CommentsConfig = z.infer<typeof CommentsConfig>;\n\nexport const ActivityComments = z.object({\n config: CommentsConfig,\n comments: z.array(CommentView),\n});\nexport type ActivityComments = z.infer<typeof ActivityComments>;\n\nexport const PostComment = z.object({\n body: z.string().min(1).max(10_000),\n parentId: z.string().nullable().default(null),\n});\nexport type PostComment = z.infer<typeof PostComment>;\n\nexport const EditComment = z.object({\n body: z.string().min(1).max(10_000),\n});\nexport type EditComment = z.infer<typeof EditComment>;\n\n/** The staff PATCH writes status and nothing else: publishing covers approving\n * a pending comment and restoring a removed one. Revising the text is the\n * author's own edit, under /api/learn. */\nexport const PatchComment = z.object({\n status: z.literal(\"published\"),\n});\nexport type PatchComment = z.infer<typeof PatchComment>;\n\n/** Replaces whatever the reader had. Clearing is DELETE, which carries no body. */\nexport const SetCommentReaction = z.object({\n emoji: ReactionEmoji,\n});\nexport type SetCommentReaction = z.infer<typeof SetCommentReaction>;\n\n/** A moderator's reply, posted from the queue against the comment it answers. */\nexport const ReplyToComment = z.object({\n body: z.string().min(1).max(10_000),\n});\nexport type ReplyToComment = z.infer<typeof ReplyToComment>;\n\nexport const ReportComment = z.object({\n reason: z.string().max(1_000).default(\"\"),\n});\nexport type ReportComment = z.infer<typeof ReportComment>;\n\nexport const Comment = commentSchema;\nexport type Comment = z.infer<typeof Comment>;\n\nexport const CommentReport = z.object({\n id: z.string(),\n commentId: z.string(),\n orgUserId: z.string(),\n reason: z.string(),\n resolvedAt: z.date().nullable(),\n createdAt: z.date(),\n});\nexport type CommentReport = z.infer<typeof CommentReport>;\n\n/** An unresolved report on a listed comment. Resolved ones are history and are\n * never served here. */\nexport const CommentReportSummary = commentReportSummarySchema;\nexport type CommentReportSummary = z.infer<typeof CommentReportSummary>;\n\n/** One row of the staff comment list: the comment plus the context a\n * moderation decision needs, so the list needs no follow-up request. */\nexport const CommentListItem = commentListItemSchema;\nexport type CommentListItem = z.infer<typeof CommentListItem>;\n\nexport const CommentsQuery = ListQuery.extend({\n status: CommentStatus.optional(),\n /** true = only comments carrying an unresolved report, false = only those\n * carrying none. `z.stringbool` because query values arrive as strings and\n * `z.coerce.boolean()` would read \"false\" as true. */\n reported: z.stringbool().optional(),\n courseId: z.string().optional(),\n activityId: z.string().optional(),\n /** Scope to one author (org_users.id). */\n orgUserId: z.string().optional(),\n});\nexport type CommentsQuery = z.infer<typeof CommentsQuery>;\n\nexport const CommentsPage = paginated(CommentListItem);\nexport type CommentsPage = z.infer<typeof CommentsPage>;\n\nexport const DiscussionActivityParam = z.object({ activityId: z.string() });\nexport type DiscussionActivityParam = z.infer<typeof DiscussionActivityParam>;\n\nexport const CommentIdParam = z.object({ commentId: z.string() });\nexport type CommentIdParam = z.infer<typeof CommentIdParam>;\n\n"],"mappings":";;;;AAmBA,MAAa,gBAAgB;AAG7B,MAAa,gBAAgB;;AAI7B,MAAa,gBAAgB,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE;;AAIrD,MAAa,iBAAiB,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;AAGnE,MAAa,cAAc;;AAI3B,MAAa,mBAAmB,EAAE,OAAO;CACvC,WAAW;CACX,gBAAgB,cAAc,SAAS;AACzC,CAAC;;;AAKD,MAAa,kBAAkB,EAAE,OAAO;CACtC,SAAS,EAAE,QAAQ;CACnB,UAAU,EAAE,QAAQ;CACpB,eAAe,EAAE,QAAQ;CACzB,WAAW,EAAE,QAAQ;AACvB,CAAC;;;AAOD,MAAa,iBAAiB;AAG9B,MAAa,mBAAmB,EAAE,OAAO;CACvC,QAAQ;CACR,UAAU,EAAE,MAAM,WAAW;AAC/B,CAAC;AAGD,MAAa,cAAc,EAAE,OAAO;CAClC,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAM;CAClC,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,IAAI;AAC9C,CAAC;AAGD,MAAa,cAAc,EAAE,OAAO,EAClC,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAM,EACpC,CAAC;;;;AAMD,MAAa,eAAe,EAAE,OAAO,EACnC,QAAQ,EAAE,QAAQ,WAAW,EAC/B,CAAC;;AAID,MAAa,qBAAqB,EAAE,OAAO,EACzC,OAAO,cACT,CAAC;;AAID,MAAa,iBAAiB,EAAE,OAAO,EACrC,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAM,EACpC,CAAC;AAGD,MAAa,gBAAgB,EAAE,OAAO,EACpC,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,GAAK,CAAC,CAAC,QAAQ,EAAE,EAC1C,CAAC;AAGD,MAAa,UAAU;AAGvB,MAAa,gBAAgB,EAAE,OAAO;CACpC,IAAI,EAAE,OAAO;CACb,WAAW,EAAE,OAAO;CACpB,WAAW,EAAE,OAAO;CACpB,QAAQ,EAAE,OAAO;CACjB,YAAY,EAAE,KAAK,CAAC,CAAC,SAAS;CAC9B,WAAW,EAAE,KAAK;AACpB,CAAC;;;AAKD,MAAa,uBAAuB;;;AAKpC,MAAa,kBAAkB;AAG/B,MAAa,gBAAgB,UAAU,OAAO;CAC5C,QAAQ,cAAc,SAAS;;;;CAI/B,UAAU,EAAE,WAAW,CAAC,CAAC,SAAS;CAClC,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS;CAC9B,YAAY,EAAE,OAAO,CAAC,CAAC,SAAS;;CAEhC,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;AACjC,CAAC;AAGD,MAAa,eAAe,UAAU,eAAe;AAGrD,MAAa,0BAA0B,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC;AAG1E,MAAa,iBAAiB,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/http/schemas/downloads.d.ts
|
|
3
|
+
declare const DownloadStatus: z.ZodEnum<{
|
|
4
|
+
draft: "draft";
|
|
5
|
+
published: "published";
|
|
6
|
+
}>;
|
|
7
|
+
type DownloadStatus = z.infer<typeof DownloadStatus>;
|
|
8
|
+
declare const Download: z.ZodObject<{
|
|
9
|
+
orgId: z.ZodString;
|
|
10
|
+
id: z.ZodString;
|
|
11
|
+
type: z.ZodLiteral<"download">;
|
|
12
|
+
title: z.ZodString;
|
|
13
|
+
slug: z.ZodString;
|
|
14
|
+
description: z.ZodString;
|
|
15
|
+
status: z.ZodEnum<{
|
|
16
|
+
draft: "draft";
|
|
17
|
+
published: "published";
|
|
18
|
+
}>;
|
|
19
|
+
category: z.ZodString;
|
|
20
|
+
thumbnailAssetId: z.ZodNullable<z.ZodString>;
|
|
21
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
22
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
23
|
+
}, z.core.$strict>;
|
|
24
|
+
type Download = z.infer<typeof Download>;
|
|
25
|
+
declare const DownloadAsset: z.ZodObject<{
|
|
26
|
+
orgId: z.ZodString;
|
|
27
|
+
id: z.ZodString;
|
|
28
|
+
downloadId: z.ZodString;
|
|
29
|
+
assetId: z.ZodString;
|
|
30
|
+
seq: z.ZodNumber;
|
|
31
|
+
displayName: z.ZodNullable<z.ZodString>;
|
|
32
|
+
}, z.core.$strict>;
|
|
33
|
+
type DownloadAsset = z.infer<typeof DownloadAsset>;
|
|
34
|
+
declare const CreateDownload: z.ZodObject<{
|
|
35
|
+
title: z.ZodString;
|
|
36
|
+
description: z.ZodDefault<z.ZodString>;
|
|
37
|
+
category: z.ZodDefault<z.ZodString>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
type CreateDownload = z.infer<typeof CreateDownload>;
|
|
40
|
+
declare const UpdateDownload: z.ZodObject<{
|
|
41
|
+
title: z.ZodOptional<z.ZodString>;
|
|
42
|
+
description: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
43
|
+
category: z.ZodOptional<z.ZodDefault<z.ZodString>>;
|
|
44
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
45
|
+
draft: "draft";
|
|
46
|
+
published: "published";
|
|
47
|
+
}>>;
|
|
48
|
+
thumbnailAssetId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
type UpdateDownload = z.infer<typeof UpdateDownload>;
|
|
51
|
+
declare const DownloadsQuery: z.ZodObject<{
|
|
52
|
+
page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
53
|
+
pageSize: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
54
|
+
search: z.ZodOptional<z.ZodString>;
|
|
55
|
+
sort: z.ZodOptional<z.ZodString>;
|
|
56
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
57
|
+
draft: "draft";
|
|
58
|
+
published: "published";
|
|
59
|
+
}>>;
|
|
60
|
+
category: z.ZodOptional<z.ZodString>;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
type DownloadsQuery = z.infer<typeof DownloadsQuery>;
|
|
63
|
+
declare const DownloadsPage: z.ZodObject<{
|
|
64
|
+
rows: z.ZodArray<z.ZodObject<{
|
|
65
|
+
orgId: z.ZodString;
|
|
66
|
+
id: z.ZodString;
|
|
67
|
+
type: z.ZodLiteral<"download">;
|
|
68
|
+
title: z.ZodString;
|
|
69
|
+
slug: z.ZodString;
|
|
70
|
+
description: z.ZodString;
|
|
71
|
+
status: z.ZodEnum<{
|
|
72
|
+
draft: "draft";
|
|
73
|
+
published: "published";
|
|
74
|
+
}>;
|
|
75
|
+
category: z.ZodString;
|
|
76
|
+
thumbnailAssetId: z.ZodNullable<z.ZodString>;
|
|
77
|
+
createdAt: z.ZodCoercedDate<unknown>;
|
|
78
|
+
updatedAt: z.ZodCoercedDate<unknown>;
|
|
79
|
+
}, z.core.$strict>>;
|
|
80
|
+
total: z.ZodNumber;
|
|
81
|
+
page: z.ZodNumber;
|
|
82
|
+
pageSize: z.ZodNumber;
|
|
83
|
+
}, z.core.$strip>;
|
|
84
|
+
type DownloadsPage = z.infer<typeof DownloadsPage>;
|
|
85
|
+
declare const AddDownloadAsset: z.ZodObject<{
|
|
86
|
+
assetId: z.ZodString;
|
|
87
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
88
|
+
}, z.core.$strict>;
|
|
89
|
+
type AddDownloadAsset = z.infer<typeof AddDownloadAsset>;
|
|
90
|
+
/** `null` restores the `filename` fallback. */
|
|
91
|
+
declare const RenameDownloadAsset: z.ZodObject<{
|
|
92
|
+
displayName: z.ZodNullable<z.ZodString>;
|
|
93
|
+
}, z.core.$strip>;
|
|
94
|
+
type RenameDownloadAsset = z.infer<typeof RenameDownloadAsset>;
|
|
95
|
+
declare const ReorderDownloadAssets: z.ZodObject<{
|
|
96
|
+
assetIds: z.ZodArray<z.ZodString>;
|
|
97
|
+
}, z.core.$strict>;
|
|
98
|
+
type ReorderDownloadAssets = z.infer<typeof ReorderDownloadAssets>;
|
|
99
|
+
declare const DownloadIdParam: z.ZodObject<{
|
|
100
|
+
downloadId: z.ZodString;
|
|
101
|
+
}, z.core.$strip>;
|
|
102
|
+
type DownloadIdParam = z.infer<typeof DownloadIdParam>;
|
|
103
|
+
declare const DownloadAssetParams: z.ZodObject<{
|
|
104
|
+
downloadId: z.ZodString;
|
|
105
|
+
assetId: z.ZodString;
|
|
106
|
+
}, z.core.$strip>;
|
|
107
|
+
type DownloadAssetParams = z.infer<typeof DownloadAssetParams>;
|
|
108
|
+
//#endregion
|
|
109
|
+
export { AddDownloadAsset, CreateDownload, Download, DownloadAsset, DownloadAssetParams, DownloadIdParam, DownloadStatus, DownloadsPage, DownloadsQuery, RenameDownloadAsset, ReorderDownloadAssets, UpdateDownload };
|
|
110
|
+
//# sourceMappingURL=downloads.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ListQuery, paginated } from "./shared.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { addDownloadAssetInputSchema, downloadAssetSchema, downloadSchema, downloadStatusSchema, reorderDownloadAssetsInputSchema } from "@headless-lms/core/schemas";
|
|
4
|
+
//#region src/http/schemas/downloads.ts
|
|
5
|
+
const DownloadStatus = downloadStatusSchema;
|
|
6
|
+
const Download = downloadSchema;
|
|
7
|
+
const DownloadAsset = downloadAssetSchema;
|
|
8
|
+
const CreateDownload = z.object({
|
|
9
|
+
title: z.string().min(1),
|
|
10
|
+
description: z.string().default(""),
|
|
11
|
+
category: z.string().default("")
|
|
12
|
+
});
|
|
13
|
+
const UpdateDownload = CreateDownload.partial().extend({
|
|
14
|
+
status: DownloadStatus.optional(),
|
|
15
|
+
thumbnailAssetId: z.string().nullable().optional()
|
|
16
|
+
});
|
|
17
|
+
const DownloadsQuery = ListQuery.extend({
|
|
18
|
+
status: DownloadStatus.optional(),
|
|
19
|
+
category: z.string().optional()
|
|
20
|
+
});
|
|
21
|
+
const DownloadsPage = paginated(Download);
|
|
22
|
+
const AddDownloadAsset = addDownloadAssetInputSchema;
|
|
23
|
+
/** `null` restores the `filename` fallback. */
|
|
24
|
+
const RenameDownloadAsset = z.object({ displayName: z.string().nullable() });
|
|
25
|
+
const ReorderDownloadAssets = reorderDownloadAssetsInputSchema;
|
|
26
|
+
const DownloadIdParam = z.object({ downloadId: z.string() });
|
|
27
|
+
const DownloadAssetParams = z.object({
|
|
28
|
+
downloadId: z.string(),
|
|
29
|
+
assetId: z.string()
|
|
30
|
+
});
|
|
31
|
+
//#endregion
|
|
32
|
+
export { AddDownloadAsset, CreateDownload, Download, DownloadAsset, DownloadAssetParams, DownloadIdParam, DownloadStatus, DownloadsPage, DownloadsQuery, RenameDownloadAsset, ReorderDownloadAssets, UpdateDownload };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=downloads.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"downloads.js","names":[],"sources":["../../../src/http/schemas/downloads.ts"],"sourcesContent":["// Downloads resource schemas — a content type whose whole structure is an\n// ordered set of media-library assets. The Fastify routes validate\n// requests/responses against these, the OpenAPI spec is built from them, and\n// the frontend SDK is generated off that spec.\nimport { z } from \"zod\";\nimport {\n addDownloadAssetInputSchema,\n downloadAssetSchema,\n downloadSchema,\n downloadStatusSchema,\n reorderDownloadAssetsInputSchema,\n} from \"@headless-lms/core/schemas\";\nimport { ListQuery, paginated } from \"./shared.js\";\n\nexport const DownloadStatus = downloadStatusSchema;\nexport type DownloadStatus = z.infer<typeof DownloadStatus>;\n\nexport const Download = downloadSchema;\nexport type Download = z.infer<typeof Download>;\n\nexport const DownloadAsset = downloadAssetSchema;\nexport type DownloadAsset = z.infer<typeof DownloadAsset>;\n\nexport const CreateDownload = z.object({\n title: z.string().min(1),\n description: z.string().default(\"\"),\n category: z.string().default(\"\"),\n});\nexport type CreateDownload = z.infer<typeof CreateDownload>;\n\nexport const UpdateDownload = CreateDownload.partial().extend({\n status: DownloadStatus.optional(),\n thumbnailAssetId: z.string().nullable().optional(),\n});\nexport type UpdateDownload = z.infer<typeof UpdateDownload>;\n\nexport const DownloadsQuery = ListQuery.extend({\n status: DownloadStatus.optional(),\n category: z.string().optional(),\n});\nexport type DownloadsQuery = z.infer<typeof DownloadsQuery>;\n\nexport const DownloadsPage = paginated(Download);\nexport type DownloadsPage = z.infer<typeof DownloadsPage>;\n\nexport const AddDownloadAsset = addDownloadAssetInputSchema;\nexport type AddDownloadAsset = z.infer<typeof AddDownloadAsset>;\n\n/** `null` restores the `filename` fallback. */\nexport const RenameDownloadAsset = z.object({\n displayName: z.string().nullable(),\n});\nexport type RenameDownloadAsset = z.infer<typeof RenameDownloadAsset>;\n\nexport const ReorderDownloadAssets = reorderDownloadAssetsInputSchema;\nexport type ReorderDownloadAssets = z.infer<typeof ReorderDownloadAssets>;\n\nexport const DownloadIdParam = z.object({ downloadId: z.string() });\nexport type DownloadIdParam = z.infer<typeof DownloadIdParam>;\n\nexport const DownloadAssetParams = z.object({\n downloadId: z.string(),\n assetId: z.string(),\n});\nexport type DownloadAssetParams = z.infer<typeof DownloadAssetParams>;\n"],"mappings":";;;;AAcA,MAAa,iBAAiB;AAG9B,MAAa,WAAW;AAGxB,MAAa,gBAAgB;AAG7B,MAAa,iBAAiB,EAAE,OAAO;CACrC,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CACvB,aAAa,EAAE,OAAO,CAAC,CAAC,QAAQ,EAAE;CAClC,UAAU,EAAE,OAAO,CAAC,CAAC,QAAQ,EAAE;AACjC,CAAC;AAGD,MAAa,iBAAiB,eAAe,QAAQ,CAAC,CAAC,OAAO;CAC5D,QAAQ,eAAe,SAAS;CAChC,kBAAkB,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;AACnD,CAAC;AAGD,MAAa,iBAAiB,UAAU,OAAO;CAC7C,QAAQ,eAAe,SAAS;CAChC,UAAU,EAAE,OAAO,CAAC,CAAC,SAAS;AAChC,CAAC;AAGD,MAAa,gBAAgB,UAAU,QAAQ;AAG/C,MAAa,mBAAmB;;AAIhC,MAAa,sBAAsB,EAAE,OAAO,EAC1C,aAAa,EAAE,OAAO,CAAC,CAAC,SAAS,EACnC,CAAC;AAGD,MAAa,wBAAwB;AAGrC,MAAa,kBAAkB,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,CAAC;AAGlE,MAAa,sBAAsB,EAAE,OAAO;CAC1C,YAAY,EAAE,OAAO;CACrB,SAAS,EAAE,OAAO;AACpB,CAAC"}
|