@contractspec/module.learning-journey 3.7.16 → 3.7.17

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 (94) hide show
  1. package/dist/browser/contracts/index.js +1 -578
  2. package/dist/browser/contracts/models.js +1 -193
  3. package/dist/browser/contracts/onboarding.js +1 -417
  4. package/dist/browser/contracts/operations.js +1 -326
  5. package/dist/browser/contracts/shared.js +1 -5
  6. package/dist/browser/docs/index.js +7 -51
  7. package/dist/browser/docs/learning-journey.docblock.js +7 -51
  8. package/dist/browser/engines/index.js +1 -675
  9. package/dist/browser/engines/srs.js +1 -198
  10. package/dist/browser/engines/streak.js +1 -159
  11. package/dist/browser/engines/xp.js +1 -320
  12. package/dist/browser/entities/ai.js +1 -343
  13. package/dist/browser/entities/course.js +1 -276
  14. package/dist/browser/entities/flashcard.js +1 -222
  15. package/dist/browser/entities/gamification.js +1 -340
  16. package/dist/browser/entities/index.js +1 -2140
  17. package/dist/browser/entities/learner.js +1 -333
  18. package/dist/browser/entities/onboarding.js +1 -301
  19. package/dist/browser/entities/quiz.js +1 -304
  20. package/dist/browser/events.js +1 -423
  21. package/dist/browser/i18n/catalogs/en.js +1 -43
  22. package/dist/browser/i18n/catalogs/es.js +1 -43
  23. package/dist/browser/i18n/catalogs/fr.js +1 -43
  24. package/dist/browser/i18n/catalogs/index.js +1 -127
  25. package/dist/browser/i18n/index.js +1 -169
  26. package/dist/browser/i18n/keys.js +1 -16
  27. package/dist/browser/i18n/locale.js +1 -13
  28. package/dist/browser/i18n/messages.js +1 -139
  29. package/dist/browser/index.js +7 -3914
  30. package/dist/browser/learning-journey.capability.js +1 -43
  31. package/dist/browser/learning-journey.feature.js +1 -56
  32. package/dist/contracts/index.js +1 -578
  33. package/dist/contracts/models.js +1 -193
  34. package/dist/contracts/onboarding.js +1 -417
  35. package/dist/contracts/operations.js +1 -326
  36. package/dist/contracts/shared.js +1 -5
  37. package/dist/docs/index.js +7 -51
  38. package/dist/docs/learning-journey.docblock.js +7 -51
  39. package/dist/engines/index.js +1 -675
  40. package/dist/engines/srs.js +1 -198
  41. package/dist/engines/streak.js +1 -159
  42. package/dist/engines/xp.js +1 -320
  43. package/dist/entities/ai.js +1 -343
  44. package/dist/entities/course.js +1 -276
  45. package/dist/entities/flashcard.js +1 -222
  46. package/dist/entities/gamification.js +1 -340
  47. package/dist/entities/index.js +1 -2140
  48. package/dist/entities/learner.js +1 -333
  49. package/dist/entities/onboarding.js +1 -301
  50. package/dist/entities/quiz.js +1 -304
  51. package/dist/events.js +1 -423
  52. package/dist/i18n/catalogs/en.js +1 -43
  53. package/dist/i18n/catalogs/es.js +1 -43
  54. package/dist/i18n/catalogs/fr.js +1 -43
  55. package/dist/i18n/catalogs/index.js +1 -127
  56. package/dist/i18n/index.js +1 -169
  57. package/dist/i18n/keys.js +1 -16
  58. package/dist/i18n/locale.js +1 -13
  59. package/dist/i18n/messages.js +1 -139
  60. package/dist/index.js +7 -3914
  61. package/dist/learning-journey.capability.js +1 -43
  62. package/dist/learning-journey.feature.js +1 -56
  63. package/dist/node/contracts/index.js +1 -578
  64. package/dist/node/contracts/models.js +1 -193
  65. package/dist/node/contracts/onboarding.js +1 -417
  66. package/dist/node/contracts/operations.js +1 -326
  67. package/dist/node/contracts/shared.js +1 -5
  68. package/dist/node/docs/index.js +7 -51
  69. package/dist/node/docs/learning-journey.docblock.js +7 -51
  70. package/dist/node/engines/index.js +1 -675
  71. package/dist/node/engines/srs.js +1 -198
  72. package/dist/node/engines/streak.js +1 -159
  73. package/dist/node/engines/xp.js +1 -320
  74. package/dist/node/entities/ai.js +1 -343
  75. package/dist/node/entities/course.js +1 -276
  76. package/dist/node/entities/flashcard.js +1 -222
  77. package/dist/node/entities/gamification.js +1 -340
  78. package/dist/node/entities/index.js +1 -2140
  79. package/dist/node/entities/learner.js +1 -333
  80. package/dist/node/entities/onboarding.js +1 -301
  81. package/dist/node/entities/quiz.js +1 -304
  82. package/dist/node/events.js +1 -423
  83. package/dist/node/i18n/catalogs/en.js +1 -43
  84. package/dist/node/i18n/catalogs/es.js +1 -43
  85. package/dist/node/i18n/catalogs/fr.js +1 -43
  86. package/dist/node/i18n/catalogs/index.js +1 -127
  87. package/dist/node/i18n/index.js +1 -169
  88. package/dist/node/i18n/keys.js +1 -16
  89. package/dist/node/i18n/locale.js +1 -13
  90. package/dist/node/i18n/messages.js +1 -139
  91. package/dist/node/index.js +7 -3914
  92. package/dist/node/learning-journey.capability.js +1 -43
  93. package/dist/node/learning-journey.feature.js +1 -56
  94. package/package.json +5 -5
@@ -1,327 +1,2 @@
1
1
  // @bun
2
- // src/contracts/models.ts
3
- import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
4
- var CourseModel = defineSchemaModel({
5
- name: "Course",
6
- description: "A learning course",
7
- fields: {
8
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
9
- title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
10
- slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
11
- description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
12
- difficulty: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
13
- status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
14
- estimatedDuration: {
15
- type: ScalarTypeEnum.Int_unsecure(),
16
- isOptional: true
17
- },
18
- thumbnailUrl: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
19
- createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
20
- }
21
- });
22
- var LearnerModel = defineSchemaModel({
23
- name: "Learner",
24
- description: "A learner profile",
25
- fields: {
26
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
27
- userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
28
- displayName: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
29
- level: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
30
- totalXp: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
31
- currentStreak: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
32
- longestStreak: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
33
- createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
34
- }
35
- });
36
- var EnrollmentModel = defineSchemaModel({
37
- name: "Enrollment",
38
- description: "A course enrollment",
39
- fields: {
40
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
41
- learnerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
42
- courseId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
43
- status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
44
- progress: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
45
- startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
46
- completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
47
- }
48
- });
49
- var ProgressModel = defineSchemaModel({
50
- name: "LessonProgress",
51
- description: "Lesson progress",
52
- fields: {
53
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
54
- learnerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
55
- lessonId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
56
- status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
57
- progress: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
58
- score: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
59
- timeSpent: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
60
- completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
61
- }
62
- });
63
- var DeckModel = defineSchemaModel({
64
- name: "Deck",
65
- description: "A flashcard deck",
66
- fields: {
67
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
68
- title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
69
- description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
70
- cardCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
71
- isPublic: { type: ScalarTypeEnum.Boolean(), isOptional: false },
72
- createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
73
- }
74
- });
75
- var CardModel = defineSchemaModel({
76
- name: "Card",
77
- description: "A flashcard",
78
- fields: {
79
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
80
- deckId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
81
- front: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
82
- back: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
83
- hints: { type: ScalarTypeEnum.JSON(), isOptional: true },
84
- isDue: { type: ScalarTypeEnum.Boolean(), isOptional: false },
85
- nextReviewAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
86
- }
87
- });
88
- var AchievementModel = defineSchemaModel({
89
- name: "Achievement",
90
- description: "An achievement",
91
- fields: {
92
- id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
93
- key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
94
- name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
95
- description: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
96
- icon: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
97
- xpReward: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
98
- unlockedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
99
- }
100
- });
101
- var EnrollInCourseInput = defineSchemaModel({
102
- name: "EnrollInCourseInput",
103
- description: "Input for enrolling in a course",
104
- fields: {
105
- courseId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
106
- }
107
- });
108
- var CompleteLessonInput = defineSchemaModel({
109
- name: "CompleteLessonInput",
110
- description: "Input for completing a lesson",
111
- fields: {
112
- lessonId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
113
- score: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
114
- timeSpent: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false }
115
- }
116
- });
117
- var SubmitCardReviewInput = defineSchemaModel({
118
- name: "SubmitCardReviewInput",
119
- description: "Input for submitting a card review",
120
- fields: {
121
- cardId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
122
- rating: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
123
- responseTimeMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true }
124
- }
125
- });
126
- var GetDueCardsInput = defineSchemaModel({
127
- name: "GetDueCardsInput",
128
- description: "Input for getting due cards",
129
- fields: {
130
- deckId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
131
- limit: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true }
132
- }
133
- });
134
- var GetDueCardsOutput = defineSchemaModel({
135
- name: "GetDueCardsOutput",
136
- description: "Output for getting due cards",
137
- fields: {
138
- cards: { type: CardModel, isArray: true, isOptional: false },
139
- total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false }
140
- }
141
- });
142
- var GetLearnerDashboardInput = defineSchemaModel({
143
- name: "GetLearnerDashboardInput",
144
- description: "Input for getting learner dashboard",
145
- fields: {
146
- learnerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
147
- }
148
- });
149
- var LearnerDashboardModel = defineSchemaModel({
150
- name: "LearnerDashboard",
151
- description: "Learner dashboard data",
152
- fields: {
153
- learner: { type: LearnerModel, isOptional: false },
154
- currentStreak: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
155
- dailyXpGoal: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
156
- dailyXpProgress: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
157
- activeEnrollments: {
158
- type: EnrollmentModel,
159
- isArray: true,
160
- isOptional: false
161
- },
162
- recentAchievements: {
163
- type: AchievementModel,
164
- isArray: true,
165
- isOptional: false
166
- },
167
- dueCardCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false }
168
- }
169
- });
170
- var SuccessOutput = defineSchemaModel({
171
- name: "SuccessOutput",
172
- description: "Generic success output",
173
- fields: {
174
- success: { type: ScalarTypeEnum.Boolean(), isOptional: false },
175
- xpEarned: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true }
176
- }
177
- });
178
-
179
- // src/contracts/shared.ts
180
- var LEARNING_JOURNEY_OWNERS = ["modules.learning-journey"];
181
-
182
- // src/contracts/operations.ts
183
- import { defineCommand, defineQuery } from "@contractspec/lib.contracts-spec";
184
- var EnrollInCourseContract = defineCommand({
185
- meta: {
186
- key: "learning.enroll",
187
- version: "1.0.0",
188
- stability: "stable",
189
- owners: [...LEARNING_JOURNEY_OWNERS],
190
- tags: ["learning", "enrollment"],
191
- description: "Enroll in a course.",
192
- goal: "Start learning a new course.",
193
- context: "Called when a learner wants to start a course."
194
- },
195
- io: {
196
- input: EnrollInCourseInput,
197
- output: EnrollmentModel,
198
- errors: {
199
- COURSE_NOT_FOUND: {
200
- description: "Course does not exist",
201
- http: 404,
202
- gqlCode: "COURSE_NOT_FOUND",
203
- when: "Course ID is invalid"
204
- },
205
- ALREADY_ENROLLED: {
206
- description: "Already enrolled in course",
207
- http: 409,
208
- gqlCode: "ALREADY_ENROLLED",
209
- when: "Learner is already enrolled"
210
- }
211
- }
212
- },
213
- policy: {
214
- auth: "user"
215
- }
216
- });
217
- var CompleteLessonContract = defineCommand({
218
- meta: {
219
- key: "learning.completeLesson",
220
- version: "1.0.0",
221
- stability: "stable",
222
- owners: [...LEARNING_JOURNEY_OWNERS],
223
- tags: ["learning", "progress"],
224
- description: "Mark a lesson as completed.",
225
- goal: "Record lesson completion and earn XP.",
226
- context: "Called when a learner finishes a lesson."
227
- },
228
- io: {
229
- input: CompleteLessonInput,
230
- output: SuccessOutput,
231
- errors: {
232
- LESSON_NOT_FOUND: {
233
- description: "Lesson does not exist",
234
- http: 404,
235
- gqlCode: "LESSON_NOT_FOUND",
236
- when: "Lesson ID is invalid"
237
- },
238
- NOT_ENROLLED: {
239
- description: "Not enrolled in course",
240
- http: 403,
241
- gqlCode: "NOT_ENROLLED",
242
- when: "Learner is not enrolled in the course"
243
- }
244
- }
245
- },
246
- policy: {
247
- auth: "user"
248
- }
249
- });
250
- var SubmitCardReviewContract = defineCommand({
251
- meta: {
252
- key: "learning.submitCardReview",
253
- version: "1.0.0",
254
- stability: "stable",
255
- owners: [...LEARNING_JOURNEY_OWNERS],
256
- tags: ["learning", "flashcards"],
257
- description: "Submit a flashcard review.",
258
- goal: "Record review and update SRS schedule.",
259
- context: "Called when reviewing flashcards."
260
- },
261
- io: {
262
- input: SubmitCardReviewInput,
263
- output: SuccessOutput,
264
- errors: {
265
- CARD_NOT_FOUND: {
266
- description: "Card does not exist",
267
- http: 404,
268
- gqlCode: "CARD_NOT_FOUND",
269
- when: "Card ID is invalid"
270
- },
271
- INVALID_RATING: {
272
- description: "Invalid rating",
273
- http: 400,
274
- gqlCode: "INVALID_RATING",
275
- when: "Rating must be AGAIN, HARD, GOOD, or EASY"
276
- }
277
- }
278
- },
279
- policy: {
280
- auth: "user"
281
- }
282
- });
283
- var GetDueCardsContract = defineQuery({
284
- meta: {
285
- key: "learning.getDueCards",
286
- version: "1.0.0",
287
- stability: "stable",
288
- owners: [...LEARNING_JOURNEY_OWNERS],
289
- tags: ["learning", "flashcards"],
290
- description: "Get flashcards due for review.",
291
- goal: "Get the next batch of cards to review.",
292
- context: "Called when starting a review session."
293
- },
294
- io: {
295
- input: GetDueCardsInput,
296
- output: GetDueCardsOutput
297
- },
298
- policy: {
299
- auth: "user"
300
- }
301
- });
302
- var GetLearnerDashboardContract = defineQuery({
303
- meta: {
304
- key: "learning.getDashboard",
305
- version: "1.0.0",
306
- stability: "stable",
307
- owners: [...LEARNING_JOURNEY_OWNERS],
308
- tags: ["learning", "dashboard"],
309
- description: "Get learner dashboard data.",
310
- goal: "Display learner progress and stats.",
311
- context: "Called when viewing the learning dashboard."
312
- },
313
- io: {
314
- input: GetLearnerDashboardInput,
315
- output: LearnerDashboardModel
316
- },
317
- policy: {
318
- auth: "user"
319
- }
320
- });
321
- export {
322
- SubmitCardReviewContract,
323
- GetLearnerDashboardContract,
324
- GetDueCardsContract,
325
- EnrollInCourseContract,
326
- CompleteLessonContract
327
- };
2
+ import{defineSchemaModel as t,ScalarTypeEnum as e}from"@contractspec/lib.schema";var m=t({name:"Course",description:"A learning course",fields:{id:{type:e.String_unsecure(),isOptional:!1},title:{type:e.String_unsecure(),isOptional:!1},slug:{type:e.String_unsecure(),isOptional:!1},description:{type:e.String_unsecure(),isOptional:!0},difficulty:{type:e.String_unsecure(),isOptional:!1},status:{type:e.String_unsecure(),isOptional:!1},estimatedDuration:{type:e.Int_unsecure(),isOptional:!0},thumbnailUrl:{type:e.String_unsecure(),isOptional:!0},createdAt:{type:e.DateTime(),isOptional:!1}}}),f=t({name:"Learner",description:"A learner profile",fields:{id:{type:e.String_unsecure(),isOptional:!1},userId:{type:e.String_unsecure(),isOptional:!1},displayName:{type:e.String_unsecure(),isOptional:!0},level:{type:e.Int_unsecure(),isOptional:!1},totalXp:{type:e.Int_unsecure(),isOptional:!1},currentStreak:{type:e.Int_unsecure(),isOptional:!1},longestStreak:{type:e.Int_unsecure(),isOptional:!1},createdAt:{type:e.DateTime(),isOptional:!1}}}),n=t({name:"Enrollment",description:"A course enrollment",fields:{id:{type:e.String_unsecure(),isOptional:!1},learnerId:{type:e.String_unsecure(),isOptional:!1},courseId:{type:e.String_unsecure(),isOptional:!1},status:{type:e.String_unsecure(),isOptional:!1},progress:{type:e.Int_unsecure(),isOptional:!1},startedAt:{type:e.DateTime(),isOptional:!0},completedAt:{type:e.DateTime(),isOptional:!0}}}),S=t({name:"LessonProgress",description:"Lesson progress",fields:{id:{type:e.String_unsecure(),isOptional:!1},learnerId:{type:e.String_unsecure(),isOptional:!1},lessonId:{type:e.String_unsecure(),isOptional:!1},status:{type:e.String_unsecure(),isOptional:!1},progress:{type:e.Int_unsecure(),isOptional:!1},score:{type:e.Int_unsecure(),isOptional:!0},timeSpent:{type:e.Int_unsecure(),isOptional:!1},completedAt:{type:e.DateTime(),isOptional:!0}}}),I=t({name:"Deck",description:"A flashcard deck",fields:{id:{type:e.String_unsecure(),isOptional:!1},title:{type:e.String_unsecure(),isOptional:!1},description:{type:e.String_unsecure(),isOptional:!0},cardCount:{type:e.Int_unsecure(),isOptional:!1},isPublic:{type:e.Boolean(),isOptional:!1},createdAt:{type:e.DateTime(),isOptional:!1}}}),O=t({name:"Card",description:"A flashcard",fields:{id:{type:e.String_unsecure(),isOptional:!1},deckId:{type:e.String_unsecure(),isOptional:!1},front:{type:e.String_unsecure(),isOptional:!1},back:{type:e.String_unsecure(),isOptional:!1},hints:{type:e.JSON(),isOptional:!0},isDue:{type:e.Boolean(),isOptional:!1},nextReviewAt:{type:e.DateTime(),isOptional:!0}}}),g=t({name:"Achievement",description:"An achievement",fields:{id:{type:e.String_unsecure(),isOptional:!1},key:{type:e.String_unsecure(),isOptional:!1},name:{type:e.String_unsecure(),isOptional:!1},description:{type:e.String_unsecure(),isOptional:!1},icon:{type:e.String_unsecure(),isOptional:!0},xpReward:{type:e.Int_unsecure(),isOptional:!1},unlockedAt:{type:e.DateTime(),isOptional:!0}}}),a=t({name:"EnrollInCourseInput",description:"Input for enrolling in a course",fields:{courseId:{type:e.String_unsecure(),isOptional:!1}}}),p=t({name:"CompleteLessonInput",description:"Input for completing a lesson",fields:{lessonId:{type:e.String_unsecure(),isOptional:!1},score:{type:e.Int_unsecure(),isOptional:!0},timeSpent:{type:e.Int_unsecure(),isOptional:!1}}}),l=t({name:"SubmitCardReviewInput",description:"Input for submitting a card review",fields:{cardId:{type:e.String_unsecure(),isOptional:!1},rating:{type:e.String_unsecure(),isOptional:!1},responseTimeMs:{type:e.Int_unsecure(),isOptional:!0}}}),o=t({name:"GetDueCardsInput",description:"Input for getting due cards",fields:{deckId:{type:e.String_unsecure(),isOptional:!0},limit:{type:e.Int_unsecure(),isOptional:!0}}}),u=t({name:"GetDueCardsOutput",description:"Output for getting due cards",fields:{cards:{type:O,isArray:!0,isOptional:!1},total:{type:e.Int_unsecure(),isOptional:!1}}}),c=t({name:"GetLearnerDashboardInput",description:"Input for getting learner dashboard",fields:{learnerId:{type:e.String_unsecure(),isOptional:!0}}}),d=t({name:"LearnerDashboard",description:"Learner dashboard data",fields:{learner:{type:f,isOptional:!1},currentStreak:{type:e.Int_unsecure(),isOptional:!1},dailyXpGoal:{type:e.Int_unsecure(),isOptional:!1},dailyXpProgress:{type:e.Int_unsecure(),isOptional:!1},activeEnrollments:{type:n,isArray:!0,isOptional:!1},recentAchievements:{type:g,isArray:!0,isOptional:!1},dueCardCount:{type:e.Int_unsecure(),isOptional:!1}}}),i=t({name:"SuccessOutput",description:"Generic success output",fields:{success:{type:e.Boolean(),isOptional:!1},xpEarned:{type:e.Int_unsecure(),isOptional:!0}}});var s=["modules.learning-journey"];import{defineCommand as r,defineQuery as y}from"@contractspec/lib.contracts-spec";var T=r({meta:{key:"learning.enroll",version:"1.0.0",stability:"stable",owners:[...s],tags:["learning","enrollment"],description:"Enroll in a course.",goal:"Start learning a new course.",context:"Called when a learner wants to start a course."},io:{input:a,output:n,errors:{COURSE_NOT_FOUND:{description:"Course does not exist",http:404,gqlCode:"COURSE_NOT_FOUND",when:"Course ID is invalid"},ALREADY_ENROLLED:{description:"Already enrolled in course",http:409,gqlCode:"ALREADY_ENROLLED",when:"Learner is already enrolled"}}},policy:{auth:"user"}}),v=r({meta:{key:"learning.completeLesson",version:"1.0.0",stability:"stable",owners:[...s],tags:["learning","progress"],description:"Mark a lesson as completed.",goal:"Record lesson completion and earn XP.",context:"Called when a learner finishes a lesson."},io:{input:p,output:i,errors:{LESSON_NOT_FOUND:{description:"Lesson does not exist",http:404,gqlCode:"LESSON_NOT_FOUND",when:"Lesson ID is invalid"},NOT_ENROLLED:{description:"Not enrolled in course",http:403,gqlCode:"NOT_ENROLLED",when:"Learner is not enrolled in the course"}}},policy:{auth:"user"}}),C=r({meta:{key:"learning.submitCardReview",version:"1.0.0",stability:"stable",owners:[...s],tags:["learning","flashcards"],description:"Submit a flashcard review.",goal:"Record review and update SRS schedule.",context:"Called when reviewing flashcards."},io:{input:l,output:i,errors:{CARD_NOT_FOUND:{description:"Card does not exist",http:404,gqlCode:"CARD_NOT_FOUND",when:"Card ID is invalid"},INVALID_RATING:{description:"Invalid rating",http:400,gqlCode:"INVALID_RATING",when:"Rating must be AGAIN, HARD, GOOD, or EASY"}}},policy:{auth:"user"}}),b=y({meta:{key:"learning.getDueCards",version:"1.0.0",stability:"stable",owners:[...s],tags:["learning","flashcards"],description:"Get flashcards due for review.",goal:"Get the next batch of cards to review.",context:"Called when starting a review session."},io:{input:o,output:u},policy:{auth:"user"}}),M=y({meta:{key:"learning.getDashboard",version:"1.0.0",stability:"stable",owners:[...s],tags:["learning","dashboard"],description:"Get learner dashboard data.",goal:"Display learner progress and stats.",context:"Called when viewing the learning dashboard."},io:{input:c,output:d},policy:{auth:"user"}});export{C as SubmitCardReviewContract,M as GetLearnerDashboardContract,b as GetDueCardsContract,T as EnrollInCourseContract,v as CompleteLessonContract};
@@ -1,6 +1,2 @@
1
1
  // @bun
