@wayq/beekon-rn 0.0.3 → 0.0.5

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.
Files changed (77) hide show
  1. package/BeekonRn.podspec +1 -1
  2. package/README.md +91 -39
  3. package/android/build.gradle +9 -4
  4. package/android/src/main/java/in/wayq/beekonrn/BeekonRnModule.kt +306 -60
  5. package/ios/BeekonRn.mm +90 -24
  6. package/ios/BeekonRn.swift +360 -60
  7. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/BeekonKit +0 -0
  8. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/Info.plist +0 -0
  9. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios.abi.json +7521 -1312
  10. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  11. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios.swiftinterface +191 -40
  12. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/BeekonKit +0 -0
  13. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Info.plist +0 -0
  14. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios-simulator.abi.json +7521 -1312
  15. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  16. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +191 -40
  17. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/x86_64-apple-ios-simulator.abi.json +7521 -1312
  18. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  19. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +191 -40
  20. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/_CodeSignature/CodeResources +2 -80
  21. package/lib/module/NativeBeekonRn.js +22 -7
  22. package/lib/module/NativeBeekonRn.js.map +1 -1
  23. package/lib/module/beekon.js +198 -46
  24. package/lib/module/beekon.js.map +1 -1
  25. package/lib/module/index.js.map +1 -1
  26. package/lib/module/internal/mappers.js +122 -28
  27. package/lib/module/internal/mappers.js.map +1 -1
  28. package/lib/module/types/config.js +2 -0
  29. package/lib/module/types/enums.js +2 -0
  30. package/lib/module/types/enums.js.map +1 -0
  31. package/lib/module/types/error.js +10 -4
  32. package/lib/module/types/error.js.map +1 -1
  33. package/lib/module/types/geofence.js +2 -0
  34. package/lib/module/types/geofence.js.map +1 -0
  35. package/lib/module/types/location.js +2 -0
  36. package/lib/module/types/sync.js +2 -0
  37. package/lib/module/types/sync.js.map +1 -0
  38. package/lib/typescript/src/NativeBeekonRn.d.ts +102 -20
  39. package/lib/typescript/src/NativeBeekonRn.d.ts.map +1 -1
  40. package/lib/typescript/src/beekon.d.ts +81 -33
  41. package/lib/typescript/src/beekon.d.ts.map +1 -1
  42. package/lib/typescript/src/index.d.ts +5 -2
  43. package/lib/typescript/src/index.d.ts.map +1 -1
  44. package/lib/typescript/src/internal/mappers.d.ts +12 -6
  45. package/lib/typescript/src/internal/mappers.d.ts.map +1 -1
  46. package/lib/typescript/src/types/config.d.ts +50 -20
  47. package/lib/typescript/src/types/config.d.ts.map +1 -1
  48. package/lib/typescript/src/types/enums.d.ts +48 -0
  49. package/lib/typescript/src/types/enums.d.ts.map +1 -0
  50. package/lib/typescript/src/types/error.d.ts +11 -5
  51. package/lib/typescript/src/types/error.d.ts.map +1 -1
  52. package/lib/typescript/src/types/geofence.d.ts +36 -0
  53. package/lib/typescript/src/types/geofence.d.ts.map +1 -0
  54. package/lib/typescript/src/types/location.d.ts +22 -8
  55. package/lib/typescript/src/types/location.d.ts.map +1 -1
  56. package/lib/typescript/src/types/state.d.ts +13 -4
  57. package/lib/typescript/src/types/state.d.ts.map +1 -1
  58. package/lib/typescript/src/types/sync.d.ts +27 -0
  59. package/lib/typescript/src/types/sync.d.ts.map +1 -0
  60. package/package.json +4 -5
  61. package/scripts/fetch-beekonkit.sh +5 -5
  62. package/src/NativeBeekonRn.ts +110 -20
  63. package/src/beekon.ts +219 -49
  64. package/src/index.tsx +21 -2
  65. package/src/internal/mappers.ts +187 -30
  66. package/src/types/config.ts +52 -20
  67. package/src/types/enums.ts +64 -0
  68. package/src/types/error.ts +11 -8
  69. package/src/types/geofence.ts +37 -0
  70. package/src/types/location.ts +28 -8
  71. package/src/types/state.ts +13 -3
  72. package/src/types/sync.ts +23 -0
  73. package/ios/Frameworks/BeekonKit.xcframework/_CodeSignature/CodeDirectory +0 -0
  74. package/ios/Frameworks/BeekonKit.xcframework/_CodeSignature/CodeRequirements +0 -0
  75. package/ios/Frameworks/BeekonKit.xcframework/_CodeSignature/CodeResources +0 -296
  76. package/ios/Frameworks/BeekonKit.xcframework/_CodeSignature/CodeSignature +0 -0
  77. package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/_CodeSignature/CodeResources +0 -146
@@ -1,53 +1,135 @@
1
1
  /**
2
- * Codegen TurboModule spec — DO NOT export Wire* types from `src/index.tsx`.
3
- * The public TS API in `src/beekon.ts` and `src/types/` is what consumers use;
4
- * mappers in `src/internal/mappers.ts` convert between the two.
2
+ * Codegen TurboModule spec — the single source React Native's Codegen reads to
3
+ * generate the native interface. **DO NOT export Wire* types from
4
+ * `src/index.tsx`.** The public TS API in `src/beekon.ts` and `src/types/` is
5
+ * what consumers use; mappers in `src/internal/mappers.ts` convert between the
6
+ * two.
5
7
  *
6
- * Wire types are flat (primitives + nested flat objects) because Codegen's
7
- * TS-to-Kotlin/ObjC type derivation has limited support for unions and
8
- * recursive structures. The state variants are encoded as a `type`
9
- * discriminator string with sibling fields nullable per variant.
8
+ * Wire types are deliberately **flat** (primitives + flat nested objects +
9
+ * arrays) because Codegen's TSKotlin/ObjC derivation has no support for unions
10
+ * or recursive structures:
11
+ *
12
+ * - **Enums travel as plain `string`** (e.g. `accuracyMode`, `quality`); the
13
+ * mappers translate to/from the public string-literal unions with a defensive
14
+ * fallback, so an unknown value never crashes a subscriber.
15
+ * - **Sum types** (`WireState`, `WireSyncStatus`) are a `type` discriminator
16
+ * string plus sibling fields nullable per variant.
17
+ * - **String maps** (`headers`, `extras`) travel as `WireKeyValue[]` pairs —
18
+ * Codegen has no portable dictionary type.
19
+ * - **Timestamps** are epoch-milliseconds; intervals are seconds.
10
20
  */
11
21
  import type { CodegenTypes, TurboModule } from 'react-native';
12
- export type WireAndroidNotification = {
22
+ /** A single string map entry — see `headers` / `setExtras`. */
23
+ export type WireKeyValue = {
24
+ key: string;
25
+ value: string;
26
+ };
27
+ export type WireSyncConfig = {
28
+ url: string;
29
+ headers: WireKeyValue[];
30
+ intervalSeconds: number;
31
+ batchSize: number;
32
+ };
33
+ /** Android-only foreground-service notification overrides. iOS ignores it. */
34
+ export type WireNotificationConfig = {
13
35
  title?: string;
14
36
  text?: string;
15
- smallIconResName?: string;
16
37
  };
17
38
  export type WireConfig = {
18
- /** Required at the wire level — the TS facade applies defaults (30 / 100). */
19
- intervalSeconds: number;
20
- /** Required at the wire level — the TS facade applies defaults (30 / 100). */
21
- distanceMeters: number;
22
- /** Android-only. iOS native module ignores. */
23
- androidNotification?: WireAndroidNotification;
39
+ /** All fields required at the wire level — the TS facade applies defaults. */
40
+ minTimeBetweenLocationsSeconds: number;
41
+ minDistanceBetweenLocationsMeters: number;
42
+ /** One of: 'high' | 'balanced' | 'low'. */
43
+ accuracyMode: string;
44
+ /** One of: 'keepTracking' | 'pause' | 'pauseWithCheckIns'. */
45
+ whenStationary: string;
46
+ stationaryRadiusMeters: number;
47
+ detectActivity: boolean;
48
+ /** Omitted keeps tracking local-only. */
49
+ sync?: WireSyncConfig;
50
+ /** Android-only; the iOS native module ignores it. */
51
+ notification?: WireNotificationConfig;
24
52
  };
25
53
  export type WireLocation = {
54
+ id: string;
26
55
  lat: number;
27
56
  lng: number;
28
57
  timestampMs: number;
29
- /** `null` when the OS did not report a value (e.g. low-confidence fix). */
58
+ /** `null` when the OS did not report a value. */
30
59
  accuracy: number | null;
31
60
  speed: number | null;
32
61
  bearing: number | null;
33
62
  altitude: number | null;
63
+ /** One of: 'ok' | 'lowAccuracy' | 'implausibleSpeed'. */
64
+ quality: string;
65
+ /** One of: 'interval' | 'motion' | 'checkIn' | 'geofence' | 'manual'. */
66
+ trigger: string;
67
+ /** One of: 'moving' | 'stationary' | 'unknown'. */
68
+ motion: string;
69
+ /** Activity enum string, or `null` unless activity detection is enabled. */
70
+ activity: string | null;
71
+ isMock: boolean;
72
+ };
73
+ export type WireGeofence = {
74
+ id: string;
75
+ lat: number;
76
+ lng: number;
77
+ radiusMeters: number;
78
+ notifyOnEntry: boolean;
79
+ notifyOnExit: boolean;
80
+ };
81
+ export type WireGeofenceEvent = {
82
+ id: string;
83
+ geofenceId: string;
84
+ /** One of: 'enter' | 'exit'. */
85
+ type: string;
86
+ timestampMs: number;
34
87
  };
35
88
  export type WireState = {
36
89
  /** One of: 'idle' | 'tracking' | 'stopped'. */
37
90
  type: string;
38
91
  /**
39
- * Only populated when `type === 'stopped'`. One of:
40
- * 'user' | 'permissionDenied' | 'locationServicesDisabled' | 'system'.
92
+ * Only populated when `type === 'stopped'`. One of: 'user' |
93
+ * 'permissionDenied' | 'locationServicesDisabled' | 'locationUnavailable' |
94
+ * 'system'.
41
95
  */
42
96
  stopReason?: string;
43
97
  };
98
+ export type WireSyncStatus = {
99
+ /** One of: 'idle' | 'pending' | 'failed'. */
100
+ type: string;
101
+ /** Only populated when `type === 'failed'`. One of: 'auth' | 'rejected'. */
102
+ failure?: string;
103
+ };
44
104
  export interface Spec extends TurboModule {
45
- configure(config: WireConfig): Promise<void>;
105
+ /**
106
+ * The config crosses as an untyped object (`ReadableMap` on Android,
107
+ * `NSDictionary` on iOS) and is parsed natively. Typing it as the nested
108
+ * {@link WireConfig} struct would force the iOS ObjC++ layer to walk Codegen's
109
+ * generated C++ structs; the facade still builds a `WireConfig`-shaped value
110
+ * via `configToWire`, so the shape is enforced upstream.
111
+ */
112
+ configure(config: CodegenTypes.UnsafeObject): Promise<void>;
46
113
  start(): Promise<void>;
47
114
  stop(): Promise<void>;
48
- history(fromMs: number, toMs: number): Promise<WireLocation[]>;
115
+ resumeIfNeeded(): Promise<void>;
116
+ getLocations(fromMs: number, toMs: number): Promise<WireLocation[]>;
117
+ /**
118
+ * A negative `beforeMs` deletes all stored locations (the wire encoding of
119
+ * the public `deleteLocations()` no-argument case). A plain `number` is used
120
+ * rather than `number | null` for portable Codegen support across platforms.
121
+ */
122
+ deleteLocations(beforeMs: number): Promise<number>;
123
+ pendingUploadCount(): Promise<number>;
124
+ sync(): Promise<void>;
125
+ setExtras(entries: WireKeyValue[]): Promise<void>;
126
+ addGeofences(geofences: WireGeofence[]): Promise<void>;
127
+ removeGeofences(ids: string[]): Promise<void>;
128
+ listGeofences(): Promise<WireGeofence[]>;
49
129
  readonly onState: CodegenTypes.EventEmitter<WireState>;
50
130
  readonly onLocation: CodegenTypes.EventEmitter<WireLocation>;
131
+ readonly onGeofenceEvent: CodegenTypes.EventEmitter<WireGeofenceEvent>;
132
+ readonly onSyncStatus: CodegenTypes.EventEmitter<WireSyncStatus>;
51
133
  }
52
134
  declare const _default: Spec;
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eekonConfig } from './types/config';
2
- import type { BeekonState } from './types/state';
2
+ import type { BeekonGeofence, GeofenceEvent } from './types/geofence';
3
3
  import type { Location } from './types/location';
