@tak-ps/cloudtak 13.53.2 → 13.54.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.
@@ -6,4 +6,4 @@ export declare class TimeoutError extends Error {
6
6
  * not settle in time. The underlying operation is not cancelled; its result
7
7
  * is simply unused if it settles late.
8
8
  */
9
- export declare function withTimeout<T>(promise: Promise<T>, timeoutMs: number, label: string): Promise<T>;
9
+ export declare function withTimeout<T>(promise: Promise<T> | PromiseLike<T>, timeoutMs: number, label: string): Promise<T>;
@@ -4,8 +4,16 @@ export declare function supportsServiceWorker(): boolean;
4
4
  * Subscribe to foreground/background transitions. On native we use Capacitor's
5
5
  * `App.appStateChange` because the web `visibilitychange` API is unreliable
6
6
  * inside an iOS WebView. The handler receives `true` when backgrounded and
7
- * `false` when foregrounded; returns a function that removes the listener.
7
+ * `false` when foregrounded, and is invoked once with the current state so
8
+ * callers registering while already backgrounded (e.g. an iOS background
9
+ * wake) start in sync; returns a function that removes the listener.
8
10
  */
9
11
  export declare function addBackgroundStateListener(handler: (isBackgrounded: boolean) => void): Promise<() => void>;
12
+ /**
13
+ * Resolve once the app is running in the foreground. iOS can relaunch a
14
+ * killed WebView while still backgrounded, with networking and IndexedDB
15
+ * suspended. Resolves immediately on web.
16
+ */
17
+ export declare function whenForegrounded(): Promise<void>;
10
18
  export declare function openExternalUrl(url: string | URL): Promise<void>;
11
19
  export declare function openSecondaryView(url: string | URL): Promise<void>;
@@ -239,5 +239,12 @@ export type DatabaseType = Dexie & {
239
239
  };
240
240
  export declare const db: DatabaseType;
241
241
  export declare function ensureDatabase(): Promise<void>;
242
+ /**
243
+ * Probe the IndexedDB connection with a real read and reopen it if needed.
244
+ * An iOS suspend can invalidate the connection without a close event -
245
+ * db.isOpen() still reports true while every request wedges - so a failed
246
+ * probe forces an explicit close before reopening.
247
+ */
248
+ export declare function recoverDatabase(probeTimeoutMs?: number): Promise<void>;
242
249
  export declare function isTransientDbError(err: unknown): boolean;
243
250
  export declare function withDbRetry<T>(fn: () => Promise<T>, attempts?: number): Promise<T>;
@@ -27,7 +27,7 @@ export declare const useMapStore: import("pinia").StoreDefinition<"cloudtak", {
27
27
  _menu?: unknown;
28
28
  _bottomBar?: unknown;
29
29
  _removeOrientationListener?: () => Promise<void>;
30
- _boundOnVisibilityChange?: () => Promise<void>;
30
+ _resumeRecovery?: Promise<void>;
31
31
  _removeBackgroundStateListener?: () => void;
32
32
  _removePushTokenListener?: () => void;
33
33
  channel: BroadcastChannel;
@@ -126,6 +126,11 @@ export declare const useMapStore: import("pinia").StoreDefinition<"cloudtak", {
126
126
  loadMission: (guid: string, opts?: {
127
127
  reload: boolean;
128
128
  }) => Promise<Subscription | null>;
129
+ /**
130
+ * Recover IndexedDB connections and the TAK WebSocket after the app
131
+ * returns to the foreground.
132
+ */
133
+ resumeFromBackground: () => Promise<void>;
129
134
  init: (container: HTMLElement) => Promise<void>;
130
135
  submitLocationHttp: (position: Position) => Promise<void>;
131
136
  initOverlays: () => Promise<void>;
@@ -15,6 +15,11 @@ export default class Atlas {
15
15
  sync: AtlasSync & Comlink.ProxyMarked;
16
16
  constructor();
17
17
  postMessage(msg: WorkerMessage): Promise<void>;
18
+ /**
19
+ * Called by the main thread on app resume - workers receive no
20
+ * visibility events to recover their own IndexedDB connection.
21
+ */
22
+ recover(): Promise<void>;
18
23
  init(authToken: string): Promise<void>;
19
24
  destroy(): void;
20
25
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tak-ps/cloudtak",
3
3
  "type": "module",
4
- "version": "13.53.2",
4
+ "version": "13.54.1",
5
5
  "types": "dist/types/plugin.d.ts",
6
6
  "files": [
7
7
  "dist/types"