@headless-lms/core 0.1.0 → 0.3.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 (249) hide show
  1. package/dist/assets/events.d.ts +90 -9
  2. package/dist/assets/events.js +19 -3
  3. package/dist/assets/events.js.map +1 -1
  4. package/dist/assets/file-urls.d.ts +20 -0
  5. package/dist/assets/file-urls.js +25 -0
  6. package/dist/assets/file-urls.js.map +1 -0
  7. package/dist/assets/index.d.ts +5 -4
  8. package/dist/assets/index.js +3 -2
  9. package/dist/assets/model.d.ts +2 -2
  10. package/dist/assets/ports.d.ts +45 -15
  11. package/dist/assets/service.d.ts +39 -7
  12. package/dist/assets/service.js +292 -37
  13. package/dist/assets/service.js.map +1 -1
  14. package/dist/automations/actions.d.ts +12 -15
  15. package/dist/automations/actions.js +188 -30
  16. package/dist/automations/actions.js.map +1 -1
  17. package/dist/automations/catalog.d.ts +5 -1
  18. package/dist/automations/catalog.js +514 -197
  19. package/dist/automations/catalog.js.map +1 -1
  20. package/dist/automations/community-derivations.d.ts +14 -0
  21. package/dist/automations/community-derivations.js +439 -0
  22. package/dist/automations/community-derivations.js.map +1 -0
  23. package/dist/automations/community-mail.d.ts +112 -0
  24. package/dist/automations/community-mail.js +90 -0
  25. package/dist/automations/community-mail.js.map +1 -0
  26. package/dist/automations/community-notifications.d.ts +16 -0
  27. package/dist/automations/community-notifications.js +84 -0
  28. package/dist/automations/community-notifications.js.map +1 -0
  29. package/dist/automations/events.d.ts +74 -24
  30. package/dist/automations/events.js +5 -5
  31. package/dist/automations/events.js.map +1 -1
  32. package/dist/automations/index.d.ts +7 -5
  33. package/dist/automations/index.js +3 -2
  34. package/dist/automations/model.d.ts +20 -3
  35. package/dist/automations/model.js +36 -3
  36. package/dist/automations/model.js.map +1 -1
  37. package/dist/automations/ports.d.ts +27 -8
  38. package/dist/automations/schedule.d.ts +6 -0
  39. package/dist/automations/schedule.js +41 -0
  40. package/dist/automations/schedule.js.map +1 -0
  41. package/dist/automations/seeds.d.ts +17 -0
  42. package/dist/automations/seeds.js +235 -0
  43. package/dist/automations/seeds.js.map +1 -0
  44. package/dist/automations/service.d.ts +41 -6
  45. package/dist/automations/service.js +542 -59
  46. package/dist/automations/service.js.map +1 -1
  47. package/dist/automations/types.d.ts +2 -2
  48. package/dist/automations/webhook-signing.d.ts +7 -0
  49. package/dist/automations/webhook-signing.js +22 -0
  50. package/dist/automations/webhook-signing.js.map +1 -0
  51. package/dist/content/events.d.ts +1013 -25
  52. package/dist/content/events.js +168 -19
  53. package/dist/content/events.js.map +1 -1
  54. package/dist/content/index.d.ts +5 -5
  55. package/dist/content/index.js +2 -2
  56. package/dist/content/model.d.ts +2 -2
  57. package/dist/content/ports.d.ts +109 -25
  58. package/dist/content/service.d.ts +68 -23
  59. package/dist/content/service.js +647 -60
  60. package/dist/content/service.js.map +1 -1
  61. package/dist/content/types.d.ts +2 -2
  62. package/dist/discussion/authors.d.ts +10 -0
  63. package/dist/discussion/authors.js +23 -0
  64. package/dist/discussion/authors.js.map +1 -0
  65. package/dist/discussion/chats.d.ts +104 -0
  66. package/dist/discussion/chats.js +798 -0
  67. package/dist/discussion/chats.js.map +1 -0
  68. package/dist/discussion/events.d.ts +633 -14
  69. package/dist/discussion/events.js +134 -5
  70. package/dist/discussion/events.js.map +1 -1
  71. package/dist/discussion/index.d.ts +7 -3
  72. package/dist/discussion/index.js +4 -1
  73. package/dist/discussion/model.d.ts +1 -2
  74. package/dist/discussion/ports.d.ts +288 -27
  75. package/dist/discussion/ports.js +6 -1
  76. package/dist/discussion/ports.js.map +1 -0
  77. package/dist/discussion/posts.d.ts +103 -0
  78. package/dist/discussion/posts.js +723 -0
  79. package/dist/discussion/posts.js.map +1 -0
  80. package/dist/discussion/service.d.ts +33 -11
  81. package/dist/discussion/service.js +297 -81
  82. package/dist/discussion/service.js.map +1 -1
  83. package/dist/entitlements/events.d.ts +264 -13
  84. package/dist/entitlements/events.js +49 -5
  85. package/dist/entitlements/events.js.map +1 -1
  86. package/dist/entitlements/index.d.ts +5 -4
  87. package/dist/entitlements/index.js +2 -1
  88. package/dist/entitlements/model.d.ts +3 -2
  89. package/dist/entitlements/ports.d.ts +124 -11
  90. package/dist/entitlements/rules.d.ts +12 -0
  91. package/dist/entitlements/rules.js +17 -0
  92. package/dist/entitlements/rules.js.map +1 -0
  93. package/dist/entitlements/service.d.ts +54 -3
  94. package/dist/entitlements/service.js +473 -2
  95. package/dist/entitlements/service.js.map +1 -1
  96. package/dist/identity/access.d.ts +6 -0
  97. package/dist/identity/access.js +7 -0
  98. package/dist/identity/access.js.map +1 -0
  99. package/dist/identity/events.d.ts +17 -3
  100. package/dist/identity/events.js +12 -2
  101. package/dist/identity/events.js.map +1 -1
  102. package/dist/identity/index.d.ts +6 -4
  103. package/dist/identity/index.js +3 -1
  104. package/dist/identity/model.d.ts +2 -1
  105. package/dist/identity/notifications.d.ts +27 -0
  106. package/dist/identity/notifications.js +101 -0
  107. package/dist/identity/notifications.js.map +1 -0
  108. package/dist/identity/ports.d.ts +76 -3
  109. package/dist/identity/service.d.ts +17 -3
  110. package/dist/identity/service.js +73 -5
  111. package/dist/identity/service.js.map +1 -1
  112. package/dist/integrations/events.d.ts +27 -3
  113. package/dist/integrations/events.js +15 -3
  114. package/dist/integrations/events.js.map +1 -1
  115. package/dist/integrations/model.js +1 -1
  116. package/dist/integrations/model.js.map +1 -1
  117. package/dist/integrations/service.js +2 -2
  118. package/dist/integrations/service.js.map +1 -1
  119. package/dist/organizations/access-scopes.d.ts +19 -0
  120. package/dist/organizations/access-scopes.js +89 -0
  121. package/dist/organizations/access-scopes.js.map +1 -0
  122. package/dist/organizations/events.d.ts +234 -25
  123. package/dist/organizations/events.js +58 -9
  124. package/dist/organizations/events.js.map +1 -1
  125. package/dist/organizations/index.d.ts +8 -7
  126. package/dist/organizations/index.js +4 -3
  127. package/dist/organizations/members.d.ts +8 -5
  128. package/dist/organizations/members.js.map +1 -1
  129. package/dist/organizations/ports.d.ts +20 -21
  130. package/dist/organizations/roles.d.ts +6 -10
  131. package/dist/organizations/roles.js +19 -7
  132. package/dist/organizations/roles.js.map +1 -1
  133. package/dist/organizations/service.d.ts +28 -14
  134. package/dist/organizations/service.js +274 -105
  135. package/dist/organizations/service.js.map +1 -1
  136. package/dist/organizations/types.d.ts +2 -11
  137. package/dist/progress/events.d.ts +34 -2
  138. package/dist/progress/events.js +15 -2
  139. package/dist/progress/events.js.map +1 -1
  140. package/dist/progress/index.d.ts +2 -2
  141. package/dist/progress/ports.d.ts +6 -1
  142. package/dist/progress/service.d.ts +5 -3
  143. package/dist/progress/service.js +9 -3
  144. package/dist/progress/service.js.map +1 -1
  145. package/dist/reporting/admin/index.d.ts +4 -0
  146. package/dist/reporting/admin/index.js +2 -0
  147. package/dist/reporting/admin/model.d.ts +108 -0
  148. package/dist/reporting/admin/ports.d.ts +27 -0
  149. package/dist/reporting/admin/service.d.ts +22 -0
  150. package/dist/reporting/admin/service.js +38 -0
  151. package/dist/reporting/admin/service.js.map +1 -0
  152. package/dist/reporting/member/index.d.ts +5 -0
  153. package/dist/reporting/member/index.js +2 -0
  154. package/dist/reporting/member/model.d.ts +124 -0
  155. package/dist/reporting/member/ports.d.ts +45 -0
  156. package/dist/reporting/member/service.d.ts +73 -0
  157. package/dist/reporting/member/service.js +286 -0
  158. package/dist/reporting/member/service.js.map +1 -0
  159. package/dist/shared/actor.d.ts +9 -0
  160. package/dist/shared/errors.d.ts +7 -1
  161. package/dist/shared/errors.js +10 -1
  162. package/dist/shared/errors.js.map +1 -1
  163. package/dist/shared/events.d.ts +5 -3
  164. package/dist/shared/events.js +1 -0
  165. package/dist/shared/events.js.map +1 -1
  166. package/dist/shared/id.d.ts +12 -0
  167. package/dist/shared/id.js +13 -1
  168. package/dist/shared/id.js.map +1 -1
  169. package/dist/shared/mailer.d.ts +6 -1
  170. package/dist/shared/mailer.js.map +1 -1
  171. package/dist/shared/network.d.ts +10 -0
  172. package/dist/shared/network.js +211 -0
  173. package/dist/shared/network.js.map +1 -0
  174. package/dist/shared/settings.js.map +1 -1
  175. package/dist/types/assets.d.ts +2 -2
  176. package/dist/types/automations.d.ts +21 -2
  177. package/dist/types/content.d.ts +2 -2
  178. package/dist/types/discussion.d.ts +12 -3
  179. package/dist/types/email-templates.d.ts +124 -1
  180. package/dist/types/entitlements.d.ts +2 -2
  181. package/dist/types/events.d.ts +3 -3
  182. package/dist/types/identity.d.ts +48 -2
  183. package/dist/types/index.d.ts +10 -10
  184. package/dist/types/organizations.d.ts +2 -2
  185. package/dist/types/ports.d.ts +7 -1
  186. package/dist/types/schemas/assets.d.ts +67 -36
  187. package/dist/types/schemas/assets.js +19 -13
  188. package/dist/types/schemas/assets.js.map +1 -1
  189. package/dist/types/schemas/automations.d.ts +88 -4
  190. package/dist/types/schemas/automations.js +46 -6
  191. package/dist/types/schemas/automations.js.map +1 -1
  192. package/dist/types/schemas/content.d.ts +385 -20
  193. package/dist/types/schemas/content.js +178 -15
  194. package/dist/types/schemas/content.js.map +1 -1
  195. package/dist/types/schemas/credentials.js.map +1 -1
  196. package/dist/types/schemas/discussion.d.ts +379 -4
  197. package/dist/types/schemas/discussion.js +209 -7
  198. package/dist/types/schemas/discussion.js.map +1 -1
  199. package/dist/types/schemas/entitlements.d.ts +44 -4
  200. package/dist/types/schemas/entitlements.js +32 -4
  201. package/dist/types/schemas/entitlements.js.map +1 -1
  202. package/dist/types/schemas/identity.d.ts +115 -5
  203. package/dist/types/schemas/identity.js +59 -6
  204. package/dist/types/schemas/identity.js.map +1 -1
  205. package/dist/types/schemas/index.d.ts +9 -9
  206. package/dist/types/schemas/index.js +9 -9
  207. package/dist/types/schemas/integrations.js.map +1 -1
  208. package/dist/types/schemas/organizations.d.ts +27 -5
  209. package/dist/types/schemas/organizations.js +14 -7
  210. package/dist/types/schemas/organizations.js.map +1 -1
  211. package/dist/types/schemas/outbox.d.ts +1 -0
  212. package/dist/types/schemas/outbox.js +1 -0
  213. package/dist/types/schemas/outbox.js.map +1 -1
  214. package/dist/types/schemas/progress.d.ts +1 -0
  215. package/dist/types/schemas/progress.js +1 -0
  216. package/dist/types/schemas/progress.js.map +1 -1
  217. package/dist/types/schemas/settings.js.map +1 -1
  218. package/dist/types/schemas/shared.d.ts +4 -1
  219. package/dist/types/schemas/shared.js +7 -1
  220. package/dist/types/schemas/shared.js.map +1 -1
  221. package/dist/types/shared.d.ts +1 -1
  222. package/package.json +2 -2
  223. package/dist/reporting/dashboard/index.d.ts +0 -4
  224. package/dist/reporting/dashboard/index.js +0 -2
  225. package/dist/reporting/dashboard/model.d.ts +0 -14
  226. package/dist/reporting/dashboard/ports.d.ts +0 -13
  227. package/dist/reporting/dashboard/service.d.ts +0 -19
  228. package/dist/reporting/dashboard/service.js +0 -20
  229. package/dist/reporting/dashboard/service.js.map +0 -1
  230. package/dist/reporting/learn/index.d.ts +0 -5
  231. package/dist/reporting/learn/index.js +0 -2
  232. package/dist/reporting/learn/model.d.ts +0 -23
  233. package/dist/reporting/learn/ports.d.ts +0 -42
  234. package/dist/reporting/learn/service.d.ts +0 -48
  235. package/dist/reporting/learn/service.js +0 -111
  236. package/dist/reporting/learn/service.js.map +0 -1
  237. package/dist/reporting/students/index.d.ts +0 -4
  238. package/dist/reporting/students/index.js +0 -2
  239. package/dist/reporting/students/model.d.ts +0 -31
  240. package/dist/reporting/students/ports.d.ts +0 -13
  241. package/dist/reporting/students/ports.js +0 -1
  242. package/dist/reporting/students/service.d.ts +0 -19
  243. package/dist/reporting/students/service.js +0 -20
  244. package/dist/reporting/students/service.js.map +0 -1
  245. /package/dist/reporting/{dashboard → admin}/model.js +0 -0
  246. /package/dist/reporting/{dashboard → admin}/ports.js +0 -0
  247. /package/dist/reporting/{learn → member}/model.js +0 -0
  248. /package/dist/reporting/{learn → member}/ports.js +0 -0
  249. /package/dist/{reporting/students/model.js → shared/actor.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { idSchema } from "../types/schemas/shared.js";
2
- import { activitySchema, courseSchema, downloadAssetSchema, downloadSchema, moduleSchema } from "../types/schemas/content.js";
2
+ import { activitySchema, bundleItemSchema, bundleSchema, communitySchema, courseSchema, downloadAssetSchema, downloadSchema, moduleSchema, spaceDetailSchema } from "../types/schemas/content.js";
3
3
  import { defineEvent } from "../shared/events.js";
4
4
  import { z } from "zod";
5
5
  //#region src/content/events.ts
@@ -7,96 +7,245 @@ const downloadAssetsEventSchema = z.object({
7
7
  downloadId: idSchema,
8
8
  assets: z.array(downloadAssetSchema)
9
9
  }).strict();
10
+ const bundleItemsEventSchema = z.object({
11
+ bundleId: idSchema,
12
+ items: z.array(bundleItemSchema)
13
+ }).strict();
14
+ const publicCourse = courseSchema.pick({
15
+ orgId: true,
16
+ id: true,
17
+ type: true,
18
+ title: true,
19
+ slug: true,
20
+ description: true,
21
+ status: true,
22
+ category: true,
23
+ thumbnailAssetId: true,
24
+ settings: true,
25
+ createdAt: true,
26
+ updatedAt: true
27
+ }).strip();
28
+ const publicModule = moduleSchema.pick({
29
+ orgId: true,
30
+ id: true,
31
+ courseId: true,
32
+ title: true,
33
+ seq: true,
34
+ createdAt: true,
35
+ updatedAt: true
36
+ }).strip();
37
+ const publicActivity = activitySchema.pick({
38
+ orgId: true,
39
+ id: true,
40
+ moduleId: true,
41
+ courseId: true,
42
+ seq: true,
43
+ createdAt: true,
44
+ updatedAt: true
45
+ }).strip();
46
+ const publicDownload = downloadSchema.pick({
47
+ orgId: true,
48
+ id: true,
49
+ type: true,
50
+ title: true,
51
+ slug: true,
52
+ description: true,
53
+ status: true,
54
+ category: true,
55
+ thumbnailAssetId: true,
56
+ createdAt: true,
57
+ updatedAt: true
58
+ }).strip();
59
+ const publicDownloadAsset = downloadAssetSchema.pick({
60
+ orgId: true,
61
+ id: true,
62
+ downloadId: true,
63
+ assetId: true,
64
+ seq: true,
65
+ displayName: true,
66
+ createdAt: true,
67
+ updatedAt: true
68
+ }).strip();
69
+ const publicCommunity = communitySchema.omit({ settings: true }).strip();
70
+ const publicDownloadAssets = z.object({
71
+ downloadId: idSchema,
72
+ assets: z.array(publicDownloadAsset)
73
+ });
10
74
  const contentEvents = {
11
75
  courseCreated: defineEvent({
12
76
  type: "content.course.created",
13
77
  version: 1,
14
- data: courseSchema
78
+ data: courseSchema,
79
+ publicData: publicCourse
15
80
  }),
16
81
  courseUpdated: defineEvent({
17
82
  type: "content.course.updated",
18
83
  version: 1,
19
- data: courseSchema
84
+ data: courseSchema,
85
+ publicData: publicCourse
20
86
  }),
21
87
  courseDeleted: defineEvent({
22
88
  type: "content.course.deleted",
23
89
  version: 1,
24
- data: courseSchema
90
+ data: courseSchema,
91
+ publicData: publicCourse
25
92
  }),
26
93
  moduleCreated: defineEvent({
27
94
  type: "content.course.module.created",
28
95
  version: 1,
29
- data: moduleSchema
96
+ data: moduleSchema,
97
+ publicData: publicModule
30
98
  }),
31
99
  moduleUpdated: defineEvent({
32
100
  type: "content.course.module.updated",
33
101
  version: 1,
34
- data: moduleSchema
102
+ data: moduleSchema,
103
+ publicData: publicModule
35
104
  }),
36
105
  moduleDeleted: defineEvent({
37
106
  type: "content.course.module.deleted",
38
107
  version: 1,
39
- data: moduleSchema
108
+ data: moduleSchema,
109
+ publicData: publicModule
40
110
  }),
41
111
  modulesReordered: defineEvent({
42
112
  type: "content.course.modules.reordered",
43
113
  version: 1,
44
- data: z.array(moduleSchema)
114
+ data: z.array(moduleSchema),
115
+ publicData: z.array(publicModule)
45
116
  }),
46
117
  activityCreated: defineEvent({
47
118
  type: "content.course.activity.created",
48
119
  version: 1,
49
- data: activitySchema
120
+ data: activitySchema,
121
+ publicData: publicActivity
50
122
  }),
51
123
  activityUpdated: defineEvent({
52
124
  type: "content.course.activity.updated",
53
125
  version: 1,
54
- data: activitySchema
126
+ data: activitySchema,
127
+ publicData: publicActivity
55
128
  }),
56
129
  activityDeleted: defineEvent({
57
130
  type: "content.course.activity.deleted",
58
131
  version: 1,
59
- data: activitySchema
132
+ data: activitySchema,
133
+ publicData: publicActivity
60
134
  }),
61
135
  activitiesReordered: defineEvent({
62
136
  type: "content.course.activities.reordered",
63
137
  version: 1,
64
- data: moduleSchema
138
+ data: moduleSchema,
139
+ publicData: publicModule
65
140
  }),
66
141
  downloadCreated: defineEvent({
67
142
  type: "content.download.created",
68
143
  version: 1,
69
- data: downloadSchema
144
+ data: downloadSchema,
145
+ publicData: publicDownload
70
146
  }),
71
147
  downloadUpdated: defineEvent({
72
148
  type: "content.download.updated",
73
149
  version: 1,
74
- data: downloadSchema
150
+ data: downloadSchema,
151
+ publicData: publicDownload
75
152
  }),
76
153
  downloadDeleted: defineEvent({
77
154
  type: "content.download.deleted",
78
155
  version: 1,
79
- data: downloadSchema
156
+ data: downloadSchema,
157
+ publicData: publicDownload
80
158
  }),
81
159
  downloadAssetAdded: defineEvent({
82
160
  type: "content.download.asset.added",
83
161
  version: 1,
84
- data: downloadAssetsEventSchema
162
+ data: downloadAssetsEventSchema,
163
+ publicData: publicDownloadAssets
85
164
  }),
86
165
  downloadAssetRemoved: defineEvent({
87
166
  type: "content.download.asset.removed",
88
167
  version: 1,
89
- data: downloadAssetsEventSchema
168
+ data: downloadAssetsEventSchema,
169
+ publicData: publicDownloadAssets
90
170
  }),
91
171
  downloadAssetRenamed: defineEvent({
92
172
  type: "content.download.asset.renamed",
93
173
  version: 1,
94
- data: downloadAssetsEventSchema
174
+ data: downloadAssetsEventSchema,
175
+ publicData: publicDownloadAssets
95
176
  }),
96
177
  downloadAssetsReordered: defineEvent({
97
178
  type: "content.download.assets.reordered",
98
179
  version: 1,
99
- data: downloadAssetsEventSchema
180
+ data: downloadAssetsEventSchema,
181
+ publicData: publicDownloadAssets
182
+ }),
183
+ bundleCreated: defineEvent({
184
+ type: "content.bundle.created",
185
+ version: 1,
186
+ data: bundleSchema
187
+ }),
188
+ bundleUpdated: defineEvent({
189
+ type: "content.bundle.updated",
190
+ version: 1,
191
+ data: bundleSchema
192
+ }),
193
+ bundleDeleted: defineEvent({
194
+ type: "content.bundle.deleted",
195
+ version: 1,
196
+ data: bundleSchema
197
+ }),
198
+ bundleItemAdded: defineEvent({
199
+ type: "content.bundle.item.added",
200
+ version: 1,
201
+ data: bundleItemsEventSchema
202
+ }),
203
+ bundleItemRemoved: defineEvent({
204
+ type: "content.bundle.item.removed",
205
+ version: 1,
206
+ data: bundleItemsEventSchema
207
+ }),
208
+ communityCreated: defineEvent({
209
+ type: "content.community.created",
210
+ version: 1,
211
+ data: communitySchema,
212
+ publicData: publicCommunity
213
+ }),
214
+ communityUpdated: defineEvent({
215
+ type: "content.community.updated",
216
+ version: 1,
217
+ data: communitySchema,
218
+ publicData: publicCommunity
219
+ }),
220
+ communityDeleted: defineEvent({
221
+ type: "content.community.deleted",
222
+ version: 1,
223
+ data: communitySchema,
224
+ publicData: publicCommunity
225
+ }),
226
+ spaceCreated: defineEvent({
227
+ type: "content.community.space.created",
228
+ version: 1,
229
+ data: spaceDetailSchema,
230
+ publicData: spaceDetailSchema
231
+ }),
232
+ spaceUpdated: defineEvent({
233
+ type: "content.community.space.updated",
234
+ version: 1,
235
+ data: spaceDetailSchema,
236
+ publicData: spaceDetailSchema
237
+ }),
238
+ spaceDeleted: defineEvent({
239
+ type: "content.community.space.deleted",
240
+ version: 1,
241
+ data: spaceDetailSchema,
242
+ publicData: spaceDetailSchema
243
+ }),
244
+ spacesReordered: defineEvent({
245
+ type: "content.community.spaces.reordered",
246
+ version: 1,
247
+ data: z.array(spaceDetailSchema),
248
+ publicData: z.array(spaceDetailSchema)
100
249
  })
101
250
  };
102
251
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"events.js","names":[],"sources":["../../src/content/events.ts"],"sourcesContent":["import { z } from 'zod';\nimport {\n activitySchema,\n courseSchema,\n downloadAssetSchema,\n downloadSchema,\n idSchema,\n moduleSchema,\n} from '../types/schemas/index.js';\nimport {\n defineEvent,\n type EventOf,\n type EventOfValues,\n} from '../shared/ports.js';\n\nconst downloadAssetsEventSchema = z\n .object({\n downloadId: idSchema,\n assets: z.array(downloadAssetSchema),\n })\n .strict();\n\nexport const contentEvents = {\n courseCreated: defineEvent({\n type: 'content.course.created',\n version: 1,\n data: courseSchema,\n }),\n courseUpdated: defineEvent({\n type: 'content.course.updated',\n version: 1,\n data: courseSchema,\n }),\n courseDeleted: defineEvent({\n type: 'content.course.deleted',\n version: 1,\n data: courseSchema,\n }),\n moduleCreated: defineEvent({\n type: 'content.course.module.created',\n version: 1,\n data: moduleSchema,\n }),\n moduleUpdated: defineEvent({\n type: 'content.course.module.updated',\n version: 1,\n data: moduleSchema,\n }),\n moduleDeleted: defineEvent({\n type: 'content.course.module.deleted',\n version: 1,\n data: moduleSchema,\n }),\n modulesReordered: defineEvent({\n type: 'content.course.modules.reordered',\n version: 1,\n data: z.array(moduleSchema),\n }),\n activityCreated: defineEvent({\n type: 'content.course.activity.created',\n version: 1,\n data: activitySchema,\n }),\n activityUpdated: defineEvent({\n type: 'content.course.activity.updated',\n version: 1,\n data: activitySchema,\n }),\n activityDeleted: defineEvent({\n type: 'content.course.activity.deleted',\n version: 1,\n data: activitySchema,\n }),\n activitiesReordered: defineEvent({\n type: 'content.course.activities.reordered',\n version: 1,\n data: moduleSchema,\n }),\n downloadCreated: defineEvent({\n type: 'content.download.created',\n version: 1,\n data: downloadSchema,\n }),\n downloadUpdated: defineEvent({\n type: 'content.download.updated',\n version: 1,\n data: downloadSchema,\n }),\n downloadDeleted: defineEvent({\n type: 'content.download.deleted',\n version: 1,\n data: downloadSchema,\n }),\n downloadAssetAdded: defineEvent({\n type: 'content.download.asset.added',\n version: 1,\n data: downloadAssetsEventSchema,\n }),\n downloadAssetRemoved: defineEvent({\n type: 'content.download.asset.removed',\n version: 1,\n data: downloadAssetsEventSchema,\n }),\n downloadAssetRenamed: defineEvent({\n type: 'content.download.asset.renamed',\n version: 1,\n data: downloadAssetsEventSchema,\n }),\n downloadAssetsReordered: defineEvent({\n type: 'content.download.assets.reordered',\n version: 1,\n data: downloadAssetsEventSchema,\n }),\n};\n\nexport type CourseCreated = EventOf<typeof contentEvents.courseCreated>;\nexport type CourseUpdated = EventOf<typeof contentEvents.courseUpdated>;\nexport type CourseDeleted = EventOf<typeof contentEvents.courseDeleted>;\nexport type CourseModuleCreated = EventOf<typeof contentEvents.moduleCreated>;\nexport type CourseModuleUpdated = EventOf<typeof contentEvents.moduleUpdated>;\nexport type CourseModuleDeleted = EventOf<typeof contentEvents.moduleDeleted>;\nexport type CourseModulesReordered = EventOf<typeof contentEvents.modulesReordered>;\nexport type CourseActivityCreated = EventOf<typeof contentEvents.activityCreated>;\nexport type CourseActivityUpdated = EventOf<typeof contentEvents.activityUpdated>;\nexport type CourseActivityDeleted = EventOf<typeof contentEvents.activityDeleted>;\nexport type CourseActivitiesReordered = EventOf<typeof contentEvents.activitiesReordered>;\nexport type DownloadCreated = EventOf<typeof contentEvents.downloadCreated>;\nexport type DownloadUpdated = EventOf<typeof contentEvents.downloadUpdated>;\nexport type DownloadDeleted = EventOf<typeof contentEvents.downloadDeleted>;\nexport type DownloadAssetAdded = EventOf<typeof contentEvents.downloadAssetAdded>;\nexport type DownloadAssetRemoved = EventOf<typeof contentEvents.downloadAssetRemoved>;\nexport type DownloadAssetRenamed = EventOf<typeof contentEvents.downloadAssetRenamed>;\nexport type DownloadAssetsReordered = EventOf<typeof contentEvents.downloadAssetsReordered>;\nexport type ContentEvent = EventOfValues<typeof contentEvents>;\n"],"mappings":";;;;;AAeA,MAAM,4BAA4B,EAC/B,OAAO;CACN,YAAY;CACZ,QAAQ,EAAE,MAAM,mBAAmB;AACrC,CAAC,CAAC,CACD,OAAO;AAEV,MAAa,gBAAgB;CAC3B,eAAe,YAAY;EACzB,MAAM;EACN,SAAS;EACT,MAAM;CACR,CAAC;CACD,eAAe,YAAY;EACzB,MAAM;EACN,SAAS;EACT,MAAM;CACR,CAAC;CACD,eAAe,YAAY;EACzB,MAAM;EACN,SAAS;EACT,MAAM;CACR,CAAC;CACD,eAAe,YAAY;EACzB,MAAM;EACN,SAAS;EACT,MAAM;CACR,CAAC;CACD,eAAe,YAAY;EACzB,MAAM;EACN,SAAS;EACT,MAAM;CACR,CAAC;CACD,eAAe,YAAY;EACzB,MAAM;EACN,SAAS;EACT,MAAM;CACR,CAAC;CACD,kBAAkB,YAAY;EAC5B,MAAM;EACN,SAAS;EACT,MAAM,EAAE,MAAM,YAAY;CAC5B,CAAC;CACD,iBAAiB,YAAY;EAC3B,MAAM;EACN,SAAS;EACT,MAAM;CACR,CAAC;CACD,iBAAiB,YAAY;EAC3B,MAAM;EACN,SAAS;EACT,MAAM;CACR,CAAC;CACD,iBAAiB,YAAY;EAC3B,MAAM;EACN,SAAS;EACT,MAAM;CACR,CAAC;CACD,qBAAqB,YAAY;EAC/B,MAAM;EACN,SAAS;EACT,MAAM;CACR,CAAC;CACD,iBAAiB,YAAY;EAC3B,MAAM;EACN,SAAS;EACT,MAAM;CACR,CAAC;CACD,iBAAiB,YAAY;EAC3B,MAAM;EACN,SAAS;EACT,MAAM;CACR,CAAC;CACD,iBAAiB,YAAY;EAC3B,MAAM;EACN,SAAS;EACT,MAAM;CACR,CAAC;CACD,oBAAoB,YAAY;EAC9B,MAAM;EACN,SAAS;EACT,MAAM;CACR,CAAC;CACD,sBAAsB,YAAY;EAChC,MAAM;EACN,SAAS;EACT,MAAM;CACR,CAAC;CACD,sBAAsB,YAAY;EAChC,MAAM;EACN,SAAS;EACT,MAAM;CACR,CAAC;CACD,yBAAyB,YAAY;EACnC,MAAM;EACN,SAAS;EACT,MAAM;CACR,CAAC;AACH"}
1
+ {"version":3,"file":"events.js","names":[],"sources":["../../src/content/events.ts"],"sourcesContent":["import { z } from 'zod';\nimport {\n activitySchema,\n bundleItemSchema,\n bundleSchema,\n communitySchema,\n courseSchema,\n downloadAssetSchema,\n downloadSchema,\n idSchema,\n moduleSchema,\n spaceDetailSchema,\n} from '../types/schemas/index.js';\nimport { defineEvent, type EventOf, type EventOfValues } from '../shared/ports.js';\n\nconst downloadAssetsEventSchema = z\n .object({\n downloadId: idSchema,\n assets: z.array(downloadAssetSchema),\n })\n .strict();\n\nconst bundleItemsEventSchema = z\n .object({\n bundleId: idSchema,\n items: z.array(bundleItemSchema),\n })\n .strict();\n\nconst publicCourse = courseSchema\n .pick({\n orgId: true,\n id: true,\n type: true,\n title: true,\n slug: true,\n description: true,\n status: true,\n category: true,\n thumbnailAssetId: true,\n settings: true,\n createdAt: true,\n updatedAt: true,\n })\n .strip();\n\nconst publicModule = moduleSchema\n .pick({\n orgId: true,\n id: true,\n courseId: true,\n title: true,\n seq: true,\n createdAt: true,\n updatedAt: true,\n })\n .strip();\n\nconst publicActivity = activitySchema\n .pick({\n orgId: true,\n id: true,\n moduleId: true,\n courseId: true,\n seq: true,\n createdAt: true,\n updatedAt: true,\n })\n .strip();\n\nconst publicDownload = downloadSchema\n .pick({\n orgId: true,\n id: true,\n type: true,\n title: true,\n slug: true,\n description: true,\n status: true,\n category: true,\n thumbnailAssetId: true,\n createdAt: true,\n updatedAt: true,\n })\n .strip();\n\nconst publicDownloadAsset = downloadAssetSchema\n .pick({\n orgId: true,\n id: true,\n downloadId: true,\n assetId: true,\n seq: true,\n displayName: true,\n createdAt: true,\n updatedAt: true,\n })\n .strip();\n\nconst publicCommunity = communitySchema.omit({ settings: true }).strip();\n\nconst publicDownloadAssets = z.object({\n downloadId: idSchema,\n assets: z.array(publicDownloadAsset),\n});\n\nexport const contentEvents = {\n courseCreated: defineEvent({\n type: 'content.course.created',\n version: 1,\n data: courseSchema,\n publicData: publicCourse,\n }),\n courseUpdated: defineEvent({\n type: 'content.course.updated',\n version: 1,\n data: courseSchema,\n publicData: publicCourse,\n }),\n courseDeleted: defineEvent({\n type: 'content.course.deleted',\n version: 1,\n data: courseSchema,\n publicData: publicCourse,\n }),\n moduleCreated: defineEvent({\n type: 'content.course.module.created',\n version: 1,\n data: moduleSchema,\n publicData: publicModule,\n }),\n moduleUpdated: defineEvent({\n type: 'content.course.module.updated',\n version: 1,\n data: moduleSchema,\n publicData: publicModule,\n }),\n moduleDeleted: defineEvent({\n type: 'content.course.module.deleted',\n version: 1,\n data: moduleSchema,\n publicData: publicModule,\n }),\n modulesReordered: defineEvent({\n type: 'content.course.modules.reordered',\n version: 1,\n data: z.array(moduleSchema),\n publicData: z.array(publicModule),\n }),\n activityCreated: defineEvent({\n type: 'content.course.activity.created',\n version: 1,\n data: activitySchema,\n publicData: publicActivity,\n }),\n activityUpdated: defineEvent({\n type: 'content.course.activity.updated',\n version: 1,\n data: activitySchema,\n publicData: publicActivity,\n }),\n activityDeleted: defineEvent({\n type: 'content.course.activity.deleted',\n version: 1,\n data: activitySchema,\n publicData: publicActivity,\n }),\n activitiesReordered: defineEvent({\n type: 'content.course.activities.reordered',\n version: 1,\n data: moduleSchema,\n publicData: publicModule,\n }),\n downloadCreated: defineEvent({\n type: 'content.download.created',\n version: 1,\n data: downloadSchema,\n publicData: publicDownload,\n }),\n downloadUpdated: defineEvent({\n type: 'content.download.updated',\n version: 1,\n data: downloadSchema,\n publicData: publicDownload,\n }),\n downloadDeleted: defineEvent({\n type: 'content.download.deleted',\n version: 1,\n data: downloadSchema,\n publicData: publicDownload,\n }),\n downloadAssetAdded: defineEvent({\n type: 'content.download.asset.added',\n version: 1,\n data: downloadAssetsEventSchema,\n publicData: publicDownloadAssets,\n }),\n downloadAssetRemoved: defineEvent({\n type: 'content.download.asset.removed',\n version: 1,\n data: downloadAssetsEventSchema,\n publicData: publicDownloadAssets,\n }),\n downloadAssetRenamed: defineEvent({\n type: 'content.download.asset.renamed',\n version: 1,\n data: downloadAssetsEventSchema,\n publicData: publicDownloadAssets,\n }),\n downloadAssetsReordered: defineEvent({\n type: 'content.download.assets.reordered',\n version: 1,\n data: downloadAssetsEventSchema,\n publicData: publicDownloadAssets,\n }),\n bundleCreated: defineEvent({\n type: 'content.bundle.created',\n version: 1,\n data: bundleSchema,\n }),\n bundleUpdated: defineEvent({\n type: 'content.bundle.updated',\n version: 1,\n data: bundleSchema,\n }),\n bundleDeleted: defineEvent({\n type: 'content.bundle.deleted',\n version: 1,\n data: bundleSchema,\n }),\n bundleItemAdded: defineEvent({\n type: 'content.bundle.item.added',\n version: 1,\n data: bundleItemsEventSchema,\n }),\n bundleItemRemoved: defineEvent({\n type: 'content.bundle.item.removed',\n version: 1,\n data: bundleItemsEventSchema,\n }),\n communityCreated: defineEvent({\n type: 'content.community.created',\n version: 1,\n data: communitySchema,\n publicData: publicCommunity,\n }),\n communityUpdated: defineEvent({\n type: 'content.community.updated',\n version: 1,\n data: communitySchema,\n publicData: publicCommunity,\n }),\n communityDeleted: defineEvent({\n type: 'content.community.deleted',\n version: 1,\n data: communitySchema,\n publicData: publicCommunity,\n }),\n spaceCreated: defineEvent({\n type: 'content.community.space.created',\n version: 1,\n data: spaceDetailSchema,\n publicData: spaceDetailSchema,\n }),\n spaceUpdated: defineEvent({\n type: 'content.community.space.updated',\n version: 1,\n data: spaceDetailSchema,\n publicData: spaceDetailSchema,\n }),\n spaceDeleted: defineEvent({\n type: 'content.community.space.deleted',\n version: 1,\n data: spaceDetailSchema,\n publicData: spaceDetailSchema,\n }),\n spacesReordered: defineEvent({\n type: 'content.community.spaces.reordered',\n version: 1,\n data: z.array(spaceDetailSchema),\n publicData: z.array(spaceDetailSchema),\n }),\n};\n\nexport type CourseCreated = EventOf<typeof contentEvents.courseCreated>;\nexport type CourseUpdated = EventOf<typeof contentEvents.courseUpdated>;\nexport type CourseDeleted = EventOf<typeof contentEvents.courseDeleted>;\nexport type CourseModuleCreated = EventOf<typeof contentEvents.moduleCreated>;\nexport type CourseModuleUpdated = EventOf<typeof contentEvents.moduleUpdated>;\nexport type CourseModuleDeleted = EventOf<typeof contentEvents.moduleDeleted>;\nexport type CourseModulesReordered = EventOf<typeof contentEvents.modulesReordered>;\nexport type CourseActivityCreated = EventOf<typeof contentEvents.activityCreated>;\nexport type CourseActivityUpdated = EventOf<typeof contentEvents.activityUpdated>;\nexport type CourseActivityDeleted = EventOf<typeof contentEvents.activityDeleted>;\nexport type CourseActivitiesReordered = EventOf<typeof contentEvents.activitiesReordered>;\nexport type DownloadCreated = EventOf<typeof contentEvents.downloadCreated>;\nexport type DownloadUpdated = EventOf<typeof contentEvents.downloadUpdated>;\nexport type DownloadDeleted = EventOf<typeof contentEvents.downloadDeleted>;\nexport type DownloadAssetAdded = EventOf<typeof contentEvents.downloadAssetAdded>;\nexport type DownloadAssetRemoved = EventOf<typeof contentEvents.downloadAssetRemoved>;\nexport type DownloadAssetRenamed = EventOf<typeof contentEvents.downloadAssetRenamed>;\nexport type DownloadAssetsReordered = EventOf<typeof contentEvents.downloadAssetsReordered>;\nexport type BundleCreated = EventOf<typeof contentEvents.bundleCreated>;\nexport type BundleUpdated = EventOf<typeof contentEvents.bundleUpdated>;\nexport type BundleDeleted = EventOf<typeof contentEvents.bundleDeleted>;\nexport type BundleItemAdded = EventOf<typeof contentEvents.bundleItemAdded>;\nexport type BundleItemRemoved = EventOf<typeof contentEvents.bundleItemRemoved>;\nexport type CommunityCreated = EventOf<typeof contentEvents.communityCreated>;\nexport type CommunityUpdated = EventOf<typeof contentEvents.communityUpdated>;\nexport type CommunityDeleted = EventOf<typeof contentEvents.communityDeleted>;\nexport type CommunitySpaceCreated = EventOf<typeof contentEvents.spaceCreated>;\nexport type CommunitySpaceUpdated = EventOf<typeof contentEvents.spaceUpdated>;\nexport type CommunitySpaceDeleted = EventOf<typeof contentEvents.spaceDeleted>;\nexport type CommunitySpacesReordered = EventOf<typeof contentEvents.spacesReordered>;\nexport type ContentEvent = EventOfValues<typeof contentEvents>;\n"],"mappings":"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"}
@@ -1,8 +1,8 @@
1
1
  import { Page } from "../types/shared.js";
