@transistorsoft/background-geolocation-types 5.0.0-beta.1

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 (109) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +137 -0
  3. package/dist/core/api/BackgroundGeolocation.d.ts +6 -0
  4. package/dist/core/api/BackgroundGeolocation.js +2 -0
  5. package/dist/core/api/CurrentPositionRequest.d.ts +44 -0
  6. package/dist/core/api/CurrentPositionRequest.js +2 -0
  7. package/dist/core/api/DeviceSettings.d.ts +77 -0
  8. package/dist/core/api/DeviceSettings.js +2 -0
  9. package/dist/core/api/Logger.d.ts +421 -0
  10. package/dist/core/api/Logger.js +2 -0
  11. package/dist/core/api/State.d.ts +75 -0
  12. package/dist/core/api/State.js +2 -0
  13. package/dist/core/config/ActivityConfig.d.ts +271 -0
  14. package/dist/core/config/ActivityConfig.js +2 -0
  15. package/dist/core/config/AppConfig.d.ts +599 -0
  16. package/dist/core/config/AppConfig.js +2 -0
  17. package/dist/core/config/AuthorizationConfig.d.ts +200 -0
  18. package/dist/core/config/AuthorizationConfig.js +2 -0
  19. package/dist/core/config/CompoundConfig.d.ts +19 -0
  20. package/dist/core/config/CompoundConfig.js +2 -0
  21. package/dist/core/config/Config.d.ts +149 -0
  22. package/dist/core/config/Config.js +2 -0
  23. package/dist/core/config/GeoConfig.d.ts +905 -0
  24. package/dist/core/config/GeoConfig.js +2 -0
  25. package/dist/core/config/HttpConfig.d.ts +579 -0
  26. package/dist/core/config/HttpConfig.js +2 -0
  27. package/dist/core/config/LocationFilter.d.ts +272 -0
  28. package/dist/core/config/LocationFilter.js +2 -0
  29. package/dist/core/config/LoggerConfig.d.ts +319 -0
  30. package/dist/core/config/LoggerConfig.js +2 -0
  31. package/dist/core/config/NotificationConfig.d.ts +519 -0
  32. package/dist/core/config/NotificationConfig.js +2 -0
  33. package/dist/core/config/PersistenceConfig.d.ts +552 -0
  34. package/dist/core/config/PersistenceConfig.js +2 -0
  35. package/dist/core/data/DeviceInfo.d.ts +61 -0
  36. package/dist/core/data/DeviceInfo.js +2 -0
  37. package/dist/core/data/Geofence.d.ts +16 -0
  38. package/dist/core/data/Geofence.js +2 -0
  39. package/dist/core/data/Location.d.ts +253 -0
  40. package/dist/core/data/Location.js +2 -0
  41. package/dist/core/data/Sensors.d.ts +30 -0
  42. package/dist/core/data/Sensors.js +2 -0
  43. package/dist/core/events/AuthorizationEvent.d.ts +15 -0
  44. package/dist/core/events/AuthorizationEvent.js +2 -0
  45. package/dist/core/events/ConnectivityChangeEvent.d.ts +9 -0
  46. package/dist/core/events/ConnectivityChangeEvent.js +2 -0
  47. package/dist/core/events/GeofenceEvent.d.ts +19 -0
  48. package/dist/core/events/GeofenceEvent.js +2 -0
  49. package/dist/core/events/GeofencesChangeEvent.d.ts +12 -0
  50. package/dist/core/events/GeofencesChangeEvent.js +2 -0
  51. package/dist/core/events/HeadlessEvent.d.ts +12 -0
  52. package/dist/core/events/HeadlessEvent.js +2 -0
  53. package/dist/core/events/HeartbeatEvent.d.ts +14 -0
  54. package/dist/core/events/HeartbeatEvent.js +2 -0
  55. package/dist/core/events/HttpEvent.d.ts +13 -0
  56. package/dist/core/events/HttpEvent.js +2 -0
  57. package/dist/core/events/MotionActivityEvent.d.ts +12 -0
  58. package/dist/core/events/MotionActivityEvent.js +2 -0
  59. package/dist/core/events/MotionChangeEvent.d.ts +12 -0
  60. package/dist/core/events/MotionChangeEvent.js +2 -0
  61. package/dist/core/events/ProviderChangeEvent.d.ts +17 -0
  62. package/dist/core/events/ProviderChangeEvent.js +2 -0
  63. package/dist/core/events/Subscription.d.ts +86 -0
  64. package/dist/core/events/Subscription.js +2 -0
  65. package/dist/docs-entry.d.ts +3 -0
  66. package/dist/docs-entry.js +20 -0
  67. package/dist/enums/AccuracyAuthorization.d.ts +16 -0
  68. package/dist/enums/AccuracyAuthorization.js +19 -0
  69. package/dist/enums/ActivityType.d.ts +28 -0
  70. package/dist/enums/ActivityType.js +31 -0
  71. package/dist/enums/AuthorizationStatus.d.ts +20 -0
  72. package/dist/enums/AuthorizationStatus.js +23 -0
  73. package/dist/enums/AuthorizationStrategy.d.ts +10 -0
  74. package/dist/enums/AuthorizationStrategy.js +13 -0
  75. package/dist/enums/DesiredAccuracy.d.ts +13 -0
  76. package/dist/enums/DesiredAccuracy.js +16 -0
  77. package/dist/enums/Event.d.ts +21 -0
  78. package/dist/enums/Event.js +24 -0
  79. package/dist/enums/GeofenceAction.d.ts +18 -0
  80. package/dist/enums/GeofenceAction.js +21 -0
  81. package/dist/enums/HttpMethod.d.ts +11 -0
  82. package/dist/enums/HttpMethod.js +14 -0
  83. package/dist/enums/KalmanProfile.d.ts +30 -0
  84. package/dist/enums/KalmanProfile.js +33 -0
  85. package/dist/enums/LocationError.d.ts +23 -0
  86. package/dist/enums/LocationError.js +26 -0
  87. package/dist/enums/LocationFilterPolicy.d.ts +108 -0
  88. package/dist/enums/LocationFilterPolicy.js +111 -0
  89. package/dist/enums/LogLevel.d.ts +13 -0
  90. package/dist/enums/LogLevel.js +16 -0
  91. package/dist/enums/LogLevelName.d.ts +1 -0
  92. package/dist/enums/LogLevelName.js +15 -0
  93. package/dist/enums/MotionActivityType.d.ts +14 -0
  94. package/dist/enums/MotionActivityType.js +17 -0
  95. package/dist/enums/NotificationPriority.d.ts +22 -0
  96. package/dist/enums/NotificationPriority.js +25 -0
  97. package/dist/enums/PersistMode.d.ts +12 -0
  98. package/dist/enums/PersistMode.js +15 -0
  99. package/dist/enums/SQLQueryOrder.d.ts +16 -0
  100. package/dist/enums/SQLQueryOrder.js +17 -0
  101. package/dist/enums/TrackingMode.d.ts +14 -0
  102. package/dist/enums/TrackingMode.js +17 -0
  103. package/dist/enums/TriggerActivity.d.ts +13 -0
  104. package/dist/enums/TriggerActivity.js +16 -0
  105. package/dist/index.d.ts +49 -0
  106. package/dist/index.js +69 -0
  107. package/dist/legacy/LegacyConfig.d.ts +24 -0
  108. package/dist/legacy/LegacyConfig.js +2 -0
  109. package/package.json +50 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Transistor Software
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,137 @@
1
+ # @transistorsoft/background-geolocation-types
2
+
3
+ Shared **TypeScript type definitions** and **generated API documentation** for Transistor Software’s Background Geolocation SDKs:
4
+
5
+ - **React Native**
6
+ - **Capacitor**
7
+ - **Cordova**
8
+
9
+ This package centralizes all public TypeScript interfaces, enums, utility types, and TypeDoc‑generated documentation shared across platform SDKs.
10
+ It contains **types only** — no runtime code.
11
+
12
+ ---
13
+
14
+ ## 📦 Installation
15
+
16
+ Install as a development dependency:
17
+
18
+ ```bash
19
+ npm install @transistorsoft/background-geolocation-types --save-dev
20
+ ```
21
+
22
+ ```bash
23
+ yarn add -D @transistorsoft/background-geolocation-types
24
+ ```
25
+
26
+ ```bash
27
+ pnpm add -D @transistorsoft/background-geolocation-types
28
+ ```
29
+
30
+ ---
31
+
32
+ ## 🎯 Purpose
33
+
34
+ This package exists to:
35
+
36
+ 1. Provide **strict, shared TypeScript types** across all Background Geolocation SDKs.
37
+ 2. Serve as the source for **Typedoc documentation**.
38
+ 3. Ensure consistent API signatures across React Native, Capacitor, and Cordova.
39
+
40
+ This avoids duplication and keeps all platform SDKs perfectly in sync.
41
+
42
+ ---
43
+
44
+ ## 📘 Using the Types
45
+
46
+ Typically, consuming SDKs re‑export all public types:
47
+
48
+ ```ts
49
+ import BackgroundGeolocation, {
50
+ Config,
51
+ GeoConfig,
52
+ HttpConfig,
53
+ PersistMode,
54
+ Location,
55
+ State
56
+ } from '{{pluginName}}';
57
+ ```
58
+
59
+ If desired, types can also be imported directly:
60
+
61
+ ```ts
62
+ import type { Location, GeofenceEvent, PersistMode }
63
+ from '@transistorsoft/background-geolocation-types';
64
+ ```
65
+
66
+ ---
67
+
68
+ ## 📚 Documentation
69
+
70
+ Generate API docs using:
71
+
72
+ ```bash
73
+ pnpm run docs
74
+ ```
75
+
76
+ This runs TypeDoc with the custom Transistorsoft plugins:
77
+
78
+ - **typedoc-plugin-templates**
79
+ - **typedoc-plugin-gitlink**
80
+ - **typedoc-plugin-mediaplayer**
81
+ - **typedoc-plugin-site**
82
+
83
+ Docs output to:
84
+
85
+ ```
86
+ ./docs
87
+ ```
88
+
89
+ ---
90
+
91
+ ## 🛠️ Development
92
+
93
+ Build the project:
94
+
95
+ ```bash
96
+ pnpm run clean && pnpm run build
97
+ ```
98
+
99
+ Watch mode:
100
+
101
+ ```bash
102
+ pnpm run watch
103
+ ```
104
+
105
+ ---
106
+
107
+ ## 📁 Structure
108
+
109
+ ```
110
+ background-geolocation-types/
111
+ ├── src/
112
+ ├── dist/
113
+ ├── docs/
114
+ ├── tools/
115
+ ├── typedoc.json
116
+ └── tsconfig.json
117
+ ```
118
+
119
+ ---
120
+
121
+ ## 🤝 Contributing
122
+
123
+ Contributions are welcome — especially improvements to TypeScript typings and documentation.
124
+
125
+ Please ensure:
126
+
127
+ - No runtime logic is added — this package is **types only**.
128
+ - Definitions remain platform‑agnostic.
129
+ - Changes reflect the APIs of all supported SDKs.
130
+
131
+ ---
132
+
133
+ ## 📄 License
134
+
135
+ Commercial license. See `LICENSE` for details.
136
+
137
+
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Main SDK API used by consumers.
3
+ * @category Primary API
4
+ */
5
+ export interface BackgroundGeolocation extends BackgroundGeolocationAPI {
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Options provided to {@link BackgroundGeolocation.getCurrentPosition}.
3
+ *
4
+ * @example
5
+ * ```typescript
6
+ * let location = await BackgroundGeolocation.getCurrentPosition({
7
+ * timeout: 30, // 30 second timeout to fetch location
8
+ * persist: true, // Defaults to state.enabled
9
+ * maximumAge: 5000, // Accept the last-known-location if not older than 5000 ms.
10
+ * desiredAccuracy: 10, // Try to fetch a location with an accuracy of `10` meters.
11
+ * samples: 3, // How many location samples to attempt.
12
+ * extras: { // Custom meta-data.
13
+ * "route_id": 123
14
+ * }
15
+ * });
16
+ * ```
17
+ * @category Primary API
18
+ */
19
+ export interface CurrentPositionRequest {
20
+ /**
21
+ * Sets the maximum number of location-samples to fetch before returning the best possible location to your `callback`. Default is `3`. Only the final Location will be persisted.
22
+ */
23
+ samples?: number;
24
+ /**
25
+ * Sets the desired accuracy of location you're attempting to fetch. When a location having `accuracy <= desiredAccuracy` is retrieved, the plugin will stop sampling and immediately return that location. Defaults to your configured [[Config.stationaryRadius]].
26
+ */
27
+ desiredAccuracy?: number;
28
+ /**
29
+ * Location-timeout in `seconds`. Default: `30`. If the timeout expires before a [[Location]] is retrieved, a [[LocationError]] will fire.
30
+ */
31
+ timeout?: number;
32
+ /**
33
+ * Defaults to `true` when plugin is `enabled`; `false`, otherwise. Set `false` to disable persisting the retrieved Location in the plugin's SQLite database.
34
+ */
35
+ persist?: boolean;
36
+ /**
37
+ * Accept the last-recorded-location if no older than supplied value in `milliseconds`. Default is `0`.
38
+ */
39
+ maximumAge?: number;
40
+ /**
41
+ * Optional meta-data to attach to the location. These `extras` will be merged to the configured [[Config.extras]] and persisted / POSTed to your server (if you've configured a [[Config.url]].
42
+ */
43
+ extras?: Record<string, any>;
44
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,77 @@
1
+ /**
2
+ * An object for redirecting a User to an Android device's settings screen from a {@link DeviceSettings} request.
3
+ *
4
+ * Contains meta-data about the device (`manufacturer`, `model`, `version`) and whether you’ve already shown this screen.
5
+ *
6
+ * @category Device
7
+ */
8
+ export interface DeviceSettingsRequest {
9
+ /** Device manufacturer (e.g., "Huawei", "Samsung"). */
10
+ manufacturer: string;
11
+ /** Device model (e.g., "P40", "SM-G991B"). */
12
+ model: string;
13
+ /** OS version string. */
14
+ version: string;
15
+ /** Whether this screen has previously been shown. */
16
+ seen: boolean;
17
+ /** Timestamp of when this screen was last shown. */
18
+ lastSeenAt: Date;
19
+ /**
20
+ * The settings screen action to be shown.
21
+ * ⚠️ Set automatically by the native layer.
22
+ */
23
+ action: string;
24
+ }
25
+ /**
26
+ * Device Settings API (types-only).
27
+ *
28
+ * Provides an API to show Android & vendor-specific Battery / Power Management settings screens that can
29
+ * affect performance of the Background Geolocation SDK on various devices.
30
+ *
31
+ * See: https://dontkillmyapp.com/
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * // Is Android device ignoring battery optimizations?
36
+ * const isIgnoring = await BackgroundGeolocation.deviceSettings.isIgnoringBatteryOptimizations();
37
+ * if (!isIgnoring) {
38
+ * const req = await BackgroundGeolocation.deviceSettings.showIgnoreBatteryOptimizations();
39
+ * if (!req.seen) {
40
+ * const confirmed = await showMyConfirmDialog({ title: 'Settings request', text: 'Please disable battery optimizations' });
41
+ * if (confirmed) {
42
+ * await BackgroundGeolocation.deviceSettings.show(req);
43
+ * }
44
+ * }
45
+ * }
46
+ * ```
47
+ * @category Device
48
+ */
49
+ export interface DeviceSettings {
50
+ /**
51
+ * Returns `true` if device is ignoring battery optimizations for your app.
52
+ *
53
+ * In most cases, the SDK performs normally with battery optimizations enabled.
54
+ */
55
+ isIgnoringBatteryOptimizations(): Promise<boolean>;
56
+ /**
57
+ * Prepare a request to show Android’s *Ignore Battery Optimizations* settings screen.
58
+ *
59
+ * Does **not** immediately redirect — returns a {@link DeviceSettingsRequest} first so you can
60
+ * decide whether to prompt the user (eg: avoid annoying them if `seen === true`).
61
+ *
62
+ * ⚠️ On some devices/OS versions, this screen may not exist; callers should `catch` errors.
63
+ */
64
+ showIgnoreBatteryOptimizations(): Promise<DeviceSettingsRequest>;
65
+ /**
66
+ * Prepare a request to show a vendor-specific “Power Manager” screen (Huawei, Xiaomi, Vivo, etc).
67
+ *
68
+ * Does **not** immediately redirect — returns a {@link DeviceSettingsRequest} first.
69
+ * Not all vendors/versions implement this screen; callers should `catch` errors.
70
+ */
71
+ showPowerManager(): Promise<DeviceSettingsRequest>;
72
+ /**
73
+ * Execute a previously prepared {@link DeviceSettingsRequest} to actually show the screen.
74
+ * Resolves `true` if the redirect was attempted.
75
+ */
76
+ show(request: DeviceSettingsRequest): Promise<boolean>;
77
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });