@playcademy/vite-plugin 0.2.24-beta.7 → 0.2.24-beta.9

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.
Files changed (2) hide show
  1. package/dist/index.js +26 -8
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -25336,7 +25336,7 @@ var package_default;
25336
25336
  var init_package = __esm(() => {
25337
25337
  package_default = {
25338
25338
  name: "@playcademy/sandbox",
25339
- version: "0.3.17-beta.10",
25339
+ version: "0.3.17-beta.12",
25340
25340
  description: "Local development server for Playcademy game development",
25341
25341
  type: "module",
25342
25342
  exports: {
@@ -55692,7 +55692,8 @@ var init_timeback_service = __esm(() => {
55692
55692
  }) {
55693
55693
  const client = this.requireClient();
55694
55694
  const db2 = this.deps.db;
55695
- const extensionsWithResumeId = TimebackService2.addResumeIdToExtensions(extensions, resumeId);
55695
+ const effectiveResumeId = resumeId ?? runId ?? crypto.randomUUID();
55696
+ const extensionsWithResumeId = TimebackService2.addResumeIdToExtensions(extensions, effectiveResumeId);
55696
55697
  await this.deps.validateDeveloperAccess(user, gameId);
55697
55698
  const integration = await db2.query.gameTimebackIntegrations.findFirst({
55698
55699
  where: and(eq(gameTimebackIntegrations.gameId, gameId), eq(gameTimebackIntegrations.grade, activityData.grade), eq(gameTimebackIntegrations.subject, activityData.subject))
@@ -55765,18 +55766,26 @@ var init_timeback_service = __esm(() => {
55765
55766
  activityData,
55766
55767
  timingData,
55767
55768
  windowStartedAtMs,
55769
+ windowSequence,
55768
55770
  isFinal,
55769
55771
  user
55770
55772
  }) {
55771
55773
  const client = this.requireClient();
55772
55774
  const db2 = this.deps.db;
55773
- const heartbeatWindowKey = `${runId}:${windowStartedAtMs}`;
55775
+ const hasWindowStartedAtMs = windowStartedAtMs !== undefined;
55776
+ const hasWindowSequence = windowSequence !== undefined;
55777
+ if (hasWindowStartedAtMs === hasWindowSequence) {
55778
+ throw new ValidationError("Provide exactly one of windowStartedAtMs or windowSequence");
55779
+ }
55780
+ const heartbeatWindowKey = hasWindowStartedAtMs ? `${runId}:t:${windowStartedAtMs}` : `${runId}:s:${windowSequence}`;
55781
+ const effectiveResumeId = resumeId ?? runId;
55774
55782
  if (TimebackService2.isDuplicateHeartbeatWindow(heartbeatWindowKey)) {
55775
55783
  logger17.debug("Skipping duplicate heartbeat window", {
55776
55784
  gameId,
55777
55785
  studentId,
55778
55786
  runId,
55779
55787
  windowStartedAtMs,
55788
+ windowSequence,
55780
55789
  isFinal
55781
55790
  });
55782
55791
  return { status: "ok" };
@@ -55789,6 +55798,7 @@ var init_timeback_service = __esm(() => {
55789
55798
  studentId,
55790
55799
  runId,
55791
55800
  windowStartedAtMs,
55801
+ windowSequence,
55792
55802
  isFinal
55793
55803
  });
55794
55804
  return inFlightHeartbeat;
@@ -55815,7 +55825,7 @@ var init_timeback_service = __esm(() => {
55815
55825
  courseId: activityData.courseId,
55816
55826
  courseName: activityData.courseName,
55817
55827
  studentEmail: activityData.studentEmail,
55818
- extensions: TimebackService2.addResumeIdToExtensions(undefined, resumeId),
55828
+ extensions: TimebackService2.addResumeIdToExtensions(undefined, effectiveResumeId),
55819
55829
  ...runId ? { runId } : {}
55820
55830
  });
55821
55831
  }
@@ -55826,6 +55836,7 @@ var init_timeback_service = __esm(() => {
55826
55836
  studentId,
55827
55837
  runId,
55828
55838
  windowStartedAtMs,
55839
+ windowSequence,
55829
55840
  activeTimeSeconds,
55830
55841
  isFinal
55831
55842
  });
@@ -120390,7 +120401,7 @@ var init_schemas11 = __esm(() => {
120390
120401
  gameId: exports_external.string().uuid(),
120391
120402
  studentId: exports_external.string().min(1),
120392
120403
  runId: exports_external.string().uuid().optional(),
120393
- resumeId: exports_external.string().uuid(),
120404
+ resumeId: exports_external.string().uuid().optional(),
120394
120405
  activityData: TimebackActivityDataSchema,
120395
120406
  scoreData: exports_external.object({
120396
120407
  correctQuestions: exports_external.number().int().min(0),
@@ -120411,14 +120422,18 @@ var init_schemas11 = __esm(() => {
120411
120422
  gameId: exports_external.string().uuid(),
120412
120423
  studentId: exports_external.string().min(1),
120413
120424
  runId: exports_external.string().uuid(),
120414
- resumeId: exports_external.string().uuid(),
120425
+ resumeId: exports_external.string().uuid().optional(),
120415
120426
  activityData: TimebackActivityDataSchema,
120416
120427
  timingData: exports_external.object({
120417
120428
  activeMs: exports_external.number().nonnegative(),
120418
120429
  pausedMs: exports_external.number().nonnegative()
120419
120430
  }),
120420
- windowStartedAtMs: exports_external.number().int().nonnegative(),
120431
+ windowStartedAtMs: exports_external.number().int().nonnegative().optional(),
120432
+ windowSequence: exports_external.number().int().nonnegative().optional(),
120421
120433
  isFinal: exports_external.boolean().optional()
120434
+ }).refine((value) => value.windowStartedAtMs !== undefined !== (value.windowSequence !== undefined), {
120435
+ message: "Provide exactly one of windowStartedAtMs or windowSequence",
120436
+ path: ["windowStartedAtMs"]
120422
120437
  });
120423
120438
  PopulateStudentRequestSchema = exports_external.object({
120424
120439
  firstName: exports_external.string().min(1).optional(),
@@ -122937,6 +122952,7 @@ var init_timeback_controller = __esm(() => {
122937
122952
  activityData,
122938
122953
  timingData,
122939
122954
  windowStartedAtMs,
122955
+ windowSequence,
122940
122956
  isFinal
122941
122957
  } = body2;
122942
122958
  logger63.debug("Recording heartbeat", {
@@ -122945,6 +122961,7 @@ var init_timeback_controller = __esm(() => {
122945
122961
  runId,
122946
122962
  resumeId,
122947
122963
  windowStartedAtMs,
122964
+ windowSequence,
122948
122965
  activeMs: timingData.activeMs,
122949
122966
  isFinal
122950
122967
  });
@@ -122956,6 +122973,7 @@ var init_timeback_controller = __esm(() => {
122956
122973
  activityData,
122957
122974
  timingData,
122958
122975
  windowStartedAtMs,
122976
+ windowSequence,
122959
122977
  isFinal,
122960
122978
  user: ctx.user
122961
122979
  });
@@ -125931,7 +125949,7 @@ var import_picocolors12 = __toESM(require_picocolors(), 1);
125931
125949
  // package.json
125932
125950
  var package_default2 = {
125933
125951
  name: "@playcademy/vite-plugin",
125934
- version: "0.2.24-beta.7",
125952
+ version: "0.2.24-beta.9",
125935
125953
  type: "module",
125936
125954
  exports: {
125937
125955
  ".": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playcademy/vite-plugin",
3
- "version": "0.2.24-beta.7",
3
+ "version": "0.2.24-beta.9",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {