@headless-lms/core 0.3.0 → 0.4.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 (205) hide show
  1. package/dist/assets/events.d.ts +9 -9
  2. package/dist/assets/index.d.ts +3 -2
  3. package/dist/assets/index.js +2 -1
  4. package/dist/assets/jobs.d.ts +15 -0
  5. package/dist/assets/jobs.js +30 -0
  6. package/dist/assets/jobs.js.map +1 -0
  7. package/dist/assets/ports.d.ts +4 -3
  8. package/dist/assets/service.d.ts +0 -1
  9. package/dist/assets/service.js +0 -4
  10. package/dist/assets/service.js.map +1 -1
  11. package/dist/automations/actions.js +2 -63
  12. package/dist/automations/actions.js.map +1 -1
  13. package/dist/automations/catalog.d.ts +1 -2
  14. package/dist/automations/catalog.js +69 -62
  15. package/dist/automations/catalog.js.map +1 -1
  16. package/dist/automations/community-derivations.js +4 -4
  17. package/dist/automations/community-derivations.js.map +1 -1
  18. package/dist/automations/community-mail.d.ts +3 -17
  19. package/dist/automations/community-mail.js +1 -21
  20. package/dist/automations/community-mail.js.map +1 -1
  21. package/dist/automations/events.d.ts +0 -10
  22. package/dist/automations/index.d.ts +11 -4
  23. package/dist/automations/index.js +8 -1
  24. package/dist/automations/notifications/debounce.d.ts +25 -0
  25. package/dist/automations/notifications/debounce.js +93 -0
  26. package/dist/automations/notifications/debounce.js.map +1 -0
  27. package/dist/automations/notifications/defaults.d.ts +8 -0
  28. package/dist/automations/notifications/defaults.js +316 -0
  29. package/dist/automations/notifications/defaults.js.map +1 -0
  30. package/dist/automations/notifications/delivery.d.ts +28 -0
  31. package/dist/automations/notifications/delivery.js +88 -0
  32. package/dist/automations/notifications/delivery.js.map +1 -0
  33. package/dist/automations/notifications/processor.d.ts +64 -0
  34. package/dist/automations/notifications/processor.js +270 -0
  35. package/dist/automations/notifications/processor.js.map +1 -0
  36. package/dist/automations/notifications/rules/content.d.ts +6 -0
  37. package/dist/automations/notifications/rules/content.js +39 -0
  38. package/dist/automations/notifications/rules/content.js.map +1 -0
  39. package/dist/automations/notifications/rules/discussion.d.ts +7 -0
  40. package/dist/automations/notifications/rules/discussion.js +678 -0
  41. package/dist/automations/notifications/rules/discussion.js.map +1 -0
  42. package/dist/automations/notifications/rules/entitlements.d.ts +6 -0
  43. package/dist/automations/notifications/rules/entitlements.js +249 -0
  44. package/dist/automations/notifications/rules/entitlements.js.map +1 -0
  45. package/dist/automations/notifications/rules/index.d.ts +6 -0
  46. package/dist/automations/notifications/rules/index.js +15 -0
  47. package/dist/automations/notifications/rules/index.js.map +1 -0
  48. package/dist/automations/notifications/rules/organizations.d.ts +6 -0
  49. package/dist/automations/notifications/rules/organizations.js +28 -0
  50. package/dist/automations/notifications/rules/organizations.js.map +1 -0
  51. package/dist/automations/notifications/rules/recipients.d.ts +32 -0
  52. package/dist/automations/notifications/rules/recipients.js +99 -0
  53. package/dist/automations/notifications/rules/recipients.js.map +1 -0
  54. package/dist/automations/notifications/service.d.ts +27 -0
  55. package/dist/automations/notifications/service.js +45 -0
  56. package/dist/automations/notifications/service.js.map +1 -0
  57. package/dist/automations/notifications/types.d.ts +7 -0
  58. package/dist/automations/notifications/types.js +473 -0
  59. package/dist/automations/notifications/types.js.map +1 -0
  60. package/dist/automations/ports.d.ts +119 -5
  61. package/dist/automations/service.d.ts +10 -13
  62. package/dist/automations/service.js +21 -83
  63. package/dist/automations/service.js.map +1 -1
  64. package/dist/content/events.d.ts +130 -80
  65. package/dist/content/events.js +11 -0
  66. package/dist/content/events.js.map +1 -1
  67. package/dist/content/index.d.ts +6 -4
  68. package/dist/content/index.js +3 -1
  69. package/dist/content/model.d.ts +2 -2
  70. package/dist/content/notification-categories.d.ts +36 -0
  71. package/dist/content/notification-categories.js +64 -0
  72. package/dist/content/notification-categories.js.map +1 -0
  73. package/dist/content/ports.d.ts +25 -6
  74. package/dist/content/service.d.ts +4 -4
  75. package/dist/content/service.js +24 -8
  76. package/dist/content/service.js.map +1 -1
  77. package/dist/content/titles.d.ts +22 -0
  78. package/dist/content/titles.js +69 -0
  79. package/dist/content/titles.js.map +1 -0
  80. package/dist/content/types.d.ts +2 -2
  81. package/dist/discussion/chats.d.ts +9 -4
  82. package/dist/discussion/chats.js +80 -47
  83. package/dist/discussion/chats.js.map +1 -1
  84. package/dist/discussion/digests.d.ts +24 -0
  85. package/dist/discussion/digests.js +104 -0
  86. package/dist/discussion/digests.js.map +1 -0
  87. package/dist/discussion/events.d.ts +194 -28
  88. package/dist/discussion/events.js +74 -17
  89. package/dist/discussion/events.js.map +1 -1
  90. package/dist/discussion/index.d.ts +7 -2
  91. package/dist/discussion/index.js +6 -1
  92. package/dist/discussion/jobs.d.ts +16 -0
  93. package/dist/discussion/jobs.js +40 -0
  94. package/dist/discussion/jobs.js.map +1 -0
  95. package/dist/discussion/mentions.d.ts +11 -0
  96. package/dist/discussion/mentions.js +35 -0
  97. package/dist/discussion/mentions.js.map +1 -0
  98. package/dist/discussion/ports.d.ts +107 -24
  99. package/dist/discussion/ports.js.map +1 -1
  100. package/dist/discussion/posts.d.ts +18 -8
  101. package/dist/discussion/posts.js +207 -155
  102. package/dist/discussion/posts.js.map +1 -1
  103. package/dist/discussion/service.d.ts +17 -8
  104. package/dist/discussion/service.js +105 -41
  105. package/dist/discussion/service.js.map +1 -1
  106. package/dist/discussion/subscriptions.d.ts +37 -0
  107. package/dist/discussion/subscriptions.js +99 -0
  108. package/dist/discussion/subscriptions.js.map +1 -0
  109. package/dist/discussion/titles.d.ts +26 -0
  110. package/dist/discussion/titles.js +84 -0
  111. package/dist/discussion/titles.js.map +1 -0
  112. package/dist/entitlements/events.d.ts +20 -20
  113. package/dist/entitlements/index.d.ts +2 -1
  114. package/dist/entitlements/index.js +2 -1
  115. package/dist/entitlements/jobs.d.ts +12 -0
  116. package/dist/entitlements/jobs.js +18 -0
  117. package/dist/entitlements/jobs.js.map +1 -0
  118. package/dist/entitlements/ports.d.ts +7 -3
  119. package/dist/entitlements/service.d.ts +5 -2
  120. package/dist/entitlements/service.js +23 -3
  121. package/dist/entitlements/service.js.map +1 -1
  122. package/dist/identity/devices.d.ts +30 -0
  123. package/dist/identity/devices.js +107 -0
  124. package/dist/identity/devices.js.map +1 -0
  125. package/dist/identity/events.d.ts +2 -2
  126. package/dist/identity/index.d.ts +5 -4
  127. package/dist/identity/index.js +3 -2
  128. package/dist/identity/model.d.ts +2 -2
  129. package/dist/identity/notification-settings.d.ts +28 -0
  130. package/dist/identity/notification-settings.js +113 -0
  131. package/dist/identity/notification-settings.js.map +1 -0
  132. package/dist/identity/ports.d.ts +78 -54
  133. package/dist/integrations/events.d.ts +3 -3
  134. package/dist/organizations/events.d.ts +32 -32
  135. package/dist/organizations/index.d.ts +2 -1
  136. package/dist/organizations/index.js +2 -1
  137. package/dist/organizations/notification-categories.d.ts +32 -0
  138. package/dist/organizations/notification-categories.js +51 -0
  139. package/dist/organizations/notification-categories.js.map +1 -0
  140. package/dist/organizations/ports.d.ts +3 -0
  141. package/dist/organizations/service.d.ts +2 -0
  142. package/dist/organizations/service.js +7 -0
  143. package/dist/organizations/service.js.map +1 -1
  144. package/dist/progress/events.d.ts +14 -14
  145. package/dist/reporting/member/index.d.ts +2 -2
  146. package/dist/reporting/member/model.d.ts +56 -23
  147. package/dist/reporting/member/ports.d.ts +9 -6
  148. package/dist/reporting/member/service.d.ts +33 -14
  149. package/dist/reporting/member/service.js +138 -60
  150. package/dist/reporting/member/service.js.map +1 -1
  151. package/dist/shared/errors.d.ts +13 -1
  152. package/dist/shared/errors.js +18 -1
  153. package/dist/shared/errors.js.map +1 -1
  154. package/dist/shared/id.d.ts +3 -0
  155. package/dist/shared/id.js +4 -1
  156. package/dist/shared/id.js.map +1 -1
  157. package/dist/shared/mailer.d.ts +11 -1
  158. package/dist/shared/mailer.js +32 -5
  159. package/dist/shared/mailer.js.map +1 -1
  160. package/dist/shared/notification-categories.d.ts +16 -0
  161. package/dist/shared/notification-categories.js +94 -0
  162. package/dist/shared/notification-categories.js.map +1 -0
  163. package/dist/shared/notification-settings.d.ts +14 -0
  164. package/dist/shared/notification-settings.js +61 -0
  165. package/dist/shared/notification-settings.js.map +1 -0
  166. package/dist/shared/ports.d.ts +48 -2
  167. package/dist/shared/settings.d.ts +2 -1
  168. package/dist/shared/settings.js +1 -0
  169. package/dist/shared/settings.js.map +1 -1
  170. package/dist/types/automations.d.ts +8 -2
  171. package/dist/types/content.d.ts +2 -2
  172. package/dist/types/discussion.d.ts +2 -2
  173. package/dist/types/email-templates.d.ts +97 -3
  174. package/dist/types/identity.d.ts +2 -2
  175. package/dist/types/index.d.ts +7 -6
  176. package/dist/types/notifications.d.ts +157 -0
  177. package/dist/types/notifications.js +1 -0
  178. package/dist/types/schemas/automations.d.ts +1 -10
  179. package/dist/types/schemas/automations.js +1 -3
  180. package/dist/types/schemas/automations.js.map +1 -1
  181. package/dist/types/schemas/content.d.ts +62 -1
  182. package/dist/types/schemas/content.js +25 -3
  183. package/dist/types/schemas/content.js.map +1 -1
  184. package/dist/types/schemas/discussion.d.ts +85 -12
  185. package/dist/types/schemas/discussion.js +47 -13
  186. package/dist/types/schemas/discussion.js.map +1 -1
  187. package/dist/types/schemas/identity.d.ts +1 -85
  188. package/dist/types/schemas/identity.js +1 -42
  189. package/dist/types/schemas/identity.js.map +1 -1
  190. package/dist/types/schemas/index.d.ts +6 -5
  191. package/dist/types/schemas/index.js +6 -5
  192. package/dist/types/schemas/notifications.d.ts +95 -0
  193. package/dist/types/schemas/notifications.js +56 -0
  194. package/dist/types/schemas/notifications.js.map +1 -0
  195. package/dist/types/schemas/progress.d.ts +3 -3
  196. package/package.json +1 -1
  197. package/dist/automations/community-notifications.d.ts +0 -16
  198. package/dist/automations/community-notifications.js +0 -84
  199. package/dist/automations/community-notifications.js.map +0 -1
  200. package/dist/automations/seeds.d.ts +0 -17
  201. package/dist/automations/seeds.js +0 -235
  202. package/dist/automations/seeds.js.map +0 -1
  203. package/dist/identity/notifications.d.ts +0 -27
  204. package/dist/identity/notifications.js +0 -101
  205. package/dist/identity/notifications.js.map +0 -1
