@contractspec/module.learning-journey 1.44.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 (85) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +200 -0
  3. package/dist/contracts/index.d.ts +5 -0
  4. package/dist/contracts/index.js +6 -0
  5. package/dist/contracts/models.d.ts +451 -0
  6. package/dist/contracts/models.d.ts.map +1 -0
  7. package/dist/contracts/models.js +388 -0
  8. package/dist/contracts/models.js.map +1 -0
  9. package/dist/contracts/onboarding.d.ts +666 -0
  10. package/dist/contracts/onboarding.d.ts.map +1 -0
  11. package/dist/contracts/onboarding.js +402 -0
  12. package/dist/contracts/onboarding.js.map +1 -0
  13. package/dist/contracts/operations.d.ts +280 -0
  14. package/dist/contracts/operations.d.ts.map +1 -0
  15. package/dist/contracts/operations.js +151 -0
  16. package/dist/contracts/operations.js.map +1 -0
  17. package/dist/contracts/shared.d.ts +5 -0
  18. package/dist/contracts/shared.d.ts.map +1 -0
  19. package/dist/contracts/shared.js +6 -0
  20. package/dist/contracts/shared.js.map +1 -0
  21. package/dist/docs/index.d.ts +1 -0
  22. package/dist/docs/index.js +1 -0
  23. package/dist/docs/learning-journey.docblock.d.ts +1 -0
  24. package/dist/docs/learning-journey.docblock.js +136 -0
  25. package/dist/docs/learning-journey.docblock.js.map +1 -0
  26. package/dist/engines/index.d.ts +4 -0
  27. package/dist/engines/index.js +5 -0
  28. package/dist/engines/srs.d.ts +111 -0
  29. package/dist/engines/srs.d.ts.map +1 -0
  30. package/dist/engines/srs.js +219 -0
  31. package/dist/engines/srs.js.map +1 -0
  32. package/dist/engines/streak.d.ts +100 -0
  33. package/dist/engines/streak.d.ts.map +1 -0
  34. package/dist/engines/streak.js +194 -0
  35. package/dist/engines/streak.js.map +1 -0
  36. package/dist/engines/xp.d.ts +97 -0
  37. package/dist/engines/xp.d.ts.map +1 -0
  38. package/dist/engines/xp.js +213 -0
  39. package/dist/engines/xp.js.map +1 -0
  40. package/dist/entities/ai.d.ts +232 -0
  41. package/dist/entities/ai.d.ts.map +1 -0
  42. package/dist/entities/ai.js +376 -0
  43. package/dist/entities/ai.js.map +1 -0
  44. package/dist/entities/course.d.ts +184 -0
  45. package/dist/entities/course.d.ts.map +1 -0
  46. package/dist/entities/course.js +316 -0
  47. package/dist/entities/course.js.map +1 -0
  48. package/dist/entities/flashcard.d.ts +170 -0
  49. package/dist/entities/flashcard.d.ts.map +1 -0
  50. package/dist/entities/flashcard.js +249 -0
  51. package/dist/entities/flashcard.js.map +1 -0
  52. package/dist/entities/gamification.d.ts +238 -0
  53. package/dist/entities/gamification.d.ts.map +1 -0
  54. package/dist/entities/gamification.js +392 -0
  55. package/dist/entities/gamification.js.map +1 -0
  56. package/dist/entities/index.d.ts +629 -0
  57. package/dist/entities/index.d.ts.map +1 -0
  58. package/dist/entities/index.js +45 -0
  59. package/dist/entities/index.js.map +1 -0
  60. package/dist/entities/learner.d.ts +224 -0
  61. package/dist/entities/learner.d.ts.map +1 -0
  62. package/dist/entities/learner.js +365 -0
  63. package/dist/entities/learner.js.map +1 -0
  64. package/dist/entities/onboarding.d.ts +190 -0
  65. package/dist/entities/onboarding.d.ts.map +1 -0
  66. package/dist/entities/onboarding.js +307 -0
  67. package/dist/entities/onboarding.js.map +1 -0
  68. package/dist/entities/quiz.d.ts +220 -0
  69. package/dist/entities/quiz.d.ts.map +1 -0
  70. package/dist/entities/quiz.js +370 -0
  71. package/dist/entities/quiz.js.map +1 -0
  72. package/dist/events.d.ts +796 -0
  73. package/dist/events.d.ts.map +1 -0
  74. package/dist/events.js +690 -0
  75. package/dist/events.js.map +1 -0
  76. package/dist/index.d.ts +20 -0
  77. package/dist/index.js +22 -0
  78. package/dist/learning-journey.feature.d.ts +12 -0
  79. package/dist/learning-journey.feature.d.ts.map +1 -0
  80. package/dist/learning-journey.feature.js +150 -0
  81. package/dist/learning-journey.feature.js.map +1 -0
  82. package/dist/track-spec.d.ts +129 -0
  83. package/dist/track-spec.d.ts.map +1 -0
  84. package/dist/track-spec.js +0 -0
  85. package/package.json +98 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","names":[],"sources":["../src/events.ts"],"sourcesContent":[],"mappings":"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"}
