@headless-lms/server 0.4.0 → 0.6.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 (222) hide show
  1. package/README.md +14 -0
  2. package/dist/app/community-mail.d.ts +5 -3
  3. package/dist/app/community-mail.js +60 -12
  4. package/dist/app/community-mail.js.map +1 -1
  5. package/dist/app/container.d.ts +24 -3
  6. package/dist/app/container.js +102 -38
  7. package/dist/app/container.js.map +1 -1
  8. package/dist/app/notification-channels.js +1 -0
  9. package/dist/app/notification-channels.js.map +1 -1
  10. package/dist/app/notification-reads.d.ts +3 -3
  11. package/dist/app/notification-reads.js +7 -28
  12. package/dist/app/notification-reads.js.map +1 -1
  13. package/dist/app/platform.d.ts +14 -0
  14. package/dist/app/platform.js +14 -0
  15. package/dist/app/platform.js.map +1 -0
  16. package/dist/http/config.d.ts +4 -0
  17. package/dist/http/errors.js +9 -4
  18. package/dist/http/errors.js.map +1 -1
  19. package/dist/http/fastify.d.ts +8 -0
  20. package/dist/http/mcp/catalogue.d.ts +11 -9
  21. package/dist/http/mcp/catalogue.js +15 -21
  22. package/dist/http/mcp/catalogue.js.map +1 -1
  23. package/dist/http/mcp/challenge.js +3 -3
  24. package/dist/http/mcp/challenge.js.map +1 -1
  25. package/dist/http/mcp/route.js +7 -7
  26. package/dist/http/mcp/route.js.map +1 -1
  27. package/dist/http/mcp/test-support.d.ts +6 -5
  28. package/dist/http/mcp/test-support.js +32 -11
  29. package/dist/http/mcp/test-support.js.map +1 -1
  30. package/dist/http/mcp/tool.d.ts +3 -9
  31. package/dist/http/mcp/tool.js +14 -6
  32. package/dist/http/mcp/tool.js.map +1 -1
  33. package/dist/http/mcp/tools/automations.js +10 -20
  34. package/dist/http/mcp/tools/automations.js.map +1 -1
  35. package/dist/http/mcp/tools/catalog.js +25 -42
  36. package/dist/http/mcp/tools/catalog.js.map +1 -1
  37. package/dist/http/mcp/tools/comments.js +9 -19
  38. package/dist/http/mcp/tools/comments.js.map +1 -1
  39. package/dist/http/mcp/tools/communities.js +17 -32
  40. package/dist/http/mcp/tools/communities.js.map +1 -1
  41. package/dist/http/mcp/tools/community-members.js +9 -16
  42. package/dist/http/mcp/tools/community-members.js.map +1 -1
  43. package/dist/http/mcp/tools/community-moderation.js +13 -25
  44. package/dist/http/mcp/tools/community-moderation.js.map +1 -1
  45. package/dist/http/mcp/tools/courses.js +11 -21
  46. package/dist/http/mcp/tools/courses.js.map +1 -1
  47. package/dist/http/mcp/tools/events.d.ts +6 -0
  48. package/dist/http/mcp/tools/events.js +170 -0
  49. package/dist/http/mcp/tools/events.js.map +1 -0
  50. package/dist/http/mcp/tools/index.d.ts +5 -1
  51. package/dist/http/mcp/tools/index.js +45 -10
  52. package/dist/http/mcp/tools/index.js.map +1 -1
  53. package/dist/http/mcp/tools/organization.d.ts +6 -0
  54. package/dist/http/mcp/tools/organization.js +214 -0
  55. package/dist/http/mcp/tools/organization.js.map +1 -0
  56. package/dist/http/mcp/tools/people.js +30 -49
  57. package/dist/http/mcp/tools/people.js.map +1 -1
  58. package/dist/http/plugins/auth.js +37 -8
  59. package/dist/http/plugins/auth.js.map +1 -1
  60. package/dist/http/plugins/error-handler.d.ts +5 -1
  61. package/dist/http/plugins/error-handler.js +10 -2
  62. package/dist/http/plugins/error-handler.js.map +1 -1
  63. package/dist/http/plugins/openapi.js +18 -2
  64. package/dist/http/plugins/openapi.js.map +1 -1
  65. package/dist/http/plugins/platform.d.ts +7 -0
  66. package/dist/http/plugins/platform.js +13 -0
  67. package/dist/http/plugins/platform.js.map +1 -0
  68. package/dist/http/routes/access.js +54 -36
  69. package/dist/http/routes/access.js.map +1 -1
  70. package/dist/http/routes/activities.js +45 -45
  71. package/dist/http/routes/activities.js.map +1 -1
  72. package/dist/http/routes/assets.js +30 -65
  73. package/dist/http/routes/assets.js.map +1 -1
  74. package/dist/http/routes/automations.js +37 -42
  75. package/dist/http/routes/automations.js.map +1 -1
  76. package/dist/http/routes/bundles.js +33 -36
  77. package/dist/http/routes/bundles.js.map +1 -1
  78. package/dist/http/routes/communities.js +93 -145
  79. package/dist/http/routes/communities.js.map +1 -1
  80. package/dist/http/routes/community-moderation.js +83 -137
  81. package/dist/http/routes/community-moderation.js.map +1 -1
  82. package/dist/http/routes/course-analytics.js +32 -15
  83. package/dist/http/routes/course-analytics.js.map +1 -1
  84. package/dist/http/routes/courses.js +25 -32
  85. package/dist/http/routes/courses.js.map +1 -1
  86. package/dist/http/routes/dashboard.js +9 -9
  87. package/dist/http/routes/dashboard.js.map +1 -1
  88. package/dist/http/routes/discussion.js +21 -39
  89. package/dist/http/routes/discussion.js.map +1 -1
  90. package/dist/http/routes/downloads.js +41 -47
  91. package/dist/http/routes/downloads.js.map +1 -1
  92. package/dist/http/routes/entitlements.js +19 -23
  93. package/dist/http/routes/entitlements.js.map +1 -1
  94. package/dist/http/routes/events.d.ts +7 -0
  95. package/dist/http/routes/events.js +333 -0
  96. package/dist/http/routes/events.js.map +1 -0
  97. package/dist/http/routes/integrations.js +40 -73
  98. package/dist/http/routes/integrations.js.map +1 -1
  99. package/dist/http/routes/member/assets.js +10 -13
  100. package/dist/http/routes/member/assets.js.map +1 -1
  101. package/dist/http/routes/member/chats.js +170 -47
  102. package/dist/http/routes/member/chats.js.map +1 -1
  103. package/dist/http/routes/member/comments.js +65 -26
  104. package/dist/http/routes/member/comments.js.map +1 -1
  105. package/dist/http/routes/member/community.js +45 -52
  106. package/dist/http/routes/member/community.js.map +1 -1
  107. package/dist/http/routes/member/courses.js +12 -19
  108. package/dist/http/routes/member/courses.js.map +1 -1
  109. package/dist/http/routes/member/devices.js +9 -10
  110. package/dist/http/routes/member/devices.js.map +1 -1
  111. package/dist/http/routes/member/downloads.js +6 -9
  112. package/dist/http/routes/member/downloads.js.map +1 -1
  113. package/dist/http/routes/member/events.d.ts +7 -0
  114. package/dist/http/routes/member/events.js +386 -0
  115. package/dist/http/routes/member/events.js.map +1 -0
  116. package/dist/http/routes/member/files.js +88 -46
  117. package/dist/http/routes/member/files.js.map +1 -1
  118. package/dist/http/routes/member/index.js +2 -0
  119. package/dist/http/routes/member/index.js.map +1 -1
  120. package/dist/http/routes/member/notification-settings.js +15 -23
  121. package/dist/http/routes/member/notification-settings.js.map +1 -1
  122. package/dist/http/routes/member/notifications.js +16 -16
  123. package/dist/http/routes/member/notifications.js.map +1 -1
  124. package/dist/http/routes/member/org.js +5 -15
  125. package/dist/http/routes/member/org.js.map +1 -1
  126. package/dist/http/routes/member/posts.js +67 -68
  127. package/dist/http/routes/member/posts.js.map +1 -1
  128. package/dist/http/routes/member/profile.js +15 -6
  129. package/dist/http/routes/member/profile.js.map +1 -1
  130. package/dist/http/routes/member/progress.js +7 -11
  131. package/dist/http/routes/member/progress.js.map +1 -1
  132. package/dist/http/routes/organizations.js +319 -135
  133. package/dist/http/routes/organizations.js.map +1 -1
  134. package/dist/http/routes/platform.d.ts +7 -0
  135. package/dist/http/routes/platform.js +61 -0
  136. package/dist/http/routes/platform.js.map +1 -0
  137. package/dist/http/routes/students.js +12 -75
  138. package/dist/http/routes/students.js.map +1 -1
  139. package/dist/http/routes/webhooks.js +30 -39
  140. package/dist/http/routes/webhooks.js.map +1 -1
  141. package/dist/http/routes.js +9 -0
  142. package/dist/http/routes.js.map +1 -1
  143. package/dist/http/schemas/access.d.ts +346 -64
  144. package/dist/http/schemas/access.js +39 -12
  145. package/dist/http/schemas/access.js.map +1 -1
  146. package/dist/http/schemas/assets.d.ts +8 -3
  147. package/dist/http/schemas/assets.js +6 -5
  148. package/dist/http/schemas/assets.js.map +1 -1
  149. package/dist/http/schemas/automations.d.ts +4 -4
  150. package/dist/http/schemas/chats.d.ts +216 -37
  151. package/dist/http/schemas/chats.js +13 -4
  152. package/dist/http/schemas/chats.js.map +1 -1
  153. package/dist/http/schemas/community.d.ts +105 -31
  154. package/dist/http/schemas/community.js +25 -9
  155. package/dist/http/schemas/community.js.map +1 -1
  156. package/dist/http/schemas/course-analytics.d.ts +51 -1
  157. package/dist/http/schemas/course-analytics.js +19 -1
  158. package/dist/http/schemas/course-analytics.js.map +1 -1
  159. package/dist/http/schemas/dashboard.d.ts +1 -0
  160. package/dist/http/schemas/dashboard.js +2 -1
  161. package/dist/http/schemas/dashboard.js.map +1 -1
  162. package/dist/http/schemas/discussion.d.ts +22 -72
  163. package/dist/http/schemas/discussion.js +2 -2
  164. package/dist/http/schemas/discussion.js.map +1 -1
  165. package/dist/http/schemas/entitlements.d.ts +9 -12
  166. package/dist/http/schemas/entitlements.js +11 -5
  167. package/dist/http/schemas/entitlements.js.map +1 -1
  168. package/dist/http/schemas/events.d.ts +527 -0
  169. package/dist/http/schemas/events.js +64 -0
  170. package/dist/http/schemas/events.js.map +1 -0
  171. package/dist/http/schemas/files.d.ts +24 -5
  172. package/dist/http/schemas/files.js +15 -2
  173. package/dist/http/schemas/files.js.map +1 -1
  174. package/dist/http/schemas/index.d.ts +11 -9
  175. package/dist/http/schemas/index.js +11 -9
  176. package/dist/http/schemas/invites.d.ts +3 -47
  177. package/dist/http/schemas/invites.js +4 -25
  178. package/dist/http/schemas/invites.js.map +1 -1
  179. package/dist/http/schemas/member.d.ts +94 -7
  180. package/dist/http/schemas/member.js +7 -3
  181. package/dist/http/schemas/member.js.map +1 -1
  182. package/dist/http/schemas/members.d.ts +329 -65
  183. package/dist/http/schemas/members.js +67 -25
  184. package/dist/http/schemas/members.js.map +1 -1
  185. package/dist/http/schemas/notifications.d.ts +58 -54
  186. package/dist/http/schemas/platform.d.ts +38 -0
  187. package/dist/http/schemas/platform.js +19 -0
  188. package/dist/http/schemas/platform.js.map +1 -0
  189. package/dist/http/schemas/posts.d.ts +55 -35
  190. package/dist/http/schemas/posts.js +4 -4
  191. package/dist/http/schemas/posts.js.map +1 -1
  192. package/dist/http/schemas/profile.d.ts +1 -1
  193. package/dist/http/schemas/shared.d.ts +1 -11
  194. package/dist/http/schemas/shared.js +1 -10
  195. package/dist/http/schemas/shared.js.map +1 -1
  196. package/dist/http/schemas/students.d.ts +22 -0
  197. package/dist/http/schemas/students.js +3 -1
  198. package/dist/http/schemas/students.js.map +1 -1
  199. package/dist/http/scope.d.ts +9 -13
  200. package/dist/http/scope.js +29 -40
  201. package/dist/http/scope.js.map +1 -1
  202. package/dist/http/server.js +9 -0
  203. package/dist/http/server.js.map +1 -1
  204. package/dist/http/shutdown.d.ts +11 -0
  205. package/dist/http/shutdown.js +40 -0
  206. package/dist/http/shutdown.js.map +1 -0
  207. package/dist/http/sse.d.ts +19 -0
  208. package/dist/http/sse.js +104 -0
  209. package/dist/http/sse.js.map +1 -0
  210. package/dist/http/test-caller.d.ts +13 -0
  211. package/dist/http/test-caller.js +14 -0
  212. package/dist/http/test-caller.js.map +1 -0
  213. package/dist/http/well-known.js +2 -2
  214. package/dist/http/well-known.js.map +1 -1
  215. package/dist/index.d.ts +4 -2
  216. package/dist/index.js +4 -2
  217. package/dist/index.js.map +1 -1
  218. package/dist/packages/server/package.js +1 -1
  219. package/package.json +7 -6
  220. package/dist/http/routes/member/actor.d.ts +0 -14
  221. package/dist/http/routes/member/actor.js +0 -11
  222. package/dist/http/routes/member/actor.js.map +0 -1
