@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.
- package/BeekonRn.podspec +1 -1
- package/README.md +91 -39
- package/android/build.gradle +9 -4
- package/android/src/main/java/in/wayq/beekonrn/BeekonRnModule.kt +306 -60
- package/ios/BeekonRn.mm +90 -24
- package/ios/BeekonRn.swift +360 -60
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/BeekonKit +0 -0
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/Info.plist +0 -0
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios.abi.json +7521 -1312
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios.swiftinterface +191 -40
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/BeekonKit +0 -0
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Info.plist +0 -0
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios-simulator.abi.json +7521 -1312
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +191 -40
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/x86_64-apple-ios-simulator.abi.json +7521 -1312
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +191 -40
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/_CodeSignature/CodeResources +2 -80
- package/lib/module/NativeBeekonRn.js +22 -7
- package/lib/module/NativeBeekonRn.js.map +1 -1
- package/lib/module/beekon.js +198 -46
- package/lib/module/beekon.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal/mappers.js +122 -28
- package/lib/module/internal/mappers.js.map +1 -1
- package/lib/module/types/config.js +2 -0
- package/lib/module/types/enums.js +2 -0
- package/lib/module/types/enums.js.map +1 -0
- package/lib/module/types/error.js +10 -4
- package/lib/module/types/error.js.map +1 -1
- package/lib/module/types/geofence.js +2 -0
- package/lib/module/types/geofence.js.map +1 -0
- package/lib/module/types/location.js +2 -0
- package/lib/module/types/sync.js +2 -0
- package/lib/module/types/sync.js.map +1 -0
- package/lib/typescript/src/NativeBeekonRn.d.ts +102 -20
- package/lib/typescript/src/NativeBeekonRn.d.ts.map +1 -1
- package/lib/typescript/src/beekon.d.ts +81 -33
- package/lib/typescript/src/beekon.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +5 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/internal/mappers.d.ts +12 -6
- package/lib/typescript/src/internal/mappers.d.ts.map +1 -1
- package/lib/typescript/src/types/config.d.ts +50 -20
- package/lib/typescript/src/types/config.d.ts.map +1 -1
- package/lib/typescript/src/types/enums.d.ts +48 -0
- package/lib/typescript/src/types/enums.d.ts.map +1 -0
- package/lib/typescript/src/types/error.d.ts +11 -5
- package/lib/typescript/src/types/error.d.ts.map +1 -1
- package/lib/typescript/src/types/geofence.d.ts +36 -0
- package/lib/typescript/src/types/geofence.d.ts.map +1 -0
- package/lib/typescript/src/types/location.d.ts +22 -8
- package/lib/typescript/src/types/location.d.ts.map +1 -1
- package/lib/typescript/src/types/state.d.ts +13 -4
- package/lib/typescript/src/types/state.d.ts.map +1 -1
- package/lib/typescript/src/types/sync.d.ts +27 -0
- package/lib/typescript/src/types/sync.d.ts.map +1 -0
- package/package.json +4 -5
- package/scripts/fetch-beekonkit.sh +5 -5
- package/src/NativeBeekonRn.ts +110 -20
- package/src/beekon.ts +219 -49
- package/src/index.tsx +21 -2
- package/src/internal/mappers.ts +187 -30
- package/src/types/config.ts +52 -20
- package/src/types/enums.ts +64 -0
- package/src/types/error.ts +11 -8
- package/src/types/geofence.ts +37 -0
- package/src/types/location.ts +28 -8
- package/src/types/state.ts +13 -3
- package/src/types/sync.ts +23 -0
- package/ios/Frameworks/BeekonKit.xcframework/_CodeSignature/CodeDirectory +0 -0
- package/ios/Frameworks/BeekonKit.xcframework/_CodeSignature/CodeRequirements +0 -0
- package/ios/Frameworks/BeekonKit.xcframework/_CodeSignature/CodeResources +0 -296
- package/ios/Frameworks/BeekonKit.xcframework/_CodeSignature/CodeSignature +0 -0
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64/BeekonKit.framework/_CodeSignature/CodeResources +0 -146
package/lib/module/beekon.js
CHANGED
|
@@ -1,103 +1,255 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import NativeBeekon from "./NativeBeekonRn.js";
|
|
4
|
-
import { configToWire, wireToLocation, wireToState,
|
|
4
|
+
import { configToWire, geofenceToWire, recordToEntries, rethrowAsBeekonError, wireToGeofence, wireToGeofenceEvent, wireToLocation, wireToState, wireToSyncStatus } from "./internal/mappers.js";
|
|
5
|
+
/**
|
|
6
|
+
* Fans the four native EventEmitters out to multiple JS subscribers and adds
|
|
7
|
+
* replay-1 semantics for `state` / `syncStatus` (RN EventEmitters don't replay,
|
|
8
|
+
* so we cache the latest value and hand it to new subscribers immediately —
|
|
9
|
+
* matching the native StateFlow / AsyncStream contract). `location` /
|
|
10
|
+
* `geofenceEvent` are plain fan-out with no replay.
|
|
11
|
+
*
|
|
12
|
+
* Native subscriptions are opened once, on first use, and kept for the app
|
|
13
|
+
* lifetime — the native module collects its flows continuously regardless, so
|
|
14
|
+
* this only keeps the JS cache warm.
|
|
15
|
+
*/
|
|
16
|
+
class EventHub {
|
|
17
|
+
subscribed = false;
|
|
18
|
+
stateListeners = new Set();
|
|
19
|
+
locationListeners = new Set();
|
|
20
|
+
geofenceListeners = new Set();
|
|
21
|
+
syncListeners = new Set();
|
|
22
|
+
/** Idempotent: opens the native subscriptions the first time it is called. */
|
|
23
|
+
ensureSubscribed() {
|
|
24
|
+
if (this.subscribed) return;
|
|
25
|
+
this.subscribed = true;
|
|
26
|
+
NativeBeekon.onState(w => {
|
|
27
|
+
const s = wireToState(w);
|
|
28
|
+
this.lastState = s;
|
|
29
|
+
this.stateListeners.forEach(cb => cb(s));
|
|
30
|
+
});
|
|
31
|
+
NativeBeekon.onLocation(w => {
|
|
32
|
+
const l = wireToLocation(w);
|
|
33
|
+
this.locationListeners.forEach(cb => cb(l));
|
|
34
|
+
});
|
|
35
|
+
NativeBeekon.onGeofenceEvent(w => {
|
|
36
|
+
const g = wireToGeofenceEvent(w);
|
|
37
|
+
this.geofenceListeners.forEach(cb => cb(g));
|
|
38
|
+
});
|
|
39
|
+
NativeBeekon.onSyncStatus(w => {
|
|
40
|
+
const s = wireToSyncStatus(w);
|
|
41
|
+
this.lastSyncStatus = s;
|
|
42
|
+
this.syncListeners.forEach(cb => cb(s));
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
onState(cb) {
|
|
46
|
+
this.ensureSubscribed();
|
|
47
|
+
this.stateListeners.add(cb);
|
|
48
|
+
if (this.lastState !== undefined) cb(this.lastState);
|
|
49
|
+
return () => {
|
|
50
|
+
this.stateListeners.delete(cb);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
onLocation(cb) {
|
|
54
|
+
this.ensureSubscribed();
|
|
55
|
+
this.locationListeners.add(cb);
|
|
56
|
+
return () => {
|
|
57
|
+
this.locationListeners.delete(cb);
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
onGeofenceEvent(cb) {
|
|
61
|
+
this.ensureSubscribed();
|
|
62
|
+
this.geofenceListeners.add(cb);
|
|
63
|
+
return () => {
|
|
64
|
+
this.geofenceListeners.delete(cb);
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
onSyncStatus(cb) {
|
|
68
|
+
this.ensureSubscribed();
|
|
69
|
+
this.syncListeners.add(cb);
|
|
70
|
+
if (this.lastSyncStatus !== undefined) cb(this.lastSyncStatus);
|
|
71
|
+
return () => {
|
|
72
|
+
this.syncListeners.delete(cb);
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
5
76
|
|
|
6
77
|
/**
|
|
7
|
-
* Public facade for the Beekon SDK
|
|
78
|
+
* Public facade for the Beekon SDK — a 1:1 mirror of the native APIs:
|
|
8
79
|
*
|
|
9
80
|
* - Android: `in.wayq.beekon.Beekon` (object)
|
|
10
81
|
* - iOS: `BeekonKit.Beekon.shared` (actor)
|
|
11
82
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* `
|
|
83
|
+
* There is **no `initialize()`** — the native SDKs auto-initialize. Lifecycle:
|
|
84
|
+
* `configure(config)` (optional; defaults 30s / 100m) → `start()` → … →
|
|
85
|
+
* `stop()`. `start()` / `stop()` **never throw** — `onState` is the single
|
|
86
|
+
* source of truth for whether tracking is active and why it stopped.
|
|
15
87
|
*
|
|
16
|
-
* **Threading:**
|
|
88
|
+
* **Threading:** methods are safe to call from any JS context; subscriber
|
|
17
89
|
* callbacks fire on the JS thread.
|
|
18
90
|
*
|
|
19
|
-
* **Persistence invariant:** the SDK persists every gated fix natively; JS is
|
|
20
|
-
*
|
|
21
|
-
*
|
|
91
|
+
* **Persistence invariant:** the SDK persists every gated fix natively; JS is a
|
|
92
|
+
* passive observer that is not guaranteed to be alive in the background. For
|
|
93
|
+
* past fixes use `getLocations()`.
|
|
22
94
|
*/
|
|
23
95
|
class BeekonImpl {
|
|
96
|
+
hub = new EventHub();
|
|
97
|
+
|
|
24
98
|
/**
|
|
25
99
|
* Set tracking parameters. Optional — `start()` falls back to the previously
|
|
26
|
-
* persisted config or the SDK
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* without restarting the underlying location subscription.
|
|
100
|
+
* persisted config, or the SDK defaults if never configured. While tracking,
|
|
101
|
+
* gate thresholds take effect on the next admitted fix without restarting the
|
|
102
|
+
* location subscription; `accuracyMode` applies on the next `start()`.
|
|
30
103
|
*/
|
|
31
104
|
async configure(config) {
|
|
105
|
+
this.hub.ensureSubscribed();
|
|
106
|
+
await NativeBeekon.configure(configToWire(config));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Begin tracking. Never throws — observe `onState` for the outcome
|
|
111
|
+
* (`stopped(reason)` on a permission / services / system problem). Beekon
|
|
112
|
+
* ships no permission API: request permissions in the host app, then observe
|
|
113
|
+
* `onState`.
|
|
114
|
+
*/
|
|
115
|
+
async start() {
|
|
116
|
+
this.hub.ensureSubscribed();
|
|
117
|
+
await NativeBeekon.start();
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/** Stop tracking. Idempotent. Registered geofences keep firing. */
|
|
121
|
+
async stop() {
|
|
122
|
+
this.hub.ensureSubscribed();
|
|
123
|
+
await NativeBeekon.stop();
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Resume tracking if a session was active before the app was terminated. A
|
|
128
|
+
* no-op if the user explicitly stopped. Call early in app startup.
|
|
129
|
+
*
|
|
130
|
+
* Note: on a background relaunch the JS engine may not be running, so true
|
|
131
|
+
* cold-launch resume also requires native host wiring (Android: call
|
|
132
|
+
* `Beekon.start()` from `Application.onCreate`; iOS: `registerBackgroundTasks`
|
|
133
|
+
* in the AppDelegate). See the README.
|
|
134
|
+
*/
|
|
135
|
+
async resumeIfNeeded() {
|
|
136
|
+
this.hub.ensureSubscribed();
|
|
137
|
+
await NativeBeekon.resumeIfNeeded();
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Read persisted fixes in the inclusive range `[from, to]`, oldest first.
|
|
142
|
+
* Reads come from the SDK's local storage (Room on Android, GRDB on iOS) — the
|
|
143
|
+
* source of truth even when JS was asleep. With sync enabled, rows are deleted
|
|
144
|
+
* locally once the server accepts them, so this returns only un-uploaded fixes.
|
|
145
|
+
*
|
|
146
|
+
* Throws `BeekonError` with kind `'storage'` on a database read failure.
|
|
147
|
+
*/
|
|
148
|
+
async getLocations(from, to) {
|
|
32
149
|
try {
|
|
33
|
-
await NativeBeekon.
|
|
150
|
+
const wires = await NativeBeekon.getLocations(from.getTime(), to.getTime());
|
|
151
|
+
return wires.map(wireToLocation);
|
|
34
152
|
} catch (e) {
|
|
35
153
|
rethrowAsBeekonError(e);
|
|
36
154
|
}
|
|
37
155
|
}
|
|
38
156
|
|
|
39
157
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* - `'permissionDenied'` — location permission not granted.
|
|
44
|
-
* - `'locationServicesDisabled'` — system location services off (or GMS
|
|
45
|
-
* unavailable on Android).
|
|
158
|
+
* Delete stored locations captured at or before `before` (all of them when
|
|
159
|
+
* `before` is omitted). Returns the number of rows removed. Throws
|
|
160
|
+
* `BeekonError` with kind `'storage'` on a failure.
|
|
46
161
|
*/
|
|
47
|
-
async
|
|
162
|
+
async deleteLocations(before) {
|
|
48
163
|
try {
|
|
49
|
-
|
|
164
|
+
// Negative is the wire sentinel for "delete all" (see NativeBeekonRn.ts).
|
|
165
|
+
return await NativeBeekon.deleteLocations(before ? before.getTime() : -1);
|
|
50
166
|
} catch (e) {
|
|
51
167
|
rethrowAsBeekonError(e);
|
|
52
168
|
}
|
|
53
169
|
}
|
|
54
170
|
|
|
55
|
-
/**
|
|
56
|
-
|
|
171
|
+
/**
|
|
172
|
+
* The number of stored locations not yet uploaded. Throws `BeekonError` with
|
|
173
|
+
* kind `'storage'` on a failure.
|
|
174
|
+
*/
|
|
175
|
+
async pendingUploadCount() {
|
|
57
176
|
try {
|
|
58
|
-
await NativeBeekon.
|
|
177
|
+
return await NativeBeekon.pendingUploadCount();
|
|
59
178
|
} catch (e) {
|
|
60
179
|
rethrowAsBeekonError(e);
|
|
61
180
|
}
|
|
62
181
|
}
|
|
63
182
|
|
|
64
183
|
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* Android, GRDB on iOS) — the source of truth even when JS was asleep.
|
|
68
|
-
*
|
|
69
|
-
* Retention: fixes older than 7 days OR beyond the most recent 100K are
|
|
70
|
-
* pruned automatically.
|
|
71
|
-
*
|
|
72
|
-
* Throws `BeekonError` with kind `'storageFailure'` on database read failure.
|
|
184
|
+
* Request an immediate upload. Best-effort and self-retrying; a no-op when
|
|
185
|
+
* sync is not configured.
|
|
73
186
|
*/
|
|
74
|
-
async
|
|
187
|
+
async sync() {
|
|
188
|
+
await NativeBeekon.sync();
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** Set custom key/value fields (e.g. `user_id`) included with every upload. */
|
|
192
|
+
async setExtras(extras) {
|
|
193
|
+
await NativeBeekon.setExtras(recordToEntries(extras));
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Register geofences. Re-adding an `id` replaces the existing one. Throws
|
|
198
|
+
* `BeekonError` with kind `'invalidGeofence'` if any entry fails validation —
|
|
199
|
+
* none are added when one is invalid.
|
|
200
|
+
*/
|
|
201
|
+
async addGeofences(geofences) {
|
|
75
202
|
try {
|
|
76
|
-
|
|
77
|
-
return wires.map(wireToLocation);
|
|
203
|
+
await NativeBeekon.addGeofences(geofences.map(geofenceToWire));
|
|
78
204
|
} catch (e) {
|
|
79
205
|
rethrowAsBeekonError(e);
|
|
80
206
|
}
|
|
81
207
|
}
|
|
82
208
|
|
|
209
|
+
/** Unregister geofences by id. Unknown ids are ignored. */
|
|
210
|
+
async removeGeofences(ids) {
|
|
211
|
+
await NativeBeekon.removeGeofences(ids);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/** The currently registered geofences. */
|
|
215
|
+
async listGeofences() {
|
|
216
|
+
const wires = await NativeBeekon.listGeofences();
|
|
217
|
+
return wires.map(wireToGeofence);
|
|
218
|
+
}
|
|
219
|
+
|
|
83
220
|
/**
|
|
84
|
-
* Subscribe to state transitions
|
|
85
|
-
* current state is delivered to new subscribers
|
|
86
|
-
*
|
|
221
|
+
* Subscribe to tracking-state transitions (`idle` / `tracking` /
|
|
222
|
+
* `stopped(reason)`). The current state is delivered to new subscribers
|
|
223
|
+
* immediately (replay-1). Returns an unsubscribe function.
|
|
87
224
|
*/
|
|
88
225
|
onState(cb) {
|
|
89
|
-
|
|
90
|
-
return () => subscription.remove();
|
|
226
|
+
return this.hub.onState(cb);
|
|
91
227
|
}
|
|
92
228
|
|
|
93
229
|
/**
|
|
94
|
-
* Subscribe to gated locations as they arrive.
|
|
95
|
-
*
|
|
96
|
-
*
|
|
230
|
+
* Subscribe to gated locations as they arrive. Broadcast (no replay) — only
|
|
231
|
+
* delivers while the JS engine is alive. For fixes emitted while JS was
|
|
232
|
+
* asleep, use `getLocations()`. Returns an unsubscribe function.
|
|
97
233
|
*/
|
|
98
234
|
onLocation(cb) {
|
|
99
|
-
|
|
100
|
-
|
|
235
|
+
return this.hub.onLocation(cb);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Subscribe to geofence enter / exit crossings. Broadcast (no replay).
|
|
240
|
+
* Returns an unsubscribe function.
|
|
241
|
+
*/
|
|
242
|
+
onGeofenceEvent(cb) {
|
|
243
|
+
return this.hub.onGeofenceEvent(cb);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Subscribe to upload health (`idle` / `pending` / `failed(reason)`). The
|
|
248
|
+
* current status is delivered to new subscribers immediately (replay-1).
|
|
249
|
+
* Returns an unsubscribe function.
|
|
250
|
+
*/
|
|
251
|
+
onSyncStatus(cb) {
|
|
252
|
+
return this.hub.onSyncStatus(cb);
|
|
101
253
|
}
|
|
102
254
|
}
|
|
103
255
|
export const Beekon = new BeekonImpl();
|
package/lib/module/beekon.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeBeekon","configToWire","wireToLocation","wireToState","
|
|
1
|
+
{"version":3,"names":["NativeBeekon","configToWire","geofenceToWire","recordToEntries","rethrowAsBeekonError","wireToGeofence","wireToGeofenceEvent","wireToLocation","wireToState","wireToSyncStatus","EventHub","subscribed","stateListeners","Set","locationListeners","geofenceListeners","syncListeners","ensureSubscribed","onState","w","s","lastState","forEach","cb","onLocation","l","onGeofenceEvent","g","onSyncStatus","lastSyncStatus","add","undefined","delete","BeekonImpl","hub","configure","config","start","stop","resumeIfNeeded","getLocations","from","to","wires","getTime","map","e","deleteLocations","before","pendingUploadCount","sync","setExtras","extras","addGeofences","geofences","removeGeofences","ids","listGeofences","Beekon"],"sourceRoot":"../../src","sources":["beekon.ts"],"mappings":";;AAAA,OAAOA,YAAY,MAAM,qBAAkB;AAM3C,SACEC,YAAY,EACZC,cAAc,EACdC,eAAe,EACfC,oBAAoB,EACpBC,cAAc,EACdC,mBAAmB,EACnBC,cAAc,EACdC,WAAW,EACXC,gBAAgB,QACX,uBAAoB;AAI3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,QAAQ,CAAC;EACLC,UAAU,GAAG,KAAK;EACTC,cAAc,GAAG,IAAIC,GAAG,CAAwB,CAAC;EACjDC,iBAAiB,GAAG,IAAID,GAAG,CAAqB,CAAC;EACjDE,iBAAiB,GAAG,IA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IAC1D,OAAO,IAAI,CAACW,GAAG,CAACR,eAAe,CAACH,EAAE,CAAC;EACrC;;EAEA;AACF;AACA;AACA;AACA;EACEK,YAAYA,CAACL,EAA2B,EAAc;IACpD,OAAO,IAAI,CAACW,GAAG,CAACN,YAAY,CAACL,EAAE,CAAC;EAClC;AACF;AAEA,OAAO,MAAMmC,MAAM,GAAG,IAAIzB,UAAU,CAAC,CAAC","ignoreList":[]}
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Beekon","BeekonError"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,aAAU;
|
|
1
|
+
{"version":3,"names":["Beekon","BeekonError"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,aAAU;AAuBjC,SAASC,WAAW,QAA8B,kBAAe","ignoreList":[]}
|
|
@@ -1,37 +1,96 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { BeekonError } from "../types/error.js";
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
// Config defaults. Kept here (not in the wire layer) so the native modules can
|
|
5
|
+
// treat every wire field as present.
|
|
6
|
+
const DEFAULTS = {
|
|
7
|
+
minTimeBetweenLocationsSeconds: 30,
|
|
8
|
+
minDistanceBetweenLocationsMeters: 100,
|
|
9
|
+
accuracyMode: 'balanced',
|
|
10
|
+
whenStationary: 'pause',
|
|
11
|
+
stationaryRadiusMeters: 5,
|
|
12
|
+
detectActivity: false,
|
|
13
|
+
syncIntervalSeconds: 300,
|
|
14
|
+
syncBatchSize: 100
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// --- Public → wire ---------------------------------------------------------
|
|
18
|
+
|
|
19
|
+
export function recordToEntries(record) {
|
|
20
|
+
if (!record) return [];
|
|
21
|
+
return Object.keys(record).map(key => ({
|
|
22
|
+
key,
|
|
23
|
+
value: record[key]
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
6
26
|
export function configToWire(config) {
|
|
27
|
+
const sync = config.sync;
|
|
28
|
+
return {
|
|
29
|
+
minTimeBetweenLocationsSeconds: config.minTimeBetweenLocationsSeconds ?? DEFAULTS.minTimeBetweenLocationsSeconds,
|
|
30
|
+
minDistanceBetweenLocationsMeters: config.minDistanceBetweenLocationsMeters ?? DEFAULTS.minDistanceBetweenLocationsMeters,
|
|
31
|
+
accuracyMode: config.accuracyMode ?? DEFAULTS.accuracyMode,
|
|
32
|
+
whenStationary: config.whenStationary ?? DEFAULTS.whenStationary,
|
|
33
|
+
stationaryRadiusMeters: config.stationaryRadiusMeters ?? DEFAULTS.stationaryRadiusMeters,
|
|
34
|
+
detectActivity: config.detectActivity ?? DEFAULTS.detectActivity,
|
|
35
|
+
sync: sync ? {
|
|
36
|
+
url: sync.url,
|
|
37
|
+
headers: recordToEntries(sync.headers),
|
|
38
|
+
intervalSeconds: sync.intervalSeconds ?? DEFAULTS.syncIntervalSeconds,
|
|
39
|
+
batchSize: sync.batchSize ?? DEFAULTS.syncBatchSize
|
|
40
|
+
} : undefined,
|
|
41
|
+
notification: config.notification ? {
|
|
42
|
+
title: config.notification.title,
|
|
43
|
+
text: config.notification.text
|
|
44
|
+
} : undefined
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export function geofenceToWire(g) {
|
|
7
48
|
return {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
49
|
+
id: g.id,
|
|
50
|
+
lat: g.latitude,
|
|
51
|
+
lng: g.longitude,
|
|
52
|
+
radiusMeters: g.radiusMeters,
|
|
53
|
+
notifyOnEntry: g.notifyOnEntry ?? true,
|
|
54
|
+
notifyOnExit: g.notifyOnExit ?? true
|
|
11
55
|
};
|
|
12
56
|
}
|
|
57
|
+
|
|
58
|
+
// --- Wire → public ---------------------------------------------------------
|
|
59
|
+
|
|
13
60
|
export function wireToLocation(w) {
|
|
14
61
|
return {
|
|
15
|
-
|
|
16
|
-
|
|
62
|
+
id: w.id,
|
|
63
|
+
latitude: w.lat,
|
|
64
|
+
longitude: w.lng,
|
|
65
|
+
timestamp: new Date(w.timestampMs),
|
|
17
66
|
accuracy: w.accuracy,
|
|
18
67
|
speed: w.speed,
|
|
19
68
|
bearing: w.bearing,
|
|
20
69
|
altitude: w.altitude,
|
|
21
|
-
|
|
70
|
+
quality: oneOf(w.quality, ['ok', 'lowAccuracy', 'implausibleSpeed'], 'ok'),
|
|
71
|
+
trigger: oneOf(w.trigger, ['interval', 'motion', 'checkIn', 'geofence', 'manual'], 'interval'),
|
|
72
|
+
motion: oneOf(w.motion, ['moving', 'stationary', 'unknown'], 'unknown'),
|
|
73
|
+
activity: w.activity == null ? null : oneOf(w.activity, ['stationary', 'walking', 'running', 'cycling', 'automotive', 'unknown'], 'unknown'),
|
|
74
|
+
isMock: w.isMock
|
|
22
75
|
};
|
|
23
76
|
}
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
77
|
+
export function wireToGeofence(w) {
|
|
78
|
+
return {
|
|
79
|
+
id: w.id,
|
|
80
|
+
latitude: w.lat,
|
|
81
|
+
longitude: w.lng,
|
|
82
|
+
radiusMeters: w.radiusMeters,
|
|
83
|
+
notifyOnEntry: w.notifyOnEntry,
|
|
84
|
+
notifyOnExit: w.notifyOnExit
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
export function wireToGeofenceEvent(w) {
|
|
88
|
+
return {
|
|
89
|
+
id: w.id,
|
|
90
|
+
geofenceId: w.geofenceId,
|
|
91
|
+
type: oneOf(w.type, ['enter', 'exit'], 'enter'),
|
|
92
|
+
timestamp: new Date(w.timestampMs)
|
|
93
|
+
};
|
|
35
94
|
}
|
|
36
95
|
export function wireToState(w) {
|
|
37
96
|
switch (w.type) {
|
|
@@ -55,12 +114,49 @@ export function wireToState(w) {
|
|
|
55
114
|
};
|
|
56
115
|
}
|
|
57
116
|
}
|
|
117
|
+
export function wireToSyncStatus(w) {
|
|
118
|
+
switch (w.type) {
|
|
119
|
+
case 'idle':
|
|
120
|
+
return {
|
|
121
|
+
kind: 'idle'
|
|
122
|
+
};
|
|
123
|
+
case 'pending':
|
|
124
|
+
return {
|
|
125
|
+
kind: 'pending'
|
|
126
|
+
};
|
|
127
|
+
case 'failed':
|
|
128
|
+
return {
|
|
129
|
+
kind: 'failed',
|
|
130
|
+
reason: toSyncFailure(w.failure)
|
|
131
|
+
};
|
|
132
|
+
default:
|
|
133
|
+
return {
|
|
134
|
+
kind: 'idle'
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
function toStopReason(s) {
|
|
139
|
+
return oneOf(s, ['user', 'permissionDenied', 'locationServicesDisabled', 'locationUnavailable', 'system'],
|
|
140
|
+
// The native side always populates the reason for a `stopped` state; an
|
|
141
|
+
// unknown/missing value means the wire contract was violated — fall back to
|
|
142
|
+
// `system` rather than throwing on a subscriber.
|
|
143
|
+
'system');
|
|
144
|
+
}
|
|
145
|
+
function toSyncFailure(s) {
|
|
146
|
+
return oneOf(s, ['auth', 'rejected'], 'rejected');
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** Validate a wire enum string against the known set, with a safe fallback. */
|
|
150
|
+
function oneOf(value, allowed, fallback) {
|
|
151
|
+
return allowed.includes(value ?? '') ? value : fallback;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// --- Errors ----------------------------------------------------------------
|
|
58
155
|
|
|
59
156
|
/**
|
|
60
|
-
* Re-throw a native promise rejection as a typed
|
|
61
|
-
* encode the kind in the error
|
|
62
|
-
* `
|
|
63
|
-
* through as the original error.
|
|
157
|
+
* Re-throw a native promise rejection as a typed {@link BeekonError}. The native
|
|
158
|
+
* modules encode the kind in the error-code string (`STORAGE_FAILURE`,
|
|
159
|
+
* `INVALID_GEOFENCE`); anything else falls through as the original error.
|
|
64
160
|
*/
|
|
65
161
|
export function rethrowAsBeekonError(e) {
|
|
66
162
|
const code = e?.code;
|
|
@@ -73,12 +169,10 @@ export function rethrowAsBeekonError(e) {
|
|
|
73
169
|
}
|
|
74
170
|
function codeToKind(code) {
|
|
75
171
|
switch (code) {
|
|
76
|
-
case 'PERMISSION_DENIED':
|
|
77
|
-
return 'permissionDenied';
|
|
78
|
-
case 'LOCATION_SERVICES_DISABLED':
|
|
79
|
-
return 'locationServicesDisabled';
|
|
80
172
|
case 'STORAGE_FAILURE':
|
|
81
|
-
return '
|
|
173
|
+
return 'storage';
|
|
174
|
+
case 'INVALID_GEOFENCE':
|
|
175
|
+
return 'invalidGeofence';
|
|
82
176
|
default:
|
|
83
177
|
return undefined;
|
|
84
178
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BeekonError","
|
|
1
|
+
{"version":3,"names":["BeekonError","DEFAULTS","minTimeBetweenLocationsSeconds","minDistanceBetweenLocationsMeters","accuracyMode","whenStationary","stationaryRadiusMeters","detectActivity","syncIntervalSeconds","syncBatchSize","recordToEntries","record","Object","keys","map","key","value","configToWire","config","sync","url","headers","intervalSeconds","batchSize","undefined","notification","title","text","geofenceToWire","g","id","lat","latitude","lng","longitude","radiusMeters","notifyOnEntry","notifyOnExit","wireToLocation","w","timestamp","Date","timestampMs","accuracy","speed","bearing","altitude","quality","oneOf","trigger","motion","activity","isMock","wireToGeofence","wireToGeofenceEvent","geofenceId","type","wireToState","kind","reason","toStopReason","stopReason","wireToSyncStatus","toSyncFailure","failure","s","allowed","fallback","includes","rethrowAsBeekonError","e","code","message","String","codeToKind"],"sourceRoot":"../../../src","sources":["internal/mappers.ts"],"mappings":";;AAiBA,SAASA,WAAW,QAA8B,mBAAgB;AAWlE;AACA;AACA,MAAMC,QAAQ,GAAG;EACfC,8BAA8B,EAAE,EAAE;EAClCC,iCAAiC,EAAE,GAAG;EACtCC,YAAY,EAAE,UAA0B;EACxCC,cAAc,EAAE,OAAy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AEA,SAASI,UAAUA,CAACH,IAAwB,EAA+B;EACzE,QAAQA,IAAI;IACV,KAAK,iBAAiB;MACpB,OAAO,SAAS;IAClB,KAAK,kBAAkB;MACrB,OAAO,iBAAiB;IAC1B;MACE,OAAO/C,SAAS;EACpB;AACF","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/enums.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Error kinds thrown
|
|
5
|
-
*
|
|
4
|
+
* Error kinds thrown across the bridge. These are the **only** errors Beekon
|
|
5
|
+
* throws — permission / location-services / lifecycle problems never throw; they
|
|
6
|
+
* surface on the `onState` stream as `stopped(reason)` instead.
|
|
7
|
+
*
|
|
8
|
+
* - `'storage'` — a local-store (SQLite) read/write failed. Thrown by
|
|
9
|
+
* `getLocations()`, `deleteLocations()`, and `pendingUploadCount()`.
|
|
10
|
+
* - `'invalidGeofence'` — a geofence passed to `addGeofences()` failed
|
|
11
|
+
* validation (empty/oversized id, or non-positive radius).
|
|
6
12
|
*/
|
|
7
13
|
|
|
8
14
|
/**
|
|
9
|
-
* Typed error surfaced from the bridge. The native module rejects promises
|
|
10
|
-
*
|
|
15
|
+
* Typed error surfaced from the bridge. The native module rejects promises with
|
|
16
|
+
* the kind encoded as the error code; the facade re-wraps into this.
|
|
11
17
|
*/
|
|
12
18
|
export class BeekonError extends Error {
|
|
13
19
|
constructor(kind, message) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["BeekonError","Error","constructor","kind","message","name"],"sourceRoot":"../../../src","sources":["types/error.ts"],"mappings":";;AAAA;AACA;AACA;AACA;;
|
|
1
|
+
{"version":3,"names":["BeekonError","Error","constructor","kind","message","name"],"sourceRoot":"../../../src","sources":["types/error.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA,OAAO,MAAMA,WAAW,SAASC,KAAK,CAAC;EAGrCC,WAAWA,CAACC,IAAqB,EAAEC,OAAe,EAAE;IAClD,KAAK,CAACA,OAAO,CAAC;IACd,IAAI,CAACC,IAAI,GAAG,aAAa;IACzB,IAAI,CAACF,IAAI,GAAGA,IAAI;EAClB;AACF","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/geofence.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/sync.ts"],"mappings":"","ignoreList":[]}
|