2
- import { Activity, AddDownloadAssetInput, Course, CourseSettings, CourseStatus, CreateCourseInput, CreateDownloadInput, Download, DownloadAsset, DownloadStatus, ListCoursesQuery, ListDownloadsQuery, Module, ReorderDownloadAssetsInput, SaveActivityInput, UpdateCourseInput, UpdateDownloadInput } from "../types/schemas/content.js";
3
- import { ContentEvent, CourseActivitiesReordered, CourseActivityCreated, CourseActivityDeleted, CourseActivityUpdated, CourseCreated, CourseDeleted, CourseModuleCreated, CourseModuleDeleted, CourseModuleUpdated, CourseModulesReordered, CourseUpdated, DownloadCreated, DownloadDeleted, DownloadUpdated, contentEvents } from "./events.js";
2
+ import { Activity, ActivityAsset, ActivityView, AddDownloadAssetInput, Bundle, BundleItem, Community, CommunityStatus, CommunityView, Course, CourseSettings, CourseStatus, CourseView, CreateBundleInput, CreateCommunityInput, CreateCourseInput, CreateDownloadInput, CreateSpaceInput, DmSettings, Download, DownloadAsset, DownloadFile, DownloadStatus, DownloadView, ListBundlesQuery, ListCommunitiesQuery, ListCoursesQuery, ListDownloadsQuery, Module, PatchDmSettingsInput, ReorderDownloadAssetsInput, SaveActivityInput, SetSpaceTopicsInput, Space, SpaceAccessRule, SpaceDetail, SpaceLink, SpaceTopic, UpdateBundleInput, UpdateCommunityInput, UpdateCourseInput, UpdateDownloadInput, UpdateSpaceInput } from "../types/schemas/content.js";
4
3
  import "./model.js";
