@headless-lms/core 0.1.0 → 0.2.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.
- package/dist/assets/events.d.ts +66 -3
- package/dist/assets/events.js +19 -3
- package/dist/assets/events.js.map +1 -1
- package/dist/assets/service.js +5 -3
- package/dist/assets/service.js.map +1 -1
- package/dist/automations/actions.d.ts +11 -3
- package/dist/automations/actions.js +38 -5
- package/dist/automations/actions.js.map +1 -1
- package/dist/automations/catalog.d.ts +4 -1
- package/dist/automations/catalog.js +289 -188
- package/dist/automations/catalog.js.map +1 -1
- package/dist/automations/events.d.ts +46 -24
- package/dist/automations/events.js +5 -5
- package/dist/automations/events.js.map +1 -1
- package/dist/automations/index.d.ts +5 -5
- package/dist/automations/index.js +2 -2
- package/dist/automations/model.d.ts +13 -3
- package/dist/automations/model.js +23 -3
- package/dist/automations/model.js.map +1 -1
- package/dist/automations/ports.d.ts +23 -8
- package/dist/automations/service.d.ts +21 -5
- package/dist/automations/service.js +267 -47
- package/dist/automations/service.js.map +1 -1
- package/dist/automations/types.d.ts +2 -2
- package/dist/automations/webhook-signing.d.ts +7 -0
- package/dist/automations/webhook-signing.js +22 -0
- package/dist/automations/webhook-signing.js.map +1 -0
- package/dist/content/events.d.ts +401 -25
- package/dist/content/events.js +125 -19
- package/dist/content/events.js.map +1 -1
- package/dist/content/index.d.ts +5 -5
- package/dist/content/index.js +2 -2
- package/dist/content/model.d.ts +2 -2
- package/dist/content/ports.d.ts +42 -11
- package/dist/content/service.d.ts +15 -9
- package/dist/content/service.js +153 -45
- package/dist/content/service.js.map +1 -1
- package/dist/content/types.d.ts +2 -2
- package/dist/discussion/events.d.ts +60 -4
- package/dist/discussion/events.js +30 -4
- package/dist/discussion/events.js.map +1 -1
- package/dist/discussion/model.d.ts +1 -2
- package/dist/discussion/ports.d.ts +1 -1
- package/dist/discussion/service.d.ts +1 -1
- package/dist/discussion/service.js +11 -10
- package/dist/discussion/service.js.map +1 -1
- package/dist/entitlements/events.d.ts +96 -12
- package/dist/entitlements/events.js +21 -4
- package/dist/entitlements/events.js.map +1 -1
- package/dist/entitlements/service.js +1 -0
- package/dist/entitlements/service.js.map +1 -1
- package/dist/identity/events.d.ts +17 -3
- package/dist/identity/events.js +12 -2
- package/dist/identity/events.js.map +1 -1
- package/dist/identity/ports.d.ts +3 -0
- package/dist/identity/service.d.ts +3 -0
- package/dist/identity/service.js +12 -1
- package/dist/identity/service.js.map +1 -1
- package/dist/integrations/events.d.ts +27 -3
- package/dist/integrations/events.js +15 -3
- package/dist/integrations/events.js.map +1 -1
- package/dist/integrations/service.js +1 -1
- package/dist/integrations/service.js.map +1 -1
- package/dist/organizations/events.d.ts +178 -11
- package/dist/organizations/events.js +52 -9
- package/dist/organizations/events.js.map +1 -1
- package/dist/organizations/index.d.ts +3 -3
- package/dist/organizations/members.js.map +1 -1
- package/dist/organizations/ports.d.ts +6 -10
- package/dist/organizations/roles.js.map +1 -1
- package/dist/organizations/service.d.ts +9 -4
- package/dist/organizations/service.js +131 -72
- package/dist/organizations/service.js.map +1 -1
- package/dist/organizations/types.d.ts +2 -2
- package/dist/progress/events.d.ts +34 -2
- package/dist/progress/events.js +15 -2
- package/dist/progress/events.js.map +1 -1
- package/dist/progress/service.d.ts +2 -2
- package/dist/progress/service.js +4 -2
- package/dist/progress/service.js.map +1 -1
- package/dist/reporting/courses/index.d.ts +4 -0
- package/dist/reporting/courses/index.js +2 -0
- package/dist/reporting/courses/model.d.ts +24 -0
- package/dist/reporting/courses/model.js +1 -0
- package/dist/reporting/courses/ports.d.ts +13 -0
- package/dist/reporting/courses/ports.js +1 -0
- package/dist/reporting/courses/service.d.ts +19 -0
- package/dist/reporting/courses/service.js +20 -0
- package/dist/reporting/courses/service.js.map +1 -0
- package/dist/reporting/learn/model.d.ts +2 -2
- package/dist/reporting/learn/ports.d.ts +2 -1
- package/dist/reporting/learn/service.d.ts +2 -1
- package/dist/reporting/learn/service.js +5 -0
- package/dist/reporting/learn/service.js.map +1 -1
- package/dist/reporting/students/index.d.ts +2 -2
- package/dist/reporting/students/model.d.ts +21 -1
- package/dist/reporting/students/ports.d.ts +3 -1
- package/dist/reporting/students/service.d.ts +2 -1
- package/dist/reporting/students/service.js +3 -0
- package/dist/reporting/students/service.js.map +1 -1
- package/dist/shared/events.d.ts +5 -3
- package/dist/shared/events.js +1 -0
- package/dist/shared/events.js.map +1 -1
- package/dist/shared/id.d.ts +1 -0
- package/dist/shared/id.js +1 -0
- package/dist/shared/id.js.map +1 -1
- package/dist/shared/mailer.d.ts +2 -0
- package/dist/shared/mailer.js.map +1 -1
- package/dist/shared/settings.js.map +1 -1
- package/dist/types/automations.d.ts +13 -2
- package/dist/types/content.d.ts +2 -2
- package/dist/types/discussion.d.ts +3 -2
- package/dist/types/email-templates.d.ts +3 -1
- package/dist/types/events.d.ts +3 -3
- package/dist/types/index.d.ts +6 -6
- package/dist/types/organizations.d.ts +2 -2
- package/dist/types/ports.d.ts +1 -1
- package/dist/types/schemas/assets.d.ts +3 -0
- package/dist/types/schemas/assets.js +2 -1
- package/dist/types/schemas/assets.js.map +1 -1
- package/dist/types/schemas/automations.d.ts +71 -4
- package/dist/types/schemas/automations.js +35 -4
- package/dist/types/schemas/automations.js.map +1 -1
- package/dist/types/schemas/content.d.ts +51 -18
- package/dist/types/schemas/content.js +40 -13
- package/dist/types/schemas/content.js.map +1 -1
- package/dist/types/schemas/credentials.js.map +1 -1
- package/dist/types/schemas/discussion.d.ts +10 -2
- package/dist/types/schemas/discussion.js +12 -5
- package/dist/types/schemas/discussion.js.map +1 -1
- package/dist/types/schemas/entitlements.d.ts +8 -2
- package/dist/types/schemas/entitlements.js +10 -4
- package/dist/types/schemas/entitlements.js.map +1 -1
- package/dist/types/schemas/identity.d.ts +4 -4
- package/dist/types/schemas/identity.js +5 -5
- package/dist/types/schemas/identity.js.map +1 -1
- package/dist/types/schemas/index.d.ts +6 -6
- package/dist/types/schemas/index.js +6 -6
- package/dist/types/schemas/integrations.js.map +1 -1
- package/dist/types/schemas/organizations.d.ts +19 -5
- package/dist/types/schemas/organizations.js +12 -7
- package/dist/types/schemas/organizations.js.map +1 -1
- package/dist/types/schemas/outbox.d.ts +1 -0
- package/dist/types/schemas/outbox.js +1 -0
- package/dist/types/schemas/outbox.js.map +1 -1
- package/dist/types/schemas/progress.d.ts +1 -0
- package/dist/types/schemas/progress.js +1 -0
- package/dist/types/schemas/progress.js.map +1 -1
- package/dist/types/schemas/settings.js.map +1 -1
- package/dist/types/schemas/shared.d.ts +2 -1
- package/dist/types/schemas/shared.js +3 -1
- package/dist/types/schemas/shared.js.map +1 -1
- package/dist/types/shared.d.ts +1 -1
- package/package.json +1 -1
package/dist/content/events.js
CHANGED
|
@@ -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, courseSchema, downloadAssetSchema, downloadSchema, moduleSchema } 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,202 @@ 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 publicDownloadAssets = z.object({
|
|
70
|
+
downloadId: idSchema,
|
|
71
|
+
assets: z.array(publicDownloadAsset)
|
|
72
|
+
});
|
|
10
73
|
const contentEvents = {
|
|
11
74
|
courseCreated: defineEvent({
|
|
12
75
|
type: "content.course.created",
|
|
13
76
|
version: 1,
|
|
14
|
-
data: courseSchema
|
|
77
|
+
data: courseSchema,
|
|
78
|
+
publicData: publicCourse
|
|
15
79
|
}),
|
|
16
80
|
courseUpdated: defineEvent({
|
|
17
81
|
type: "content.course.updated",
|
|
18
82
|
version: 1,
|
|
19
|
-
data: courseSchema
|
|
83
|
+
data: courseSchema,
|
|
84
|
+
publicData: publicCourse
|
|
20
85
|
}),
|
|
21
86
|
courseDeleted: defineEvent({
|
|
22
87
|
type: "content.course.deleted",
|
|
23
88
|
version: 1,
|
|
24
|
-
data: courseSchema
|
|
89
|
+
data: courseSchema,
|
|
90
|
+
publicData: publicCourse
|
|
25
91
|
}),
|
|
26
92
|
moduleCreated: defineEvent({
|
|
27
93
|
type: "content.course.module.created",
|
|
28
94
|
version: 1,
|
|
29
|
-
data: moduleSchema
|
|
95
|
+
data: moduleSchema,
|
|
96
|
+
publicData: publicModule
|
|
30
97
|
}),
|
|
31
98
|
moduleUpdated: defineEvent({
|
|
32
99
|
type: "content.course.module.updated",
|
|
33
100
|
version: 1,
|
|
34
|
-
data: moduleSchema
|
|
101
|
+
data: moduleSchema,
|
|
102
|
+
publicData: publicModule
|
|
35
103
|
}),
|
|
36
104
|
moduleDeleted: defineEvent({
|
|
37
105
|
type: "content.course.module.deleted",
|
|
38
106
|
version: 1,
|
|
39
|
-
data: moduleSchema
|
|
107
|
+
data: moduleSchema,
|
|
108
|
+
publicData: publicModule
|
|
40
109
|
}),
|
|
41
110
|
modulesReordered: defineEvent({
|
|
42
111
|
type: "content.course.modules.reordered",
|
|
43
112
|
version: 1,
|
|
44
|
-
data: z.array(moduleSchema)
|
|
113
|
+
data: z.array(moduleSchema),
|
|
114
|
+
publicData: z.array(publicModule)
|
|
45
115
|
}),
|
|
46
116
|
activityCreated: defineEvent({
|
|
47
117
|
type: "content.course.activity.created",
|
|
48
118
|
version: 1,
|
|
49
|
-
data: activitySchema
|
|
119
|
+
data: activitySchema,
|
|
120
|
+
publicData: publicActivity
|
|
50
121
|
}),
|
|
51
122
|
activityUpdated: defineEvent({
|
|
52
123
|
type: "content.course.activity.updated",
|
|
53
124
|
version: 1,
|
|
54
|
-
data: activitySchema
|
|
125
|
+
data: activitySchema,
|
|
126
|
+
publicData: publicActivity
|
|
55
127
|
}),
|
|
56
128
|
activityDeleted: defineEvent({
|
|
57
129
|
type: "content.course.activity.deleted",
|
|
58
130
|
version: 1,
|
|
59
|
-
data: activitySchema
|
|
131
|
+
data: activitySchema,
|
|
132
|
+
publicData: publicActivity
|
|
60
133
|
}),
|
|
61
134
|
activitiesReordered: defineEvent({
|
|
62
135
|
type: "content.course.activities.reordered",
|
|
63
136
|
version: 1,
|
|
64
|
-
data: moduleSchema
|
|
137
|
+
data: moduleSchema,
|
|
138
|
+
publicData: publicModule
|
|
65
139
|
}),
|
|
66
140
|
downloadCreated: defineEvent({
|
|
67
141
|
type: "content.download.created",
|
|
68
142
|
version: 1,
|
|
69
|
-
data: downloadSchema
|
|
143
|
+
data: downloadSchema,
|
|
144
|
+
publicData: publicDownload
|
|
70
145
|
}),
|
|
71
146
|
downloadUpdated: defineEvent({
|
|
72
147
|
type: "content.download.updated",
|
|
73
148
|
version: 1,
|
|
74
|
-
data: downloadSchema
|
|
149
|
+
data: downloadSchema,
|
|
150
|
+
publicData: publicDownload
|
|
75
151
|
}),
|
|
76
152
|
downloadDeleted: defineEvent({
|
|
77
153
|
type: "content.download.deleted",
|
|
78
154
|
version: 1,
|
|
79
|
-
data: downloadSchema
|
|
155
|
+
data: downloadSchema,
|
|
156
|
+
publicData: publicDownload
|
|
80
157
|
}),
|
|
81
158
|
downloadAssetAdded: defineEvent({
|
|
82
159
|
type: "content.download.asset.added",
|
|
83
160
|
version: 1,
|
|
84
|
-
data: downloadAssetsEventSchema
|
|
161
|
+
data: downloadAssetsEventSchema,
|
|
162
|
+
publicData: publicDownloadAssets
|
|
85
163
|
}),
|
|
86
164
|
downloadAssetRemoved: defineEvent({
|
|
87
165
|
type: "content.download.asset.removed",
|
|
88
166
|
version: 1,
|
|
89
|
-
data: downloadAssetsEventSchema
|
|
167
|
+
data: downloadAssetsEventSchema,
|
|
168
|
+
publicData: publicDownloadAssets
|
|
90
169
|
}),
|
|
91
170
|
downloadAssetRenamed: defineEvent({
|
|
92
171
|
type: "content.download.asset.renamed",
|
|
93
172
|
version: 1,
|
|
94
|
-
data: downloadAssetsEventSchema
|
|
173
|
+
data: downloadAssetsEventSchema,
|
|
174
|
+
publicData: publicDownloadAssets
|
|
95
175
|
}),
|
|
96
176
|
downloadAssetsReordered: defineEvent({
|
|
97
177
|
type: "content.download.assets.reordered",
|
|
98
178
|
version: 1,
|
|
99
|
-
data: downloadAssetsEventSchema
|
|
179
|
+
data: downloadAssetsEventSchema,
|
|
180
|
+
publicData: publicDownloadAssets
|
|
181
|
+
}),
|
|
182
|
+
bundleCreated: defineEvent({
|
|
183
|
+
type: "content.bundle.created",
|
|
184
|
+
version: 1,
|
|
185
|
+
data: bundleSchema
|
|
186
|
+
}),
|
|
187
|
+
bundleUpdated: defineEvent({
|
|
188
|
+
type: "content.bundle.updated",
|
|
189
|
+
version: 1,
|
|
190
|
+
data: bundleSchema
|
|
191
|
+
}),
|
|
192
|
+
bundleDeleted: defineEvent({
|
|
193
|
+
type: "content.bundle.deleted",
|
|
194
|
+
version: 1,
|
|
195
|
+
data: bundleSchema
|
|
196
|
+
}),
|
|
197
|
+
bundleItemAdded: defineEvent({
|
|
198
|
+
type: "content.bundle.item.added",
|
|
199
|
+
version: 1,
|
|
200
|
+
data: bundleItemsEventSchema
|
|
201
|
+
}),
|
|
202
|
+
bundleItemRemoved: defineEvent({
|
|
203
|
+
type: "content.bundle.item.removed",
|
|
204
|
+
version: 1,
|
|
205
|
+
data: bundleItemsEventSchema
|
|
100
206
|
})
|
|
101
207
|
};
|
|
102
208
|
//#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 courseSchema,\n downloadAssetSchema,\n downloadSchema,\n idSchema,\n moduleSchema,\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 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};\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 ContentEvent = EventOfValues<typeof contentEvents>;\n"],"mappings":"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"}
|
package/dist/content/index.d.ts
CHANGED
|
@@ -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, AddDownloadAssetInput, Bundle, BundleItem, Course, CourseSettings, CourseStatus, CreateBundleInput, CreateCourseInput, CreateDownloadInput, Download, DownloadAsset, DownloadStatus, ListBundlesQuery, ListCoursesQuery, ListDownloadsQuery, Module, ReorderDownloadAssetsInput, SaveActivityInput, UpdateBundleInput, UpdateCourseInput, UpdateDownloadInput } from "../types/schemas/content.js";
|
|
3
|
+
import { BundleCreated, BundleDeleted, BundleItemAdded, BundleItemRemoved, BundleUpdated, ContentEvent, CourseActivitiesReordered, CourseActivityCreated, CourseActivityDeleted, CourseActivityUpdated, CourseCreated, CourseDeleted, CourseModuleCreated, CourseModuleDeleted, CourseModuleUpdated, CourseModulesReordered, CourseUpdated, DownloadCreated, DownloadDeleted, DownloadUpdated, contentEvents } from "./events.js";
|
|
4
4
|
import "./model.js";
|
|
5
5
|
import "./types.js";
|
|
6
|
-
import { ContentRepository, ContentService } from "./ports.js";
|
|
7
|
-
import {
|
|
8
|
-
export { type Activity, type AddDownloadAssetInput, type ContentEvent, type ContentRepository, type ContentService
|
|
6
|
+
import { BundlesService, ContentRepository, ContentService as ContentService$1, CourseManagementService, DownloadablesService } from "./ports.js";
|
|
7
|
+
import { ContentService } from "./service.js";
|
|
8
|
+
export { type Activity, type ActivityAsset, type AddDownloadAssetInput, type Bundle, type BundleCreated, type BundleDeleted, type BundleItem, type BundleItemAdded, type BundleItemRemoved, type BundleUpdated, type BundlesService, 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 CreateBundleInput, type CreateCourseInput, type CreateDownloadInput, type Download, type DownloadAsset, type DownloadCreated, type DownloadDeleted, type DownloadStatus, type DownloadUpdated, type DownloadablesService, type ListBundlesQuery, type ListCoursesQuery, type ListDownloadsQuery, type Module, type Page, type ReorderDownloadAssetsInput, type SaveActivityInput, type UpdateBundleInput, type UpdateCourseInput, type UpdateDownloadInput, contentEvents };
|
package/dist/content/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { contentEvents } from "./events.js";
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
2
|
+
import { ContentService } from "./service.js";
|
|
3
|
+
export { ContentService, contentEvents };
|
package/dist/content/model.d.ts
CHANGED
|
@@ -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, Bundle, BundleItem, ContentItem, ContentType, Course, CourseSettings, CourseStatus, Download, DownloadAsset, DownloadStatus, Module, SaveActivityInput } 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, Bundle, BundleItem, ContentItem, ContentType, Course, CourseSettings, CourseStatus, Download, DownloadAsset, DownloadStatus, Module, SaveActivityInput };
|
package/dist/content/ports.d.ts
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
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, AddDownloadAssetInput, Bundle, BundleItem, Course, CourseSettings, CreateBundleInput, CreateCourseInput, CreateDownloadInput, Download, DownloadAsset, ListBundlesQuery, ListCoursesQuery, ListDownloadsQuery, Module, SaveActivityInput, UpdateBundleInput, UpdateCourseInput, UpdateDownloadInput } 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
6
|
//#region src/content/ports.d.ts
|
|
7
|
-
interface ContentService {
|
|
8
|
-
|
|
7
|
+
interface ContentService extends DownloadablesService, CourseManagementService {}
|
|
8
|
+
interface CourseManagementService {
|
|
9
|
+
listCourses(orgId: string, query: ListCoursesQuery): Promise<Page<Course>>;
|
|
9
10
|
getCourse(orgId: string, id: string): Promise<Course | null>;
|
|
10
11
|
createCourse(orgId: string, input: CreateCourseInput): Promise<Course>;
|
|
11
12
|
/** @throws NotFoundError when no course with this id exists in the org. */
|
|
12
13
|
updateCourse(orgId: string, id: string, patch: UpdateCourseInput): Promise<Course>;
|
|
13
14
|
/** @throws NotFoundError when no course with this id exists in the org. */
|
|
14
|
-
|
|
15
|
+
patchCourseSettings(orgId: string, id: string, value: Partial<CourseSettings>): Promise<CourseSettings>;
|
|
15
16
|
/** @throws NotFoundError when no course with this id exists in the org. */
|
|
16
17
|
deleteCourse(orgId: string, id: string): Promise<void>;
|
|
17
18
|
listCourseModules(orgId: string, courseId: string): Promise<Module[]>;
|
|
18
19
|
listCourseActivities(orgId: string, courseId: string): Promise<Activity[]>;
|
|
20
|
+
listCourseActivityAssets(orgId: string, courseId: string): Promise<ActivityAsset[]>;
|
|
19
21
|
getActivity(orgId: string, activityId: string): Promise<Activity | null>;
|
|
20
22
|
getModule(orgId: string, moduleId: string): Promise<Module | null>;
|
|
21
23
|
reorderModules(orgId: string, courseId: string, orderedIds: string[]): Promise<Module[]>;
|
|
@@ -30,6 +32,8 @@ interface ContentService {
|
|
|
30
32
|
saveActivity(orgId: string, courseId: string, moduleId: string, input: SaveActivityInput, activityId?: string): Promise<Module[]>;
|
|
31
33
|
/** @throws NotFoundError when no such activity exists in this module. */
|
|
32
34
|
deleteActivity(orgId: string, courseId: string, moduleId: string, activityId: string): Promise<Module[]>;
|
|
35
|
+
}
|
|
36
|
+
interface DownloadablesService {
|
|
33
37
|
listDownloads(orgId: string, query: ListDownloadsQuery): Promise<Page<Download>>;
|
|
34
38
|
getDownload(orgId: string, id: string): Promise<Download | null>;
|
|
35
39
|
createDownload(orgId: string, input: CreateDownloadInput): Promise<Download>;
|
|
@@ -44,14 +48,32 @@ interface ContentService {
|
|
|
44
48
|
/** @throws ConflictError when assetIds is not exactly the download's current asset set. */
|
|
45
49
|
reorderDownloadAssets(orgId: string, downloadId: string, assetIds: string[]): Promise<DownloadAsset[]>;
|
|
46
50
|
}
|
|
51
|
+
interface BundlesService {
|
|
52
|
+
listBundles(orgId: string, query: ListBundlesQuery): Promise<Page<Bundle>>;
|
|
53
|
+
getBundle(orgId: string, id: string): Promise<Bundle | null>;
|
|
54
|
+
/** Bundle and its initial items are created together, or not at all.
|
|
55
|
+
* @throws NotFoundError when an initial content id does not exist in the org. */
|
|
56
|
+
createBundle(orgId: string, input: CreateBundleInput): Promise<Bundle>;
|
|
57
|
+
/** @throws NotFoundError when no bundle with this id exists in the org. */
|
|
58
|
+
updateBundle(orgId: string, id: string, patch: UpdateBundleInput): Promise<Bundle>;
|
|
59
|
+
/** @throws NotFoundError when no bundle with this id exists in the org. */
|
|
60
|
+
deleteBundle(orgId: string, id: string): Promise<void>;
|
|
61
|
+
listBundleItems(orgId: string, bundleId: string): Promise<BundleItem[]>;
|
|
62
|
+
/** @throws NotFoundError when the bundle — or the content — does not exist in the org. */
|
|
63
|
+
addBundleItem(orgId: string, bundleId: string, contentId: string): Promise<BundleItem[]>;
|
|
64
|
+
/** @throws NotFoundError when no bundle with this id exists in the org. */
|
|
65
|
+
removeBundleItem(orgId: string, bundleId: string, contentId: string): Promise<BundleItem[]>;
|
|
66
|
+
}
|
|
47
67
|
interface ContentRepository {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
68
|
+
listCourses(orgId: string, query: ListCoursesQuery): Promise<Page<Course>>;
|
|
69
|
+
findCourseById(orgId: string, id: string): Promise<Course | null>;
|
|
70
|
+
createCourse(orgId: string, input: CreateCourseInput, slug: string): Promise<Course>;
|
|
71
|
+
updateCourse(orgId: string, id: string, patch: UpdateCourseInput): Promise<Course | null>;
|
|
72
|
+
patchCourseSettings(orgId: string, id: string, value: Partial<CourseSettings>): Promise<CourseSettings>;
|
|
73
|
+
deleteCourse(orgId: string, id: string): Promise<boolean>;
|
|
74
|
+
listCourseModules(orgId: string, courseId: string): Promise<Module[]>;
|
|
54
75
|
listActivitiesForCourse(orgId: string, courseId: string): Promise<Activity[]>;
|
|
76
|
+
listActivityAssetsForCourse(orgId: string, courseId: string): Promise<ActivityAsset[]>;
|
|
55
77
|
findActivity(orgId: string, activityId: string): Promise<Activity | null>;
|
|
56
78
|
findModule(orgId: string, moduleId: string): Promise<Module | null>;
|
|
57
79
|
reorderModules(orgId: string, courseId: string, orderedIds: string[]): Promise<Module[]>;
|
|
@@ -74,6 +96,15 @@ interface ContentRepository {
|
|
|
74
96
|
removeDownloadAsset(orgId: string, downloadId: string, assetId: string): Promise<DownloadAsset[]>;
|
|
75
97
|
renameDownloadAsset(orgId: string, downloadId: string, assetId: string, displayName: string | null): Promise<DownloadAsset[]>;
|
|
76
98
|
reorderDownloadAssets(orgId: string, downloadId: string, assetIds: string[]): Promise<DownloadAsset[]>;
|
|
99
|
+
listBundles(orgId: string, query: ListBundlesQuery): Promise<Page<Bundle>>;
|
|
100
|
+
findBundleById(orgId: string, id: string): Promise<Bundle | null>;
|
|
101
|
+
createBundle(orgId: string, input: CreateBundleInput): Promise<Bundle>;
|
|
102
|
+
updateBundle(orgId: string, id: string, patch: UpdateBundleInput): Promise<Bundle | null>;
|
|
103
|
+
deleteBundle(orgId: string, id: string): Promise<boolean>;
|
|
104
|
+
listBundleItems(orgId: string, bundleId: string): Promise<BundleItem[]>;
|
|
105
|
+
/** Content already in the bundle is left as it is — adding twice is a no-op. */
|
|
106
|
+
addBundleItem(orgId: string, bundleId: string, contentId: string): Promise<BundleItem[]>;
|
|
107
|
+
removeBundleItem(orgId: string, bundleId: string, contentId: string): Promise<BundleItem[]>;
|
|
77
108
|
}
|
|
78
109
|
interface ContentTxScope {
|
|
79
110
|
content: ContentRepository;
|
|
@@ -81,5 +112,5 @@ interface ContentTxScope {
|
|
|
81
112
|
}
|
|
82
113
|
type ContentUnitOfWork = UnitOfWork<ContentTxScope>;
|
|
83
114
|
//#endregion
|
|
84
|
-
export { ContentRepository, ContentService, ContentTxScope, ContentUnitOfWork };
|
|
115
|
+
export { BundlesService, ContentRepository, ContentService, ContentTxScope, ContentUnitOfWork, CourseManagementService, DownloadablesService };
|
|
85
116
|
//# sourceMappingURL=ports.d.ts.map
|
|
@@ -1,32 +1,30 @@
|
|
|
1
1
|
import { Page } from "../types/shared.js";
|
|
2
2
|
import { Logger } from "../types/ports.js";
|
|
3
|
-
import { Activity, AddDownloadAssetInput, Course, CourseSettings, CreateCourseInput, CreateDownloadInput, Download, DownloadAsset, ListCoursesQuery, ListDownloadsQuery, Module, SaveActivityInput, UpdateCourseInput, UpdateDownloadInput } from "../types/schemas/content.js";
|
|
3
|
+
import { Activity, ActivityAsset, AddDownloadAssetInput, Bundle, BundleItem, Course, CourseSettings, CreateBundleInput, CreateCourseInput, CreateDownloadInput, Download, DownloadAsset, ListBundlesQuery, ListCoursesQuery, ListDownloadsQuery, Module, SaveActivityInput, UpdateBundleInput, UpdateCourseInput, UpdateDownloadInput } from "../types/schemas/content.js";
|
|
4
4
|
import "../shared/ports.js";
|
|
5
5
|
import "./model.js";
|
|
6
6
|
import "./types.js";
|
|
7
|
-
import {
|
|
8
|
-
import { SettingsService } from "../shared/settings.js";
|
|
7
|
+
import { BundlesService, ContentRepository, ContentUnitOfWork, CourseManagementService, DownloadablesService } from "./ports.js";
|
|
9
8
|
//#region src/content/service.d.ts
|
|
10
9
|
type ContentServiceParams = {
|
|
11
10
|
repo: ContentRepository;
|
|
12
11
|
uow: ContentUnitOfWork;
|
|
13
|
-
settings: SettingsService;
|
|
14
12
|
logger?: Logger;
|
|
15
13
|
};
|
|
16
|
-
declare class
|
|
14
|
+
declare class ContentService implements CourseManagementService, DownloadablesService, BundlesService {
|
|
17
15
|
private readonly repo;
|
|
18
16
|
private readonly uow;
|
|
19
|
-
private readonly settings;
|
|
20
17
|
private readonly logger;
|
|
21
18
|
constructor(params: ContentServiceParams);
|
|
22
|
-
|
|
19
|
+
listCourses(orgId: string, query: ListCoursesQuery): Promise<Page<Course>>;
|
|
23
20
|
getCourse(orgId: string, id: string): Promise<Course | null>;
|
|
24
21
|
createCourse(orgId: string, input: CreateCourseInput): Promise<Course>;
|
|
25
22
|
updateCourse(orgId: string, id: string, patch: UpdateCourseInput): Promise<Course>;
|
|
26
|
-
|
|
23
|
+
patchCourseSettings(orgId: string, id: string, value: Partial<CourseSettings>): Promise<CourseSettings>;
|
|
27
24
|
deleteCourse(orgId: string, id: string): Promise<void>;
|
|
28
25
|
listCourseModules(orgId: string, courseId: string): Promise<Module[]>;
|
|
29
26
|
listCourseActivities(orgId: string, courseId: string): Promise<Activity[]>;
|
|
27
|
+
listCourseActivityAssets(orgId: string, courseId: string): Promise<ActivityAsset[]>;
|
|
30
28
|
getActivity(orgId: string, activityId: string): Promise<Activity | null>;
|
|
31
29
|
getModule(orgId: string, moduleId: string): Promise<Module | null>;
|
|
32
30
|
reorderModules(orgId: string, courseId: string, orderedIds: string[]): Promise<Module[]>;
|
|
@@ -48,7 +46,15 @@ declare class ContentServiceImpl implements ContentService {
|
|
|
48
46
|
/** The caller must send the COMPLETE ordered set — a partial list would
|
|
49
47
|
* silently unlink whatever it omitted. */
|
|
50
48
|
reorderDownloadAssets(orgId: string, downloadId: string, assetIds: string[]): Promise<DownloadAsset[]>;
|
|
49
|
+
listBundles(orgId: string, query: ListBundlesQuery): Promise<Page<Bundle>>;
|
|
50
|
+
getBundle(orgId: string, id: string): Promise<Bundle | null>;
|
|
51
|
+
createBundle(orgId: string, input: CreateBundleInput): Promise<Bundle>;
|
|
52
|
+
updateBundle(orgId: string, id: string, patch: UpdateBundleInput): Promise<Bundle>;
|
|
53
|
+
deleteBundle(orgId: string, id: string): Promise<void>;
|
|
54
|
+
listBundleItems(orgId: string, bundleId: string): Promise<BundleItem[]>;
|
|
55
|
+
addBundleItem(orgId: string, bundleId: string, contentId: string): Promise<BundleItem[]>;
|
|
56
|
+
removeBundleItem(orgId: string, bundleId: string, contentId: string): Promise<BundleItem[]>;
|
|
51
57
|
}
|
|
52
58
|
//#endregion
|
|
53
|
-
export {
|
|
59
|
+
export { ContentService, ContentServiceParams };
|
|
54
60
|
//# sourceMappingURL=service.d.ts.map
|