@condorinst/mobile-bridge 0.23.0 → 0.23.1

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/dev.d.cts CHANGED
@@ -778,6 +778,12 @@ interface Scenario {
778
778
  * fail at `'send_data_log'` anyway.
779
779
  */
780
780
  sessionFailAt?: string;
781
+ /**
782
+ * With `realTime` on, how long a session lasts from its start before it ends
783
+ * anyway (default 180 000 ms — what a real device showed; the app itself
784
+ * does not end it while `realTime` is on).
785
+ */
786
+ realTimeSessionMs?: number;
781
787
  /** Log period of the devices, in seconds (programmable; default 60). */
782
788
  logPeriodS: number;
783
789
  systemStatus: SystemStatusPayload;
package/dist/dev.d.ts CHANGED
@@ -778,6 +778,12 @@ interface Scenario {
778
778
  * fail at `'send_data_log'` anyway.
779
779
  */
780
780
  sessionFailAt?: string;
781
+ /**
782
+ * With `realTime` on, how long a session lasts from its start before it ends
783
+ * anyway (default 180 000 ms — what a real device showed; the app itself
784
+ * does not end it while `realTime` is on).
785
+ */
786
+ realTimeSessionMs?: number;
781
787
  /** Log period of the devices, in seconds (programmable; default 60). */
782
788
  logPeriodS: number;
783
789
  systemStatus: SystemStatusPayload;
package/dist/dev.js CHANGED
@@ -1401,6 +1401,7 @@ function createSimulatedNative(adapter, scenario, hooks = {}) {
1401
1401
  const pendingSync = /* @__PURE__ */ new Set();
1402
1402
  const pendingErase = /* @__PURE__ */ new Set();
1403
1403
  const running = /* @__PURE__ */ new Set();
1404
+ const sessionStart = /* @__PURE__ */ new Map();
1404
1405
  const idOf = (device) => byId && roster.filter((d) => d.serialNo === device.serialNo).length > 1 ? { deviceId: device.deviceId } : {};
1405
1406
  const findDevice = (args) => args.deviceId !== void 0 ? roster.find((d) => d.deviceId === args.deviceId) : roster.find((d) => d.serialNo === args.serialNo);
1406
1407
  const statusForBundle = () => {
@@ -1738,6 +1739,7 @@ function createSimulatedNative(adapter, scenario, hooks = {}) {
1738
1739
  ];
1739
1740
  const failAt = scenario.sessionFailAt ?? (status.internet === false ? "send_data_log" : void 0);
1740
1741
  running.add(id);
1742
+ sessionStart.set(id, now());
1741
1743
  let delay = latency();
1742
1744
  reply("deviceNotification", note("Device connected", null), delay);
1743
1745
  for (const [message, code, stage] of steps) {
@@ -1763,7 +1765,19 @@ function createSimulatedNative(adapter, scenario, hooks = {}) {
1763
1765
  const timer = setTimeout(() => {
1764
1766
  timers.delete(timer);
1765
1767
  running.delete(deviceId);
1766
- if (!realTimeOn.has(deviceId)) setConnected(deviceId, false);
1768
+ if (!realTimeOn.has(deviceId)) {
1769
+ setConnected(deviceId, false);
1770
+ return;
1771
+ }
1772
+ const startedAt2 = sessionStart.get(deviceId) ?? now();
1773
+ const hold = setTimeout(
1774
+ () => {
1775
+ timers.delete(hold);
1776
+ if (connected.get(deviceId) && !running.has(deviceId)) setConnected(deviceId, false);
1777
+ },
1778
+ Math.max(0, startedAt2 + (scenario.realTimeSessionMs ?? 18e4) - now())
1779
+ );
1780
+ timers.add(hold);
1767
1781
  }, delay);
1768
1782
  timers.add(timer);
1769
1783
  }