@go-avro/avro-js 0.0.110 → 0.0.111

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
+ };
@@ -18,6 +18,8 @@ export interface DeviceInfo {
18
18
  /** OS and version, e.g. "iOS 26.1" or "macOS 15". */
19
19
  os?: string;
20
20
  app_version?: string;
21
+ /** Whether the client is on screen (app active / tab visible). */
22
+ foreground?: boolean;
21
23
  }
22
24
  /** A device the user has connected from, as tracked by the server. */
23
25
  export interface Device {
@@ -31,6 +33,8 @@ export interface Device {
31
33
  location_status: LocationServicesStatus;
32
34
  /** Whether the device currently holds a socket. */
33
35
  online: boolean;
36
+ /** Whether the client is on screen; a backgrounded phone stays online for location. */
37
+ foreground: boolean;
34
38
  last_location: Location | null;
35
39
  last_seen: number | null;
36
40
  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.111";
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.111';
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.111",
4
4
  "description": "JS client for Avro backend integration.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",