@contractspec/module.learning-journey 3.7.6 → 3.7.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -188
- package/dist/browser/contracts/index.js +148 -148
- package/dist/browser/contracts/models.js +1 -1
- package/dist/browser/contracts/onboarding.js +5 -5
- package/dist/browser/contracts/operations.js +4 -4
- package/dist/browser/engines/index.js +173 -173
- package/dist/browser/engines/xp.js +18 -18
- package/dist/browser/events.js +1 -1
- package/dist/browser/i18n/catalogs/index.js +18 -18
- package/dist/browser/i18n/index.js +26 -26
- package/dist/browser/i18n/locale.js +2 -2
- package/dist/browser/i18n/messages.js +18 -18
- package/dist/browser/index.js +336 -335
- package/dist/contracts/index.d.ts +2 -2
- package/dist/contracts/index.js +148 -148
- package/dist/contracts/models.js +1 -1
- package/dist/contracts/onboarding.js +5 -5
- package/dist/contracts/operations.js +4 -4
- package/dist/engines/index.d.ts +1 -1
- package/dist/engines/index.js +173 -173
- package/dist/engines/xp.js +18 -18
- package/dist/events.js +1 -1
- package/dist/i18n/catalogs/index.d.ts +1 -1
- package/dist/i18n/catalogs/index.js +18 -18
- package/dist/i18n/index.d.ts +7 -7
- package/dist/i18n/index.js +26 -26
- package/dist/i18n/locale.d.ts +1 -1
- package/dist/i18n/locale.js +2 -2
- package/dist/i18n/messages.js +18 -18
- package/dist/index.d.ts +3 -3
- package/dist/index.js +336 -335
- package/dist/node/contracts/index.js +148 -148
- package/dist/node/contracts/models.js +1 -1
- package/dist/node/contracts/onboarding.js +5 -5
- package/dist/node/contracts/operations.js +4 -4
- package/dist/node/engines/index.js +173 -173
- package/dist/node/engines/xp.js +18 -18
- package/dist/node/events.js +1 -1
- package/dist/node/i18n/catalogs/index.js +18 -18
- package/dist/node/i18n/index.js +26 -26
- package/dist/node/i18n/locale.js +2 -2
- package/dist/node/i18n/messages.js +18 -18
- package/dist/node/index.js +336 -335
- package/package.json +7 -7
package/dist/contracts/index.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
// src/contracts/shared.ts
|
|
3
|
-
var LEARNING_JOURNEY_OWNERS = ["modules.learning-journey"];
|
|
4
|
-
|
|
5
2
|
// src/contracts/models.ts
|
|
6
|
-
import {
|
|
3
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
7
4
|
var CourseModel = defineSchemaModel({
|
|
8
5
|
name: "Course",
|
|
9
6
|
description: "A learning course",
|
|
@@ -179,149 +176,12 @@ var SuccessOutput = defineSchemaModel({
|
|
|
179
176
|
}
|
|
180
177
|
});
|
|
181
178
|
|
|
182
|
-
// src/contracts/
|
|
183
|
-
|
|
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
|
-
});
|
|
179
|
+
// src/contracts/shared.ts
|
|
180
|
+
var LEARNING_JOURNEY_OWNERS = ["modules.learning-journey"];
|
|
321
181
|
|
|
322
182
|
// src/contracts/onboarding.ts
|
|
323
|
-
import {
|
|
324
|
-
import {
|
|
183
|
+
import { defineCommand, defineQuery } from "@contractspec/lib.contracts-spec";
|
|
184
|
+
import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
|
|
325
185
|
var OnboardingStepConditionModel = defineSchemaModel2({
|
|
326
186
|
name: "OnboardingStepCondition",
|
|
327
187
|
description: "Structured completion condition for onboarding steps.",
|
|
@@ -476,7 +336,7 @@ var RecordOnboardingEventInput = defineSchemaModel2({
|
|
|
476
336
|
occurredAt: { type: ScalarTypeEnum2.DateTime(), isOptional: true }
|
|
477
337
|
}
|
|
478
338
|
});
|
|
479
|
-
var ListOnboardingTracksContract =
|
|
339
|
+
var ListOnboardingTracksContract = defineQuery({
|
|
480
340
|
meta: {
|
|
481
341
|
key: "learning.onboarding.listTracks",
|
|
482
342
|
version: "1.0.0",
|
|
@@ -495,7 +355,7 @@ var ListOnboardingTracksContract = defineQuery2({
|
|
|
495
355
|
auth: "user"
|
|
496
356
|
}
|
|
497
357
|
});
|
|
498
|
-
var GetOnboardingProgressContract =
|
|
358
|
+
var GetOnboardingProgressContract = defineQuery({
|
|
499
359
|
meta: {
|
|
500
360
|
key: "learning.onboarding.getProgress",
|
|
501
361
|
version: "1.0.0",
|
|
@@ -514,7 +374,7 @@ var GetOnboardingProgressContract = defineQuery2({
|
|
|
514
374
|
auth: "user"
|
|
515
375
|
}
|
|
516
376
|
});
|
|
517
|
-
var RecordOnboardingEventContract =
|
|
377
|
+
var RecordOnboardingEventContract = defineCommand({
|
|
518
378
|
meta: {
|
|
519
379
|
key: "learning.onboarding.recordEvent",
|
|
520
380
|
version: "1.0.0",
|
|
@@ -547,6 +407,146 @@ var RecordOnboardingEventContract = defineCommand2({
|
|
|
547
407
|
auth: "user"
|
|
548
408
|
}
|
|
549
409
|
});
|
|
410
|
+
|
|
411
|
+
// src/contracts/operations.ts
|
|
412
|
+
import { defineCommand as defineCommand2, defineQuery as defineQuery2 } from "@contractspec/lib.contracts-spec";
|
|
413
|
+
var EnrollInCourseContract = defineCommand2({
|
|
414
|
+
meta: {
|
|
415
|
+
key: "learning.enroll",
|
|
416
|
+
version: "1.0.0",
|
|
417
|
+
stability: "stable",
|
|
418
|
+
owners: [...LEARNING_JOURNEY_OWNERS],
|
|
419
|
+
tags: ["learning", "enrollment"],
|
|
420
|
+
description: "Enroll in a course.",
|
|
421
|
+
goal: "Start learning a new course.",
|
|
422
|
+
context: "Called when a learner wants to start a course."
|
|
423
|
+
},
|
|
424
|
+
io: {
|
|
425
|
+
input: EnrollInCourseInput,
|
|
426
|
+
output: EnrollmentModel,
|
|
427
|
+
errors: {
|
|
428
|
+
COURSE_NOT_FOUND: {
|
|
429
|
+
description: "Course does not exist",
|
|
430
|
+
http: 404,
|
|
431
|
+
gqlCode: "COURSE_NOT_FOUND",
|
|
432
|
+
when: "Course ID is invalid"
|
|
433
|
+
},
|
|
434
|
+
ALREADY_ENROLLED: {
|
|
435
|
+
description: "Already enrolled in course",
|
|
436
|
+
http: 409,
|
|
437
|
+
gqlCode: "ALREADY_ENROLLED",
|
|
438
|
+
when: "Learner is already enrolled"
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
policy: {
|
|
443
|
+
auth: "user"
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
var CompleteLessonContract = defineCommand2({
|
|
447
|
+
meta: {
|
|
448
|
+
key: "learning.completeLesson",
|
|
449
|
+
version: "1.0.0",
|
|
450
|
+
stability: "stable",
|
|
451
|
+
owners: [...LEARNING_JOURNEY_OWNERS],
|
|
452
|
+
tags: ["learning", "progress"],
|
|
453
|
+
description: "Mark a lesson as completed.",
|
|
454
|
+
goal: "Record lesson completion and earn XP.",
|
|
455
|
+
context: "Called when a learner finishes a lesson."
|
|
456
|
+
},
|
|
457
|
+
io: {
|
|
458
|
+
input: CompleteLessonInput,
|
|
459
|
+
output: SuccessOutput,
|
|
460
|
+
errors: {
|
|
461
|
+
LESSON_NOT_FOUND: {
|
|
462
|
+
description: "Lesson does not exist",
|
|
463
|
+
http: 404,
|
|
464
|
+
gqlCode: "LESSON_NOT_FOUND",
|
|
465
|
+
when: "Lesson ID is invalid"
|
|
466
|
+
},
|
|
467
|
+
NOT_ENROLLED: {
|
|
468
|
+
description: "Not enrolled in course",
|
|
469
|
+
http: 403,
|
|
470
|
+
gqlCode: "NOT_ENROLLED",
|
|
471
|
+
when: "Learner is not enrolled in the course"
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
},
|
|
475
|
+
policy: {
|
|
476
|
+
auth: "user"
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
var SubmitCardReviewContract = defineCommand2({
|
|
480
|
+
meta: {
|
|
481
|
+
key: "learning.submitCardReview",
|
|
482
|
+
version: "1.0.0",
|
|
483
|
+
stability: "stable",
|
|
484
|
+
owners: [...LEARNING_JOURNEY_OWNERS],
|
|
485
|
+
tags: ["learning", "flashcards"],
|
|
486
|
+
description: "Submit a flashcard review.",
|
|
487
|
+
goal: "Record review and update SRS schedule.",
|
|
488
|
+
context: "Called when reviewing flashcards."
|
|
489
|
+
},
|
|
490
|
+
io: {
|
|
491
|
+
input: SubmitCardReviewInput,
|
|
492
|
+
output: SuccessOutput,
|
|
493
|
+
errors: {
|
|
494
|
+
CARD_NOT_FOUND: {
|
|
495
|
+
description: "Card does not exist",
|
|
496
|
+
http: 404,
|
|
497
|
+
gqlCode: "CARD_NOT_FOUND",
|
|
498
|
+
when: "Card ID is invalid"
|
|
499
|
+
},
|
|
500
|
+
INVALID_RATING: {
|
|
501
|
+
description: "Invalid rating",
|
|
502
|
+
http: 400,
|
|
503
|
+
gqlCode: "INVALID_RATING",
|
|
504
|
+
when: "Rating must be AGAIN, HARD, GOOD, or EASY"
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
},
|
|
508
|
+
policy: {
|
|
509
|
+
auth: "user"
|
|
510
|
+
}
|
|
511
|
+
});
|
|
512
|
+
var GetDueCardsContract = defineQuery2({
|
|
513
|
+
meta: {
|
|
514
|
+
key: "learning.getDueCards",
|
|
515
|
+
version: "1.0.0",
|
|
516
|
+
stability: "stable",
|
|
517
|
+
owners: [...LEARNING_JOURNEY_OWNERS],
|
|
518
|
+
tags: ["learning", "flashcards"],
|
|
519
|
+
description: "Get flashcards due for review.",
|
|
520
|
+
goal: "Get the next batch of cards to review.",
|
|
521
|
+
context: "Called when starting a review session."
|
|
522
|
+
},
|
|
523
|
+
io: {
|
|
524
|
+
input: GetDueCardsInput,
|
|
525
|
+
output: GetDueCardsOutput
|
|
526
|
+
},
|
|
527
|
+
policy: {
|
|
528
|
+
auth: "user"
|
|
529
|
+
}
|
|
530
|
+
});
|
|
531
|
+
var GetLearnerDashboardContract = defineQuery2({
|
|
532
|
+
meta: {
|
|
533
|
+
key: "learning.getDashboard",
|
|
534
|
+
version: "1.0.0",
|
|
535
|
+
stability: "stable",
|
|
536
|
+
owners: [...LEARNING_JOURNEY_OWNERS],
|
|
537
|
+
tags: ["learning", "dashboard"],
|
|
538
|
+
description: "Get learner dashboard data.",
|
|
539
|
+
goal: "Display learner progress and stats.",
|
|
540
|
+
context: "Called when viewing the learning dashboard."
|
|
541
|
+
},
|
|
542
|
+
io: {
|
|
543
|
+
input: GetLearnerDashboardInput,
|
|
544
|
+
output: LearnerDashboardModel
|
|
545
|
+
},
|
|
546
|
+
policy: {
|
|
547
|
+
auth: "user"
|
|
548
|
+
}
|
|
549
|
+
});
|
|
550
550
|
export {
|
|
551
551
|
SuccessOutput,
|
|
552
552
|
SubmitCardReviewInput,
|
package/dist/contracts/models.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
// src/contracts/models.ts
|
|
3
|
-
import {
|
|
3
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
4
4
|
var CourseModel = defineSchemaModel({
|
|
5
5
|
name: "Course",
|
|
6
6
|
description: "A learning course",
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
// src/contracts/shared.ts
|
|
3
|
-
var LEARNING_JOURNEY_OWNERS = ["modules.learning-journey"];
|
|
4
|
-
|
|
5
2
|
// src/contracts/models.ts
|
|
6
|
-
import {
|
|
3
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
7
4
|
var CourseModel = defineSchemaModel({
|
|
8
5
|
name: "Course",
|
|
9
6
|
description: "A learning course",
|
|
@@ -179,9 +176,12 @@ var SuccessOutput = defineSchemaModel({
|
|
|
179
176
|
}
|
|
180
177
|
});
|
|
181
178
|
|
|
179
|
+
// src/contracts/shared.ts
|
|
180
|
+
var LEARNING_JOURNEY_OWNERS = ["modules.learning-journey"];
|
|
181
|
+
|
|
182
182
|
// src/contracts/onboarding.ts
|
|
183
|
-
import { ScalarTypeEnum as ScalarTypeEnum2, defineSchemaModel as defineSchemaModel2 } from "@contractspec/lib.schema";
|
|
184
183
|
import { defineCommand, defineQuery } from "@contractspec/lib.contracts-spec";
|
|
184
|
+
import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
|
|
185
185
|
var OnboardingStepConditionModel = defineSchemaModel2({
|
|
186
186
|
name: "OnboardingStepCondition",
|
|
187
187
|
description: "Structured completion condition for onboarding steps.",
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
// src/contracts/shared.ts
|
|
3
|
-
var LEARNING_JOURNEY_OWNERS = ["modules.learning-journey"];
|
|
4
|
-
|
|
5
2
|
// src/contracts/models.ts
|
|
6
|
-
import {
|
|
3
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
7
4
|
var CourseModel = defineSchemaModel({
|
|
8
5
|
name: "Course",
|
|
9
6
|
description: "A learning course",
|
|
@@ -179,6 +176,9 @@ var SuccessOutput = defineSchemaModel({
|
|
|
179
176
|
}
|
|
180
177
|
});
|
|
181
178
|
|
|
179
|
+
// src/contracts/shared.ts
|
|
180
|
+
var LEARNING_JOURNEY_OWNERS = ["modules.learning-journey"];
|
|
181
|
+
|
|
182
182
|
// src/contracts/operations.ts
|
|
183
183
|
import { defineCommand, defineQuery } from "@contractspec/lib.contracts-spec";
|
|
184
184
|
var EnrollInCourseContract = defineCommand({
|
package/dist/engines/index.d.ts
CHANGED