@wayq/beekon-rn 0.0.7 → 0.0.9
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/CHANGELOG.md +43 -0
- package/README.md +67 -5
- package/android/build.gradle +3 -2
- package/android/src/main/java/in/wayq/beekonrn/BeekonRnModule.kt +106 -8
- package/ios/BeekonRn.mm +35 -0
- package/ios/BeekonRn.swift +140 -8
- 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 +6048 -3656
- 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 +95 -18
- 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 +6048 -3656
- 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 +95 -18
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/Modules/BeekonKit.swiftmodule/x86_64-apple-ios-simulator.abi.json +6048 -3656
- 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 +95 -18
- package/ios/Frameworks/BeekonKit.xcframework/ios-arm64_x86_64-simulator/BeekonKit.framework/_CodeSignature/CodeResources +1 -1
- package/lib/module/NativeBeekonRn.js.map +1 -1
- package/lib/module/beekon.js +97 -1
- package/lib/module/beekon.js.map +1 -1
- package/lib/module/index.js +4 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal/licenseNudge.js +64 -0
- package/lib/module/internal/licenseNudge.js.map +1 -0
- package/lib/module/internal/mappers.js +56 -8
- package/lib/module/internal/mappers.js.map +1 -1
- package/lib/module/types/config.js +73 -1
- package/lib/module/types/config.js.map +1 -1
- package/lib/module/types/log.js +4 -0
- package/lib/module/types/log.js.map +1 -0
- package/lib/typescript/src/NativeBeekonRn.d.ts +47 -2
- package/lib/typescript/src/NativeBeekonRn.d.ts.map +1 -1
- package/lib/typescript/src/beekon.d.ts +46 -1
- package/lib/typescript/src/beekon.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +4 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/internal/licenseNudge.d.ts +38 -0
- package/lib/typescript/src/internal/licenseNudge.d.ts.map +1 -0
- package/lib/typescript/src/internal/mappers.d.ts +3 -1
- package/lib/typescript/src/internal/mappers.d.ts.map +1 -1
- package/lib/typescript/src/types/config.d.ts +90 -7
- package/lib/typescript/src/types/config.d.ts.map +1 -1
- package/lib/typescript/src/types/enums.d.ts +8 -0
- package/lib/typescript/src/types/enums.d.ts.map +1 -1
- package/lib/typescript/src/types/log.d.ts +22 -0
- package/lib/typescript/src/types/log.d.ts.map +1 -0
- package/lib/typescript/src/types/state.d.ts +4 -1
- package/lib/typescript/src/types/state.d.ts.map +1 -1
- package/package.json +1 -1
- package/scripts/fetch-beekonkit.sh +4 -4
- package/src/NativeBeekonRn.ts +49 -2
- package/src/beekon.ts +100 -1
- package/src/index.tsx +7 -1
- package/src/internal/licenseNudge.ts +80 -0
- package/src/internal/mappers.ts +67 -7
- package/src/types/config.ts +99 -7
- package/src/types/enums.ts +9 -0
- package/src/types/log.ts +22 -0
- package/src/types/state.ts +4 -0
package/src/types/config.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AuthConfig } from './auth';
|
|
2
|
-
import type { AccuracyMode, StationaryMode } from './enums';
|
|
2
|
+
import type { AccuracyMode, LogLevel, StationaryMode } from './enums';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Foreground-service notification overrides. **Android-only** — the platform
|
|
@@ -23,8 +23,8 @@ export type NotificationConfig = {
|
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
* Server-upload configuration. Presence of {@link
|
|
27
|
-
* batched uploads of stored locations and geofence events; omitting it keeps
|
|
26
|
+
* Server-upload configuration. Presence of {@link SelfManagedConfig.sync} turns
|
|
27
|
+
* on batched uploads of stored locations and geofence events; omitting it keeps
|
|
28
28
|
* tracking local-only.
|
|
29
29
|
*/
|
|
30
30
|
export type SyncConfig = {
|
|
@@ -39,6 +39,15 @@ export type SyncConfig = {
|
|
|
39
39
|
intervalSeconds?: number;
|
|
40
40
|
/** Maximum locations per upload. Clamped to `[1, 1000]`. Default: `100`. */
|
|
41
41
|
batchSize?: number;
|
|
42
|
+
/**
|
|
43
|
+
* Pending-fix count that triggers an early upload of regular fixes, ahead of
|
|
44
|
+
* the {@link SyncConfig.intervalSeconds} schedule (not subject to the Android
|
|
45
|
+
* ~15 min floor). `0` (the default) leaves regular fixes to the schedule.
|
|
46
|
+
* Negative values are treated as `0`. Independent of this setting, a geofence
|
|
47
|
+
* event and a session stop with pending fixes always flush immediately while
|
|
48
|
+
* sync is configured. Requires the native SDK ≥ 0.0.9. Default: `0`.
|
|
49
|
+
*/
|
|
50
|
+
syncThreshold?: number;
|
|
42
51
|
/**
|
|
43
52
|
* Declarative token-refresh recipe. When set, the SDK attaches and natively
|
|
44
53
|
* refreshes the access token (proactively before expiry, reactively on
|
|
@@ -49,15 +58,58 @@ export type SyncConfig = {
|
|
|
49
58
|
};
|
|
50
59
|
|
|
51
60
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
61
|
+
* **Cloud-mode** configuration (cloud-mode-v1 §2). Point the SDK at Beekon
|
|
62
|
+
* Cloud (or a self-hosted Beekon backend) with a project key; the **server**
|
|
63
|
+
* owns the tracking parameters, sync cadence, geofences, and the license. This
|
|
64
|
+
* arm therefore exposes **only** the project credential, an optional endpoint
|
|
65
|
+
* override, the platform-universal Android `notification`, and `logLevel` — it
|
|
66
|
+
* deliberately does NOT expose tracking params, `sync`, or `licenseKey` (those
|
|
67
|
+
* are server-owned or derived).
|
|
68
|
+
*/
|
|
69
|
+
export type CloudConfig = {
|
|
70
|
+
/** Arm discriminator — selects cloud mode. */
|
|
71
|
+
mode: 'cloud';
|
|
72
|
+
/**
|
|
73
|
+
* Opaque project credential (prefix `bkproj_`). A **bearer secret** on a
|
|
74
|
+
* separate credential plane from the license token — do **not** commit it to
|
|
75
|
+
* source control. Surrounding whitespace is trimmed and an empty key is
|
|
76
|
+
* rejected natively.
|
|
77
|
+
*/
|
|
78
|
+
projectKey: string;
|
|
79
|
+
/**
|
|
80
|
+
* Base URL of the Beekon backend. Omit for Beekon Cloud (the SDK uses the
|
|
81
|
+
* baked-in `https://api.getbeekon.com`); set it to a self-hosted Beekon
|
|
82
|
+
* backend's base URL (the `/v1/token`, `/v1/config`, `/v1/ingest` suffixes
|
|
83
|
+
* are derived). Default: unset (`https://api.getbeekon.com`).
|
|
84
|
+
*/
|
|
85
|
+
endpoint?: string;
|
|
86
|
+
/** Android-only notification overrides. Ignored on iOS. */
|
|
87
|
+
notification?: NotificationConfig;
|
|
88
|
+
/**
|
|
89
|
+
* Diagnostic log verbosity threshold. See {@link SelfManagedConfig.logLevel}.
|
|
90
|
+
* Default: `'info'`.
|
|
91
|
+
*/
|
|
92
|
+
logLevel?: LogLevel;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* **Self-managed** configuration (cloud-mode-v1 §2 / self-managed-mode-v1).
|
|
97
|
+
* The app owns all configuration locally — tracking parameters, an optional
|
|
98
|
+
* `sync` (omit ⇒ local-only; set ⇒ custom-backend ingest), an optional
|
|
99
|
+
* `licenseKey`, plus `notification` and `logLevel`. This is the pre-cloud
|
|
100
|
+
* behaviour.
|
|
101
|
+
*
|
|
102
|
+
* Every field other than `mode` is optional — `Beekon.start()` falls back to
|
|
103
|
+
* the previously persisted config, or to the documented defaults below if never
|
|
104
|
+
* configured.
|
|
55
105
|
*
|
|
56
106
|
* The two gate knobs (`minTimeBetweenLocationsSeconds`,
|
|
57
107
|
* `minDistanceBetweenLocationsMeters`) admit a fix only when **both** are
|
|
58
108
|
* satisfied; pass `0` to disable a gate.
|
|
59
109
|
*/
|
|
60
|
-
export type
|
|
110
|
+
export type SelfManagedConfig = {
|
|
111
|
+
/** Arm discriminator — selects self-managed mode. */
|
|
112
|
+
mode: 'selfManaged';
|
|
61
113
|
/** Minimum seconds between admitted fixes (10s floor). Default: `30`. */
|
|
62
114
|
minTimeBetweenLocationsSeconds?: number;
|
|
63
115
|
/** Minimum metres between admitted fixes. `0` disables it. Default: `100`. */
|
|
@@ -91,4 +143,44 @@ export type BeekonConfig = {
|
|
|
91
143
|
* useless to anyone else. Default: unset.
|
|
92
144
|
*/
|
|
93
145
|
licenseKey?: string;
|
|
146
|
+
/**
|
|
147
|
+
* Diagnostic log verbosity threshold. Entries at or below this level are
|
|
148
|
+
* recorded to the persisted ring buffer and {@link Beekon.onLog}. `'info'`
|
|
149
|
+
* (the default) keeps coordinates out of the buffer — they appear only at
|
|
150
|
+
* `'debug'`/`'verbose'`. Change at runtime with {@link Beekon.setLogLevel}.
|
|
151
|
+
* Requires the native SDK ≥ 0.0.9. Default: `'info'`.
|
|
152
|
+
*/
|
|
153
|
+
logLevel?: LogLevel;
|
|
94
154
|
};
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Tracking configuration. A **sealed two-arm** discriminated union (cloud-mode-v1
|
|
158
|
+
* §2): the `mode` tag selects {@link CloudConfig} (server-owned config) or
|
|
159
|
+
* {@link SelfManagedConfig} (app-owned config). Each arm exposes only that arm's
|
|
160
|
+
* fields — the cloud arm cannot carry tracking params / sync / a license key.
|
|
161
|
+
*
|
|
162
|
+
* Build a value with the {@link BeekonConfig.cloud} / {@link BeekonConfig.selfManaged}
|
|
163
|
+
* factories, or with a plain object literal that includes the `mode` tag.
|
|
164
|
+
*/
|
|
165
|
+
export type BeekonConfig = CloudConfig | SelfManagedConfig;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Factory helpers mirroring the native sealed-type constructors
|
|
169
|
+
* (`BeekonConfig.cloud(...)` / `BeekonConfig.selfManaged(...)`). They stamp the
|
|
170
|
+
* `mode` discriminator so each call site can express only its arm's fields.
|
|
171
|
+
*
|
|
172
|
+
* Merged with the {@link BeekonConfig} type so `BeekonConfig` is usable as both
|
|
173
|
+
* a type and a value.
|
|
174
|
+
*/
|
|
175
|
+
export const BeekonConfig = {
|
|
176
|
+
/** Build a {@link CloudConfig}. `projectKey` is required. */
|
|
177
|
+
cloud(options: Omit<CloudConfig, 'mode'>): CloudConfig {
|
|
178
|
+
return { mode: 'cloud', ...options };
|
|
179
|
+
},
|
|
180
|
+
/** Build a {@link SelfManagedConfig}. Every field is optional. */
|
|
181
|
+
selfManaged(
|
|
182
|
+
options: Omit<SelfManagedConfig, 'mode'> = {}
|
|
183
|
+
): SelfManagedConfig {
|
|
184
|
+
return { mode: 'selfManaged', ...options };
|
|
185
|
+
},
|
|
186
|
+
} as const;
|
package/src/types/enums.ts
CHANGED
|
@@ -78,3 +78,12 @@ export type AuthStrategy = 'bearer' | 'raw';
|
|
|
78
78
|
* - `'json'` — `application/json`.
|
|
79
79
|
*/
|
|
80
80
|
export type AuthBodyFormat = 'form' | 'json';
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Diagnostic log verbosity threshold. Ordered by increasing verbosity; an entry
|
|
84
|
+
* is recorded only when its level is at or below the active threshold
|
|
85
|
+
* ({@link BeekonConfig.logLevel} or {@link Beekon.setLogLevel}). The default is
|
|
86
|
+
* `'info'`, so coordinates (logged only at `'debug'`/`'verbose'`) stay out of the
|
|
87
|
+
* buffer. Mirrors the native `LogLevel`; see `spec/diagnostics/log-format-v1`.
|
|
88
|
+
*/
|
|
89
|
+
export type LogLevel = 'off' | 'error' | 'warn' | 'info' | 'debug' | 'verbose';
|
package/src/types/log.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { LogLevel } from './enums';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A single diagnostic log record from the Beekon SDK.
|
|
5
|
+
*
|
|
6
|
+
* Delivered live on {@link Beekon.onLog} and read back from the persisted ring
|
|
7
|
+
* buffer via {@link Beekon.getLog}. Entries survive process death — the point of
|
|
8
|
+
* the buffer is post-hoc field diagnosis. Mirrors the native `LogEntry`; see
|
|
9
|
+
* `spec/diagnostics/log-format-v1`.
|
|
10
|
+
*/
|
|
11
|
+
export type LogEntry = {
|
|
12
|
+
/** UUIDv7 — orders and dedups entries. */
|
|
13
|
+
id: string;
|
|
14
|
+
/** When the entry was recorded. */
|
|
15
|
+
timestamp: Date;
|
|
16
|
+
/** Severity. Always one of `'error'`…`'verbose'`. */
|
|
17
|
+
level: LogLevel;
|
|
18
|
+
/** Originating subsystem (e.g. `'location'`, `'sync'`); host breadcrumbs use `'app'`. */
|
|
19
|
+
category: string;
|
|
20
|
+
/** Human-readable, already-redacted text. */
|
|
21
|
+
message: string;
|
|
22
|
+
};
|
package/src/types/state.ts
CHANGED
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
* (user-fixable in Settings).
|
|
9
9
|
* - `'locationUnavailable'` — no usable location backend on this device (e.g.
|
|
10
10
|
* Google Play Services absent/outdated on Android). Not user-fixable.
|
|
11
|
+
* - `'cloudModeUnavailable'` — the SDK was configured for cloud mode but the
|
|
12
|
+
* running build cannot operate it (cloud-mode-v1). Not user-fixable; switch to
|
|
13
|
+
* a self-managed config or a cloud-capable SDK build.
|
|
11
14
|
* - `'system'` — the OS terminated tracking (e.g. foreground-service kill,
|
|
12
15
|
* or an unrecoverable internal error).
|
|
13
16
|
*/
|
|
@@ -16,6 +19,7 @@ export type StopReason =
|
|
|
16
19
|
| 'permissionDenied'
|
|
17
20
|
| 'locationServicesDisabled'
|
|
18
21
|
| 'locationUnavailable'
|
|
22
|
+
| 'cloudModeUnavailable'
|
|
19
23
|
| 'system';
|
|
20
24
|
|
|
21
25
|
/**
|