5
4
  import "./types.js";
6
- import { ContentRepository, ContentService } from "./ports.js";
7
- import { ContentServiceImpl } from "./service.js";
8
- export { type Activity, type AddDownloadAssetInput, type ContentEvent, type ContentRepository, type ContentService, ContentServiceImpl, type Course, type CourseActivitiesReordered, type CourseActivityCreated, type CourseActivityDeleted, type CourseActivityUpdated, type CourseCreated, type CourseDeleted, type CourseModuleCreated, type CourseModuleDeleted, type CourseModuleUpdated, type CourseModulesReordered, type CourseSettings, type CourseStatus, type CourseUpdated, type CreateCourseInput, type CreateDownloadInput, type Download, type DownloadAsset, type DownloadCreated, type DownloadDeleted, type DownloadStatus, type DownloadUpdated, type ListCoursesQuery, type ListDownloadsQuery, type Module, type Page, type ReorderDownloadAssetsInput, type SaveActivityInput, type UpdateCourseInput, type UpdateDownloadInput, contentEvents };
5
+ import { BundlesService, CommunitiesService, CommunityReader, ContentRepository, ContentService as ContentService$1, CourseManagementService, DownloadablesService, SpaceRowLock } from "./ports.js";
6
+ import { ContentService } from "./service.js";
7
+ import { BundleCreated, BundleDeleted, BundleItemAdded, BundleItemRemoved, BundleUpdated, CommunityCreated, CommunityDeleted, CommunitySpaceCreated, CommunitySpaceDeleted, CommunitySpaceUpdated, CommunitySpacesReordered, CommunityUpdated, ContentEvent, CourseActivitiesReordered, CourseActivityCreated, CourseActivityDeleted, CourseActivityUpdated, CourseCreated, CourseDeleted, CourseModuleCreated, CourseModuleDeleted, CourseModuleUpdated, CourseModulesReordered, CourseUpdated, DownloadCreated, DownloadDeleted, DownloadUpdated, contentEvents } from "./events.js";
8
+ export { type Activity, type ActivityAsset, type ActivityView, type AddDownloadAssetInput, type Bundle, type BundleCreated, type BundleDeleted, type BundleItem, type BundleItemAdded, type BundleItemRemoved, type BundleUpdated, type BundlesService, type CommunitiesService, type Community, type CommunityCreated, type CommunityDeleted, type CommunityReader, type CommunitySpaceCreated, type CommunitySpaceDeleted, type CommunitySpaceUpdated, type CommunitySpacesReordered, type CommunityStatus, type CommunityUpdated, type CommunityView, type ContentEvent, type ContentRepository, ContentService, type ContentService$1 as ContentServicePort, type Course, type CourseActivitiesReordered, type CourseActivityCreated, type CourseActivityDeleted, type CourseActivityUpdated, type CourseCreated, type CourseDeleted, type CourseManagementService, type CourseModuleCreated, type CourseModuleDeleted, type CourseModuleUpdated, type CourseModulesReordered, type CourseSettings, type CourseStatus, type CourseUpdated, type CourseView, type CreateBundleInput, type CreateCommunityInput, type CreateCourseInput, type CreateDownloadInput, type CreateSpaceInput, type DmSettings, type Download, type DownloadAsset, type DownloadCreated, type DownloadDeleted, type DownloadFile, type DownloadStatus, type DownloadUpdated, type DownloadView, type DownloadablesService, type ListBundlesQuery, type ListCommunitiesQuery, type ListCoursesQuery, type ListDownloadsQuery, type Module, type Page, type PatchDmSettingsInput, type ReorderDownloadAssetsInput, type SaveActivityInput, type SetSpaceTopicsInput, type Space, type SpaceAccessRule, type SpaceDetail, type SpaceLink, type SpaceRowLock, type SpaceTopic, type UpdateBundleInput, type UpdateCommunityInput, type UpdateCourseInput, type UpdateDownloadInput, type UpdateSpaceInput, contentEvents };
@@ -1,3 +1,3 @@
1
1
  import { contentEvents } from "./events.js";