@@ -17,6 +17,7 @@ declare const discussionEvents: {
17
17
  removedBy: string | null;
18
18
  createdAt: Date;
19
19
  updatedAt: Date;
20
+ mentionedOrgUserIds: string[];
20
21
  }, "discussion.comment.created", 1>, {
21
22
  id: string;
22
23
  orgId: string;
@@ -30,19 +31,20 @@ declare const discussionEvents: {
30
31
  removedBy: string | null;
31
32
  createdAt: unknown;
32
33
  updatedAt: unknown;
34
+ mentionedOrgUserIds: string[];
33
35
  }, z.ZodObject<{
34
- orgId: z.ZodString;
35
36
  id: z.ZodString;
37
+ orgId: z.ZodString;
38
+ orgUserId: z.ZodString;
39
+ createdAt: z.ZodCoercedDate<unknown>;
40
+ updatedAt: z.ZodCoercedDate<unknown>;
36
41
  status: z.ZodEnum<{
37
42
  pending: "pending";
38
43
  published: "published";
39
44
  removed: "removed";
40
45
  }>;
41
- createdAt: z.ZodCoercedDate<unknown>;
42
- updatedAt: z.ZodCoercedDate<unknown>;
43
- communityId: z.ZodNullable<z.ZodString>;
44
- orgUserId: z.ZodString;
45
46
  activityId: z.ZodNullable<z.ZodString>;
47
+ communityId: z.ZodNullable<z.ZodString>;
46
48
  postId: z.ZodNullable<z.ZodString>;
47
49
  parentId: z.ZodNullable<z.ZodString>;
48
50
  body: z.ZodString;
@@ -61,6 +63,7 @@ declare const discussionEvents: {
61
63
  removedBy: string | null;
62
64
  createdAt: Date;
63
65
  updatedAt: Date;
66
+ mentionedOrgUserIds: string[];
64
67
  }, "discussion.comment.published", 1>, {
65
68
  id: string;
66
69
  orgId: string;
@@ -74,24 +77,96 @@ declare const discussionEvents: {
74
77
  removedBy: string | null;
75
78
  createdAt: unknown;
76
79
  updatedAt: unknown;
80
+ mentionedOrgUserIds: string[];
77
81
  }, z.ZodObject<{
78
- orgId: z.ZodString;
79
82
  id: z.ZodString;
83
+ orgId: z.ZodString;
84
+ orgUserId: z.ZodString;
85
+ createdAt: z.ZodCoercedDate<unknown>;
86
+ updatedAt: z.ZodCoercedDate<unknown>;
80
87
  status: z.ZodEnum<{
81
88
  pending: "pending";
82
89
  published: "published";
83
90
  removed: "removed";
84
91
  }>;
85
- createdAt: z.ZodCoercedDate<unknown>;
86
- updatedAt: z.ZodCoercedDate<unknown>;
92
+ activityId: z.ZodNullable<z.ZodString>;
87
93
  communityId: z.ZodNullable<z.ZodString>;
94
+ postId: z.ZodNullable<z.ZodString>;
95
+ parentId: z.ZodNullable<z.ZodString>;
96
+ body: z.ZodString;
97
+ removedBy: z.ZodNullable<z.ZodString>;
98
+ }, z.core.$strip>>;
99
+ commentUpdated: RuntimeEventDefinition<VersionedDomainEvent<{
100
+ id: string;
101
+ orgId: string;
102
+ activityId: string | null;
103
+ postId: string | null;
104
+ communityId: string | null;
105
+ parentId: string | null;
106
+ orgUserId: string;
107
+ body: string;
108
+ status: "pending" | "published" | "removed";
109
+ removedBy: string | null;
110
+ createdAt: Date;
111
+ updatedAt: Date;
112
+ mentionedOrgUserIds: string[];
113
+ }, "discussion.comment.updated", 1>, {
114
+ id: string;
115
+ orgId: string;
116
+ activityId: string | null;
117
+ postId: string | null;
118
+ communityId: string | null;
119
+ parentId: string | null;
120
+ orgUserId: string;
121
+ body: string;
122
+ status: "pending" | "published" | "removed";
123
+ removedBy: string | null;
124
+ createdAt: unknown;
125
+ updatedAt: unknown;
126
+ mentionedOrgUserIds: string[];
127
+ }, z.ZodObject<{
128
+ id: z.ZodString;
129
+ orgId: z.ZodString;
88
130
  orgUserId: z.ZodString;
131
+ createdAt: z.ZodCoercedDate<unknown>;
132
+ updatedAt: z.ZodCoercedDate<unknown>;
133
+ status: z.ZodEnum<{
134
+ pending: "pending";
135
+ published: "published";
136
+ removed: "removed";
137
+ }>;
89
138
  activityId: z.ZodNullable<z.ZodString>;
139
+ communityId: z.ZodNullable<z.ZodString>;
90
140
  postId: z.ZodNullable<z.ZodString>;
91
141
  parentId: z.ZodNullable<z.ZodString>;
92
142
  body: z.ZodString;
93
143
  removedBy: z.ZodNullable<z.ZodString>;
94
144
  }, z.core.$strip>>;
145
+ commentReactionAdded: RuntimeEventDefinition<VersionedDomainEvent<{
146
+ commentId: string;
147
+ postId: string | null;
148
+ activityId: string | null;
149
+ spaceId: string | null;
150
+ communityId: string | null;
151
+ orgUserId: string;
152
+ reaction: string;
153
+ }, "discussion.comment.reaction.added", 1>, {
154
+ commentId: string;
155
+ postId: string | null;
156
+ activityId: string | null;
157
+ spaceId: string | null;
158
+ communityId: string | null;
159
+ orgUserId: string;
160
+ reaction: string;
161
+ }, z.ZodObject<{
162
+ commentId: z.ZodString;
163
+ postId: z.ZodNullable<z.ZodString>;
164
+ activityId: z.ZodNullable<z.ZodString>;
165
+ spaceId: z.ZodNullable<z.ZodString>;
166
+ communityId: z.ZodNullable<z.ZodString>;
167
+ orgUserId: z.ZodString;
168
+ reaction: z.ZodString;
169
+ }, z.core.$strict>>;
95
170
  commentRemoved: RuntimeEventDefinition<VersionedDomainEvent<{
96
171
  id: string;
97
172
  orgId: string;
@@ -119,18 +194,18 @@ declare const discussionEvents: {
119
194
  createdAt: unknown;
120
195
  updatedAt: unknown;
121
196
  }, z.ZodObject<{
122
- orgId: z.ZodString;
123
197
  id: z.ZodString;
198
+ orgId: z.ZodString;
199
+ orgUserId: z.ZodString;
200
+ createdAt: z.ZodCoercedDate<unknown>;
201
+ updatedAt: z.ZodCoercedDate<unknown>;
124
202
  status: z.ZodEnum<{
125
203
  pending: "pending";
126
204
  published: "published";
127
205
  removed: "removed";
128
206
  }>;
129
- createdAt: z.ZodCoercedDate<unknown>;
130
- updatedAt: z.ZodCoercedDate<unknown>;
131
- communityId: z.ZodNullable<z.ZodString>;
132
- orgUserId: z.ZodString;
133
207
  activityId: z.ZodNullable<z.ZodString>;
208
+ communityId: z.ZodNullable<z.ZodString>;
134
209
  postId: z.ZodNullable<z.ZodString>;
135
210
  parentId: z.ZodNullable<z.ZodString>;
136
211
  body: z.ZodString;
@@ -161,12 +236,12 @@ declare const discussionEvents: {
161
236
  updatedAt: unknown;
162
237
  communityId: string | null;
163
238
  }, z.ZodObject<{
164
- orgId: z.ZodString;
165
239
  id: z.ZodString;
240
+ orgId: z.ZodString;
241
+ orgUserId: z.ZodString;
166
242
  createdAt: z.ZodCoercedDate<unknown>;
167
243
  updatedAt: z.ZodCoercedDate<unknown>;
168
244
  communityId: z.ZodNullable<z.ZodString>;
169
- orgUserId: z.ZodString;
170
245
  commentId: z.ZodString;
171
246
  reason: z.ZodString;
172
247
  resolvedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
@@ -258,6 +333,7 @@ declare const discussionEvents: {
258
333
  reactionsEnabled: boolean | null;
259
334
  createdAt: Date;
260
335
  updatedAt: Date;
336
+ mentionedOrgUserIds: string[];
261
337
  }, "discussion.post.updated", 1>, {
262
338
  orgId: string;
263
339
  id: string;
@@ -278,6 +354,7 @@ declare const discussionEvents: {
278
354
  reactionsEnabled: boolean | null;
279
355
  createdAt: unknown;
280
356
  updatedAt: unknown;
357
+ mentionedOrgUserIds: string[];
281
358
  }, z.ZodObject<{
282
359
  orgId: z.ZodString;
283
360
  id: z.ZodString;
@@ -304,7 +381,7 @@ declare const discussionEvents: {
304
381
  reactionsEnabled: z.ZodNullable<z.ZodBoolean>;
305
382
  createdAt: z.ZodCoercedDate<unknown>;
306
383
  updatedAt: z.ZodCoercedDate<unknown>;
307
- }, z.core.$strict>>;
384
+ }, z.core.$strip>>;
308
385
  postPublished: RuntimeEventDefinition<VersionedDomainEvent<{
309
386
  orgId: string;
310
387
  id: string;
@@ -325,6 +402,7 @@ declare const discussionEvents: {
325
402
  reactionsEnabled: boolean | null;
326
403
  createdAt: Date;
327
404
  updatedAt: Date;
405
+ mentionedOrgUserIds: string[];
328
406
  }, "discussion.post.published", 1>, {
329
407
  orgId: string;
330
408
  id: string;
@@ -345,6 +423,7 @@ declare const discussionEvents: {
345
423
  reactionsEnabled: boolean | null;
346
424
  createdAt: unknown;
347
425
  updatedAt: unknown;
426
+ mentionedOrgUserIds: string[];
348
427
  }, z.ZodObject<{
349
428
  orgId: z.ZodString;
350
429
  id: z.ZodString;
@@ -371,6 +450,25 @@ declare const discussionEvents: {
371
450
  reactionsEnabled: z.ZodNullable<z.ZodBoolean>;
372
451
  createdAt: z.ZodCoercedDate<unknown>;
373
452
  updatedAt: z.ZodCoercedDate<unknown>;
453
+ }, z.core.$strip>>;
454
+ postReactionAdded: RuntimeEventDefinition<VersionedDomainEvent<{
455
+ postId: string;
456
+ spaceId: string;
457
+ communityId: string;
458
+ orgUserId: string;
459
+ reaction: string;
460
+ }, "discussion.post.reaction.added", 1>, {
461
+ postId: string;
462
+ spaceId: string;
463
+ communityId: string;
464
+ orgUserId: string;
465
+ reaction: string;
466
+ }, z.ZodObject<{
467
+ postId: z.ZodString;
468
+ spaceId: z.ZodString;
469
+ communityId: z.ZodString;
470
+ orgUserId: z.ZodString;
471
+ reaction: z.ZodString;
374
472
  }, z.core.$strict>>;
375
473
  postRemoved: RuntimeEventDefinition<VersionedDomainEvent<{
376
474
  orgId: string;
@@ -504,8 +602,8 @@ declare const discussionEvents: {
504
602
  updatedAt: unknown;
505
603
  participantIds: string[];
506
604
  }, z.ZodObject<{
507
- orgId: z.ZodString;
508
605
  id: z.ZodString;
606
+ orgId: z.ZodString;
509
607
  kind: z.ZodEnum<{
510
608
  direct: "direct";
511
609
  group: "group";
@@ -544,8 +642,8 @@ declare const discussionEvents: {
544
642
  updatedAt: unknown;
545
643
  participantIds: string[];
546
644
  }, z.ZodObject<{
547
- orgId: z.ZodString;
548
645
  id: z.ZodString;
646
+ orgId: z.ZodString;
549
647
  kind: z.ZodEnum<{
550
648
  direct: "direct";
551
649
  group: "group";
@@ -587,6 +685,7 @@ declare const discussionEvents: {
587
685
  deletedAt: Date | null;
588
686
  createdAt: Date;
589
687
  updatedAt: Date;
688
+ mentionedOrgUserIds: string[];
590
689
  }, "discussion.message.sent", 1>, {
591
690
  orgId: string;
592
691
  id: string;
@@ -599,18 +698,76 @@ declare const discussionEvents: {
599
698
  deletedAt: unknown;
600
699
  createdAt: unknown;
601
700
  updatedAt: unknown;
701
+ mentionedOrgUserIds: string[];
602
702
  }, z.ZodObject<{
603
- orgId: z.ZodString;
604
703
  id: z.ZodString;
704
+ orgId: z.ZodString;
705
+ orgUserId: z.ZodString;
605
706
  createdAt: z.ZodCoercedDate<unknown>;
606
707
  updatedAt: z.ZodCoercedDate<unknown>;
607
708
  communityId: z.ZodString;
709
+ chatId: z.ZodString;
710
+ replyToId: z.ZodNullable<z.ZodString>;
711
+ editedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
712
+ deletedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
713
+ }, z.core.$strip>>;
714
+ messageUpdated: RuntimeEventDefinition<VersionedDomainEvent<{
715
+ orgId: string;
716
+ id: string;
717
+ communityId: string;
718
+ chatId: string;
719
+ orgUserId: string;
720
+ body: string;
721
+ replyToId: string | null;
722
+ editedAt: Date | null;
723
+ deletedAt: Date | null;
724
+ createdAt: Date;
725
+ updatedAt: Date;
726
+ mentionedOrgUserIds: string[];
727
+ }, "discussion.message.updated", 1>, {
728
+ orgId: string;
729
+ id: string;
730
+ communityId: string;
731
+ chatId: string;
732
+ orgUserId: string;
733
+ body: string;
734
+ replyToId: string | null;
735
+ editedAt: unknown;
736
+ deletedAt: unknown;
737
+ createdAt: unknown;
738
+ updatedAt: unknown;
739
+ mentionedOrgUserIds: string[];
740
+ }, z.ZodObject<{
741
+ id: z.ZodString;
742
+ orgId: z.ZodString;
608
743
  orgUserId: z.ZodString;
744
+ createdAt: z.ZodCoercedDate<unknown>;
745
+ updatedAt: z.ZodCoercedDate<unknown>;
746
+ communityId: z.ZodString;
609
747
  chatId: z.ZodString;
610
748
  replyToId: z.ZodNullable<z.ZodString>;
611
749
  editedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
612
750
  deletedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
613
751
  }, z.core.$strip>>;
752
+ messageReactionAdded: RuntimeEventDefinition<VersionedDomainEvent<{
753
+ messageId: string;
754
+ chatId: string;
755
+ communityId: string;
756
+ orgUserId: string;
757
+ reaction: string;
758
+ }, "discussion.message.reaction.added", 1>, {
759
+ messageId: string;
760
+ chatId: string;
761
+ communityId: string;
762
+ orgUserId: string;
763
+ reaction: string;
764
+ }, z.ZodObject<{
765
+ messageId: z.ZodString;
766
+ chatId: z.ZodString;
767
+ communityId: z.ZodString;
768
+ orgUserId: z.ZodString;
769
+ reaction: z.ZodString;
770
+ }, z.core.$strict>>;
614
771
  messageDeleted: RuntimeEventDefinition<VersionedDomainEvent<{
615
772
  orgId: string;
616
773
  id: string;
@@ -636,12 +793,12 @@ declare const discussionEvents: {
636
793
  createdAt: unknown;
637
794
  updatedAt: unknown;
638
795
  }, z.ZodObject<{
639
- orgId: z.ZodString;
640
796
  id: z.ZodString;
797
+ orgId: z.ZodString;
798
+ orgUserId: z.ZodString;
641
799
  createdAt: z.ZodCoercedDate<unknown>;
642
800
  updatedAt: z.ZodCoercedDate<unknown>;
643
801
  communityId: z.ZodString;
644
- orgUserId: z.ZodString;
645
802
  chatId: z.ZodString;
646
803
  replyToId: z.ZodNullable<z.ZodString>;
647
804
  editedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
@@ -672,12 +829,12 @@ declare const discussionEvents: {
672
829
  createdAt: unknown;
673
830
  updatedAt: unknown;
674
831
  }, z.ZodObject<{
675
- orgId: z.ZodString;
676
832
  id: z.ZodString;
833
+ orgId: z.ZodString;
834
+ orgUserId: z.ZodString;
677
835
  createdAt: z.ZodCoercedDate<unknown>;
678
836
  updatedAt: z.ZodCoercedDate<unknown>;
679
837
  communityId: z.ZodString;
680
- orgUserId: z.ZodString;
681
838
  resolvedAt: z.ZodNullable<z.ZodCoercedDate<unknown>>;
682
839
  resolution: z.ZodNullable<z.ZodEnum<{
683
840
  dismissed: "dismissed";
@@ -689,32 +846,41 @@ declare const discussionEvents: {
689
846
  }, z.core.$strip>>;
690
847
  digestDue: RuntimeEventDefinition<VersionedDomainEvent<{
691
848
  communityId: string;
692
- period: string;
693
- }, "discussion.digest.due", 1>, {
849
+ from: Date;
850
+ to: Date;
851
+ }, "discussion.digest.due", 2>, {
694
852
  communityId: string;
695
- period: string;
853
+ from: unknown;
854
+ to: unknown;
696
855
  }, z.ZodObject<{
697
856
  communityId: z.ZodString;
698
- period: z.ZodString;
857
+ from: z.ZodCoercedDate<unknown>;
858
+ to: z.ZodCoercedDate<unknown>;
699
859
  }, z.core.$strict>>;
700
860
  };
701
861
  type CommentCreated = EventOf<typeof discussionEvents.commentCreated>;
702
862
  type CommentPublished = EventOf<typeof discussionEvents.commentPublished>;
863
+ type CommentUpdated = EventOf<typeof discussionEvents.commentUpdated>;
864
+ type CommentReactionAdded = EventOf<typeof discussionEvents.commentReactionAdded>;
703
865
  type CommentRemoved = EventOf<typeof discussionEvents.commentRemoved>;
704
866
  type CommentReported = EventOf<typeof discussionEvents.commentReported>;
705
867
  type DiscussionEvent = EventOfValues<typeof discussionEvents>;
706
868
  type PostCreated = EventOf<typeof discussionEvents.postCreated>;
707
869
  type PostUpdated = EventOf<typeof discussionEvents.postUpdated>;
708
870
  type PostPublished = EventOf<typeof discussionEvents.postPublished>;
871
+ type PostReactionAdded = EventOf<typeof discussionEvents.postReactionAdded>;
709
872
  type PostRemoved = EventOf<typeof discussionEvents.postRemoved>;
710
873
  type PostReported = EventOf<typeof discussionEvents.postReported>;
711
874
  type ChatCreated = EventOf<typeof discussionEvents.chatCreated>;
712
875
  type ChatUpdated = EventOf<typeof discussionEvents.chatUpdated>;
713
876
  type ChatParticipantAdded = EventOf<typeof discussionEvents.chatParticipantAdded>;
714
877
  type MessageSent = EventOf<typeof discussionEvents.messageSent>;
878
+ type MessageUpdated = EventOf<typeof discussionEvents.messageUpdated>;
879
+ type MessageReactionAdded = EventOf<typeof discussionEvents.messageReactionAdded>;
715
880
  type MessageDeleted = EventOf<typeof discussionEvents.messageDeleted>;
716
881
  type MessageReported = EventOf<typeof discussionEvents.messageReported>;
882
+ type DigestDue = EventOf<typeof discussionEvents.digestDue>;
717
883
  type NewDiscussionEvent = NewDomainEvent<DiscussionEvent>;
718
884
  //#endregion
719
- export { ChatCreated, ChatParticipantAdded, ChatUpdated, CommentCreated, CommentPublished, CommentRemoved, CommentReported, DiscussionEvent, MessageDeleted, MessageReported, MessageSent, NewDiscussionEvent, PostCreated, PostPublished, PostRemoved, PostReported, PostUpdated, discussionEvents };
885
+ export { ChatCreated, ChatParticipantAdded, ChatUpdated, CommentCreated, CommentPublished, CommentReactionAdded, CommentRemoved, CommentReported, CommentUpdated, DigestDue, DiscussionEvent, MessageDeleted, MessageReactionAdded, MessageReported, MessageSent, MessageUpdated, NewDiscussionEvent, PostCreated, PostPublished, PostReactionAdded, PostRemoved, PostReported, PostUpdated, discussionEvents };
720
886
  //# sourceMappingURL=events.d.ts.map
@@ -1,8 +1,13 @@
1
1
  import { idSchema } from "../types/schemas/shared.js";
2
- import { chatSchema, commentReportSchema, commentSchema, messageFlagSchema, messageSchema, postFlagSchema, postSchema } from "../types/schemas/discussion.js";
2
+ import { chatSchema, commentReportSchema, commentSchema, messageFlagSchema, messageSchema, postFlagSchema, postSchema, reactionEmojiSchema } from "../types/schemas/discussion.js";
3
3
  import { defineEvent } from "../shared/events.js";
4
4
  import { z } from "zod";
5
5
  //#region src/discussion/events.ts
6
+ const mentioned = { mentionedOrgUserIds: z.array(idSchema) };
7
+ const commentEventSchema = commentSchema.extend(mentioned);
8
+ const postEventSchema = postSchema.extend(mentioned);
9
+ const publicPost = postSchema.strip();
10
+ const messageEventSchema = messageSchema.extend(mentioned);
6
11
  const publicComment = commentSchema.pick({
7
12
  id: true,
8
13
  orgId: true,
@@ -47,20 +52,60 @@ const participantAddedSchema = z.object({
47
52
  addedBy: idSchema
48
53
  }).strict();
49
54
  const publicMessage = messageSchema.omit({ body: true }).strip();
55
+ const postReactionAddedSchema = z.object({
56
+ postId: idSchema,
57
+ spaceId: idSchema,
58
+ communityId: idSchema,
59
+ orgUserId: idSchema,
60
+ reaction: reactionEmojiSchema
61
+ }).strict();
62
+ const commentReactionAddedSchema = z.object({
63
+ commentId: idSchema,
64
+ postId: idSchema.nullable(),
65
+ activityId: idSchema.nullable(),
66
+ spaceId: idSchema.nullable(),
67
+ communityId: idSchema.nullable(),
68
+ orgUserId: idSchema,
69
+ reaction: reactionEmojiSchema
70
+ }).strict();
71
+ const messageReactionAddedSchema = z.object({
72
+ messageId: idSchema,
73
+ chatId: idSchema,
74
+ communityId: idSchema,
75
+ orgUserId: idSchema,
76
+ reaction: reactionEmojiSchema
77
+ }).strict();
78
+ const digestDueSchema = z.object({
79
+ communityId: idSchema,
80
+ from: z.coerce.date(),
81
+ to: z.coerce.date()
82
+ }).strict();
50
83
  const publicMessageFlag = messageFlagSchema.omit({ reason: true }).strip();
51
84
  const discussionEvents = {
52
85
  commentCreated: defineEvent({
53
86
  type: "discussion.comment.created",
54
87
  version: 1,
55
- data: commentSchema,
88
+ data: commentEventSchema,
56
89
  publicData: publicComment
57
90
  }),
58
91
  commentPublished: defineEvent({
59
92
  type: "discussion.comment.published",
60
93
  version: 1,
61
- data: commentSchema,
94
+ data: commentEventSchema,
95
+ publicData: publicComment
96
+ }),
97
+ commentUpdated: defineEvent({
98
+ type: "discussion.comment.updated",
99
+ version: 1,
100
+ data: commentEventSchema,
62
101
  publicData: publicComment
63
102
  }),
103
+ commentReactionAdded: defineEvent({
104
+ type: "discussion.comment.reaction.added",
105
+ version: 1,
106
+ data: commentReactionAddedSchema,
107
+ publicData: commentReactionAddedSchema
108
+ }),
64
109
  commentRemoved: defineEvent({
65
110
  type: "discussion.comment.removed",
66
111
  version: 1,
@@ -82,14 +127,20 @@ const discussionEvents = {
82
127
  postUpdated: defineEvent({
83
128
  type: "discussion.post.updated",
84
129
  version: 1,
85
- data: postSchema,
86
- publicData: postSchema
130
+ data: postEventSchema,
131
+ publicData: publicPost
87
132
  }),
88
133
  postPublished: defineEvent({
89
134
  type: "discussion.post.published",
90
135
  version: 1,
91
- data: postSchema,
92
- publicData: postSchema
136
+ data: postEventSchema,
137
+ publicData: publicPost
138
+ }),
139
+ postReactionAdded: defineEvent({
140
+ type: "discussion.post.reaction.added",
141
+ version: 1,
142
+ data: postReactionAddedSchema,
143
+ publicData: postReactionAddedSchema
93
144
  }),
94
145
  postRemoved: defineEvent({
95
146
  type: "discussion.post.removed",
@@ -124,9 +175,21 @@ const discussionEvents = {
124
175
  messageSent: defineEvent({
125
176
  type: "discussion.message.sent",
126
177
  version: 1,
127
- data: messageSchema,
178
+ data: messageEventSchema,
179
+ publicData: publicMessage
180
+ }),
181
+ messageUpdated: defineEvent({
182
+ type: "discussion.message.updated",
183
+ version: 1,
184
+ data: messageEventSchema,
128
185
  publicData: publicMessage
129
186
  }),
187
+ messageReactionAdded: defineEvent({
188
+ type: "discussion.message.reaction.added",
189
+ version: 1,
190
+ data: messageReactionAddedSchema,
191
+ publicData: messageReactionAddedSchema
192
+ }),
130
193
  messageDeleted: defineEvent({
131
194
  type: "discussion.message.deleted",
132
195
  version: 1,
@@ -141,15 +204,9 @@ const discussionEvents = {
141
204
  }),
142
205
  digestDue: defineEvent({
143
206
  type: "discussion.digest.due",
144
- version: 1,
145
- data: z.object({
146
- communityId: idSchema,
147
- period: z.string().min(1)
148
- }).strict(),
149
- publicData: z.object({
150
- communityId: idSchema,
151
- period: z.string().min(1)
152
- }).strict()
207
+ version: 2,
208
+ data: digestDueSchema,
209
+ publicData: digestDueSchema
153
210
  })
154
211
  };
155
212
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"events.js","names":[],"sources":["../../src/discussion/events.ts"],"sourcesContent":["import { z } from 'zod';\nimport {\n chatSchema,\n commentReportSchema,\n commentSchema,\n idSchema,\n messageFlagSchema,\n messageSchema,\n postFlagSchema,\n postSchema,\n} from '../types/schemas/index.js';\nimport {\n defineEvent,\n type EventOf,\n type EventOfValues,\n type NewDomainEvent,\n} from '../shared/ports.js';\n\nconst publicComment = commentSchema\n .pick({\n id: true,\n orgId: true,\n activityId: true,\n postId: true,\n communityId: true,\n parentId: true,\n orgUserId: true,\n body: true,\n status: true,\n removedBy: true,\n createdAt: true,\n updatedAt: true,\n })\n .strip();\n\nconst reportedComment = commentReportSchema.extend({ communityId: idSchema.nullable() });\nconst publicCommentReport = reportedComment\n .pick({\n id: true,\n orgId: true,\n communityId: true,\n commentId: true,\n orgUserId: true,\n reason: true,\n resolvedAt: true,\n createdAt: true,\n updatedAt: true,\n })\n .strip();\nconst reportedPost = postFlagSchema.extend({ communityId: idSchema });\n\nconst chatEventSchema = chatSchema.extend({\n participantIds: z.array(idSchema),\n});\n\nconst publicChat = chatEventSchema\n .pick({\n id: true,\n orgId: true,\n communityId: true,\n kind: true,\n status: true,\n createdBy: true,\n participantIds: true,\n })\n .strip();\n\nconst participantAddedSchema = z\n .object({\n chatId: idSchema,\n communityId: idSchema,\n orgUserId: idSchema,\n addedBy: idSchema,\n })\n .strict();\n\nconst publicMessage = messageSchema.omit({ body: true }).strip();\nconst publicMessageFlag = messageFlagSchema.omit({ reason: true }).strip();\n\nexport const discussionEvents = {\n commentCreated: defineEvent({\n type: 'discussion.comment.created',\n version: 1,\n data: commentSchema,\n publicData: publicComment,\n }),\n commentPublished: defineEvent({\n type: 'discussion.comment.published',\n version: 1,\n data: commentSchema,\n publicData: publicComment,\n }),\n commentRemoved: defineEvent({\n type: 'discussion.comment.removed',\n version: 1,\n data: commentSchema,\n publicData: publicComment,\n }),\n commentReported: defineEvent({\n type: 'discussion.comment.reported',\n version: 1,\n data: reportedComment,\n publicData: publicCommentReport,\n }),\n postCreated: defineEvent({\n type: 'discussion.post.created',\n version: 1,\n data: postSchema,\n publicData: postSchema,\n }),\n postUpdated: defineEvent({\n type: 'discussion.post.updated',\n version: 1,\n data: postSchema,\n publicData: postSchema,\n }),\n postPublished: defineEvent({\n type: 'discussion.post.published',\n version: 1,\n data: postSchema,\n publicData: postSchema,\n }),\n postRemoved: defineEvent({\n type: 'discussion.post.removed',\n version: 1,\n data: postSchema,\n publicData: postSchema,\n }),\n postReported: defineEvent({\n type: 'discussion.post.reported',\n version: 1,\n data: reportedPost,\n publicData: reportedPost,\n }),\n chatCreated: defineEvent({\n type: 'discussion.chat.created',\n version: 1,\n data: chatEventSchema,\n publicData: publicChat,\n }),\n chatUpdated: defineEvent({\n type: 'discussion.chat.updated',\n version: 1,\n data: chatEventSchema,\n publicData: publicChat,\n }),\n chatParticipantAdded: defineEvent({\n type: 'discussion.chat.participant.added',\n version: 1,\n data: participantAddedSchema,\n publicData: participantAddedSchema,\n }),\n messageSent: defineEvent({\n type: 'discussion.message.sent',\n version: 1,\n data: messageSchema,\n publicData: publicMessage,\n }),\n messageDeleted: defineEvent({\n type: 'discussion.message.deleted',\n version: 1,\n data: messageSchema,\n publicData: publicMessage,\n }),\n messageReported: defineEvent({\n type: 'discussion.message.reported',\n version: 1,\n data: messageFlagSchema,\n publicData: publicMessageFlag,\n }),\n digestDue: defineEvent({\n type: 'discussion.digest.due',\n version: 1,\n data: z.object({ communityId: idSchema, period: z.string().min(1) }).strict(),\n publicData: z.object({ communityId: idSchema, period: z.string().min(1) }).strict(),\n }),\n};\n\nexport type CommentCreated = EventOf<typeof discussionEvents.commentCreated>;\nexport type CommentPublished = EventOf<typeof discussionEvents.commentPublished>;\nexport type CommentRemoved = EventOf<typeof discussionEvents.commentRemoved>;\nexport type CommentReported = EventOf<typeof discussionEvents.commentReported>;\nexport type DiscussionEvent = EventOfValues<typeof discussionEvents>;\nexport type PostCreated = EventOf<typeof discussionEvents.postCreated>;\nexport type PostUpdated = EventOf<typeof discussionEvents.postUpdated>;\nexport type PostPublished = EventOf<typeof discussionEvents.postPublished>;\nexport type PostRemoved = EventOf<typeof discussionEvents.postRemoved>;\nexport type PostReported = EventOf<typeof discussionEvents.postReported>;\nexport type ChatCreated = EventOf<typeof discussionEvents.chatCreated>;\nexport type ChatUpdated = EventOf<typeof discussionEvents.chatUpdated>;\nexport type ChatParticipantAdded = EventOf<typeof discussionEvents.chatParticipantAdded>;\nexport type MessageSent = EventOf<typeof discussionEvents.messageSent>;\nexport type MessageDeleted = EventOf<typeof discussionEvents.messageDeleted>;\nexport type MessageReported = EventOf<typeof discussionEvents.messageReported>;\nexport type NewDiscussionEvent = NewDomainEvent<DiscussionEvent>;\n"],"mappings":";;;;;AAkBA,MAAM,gBAAgB,cACnB,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,YAAY;CACZ,QAAQ;CACR,aAAa;CACb,UAAU;CACV,WAAW;CACX,MAAM;CACN,QAAQ;CACR,WAAW;CACX,WAAW;CACX,WAAW;AACb,CAAC,CAAC,CACD,MAAM;AAET,MAAM,kBAAkB,oBAAoB,OAAO,EAAE,aAAa,SAAS,SAAS,EAAE,CAAC;AACvF,MAAM,sBAAsB,gBACzB,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aAAa;CACb,WAAW;CACX,WAAW;CACX,QAAQ;CACR,YAAY;CACZ,WAAW;CACX,WAAW;AACb,CAAC,CAAC,CACD,MAAM;AACT,MAAM,eAAe,eAAe,OAAO,EAAE,aAAa,SAAS,CAAC;AAEpE,MAAM,kBAAkB,WAAW,OAAO,EACxC,gBAAgB,EAAE,MAAM,QAAQ,EAClC,CAAC;AAED,MAAM,aAAa,gBAChB,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aAAa;CACb,MAAM;CACN,QAAQ;CACR,WAAW;CACX,gBAAgB;AAClB,CAAC,CAAC,CACD,MAAM;AAET,MAAM,yBAAyB,EAC5B,OAAO;CACN,QAAQ;CACR,aAAa;CACb,WAAW;CACX,SAAS;AACX,CAAC,CAAC,CACD,OAAO;AAEV,MAAM,gBAAgB,cAAc,KAAK,EAAE,MAAM,KAAK,CAAC,CAAC,CAAC,MAAM;AAC/D,MAAM,oBAAoB,kBAAkB,KAAK,EAAE,QAAQ,KAAK,CAAC,CAAC,CAAC,MAAM;AAEzE,MAAa,mBAAmB;CAC9B,gBAAgB,YAAY;EAC1B,MAAM;EACN,SAAS;EACT,MAAM;EACN,YAAY;CACd,CA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QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;EAAE,CAAC,CAAC,CAAC,OAAO;CACpF,CAAC;AACH"}
1
+ {"version":3,"file":"events.js","names":[],"sources":["../../src/discussion/events.ts"],"sourcesContent":["import { z } from 'zod';\nimport {\n chatSchema,\n commentReportSchema,\n commentSchema,\n idSchema,\n messageFlagSchema,\n messageSchema,\n postFlagSchema,\n postSchema,\n reactionEmojiSchema,\n} from '../types/schemas/index.js';\nimport {\n defineEvent,\n type EventOf,\n type EventOfValues,\n type NewDomainEvent,\n} from '../shared/ports.js';\n\nconst mentioned = { mentionedOrgUserIds: z.array(idSchema) };\nconst commentEventSchema = commentSchema.extend(mentioned);\nconst postEventSchema = postSchema.extend(mentioned);\nconst publicPost = postSchema.strip();\nconst messageEventSchema = messageSchema.extend(mentioned);\n\nconst publicComment = commentSchema\n .pick({\n id: true,\n orgId: true,\n activityId: true,\n postId: true,\n communityId: true,\n parentId: true,\n orgUserId: true,\n body: true,\n status: true,\n removedBy: true,\n createdAt: true,\n updatedAt: true,\n })\n .strip();\n\nconst reportedComment = commentReportSchema.extend({ communityId: idSchema.nullable() });\nconst publicCommentReport = reportedComment\n .pick({\n id: true,\n orgId: true,\n communityId: true,\n commentId: true,\n orgUserId: true,\n reason: true,\n resolvedAt: true,\n createdAt: true,\n updatedAt: true,\n })\n .strip();\nconst reportedPost = postFlagSchema.extend({ communityId: idSchema });\n\nconst chatEventSchema = chatSchema.extend({\n participantIds: z.array(idSchema),\n});\n\nconst publicChat = chatEventSchema\n .pick({\n id: true,\n orgId: true,\n communityId: true,\n kind: true,\n status: true,\n createdBy: true,\n participantIds: true,\n })\n .strip();\n\nconst participantAddedSchema = z\n .object({\n chatId: idSchema,\n communityId: idSchema,\n orgUserId: idSchema,\n addedBy: idSchema,\n })\n .strict();\n\nconst publicMessage = messageSchema.omit({ body: true }).strip();\n\nconst postReactionAddedSchema = z\n .object({\n postId: idSchema,\n spaceId: idSchema,\n communityId: idSchema,\n orgUserId: idSchema,\n reaction: reactionEmojiSchema,\n })\n .strict();\n\nconst commentReactionAddedSchema = z\n .object({\n commentId: idSchema,\n postId: idSchema.nullable(),\n activityId: idSchema.nullable(),\n spaceId: idSchema.nullable(),\n communityId: idSchema.nullable(),\n orgUserId: idSchema,\n reaction: reactionEmojiSchema,\n })\n .strict();\n\nconst messageReactionAddedSchema = z\n .object({\n messageId: idSchema,\n chatId: idSchema,\n communityId: idSchema,\n orgUserId: idSchema,\n reaction: reactionEmojiSchema,\n })\n .strict();\n\nconst digestDueSchema = z\n .object({ communityId: idSchema, from: z.coerce.date(), to: z.coerce.date() })\n .strict();\nconst publicMessageFlag = messageFlagSchema.omit({ reason: true }).strip();\n\nexport const discussionEvents = {\n commentCreated: defineEvent({\n type: 'discussion.comment.created',\n version: 1,\n data: commentEventSchema,\n publicData: publicComment,\n }),\n commentPublished: defineEvent({\n type: 'discussion.comment.published',\n version: 1,\n data: commentEventSchema,\n publicData: publicComment,\n }),\n commentUpdated: defineEvent({\n type: 'discussion.comment.updated',\n version: 1,\n data: commentEventSchema,\n publicData: publicComment,\n }),\n commentReactionAdded: defineEvent({\n type: 'discussion.comment.reaction.added',\n version: 1,\n data: commentReactionAddedSchema,\n publicData: commentReactionAddedSchema,\n }),\n commentRemoved: defineEvent({\n type: 'discussion.comment.removed',\n version: 1,\n data: commentSchema,\n publicData: publicComment,\n }),\n commentReported: defineEvent({\n type: 'discussion.comment.reported',\n version: 1,\n data: reportedComment,\n publicData: publicCommentReport,\n }),\n postCreated: defineEvent({\n type: 'discussion.post.created',\n version: 1,\n data: postSchema,\n publicData: postSchema,\n }),\n postUpdated: defineEvent({\n type: 'discussion.post.updated',\n version: 1,\n data: postEventSchema,\n publicData: publicPost,\n }),\n postPublished: defineEvent({\n type: 'discussion.post.published',\n version: 1,\n data: postEventSchema,\n publicData: publicPost,\n }),\n postReactionAdded: defineEvent({\n type: 'discussion.post.reaction.added',\n version: 1,\n data: postReactionAddedSchema,\n publicData: postReactionAddedSchema,\n }),\n postRemoved: defineEvent({\n type: 'discussion.post.removed',\n version: 1,\n data: postSchema,\n publicData: postSchema,\n }),\n postReported: defineEvent({\n type: 'discussion.post.reported',\n version: 1,\n data: reportedPost,\n publicData: reportedPost,\n }),\n chatCreated: defineEvent({\n type: 'discussion.chat.created',\n version: 1,\n data: chatEventSchema,\n publicData: publicChat,\n }),\n chatUpdated: defineEvent({\n type: 'discussion.chat.updated',\n version: 1,\n data: chatEventSchema,\n publicData: publicChat,\n }),\n chatParticipantAdded: defineEvent({\n type: 'discussion.chat.participant.added',\n version: 1,\n data: participantAddedSchema,\n publicData: participantAddedSchema,\n }),\n messageSent: defineEvent({\n type: 'discussion.message.sent',\n version: 1,\n data: messageEventSchema,\n publicData: publicMessage,\n }),\n messageUpdated: defineEvent({\n type: 'discussion.message.updated',\n version: 1,\n data: messageEventSchema,\n publicData: publicMessage,\n }),\n messageReactionAdded: defineEvent({\n type: 'discussion.message.reaction.added',\n version: 1,\n data: messageReactionAddedSchema,\n publicData: messageReactionAddedSchema,\n }),\n messageDeleted: defineEvent({\n type: 'discussion.message.deleted',\n version: 1,\n data: messageSchema,\n publicData: publicMessage,\n }),\n messageReported: defineEvent({\n type: 'discussion.message.reported',\n version: 1,\n data: messageFlagSchema,\n publicData: publicMessageFlag,\n }),\n digestDue: defineEvent({\n type: 'discussion.digest.due',\n version: 2,\n data: digestDueSchema,\n publicData: digestDueSchema,\n }),\n};\n\nexport type CommentCreated = EventOf<typeof discussionEvents.commentCreated>;\nexport type CommentPublished = EventOf<typeof discussionEvents.commentPublished>;\nexport type CommentUpdated = EventOf<typeof discussionEvents.commentUpdated>;\nexport type CommentReactionAdded = EventOf<typeof discussionEvents.commentReactionAdded>;\nexport type CommentRemoved = EventOf<typeof discussionEvents.commentRemoved>;\nexport type CommentReported = EventOf<typeof discussionEvents.commentReported>;\nexport type DiscussionEvent = EventOfValues<typeof discussionEvents>;\nexport type PostCreated = EventOf<typeof discussionEvents.postCreated>;\nexport type PostUpdated = EventOf<typeof discussionEvents.postUpdated>;\nexport type PostPublished = EventOf<typeof discussionEvents.postPublished>;\nexport type PostReactionAdded = EventOf<typeof discussionEvents.postReactionAdded>;\nexport type PostRemoved = EventOf<typeof discussionEvents.postRemoved>;\nexport type PostReported = EventOf<typeof discussionEvents.postReported>;\nexport type ChatCreated = EventOf<typeof discussionEvents.chatCreated>;\nexport type ChatUpdated = EventOf<typeof discussionEvents.chatUpdated>;\nexport type ChatParticipantAdded = EventOf<typeof discussionEvents.chatParticipantAdded>;\nexport type MessageSent = EventOf<typeof discussionEvents.messageSent>;\nexport type MessageUpdated = EventOf<typeof discussionEvents.messageUpdated>;\nexport type MessageReactionAdded = EventOf<typeof discussionEvents.messageReactionAdded>;\nexport type MessageDeleted = EventOf<typeof discussionEvents.messageDeleted>;\nexport type MessageReported = EventOf<typeof discussionEvents.messageReported>;\nexport type DigestDue = EventOf<typeof discussionEvents.digestDue>;\nexport type NewDiscussionEvent = NewDomainEvent<DiscussionEvent>;\n"],"mappings":";;;;;AAmBA,MAAM,YAAY,EAAE,qBAAqB,EAAE,MAAM,QAAQ,EAAE;AAC3D,MAAM,qBAAqB,cAAc,OAAO,SAAS;AACzD,MAAM,kBAAkB,WAAW,OAAO,SAAS;AACnD,MAAM,aAAa,WAAW,MAAM;AACpC,MAAM,qBAAqB,cAAc,OAAO,SAAS;AAEzD,MAAM,gBAAgB,cACnB,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,YAAY;CACZ,QAAQ;CACR,aAAa;CACb,UAAU;CACV,WAAW;CACX,MAAM;CACN,QAAQ;CACR,WAAW;CACX,WAAW;CACX,WAAW;AACb,CAAC,CAAC,CACD,MAAM;AAET,MAAM,kBAAkB,oBAAoB,OAAO,EAAE,aAAa,SAAS,SAAS,EAAE,CAAC;AACvF,MAAM,sBAAsB,gBACzB,KAAK;CACJ,IAAI;CACJ,OAAO;CACP,aAAa;CACb,WAAW;CACX,WAAW;CACX,QAAQ;CACR,YAAY;CACZ,WAA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T,MAAM;EACN,YAAY;CACd,CAAC;CACD,gBAAgB,YAAY;EAC1B,MAAM;EACN,SAAS;EACT,MAAM;EACN,YAAY;CACd,CAAC;CACD,iBAAiB,YAAY;EAC3B,MAAM;EACN,SAAS;EACT,MAAM;EACN,YAAY;CACd,CAAC;CACD,WAAW,YAAY;EACrB,MAAM;EACN,SAAS;EACT,MAAM;EACN,YAAY;CACd,CAAC;AACH"}
@@ -3,10 +3,15 @@ import { Comment, CommentAuthor, CommentReport } from "../types/discussion.js";
3
3
  import { Actor } from "../shared/actor.js";
4
4
  import "./model.js";
5
5
  import "./types.js";
6
- import { ActivityComments, AuthorProfileReader, AuthorRecord, AuthorRoleReader, BookmarkQuery, ChatListItem, ChatRepository, ChatService, ChatUnitOfWork, ChatWriteScope, CommentReactions, CommentWithContext, ContentAccessReader, CreatePostInput, DiscussionRepository, DiscussionService, DiscussionUnitOfWork, DiscussionWriteScope, FeedQuery, MessageQueue, MessageReactions, PageQuery, PostCommentInput, PostCommentReader, PostPatch, PostReactions, PostRepository, PostService, PostThreadsQuery, PostUnitOfWork, PostWriteScope, SendMessageInput, SpaceModerationQueue, StartDirectInput, StartGroupInput, UpdatePostInput } from "./ports.js";
6
+ import { ActivityComments, AuthorProfileReader, AuthorRecord, AuthorRoleReader, BookmarkQuery, ChatInboxRow, ChatListItem, ChatRepository, ChatService, ChatUnitOfWork, ChatUnread, ChatWriteScope, CommentReactions, CommentWithContext, ContentAccessReader, CreatePostInput, DigestRunRepository, DigestScheduleReader, DigestService, DigestUnitOfWork, DigestWriteScope, DiscussionRepository, DiscussionService, DiscussionUnitOfWork, DiscussionWriteScope, FeedQuery, ItemTitle, ItemTitles, MentionsRepository, MessageQueue, MessageReactions, MuteInput, PageQuery, PostCommentInput, PostCommentReader, PostGuard, PostPatch, PostReactions, PostRepository, PostService, PostThreadsQuery, PostUnitOfWork, PostWriteScope, PublishedPost, SendMessageInput, SpaceModerationQueue, StartDirectInput, StartGroupInput, SubscriptionInput, SubscriptionService, SubscriptionsRepository, UpdatePostInput } from "./ports.js";
7
7
  import { authorView } from "./authors.js";
8
8
  import { ChatServiceImpl } from "./chats.js";
9
+ import { DigestServiceImpl, latestDueAt } from "./digests.js";
9
10
  import { DiscussionEvent, discussionEvents } from "./events.js";
10
11
  import { DEFAULT_SETTINGS, DiscussionServiceImpl } from "./service.js";
11
12
  import { PostServiceImpl } from "./posts.js";
12
- export { type ActivityComments, type Actor, type AuthorProfileReader, type AuthorRecord, type AuthorRoleReader, type BookmarkQuery, type ChatListItem, type ChatRepository, type ChatService, ChatServiceImpl, type ChatUnitOfWork, type ChatWriteScope, type Comment, type CommentAuthor, type CommentListItem, type CommentReaction, type CommentReactions, type CommentReport, type CommentReportSummary, type CommentSettings, type CommentStatus, type CommentView, type CommentWithContext, type CommentsConfig, type ContentAccessReader, type CreatePostInput, DEFAULT_SETTINGS, type DiscussionEvent, type DiscussionRepository, type DiscussionService, DiscussionServiceImpl, type DiscussionUnitOfWork, type DiscussionWriteScope, type FeedQuery, type ListCommentsQuery, type MessageQueue, type MessageReactions, type PageQuery, type PostCommentInput, type PostCommentReader, type PostPatch, type PostReactions, type PostRepository, type PostService, PostServiceImpl, type PostThreadsQuery, type PostUnitOfWork, type PostWriteScope, type ReactionCounts, type ReactionEmoji, type SendMessageInput, type SpaceModerationQueue, type StartDirectInput, type StartGroupInput, type UpdatePostInput, authorView, discussionEvents };
13
+ import { SubscriptionServiceImpl, activeSubscription } from "./subscriptions.js";
14
+ import { nameMentions } from "./mentions.js";
15
+ import { DiscussionItemTitles } from "./titles.js";
16
+ import { DIGEST_OPEN_JOB, POST_PUBLISH_JOB, discussionJobs, discussionRecurringJobs } from "./jobs.js";
17
+ export { type ActivityComments, type Actor, type AuthorProfileReader, type AuthorRecord, type AuthorRoleReader, type BookmarkQuery, type ChatInboxRow, type ChatListItem, type ChatRepository, type ChatService, ChatServiceImpl, type ChatUnitOfWork, type ChatUnread, type ChatWriteScope, type Comment, type CommentAuthor, type CommentListItem, type CommentReaction, type CommentReactions, type CommentReport, type CommentReportSummary, type CommentSettings, type CommentStatus, type CommentView, type CommentWithContext, type CommentsConfig, type ContentAccessReader, type CreatePostInput, DEFAULT_SETTINGS, DIGEST_OPEN_JOB, type DigestRunRepository, type DigestScheduleReader, type DigestService, DigestServiceImpl, type DigestUnitOfWork, type DigestWriteScope, type DiscussionEvent, DiscussionItemTitles, type DiscussionRepository, type DiscussionService, DiscussionServiceImpl, type DiscussionUnitOfWork, type DiscussionWriteScope, type FeedQuery, type ItemTitle, type ItemTitles, type ListCommentsQuery, type MentionsRepository, type MessageQueue, type MessageReactions, type MuteInput, POST_PUBLISH_JOB, type PageQuery, type PostCommentInput, type PostCommentReader, type PostGuard, type PostPatch, type PostReactions, type PostRepository, type PostService, PostServiceImpl, type PostThreadsQuery, type PostUnitOfWork, type PostWriteScope, type PublishedPost, type ReactionCounts, type ReactionEmoji, type SendMessageInput, type SpaceModerationQueue, type StartDirectInput, type StartGroupInput, type SubscriptionInput, type SubscriptionService, SubscriptionServiceImpl, type SubscriptionsRepository, type UpdatePostInput, activeSubscription, authorView, discussionEvents, discussionJobs, discussionRecurringJobs, latestDueAt, nameMentions };
@@ -1,6 +1,11 @@
1
1
  import { discussionEvents } from "./events.js";
2
2
  import { authorView } from "./authors.js";
3
+ import { nameMentions } from "./mentions.js";
3
4
  import { DEFAULT_SETTINGS, DiscussionServiceImpl } from "./service.js";
5
+ import { DIGEST_OPEN_JOB, POST_PUBLISH_JOB, discussionJobs, discussionRecurringJobs } from "./jobs.js";
6
+ import { SubscriptionServiceImpl, activeSubscription } from "./subscriptions.js";
4
7
  import { PostServiceImpl } from "./posts.js";
8
+ import { DigestServiceImpl, latestDueAt } from "./digests.js";
5
9
  import { ChatServiceImpl } from "./chats.js";
6
- export { ChatServiceImpl, DEFAULT_SETTINGS, DiscussionServiceImpl, PostServiceImpl, authorView, discussionEvents };
10
+ import { DiscussionItemTitles } from "./titles.js";
11
+ export { ChatServiceImpl, DEFAULT_SETTINGS, DIGEST_OPEN_JOB, DigestServiceImpl, DiscussionItemTitles, DiscussionServiceImpl, POST_PUBLISH_JOB, PostServiceImpl, SubscriptionServiceImpl, activeSubscription, authorView, discussionEvents, discussionJobs, discussionRecurringJobs, latestDueAt, nameMentions };
@@ -0,0 +1,16 @@
1
+ import { Logger } from "../types/ports.js";
2
+ import { RecurringJob, ScheduledJob } from "../shared/ports.js";
3
+ import { DigestService, PostService } from "./ports.js";
4
+ //#region src/discussion/jobs.d.ts
5
+ declare const POST_PUBLISH_JOB = "discussion.post.publish";
6
+ declare const DIGEST_OPEN_JOB = "discussion.digest.open";
7
+ interface DiscussionJobDeps {
8
+ posts: Pick<PostService, 'publishScheduled'>;
9
+ digests: Pick<DigestService, 'openDue'>;
10
+ logger?: Logger;
11
+ }
12
+ declare function discussionJobs(deps: DiscussionJobDeps): ScheduledJob[];
13
+ declare const discussionRecurringJobs: RecurringJob[];
14
+ //#endregion
15
+ export { DIGEST_OPEN_JOB, DiscussionJobDeps, POST_PUBLISH_JOB, discussionJobs, discussionRecurringJobs };
16
+ //# sourceMappingURL=jobs.d.ts.map