@playcademy/sdk 0.24.0 → 0.24.1-beta.1
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/index.d.ts +146 -126
- package/dist/index.js +1 -1
- package/dist/internal.d.ts +2023 -1975
- package/dist/internal.js +3 -1
- package/dist/server/edge.js +1 -1
- package/dist/server.js +1 -1
- package/dist/types.d.ts +434 -410
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -225,132 +225,6 @@ declare const ASSESSMENT_PURPOSES: readonly ['end_of_course', 'diagnostic', 'rev
|
|
|
225
225
|
*/
|
|
226
226
|
declare const PLAYCADEMY_ASSESSMENT_CONTRACT_VERSION: 2;
|
|
227
227
|
|
|
228
|
-
/**
|
|
229
|
-
* User Types
|
|
230
|
-
*
|
|
231
|
-
* Enums, DTOs and API response types. Database row types are in @playcademy/data/types.
|
|
232
|
-
*
|
|
233
|
-
* @module types/user
|
|
234
|
-
*/
|
|
235
|
-
|
|
236
|
-
type UserRoleEnumType = UserRole;
|
|
237
|
-
type DeveloperStatusEnumType = 'none' | 'pending' | 'approved';
|
|
238
|
-
type TimebackUserRole = 'administrator' | 'aide' | 'guardian' | 'parent' | 'proctor' | 'relative' | 'student' | 'teacher';
|
|
239
|
-
type TimebackOrgType = 'department' | 'school' | 'district' | 'local' | 'state' | 'national';
|
|
240
|
-
interface UserEnrollment {
|
|
241
|
-
gameId?: string;
|
|
242
|
-
courseId: string;
|
|
243
|
-
id?: string;
|
|
244
|
-
grade: number;
|
|
245
|
-
subject: string;
|
|
246
|
-
orgId?: string;
|
|
247
|
-
}
|
|
248
|
-
interface UserOrganization {
|
|
249
|
-
id: string;
|
|
250
|
-
name: string | null;
|
|
251
|
-
type: TimebackOrgType | string;
|
|
252
|
-
isPrimary: boolean;
|
|
253
|
-
}
|
|
254
|
-
interface TimebackStudentProfile {
|
|
255
|
-
role: TimebackUserRole;
|
|
256
|
-
organizations: UserOrganization[];
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* Timeback identity on `/users/me`: who the student is, without enrollments.
|
|
260
|
-
* Enrollments come from `/timeback/user` (or `client.timeback.user`).
|
|
261
|
-
*/
|
|
262
|
-
interface UserTimebackProfile extends TimebackStudentProfile {
|
|
263
|
-
id: string;
|
|
264
|
-
}
|
|
265
|
-
type LocalDaySource = 'browser_last_seen' | 'platform_default';
|
|
266
|
-
interface LocalDayContext {
|
|
267
|
-
timeZone: string;
|
|
268
|
-
source: LocalDaySource;
|
|
269
|
-
/** ISO 8601 timestamp for the last persisted timezone observation. */
|
|
270
|
-
observedAt: string | null;
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* OpenID Connect UserInfo claims (NOT a database row).
|
|
274
|
-
*/
|
|
275
|
-
interface UserInfo {
|
|
276
|
-
sub: string;
|
|
277
|
-
email: string;
|
|
278
|
-
name: string | null;
|
|
279
|
-
email_verified?: boolean;
|
|
280
|
-
given_name?: string;
|
|
281
|
-
family_name?: string;
|
|
282
|
-
issuer?: string;
|
|
283
|
-
lti_roles?: unknown;
|
|
284
|
-
lti_context?: unknown;
|
|
285
|
-
lti_resource_link?: unknown;
|
|
286
|
-
timeback_id?: string;
|
|
287
|
-
}
|
|
288
|
-
interface DemoProfile {
|
|
289
|
-
displayName: string;
|
|
290
|
-
isDefault: boolean;
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* Update shape for `client.demo.profile.update(...)`.
|
|
294
|
-
*
|
|
295
|
-
* Kept as a named type so callers typed against it pick up new fields
|
|
296
|
-
* automatically, but `displayName` is the only updatable field today and
|
|
297
|
-
* the server's `DemoProfileSchema` requires it — a no-field payload would
|
|
298
|
-
* 400 at runtime, so we model that at the type level too. When additional
|
|
299
|
-
* fields land, make them required/optional individually based on server
|
|
300
|
-
* validation, rather than blanket-optional.
|
|
301
|
-
*/
|
|
302
|
-
interface DemoProfileUpdate {
|
|
303
|
-
displayName: string;
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* Authenticated user for API responses.
|
|
307
|
-
* Differs from UserRow: omits timebackId, adds hasTimebackAccount and timeback.
|
|
308
|
-
*/
|
|
309
|
-
interface AuthenticatedUser {
|
|
310
|
-
id: string;
|
|
311
|
-
email: string;
|
|
312
|
-
emailVerified: boolean;
|
|
313
|
-
name: string | null;
|
|
314
|
-
image: string | null;
|
|
315
|
-
username: string | null;
|
|
316
|
-
role: UserRoleEnumType;
|
|
317
|
-
developerStatus: DeveloperStatusEnumType;
|
|
318
|
-
createdAt: Date;
|
|
319
|
-
updatedAt: Date;
|
|
320
|
-
hasTimebackAccount: boolean;
|
|
321
|
-
localDay: LocalDayContext;
|
|
322
|
-
timeback?: UserTimebackProfile;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* Leaderboard Types
|
|
327
|
-
*
|
|
328
|
-
* @module types/leaderboard
|
|
329
|
-
*/
|
|
330
|
-
type LeaderboardTimeframe = 'all_time' | 'monthly' | 'weekly' | 'daily';
|
|
331
|
-
interface LeaderboardOptions {
|
|
332
|
-
timeframe?: LeaderboardTimeframe;
|
|
333
|
-
limit?: number;
|
|
334
|
-
offset?: number;
|
|
335
|
-
gameId?: string;
|
|
336
|
-
}
|
|
337
|
-
/**
|
|
338
|
-
* Leaderboard entry with required game context.
|
|
339
|
-
* Used when fetching leaderboards for a specific game.
|
|
340
|
-
*/
|
|
341
|
-
interface GameLeaderboardEntry {
|
|
342
|
-
rank: number;
|
|
343
|
-
userId: string;
|
|
344
|
-
username: string;
|
|
345
|
-
userImage?: string | null;
|
|
346
|
-
score: number;
|
|
347
|
-
achievedAt: Date;
|
|
348
|
-
metadata?: Record<string, unknown>;
|
|
349
|
-
gameId: string;
|
|
350
|
-
gameTitle: string;
|
|
351
|
-
gameSlug: string;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
228
|
/**
|
|
355
229
|
* TimeBack Enums & Literal Types
|
|
356
230
|
*
|
|
@@ -494,6 +368,12 @@ interface EndActivityScoreData {
|
|
|
494
368
|
* @module types/timeback/api
|
|
495
369
|
*/
|
|
496
370
|
|
|
371
|
+
/**
|
|
372
|
+
* `base` courses form a game's grade ladder (one active per grade and subject).
|
|
373
|
+
* `hole_filling` courses are remediation courses Timeback enrolls students into
|
|
374
|
+
* after a failed test; each sits beside a base course.
|
|
375
|
+
*/
|
|
376
|
+
type GameTimebackIntegrationKind = 'base' | 'hole_filling';
|
|
497
377
|
interface HeartbeatRequestBase {
|
|
498
378
|
gameId: string;
|
|
499
379
|
studentId: string;
|
|
@@ -1353,6 +1233,146 @@ interface FinalizeAssessmentInput extends AssessmentMasteryAward {
|
|
|
1353
1233
|
xpAwarded: number;
|
|
1354
1234
|
}
|
|
1355
1235
|
|
|
1236
|
+
/**
|
|
1237
|
+
* User Types
|
|
1238
|
+
*
|
|
1239
|
+
* Enums, DTOs and API response types. Database row types are in @playcademy/data/types.
|
|
1240
|
+
*
|
|
1241
|
+
* @module types/user
|
|
1242
|
+
*/
|
|
1243
|
+
|
|
1244
|
+
type UserRoleEnumType = UserRole;
|
|
1245
|
+
type DeveloperStatusEnumType = 'none' | 'pending' | 'approved';
|
|
1246
|
+
type TimebackUserRole = 'administrator' | 'aide' | 'guardian' | 'parent' | 'proctor' | 'relative' | 'student' | 'teacher';
|
|
1247
|
+
type TimebackOrgType = 'department' | 'school' | 'district' | 'local' | 'state' | 'national';
|
|
1248
|
+
interface UserEnrollment {
|
|
1249
|
+
gameId?: string;
|
|
1250
|
+
courseId: string;
|
|
1251
|
+
id?: string;
|
|
1252
|
+
grade: number;
|
|
1253
|
+
subject: string;
|
|
1254
|
+
orgId?: string;
|
|
1255
|
+
/**
|
|
1256
|
+
* `base` for the game's grade courses, `hole_filling` for a remediation
|
|
1257
|
+
* course Timeback enrolled the student in. Absent means `base`.
|
|
1258
|
+
*/
|
|
1259
|
+
kind?: GameTimebackIntegrationKind;
|
|
1260
|
+
/** For hole-filling enrollments: the course ID of the base course it belongs to. */
|
|
1261
|
+
baseCourseId?: string;
|
|
1262
|
+
/** For hole-filling enrollments: when the enrollment started (ISO 8601). */
|
|
1263
|
+
beginDate?: string | null;
|
|
1264
|
+
/**
|
|
1265
|
+
* For hole-filling enrollments: enrollment metadata as set by Timeback
|
|
1266
|
+
* (e.g. `assignmentId`, `testType`). Every field is optional.
|
|
1267
|
+
*/
|
|
1268
|
+
enrollmentMetadata?: Record<string, unknown>;
|
|
1269
|
+
}
|
|
1270
|
+
interface UserOrganization {
|
|
1271
|
+
id: string;
|
|
1272
|
+
name: string | null;
|
|
1273
|
+
type: TimebackOrgType | string;
|
|
1274
|
+
isPrimary: boolean;
|
|
1275
|
+
}
|
|
1276
|
+
interface TimebackStudentProfile {
|
|
1277
|
+
role: TimebackUserRole;
|
|
1278
|
+
organizations: UserOrganization[];
|
|
1279
|
+
}
|
|
1280
|
+
/**
|
|
1281
|
+
* Timeback identity on `/users/me`: who the student is, without enrollments.
|
|
1282
|
+
* Enrollments come from `/timeback/user` (or `client.timeback.user`).
|
|
1283
|
+
*/
|
|
1284
|
+
interface UserTimebackProfile extends TimebackStudentProfile {
|
|
1285
|
+
id: string;
|
|
1286
|
+
}
|
|
1287
|
+
type LocalDaySource = 'browser_last_seen' | 'platform_default';
|
|
1288
|
+
interface LocalDayContext {
|
|
1289
|
+
timeZone: string;
|
|
1290
|
+
source: LocalDaySource;
|
|
1291
|
+
/** ISO 8601 timestamp for the last persisted timezone observation. */
|
|
1292
|
+
observedAt: string | null;
|
|
1293
|
+
}
|
|
1294
|
+
/**
|
|
1295
|
+
* OpenID Connect UserInfo claims (NOT a database row).
|
|
1296
|
+
*/
|
|
1297
|
+
interface UserInfo {
|
|
1298
|
+
sub: string;
|
|
1299
|
+
email: string;
|
|
1300
|
+
name: string | null;
|
|
1301
|
+
email_verified?: boolean;
|
|
1302
|
+
given_name?: string;
|
|
1303
|
+
family_name?: string;
|
|
1304
|
+
issuer?: string;
|
|
1305
|
+
lti_roles?: unknown;
|
|
1306
|
+
lti_context?: unknown;
|
|
1307
|
+
lti_resource_link?: unknown;
|
|
1308
|
+
timeback_id?: string;
|
|
1309
|
+
}
|
|
1310
|
+
interface DemoProfile {
|
|
1311
|
+
displayName: string;
|
|
1312
|
+
isDefault: boolean;
|
|
1313
|
+
}
|
|
1314
|
+
/**
|
|
1315
|
+
* Update shape for `client.demo.profile.update(...)`.
|
|
1316
|
+
*
|
|
1317
|
+
* Kept as a named type so callers typed against it pick up new fields
|
|
1318
|
+
* automatically, but `displayName` is the only updatable field today and
|
|
1319
|
+
* the server's `DemoProfileSchema` requires it — a no-field payload would
|
|
1320
|
+
* 400 at runtime, so we model that at the type level too. When additional
|
|
1321
|
+
* fields land, make them required/optional individually based on server
|
|
1322
|
+
* validation, rather than blanket-optional.
|
|
1323
|
+
*/
|
|
1324
|
+
interface DemoProfileUpdate {
|
|
1325
|
+
displayName: string;
|
|
1326
|
+
}
|
|
1327
|
+
/**
|
|
1328
|
+
* Authenticated user for API responses.
|
|
1329
|
+
* Differs from UserRow: omits timebackId, adds hasTimebackAccount and timeback.
|
|
1330
|
+
*/
|
|
1331
|
+
interface AuthenticatedUser {
|
|
1332
|
+
id: string;
|
|
1333
|
+
email: string;
|
|
1334
|
+
emailVerified: boolean;
|
|
1335
|
+
name: string | null;
|
|
1336
|
+
image: string | null;
|
|
1337
|
+
username: string | null;
|
|
1338
|
+
role: UserRoleEnumType;
|
|
1339
|
+
developerStatus: DeveloperStatusEnumType;
|
|
1340
|
+
createdAt: Date;
|
|
1341
|
+
updatedAt: Date;
|
|
1342
|
+
hasTimebackAccount: boolean;
|
|
1343
|
+
localDay: LocalDayContext;
|
|
1344
|
+
timeback?: UserTimebackProfile;
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
/**
|
|
1348
|
+
* Leaderboard Types
|
|
1349
|
+
*
|
|
1350
|
+
* @module types/leaderboard
|
|
1351
|
+
*/
|
|
1352
|
+
type LeaderboardTimeframe = 'all_time' | 'monthly' | 'weekly' | 'daily';
|
|
1353
|
+
interface LeaderboardOptions {
|
|
1354
|
+
timeframe?: LeaderboardTimeframe;
|
|
1355
|
+
limit?: number;
|
|
1356
|
+
offset?: number;
|
|
1357
|
+
gameId?: string;
|
|
1358
|
+
}
|
|
1359
|
+
/**
|
|
1360
|
+
* Leaderboard entry with required game context.
|
|
1361
|
+
* Used when fetching leaderboards for a specific game.
|
|
1362
|
+
*/
|
|
1363
|
+
interface GameLeaderboardEntry {
|
|
1364
|
+
rank: number;
|
|
1365
|
+
userId: string;
|
|
1366
|
+
username: string;
|
|
1367
|
+
userImage?: string | null;
|
|
1368
|
+
score: number;
|
|
1369
|
+
achievedAt: Date;
|
|
1370
|
+
metadata?: Record<string, unknown>;
|
|
1371
|
+
gameId: string;
|
|
1372
|
+
gameTitle: string;
|
|
1373
|
+
gameSlug: string;
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1356
1376
|
/**
|
|
1357
1377
|
* Cache configuration types for runtime customization
|
|
1358
1378
|
*/
|
package/dist/index.js
CHANGED
|
@@ -3765,7 +3765,7 @@ async function request({
|
|
|
3765
3765
|
return rawText && rawText.length > 0 ? rawText : undefined;
|
|
3766
3766
|
}
|
|
3767
3767
|
// src/version.ts
|
|
3768
|
-
var SDK_VERSION = "0.24.
|
|
3768
|
+
var SDK_VERSION = "0.24.1-beta.1";
|
|
3769
3769
|
|
|
3770
3770
|
// src/clients/base.ts
|
|
3771
3771
|
class PlaycademyBaseClient {
|