@headless-lms/server 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/README.md +14 -0
  2. package/dist/app/community-mail.d.ts +10 -10
  3. package/dist/app/community-mail.js +72 -28
  4. package/dist/app/community-mail.js.map +1 -1
  5. package/dist/app/container.d.ts +48 -10
  6. package/dist/app/container.js +268 -48
  7. package/dist/app/container.js.map +1 -1
  8. package/dist/app/notification-channels.d.ts +47 -0
  9. package/dist/app/notification-channels.js +175 -0
  10. package/dist/app/notification-channels.js.map +1 -0
  11. package/dist/app/notification-reads.d.ts +23 -0
  12. package/dist/app/notification-reads.js +74 -0
  13. package/dist/app/notification-reads.js.map +1 -0
  14. package/dist/app/platform.d.ts +14 -0
  15. package/dist/app/platform.js +14 -0
  16. package/dist/app/platform.js.map +1 -0
  17. package/dist/http/config.d.ts +4 -0
  18. package/dist/http/errors.d.ts +1 -0
  19. package/dist/http/errors.js +24 -4
  20. package/dist/http/errors.js.map +1 -1
  21. package/dist/http/fastify.d.ts +8 -0
  22. package/dist/http/mcp/catalogue.d.ts +11 -9
  23. package/dist/http/mcp/catalogue.js +15 -21
  24. package/dist/http/mcp/catalogue.js.map +1 -1
  25. package/dist/http/mcp/challenge.js +3 -3
  26. package/dist/http/mcp/challenge.js.map +1 -1
  27. package/dist/http/mcp/route.js +7 -7
  28. package/dist/http/mcp/route.js.map +1 -1
  29. package/dist/http/mcp/test-support.d.ts +6 -5
  30. package/dist/http/mcp/test-support.js +32 -11
  31. package/dist/http/mcp/test-support.js.map +1 -1
  32. package/dist/http/mcp/tool.d.ts +3 -9
  33. package/dist/http/mcp/tool.js +14 -6
  34. package/dist/http/mcp/tool.js.map +1 -1
  35. package/dist/http/mcp/tools/automations.js +10 -20
  36. package/dist/http/mcp/tools/automations.js.map +1 -1
  37. package/dist/http/mcp/tools/catalog.js +25 -42
  38. package/dist/http/mcp/tools/catalog.js.map +1 -1
  39. package/dist/http/mcp/tools/comments.js +9 -19
  40. package/dist/http/mcp/tools/comments.js.map +1 -1
  41. package/dist/http/mcp/tools/communities.js +16 -31
  42. package/dist/http/mcp/tools/communities.js.map +1 -1
  43. package/dist/http/mcp/tools/community-members.js +9 -16
  44. package/dist/http/mcp/tools/community-members.js.map +1 -1
  45. package/dist/http/mcp/tools/community-moderation.js +13 -25
  46. package/dist/http/mcp/tools/community-moderation.js.map +1 -1
  47. package/dist/http/mcp/tools/courses.js +11 -21
  48. package/dist/http/mcp/tools/courses.js.map +1 -1
  49. package/dist/http/mcp/tools/events.d.ts +6 -0
  50. package/dist/http/mcp/tools/events.js +170 -0
  51. package/dist/http/mcp/tools/events.js.map +1 -0
  52. package/dist/http/mcp/tools/index.d.ts +5 -1
  53. package/dist/http/mcp/tools/index.js +45 -10
  54. package/dist/http/mcp/tools/index.js.map +1 -1
  55. package/dist/http/mcp/tools/organization.d.ts +6 -0
  56. package/dist/http/mcp/tools/organization.js +214 -0
  57. package/dist/http/mcp/tools/organization.js.map +1 -0
  58. package/dist/http/mcp/tools/people.js +30 -49
  59. package/dist/http/mcp/tools/people.js.map +1 -1
  60. package/dist/http/plugins/auth.js +37 -8
  61. package/dist/http/plugins/auth.js.map +1 -1
  62. package/dist/http/plugins/error-handler.d.ts +5 -1
  63. package/dist/http/plugins/error-handler.js +13 -3
  64. package/dist/http/plugins/error-handler.js.map +1 -1
  65. package/dist/http/plugins/openapi.js +18 -2
  66. package/dist/http/plugins/openapi.js.map +1 -1
  67. package/dist/http/plugins/platform.d.ts +7 -0
  68. package/dist/http/plugins/platform.js +13 -0
  69. package/dist/http/plugins/platform.js.map +1 -0
  70. package/dist/http/routes/access.js +54 -36
  71. package/dist/http/routes/access.js.map +1 -1
  72. package/dist/http/routes/activities.js +45 -45
  73. package/dist/http/routes/activities.js.map +1 -1
  74. package/dist/http/routes/assets.js +30 -65
  75. package/dist/http/routes/assets.js.map +1 -1
  76. package/dist/http/routes/automations.js +37 -42
  77. package/dist/http/routes/automations.js.map +1 -1
  78. package/dist/http/routes/bundles.js +33 -36
  79. package/dist/http/routes/bundles.js.map +1 -1
  80. package/dist/http/routes/communities.js +144 -136
  81. package/dist/http/routes/communities.js.map +1 -1
  82. package/dist/http/routes/community-moderation.js +83 -137
  83. package/dist/http/routes/community-moderation.js.map +1 -1
  84. package/dist/http/routes/course-analytics.js +32 -15
  85. package/dist/http/routes/course-analytics.js.map +1 -1
  86. package/dist/http/routes/courses.js +25 -32
  87. package/dist/http/routes/courses.js.map +1 -1
  88. package/dist/http/routes/dashboard.js +9 -9
  89. package/dist/http/routes/dashboard.js.map +1 -1
  90. package/dist/http/routes/discussion.js +21 -39
  91. package/dist/http/routes/discussion.js.map +1 -1
  92. package/dist/http/routes/downloads.js +41 -47
  93. package/dist/http/routes/downloads.js.map +1 -1
  94. package/dist/http/routes/entitlements.js +19 -23
  95. package/dist/http/routes/entitlements.js.map +1 -1
  96. package/dist/http/routes/events.d.ts +7 -0
  97. package/dist/http/routes/events.js +333 -0
  98. package/dist/http/routes/events.js.map +1 -0
  99. package/dist/http/routes/integrations.js +40 -73
  100. package/dist/http/routes/integrations.js.map +1 -1
  101. package/dist/http/routes/member/assets.js +10 -13
  102. package/dist/http/routes/member/assets.js.map +1 -1
  103. package/dist/http/routes/member/chats.js +177 -75
  104. package/dist/http/routes/member/chats.js.map +1 -1
  105. package/dist/http/routes/member/comments.js +65 -26
  106. package/dist/http/routes/member/comments.js.map +1 -1
  107. package/dist/http/routes/member/community.js +68 -51
  108. package/dist/http/routes/member/community.js.map +1 -1
  109. package/dist/http/routes/member/courses.js +12 -19
  110. package/dist/http/routes/member/courses.js.map +1 -1
  111. package/dist/http/routes/member/devices.d.ts +7 -0
  112. package/dist/http/routes/member/devices.js +97 -0
  113. package/dist/http/routes/member/devices.js.map +1 -0
  114. package/dist/http/routes/member/downloads.js +6 -9
  115. package/dist/http/routes/member/downloads.js.map +1 -1
  116. package/dist/http/routes/member/events.d.ts +7 -0
  117. package/dist/http/routes/member/events.js +386 -0
  118. package/dist/http/routes/member/events.js.map +1 -0
  119. package/dist/http/routes/member/files.js +71 -46
  120. package/dist/http/routes/member/files.js.map +1 -1
  121. package/dist/http/routes/member/index.js +6 -0
  122. package/dist/http/routes/member/index.js.map +1 -1
  123. package/dist/http/routes/member/notification-settings.d.ts +7 -0
  124. package/dist/http/routes/member/notification-settings.js +100 -0
  125. package/dist/http/routes/member/notification-settings.js.map +1 -0
  126. package/dist/http/routes/member/notifications.js +69 -45
  127. package/dist/http/routes/member/notifications.js.map +1 -1
  128. package/dist/http/routes/member/org.js +5 -15
  129. package/dist/http/routes/member/org.js.map +1 -1
  130. package/dist/http/routes/member/posts.js +94 -95
  131. package/dist/http/routes/member/posts.js.map +1 -1
  132. package/dist/http/routes/member/profile.js +15 -6
  133. package/dist/http/routes/member/profile.js.map +1 -1
  134. package/dist/http/routes/member/progress.js +7 -11
  135. package/dist/http/routes/member/progress.js.map +1 -1
  136. package/dist/http/routes/organizations.js +415 -110
  137. package/dist/http/routes/organizations.js.map +1 -1
  138. package/dist/http/routes/platform.d.ts +7 -0
  139. package/dist/http/routes/platform.js +61 -0
  140. package/dist/http/routes/platform.js.map +1 -0
  141. package/dist/http/routes/students.js +12 -75
  142. package/dist/http/routes/students.js.map +1 -1
  143. package/dist/http/routes/webhooks.js +30 -39
  144. package/dist/http/routes/webhooks.js.map +1 -1
  145. package/dist/http/routes.js +9 -0
  146. package/dist/http/routes.js.map +1 -1
  147. package/dist/http/schemas/access.d.ts +346 -64
  148. package/dist/http/schemas/access.js +39 -12
  149. package/dist/http/schemas/access.js.map +1 -1
  150. package/dist/http/schemas/assets.d.ts +13 -8
  151. package/dist/http/schemas/assets.js +6 -5
  152. package/dist/http/schemas/assets.js.map +1 -1
  153. package/dist/http/schemas/automations.d.ts +4 -8
  154. package/dist/http/schemas/chats.d.ts +238 -36
  155. package/dist/http/schemas/chats.js +14 -7
  156. package/dist/http/schemas/chats.js.map +1 -1
  157. package/dist/http/schemas/community.d.ts +140 -33
  158. package/dist/http/schemas/community.js +25 -9
  159. package/dist/http/schemas/community.js.map +1 -1
  160. package/dist/http/schemas/course-analytics.d.ts +51 -1
  161. package/dist/http/schemas/course-analytics.js +19 -1
  162. package/dist/http/schemas/course-analytics.js.map +1 -1
  163. package/dist/http/schemas/dashboard.d.ts +1 -0
  164. package/dist/http/schemas/dashboard.js +2 -1
  165. package/dist/http/schemas/dashboard.js.map +1 -1
  166. package/dist/http/schemas/discussion.d.ts +45 -73
  167. package/dist/http/schemas/discussion.js +16 -4
  168. package/dist/http/schemas/discussion.js.map +1 -1
  169. package/dist/http/schemas/entitlements.d.ts +9 -12
  170. package/dist/http/schemas/entitlements.js +11 -5
  171. package/dist/http/schemas/entitlements.js.map +1 -1
  172. package/dist/http/schemas/events.d.ts +527 -0
  173. package/dist/http/schemas/events.js +64 -0
  174. package/dist/http/schemas/events.js.map +1 -0
  175. package/dist/http/schemas/files.d.ts +15 -5
  176. package/dist/http/schemas/files.js +10 -2
  177. package/dist/http/schemas/files.js.map +1 -1
  178. package/dist/http/schemas/index.d.ts +14 -12
  179. package/dist/http/schemas/index.js +14 -12
  180. package/dist/http/schemas/invites.d.ts +3 -47
  181. package/dist/http/schemas/invites.js +4 -25
  182. package/dist/http/schemas/invites.js.map +1 -1
  183. package/dist/http/schemas/member.d.ts +94 -7
  184. package/dist/http/schemas/member.js +7 -3
  185. package/dist/http/schemas/member.js.map +1 -1
  186. package/dist/http/schemas/members.d.ts +329 -65
  187. package/dist/http/schemas/members.js +67 -25
  188. package/dist/http/schemas/members.js.map +1 -1
  189. package/dist/http/schemas/notifications.d.ts +502 -175
  190. package/dist/http/schemas/notifications.js +148 -28
  191. package/dist/http/schemas/notifications.js.map +1 -1
  192. package/dist/http/schemas/platform.d.ts +37 -0
  193. package/dist/http/schemas/platform.js +19 -0
  194. package/dist/http/schemas/platform.js.map +1 -0
  195. package/dist/http/schemas/posts.d.ts +92 -38
  196. package/dist/http/schemas/posts.js +4 -4
  197. package/dist/http/schemas/posts.js.map +1 -1
  198. package/dist/http/schemas/profile.d.ts +1 -1
  199. package/dist/http/schemas/shared.d.ts +10 -13
  200. package/dist/http/schemas/shared.js +3 -11
  201. package/dist/http/schemas/shared.js.map +1 -1
  202. package/dist/http/schemas/students.d.ts +22 -0
  203. package/dist/http/schemas/students.js +3 -1
  204. package/dist/http/schemas/students.js.map +1 -1
  205. package/dist/http/scope.d.ts +9 -12
  206. package/dist/http/scope.js +30 -35
  207. package/dist/http/scope.js.map +1 -1
  208. package/dist/http/server.js +9 -0
  209. package/dist/http/server.js.map +1 -1
  210. package/dist/http/shutdown.d.ts +11 -0
  211. package/dist/http/shutdown.js +40 -0
  212. package/dist/http/shutdown.js.map +1 -0
  213. package/dist/http/sse.d.ts +19 -0
  214. package/dist/http/sse.js +104 -0
  215. package/dist/http/sse.js.map +1 -0
  216. package/dist/http/test-caller.d.ts +13 -0
  217. package/dist/http/test-caller.js +14 -0
  218. package/dist/http/test-caller.js.map +1 -0
  219. package/dist/http/well-known.js +2 -2
  220. package/dist/http/well-known.js.map +1 -1
  221. package/dist/index.d.ts +5 -2
  222. package/dist/index.js +4 -2
  223. package/dist/index.js.map +1 -1
  224. package/dist/packages/server/package.js +1 -1
  225. package/package.json +7 -6
  226. package/dist/http/routes/member/actor.d.ts +0 -14
  227. package/dist/http/routes/member/actor.js +0 -11
  228. package/dist/http/routes/member/actor.js.map +0 -1