2
- // src/contracts/shared.ts
3
- var LEARNING_JOURNEY_OWNERS = ["modules.learning-journey"];
4
- export {
5
- LEARNING_JOURNEY_OWNERS
6
- };
2
+ var n=["modules.learning-journey"];export{n as LEARNING_JOURNEY_OWNERS};
@@ -1,16 +1,5 @@
1
1
  // @bun
2
- // src/docs/learning-journey.docblock.ts
3
- import { registerDocBlocks } from "@contractspec/lib.contracts-spec/docs";
4
- var learningJourneyDocBlocks = [
5
- {
6
- id: "docs.learning-journey.engine",
7
- title: "Learning Journey Engine",
8
- summary: "Tracks learners, tracks/modules/steps, progress, quizzes, streaks, XP, and AI coaching hooks for product-integrated onboarding.",
9
- kind: "reference",
10
- visibility: "public",
11
- route: "/docs/learning-journey/engine",
12
- tags: ["learning", "onboarding", "journey", "education"],
13
- body: `## Capabilities
2
+ import{registerDocBlocks as m}from"@contractspec/lib.contracts-spec/docs";var f=[{id:"docs.learning-journey.engine",title:"Learning Journey Engine",summary:"Tracks learners, tracks/modules/steps, progress, quizzes, streaks, XP, and AI coaching hooks for product-integrated onboarding.",kind:"reference",visibility:"public",route:"/docs/learning-journey/engine",tags:["learning","onboarding","journey","education"],body:`## Capabilities
14
3
 
15
4
  - **Entities**: Learner, Track, Module, Step, Progress, Quiz, Flashcard, AI Coach, Gamification (XP, streaks, badges).
16
5
  - **Contracts**: enroll/resume/advance steps, complete quizzes, record streaks, assign XP, fetch progress dashboards, onboarding list/progress/recordEvent.
@@ -40,13 +29,13 @@ var learningJourneyDocBlocks = [
40
29
 
41
30
  ## Example
42
31
 
43
- ${"```"}ts
32
+ \`\`\`ts
44
33
  import { learningJourneyEntities } from '@contractspec/module.learning-journey';
45
34
  import { StreakEngine } from '@contractspec/module.learning-journey/engines';
46
35
 
47
36
  const streak = new StreakEngine({ graceDays: 1 });
48
37
  const updated = streak.compute({ lastActiveAt: new Date(), today: new Date() });
49
- ${"```"},
38
+ \`\`\`,
50
39
 
51
40
  ## Guardrails
52
41
 
@@ -54,17 +43,7 @@ ${"```"},
54
43
  - Avoid storing PII in content; keep org/user scoping for multi-tenant isolation.
55
44
  - Emit analytics and audit logs for completions; respect \`prefers-reduced-motion\` in UIs consuming these specs.
56
45
  - Track completion bonuses: \`completionXpBonus\`, \`completionBadgeKey\`, optional \`streakHoursWindow\` + \`streakBonusXp\`.
57
- `
58
- },
59
- {
60
- id: "docs.learning-journey.goal",
61
- title: "Learning Journey \u2014 Goal",
62
- summary: "Why the learning journey engine exists and the outcomes it targets.",
63
- kind: "goal",
64
- visibility: "public",
65
- route: "/docs/learning-journey/goal",
66
- tags: ["learning", "goal"],
67
- body: `## Why it matters
46
+ `},{id:"docs.learning-journey.goal",title:"Learning Journey \u2014 Goal",summary:"Why the learning journey engine exists and the outcomes it targets.",kind:"goal",visibility:"public",route:"/docs/learning-journey/goal",tags:["learning","goal"],body:`## Why it matters
68
47
  - Provides a regenerable onboarding/education engine tied to product signals.
69
48
  - Keeps tracks, steps, quizzes, and gamification consistent across surfaces.
70
49
 
@@ -74,17 +53,7 @@ ${"```"},
74
53
 
75
54
  ## Success criteria
76
55
  - Journey changes regenerate UI/API/events without drift.
77
- - Analytics/audit hooks exist for completions and streaks.`
78
- },
79
- {
80
- id: "docs.learning-journey.usage",
81
- title: "Learning Journey \u2014 Usage",
82
- summary: "How to compose, bind, and regenerate journeys safely.",
83
- kind: "usage",
84
- visibility: "public",
85
- route: "/docs/learning-journey/usage",
86
- tags: ["learning", "usage"],
87
- body: `## Setup
56
+ - Analytics/audit hooks exist for completions and streaks.`},{id:"docs.learning-journey.usage",title:"Learning Journey \u2014 Usage",summary:"How to compose, bind, and regenerate journeys safely.",kind:"usage",visibility:"public",route:"/docs/learning-journey/usage",tags:["learning","usage"],body:`## Setup
88
57
  1) Include \`learningJourneyEntities\` in schema composition.
89
58
  2) Register contracts/events from \`@contractspec/module.learning-journey\`.
90
59
  3) Bind steps to real product events (e.g., deal.created, run.completed).
@@ -97,17 +66,7 @@ ${"```"},
97
66
  ## Guardrails
98
67
  - Avoid hardcoded progression; keep engines declarative.
99
68
  - Emit analytics/audit for completions; respect user locale/accessibility in presentations.
100
- - Keep content free of PII; scope learners by org/tenant.`
101
- },
102
- {
103
- id: "docs.learning-journey.constraints",
104
- title: "Learning Journey \u2014 Constraints & Safety",
105
- summary: "Internal guardrails for progression, telemetry, and regeneration semantics.",
106
- kind: "reference",
107
- visibility: "internal",
108
- route: "/docs/learning-journey/constraints",
109
- tags: ["learning", "constraints", "internal"],
110
- body: `## Constraints
69
+ - Keep content free of PII; scope learners by org/tenant.`},{id:"docs.learning-journey.constraints",title:"Learning Journey \u2014 Constraints & Safety",summary:"Internal guardrails for progression, telemetry, and regeneration semantics.",kind:"reference",visibility:"internal",route:"/docs/learning-journey/constraints",tags:["learning","constraints","internal"],body:`## Constraints
111
70
  - Progression (tracks/modules/steps) and engines (SRS, streaks, XP) must stay declarative in spec.
112
71
  - Events to emit: learner.enrolled, step.completed, quiz.scored, streak.reset, xp.awarded.
113
72
  - Regeneration should not change scoring/streak rules without explicit spec change.
@@ -119,7 +78,4 @@ ${"```"},
119
78
  ## Verification
120
79
  - Add fixtures for streak/XP rule changes and quiz scoring.
121
80
  - Ensure Notifications/Audit wiring persists for completions; analytics emitted for progress.
122
- - Use Feature Flags to trial new tracks or reward rules; default safe/off.`
123
- }
124
- ];
125
- registerDocBlocks(learningJourneyDocBlocks);
81
+ - Use Feature Flags to trial new tracks or reward rules; default safe/off.`}];m(f);
@@ -1,16 +1,5 @@
1
1
  // @bun
