@contractspec/module.learning-journey 3.7.15 → 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.
- package/dist/browser/contracts/index.js +1 -578
- package/dist/browser/contracts/models.js +1 -193
- package/dist/browser/contracts/onboarding.js +1 -417
- package/dist/browser/contracts/operations.js +1 -326
- package/dist/browser/contracts/shared.js +1 -5
- package/dist/browser/docs/index.js +7 -51
- package/dist/browser/docs/learning-journey.docblock.js +7 -51
- package/dist/browser/engines/index.js +1 -675
- package/dist/browser/engines/srs.js +1 -198
- package/dist/browser/engines/streak.js +1 -159
- package/dist/browser/engines/xp.js +1 -320
- package/dist/browser/entities/ai.js +1 -343
- package/dist/browser/entities/course.js +1 -276
- package/dist/browser/entities/flashcard.js +1 -222
- package/dist/browser/entities/gamification.js +1 -340
- package/dist/browser/entities/index.js +1 -2140
- package/dist/browser/entities/learner.js +1 -333
- package/dist/browser/entities/onboarding.js +1 -301
- package/dist/browser/entities/quiz.js +1 -304
- package/dist/browser/events.js +1 -423
- package/dist/browser/i18n/catalogs/en.js +1 -43
- package/dist/browser/i18n/catalogs/es.js +1 -43
- package/dist/browser/i18n/catalogs/fr.js +1 -43
- package/dist/browser/i18n/catalogs/index.js +1 -127
- package/dist/browser/i18n/index.js +1 -169
- package/dist/browser/i18n/keys.js +1 -16
- package/dist/browser/i18n/locale.js +1 -13
- package/dist/browser/i18n/messages.js +1 -139
- package/dist/browser/index.js +7 -3914
- package/dist/browser/learning-journey.capability.js +1 -43
- package/dist/browser/learning-journey.feature.js +1 -56
- package/dist/contracts/index.js +1 -578
- package/dist/contracts/models.js +1 -193
- package/dist/contracts/onboarding.js +1 -417
- package/dist/contracts/operations.js +1 -326
- package/dist/contracts/shared.js +1 -5
- package/dist/docs/index.js +7 -51
- package/dist/docs/learning-journey.docblock.js +7 -51
- package/dist/engines/index.js +1 -675
- package/dist/engines/srs.js +1 -198
- package/dist/engines/streak.js +1 -159
- package/dist/engines/xp.js +1 -320
- package/dist/entities/ai.js +1 -343
- package/dist/entities/course.js +1 -276
- package/dist/entities/flashcard.js +1 -222
- package/dist/entities/gamification.js +1 -340
- package/dist/entities/index.js +1 -2140
- package/dist/entities/learner.js +1 -333
- package/dist/entities/onboarding.js +1 -301
- package/dist/entities/quiz.js +1 -304
- package/dist/events.js +1 -423
- package/dist/i18n/catalogs/en.js +1 -43
- package/dist/i18n/catalogs/es.js +1 -43
- package/dist/i18n/catalogs/fr.js +1 -43
- package/dist/i18n/catalogs/index.js +1 -127
- package/dist/i18n/index.js +1 -169
- package/dist/i18n/keys.js +1 -16
- package/dist/i18n/locale.js +1 -13
- package/dist/i18n/messages.js +1 -139
- package/dist/index.js +7 -3914
- package/dist/learning-journey.capability.js +1 -43
- package/dist/learning-journey.feature.js +1 -56
- package/dist/node/contracts/index.js +1 -578
- package/dist/node/contracts/models.js +1 -193
- package/dist/node/contracts/onboarding.js +1 -417
- package/dist/node/contracts/operations.js +1 -326
- package/dist/node/contracts/shared.js +1 -5
- package/dist/node/docs/index.js +7 -51
- package/dist/node/docs/learning-journey.docblock.js +7 -51
- package/dist/node/engines/index.js +1 -675
- package/dist/node/engines/srs.js +1 -198
- package/dist/node/engines/streak.js +1 -159
- package/dist/node/engines/xp.js +1 -320
- package/dist/node/entities/ai.js +1 -343
- package/dist/node/entities/course.js +1 -276
- package/dist/node/entities/flashcard.js +1 -222
- package/dist/node/entities/gamification.js +1 -340
- package/dist/node/entities/index.js +1 -2140
- package/dist/node/entities/learner.js +1 -333
- package/dist/node/entities/onboarding.js +1 -301
- package/dist/node/entities/quiz.js +1 -304
- package/dist/node/events.js +1 -423
- package/dist/node/i18n/catalogs/en.js +1 -43
- package/dist/node/i18n/catalogs/es.js +1 -43
- package/dist/node/i18n/catalogs/fr.js +1 -43
- package/dist/node/i18n/catalogs/index.js +1 -127
- package/dist/node/i18n/index.js +1 -169
- package/dist/node/i18n/keys.js +1 -16
- package/dist/node/i18n/locale.js +1 -13
- package/dist/node/i18n/messages.js +1 -139
- package/dist/node/index.js +7 -3914
- package/dist/node/learning-journey.capability.js +1 -43
- package/dist/node/learning-journey.feature.js +1 -56
- package/package.json +7 -7
|
@@ -1,193 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
3
|
-
var CourseModel = defineSchemaModel({
|
|
4
|
-
name: "Course",
|
|
5
|
-
description: "A learning course",
|
|
6
|
-
fields: {
|
|
7
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
8
|
-
title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
9
|
-
slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
10
|
-
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
11
|
-
difficulty: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
12
|
-
status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
13
|
-
estimatedDuration: {
|
|
14
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
15
|
-
isOptional: true
|
|
16
|
-
},
|
|
17
|
-
thumbnailUrl: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
18
|
-
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
var LearnerModel = defineSchemaModel({
|
|
22
|
-
name: "Learner",
|
|
23
|
-
description: "A learner profile",
|
|
24
|
-
fields: {
|
|
25
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
26
|
-
userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
27
|
-
displayName: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
28
|
-
level: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
29
|
-
totalXp: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
30
|
-
currentStreak: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
31
|
-
longestStreak: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
32
|
-
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
var EnrollmentModel = defineSchemaModel({
|
|
36
|
-
name: "Enrollment",
|
|
37
|
-
description: "A course enrollment",
|
|
38
|
-
fields: {
|
|
39
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
40
|
-
learnerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
41
|
-
courseId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
42
|
-
status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
43
|
-
progress: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
44
|
-
startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
45
|
-
completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
var ProgressModel = defineSchemaModel({
|
|
49
|
-
name: "LessonProgress",
|
|
50
|
-
description: "Lesson progress",
|
|
51
|
-
fields: {
|
|
52
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
53
|
-
learnerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
54
|
-
lessonId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
55
|
-
status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
56
|
-
progress: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
57
|
-
score: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
58
|
-
timeSpent: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
59
|
-
completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
var DeckModel = defineSchemaModel({
|
|
63
|
-
name: "Deck",
|
|
64
|
-
description: "A flashcard deck",
|
|
65
|
-
fields: {
|
|
66
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
67
|
-
title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
68
|
-
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
69
|
-
cardCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
70
|
-
isPublic: { type: ScalarTypeEnum.Boolean(), isOptional: false },
|
|
71
|
-
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
var CardModel = defineSchemaModel({
|
|
75
|
-
name: "Card",
|
|
76
|
-
description: "A flashcard",
|
|
77
|
-
fields: {
|
|
78
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
79
|
-
deckId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
80
|
-
front: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
81
|
-
back: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
82
|
-
hints: { type: ScalarTypeEnum.JSON(), isOptional: true },
|
|
83
|
-
isDue: { type: ScalarTypeEnum.Boolean(), isOptional: false },
|
|
84
|
-
nextReviewAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
var AchievementModel = defineSchemaModel({
|
|
88
|
-
name: "Achievement",
|
|
89
|
-
description: "An achievement",
|
|
90
|
-
fields: {
|
|
91
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
92
|
-
key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
93
|
-
name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
94
|
-
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
95
|
-
icon: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
96
|
-
xpReward: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
97
|
-
unlockedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
var EnrollInCourseInput = defineSchemaModel({
|
|
101
|
-
name: "EnrollInCourseInput",
|
|
102
|
-
description: "Input for enrolling in a course",
|
|
103
|
-
fields: {
|
|
104
|
-
courseId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
var CompleteLessonInput = defineSchemaModel({
|
|
108
|
-
name: "CompleteLessonInput",
|
|
109
|
-
description: "Input for completing a lesson",
|
|
110
|
-
fields: {
|
|
111
|
-
lessonId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
112
|
-
score: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
113
|
-
timeSpent: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false }
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
var SubmitCardReviewInput = defineSchemaModel({
|
|
117
|
-
name: "SubmitCardReviewInput",
|
|
118
|
-
description: "Input for submitting a card review",
|
|
119
|
-
fields: {
|
|
120
|
-
cardId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
121
|
-
rating: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
122
|
-
responseTimeMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true }
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
var GetDueCardsInput = defineSchemaModel({
|
|
126
|
-
name: "GetDueCardsInput",
|
|
127
|
-
description: "Input for getting due cards",
|
|
128
|
-
fields: {
|
|
129
|
-
deckId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
130
|
-
limit: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true }
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
var GetDueCardsOutput = defineSchemaModel({
|
|
134
|
-
name: "GetDueCardsOutput",
|
|
135
|
-
description: "Output for getting due cards",
|
|
136
|
-
fields: {
|
|
137
|
-
cards: { type: CardModel, isArray: true, isOptional: false },
|
|
138
|
-
total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false }
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
var GetLearnerDashboardInput = defineSchemaModel({
|
|
142
|
-
name: "GetLearnerDashboardInput",
|
|
143
|
-
description: "Input for getting learner dashboard",
|
|
144
|
-
fields: {
|
|
145
|
-
learnerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
var LearnerDashboardModel = defineSchemaModel({
|
|
149
|
-
name: "LearnerDashboard",
|
|
150
|
-
description: "Learner dashboard data",
|
|
151
|
-
fields: {
|
|
152
|
-
learner: { type: LearnerModel, isOptional: false },
|
|
153
|
-
currentStreak: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
154
|
-
dailyXpGoal: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
155
|
-
dailyXpProgress: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
156
|
-
activeEnrollments: {
|
|
157
|
-
type: EnrollmentModel,
|
|
158
|
-
isArray: true,
|
|
159
|
-
isOptional: false
|
|
160
|
-
},
|
|
161
|
-
recentAchievements: {
|
|
162
|
-
type: AchievementModel,
|
|
163
|
-
isArray: true,
|
|
164
|
-
isOptional: false
|
|
165
|
-
},
|
|
166
|
-
dueCardCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false }
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
var SuccessOutput = defineSchemaModel({
|
|
170
|
-
name: "SuccessOutput",
|
|
171
|
-
description: "Generic success output",
|
|
172
|
-
fields: {
|
|
173
|
-
success: { type: ScalarTypeEnum.Boolean(), isOptional: false },
|
|
174
|
-
xpEarned: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true }
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
export {
|
|
178
|
-
SuccessOutput,
|
|
179
|
-
SubmitCardReviewInput,
|
|
180
|
-
ProgressModel,
|
|
181
|
-
LearnerModel,
|
|
182
|
-
LearnerDashboardModel,
|
|
183
|
-
GetLearnerDashboardInput,
|
|
184
|
-
GetDueCardsOutput,
|
|
185
|
-
GetDueCardsInput,
|
|
186
|
-
EnrollmentModel,
|
|
187
|
-
EnrollInCourseInput,
|
|
188
|
-
DeckModel,
|
|
189
|
-
CourseModel,
|
|
190
|
-
CompleteLessonInput,
|
|
191
|
-
CardModel,
|
|
192
|
-
AchievementModel
|
|
193
|
-
};
|
|
1
|
+
import{defineSchemaModel as t,ScalarTypeEnum as e}from"@contractspec/lib.schema";var p=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}}}),n=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}}}),s=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}}}),l=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}}}),u=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}}}),i=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}}}),r=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}}}),o=t({name:"EnrollInCourseInput",description:"Input for enrolling in a course",fields:{courseId:{type:e.String_unsecure(),isOptional:!1}}}),c=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}}}),d=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}}}),f=t({name:"GetDueCardsInput",description:"Input for getting due cards",fields:{deckId:{type:e.String_unsecure(),isOptional:!0},limit:{type:e.Int_unsecure(),isOptional:!0}}}),y=t({name:"GetDueCardsOutput",description:"Output for getting due cards",fields:{cards:{type:i,isArray:!0,isOptional:!1},total:{type:e.Int_unsecure(),isOptional:!1}}}),O=t({name:"GetLearnerDashboardInput",description:"Input for getting learner dashboard",fields:{learnerId:{type:e.String_unsecure(),isOptional:!0}}}),_=t({name:"LearnerDashboard",description:"Learner dashboard data",fields:{learner:{type:n,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:s,isArray:!0,isOptional:!1},recentAchievements:{type:r,isArray:!0,isOptional:!1},dueCardCount:{type:e.Int_unsecure(),isOptional:!1}}}),g=t({name:"SuccessOutput",description:"Generic success output",fields:{success:{type:e.Boolean(),isOptional:!1},xpEarned:{type:e.Int_unsecure(),isOptional:!0}}});export{g as SuccessOutput,d as SubmitCardReviewInput,l as ProgressModel,n as LearnerModel,_ as LearnerDashboardModel,O as GetLearnerDashboardInput,y as GetDueCardsOutput,f as GetDueCardsInput,s as EnrollmentModel,o as EnrollInCourseInput,u as DeckModel,p as CourseModel,c as CompleteLessonInput,i as CardModel,r as AchievementModel};
|
|
@@ -1,417 +1 @@
|
|
|
1
|
-
// src/contracts/models.ts
|
|
2
|
-
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
3
|
-
var CourseModel = defineSchemaModel({
|
|
4
|
-
name: "Course",
|
|
5
|
-
description: "A learning course",
|
|
6
|
-
fields: {
|
|
7
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
8
|
-
title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
9
|
-
slug: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
10
|
-
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
11
|
-
difficulty: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
12
|
-
status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
13
|
-
estimatedDuration: {
|
|
14
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
15
|
-
isOptional: true
|
|
16
|
-
},
|
|
17
|
-
thumbnailUrl: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
18
|
-
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
var LearnerModel = defineSchemaModel({
|
|
22
|
-
name: "Learner",
|
|
23
|
-
description: "A learner profile",
|
|
24
|
-
fields: {
|
|
25
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
26
|
-
userId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
27
|
-
displayName: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
28
|
-
level: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
29
|
-
totalXp: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
30
|
-
currentStreak: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
31
|
-
longestStreak: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
32
|
-
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
var EnrollmentModel = defineSchemaModel({
|
|
36
|
-
name: "Enrollment",
|
|
37
|
-
description: "A course enrollment",
|
|
38
|
-
fields: {
|
|
39
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
40
|
-
learnerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
41
|
-
courseId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
42
|
-
status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
43
|
-
progress: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
44
|
-
startedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true },
|
|
45
|
-
completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
var ProgressModel = defineSchemaModel({
|
|
49
|
-
name: "LessonProgress",
|
|
50
|
-
description: "Lesson progress",
|
|
51
|
-
fields: {
|
|
52
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
53
|
-
learnerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
54
|
-
lessonId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
55
|
-
status: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
56
|
-
progress: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
57
|
-
score: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
58
|
-
timeSpent: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
59
|
-
completedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
var DeckModel = defineSchemaModel({
|
|
63
|
-
name: "Deck",
|
|
64
|
-
description: "A flashcard deck",
|
|
65
|
-
fields: {
|
|
66
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
67
|
-
title: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
68
|
-
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
69
|
-
cardCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
70
|
-
isPublic: { type: ScalarTypeEnum.Boolean(), isOptional: false },
|
|
71
|
-
createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false }
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
var CardModel = defineSchemaModel({
|
|
75
|
-
name: "Card",
|
|
76
|
-
description: "A flashcard",
|
|
77
|
-
fields: {
|
|
78
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
79
|
-
deckId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
80
|
-
front: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
81
|
-
back: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
82
|
-
hints: { type: ScalarTypeEnum.JSON(), isOptional: true },
|
|
83
|
-
isDue: { type: ScalarTypeEnum.Boolean(), isOptional: false },
|
|
84
|
-
nextReviewAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
var AchievementModel = defineSchemaModel({
|
|
88
|
-
name: "Achievement",
|
|
89
|
-
description: "An achievement",
|
|
90
|
-
fields: {
|
|
91
|
-
id: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
92
|
-
key: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
93
|
-
name: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
94
|
-
description: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
95
|
-
icon: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
96
|
-
xpReward: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
97
|
-
unlockedAt: { type: ScalarTypeEnum.DateTime(), isOptional: true }
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
var EnrollInCourseInput = defineSchemaModel({
|
|
101
|
-
name: "EnrollInCourseInput",
|
|
102
|
-
description: "Input for enrolling in a course",
|
|
103
|
-
fields: {
|
|
104
|
-
courseId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
var CompleteLessonInput = defineSchemaModel({
|
|
108
|
-
name: "CompleteLessonInput",
|
|
109
|
-
description: "Input for completing a lesson",
|
|
110
|
-
fields: {
|
|
111
|
-
lessonId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
112
|
-
score: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true },
|
|
113
|
-
timeSpent: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false }
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
var SubmitCardReviewInput = defineSchemaModel({
|
|
117
|
-
name: "SubmitCardReviewInput",
|
|
118
|
-
description: "Input for submitting a card review",
|
|
119
|
-
fields: {
|
|
120
|
-
cardId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
121
|
-
rating: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
122
|
-
responseTimeMs: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true }
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
var GetDueCardsInput = defineSchemaModel({
|
|
126
|
-
name: "GetDueCardsInput",
|
|
127
|
-
description: "Input for getting due cards",
|
|
128
|
-
fields: {
|
|
129
|
-
deckId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },
|
|
130
|
-
limit: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true }
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
var GetDueCardsOutput = defineSchemaModel({
|
|
134
|
-
name: "GetDueCardsOutput",
|
|
135
|
-
description: "Output for getting due cards",
|
|
136
|
-
fields: {
|
|
137
|
-
cards: { type: CardModel, isArray: true, isOptional: false },
|
|
138
|
-
total: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false }
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
var GetLearnerDashboardInput = defineSchemaModel({
|
|
142
|
-
name: "GetLearnerDashboardInput",
|
|
143
|
-
description: "Input for getting learner dashboard",
|
|
144
|
-
fields: {
|
|
145
|
-
learnerId: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
var LearnerDashboardModel = defineSchemaModel({
|
|
149
|
-
name: "LearnerDashboard",
|
|
150
|
-
description: "Learner dashboard data",
|
|
151
|
-
fields: {
|
|
152
|
-
learner: { type: LearnerModel, isOptional: false },
|
|
153
|
-
currentStreak: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
154
|
-
dailyXpGoal: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
155
|
-
dailyXpProgress: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
156
|
-
activeEnrollments: {
|
|
157
|
-
type: EnrollmentModel,
|
|
158
|
-
isArray: true,
|
|
159
|
-
isOptional: false
|
|
160
|
-
},
|
|
161
|
-
recentAchievements: {
|
|
162
|
-
type: AchievementModel,
|
|
163
|
-
isArray: true,
|
|
164
|
-
isOptional: false
|
|
165
|
-
},
|
|
166
|
-
dueCardCount: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false }
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
var SuccessOutput = defineSchemaModel({
|
|
170
|
-
name: "SuccessOutput",
|
|
171
|
-
description: "Generic success output",
|
|
172
|
-
fields: {
|
|
173
|
-
success: { type: ScalarTypeEnum.Boolean(), isOptional: false },
|
|
174
|
-
xpEarned: { type: ScalarTypeEnum.Int_unsecure(), isOptional: true }
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
// src/contracts/shared.ts
|
|
179
|
-
var LEARNING_JOURNEY_OWNERS = ["modules.learning-journey"];
|
|
180
|
-
|
|
181
|
-
// src/contracts/onboarding.ts
|
|
182
|
-
import { defineCommand, defineQuery } from "@contractspec/lib.contracts-spec";
|
|
183
|
-
import { defineSchemaModel as defineSchemaModel2, ScalarTypeEnum as ScalarTypeEnum2 } from "@contractspec/lib.schema";
|
|
184
|
-
var OnboardingStepConditionModel = defineSchemaModel2({
|
|
185
|
-
name: "OnboardingStepCondition",
|
|
186
|
-
description: "Structured completion condition for onboarding steps.",
|
|
187
|
-
fields: {
|
|
188
|
-
eventName: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
189
|
-
eventVersion: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
190
|
-
sourceModule: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
191
|
-
payloadFilter: { type: ScalarTypeEnum2.JSON(), isOptional: true }
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
var OnboardingStepModel = defineSchemaModel2({
|
|
195
|
-
name: "OnboardingStep",
|
|
196
|
-
description: "Declarative onboarding step definition.",
|
|
197
|
-
fields: {
|
|
198
|
-
id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
199
|
-
trackId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
200
|
-
title: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
201
|
-
description: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
202
|
-
instructions: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
203
|
-
helpUrl: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
204
|
-
order: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
|
|
205
|
-
completionEvent: {
|
|
206
|
-
type: ScalarTypeEnum2.String_unsecure(),
|
|
207
|
-
isOptional: false
|
|
208
|
-
},
|
|
209
|
-
completionCondition: {
|
|
210
|
-
type: OnboardingStepConditionModel,
|
|
211
|
-
isOptional: true
|
|
212
|
-
},
|
|
213
|
-
xpReward: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true },
|
|
214
|
-
isRequired: { type: ScalarTypeEnum2.Boolean(), isOptional: true },
|
|
215
|
-
canSkip: { type: ScalarTypeEnum2.Boolean(), isOptional: true },
|
|
216
|
-
actionUrl: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
217
|
-
actionLabel: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
218
|
-
metadata: { type: ScalarTypeEnum2.JSON(), isOptional: true }
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
var OnboardingTrackModel = defineSchemaModel2({
|
|
222
|
-
name: "OnboardingTrack",
|
|
223
|
-
description: "Onboarding track metadata and steps.",
|
|
224
|
-
fields: {
|
|
225
|
-
id: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
226
|
-
productId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
227
|
-
name: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
228
|
-
description: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
229
|
-
targetUserSegment: {
|
|
230
|
-
type: ScalarTypeEnum2.String_unsecure(),
|
|
231
|
-
isOptional: true
|
|
232
|
-
},
|
|
233
|
-
targetRole: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
234
|
-
isActive: { type: ScalarTypeEnum2.Boolean(), isOptional: true },
|
|
235
|
-
isRequired: { type: ScalarTypeEnum2.Boolean(), isOptional: true },
|
|
236
|
-
canSkip: { type: ScalarTypeEnum2.Boolean(), isOptional: true },
|
|
237
|
-
totalXp: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true },
|
|
238
|
-
completionXpBonus: {
|
|
239
|
-
type: ScalarTypeEnum2.Int_unsecure(),
|
|
240
|
-
isOptional: true
|
|
241
|
-
},
|
|
242
|
-
completionBadgeKey: {
|
|
243
|
-
type: ScalarTypeEnum2.String_unsecure(),
|
|
244
|
-
isOptional: true
|
|
245
|
-
},
|
|
246
|
-
streakHoursWindow: {
|
|
247
|
-
type: ScalarTypeEnum2.Int_unsecure(),
|
|
248
|
-
isOptional: true
|
|
249
|
-
},
|
|
250
|
-
streakBonusXp: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true },
|
|
251
|
-
metadata: { type: ScalarTypeEnum2.JSON(), isOptional: true },
|
|
252
|
-
steps: { type: OnboardingStepModel, isArray: true, isOptional: false }
|
|
253
|
-
}
|
|
254
|
-
});
|
|
255
|
-
var OnboardingStepProgressModel = defineSchemaModel2({
|
|
256
|
-
name: "OnboardingStepProgress",
|
|
257
|
-
description: "Progress for a specific onboarding step.",
|
|
258
|
-
fields: {
|
|
259
|
-
stepId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
260
|
-
status: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
261
|
-
xpEarned: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true },
|
|
262
|
-
triggeringEvent: {
|
|
263
|
-
type: ScalarTypeEnum2.String_unsecure(),
|
|
264
|
-
isOptional: true
|
|
265
|
-
},
|
|
266
|
-
eventPayload: { type: ScalarTypeEnum2.JSON(), isOptional: true },
|
|
267
|
-
completedAt: { type: ScalarTypeEnum2.DateTime(), isOptional: true }
|
|
268
|
-
}
|
|
269
|
-
});
|
|
270
|
-
var OnboardingProgressModel = defineSchemaModel2({
|
|
271
|
-
name: "OnboardingProgress",
|
|
272
|
-
description: "Aggregated progress for an onboarding track.",
|
|
273
|
-
fields: {
|
|
274
|
-
learnerId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
275
|
-
trackId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
276
|
-
progress: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: false },
|
|
277
|
-
isCompleted: { type: ScalarTypeEnum2.Boolean(), isOptional: false },
|
|
278
|
-
xpEarned: { type: ScalarTypeEnum2.Int_unsecure(), isOptional: true },
|
|
279
|
-
startedAt: { type: ScalarTypeEnum2.DateTime(), isOptional: true },
|
|
280
|
-
completedAt: { type: ScalarTypeEnum2.DateTime(), isOptional: true },
|
|
281
|
-
lastActivityAt: { type: ScalarTypeEnum2.DateTime(), isOptional: true },
|
|
282
|
-
steps: {
|
|
283
|
-
type: OnboardingStepProgressModel,
|
|
284
|
-
isArray: true,
|
|
285
|
-
isOptional: true
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
});
|
|
289
|
-
var ListOnboardingTracksInput = defineSchemaModel2({
|
|
290
|
-
name: "ListOnboardingTracksInput",
|
|
291
|
-
description: "Filters for listing onboarding tracks.",
|
|
292
|
-
fields: {
|
|
293
|
-
learnerId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
294
|
-
productId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
295
|
-
trackIds: {
|
|
296
|
-
type: ScalarTypeEnum2.String_unsecure(),
|
|
297
|
-
isArray: true,
|
|
298
|
-
isOptional: true
|
|
299
|
-
},
|
|
300
|
-
includeProgress: {
|
|
301
|
-
type: ScalarTypeEnum2.Boolean(),
|
|
302
|
-
isOptional: true
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
});
|
|
306
|
-
var ListOnboardingTracksOutput = defineSchemaModel2({
|
|
307
|
-
name: "ListOnboardingTracksOutput",
|
|
308
|
-
description: "Available onboarding tracks with optional progress.",
|
|
309
|
-
fields: {
|
|
310
|
-
tracks: { type: OnboardingTrackModel, isArray: true, isOptional: false },
|
|
311
|
-
progress: {
|
|
312
|
-
type: OnboardingProgressModel,
|
|
313
|
-
isArray: true,
|
|
314
|
-
isOptional: true
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
});
|
|
318
|
-
var GetOnboardingProgressInput = defineSchemaModel2({
|
|
319
|
-
name: "GetOnboardingProgressInput",
|
|
320
|
-
description: "Input for fetching onboarding progress for a track.",
|
|
321
|
-
fields: {
|
|
322
|
-
trackId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
323
|
-
learnerId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true }
|
|
324
|
-
}
|
|
325
|
-
});
|
|
326
|
-
var RecordOnboardingEventInput = defineSchemaModel2({
|
|
327
|
-
name: "RecordOnboardingEventInput",
|
|
328
|
-
description: "Record a domain event to advance onboarding progress via completion conditions.",
|
|
329
|
-
fields: {
|
|
330
|
-
learnerId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
331
|
-
trackId: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
332
|
-
eventName: { type: ScalarTypeEnum2.String_unsecure(), isOptional: false },
|
|
333
|
-
eventVersion: { type: ScalarTypeEnum2.String_unsecure(), isOptional: true },
|
|
334
|
-
eventPayload: { type: ScalarTypeEnum2.JSON(), isOptional: true },
|
|
335
|
-
occurredAt: { type: ScalarTypeEnum2.DateTime(), isOptional: true }
|
|
336
|
-
}
|
|
337
|
-
});
|
|
338
|
-
var ListOnboardingTracksContract = defineQuery({
|
|
339
|
-
meta: {
|
|
340
|
-
key: "learning.onboarding.listTracks",
|
|
341
|
-
version: "1.0.0",
|
|
342
|
-
stability: "stable",
|
|
343
|
-
owners: [...LEARNING_JOURNEY_OWNERS],
|
|
344
|
-
tags: ["learning", "onboarding", "journey"],
|
|
345
|
-
description: "List onboarding tracks available to a learner or product.",
|
|
346
|
-
goal: "Expose track catalog for UI/API surfaces.",
|
|
347
|
-
context: "Called when showing onboarding/learning journey catalog."
|
|
348
|
-
},
|
|
349
|
-
io: {
|
|
350
|
-
input: ListOnboardingTracksInput,
|
|
351
|
-
output: ListOnboardingTracksOutput
|
|
352
|
-
},
|
|
353
|
-
policy: {
|
|
354
|
-
auth: "user"
|
|
355
|
-
}
|
|
356
|
-
});
|
|
357
|
-
var GetOnboardingProgressContract = defineQuery({
|
|
358
|
-
meta: {
|
|
359
|
-
key: "learning.onboarding.getProgress",
|
|
360
|
-
version: "1.0.0",
|
|
361
|
-
stability: "stable",
|
|
362
|
-
owners: [...LEARNING_JOURNEY_OWNERS],
|
|
363
|
-
tags: ["learning", "onboarding", "journey"],
|
|
364
|
-
description: "Fetch onboarding progress for a specific track.",
|
|
365
|
-
goal: "Display learner progress and remaining steps.",
|
|
366
|
-
context: "Called when rendering a track detail or widget."
|
|
367
|
-
},
|
|
368
|
-
io: {
|
|
369
|
-
input: GetOnboardingProgressInput,
|
|
370
|
-
output: OnboardingProgressModel
|
|
371
|
-
},
|
|
372
|
-
policy: {
|
|
373
|
-
auth: "user"
|
|
374
|
-
}
|
|
375
|
-
});
|
|
376
|
-
var RecordOnboardingEventContract = defineCommand({
|
|
377
|
-
meta: {
|
|
378
|
-
key: "learning.onboarding.recordEvent",
|
|
379
|
-
version: "1.0.0",
|
|
380
|
-
stability: "stable",
|
|
381
|
-
owners: [...LEARNING_JOURNEY_OWNERS],
|
|
382
|
-
tags: ["learning", "onboarding", "events"],
|
|
383
|
-
description: "Record a domain event to evaluate onboarding step completion conditions.",
|
|
384
|
-
goal: "Advance onboarding automatically from product events.",
|
|
385
|
-
context: "Called by event bus handlers when relevant product events fire (e.g., deal.created)."
|
|
386
|
-
},
|
|
387
|
-
io: {
|
|
388
|
-
input: RecordOnboardingEventInput,
|
|
389
|
-
output: SuccessOutput,
|
|
390
|
-
errors: {
|
|
391
|
-
TRACK_NOT_FOUND: {
|
|
392
|
-
description: "Track not found for event routing",
|
|
393
|
-
http: 404,
|
|
394
|
-
gqlCode: "TRACK_NOT_FOUND",
|
|
395
|
-
when: "Track ID or routing context is invalid"
|
|
396
|
-
},
|
|
397
|
-
STEP_NOT_FOUND: {
|
|
398
|
-
description: "Step not found for completion condition",
|
|
399
|
-
http: 404,
|
|
400
|
-
gqlCode: "STEP_NOT_FOUND",
|
|
401
|
-
when: "No step matches the incoming event"
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
},
|
|
405
|
-
policy: {
|
|
406
|
-
auth: "user"
|
|
407
|
-
}
|
|
408
|
-
});
|
|
409
|
-
export {
|
|
410
|
-
RecordOnboardingEventContract,
|
|
411
|
-
OnboardingTrackModel,
|
|
412
|
-
OnboardingStepProgressModel,
|
|
413
|
-
OnboardingStepModel,
|
|
414
|
-
OnboardingProgressModel,
|
|
415
|
-
ListOnboardingTracksContract,
|
|
416
|
-
GetOnboardingProgressContract
|
|
417
|
-
};
|
|
1
|
+
import{defineSchemaModel as s,ScalarTypeEnum as e}from"@contractspec/lib.schema";var C=s({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}}}),u=s({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}}}),l=s({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}}}),v=s({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}}}),k=s({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}}}),a=s({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}}}),f=s({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}}}),L=s({name:"EnrollInCourseInput",description:"Input for enrolling in a course",fields:{courseId:{type:e.String_unsecure(),isOptional:!1}}}),w=s({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}}}),G=s({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}}}),h=s({name:"GetDueCardsInput",description:"Input for getting due cards",fields:{deckId:{type:e.String_unsecure(),isOptional:!0},limit:{type:e.Int_unsecure(),isOptional:!0}}}),B=s({name:"GetDueCardsOutput",description:"Output for getting due cards",fields:{cards:{type:a,isArray:!0,isOptional:!1},total:{type:e.Int_unsecure(),isOptional:!1}}}),X=s({name:"GetLearnerDashboardInput",description:"Input for getting learner dashboard",fields:{learnerId:{type:e.String_unsecure(),isOptional:!0}}}),j=s({name:"LearnerDashboard",description:"Learner dashboard data",fields:{learner:{type:u,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:l,isArray:!0,isOptional:!1},recentAchievements:{type:f,isArray:!0,isOptional:!1},dueCardCount:{type:e.Int_unsecure(),isOptional:!1}}}),r=s({name:"SuccessOutput",description:"Generic success output",fields:{success:{type:e.Boolean(),isOptional:!1},xpEarned:{type:e.Int_unsecure(),isOptional:!0}}});var n=["modules.learning-journey"];import{defineCommand as d,defineQuery as o}from"@contractspec/lib.contracts-spec";import{defineSchemaModel as i,ScalarTypeEnum as t}from"@contractspec/lib.schema";var O=i({name:"OnboardingStepCondition",description:"Structured completion condition for onboarding steps.",fields:{eventName:{type:t.String_unsecure(),isOptional:!1},eventVersion:{type:t.String_unsecure(),isOptional:!0},sourceModule:{type:t.String_unsecure(),isOptional:!0},payloadFilter:{type:t.JSON(),isOptional:!0}}}),c=i({name:"OnboardingStep",description:"Declarative onboarding step definition.",fields:{id:{type:t.String_unsecure(),isOptional:!1},trackId:{type:t.String_unsecure(),isOptional:!1},title:{type:t.String_unsecure(),isOptional:!1},description:{type:t.String_unsecure(),isOptional:!0},instructions:{type:t.String_unsecure(),isOptional:!0},helpUrl:{type:t.String_unsecure(),isOptional:!0},order:{type:t.Int_unsecure(),isOptional:!1},completionEvent:{type:t.String_unsecure(),isOptional:!1},completionCondition:{type:O,isOptional:!0},xpReward:{type:t.Int_unsecure(),isOptional:!0},isRequired:{type:t.Boolean(),isOptional:!0},canSkip:{type:t.Boolean(),isOptional:!0},actionUrl:{type:t.String_unsecure(),isOptional:!0},actionLabel:{type:t.String_unsecure(),isOptional:!0},metadata:{type:t.JSON(),isOptional:!0}}}),_=i({name:"OnboardingTrack",description:"Onboarding track metadata and steps.",fields:{id:{type:t.String_unsecure(),isOptional:!1},productId:{type:t.String_unsecure(),isOptional:!0},name:{type:t.String_unsecure(),isOptional:!1},description:{type:t.String_unsecure(),isOptional:!0},targetUserSegment:{type:t.String_unsecure(),isOptional:!0},targetRole:{type:t.String_unsecure(),isOptional:!0},isActive:{type:t.Boolean(),isOptional:!0},isRequired:{type:t.Boolean(),isOptional:!0},canSkip:{type:t.Boolean(),isOptional:!0},totalXp:{type:t.Int_unsecure(),isOptional:!0},completionXpBonus:{type:t.Int_unsecure(),isOptional:!0},completionBadgeKey:{type:t.String_unsecure(),isOptional:!0},streakHoursWindow:{type:t.Int_unsecure(),isOptional:!0},streakBonusXp:{type:t.Int_unsecure(),isOptional:!0},metadata:{type:t.JSON(),isOptional:!0},steps:{type:c,isArray:!0,isOptional:!1}}}),I=i({name:"OnboardingStepProgress",description:"Progress for a specific onboarding step.",fields:{stepId:{type:t.String_unsecure(),isOptional:!1},status:{type:t.String_unsecure(),isOptional:!1},xpEarned:{type:t.Int_unsecure(),isOptional:!0},triggeringEvent:{type:t.String_unsecure(),isOptional:!0},eventPayload:{type:t.JSON(),isOptional:!0},completedAt:{type:t.DateTime(),isOptional:!0}}}),p=i({name:"OnboardingProgress",description:"Aggregated progress for an onboarding track.",fields:{learnerId:{type:t.String_unsecure(),isOptional:!0},trackId:{type:t.String_unsecure(),isOptional:!1},progress:{type:t.Int_unsecure(),isOptional:!1},isCompleted:{type:t.Boolean(),isOptional:!1},xpEarned:{type:t.Int_unsecure(),isOptional:!0},startedAt:{type:t.DateTime(),isOptional:!0},completedAt:{type:t.DateTime(),isOptional:!0},lastActivityAt:{type:t.DateTime(),isOptional:!0},steps:{type:I,isArray:!0,isOptional:!0}}}),g=i({name:"ListOnboardingTracksInput",description:"Filters for listing onboarding tracks.",fields:{learnerId:{type:t.String_unsecure(),isOptional:!0},productId:{type:t.String_unsecure(),isOptional:!0},trackIds:{type:t.String_unsecure(),isArray:!0,isOptional:!0},includeProgress:{type:t.Boolean(),isOptional:!0}}}),y=i({name:"ListOnboardingTracksOutput",description:"Available onboarding tracks with optional progress.",fields:{tracks:{type:_,isArray:!0,isOptional:!1},progress:{type:p,isArray:!0,isOptional:!0}}}),D=i({name:"GetOnboardingProgressInput",description:"Input for fetching onboarding progress for a track.",fields:{trackId:{type:t.String_unsecure(),isOptional:!1},learnerId:{type:t.String_unsecure(),isOptional:!0}}}),x=i({name:"RecordOnboardingEventInput",description:"Record a domain event to advance onboarding progress via completion conditions.",fields:{learnerId:{type:t.String_unsecure(),isOptional:!1},trackId:{type:t.String_unsecure(),isOptional:!0},eventName:{type:t.String_unsecure(),isOptional:!1},eventVersion:{type:t.String_unsecure(),isOptional:!0},eventPayload:{type:t.JSON(),isOptional:!0},occurredAt:{type:t.DateTime(),isOptional:!0}}}),P=o({meta:{key:"learning.onboarding.listTracks",version:"1.0.0",stability:"stable",owners:[...n],tags:["learning","onboarding","journey"],description:"List onboarding tracks available to a learner or product.",goal:"Expose track catalog for UI/API surfaces.",context:"Called when showing onboarding/learning journey catalog."},io:{input:g,output:y},policy:{auth:"user"}}),V=o({meta:{key:"learning.onboarding.getProgress",version:"1.0.0",stability:"stable",owners:[...n],tags:["learning","onboarding","journey"],description:"Fetch onboarding progress for a specific track.",goal:"Display learner progress and remaining steps.",context:"Called when rendering a track detail or widget."},io:{input:D,output:p},policy:{auth:"user"}}),Z=d({meta:{key:"learning.onboarding.recordEvent",version:"1.0.0",stability:"stable",owners:[...n],tags:["learning","onboarding","events"],description:"Record a domain event to evaluate onboarding step completion conditions.",goal:"Advance onboarding automatically from product events.",context:"Called by event bus handlers when relevant product events fire (e.g., deal.created)."},io:{input:x,output:r,errors:{TRACK_NOT_FOUND:{description:"Track not found for event routing",http:404,gqlCode:"TRACK_NOT_FOUND",when:"Track ID or routing context is invalid"},STEP_NOT_FOUND:{description:"Step not found for completion condition",http:404,gqlCode:"STEP_NOT_FOUND",when:"No step matches the incoming event"}}},policy:{auth:"user"}});export{Z as RecordOnboardingEventContract,_ as OnboardingTrackModel,I as OnboardingStepProgressModel,c as OnboardingStepModel,p as OnboardingProgressModel,P as ListOnboardingTracksContract,V as GetOnboardingProgressContract};
|