@headless-lms/server 0.4.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 (223) 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 +16 -31
  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 +71 -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 +19 -14
  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 +211 -32
  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 +91 -44
  154. package/dist/http/schemas/community.js +21 -8
  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 +15 -5
  172. package/dist/http/schemas/files.js +10 -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/integrations.d.ts +4 -4
  177. package/dist/http/schemas/invites.d.ts +3 -47
  178. package/dist/http/schemas/invites.js +4 -25
  179. package/dist/http/schemas/invites.js.map +1 -1
  180. package/dist/http/schemas/member.d.ts +94 -7
  181. package/dist/http/schemas/member.js +7 -3
  182. package/dist/http/schemas/member.js.map +1 -1
  183. package/dist/http/schemas/members.d.ts +333 -69
  184. package/dist/http/schemas/members.js +67 -25
  185. package/dist/http/schemas/members.js.map +1 -1
  186. package/dist/http/schemas/notifications.d.ts +57 -53
  187. package/dist/http/schemas/platform.d.ts +37 -0
  188. package/dist/http/schemas/platform.js +19 -0
  189. package/dist/http/schemas/platform.js.map +1 -0
  190. package/dist/http/schemas/posts.d.ts +55 -35
  191. package/dist/http/schemas/posts.js +4 -4
  192. package/dist/http/schemas/posts.js.map +1 -1
  193. package/dist/http/schemas/profile.d.ts +1 -1
  194. package/dist/http/schemas/shared.d.ts +1 -11
  195. package/dist/http/schemas/shared.js +1 -10
  196. package/dist/http/schemas/shared.js.map +1 -1
  197. package/dist/http/schemas/students.d.ts +25 -3
  198. package/dist/http/schemas/students.js +3 -1
  199. package/dist/http/schemas/students.js.map +1 -1
  200. package/dist/http/scope.d.ts +9 -13
  201. package/dist/http/scope.js +29 -40
  202. package/dist/http/scope.js.map +1 -1
  203. package/dist/http/server.js +9 -0
  204. package/dist/http/server.js.map +1 -1
  205. package/dist/http/shutdown.d.ts +11 -0
  206. package/dist/http/shutdown.js +40 -0
  207. package/dist/http/shutdown.js.map +1 -0
  208. package/dist/http/sse.d.ts +19 -0
  209. package/dist/http/sse.js +104 -0
  210. package/dist/http/sse.js.map +1 -0
  211. package/dist/http/test-caller.d.ts +13 -0
  212. package/dist/http/test-caller.js +14 -0
  213. package/dist/http/test-caller.js.map +1 -0
  214. package/dist/http/well-known.js +2 -2
  215. package/dist/http/well-known.js.map +1 -1
  216. package/dist/index.d.ts +4 -2
  217. package/dist/index.js +4 -2
  218. package/dist/index.js.map +1 -1
  219. package/dist/packages/server/package.js +1 -1
  220. package/package.json +7 -6
  221. package/dist/http/routes/member/actor.d.ts +0 -14
  222. package/dist/http/routes/member/actor.js +0 -11
  223. 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;