@@ -8,8 +8,8 @@ declare const AssetKind: z.ZodEnum<{
8
8
  }>;
9
9
  type AssetKind = z.infer<typeof AssetKind>;
10
10
  declare const AssetSource: z.ZodEnum<{
11
- library: "library";
12
11
  member: "member";
12
+ library: "library";
13
13
  }>;
14
14
  type AssetSource = z.infer<typeof AssetSource>;
15
15
  declare const AssetStatus: z.ZodEnum<{
@@ -26,10 +26,11 @@ declare const Asset: z.ZodObject<{
26
26
  }>;
27
27
  createdAt: z.ZodCoercedDate<unknown>;
28
28
  updatedAt: z.ZodCoercedDate<unknown>;
29
- uploadedBy: z.ZodString;
29
+ contentId: z.ZodNullable<z.ZodString>;
30
30
  filename: z.ZodString;
31
31
  contentType: z.ZodString;
32
32
  size: z.ZodNumber;
33
+ uploadedBy: z.ZodString;
33
34
  kind: z.ZodEnum<{
34
35
  image: "image";
35
36
  video: "video";
@@ -37,8 +38,8 @@ declare const Asset: z.ZodObject<{
37
38
  document: "document";
38
39
  }>;
39
40
  source: z.ZodEnum<{
40
- library: "library";
41
41
  member: "member";
42
+ library: "library";
42
43
  }>;
43
44
  url: z.ZodNullable<z.ZodString>;
44
45
  downloadUrl: z.ZodNullable<z.ZodString>;
@@ -56,9 +57,10 @@ declare const AssetsQuery: z.ZodObject<{
56
57
  document: "document";
57
58
  }>>;
58
59
  source: z.ZodOptional<z.ZodEnum<{
59
- library: "library";
60
60
  member: "member";
61
+ library: "library";
61
62
  }>>;
63
+ contentId: z.ZodOptional<z.ZodString>;
62
64
  }, z.core.$strip>;
63
65
  type AssetsQuery = z.infer<typeof AssetsQuery>;
64
66
  declare const AssetsPage: z.ZodObject<{
@@ -71,10 +73,11 @@ declare const AssetsPage: z.ZodObject<{
71
73
  }>;
72
74
  createdAt: z.ZodCoercedDate<unknown>;
73
75
  updatedAt: z.ZodCoercedDate<unknown>;
74
- uploadedBy: z.ZodString;
76
+ contentId: z.ZodNullable<z.ZodString>;
75
77
  filename: z.ZodString;
76
78
  contentType: z.ZodString;
77
79
  size: z.ZodNumber;
80
+ uploadedBy: z.ZodString;
78
81
  kind: z.ZodEnum<{
79
82
  image: "image";
80
83
  video: "video";
@@ -82,8 +85,8 @@ declare const AssetsPage: z.ZodObject<{
82
85
  document: "document";
83
86
  }>;
84
87
  source: z.ZodEnum<{
85
- library: "library";
86
88
  member: "member";
89
+ library: "library";
87
90
  }>;
88
91
  url: z.ZodNullable<z.ZodString>;
89
92
  downloadUrl: z.ZodNullable<z.ZodString>;
@@ -100,6 +103,7 @@ type AssetIdParam = z.infer<typeof AssetIdParam>;
100
103
  declare const RequestUpload: z.ZodObject<{
101
104
  filename: z.ZodString;
102
105
  contentType: z.ZodString;
106
+ contentId: z.ZodOptional<z.ZodString>;
103
107
  }, z.core.$strip>;
104
108
  type RequestUpload = z.infer<typeof RequestUpload>;
105
109
  declare const RequestMemberUpload: z.ZodObject<{
@@ -121,10 +125,11 @@ declare const UploadTicket: z.ZodObject<{
121
125
  }>;
122
126
  createdAt: z.ZodCoercedDate<unknown>;
123
127
  updatedAt: z.ZodCoercedDate<unknown>;
124
- uploadedBy: z.ZodString;
128
+ contentId: z.ZodNullable<z.ZodString>;
125
129
  filename: z.ZodString;
126
130
  contentType: z.ZodString;
127
131
  size: z.ZodNumber;
132
+ uploadedBy: z.ZodString;
128
133
  kind: z.ZodEnum<{
129
134
  image: "image";
130
135
  video: "video";
@@ -132,8 +137,8 @@ declare const UploadTicket: z.ZodObject<{
132
137
  document: "document";
133
138
  }>;
134
139
  source: z.ZodEnum<{
135
- library: "library";
136
140
  member: "member";
141
+ library: "library";
137
142
  }>;
138
143
  url: z.ZodNullable<z.ZodString>;
139
144
  downloadUrl: z.ZodNullable<z.ZodString>;
@@ -1,10 +1,9 @@
1
1
  import { ListQuery, paginated } from "./shared.js";
2
- import { MEMBER_IMAGE_TYPE } from "@headless-lms/core/assets";
3
2
  import { z } from "zod";
4
3
  import { assetKindSchema, assetSourceSchema, assetStatusSchema, assetViewSchema, uploadTicketSchema } from "@headless-lms/core/schemas";
5
4
  //#region src/http/schemas/assets.ts
6
5
  const AssetKind = assetKindSchema.describe("The media class, derived by the server from the content type.");
7
- const AssetSource = assetSourceSchema.describe("Where the file came from: `library` is the org's media uploaded by staff, `member` is a person's own upload.");
6
+ const AssetSource = assetSourceSchema.describe("Where the file came from: `library` is the org's media, `member` is a person's own upload.");
8
7
  const AssetStatus = assetStatusSchema;
9
8
  const Asset = assetViewSchema.omit({ key: true }).extend({
10
9
  kind: AssetKind,
@@ -14,18 +13,20 @@ const Asset = assetViewSchema.omit({ key: true }).extend({
14
13
  }).strip();
15
14
  const AssetsQuery = ListQuery.extend({
16
15
  kind: AssetKind.optional(),
17
- source: AssetSource.optional().describe("Defaults to `library`.")
16
+ source: AssetSource.optional().describe("Defaults to `library`."),
17
+ contentId: z.string().optional().describe("Only the files uploaded for this content item.")
18
18
  });
19
19
  const AssetsPage = paginated(Asset);
20
20
  const AssetIdParam = z.object({ id: z.string() });
21
21
  const Filename = z.string().trim().min(1).max(255);
22
22
  const RequestUpload = z.object({
23
23
  filename: Filename,
24
- contentType: z.string().min(1).max(255).describe("The media class is derived from this.")
24
+ contentType: z.string().min(1).max(255).describe("The media class is derived from this."),
25
+ contentId: z.string().optional().describe("The course, download or community the file is for.")
25
26
  });
26
27
  const RequestMemberUpload = z.object({
27
28
  filename: Filename,
28
- contentType: z.string().regex(MEMBER_IMAGE_TYPE, "A member upload must be a PNG, JPEG, GIF, WebP or AVIF image").describe("One of `image/png`, `image/jpeg`, `image/gif`, `image/webp` or `image/avif`. The stored type and size are checked when the upload is finalized.")
29
+ contentType: z.string().min(1).max(255).describe("Any type. Only `image/png`, `image/jpeg`, `image/gif`, `image/webp` and `image/avif` count as images (a profile photo, a post cover, a message attachment); every other type is a file a post can show. The stored type and size are checked when the upload is finalized.")
29
30
  });
30
31
  const UploadTicket = uploadTicketSchema.extend({ asset: Asset });
31
32
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"assets.js","names":[],"sources":["../../../src/http/schemas/assets.ts"],"sourcesContent":["import { z } from 'zod';\nimport {\n assetKindSchema,\n assetSourceSchema,\n assetStatusSchema,\n assetViewSchema,\n uploadTicketSchema,\n} from '@headless-lms/core/schemas';\nimport { MEMBER_IMAGE_TYPE } from '@headless-lms/core/assets';\nimport { ListQuery, paginated } from './shared.js';\n\nexport const AssetKind = assetKindSchema.describe(\n 'The media class, derived by the server from the content type.',\n);\nexport type AssetKind = z.infer<typeof AssetKind>;\n\nexport const AssetSource = assetSourceSchema.describe(\n \"Where the file came from: `library` is the org's media uploaded by staff, `member` is a person's own upload.\",\n);\nexport type AssetSource = z.infer<typeof AssetSource>;\n\nexport const AssetStatus = assetStatusSchema;\nexport type AssetStatus = z.infer<typeof AssetStatus>;\n\nexport const Asset = assetViewSchema\n .omit({ key: true })\n .extend({\n kind: AssetKind,\n source: AssetSource,\n url: z\n .string()\n .nullable()\n .describe(\n 'A short-lived signed URL that shows a ready library file. `null` while pending and for a member upload, which is served with what it is attached to.',\n ),\n downloadUrl: z\n .string()\n .nullable()\n .describe('The same file as a download saved under its filename. `null` when `url` is.'),\n })\n .strip();\nexport type Asset = z.infer<typeof Asset>;\n\nexport const AssetsQuery = ListQuery.extend({\n kind: AssetKind.optional(),\n source: AssetSource.optional().describe('Defaults to `library`.'),\n});\nexport type AssetsQuery = z.infer<typeof AssetsQuery>;\n\nexport const AssetsPage = paginated(Asset);\nexport type AssetsPage = z.infer<typeof AssetsPage>;\n\nexport const AssetIdParam = z.object({ id: z.string() });\nexport type AssetIdParam = z.infer<typeof AssetIdParam>;\n\nconst Filename = z.string().trim().min(1).max(255);\n\nexport const RequestUpload = z.object({\n filename: Filename,\n contentType: z.string().min(1).max(255).describe('The media class is derived from this.'),\n});\nexport type RequestUpload = z.infer<typeof RequestUpload>;\n\nexport const RequestMemberUpload = z.object({\n filename: Filename,\n contentType: z\n .string()\n .regex(MEMBER_IMAGE_TYPE, 'A member upload must be a PNG, JPEG, GIF, WebP or AVIF image')\n .describe(\n 'One of `image/png`, `image/jpeg`, `image/gif`, `image/webp` or `image/avif`. The stored type and size are checked when the upload is finalized.',\n ),\n});\nexport type RequestMemberUpload = z.infer<typeof RequestMemberUpload>;\n\nexport const UploadTicket = uploadTicketSchema.extend({ asset: Asset });\nexport type UploadTicket = z.infer<typeof UploadTicket>;\n"],"mappings":";;;;;AAWA,MAAa,YAAY,gBAAgB,SACvC,+DACF;AAGA,MAAa,cAAc,kBAAkB,SAC3C,8GACF;AAGA,MAAa,cAAc;AAG3B,MAAa,QAAQ,gBAClB,KAAK,EAAE,KAAK,KAAK,CAAC,CAAC,CACnB,OAAO;CACN,MAAM;CACN,QAAQ;CACR,KAAK,EACF,OAAO,CAAC,CACR,SAAS,CAAC,CACV,SACC,sJACF;CACF,aAAa,EACV,OAAO,CAAC,CACR,SAAS,CAAC,CACV,SAAS,6EAA6E;AAC3F,CAAC,CAAC,CACD,MAAM;AAGT,MAAa,cAAc,UAAU,OAAO;CAC1C,MAAM,UAAU,SAAS;CACzB,QAAQ,YAAY,SAAS,CAAC,CAAC,SAAS,wBAAwB;AAClE,CAAC;AAGD,MAAa,aAAa,UAAU,KAAK;AAGzC,MAAa,eAAe,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAGvD,MAAM,WAAW,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG;AAEjD,MAAa,gBAAgB,EAAE,OAAO;CACpC,UAAU;CACV,aAAa,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,SAAS,uCAAuC;AAC1F,CAAC;AAGD,MAAa,sBAAsB,EAAE,OAAO;CAC1C,UAAU;CACV,aAAa,EACV,OAAO,CAAC,CACR,MAAM,mBAAmB,8DAA8D,CAAC,CACxF,SACC,iJACF;AACJ,CAAC;AAGD,MAAa,eAAe,mBAAmB,OAAO,EAAE,OAAO,MAAM,CAAC"}
1
+ {"version":3,"file":"assets.js","names":[],"sources":["../../../src/http/schemas/assets.ts"],"sourcesContent":["import { z } from 'zod';\nimport {\n assetKindSchema,\n assetSourceSchema,\n assetStatusSchema,\n assetViewSchema,\n uploadTicketSchema,\n} from '@headless-lms/core/schemas';\nimport { ListQuery, paginated } from './shared.js';\n\nexport const AssetKind = assetKindSchema.describe(\n 'The media class, derived by the server from the content type.',\n);\nexport type AssetKind = z.infer<typeof AssetKind>;\n\nexport const AssetSource = assetSourceSchema.describe(\n \"Where the file came from: `library` is the org's media, `member` is a person's own upload.\",\n);\nexport type AssetSource = z.infer<typeof AssetSource>;\n\nexport const AssetStatus = assetStatusSchema;\nexport type AssetStatus = z.infer<typeof AssetStatus>;\n\nexport const Asset = assetViewSchema\n .omit({ key: true })\n .extend({\n kind: AssetKind,\n source: AssetSource,\n url: z\n .string()\n .nullable()\n .describe(\n 'A short-lived signed URL that shows a ready library file. `null` while pending and for a member upload, which is served with what it is attached to.',\n ),\n downloadUrl: z\n .string()\n .nullable()\n .describe('The same file as a download saved under its filename. `null` when `url` is.'),\n })\n .strip();\nexport type Asset = z.infer<typeof Asset>;\n\nexport const AssetsQuery = ListQuery.extend({\n kind: AssetKind.optional(),\n source: AssetSource.optional().describe('Defaults to `library`.'),\n contentId: z.string().optional().describe('Only the files uploaded for this content item.'),\n});\nexport type AssetsQuery = z.infer<typeof AssetsQuery>;\n\nexport const AssetsPage = paginated(Asset);\nexport type AssetsPage = z.infer<typeof AssetsPage>;\n\nexport const AssetIdParam = z.object({ id: z.string() });\nexport type AssetIdParam = z.infer<typeof AssetIdParam>;\n\nconst Filename = z.string().trim().min(1).max(255);\n\nexport const RequestUpload = z.object({\n filename: Filename,\n contentType: z.string().min(1).max(255).describe('The media class is derived from this.'),\n contentId: z.string().optional().describe('The course, download or community the file is for.'),\n});\nexport type RequestUpload = z.infer<typeof RequestUpload>;\n\nexport const RequestMemberUpload = z.object({\n filename: Filename,\n contentType: z\n .string()\n .min(1)\n .max(255)\n .describe(\n 'Any type. Only `image/png`, `image/jpeg`, `image/gif`, `image/webp` and `image/avif` count as images (a profile photo, a post cover, a message attachment); every other type is a file a post can show. The stored type and size are checked when the upload is finalized.',\n ),\n});\nexport type RequestMemberUpload = z.infer<typeof RequestMemberUpload>;\n\nexport const UploadTicket = uploadTicketSchema.extend({ asset: Asset });\nexport type UploadTicket = z.infer<typeof UploadTicket>;\n"],"mappings":";;;;AAUA,MAAa,YAAY,gBAAgB,SACvC,+DACF;AAGA,MAAa,cAAc,kBAAkB,SAC3C,4FACF;AAGA,MAAa,cAAc;AAG3B,MAAa,QAAQ,gBAClB,KAAK,EAAE,KAAK,KAAK,CAAC,CAAC,CACnB,OAAO;CACN,MAAM;CACN,QAAQ;CACR,KAAK,EACF,OAAO,CAAC,CACR,SAAS,CAAC,CACV,SACC,sJACF;CACF,aAAa,EACV,OAAO,CAAC,CACR,SAAS,CAAC,CACV,SAAS,6EAA6E;AAC3F,CAAC,CAAC,CACD,MAAM;AAGT,MAAa,cAAc,UAAU,OAAO;CAC1C,MAAM,UAAU,SAAS;CACzB,QAAQ,YAAY,SAAS,CAAC,CAAC,SAAS,wBAAwB;CAChE,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,gDAAgD;AAC5F,CAAC;AAGD,MAAa,aAAa,UAAU,KAAK;AAGzC,MAAa,eAAe,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAGvD,MAAM,WAAW,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG;AAEjD,MAAa,gBAAgB,EAAE,OAAO;CACpC,UAAU;CACV,aAAa,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,SAAS,uCAAuC;CACxF,WAAW,EAAE,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS,oDAAoD;AAChG,CAAC;AAGD,MAAa,sBAAsB,EAAE,OAAO;CAC1C,UAAU;CACV,aAAa,EACV,OAAO,CAAC,CACR,IAAI,CAAC,CAAC,CACN,IAAI,GAAG,CAAC,CACR,SACC,4QACF;AACJ,CAAC;AAGD,MAAa,eAAe,mBAAmB,OAAO,EAAE,OAAO,MAAM,CAAC"}
@@ -30,10 +30,6 @@ declare const Automation: z.ZodObject<{
30
30
  }, z.core.$strict>>;
31
31
  enabled: z.ZodBoolean;
32
32
  filter: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodType<import("@headless-lms/core/types").JsonValue, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").JsonValue, unknown>>>>;
33
- source: z.ZodEnum<{
34
- system: "system";
35
- user: "user";
36
- }>;
37
33
  createdAt: z.ZodCoercedDate<unknown>;
38
34
  updatedAt: z.ZodCoercedDate<unknown>;
39
35
  }, z.core.$strict>;
@@ -97,8 +93,8 @@ declare const AvailableTriggers: z.ZodObject<{
97
93
  }, z.core.$strict>;
98
94
  type AvailableTriggers = z.infer<typeof AvailableTriggers>;
99
95
  declare const AutomationRunStatus: z.ZodEnum<{
100
- running: "running";
101
96
  completed: "completed";
97
+ running: "running";
102
98
  failed: "failed";
103
99
  }>;
104
100
  type AutomationRunStatus = z.infer<typeof AutomationRunStatus>;
@@ -121,8 +117,8 @@ declare const AutomationRun: z.ZodObject<{
121
117
  eventId: z.ZodString;
122
118
  event: z.ZodType<import("@headless-lms/core/types").DomainEvent<unknown, string, number>, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").DomainEvent<unknown, string, number>, unknown>>;
123
119
  status: z.ZodEnum<{
124
- running: "running";
125
120
  completed: "completed";
121
+ running: "running";
126
122
  failed: "failed";
127
123
  }>;
128
124
  actionResults: z.ZodArray<z.ZodObject<{
@@ -147,8 +143,8 @@ declare const AutomationRunsQuery: z.ZodObject<{
147
143
  search: z.ZodOptional<z.ZodString>;
148
144
  sort: z.ZodOptional<z.ZodString>;
149
145
  status: z.ZodOptional<z.ZodEnum<{
150
- running: "running";
151
146
  completed: "completed";
147
+ running: "running";
152
148
  failed: "failed";
153
149
  }>>;
154
150
  }, z.core.$strip>;
@@ -162,8 +158,8 @@ declare const AutomationRunsPage: z.ZodObject<{
162
158
  eventId: z.ZodString;
163
159
  event: z.ZodType<import("@headless-lms/core/types").DomainEvent<unknown, string, number>, unknown, z.core.$ZodTypeInternals<import("@headless-lms/core/types").DomainEvent<unknown, string, number>, unknown>>;
164
160
  status: z.ZodEnum<{
165
- running: "running";
166
161
  completed: "completed";
162
+ running: "running";
167
163
  failed: "failed";
168
164
  }>;
169
165
  actionResults: z.ZodArray<z.ZodObject<{
@@ -44,6 +44,7 @@ declare const MessageView: z.ZodObject<{
44
44
  orgUserId: z.ZodString;
45
45
  body: z.ZodString;
46
46
  replyToId: z.ZodNullable<z.ZodString>;
47
+ clientId: z.ZodNullable<z.ZodUUID>;
47
48
  editedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
48
49
  deletedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
49
50
  createdAt: z.ZodCoercedDate<unknown>;
@@ -57,13 +58,8 @@ declare const MessageView: z.ZodObject<{
57
58
  image: z.ZodNullable<z.ZodString>;
58
59
  imageAssetId: z.ZodNullable<z.ZodString>;
59
60
  imageUrl: z.ZodNullable<z.ZodString>;
60
- role: z.ZodEnum<{
61
- owner: "owner";
62
- admin: "admin";
63
- instructor: "instructor";
64
- moderator: "moderator";
65
- student: "student";
66
- }>;
61
+ team: z.ZodBoolean;
62
+ roleName: z.ZodNullable<z.ZodString>;
67
63
  }, z.core.$strict>;
68
64
  attachments: z.ZodArray<z.ZodObject<{
69
65
  assetId: z.ZodString;
@@ -71,6 +67,10 @@ declare const MessageView: z.ZodObject<{
71
67
  }, z.core.$strict>>;
72
68
  reactions: z.ZodRecord<z.ZodString, z.ZodNumber>;
73
69
  viewerReaction: z.ZodNullable<z.ZodString>;
70
+ mentions: z.ZodArray<z.ZodObject<{
71
+ orgUserId: z.ZodString;
72
+ name: z.ZodString;
73
+ }, z.core.$strict>>;
74
74
  }, z.core.$strict>;
75
75
  declare const MessagesPage: z.ZodObject<{
76
76
  rows: z.ZodArray<z.ZodObject<{
@@ -81,6 +81,7 @@ declare const MessagesPage: z.ZodObject<{
81
81
  orgUserId: z.ZodString;
82
82
  body: z.ZodString;
83
83
  replyToId: z.ZodNullable<z.ZodString>;
84
+ clientId: z.ZodNullable<z.ZodUUID>;
84
85
  editedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
85
86
  deletedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
86
87
  createdAt: z.ZodCoercedDate<unknown>;
@@ -94,13 +95,8 @@ declare const MessagesPage: z.ZodObject<{
94
95
  image: z.ZodNullable<z.ZodString>;
95
96
  imageAssetId: z.ZodNullable<z.ZodString>;
96
97
  imageUrl: z.ZodNullable<z.ZodString>;
97
- role: z.ZodEnum<{
98
- owner: "owner";
99
- admin: "admin";
100
- instructor: "instructor";
101
- moderator: "moderator";
102
- student: "student";
103
- }>;
98
+ team: z.ZodBoolean;
99
+ roleName: z.ZodNullable<z.ZodString>;
104
100
  }, z.core.$strict>;
105
101
  attachments: z.ZodArray<z.ZodObject<{
106
102
  assetId: z.ZodString;
@@ -108,6 +104,10 @@ declare const MessagesPage: z.ZodObject<{
108
104
  }, z.core.$strict>>;
109
105
  reactions: z.ZodRecord<z.ZodString, z.ZodNumber>;
110
106
  viewerReaction: z.ZodNullable<z.ZodString>;
107
+ mentions: z.ZodArray<z.ZodObject<{
108
+ orgUserId: z.ZodString;
109
+ name: z.ZodString;
110
+ }, z.core.$strict>>;
111
111
  }, z.core.$strict>>;
112
112
  total: z.ZodNumber;
113
113
  page: z.ZodNumber;
@@ -134,9 +134,26 @@ declare const ChatListItem: z.ZodObject<{
134
134
  updatedAt: z.ZodCoercedDate<unknown>;
135
135
  }, z.core.$strict>;
136
136
  participantIds: z.ZodArray<z.ZodString>;
137
+ participants: z.ZodArray<z.ZodObject<{
138
+ id: z.ZodString;
139
+ firstName: z.ZodNullable<z.ZodString>;
140
+ lastName: z.ZodNullable<z.ZodString>;
141
+ displayName: z.ZodNullable<z.ZodString>;
142
+ headline: z.ZodNullable<z.ZodString>;
143
+ image: z.ZodNullable<z.ZodString>;
144
+ imageAssetId: z.ZodNullable<z.ZodString>;
145
+ imageUrl: z.ZodNullable<z.ZodString>;
146
+ team: z.ZodBoolean;
147
+ roleName: z.ZodNullable<z.ZodString>;
148
+ }, z.core.$strict>>;
137
149
  lastReadMessageId: z.ZodNullable<z.ZodString>;
138
- muted: z.ZodBoolean;
139
- mutedUntil: z.ZodNullable<z.ZodCoercedDate<unknown>>;
150
+ subscription: z.ZodNullable<z.ZodObject<{
151
+ state: z.ZodEnum<{
152
+ following: "following";
153
+ muted: "muted";
154
+ }>;
155
+ mutedUntil: z.ZodNullable<z.ZodCoercedDate<unknown>>;
156
+ }, z.core.$strict>>;
140
157
  unread: z.ZodNumber;
141
158
  lastMessage: z.ZodNullable<z.ZodObject<{
142
159
  id: z.ZodString;
@@ -168,9 +185,26 @@ declare const ChatsPage: z.ZodObject<{
168
185
  updatedAt: z.ZodCoercedDate<unknown>;
169
186
  }, z.core.$strict>;
170
187
  participantIds: z.ZodArray<z.ZodString>;
188
+ participants: z.ZodArray<z.ZodObject<{
189
+ id: z.ZodString;
190
+ firstName: z.ZodNullable<z.ZodString>;
191
+ lastName: z.ZodNullable<z.ZodString>;
192
+ displayName: z.ZodNullable<z.ZodString>;
193
+ headline: z.ZodNullable<z.ZodString>;
194
+ image: z.ZodNullable<z.ZodString>;
195
+ imageAssetId: z.ZodNullable<z.ZodString>;
196
+ imageUrl: z.ZodNullable<z.ZodString>;
197
+ team: z.ZodBoolean;
198
+ roleName: z.ZodNullable<z.ZodString>;
199
+ }, z.core.$strict>>;
171
200
  lastReadMessageId: z.ZodNullable<z.ZodString>;
172
- muted: z.ZodBoolean;
173
- mutedUntil: z.ZodNullable<z.ZodCoercedDate<unknown>>;
201
+ subscription: z.ZodNullable<z.ZodObject<{
202
+ state: z.ZodEnum<{
203
+ following: "following";
204
+ muted: "muted";
205
+ }>;
206
+ mutedUntil: z.ZodNullable<z.ZodCoercedDate<unknown>>;
207
+ }, z.core.$strict>>;
174
208
  unread: z.ZodNumber;
175
209
  lastMessage: z.ZodNullable<z.ZodObject<{
176
210
  id: z.ZodString;
@@ -184,6 +218,172 @@ declare const ChatsPage: z.ZodObject<{
184
218
  page: z.ZodNumber;
185
219
  pageSize: z.ZodNumber;
186
220
  }, z.core.$strip>;
221
+ declare const ChatListQuery: z.ZodObject<{
222
+ page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
223
+ pageSize: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
224
+ requests: z.ZodOptional<z.ZodCodec<z.ZodString, z.ZodBoolean>>;
225
+ }, z.core.$strict>;
226
+ declare const ChatUnreadSummary: z.ZodObject<{
227
+ unread: z.ZodNumber;
228
+ requests: z.ZodNumber;
229
+ }, z.core.$strict>;
230
+ declare const ChatLiveEvent: z.ZodDiscriminatedUnion<[z.ZodObject<{
231
+ type: z.ZodLiteral<"ready">;
232
+ heartbeatMs: z.ZodNumber;
233
+ }, z.core.$strict>, z.ZodObject<{
234
+ type: z.ZodLiteral<"message.created">;
235
+ chatId: z.ZodString;
236
+ message: z.ZodObject<{
237
+ orgId: z.ZodString;
238
+ id: z.ZodString;
239
+ communityId: z.ZodString;
240
+ createdAt: z.ZodCoercedDate<unknown>;
241
+ updatedAt: z.ZodCoercedDate<unknown>;
242
+ orgUserId: z.ZodString;
243
+ chatId: z.ZodString;
244
+ body: z.ZodString;
245
+ replyToId: z.ZodNullable<z.ZodString>;
246
+ clientId: z.ZodNullable<z.ZodUUID>;
247
+ editedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
248
+ deletedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
249
+ sender: z.ZodObject<{
250
+ id: z.ZodString;
251
+ firstName: z.ZodNullable<z.ZodString>;
252
+ lastName: z.ZodNullable<z.ZodString>;
253
+ displayName: z.ZodNullable<z.ZodString>;
254
+ headline: z.ZodNullable<z.ZodString>;
255
+ image: z.ZodNullable<z.ZodString>;
256
+ imageAssetId: z.ZodNullable<z.ZodString>;
257
+ imageUrl: z.ZodNullable<z.ZodString>;
258
+ team: z.ZodBoolean;
259
+ roleName: z.ZodNullable<z.ZodString>;
260
+ }, z.core.$strict>;
261
+ attachments: z.ZodArray<z.ZodObject<{
262
+ assetId: z.ZodString;
263
+ url: z.ZodString;
264
+ }, z.core.$strict>>;
265
+ reactions: z.ZodRecord<z.ZodString, z.ZodNumber>;
266
+ mentions: z.ZodArray<z.ZodObject<{
267
+ orgUserId: z.ZodString;
268
+ name: z.ZodString;
269
+ }, z.core.$strict>>;
270
+ }, z.core.$strict>;
271
+ }, z.core.$strict>, z.ZodObject<{
272
+ type: z.ZodLiteral<"message.updated">;
273
+ chatId: z.ZodString;
274
+ message: z.ZodObject<{
275
+ orgId: z.ZodString;
276
+ id: z.ZodString;
277
+ communityId: z.ZodString;
278
+ createdAt: z.ZodCoercedDate<unknown>;
279
+ updatedAt: z.ZodCoercedDate<unknown>;
280
+ orgUserId: z.ZodString;
281
+ chatId: z.ZodString;
282
+ body: z.ZodString;
283
+ replyToId: z.ZodNullable<z.ZodString>;
284
+ clientId: z.ZodNullable<z.ZodUUID>;
285
+ editedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
286
+ deletedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
287
+ sender: z.ZodObject<{
288
+ id: z.ZodString;
289
+ firstName: z.ZodNullable<z.ZodString>;
290
+ lastName: z.ZodNullable<z.ZodString>;
291
+ displayName: z.ZodNullable<z.ZodString>;
292
+ headline: z.ZodNullable<z.ZodString>;
293
+ image: z.ZodNullable<z.ZodString>;
294
+ imageAssetId: z.ZodNullable<z.ZodString>;
295
+ imageUrl: z.ZodNullable<z.ZodString>;
296
+ team: z.ZodBoolean;
297
+ roleName: z.ZodNullable<z.ZodString>;
298
+ }, z.core.$strict>;
299
+ attachments: z.ZodArray<z.ZodObject<{
300
+ assetId: z.ZodString;
301
+ url: z.ZodString;
302
+ }, z.core.$strict>>;
303
+ reactions: z.ZodRecord<z.ZodString, z.ZodNumber>;
304
+ mentions: z.ZodArray<z.ZodObject<{
305
+ orgUserId: z.ZodString;
306
+ name: z.ZodString;
307
+ }, z.core.$strict>>;
308
+ }, z.core.$strict>;
309
+ }, z.core.$strict>, z.ZodObject<{
310
+ type: z.ZodLiteral<"message.deleted">;
311
+ chatId: z.ZodString;
312
+ messageId: z.ZodString;
313
+ deletedAt: z.ZodCoercedDate<unknown>;
314
+ }, z.core.$strict>, z.ZodObject<{
315
+ type: z.ZodLiteral<"message.reactions">;
316
+ chatId: z.ZodString;
317
+ messageId: z.ZodString;
318
+ reactions: z.ZodRecord<z.ZodString, z.ZodNumber>;
319
+ orgUserId: z.ZodString;
320
+ reaction: z.ZodNullable<z.ZodString>;
321
+ }, z.core.$strict>, z.ZodObject<{
322
+ type: z.ZodLiteral<"chat.updated">;
323
+ chatId: z.ZodString;
324
+ chat: z.ZodObject<{
325
+ orgId: z.ZodString;
326
+ id: z.ZodString;
327
+ communityId: z.ZodString;
328
+ kind: z.ZodEnum<{
329
+ direct: "direct";
330
+ group: "group";
331
+ }>;
332
+ status: z.ZodEnum<{
333
+ pending: "pending";
334
+ open: "open";
335
+ closed: "closed";
336
+ }>;
337
+ createdBy: z.ZodNullable<z.ZodString>;
338
+ lockedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
339
+ lockedBy: z.ZodNullable<z.ZodString>;
340
+ createdAt: z.ZodCoercedDate<unknown>;
341
+ updatedAt: z.ZodCoercedDate<unknown>;
342
+ }, z.core.$strict>;
343
+ participants: z.ZodArray<z.ZodObject<{
344
+ id: z.ZodString;
345
+ firstName: z.ZodNullable<z.ZodString>;
346
+ lastName: z.ZodNullable<z.ZodString>;
347
+ displayName: z.ZodNullable<z.ZodString>;
348
+ headline: z.ZodNullable<z.ZodString>;
349
+ image: z.ZodNullable<z.ZodString>;
350
+ imageAssetId: z.ZodNullable<z.ZodString>;
351
+ imageUrl: z.ZodNullable<z.ZodString>;
352
+ team: z.ZodBoolean;
353
+ roleName: z.ZodNullable<z.ZodString>;
354
+ }, z.core.$strict>>;
355
+ }, z.core.$strict>, z.ZodObject<{
356
+ type: z.ZodLiteral<"chat.removed">;
357
+ chatId: z.ZodString;
358
+ }, z.core.$strict>, z.ZodObject<{
359
+ type: z.ZodLiteral<"chat.state">;
360
+ chatId: z.ZodString;
361
+ unread: z.ZodNumber;
362
+ lastReadMessageId: z.ZodNullable<z.ZodString>;
363
+ subscription: z.ZodNullable<z.ZodObject<{
364
+ state: z.ZodEnum<{
365
+ following: "following";
366
+ muted: "muted";
367
+ }>;
368
+ mutedUntil: z.ZodNullable<z.ZodCoercedDate<unknown>>;
369
+ }, z.core.$strict>>;
370
+ }, z.core.$strict>, z.ZodObject<{
371
+ unread: z.ZodNumber;
372
+ requests: z.ZodNumber;
373
+ type: z.ZodLiteral<"unread">;
374
+ }, z.core.$strict>, z.ZodObject<{
375
+ type: z.ZodLiteral<"typing">;
376
+ chatId: z.ZodString;
377
+ orgUserId: z.ZodString;
378
+ until: z.ZodCoercedDate<unknown>;
379
+ }, z.core.$strict>, z.ZodObject<{
380
+ type: z.ZodLiteral<"resync">;
381
+ }, z.core.$strict>, z.ZodObject<{
382
+ type: z.ZodLiteral<"closed">;
383
+ reason: z.ZodEnum<{
384
+ shutdown: "shutdown";
385
+ }>;
386
+ }, z.core.$strict>], "type">;
187
387
  declare const MessageQueueEntry: z.ZodObject<{
188
388
  message: z.ZodObject<{
189
389
  orgId: z.ZodString;
@@ -193,6 +393,7 @@ declare const MessageQueueEntry: z.ZodObject<{
193
393
  orgUserId: z.ZodString;
194
394
  body: z.ZodString;
195
395
  replyToId: z.ZodNullable<z.ZodString>;
396
+ clientId: z.ZodNullable<z.ZodUUID>;
196
397
  editedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
197
398
  deletedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
198
399
  createdAt: z.ZodCoercedDate<unknown>;
@@ -206,13 +407,8 @@ declare const MessageQueueEntry: z.ZodObject<{
206
407
  image: z.ZodNullable<z.ZodString>;
207
408
  imageAssetId: z.ZodNullable<z.ZodString>;
208
409
  imageUrl: z.ZodNullable<z.ZodString>;
209
- role: z.ZodEnum<{
210
- owner: "owner";
211
- admin: "admin";
212
- instructor: "instructor";
213
- moderator: "moderator";
214
- student: "student";
215
- }>;
410
+ team: z.ZodBoolean;
411
+ roleName: z.ZodNullable<z.ZodString>;
216
412
  }, z.core.$strict>;
217
413
  attachments: z.ZodArray<z.ZodObject<{
218
414
  assetId: z.ZodString;
@@ -220,6 +416,10 @@ declare const MessageQueueEntry: z.ZodObject<{
220
416
  }, z.core.$strict>>;
221
417
  reactions: z.ZodRecord<z.ZodString, z.ZodNumber>;
222
418
  viewerReaction: z.ZodNullable<z.ZodString>;
419
+ mentions: z.ZodArray<z.ZodObject<{
420
+ orgUserId: z.ZodString;
421
+ name: z.ZodString;
422
+ }, z.core.$strict>>;
223
423
  }, z.core.$strict>;
224
424
  flags: z.ZodArray<z.ZodObject<{
225
425
  orgId: z.ZodString;
@@ -269,6 +469,7 @@ declare const MessageQueue: z.ZodObject<{
269
469
  orgUserId: z.ZodString;
270
470
  body: z.ZodString;
271
471
  replyToId: z.ZodNullable<z.ZodString>;
472
+ clientId: z.ZodNullable<z.ZodUUID>;
272
473
  editedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
273
474
  deletedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
274
475
  createdAt: z.ZodCoercedDate<unknown>;
@@ -282,13 +483,8 @@ declare const MessageQueue: z.ZodObject<{
282
483
  image: z.ZodNullable<z.ZodString>;
283
484
  imageAssetId: z.ZodNullable<z.ZodString>;
284
485
  imageUrl: z.ZodNullable<z.ZodString>;
285
- role: z.ZodEnum<{
286
- owner: "owner";
287
- admin: "admin";
288
- instructor: "instructor";
289
- moderator: "moderator";
290
- student: "student";
291
- }>;
486
+ team: z.ZodBoolean;
487
+ roleName: z.ZodNullable<z.ZodString>;
292
488
  }, z.core.$strict>;
293
489
  attachments: z.ZodArray<z.ZodObject<{
294
490
  assetId: z.ZodString;
@@ -296,6 +492,10 @@ declare const MessageQueue: z.ZodObject<{
296
492
  }, z.core.$strict>>;
297
493
  reactions: z.ZodRecord<z.ZodString, z.ZodNumber>;
298
494
  viewerReaction: z.ZodNullable<z.ZodString>;
495
+ mentions: z.ZodArray<z.ZodObject<{
496
+ orgUserId: z.ZodString;
497
+ name: z.ZodString;
498
+ }, z.core.$strict>>;
299
499
  }, z.core.$strict>;
300
500
  flags: z.ZodArray<z.ZodObject<{
301
501
  orgId: z.ZodString;
@@ -350,6 +550,7 @@ declare const SendMessage: z.ZodObject<{
350
550
  body: z.ZodString;
351
551
  replyToId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
352
552
  assetIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
553
+ clientId: z.ZodOptional<z.ZodUUID>;
353
554
  }, z.core.$strict>;
354
555
  declare const EditMessage: z.ZodObject<{
355
556
  body: z.ZodString;
@@ -357,9 +558,6 @@ declare const EditMessage: z.ZodObject<{
357
558
  declare const MarkRead: z.ZodObject<{
358
559
  messageId: z.ZodString;
359
560
  }, z.core.$strict>;
360
- declare const MuteChat: z.ZodObject<{
361
- until: z.ZodOptional<z.ZodPipe<z.ZodISODateTime, z.ZodCoercedDate<string>>>;
362
- }, z.core.$strict>;
363
561
  declare const OrgUserBody: z.ZodObject<{
364
562
  orgUserId: z.ZodString;
365
563
  }, z.core.$strict>;
@@ -381,6 +579,10 @@ declare const BlockParam: z.ZodObject<{
381
579
  communityId: z.ZodString;
382
580
  orgUserId: z.ZodString;
383
581
  }, z.core.$strip>;
582
+ declare const DirectChatParam: z.ZodObject<{
583
+ communityId: z.ZodString;
584
+ orgUserId: z.ZodString;
585
+ }, z.core.$strip>;
384
586
  //#endregion
385
- export { BlockParam, Chat, ChatIdParam, ChatListItem, ChatsPage, CommunityParam, EditMessage, MarkRead, MessageFlag, MessageIdParam, MessageQueue, MessageQueueEntry, MessageView, MessagesPage, MuteChat, OrgUserBody, ResolveMessageFlags, SendMessage, StartDirectChat, StartGroupChat };
587
+ export { BlockParam, Chat, ChatIdParam, ChatListItem, ChatListQuery, ChatLiveEvent, ChatUnreadSummary, ChatsPage, CommunityParam, DirectChatParam, EditMessage, MarkRead, MessageFlag, MessageIdParam, MessageQueue, MessageQueueEntry, MessageView, MessagesPage, OrgUserBody, ResolveMessageFlags, SendMessage, StartDirectChat, StartGroupChat };
386
588
  //# sourceMappingURL=chats.d.ts.map
@@ -1,6 +1,6 @@
1
- import { DateTimeInput, paginated } from "./shared.js";
1
+ import { PageQuery, paginated } from "./shared.js";
2
2
  import { z } from "zod";
3
- import { chatLastMessageSchema, chatSchema, idSchema, messageFlagResolutionSchema, messageFlagSchema, messageViewSchema } from "@headless-lms/core/schemas";
3
+ import { chatLastMessageSchema, chatLiveEventSchema, chatSchema, chatUnreadSummarySchema, commentAuthorSchema, idSchema, messageFlagResolutionSchema, messageFlagSchema, messageViewSchema, subscriptionViewSchema } from "@headless-lms/core/schemas";
4
4
  //#region src/http/schemas/chats.ts
5
5
  const Chat = chatSchema;
6
6
  const MessageFlag = messageFlagSchema;
@@ -9,13 +9,16 @@ const MessagesPage = paginated(MessageView);
9
9
  const ChatListItem = z.object({
10
10
  chat: Chat,
11
11
  participantIds: z.array(z.string()),
12
+ participants: z.array(commentAuthorSchema).describe("The profiles of the people in `participantIds`"),
12
13
  lastReadMessageId: z.string().nullable(),
13
- muted: z.boolean(),
14
- mutedUntil: z.coerce.date().nullable(),
14
+ subscription: subscriptionViewSchema.nullable().describe("Your mute on this chat while it applies; null when none"),
15
15
  unread: z.number().int(),
16
16
  lastMessage: chatLastMessageSchema.nullable()
17
17
  });
18
18
  const ChatsPage = paginated(ChatListItem);
19
+ const ChatListQuery = PageQuery.extend({ requests: z.stringbool().optional().describe("`true` for only the pending message requests to you, `false` for everything else; omit for every chat") }).strict();
20
+ const ChatUnreadSummary = chatUnreadSummarySchema;
21
+ const ChatLiveEvent = chatLiveEventSchema;
19
22
  const MessageQueueEntry = z.object({
20
23
  message: MessageView,
21
24
  flags: z.array(MessageFlag),
@@ -38,11 +41,11 @@ const StartGroupChat = z.object({
38
41
  const SendMessage = z.object({
39
42
  body: MessageBody,
40
43
  replyToId: idSchema.nullable().default(null).describe("A message in the same chat this one answers"),
41
- assetIds: Attachments
44
+ assetIds: Attachments,
45
+ clientId: z.uuid().optional().describe("Your id for this send. Sending again with the same id returns the message already sent.")
42
46
  }).strict();
43
47
  const EditMessage = z.object({ body: MessageBody }).strict();
44
48
  const MarkRead = z.object({ messageId: idSchema.describe("The newest message you have read in this chat") }).strict();
45
- const MuteChat = z.object({ until: DateTimeInput.optional().describe("When the mute ends. Omit to mute until you unmute") }).strict();
46
49
  const OrgUserBody = z.object({ orgUserId: idSchema }).strict();
47
50
  const ResolveMessageFlags = z.object({ resolution: messageFlagResolutionSchema.extract(["dismissed"]).describe("`dismissed` closes the open flags and leaves the message up. Deleting the message or locking the chat resolves its flags as `deleted` or `locked` instead.") }).strict();
48
51
  const ChatIdParam = z.object({ chatId: z.string() });
@@ -52,7 +55,11 @@ const BlockParam = z.object({
52
55
  communityId: z.string(),
53
56
  orgUserId: z.string()
54
57
  });
58
+ const DirectChatParam = z.object({
59
+ communityId: z.string(),
60
+ orgUserId: z.string()
61
+ });
55
62
  //#endregion
56
- export { BlockParam, Chat, ChatIdParam, ChatListItem, ChatsPage, CommunityParam, EditMessage, MarkRead, MessageFlag, MessageIdParam, MessageQueue, MessageQueueEntry, MessageView, MessagesPage, MuteChat, OrgUserBody, ResolveMessageFlags, SendMessage, StartDirectChat, StartGroupChat };
63
+ export { BlockParam, Chat, ChatIdParam, ChatListItem, ChatListQuery, ChatLiveEvent, ChatUnreadSummary, ChatsPage, CommunityParam, DirectChatParam, EditMessage, MarkRead, MessageFlag, MessageIdParam, MessageQueue, MessageQueueEntry, MessageView, MessagesPage, OrgUserBody, ResolveMessageFlags, SendMessage, StartDirectChat, StartGroupChat };
57
64
 
58
65
  //# sourceMappingURL=chats.js.map