4
+ import type { BeekonState } from './types/state';
5
+ import type { SyncStatus } from './types/sync';
4
6
  /**
5
- * Public facade for the Beekon SDK. Mirrors the native APIs:
7
+ * Public facade for the Beekon SDK a 1:1 mirror of the native APIs:
6
8
  *
7
9
  * - Android: `in.wayq.beekon.Beekon` (object)
8
10
  * - iOS: `BeekonKit.Beekon.shared` (actor)
9
11
  *
10
- * Lifecycle: `configure(config)` `start()` ... `stop()` (idempotent).
11
- * Subscribe to `onState` / `onLocation` for live updates; query
12
- * `history(from, to)` for persisted fixes.
12
+ * There is **no `initialize()`** the native SDKs auto-initialize. Lifecycle:
13
+ * `configure(config)` (optional; defaults 30s / 100m) → `start()`
14
+ * `stop()`. `start()` / `stop()` **never throw** — `onState` is the single
15
+ * source of truth for whether tracking is active and why it stopped.
13
16
  *
14
- * **Threading:** Methods are safe to call from any JS context. Subscribers'
17
+ * **Threading:** methods are safe to call from any JS context; subscriber
15
18
  * callbacks fire on the JS thread.
16
19
  *
17
- * **Persistence invariant:** the SDK persists every gated fix natively; JS is
18
- * a passive observer. In background, the JS engine is not guaranteed to be
19
- * alive — for past fixes, use `history()`.
20
+ * **Persistence invariant:** the SDK persists every gated fix natively; JS is a
21
+ * passive observer that is not guaranteed to be alive in the background. For
22
+ * past fixes use `getLocations()`.
20
23
  */
21
24
  declare class BeekonImpl {
25
+ private readonly hub;
22
26
  /**
23
27
  * Set tracking parameters. Optional — `start()` falls back to the previously
24
- * persisted config or the SDK default (30s / 100m) if never configured.
25
- *
26
- * While tracking, the new gate values take effect on the next admitted fix
27
- * without restarting the underlying location subscription.
28
+ * persisted config, or the SDK defaults if never configured. While tracking,
29
+ * gate thresholds take effect on the next admitted fix without restarting the
30
+ * location subscription; `accuracyMode` applies on the next `start()`.
28
31
  */
29
32
  configure(config: BeekonConfig): Promise<void>;
30
33
  /**
31
- * Begin tracking. State transitions to `tracking`.
32
- *
33
- * Throws a `BeekonError` with kind:
34
- * - `'permissionDenied'` — location permission not granted.
35
- * - `'locationServicesDisabled'` — system location services off (or GMS
36
- * unavailable on Android).
34
+ * Begin tracking. Never throws observe `onState` for the outcome
35
+ * (`stopped(reason)` on a permission / services / system problem). Beekon
36
+ * ships no permission API: request permissions in the host app, then observe
37
+ * `onState`.
37
38
  */
38
39
  start(): Promise<void>;
39
- /** Stop tracking. Idempotent. State transitions to `stopped(user)`. */
40
+ /** Stop tracking. Idempotent. Registered geofences keep firing. */
40
41
  stop(): Promise<void>;
41
42
  /**
42
- * Read persisted fixes in the time range [from, to]. Returns fixes in
43
- * chronological order. Reads come from the SDK's local storage (Room on
44
- * Android, GRDB on iOS) — the source of truth even when JS was asleep.
43
+ * Resume tracking if a session was active before the app was terminated. A
44
+ * no-op if the user explicitly stopped. Call early in app startup.
45
45
  *
46
- * Retention: fixes older than 7 days OR beyond the most recent 100K are
47
- * pruned automatically.
46
+ * Note: on a background relaunch the JS engine may not be running, so true
47
+ * cold-launch resume also requires native host wiring (Android: call
48
+ * `Beekon.start()` from `Application.onCreate`; iOS: `registerBackgroundTasks`
49
+ * in the AppDelegate). See the README.
50
+ */
51
+ resumeIfNeeded(): Promise<void>;
52
+ /**
53
+ * Read persisted fixes in the inclusive range `[from, to]`, oldest first.
54
+ * Reads come from the SDK's local storage (Room on Android, GRDB on iOS) — the
55
+ * source of truth even when JS was asleep. With sync enabled, rows are deleted
56
+ * locally once the server accepts them, so this returns only un-uploaded fixes.
48
57
  *
49
- * Throws `BeekonError` with kind `'storageFailure'` on database read failure.
58
+ * Throws `BeekonError` with kind `'storage'` on a database read failure.
59
+ */
60
+ getLocations(from: Date, to: Date): Promise<Location[]>;
61
+ /**
62
+ * Delete stored locations captured at or before `before` (all of them when
63
+ * `before` is omitted). Returns the number of rows removed. Throws
64
+ * `BeekonError` with kind `'storage'` on a failure.
65
+ */
66
+ deleteLocations(before?: Date): Promise<number>;
67
+ /**
68
+ * The number of stored locations not yet uploaded. Throws `BeekonError` with
69
+ * kind `'storage'` on a failure.
70
+ */
71
+ pendingUploadCount(): Promise<number>;
72
+ /**
73
+ * Request an immediate upload. Best-effort and self-retrying; a no-op when
74
+ * sync is not configured.
75
+ */
76
+ sync(): Promise<void>;
77
+ /** Set custom key/value fields (e.g. `user_id`) included with every upload. */
78
+ setExtras(extras: Record<string, string>): Promise<void>;
79
+ /**
80
+ * Register geofences. Re-adding an `id` replaces the existing one. Throws
81
+ * `BeekonError` with kind `'invalidGeofence'` if any entry fails validation —
82
+ * none are added when one is invalid.
50
83
  */
51
- history(from: Date, to: Date): Promise<Location[]>;
84
+ addGeofences(geofences: BeekonGeofence[]): Promise<void>;
85
+ /** Unregister geofences by id. Unknown ids are ignored. */
86
+ removeGeofences(ids: string[]): Promise<void>;
87
+ /** The currently registered geofences. */
88
+ listGeofences(): Promise<BeekonGeofence[]>;
52
89
  /**
53
- * Subscribe to state transitions. Returns an unsubscribe function. The
54
- * current state is delivered to new subscribers immediately (replay-1
55
- * semantics, matching the native `state` flow / AsyncStream).
90
+ * Subscribe to tracking-state transitions (`idle` / `tracking` /
91
+ * `stopped(reason)`). The current state is delivered to new subscribers
92
+ * immediately (replay-1). Returns an unsubscribe function.
56
93
  */
57
94
  onState(cb: (s: BeekonState) => void): () => void;
58
95
  /**
59
- * Subscribe to gated locations as they arrive. Returns an unsubscribe
60
- * function. Broadcast (no replay) only delivers while the JS engine is
61
- * alive. For fixes emitted while JS was asleep, use `history()`.
96
+ * Subscribe to gated locations as they arrive. Broadcast (no replay) — only
97
+ * delivers while the JS engine is alive. For fixes emitted while JS was
98
+ * asleep, use `getLocations()`. Returns an unsubscribe function.
62
99
  */
63
100
  onLocation(cb: (l: Location) => void): () => void;
101
+ /**
102
+ * Subscribe to geofence enter / exit crossings. Broadcast (no replay).
103
+ * Returns an unsubscribe function.
104
+ */
105
+ onGeofenceEvent(cb: (e: GeofenceEvent) => void): () => void;
106
+ /**
107
+ * Subscribe to upload health (`idle` / `pending` / `failed(reason)`). The
108
+ * current status is delivered to new subscribers immediately (replay-1).
109
+ * Returns an unsubscribe function.
110
+ */
111
+ onSyncStatus(cb: (s: SyncStatus) => void): () => void;
64
112
  }