@@ -182,9 +182,9 @@ declare const SpaceMember: z.ZodObject<{
182
182
  spaceId: z.ZodString;
183
183
  orgUserId: z.ZodString;
184
184
  status: z.ZodEnum<{
185
- active: "active";
186
- invited: "invited";
187
185
  requested: "requested";
186
+ invited: "invited";
187
+ active: "active";
188
188
  revoked: "revoked";
189
189
  }>;
190
190
  source: z.ZodEnum<{
@@ -203,9 +203,9 @@ declare const SpaceMembersPage: z.ZodObject<{
203
203
  spaceId: z.ZodString;
204
204
  orgUserId: z.ZodString;
205
205
  status: z.ZodEnum<{
206
- active: "active";
207
- invited: "invited";
208
206
  requested: "requested";
207
+ invited: "invited";
208
+ active: "active";
209
209
  revoked: "revoked";
210
210
  }>;
211
211
  source: z.ZodEnum<{
@@ -304,13 +304,9 @@ declare const CommunityMember: z.ZodObject<{
304
304
  lastName: z.ZodNullable<z.ZodString>;
305
305
  email: z.ZodString;
306
306
  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
- }>;
307
+ team: z.ZodBoolean;
308
+ roleName: z.ZodNullable<z.ZodString>;
309
+ opensEverySpace: z.ZodBoolean;
314
310
  }, z.core.$strip>;
315
311
  declare const CommunityMembersQuery: z.ZodObject<{
316
312
  page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
@@ -324,13 +320,9 @@ declare const CommunityMembersPage: z.ZodObject<{
324
320
  lastName: z.ZodNullable<z.ZodString>;
325
321
  email: z.ZodString;
326
322
  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
- }>;
323
+ team: z.ZodBoolean;
324
+ roleName: z.ZodNullable<z.ZodString>;
325
+ opensEverySpace: z.ZodBoolean;
334
326
  }, z.core.$strip>>;
335
327
  total: z.ZodNumber;
336
328
  page: z.ZodNumber;
@@ -338,12 +330,14 @@ declare const CommunityMembersPage: z.ZodObject<{
338
330
  }, z.core.$strip>;
339
331
  declare const DirectoryEntry: z.ZodObject<{
340
332
  orgUserId: z.ZodString;
341
- role: z.ZodString;
342
333
  displayName: z.ZodNullable<z.ZodString>;
343
334
  headline: z.ZodNullable<z.ZodString>;
344
335
  bio: z.ZodNullable<z.ZodString>;
345
336
  imageAssetId: z.ZodNullable<z.ZodString>;
346
337
  imageUrl: z.ZodNullable<z.ZodString>;
338
+ team: z.ZodBoolean;
339
+ roleName: z.ZodNullable<z.ZodString>;
340
+ opensEverySpace: z.ZodBoolean;
347
341
  }, z.core.$strip>;
348
342
  declare const DirectoryQuery: z.ZodObject<{
349
343
  page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
@@ -353,12 +347,14 @@ declare const DirectoryQuery: z.ZodObject<{
353
347
  declare const DirectoryPage: z.ZodObject<{
354
348
  rows: z.ZodArray<z.ZodObject<{
355
349
  orgUserId: z.ZodString;
356
- role: z.ZodString;
357
350
  displayName: z.ZodNullable<z.ZodString>;
358
351
  headline: z.ZodNullable<z.ZodString>;
359
352
  bio: z.ZodNullable<z.ZodString>;
360
353
  imageAssetId: z.ZodNullable<z.ZodString>;
361
354
  imageUrl: z.ZodNullable<z.ZodString>;
355
+ team: z.ZodBoolean;
356
+ roleName: z.ZodNullable<z.ZodString>;
357
+ opensEverySpace: z.ZodBoolean;
362
358
  }, z.core.$strip>>;
363
359
  total: z.ZodNumber;
364
360
  page: z.ZodNumber;
@@ -374,10 +370,10 @@ declare const LockedCommunitySpace: z.ZodObject<{
374
370
  by_invite: "by_invite";
375
371
  }>;
376
372
  standing: z.ZodEnum<{
377
- invited: "invited";
378
- member: "member";
379
373
  open: "open";
380
374
  requested: "requested";
375
+ invited: "invited";
376
+ member: "member";
381
377
  full: "full";
382
378
  none: "none";
383
379
  }>;
@@ -393,10 +389,10 @@ declare const OpenCommunitySpace: z.ZodObject<{
393
389
  by_invite: "by_invite";
394
390
  }>;
395
391
  standing: z.ZodEnum<{
396
- invited: "invited";
397
- member: "member";
398
392
  open: "open";
399
393
  requested: "requested";
394
+ invited: "invited";
395
+ member: "member";
400
396
  full: "full";
401
397
  none: "none";
402
398
  }>;
@@ -440,10 +436,10 @@ declare const CommunityHomeSpace: z.ZodDiscriminatedUnion<[z.ZodObject<{
440
436
  by_invite: "by_invite";
441
437
  }>;
442
438
  standing: z.ZodEnum<{
443
- invited: "invited";
444
- member: "member";
445
439
  open: "open";
446
440
  requested: "requested";
441
+ invited: "invited";
442
+ member: "member";
447
443
  full: "full";
448
444
  none: "none";
449
445
  }>;
@@ -458,10 +454,10 @@ declare const CommunityHomeSpace: z.ZodDiscriminatedUnion<[z.ZodObject<{
458
454
  by_invite: "by_invite";
459
455
  }>;
460
456
  standing: z.ZodEnum<{
461
- invited: "invited";
462
- member: "member";
463
457
  open: "open";
464
458
  requested: "requested";
459
+ invited: "invited";
460
+ member: "member";
465
461
  full: "full";
466
462
  none: "none";
467
463
  }>;
@@ -503,8 +499,8 @@ declare const CommunityHome: z.ZodObject<{
503
499
  dm: z.ZodObject<{
504
500
  enabled: z.ZodBoolean;
505
501
  memberToMember: z.ZodBoolean;
506
- memberToStaff: z.ZodBoolean;
507
- staffToAnyone: z.ZodBoolean;
502
+ memberToTeam: z.ZodBoolean;
503
+ teamToAnyone: z.ZodBoolean;
508
504
  firstMessageIsRequest: z.ZodBoolean;
509
505
  groupChats: z.ZodBoolean;
510
506
  groupSize: z.ZodNumber;
@@ -519,10 +515,10 @@ declare const CommunityHome: z.ZodObject<{
519
515
  by_invite: "by_invite";
520
516
  }>;
521
517
  standing: z.ZodEnum<{
522
- invited: "invited";
523
- member: "member";
524
518
  open: "open";
525
519
  requested: "requested";
520
+ invited: "invited";
521
+ member: "member";
526
522
  full: "full";
527
523
  none: "none";
528
524
  }>;
@@ -537,10 +533,10 @@ declare const CommunityHome: z.ZodObject<{
537
533
  by_invite: "by_invite";
538
534
  }>;
539
535
  standing: z.ZodEnum<{
540
- invited: "invited";
541
- member: "member";
542
536
  open: "open";
543
537
  requested: "requested";
538
+ invited: "invited";
539
+ member: "member";
544
540
  full: "full";
545
541
  none: "none";
546
542
  }>;
@@ -574,6 +570,57 @@ declare const CommunityHome: z.ZodObject<{
574
570
  mutedUntil: z.ZodNullable<z.ZodCoercedDate<unknown>>;
575
571
  }, z.core.$strict>>;
576
572
  }, z.core.$strip>], "locked">>;
573
+ viewer: z.ZodObject<{
574
+ permissions: z.ZodArray<z.ZodEnum<{
575
+ "organizations:read": "organizations:read";
576
+ "organizations:write": "organizations:write";
577
+ "api_keys:read": "api_keys:read";
578
+ "api_keys:write": "api_keys:write";
579
+ "api_keys:delete": "api_keys:delete";
580
+ "notification_categories:read": "notification_categories:read";
581
+ "notification_categories:write": "notification_categories:write";
582
+ "integrations:read": "integrations:read";
583
+ "integrations:write": "integrations:write";
584
+ "integrations:delete": "integrations:delete";
585
+ "analytics:read": "analytics:read";
586
+ "people:read": "people:read";
587
+ "people:write": "people:write";
588
+ "people:delete": "people:delete";
589
+ "roles:read": "roles:read";
590
+ "roles:write": "roles:write";
591
+ "roles:delete": "roles:delete";
592
+ "access:read": "access:read";
593
+ "access:write": "access:write";
594
+ "bundles:read": "bundles:read";
595
+ "bundles:write": "bundles:write";
596
+ "bundles:delete": "bundles:delete";
597
+ "media:read": "media:read";
598
+ "media:write": "media:write";
599
+ "media:delete": "media:delete";
600
+ "courses:read": "courses:read";
601
+ "courses:write": "courses:write";
602
+ "courses:delete": "courses:delete";
603
+ "courses:moderate": "courses:moderate";
604
+ "progress:read": "progress:read";
605
+ "downloads:read": "downloads:read";
606
+ "downloads:write": "downloads:write";
607
+ "downloads:delete": "downloads:delete";
608
+ "communities:read": "communities:read";
609
+ "communities:write": "communities:write";
610
+ "communities:delete": "communities:delete";
611
+ "communities:moderate": "communities:moderate";
612
+ "events:read": "events:read";
613
+ "events:write": "events:write";
614
+ "events:delete": "events:delete";
615
+ "automations:read": "automations:read";
616
+ "automations:write": "automations:write";
617
+ "automations:delete": "automations:delete";
618
+ }>>;
619
+ opensEverySpace: z.ZodBoolean;
620
+ team: z.ZodBoolean;
621
+ roleName: z.ZodString;
622
+ canCreateEvents: z.ZodBoolean;
623
+ }, z.core.$strip>;
577
624
  }, z.core.$strip>;
578
625
  declare const CommunityAnalytics: z.ZodObject<{
579
626
  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, spaceDetailSchema, spaceMemberSchema, 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() });
@@ -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,9 @@ 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.")
76
82
  });
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") });
83
+ 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
84
  const OpenCommunitySpace = CommunityHomeSpaceBase.extend({
79
85
  locked: z.literal(false).describe("The viewer can open this space and read its feed"),
80
86
  description: z.string().nullable(),
@@ -97,7 +103,7 @@ const OpenCommunitySpace = CommunityHomeSpaceBase.extend({
97
103
  "community"
98
104
  ]),
99
105
  title: z.string()
100
- })).describe("Linked content that is published; staff also see unpublished targets"),
106
+ })).describe("Linked content that is published; a holder of the item's read permission also sees it unpublished"),
101
107
  subscription: subscriptionViewSchema.nullable().describe("Your mute on this space while it applies; null when none")
102
108
  });
103
109
  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 +113,14 @@ const CommunityHome = z.object({
107
113
  description: z.string(),
108
114
  thumbnailUrl: z.string().nullable(),
109
115
  dm: dmSettingsSchema,
110
- spaces: z.array(CommunityHomeSpace)
116
+ spaces: z.array(CommunityHomeSpace),
117
+ viewer: z.object({
118
+ permissions: z.array(permissionSchema).describe("What the viewer holds on this community"),
119
+ opensEverySpace: z.boolean().describe("The viewer opens every space, so holds no place in its spaces"),
120
+ team: z.boolean().describe("The viewer is shown as team here"),
121
+ roleName: z.string().describe("The name of the viewer's role here"),
122
+ canCreateEvents: z.boolean().describe("The viewer holds `events:write` on the org")
123
+ }).describe("The viewer in this community")
111
124
  });
112
125
  const CommunityAnalytics = z.object({
113
126
  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,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AAC,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 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({\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});\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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S,8BAA8B;AAC5C,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"}
@@ -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"}