2
- import { ContentServiceImpl } from "./service.js";
3
- export { ContentServiceImpl, contentEvents };
2
+ import { ContentService } from "./service.js";
3
+ export { ContentService, contentEvents };
@@ -1,3 +1,3 @@
1
- import { Activity, ActivityAsset, ActivitySettings, ContentItem, ContentType, Course, CourseSettings, CourseStatus, Download, DownloadAsset, DownloadStatus, Module, SaveActivityInput } from "../types/schemas/content.js";
1
+ import { Activity, ActivityAsset, ActivitySettings, ActivityView, Bundle, BundleItem, Community, CommunitySettings, CommunityStatus, CommunityView, ContentItem, ContentType, Course, CourseSettings, CourseStatus, CourseView, DmSettings, Download, DownloadAsset, DownloadFile, DownloadStatus, DownloadView, Module, SaveActivityInput, Space, SpaceAccessRule, SpaceDetail, SpaceLink, SpaceSettings, SpaceTopic } from "../types/schemas/content.js";
2
2
  import "../types/index.js";
3
- export type { Activity, ActivityAsset, ActivitySettings, ContentItem, ContentType, Course, CourseSettings, CourseStatus, Download, DownloadAsset, DownloadStatus, Module, SaveActivityInput };
3
+ export type { Activity, ActivityAsset, ActivitySettings, ActivityView, Bundle, BundleItem, Community, CommunitySettings, CommunityStatus, CommunityView, ContentItem, ContentType, Course, CourseSettings, CourseStatus, CourseView, DmSettings, Download, DownloadAsset, DownloadFile, DownloadStatus, DownloadView, Module, SaveActivityInput, Space, SpaceAccessRule, SpaceDetail, SpaceLink, SpaceSettings, SpaceTopic };
@@ -1,21 +1,54 @@
1
1
  import { Page } from "../types/shared.js";
