@playcademy/sdk 0.16.1-beta.11 → 0.16.1-beta.12

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.d.ts CHANGED
@@ -1911,6 +1911,15 @@ type EmbedActivity = EmbedActivityCompleted | EmbedActivityAbandoned | EmbedActi
1911
1911
  /** The child called `endActivity()` and its report was relayed. */
1912
1912
  interface EmbedActivityCompleted {
1913
1913
  status: 'completed';
1914
+ /**
1915
+ * The platform run this completion records under. One run ends in at
1916
+ * most one completion (the server dedupes on it), and a resumed launch
1917
+ * keeps the interrupted run's id — so this doubles as the completion's
1918
+ * attempt identity: feed it to whatever consumes the result and drop
1919
+ * anything you have seen before. Absent only for pure UX embeds
1920
+ * (launched without `timeback`), which record nothing.
1921
+ */
1922
+ runId?: string;
1914
1923
  /** Correct answers, from the child's report. */
1915
1924
  correct: number;
1916
1925
  /** Total questions, from the child's report. */
@@ -1939,6 +1948,12 @@ interface EmbedActivityCompleted {
1939
1948
  */
1940
1949
  interface EmbedActivityAbandoned {
1941
1950
  status: 'abandoned';
1951
+ /**
1952
+ * The platform run the launch was recording under, when one had
1953
+ * opened. Absent when the child never started an activity or the
1954
+ * launch was a pure UX embed.
1955
+ */
1956
+ runId?: string;
1942
1957
  timing: EmbedSessionTiming;
1943
1958
  /**
1944
1959
  * The final resume envelope, when the child checkpointed during the
@@ -1960,6 +1975,13 @@ interface EmbedActivityFailed {
1960
1975
  interface EmbedSession {
1961
1976
  /** The mounted child iframe. Useful for focus management. */
1962
1977
  readonly iframe: HTMLIFrameElement;
1978
+ /**
1979
+ * The platform run this launch records under, or null before the run
1980
+ * opens (the child's first activity) and for pure UX embeds. Stable
1981
+ * once set; also echoed on the finished record, which is where most
1982
+ * callers should read it.
1983
+ */
1984
+ readonly runId: string | null;
1963
1985
  /**
1964
1986
  * The latest resume envelope, live during play; null until the child
1965
1987
  * first checkpoints. Read it on your own cadence to persist
package/dist/index.js CHANGED
@@ -1119,6 +1119,9 @@ class ChildSession {
1119
1119
  this.#abandon();
1120
1120
  this.#teardown();
1121
1121
  }
1122
+ get runId() {
1123
+ return this.#parentRunId;
1124
+ }
1122
1125
  get checkpoint() {
1123
1126
  if (!this.#hasCheckpoint) {
1124
1127
  return null;
@@ -1227,6 +1230,9 @@ class ChildSession {
1227
1230
  status: "abandoned",
1228
1231
  timing: this.#relayedTiming()
1229
1232
  };
1233
+ if (this.#parentRunId) {
1234
+ activity.runId = this.#parentRunId;
1235
+ }
1230
1236
  const resume = this.checkpoint;
1231
1237
  if (resume) {
1232
1238
  activity.resume = resume;
@@ -1251,9 +1257,11 @@ class ChildSession {
1251
1257
  }
1252
1258
  this.#settled = true;
1253
1259
  this.#clearResume();
1260
+ this.#ensureBridgeRun();
1254
1261
  let endMemo = null;
1255
1262
  this.#resolveFinished({
1256
1263
  status: "completed",
1264
+ runId: this.#parentRunId ?? undefined,
1257
1265
  correct: childReport.scoreData.correctQuestions,
1258
1266
  total: childReport.scoreData.totalQuestions,
1259
1267
  timing: this.#completedTiming(childReport),
@@ -3476,7 +3484,7 @@ async function request({
3476
3484
  return rawText && rawText.length > 0 ? rawText : undefined;
3477
3485
  }
3478
3486
  // src/version.ts
3479
- var SDK_VERSION = "0.16.1-beta.11";
3487
+ var SDK_VERSION = "0.16.1-beta.12";
3480
3488
 
3481
3489
  // src/clients/base.ts
3482
3490
  class PlaycademyBaseClient {
@@ -2977,6 +2977,15 @@ type EmbedActivity = EmbedActivityCompleted | EmbedActivityAbandoned | EmbedActi
2977
2977
  /** The child called `endActivity()` and its report was relayed. */
2978
2978
  interface EmbedActivityCompleted {
2979
2979
  status: 'completed';
2980
+ /**
2981
+ * The platform run this completion records under. One run ends in at
2982
+ * most one completion (the server dedupes on it), and a resumed launch
2983
+ * keeps the interrupted run's id — so this doubles as the completion's
2984
+ * attempt identity: feed it to whatever consumes the result and drop
2985
+ * anything you have seen before. Absent only for pure UX embeds
2986
+ * (launched without `timeback`), which record nothing.
2987
+ */
2988
+ runId?: string;
2980
2989
  /** Correct answers, from the child's report. */
2981
2990
  correct: number;
2982
2991
  /** Total questions, from the child's report. */
@@ -3005,6 +3014,12 @@ interface EmbedActivityCompleted {
3005
3014
  */
3006
3015
  interface EmbedActivityAbandoned {
3007
3016
  status: 'abandoned';
3017
+ /**
3018
+ * The platform run the launch was recording under, when one had
3019
+ * opened. Absent when the child never started an activity or the
3020
+ * launch was a pure UX embed.
3021
+ */
3022
+ runId?: string;
3008
3023
  timing: EmbedSessionTiming;
3009
3024
  /**
3010
3025
  * The final resume envelope, when the child checkpointed during the
@@ -3026,6 +3041,13 @@ interface EmbedActivityFailed {
3026
3041
  interface EmbedSession {
3027
3042
  /** The mounted child iframe. Useful for focus management. */
3028
3043
  readonly iframe: HTMLIFrameElement;
3044
+ /**
3045
+ * The platform run this launch records under, or null before the run
3046
+ * opens (the child's first activity) and for pure UX embeds. Stable
3047
+ * once set; also echoed on the finished record, which is where most
3048
+ * callers should read it.
3049
+ */
3050
+ readonly runId: string | null;
3029
3051
  /**
3030
3052
  * The latest resume envelope, live during play; null until the child
3031
3053
  * first checkpoints. Read it on your own cadence to persist
package/dist/internal.js CHANGED
@@ -1119,6 +1119,9 @@ class ChildSession {
1119
1119
  this.#abandon();
1120
1120
  this.#teardown();
1121
1121
  }
1122
+ get runId() {
1123
+ return this.#parentRunId;
1124
+ }
1122
1125
  get checkpoint() {
1123
1126
  if (!this.#hasCheckpoint) {
1124
1127
  return null;
@@ -1227,6 +1230,9 @@ class ChildSession {
1227
1230
  status: "abandoned",
1228
1231
  timing: this.#relayedTiming()
1229
1232
  };
1233
+ if (this.#parentRunId) {
1234
+ activity.runId = this.#parentRunId;
1235
+ }
1230
1236
  const resume = this.checkpoint;
1231
1237
  if (resume) {
1232
1238
  activity.resume = resume;
@@ -1251,9 +1257,11 @@ class ChildSession {
1251
1257
  }
1252
1258
  this.#settled = true;
1253
1259
  this.#clearResume();
1260
+ this.#ensureBridgeRun();
1254
1261
  let endMemo = null;
1255
1262
  this.#resolveFinished({
1256
1263
  status: "completed",
1264
+ runId: this.#parentRunId ?? undefined,
1257
1265
  correct: childReport.scoreData.correctQuestions,
1258
1266
  total: childReport.scoreData.totalQuestions,
1259
1267
  timing: this.#completedTiming(childReport),
@@ -4352,7 +4360,7 @@ async function request({
4352
4360
  return rawText && rawText.length > 0 ? rawText : undefined;
4353
4361
  }
4354
4362
  // src/version.ts
4355
- var SDK_VERSION = "0.16.1-beta.11";
4363
+ var SDK_VERSION = "0.16.1-beta.12";
4356
4364
 
4357
4365
  // src/clients/base.ts
4358
4366
  class PlaycademyBaseClient {
@@ -313,7 +313,7 @@ function extractApiErrorInfo(error) {
313
313
  }
314
314
 
315
315
  // src/version.ts
316
- var SDK_VERSION = "0.16.1-beta.11";
316
+ var SDK_VERSION = "0.16.1-beta.12";
317
317
 
318
318
  // src/server/request.ts
319
319
  async function makeApiRequest(opts) {
package/dist/server.js CHANGED
@@ -502,7 +502,7 @@ function extractApiErrorInfo(error) {
502
502
  }
503
503
 
504
504
  // src/version.ts
505
- var SDK_VERSION = "0.16.1-beta.11";
505
+ var SDK_VERSION = "0.16.1-beta.12";
506
506
 
507
507
  // src/server/request.ts
508
508
  async function makeApiRequest(opts) {
package/dist/types.d.ts CHANGED
@@ -2340,6 +2340,15 @@ type EmbedActivity = EmbedActivityCompleted | EmbedActivityAbandoned | EmbedActi
2340
2340
  /** The child called `endActivity()` and its report was relayed. */
2341
2341
  interface EmbedActivityCompleted {
2342
2342
  status: 'completed';
2343
+ /**
2344
+ * The platform run this completion records under. One run ends in at
2345
+ * most one completion (the server dedupes on it), and a resumed launch
2346
+ * keeps the interrupted run's id — so this doubles as the completion's
2347
+ * attempt identity: feed it to whatever consumes the result and drop
2348
+ * anything you have seen before. Absent only for pure UX embeds
2349
+ * (launched without `timeback`), which record nothing.
2350
+ */
2351
+ runId?: string;
2343
2352
  /** Correct answers, from the child's report. */
2344
2353
  correct: number;
2345
2354
  /** Total questions, from the child's report. */
@@ -2368,6 +2377,12 @@ interface EmbedActivityCompleted {
2368
2377
  */
2369
2378
  interface EmbedActivityAbandoned {
2370
2379
  status: 'abandoned';
2380
+ /**
2381
+ * The platform run the launch was recording under, when one had
2382
+ * opened. Absent when the child never started an activity or the
2383
+ * launch was a pure UX embed.
2384
+ */
2385
+ runId?: string;
2371
2386
  timing: EmbedSessionTiming;
2372
2387
  /**
2373
2388
  * The final resume envelope, when the child checkpointed during the
@@ -2389,6 +2404,13 @@ interface EmbedActivityFailed {
2389
2404
  interface EmbedSession {
2390
2405
  /** The mounted child iframe. Useful for focus management. */
2391
2406
  readonly iframe: HTMLIFrameElement;
2407
+ /**
2408
+ * The platform run this launch records under, or null before the run
2409
+ * opens (the child's first activity) and for pure UX embeds. Stable
2410
+ * once set; also echoed on the finished record, which is where most
2411
+ * callers should read it.
2412
+ */
2413
+ readonly runId: string | null;
2392
2414
  /**
2393
2415
  * The latest resume envelope, live during play; null until the child
2394
2416
  * first checkpoints. Read it on your own cadence to persist
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@playcademy/sdk",
3
- "version": "0.16.1-beta.11",
3
+ "version": "0.16.1-beta.12",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {