@headless-lms/server 0.3.0 → 0.5.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 (228) hide show
  1. package/README.md +14 -0
  2. package/dist/app/community-mail.d.ts +10 -10
  3. package/dist/app/community-mail.js +72 -28
  4. package/dist/app/community-mail.js.map +1 -1
  5. package/dist/app/container.d.ts +48 -10
  6. package/dist/app/container.js +268 -48
  7. package/dist/app/container.js.map +1 -1
  8. package/dist/app/notification-channels.d.ts +47 -0
  9. package/dist/app/notification-channels.js +175 -0
  10. package/dist/app/notification-channels.js.map +1 -0
  11. package/dist/app/notification-reads.d.ts +23 -0
  12. package/dist/app/notification-reads.js +74 -0
  13. package/dist/app/notification-reads.js.map +1 -0
  14. package/dist/app/platform.d.ts +14 -0
  15. package/dist/app/platform.js +14 -0
  16. package/dist/app/platform.js.map +1 -0
  17. package/dist/http/config.d.ts +4 -0
  18. package/dist/http/errors.d.ts +1 -0
  19. package/dist/http/errors.js +24 -4
  20. package/dist/http/errors.js.map +1 -1
  21. package/dist/http/fastify.d.ts +8 -0
  22. package/dist/http/mcp/catalogue.d.ts +11 -9
  23. package/dist/http/mcp/catalogue.js +15 -21
  24. package/dist/http/mcp/catalogue.js.map +1 -1
  25. package/dist/http/mcp/challenge.js +3 -3
  26. package/dist/http/mcp/challenge.js.map +1 -1
  27. package/dist/http/mcp/route.js +7 -7
  28. package/dist/http/mcp/route.js.map +1 -1
  29. package/dist/http/mcp/test-support.d.ts +6 -5
  30. package/dist/http/mcp/test-support.js +32 -11
  31. package/dist/http/mcp/test-support.js.map +1 -1
  32. package/dist/http/mcp/tool.d.ts +3 -9
  33. package/dist/http/mcp/tool.js +14 -6
  34. package/dist/http/mcp/tool.js.map +1 -1
  35. package/dist/http/mcp/tools/automations.js +10 -20
  36. package/dist/http/mcp/tools/automations.js.map +1 -1
  37. package/dist/http/mcp/tools/catalog.js +25 -42
  38. package/dist/http/mcp/tools/catalog.js.map +1 -1
  39. package/dist/http/mcp/tools/comments.js +9 -19
  40. package/dist/http/mcp/tools/comments.js.map +1 -1
  41. package/dist/http/mcp/tools/communities.js +16 -31
  42. package/dist/http/mcp/tools/communities.js.map +1 -1
  43. package/dist/http/mcp/tools/community-members.js +9 -16
  44. package/dist/http/mcp/tools/community-members.js.map +1 -1
  45. package/dist/http/mcp/tools/community-moderation.js +13 -25
  46. package/dist/http/mcp/tools/community-moderation.js.map +1 -1
  47. package/dist/http/mcp/tools/courses.js +11 -21
  48. package/dist/http/mcp/tools/courses.js.map +1 -1
  49. package/dist/http/mcp/tools/events.d.ts +6 -0
  50. package/dist/http/mcp/tools/events.js +170 -0
  51. package/dist/http/mcp/tools/events.js.map +1 -0
  52. package/dist/http/mcp/tools/index.d.ts +5 -1
  53. package/dist/http/mcp/tools/index.js +45 -10
  54. package/dist/http/mcp/tools/index.js.map +1 -1
  55. package/dist/http/mcp/tools/organization.d.ts +6 -0
  56. package/dist/http/mcp/tools/organization.js +214 -0
  57. package/dist/http/mcp/tools/organization.js.map +1 -0
  58. package/dist/http/mcp/tools/people.js +30 -49
  59. package/dist/http/mcp/tools/people.js.map +1 -1
  60. package/dist/http/plugins/auth.js +37 -8
  61. package/dist/http/plugins/auth.js.map +1 -1
  62. package/dist/http/plugins/error-handler.d.ts +5 -1
  63. package/dist/http/plugins/error-handler.js +13 -3
  64. package/dist/http/plugins/error-handler.js.map +1 -1
  65. package/dist/http/plugins/openapi.js +18 -2
  66. package/dist/http/plugins/openapi.js.map +1 -1
  67. package/dist/http/plugins/platform.d.ts +7 -0
  68. package/dist/http/plugins/platform.js +13 -0
  69. package/dist/http/plugins/platform.js.map +1 -0
  70. package/dist/http/routes/access.js +54 -36
  71. package/dist/http/routes/access.js.map +1 -1
  72. package/dist/http/routes/activities.js +45 -45
  73. package/dist/http/routes/activities.js.map +1 -1
  74. package/dist/http/routes/assets.js +30 -65
  75. package/dist/http/routes/assets.js.map +1 -1
  76. package/dist/http/routes/automations.js +37 -42
  77. package/dist/http/routes/automations.js.map +1 -1
  78. package/dist/http/routes/bundles.js +33 -36
  79. package/dist/http/routes/bundles.js.map +1 -1
  80. package/dist/http/routes/communities.js +144 -136
  81. package/dist/http/routes/communities.js.map +1 -1
  82. package/dist/http/routes/community-moderation.js +83 -137
  83. package/dist/http/routes/community-moderation.js.map +1 -1
  84. package/dist/http/routes/course-analytics.js +32 -15
  85. package/dist/http/routes/course-analytics.js.map +1 -1
  86. package/dist/http/routes/courses.js +25 -32
  87. package/dist/http/routes/courses.js.map +1 -1
  88. package/dist/http/routes/dashboard.js +9 -9
  89. package/dist/http/routes/dashboard.js.map +1 -1
  90. package/dist/http/routes/discussion.js +21 -39
  91. package/dist/http/routes/discussion.js.map +1 -1
  92. package/dist/http/routes/downloads.js +41 -47
  93. package/dist/http/routes/downloads.js.map +1 -1
  94. package/dist/http/routes/entitlements.js +19 -23
  95. package/dist/http/routes/entitlements.js.map +1 -1
  96. package/dist/http/routes/events.d.ts +7 -0
  97. package/dist/http/routes/events.js +333 -0
  98. package/dist/http/routes/events.js.map +1 -0
  99. package/dist/http/routes/integrations.js +40 -73
  100. package/dist/http/routes/integrations.js.map +1 -1
  101. package/dist/http/routes/member/assets.js +10 -13
  102. package/dist/http/routes/member/assets.js.map +1 -1
  103. package/dist/http/routes/member/chats.js +177 -75
  104. package/dist/http/routes/member/chats.js.map +1 -1
  105. package/dist/http/routes/member/comments.js +65 -26
  106. package/dist/http/routes/member/comments.js.map +1 -1
  107. package/dist/http/routes/member/community.js +68 -51
  108. package/dist/http/routes/member/community.js.map +1 -1
  109. package/dist/http/routes/member/courses.js +12 -19
  110. package/dist/http/routes/member/courses.js.map +1 -1
  111. package/dist/http/routes/member/devices.d.ts +7 -0
  112. package/dist/http/routes/member/devices.js +97 -0
  113. package/dist/http/routes/member/devices.js.map +1 -0
  114. package/dist/http/routes/member/downloads.js +6 -9
  115. package/dist/http/routes/member/downloads.js.map +1 -1
  116. package/dist/http/routes/member/events.d.ts +7 -0
  117. package/dist/http/routes/member/events.js +386 -0
  118. package/dist/http/routes/member/events.js.map +1 -0
  119. package/dist/http/routes/member/files.js +71 -46
  120. package/dist/http/routes/member/files.js.map +1 -1
  121. package/dist/http/routes/member/index.js +6 -0
  122. package/dist/http/routes/member/index.js.map +1 -1
  123. package/dist/http/routes/member/notification-settings.d.ts +7 -0
  124. package/dist/http/routes/member/notification-settings.js +100 -0
  125. package/dist/http/routes/member/notification-settings.js.map +1 -0
  126. package/dist/http/routes/member/notifications.js +69 -45
  127. package/dist/http/routes/member/notifications.js.map +1 -1
  128. package/dist/http/routes/member/org.js +5 -15
  129. package/dist/http/routes/member/org.js.map +1 -1
  130. package/dist/http/routes/member/posts.js +94 -95
  131. package/dist/http/routes/member/posts.js.map +1 -1
  132. package/dist/http/routes/member/profile.js +15 -6
  133. package/dist/http/routes/member/profile.js.map +1 -1
  134. package/dist/http/routes/member/progress.js +7 -11
  135. package/dist/http/routes/member/progress.js.map +1 -1
  136. package/dist/http/routes/organizations.js +415 -110
  137. package/dist/http/routes/organizations.js.map +1 -1
  138. package/dist/http/routes/platform.d.ts +7 -0
  139. package/dist/http/routes/platform.js +61 -0
  140. package/dist/http/routes/platform.js.map +1 -0
  141. package/dist/http/routes/students.js +12 -75
  142. package/dist/http/routes/students.js.map +1 -1
  143. package/dist/http/routes/webhooks.js +30 -39
  144. package/dist/http/routes/webhooks.js.map +1 -1
  145. package/dist/http/routes.js +9 -0
  146. package/dist/http/routes.js.map +1 -1
  147. package/dist/http/schemas/access.d.ts +346 -64
  148. package/dist/http/schemas/access.js +39 -12
  149. package/dist/http/schemas/access.js.map +1 -1
  150. package/dist/http/schemas/assets.d.ts +13 -8
  151. package/dist/http/schemas/assets.js +6 -5
  152. package/dist/http/schemas/assets.js.map +1 -1
  153. package/dist/http/schemas/automations.d.ts +4 -8
  154. package/dist/http/schemas/chats.d.ts +238 -36
  155. package/dist/http/schemas/chats.js +14 -7
  156. package/dist/http/schemas/chats.js.map +1 -1
  157. package/dist/http/schemas/community.d.ts +140 -33
  158. package/dist/http/schemas/community.js +25 -9
  159. package/dist/http/schemas/community.js.map +1 -1
  160. package/dist/http/schemas/course-analytics.d.ts +51 -1
  161. package/dist/http/schemas/course-analytics.js +19 -1
  162. package/dist/http/schemas/course-analytics.js.map +1 -1
  163. package/dist/http/schemas/dashboard.d.ts +1 -0
  164. package/dist/http/schemas/dashboard.js +2 -1
  165. package/dist/http/schemas/dashboard.js.map +1 -1
  166. package/dist/http/schemas/discussion.d.ts +45 -73
  167. package/dist/http/schemas/discussion.js +16 -4
  168. package/dist/http/schemas/discussion.js.map +1 -1
  169. package/dist/http/schemas/entitlements.d.ts +9 -12
  170. package/dist/http/schemas/entitlements.js +11 -5
  171. package/dist/http/schemas/entitlements.js.map +1 -1
  172. package/dist/http/schemas/events.d.ts +527 -0
  173. package/dist/http/schemas/events.js +64 -0
  174. package/dist/http/schemas/events.js.map +1 -0
  175. package/dist/http/schemas/files.d.ts +15 -5
  176. package/dist/http/schemas/files.js +10 -2
  177. package/dist/http/schemas/files.js.map +1 -1
  178. package/dist/http/schemas/index.d.ts +14 -12
  179. package/dist/http/schemas/index.js +14 -12
  180. package/dist/http/schemas/invites.d.ts +3 -47
  181. package/dist/http/schemas/invites.js +4 -25
  182. package/dist/http/schemas/invites.js.map +1 -1
  183. package/dist/http/schemas/member.d.ts +94 -7
  184. package/dist/http/schemas/member.js +7 -3
  185. package/dist/http/schemas/member.js.map +1 -1
  186. package/dist/http/schemas/members.d.ts +329 -65
  187. package/dist/http/schemas/members.js +67 -25
  188. package/dist/http/schemas/members.js.map +1 -1
  189. package/dist/http/schemas/notifications.d.ts +502 -175
  190. package/dist/http/schemas/notifications.js +148 -28
  191. package/dist/http/schemas/notifications.js.map +1 -1
  192. package/dist/http/schemas/platform.d.ts +37 -0
  193. package/dist/http/schemas/platform.js +19 -0
  194. package/dist/http/schemas/platform.js.map +1 -0
  195. package/dist/http/schemas/posts.d.ts +92 -38
  196. package/dist/http/schemas/posts.js +4 -4
  197. package/dist/http/schemas/posts.js.map +1 -1
  198. package/dist/http/schemas/profile.d.ts +1 -1
  199. package/dist/http/schemas/shared.d.ts +10 -13
  200. package/dist/http/schemas/shared.js +3 -11
  201. package/dist/http/schemas/shared.js.map +1 -1
  202. package/dist/http/schemas/students.d.ts +22 -0
  203. package/dist/http/schemas/students.js +3 -1
  204. package/dist/http/schemas/students.js.map +1 -1
  205. package/dist/http/scope.d.ts +9 -12
  206. package/dist/http/scope.js +30 -35
  207. package/dist/http/scope.js.map +1 -1
  208. package/dist/http/server.js +9 -0
  209. package/dist/http/server.js.map +1 -1
  210. package/dist/http/shutdown.d.ts +11 -0
  211. package/dist/http/shutdown.js +40 -0
  212. package/dist/http/shutdown.js.map +1 -0
  213. package/dist/http/sse.d.ts +19 -0
  214. package/dist/http/sse.js +104 -0
  215. package/dist/http/sse.js.map +1 -0
  216. package/dist/http/test-caller.d.ts +13 -0
  217. package/dist/http/test-caller.js +14 -0
  218. package/dist/http/test-caller.js.map +1 -0
  219. package/dist/http/well-known.js +2 -2
  220. package/dist/http/well-known.js.map +1 -1
  221. package/dist/index.d.ts +5 -2
  222. package/dist/index.js +4 -2
  223. package/dist/index.js.map +1 -1
  224. package/dist/packages/server/package.js +1 -1
  225. package/package.json +7 -6
  226. package/dist/http/routes/member/actor.d.ts +0 -14
  227. package/dist/http/routes/member/actor.js +0 -11
  228. package/dist/http/routes/member/actor.js.map +0 -1