2
- import { Activity, AddDownloadAssetInput, Course, CourseSettings, CreateCourseInput, CreateDownloadInput, Download, DownloadAsset, ListCoursesQuery, ListDownloadsQuery, Module, SaveActivityInput, UpdateCourseInput, UpdateDownloadInput } from "../types/schemas/content.js";
2
+ import { Activity, ActivityAsset, ActivityView, AddDownloadAssetInput, Bundle, BundleItem, Community, CommunityView, Course, CourseSettings, CourseView, CreateBundleInput, CreateCommunityInput, CreateCourseInput, CreateDownloadInput, CreateSpaceInput, DmSettings, Download, DownloadAsset, DownloadFile, DownloadView, ListBundlesQuery, ListCommunitiesQuery, ListCoursesQuery, ListDownloadsQuery, Module, PatchDmSettingsInput, SaveActivityInput, SetSpaceTopicsInput, Space, SpaceDetail, UpdateBundleInput, UpdateCommunityInput, UpdateCourseInput, UpdateDownloadInput, UpdateSpaceInput } from "../types/schemas/content.js";
3
3
  import { OutboxAppender, UnitOfWork } from "../shared/ports.js";
4
4
  import "./model.js";
5
5
  import "./types.js";
6
+ import { Actor } from "../shared/actor.js";
6
7
  //#region src/content/ports.d.ts