package/dist/events.js ADDED
@@ -0,0 +1,690 @@
1
+ import { LEARNING_JOURNEY_OWNERS } from "./contracts/shared.js";
2
+ import { ScalarTypeEnum, defineSchemaModel } from "@contractspec/lib.schema";
3
+ import { defineEvent } from "@contractspec/lib.contracts";
4
+
5
+ //#region src/events.ts
6
+ const CoursePublishedPayload = defineSchemaModel({
7
+ name: "CoursePublishedEventPayload",
8
+ description: "Payload when a course is published",
9
+ fields: {
10
+ courseId: {
11
+ type: ScalarTypeEnum.String_unsecure(),
12
+ isOptional: false
13
+ },
14
+ title: {
15
+ type: ScalarTypeEnum.String_unsecure(),
16
+ isOptional: false
17
+ },
18
+ authorId: {
19
+ type: ScalarTypeEnum.String_unsecure(),
20
+ isOptional: false
21
+ },
22
+ publishedAt: {
23
+ type: ScalarTypeEnum.DateTime(),
24
+ isOptional: false
25
+ }
26
+ }
27
+ });
28
+ const CoursePublishedEvent = defineEvent({
29
+ meta: {
30
+ key: "course.published",
31
+ version: 1,
32
+ description: "A course has been published.",
33
+ stability: "stable",
34
+ owners: [...LEARNING_JOURNEY_OWNERS],
35
+ tags: ["learning", "course"]
36
+ },
37
+ payload: CoursePublishedPayload
38
+ });
39
+ const EnrollmentCreatedPayload = defineSchemaModel({
40
+ name: "EnrollmentCreatedEventPayload",
41
+ description: "Payload when a learner enrolls in a course",
42
+ fields: {
43
+ enrollmentId: {
44
+ type: ScalarTypeEnum.String_unsecure(),
45
+ isOptional: false
46
+ },
47
+ learnerId: {
48
+ type: ScalarTypeEnum.String_unsecure(),
49
+ isOptional: false
50
+ },
51
+ courseId: {
52
+ type: ScalarTypeEnum.String_unsecure(),
53
+ isOptional: false
54
+ },
55
+ enrolledAt: {
56
+ type: ScalarTypeEnum.DateTime(),
57
+ isOptional: false
58
+ }
59
+ }
60
+ });
61
+ const EnrollmentCreatedEvent = defineEvent({
62
+ meta: {
63
+ key: "enrollment.created",
64
+ version: 1,
65
+ description: "A learner has enrolled in a course.",
66
+ stability: "stable",
67
+ owners: [...LEARNING_JOURNEY_OWNERS],
68
+ tags: ["learning", "enrollment"]
69
+ },
70
+ payload: EnrollmentCreatedPayload
71
+ });
72
+ const LessonCompletedPayload = defineSchemaModel({
73
+ name: "LessonCompletedEventPayload",
74
+ description: "Payload when a lesson is completed",
75
+ fields: {
76
+ learnerId: {
77
+ type: ScalarTypeEnum.String_unsecure(),
78
+ isOptional: false
79
+ },
80
+ lessonId: {
81
+ type: ScalarTypeEnum.String_unsecure(),
82
+ isOptional: false
83
+ },
84
+ courseId: {
85
+ type: ScalarTypeEnum.String_unsecure(),
86
+ isOptional: false
87
+ },
88
+ score: {
89
+ type: ScalarTypeEnum.Int_unsecure(),
90
+ isOptional: true
91
+ },
92
+ xpEarned: {
93
+ type: ScalarTypeEnum.Int_unsecure(),
94
+ isOptional: false
95
+ },
96
+ timeSpent: {
97
+ type: ScalarTypeEnum.Int_unsecure(),
98
+ isOptional: false
99
+ },
100
+ completedAt: {
101
+ type: ScalarTypeEnum.DateTime(),
102
+ isOptional: false
103
+ }
104
+ }
105
+ });
106
+ const LessonCompletedEvent = defineEvent({
107
+ meta: {
108
+ key: "lesson.completed",
109
+ version: 1,
110
+ description: "A learner has completed a lesson.",
111
+ stability: "stable",
112
+ owners: [...LEARNING_JOURNEY_OWNERS],
113
+ tags: [
114
+ "learning",
115
+ "progress",
116
+ "lesson"
117
+ ]
118
+ },
119
+ payload: LessonCompletedPayload
120
+ });
121
+ const CourseCompletedPayload = defineSchemaModel({
122
+ name: "CourseCompletedEventPayload",
123
+ description: "Payload when a course is completed",
124
+ fields: {
125
+ learnerId: {
126
+ type: ScalarTypeEnum.String_unsecure(),
127
+ isOptional: false
128
+ },
129
+ courseId: {
130
+ type: ScalarTypeEnum.String_unsecure(),
131
+ isOptional: false
132
+ },
133
+ enrollmentId: {
134
+ type: ScalarTypeEnum.String_unsecure(),
135
+ isOptional: false
136
+ },
137
+ score: {
138
+ type: ScalarTypeEnum.Int_unsecure(),
139
+ isOptional: true
140
+ },
141
+ xpEarned: {
142
+ type: ScalarTypeEnum.Int_unsecure(),
143
+ isOptional: false
144
+ },
145
+ certificateId: {
146
+ type: ScalarTypeEnum.String_unsecure(),
147
+ isOptional: true
148
+ },
149
+ completedAt: {
150
+ type: ScalarTypeEnum.DateTime(),
151
+ isOptional: false
152
+ }
153
+ }
154
+ });
155
+ const CourseCompletedEvent = defineEvent({
156
+ meta: {
157
+ key: "course.completed",
158
+ version: 1,
159
+ description: "A learner has completed a course.",
160
+ stability: "stable",
161
+ owners: [...LEARNING_JOURNEY_OWNERS],
162
+ tags: [
163
+ "learning",
164
+ "progress",
165
+ "course"
166
+ ]
167
+ },
168
+ payload: CourseCompletedPayload
169
+ });
170
+ const OnboardingStartedPayload = defineSchemaModel({
171
+ name: "OnboardingStartedEventPayload",
172
+ description: "Payload when onboarding starts",
173
+ fields: {
174
+ learnerId: {
175
+ type: ScalarTypeEnum.String_unsecure(),
176
+ isOptional: false
177
+ },
178
+ trackId: {
179
+ type: ScalarTypeEnum.String_unsecure(),
180
+ isOptional: false
181
+ },
182
+ productId: {
183
+ type: ScalarTypeEnum.String_unsecure(),
184
+ isOptional: false
185
+ },
186
+ startedAt: {
187
+ type: ScalarTypeEnum.DateTime(),
188
+ isOptional: false
189
+ }
190
+ }
191
+ });
192
+ const OnboardingStartedEvent = defineEvent({
193
+ meta: {
194
+ key: "onboarding.started",
195
+ version: 1,
196
+ description: "A learner has started onboarding.",
197
+ stability: "stable",
198
+ owners: [...LEARNING_JOURNEY_OWNERS],
199
+ tags: ["learning", "onboarding"]
200
+ },
201
+ payload: OnboardingStartedPayload
202
+ });
203
+ const OnboardingStepCompletedPayload = defineSchemaModel({
204
+ name: "OnboardingStepCompletedEventPayload",
205
+ description: "Payload when an onboarding step is completed",
206
+ fields: {
207
+ learnerId: {
208
+ type: ScalarTypeEnum.String_unsecure(),
209
+ isOptional: false
210
+ },
211
+ trackId: {
212
+ type: ScalarTypeEnum.String_unsecure(),
213
+ isOptional: false
214
+ },
215
+ stepId: {
216
+ type: ScalarTypeEnum.String_unsecure(),
217
+ isOptional: false
218
+ },
219
+ triggeringEvent: {
220
+ type: ScalarTypeEnum.String_unsecure(),
221
+ isOptional: true
222
+ },
223
+ xpEarned: {
224
+ type: ScalarTypeEnum.Int_unsecure(),
225
+ isOptional: false
226
+ },
227
+ completedAt: {
228
+ type: ScalarTypeEnum.DateTime(),
229
+ isOptional: false
230
+ }
231
+ }
232
+ });
233
+ const OnboardingStepCompletedEvent = defineEvent({
234
+ meta: {
235
+ key: "onboarding.step_completed",
236
+ version: 1,
237
+ description: "An onboarding step has been completed.",
238
+ stability: "stable",
239
+ owners: [...LEARNING_JOURNEY_OWNERS],
240
+ tags: ["learning", "onboarding"]
241
+ },
242
+ payload: OnboardingStepCompletedPayload
243
+ });
244
+ const OnboardingCompletedPayload = defineSchemaModel({
245
+ name: "OnboardingCompletedEventPayload",
246
+ description: "Payload when onboarding is completed",
247
+ fields: {
248
+ learnerId: {
249
+ type: ScalarTypeEnum.String_unsecure(),
250
+ isOptional: false
251
+ },
252
+ trackId: {
253
+ type: ScalarTypeEnum.String_unsecure(),
254
+ isOptional: false
255
+ },
256
+ productId: {
257
+ type: ScalarTypeEnum.String_unsecure(),
258
+ isOptional: false
259
+ },
260
+ xpEarned: {
261
+ type: ScalarTypeEnum.Int_unsecure(),
262
+ isOptional: false
263
+ },
264
+ completedAt: {
265
+ type: ScalarTypeEnum.DateTime(),
266
+ isOptional: false
267
+ }
268
+ }
269
+ });
270
+ const OnboardingCompletedEvent = defineEvent({
271
+ meta: {
272
+ key: "onboarding.completed",
273
+ version: 1,
274
+ description: "A learner has completed onboarding.",
275
+ stability: "stable",
276
+ owners: [...LEARNING_JOURNEY_OWNERS],
277
+ tags: ["learning", "onboarding"]
278
+ },
279
+ payload: OnboardingCompletedPayload
280
+ });
281
+ const CardReviewedPayload = defineSchemaModel({
282
+ name: "CardReviewedEventPayload",
283
+ description: "Payload when a flashcard is reviewed",
284
+ fields: {
285
+ learnerId: {
286
+ type: ScalarTypeEnum.String_unsecure(),
287
+ isOptional: false
288
+ },
289
+ cardId: {
290
+ type: ScalarTypeEnum.String_unsecure(),
291
+ isOptional: false
292
+ },
293
+ deckId: {
294
+ type: ScalarTypeEnum.String_unsecure(),
295
+ isOptional: false
296
+ },
297
+ rating: {
298
+ type: ScalarTypeEnum.String_unsecure(),
299
+ isOptional: false
300
+ },
301
+ responseTimeMs: {
302
+ type: ScalarTypeEnum.Int_unsecure(),
303
+ isOptional: true
304
+ },
305
+ reviewedAt: {
306
+ type: ScalarTypeEnum.DateTime(),
307
+ isOptional: false
308
+ }
309
+ }
310
+ });
311
+ const CardReviewedEvent = defineEvent({
312
+ meta: {
313
+ key: "flashcard.reviewed",
314
+ version: 1,
315
+ description: "A flashcard has been reviewed.",
316
+ stability: "stable",
317
+ owners: [...LEARNING_JOURNEY_OWNERS],
318
+ tags: ["learning", "flashcards"]
319
+ },
320
+ payload: CardReviewedPayload
321
+ });
322
+ const QuizStartedPayload = defineSchemaModel({
323
+ name: "QuizStartedEventPayload",
324
+ description: "Payload when a quiz is started",
325
+ fields: {
326
+ learnerId: {
327
+ type: ScalarTypeEnum.String_unsecure(),
328
+ isOptional: false
329
+ },
330
+ quizId: {
331
+ type: ScalarTypeEnum.String_unsecure(),
332
+ isOptional: false
333
+ },
334
+ attemptId: {
335
+ type: ScalarTypeEnum.String_unsecure(),
336
+ isOptional: false
337
+ },
338
+ attemptNumber: {
339
+ type: ScalarTypeEnum.Int_unsecure(),
340
+ isOptional: false
341
+ },
342
+ startedAt: {
343
+ type: ScalarTypeEnum.DateTime(),
344
+ isOptional: false
345
+ }
346
+ }
347
+ });
348
+ const QuizStartedEvent = defineEvent({
349
+ meta: {
350
+ key: "quiz.started",
351
+ version: 1,
352
+ description: "A quiz attempt has started.",
353
+ stability: "stable",
354
+ owners: [...LEARNING_JOURNEY_OWNERS],
355
+ tags: ["learning", "quiz"]
356
+ },
357
+ payload: QuizStartedPayload
358
+ });
359
+ const QuizCompletedPayload = defineSchemaModel({
360
+ name: "QuizCompletedEventPayload",
361
+ description: "Payload when a quiz is completed",
362
+ fields: {
363
+ learnerId: {
364
+ type: ScalarTypeEnum.String_unsecure(),
365
+ isOptional: false
366
+ },
367
+ quizId: {
368
+ type: ScalarTypeEnum.String_unsecure(),
369
+ isOptional: false
370
+ },
371
+ attemptId: {
372
+ type: ScalarTypeEnum.String_unsecure(),
373
+ isOptional: false
374
+ },
375
+ score: {
376
+ type: ScalarTypeEnum.Int_unsecure(),
377
+ isOptional: false
378
+ },
379
+ percentageScore: {
380
+ type: ScalarTypeEnum.Int_unsecure(),
381
+ isOptional: false
382
+ },
383
+ passed: {
384
+ type: ScalarTypeEnum.Boolean(),
385
+ isOptional: false
386
+ },
387
+ xpEarned: {
388
+ type: ScalarTypeEnum.Int_unsecure(),
389
+ isOptional: false
390
+ },
391
+ timeSpent: {
392
+ type: ScalarTypeEnum.Int_unsecure(),
393
+ isOptional: false
394
+ },
395
+ completedAt: {
396
+ type: ScalarTypeEnum.DateTime(),
397
+ isOptional: false
398
+ }
399
+ }
400
+ });
401
+ const QuizCompletedEvent = defineEvent({
402
+ meta: {
403
+ key: "quiz.completed",
404
+ version: 1,
405
+ description: "A quiz attempt has been completed.",
406
+ stability: "stable",
407
+ owners: [...LEARNING_JOURNEY_OWNERS],
408
+ tags: ["learning", "quiz"]
409
+ },
410
+ payload: QuizCompletedPayload
411
+ });
412
+ const XpEarnedPayload = defineSchemaModel({
413
+ name: "XpEarnedEventPayload",
414
+ description: "Payload when XP is earned",
415
+ fields: {
416
+ learnerId: {
417
+ type: ScalarTypeEnum.String_unsecure(),
418
+ isOptional: false
419
+ },
420
+ amount: {
421
+ type: ScalarTypeEnum.Int_unsecure(),
422
+ isOptional: false
423
+ },
424
+ source: {
425
+ type: ScalarTypeEnum.String_unsecure(),
426
+ isOptional: false
427
+ },
428
+ sourceId: {
429
+ type: ScalarTypeEnum.String_unsecure(),
430
+ isOptional: true
431
+ },
432
+ totalXp: {
433
+ type: ScalarTypeEnum.Int_unsecure(),
434
+ isOptional: false
435
+ },
436
+ earnedAt: {
437
+ type: ScalarTypeEnum.DateTime(),
438
+ isOptional: false
439
+ }
440
+ }
441
+ });
442
+ const XpEarnedEvent = defineEvent({
443
+ meta: {
444
+ key: "xp.earned",
445
+ version: 1,
446
+ description: "XP has been earned.",
447
+ stability: "stable",
448
+ owners: [...LEARNING_JOURNEY_OWNERS],
449
+ tags: [
450
+ "learning",
451
+ "gamification",
452
+ "xp"
453
+ ]
454
+ },
455
+ payload: XpEarnedPayload
456
+ });
457
+ const LevelUpPayload = defineSchemaModel({
458
+ name: "LevelUpEventPayload",
459
+ description: "Payload when a learner levels up",
460
+ fields: {
461
+ learnerId: {
462
+ type: ScalarTypeEnum.String_unsecure(),
463
+ isOptional: false
464
+ },
465
+ previousLevel: {
466
+ type: ScalarTypeEnum.Int_unsecure(),
467
+ isOptional: false
468
+ },
469
+ newLevel: {
470
+ type: ScalarTypeEnum.Int_unsecure(),
471
+ isOptional: false
472
+ },
473
+ totalXp: {
474
+ type: ScalarTypeEnum.Int_unsecure(),
475
+ isOptional: false
476
+ },
477
+ leveledUpAt: {
478
+ type: ScalarTypeEnum.DateTime(),
479
+ isOptional: false
480
+ }
481
+ }
482
+ });
483
+ const LevelUpEvent = defineEvent({
484
+ meta: {
485
+ key: "level.up",
486
+ version: 1,
487
+ description: "A learner has leveled up.",
488
+ stability: "stable",
489
+ owners: [...LEARNING_JOURNEY_OWNERS],
490
+ tags: [
491
+ "learning",
492
+ "gamification",
493
+ "level"
494
+ ]
495
+ },
496
+ payload: LevelUpPayload
497
+ });
498
+ const StreakUpdatedPayload = defineSchemaModel({
499
+ name: "StreakUpdatedEventPayload",
500
+ description: "Payload when a streak is updated",
501
+ fields: {
502
+ learnerId: {
503
+ type: ScalarTypeEnum.String_unsecure(),
504
+ isOptional: false
505
+ },
506
+ previousStreak: {
507
+ type: ScalarTypeEnum.Int_unsecure(),
508
+ isOptional: false
509
+ },
510
+ currentStreak: {
511
+ type: ScalarTypeEnum.Int_unsecure(),
512
+ isOptional: false
513
+ },
514
+ longestStreak: {
515
+ type: ScalarTypeEnum.Int_unsecure(),
516
+ isOptional: false
517
+ },
518
+ freezeUsed: {
519
+ type: ScalarTypeEnum.Boolean(),
520
+ isOptional: false
521
+ },
522
+ updatedAt: {
523
+ type: ScalarTypeEnum.DateTime(),
524
+ isOptional: false
525
+ }
526
+ }
527
+ });
528
+ const StreakUpdatedEvent = defineEvent({
529
+ meta: {
530
+ key: "streak.updated",
531
+ version: 1,
532
+ description: "A streak has been updated.",
533
+ stability: "stable",
534
+ owners: [...LEARNING_JOURNEY_OWNERS],
535
+ tags: [
536
+ "learning",
537
+ "gamification",
538
+ "streak"
539
+ ]
540
+ },
541
+ payload: StreakUpdatedPayload
542
+ });
543
+ const AchievementUnlockedPayload = defineSchemaModel({
544
+ name: "AchievementUnlockedEventPayload",
545
+ description: "Payload when an achievement is unlocked",
546
+ fields: {
547
+ learnerId: {
548
+ type: ScalarTypeEnum.String_unsecure(),
549
+ isOptional: false
550
+ },
551
+ achievementId: {
552
+ type: ScalarTypeEnum.String_unsecure(),
553
+ isOptional: false
554
+ },
555
+ achievementKey: {
556
+ type: ScalarTypeEnum.String_unsecure(),
557
+ isOptional: false
558
+ },
559
+ achievementName: {
560
+ type: ScalarTypeEnum.String_unsecure(),
561
+ isOptional: false
562
+ },
563
+ xpEarned: {
564
+ type: ScalarTypeEnum.Int_unsecure(),
565
+ isOptional: false
566
+ },
567
+ unlockedAt: {
568
+ type: ScalarTypeEnum.DateTime(),
569
+ isOptional: false
570
+ }
571
+ }
572
+ });
573
+ const AchievementUnlockedEvent = defineEvent({
574
+ meta: {
575
+ key: "achievement.unlocked",
576
+ version: 1,
577
+ description: "An achievement has been unlocked.",
578
+ stability: "stable",
579
+ owners: [...LEARNING_JOURNEY_OWNERS],
580
+ tags: [
581
+ "learning",
582
+ "gamification",
583
+ "achievement"
584
+ ]
585
+ },
586
+ payload: AchievementUnlockedPayload
587
+ });
588
+ const DailyGoalCompletedPayload = defineSchemaModel({
589
+ name: "DailyGoalCompletedEventPayload",
590
+ description: "Payload when a daily goal is completed",
591
+ fields: {
592
+ learnerId: {
593
+ type: ScalarTypeEnum.String_unsecure(),
594
+ isOptional: false
595
+ },
596
+ date: {
597
+ type: ScalarTypeEnum.String_unsecure(),
598
+ isOptional: false
599
+ },
600
+ targetXp: {
601
+ type: ScalarTypeEnum.Int_unsecure(),
602
+ isOptional: false
603
+ },
604
+ actualXp: {
605
+ type: ScalarTypeEnum.Int_unsecure(),
606
+ isOptional: false
607
+ },
608
+ completedAt: {
609
+ type: ScalarTypeEnum.DateTime(),
610
+ isOptional: false
611
+ }
612
+ }
613
+ });
614
+ const DailyGoalCompletedEvent = defineEvent({
615
+ meta: {
616
+ key: "daily_goal.completed",
617
+ version: 1,
618
+ description: "A daily goal has been completed.",
619
+ stability: "stable",
620
+ owners: [...LEARNING_JOURNEY_OWNERS],
621
+ tags: [
622
+ "learning",
623
+ "gamification",
624
+ "goal"
625
+ ]
626
+ },
627
+ payload: DailyGoalCompletedPayload
628
+ });
629
+ const CertificateIssuedPayload = defineSchemaModel({
630
+ name: "CertificateIssuedEventPayload",
631
+ description: "Payload when a certificate is issued",
632
+ fields: {
633
+ certificateId: {
634
+ type: ScalarTypeEnum.String_unsecure(),
635
+ isOptional: false
636
+ },
637
+ learnerId: {
638
+ type: ScalarTypeEnum.String_unsecure(),
639
+ isOptional: false
640
+ },
641
+ courseId: {
642
+ type: ScalarTypeEnum.String_unsecure(),
643
+ isOptional: false
644
+ },
645
+ certificateNumber: {
646
+ type: ScalarTypeEnum.String_unsecure(),
647
+ isOptional: false
648
+ },
649
+ issuedAt: {
650
+ type: ScalarTypeEnum.DateTime(),
651
+ isOptional: false
652
+ }
653
+ }
654
+ });
655
+ const CertificateIssuedEvent = defineEvent({
656
+ meta: {
657
+ key: "certificate.issued",
658
+ version: 1,
659
+ description: "A certificate has been issued.",
660
+ stability: "stable",
661
+ owners: [...LEARNING_JOURNEY_OWNERS],
662
+ tags: ["learning", "certificate"]
663
+ },
664
+ payload: CertificateIssuedPayload
665
+ });
666
+ /**
667
+ * All learning journey events.
668
+ */
669
+ const LearningJourneyEvents = {
670
+ CoursePublishedEvent,
671
+ EnrollmentCreatedEvent,
672
+ LessonCompletedEvent,
673
+ CourseCompletedEvent,
674
+ OnboardingStartedEvent,
675
+ OnboardingStepCompletedEvent,
676
+ OnboardingCompletedEvent,
677
+ CardReviewedEvent,
678
+ QuizStartedEvent,
679
+ QuizCompletedEvent,
680
+ XpEarnedEvent,
681
+ LevelUpEvent,
682
+ StreakUpdatedEvent,
683
+ AchievementUnlockedEvent,
684
+ DailyGoalCompletedEvent,
685
+ CertificateIssuedEvent
686
+ };
687
+
688
+ //#endregion
689
+ export { AchievementUnlockedEvent, CardReviewedEvent, CertificateIssuedEvent, CourseCompletedEvent, CoursePublishedEvent, DailyGoalCompletedEvent, EnrollmentCreatedEvent, LearningJourneyEvents, LessonCompletedEvent, LevelUpEvent, OnboardingCompletedEvent, OnboardingStartedEvent, OnboardingStepCompletedEvent, QuizCompletedEvent, QuizStartedEvent, StreakUpdatedEvent, XpEarnedEvent };
690
+ //# sourceMappingURL=events.js.map