@playcademy/sdk 0.9.1-beta.2 → 0.9.1-beta.3
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 +109 -602
- package/dist/index.d.ts +19 -1068
- package/dist/index.js +110 -754
- package/dist/internal.d.ts +2021 -7090
- package/dist/internal.js +171 -1163
- package/dist/server/edge.d.ts +9 -359
- package/dist/server.d.ts +9 -359
- package/dist/types.d.ts +550 -4692
- package/package.json +2 -3
package/dist/server/edge.d.ts
CHANGED
|
@@ -1,334 +1,9 @@
|
|
|
1
1
|
import { SchemaInfo } from '@playcademy/cloudflare';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* @module types/timeback/types
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* Valid TimeBack subject values for course configuration.
|
|
12
|
-
* These are the supported subject values for OneRoster courses.
|
|
13
|
-
*/
|
|
14
|
-
type TimebackSubject = 'Reading' | 'Language' | 'Vocabulary' | 'Social Studies' | 'Writing' | 'Science' | 'FastMath' | 'Math' | 'None';
|
|
15
|
-
/**
|
|
16
|
-
* Grade levels per AE OneRoster GradeEnum.
|
|
17
|
-
* -1 = Pre-K, 0 = Kindergarten, 1-12 = Grades 1-12, 13 = AP
|
|
18
|
-
*/
|
|
19
|
-
type TimebackGrade = -1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13;
|
|
20
|
-
/**
|
|
21
|
-
* Valid Caliper subject values.
|
|
22
|
-
* Matches OneRoster subjects, with "None" as a Caliper-specific fallback.
|
|
23
|
-
*/
|
|
24
|
-
type CaliperSubject = 'Reading' | 'Language' | 'Vocabulary' | 'Social Studies' | 'Writing' | 'Science' | 'FastMath' | 'Math' | 'None';
|
|
25
|
-
/**
|
|
26
|
-
* OneRoster organization types.
|
|
27
|
-
*/
|
|
28
|
-
type OrganizationType = 'department' | 'school' | 'district' | 'local' | 'state' | 'national';
|
|
29
|
-
/**
|
|
30
|
-
* Lesson types for PowerPath integration.
|
|
31
|
-
*/
|
|
32
|
-
type LessonType = 'powerpath-100' | 'quiz' | 'test-out' | 'placement' | 'unit-test' | 'alpha-read-article' | null;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* TimeBack Configuration Types
|
|
36
|
-
*
|
|
37
|
-
* Configuration interfaces for Organization, Course, Component,
|
|
38
|
-
* Resource, and complete TimeBack setup.
|
|
39
|
-
*
|
|
40
|
-
* @module types/timeback/config
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Organization configuration for TimeBack (user input - optionals allowed)
|
|
45
|
-
*/
|
|
46
|
-
interface OrganizationConfig {
|
|
47
|
-
/** Display name for your organization */
|
|
48
|
-
name?: string;
|
|
49
|
-
/** Organization type */
|
|
50
|
-
type?: OrganizationType;
|
|
51
|
-
/** Unique identifier (defaults to Playcademy's org) */
|
|
52
|
-
identifier?: string;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Course goals for daily student targets
|
|
56
|
-
*/
|
|
57
|
-
interface CourseGoals {
|
|
58
|
-
/** Target XP students should earn per day */
|
|
59
|
-
dailyXp?: number;
|
|
60
|
-
/** Target lessons per day */
|
|
61
|
-
dailyLessons?: number;
|
|
62
|
-
/** Target active minutes per day */
|
|
63
|
-
dailyActiveMinutes?: number;
|
|
64
|
-
/** Target accuracy percentage */
|
|
65
|
-
dailyAccuracy?: number;
|
|
66
|
-
/** Target mastered units per day */
|
|
67
|
-
dailyMasteredUnits?: number;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Course metrics and totals
|
|
71
|
-
*/
|
|
72
|
-
interface CourseMetrics {
|
|
73
|
-
/** Total XP available in the course */
|
|
74
|
-
totalXp?: number;
|
|
75
|
-
/** Total lessons/activities in the course */
|
|
76
|
-
totalLessons?: number;
|
|
77
|
-
/** Total number of grade levels covered by this course */
|
|
78
|
-
totalGrades?: number;
|
|
79
|
-
/** The type of course (e.g. 'optional', 'hole-filling', 'base') */
|
|
80
|
-
courseType?: 'base' | 'hole-filling' | 'optional' | 'Base' | 'Hole-Filling' | 'Optional';
|
|
81
|
-
/** Indicates whether the course is supplemental content */
|
|
82
|
-
isSupplemental?: boolean;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Complete course metadata structure
|
|
86
|
-
*/
|
|
87
|
-
interface CourseMetadata {
|
|
88
|
-
/** Define the type of course and priority for the student */
|
|
89
|
-
courseType?: 'base' | 'hole-filling' | 'optional';
|
|
90
|
-
/** Boolean value to determine if a course is supplemental to a base course */
|
|
91
|
-
isSupplemental?: boolean;
|
|
92
|
-
/** Boolean value to determine if a course is custom to an individual student */
|
|
93
|
-
isCustom?: boolean;
|
|
94
|
-
/** Signals whether a course is in production with students */
|
|
95
|
-
publishStatus?: 'draft' | 'testing' | 'published' | 'deactivated';
|
|
96
|
-
/** Whether this course appears in the TimeBack catalog for teachers and parents */
|
|
97
|
-
timebackVisible?: boolean;
|
|
98
|
-
/** Who to contact when issues reported with questions */
|
|
99
|
-
contactEmail?: string;
|
|
100
|
-
/** Primary app identifier */
|
|
101
|
-
primaryApp?: string;
|
|
102
|
-
/** Learning goals for students */
|
|
103
|
-
goals?: CourseGoals;
|
|
104
|
-
/** Course metrics and totals */
|
|
105
|
-
metrics?: CourseMetrics;
|
|
106
|
-
/** Vendor-specific metadata (e.g., AlphaLearn) */
|
|
107
|
-
[key: string]: unknown;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Course configuration for TimeBack (user input)
|
|
111
|
-
*/
|
|
112
|
-
interface CourseConfig {
|
|
113
|
-
/** Allocated OneRoster sourcedId (set after creation) */
|
|
114
|
-
sourcedId?: string;
|
|
115
|
-
/** Course title (defaults to game name) */
|
|
116
|
-
title?: string;
|
|
117
|
-
/** Subjects (REQUIRED for TimeBack integration) */
|
|
118
|
-
subjects: TimebackSubject[];
|
|
119
|
-
/** Used when recording progress/sessions if not explicitly specified per event. */
|
|
120
|
-
defaultSubject?: TimebackSubject;
|
|
121
|
-
/** Grade levels (REQUIRED for TimeBack integration) */
|
|
122
|
-
grades: TimebackGrade[];
|
|
123
|
-
/** Short course code (optional, auto-generated) */
|
|
124
|
-
courseCode?: string;
|
|
125
|
-
/** Course level (auto-derived from grades) */
|
|
126
|
-
level?: 'Elementary' | 'Middle' | 'High' | 'AP' | string;
|
|
127
|
-
/** Grading system */
|
|
128
|
-
gradingScheme?: 'STANDARD';
|
|
129
|
-
/** Total XP available in this course (REQUIRED before setup) */
|
|
130
|
-
totalXp?: number | null;
|
|
131
|
-
/** Total masterable units in this course (REQUIRED before setup) */
|
|
132
|
-
masterableUnits?: number | null;
|
|
133
|
-
/** Custom Playcademy metadata */
|
|
134
|
-
metadata?: CourseMetadata;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Component configuration for TimeBack (user input)
|
|
138
|
-
*/
|
|
139
|
-
interface ComponentConfig {
|
|
140
|
-
/** Component title (defaults to "{course.title} Activities") */
|
|
141
|
-
title?: string;
|
|
142
|
-
/** Display order */
|
|
143
|
-
sortOrder?: number;
|
|
144
|
-
/** Required prior components */
|
|
145
|
-
prerequisites?: string[];
|
|
146
|
-
/** How prerequisites work */
|
|
147
|
-
prerequisiteCriteria?: 'ALL' | 'ANY';
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Playcademy-specific resource extensions
|
|
151
|
-
*/
|
|
152
|
-
interface PlaycademyResourceMetadata {
|
|
153
|
-
/** Mastery configuration for tracking discrete learning units */
|
|
154
|
-
mastery?: {
|
|
155
|
-
/** Total number of masterable units in the resource */
|
|
156
|
-
masterableUnits: number;
|
|
157
|
-
/** Type of mastery unit for semantic clarity */
|
|
158
|
-
unitType?: 'level' | 'rank' | 'skill' | 'module';
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Resource configuration for TimeBack (user input)
|
|
163
|
-
*/
|
|
164
|
-
interface ResourceConfig {
|
|
165
|
-
/** Resource title (defaults to "{course.title} Game") */
|
|
166
|
-
title?: string;
|
|
167
|
-
/** Internal resource ID (auto-generated from package.json) */
|
|
168
|
-
vendorResourceId?: string;
|
|
169
|
-
/** Vendor identifier */
|
|
170
|
-
vendorId?: string;
|
|
171
|
-
/** Application identifier */
|
|
172
|
-
applicationId?: string;
|
|
173
|
-
/** Resource roles */
|
|
174
|
-
roles?: ('primary' | 'secondary')[];
|
|
175
|
-
/** Resource importance */
|
|
176
|
-
importance?: 'primary' | 'secondary';
|
|
177
|
-
/** Interactive resource metadata */
|
|
178
|
-
metadata?: {
|
|
179
|
-
/** Resource type */
|
|
180
|
-
type?: 'interactive';
|
|
181
|
-
/** Launch URL (defaults to Playcademy game URL) */
|
|
182
|
-
launchUrl?: string;
|
|
183
|
-
/** Platform name */
|
|
184
|
-
toolProvider?: string;
|
|
185
|
-
/** Teaching method */
|
|
186
|
-
instructionalMethod?: 'exploratory' | 'direct-instruction';
|
|
187
|
-
/** Subject area */
|
|
188
|
-
subject?: TimebackSubject;
|
|
189
|
-
/** Target grades */
|
|
190
|
-
grades?: TimebackGrade[];
|
|
191
|
-
/** Content language */
|
|
192
|
-
language?: string;
|
|
193
|
-
/** Base XP for completion */
|
|
194
|
-
xp?: number;
|
|
195
|
-
/** Playcademy-specific extensions */
|
|
196
|
-
playcademy?: PlaycademyResourceMetadata;
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Component Resource link configuration (user input)
|
|
201
|
-
*/
|
|
202
|
-
interface ComponentResourceConfig {
|
|
203
|
-
/** Link title (defaults to "{resource.title} Activity") */
|
|
204
|
-
title?: string;
|
|
205
|
-
/** Display order */
|
|
206
|
-
sortOrder?: number;
|
|
207
|
-
/** Lesson type for PowerPath integration */
|
|
208
|
-
lessonType?: LessonType;
|
|
209
|
-
}
|
|
210
|
-
interface TimebackCourseConfig {
|
|
211
|
-
subject: string;
|
|
212
|
-
grade: number;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* TimeBack Client SDK DTOs
|
|
217
|
-
*
|
|
218
|
-
* Data transfer objects for the TimeBack client SDK including
|
|
219
|
-
* progress tracking, session management, and activity completion.
|
|
220
|
-
*
|
|
221
|
-
* Note: TimebackClientConfig lives in @playcademy/timeback as it's
|
|
222
|
-
* SDK configuration, not a DTO.
|
|
223
|
-
*
|
|
224
|
-
* @module types/timeback/client
|
|
225
|
-
*/
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Known extensions for TimeBack Activity Metrics Collection
|
|
229
|
-
*/
|
|
230
|
-
interface TimebackActivityExtensions {
|
|
231
|
-
/** Percentage complete (0-100) for the app course */
|
|
232
|
-
pctCompleteApp?: number;
|
|
233
|
-
/** Allow other arbitrary extensions */
|
|
234
|
-
[key: string]: unknown;
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Activity data for ending an activity
|
|
238
|
-
*/
|
|
239
|
-
interface ActivityData {
|
|
240
|
-
/** Unique activity identifier (required) */
|
|
241
|
-
activityId: string;
|
|
242
|
-
/** Grade level for this activity (required for multi-grade course routing) */
|
|
243
|
-
grade: number;
|
|
244
|
-
/** Subject area (required for multi-grade course routing) */
|
|
245
|
-
subject: CaliperSubject;
|
|
246
|
-
/** Activity display name (optional) */
|
|
247
|
-
activityName?: string;
|
|
248
|
-
/** Course identifier (auto-filled from config if not provided) */
|
|
249
|
-
courseId?: string;
|
|
250
|
-
/** Course display name (auto-filled from config if not provided) */
|
|
251
|
-
courseName?: string;
|
|
252
|
-
/** Student email address (optional) */
|
|
253
|
-
studentEmail?: string;
|
|
254
|
-
/** Application name for Caliper events (defaults to 'Game') */
|
|
255
|
-
appName?: string;
|
|
256
|
-
/** Sensor URL for Caliper events (defaults to baseUrl) */
|
|
257
|
-
sensorUrl?: string;
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* Score data for activity completion
|
|
261
|
-
*/
|
|
262
|
-
interface ScoreData {
|
|
263
|
-
/** Number of questions answered correctly */
|
|
264
|
-
correctQuestions: number;
|
|
265
|
-
/** Total number of questions */
|
|
266
|
-
totalQuestions: number;
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Timing data for activity completion
|
|
270
|
-
*/
|
|
271
|
-
interface TimingData {
|
|
272
|
-
/** Duration of the activity in seconds */
|
|
273
|
-
durationSeconds: number;
|
|
274
|
-
}
|
|
275
|
-
/**
|
|
276
|
-
* Complete payload for ending an activity
|
|
277
|
-
*/
|
|
278
|
-
interface EndActivityPayload {
|
|
279
|
-
/** Activity metadata */
|
|
280
|
-
activityData: ActivityData;
|
|
281
|
-
/** Score information */
|
|
282
|
-
scoreData: ScoreData;
|
|
283
|
-
/** Timing information */
|
|
284
|
-
timingData: TimingData;
|
|
285
|
-
/** Explicit XP value to override automatic calculation */
|
|
286
|
-
xpEarned?: number;
|
|
287
|
-
/** Number of learning units mastered */
|
|
288
|
-
masteredUnits?: number;
|
|
289
|
-
/** Optional arbitrary extensions to include in the Caliper event */
|
|
290
|
-
extensions?: TimebackActivityExtensions;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* TimeBack API Request/Response Types
|
|
295
|
-
*
|
|
296
|
-
* Types for TimeBack API endpoints including XP tracking,
|
|
297
|
-
* setup, verification, and activity completion.
|
|
298
|
-
*
|
|
299
|
-
* @module types/timeback/api
|
|
300
|
-
*/
|
|
301
|
-
|
|
302
|
-
interface EndActivityResponse {
|
|
303
|
-
status: 'ok';
|
|
304
|
-
courseId: string;
|
|
305
|
-
xpAwarded: number;
|
|
306
|
-
masteredUnits?: number;
|
|
307
|
-
pctCompleteApp?: number;
|
|
308
|
-
scoreStatus?: string;
|
|
309
|
-
inProgress?: string;
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* XP data for a single course.
|
|
313
|
-
*/
|
|
314
|
-
interface StudentCourseXp {
|
|
315
|
-
grade: number;
|
|
316
|
-
subject: string;
|
|
317
|
-
title: string;
|
|
318
|
-
totalXp: number;
|
|
319
|
-
todayXp?: number;
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
* Response from student XP query.
|
|
323
|
-
*/
|
|
324
|
-
interface StudentXpResponse {
|
|
325
|
-
/** Total XP across all queried courses */
|
|
326
|
-
totalXp: number;
|
|
327
|
-
/** Today's XP (if requested) */
|
|
328
|
-
todayXp?: number;
|
|
329
|
-
/** Per-course XP breakdown (if requested) */
|
|
330
|
-
courses?: StudentCourseXp[];
|
|
331
|
-
}
|
|
2
|
+
import { TimebackCourseConfig, CourseConfig, OrganizationConfig, ComponentConfig, ResourceConfig, ComponentResourceConfig } from '@playcademy/types/timeback';
|
|
3
|
+
export { ActivityData, ComponentConfig, ComponentResourceConfig, EndActivityPayload, OrganizationConfig, ResourceConfig, TimebackGrade, TimebackSubject } from '@playcademy/types/timeback';
|
|
4
|
+
import { UserInfo } from '@playcademy/types/user';
|
|
5
|
+
export { UserInfo } from '@playcademy/types/user';
|
|
6
|
+
import * as _playcademy_types from '@playcademy/types';
|
|
332
7
|
|
|
333
8
|
/**
|
|
334
9
|
* @fileoverview Server SDK Type Definitions
|
|
@@ -447,7 +122,7 @@ interface PlaycademyConfig {
|
|
|
447
122
|
/** External URL (for external games) */
|
|
448
123
|
externalUrl?: string;
|
|
449
124
|
/** Game platform */
|
|
450
|
-
platform?: 'web' | '
|
|
125
|
+
platform?: 'web' | 'godot';
|
|
451
126
|
/** Integrations (database, custom routes, external services) */
|
|
452
127
|
integrations?: IntegrationsConfig;
|
|
453
128
|
}
|
|
@@ -553,31 +228,6 @@ interface BackendDeploymentBundle {
|
|
|
553
228
|
compatibilityFlags?: string[];
|
|
554
229
|
}
|
|
555
230
|
|
|
556
|
-
/**
|
|
557
|
-
* User Types
|
|
558
|
-
*
|
|
559
|
-
* Enums, DTOs and API response types. Database row types are in @playcademy/data/types.
|
|
560
|
-
*
|
|
561
|
-
* @module types/user
|
|
562
|
-
*/
|
|
563
|
-
|
|
564
|
-
/**
|
|
565
|
-
* OpenID Connect UserInfo claims (NOT a database row).
|
|
566
|
-
*/
|
|
567
|
-
interface UserInfo {
|
|
568
|
-
sub: string;
|
|
569
|
-
email: string;
|
|
570
|
-
name: string | null;
|
|
571
|
-
email_verified?: boolean;
|
|
572
|
-
given_name?: string;
|
|
573
|
-
family_name?: string;
|
|
574
|
-
issuer?: string;
|
|
575
|
-
lti_roles?: unknown;
|
|
576
|
-
lti_context?: unknown;
|
|
577
|
-
lti_resource_link?: unknown;
|
|
578
|
-
timeback_id?: string;
|
|
579
|
-
}
|
|
580
|
-
|
|
581
231
|
/**
|
|
582
232
|
* Server-side Playcademy client for recording student activity to TimeBack.
|
|
583
233
|
*
|
|
@@ -642,12 +292,12 @@ declare class PlaycademyClient {
|
|
|
642
292
|
get config(): PlaycademyServerClientState['config'];
|
|
643
293
|
/** TimeBack integration methods (endActivity) */
|
|
644
294
|
timeback: {
|
|
645
|
-
endActivity: (studentId: string, payload: EndActivityPayload) => Promise<EndActivityResponse>;
|
|
295
|
+
endActivity: (studentId: string, payload: _playcademy_types.EndActivityPayload) => Promise<_playcademy_types.EndActivityResponse>;
|
|
646
296
|
getStudentXp: (studentId: string, options?: {
|
|
647
297
|
grade?: number;
|
|
648
298
|
subject?: string;
|
|
649
299
|
include?: ('perCourse' | 'today')[];
|
|
650
|
-
}) => Promise<StudentXpResponse>;
|
|
300
|
+
}) => Promise<_playcademy_types.StudentXpResponse>;
|
|
651
301
|
};
|
|
652
302
|
}
|
|
653
303
|
|
|
@@ -710,4 +360,4 @@ declare function verifyGameToken(gameToken: string, options?: {
|
|
|
710
360
|
}): Promise<VerifyGameTokenResponse>;
|
|
711
361
|
|
|
712
362
|
export { PlaycademyClient, verifyGameToken };
|
|
713
|
-
export type {
|
|
363
|
+
export type { BackendDeploymentBundle, BackendResourceBindings, IntegrationsConfig, PlaycademyConfig, PlaycademyServerClientConfig, PlaycademyServerClientState, QueueConfig, TimebackBaseConfig, TimebackCourseConfigWithOverrides, TimebackIntegrationConfig };
|