@@ -1 +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"}
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 upcomingEvents: z.number().int().describe('Published events that have not ended'),\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;CAC7B,gBAAgB,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,sCAAsC;AAClF,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"}
@@ -15,13 +15,8 @@ declare const CommentAuthor: z.ZodObject<{
15
15
  image: z.ZodNullable<z.ZodString>;
16
16
  imageAssetId: z.ZodNullable<z.ZodString>;
17
17
  imageUrl: z.ZodNullable<z.ZodString>;
18
- role: z.ZodEnum<{
19
- owner: "owner";
20
- admin: "admin";
21
- instructor: "instructor";
22
- moderator: "moderator";
23
- student: "student";
24
- }>;
18
+ team: z.ZodBoolean;
19
+ roleName: z.ZodNullable<z.ZodString>;
25
20
  }, z.core.$strict>;
26
21
  type CommentAuthor = z.infer<typeof CommentAuthor>;
27
22
  /** Any single emoji. Open, so widening the picker needs no schema change. */
@@ -30,6 +25,20 @@ type ReactionEmoji = z.infer<typeof ReactionEmoji>;
30
25
  /** Counts by emoji; unused ones are absent, so no reactions serves `{}`. */
31
26
  declare const ReactionCounts: z.ZodRecord<z.ZodString, z.ZodNumber>;