7
- interface ContentService {
8
- list(orgId: string, query: ListCoursesQuery): Promise<Page<Course>>;
9
- getCourse(orgId: string, id: string): Promise<Course | null>;
10
- createCourse(orgId: string, input: CreateCourseInput): Promise<Course>;
8
+ interface ContentService extends DownloadablesService, CourseManagementService, CommunitiesService {}
9
+ interface CommunityReader {
10
+ getSpace(orgId: string, spaceId: string): Promise<SpaceDetail | null>;
11
+ listSpaces(orgId: string, communityId: string): Promise<SpaceDetail[]>;
12
+ getDmSettings(orgId: string, communityId: string): Promise<DmSettings | null>;
13
+ }
14
+ interface SpaceRowLock {
15
+ lockSpace(orgId: string, spaceId: string): Promise<Space | null>;
16
+ }
17
+ interface CommunitiesService extends CommunityReader {
18
+ listCommunities(orgId: string, query: ListCommunitiesQuery): Promise<Page<CommunityView>>;
19
+ getCommunity(orgId: string, id: string): Promise<CommunityView | null>;
20
+ listPublishedCommunityIds(orgId: string): Promise<string[]>;
21
+ listCommunitiesById(orgId: string, ids: string[]): Promise<Community[]>;
22
+ getCommunitySpace(orgId: string, communityId: string, spaceId: string): Promise<SpaceDetail | null>;
23
+ createCommunity(orgId: string, input: CreateCommunityInput, actor: Actor): Promise<CommunityView>;
24
+ updateCommunity(orgId: string, id: string, patch: UpdateCommunityInput, actor: Actor): Promise<CommunityView>;
25
+ publishCommunity(orgId: string, id: string, actor: Actor): Promise<CommunityView>;
26
+ unpublishCommunity(orgId: string, id: string, actor: Actor): Promise<CommunityView>;
27
+ deleteCommunity(orgId: string, id: string, actor: Actor): Promise<void>;
28
+ patchDmSettings(orgId: string, id: string, patch: PatchDmSettingsInput, actor: Actor): Promise<CommunityView>;
29
+ createSpace(orgId: string, communityId: string, input: CreateSpaceInput, actor: Actor): Promise<SpaceDetail>;
30
+ updateSpace(orgId: string, communityId: string, spaceId: string, patch: UpdateSpaceInput, actor: Actor): Promise<SpaceDetail>;
31
+ deleteSpace(orgId: string, communityId: string, spaceId: string, actor: Actor): Promise<void>;
32
+ reorderSpaces(orgId: string, communityId: string, orderedIds: string[], actor: Actor): Promise<SpaceDetail[]>;
33
+ setSpaceTopics(orgId: string, communityId: string, spaceId: string, input: SetSpaceTopicsInput, actor: Actor): Promise<SpaceDetail>;
34
+ addSpaceLink(orgId: string, communityId: string, spaceId: string, contentId: string, actor: Actor): Promise<SpaceDetail>;
35
+ removeSpaceLink(orgId: string, communityId: string, spaceId: string, linkId: string, actor: Actor): Promise<SpaceDetail>;
36
+ reorderSpaceLinks(orgId: string, communityId: string, spaceId: string, orderedIds: string[], actor: Actor): Promise<SpaceDetail>;
37
+ }
38
+ interface CourseManagementService {
39
+ listCourses(orgId: string, query: ListCoursesQuery): Promise<Page<CourseView>>;
40
+ getCourse(orgId: string, id: string): Promise<CourseView | null>;
41
+ createCourse(orgId: string, input: CreateCourseInput): Promise<CourseView>;
11
42
  /** @throws NotFoundError when no course with this id exists in the org. */
12
- updateCourse(orgId: string, id: string, patch: UpdateCourseInput): Promise<Course>;
43
+ updateCourse(orgId: string, id: string, patch: UpdateCourseInput): Promise<CourseView>;
13
44
  /** @throws NotFoundError when no course with this id exists in the org. */
14
- patchSettings(orgId: string, id: string, value: Partial<CourseSettings>): Promise<CourseSettings>;
45
+ patchCourseSettings(orgId: string, id: string, value: Partial<CourseSettings>): Promise<CourseSettings>;
15
46
  /** @throws NotFoundError when no course with this id exists in the org. */
16
- deleteCourse(orgId: string, id: string): Promise<void>;
47
+ deleteCourse(orgId: string, id: string, actor: Actor): Promise<void>;
17
48
  listCourseModules(orgId: string, courseId: string): Promise<Module[]>;
18
49
  listCourseActivities(orgId: string, courseId: string): Promise<Activity[]>;
50
+ listCourseActivityViews(orgId: string, courseId: string): Promise<ActivityView[]>;
51
+ listCourseActivityAssets(orgId: string, courseId: string): Promise<ActivityAsset[]>;
19
52
  getActivity(orgId: string, activityId: string): Promise<Activity | null>;
20
53
  getModule(orgId: string, moduleId: string): Promise<Module | null>;
21
54
  reorderModules(orgId: string, courseId: string, orderedIds: string[]): Promise<Module[]>;
@@ -30,28 +63,48 @@ interface ContentService {
30
63
  saveActivity(orgId: string, courseId: string, moduleId: string, input: SaveActivityInput, activityId?: string): Promise<Module[]>;
31
64
  /** @throws NotFoundError when no such activity exists in this module. */
32
65
  deleteActivity(orgId: string, courseId: string, moduleId: string, activityId: string): Promise<Module[]>;
33
- listDownloads(orgId: string, query: ListDownloadsQuery): Promise<Page<Download>>;
34
- getDownload(orgId: string, id: string): Promise<Download | null>;
35
- createDownload(orgId: string, input: CreateDownloadInput): Promise<Download>;
66
+ }
67
+ interface DownloadablesService {
68
+ listDownloads(orgId: string, query: ListDownloadsQuery): Promise<Page<DownloadView>>;
69
+ getDownload(orgId: string, id: string): Promise<DownloadView | null>;
70
+ createDownload(orgId: string, input: CreateDownloadInput): Promise<DownloadView>;
36
71
  /** @throws NotFoundError when no download with this id exists in the org. */
37
- updateDownload(orgId: string, id: string, patch: UpdateDownloadInput): Promise<Download>;
72
+ updateDownload(orgId: string, id: string, patch: UpdateDownloadInput): Promise<DownloadView>;
38
73
  /** @throws NotFoundError when no download with this id exists in the org. */
39
- removeDownload(orgId: string, id: string): Promise<void>;
40
- listDownloadAssets(orgId: string, downloadId: string): Promise<DownloadAsset[]>;
41
- addDownloadAsset(orgId: string, downloadId: string, input: AddDownloadAssetInput): Promise<DownloadAsset[]>;
42
- removeDownloadAsset(orgId: string, downloadId: string, assetId: string): Promise<DownloadAsset[]>;
43
- renameDownloadAsset(orgId: string, downloadId: string, assetId: string, displayName: string | null): Promise<DownloadAsset[]>;
74
+ removeDownload(orgId: string, id: string, actor: Actor): Promise<void>;
75
+ listDownloadAssets(orgId: string, downloadId: string): Promise<DownloadFile[]>;
76
+ addDownloadAsset(orgId: string, downloadId: string, input: AddDownloadAssetInput): Promise<DownloadFile[]>;
77
+ removeDownloadAsset(orgId: string, downloadId: string, assetId: string): Promise<DownloadFile[]>;
78
+ renameDownloadAsset(orgId: string, downloadId: string, assetId: string, displayName: string | null): Promise<DownloadFile[]>;
44
79
  /** @throws ConflictError when assetIds is not exactly the download's current asset set. */
45
- reorderDownloadAssets(orgId: string, downloadId: string, assetIds: string[]): Promise<DownloadAsset[]>;
80
+ reorderDownloadAssets(orgId: string, downloadId: string, assetIds: string[]): Promise<DownloadFile[]>;
81
+ }
82
+ interface BundlesService {
83
+ listBundles(orgId: string, query: ListBundlesQuery): Promise<Page<Bundle>>;
84
+ getBundle(orgId: string, id: string): Promise<Bundle | null>;
85
+ /** Bundle and its initial items are created together, or not at all.
86
+ * @throws NotFoundError when an initial content id does not exist in the org. */
87
+ createBundle(orgId: string, input: CreateBundleInput): Promise<Bundle>;
88
+ /** @throws NotFoundError when no bundle with this id exists in the org. */
89
+ updateBundle(orgId: string, id: string, patch: UpdateBundleInput): Promise<Bundle>;
90
+ /** @throws NotFoundError when no bundle with this id exists in the org. */
91
+ deleteBundle(orgId: string, id: string): Promise<void>;
92
+ listBundleItems(orgId: string, bundleId: string): Promise<BundleItem[]>;
93
+ /** @throws NotFoundError when the bundle — or the content — does not exist in the org. */
94
+ addBundleItem(orgId: string, bundleId: string, contentId: string): Promise<BundleItem[]>;
95
+ /** @throws NotFoundError when no bundle with this id exists in the org. */
96
+ removeBundleItem(orgId: string, bundleId: string, contentId: string): Promise<BundleItem[]>;
46
97
  }
47
98
  interface ContentRepository {
48
- list(orgId: string, query: ListCoursesQuery): Promise<Page<Course>>;
49
- findById(orgId: string, id: string): Promise<Course | null>;
50
- create(orgId: string, input: CreateCourseInput, slug: string): Promise<Course>;
51
- update(orgId: string, id: string, patch: UpdateCourseInput): Promise<Course | null>;
52
- delete(orgId: string, id: string): Promise<boolean>;
53
- listForCourse(orgId: string, courseId: string): Promise<Module[]>;
99
+ listCourses(orgId: string, query: ListCoursesQuery): Promise<Page<Course>>;
100
+ findCourseById(orgId: string, id: string): Promise<Course | null>;
101
+ createCourse(orgId: string, input: CreateCourseInput, slug: string): Promise<Course>;
102
+ updateCourse(orgId: string, id: string, patch: UpdateCourseInput): Promise<Course | null>;
103
+ patchCourseSettings(orgId: string, id: string, value: Partial<CourseSettings>): Promise<CourseSettings>;
104
+ deleteCourse(orgId: string, id: string): Promise<boolean>;
105
+ listCourseModules(orgId: string, courseId: string): Promise<Module[]>;
54
106
  listActivitiesForCourse(orgId: string, courseId: string): Promise<Activity[]>;
107
+ listActivityAssetsForCourse(orgId: string, courseId: string): Promise<ActivityAsset[]>;
55
108
  findActivity(orgId: string, activityId: string): Promise<Activity | null>;
56
109
  findModule(orgId: string, moduleId: string): Promise<Module | null>;
57
110
  reorderModules(orgId: string, courseId: string, orderedIds: string[]): Promise<Module[]>;
@@ -74,6 +127,37 @@ interface ContentRepository {
74
127
  removeDownloadAsset(orgId: string, downloadId: string, assetId: string): Promise<DownloadAsset[]>;
75
128
  renameDownloadAsset(orgId: string, downloadId: string, assetId: string, displayName: string | null): Promise<DownloadAsset[]>;
76
129
  reorderDownloadAssets(orgId: string, downloadId: string, assetIds: string[]): Promise<DownloadAsset[]>;
130
+ listBundles(orgId: string, query: ListBundlesQuery): Promise<Page<Bundle>>;
131
+ findBundleById(orgId: string, id: string): Promise<Bundle | null>;
132
+ createBundle(orgId: string, input: CreateBundleInput): Promise<Bundle>;
133
+ updateBundle(orgId: string, id: string, patch: UpdateBundleInput): Promise<Bundle | null>;
134
+ deleteBundle(orgId: string, id: string): Promise<boolean>;
135
+ listBundleItems(orgId: string, bundleId: string): Promise<BundleItem[]>;
136
+ /** Content already in the bundle is left as it is — adding twice is a no-op. */
137
+ addBundleItem(orgId: string, bundleId: string, contentId: string): Promise<BundleItem[]>;
138
+ removeBundleItem(orgId: string, bundleId: string, contentId: string): Promise<BundleItem[]>;
139
+ listCommunities(orgId: string, query: ListCommunitiesQuery): Promise<Page<Community>>;
140
+ findCommunityById(orgId: string, id: string): Promise<Community | null>;
141
+ findCommunitiesByIds(orgId: string, ids: string[]): Promise<Community[]>;
142
+ listPublishedCommunityIds(orgId: string): Promise<string[]>;
143
+ createCommunity(orgId: string, input: CreateCommunityInput, slug: string): Promise<Community>;
144
+ updateCommunity(orgId: string, id: string, patch: UpdateCommunityInput): Promise<Community | null>;
145
+ patchDmSettings(orgId: string, id: string, patch: PatchDmSettingsInput): Promise<Community | null>;
146
+ deleteCommunity(orgId: string, id: string): Promise<boolean>;
147
+ deleteCommunitySettings(orgId: string, id: string): Promise<void>;
148
+ listSpaces(orgId: string, communityId: string): Promise<SpaceDetail[]>;
149
+ findSpace(orgId: string, spaceId: string): Promise<SpaceDetail | null>;
150
+ lockSpace(orgId: string, spaceId: string): Promise<Space | null>;
151
+ createSpace(orgId: string, communityId: string, input: CreateSpaceInput): Promise<SpaceDetail>;
152
+ updateSpace(orgId: string, communityId: string, spaceId: string, patch: UpdateSpaceInput): Promise<SpaceDetail | null>;
153
+ deleteSpace(orgId: string, communityId: string, spaceId: string): Promise<boolean>;
154
+ reorderSpaces(orgId: string, communityId: string, orderedIds: string[]): Promise<SpaceDetail[]>;
155
+ setSpaceTopics(orgId: string, spaceId: string, input: SetSpaceTopicsInput): Promise<SpaceDetail>;
156
+ topicsInUse(orgId: string, spaceId: string, topicIds: string[]): Promise<string[]>;
157
+ addSpaceLink(orgId: string, spaceId: string, contentId: string): Promise<SpaceDetail>;
158
+ removeSpaceLink(orgId: string, spaceId: string, linkId: string): Promise<SpaceDetail>;
159
+ reorderSpaceLinks(orgId: string, spaceId: string, orderedIds: string[]): Promise<SpaceDetail>;
160
+ spacesLinkingContent(orgId: string, contentId: string): Promise<string[]>;
77
161
  }
78
162
  interface ContentTxScope {
79
163
  content: ContentRepository;
@@ -81,5 +165,5 @@ interface ContentTxScope {
81
165
  }
82
166
  type ContentUnitOfWork = UnitOfWork<ContentTxScope>;
83
167
  //#endregion
84
- export { ContentRepository, ContentService, ContentTxScope, ContentUnitOfWork };
168
+ export { BundlesService, CommunitiesService, CommunityReader, ContentRepository, ContentService, ContentTxScope, ContentUnitOfWork, CourseManagementService, DownloadablesService, SpaceRowLock };
85
169
  //# sourceMappingURL=ports.d.ts.map