@playcademy/sdk 0.9.1-beta.1 → 0.9.1-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/README.md +5 -2
- package/dist/index.d.ts +364 -359
- package/dist/index.js +12 -2
- package/dist/internal.d.ts +5506 -5454
- package/dist/internal.js +16 -3
- package/dist/types.d.ts +1182 -1177
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1953,17 +1953,21 @@ function createTimebackActivityTracker(client) {
|
|
|
1953
1953
|
}
|
|
1954
1954
|
}
|
|
1955
1955
|
return {
|
|
1956
|
+
currentRunId() {
|
|
1957
|
+
return currentActivity?.runId;
|
|
1958
|
+
},
|
|
1956
1959
|
startActivity(metadata, options) {
|
|
1957
1960
|
if (options?.runId !== undefined && !isValidUUID(options.runId)) {
|
|
1958
1961
|
throw new Error(`startActivity: \`runId\` must be a UUID (received \`${JSON.stringify(options.runId)}\`). Use crypto.randomUUID() or persist a previously-generated UUID.`);
|
|
1959
1962
|
}
|
|
1960
1963
|
cleanupListeners();
|
|
1961
1964
|
const now = Date.now();
|
|
1965
|
+
const runId = options?.runId ?? crypto.randomUUID();
|
|
1962
1966
|
const heartbeatIntervalMs = normalizeDelayMs(options?.heartbeatIntervalMs, DEFAULT_HEARTBEAT_INTERVAL_MS, false);
|
|
1963
1967
|
const pausedHeartbeatTimeoutMs = normalizeDelayMs(options?.pausedHeartbeatTimeoutMs ?? options?.hiddenTimeoutMs, DEFAULT_PAUSED_HEARTBEAT_TIMEOUT_MS, false);
|
|
1964
1968
|
const inactivityTimeoutMs = normalizeDelayMs(options?.inactivityTimeoutMs, DEFAULT_INACTIVITY_TIMEOUT_MS, false);
|
|
1965
1969
|
currentActivity = {
|
|
1966
|
-
runId
|
|
1970
|
+
runId,
|
|
1967
1971
|
resumeId: crypto.randomUUID(),
|
|
1968
1972
|
startTime: now,
|
|
1969
1973
|
metadata,
|
|
@@ -2006,6 +2010,7 @@ function createTimebackActivityTracker(client) {
|
|
|
2006
2010
|
messaging.listen("PLAYCADEMY_PAUSE" /* PAUSE */, boundShellPauseHandler);
|
|
2007
2011
|
messaging.listen("PLAYCADEMY_RESUME" /* RESUME */, boundShellResumeHandler);
|
|
2008
2012
|
syncInactivityTracking();
|
|
2013
|
+
return { runId };
|
|
2009
2014
|
},
|
|
2010
2015
|
pauseActivity() {
|
|
2011
2016
|
if (!currentActivity) {
|
|
@@ -2189,6 +2194,7 @@ function createTimebackEngine(client) {
|
|
|
2189
2194
|
}
|
|
2190
2195
|
},
|
|
2191
2196
|
activity: {
|
|
2197
|
+
currentRunId: activityTracker.currentRunId,
|
|
2192
2198
|
start: activityTracker.startActivity,
|
|
2193
2199
|
pause: activityTracker.pauseActivity,
|
|
2194
2200
|
resume: activityTracker.resumeActivity,
|
|
@@ -2249,9 +2255,13 @@ function createTimebackNamespace(client) {
|
|
|
2249
2255
|
}
|
|
2250
2256
|
};
|
|
2251
2257
|
},
|
|
2258
|
+
get currentRunId() {
|
|
2259
|
+
assertPlatformMode(client, "timeback.currentRunId");
|
|
2260
|
+
return engine.activity.currentRunId();
|
|
2261
|
+
},
|
|
2252
2262
|
startActivity: (metadata, options) => {
|
|
2253
2263
|
assertPlatformMode(client, "timeback.startActivity()");
|
|
2254
|
-
engine.activity.start(metadata, options);
|
|
2264
|
+
return engine.activity.start(metadata, options);
|
|
2255
2265
|
},
|
|
2256
2266
|
pauseActivity: () => {
|
|
2257
2267
|
assertPlatformMode(client, "timeback.pauseActivity()");
|