@go-avro/avro-js 0.0.110 → 0.0.112

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
@@ -40,7 +40,8 @@ import './client/hooks/email';
40
40
  export { defaultPassOnFeeMethod } from './billing/fees';
41
41
  export { reverseGeocode } from './geocode';
42
42
  export { fetchCensusFeatures } from './census';
43
- export { LOCATION_STALE_MINUTES, LOCATION_RECENT_HOURS, isLocationRecent, REPORTING_STATUSES, locationAgeMinutes, isLocationStale, isReportingStatus, isMobileDevice, mobileDevices, } from './presence';
43
+ export { LOCATION_STALE_MINUTES, LOCATION_RECENT_HOURS, isLocationRecent, REPORTING_STATUSES, locationAgeMinutes, isLocationStale, isReportingStatus, isMobileDevice, mobileDevices, userPresence, } from './presence';
44
+ export type { UserPresence } from './presence';
44
45
  export type { ReverseGeocodeResult } from './geocode';
45
46
  export * from './types/api';
46
47
  export * from './types/auth';
package/dist/index.js CHANGED
@@ -38,7 +38,7 @@ import './client/hooks/email';
38
38
  export { defaultPassOnFeeMethod } from './billing/fees';
39
39
  export { reverseGeocode } from './geocode';
40
40
  export { fetchCensusFeatures } from './census';
41
- export { LOCATION_STALE_MINUTES, LOCATION_RECENT_HOURS, isLocationRecent, REPORTING_STATUSES, locationAgeMinutes, isLocationStale, isReportingStatus, isMobileDevice, mobileDevices, } from './presence';
41
+ export { LOCATION_STALE_MINUTES, LOCATION_RECENT_HOURS, isLocationRecent, REPORTING_STATUSES, locationAgeMinutes, isLocationStale, isReportingStatus, isMobileDevice, mobileDevices, userPresence, } from './presence';
42
42
  export * from './types/api';
43
43
  export * from './types/auth';
44
44
  export * from './types/cache';
@@ -25,3 +25,9 @@ export declare const isLocationStale: (location: Pick<Location, "time_collected"
25
25
  export declare const LOCATION_RECENT_HOURS = 24;
26
26
  /** True when the fix exists and is newer than `hours` old. */
27
27
  export declare const isLocationRecent: (location: Pick<Location, "time_collected"> | null | undefined, hours?: number, nowMs?: number) => boolean;
28
+ export type UserPresence = 'online' | 'background' | 'offline';
29
+ /**
30
+ * online: some device is connected and on screen; background: connected
31
+ * but nothing on screen (e.g. a phone tracking location); offline: none.
32
+ */
33
+ export declare const userPresence: (devices: Device[] | null | undefined) => UserPresence;
package/dist/presence.js CHANGED
@@ -38,3 +38,13 @@ export const isLocationRecent = (location, hours = LOCATION_RECENT_HOURS, nowMs
38
38
  const age = locationAgeMinutes(location, nowMs);
39
39
  return age !== null && age < hours * 60;
40
40
  };
41
+ /**
42
+ * online: some device is connected and on screen; background: connected
43
+ * but nothing on screen (e.g. a phone tracking location); offline: none.
44
+ */
45
+ export const userPresence = (devices) => {
46
+ const connected = (devices ?? []).filter((d) => d.online);
47
+ if (connected.some((d) => d.foreground))
48
+ return 'online';
49
+ return connected.length > 0 ? 'background' : 'offline';
50
+ };
@@ -6,18 +6,15 @@ export declare const DevicePlatform: {
6
6
  readonly WEB: "web";
7
7
  };
8
8
  export type DevicePlatform = (typeof DevicePlatform)[keyof typeof DevicePlatform];
9
- /** What a client tells the server about the install it is running on. */
10
9
  export interface DeviceInfo {
11
- /** Stable per-install id (identifierForVendor, androidId, stored UUID). */
12
10
  device_key: string;
13
11
  platform: DevicePlatform;
14
- /** User-facing label, e.g. "Chris's iPhone". */
15
12
  name?: string;
16
- /** Hardware, e.g. "iPhone 17" or "ASUS Zenbook". */
17
13
  model?: string;
18
- /** OS and version, e.g. "iOS 26.1" or "macOS 15". */
19
14
  os?: string;
20
15
  app_version?: string;
16
+ foreground?: boolean;
17
+ headless?: boolean;
21
18
  }
22
19
  /** A device the user has connected from, as tracked by the server. */
23
20
  export interface Device {
@@ -29,8 +26,9 @@ export interface Device {
29
26
  os: string | null;
30
27
  app_version: string | null;
31
28
  location_status: LocationServicesStatus;
32
- /** Whether the device currently holds a socket. */
33
29
  online: boolean;
30
+ tracking: boolean;
31
+ foreground: boolean;
34
32
  last_location: Location | null;
35
33
  last_seen: number | null;
36
34
  time_created: number | null;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const AVRO_JS_VERSION = "0.0.110";
1
+ export declare const AVRO_JS_VERSION = "0.0.112";
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // AUTO-GENERATED by scripts/gen-version.js — do not edit by hand.
2
2
  // Regenerated from package.json by the `prebuild` npm hook.
3
- export const AVRO_JS_VERSION = '0.0.110';
3
+ export const AVRO_JS_VERSION = '0.0.112';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-avro/avro-js",
3
- "version": "0.0.110",
3
+ "version": "0.0.112",
4
4
  "description": "JS client for Avro backend integration.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",