32
27
  type ReactionCounts = z.infer<typeof ReactionCounts>;
28
+ declare const SetPostSubscription: z.ZodDiscriminatedUnion<[z.ZodObject<{
29
+ state: z.ZodLiteral<"following">;
30
+ }, z.core.$strict>, z.ZodObject<{
31
+ state: z.ZodLiteral<"muted">;
32
+ mutedUntil: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodISODateTime, z.ZodCoercedDate<string>>>>;
33
+ }, z.core.$strict>, z.ZodObject<{
34
+ state: z.ZodLiteral<"none">;
35
+ }, z.core.$strict>], "state">;
36
+ declare const SetMute: z.ZodDiscriminatedUnion<[z.ZodObject<{
37
+ state: z.ZodLiteral<"muted">;
38
+ mutedUntil: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodISODateTime, z.ZodCoercedDate<string>>>>;
39
+ }, z.core.$strict>, z.ZodObject<{
40
+ state: z.ZodLiteral<"none">;
41
+ }, z.core.$strict>], "state">;
33
42
  declare const CommentView: z.ZodObject<{
34
43
  id: z.ZodString;
35
44
  activityId: z.ZodNullable<z.ZodString>;
@@ -45,13 +54,8 @@ declare const CommentView: z.ZodObject<{
45
54
  image: z.ZodNullable<z.ZodString>;
46
55
  imageAssetId: z.ZodNullable<z.ZodString>;
47
56
  imageUrl: z.ZodNullable<z.ZodString>;
48
- role: z.ZodEnum<{
49
- owner: "owner";
50
- admin: "admin";
51
- instructor: "instructor";
52
- moderator: "moderator";
53
- student: "student";
54
- }>;
57
+ team: z.ZodBoolean;
58
+ roleName: z.ZodNullable<z.ZodString>;
55
59
  }, z.core.$strict>;
56
60
  body: z.ZodNullable<z.ZodString>;
57
61
  status: z.ZodEnum<{
@@ -68,16 +72,15 @@ declare const CommentView: z.ZodObject<{
68
72
  image: z.ZodNullable<z.ZodString>;
69
73
  imageAssetId: z.ZodNullable<z.ZodString>;
70
74
  imageUrl: z.ZodNullable<z.ZodString>;
71
- role: z.ZodEnum<{
72
- owner: "owner";
73
- admin: "admin";
74
- instructor: "instructor";
75
- moderator: "moderator";
76
- student: "student";
77
- }>;
75
+ team: z.ZodBoolean;
76
+ roleName: z.ZodNullable<z.ZodString>;
78
77
  }, z.core.$strict>>;
79
78
  reactions: z.ZodRecord<z.ZodString, z.ZodNumber>;
80
79
  viewerReaction: z.ZodOptional<z.ZodString>;
80
+ mentions: z.ZodArray<z.ZodObject<{
81
+ orgUserId: z.ZodString;
82
+ name: z.ZodString;
83
+ }, z.core.$strict>>;
81
84
  createdAt: z.ZodCoercedDate<unknown>;
82
85
  updatedAt: z.ZodCoercedDate<unknown>;
83
86
  }, z.core.$strict>;
@@ -128,13 +131,8 @@ declare const ActivityComments: z.ZodObject<{
128
131
  image: z.ZodNullable<z.ZodString>;
129
132
  imageAssetId: z.ZodNullable<z.ZodString>;
130
133
  imageUrl: z.ZodNullable<z.ZodString>;
131
- role: z.ZodEnum<{
132
- owner: "owner";
133
- admin: "admin";
134
- instructor: "instructor";
135
- moderator: "moderator";
136
- student: "student";
137
- }>;
134
+ team: z.ZodBoolean;
135
+ roleName: z.ZodNullable<z.ZodString>;
138
136
  }, z.core.$strict>;
139
137
  body: z.ZodNullable<z.ZodString>;
140
138
  status: z.ZodEnum<{
@@ -151,16 +149,15 @@ declare const ActivityComments: z.ZodObject<{
151
149
  image: z.ZodNullable<z.ZodString>;
152
150
  imageAssetId: z.ZodNullable<z.ZodString>;
153
151
  imageUrl: z.ZodNullable<z.ZodString>;
154
- role: z.ZodEnum<{
155
- owner: "owner";
156
- admin: "admin";
157
- instructor: "instructor";
158
- moderator: "moderator";
159
- student: "student";
160
- }>;
152
+ team: z.ZodBoolean;
153
+ roleName: z.ZodNullable<z.ZodString>;
161
154
  }, z.core.$strict>>;
162
155
  reactions: z.ZodRecord<z.ZodString, z.ZodNumber>;
163
156
  viewerReaction: z.ZodOptional<z.ZodString>;
157
+ mentions: z.ZodArray<z.ZodObject<{
158
+ orgUserId: z.ZodString;
159
+ name: z.ZodString;
160
+ }, z.core.$strict>>;
164
161
  createdAt: z.ZodCoercedDate<unknown>;
165
162
  updatedAt: z.ZodCoercedDate<unknown>;
166
163
  }, z.core.$strict>>;
@@ -175,7 +172,7 @@ declare const EditComment: z.ZodObject<{
175
172
  body: z.ZodString;
176
173
  }, z.core.$strict>;
177
174
  type EditComment = z.infer<typeof EditComment>;
178
- /** The staff PATCH writes status and nothing else: publishing covers approving
175
+ /** The moderator's PATCH writes status and nothing else: publishing covers approving
179
176
  * a pending comment and restoring a removed one. Revising the text is the
180
177
  * author's own edit, under /api/member. */
181
178
  declare const PatchComment: z.ZodObject<{
@@ -242,19 +239,14 @@ declare const CommentReportSummary: z.ZodObject<{
242
239
  image: z.ZodNullable<z.ZodString>;
243
240
  imageAssetId: z.ZodNullable<z.ZodString>;
244
241
  imageUrl: z.ZodNullable<z.ZodString>;
245
- role: z.ZodEnum<{
246
- owner: "owner";
247
- admin: "admin";
248
- instructor: "instructor";
249
- moderator: "moderator";
250
- student: "student";
251
- }>;
242
+ team: z.ZodBoolean;
243
+ roleName: z.ZodNullable<z.ZodString>;
252
244
  }, z.core.$strict>;
253
245
  reason: z.ZodString;
254
246
  createdAt: z.ZodCoercedDate<unknown>;
255
247
  }, z.core.$strict>;
256
248
  type CommentReportSummary = z.infer<typeof CommentReportSummary>;
257
- /** One row of the staff comment list: the comment plus the context a
249
+ /** One row of the moderation comment list: the comment plus the context a
258
250
  * moderation decision needs, so the list needs no follow-up request. */
259
251
  declare const CommentListItem: z.ZodObject<{
260
252
  id: z.ZodString;
@@ -277,13 +269,8 @@ declare const CommentListItem: z.ZodObject<{
277
269
  image: z.ZodNullable<z.ZodString>;
278
270
  imageAssetId: z.ZodNullable<z.ZodString>;
279
271
  imageUrl: z.ZodNullable<z.ZodString>;
280
- role: z.ZodEnum<{
281
- owner: "owner";
282
- admin: "admin";
283
- instructor: "instructor";
284
- moderator: "moderator";
285
- student: "student";
286
- }>;
272
+ team: z.ZodBoolean;
273
+ roleName: z.ZodNullable<z.ZodString>;
287
274
  }, z.core.$strict>;
288
275
  authorEmail: z.ZodEmail;
289
276
  removedBy: z.ZodNullable<z.ZodString>;
@@ -297,13 +284,8 @@ declare const CommentListItem: z.ZodObject<{
297
284
  image: z.ZodNullable<z.ZodString>;
298
285
  imageAssetId: z.ZodNullable<z.ZodString>;
299
286
  imageUrl: z.ZodNullable<z.ZodString>;
300
- role: z.ZodEnum<{
301
- owner: "owner";
302
- admin: "admin";
303
- instructor: "instructor";
304
- moderator: "moderator";
305
- student: "student";
306
- }>;
287
+ team: z.ZodBoolean;
288
+ roleName: z.ZodNullable<z.ZodString>;
307
289
  }, z.core.$strict>;
308
290
  reason: z.ZodString;
309
291
  createdAt: z.ZodCoercedDate<unknown>;
@@ -350,13 +332,8 @@ declare const CommentsPage: z.ZodObject<{
350
332
  image: z.ZodNullable<z.ZodString>;
351
333
  imageAssetId: z.ZodNullable<z.ZodString>;
352
334
  imageUrl: z.ZodNullable<z.ZodString>;
353
- role: z.ZodEnum<{
354
- owner: "owner";
355
- admin: "admin";
356
- instructor: "instructor";
357
- moderator: "moderator";
358
- student: "student";
359
- }>;
335
+ team: z.ZodBoolean;
336
+ roleName: z.ZodNullable<z.ZodString>;
360
337
  }, z.core.$strict>;
361
338
  authorEmail: z.ZodEmail;
362
339
  removedBy: z.ZodNullable<z.ZodString>;
@@ -370,13 +347,8 @@ declare const CommentsPage: z.ZodObject<{
370
347
  image: z.ZodNullable<z.ZodString>;
371
348
  imageAssetId: z.ZodNullable<z.ZodString>;
372
349
  imageUrl: z.ZodNullable<z.ZodString>;
373
- role: z.ZodEnum<{
374
- owner: "owner";
375
- admin: "admin";
376
- instructor: "instructor";
377
- moderator: "moderator";
378
- student: "student";
379
- }>;
350
+ team: z.ZodBoolean;
351
+ roleName: z.ZodNullable<z.ZodString>;
380
352
  }, z.core.$strict>;
381
353
  reason: z.ZodString;
382
354
  createdAt: z.ZodCoercedDate<unknown>;
@@ -398,5 +370,5 @@ declare const CommentIdParam: z.ZodObject<{
398
370
  }, z.core.$strip>;
399
371
  type CommentIdParam = z.infer<typeof CommentIdParam>;
400
372
  //#endregion
401
- export { ActivityComments, Comment, CommentAuthor, CommentIdParam, CommentListItem, CommentReport, CommentReportSummary, CommentSettings, CommentStatus, CommentView, CommentsConfig, CommentsPage, CommentsQuery, DiscussionActivityParam, EditComment, PatchComment, PostComment, ReactionCounts, ReactionEmoji, Reactions, ReplyToComment, ReportComment, ResolveCommentFlags, SetReaction };
373
+ export { ActivityComments, Comment, CommentAuthor, CommentIdParam, CommentListItem, CommentReport, CommentReportSummary, CommentSettings, CommentStatus, CommentView, CommentsConfig, CommentsPage, CommentsQuery, DiscussionActivityParam, EditComment, PatchComment, PostComment, ReactionCounts, ReactionEmoji, Reactions, ReplyToComment, ReportComment, ResolveCommentFlags, SetMute, SetPostSubscription, SetReaction };
402
374
  //# sourceMappingURL=discussion.d.ts.map
@@ -1,4 +1,4 @@
1
- import { ListQuery, paginated } from "./shared.js";
1
+ import { DateTimeInput, ListQuery, paginated } from "./shared.js";
2
2
  import { z } from "zod";
3
3
  import { commentAuthorSchema, commentFlagResolutionSchema, commentListItemSchema, commentReportSummarySchema, commentSchema, commentStatusSchema, commentViewSchema, idSchema } from "@headless-lms/core/schemas";
4
4
  //#region src/http/schemas/discussion.ts
@@ -8,6 +8,18 @@ const CommentAuthor = commentAuthorSchema;
8
8
  const ReactionEmoji = z.string().min(1).max(16);
9
9
  /** Counts by emoji; unused ones are absent, so no reactions serves `{}`. */
10
10
  const ReactionCounts = z.record(z.string(), z.number().int());
11
+ const Following = z.object({ state: z.literal("following") }).strict().describe("Follow the post: you are notified of its new comments");
12
+ const Muted = z.object({
13
+ state: z.literal("muted"),
14
+ mutedUntil: DateTimeInput.nullable().optional().describe("When the mute ends. Omit or null to mute until you change it")
15
+ }).strict().describe("Mute it: its activity stops notifying you, except mentions and actions on you");
16
+ const Unsubscribed = z.object({ state: z.literal("none") }).strict().describe("Neither follow nor mute it");
17
+ const SetPostSubscription = z.discriminatedUnion("state", [
18
+ Following,
19
+ Muted,
20
+ Unsubscribed
21
+ ]);
22
+ const SetMute = z.discriminatedUnion("state", [Muted, Unsubscribed]);
11
23
  const CommentView = commentViewSchema;
12
24
  /** What a reaction write on a post, message or comment returns, so the client never recomputes a count. */
13
25
  const Reactions = z.object({
@@ -34,7 +46,7 @@ const PostComment = z.object({
34
46
  parentId: idSchema.nullable().default(null).describe("The comment this replies to. Replies nest one level, under a root comment")
35
47
  }).strict();
36
48
  const EditComment = z.object({ body: z.string().min(1).max(1e4) }).strict();
37
- /** The staff PATCH writes status and nothing else: publishing covers approving
49
+ /** The moderator's PATCH writes status and nothing else: publishing covers approving
38
50
  * a pending comment and restoring a removed one. Revising the text is the
39
51
  * author's own edit, under /api/member. */
40
52
  const PatchComment = z.object({ status: z.literal("published") });
@@ -56,7 +68,7 @@ const CommentReport = z.object({
56
68
  /** An unresolved report on a listed comment. Resolved ones are history and are
57
69
  * never served here. */
58
70
  const CommentReportSummary = commentReportSummarySchema;
59
- /** One row of the staff comment list: the comment plus the context a
71
+ /** One row of the moderation comment list: the comment plus the context a
60
72
  * moderation decision needs, so the list needs no follow-up request. */
61
73
  const CommentListItem = commentListItemSchema;
62
74
  const CommentsQuery = ListQuery.extend({
@@ -74,6 +86,6 @@ const CommentsPage = paginated(CommentListItem);
74
86
  const DiscussionActivityParam = z.object({ activityId: z.string() });
75
87
  const CommentIdParam = z.object({ commentId: z.string() });
76
88
  //#endregion
77
- export { ActivityComments, Comment, CommentAuthor, CommentIdParam, CommentListItem, CommentReport, CommentReportSummary, CommentSettings, CommentStatus, CommentView, CommentsConfig, CommentsPage, CommentsQuery, DiscussionActivityParam, EditComment, PatchComment, PostComment, ReactionCounts, ReactionEmoji, Reactions, ReplyToComment, ReportComment, ResolveCommentFlags, SetReaction };
89
+ export { ActivityComments, Comment, CommentAuthor, CommentIdParam, CommentListItem, CommentReport, CommentReportSummary, CommentSettings, CommentStatus, CommentView, CommentsConfig, CommentsPage, CommentsQuery, DiscussionActivityParam, EditComment, PatchComment, PostComment, ReactionCounts, ReactionEmoji, Reactions, ReplyToComment, ReportComment, ResolveCommentFlags, SetMute, SetPostSubscription, SetReaction };
78
90
 
79
91
  //# sourceMappingURL=discussion.js.map
@@ -1 +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 commentFlagResolutionSchema,\n commentStatusSchema,\n commentViewSchema,\n idSchema,\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 a reaction write on a post, message or comment returns, so the client never recomputes a count. */\nexport const Reactions = z.object({\n reactions: ReactionCounts,\n viewerReaction: ReactionEmoji.optional().describe('Absent when you have no reaction'),\n});\nexport type Reactions = z.infer<typeof Reactions>;\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\n .object({\n body: z.string().min(1).max(10_000),\n parentId: idSchema\n .nullable()\n .default(null)\n .describe('The comment this replies to. Replies nest one level, under a root comment'),\n })\n .strict();\nexport type PostComment = z.infer<typeof PostComment>;\n\nexport const EditComment = z.object({ body: z.string().min(1).max(10_000) }).strict();\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/member. */\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 SetReaction = z\n .object({ emoji: ReactionEmoji.describe('Replaces any reaction you already had') })\n .strict();\nexport type SetReaction = z.infer<typeof SetReaction>;\n\nexport const ResolveCommentFlags = z\n .object({\n resolution: commentFlagResolutionSchema\n .extract(['dismissed'])\n .describe(\n '`dismissed` closes the open flags and leaves the comment up. Removing the comment resolves its flags as `removed` instead.',\n ),\n })\n .strict();\nexport type ResolveCommentFlags = z.infer<typeof ResolveCommentFlags>;\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({ reason: z.string().max(1_000).default('') }).strict();\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"],"mappings":";;;;AAqBA,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,YAAY,EAAE,OAAO;CAChC,WAAW;CACX,gBAAgB,cAAc,SAAS,CAAC,CAAC,SAAS,kCAAkC;AACtF,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,EACxB,OAAO;CACN,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAM;CAClC,UAAU,SACP,SAAS,CAAC,CACV,QAAQ,IAAI,CAAC,CACb,SAAS,2EAA2E;AACzF,CAAC,CAAC,CACD,OAAO;AAGV,MAAa,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAM,EAAE,CAAC,CAAC,CAAC,OAAO;;;;AAMpF,MAAa,eAAe,EAAE,OAAO,EACnC,QAAQ,EAAE,QAAQ,WAAW,EAC/B,CAAC;;AAID,MAAa,cAAc,EACxB,OAAO,EAAE,OAAO,cAAc,SAAS,uCAAuC,EAAE,CAAC,CAAC,CAClF,OAAO;AAGV,MAAa,sBAAsB,EAChC,OAAO,EACN,YAAY,4BACT,QAAQ,CAAC,WAAW,CAAC,CAAC,CACtB,SACC,4HACF,EACJ,CAAC,CAAC,CACD,OAAO;;AAIV,MAAa,iBAAiB,EAAE,OAAO,EACrC,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAM,EACpC,CAAC;AAGD,MAAa,gBAAgB,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,GAAK,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO;AAG5F,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"}
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 commentFlagResolutionSchema,\n commentStatusSchema,\n commentViewSchema,\n idSchema,\n} from '@headless-lms/core/schemas';\nimport { z } from 'zod';\nimport { DateTimeInput, 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\nconst Following = z\n .object({ state: z.literal('following') })\n .strict()\n .describe('Follow the post: you are notified of its new comments');\nconst Muted = z\n .object({\n state: z.literal('muted'),\n mutedUntil: DateTimeInput.nullable()\n .optional()\n .describe('When the mute ends. Omit or null to mute until you change it'),\n })\n .strict()\n .describe('Mute it: its activity stops notifying you, except mentions and actions on you');\nconst Unsubscribed = z\n .object({ state: z.literal('none') })\n .strict()\n .describe('Neither follow nor mute it');\n\nexport const SetPostSubscription = z.discriminatedUnion('state', [Following, Muted, Unsubscribed]);\nexport const SetMute = z.discriminatedUnion('state', [Muted, Unsubscribed]);\n\nexport const CommentView = commentViewSchema;\nexport type CommentView = z.infer<typeof CommentView>;\n\n/** What a reaction write on a post, message or comment returns, so the client never recomputes a count. */\nexport const Reactions = z.object({\n reactions: ReactionCounts,\n viewerReaction: ReactionEmoji.optional().describe('Absent when you have no reaction'),\n});\nexport type Reactions = z.infer<typeof Reactions>;\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\n .object({\n body: z.string().min(1).max(10_000),\n parentId: idSchema\n .nullable()\n .default(null)\n .describe('The comment this replies to. Replies nest one level, under a root comment'),\n })\n .strict();\nexport type PostComment = z.infer<typeof PostComment>;\n\nexport const EditComment = z.object({ body: z.string().min(1).max(10_000) }).strict();\nexport type EditComment = z.infer<typeof EditComment>;\n\n/** The moderator's 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/member. */\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 SetReaction = z\n .object({ emoji: ReactionEmoji.describe('Replaces any reaction you already had') })\n .strict();\nexport type SetReaction = z.infer<typeof SetReaction>;\n\nexport const ResolveCommentFlags = z\n .object({\n resolution: commentFlagResolutionSchema\n .extract(['dismissed'])\n .describe(\n '`dismissed` closes the open flags and leaves the comment up. Removing the comment resolves its flags as `removed` instead.',\n ),\n })\n .strict();\nexport type ResolveCommentFlags = z.infer<typeof ResolveCommentFlags>;\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({ reason: z.string().max(1_000).default('') }).strict();\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 moderation 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"],"mappings":"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"}
@@ -9,6 +9,7 @@ type EntitlementStatus = z.infer<typeof EntitlementStatus>;
9
9
  declare const ContentType: z.ZodEnum<{
10
10
  course: "course";
11
11
  download: "download";
12
+ event: "event";
12
13
  }>;
13
14
  type ContentType = z.infer<typeof ContentType>;
14
15
  /** Reference to the granted content: identity + display name (join-derived).
@@ -18,6 +19,7 @@ declare const ContentRef: z.ZodObject<{
18
19
  type: z.ZodEnum<{
19
20
  course: "course";
20
21
  download: "download";
22
+ event: "event";
21
23
  }>;
22
24
  title: z.ZodString;
23
25
  }, z.core.$strip>;
@@ -55,6 +57,7 @@ declare const EntitlementsQuery: z.ZodObject<{
55
57
  type: z.ZodOptional<z.ZodEnum<{
56
58
  course: "course";
57
59
  download: "download";
60
+ event: "event";
58
61
  }>>;
59
62
  }, z.core.$strip>;
60
63
  type EntitlementsQuery = z.infer<typeof EntitlementsQuery>;
@@ -88,18 +91,12 @@ declare const GrantEntitlement: z.ZodObject<{
88
91
  expiresAt: z.ZodNullable<z.ZodPipe<z.ZodISODateTime, z.ZodCoercedDate<string>>>;
89
92
  }, z.core.$strip>;
90
93
  type GrantEntitlement = z.infer<typeof GrantEntitlement>;
91
- /** Revoke/reinstate access by setting the active|revoked status. */
92
- declare const SetEntitlementStatus: z.ZodObject<{
93
- status: z.ZodEnum<{
94
- active: "active";
95
- revoked: "revoked";
96
- }>;
97
- }, z.core.$strip>;
98
- type SetEntitlementStatus = z.infer<typeof SetEntitlementStatus>;
99
- declare const EntitlementIdParam: z.ZodObject<{
100
- id: z.ZodString;
94
+ declare const RevokeEntitlement: z.ZodObject<{
95
+ orgUserId: z.ZodString;
96
+ contentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
97
+ bundleId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
101
98
  }, z.core.$strip>;
102
- type EntitlementIdParam = z.infer<typeof EntitlementIdParam>;
99
+ type RevokeEntitlement = z.infer<typeof RevokeEntitlement>;
103
100
  //#endregion
104
- export { ContentRef, ContentType, Entitlement, EntitlementIdParam, EntitlementStatus, EntitlementsPage, EntitlementsQuery, GrantEntitlement, SetEntitlementStatus };
101
+ export { ContentRef, ContentType, Entitlement, EntitlementStatus, EntitlementsPage, EntitlementsQuery, GrantEntitlement, RevokeEntitlement };
105
102
  //# sourceMappingURL=entitlements.d.ts.map
@@ -7,7 +7,11 @@ const EntitlementStatus = z.enum([
7
7
  "expired",
8
8
  "revoked"
9
9
  ]);
10
- const ContentType = z.enum(["course", "download"]);
10
+ const ContentType = z.enum([
11
+ "course",
12
+ "download",
13
+ "event"
14
+ ]);
11
15
  /** Reference to the granted content: identity + display name (join-derived).
12
16
  * The full content object lives on its own resource. */
13
17
  const ContentRef = z.object({
@@ -34,10 +38,12 @@ const GrantEntitlement = z.object({
34
38
  bundleId: idSchema.nullish(),
35
39
  expiresAt: DateTimeInput.nullable().describe("When access ends; null never expires")
36
40
  }).refine((v) => v.contentId != null !== (v.bundleId != null), { message: "Provide exactly one of contentId or bundleId" });
37
- /** Revoke/reinstate access by setting the active|revoked status. */
38
- const SetEntitlementStatus = z.object({ status: z.enum(["active", "revoked"]) });
39
- const EntitlementIdParam = z.object({ id: z.string() });
41
+ const RevokeEntitlement = z.object({
42
+ orgUserId: idSchema,
43
+ contentId: idSchema.nullish(),
44
+ bundleId: idSchema.nullish()
45
+ }).refine((v) => v.contentId != null !== (v.bundleId != null), { message: "Provide exactly one of contentId or bundleId" });
40
46
  //#endregion
41
- export { ContentRef, ContentType, Entitlement, EntitlementIdParam, EntitlementStatus, EntitlementsPage, EntitlementsQuery, GrantEntitlement, SetEntitlementStatus };
47
+ export { ContentRef, ContentType, Entitlement, EntitlementStatus, EntitlementsPage, EntitlementsQuery, GrantEntitlement, RevokeEntitlement };
42
48
 
43
49
  //# sourceMappingURL=entitlements.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"entitlements.js","names":[],"sources":["../../../src/http/schemas/entitlements.ts"],"sourcesContent":["// Entitlements resource schemas. An entitlement is a student's access grant to\n// a piece of content — generic over content types (course today) — its\n// validity + source. Distinct from payment and from completion.\nimport { z } from 'zod';\nimport { entitlementSchema, idSchema } from '@headless-lms/core/schemas';\nimport { DateTimeInput, ListQuery, paginated } from './shared.js';\n\nexport const EntitlementStatus = z.enum(['active', 'expired', 'revoked']);\nexport type EntitlementStatus = z.infer<typeof EntitlementStatus>;\n\nexport const ContentType = z.enum(['course', 'download']);\nexport type ContentType = z.infer<typeof ContentType>;\n\n/** Reference to the granted content: identity + display name (join-derived).\n * The full content object lives on its own resource. */\nexport const ContentRef = z.object({\n id: z.string(),\n type: ContentType,\n title: z.string(),\n});\nexport type ContentRef = z.infer<typeof ContentRef>;\n\nexport const Entitlement = entitlementSchema;\nexport type Entitlement = z.infer<typeof Entitlement>;\n\nexport const EntitlementsQuery = ListQuery.extend({\n status: EntitlementStatus.optional(),\n source: z.string().optional(),\n /** Scope to a single student (used by the student detail view). */\n orgUserId: z.string().optional(),\n /** Scope to a single piece of content. */\n contentId: z.string().optional(),\n /** Scope to one content type. */\n type: ContentType.optional(),\n});\nexport type EntitlementsQuery = z.infer<typeof EntitlementsQuery>;\n\nexport const EntitlementsPage = paginated(Entitlement);\nexport type EntitlementsPage = z.infer<typeof EntitlementsPage>;\n\n/** A grant targets exactly one of: a single content item or a bundle. */\nexport const GrantEntitlement = z\n .object({\n orgUserId: idSchema,\n contentId: idSchema.nullish(),\n bundleId: idSchema.nullish(),\n expiresAt: DateTimeInput.nullable().describe('When access ends; null never expires'),\n })\n .refine((v) => (v.contentId != null) !== (v.bundleId != null), {\n message: 'Provide exactly one of contentId or bundleId',\n });\nexport type GrantEntitlement = z.infer<typeof GrantEntitlement>;\n\n/** Revoke/reinstate access by setting the active|revoked status. */\nexport const SetEntitlementStatus = z.object({\n status: z.enum(['active', 'revoked']),\n});\nexport type SetEntitlementStatus = z.infer<typeof SetEntitlementStatus>;\n\nexport const EntitlementIdParam = z.object({ id: z.string() });\nexport type EntitlementIdParam = z.infer<typeof EntitlementIdParam>;\n"],"mappings":";;;;AAOA,MAAa,oBAAoB,EAAE,KAAK;CAAC;CAAU;CAAW;AAAS,CAAC;AAGxE,MAAa,cAAc,EAAE,KAAK,CAAC,UAAU,UAAU,CAAC;;;AAKxD,MAAa,aAAa,EAAE,OAAO;CACjC,IAAI,EAAE,OAAO;CACb,MAAM;CACN,OAAO,EAAE,OAAO;AAClB,CAAC;AAGD,MAAa,cAAc;AAG3B,MAAa,oBAAoB,UAAU,OAAO;CAChD,QAAQ,kBAAkB,SAAS;CACnC,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;;CAE5B,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;;CAE/B,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;;CAE/B,MAAM,YAAY,SAAS;AAC7B,CAAC;AAGD,MAAa,mBAAmB,UAAU,WAAW;;AAIrD,MAAa,mBAAmB,EAC7B,OAAO;CACN,WAAW;CACX,WAAW,SAAS,QAAQ;CAC5B,UAAU,SAAS,QAAQ;CAC3B,WAAW,cAAc,SAAS,CAAC,CAAC,SAAS,sCAAsC;AACrF,CAAC,CAAC,CACD,QAAQ,MAAO,EAAE,aAAa,UAAW,EAAE,YAAY,OAAO,EAC7D,SAAS,+CACX,CAAC;;AAIH,MAAa,uBAAuB,EAAE,OAAO,EAC3C,QAAQ,EAAE,KAAK,CAAC,UAAU,SAAS,CAAC,EACtC,CAAC;AAGD,MAAa,qBAAqB,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"entitlements.js","names":[],"sources":["../../../src/http/schemas/entitlements.ts"],"sourcesContent":["// Entitlements resource schemas. An entitlement is a student's access grant to\n// a piece of content — generic over content types (course today) — its\n// validity + source. Distinct from payment and from completion.\nimport { z } from 'zod';\nimport { entitlementSchema, idSchema } from '@headless-lms/core/schemas';\nimport { DateTimeInput, ListQuery, paginated } from './shared.js';\n\nexport const EntitlementStatus = z.enum(['active', 'expired', 'revoked']);\nexport type EntitlementStatus = z.infer<typeof EntitlementStatus>;\n\nexport const ContentType = z.enum(['course', 'download', 'event']);\nexport type ContentType = z.infer<typeof ContentType>;\n\n/** Reference to the granted content: identity + display name (join-derived).\n * The full content object lives on its own resource. */\nexport const ContentRef = z.object({\n id: z.string(),\n type: ContentType,\n title: z.string(),\n});\nexport type ContentRef = z.infer<typeof ContentRef>;\n\nexport const Entitlement = entitlementSchema;\nexport type Entitlement = z.infer<typeof Entitlement>;\n\nexport const EntitlementsQuery = ListQuery.extend({\n status: EntitlementStatus.optional(),\n source: z.string().optional(),\n /** Scope to a single student (used by the student detail view). */\n orgUserId: z.string().optional(),\n /** Scope to a single piece of content. */\n contentId: z.string().optional(),\n /** Scope to one content type. */\n type: ContentType.optional(),\n});\nexport type EntitlementsQuery = z.infer<typeof EntitlementsQuery>;\n\nexport const EntitlementsPage = paginated(Entitlement);\nexport type EntitlementsPage = z.infer<typeof EntitlementsPage>;\n\n/** A grant targets exactly one of: a single content item or a bundle. */\nexport const GrantEntitlement = z\n .object({\n orgUserId: idSchema,\n contentId: idSchema.nullish(),\n bundleId: idSchema.nullish(),\n expiresAt: DateTimeInput.nullable().describe('When access ends; null never expires'),\n })\n .refine((v) => (v.contentId != null) !== (v.bundleId != null), {\n message: 'Provide exactly one of contentId or bundleId',\n });\nexport type GrantEntitlement = z.infer<typeof GrantEntitlement>;\n\nexport const RevokeEntitlement = z\n .object({\n orgUserId: idSchema,\n contentId: idSchema.nullish(),\n bundleId: idSchema.nullish(),\n })\n .refine((v) => (v.contentId != null) !== (v.bundleId != null), {\n message: 'Provide exactly one of contentId or bundleId',\n });\nexport type RevokeEntitlement = z.infer<typeof RevokeEntitlement>;\n"],"mappings":";;;;AAOA,MAAa,oBAAoB,EAAE,KAAK;CAAC;CAAU;CAAW;AAAS,CAAC;AAGxE,MAAa,cAAc,EAAE,KAAK;CAAC;CAAU;CAAY;AAAO,CAAC;;;AAKjE,MAAa,aAAa,EAAE,OAAO;CACjC,IAAI,EAAE,OAAO;CACb,MAAM;CACN,OAAO,EAAE,OAAO;AAClB,CAAC;AAGD,MAAa,cAAc;AAG3B,MAAa,oBAAoB,UAAU,OAAO;CAChD,QAAQ,kBAAkB,SAAS;CACnC,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS;;CAE5B,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;;CAE/B,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;;CAE/B,MAAM,YAAY,SAAS;AAC7B,CAAC;AAGD,MAAa,mBAAmB,UAAU,WAAW;;AAIrD,MAAa,mBAAmB,EAC7B,OAAO;CACN,WAAW;CACX,WAAW,SAAS,QAAQ;CAC5B,UAAU,SAAS,QAAQ;CAC3B,WAAW,cAAc,SAAS,CAAC,CAAC,SAAS,sCAAsC;AACrF,CAAC,CAAC,CACD,QAAQ,MAAO,EAAE,aAAa,UAAW,EAAE,YAAY,OAAO,EAC7D,SAAS,+CACX,CAAC;AAGH,MAAa,oBAAoB,EAC9B,OAAO;CACN,WAAW;CACX,WAAW,SAAS,QAAQ;CAC5B,UAAU,SAAS,QAAQ;AAC7B,CAAC,CAAC,CACD,QAAQ,MAAO,EAAE,aAAa,UAAW,EAAE,YAAY,OAAO,EAC7D,SAAS,+CACX,CAAC"}