@playcademy/sandbox 0.3.16 → 0.3.17-beta.2
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 +72 -12
- package/dist/server.js +72 -12
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1310,7 +1310,7 @@ var package_default;
|
|
|
1310
1310
|
var init_package = __esm(() => {
|
|
1311
1311
|
package_default = {
|
|
1312
1312
|
name: "@playcademy/sandbox",
|
|
1313
|
-
version: "0.3.
|
|
1313
|
+
version: "0.3.17-beta.2",
|
|
1314
1314
|
description: "Local development server for Playcademy game development",
|
|
1315
1315
|
type: "module",
|
|
1316
1316
|
exports: {
|
|
@@ -26479,6 +26479,7 @@ class DeployService {
|
|
|
26479
26479
|
try {
|
|
26480
26480
|
result = await this.timeStep("Cloudflare deploy", () => cf.deploy(deploymentId, request.code, env, {
|
|
26481
26481
|
...deploymentOptions,
|
|
26482
|
+
compatibilityFlags: request.compatibilityFlags,
|
|
26482
26483
|
existingResources: activeDeployment?.resources ?? undefined,
|
|
26483
26484
|
assetsPath: frontendAssetsPath,
|
|
26484
26485
|
keepAssets
|
|
@@ -28777,7 +28778,6 @@ var init_constants3 = __esm(() => {
|
|
|
28777
28778
|
}
|
|
28778
28779
|
};
|
|
28779
28780
|
});
|
|
28780
|
-
|
|
28781
28781
|
// ../edge-play/src/entry/setup.ts
|
|
28782
28782
|
function prefixSecrets(secrets) {
|
|
28783
28783
|
const prefixed = {};
|
|
@@ -30485,6 +30485,27 @@ class TimebackAdminService {
|
|
|
30485
30485
|
const rounded = Math.round(value * TimebackAdminService.XP_PRECISION_FACTOR) / TimebackAdminService.XP_PRECISION_FACTOR;
|
|
30486
30486
|
return Object.is(rounded, -0) ? 0 : rounded;
|
|
30487
30487
|
}
|
|
30488
|
+
static toAttributionEventTime(date3) {
|
|
30489
|
+
if (!date3) {
|
|
30490
|
+
return;
|
|
30491
|
+
}
|
|
30492
|
+
const match = date3.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
30493
|
+
if (!match) {
|
|
30494
|
+
throw new ValidationError("Date must be in YYYY-MM-DD format");
|
|
30495
|
+
}
|
|
30496
|
+
const [, yearStr, monthStr, dayStr] = match;
|
|
30497
|
+
const year = Number(yearStr);
|
|
30498
|
+
const month = Number(monthStr);
|
|
30499
|
+
const day = Number(dayStr);
|
|
30500
|
+
if (!Number.isInteger(year) || !Number.isInteger(month) || !Number.isInteger(day)) {
|
|
30501
|
+
throw new ValidationError("Date must be in YYYY-MM-DD format");
|
|
30502
|
+
}
|
|
30503
|
+
const eventTime = new Date(Date.UTC(year, month - 1, day, 12, 0, 0));
|
|
30504
|
+
if (eventTime.getUTCFullYear() !== year || eventTime.getUTCMonth() + 1 !== month || eventTime.getUTCDate() !== day) {
|
|
30505
|
+
throw new ValidationError("Date must be a valid calendar date");
|
|
30506
|
+
}
|
|
30507
|
+
return eventTime.toISOString();
|
|
30508
|
+
}
|
|
30488
30509
|
requireClient() {
|
|
30489
30510
|
if (!this.deps.timeback) {
|
|
30490
30511
|
logger16.error("Timeback client not available in context");
|
|
@@ -30560,7 +30581,6 @@ class TimebackAdminService {
|
|
|
30560
30581
|
masteredUnitsForDay += masteredUnitsFromFact;
|
|
30561
30582
|
}
|
|
30562
30583
|
}
|
|
30563
|
-
const roundedXpForDay = TimebackAdminService.roundXpToTenths(xpForDay);
|
|
30564
30584
|
totalXpRaw += xpForDay;
|
|
30565
30585
|
activeTimeSeconds += activeSecondsForDay;
|
|
30566
30586
|
masteredUnits += masteredUnitsForDay;
|
|
@@ -30569,7 +30589,7 @@ class TimebackAdminService {
|
|
|
30569
30589
|
}
|
|
30570
30590
|
history.push({
|
|
30571
30591
|
date: date3,
|
|
30572
|
-
xpEarned:
|
|
30592
|
+
xpEarned: TimebackAdminService.roundXpToTenths(xpForDay),
|
|
30573
30593
|
activeTimeSeconds: activeSecondsForDay,
|
|
30574
30594
|
masteredUnits: masteredUnitsForDay
|
|
30575
30595
|
});
|
|
@@ -30883,6 +30903,7 @@ class TimebackAdminService {
|
|
|
30883
30903
|
courseId: data.courseId,
|
|
30884
30904
|
studentId: data.studentId,
|
|
30885
30905
|
xpEarned: data.xp,
|
|
30906
|
+
eventTime: TimebackAdminService.toAttributionEventTime(data.date),
|
|
30886
30907
|
reason: data.reason,
|
|
30887
30908
|
actor,
|
|
30888
30909
|
appName,
|
|
@@ -30897,6 +30918,7 @@ class TimebackAdminService {
|
|
|
30897
30918
|
courseId: data.courseId,
|
|
30898
30919
|
studentId: data.studentId,
|
|
30899
30920
|
activeTimeSeconds: data.seconds,
|
|
30921
|
+
eventTime: TimebackAdminService.toAttributionEventTime(data.date),
|
|
30900
30922
|
reason: data.reason,
|
|
30901
30923
|
actor,
|
|
30902
30924
|
appName,
|
|
@@ -30911,6 +30933,7 @@ class TimebackAdminService {
|
|
|
30911
30933
|
courseId: data.courseId,
|
|
30912
30934
|
studentId: data.studentId,
|
|
30913
30935
|
masteredUnits: data.units,
|
|
30936
|
+
eventTime: TimebackAdminService.toAttributionEventTime(data.date),
|
|
30914
30937
|
reason: data.reason,
|
|
30915
30938
|
actor,
|
|
30916
30939
|
appName,
|
|
@@ -34838,7 +34861,7 @@ function createCaliperNamespace(client) {
|
|
|
34838
34861
|
"@context": CALIPER_CONSTANTS4.context,
|
|
34839
34862
|
id: `urn:uuid:${crypto.randomUUID()}`,
|
|
34840
34863
|
type: TIMEBACK_EVENT_TYPES4.timeSpentEvent,
|
|
34841
|
-
eventTime: new Date().toISOString(),
|
|
34864
|
+
eventTime: data.eventTime || new Date().toISOString(),
|
|
34842
34865
|
profile: CALIPER_CONSTANTS4.profile,
|
|
34843
34866
|
actor: {
|
|
34844
34867
|
id: urls.user(data.studentId),
|
|
@@ -35339,6 +35362,7 @@ class AdminEventRecorder {
|
|
|
35339
35362
|
courseId: data.courseId,
|
|
35340
35363
|
courseName: ctx.courseContext.courseName,
|
|
35341
35364
|
xpEarned: data.xpEarned,
|
|
35365
|
+
eventTime: data.eventTime,
|
|
35342
35366
|
subject: ctx.courseContext.subject,
|
|
35343
35367
|
appName: ctx.appName,
|
|
35344
35368
|
sensorUrl: ctx.sensorUrl,
|
|
@@ -35364,6 +35388,7 @@ class AdminEventRecorder {
|
|
|
35364
35388
|
courseId: data.courseId,
|
|
35365
35389
|
courseName: ctx.courseContext.courseName,
|
|
35366
35390
|
activeTimeSeconds: data.activeTimeSeconds,
|
|
35391
|
+
eventTime: data.eventTime,
|
|
35367
35392
|
subject: ctx.courseContext.subject,
|
|
35368
35393
|
appName: ctx.appName,
|
|
35369
35394
|
sensorUrl: ctx.sensorUrl,
|
|
@@ -35384,6 +35409,7 @@ class AdminEventRecorder {
|
|
|
35384
35409
|
courseId: data.courseId,
|
|
35385
35410
|
courseName: ctx.courseContext.courseName,
|
|
35386
35411
|
masteredUnits: data.masteredUnits,
|
|
35412
|
+
eventTime: data.eventTime,
|
|
35387
35413
|
subject: ctx.courseContext.subject,
|
|
35388
35414
|
appName: ctx.appName,
|
|
35389
35415
|
sensorUrl: ctx.sensorUrl,
|
|
@@ -93126,6 +93152,7 @@ var init_schemas2 = __esm(() => {
|
|
|
93126
93152
|
code: exports_external.string().optional(),
|
|
93127
93153
|
codeUploadToken: exports_external.string().optional(),
|
|
93128
93154
|
config: exports_external.unknown().optional(),
|
|
93155
|
+
compatibilityFlags: exports_external.array(exports_external.string()).optional(),
|
|
93129
93156
|
bindings: exports_external.object({
|
|
93130
93157
|
database: exports_external.array(exports_external.string()).optional(),
|
|
93131
93158
|
keyValue: exports_external.array(exports_external.string()).optional(),
|
|
@@ -93379,7 +93406,19 @@ function isTimebackGrade3(value) {
|
|
|
93379
93406
|
function isTimebackSubject3(value) {
|
|
93380
93407
|
return TIMEBACK_SUBJECTS5.includes(value);
|
|
93381
93408
|
}
|
|
93382
|
-
|
|
93409
|
+
function isValidAdminAttributionDate(value) {
|
|
93410
|
+
const match3 = value.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
93411
|
+
if (!match3) {
|
|
93412
|
+
return false;
|
|
93413
|
+
}
|
|
93414
|
+
const [, yearStr, monthStr, dayStr] = match3;
|
|
93415
|
+
const year3 = Number(yearStr);
|
|
93416
|
+
const month = Number(monthStr);
|
|
93417
|
+
const day = Number(dayStr);
|
|
93418
|
+
const date4 = new Date(Date.UTC(year3, month - 1, day, 12, 0, 0));
|
|
93419
|
+
return date4.getUTCFullYear() === year3 && date4.getUTCMonth() + 1 === month && date4.getUTCDate() === day;
|
|
93420
|
+
}
|
|
93421
|
+
var TIMEBACK_GRADES, TIMEBACK_SUBJECTS5, TimebackGradeSchema, TimebackSubjectSchema, UpdateTimebackXpRequestSchema, EndActivityRequestSchema, PopulateStudentRequestSchema, DerivedPlatformCourseConfigSchema, TimebackBaseConfigSchema, PlatformTimebackSetupRequestSchema, AdminTimebackMutationBaseSchema, AdminAttributionDateSchema, GrantTimebackXpRequestSchema, AdjustTimebackTimeRequestSchema, AdjustTimebackMasteryRequestSchema, ToggleCourseCompletionRequestSchema;
|
|
93383
93422
|
var init_schemas11 = __esm(() => {
|
|
93384
93423
|
init_esm();
|
|
93385
93424
|
TIMEBACK_GRADES = [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13];
|
|
@@ -93489,14 +93528,32 @@ var init_schemas11 = __esm(() => {
|
|
|
93489
93528
|
studentId: exports_external.string().min(1),
|
|
93490
93529
|
reason: exports_external.string().min(1)
|
|
93491
93530
|
});
|
|
93531
|
+
AdminAttributionDateSchema = exports_external.string().superRefine((value, ctx) => {
|
|
93532
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
93533
|
+
ctx.addIssue({
|
|
93534
|
+
code: exports_external.ZodIssueCode.custom,
|
|
93535
|
+
message: "Date must be in YYYY-MM-DD format"
|
|
93536
|
+
});
|
|
93537
|
+
return;
|
|
93538
|
+
}
|
|
93539
|
+
if (!isValidAdminAttributionDate(value)) {
|
|
93540
|
+
ctx.addIssue({
|
|
93541
|
+
code: exports_external.ZodIssueCode.custom,
|
|
93542
|
+
message: "Date must be a valid calendar date"
|
|
93543
|
+
});
|
|
93544
|
+
}
|
|
93545
|
+
});
|
|
93492
93546
|
GrantTimebackXpRequestSchema = AdminTimebackMutationBaseSchema.extend({
|
|
93493
|
-
xp: exports_external.number().min(-100, "Amount must be between -100 and 100").max(100, "Amount must be between -100 and 100").refine((value) => value !== 0, { message: "Amount cannot be 0" })
|
|
93547
|
+
xp: exports_external.number().min(-100, "Amount must be between -100 and 100").max(100, "Amount must be between -100 and 100").refine((value) => value !== 0, { message: "Amount cannot be 0" }),
|
|
93548
|
+
date: AdminAttributionDateSchema.optional()
|
|
93494
93549
|
});
|
|
93495
93550
|
AdjustTimebackTimeRequestSchema = AdminTimebackMutationBaseSchema.extend({
|
|
93496
|
-
seconds: exports_external.number().refine((value) => value !== 0, { message: "Time amount cannot be 0" })
|
|
93551
|
+
seconds: exports_external.number().refine((value) => value !== 0, { message: "Time amount cannot be 0" }),
|
|
93552
|
+
date: AdminAttributionDateSchema.optional()
|
|
93497
93553
|
});
|
|
93498
93554
|
AdjustTimebackMasteryRequestSchema = AdminTimebackMutationBaseSchema.extend({
|
|
93499
|
-
units: exports_external.number().refine((value) => value !== 0, { message: "Units cannot be 0" })
|
|
93555
|
+
units: exports_external.number().refine((value) => value !== 0, { message: "Units cannot be 0" }),
|
|
93556
|
+
date: AdminAttributionDateSchema.optional()
|
|
93500
93557
|
});
|
|
93501
93558
|
ToggleCourseCompletionRequestSchema = exports_external.object({
|
|
93502
93559
|
gameId: exports_external.string().uuid(),
|
|
@@ -95907,7 +95964,8 @@ var init_timeback_controller = __esm(() => {
|
|
|
95907
95964
|
gameId: body2.gameId,
|
|
95908
95965
|
courseId: body2.courseId,
|
|
95909
95966
|
studentId: body2.studentId,
|
|
95910
|
-
xp: body2.xp
|
|
95967
|
+
xp: body2.xp,
|
|
95968
|
+
date: body2.date
|
|
95911
95969
|
});
|
|
95912
95970
|
return ctx.services.timebackAdmin.grantManualXp(body2, ctx.user);
|
|
95913
95971
|
});
|
|
@@ -95918,7 +95976,8 @@ var init_timeback_controller = __esm(() => {
|
|
|
95918
95976
|
gameId: body2.gameId,
|
|
95919
95977
|
courseId: body2.courseId,
|
|
95920
95978
|
studentId: body2.studentId,
|
|
95921
|
-
seconds: body2.seconds
|
|
95979
|
+
seconds: body2.seconds,
|
|
95980
|
+
date: body2.date
|
|
95922
95981
|
});
|
|
95923
95982
|
return ctx.services.timebackAdmin.adjustTimeSpent(body2, ctx.user);
|
|
95924
95983
|
});
|
|
@@ -95929,7 +95988,8 @@ var init_timeback_controller = __esm(() => {
|
|
|
95929
95988
|
gameId: body2.gameId,
|
|
95930
95989
|
courseId: body2.courseId,
|
|
95931
95990
|
studentId: body2.studentId,
|
|
95932
|
-
units: body2.units
|
|
95991
|
+
units: body2.units,
|
|
95992
|
+
date: body2.date
|
|
95933
95993
|
});
|
|
95934
95994
|
return ctx.services.timebackAdmin.adjustMasteredUnits(body2, ctx.user);
|
|
95935
95995
|
});
|
package/dist/server.js
CHANGED
|
@@ -1309,7 +1309,7 @@ var package_default;
|
|
|
1309
1309
|
var init_package = __esm(() => {
|
|
1310
1310
|
package_default = {
|
|
1311
1311
|
name: "@playcademy/sandbox",
|
|
1312
|
-
version: "0.3.
|
|
1312
|
+
version: "0.3.17-beta.2",
|
|
1313
1313
|
description: "Local development server for Playcademy game development",
|
|
1314
1314
|
type: "module",
|
|
1315
1315
|
exports: {
|
|
@@ -26478,6 +26478,7 @@ class DeployService {
|
|
|
26478
26478
|
try {
|
|
26479
26479
|
result = await this.timeStep("Cloudflare deploy", () => cf.deploy(deploymentId, request.code, env, {
|
|
26480
26480
|
...deploymentOptions,
|
|
26481
|
+
compatibilityFlags: request.compatibilityFlags,
|
|
26481
26482
|
existingResources: activeDeployment?.resources ?? undefined,
|
|
26482
26483
|
assetsPath: frontendAssetsPath,
|
|
26483
26484
|
keepAssets
|
|
@@ -28776,7 +28777,6 @@ var init_constants3 = __esm(() => {
|
|
|
28776
28777
|
}
|
|
28777
28778
|
};
|
|
28778
28779
|
});
|
|
28779
|
-
|
|
28780
28780
|
// ../edge-play/src/entry/setup.ts
|
|
28781
28781
|
function prefixSecrets(secrets) {
|
|
28782
28782
|
const prefixed = {};
|
|
@@ -30484,6 +30484,27 @@ class TimebackAdminService {
|
|
|
30484
30484
|
const rounded = Math.round(value * TimebackAdminService.XP_PRECISION_FACTOR) / TimebackAdminService.XP_PRECISION_FACTOR;
|
|
30485
30485
|
return Object.is(rounded, -0) ? 0 : rounded;
|
|
30486
30486
|
}
|
|
30487
|
+
static toAttributionEventTime(date3) {
|
|
30488
|
+
if (!date3) {
|
|
30489
|
+
return;
|
|
30490
|
+
}
|
|
30491
|
+
const match = date3.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
30492
|
+
if (!match) {
|
|
30493
|
+
throw new ValidationError("Date must be in YYYY-MM-DD format");
|
|
30494
|
+
}
|
|
30495
|
+
const [, yearStr, monthStr, dayStr] = match;
|
|
30496
|
+
const year = Number(yearStr);
|
|
30497
|
+
const month = Number(monthStr);
|
|
30498
|
+
const day = Number(dayStr);
|
|
30499
|
+
if (!Number.isInteger(year) || !Number.isInteger(month) || !Number.isInteger(day)) {
|
|
30500
|
+
throw new ValidationError("Date must be in YYYY-MM-DD format");
|
|
30501
|
+
}
|
|
30502
|
+
const eventTime = new Date(Date.UTC(year, month - 1, day, 12, 0, 0));
|
|
30503
|
+
if (eventTime.getUTCFullYear() !== year || eventTime.getUTCMonth() + 1 !== month || eventTime.getUTCDate() !== day) {
|
|
30504
|
+
throw new ValidationError("Date must be a valid calendar date");
|
|
30505
|
+
}
|
|
30506
|
+
return eventTime.toISOString();
|
|
30507
|
+
}
|
|
30487
30508
|
requireClient() {
|
|
30488
30509
|
if (!this.deps.timeback) {
|
|
30489
30510
|
logger16.error("Timeback client not available in context");
|
|
@@ -30559,7 +30580,6 @@ class TimebackAdminService {
|
|
|
30559
30580
|
masteredUnitsForDay += masteredUnitsFromFact;
|
|
30560
30581
|
}
|
|
30561
30582
|
}
|
|
30562
|
-
const roundedXpForDay = TimebackAdminService.roundXpToTenths(xpForDay);
|
|
30563
30583
|
totalXpRaw += xpForDay;
|
|
30564
30584
|
activeTimeSeconds += activeSecondsForDay;
|
|
30565
30585
|
masteredUnits += masteredUnitsForDay;
|
|
@@ -30568,7 +30588,7 @@ class TimebackAdminService {
|
|
|
30568
30588
|
}
|
|
30569
30589
|
history.push({
|
|
30570
30590
|
date: date3,
|
|
30571
|
-
xpEarned:
|
|
30591
|
+
xpEarned: TimebackAdminService.roundXpToTenths(xpForDay),
|
|
30572
30592
|
activeTimeSeconds: activeSecondsForDay,
|
|
30573
30593
|
masteredUnits: masteredUnitsForDay
|
|
30574
30594
|
});
|
|
@@ -30882,6 +30902,7 @@ class TimebackAdminService {
|
|
|
30882
30902
|
courseId: data.courseId,
|
|
30883
30903
|
studentId: data.studentId,
|
|
30884
30904
|
xpEarned: data.xp,
|
|
30905
|
+
eventTime: TimebackAdminService.toAttributionEventTime(data.date),
|
|
30885
30906
|
reason: data.reason,
|
|
30886
30907
|
actor,
|
|
30887
30908
|
appName,
|
|
@@ -30896,6 +30917,7 @@ class TimebackAdminService {
|
|
|
30896
30917
|
courseId: data.courseId,
|
|
30897
30918
|
studentId: data.studentId,
|
|
30898
30919
|
activeTimeSeconds: data.seconds,
|
|
30920
|
+
eventTime: TimebackAdminService.toAttributionEventTime(data.date),
|
|
30899
30921
|
reason: data.reason,
|
|
30900
30922
|
actor,
|
|
30901
30923
|
appName,
|
|
@@ -30910,6 +30932,7 @@ class TimebackAdminService {
|
|
|
30910
30932
|
courseId: data.courseId,
|
|
30911
30933
|
studentId: data.studentId,
|
|
30912
30934
|
masteredUnits: data.units,
|
|
30935
|
+
eventTime: TimebackAdminService.toAttributionEventTime(data.date),
|
|
30913
30936
|
reason: data.reason,
|
|
30914
30937
|
actor,
|
|
30915
30938
|
appName,
|
|
@@ -34837,7 +34860,7 @@ function createCaliperNamespace(client) {
|
|
|
34837
34860
|
"@context": CALIPER_CONSTANTS4.context,
|
|
34838
34861
|
id: `urn:uuid:${crypto.randomUUID()}`,
|
|
34839
34862
|
type: TIMEBACK_EVENT_TYPES4.timeSpentEvent,
|
|
34840
|
-
eventTime: new Date().toISOString(),
|
|
34863
|
+
eventTime: data.eventTime || new Date().toISOString(),
|
|
34841
34864
|
profile: CALIPER_CONSTANTS4.profile,
|
|
34842
34865
|
actor: {
|
|
34843
34866
|
id: urls.user(data.studentId),
|
|
@@ -35338,6 +35361,7 @@ class AdminEventRecorder {
|
|
|
35338
35361
|
courseId: data.courseId,
|
|
35339
35362
|
courseName: ctx.courseContext.courseName,
|
|
35340
35363
|
xpEarned: data.xpEarned,
|
|
35364
|
+
eventTime: data.eventTime,
|
|
35341
35365
|
subject: ctx.courseContext.subject,
|
|
35342
35366
|
appName: ctx.appName,
|
|
35343
35367
|
sensorUrl: ctx.sensorUrl,
|
|
@@ -35363,6 +35387,7 @@ class AdminEventRecorder {
|
|
|
35363
35387
|
courseId: data.courseId,
|
|
35364
35388
|
courseName: ctx.courseContext.courseName,
|
|
35365
35389
|
activeTimeSeconds: data.activeTimeSeconds,
|
|
35390
|
+
eventTime: data.eventTime,
|
|
35366
35391
|
subject: ctx.courseContext.subject,
|
|
35367
35392
|
appName: ctx.appName,
|
|
35368
35393
|
sensorUrl: ctx.sensorUrl,
|
|
@@ -35383,6 +35408,7 @@ class AdminEventRecorder {
|
|
|
35383
35408
|
courseId: data.courseId,
|
|
35384
35409
|
courseName: ctx.courseContext.courseName,
|
|
35385
35410
|
masteredUnits: data.masteredUnits,
|
|
35411
|
+
eventTime: data.eventTime,
|
|
35386
35412
|
subject: ctx.courseContext.subject,
|
|
35387
35413
|
appName: ctx.appName,
|
|
35388
35414
|
sensorUrl: ctx.sensorUrl,
|
|
@@ -93125,6 +93151,7 @@ var init_schemas2 = __esm(() => {
|
|
|
93125
93151
|
code: exports_external.string().optional(),
|
|
93126
93152
|
codeUploadToken: exports_external.string().optional(),
|
|
93127
93153
|
config: exports_external.unknown().optional(),
|
|
93154
|
+
compatibilityFlags: exports_external.array(exports_external.string()).optional(),
|
|
93128
93155
|
bindings: exports_external.object({
|
|
93129
93156
|
database: exports_external.array(exports_external.string()).optional(),
|
|
93130
93157
|
keyValue: exports_external.array(exports_external.string()).optional(),
|
|
@@ -93378,7 +93405,19 @@ function isTimebackGrade3(value) {
|
|
|
93378
93405
|
function isTimebackSubject3(value) {
|
|
93379
93406
|
return TIMEBACK_SUBJECTS5.includes(value);
|
|
93380
93407
|
}
|
|
93381
|
-
|
|
93408
|
+
function isValidAdminAttributionDate(value) {
|
|
93409
|
+
const match3 = value.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
93410
|
+
if (!match3) {
|
|
93411
|
+
return false;
|
|
93412
|
+
}
|
|
93413
|
+
const [, yearStr, monthStr, dayStr] = match3;
|
|
93414
|
+
const year3 = Number(yearStr);
|
|
93415
|
+
const month = Number(monthStr);
|
|
93416
|
+
const day = Number(dayStr);
|
|
93417
|
+
const date4 = new Date(Date.UTC(year3, month - 1, day, 12, 0, 0));
|
|
93418
|
+
return date4.getUTCFullYear() === year3 && date4.getUTCMonth() + 1 === month && date4.getUTCDate() === day;
|
|
93419
|
+
}
|
|
93420
|
+
var TIMEBACK_GRADES, TIMEBACK_SUBJECTS5, TimebackGradeSchema, TimebackSubjectSchema, UpdateTimebackXpRequestSchema, EndActivityRequestSchema, PopulateStudentRequestSchema, DerivedPlatformCourseConfigSchema, TimebackBaseConfigSchema, PlatformTimebackSetupRequestSchema, AdminTimebackMutationBaseSchema, AdminAttributionDateSchema, GrantTimebackXpRequestSchema, AdjustTimebackTimeRequestSchema, AdjustTimebackMasteryRequestSchema, ToggleCourseCompletionRequestSchema;
|
|
93382
93421
|
var init_schemas11 = __esm(() => {
|
|
93383
93422
|
init_esm();
|
|
93384
93423
|
TIMEBACK_GRADES = [-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13];
|
|
@@ -93488,14 +93527,32 @@ var init_schemas11 = __esm(() => {
|
|
|
93488
93527
|
studentId: exports_external.string().min(1),
|
|
93489
93528
|
reason: exports_external.string().min(1)
|
|
93490
93529
|
});
|
|
93530
|
+
AdminAttributionDateSchema = exports_external.string().superRefine((value, ctx) => {
|
|
93531
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
93532
|
+
ctx.addIssue({
|
|
93533
|
+
code: exports_external.ZodIssueCode.custom,
|
|
93534
|
+
message: "Date must be in YYYY-MM-DD format"
|
|
93535
|
+
});
|
|
93536
|
+
return;
|
|
93537
|
+
}
|
|
93538
|
+
if (!isValidAdminAttributionDate(value)) {
|
|
93539
|
+
ctx.addIssue({
|
|
93540
|
+
code: exports_external.ZodIssueCode.custom,
|
|
93541
|
+
message: "Date must be a valid calendar date"
|
|
93542
|
+
});
|
|
93543
|
+
}
|
|
93544
|
+
});
|
|
93491
93545
|
GrantTimebackXpRequestSchema = AdminTimebackMutationBaseSchema.extend({
|
|
93492
|
-
xp: exports_external.number().min(-100, "Amount must be between -100 and 100").max(100, "Amount must be between -100 and 100").refine((value) => value !== 0, { message: "Amount cannot be 0" })
|
|
93546
|
+
xp: exports_external.number().min(-100, "Amount must be between -100 and 100").max(100, "Amount must be between -100 and 100").refine((value) => value !== 0, { message: "Amount cannot be 0" }),
|
|
93547
|
+
date: AdminAttributionDateSchema.optional()
|
|
93493
93548
|
});
|
|
93494
93549
|
AdjustTimebackTimeRequestSchema = AdminTimebackMutationBaseSchema.extend({
|
|
93495
|
-
seconds: exports_external.number().refine((value) => value !== 0, { message: "Time amount cannot be 0" })
|
|
93550
|
+
seconds: exports_external.number().refine((value) => value !== 0, { message: "Time amount cannot be 0" }),
|
|
93551
|
+
date: AdminAttributionDateSchema.optional()
|
|
93496
93552
|
});
|
|
93497
93553
|
AdjustTimebackMasteryRequestSchema = AdminTimebackMutationBaseSchema.extend({
|
|
93498
|
-
units: exports_external.number().refine((value) => value !== 0, { message: "Units cannot be 0" })
|
|
93554
|
+
units: exports_external.number().refine((value) => value !== 0, { message: "Units cannot be 0" }),
|
|
93555
|
+
date: AdminAttributionDateSchema.optional()
|
|
93499
93556
|
});
|
|
93500
93557
|
ToggleCourseCompletionRequestSchema = exports_external.object({
|
|
93501
93558
|
gameId: exports_external.string().uuid(),
|
|
@@ -95906,7 +95963,8 @@ var init_timeback_controller = __esm(() => {
|
|
|
95906
95963
|
gameId: body2.gameId,
|
|
95907
95964
|
courseId: body2.courseId,
|
|
95908
95965
|
studentId: body2.studentId,
|
|
95909
|
-
xp: body2.xp
|
|
95966
|
+
xp: body2.xp,
|
|
95967
|
+
date: body2.date
|
|
95910
95968
|
});
|
|
95911
95969
|
return ctx.services.timebackAdmin.grantManualXp(body2, ctx.user);
|
|
95912
95970
|
});
|
|
@@ -95917,7 +95975,8 @@ var init_timeback_controller = __esm(() => {
|
|
|
95917
95975
|
gameId: body2.gameId,
|
|
95918
95976
|
courseId: body2.courseId,
|
|
95919
95977
|
studentId: body2.studentId,
|
|
95920
|
-
seconds: body2.seconds
|
|
95978
|
+
seconds: body2.seconds,
|
|
95979
|
+
date: body2.date
|
|
95921
95980
|
});
|
|
95922
95981
|
return ctx.services.timebackAdmin.adjustTimeSpent(body2, ctx.user);
|
|
95923
95982
|
});
|
|
@@ -95928,7 +95987,8 @@ var init_timeback_controller = __esm(() => {
|
|
|
95928
95987
|
gameId: body2.gameId,
|
|
95929
95988
|
courseId: body2.courseId,
|
|
95930
95989
|
studentId: body2.studentId,
|
|
95931
|
-
units: body2.units
|
|
95990
|
+
units: body2.units,
|
|
95991
|
+
date: body2.date
|
|
95932
95992
|
});
|
|
95933
95993
|
return ctx.services.timebackAdmin.adjustMasteredUnits(body2, ctx.user);
|
|
95934
95994
|
});
|