@@ -16,8 +16,8 @@ declare const Community: z.ZodObject<{
16
16
  dm: z.ZodObject<{
17
17
  enabled: z.ZodBoolean;
18
18
  memberToMember: z.ZodBoolean;
19
- memberToStaff: z.ZodBoolean;
20
- staffToAnyone: z.ZodBoolean;
19
+ memberToTeam: z.ZodBoolean;
20
+ teamToAnyone: z.ZodBoolean;
21
21
  firstMessageIsRequest: z.ZodBoolean;
22
22
  groupChats: z.ZodBoolean;
23
23
  groupSize: z.ZodNumber;
@@ -63,8 +63,8 @@ declare const CommunitiesPage: z.ZodObject<{
63
63
  dm: z.ZodObject<{
64
64
  enabled: z.ZodBoolean;
65
65
  memberToMember: z.ZodBoolean;
66
- memberToStaff: z.ZodBoolean;
67
- staffToAnyone: z.ZodBoolean;
66
+ memberToTeam: z.ZodBoolean;
67
+ teamToAnyone: z.ZodBoolean;
68
68
  firstMessageIsRequest: z.ZodBoolean;
69
69
  groupChats: z.ZodBoolean;
70
70
  groupSize: z.ZodNumber;
@@ -103,8 +103,8 @@ declare const UpdateCommunity: z.ZodObject<{
103
103
  declare const PatchDmSettings: z.ZodObject<{
104
104
  enabled: z.ZodOptional<z.ZodBoolean>;
105
105
  memberToMember: z.ZodOptional<z.ZodBoolean>;
106
- memberToStaff: z.ZodOptional<z.ZodBoolean>;
107
- staffToAnyone: z.ZodOptional<z.ZodBoolean>;
106
+ memberToTeam: z.ZodOptional<z.ZodBoolean>;
107
+ teamToAnyone: z.ZodOptional<z.ZodBoolean>;
108
108
  firstMessageIsRequest: z.ZodOptional<z.ZodBoolean>;
109
109
  groupChats: z.ZodOptional<z.ZodBoolean>;
110
110
  groupSize: z.ZodOptional<z.ZodNumber>;
@@ -112,8 +112,8 @@ declare const PatchDmSettings: z.ZodObject<{
112
112
  declare const PatchCommunitySettings: z.ZodObject<{
113
113
  enabled: z.ZodOptional<z.ZodBoolean>;
114
114
  memberToMember: z.ZodOptional<z.ZodBoolean>;
115
- memberToStaff: z.ZodOptional<z.ZodBoolean>;
116
- staffToAnyone: z.ZodOptional<z.ZodBoolean>;
115
+ memberToTeam: z.ZodOptional<z.ZodBoolean>;
116
+ teamToAnyone: z.ZodOptional<z.ZodBoolean>;
117
117
  firstMessageIsRequest: z.ZodOptional<z.ZodBoolean>;
118
118
  groupChats: z.ZodOptional<z.ZodBoolean>;
119
119
  groupSize: z.ZodOptional<z.ZodNumber>;
@@ -130,8 +130,8 @@ declare const PatchCommunitySettings: z.ZodObject<{
130
130
  declare const DmSettings: z.ZodObject<{
131
131
  enabled: z.ZodBoolean;
132
132
  memberToMember: z.ZodBoolean;
133
- memberToStaff: z.ZodBoolean;
134
- staffToAnyone: z.ZodBoolean;
133
+ memberToTeam: z.ZodBoolean;
134
+ teamToAnyone: z.ZodBoolean;
135
135
  firstMessageIsRequest: z.ZodBoolean;
136
136
  groupChats: z.ZodBoolean;
137
137
  groupSize: z.ZodNumber;
@@ -154,6 +154,9 @@ declare const SpaceDetail: z.ZodObject<{
154
154
  reactions: z.ZodBoolean;
155
155
  requireReview: z.ZodBoolean;
156
156
  }, z.core.$strict>;
157
+ coverAssetId: z.ZodNullable<z.ZodString>;
158
+ backgroundAssetId: z.ZodNullable<z.ZodString>;
159
+ iconAssetId: z.ZodNullable<z.ZodString>;
157
160
  createdAt: z.ZodCoercedDate<unknown>;
158
161
  updatedAt: z.ZodCoercedDate<unknown>;
159
162
  topics: z.ZodArray<z.ZodObject<{
@@ -174,6 +177,9 @@ declare const SpaceDetail: z.ZodObject<{
174
177
  createdAt: z.ZodCoercedDate<unknown>;
175
178
  updatedAt: z.ZodCoercedDate<unknown>;
176
179
  }, z.core.$strict>>;
180
+ coverUrl: z.ZodNullable<z.ZodString>;
181
+ backgroundUrl: z.ZodNullable<z.ZodString>;
182
+ iconUrl: z.ZodNullable<z.ZodString>;
177
183
  }, z.core.$strict>;
178
184
  declare const SpaceMember: z.ZodObject<{
179
185
  orgId: z.ZodString;
@@ -249,6 +255,9 @@ declare const UpdateSpace: z.ZodObject<{
249
255
  reactions: z.ZodOptional<z.ZodBoolean>;
250
256
  requireReview: z.ZodOptional<z.ZodBoolean>;
251
257
  }, z.core.$strict>>;
258
+ coverAssetId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
259
+ backgroundAssetId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
260
+ iconAssetId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
252
261
  }, z.core.$strict>;
253
262
  declare const SetSpaceTopics: z.ZodObject<{
254
263
  topics: z.ZodArray<z.ZodObject<{
@@ -304,13 +313,9 @@ declare const CommunityMember: z.ZodObject<{
304
313
  lastName: z.ZodNullable<z.ZodString>;
305
314
  email: z.ZodString;
306
315
  image: z.ZodNullable<z.ZodString>;
307
- role: z.ZodEnum<{
308
- owner: "owner";
309
- admin: "admin";
310
- instructor: "instructor";
311
- moderator: "moderator";
312
- student: "student";
313
- }>;
316
+ team: z.ZodBoolean;
317
+ roleName: z.ZodNullable<z.ZodString>;
318
+ opensEverySpace: z.ZodBoolean;
314
319
  }, z.core.$strip>;
315
320
  declare const CommunityMembersQuery: z.ZodObject<{
316
321
  page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
@@ -324,13 +329,9 @@ declare const CommunityMembersPage: z.ZodObject<{
324
329
  lastName: z.ZodNullable<z.ZodString>;
325
330
  email: z.ZodString;
326
331
  image: z.ZodNullable<z.ZodString>;
327
- role: z.ZodEnum<{
328
- owner: "owner";
329
- admin: "admin";
330
- instructor: "instructor";
331
- moderator: "moderator";
332
- student: "student";
333
- }>;
332
+ team: z.ZodBoolean;
333
+ roleName: z.ZodNullable<z.ZodString>;
334
+ opensEverySpace: z.ZodBoolean;
334
335
  }, z.core.$strip>>;
335
336
  total: z.ZodNumber;
336
337
  page: z.ZodNumber;
@@ -338,12 +339,14 @@ declare const CommunityMembersPage: z.ZodObject<{
338
339
  }, z.core.$strip>;
339
340
  declare const DirectoryEntry: z.ZodObject<{
340
341
  orgUserId: z.ZodString;
341
- role: z.ZodString;
342
342
  displayName: z.ZodNullable<z.ZodString>;
343
343
  headline: z.ZodNullable<z.ZodString>;
344
344
  bio: z.ZodNullable<z.ZodString>;
345
345
  imageAssetId: z.ZodNullable<z.ZodString>;
346
346
  imageUrl: z.ZodNullable<z.ZodString>;
347
+ team: z.ZodBoolean;
348
+ roleName: z.ZodNullable<z.ZodString>;
349
+ opensEverySpace: z.ZodBoolean;
347
350
  }, z.core.$strip>;
348
351
  declare const DirectoryQuery: z.ZodObject<{
349
352
  page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
@@ -353,12 +356,14 @@ declare const DirectoryQuery: z.ZodObject<{
353
356
  declare const DirectoryPage: z.ZodObject<{
354
357
  rows: z.ZodArray<z.ZodObject<{
355
358
  orgUserId: z.ZodString;
356
- role: z.ZodString;
357
359
  displayName: z.ZodNullable<z.ZodString>;
358
360
  headline: z.ZodNullable<z.ZodString>;
359
361
  bio: z.ZodNullable<z.ZodString>;
360
362
  imageAssetId: z.ZodNullable<z.ZodString>;
361
363
  imageUrl: z.ZodNullable<z.ZodString>;
364
+ team: z.ZodBoolean;
365
+ roleName: z.ZodNullable<z.ZodString>;
366
+ opensEverySpace: z.ZodBoolean;
362
367
  }, z.core.$strip>>;
363
368
  total: z.ZodNumber;
364
369
  page: z.ZodNumber;
@@ -381,6 +386,9 @@ declare const LockedCommunitySpace: z.ZodObject<{
381
386
  full: "full";
382
387
  none: "none";
383
388
  }>;
389
+ coverUrl: z.ZodNullable<z.ZodString>;
390
+ backgroundUrl: z.ZodNullable<z.ZodString>;
391
+ iconUrl: z.ZodNullable<z.ZodString>;
384
392
  locked: z.ZodLiteral<true>;
385
393
  }, z.core.$strip>;
386
394
  declare const OpenCommunitySpace: z.ZodObject<{
@@ -400,6 +408,9 @@ declare const OpenCommunitySpace: z.ZodObject<{
400
408
  full: "full";
401
409
  none: "none";
402
410
  }>;
411
+ coverUrl: z.ZodNullable<z.ZodString>;
412
+ backgroundUrl: z.ZodNullable<z.ZodString>;
413
+ iconUrl: z.ZodNullable<z.ZodString>;
403
414
  locked: z.ZodLiteral<false>;
404
415
  description: z.ZodNullable<z.ZodString>;
405
416
  capacity: z.ZodNullable<z.ZodNumber>;
@@ -416,9 +427,9 @@ declare const OpenCommunitySpace: z.ZodObject<{
416
427
  id: z.ZodString;
417
428
  contentId: z.ZodString;
418
429
  type: z.ZodEnum<{
419
- community: "community";
420
430
  course: "course";
421
431
  download: "download";
432
+ community: "community";
422
433
  }>;
423
434
  title: z.ZodString;
424
435
  }, z.core.$strip>>;
@@ -447,6 +458,9 @@ declare const CommunityHomeSpace: z.ZodDiscriminatedUnion<[z.ZodObject<{
447
458
  full: "full";
448
459
  none: "none";
449
460
  }>;
461
+ coverUrl: z.ZodNullable<z.ZodString>;
462
+ backgroundUrl: z.ZodNullable<z.ZodString>;
463
+ iconUrl: z.ZodNullable<z.ZodString>;
450
464
  locked: z.ZodLiteral<true>;
451
465
  }, z.core.$strip>, z.ZodObject<{
452
466
  id: z.ZodString;
@@ -465,6 +479,9 @@ declare const CommunityHomeSpace: z.ZodDiscriminatedUnion<[z.ZodObject<{
465
479
  full: "full";
466
480
  none: "none";
467
481
  }>;
482
+ coverUrl: z.ZodNullable<z.ZodString>;
483
+ backgroundUrl: z.ZodNullable<z.ZodString>;
484
+ iconUrl: z.ZodNullable<z.ZodString>;
468
485
  locked: z.ZodLiteral<false>;
469
486
  description: z.ZodNullable<z.ZodString>;
470
487
  capacity: z.ZodNullable<z.ZodNumber>;
@@ -481,9 +498,9 @@ declare const CommunityHomeSpace: z.ZodDiscriminatedUnion<[z.ZodObject<{
481
498
  id: z.ZodString;
482
499
  contentId: z.ZodString;
483
500
  type: z.ZodEnum<{
484
- community: "community";
485
501
  course: "course";
486
502
  download: "download";
503
+ community: "community";
487
504
  }>;
488
505
  title: z.ZodString;
489
506
  }, z.core.$strip>>;
@@ -503,8 +520,8 @@ declare const CommunityHome: z.ZodObject<{
503
520
  dm: z.ZodObject<{
504
521
  enabled: z.ZodBoolean;
505
522
  memberToMember: z.ZodBoolean;
506
- memberToStaff: z.ZodBoolean;
507
- staffToAnyone: z.ZodBoolean;
523
+ memberToTeam: z.ZodBoolean;
524
+ teamToAnyone: z.ZodBoolean;
508
525
  firstMessageIsRequest: z.ZodBoolean;
509
526
  groupChats: z.ZodBoolean;
510
527
  groupSize: z.ZodNumber;
@@ -526,6 +543,9 @@ declare const CommunityHome: z.ZodObject<{
526
543
  full: "full";
527
544
  none: "none";
528
545
  }>;
546
+ coverUrl: z.ZodNullable<z.ZodString>;
547
+ backgroundUrl: z.ZodNullable<z.ZodString>;
548
+ iconUrl: z.ZodNullable<z.ZodString>;
529
549
  locked: z.ZodLiteral<true>;
530
550
  }, z.core.$strip>, z.ZodObject<{
531
551
  id: z.ZodString;
@@ -544,6 +564,9 @@ declare const CommunityHome: z.ZodObject<{
544
564
  full: "full";
545
565
  none: "none";
546
566
  }>;
567
+ coverUrl: z.ZodNullable<z.ZodString>;
568
+ backgroundUrl: z.ZodNullable<z.ZodString>;
569
+ iconUrl: z.ZodNullable<z.ZodString>;
547
570
  locked: z.ZodLiteral<false>;
548
571
  description: z.ZodNullable<z.ZodString>;
549
572
  capacity: z.ZodNullable<z.ZodNumber>;
@@ -560,9 +583,9 @@ declare const CommunityHome: z.ZodObject<{
560
583
  id: z.ZodString;
561
584
  contentId: z.ZodString;
562
585
  type: z.ZodEnum<{
563
- community: "community";
564
586
  course: "course";
565
587
  download: "download";
588
+ community: "community";
566
589
  }>;
567
590
  title: z.ZodString;
568
591
  }, z.core.$strip>>;
@@ -574,6 +597,57 @@ declare const CommunityHome: z.ZodObject<{
574
597
  mutedUntil: z.ZodNullable<z.ZodCoercedDate<unknown>>;
575
598
  }, z.core.$strict>>;
576
599
  }, z.core.$strip>], "locked">>;
600
+ viewer: z.ZodObject<{
601
+ permissions: z.ZodArray<z.ZodEnum<{
602
+ "organizations:read": "organizations:read";
603
+ "organizations:write": "organizations:write";
604
+ "api_keys:read": "api_keys:read";
605
+ "api_keys:write": "api_keys:write";
606
+ "api_keys:delete": "api_keys:delete";
607
+ "notification_categories:read": "notification_categories:read";
608
+ "notification_categories:write": "notification_categories:write";
609
+ "integrations:read": "integrations:read";
610
+ "integrations:write": "integrations:write";
611
+ "integrations:delete": "integrations:delete";
612
+ "analytics:read": "analytics:read";
613
+ "people:read": "people:read";
614
+ "people:write": "people:write";
615
+ "people:delete": "people:delete";
616
+ "roles:read": "roles:read";
617
+ "roles:write": "roles:write";
618
+ "roles:delete": "roles:delete";
619
+ "access:read": "access:read";
620
+ "access:write": "access:write";
621
+ "bundles:read": "bundles:read";
622
+ "bundles:write": "bundles:write";
623
+ "bundles:delete": "bundles:delete";
624
+ "media:read": "media:read";
625
+ "media:write": "media:write";
626
+ "media:delete": "media:delete";
627
+ "courses:read": "courses:read";
628
+ "courses:write": "courses:write";
629
+ "courses:delete": "courses:delete";
630
+ "courses:moderate": "courses:moderate";
631
+ "progress:read": "progress:read";
632
+ "downloads:read": "downloads:read";
633
+ "downloads:write": "downloads:write";
634
+ "downloads:delete": "downloads:delete";
635
+ "communities:read": "communities:read";
636
+ "communities:write": "communities:write";
637
+ "communities:delete": "communities:delete";
638
+ "communities:moderate": "communities:moderate";
639
+ "events:read": "events:read";
640
+ "events:write": "events:write";
641
+ "events:delete": "events:delete";
642
+ "automations:read": "automations:read";
643
+ "automations:write": "automations:write";
644
+ "automations:delete": "automations:delete";
645
+ }>>;
646
+ opensEverySpace: z.ZodBoolean;
647
+ team: z.ZodBoolean;
648
+ roleName: z.ZodString;
649
+ canCreateEvents: z.ZodBoolean;
650
+ }, z.core.$strip>;
577
651
  }, z.core.$strip>;
578
652
  declare const CommunityAnalytics: z.ZodObject<{
579
653
  memberCount: z.ZodNumber;
@@ -1,6 +1,6 @@
1
1
  import { ListQuery, OrgUserProfileSchema, PageQuery, paginated } from "./shared.js";
2
2
  import { z } from "zod";
3
- import { communityStatusSchema, communityViewSchema, createCommunityInputSchema, createSpaceInputSchema, dmSettingsSchema, idSchema, patchCommunitySettingsInputSchema, patchDmSettingsInputSchema, roleSchema, setSpaceTopicsInputSchema, spaceDetailSchema, spaceMemberSchema, subscriptionViewSchema, updateCommunityInputSchema, updateSpaceInputSchema } from "@headless-lms/core/schemas";
3
+ import { communityStatusSchema, communityViewSchema, createCommunityInputSchema, createSpaceInputSchema, dmSettingsSchema, idSchema, patchCommunitySettingsInputSchema, patchDmSettingsInputSchema, permissionSchema, setSpaceTopicsInputSchema, spaceMemberSchema, spaceViewSchema, subscriptionViewSchema, updateCommunityInputSchema, updateSpaceInputSchema } from "@headless-lms/core/schemas";
4
4
  //#region src/http/schemas/community.ts
5
5
  const Community = communityViewSchema;
6
6
  const CommunitiesQuery = ListQuery.extend({ status: communityStatusSchema.optional() });
@@ -10,7 +10,7 @@ const UpdateCommunity = updateCommunityInputSchema;
10
10
  const PatchDmSettings = patchDmSettingsInputSchema;
11
11
  const PatchCommunitySettings = patchCommunitySettingsInputSchema;
12
12
  const DmSettings = dmSettingsSchema;
13
- const SpaceDetail = spaceDetailSchema;
13
+ const SpaceDetail = spaceViewSchema;
14
14
  const SpaceMember = spaceMemberSchema;
15
15
  const SpaceMembersPage = paginated(SpaceMember);
16
16
  const CreateSpace = createSpaceInputSchema;
@@ -42,17 +42,23 @@ const CommunityChatParam = z.object({
42
42
  communityId: z.string(),
43
43
  chatId: z.string()
44
44
  });
45
- const CommunityMember = OrgUserProfileSchema.extend({ role: roleSchema });
45
+ const CommunityMember = OrgUserProfileSchema.extend({
46
+ team: z.boolean().describe("Shown as team in the community."),
47
+ roleName: z.string().nullable().describe("The name of the role that makes them team in the community, or null."),
48
+ opensEverySpace: z.boolean().describe("Opens every space of the community, so holds no place in its spaces.")
49
+ });
46
50
  const CommunityMembersQuery = PageQuery.extend({ search: z.string().trim().optional() });
47
51
  const CommunityMembersPage = paginated(CommunityMember);
48
52
  const DirectoryEntry = z.object({
49
53
  orgUserId: z.string(),
50
- role: z.string(),
51
54
  displayName: z.string().nullable(),
52
55
  headline: z.string().nullable(),
53
56
  bio: z.string().nullable(),
54
57
  imageAssetId: z.string().nullable(),
55
- imageUrl: z.string().nullable()
58
+ imageUrl: z.string().nullable(),
59
+ team: z.boolean().describe("Shown as team in this community"),
60
+ roleName: z.string().nullable().describe("The name of the role that makes the person team here; null when not team"),
61
+ opensEverySpace: z.boolean().describe("Opens every space in this community, so holds no place in its spaces")
56
62
  });
57
63
  const DirectoryQuery = PageQuery.extend({ search: z.string().trim().max(100).optional().describe("Matches part of a display name") });
58
64
  const DirectoryPage = paginated(DirectoryEntry);
@@ -72,9 +78,12 @@ const CommunityHomeSpaceBase = z.object({
72
78
  "invited",
73
79
  "full",
74
80
  "none"
75
- ]).describe("Where the viewer stands with this space, and so which action it offers. `open`: the viewer can open it without joining (an all-members space, or staff). `member`: the viewer belongs to it. `requested`: the viewer asked to join and awaits a decision. `invited`: the viewer may accept or refuse an invitation. `full`: it is at capacity. `none`: none of these; ask to join a `by_request` space, or wait for an invitation to a `by_invite` one.")
81
+ ]).describe("Where the viewer stands with this space, and so which action it offers. `open`: the viewer can open it without joining (an all-members space, or the viewer opens every space). `member`: the viewer belongs to it. `requested`: the viewer asked to join and awaits a decision. `invited`: the viewer may accept or refuse an invitation. `full`: it is at capacity. `none`: none of these; ask to join a `by_request` space, or wait for an invitation to a `by_invite` one."),
82
+ coverUrl: z.string().nullable(),
83
+ backgroundUrl: z.string().nullable(),
84
+ iconUrl: z.string().nullable()
76
85
  });
77
- const LockedCommunitySpace = CommunityHomeSpaceBase.extend({ locked: z.literal(true).describe("The viewer cannot open this space. Only enough to request a place, accept an invite or contact staff is served; never its description, topics, links or settings") });
86
+ const LockedCommunitySpace = CommunityHomeSpaceBase.extend({ locked: z.literal(true).describe("The viewer cannot open this space. Only enough to request a place, accept an invite or contact the team is served; never its description, topics, links or settings") });
78
87
  const OpenCommunitySpace = CommunityHomeSpaceBase.extend({
79
88
  locked: z.literal(false).describe("The viewer can open this space and read its feed"),
80
89
  description: z.string().nullable(),
@@ -97,7 +106,7 @@ const OpenCommunitySpace = CommunityHomeSpaceBase.extend({
97
106
  "community"
98
107
  ]),
99
108
  title: z.string()
100
- })).describe("Linked content that is published; staff also see unpublished targets"),
109
+ })).describe("Linked content that is published; a holder of the item's read permission also sees it unpublished"),
101
110
  subscription: subscriptionViewSchema.nullable().describe("Your mute on this space while it applies; null when none")
102
111
  });
103
112
  const CommunityHomeSpace = z.discriminatedUnion("locked", [LockedCommunitySpace, OpenCommunitySpace]).describe("A space as the viewer sees it. A by-invite space the viewer is not invited to or a member of is never served");
@@ -107,7 +116,14 @@ const CommunityHome = z.object({
107
116
  description: z.string(),
108
117
  thumbnailUrl: z.string().nullable(),
109
118
  dm: dmSettingsSchema,
110
- spaces: z.array(CommunityHomeSpace)
119
+ spaces: z.array(CommunityHomeSpace),
120
+ viewer: z.object({
121
+ permissions: z.array(permissionSchema).describe("What the viewer holds on this community"),
122
+ opensEverySpace: z.boolean().describe("The viewer opens every space, so holds no place in its spaces"),
123
+ team: z.boolean().describe("The viewer is shown as team here"),
124
+ roleName: z.string().describe("The name of the viewer's role here"),
125
+ canCreateEvents: z.boolean().describe("The viewer holds `events:write` on the org")
126
+ }).describe("The viewer in this community")
111
127
  });
112
128
  const CommunityAnalytics = z.object({
113
129
  memberCount: z.number().int(),
@@ -1 +1 @@
1
- {"version":3,"file":"community.js","names":[],"sources":["../../../src/http/schemas/community.ts"],"sourcesContent":["import { z } from 'zod';\nimport {\n communityStatusSchema,\n roleSchema,\n communityViewSchema,\n createCommunityInputSchema,\n createSpaceInputSchema,\n dmSettingsSchema,\n idSchema,\n patchDmSettingsInputSchema,\n patchCommunitySettingsInputSchema,\n setSpaceTopicsInputSchema,\n spaceDetailSchema,\n spaceMemberSchema,\n subscriptionViewSchema,\n updateCommunityInputSchema,\n updateSpaceInputSchema,\n} from '@headless-lms/core/schemas';\nimport type {\n CommunityAnalytics as DomainCommunityAnalytics,\n CommunityMember as DomainCommunityMember,\n} from '@headless-lms/core/reporting/admin';\nimport type {\n CommunityHome as DomainCommunityHome,\n CommunityHomeSpace as DomainCommunityHomeSpace,\n DirectoryEntry as DomainDirectoryEntry,\n} from '@headless-lms/core/reporting/member';\nimport { ListQuery, OrgUserProfileSchema, PageQuery, paginated, type Matches } from './shared.js';\n\nexport const Community = communityViewSchema;\nexport const CommunitiesQuery = ListQuery.extend({\n status: communityStatusSchema.optional(),\n});\nexport const CommunitiesPage = paginated(Community);\nexport const CreateCommunity = createCommunityInputSchema;\nexport const UpdateCommunity = updateCommunityInputSchema;\nexport const PatchDmSettings = patchDmSettingsInputSchema;\nexport const PatchCommunitySettings = patchCommunitySettingsInputSchema;\nexport const DmSettings = dmSettingsSchema;\nexport const SpaceDetail = spaceDetailSchema;\nexport const SpaceMember = spaceMemberSchema;\nexport const SpaceMembersPage = paginated(SpaceMember);\nexport const CreateSpace = createSpaceInputSchema;\nexport const UpdateSpace = updateSpaceInputSchema;\nexport const SetSpaceTopics = setSpaceTopicsInputSchema;\nexport const OrderedIds = z\n .object({\n ids: z\n .array(idSchema)\n .min(1)\n .max(200)\n .describe('Every id in the collection, once each, in the new order'),\n })\n .strict();\nexport const SpaceLinkBody = z\n .object({ contentId: idSchema.describe('The course, download or community to link') })\n .strict();\n\nexport const CommunityIdParam = z.object({ communityId: z.string() });\nexport const CommunitySpaceParam = z.object({ communityId: z.string(), spaceId: z.string() });\nexport const SpaceIdParam = z.object({ spaceId: z.string() });\nexport const SpaceLinkParam = CommunitySpaceParam.extend({ linkId: z.string() });\nexport const SpaceMemberParam = CommunitySpaceParam.extend({ orgUserId: z.string() });\nexport const CommunityPostParam = z.object({ communityId: z.string(), postId: z.string() });\nexport const CommunityCommentParam = z.object({ communityId: z.string(), commentId: z.string() });\nexport const CommunityMessageParam = z.object({ communityId: z.string(), messageId: z.string() });\nexport const CommunityChatParam = z.object({ communityId: z.string(), chatId: z.string() });\n\nexport const CommunityMember = OrgUserProfileSchema.extend({ role: roleSchema });\ntype _CommunityMemberMatches = Matches<DomainCommunityMember, z.infer<typeof CommunityMember>> &\n Matches<z.infer<typeof CommunityMember>, DomainCommunityMember>;\nexport const CommunityMembersQuery = PageQuery.extend({ search: z.string().trim().optional() });\nexport const CommunityMembersPage = paginated(CommunityMember);\n\nexport const DirectoryEntry = z.object({\n orgUserId: z.string(),\n role: z.string(),\n displayName: z.string().nullable(),\n headline: z.string().nullable(),\n bio: z.string().nullable(),\n imageAssetId: z.string().nullable(),\n imageUrl: z.string().nullable(),\n});\ntype _DirectoryMatches = Matches<\n Omit<DomainDirectoryEntry, 'userId'>,\n z.infer<typeof DirectoryEntry>\n> &\n Matches<z.infer<typeof DirectoryEntry>, Omit<DomainDirectoryEntry, 'userId'>>;\nexport const DirectoryQuery = PageQuery.extend({\n search: z.string().trim().max(100).optional().describe('Matches part of a display name'),\n});\nexport const DirectoryPage = paginated(DirectoryEntry);\n\nconst CommunityHomeSpaceBase = z.object({\n id: z.string(),\n name: z.string(),\n memberCount: z.number().int().describe('Active space members'),\n accessRule: z.enum(['all_members', 'by_request', 'by_invite']),\n standing: z\n .enum(['open', 'member', 'requested', 'invited', 'full', 'none'])\n .describe(\n 'Where the viewer stands with this space, and so which action it offers. `open`: the viewer can open it without joining (an all-members space, or staff). `member`: the viewer belongs to it. `requested`: the viewer asked to join and awaits a decision. `invited`: the viewer may accept or refuse an invitation. `full`: it is at capacity. `none`: none of these; ask to join a `by_request` space, or wait for an invitation to a `by_invite` one.',\n ),\n});\n\nexport const LockedCommunitySpace = CommunityHomeSpaceBase.extend({\n locked: z\n .literal(true)\n .describe(\n 'The viewer cannot open this space. Only enough to request a place, accept an invite or contact staff is served; never its description, topics, links or settings',\n ),\n});\n\nexport const OpenCommunitySpace = CommunityHomeSpaceBase.extend({\n locked: z.literal(false).describe('The viewer can open this space and read its feed'),\n description: z.string().nullable(),\n capacity: z.number().int().nullable(),\n settings: z.object({\n comments: z.boolean(),\n reactions: z.boolean(),\n requireReview: z.boolean(),\n }),\n topics: z.array(z.object({ id: z.string(), name: z.string() })),\n links: z\n .array(\n z.object({\n id: z.string(),\n contentId: z.string(),\n type: z.enum(['course', 'download', 'community']),\n title: z.string(),\n }),\n )\n .describe('Linked content that is published; staff also see unpublished targets'),\n subscription: subscriptionViewSchema\n .nullable()\n .describe('Your mute on this space while it applies; null when none'),\n});\n\nexport const CommunityHomeSpace = z\n .discriminatedUnion('locked', [LockedCommunitySpace, OpenCommunitySpace])\n .describe(\n 'A space as the viewer sees it. A by-invite space the viewer is not invited to or a member of is never served',\n );\ntype _HomeSpaceMatches = Matches<DomainCommunityHomeSpace, z.infer<typeof CommunityHomeSpace>> &\n Matches<z.infer<typeof CommunityHomeSpace>, DomainCommunityHomeSpace>;\n\nexport const CommunityHome = z.object({\n communityId: z.string(),\n title: z.string(),\n description: z.string(),\n thumbnailUrl: z.string().nullable(),\n dm: dmSettingsSchema,\n spaces: z.array(CommunityHomeSpace),\n});\ntype _HomeMatches = Matches<DomainCommunityHome, z.infer<typeof CommunityHome>> &\n Matches<z.infer<typeof CommunityHome>, DomainCommunityHome>;\n\nexport const CommunityAnalytics = z.object({\n memberCount: z.number().int(),\n activeMembers: z.number().int(),\n postsPerSpace: z.array(z.object({ spaceId: z.string(), count: z.number().int() })),\n commentsPerPost: z.array(z.object({ postId: z.string(), count: z.number().int() })),\n messagesSent: z.number().int(),\n flagsRaised: z.number().int(),\n flagsResolved: z.number().int(),\n grantsLapsed: z.number().int(),\n grantsRenewed: z.number().int(),\n});\ntype _AnalyticsMatches = Matches<DomainCommunityAnalytics, z.infer<typeof CommunityAnalytics>> &\n Matches<z.infer<typeof CommunityAnalytics>, DomainCommunityAnalytics>;\n"],"mappings":";;;;AA6BA,MAAa,YAAY;AACzB,MAAa,mBAAmB,UAAU,OAAO,EAC/C,QAAQ,sBAAsB,SAAS,EACzC,CAAC;AACD,MAAa,kBAAkB,UAAU,SAAS;AAClD,MAAa,kBAAkB;AAC/B,MAAa,kBAAkB;AAC/B,MAAa,kBAAkB;AAC/B,MAAa,yBAAyB;AACtC,MAAa,aAAa;AAC1B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,mBAAmB,UAAU,WAAW;AACrD,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,iBAAiB;AAC9B,MAAa,aAAa,EACvB,OAAO,EACN,KAAK,EACF,MAAM,QAAQ,CAAC,CACf,IAAI,CAAC,CAAC,CACN,IAAI,GAAG,CAAC,CACR,SAAS,yDAAyD,EACvE,CAAC,CAAC,CACD,OAAO;AACV,MAAa,gBAAgB,EAC1B,OAAO,EAAE,WAAW,SAAS,SAAS,2CAA2C,EAAE,CAAC,CAAC,CACrF,OAAO;AAEV,MAAa,mBAAmB,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC;AACpE,MAAa,sBAAsB,EAAE,OAAO;CAAE,aAAa,EAAE,OAAO;CAAG,SAAS,EAAE,OAAO;AAAE,CAAC;AAC5F,MAAa,e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,EAAE,OAAO;CACpC,aAAa,EAAE,OAAO;CACtB,OAAO,EAAE,OAAO;CAChB,aAAa,EAAE,OAAO;CACtB,cAAc,EAAE,OAAO,CAAC,CAAC,SAAS;CAClC,IAAI;CACJ,QAAQ,EAAE,MAAM,kBAAkB;AACpC,CAAC;AAID,MAAa,qBAAqB,EAAE,OAAO;CACzC,aAAa,EAAE,OAAO,CAAC,CAAC,IAAI;CAC5B,eAAe,EAAE,OAAO,CAAC,CAAC,IAAI;CAC9B,eAAe,EAAE,MAAM,EAAE,OAAO;EAAE,SAAS,EAAE,OAAO;EAAG,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI;CAAE,CAAC,CAAC;CACjF,iBAAiB,EAAE,MAAM,EAAE,OAAO;EAAE,QAAQ,EAAE,OAAO;EAAG,OAAO,EAAE,OAAO,CAAC,CAAC,IAAI;CAAE,CAAC,CAAC;CAClF,cAAc,EAAE,OAAO,CAAC,CAAC,IAAI;CAC7B,aAAa,EAAE,OAAO,CAAC,CAAC,IAAI;CAC5B,eAAe,EAAE,OAAO,CAAC,CAAC,IAAI;CAC9B,cAAc,EAAE,OAAO,CAAC,CAAC,IAAI;CAC7B,eAAe,EAAE,OAAO,CAAC,CAAC,IAAI;AAChC,CAAC"}
1
+ {"version":3,"file":"community.js","names":[],"sources":["../../../src/http/schemas/community.ts"],"sourcesContent":["import { z } from 'zod';\nimport {\n communityStatusSchema,\n communityViewSchema,\n createCommunityInputSchema,\n createSpaceInputSchema,\n dmSettingsSchema,\n idSchema,\n patchDmSettingsInputSchema,\n permissionSchema,\n patchCommunitySettingsInputSchema,\n setSpaceTopicsInputSchema,\n spaceViewSchema,\n spaceMemberSchema,\n subscriptionViewSchema,\n updateCommunityInputSchema,\n updateSpaceInputSchema,\n} from '@headless-lms/core/schemas';\nimport type {\n CommunityAnalytics as DomainCommunityAnalytics,\n CommunityMember as DomainCommunityMember,\n} from '@headless-lms/core/reporting/admin';\nimport type {\n CommunityHome as DomainCommunityHome,\n CommunityHomeSpace as DomainCommunityHomeSpace,\n DirectoryEntry as DomainDirectoryEntry,\n} from '@headless-lms/core/reporting/member';\nimport { ListQuery, OrgUserProfileSchema, PageQuery, paginated, type Matches } from './shared.js';\n\nexport const Community = communityViewSchema;\nexport const CommunitiesQuery = ListQuery.extend({\n status: communityStatusSchema.optional(),\n});\nexport const CommunitiesPage = paginated(Community);\nexport const CreateCommunity = createCommunityInputSchema;\nexport const UpdateCommunity = updateCommunityInputSchema;\nexport const PatchDmSettings = patchDmSettingsInputSchema;\nexport const PatchCommunitySettings = patchCommunitySettingsInputSchema;\nexport const DmSettings = dmSettingsSchema;\nexport const SpaceDetail = spaceViewSchema;\nexport const SpaceMember = spaceMemberSchema;\nexport const SpaceMembersPage = paginated(SpaceMember);\nexport const CreateSpace = createSpaceInputSchema;\nexport const UpdateSpace = updateSpaceInputSchema;\nexport const SetSpaceTopics = setSpaceTopicsInputSchema;\nexport const OrderedIds = z\n .object({\n ids: z\n .array(idSchema)\n .min(1)\n .max(200)\n .describe('Every id in the collection, once each, in the new order'),\n })\n .strict();\nexport const SpaceLinkBody = z\n .object({ contentId: idSchema.describe('The course, download or community to link') })\n .strict();\n\nexport const CommunityIdParam = z.object({ communityId: z.string() });\nexport const CommunitySpaceParam = z.object({ communityId: z.string(), spaceId: z.string() });\nexport const SpaceIdParam = z.object({ spaceId: z.string() });\nexport const SpaceLinkParam = CommunitySpaceParam.extend({ linkId: z.string() });\nexport const SpaceMemberParam = CommunitySpaceParam.extend({ orgUserId: z.string() });\nexport const CommunityPostParam = z.object({ communityId: z.string(), postId: z.string() });\nexport const CommunityCommentParam = z.object({ communityId: z.string(), commentId: z.string() });\nexport const CommunityMessageParam = z.object({ communityId: z.string(), messageId: z.string() });\nexport const CommunityChatParam = z.object({ communityId: z.string(), chatId: z.string() });\n\nexport const CommunityMember = OrgUserProfileSchema.extend({\n team: z.boolean().describe('Shown as team in the community.'),\n roleName: z\n .string()\n .nullable()\n .describe('The name of the role that makes them team in the community, or null.'),\n opensEverySpace: z\n .boolean()\n .describe('Opens every space of the community, so holds no place in its spaces.'),\n});\ntype _CommunityMemberMatches = Matches<DomainCommunityMember, z.infer<typeof CommunityMember>> &\n Matches<z.infer<typeof CommunityMember>, DomainCommunityMember>;\nexport const CommunityMembersQuery = PageQuery.extend({ search: z.string().trim().optional() });\nexport const CommunityMembersPage = paginated(CommunityMember);\n\nexport const DirectoryEntry = z.object({\n orgUserId: z.string(),\n displayName: z.string().nullable(),\n headline: z.string().nullable(),\n bio: z.string().nullable(),\n imageAssetId: z.string().nullable(),\n imageUrl: z.string().nullable(),\n team: z.boolean().describe('Shown as team in this community'),\n roleName: z\n .string()\n .nullable()\n .describe('The name of the role that makes the person team here; null when not team'),\n opensEverySpace: z\n .boolean()\n .describe('Opens every space in this community, so holds no place in its spaces'),\n});\ntype _DirectoryMatches = Matches<\n Omit<DomainDirectoryEntry, 'userId'>,\n z.infer<typeof DirectoryEntry>\n> &\n Matches<z.infer<typeof DirectoryEntry>, Omit<DomainDirectoryEntry, 'userId'>>;\nexport const DirectoryQuery = PageQuery.extend({\n search: z.string().trim().max(100).optional().describe('Matches part of a display name'),\n});\nexport const DirectoryPage = paginated(DirectoryEntry);\n\nconst CommunityHomeSpaceBase = z.object({\n id: z.string(),\n name: z.string(),\n memberCount: z.number().int().describe('Active space members'),\n accessRule: z.enum(['all_members', 'by_request', 'by_invite']),\n standing: z\n .enum(['open', 'member', 'requested', 'invited', 'full', 'none'])\n .describe(\n 'Where the viewer stands with this space, and so which action it offers. `open`: the viewer can open it without joining (an all-members space, or the viewer opens every space). `member`: the viewer belongs to it. `requested`: the viewer asked to join and awaits a decision. `invited`: the viewer may accept or refuse an invitation. `full`: it is at capacity. `none`: none of these; ask to join a `by_request` space, or wait for an invitation to a `by_invite` one.',\n ),\n coverUrl: z.string().nullable(),\n backgroundUrl: z.string().nullable(),\n iconUrl: z.string().nullable(),\n});\n\nexport const LockedCommunitySpace = CommunityHomeSpaceBase.extend({\n locked: z\n .literal(true)\n .describe(\n 'The viewer cannot open this space. Only enough to request a place, accept an invite or contact the team is served; never its description, topics, links or settings',\n ),\n});\n\nexport const OpenCommunitySpace = CommunityHomeSpaceBase.extend({\n locked: z.literal(false).describe('The viewer can open this space and read its feed'),\n description: z.string().nullable(),\n capacity: z.number().int().nullable(),\n settings: z.object({\n comments: z.boolean(),\n reactions: z.boolean(),\n requireReview: z.boolean(),\n }),\n topics: z.array(z.object({ id: z.string(), name: z.string() })),\n links: z\n .array(\n z.object({\n id: z.string(),\n contentId: z.string(),\n type: z.enum(['course', 'download', 'community']),\n title: z.string(),\n }),\n )\n .describe(\n \"Linked content that is published; a holder of the item's read permission also sees it unpublished\",\n ),\n subscription: subscriptionViewSchema\n .nullable()\n .describe('Your mute on this space while it applies; null when none'),\n});\n\nexport const CommunityHomeSpace = z\n .discriminatedUnion('locked', [LockedCommunitySpace, OpenCommunitySpace])\n .describe(\n 'A space as the viewer sees it. A by-invite space the viewer is not invited to or a member of is never served',\n );\ntype _HomeSpaceMatches = Matches<DomainCommunityHomeSpace, z.infer<typeof CommunityHomeSpace>> &\n Matches<z.infer<typeof CommunityHomeSpace>, DomainCommunityHomeSpace>;\n\nexport const CommunityHome = z.object({\n communityId: z.string(),\n title: z.string(),\n description: z.string(),\n thumbnailUrl: z.string().nullable(),\n dm: dmSettingsSchema,\n spaces: z.array(CommunityHomeSpace),\n viewer: z\n .object({\n permissions: z.array(permissionSchema).describe('What the viewer holds on this community'),\n opensEverySpace: z\n .boolean()\n .describe('The viewer opens every space, so holds no place in its spaces'),\n team: z.boolean().describe('The viewer is shown as team here'),\n roleName: z.string().describe(\"The name of the viewer's role here\"),\n canCreateEvents: z.boolean().describe('The viewer holds `events:write` on the org'),\n })\n .describe('The viewer in this community'),\n});\ntype _HomeMatches = Matches<DomainCommunityHome, z.infer<typeof CommunityHome>> &\n Matches<z.infer<typeof CommunityHome>, DomainCommunityHome>;\n\nexport const CommunityAnalytics = z.object({\n memberCount: z.number().int(),\n activeMembers: z.number().int(),\n postsPerSpace: z.array(z.object({ spaceId: z.string(), count: z.number().int() })),\n commentsPerPost: z.array(z.object({ postId: z.string(), count: z.number().int() })),\n messagesSent: z.number().int(),\n flagsRaised: z.number().int(),\n flagsResolved: z.number().int(),\n grantsLapsed: z.number().int(),\n grantsRenewed: z.number().int(),\n});\ntype _AnalyticsMatches = Matches<DomainCommunityAnalytics, z.infer<typeof CommunityAnalytics>> &\n Matches<z.infer<typeof CommunityAnalytics>, DomainCommunityAnalytics>;\n"],"mappings":";;;;AA6BA,MAAa,YAAY;AACzB,MAAa,mBAAmB,UAAU,OAAO,EAC/C,QAAQ,sBAAsB,SAAS,EACzC,CAAC;AACD,MAAa,kBAAkB,UAAU,SAAS;AAClD,MAAa,kBAAkB;AAC/B,MAAa,kBAAkB;AAC/B,MAAa,kBAAkB;AAC/B,MAAa,yBAAyB;AACtC,MAAa,aAAa;AAC1B,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,mBAAmB,UAAU,WAAW;AACrD,MAAa,cAAc;AAC3B,MAAa,cAAc;AAC3B,MAAa,iBAAiB;AAC9B,MAAa,aAAa,EACvB,OAAO,EACN,KAAK,EACF,MAAM,QAAQ,CAAC,CACf,IAAI,CAAC,CAAC,CACN,IAAI,GAAG,CAAC,CACR,SAAS,yDAAyD,EACvE,CAAC,CAAC,CACD,OAAO;AACV,MAAa,gBAAgB,EAC1B,OAAO,EAAE,WAAW,SAAS,SAAS,2CAA2C,EAAE,CAAC,CAAC,CACrF,OAAO;AAEV,MAAa,mBAAmB,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC;AACpE,MAAa,sBAAsB,EAAE,OAAO;CAAE,aAAa,EAAE,OAAO;CAAG,SAAS,EAAE,OAAO;AAAE,CAAC;AAC5F,MAAa,eAAe,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AAC5D,MAAa,iBAAiB,oBAAoB,OAAO,EAAE,QAAQ,EAAE,OAAO,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;CAC7B,aAAa,EAAE,OAAO,CAAC,CAAC,IAAI;CAC5B,eAAe,EAAE,OAAO,CAAC,CAAC,IAAI;CAC9B,cAAc,EAAE,OAAO,CAAC,CAAC,IAAI;CAC7B,eAAe,EAAE,OAAO,CAAC,CAAC,IAAI;AAChC,CAAC"}
@@ -24,6 +24,56 @@ declare const CourseAnalytics: z.ZodObject<{
24
24
  }, z.core.$strip>>;
25
25
  }, z.core.$strip>;
26
26
  type CourseAnalytics = z.infer<typeof CourseAnalytics>;
27
+ declare const CourseLearner: z.ZodObject<{
28
+ id: z.ZodString;
29
+ firstName: z.ZodNullable<z.ZodString>;
30
+ lastName: z.ZodNullable<z.ZodString>;
31
+ email: z.ZodString;
32
+ image: z.ZodNullable<z.ZodString>;
33
+ status: z.ZodEnum<{
34
+ active: "active";
35
+ revoked: "revoked";
36
+ expired: "expired";
37
+ }>;
38
+ source: z.ZodString;
39
+ grantedAt: z.ZodString;
40
+ expiresAt: z.ZodNullable<z.ZodString>;
41
+ totalActivities: z.ZodNumber;
42
+ completedActivities: z.ZodNumber;
43
+ progress: z.ZodNumber;
44
+ lastActivityAt: z.ZodNullable<z.ZodString>;
45
+ completedAt: z.ZodNullable<z.ZodString>;
46
+ }, z.core.$strip>;
47
+ declare const CourseLearnersQuery: z.ZodObject<{
48
+ page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
49
+ pageSize: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
50
+ search: z.ZodOptional<z.ZodString>;
51
+ }, z.core.$strict>;
52
+ declare const CourseLearnersPage: z.ZodObject<{
53
+ rows: z.ZodArray<z.ZodObject<{
54
+ id: z.ZodString;
55
+ firstName: z.ZodNullable<z.ZodString>;
56
+ lastName: z.ZodNullable<z.ZodString>;
57
+ email: z.ZodString;
58
+ image: z.ZodNullable<z.ZodString>;
59
+ status: z.ZodEnum<{
60
+ active: "active";
61
+ revoked: "revoked";
62
+ expired: "expired";
63
+ }>;
64
+ source: z.ZodString;
65
+ grantedAt: z.ZodString;
66
+ expiresAt: z.ZodNullable<z.ZodString>;
67
+ totalActivities: z.ZodNumber;
68
+ completedActivities: z.ZodNumber;
69
+ progress: z.ZodNumber;
70
+ lastActivityAt: z.ZodNullable<z.ZodString>;
71
+ completedAt: z.ZodNullable<z.ZodString>;
72
+ }, z.core.$strip>>;
73
+ total: z.ZodNumber;
74
+ page: z.ZodNumber;
75
+ pageSize: z.ZodNumber;
76
+ }, z.core.$strip>;
27
77
  //#endregion
28
- export { CourseActivityEngagement, CourseAnalytics };
78
+ export { CourseActivityEngagement, CourseAnalytics, CourseLearner, CourseLearnersPage, CourseLearnersQuery };
29
79
  //# sourceMappingURL=course-analytics.d.ts.map
@@ -1,3 +1,4 @@
1
+ import { OrgUserProfileSchema, PageQuery, paginated } from "./shared.js";
1
2
  import { z } from "zod";
2
3
  //#region src/http/schemas/course-analytics.ts
3
4
  const CourseActivityEngagement = z.object({
@@ -15,7 +16,24 @@ const CourseAnalytics = z.object({
15
16
  avgProgress: z.number().int(),
16
17
  activities: z.array(CourseActivityEngagement)
17
18
  });
19
+ const CourseLearner = OrgUserProfileSchema.extend({
20
+ status: z.enum([
21
+ "active",
22
+ "expired",
23
+ "revoked"
24
+ ]).describe("The status of the grant that opens the course to them."),
25
+ source: z.string().describe("Where the grant came from."),
26
+ grantedAt: z.string(),
27
+ expiresAt: z.string().nullable(),
28
+ totalActivities: z.number().int().describe("Published activities in the course."),
29
+ completedActivities: z.number().int(),
30
+ progress: z.number().int().describe("Completed published activities over the total, 0–100."),
31
+ lastActivityAt: z.string().nullable(),
32
+ completedAt: z.string().nullable()
33
+ });
34
+ const CourseLearnersQuery = PageQuery.extend({ search: z.string().trim().optional() });
35
+ const CourseLearnersPage = paginated(CourseLearner);
18
36
  //#endregion
19
- export { CourseActivityEngagement, CourseAnalytics };
37
+ export { CourseActivityEngagement, CourseAnalytics, CourseLearner, CourseLearnersPage, CourseLearnersQuery };
20
38
 
21
39
  //# sourceMappingURL=course-analytics.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"course-analytics.js","names":[],"sources":["../../../src/http/schemas/course-analytics.ts"],"sourcesContent":["// Per-course analytics resource schemas.\nimport { z } from 'zod';\n\nexport const CourseActivityEngagement = z.object({\n activityId: z.string(),\n title: z.string(),\n moduleId: z.string(),\n moduleTitle: z.string(),\n started: z.number().int(),\n completed: z.number().int(),\n});\nexport type CourseActivityEngagement = z.infer<typeof CourseActivityEngagement>;\n\nexport const CourseAnalytics = z.object({\n enrolled: z.number().int(),\n started: z.number().int(),\n completed: z.number().int(),\n avgProgress: z.number().int(),\n activities: z.array(CourseActivityEngagement),\n});\nexport type CourseAnalytics = z.infer<typeof CourseAnalytics>;\n"],"mappings":";;AAGA,MAAa,2BAA2B,EAAE,OAAO;CAC/C,YAAY,EAAE,OAAO;CACrB,OAAO,EAAE,OAAO;CAChB,UAAU,EAAE,OAAO;CACnB,aAAa,EAAE,OAAO;CACtB,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI;CACxB,WAAW,EAAE,OAAO,CAAC,CAAC,IAAI;AAC5B,CAAC;AAGD,MAAa,kBAAkB,EAAE,OAAO;CACtC,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI;CACzB,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI;CACxB,WAAW,EAAE,OAAO,CAAC,CAAC,IAAI;CAC1B,aAAa,EAAE,OAAO,CAAC,CAAC,IAAI;CAC5B,YAAY,EAAE,MAAM,wBAAwB;AAC9C,CAAC"}
1
+ {"version":3,"file":"course-analytics.js","names":[],"sources":["../../../src/http/schemas/course-analytics.ts"],"sourcesContent":["// Per-course analytics resource schemas.\nimport type { CourseLearner as DomainCourseLearner } from '@headless-lms/core/reporting/admin';\nimport { z } from 'zod';\nimport { OrgUserProfileSchema, PageQuery, paginated, type Matches } from './shared.js';\n\nexport const CourseActivityEngagement = z.object({\n activityId: z.string(),\n title: z.string(),\n moduleId: z.string(),\n moduleTitle: z.string(),\n started: z.number().int(),\n completed: z.number().int(),\n});\nexport type CourseActivityEngagement = z.infer<typeof CourseActivityEngagement>;\n\nexport const CourseAnalytics = z.object({\n enrolled: z.number().int(),\n started: z.number().int(),\n completed: z.number().int(),\n avgProgress: z.number().int(),\n activities: z.array(CourseActivityEngagement),\n});\nexport type CourseAnalytics = z.infer<typeof CourseAnalytics>;\n\nexport const CourseLearner = OrgUserProfileSchema.extend({\n status: z\n .enum(['active', 'expired', 'revoked'])\n .describe('The status of the grant that opens the course to them.'),\n source: z.string().describe('Where the grant came from.'),\n grantedAt: z.string(),\n expiresAt: z.string().nullable(),\n totalActivities: z.number().int().describe('Published activities in the course.'),\n completedActivities: z.number().int(),\n progress: z.number().int().describe('Completed published activities over the total, 0–100.'),\n lastActivityAt: z.string().nullable(),\n completedAt: z.string().nullable(),\n});\ntype _CourseLearnerMatches = Matches<DomainCourseLearner, z.infer<typeof CourseLearner>> &\n Matches<z.infer<typeof CourseLearner>, DomainCourseLearner>;\nexport const CourseLearnersQuery = PageQuery.extend({ search: z.string().trim().optional() });\nexport const CourseLearnersPage = paginated(CourseLearner);\n"],"mappings":";;;AAKA,MAAa,2BAA2B,EAAE,OAAO;CAC/C,YAAY,EAAE,OAAO;CACrB,OAAO,EAAE,OAAO;CAChB,UAAU,EAAE,OAAO;CACnB,aAAa,EAAE,OAAO;CACtB,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI;CACxB,WAAW,EAAE,OAAO,CAAC,CAAC,IAAI;AAC5B,CAAC;AAGD,MAAa,kBAAkB,EAAE,OAAO;CACtC,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI;CACzB,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI;CACxB,WAAW,EAAE,OAAO,CAAC,CAAC,IAAI;CAC1B,aAAa,EAAE,OAAO,CAAC,CAAC,IAAI;CAC5B,YAAY,EAAE,MAAM,wBAAwB;AAC9C,CAAC;AAGD,MAAa,gBAAgB,qBAAqB,OAAO;CACvD,QAAQ,EACL,KAAK;EAAC;EAAU;EAAW;CAAS,CAAC,CAAC,CACtC,SAAS,wDAAwD;CACpE,QAAQ,EAAE,OAAO,CAAC,CAAC,SAAS,4BAA4B;CACxD,WAAW,EAAE,OAAO;CACpB,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS;CAC/B,iBAAiB,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,qCAAqC;CAChF,qBAAqB,EAAE,OAAO,CAAC,CAAC,IAAI;CACpC,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,uDAAuD;CAC3F,gBAAgB,EAAE,OAAO,CAAC,CAAC,SAAS;CACpC,aAAa,EAAE,OAAO,CAAC,CAAC,SAAS;AACnC,CAAC;AAGD,MAAa,sBAAsB,UAAU,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,SAAS,EAAE,CAAC;AAC5F,MAAa,qBAAqB,UAAU,aAAa"}
@@ -5,6 +5,7 @@ declare const OverviewStats: z.ZodObject<{
5
5
  draftCourses: z.ZodNumber;
6
6
  activeStudents: z.ZodNumber;
7
7
  expiringSoon: z.ZodNumber;
8
+ upcomingEvents: z.ZodNumber;
8
9
  }, z.core.$strip>;
9
10
  type OverviewStats = z.infer<typeof OverviewStats>;
10
11
  declare const EnrollmentPoint: z.ZodObject<{
@@ -4,7 +4,8 @@ const OverviewStats = z.object({
4
4
  publishedCourses: z.number().int(),
5
5
  draftCourses: z.number().int(),
6
6
  activeStudents: z.number().int(),
7
- expiringSoon: z.number().int()
7
+ expiringSoon: z.number().int(),
8
+ upcomingEvents: z.number().int().describe("Published events that have not ended")
8
9
  });
9
10
  const EnrollmentPoint = z.object({
10
11
  date: z.string(),
@@ -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"}