65
113
  export declare const Beekon: BeekonImpl;
66
114
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"beekon.d.ts","sourceRoot":"","sources":["../../../src/beekon.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAQjD;;;;;;;;;;;;;;;;GAgBG;AACH,cAAM,UAAU;IACd;;;;;;OAMG;IACG,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAQpD;;;;;;;OAOG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ5B,uEAAuE;IACjE,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ3B;;;;;;;;;OASG;IACG,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IASxD;;;;OAIG;IACH,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,WAAW,KAAK,IAAI,GAAG,MAAM,IAAI;IAKjD;;;;OAIG;IACH,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,KAAK,IAAI,GAAG,MAAM,IAAI;CAMlD;AAED,eAAO,MAAM,MAAM,YAAmB,CAAC"}
1
+ {"version":3,"file":"beekon.d.ts","sourceRoot":"","sources":["../../../src/beekon.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,aAA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;;;OAIG;IACH,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,WAAW,KAAK,IAAI,GAAG,MAAM,IAAI;IAIjD;;;;OAIG;IACH,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,KAAK,IAAI,GAAG,MAAM,IAAI;IAIjD;;;OAGG;IACH,eAAe,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,aAAa,KAAK,IAAI,GAAG,MAAM,IAAI;IAI3D;;;;OAIG;IACH,YAAY,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,GAAG,MAAM,IAAI;CAGtD;AAED,eAAO,MAAM,MAAM,YAAmB,CAAC"}
@@ -1,6 +1,9 @@
1
1
  export { Beekon } from './beekon';
2
- export type { BeekonConfig, AndroidNotificationConfig } from './types/config';
3
- export type { BeekonState, StopReason } from './types/state';
2
+ export type { BeekonConfig, SyncConfig, NotificationConfig, } from './types/config';
3
+ export type { AccuracyMode, StationaryMode, LocationTrigger, LocationQuality, MotionState, ActivityType, } from './types/enums';
4
4
  export type { Location } from './types/location';
5
+ export type { BeekonGeofence, GeofenceEvent, Transition, } from './types/geofence';
6
+ export type { BeekonState, StopReason } from './types/state';
7
+ export type { SyncStatus, SyncFailure } from './types/sync';
5
8
  export { BeekonError, type BeekonErrorKind } from './types/error';
6
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,YAAY,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAC9E,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC7D,YAAY,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,YAAY,EACV,YAAY,EACZ,UAAU,EACV,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,YAAY,EACZ,cAAc,EACd,eAAe,EACf,eAAe,EACf,WAAW,EACX,YAAY,GACb,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,YAAY,EACV,cAAc,EACd,aAAa,EACb,UAAU,GACX,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC7D,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC"}
@@ -1,15 +1,21 @@
1
1
  import type { BeekonConfig } from '../types/config';
2
- import type { BeekonState } from '../types/state';
2
+ import type { BeekonGeofence, GeofenceEvent } from '../types/geofence';
3
3
  import type { Location } from '../types/location';
4
- import type { WireConfig, WireLocation, WireState } from '../NativeBeekonRn';
4
+ import type { BeekonState } from '../types/state';
5
+ import type { SyncStatus } from '../types/sync';
6
+ import type { WireConfig, WireGeofence, WireGeofenceEvent, WireKeyValue, WireLocation, WireState, WireSyncStatus } from '../NativeBeekonRn';
7
+ export declare function recordToEntries(record: Record<string, string> | undefined): WireKeyValue[];
5
8
  export declare function configToWire(config: BeekonConfig): WireConfig;
9
+ export declare function geofenceToWire(g: BeekonGeofence): WireGeofence;
6
10
  export declare function wireToLocation(w: WireLocation): Location;
11
+ export declare function wireToGeofence(w: WireGeofence): BeekonGeofence;
12
+ export declare function wireToGeofenceEvent(w: WireGeofenceEvent): GeofenceEvent;
7
13
  export declare function wireToState(w: WireState): BeekonState;
14
+ export declare function wireToSyncStatus(w: WireSyncStatus): SyncStatus;
8
15
  /**
9
- * Re-throw a native promise rejection as a typed `BeekonError`. Native modules
10
- * encode the kind in the error code string (`PERMISSION_DENIED`,
11
- * `LOCATION_SERVICES_DISABLED`, `STORAGE_FAILURE`); anything else falls
12
- * through as the original error.
16
+ * Re-throw a native promise rejection as a typed {@link BeekonError}. The native
17
+ * modules encode the kind in the error-code string (`STORAGE_FAILURE`,
18
+ * `INVALID_GEOFENCE`); anything else falls through as the original error.
13
19
  */
14
20
  export declare function rethrowAsBeekonError(e: unknown): never;
15
21
  //# sourceMappingURL=mappers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mappers.d.ts","sourceRoot":"","sources":["../../../../src/internal/mappers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAc,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAK7E,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,UAAU,CAM7D;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,YAAY,GAAG,QAAQ,CAUxD;AAeD,wBAAgB,WAAW,CAAC,CAAC,EAAE,SAAS,GAAG,WAAW,CAYrD;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,OAAO,GAAG,KAAK,CAQtD"}
1
+ {"version":3,"file":"mappers.d.ts","sourceRoot":"","sources":["../../../../src/internal/mappers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AASpD,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EAEd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAc,MAAM,gBAAgB,CAAC;AAC9D,OAAO,KAAK,EAAe,UAAU,EAAE,MAAM,eAAe,CAAC;AAE7D,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,cAAc,EACf,MAAM,mBAAmB,CAAC;AAiB3B,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GACzC,YAAY,EAAE,CAGhB;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,UAAU,CA0B7D;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,cAAc,GAAG,YAAY,CAS9D;AAID,wBAAgB,cAAc,CAAC,CAAC,EAAE,YAAY,GAAG,QAAQ,CA0CxD;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,YAAY,GAAG,cAAc,CAS9D;AAED,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,iBAAiB,GAAG,aAAa,CAOvE;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,SAAS,GAAG,WAAW,CAYrD;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,cAAc,GAAG,UAAU,CAW9D;AAoCD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,OAAO,GAAG,KAAK,CAQtD"}
@@ -1,33 +1,63 @@
1
+ import type { AccuracyMode, StationaryMode } from './enums';
1
2
  /**
2
- * Foreground-service notification overrides. Android-only — required by the
3
- * platform because every location foreground service must show a persistent
4
- * notification. All fields are optional; missing values resolve at runtime
5
- * against the host app's label and icon. Ignored on iOS.
3
+ * Foreground-service notification overrides. **Android-only**the platform
4
+ * requires every location foreground service to show a persistent notification.
5
+ * Both fields are optional; missing values fall back to native defaults.
6
+ * Ignored on iOS.
6
7
  */
7
- export type AndroidNotificationConfig = {
8
- /** Notification title. Defaults to "Location active". */
8
+ export type NotificationConfig = {
9
+ /** Notification title. Defaults to "Tracking location". */
9
10
  title?: string;
10
- /** Notification body text. Defaults to the host app's label. */
11
+ /** Notification body text. Defaults to no body. */
11
12
  text?: string;
13
+ };
14
+ /**
15
+ * Server-upload configuration. Presence of {@link BeekonConfig.sync} turns on
16
+ * batched uploads of stored locations and geofence events; omitting it keeps
17
+ * tracking local-only.
18
+ */
19
+ export type SyncConfig = {
20
+ /** Ingest endpoint — an `http` or `https` URL. */
21
+ url: string;
22
+ /** Extra HTTP headers sent with every upload (e.g. `Authorization`). */
23
+ headers?: Record<string, string>;
12
24
  /**
13
- * Drawable resource name (e.g. `ic_notification`) resolved at runtime via
14
- * `Resources.getIdentifier()` against the host app's `res/drawable*` folders.
15
- * Pass the resource name without extension or `R.drawable.` prefix. Defaults
16
- * to the host app's `applicationInfo.icon`.
25
+ * Target seconds between uploads. The SDK enforces a 60s floor; background
26
+ * uploads may be delayed to the OS scheduler floor (~15 min). Default: `300`.
17
27
  */
18
- smallIconResName?: string;
28
+ intervalSeconds?: number;
29
+ /** Maximum locations per upload. Clamped to `[1, 1000]`. Default: `100`. */
30
+ batchSize?: number;
19
31
  };
20
32
  /**
21
- * Tracking configuration. Two knobs: a minimum time interval and a minimum
22
- * distance between emitted fixes. A fix is admitted only when **both** gates
23
- * are satisfied. Pass `0` to disable a gate.
33
+ * Tracking configuration. Every field is optional `Beekon.start()` falls back
34
+ * to the previously persisted config, or to the documented defaults below if
35
+ * never configured.
36
+ *
37
+ * The two gate knobs (`minTimeBetweenLocationsSeconds`,
38
+ * `minDistanceBetweenLocationsMeters`) admit a fix only when **both** are
39
+ * satisfied; pass `0` to disable a gate.
24
40
  */
25
41
  export type BeekonConfig = {
26
- /** Minimum seconds between admitted fixes. Default: `30`. `0` disables the time gate. */
27
- intervalSeconds?: number;
28
- /** Minimum metres between admitted fixes. Default: `100`. `0` disables the distance gate. */
29
- distanceMeters?: number;
42
+ /** Minimum seconds between admitted fixes (10s floor). Default: `30`. */
43
+ minTimeBetweenLocationsSeconds?: number;
44
+ /** Minimum metres between admitted fixes. `0` disables it. Default: `100`. */
45
+ minDistanceBetweenLocationsMeters?: number;
46
+ /** Accuracy / battery preset. Default: `'balanced'`. */
47
+ accuracyMode?: AccuracyMode;
48
+ /** Behaviour while stationary. Default: `'pause'`. */
49
+ whenStationary?: StationaryMode;
50
+ /** Stationary exit-geofence radius, clamped to `[5, 1000]`. Default: `5`. */
51
+ stationaryRadiusMeters?: number;
52
+ /**
53
+ * Detect physical activity (walking, driving, …). Requires the
54
+ * `ACTIVITY_RECOGNITION` permission on Android and the `NSMotionUsageDescription`
55
+ * Info.plist key on iOS. Default: `false`.
56
+ */
57
+ detectActivity?: boolean;
58
+ /** Server-upload configuration. Omit to keep tracking local-only. */
59
+ sync?: SyncConfig;
30
60
  /** Android-only notification overrides. Ignored on iOS. */
31
- androidNotification?: AndroidNotificationConfig;
61
+ notification?: NotificationConfig;
32
62
  };
33
63
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/types/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACtC,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,yFAAyF;IACzF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,6FAA6F;IAC7F,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,2DAA2D;IAC3D,mBAAmB,CAAC,EAAE,yBAAyB,CAAC;CACjD,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,2DAA2D;IAC3D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,kDAAkD;IAClD,GAAG,EAAE,MAAM,CAAC;IACZ,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,yEAAyE;IACzE,8BAA8B,CAAC,EAAE,MAAM,CAAC;IACxC,8EAA8E;IAC9E,iCAAiC,CAAC,EAAE,MAAM,CAAC;IAC3C,wDAAwD;IACxD,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,sDAAsD;IACtD,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,6EAA6E;IAC7E,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,qEAAqE;IACrE,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,2DAA2D;IAC3D,YAAY,CAAC,EAAE,kBAAkB,CAAC;CACnC,CAAC"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Value enums shared across the public API, expressed as string-literal unions
3
+ * (idiomatic TS). Each mirrors the like-named enum on both native SDKs by value;
4
+ * the wire layer carries them as plain strings and the mappers translate.
5
+ */
6
+ /**
7
+ * Accuracy / battery-life preset for the location provider.
8
+ *
9
+ * - `'high'` — highest precision, highest battery cost (GPS-grade).
10
+ * - `'balanced'` — city-block precision, balanced battery (the default).
11
+ * - `'low'` — coarse, lowest battery.
12
+ */
13
+ export type AccuracyMode = 'high' | 'balanced' | 'low';
14
+ /**
15
+ * Behaviour while the device is stationary.
16
+ *
17
+ * - `'keepTracking'` — GPS stays on.
18
+ * - `'pause'` — GPS off while stationary, silent resume on movement (default).
19
+ * - `'pauseWithCheckIns'` — GPS off, but a location is recorded roughly every
20
+ * 15 minutes.
21
+ */
22
+ export type StationaryMode = 'keepTracking' | 'pause' | 'pauseWithCheckIns';
23
+ /**
24
+ * Why a {@link Location} was admitted and persisted.
25
+ *
26
+ * - `'interval'` — a scheduled fix that passed the time/distance gate.
27
+ * - `'motion'` — the device started or stopped moving.
28
+ * - `'checkIn'` — a periodic check-in while stationary.
29
+ * - `'geofence'` — a geofence crossing.
30
+ * - `'manual'` — an explicit request.
31
+ */
32
+ export type LocationTrigger = 'interval' | 'motion' | 'checkIn' | 'geofence' | 'manual';
33
+ /**
34
+ * The gate's quality verdict for a {@link Location}.
35
+ *
36
+ * - `'ok'` — passed the accuracy and speed checks.
37
+ * - `'lowAccuracy'` — worse than the usable accuracy threshold.
38
+ * - `'implausibleSpeed'` — an implausible jump from the previous fix.
39
+ */
40
+ export type LocationQuality = 'ok' | 'lowAccuracy' | 'implausibleSpeed';
41
+ /** Device motion when a {@link Location} was captured. */
42
+ export type MotionState = 'moving' | 'stationary' | 'unknown';
43
+ /**
44
+ * Detected physical activity. Only populated when
45
+ * {@link BeekonConfig.detectActivity} is enabled; otherwise `null`.
46
+ */
47
+ export type ActivityType = 'stationary' | 'walking' | 'running' | 'cycling' | 'automotive' | 'unknown';
48
+ //# sourceMappingURL=enums.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../../../src/types/enums.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,UAAU,GAAG,KAAK,CAAC;AAEvD;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG,OAAO,GAAG,mBAAmB,CAAC;AAE5E;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,GACvB,UAAU,GACV,QAAQ,GACR,SAAS,GACT,UAAU,GACV,QAAQ,CAAC;AAEb;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,aAAa,GAAG,kBAAkB,CAAC;AAExE,0DAA0D;AAC1D,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,YAAY,GAAG,SAAS,CAAC;AAE9D;;;GAGG;AACH,MAAM,MAAM,YAAY,GACpB,YAAY,GACZ,SAAS,GACT,SAAS,GACT,SAAS,GACT,YAAY,GACZ,SAAS,CAAC"}
@@ -1,11 +1,17 @@
1
1
  /**
2
- * Error kinds thrown from `Beekon.start()` / `Beekon.history()`. Match the
3
- * native `BeekonError` cases byte-for-byte.
2
+ * Error kinds thrown across the bridge. These are the **only** errors Beekon
3
+ * throws permission / location-services / lifecycle problems never throw; they
4
+ * surface on the `onState` stream as `stopped(reason)` instead.
5
+ *
6
+ * - `'storage'` — a local-store (SQLite) read/write failed. Thrown by
7
+ * `getLocations()`, `deleteLocations()`, and `pendingUploadCount()`.
8
+ * - `'invalidGeofence'` — a geofence passed to `addGeofences()` failed
9
+ * validation (empty/oversized id, or non-positive radius).
4
10
  */
5
- export type BeekonErrorKind = 'permissionDenied' | 'locationServicesDisabled' | 'storageFailure';
11
+ export type BeekonErrorKind = 'storage' | 'invalidGeofence';
6
12
  /**
7
- * Typed error surfaced from the bridge. The native module rejects promises
8
- * with the kind encoded as the error code; the facade re-wraps into this.
13
+ * Typed error surfaced from the bridge. The native module rejects promises with
14
+ * the kind encoded as the error code; the facade re-wraps into this.
9
15
  */
10
16
  export declare class BeekonError extends Error {
11
17
  readonly kind: BeekonErrorKind;
@@ -1 +1 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../../src/types/error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,eAAe,GACvB,kBAAkB,GAClB,0BAA0B,GAC1B,gBAAgB,CAAC;AAErB;;;GAGG;AACH,qBAAa,WAAY,SAAQ,KAAK;IACpC,SAAgB,IAAI,EAAE,eAAe,CAAC;gBAE1B,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM;CAKnD"}
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../../src/types/error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,iBAAiB,CAAC;AAE5D;;;GAGG;AACH,qBAAa,WAAY,SAAQ,KAAK;IACpC,SAAgB,IAAI,EAAE,eAAe,CAAC;gBAE1B,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM;CAKnD"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * A circular geofence registered via `Beekon.addGeofences()`. Mirrors
3
+ * `BeekonGeofence` on both native SDKs. The SDK pages registrations
4
+ * automatically, so you may register more than the OS geofence limit.
5
+ */
6
+ export type BeekonGeofence = {
7
+ /** Unique id, 1–100 characters. Re-adding an existing id replaces it. */
8
+ id: string;
9
+ /** Center latitude in degrees, WGS-84. */
10
+ latitude: number;
11
+ /** Center longitude in degrees, WGS-84. */
12
+ longitude: number;
13
+ /** Radius in metres. Must be `> 0`; `>= 100` is recommended for reliability. */
14
+ radiusMeters: number;
15
+ /** Emit an event on entry. Default: `true`. */
16
+ notifyOnEntry?: boolean;
17
+ /** Emit an event on exit. Default: `true`. */
18
+ notifyOnExit?: boolean;
19
+ };
20
+ /** Whether a {@link GeofenceEvent} marks entering or exiting a geofence. */
21
+ export type Transition = 'enter' | 'exit';
22
+ /**
23
+ * A geofence entry/exit crossing, delivered via `Beekon.onGeofenceEvent()`.
24
+ * Mirrors `GeofenceEvent` on both native SDKs.
25
+ */
26
+ export type GeofenceEvent = {
27
+ /** Unique event id. Used as the dedup key on upload. */
28
+ id: string;
29
+ /** The {@link BeekonGeofence.id} that was crossed. */
30
+ geofenceId: string;
31
+ /** Whether the device entered or exited. */
32
+ type: Transition;
33
+ /** When the crossing happened. */
34
+ timestamp: Date;
35
+ };
36
+ //# sourceMappingURL=geofence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"geofence.d.ts","sourceRoot":"","sources":["../../../../src/types/geofence.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,yEAAyE;IACzE,EAAE,EAAE,MAAM,CAAC;IACX,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,gFAAgF;IAChF,YAAY,EAAE,MAAM,CAAC;IACrB,+CAA+C;IAC/C,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,8CAA8C;IAC9C,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,4EAA4E;AAC5E,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC;AAE1C;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,wDAAwD;IACxD,EAAE,EAAE,MAAM,CAAC;IACX,sDAAsD;IACtD,UAAU,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,IAAI,EAAE,UAAU,CAAC;IACjB,kCAAkC;IAClC,SAAS,EAAE,IAAI,CAAC;CACjB,CAAC"}