@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,17 +1,23 @@
1
+ import type { ActivityType, LocationQuality, LocationTrigger, MotionState } from './enums';
1
2
  /**
2
3
  * A single location fix as emitted by the native SDK after gating. Fields map
3
4
  * 1:1 to `in.wayq.beekon.Location` on Android and `BeekonKit.Location` on iOS.
4
5
  *
5
- * `lat`, `lng`, and `timestamp` are always present. The four optional fields
6
- * are `null` when the OS did not report a value — the SDK never invents a
7
- * value to mask absence (e.g. a stationary device returns `bearing === null`,
8
- * not `0`).
6
+ * `id`, `latitude`, `longitude`, and `timestamp` are always present. The four
7
+ * optional numeric fields are `null` when the OS did not report a value — the
8
+ * SDK never invents a value to mask absence (e.g. a stationary device returns
9
+ * `bearing === null`, not `0`). `activity` is `null` unless
10
+ * {@link BeekonConfig.detectActivity} is enabled.
9
11
  */
10
12
  export type Location = {
13
+ /** Stable, unique storage id. Used as the dedup key on upload. */
14
+ id: string;
11
15
  /** Latitude in degrees, WGS-84. */
12
- lat: number;
16
+ latitude: number;
13
17
  /** Longitude in degrees, WGS-84. */
14
- lng: number;
18
+ longitude: number;
19
+ /** Time the OS provider reported this fix (not when JS received it). */
20
+ timestamp: Date;
15
21
  /** Horizontal accuracy in meters (1-sigma); `null` if unreported. */
16
22
  accuracy: number | null;
17
23
  /** Speed in m/s; `null` if unreported. */
@@ -20,7 +26,15 @@ export type Location = {
20
26
  bearing: number | null;
21
27
  /** Altitude in meters above the WGS-84 ellipsoid; `null` if unreported. */
22
28
  altitude: number | null;
23
- /** Time the OS provider reported this fix (not when JS received it). */
24
- timestamp: Date;
29
+ /** The gate's quality verdict for this fix. */
30
+ quality: LocationQuality;
31
+ /** Why this fix was captured. */
32
+ trigger: LocationTrigger;
33
+ /** Device motion when this fix was captured. */
34
+ motion: MotionState;
35
+ /** Detected activity, or `null` unless activity detection is enabled. */
36
+ activity: ActivityType | null;
37
+ /** `true` if the OS flagged this fix as mock/simulated. */
38
+ isMock: boolean;
25
39
  };
26
40
  //# sourceMappingURL=location.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"location.d.ts","sourceRoot":"","sources":["../../../../src/types/location.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,mCAAmC;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,oCAAoC;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,qEAAqE;IACrE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,0CAA0C;IAC1C,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,qFAAqF;IACrF,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,wEAAwE;IACxE,SAAS,EAAE,IAAI,CAAC;CACjB,CAAC"}
1
+ {"version":3,"file":"location.d.ts","sourceRoot":"","sources":["../../../../src/types/location.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,eAAe,EACf,eAAe,EACf,WAAW,EACZ,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;GASG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,kEAAkE;IAClE,EAAE,EAAE,MAAM,CAAC;IACX,mCAAmC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,oCAAoC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,wEAAwE;IACxE,SAAS,EAAE,IAAI,CAAC;IAChB,qEAAqE;IACrE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,0CAA0C;IAC1C,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,qFAAqF;IACrF,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,2EAA2E;IAC3E,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,+CAA+C;IAC/C,OAAO,EAAE,eAAe,CAAC;IACzB,iCAAiC;IACjC,OAAO,EAAE,eAAe,CAAC;IACzB,gDAAgD;IAChD,MAAM,EAAE,WAAW,CAAC;IACpB,yEAAyE;IACzE,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAC;IAC9B,2DAA2D;IAC3D,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC"}
@@ -1,15 +1,24 @@
1
1
  /**
2
2
  * Reason a tracking session ended. Mirrors `StopReason` on both platforms.
3
3
  *
4
- * `'system'` is Android-only surfaces when the OS terminates the foreground
5
- * service (memory pressure, force-stop). iOS will never emit `'system'`.
4
+ * - `'user'` — `Beekon.stop()` was called.
5
+ * - `'permissionDenied'` location permission is missing or was revoked
6
+ * (user-fixable in Settings).
7
+ * - `'locationServicesDisabled'` — system-wide location services are off
8
+ * (user-fixable in Settings).
9
+ * - `'locationUnavailable'` — no usable location backend on this device (e.g.
10
+ * Google Play Services absent/outdated on Android). Not user-fixable.
11
+ * - `'system'` — the OS terminated tracking (e.g. foreground-service kill,
12
+ * or an unrecoverable internal error).
6
13
  */
7
- export type StopReason = 'user' | 'permissionDenied' | 'locationServicesDisabled' | 'system';
14
+ export type StopReason = 'user' | 'permissionDenied' | 'locationServicesDisabled' | 'locationUnavailable' | 'system';
8
15
  /**
9
16
  * Tracking state. Mirrors the native `BeekonState` sealed type on both
10
17
  * platforms. Use the `kind` field as a discriminator.
11
18
  *
12
- * Lifecycle: `idle → tracking → stopped(reason)`.
19
+ * Lifecycle: `idle → tracking → stopped(reason)`. `start()` / `stop()` never
20
+ * throw — this stream is the single source of truth for whether tracking is
21
+ * active and why it stopped.
13
22
  */
14
23
  export type BeekonState = {
15
24
  kind: 'idle';
@@ -1 +1 @@
1
- {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../../src/types/state.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAClB,MAAM,GACN,kBAAkB,GAClB,0BAA0B,GAC1B,QAAQ,CAAC;AAEb;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,CAAC"}
1
+ {"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../../../src/types/state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,UAAU,GAClB,MAAM,GACN,kBAAkB,GAClB,0BAA0B,GAC1B,qBAAqB,GACrB,QAAQ,CAAC;AAEb;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Why a server upload failed terminally. Mirrors `SyncFailure` on both
3
+ * platforms.
4
+ *
5
+ * - `'auth'` — `401`/`403`; credentials were rejected. Refresh them (via
6
+ * `Beekon.configure()` with new `sync.headers`) and sync resumes.
7
+ * - `'rejected'` — `400`/`422`; the server rejected the payload. A payload bug;
8
+ * it won't self-resolve.
9
+ */
10
+ export type SyncFailure = 'auth' | 'rejected';
11
+ /**
12
+ * Upload health, delivered via `Beekon.onSyncStatus()`. Mirrors the native
13
+ * `SyncStatus` sealed type. Use the `kind` field as a discriminator.
14
+ *
15
+ * - `'idle'` — caught up, or sync is not configured.
16
+ * - `'pending'` — uploading or retrying (healthy).
17
+ * - `'failed'` — a terminal failure the app must act on.
18
+ */
19
+ export type SyncStatus = {
20
+ kind: 'idle';
21
+ } | {
22
+ kind: 'pending';
23
+ } | {
24
+ kind: 'failed';
25
+ reason: SyncFailure;
26
+ };
27
+ //# sourceMappingURL=sync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../../src/types/sync.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,UAAU,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,WAAW,CAAA;CAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wayq/beekon-rn",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "React Native binding for the Beekon location SDK (Android + iOS).",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -53,15 +53,14 @@
53
53
  ],
54
54
  "repository": {
55
55
  "type": "git",
56
- "url": "git+https://github.com/wayqteam/beekon.git",
57
- "directory": "beekon-rn"
56
+ "url": "git+https://github.com/wayqteam/beekon-rn.git"
58
57
  },
59
58
  "author": "wayqteam <wayqteam@users.noreply.github.com> (https://github.com/wayqteam)",
60
59
  "license": "SEE LICENSE IN LICENSE.txt",
61
60
  "bugs": {
62
- "url": "https://github.com/wayqteam/beekon/issues"
61
+ "url": "https://github.com/wayqteam/beekon-rn/issues"
63
62
  },
64
- "homepage": "https://github.com/wayqteam/beekon/tree/main/beekon-rn#readme",
63
+ "homepage": "https://github.com/wayqteam/beekon-rn#readme",
65
64
  "publishConfig": {
66
65
  "registry": "https://registry.npmjs.org/",
67
66
  "access": "public"
@@ -13,12 +13,12 @@
13
13
 
14
14
  set -euo pipefail
15
15
 
16
- VERSION="0.0.3"
16
+ VERSION="0.0.5"
17
17
  URL="https://github.com/wayqteam/beekon-ios-binary/releases/download/v${VERSION}/BeekonKit.xcframework.zip"
18
- # TODO(0.0.3): replace with the SHA256 emitted by `scripts/build-xcframework.sh`
19
- # when the v0.0.3 BeekonKit binary is cut and uploaded. v0.0.3 is the first
20
- # release with nullable Location fields (accuracy/speed/bearing/altitude).
21
- EXPECTED_SHA="c2f1990dd7064314deffc4af430839b0c8b7e61851e591c34fb683aed2fff127"
18
+ # SHA256 of the v0.0.5 BeekonKit.xcframework.zip. Matches the SwiftPM
19
+ # `binaryTarget` checksum in beekon-ios-binary's Package.swift at tag v0.0.5
20
+ # (SwiftPM's compute-checksum is the SHA256 of the zip).
21
+ EXPECTED_SHA="437bf493d7de19d8df9599da097be162796a8304eb2d7826cf2505c33d4603f7"
22
22
 
23
23
  ROOT="$(cd "$(dirname "$0")/.." && pwd)"
24
24
  DEST_DIR="${ROOT}/ios/Frameworks"
@@ -1,60 +1,150 @@
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
22
  import { TurboModuleRegistry } from 'react-native';
13
23
 
14
- export type WireAndroidNotification = {
24
+ /** A single string map entry — see `headers` / `setExtras`. */
25
+ export type WireKeyValue = {
26
+ key: string;
27
+ value: string;
28
+ };
29
+
30
+ export type WireSyncConfig = {
31
+ url: string;
32
+ headers: WireKeyValue[];
33
+ intervalSeconds: number;
34
+ batchSize: number;
35
+ };
36
+
37
+ /** Android-only foreground-service notification overrides. iOS ignores it. */
38
+ export type WireNotificationConfig = {
15
39
  title?: string;
16
40
  text?: string;
17
- smallIconResName?: string;
18
41
  };
19
42
 
20
43
  export type WireConfig = {
21
- /** Required at the wire level — the TS facade applies defaults (30 / 100). */
22
- intervalSeconds: number;
23
- /** Required at the wire level — the TS facade applies defaults (30 / 100). */
24
- distanceMeters: number;
25
- /** Android-only. iOS native module ignores. */
26
- androidNotification?: WireAndroidNotification;
44
+ /** All fields required at the wire level — the TS facade applies defaults. */
45
+ minTimeBetweenLocationsSeconds: number;
46
+ minDistanceBetweenLocationsMeters: number;
47
+ /** One of: 'high' | 'balanced' | 'low'. */
48
+ accuracyMode: string;
49
+ /** One of: 'keepTracking' | 'pause' | 'pauseWithCheckIns'. */
50
+ whenStationary: string;
51
+ stationaryRadiusMeters: number;
52
+ detectActivity: boolean;
53
+ /** Omitted keeps tracking local-only. */
54
+ sync?: WireSyncConfig;
55
+ /** Android-only; the iOS native module ignores it. */
56
+ notification?: WireNotificationConfig;
27
57
  };
28
58
 
29
59
  export type WireLocation = {
60
+ id: string;
30
61
  lat: number;
31
62
  lng: number;
32
63
  timestampMs: number;
33
- /** `null` when the OS did not report a value (e.g. low-confidence fix). */
64
+ /** `null` when the OS did not report a value. */
34
65
  accuracy: number | null;
35
66
  speed: number | null;
36
67
  bearing: number | null;
37
68
  altitude: number | null;
69
+ /** One of: 'ok' | 'lowAccuracy' | 'implausibleSpeed'. */
70
+ quality: string;
71
+ /** One of: 'interval' | 'motion' | 'checkIn' | 'geofence' | 'manual'. */
72
+ trigger: string;
73
+ /** One of: 'moving' | 'stationary' | 'unknown'. */
74
+ motion: string;
75
+ /** Activity enum string, or `null` unless activity detection is enabled. */
76
+ activity: string | null;
77
+ isMock: boolean;
78
+ };
79
+
80
+ export type WireGeofence = {
81
+ id: string;
82
+ lat: number;
83
+ lng: number;
84
+ radiusMeters: number;
85
+ notifyOnEntry: boolean;
86
+ notifyOnExit: boolean;
87
+ };
88
+
89
+ export type WireGeofenceEvent = {
90
+ id: string;
91
+ geofenceId: string;
92
+ /** One of: 'enter' | 'exit'. */
93
+ type: string;
94
+ timestampMs: number;
38
95
  };
39
96
 
40
97
  export type WireState = {
41
98
  /** One of: 'idle' | 'tracking' | 'stopped'. */
42
99
  type: string;
43
100
  /**
44
- * Only populated when `type === 'stopped'`. One of:
45
- * 'user' | 'permissionDenied' | 'locationServicesDisabled' | 'system'.
101
+ * Only populated when `type === 'stopped'`. One of: 'user' |
102
+ * 'permissionDenied' | 'locationServicesDisabled' | 'locationUnavailable' |
103
+ * 'system'.
46
104
  */
47
105
  stopReason?: string;
48
106
  };
49
107
 
108
+ export type WireSyncStatus = {
109
+ /** One of: 'idle' | 'pending' | 'failed'. */
110
+ type: string;
111
+ /** Only populated when `type === 'failed'`. One of: 'auth' | 'rejected'. */
112
+ failure?: string;
113
+ };
114
+
50
115
  export interface Spec extends TurboModule {
51
- configure(config: WireConfig): Promise<void>;
116
+ /**
117
+ * The config crosses as an untyped object (`ReadableMap` on Android,
118
+ * `NSDictionary` on iOS) and is parsed natively. Typing it as the nested
119
+ * {@link WireConfig} struct would force the iOS ObjC++ layer to walk Codegen's
120
+ * generated C++ structs; the facade still builds a `WireConfig`-shaped value
121
+ * via `configToWire`, so the shape is enforced upstream.
122
+ */
123
+ configure(config: CodegenTypes.UnsafeObject): Promise<void>;
52
124
  start(): Promise<void>;
53
125
  stop(): Promise<void>;
54
- history(fromMs: number, toMs: number): Promise<WireLocation[]>;
126
+ resumeIfNeeded(): Promise<void>;
127
+
128
+ getLocations(fromMs: number, toMs: number): Promise<WireLocation[]>;
129
+ /**
130
+ * A negative `beforeMs` deletes all stored locations (the wire encoding of
131
+ * the public `deleteLocations()` no-argument case). A plain `number` is used
132
+ * rather than `number | null` for portable Codegen support across platforms.
133
+ */
134
+ deleteLocations(beforeMs: number): Promise<number>;
135
+ pendingUploadCount(): Promise<number>;
136
+
137
+ sync(): Promise<void>;
138
+ setExtras(entries: WireKeyValue[]): Promise<void>;
139
+
140
+ addGeofences(geofences: WireGeofence[]): Promise<void>;
141
+ removeGeofences(ids: string[]): Promise<void>;
142
+ listGeofences(): Promise<WireGeofence[]>;
55
143
 
56
144
  readonly onState: CodegenTypes.EventEmitter<WireState>;
57
145
  readonly onLocation: CodegenTypes.EventEmitter<WireLocation>;
146
+ readonly onGeofenceEvent: CodegenTypes.EventEmitter<WireGeofenceEvent>;
147
+ readonly onSyncStatus: CodegenTypes.EventEmitter<WireSyncStatus>;
58
148
  }
59
149
 
60
150
  export default TurboModuleRegistry.getEnforcing<Spec>('BeekonRn');