playcademy 0.22.1-beta.3 → 0.22.2-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/cli.js +2 -2
- package/dist/constants.js +1 -1
- package/dist/db.js +1 -1
- package/dist/index.js +4 -2
- package/dist/runtime/backend-runtime/index.js +117 -4
- package/dist/runtime/backend-runtime/manifest.json +4 -4
- package/dist/utils.js +4 -2
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -1065,7 +1065,7 @@ var SAMPLE_BUCKET_FILENAME = "bucket.ts";
|
|
|
1065
1065
|
// ../better-auth/package.json
|
|
1066
1066
|
var package_default = {
|
|
1067
1067
|
name: "@playcademy/better-auth",
|
|
1068
|
-
version: "0.0.
|
|
1068
|
+
version: "0.0.15-beta.1",
|
|
1069
1069
|
type: "module",
|
|
1070
1070
|
exports: {
|
|
1071
1071
|
"./server": {
|
|
@@ -2909,7 +2909,7 @@ import { existsSync as existsSync11, mkdirSync as mkdirSync5, readFileSync as re
|
|
|
2909
2909
|
import { join as join13 } from "node:path";
|
|
2910
2910
|
|
|
2911
2911
|
// src/version.ts
|
|
2912
|
-
var cliVersion = false ? "0.0.0-dev" : "0.22.
|
|
2912
|
+
var cliVersion = false ? "0.0.0-dev" : "0.22.2-beta.1";
|
|
2913
2913
|
|
|
2914
2914
|
// src/lib/init/database.ts
|
|
2915
2915
|
var drizzleConfigTemplate = loadTemplateString("database/drizzle-config.ts");
|
package/dist/constants.js
CHANGED
package/dist/db.js
CHANGED
|
@@ -36,7 +36,7 @@ var DEFAULT_API_ROUTES_DIRECTORY = join2(SERVER_ROOT_DIRECTORY, "api");
|
|
|
36
36
|
// ../better-auth/package.json
|
|
37
37
|
var package_default = {
|
|
38
38
|
name: "@playcademy/better-auth",
|
|
39
|
-
version: "0.0.
|
|
39
|
+
version: "0.0.15-beta.1",
|
|
40
40
|
type: "module",
|
|
41
41
|
exports: {
|
|
42
42
|
"./server": {
|
package/dist/index.js
CHANGED
|
@@ -326,7 +326,7 @@ var SAMPLE_BUCKET_FILENAME = "bucket.ts";
|
|
|
326
326
|
// ../better-auth/package.json
|
|
327
327
|
var package_default = {
|
|
328
328
|
name: "@playcademy/better-auth",
|
|
329
|
-
version: "0.0.
|
|
329
|
+
version: "0.0.15-beta.1",
|
|
330
330
|
type: "module",
|
|
331
331
|
exports: {
|
|
332
332
|
"./server": {
|
|
@@ -534,6 +534,7 @@ var LOG_COLLECTOR_URL = "https://logs.playcademy.gg";
|
|
|
534
534
|
var TIMEBACK_ROUTES = {
|
|
535
535
|
END_ACTIVITY: "/integrations/timeback/end-activity",
|
|
536
536
|
GET_XP: "/integrations/timeback/xp",
|
|
537
|
+
GET_MASTERY: "/integrations/timeback/mastery",
|
|
537
538
|
HEARTBEAT: "/integrations/timeback/heartbeat",
|
|
538
539
|
ADVANCE_COURSE: "/integrations/timeback/advance-course"
|
|
539
540
|
};
|
|
@@ -4171,7 +4172,7 @@ import { existsSync as existsSync9, mkdirSync as mkdirSync2, readFileSync as rea
|
|
|
4171
4172
|
import { join as join13 } from "node:path";
|
|
4172
4173
|
|
|
4173
4174
|
// src/version.ts
|
|
4174
|
-
var cliVersion = false ? "0.0.0-dev" : "0.22.
|
|
4175
|
+
var cliVersion = false ? "0.0.0-dev" : "0.22.2-beta.1";
|
|
4175
4176
|
|
|
4176
4177
|
// src/lib/init/database.ts
|
|
4177
4178
|
var drizzleConfigTemplate = loadTemplateString("database/drizzle-config.ts");
|
|
@@ -6612,6 +6613,7 @@ var ROUTES = {
|
|
|
6612
6613
|
TIMEBACK: {
|
|
6613
6614
|
END_ACTIVITY: `/api${TIMEBACK_ROUTES.END_ACTIVITY}`,
|
|
6614
6615
|
GET_XP: `/api${TIMEBACK_ROUTES.GET_XP}`,
|
|
6616
|
+
GET_MASTERY: `/api${TIMEBACK_ROUTES.GET_MASTERY}`,
|
|
6615
6617
|
HEARTBEAT: `/api${TIMEBACK_ROUTES.HEARTBEAT}`,
|
|
6616
6618
|
ADVANCE_COURSE: `/api${TIMEBACK_ROUTES.ADVANCE_COURSE}`
|
|
6617
6619
|
}
|
|
@@ -74,6 +74,7 @@ var init_timeback = __esm({
|
|
|
74
74
|
TIMEBACK_ROUTES = {
|
|
75
75
|
END_ACTIVITY: "/integrations/timeback/end-activity",
|
|
76
76
|
GET_XP: "/integrations/timeback/xp",
|
|
77
|
+
GET_MASTERY: "/integrations/timeback/mastery",
|
|
77
78
|
HEARTBEAT: "/integrations/timeback/heartbeat",
|
|
78
79
|
ADVANCE_COURSE: "/integrations/timeback/advance-course"
|
|
79
80
|
};
|
|
@@ -120,6 +121,7 @@ var init_constants = __esm({
|
|
|
120
121
|
TIMEBACK: {
|
|
121
122
|
END_ACTIVITY: `/api${TIMEBACK_ROUTES.END_ACTIVITY}`,
|
|
122
123
|
GET_XP: `/api${TIMEBACK_ROUTES.GET_XP}`,
|
|
124
|
+
GET_MASTERY: `/api${TIMEBACK_ROUTES.GET_MASTERY}`,
|
|
123
125
|
HEARTBEAT: `/api${TIMEBACK_ROUTES.HEARTBEAT}`,
|
|
124
126
|
ADVANCE_COURSE: `/api${TIMEBACK_ROUTES.ADVANCE_COURSE}`
|
|
125
127
|
}
|
|
@@ -212,9 +214,9 @@ var init_routes = __esm({
|
|
|
212
214
|
// ../edge-play/src/entry/metadata.ts
|
|
213
215
|
function getRuntimeMetadata() {
|
|
214
216
|
return {
|
|
215
|
-
cliVersion: true ? "0.22.
|
|
216
|
-
sdkVersion: true ? "0.
|
|
217
|
-
buildId: true ? "
|
|
217
|
+
cliVersion: true ? "0.22.2-beta.1" : "0.0.0-dev",
|
|
218
|
+
sdkVersion: true ? "0.10.1-beta.1" : "0.0.0-dev",
|
|
219
|
+
buildId: true ? "feb12ff2fcf5" : "dev-source"
|
|
218
220
|
};
|
|
219
221
|
}
|
|
220
222
|
var init_metadata = __esm({
|
|
@@ -495,6 +497,7 @@ async function POST(c) {
|
|
|
495
497
|
sessionTimingData,
|
|
496
498
|
xpEarned,
|
|
497
499
|
masteredUnits,
|
|
500
|
+
masteredUnitsAbsolute,
|
|
498
501
|
extensions
|
|
499
502
|
} = await c.req.json();
|
|
500
503
|
assertTimebackIntegrated(c);
|
|
@@ -532,6 +535,7 @@ async function POST(c) {
|
|
|
532
535
|
sessionTimingData,
|
|
533
536
|
xpEarned,
|
|
534
537
|
masteredUnits,
|
|
538
|
+
masteredUnitsAbsolute,
|
|
535
539
|
extensions
|
|
536
540
|
}
|
|
537
541
|
);
|
|
@@ -617,6 +621,74 @@ var init_get_xp = __esm({
|
|
|
617
621
|
}
|
|
618
622
|
});
|
|
619
623
|
|
|
624
|
+
// ../edge-play/src/routes/integrations/timeback/get-mastery.ts
|
|
625
|
+
var get_mastery_exports = {};
|
|
626
|
+
__export(get_mastery_exports, {
|
|
627
|
+
GET: () => GET4
|
|
628
|
+
});
|
|
629
|
+
async function GET4(c) {
|
|
630
|
+
try {
|
|
631
|
+
const user = c.get("playcademyUser");
|
|
632
|
+
if (!user) {
|
|
633
|
+
return c.json(buildErrorResponse(c, "Unauthorized", "Unauthorized"), 401);
|
|
634
|
+
}
|
|
635
|
+
if (!user.timeback_id) {
|
|
636
|
+
const message2 = "User does not have TimeBack integration";
|
|
637
|
+
console.error("[TimeBack Get Mastery] Error:", message2);
|
|
638
|
+
return c.json(buildErrorResponse(c, message2, message2), 400);
|
|
639
|
+
}
|
|
640
|
+
assertTimebackIntegrated(c);
|
|
641
|
+
const config = getConfig(c);
|
|
642
|
+
const url = new URL(c.req.url);
|
|
643
|
+
const gradeParam = url.searchParams.get("grade");
|
|
644
|
+
const subjectParam = url.searchParams.get("subject");
|
|
645
|
+
const includeParam = url.searchParams.get("include");
|
|
646
|
+
const include = includeParam ? includeParam.split(",").map((s) => s.trim()) : void 0;
|
|
647
|
+
let grade;
|
|
648
|
+
let subject;
|
|
649
|
+
if (gradeParam !== null || subjectParam !== null) {
|
|
650
|
+
if (gradeParam === null || subjectParam === null) {
|
|
651
|
+
const message2 = "Both grade and subject must be provided together";
|
|
652
|
+
return c.json(buildErrorResponse(c, message2, message2), 400);
|
|
653
|
+
}
|
|
654
|
+
grade = parseInt(gradeParam, 10);
|
|
655
|
+
subject = subjectParam;
|
|
656
|
+
if (!isValidGrade2(grade)) {
|
|
657
|
+
const message2 = `grade must be a valid grade level (${VALID_GRADES2.join(", ")})`;
|
|
658
|
+
return c.json(buildErrorResponse(c, message2, message2), 400);
|
|
659
|
+
}
|
|
660
|
+
if (!isValidSubject2(subject)) {
|
|
661
|
+
const message2 = `subject must be a valid subject (${VALID_SUBJECTS2.join(", ")})`;
|
|
662
|
+
return c.json(buildErrorResponse(c, message2, message2), 400);
|
|
663
|
+
}
|
|
664
|
+
const courseValidationError = validateCourseConfig({ grade, subject, config });
|
|
665
|
+
if (courseValidationError) {
|
|
666
|
+
return c.json(
|
|
667
|
+
buildErrorResponse(c, courseValidationError.error, courseValidationError.error),
|
|
668
|
+
400
|
|
669
|
+
);
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
const sdk = c.get("sdk");
|
|
673
|
+
const result = await sdk.timeback.getStudentMastery(user.timeback_id, {
|
|
674
|
+
grade,
|
|
675
|
+
subject,
|
|
676
|
+
include
|
|
677
|
+
});
|
|
678
|
+
return c.json(result);
|
|
679
|
+
} catch (error) {
|
|
680
|
+
logError("TimeBack Get Mastery", error);
|
|
681
|
+
return c.json(buildErrorResponse(c, error, "Failed to get mastery"), getErrorStatus(error));
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
var init_get_mastery = __esm({
|
|
685
|
+
"../edge-play/src/routes/integrations/timeback/get-mastery.ts"() {
|
|
686
|
+
"use strict";
|
|
687
|
+
init_lib();
|
|
688
|
+
init_shared();
|
|
689
|
+
}
|
|
690
|
+
});
|
|
691
|
+
|
|
620
692
|
// ../edge-play/src/routes/integrations/timeback/heartbeat.ts
|
|
621
693
|
var heartbeat_exports = {};
|
|
622
694
|
__export(heartbeat_exports, {
|
|
@@ -3903,6 +3975,37 @@ function createTimebackNamespace(client) {
|
|
|
3903
3975
|
const queryString = params.toString();
|
|
3904
3976
|
const endpoint = `/api/timeback/student-xp/${studentId}?${queryString}`;
|
|
3905
3977
|
return client["request"](endpoint, "GET");
|
|
3978
|
+
},
|
|
3979
|
+
getStudentMastery: async (studentId, options) => {
|
|
3980
|
+
const hasGrade = options?.grade !== void 0;
|
|
3981
|
+
const hasSubject = options?.subject !== void 0;
|
|
3982
|
+
if (hasGrade !== hasSubject) {
|
|
3983
|
+
throw new Error("Both grade and subject must be provided together");
|
|
3984
|
+
}
|
|
3985
|
+
if (hasGrade && !isValidGrade(options.grade)) {
|
|
3986
|
+
throw new Error(
|
|
3987
|
+
`Invalid grade: ${options.grade}. Valid grades: ${VALID_GRADES.join(", ")}`
|
|
3988
|
+
);
|
|
3989
|
+
}
|
|
3990
|
+
if (hasSubject && !isValidSubject(options.subject)) {
|
|
3991
|
+
throw new Error(
|
|
3992
|
+
`Invalid subject: ${options.subject}. Valid subjects: ${VALID_SUBJECTS.join(", ")}`
|
|
3993
|
+
);
|
|
3994
|
+
}
|
|
3995
|
+
const params = new URLSearchParams();
|
|
3996
|
+
params.set("gameId", client.gameId);
|
|
3997
|
+
if (options?.grade !== void 0) {
|
|
3998
|
+
params.set("grade", String(options.grade));
|
|
3999
|
+
}
|
|
4000
|
+
if (options?.subject) {
|
|
4001
|
+
params.set("subject", options.subject);
|
|
4002
|
+
}
|
|
4003
|
+
if (options?.include?.length) {
|
|
4004
|
+
params.set("include", options.include.join(","));
|
|
4005
|
+
}
|
|
4006
|
+
const queryString = params.toString();
|
|
4007
|
+
const endpoint = `/api/timeback/student-mastery/${studentId}?${queryString}`;
|
|
4008
|
+
return client["request"](endpoint, "GET");
|
|
3906
4009
|
}
|
|
3907
4010
|
};
|
|
3908
4011
|
}
|
|
@@ -4499,14 +4602,16 @@ async function registerBuiltinRoutes(app, integrations) {
|
|
|
4499
4602
|
const health = await Promise.resolve().then(() => (init_health(), health_exports));
|
|
4500
4603
|
app.get(ROUTES.HEALTH, health.GET);
|
|
4501
4604
|
if (integrations?.timeback) {
|
|
4502
|
-
const [endActivity, getXp, heartbeat, advanceCourse] = await Promise.all([
|
|
4605
|
+
const [endActivity, getXp, getMastery, heartbeat, advanceCourse] = await Promise.all([
|
|
4503
4606
|
Promise.resolve().then(() => (init_end_activity(), end_activity_exports)),
|
|
4504
4607
|
Promise.resolve().then(() => (init_get_xp(), get_xp_exports)),
|
|
4608
|
+
Promise.resolve().then(() => (init_get_mastery(), get_mastery_exports)),
|
|
4505
4609
|
Promise.resolve().then(() => (init_heartbeat(), heartbeat_exports)),
|
|
4506
4610
|
Promise.resolve().then(() => (init_advance_course(), advance_course_exports))
|
|
4507
4611
|
]);
|
|
4508
4612
|
app.post(ROUTES.TIMEBACK.END_ACTIVITY, endActivity.POST);
|
|
4509
4613
|
app.get(ROUTES.TIMEBACK.GET_XP, getXp.GET);
|
|
4614
|
+
app.get(ROUTES.TIMEBACK.GET_MASTERY, getMastery.GET);
|
|
4510
4615
|
app.post(ROUTES.TIMEBACK.HEARTBEAT, heartbeat.POST);
|
|
4511
4616
|
app.post(ROUTES.TIMEBACK.ADVANCE_COURSE, advanceCourse.POST);
|
|
4512
4617
|
} else if (integrations?.timeback === null) {
|
|
@@ -4525,6 +4630,14 @@ async function registerBuiltinRoutes(app, integrations) {
|
|
|
4525
4630
|
__playcademyDevWarning: "timeback-not-configured"
|
|
4526
4631
|
})
|
|
4527
4632
|
);
|
|
4633
|
+
app.get(
|
|
4634
|
+
"/api/integrations/timeback/mastery",
|
|
4635
|
+
async (c) => c.json({
|
|
4636
|
+
totalMasteredUnits: 0,
|
|
4637
|
+
totalMasterableUnits: 0,
|
|
4638
|
+
__playcademyDevWarning: "timeback-not-configured"
|
|
4639
|
+
})
|
|
4640
|
+
);
|
|
4528
4641
|
app.post(
|
|
4529
4642
|
"/api/integrations/timeback/heartbeat",
|
|
4530
4643
|
async (c) => c.json({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"cliVersion": "0.22.
|
|
3
|
-
"sdkVersion": "0.
|
|
4
|
-
"runtimeBuildId": "
|
|
5
|
-
"inputFingerprint": "
|
|
2
|
+
"cliVersion": "0.22.2-beta.1",
|
|
3
|
+
"sdkVersion": "0.10.1-beta.1",
|
|
4
|
+
"runtimeBuildId": "feb12ff2fcf5",
|
|
5
|
+
"inputFingerprint": "feb12ff2fcf5a733422381410fd83b75e2931f921befb3e53bc1cc73de20eb6e",
|
|
6
6
|
"entry": "index.js"
|
|
7
7
|
}
|
package/dist/utils.js
CHANGED
|
@@ -305,6 +305,7 @@ import { dirname as dirname3, resolve as resolve3 } from "path";
|
|
|
305
305
|
var TIMEBACK_ROUTES = {
|
|
306
306
|
END_ACTIVITY: "/integrations/timeback/end-activity",
|
|
307
307
|
GET_XP: "/integrations/timeback/xp",
|
|
308
|
+
GET_MASTERY: "/integrations/timeback/mastery",
|
|
308
309
|
HEARTBEAT: "/integrations/timeback/heartbeat",
|
|
309
310
|
ADVANCE_COURSE: "/integrations/timeback/advance-course"
|
|
310
311
|
};
|
|
@@ -345,7 +346,7 @@ var DEFAULT_API_ROUTES_DIRECTORY = join2(SERVER_ROOT_DIRECTORY, "api");
|
|
|
345
346
|
// ../better-auth/package.json
|
|
346
347
|
var package_default = {
|
|
347
348
|
name: "@playcademy/better-auth",
|
|
348
|
-
version: "0.0.
|
|
349
|
+
version: "0.0.15-beta.1",
|
|
349
350
|
type: "module",
|
|
350
351
|
exports: {
|
|
351
352
|
"./server": {
|
|
@@ -1830,6 +1831,7 @@ var ROUTES = {
|
|
|
1830
1831
|
TIMEBACK: {
|
|
1831
1832
|
END_ACTIVITY: `/api${TIMEBACK_ROUTES.END_ACTIVITY}`,
|
|
1832
1833
|
GET_XP: `/api${TIMEBACK_ROUTES.GET_XP}`,
|
|
1834
|
+
GET_MASTERY: `/api${TIMEBACK_ROUTES.GET_MASTERY}`,
|
|
1833
1835
|
HEARTBEAT: `/api${TIMEBACK_ROUTES.HEARTBEAT}`,
|
|
1834
1836
|
ADVANCE_COURSE: `/api${TIMEBACK_ROUTES.ADVANCE_COURSE}`
|
|
1835
1837
|
}
|
|
@@ -2455,7 +2457,7 @@ import { existsSync as existsSync9, mkdirSync as mkdirSync2, writeFileSync as wr
|
|
|
2455
2457
|
import { dirname as dirname4, join as join14 } from "node:path";
|
|
2456
2458
|
|
|
2457
2459
|
// src/version.ts
|
|
2458
|
-
var cliVersion = false ? "0.0.0-dev" : "0.22.
|
|
2460
|
+
var cliVersion = false ? "0.0.0-dev" : "0.22.2-beta.1";
|
|
2459
2461
|
|
|
2460
2462
|
// src/lib/build/binary-resource.ts
|
|
2461
2463
|
function writeFileTree(baseDir, files) {
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "playcademy",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.2-beta.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@inquirer/prompts": "^7.8.6",
|
|
53
|
-
"@playcademy/sdk": "0.
|
|
53
|
+
"@playcademy/sdk": "0.10.0",
|
|
54
54
|
"chokidar": "^4.0.3",
|
|
55
55
|
"colorette": "^2.0.20",
|
|
56
56
|
"commander": "^14.0.1",
|