@playcademy/vite-plugin 0.2.22 → 0.2.23-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/index.js +73 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -25334,7 +25334,7 @@ var package_default;
|
|
|
25334
25334
|
var init_package = __esm(() => {
|
|
25335
25335
|
package_default = {
|
|
25336
25336
|
name: "@playcademy/sandbox",
|
|
25337
|
-
version: "0.3.
|
|
25337
|
+
version: "0.3.17-beta.2",
|
|
25338
25338
|
description: "Local development server for Playcademy game development",
|
|
25339
25339
|
type: "module",
|
|
25340
25340
|
exports: {
|
|
@@ -50332,6 +50332,7 @@ class DeployService {
|
|
|
50332
50332
|
try {
|
|
50333
50333
|
result = await this.timeStep("Cloudflare deploy", () => cf.deploy(deploymentId, request.code, env, {
|
|
50334
50334
|
...deploymentOptions,
|
|
50335
|
+
compatibilityFlags: request.compatibilityFlags,
|
|
50335
50336
|
existingResources: activeDeployment?.resources ?? undefined,
|
|
50336
50337
|
assetsPath: frontendAssetsPath,
|
|
50337
50338
|
keepAssets
|
|
@@ -54372,6 +54373,27 @@ class TimebackAdminService {
|
|
|
54372
54373
|
const rounded = Math.round(value * TimebackAdminService.XP_PRECISION_FACTOR) / TimebackAdminService.XP_PRECISION_FACTOR;
|
|
54373
54374
|
return Object.is(rounded, -0) ? 0 : rounded;
|
|
54374
54375
|
}
|
|
54376
|
+
static toAttributionEventTime(date3) {
|
|
54377
|
+
if (!date3) {
|
|
54378
|
+
return;
|
|
54379
|
+
}
|
|
54380
|
+
const match = date3.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
54381
|
+
if (!match) {
|
|
54382
|
+
throw new ValidationError("Date must be in YYYY-MM-DD format");
|
|
54383
|
+
}
|
|
54384
|
+
const [, yearStr, monthStr, dayStr] = match;
|
|
54385
|
+
const year = Number(yearStr);
|
|
54386
|
+
const month = Number(monthStr);
|
|
54387
|
+
const day = Number(dayStr);
|
|
54388
|
+
if (!Number.isInteger(year) || !Number.isInteger(month) || !Number.isInteger(day)) {
|
|
54389
|
+
throw new ValidationError("Date must be in YYYY-MM-DD format");
|
|
54390
|
+
}
|
|
54391
|
+
const eventTime = new Date(Date.UTC(year, month - 1, day, 12, 0, 0));
|
|
54392
|
+
if (eventTime.getUTCFullYear() !== year || eventTime.getUTCMonth() + 1 !== month || eventTime.getUTCDate() !== day) {
|
|
54393
|
+
throw new ValidationError("Date must be a valid calendar date");
|
|
54394
|
+
}
|
|
54395
|
+
return eventTime.toISOString();
|
|
54396
|
+
}
|
|
54375
54397
|
requireClient() {
|
|
54376
54398
|
if (!this.deps.timeback) {
|
|
54377
54399
|
logger16.error("Timeback client not available in context");
|
|
@@ -54447,7 +54469,6 @@ class TimebackAdminService {
|
|
|
54447
54469
|
masteredUnitsForDay += masteredUnitsFromFact;
|
|
54448
54470
|
}
|
|
54449
54471
|
}
|
|
54450
|
-
const roundedXpForDay = TimebackAdminService.roundXpToTenths(xpForDay);
|
|
54451
54472
|
totalXpRaw += xpForDay;
|
|
54452
54473
|
activeTimeSeconds += activeSecondsForDay;
|
|
54453
54474
|
masteredUnits += masteredUnitsForDay;
|
|
@@ -54456,7 +54477,7 @@ class TimebackAdminService {
|
|
|
54456
54477
|
}
|
|
54457
54478
|
history.push({
|
|
54458
54479
|
date: date3,
|
|
54459
|
-
xpEarned:
|
|
54480
|
+
xpEarned: TimebackAdminService.roundXpToTenths(xpForDay),
|
|
54460
54481
|
activeTimeSeconds: activeSecondsForDay,
|
|
54461
54482
|
masteredUnits: masteredUnitsForDay
|
|
54462
54483
|
});
|
|
@@ -54770,6 +54791,7 @@ class TimebackAdminService {
|
|
|
54770
54791
|
courseId: data.courseId,
|
|
54771
54792
|
studentId: data.studentId,
|
|
54772
54793
|
xpEarned: data.xp,
|
|
54794
|
+
eventTime: TimebackAdminService.toAttributionEventTime(data.date),
|
|
54773
54795
|
reason: data.reason,
|
|
54774
54796
|
actor,
|
|
54775
54797
|
appName,
|
|
@@ -54784,6 +54806,7 @@ class TimebackAdminService {
|
|
|
54784
54806
|
courseId: data.courseId,
|
|
54785
54807
|
studentId: data.studentId,
|
|
54786
54808
|
activeTimeSeconds: data.seconds,
|
|
54809
|
+
eventTime: TimebackAdminService.toAttributionEventTime(data.date),
|
|
54787
54810
|
reason: data.reason,
|
|
54788
54811
|
actor,
|
|
54789
54812
|
appName,
|
|
@@ -54798,6 +54821,7 @@ class TimebackAdminService {
|
|
|
54798
54821
|
courseId: data.courseId,
|
|
54799
54822
|
studentId: data.studentId,
|
|
54800
54823
|
masteredUnits: data.units,
|
|
54824
|
+
eventTime: TimebackAdminService.toAttributionEventTime(data.date),
|
|
54801
54825
|
reason: data.reason,
|
|
54802
54826
|
actor,
|
|
54803
54827
|
appName,
|
|
@@ -58683,7 +58707,7 @@ function createCaliperNamespace(client) {
|
|
|
58683
58707
|
"@context": CALIPER_CONSTANTS4.context,
|
|
58684
58708
|
id: `urn:uuid:${crypto.randomUUID()}`,
|
|
58685
58709
|
type: TIMEBACK_EVENT_TYPES4.timeSpentEvent,
|
|
58686
|
-
eventTime: new Date().toISOString(),
|
|
58710
|
+
eventTime: data.eventTime || new Date().toISOString(),
|
|
58687
58711
|
profile: CALIPER_CONSTANTS4.profile,
|
|
58688
58712
|
actor: {
|
|
58689
58713
|
id: urls.user(data.studentId),
|
|
@@ -59184,6 +59208,7 @@ class AdminEventRecorder {
|
|
|
59184
59208
|
courseId: data.courseId,
|
|
59185
59209
|
courseName: ctx.courseContext.courseName,
|
|
59186
59210
|
xpEarned: data.xpEarned,
|
|
59211
|
+
eventTime: data.eventTime,
|
|
59187
59212
|
subject: ctx.courseContext.subject,
|
|
59188
59213
|
appName: ctx.appName,
|
|
59189
59214
|
sensorUrl: ctx.sensorUrl,
|
|
@@ -59209,6 +59234,7 @@ class AdminEventRecorder {
|
|
|
59209
59234
|
courseId: data.courseId,
|
|
59210
59235
|
courseName: ctx.courseContext.courseName,
|
|
59211
59236
|
activeTimeSeconds: data.activeTimeSeconds,
|
|
59237
|
+
eventTime: data.eventTime,
|
|
59212
59238
|
subject: ctx.courseContext.subject,
|
|
59213
59239
|
appName: ctx.appName,
|
|
59214
59240
|
sensorUrl: ctx.sensorUrl,
|
|
@@ -59229,6 +59255,7 @@ class AdminEventRecorder {
|
|
|
59229
59255
|
courseId: data.courseId,
|
|
59230
59256
|
courseName: ctx.courseContext.courseName,
|
|
59231
59257
|
masteredUnits: data.masteredUnits,
|
|
59258
|
+
eventTime: data.eventTime,
|
|
59232
59259
|
subject: ctx.courseContext.subject,
|
|
59233
59260
|
appName: ctx.appName,
|
|
59234
59261
|
sensorUrl: ctx.sensorUrl,
|
|
@@ -119643,6 +119670,7 @@ var init_schemas2 = __esm(() => {
|
|
|
119643
119670
|
code: exports_external.string().optional(),
|
|
119644
119671
|
codeUploadToken: exports_external.string().optional(),
|
|
119645
119672
|
config: exports_external.unknown().optional(),
|
|
119673
|
+
compatibilityFlags: exports_external.array(exports_external.string()).optional(),
|
|
119646
119674
|
bindings: exports_external.object({
|
|
119647
119675
|
database: exports_external.array(exports_external.string()).optional(),
|
|
119648
119676
|
keyValue: exports_external.array(exports_external.string()).optional(),
|
|
@@ -119906,6 +119934,18 @@ function isTimebackGrade3(value) {
|
|
|
119906
119934
|
function isTimebackSubject3(value) {
|
|
119907
119935
|
return TIMEBACK_SUBJECTS5.includes(value);
|
|
119908
119936
|
}
|
|
119937
|
+
function isValidAdminAttributionDate(value) {
|
|
119938
|
+
const match3 = value.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
119939
|
+
if (!match3) {
|
|
119940
|
+
return false;
|
|
119941
|
+
}
|
|
119942
|
+
const [, yearStr, monthStr, dayStr] = match3;
|
|
119943
|
+
const year3 = Number(yearStr);
|
|
119944
|
+
const month = Number(monthStr);
|
|
119945
|
+
const day = Number(dayStr);
|
|
119946
|
+
const date4 = new Date(Date.UTC(year3, month - 1, day, 12, 0, 0));
|
|
119947
|
+
return date4.getUTCFullYear() === year3 && date4.getUTCMonth() + 1 === month && date4.getUTCDate() === day;
|
|
119948
|
+
}
|
|
119909
119949
|
var TIMEBACK_GRADES;
|
|
119910
119950
|
var TIMEBACK_SUBJECTS5;
|
|
119911
119951
|
var TimebackGradeSchema;
|
|
@@ -119917,6 +119957,7 @@ var DerivedPlatformCourseConfigSchema;
|
|
|
119917
119957
|
var TimebackBaseConfigSchema;
|
|
119918
119958
|
var PlatformTimebackSetupRequestSchema;
|
|
119919
119959
|
var AdminTimebackMutationBaseSchema;
|
|
119960
|
+
var AdminAttributionDateSchema;
|
|
119920
119961
|
var GrantTimebackXpRequestSchema;
|
|
119921
119962
|
var AdjustTimebackTimeRequestSchema;
|
|
119922
119963
|
var AdjustTimebackMasteryRequestSchema;
|
|
@@ -120030,14 +120071,32 @@ var init_schemas11 = __esm(() => {
|
|
|
120030
120071
|
studentId: exports_external.string().min(1),
|
|
120031
120072
|
reason: exports_external.string().min(1)
|
|
120032
120073
|
});
|
|
120074
|
+
AdminAttributionDateSchema = exports_external.string().superRefine((value, ctx) => {
|
|
120075
|
+
if (!/^\d{4}-\d{2}-\d{2}$/.test(value)) {
|
|
120076
|
+
ctx.addIssue({
|
|
120077
|
+
code: exports_external.ZodIssueCode.custom,
|
|
120078
|
+
message: "Date must be in YYYY-MM-DD format"
|
|
120079
|
+
});
|
|
120080
|
+
return;
|
|
120081
|
+
}
|
|
120082
|
+
if (!isValidAdminAttributionDate(value)) {
|
|
120083
|
+
ctx.addIssue({
|
|
120084
|
+
code: exports_external.ZodIssueCode.custom,
|
|
120085
|
+
message: "Date must be a valid calendar date"
|
|
120086
|
+
});
|
|
120087
|
+
}
|
|
120088
|
+
});
|
|
120033
120089
|
GrantTimebackXpRequestSchema = AdminTimebackMutationBaseSchema.extend({
|
|
120034
|
-
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" })
|
|
120090
|
+
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" }),
|
|
120091
|
+
date: AdminAttributionDateSchema.optional()
|
|
120035
120092
|
});
|
|
120036
120093
|
AdjustTimebackTimeRequestSchema = AdminTimebackMutationBaseSchema.extend({
|
|
120037
|
-
seconds: exports_external.number().refine((value) => value !== 0, { message: "Time amount cannot be 0" })
|
|
120094
|
+
seconds: exports_external.number().refine((value) => value !== 0, { message: "Time amount cannot be 0" }),
|
|
120095
|
+
date: AdminAttributionDateSchema.optional()
|
|
120038
120096
|
});
|
|
120039
120097
|
AdjustTimebackMasteryRequestSchema = AdminTimebackMutationBaseSchema.extend({
|
|
120040
|
-
units: exports_external.number().refine((value) => value !== 0, { message: "Units cannot be 0" })
|
|
120098
|
+
units: exports_external.number().refine((value) => value !== 0, { message: "Units cannot be 0" }),
|
|
120099
|
+
date: AdminAttributionDateSchema.optional()
|
|
120041
120100
|
});
|
|
120042
120101
|
ToggleCourseCompletionRequestSchema = exports_external.object({
|
|
120043
120102
|
gameId: exports_external.string().uuid(),
|
|
@@ -122516,7 +122575,8 @@ var init_timeback_controller = __esm(() => {
|
|
|
122516
122575
|
gameId: body2.gameId,
|
|
122517
122576
|
courseId: body2.courseId,
|
|
122518
122577
|
studentId: body2.studentId,
|
|
122519
|
-
xp: body2.xp
|
|
122578
|
+
xp: body2.xp,
|
|
122579
|
+
date: body2.date
|
|
122520
122580
|
});
|
|
122521
122581
|
return ctx.services.timebackAdmin.grantManualXp(body2, ctx.user);
|
|
122522
122582
|
});
|
|
@@ -122527,7 +122587,8 @@ var init_timeback_controller = __esm(() => {
|
|
|
122527
122587
|
gameId: body2.gameId,
|
|
122528
122588
|
courseId: body2.courseId,
|
|
122529
122589
|
studentId: body2.studentId,
|
|
122530
|
-
seconds: body2.seconds
|
|
122590
|
+
seconds: body2.seconds,
|
|
122591
|
+
date: body2.date
|
|
122531
122592
|
});
|
|
122532
122593
|
return ctx.services.timebackAdmin.adjustTimeSpent(body2, ctx.user);
|
|
122533
122594
|
});
|
|
@@ -122538,7 +122599,8 @@ var init_timeback_controller = __esm(() => {
|
|
|
122538
122599
|
gameId: body2.gameId,
|
|
122539
122600
|
courseId: body2.courseId,
|
|
122540
122601
|
studentId: body2.studentId,
|
|
122541
|
-
units: body2.units
|
|
122602
|
+
units: body2.units,
|
|
122603
|
+
date: body2.date
|
|
122542
122604
|
});
|
|
122543
122605
|
return ctx.services.timebackAdmin.adjustMasteredUnits(body2, ctx.user);
|
|
122544
122606
|
});
|
|
@@ -125136,7 +125198,7 @@ var import_picocolors12 = __toESM(require_picocolors(), 1);
|
|
|
125136
125198
|
// package.json
|
|
125137
125199
|
var package_default2 = {
|
|
125138
125200
|
name: "@playcademy/vite-plugin",
|
|
125139
|
-
version: "0.2.
|
|
125201
|
+
version: "0.2.23-beta.2",
|
|
125140
125202
|
type: "module",
|
|
125141
125203
|
exports: {
|
|
125142
125204
|
".": {
|