@playcademy/vite-plugin 0.2.27-beta.1 → 0.2.27-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/dist/index.js +139 -111
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -25370,7 +25370,7 @@ var package_default;
|
|
|
25370
25370
|
var init_package = __esm(() => {
|
|
25371
25371
|
package_default = {
|
|
25372
25372
|
name: "@playcademy/sandbox",
|
|
25373
|
-
version: "0.3.17-beta.
|
|
25373
|
+
version: "0.3.17-beta.26",
|
|
25374
25374
|
description: "Local development server for Playcademy game development",
|
|
25375
25375
|
type: "module",
|
|
25376
25376
|
exports: {
|
|
@@ -54176,8 +54176,17 @@ var init_log = __esm(() => {
|
|
|
54176
54176
|
function kebabToTitleCase(kebabStr) {
|
|
54177
54177
|
return kebabStr.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
54178
54178
|
}
|
|
54179
|
-
function
|
|
54180
|
-
|
|
54179
|
+
function formatDateYMDInTimezone(timeZone, date3 = new Date) {
|
|
54180
|
+
const parts2 = new Intl.DateTimeFormat("en-US", {
|
|
54181
|
+
timeZone,
|
|
54182
|
+
year: "numeric",
|
|
54183
|
+
month: "2-digit",
|
|
54184
|
+
day: "2-digit"
|
|
54185
|
+
}).formatToParts(date3);
|
|
54186
|
+
const y = parts2.find((p) => p.type === "year").value;
|
|
54187
|
+
const m = parts2.find((p) => p.type === "month").value;
|
|
54188
|
+
const d = parts2.find((p) => p.type === "day").value;
|
|
54189
|
+
return `${y}-${m}-${d}`;
|
|
54181
54190
|
}
|
|
54182
54191
|
function getUtcInstantForMidnight(date3, timeZone) {
|
|
54183
54192
|
const parts2 = new Intl.DateTimeFormat("en-US", {
|
|
@@ -54248,6 +54257,17 @@ function getDayBoundariesInTimezone(date3, timezone) {
|
|
|
54248
54257
|
const endOfDay = getUtcInstantForMidnight(nextDayNoon, timezone);
|
|
54249
54258
|
return { startOfDay, endOfDay };
|
|
54250
54259
|
}
|
|
54260
|
+
function buildPath(path2, params) {
|
|
54261
|
+
const url = new URL(path2, "http://n");
|
|
54262
|
+
if (params) {
|
|
54263
|
+
for (const [key, value] of Object.entries(params)) {
|
|
54264
|
+
if (value != null) {
|
|
54265
|
+
url.searchParams.set(key, value);
|
|
54266
|
+
}
|
|
54267
|
+
}
|
|
54268
|
+
}
|
|
54269
|
+
return `${url.pathname}${url.search}`;
|
|
54270
|
+
}
|
|
54251
54271
|
var init_pure = __esm(() => {
|
|
54252
54272
|
init_uuid2();
|
|
54253
54273
|
init_mime();
|
|
@@ -54293,11 +54313,11 @@ function isRecord2(value) {
|
|
|
54293
54313
|
function getStringValue(value) {
|
|
54294
54314
|
return typeof value === "string" && value.trim().length > 0 ? value.trim() : undefined;
|
|
54295
54315
|
}
|
|
54296
|
-
function parseSourcedIdFromUrl(
|
|
54297
|
-
if (!
|
|
54316
|
+
function parseSourcedIdFromUrl(url2) {
|
|
54317
|
+
if (!url2) {
|
|
54298
54318
|
return;
|
|
54299
54319
|
}
|
|
54300
|
-
const trimmed =
|
|
54320
|
+
const trimmed = url2.trim().replace(/\/$/, "");
|
|
54301
54321
|
if (!trimmed) {
|
|
54302
54322
|
return;
|
|
54303
54323
|
}
|
|
@@ -54685,7 +54705,7 @@ class TimebackAdminService {
|
|
|
54685
54705
|
history: []
|
|
54686
54706
|
};
|
|
54687
54707
|
}
|
|
54688
|
-
const today =
|
|
54708
|
+
const today = formatDateYMDInTimezone(PLATFORM_TIMEZONE);
|
|
54689
54709
|
const history = [];
|
|
54690
54710
|
let totalXpRaw = 0;
|
|
54691
54711
|
let todayXpRaw = 0;
|
|
@@ -54851,7 +54871,9 @@ class TimebackAdminService {
|
|
|
54851
54871
|
const uniqueEnrollmentIds = [...new Set(enrollmentIds)];
|
|
54852
54872
|
const results = await TimebackAdminService.runWithConcurrency(uniqueEnrollmentIds, TimebackAdminService.ANALYTICS_CONCURRENCY, async (enrollmentId) => {
|
|
54853
54873
|
try {
|
|
54854
|
-
const analytics = await client.edubridge.analytics.getEnrollmentFacts(enrollmentId
|
|
54874
|
+
const analytics = await client.edubridge.analytics.getEnrollmentFacts(enrollmentId, {
|
|
54875
|
+
timezone: PLATFORM_TIMEZONE
|
|
54876
|
+
});
|
|
54855
54877
|
return [enrollmentId, this.summarizeAnalyticsFacts(analytics.facts)];
|
|
54856
54878
|
} catch (error) {
|
|
54857
54879
|
logger16.warn("Failed to load enrollment analytics summary", {
|
|
@@ -55125,7 +55147,7 @@ class TimebackAdminService {
|
|
|
55125
55147
|
const enrollment = await this.assertStudentEnrolledInCourse(client, data.studentId, data.courseId);
|
|
55126
55148
|
let currentMastered = 0;
|
|
55127
55149
|
try {
|
|
55128
|
-
const analytics = await client.edubridge.analytics.getEnrollmentFacts(enrollment.id);
|
|
55150
|
+
const analytics = await client.edubridge.analytics.getEnrollmentFacts(enrollment.id, { timezone: PLATFORM_TIMEZONE });
|
|
55129
55151
|
const summary = this.summarizeAnalyticsFacts(analytics.facts);
|
|
55130
55152
|
currentMastered = summary.masteredUnits;
|
|
55131
55153
|
} catch {
|
|
@@ -55315,6 +55337,7 @@ class TimebackAdminService {
|
|
|
55315
55337
|
var logger16;
|
|
55316
55338
|
var init_timeback_admin_service = __esm(() => {
|
|
55317
55339
|
init_drizzle_orm();
|
|
55340
|
+
init_src();
|
|
55318
55341
|
init_tables_index();
|
|
55319
55342
|
init_src2();
|
|
55320
55343
|
init_constants4();
|
|
@@ -57249,13 +57272,13 @@ var init_level_service = __esm(() => {
|
|
|
57249
57272
|
});
|
|
57250
57273
|
var init_events = () => {};
|
|
57251
57274
|
function convertWebSocketUrlToHttp(wsUrl) {
|
|
57252
|
-
return wsUrl.replace(/^wss?:\/\//, (
|
|
57275
|
+
return wsUrl.replace(/^wss?:\/\//, (url2) => url2 === "wss://" ? "https://" : "http://");
|
|
57253
57276
|
}
|
|
57254
57277
|
async function publishToUser(baseUrl, secret, userId, type, payload) {
|
|
57255
|
-
const
|
|
57256
|
-
|
|
57278
|
+
const url2 = new URL(baseUrl);
|
|
57279
|
+
url2.pathname = "/publish";
|
|
57257
57280
|
try {
|
|
57258
|
-
const res = await fetch(
|
|
57281
|
+
const res = await fetch(url2.toString(), {
|
|
57259
57282
|
method: "POST",
|
|
57260
57283
|
headers: { "content-type": "application/json" },
|
|
57261
57284
|
body: JSON.stringify({ userId, type, payload, secret })
|
|
@@ -59086,14 +59109,14 @@ function debugSensitive(label, value, showChars = 4) {
|
|
|
59086
59109
|
const masked = value.length > showChars * 2 ? `${value.slice(0, showChars)}...${value.slice(-showChars)}` : `${value.slice(0, showChars)}...`;
|
|
59087
59110
|
console.log(`[DEBUG] ${label}: ${masked}`);
|
|
59088
59111
|
}
|
|
59089
|
-
function debugRequest(method,
|
|
59112
|
+
function debugRequest(method, url2, headers, body2) {
|
|
59090
59113
|
if (!isDebugEnabled()) {
|
|
59091
59114
|
return;
|
|
59092
59115
|
}
|
|
59093
59116
|
console.log(`
|
|
59094
59117
|
[DEBUG] HTTP Request:`);
|
|
59095
59118
|
console.log(` Method: ${method}`);
|
|
59096
|
-
console.log(` URL: ${
|
|
59119
|
+
console.log(` URL: ${url2}`);
|
|
59097
59120
|
if (headers) {
|
|
59098
59121
|
console.log(` Headers:`);
|
|
59099
59122
|
Object.entries(headers).forEach(([key, value]) => {
|
|
@@ -59166,7 +59189,7 @@ async function getTimebackTokenResponse(config2) {
|
|
|
59166
59189
|
function getAuthUrl(environment = "production") {
|
|
59167
59190
|
return TIMEBACK_AUTH_URLS4[environment];
|
|
59168
59191
|
}
|
|
59169
|
-
function handleHttpError(res, errorBody, attempt, retries,
|
|
59192
|
+
function handleHttpError(res, errorBody, attempt, retries, url2) {
|
|
59170
59193
|
const error = new TimebackApiError(res.status, res.statusText, errorBody);
|
|
59171
59194
|
if (res.status >= HTTP_STATUS4.CLIENT_ERROR_MIN && res.status < HTTP_STATUS4.CLIENT_ERROR_MAX) {
|
|
59172
59195
|
throw error;
|
|
@@ -59177,7 +59200,7 @@ function handleHttpError(res, errorBody, attempt, retries, url) {
|
|
|
59177
59200
|
attempt: attempt + 1,
|
|
59178
59201
|
maxRetries: retries,
|
|
59179
59202
|
status: res.status,
|
|
59180
|
-
url
|
|
59203
|
+
url: url2
|
|
59181
59204
|
});
|
|
59182
59205
|
return { retry: true, error };
|
|
59183
59206
|
}
|
|
@@ -59208,7 +59231,7 @@ async function request({
|
|
|
59208
59231
|
retries = 3,
|
|
59209
59232
|
timeout = 1e4
|
|
59210
59233
|
}) {
|
|
59211
|
-
const
|
|
59234
|
+
const url2 = baseUrl.replace(/\/$/, "") + (path2.startsWith("/") ? path2 : `/${path2}`);
|
|
59212
59235
|
const headers = { ...extraHeaders };
|
|
59213
59236
|
let payload;
|
|
59214
59237
|
if (body2 instanceof FormData) {
|
|
@@ -59225,8 +59248,8 @@ async function request({
|
|
|
59225
59248
|
try {
|
|
59226
59249
|
const controller = new AbortController;
|
|
59227
59250
|
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
59228
|
-
debugRequest(method,
|
|
59229
|
-
const res = await fetch(
|
|
59251
|
+
debugRequest(method, url2, headers, body2);
|
|
59252
|
+
const res = await fetch(url2, {
|
|
59230
59253
|
method,
|
|
59231
59254
|
headers,
|
|
59232
59255
|
body: payload,
|
|
@@ -59242,7 +59265,7 @@ async function request({
|
|
|
59242
59265
|
if (errorBody) {
|
|
59243
59266
|
debugResponse(res.status, res.statusText, errorBody);
|
|
59244
59267
|
}
|
|
59245
|
-
const result = handleHttpError(res, errorBody, attempt, retries,
|
|
59268
|
+
const result = handleHttpError(res, errorBody, attempt, retries, url2);
|
|
59246
59269
|
lastError = result.error;
|
|
59247
59270
|
if (result.retry) {
|
|
59248
59271
|
const delay = HTTP_DEFAULTS4.retryBackoffBase ** attempt * 1000;
|
|
@@ -59262,7 +59285,7 @@ async function request({
|
|
|
59262
59285
|
attempt: attempt + 1,
|
|
59263
59286
|
maxRetries: retries,
|
|
59264
59287
|
error: lastError.message,
|
|
59265
|
-
url
|
|
59288
|
+
url: url2
|
|
59266
59289
|
});
|
|
59267
59290
|
await new Promise((resolve2) => setTimeout(resolve2, delay));
|
|
59268
59291
|
}
|
|
@@ -59501,7 +59524,9 @@ function createEduBridgeNamespace(client) {
|
|
|
59501
59524
|
}
|
|
59502
59525
|
};
|
|
59503
59526
|
const analytics = {
|
|
59504
|
-
getEnrollmentFacts: async (enrollmentId) => client["request"](`/edubridge/analytics/enrollment/${enrollmentId}`,
|
|
59527
|
+
getEnrollmentFacts: async (enrollmentId, options) => client["request"](buildPath(`/edubridge/analytics/enrollment/${enrollmentId}`, {
|
|
59528
|
+
timezone: options?.timezone
|
|
59529
|
+
}), "GET")
|
|
59505
59530
|
};
|
|
59506
59531
|
return {
|
|
59507
59532
|
enrollments,
|
|
@@ -59592,8 +59617,8 @@ function createOneRosterNamespace(client) {
|
|
|
59592
59617
|
queryParams.set("offset", String(options.offset));
|
|
59593
59618
|
}
|
|
59594
59619
|
const endpoint = `${ONEROSTER_ENDPOINTS4.users}/${userSourcedId}/classes`;
|
|
59595
|
-
const
|
|
59596
|
-
const res = await client["request"](
|
|
59620
|
+
const url2 = queryParams.toString() ? `${endpoint}?${queryParams}` : endpoint;
|
|
59621
|
+
const res = await client["request"](url2, "GET");
|
|
59597
59622
|
return res.classes || [];
|
|
59598
59623
|
}
|
|
59599
59624
|
},
|
|
@@ -59611,9 +59636,9 @@ function createOneRosterNamespace(client) {
|
|
|
59611
59636
|
if (options?.offset) {
|
|
59612
59637
|
queryParams.set("offset", String(options.offset));
|
|
59613
59638
|
}
|
|
59614
|
-
const
|
|
59639
|
+
const url2 = `${ONEROSTER_ENDPOINTS4.enrollments}?${queryParams}`;
|
|
59615
59640
|
try {
|
|
59616
|
-
const response = await client["request"](
|
|
59641
|
+
const response = await client["request"](url2, "GET");
|
|
59617
59642
|
return response.enrollments || [];
|
|
59618
59643
|
} catch (error) {
|
|
59619
59644
|
logTimebackError("list enrollments for class", error, { classSourcedId });
|
|
@@ -59644,8 +59669,8 @@ function createOneRosterNamespace(client) {
|
|
|
59644
59669
|
}
|
|
59645
59670
|
queryParams.set("filter", filters.join(" AND "));
|
|
59646
59671
|
queryParams.set("limit", "3000");
|
|
59647
|
-
const
|
|
59648
|
-
const response = await client["request"](
|
|
59672
|
+
const url2 = `${ONEROSTER_ENDPOINTS4.enrollments}?${queryParams}`;
|
|
59673
|
+
const response = await client["request"](url2, "GET");
|
|
59649
59674
|
return response.enrollments || [];
|
|
59650
59675
|
}));
|
|
59651
59676
|
const enrollments = enrollmentGroups.flat();
|
|
@@ -59810,8 +59835,8 @@ function createOneRosterNamespace(client) {
|
|
|
59810
59835
|
getAttemptStats: async (studentId, lineItemId) => {
|
|
59811
59836
|
try {
|
|
59812
59837
|
const filter = `student.sourcedId='${studentId}' AND assessmentLineItem.sourcedId='${lineItemId}'`;
|
|
59813
|
-
const
|
|
59814
|
-
const response = await client["request"](
|
|
59838
|
+
const url2 = `${ONEROSTER_ENDPOINTS4.assessmentResults}?filter=${encodeURIComponent(filter)}`;
|
|
59839
|
+
const response = await client["request"](url2, "GET");
|
|
59815
59840
|
const results = response.assessmentResults || [];
|
|
59816
59841
|
const firstResult = results[0];
|
|
59817
59842
|
if (!firstResult) {
|
|
@@ -60417,7 +60442,7 @@ class MasteryTracker {
|
|
|
60417
60442
|
});
|
|
60418
60443
|
return;
|
|
60419
60444
|
}
|
|
60420
|
-
const analytics = await this.edubridgeNamespace.analytics.getEnrollmentFacts(enrollment.id);
|
|
60445
|
+
const analytics = await this.edubridgeNamespace.analytics.getEnrollmentFacts(enrollment.id, { timezone: PLATFORM_TIMEZONE });
|
|
60421
60446
|
return analytics.facts;
|
|
60422
60447
|
} catch (error) {
|
|
60423
60448
|
log.error("[MasteryTracker] Failed to load enrollment analytics facts", {
|
|
@@ -61140,7 +61165,7 @@ class TimebackClient {
|
|
|
61140
61165
|
}
|
|
61141
61166
|
const analyticsResults = await Promise.all(filteredEnrollments.map(async (enrollment) => {
|
|
61142
61167
|
try {
|
|
61143
|
-
const analytics = await this.edubridge.analytics.getEnrollmentFacts(enrollment.id);
|
|
61168
|
+
const analytics = await this.edubridge.analytics.getEnrollmentFacts(enrollment.id, { timezone: PLATFORM_TIMEZONE });
|
|
61144
61169
|
return { enrollment, analytics };
|
|
61145
61170
|
} catch (error) {
|
|
61146
61171
|
log.warn("[TimebackClient] Failed to fetch analytics for enrollment", {
|
|
@@ -61150,7 +61175,7 @@ class TimebackClient {
|
|
|
61150
61175
|
return { enrollment, analytics: null };
|
|
61151
61176
|
}
|
|
61152
61177
|
}));
|
|
61153
|
-
const today =
|
|
61178
|
+
const today = formatDateYMDInTimezone(PLATFORM_TIMEZONE);
|
|
61154
61179
|
let totalXp = 0;
|
|
61155
61180
|
let todayXp = 0;
|
|
61156
61181
|
const courses = [];
|
|
@@ -61293,6 +61318,7 @@ var EmailSchema;
|
|
|
61293
61318
|
var StudentSourcedIdSchema;
|
|
61294
61319
|
var StudentIdentifierSchema;
|
|
61295
61320
|
var init_dist3 = __esm(() => {
|
|
61321
|
+
init_src();
|
|
61296
61322
|
init_src();
|
|
61297
61323
|
init_src2();
|
|
61298
61324
|
init_src4();
|
|
@@ -61307,9 +61333,11 @@ var init_dist3 = __esm(() => {
|
|
|
61307
61333
|
init_src2();
|
|
61308
61334
|
init_src2();
|
|
61309
61335
|
init_src2();
|
|
61336
|
+
init_src4();
|
|
61310
61337
|
init_src2();
|
|
61311
61338
|
init_src2();
|
|
61312
61339
|
init_src2();
|
|
61340
|
+
init_src();
|
|
61313
61341
|
init_src2();
|
|
61314
61342
|
init_src2();
|
|
61315
61343
|
init_src2();
|
|
@@ -62150,20 +62178,20 @@ var tryDecode = (str, decoder) => {
|
|
|
62150
62178
|
};
|
|
62151
62179
|
var tryDecodeURI = (str) => tryDecode(str, decodeURI);
|
|
62152
62180
|
var getPath = (request2) => {
|
|
62153
|
-
const
|
|
62154
|
-
const start2 =
|
|
62181
|
+
const url2 = request2.url;
|
|
62182
|
+
const start2 = url2.indexOf("/", url2.indexOf(":") + 4);
|
|
62155
62183
|
let i2 = start2;
|
|
62156
|
-
for (;i2 <
|
|
62157
|
-
const charCode =
|
|
62184
|
+
for (;i2 < url2.length; i2++) {
|
|
62185
|
+
const charCode = url2.charCodeAt(i2);
|
|
62158
62186
|
if (charCode === 37) {
|
|
62159
|
-
const queryIndex =
|
|
62160
|
-
const path2 =
|
|
62187
|
+
const queryIndex = url2.indexOf("?", i2);
|
|
62188
|
+
const path2 = url2.slice(start2, queryIndex === -1 ? undefined : queryIndex);
|
|
62161
62189
|
return tryDecodeURI(path2.includes("%25") ? path2.replace(/%25/g, "%2525") : path2);
|
|
62162
62190
|
} else if (charCode === 63) {
|
|
62163
62191
|
break;
|
|
62164
62192
|
}
|
|
62165
62193
|
}
|
|
62166
|
-
return
|
|
62194
|
+
return url2.slice(start2, i2);
|
|
62167
62195
|
};
|
|
62168
62196
|
var getPathNoStrict = (request2) => {
|
|
62169
62197
|
const result = getPath(request2);
|
|
@@ -62211,42 +62239,42 @@ var _decodeURI = (value) => {
|
|
|
62211
62239
|
}
|
|
62212
62240
|
return value.indexOf("%") !== -1 ? tryDecode(value, decodeURIComponent_) : value;
|
|
62213
62241
|
};
|
|
62214
|
-
var _getQueryParam = (
|
|
62242
|
+
var _getQueryParam = (url2, key, multiple) => {
|
|
62215
62243
|
let encoded;
|
|
62216
62244
|
if (!multiple && key && !/[%+]/.test(key)) {
|
|
62217
|
-
let keyIndex2 =
|
|
62245
|
+
let keyIndex2 = url2.indexOf("?", 8);
|
|
62218
62246
|
if (keyIndex2 === -1) {
|
|
62219
62247
|
return;
|
|
62220
62248
|
}
|
|
62221
|
-
if (!
|
|
62222
|
-
keyIndex2 =
|
|
62249
|
+
if (!url2.startsWith(key, keyIndex2 + 1)) {
|
|
62250
|
+
keyIndex2 = url2.indexOf(`&${key}`, keyIndex2 + 1);
|
|
62223
62251
|
}
|
|
62224
62252
|
while (keyIndex2 !== -1) {
|
|
62225
|
-
const trailingKeyCode =
|
|
62253
|
+
const trailingKeyCode = url2.charCodeAt(keyIndex2 + key.length + 1);
|
|
62226
62254
|
if (trailingKeyCode === 61) {
|
|
62227
62255
|
const valueIndex = keyIndex2 + key.length + 2;
|
|
62228
|
-
const endIndex =
|
|
62229
|
-
return _decodeURI(
|
|
62256
|
+
const endIndex = url2.indexOf("&", valueIndex);
|
|
62257
|
+
return _decodeURI(url2.slice(valueIndex, endIndex === -1 ? undefined : endIndex));
|
|
62230
62258
|
} else if (trailingKeyCode == 38 || isNaN(trailingKeyCode)) {
|
|
62231
62259
|
return "";
|
|
62232
62260
|
}
|
|
62233
|
-
keyIndex2 =
|
|
62261
|
+
keyIndex2 = url2.indexOf(`&${key}`, keyIndex2 + 1);
|
|
62234
62262
|
}
|
|
62235
|
-
encoded = /[%+]/.test(
|
|
62263
|
+
encoded = /[%+]/.test(url2);
|
|
62236
62264
|
if (!encoded) {
|
|
62237
62265
|
return;
|
|
62238
62266
|
}
|
|
62239
62267
|
}
|
|
62240
62268
|
const results = {};
|
|
62241
|
-
encoded ??= /[%+]/.test(
|
|
62242
|
-
let keyIndex =
|
|
62269
|
+
encoded ??= /[%+]/.test(url2);
|
|
62270
|
+
let keyIndex = url2.indexOf("?", 8);
|
|
62243
62271
|
while (keyIndex !== -1) {
|
|
62244
|
-
const nextKeyIndex =
|
|
62245
|
-
let valueIndex =
|
|
62272
|
+
const nextKeyIndex = url2.indexOf("&", keyIndex + 1);
|
|
62273
|
+
let valueIndex = url2.indexOf("=", keyIndex);
|
|
62246
62274
|
if (valueIndex > nextKeyIndex && nextKeyIndex !== -1) {
|
|
62247
62275
|
valueIndex = -1;
|
|
62248
62276
|
}
|
|
62249
|
-
let name3 =
|
|
62277
|
+
let name3 = url2.slice(keyIndex + 1, valueIndex === -1 ? nextKeyIndex === -1 ? undefined : nextKeyIndex : valueIndex);
|
|
62250
62278
|
if (encoded) {
|
|
62251
62279
|
name3 = _decodeURI(name3);
|
|
62252
62280
|
}
|
|
@@ -62258,7 +62286,7 @@ var _getQueryParam = (url, key, multiple) => {
|
|
|
62258
62286
|
if (valueIndex === -1) {
|
|
62259
62287
|
value = "";
|
|
62260
62288
|
} else {
|
|
62261
|
-
value =
|
|
62289
|
+
value = url2.slice(valueIndex + 1, nextKeyIndex === -1 ? undefined : nextKeyIndex);
|
|
62262
62290
|
if (encoded) {
|
|
62263
62291
|
value = _decodeURI(value);
|
|
62264
62292
|
}
|
|
@@ -62275,8 +62303,8 @@ var _getQueryParam = (url, key, multiple) => {
|
|
|
62275
62303
|
return key ? results[key] : results;
|
|
62276
62304
|
};
|
|
62277
62305
|
var getQueryParam;
|
|
62278
|
-
var getQueryParams = (
|
|
62279
|
-
return _getQueryParam(
|
|
62306
|
+
var getQueryParams = (url2, key) => {
|
|
62307
|
+
return _getQueryParam(url2, key, true);
|
|
62280
62308
|
};
|
|
62281
62309
|
var decodeURIComponent_;
|
|
62282
62310
|
var init_url = __esm(() => {
|
|
@@ -62755,9 +62783,9 @@ var Hono = class {
|
|
|
62755
62783
|
const mergedPath = mergePath(this._basePath, path2);
|
|
62756
62784
|
const pathPrefixLength = mergedPath === "/" ? 0 : mergedPath.length;
|
|
62757
62785
|
return (request2) => {
|
|
62758
|
-
const
|
|
62759
|
-
|
|
62760
|
-
return new Request(
|
|
62786
|
+
const url2 = new URL(request2.url);
|
|
62787
|
+
url2.pathname = url2.pathname.slice(pathPrefixLength) || "/";
|
|
62788
|
+
return new Request(url2, request2);
|
|
62761
62789
|
};
|
|
62762
62790
|
})();
|
|
62763
62791
|
const handler = async (c, next) => {
|
|
@@ -63674,8 +63702,8 @@ var colorStatus = async (status) => {
|
|
|
63674
63702
|
};
|
|
63675
63703
|
var logger35 = (fn = console.log) => {
|
|
63676
63704
|
return async function logger2(c, next) {
|
|
63677
|
-
const { method, url } = c.req;
|
|
63678
|
-
const path2 =
|
|
63705
|
+
const { method, url: url2 } = c.req;
|
|
63706
|
+
const path2 = url2.slice(url2.indexOf("/", 8));
|
|
63679
63707
|
await log4(fn, "<--", method, path2);
|
|
63680
63708
|
const start2 = Date.now();
|
|
63681
63709
|
await next();
|
|
@@ -71677,34 +71705,34 @@ var require_node3 = __commonJS2((exports) => {
|
|
|
71677
71705
|
}
|
|
71678
71706
|
exports2.urlParse = urlParse;
|
|
71679
71707
|
function urlGenerate(aParsedUrl) {
|
|
71680
|
-
var
|
|
71708
|
+
var url2 = "";
|
|
71681
71709
|
if (aParsedUrl.scheme) {
|
|
71682
|
-
|
|
71710
|
+
url2 += aParsedUrl.scheme + ":";
|
|
71683
71711
|
}
|
|
71684
|
-
|
|
71712
|
+
url2 += "//";
|
|
71685
71713
|
if (aParsedUrl.auth) {
|
|
71686
|
-
|
|
71714
|
+
url2 += aParsedUrl.auth + "@";
|
|
71687
71715
|
}
|
|
71688
71716
|
if (aParsedUrl.host) {
|
|
71689
|
-
|
|
71717
|
+
url2 += aParsedUrl.host;
|
|
71690
71718
|
}
|
|
71691
71719
|
if (aParsedUrl.port) {
|
|
71692
|
-
|
|
71720
|
+
url2 += ":" + aParsedUrl.port;
|
|
71693
71721
|
}
|
|
71694
71722
|
if (aParsedUrl.path) {
|
|
71695
|
-
|
|
71723
|
+
url2 += aParsedUrl.path;
|
|
71696
71724
|
}
|
|
71697
|
-
return
|
|
71725
|
+
return url2;
|
|
71698
71726
|
}
|
|
71699
71727
|
exports2.urlGenerate = urlGenerate;
|
|
71700
71728
|
function normalize(aPath) {
|
|
71701
71729
|
var path2 = aPath;
|
|
71702
|
-
var
|
|
71703
|
-
if (
|
|
71704
|
-
if (!
|
|
71730
|
+
var url2 = urlParse(aPath);
|
|
71731
|
+
if (url2) {
|
|
71732
|
+
if (!url2.path) {
|
|
71705
71733
|
return aPath;
|
|
71706
71734
|
}
|
|
71707
|
-
path2 =
|
|
71735
|
+
path2 = url2.path;
|
|
71708
71736
|
}
|
|
71709
71737
|
var isAbsolute2 = exports2.isAbsolute(path2);
|
|
71710
71738
|
var parts2 = path2.split(/\/+/);
|
|
@@ -71728,9 +71756,9 @@ var require_node3 = __commonJS2((exports) => {
|
|
|
71728
71756
|
if (path2 === "") {
|
|
71729
71757
|
path2 = isAbsolute2 ? "/" : ".";
|
|
71730
71758
|
}
|
|
71731
|
-
if (
|
|
71732
|
-
|
|
71733
|
-
return urlGenerate(
|
|
71759
|
+
if (url2) {
|
|
71760
|
+
url2.path = path2;
|
|
71761
|
+
return urlGenerate(url2);
|
|
71734
71762
|
}
|
|
71735
71763
|
return path2;
|
|
71736
71764
|
}
|
|
@@ -72756,13 +72784,13 @@ var require_node3 = __commonJS2((exports) => {
|
|
|
72756
72784
|
if (this.sourceRoot != null) {
|
|
72757
72785
|
relativeSource = util3.relative(this.sourceRoot, relativeSource);
|
|
72758
72786
|
}
|
|
72759
|
-
var
|
|
72760
|
-
if (this.sourceRoot != null && (
|
|
72787
|
+
var url2;
|
|
72788
|
+
if (this.sourceRoot != null && (url2 = util3.urlParse(this.sourceRoot))) {
|
|
72761
72789
|
var fileUriAbsPath = relativeSource.replace(/^file:\/\//, "");
|
|
72762
|
-
if (
|
|
72790
|
+
if (url2.scheme == "file" && this._sources.has(fileUriAbsPath)) {
|
|
72763
72791
|
return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)];
|
|
72764
72792
|
}
|
|
72765
|
-
if ((!
|
|
72793
|
+
if ((!url2.path || url2.path == "/") && this._sources.has("/" + relativeSource)) {
|
|
72766
72794
|
return this.sourcesContent[this._sources.indexOf("/" + relativeSource)];
|
|
72767
72795
|
}
|
|
72768
72796
|
}
|
|
@@ -73330,18 +73358,18 @@ var require_node3 = __commonJS2((exports) => {
|
|
|
73330
73358
|
} catch (er2) {}
|
|
73331
73359
|
return fileContentsCache[path22] = contents;
|
|
73332
73360
|
});
|
|
73333
|
-
function supportRelativeURL(file,
|
|
73361
|
+
function supportRelativeURL(file, url2) {
|
|
73334
73362
|
if (!file)
|
|
73335
|
-
return
|
|
73363
|
+
return url2;
|
|
73336
73364
|
var dir = path2.dirname(file);
|
|
73337
73365
|
var match2 = /^\w+:\/\/[^\/]*/.exec(dir);
|
|
73338
73366
|
var protocol = match2 ? match2[0] : "";
|
|
73339
73367
|
var startPath = dir.slice(protocol.length);
|
|
73340
73368
|
if (protocol && /^\/\w\:/.test(startPath)) {
|
|
73341
73369
|
protocol += "/";
|
|
73342
|
-
return protocol + path2.resolve(dir.slice(protocol.length),
|
|
73370
|
+
return protocol + path2.resolve(dir.slice(protocol.length), url2).replace(/\\/g, "/");
|
|
73343
73371
|
}
|
|
73344
|
-
return protocol + path2.resolve(dir.slice(protocol.length),
|
|
73372
|
+
return protocol + path2.resolve(dir.slice(protocol.length), url2);
|
|
73345
73373
|
}
|
|
73346
73374
|
function retrieveSourceMapURL(source) {
|
|
73347
73375
|
var fileData;
|
|
@@ -73401,8 +73429,8 @@ var require_node3 = __commonJS2((exports) => {
|
|
|
73401
73429
|
sourceMap.map.sources.forEach(function(source, i3) {
|
|
73402
73430
|
var contents = sourceMap.map.sourcesContent[i3];
|
|
73403
73431
|
if (contents) {
|
|
73404
|
-
var
|
|
73405
|
-
fileContentsCache[
|
|
73432
|
+
var url2 = supportRelativeURL(sourceMap.url, source);
|
|
73433
|
+
fileContentsCache[url2] = contents;
|
|
73406
73434
|
}
|
|
73407
73435
|
});
|
|
73408
73436
|
}
|
|
@@ -121378,8 +121406,8 @@ var init_bucket_controller = __esm(() => {
|
|
|
121378
121406
|
if (!slug2) {
|
|
121379
121407
|
throw ApiError.badRequest("Missing game slug");
|
|
121380
121408
|
}
|
|
121381
|
-
const
|
|
121382
|
-
const prefix2 =
|
|
121409
|
+
const url2 = ctx.url;
|
|
121410
|
+
const prefix2 = url2.searchParams.get("prefix") || undefined;
|
|
121383
121411
|
logger40.debug("Listing files", { userId: ctx.user.id, slug: slug2, prefix: prefix2 });
|
|
121384
121412
|
const files = await ctx.services.bucket.listFiles(slug2, ctx.user, prefix2);
|
|
121385
121413
|
return { files };
|
|
@@ -122262,8 +122290,8 @@ var init_kv_controller = __esm(() => {
|
|
|
122262
122290
|
if (!slug2) {
|
|
122263
122291
|
throw ApiError.badRequest("Missing game slug");
|
|
122264
122292
|
}
|
|
122265
|
-
const
|
|
122266
|
-
const prefix2 =
|
|
122293
|
+
const url2 = ctx.url;
|
|
122294
|
+
const prefix2 = url2.searchParams.get("prefix") || undefined;
|
|
122267
122295
|
logger50.debug("Listing keys", { userId: ctx.user.id, slug: slug2, prefix: prefix2 });
|
|
122268
122296
|
const keys = await ctx.services.kv.listKeys(slug2, ctx.user, prefix2);
|
|
122269
122297
|
return { keys };
|
|
@@ -122391,17 +122419,17 @@ var init_leaderboard_controller = __esm(() => {
|
|
|
122391
122419
|
return ctx.services.leaderboard.submitScore(gameId, ctx.user.id, { score: body2.score, metadata: body2.metadata }, ctx.user.isAnonymous, ctx.params.sessionId);
|
|
122392
122420
|
});
|
|
122393
122421
|
getGlobalLeaderboard = requireAuth(async (ctx) => {
|
|
122394
|
-
const
|
|
122395
|
-
const gameId =
|
|
122422
|
+
const url2 = ctx.url;
|
|
122423
|
+
const gameId = url2.searchParams.get("gameId");
|
|
122396
122424
|
if (!gameId) {
|
|
122397
122425
|
throw ApiError.badRequest("Game ID is required");
|
|
122398
122426
|
}
|
|
122399
122427
|
let query;
|
|
122400
122428
|
try {
|
|
122401
122429
|
query = LeaderboardQuerySchema.parse({
|
|
122402
|
-
timeframe:
|
|
122403
|
-
limit: Number(
|
|
122404
|
-
offset: Number(
|
|
122430
|
+
timeframe: url2.searchParams.get("timeframe") || "all_time",
|
|
122431
|
+
limit: Number(url2.searchParams.get("limit") || "10"),
|
|
122432
|
+
offset: Number(url2.searchParams.get("offset") || "0")
|
|
122405
122433
|
});
|
|
122406
122434
|
} catch (error2) {
|
|
122407
122435
|
if (error2 instanceof exports_external.ZodError) {
|
|
@@ -122423,13 +122451,13 @@ var init_leaderboard_controller = __esm(() => {
|
|
|
122423
122451
|
if (!gameId) {
|
|
122424
122452
|
throw ApiError.badRequest("Game ID is required");
|
|
122425
122453
|
}
|
|
122426
|
-
const
|
|
122454
|
+
const url2 = ctx.url;
|
|
122427
122455
|
let query;
|
|
122428
122456
|
try {
|
|
122429
122457
|
query = LeaderboardQuerySchema.parse({
|
|
122430
|
-
timeframe:
|
|
122431
|
-
limit: Number(
|
|
122432
|
-
offset: Number(
|
|
122458
|
+
timeframe: url2.searchParams.get("timeframe") || "all_time",
|
|
122459
|
+
limit: Number(url2.searchParams.get("limit") || "10"),
|
|
122460
|
+
offset: Number(url2.searchParams.get("offset") || "0")
|
|
122433
122461
|
});
|
|
122434
122462
|
} catch (error2) {
|
|
122435
122463
|
if (error2 instanceof exports_external.ZodError) {
|
|
@@ -122463,9 +122491,9 @@ var init_leaderboard_controller = __esm(() => {
|
|
|
122463
122491
|
if (!userId) {
|
|
122464
122492
|
throw ApiError.badRequest("User ID is required");
|
|
122465
122493
|
}
|
|
122466
|
-
const
|
|
122467
|
-
const limit = Math.min(Number(
|
|
122468
|
-
const gameId =
|
|
122494
|
+
const url2 = ctx.url;
|
|
122495
|
+
const limit = Math.min(Number(url2.searchParams.get("limit") || "50"), 100);
|
|
122496
|
+
const gameId = url2.searchParams.get("gameId") || undefined;
|
|
122469
122497
|
logger51.debug("Getting user all scores", {
|
|
122470
122498
|
requesterId: ctx.user.id,
|
|
122471
122499
|
targetUserId: userId,
|
|
@@ -122479,8 +122507,8 @@ var init_leaderboard_controller = __esm(() => {
|
|
|
122479
122507
|
if (!gameId || !userId) {
|
|
122480
122508
|
throw ApiError.badRequest("Game ID and User ID are required");
|
|
122481
122509
|
}
|
|
122482
|
-
const
|
|
122483
|
-
const limit = Math.min(Number(
|
|
122510
|
+
const url2 = ctx.url;
|
|
122511
|
+
const limit = Math.min(Number(url2.searchParams.get("limit") || "10"), 100);
|
|
122484
122512
|
logger51.debug("Getting user scores", {
|
|
122485
122513
|
requesterId: ctx.user.id,
|
|
122486
122514
|
gameId,
|
|
@@ -124763,10 +124791,10 @@ var init_timeback6 = __esm(() => {
|
|
|
124763
124791
|
return c2.json(createErrorResponse(error2), error2.status);
|
|
124764
124792
|
}
|
|
124765
124793
|
if (shouldMockTimeback()) {
|
|
124766
|
-
const
|
|
124767
|
-
const gradeParam =
|
|
124768
|
-
const subjectParam =
|
|
124769
|
-
const includeParam =
|
|
124794
|
+
const url2 = new URL(c2.req.url);
|
|
124795
|
+
const gradeParam = url2.searchParams.get("grade");
|
|
124796
|
+
const subjectParam = url2.searchParams.get("subject");
|
|
124797
|
+
const includeParam = url2.searchParams.get("include") || "";
|
|
124770
124798
|
const includeOptions = includeParam.split(",").map((opt) => opt.trim().toLowerCase());
|
|
124771
124799
|
const includePerCourse = includeOptions.includes("percourse");
|
|
124772
124800
|
const includeToday = includeOptions.includes("today");
|
|
@@ -126545,7 +126573,7 @@ var import_picocolors12 = __toESM(require_picocolors(), 1);
|
|
|
126545
126573
|
// package.json
|
|
126546
126574
|
var package_default2 = {
|
|
126547
126575
|
name: "@playcademy/vite-plugin",
|
|
126548
|
-
version: "0.2.27-beta.
|
|
126576
|
+
version: "0.2.27-beta.3",
|
|
126549
126577
|
type: "module",
|
|
126550
126578
|
exports: {
|
|
126551
126579
|
".": {
|