@tak-ps/cloudtak 13.76.0 → 13.77.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.
@@ -1,6 +1,7 @@
1
1
  import type { ProfileOverlay, ProfileOverlay_Create } from '../types.ts';
2
2
  import type { LayerSpecification, MapLayerMouseEvent } from 'maplibre-gl';
3
3
  import { type DBOverlay } from '../database.ts';
4
+ import { type OverlayTileJSON } from '../stores/modules/tilejson.ts';
4
5
  export default class Overlay {
5
6
  _destroyed: boolean;
6
7
  _internal: boolean;
@@ -37,6 +38,7 @@ export default class Overlay {
37
38
  url?: string;
38
39
  styles: Array<LayerSpecification>;
39
40
  token: string | null;
41
+ tilejson: OverlayTileJSON | null;
40
42
  static create(body: ProfileOverlay | ProfileOverlay_Create, opts?: {
41
43
  internal?: boolean;
42
44
  skipSave?: boolean;
@@ -64,6 +66,12 @@ export default class Overlay {
64
66
  internal?: boolean;
65
67
  });
66
68
  healthy(): boolean;
69
+ isTiled(): boolean;
70
+ private sourceSpec;
71
+ applyTerrain(opts?: {
72
+ ease?: boolean;
73
+ }): void;
74
+ private disableTerrain;
67
75
  hasBounds(): boolean;
68
76
  zoomTo(): Promise<void>;
69
77
  addLayers(before?: string): Promise<void>;
@@ -92,6 +100,7 @@ export default class Overlay {
92
100
  attribution?: string;
93
101
  url?: string;
94
102
  token?: string;
103
+ tilejson?: OverlayTileJSON | null;
95
104
  styles?: Array<LayerSpecification>;
96
105
  }, opts?: {
97
106
  before?: string;
@@ -110,7 +119,6 @@ export default class Overlay {
110
119
  pos?: number;
111
120
  visible?: boolean;
112
121
  opacity?: number;
113
- encoding?: 'mapbox' | 'terrarium' | null;
114
122
  }): Promise<void>;
115
123
  save(): Promise<void>;
116
124
  toDBOverlay(): DBOverlay;
@@ -1,7 +1,6 @@
1
1
  import { type Observable } from 'dexie';
2
2
  import { type DBOverlay } from '../database.ts';
3
3
  import type { paths } from '@cloudtak/api-types';
4
- import type { ProfileOverlay } from '../types.ts';
5
4
  import BaseInterface from './interface.ts';
6
5
  import Overlay from './overlay-class.ts';
7
6
  import type { BaseInterface_ListOptions, BaseInterface_FromOptions } from './interface.ts';
@@ -65,8 +64,8 @@ export default class OverlayManager extends BaseInterface {
65
64
  } ? Overlay_Page : DBOverlay[]>;
66
65
  static from(id: string, opts?: BaseInterface_FromOptions): Promise<DBOverlay | undefined>;
67
66
  static liveFrom(id: string): Observable<DBOverlay | undefined>;
68
- static get(id: string | number): Promise<ProfileOverlay>;
69
- static generate(body: paths['/api/profile/overlay']['post']['requestBody']['content']['application/json']): Promise<ProfileOverlay>;
67
+ static get(id: string | number): Promise<DBOverlay>;
68
+ static generate(body: paths['/api/profile/overlay']['post']['requestBody']['content']['application/json']): Promise<DBOverlay>;
70
69
  static update(id: string, body: paths['/api/profile/overlay/{:overlay}']['patch']['requestBody']['content']['application/json']): Promise<void>;
71
70
  static sync(): Promise<void>;
72
71
  static delete(id: string, opts?: Overlay_DeleteOptions): Promise<void>;
@@ -1,5 +1,16 @@
1
1
  import type { Position } from '@capacitor/geolocation';
2
2
  import type { DevicePermissionContext } from './types.ts';
3
+ /**
4
+ * When set, the native layer POSTs each fix to `url` directly, independent of
5
+ * the WebView - iOS suspends the WebContent process in the background, so
6
+ * bridge-delivered fixes stop flowing while native delivery keeps working.
7
+ */
8
+ export type NativeDeliveryOptions = {
9
+ url: string;
10
+ headers?: Record<string, string>;
11
+ /** Minimum ms between native POSTs (and the Android update interval). */
12
+ minIntervalMs?: number;
13
+ };
3
14
  export declare class GeolocationPermission {
4
15
  private readonly context;
5
16
  constructor(context: DevicePermissionContext);
@@ -7,16 +18,22 @@ export declare class GeolocationPermission {
7
18
  private watchGeneration;
8
19
  private lastLocationTimestamp;
9
20
  private locationCallback;
10
- private static readonly DISTANCE_FILTER_M;
11
21
  private static readonly SEED_TIMEOUT_MS;
12
22
  private static readonly SEED_MAX_AGE_MS;
13
23
  static supportsLocationRequests(): boolean;
14
24
  refreshStatus(): Promise<void>;
25
+ private refreshBackgroundStatus;
15
26
  request(onGranted?: () => void): Promise<void>;
16
27
  initializeSubscription(onGranted?: () => void): Promise<void>;
17
- startWatch(onLocation: (position: Position) => void): Promise<void>;
28
+ startWatch(onLocation: (position: Position) => void, native?: NativeDeliveryOptions): Promise<void>;
18
29
  private seedImmediateFix;
19
30
  stopWatch(): Promise<void>;
20
31
  private startBackgroundWatch;
32
+ /**
33
+ * Point native POST delivery at a rotated auth token. Best-effort: the
34
+ * watch restarts with fresh headers on the next app boot regardless.
35
+ */
36
+ static updateNativeHeaders(headers: Record<string, string>): Promise<void>;
37
+ openNativeSettings(): Promise<void>;
21
38
  private static backgroundLocationToPosition;
22
39
  }
@@ -1,5 +1,5 @@
1
- export type BrowserPermissionState = PermissionState | 'unsupported' | 'unknown';
2
- export type BrowserPermissionType = 'location' | 'notification' | 'orientation' | 'storage' | 'camera' | 'wakeLock' | 'fileSystem';
1
+ export type BrowserPermissionState = PermissionState | 'when_in_use' | 'unsupported' | 'unknown';
2
+ export type BrowserPermissionType = 'location' | 'backgroundLocation' | 'notification' | 'orientation' | 'storage' | 'camera' | 'wakeLock' | 'fileSystem';
3
3
  export type FileSystemAccessHandle = FileSystemHandle & {
4
4
  queryPermission?: (descriptor?: {
5
5
  mode?: 'read' | 'readwrite';
@@ -13,6 +13,7 @@ export type { BrowserPermissionState, BrowserPermissionType } from './device/typ
13
13
  export { CameraPermission } from './device/camera.ts';
14
14
  export { FileSystemPermission } from './device/file-system.ts';
15
15
  export { GeolocationPermission } from './device/geolocation.ts';
16
+ export type { NativeDeliveryOptions } from './device/geolocation.ts';
16
17
  export { BrowserNotificationPermission } from './device/notification.ts';
17
18
  export type { PushNotificationData } from './device/notification.ts';
18
19
  export { OrientationPermission } from './device/orientation.ts';
@@ -27,6 +28,7 @@ export declare const useDeviceStore: import("pinia").SetupStoreDefinition<"devic
27
28
  storage: BrowserPermissionState;
28
29
  orientation: BrowserPermissionState;
29
30
  location: BrowserPermissionState;
31
+ backgroundLocation: BrowserPermissionState;
30
32
  camera: BrowserPermissionState;
31
33
  wakeLock: BrowserPermissionState;
32
34
  fileSystem: BrowserPermissionState;
@@ -7,12 +7,12 @@ import COT from '../base/cot.ts';
7
7
  import RoutingControl from '../lib/routing/main.ts';
8
8
  import type { NavigationState, NavigationDirection } from '../lib/routing/main.ts';
9
9
  import { LocationState } from '../utils/events.ts';
10
+ import Overlay from '../base/overlay-class.ts';
10
11
  import Subscription from '../base/subscription.ts';
11
12
  import * as mapgl from 'maplibre-gl';
12
13
  import type Atlas from '../workers/atlas.ts';
13
14
  import type { Feature } from '../types.ts';
14
15
  import type { LngLat, Point, MapGeoJSONFeature } from 'maplibre-gl';
15
- import type { Position } from '@capacitor/geolocation';
16
16
  export type TAKNotification = {
17
17
  type: string;
18
18
  name: string;
@@ -36,7 +36,6 @@ export declare const useMapStore: import("pinia").StoreDefinition<"cloudtak", {
36
36
  };
37
37
  _overlayReconcile?: Promise<void>;
38
38
  _overlayReconcileQueued?: boolean;
39
- _lastLocationHttpSubmit?: number;
40
39
  channel: BroadcastChannel;
41
40
  toImport: Feature[];
42
41
  locked: Array<string>;
@@ -119,8 +118,8 @@ export declare const useMapStore: import("pinia").StoreDefinition<"cloudtak", {
119
118
  startWorker: () => void;
120
119
  destroy: () => Promise<void>;
121
120
  makeActiveMission: (mission?: Subscription) => Promise<void>;
122
- addTerrain: () => Promise<void>;
123
- removeTerrain: () => void;
121
+ terrainOverlay: () => Overlay | undefined;
122
+ toggleTerrain: () => Promise<void>;
124
123
  returnHome: () => Promise<void>;
125
124
  /**
126
125
  * Trigger a rerender of the underlying GeoJSON Features
@@ -158,7 +157,6 @@ export declare const useMapStore: import("pinia").StoreDefinition<"cloudtak", {
158
157
  */
159
158
  resumeFromBackground: () => Promise<void>;
160
159
  init: (container: HTMLElement) => Promise<void>;
161
- submitLocationHttp: (position: Position) => Promise<void>;
162
160
  initOverlays: () => Promise<void>;
163
161
  /**
164
162
  * Reconcile the loaded map overlays against the local overlay
@@ -0,0 +1,10 @@
1
+ import type { OverlayTileJSON } from '../../types.ts';
2
+ export type { OverlayTileJSON };
3
+ type TileJSONEntry = {
4
+ url: string;
5
+ tilejson: OverlayTileJSON | null;
6
+ };
7
+ export declare function tileJSONSourceUrl(id: number): string;
8
+ export declare function setOverlayTileJSON(id: number, entry: TileJSONEntry): void;
9
+ export declare function clearOverlayTileJSON(id: number): void;
10
+ export declare function registerTileJSONProtocol(): void;
@@ -169,6 +169,7 @@ export type ProfileOverlay = paths["/api/profile/overlay/{:overlay}"]["get"]["re
169
169
  export type ProfileOverlayList = paths["/api/profile/overlay"]["get"]["responses"]["200"]["content"]["application/json"];
170
170
  export type ProfileOverlay_Create = paths["/api/profile/overlay"]["post"]["requestBody"]["content"]["application/json"];
171
171
  export type ProfileOverlay_Update = paths["/api/profile/overlay/{:overlay}"]["patch"]["requestBody"]["content"]["application/json"];
172
+ export type OverlayTileJSON = NonNullable<ProfileOverlay["tilejson"]>;
172
173
  export type ProfileTokenList = paths["/api/profile/token"]["get"]["responses"]["200"]["content"]["application/json"];
173
174
  export type ProfileToken = ProfileTokenList["items"][0];
174
175
  export type ProfilePagingList = paths["/api/profile/paging"]["get"]["responses"]["200"]["content"]["application/json"];
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Append the session token to tile URLs on CloudTAK hosts only - never third
3
+ * party tile servers. String-edited: `URL` percent-encodes `{z}/{x}/{y}`.
4
+ */
5
+ export declare function authorizeTileJSON<T extends {
6
+ tiles: string[];
7
+ }>(tilejson: T, token: string | undefined, hosts: Iterable<string>): T;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tak-ps/cloudtak",
3
3
  "type": "module",
4
- "version": "13.76.0",
4
+ "version": "13.77.1",
5
5
  "types": "dist/types/plugin.d.ts",
6
6
  "files": [
7
7
  "dist/types"