2
- // src/docs/learning-journey.docblock.ts
3
- import { registerDocBlocks } from "@contractspec/lib.contracts-spec/docs";
4
- var learningJourneyDocBlocks = [
5
- {
6
- id: "docs.learning-journey.engine",
7
- title: "Learning Journey Engine",
8
- summary: "Tracks learners, tracks/modules/steps, progress, quizzes, streaks, XP, and AI coaching hooks for product-integrated onboarding.",
9
- kind: "reference",
10
- visibility: "public",
11
- route: "/docs/learning-journey/engine",
12
- tags: ["learning", "onboarding", "journey", "education"],
13
- body: `## Capabilities
2
+ import{registerDocBlocks as f}from"@contractspec/lib.contracts-spec/docs";var h=[{id:"docs.learning-journey.engine",title:"Learning Journey Engine",summary:"Tracks learners, tracks/modules/steps, progress, quizzes, streaks, XP, and AI coaching hooks for product-integrated onboarding.",kind:"reference",visibility:"public",route:"/docs/learning-journey/engine",tags:["learning","onboarding","journey","education"],body:`## Capabilities
14
3
 
15
4
  - **Entities**: Learner, Track, Module, Step, Progress, Quiz, Flashcard, AI Coach, Gamification (XP, streaks, badges).
16
5
  - **Contracts**: enroll/resume/advance steps, complete quizzes, record streaks, assign XP, fetch progress dashboards, onboarding list/progress/recordEvent.
@@ -40,13 +29,13 @@ var learningJourneyDocBlocks = [
40
29
 
41
30
  ## Example
42
31
 
43
- ${"```"}ts
32
+ \`\`\`ts
44
33
  import { learningJourneyEntities } from '@contractspec/module.learning-journey';
45
34
  import { StreakEngine } from '@contractspec/module.learning-journey/engines';
46
35
 
47
36
  const streak = new StreakEngine({ graceDays: 1 });
48
37
  const updated = streak.compute({ lastActiveAt: new Date(), today: new Date() });
49
- ${"```"},
38
+ \`\`\`,
50
39
 
51
40
  ## Guardrails
52
41
 
@@ -54,17 +43,7 @@ ${"```"},
54
43
  - Avoid storing PII in content; keep org/user scoping for multi-tenant isolation.
55
44
  - Emit analytics and audit logs for completions; respect \`prefers-reduced-motion\` in UIs consuming these specs.
56
45
  - Track completion bonuses: \`completionXpBonus\`, \`completionBadgeKey\`, optional \`streakHoursWindow\` + \`streakBonusXp\`.
57
- `
58
- },
59
- {
60
- id: "docs.learning-journey.goal",
61
- title: "Learning Journey \u2014 Goal",
62
- summary: "Why the learning journey engine exists and the outcomes it targets.",
63
- kind: "goal",
64
- visibility: "public",
65
- route: "/docs/learning-journey/goal",
66
- tags: ["learning", "goal"],
67
- body: `## Why it matters
46
+ `},{id:"docs.learning-journey.goal",title:"Learning Journey \u2014 Goal",summary:"Why the learning journey engine exists and the outcomes it targets.",kind:"goal",visibility:"public",route:"/docs/learning-journey/goal",tags:["learning","goal"],body:`## Why it matters
68
47
  - Provides a regenerable onboarding/education engine tied to product signals.
69
48
  - Keeps tracks, steps, quizzes, and gamification consistent across surfaces.
70
49
 
@@ -74,17 +53,7 @@ ${"```"},
74
53
 
75
54
  ## Success criteria
76
55
  - Journey changes regenerate UI/API/events without drift.
77
- - Analytics/audit hooks exist for completions and streaks.`
78
- },
79
- {
80
- id: "docs.learning-journey.usage",
81
- title: "Learning Journey \u2014 Usage",
82
- summary: "How to compose, bind, and regenerate journeys safely.",
83
- kind: "usage",
84
- visibility: "public",
85
- route: "/docs/learning-journey/usage",
86
- tags: ["learning", "usage"],
87
- body: `## Setup
56
+ - Analytics/audit hooks exist for completions and streaks.`},{id:"docs.learning-journey.usage",title:"Learning Journey \u2014 Usage",summary:"How to compose, bind, and regenerate journeys safely.",kind:"usage",visibility:"public",route:"/docs/learning-journey/usage",tags:["learning","usage"],body:`## Setup
88
57
  1) Include \`learningJourneyEntities\` in schema composition.
89
58
  2) Register contracts/events from \`@contractspec/module.learning-journey\`.
90
59
  3) Bind steps to real product events (e.g., deal.created, run.completed).
@@ -97,17 +66,7 @@ ${"```"},
97
66
  ## Guardrails
98
67
  - Avoid hardcoded progression; keep engines declarative.
99
68
  - Emit analytics/audit for completions; respect user locale/accessibility in presentations.
100
- - Keep content free of PII; scope learners by org/tenant.`
101
- },
102
- {
103
- id: "docs.learning-journey.constraints",
104
- title: "Learning Journey \u2014 Constraints & Safety",
105
- summary: "Internal guardrails for progression, telemetry, and regeneration semantics.",
106
- kind: "reference",
107
- visibility: "internal",
108
- route: "/docs/learning-journey/constraints",
109
- tags: ["learning", "constraints", "internal"],
110
- body: `## Constraints
69
+ - Keep content free of PII; scope learners by org/tenant.`},{id:"docs.learning-journey.constraints",title:"Learning Journey \u2014 Constraints & Safety",summary:"Internal guardrails for progression, telemetry, and regeneration semantics.",kind:"reference",visibility:"internal",route:"/docs/learning-journey/constraints",tags:["learning","constraints","internal"],body:`## Constraints
111
70
  - Progression (tracks/modules/steps) and engines (SRS, streaks, XP) must stay declarative in spec.
112
71
  - Events to emit: learner.enrolled, step.completed, quiz.scored, streak.reset, xp.awarded.
113
72
  - Regeneration should not change scoring/streak rules without explicit spec change.
@@ -119,7 +78,4 @@ ${"```"},
119
78
  ## Verification
120
79
  - Add fixtures for streak/XP rule changes and quiz scoring.
121
80
  - Ensure Notifications/Audit wiring persists for completions; analytics emitted for progress.
122
- - Use Feature Flags to trial new tracks or reward rules; default safe/off.`
123
- }
124
- ];
125
- registerDocBlocks(learningJourneyDocBlocks);
81
+ - Use Feature Flags to trial new tracks or reward rules; default safe/off.`}];f(h);