@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
@@ -0,0 +1,421 @@
1
+ import { SQLQueryOrder } from "../../enums/SQLQueryOrder";
2
+ /**
3
+ * Used for selecting a range of records from the SDK's log database.
4
+ *
5
+ * Used with:
6
+ * - {@link Logger.getLog}
7
+ * - {@link Logger.emailLog}
8
+ * - {@link Logger.uploadLog}
9
+ *
10
+ * ```ts
11
+ * // Constrain results between optional start/end dates using an SQLQuery
12
+ * const log = await BackgroundGeolocation.logger.getLog({
13
+ * start: Date.parse("2019-10-21 13:00"), // <-- optional HH:mm:ss
14
+ * end: Date.parse("2019-10-22")
15
+ * });
16
+ *
17
+ * // Or just a start date
18
+ * const partial = await BackgroundGeolocation.logger.getLog({
19
+ * start: Date.parse("2019-10-21 13:00")
20
+ * });
21
+ *
22
+ * // Or just an end date
23
+ * await BackgroundGeolocation.logger.uploadLog("https://my.server.com/users/123/logs", {
24
+ * end: Date.parse("2019-10-21")
25
+ * });
26
+ *
27
+ * // Select first 100 records from log (ascending)
28
+ * const Logger = BackgroundGeolocation.logger;
29
+ * await Logger.emailLog("foo@bar.com", {
30
+ * order: SQLQueryOrder.Asc,
31
+ * limit: 100
32
+ * });
33
+ *
34
+ * // Select most recent 100 records from log (descending)
35
+ * await Logger.emailLog("foo@bar.com", {
36
+ * order: SQLQueryOrder.Desc,
37
+ * limit: 100
38
+ * });
39
+ * ```
40
+ *
41
+ * @category Logger
42
+ */
43
+ export interface SQLQuery {
44
+ /**
45
+ * Start date of logs to select (unix timestamp in **milliseconds**).
46
+ */
47
+ start?: number;
48
+ /**
49
+ * End date of logs to select (unix timestamp in **milliseconds**).
50
+ */
51
+ end?: number;
52
+ /**
53
+ * Limit number of records returned.
54
+ */
55
+ limit?: number;
56
+ /**
57
+ * Offset into the result set (for paging).
58
+ */
59
+ offset?: number;
60
+ /**
61
+ * Sort order for results.
62
+ *
63
+ * - `SQLQueryOrder.Asc` → ascending by time
64
+ * - `SQLQueryOrder.Desc` → descending by time
65
+ *
66
+ * Historically this corresponded to:
67
+ * - `1` = ASC
68
+ * - `-1` = DESC
69
+ */
70
+ order?: SQLQueryOrder;
71
+ }
72
+ /**
73
+ * Logger API
74
+ *
75
+ * The Background Geolocation SDK includes powerful logging features for debugging location-tracking problems. The SDK stores log-entries for a period of {@link LoggerConfig.logMaxDays} (default `3`). The volume of logging events
76
+ * inserted into the database is controlled via {@link LoggerConfig.logLevel}.
77
+ *
78
+ * For more information, see the 📘[Debugging Guide](github:wiki/Debugging).
79
+ *
80
+ * The `Logger` API is accessed via {@link BackgroundGeolocation.logger} property:
81
+ *
82
+ * @example
83
+ * ```typescript
84
+ * let Logger = BackgroundGeolocation.logger;
85
+ * let log = await Logger.getLog();
86
+ * ```
87
+ *
88
+ * ## Fetching the Logs:
89
+ *
90
+ * Logs can be fetched from the SDK in three ways:
91
+ * 1. [[getLog]]
92
+ * 2. [[emailLog]]
93
+ * 3. [[uploadLog]]
94
+ *
95
+ * ## Inserting your own log messages
96
+ *
97
+ * You can even insert your own log messages into the SDK's Log database using the following methods:
98
+ *
99
+ * | method | logLevel | icon |
100
+ * |--------------|----------|-----------------|
101
+ * |[[error]] |`ERROR` | ❗️ |
102
+ * |[[warn]] |`WARNING` | ⚠️ |
103
+ * |[[debug]] |`DEBUG` | 🐞 |
104
+ * |[[info]] |`INFO` | ℹ️ |
105
+ * |[[notice]] |`INFO` | 🔵 |
106
+ *
107
+ * @example
108
+ * ```typescript
109
+ * let Logger = BackgroundGeolocation.logger;
110
+ * BackgroundGeolocation.onLocation((location) => {
111
+ * Logger.debug("Location received in Javascript: " + location.uuid);
112
+ * });
113
+ * ```
114
+ *
115
+ * __Example Logs__
116
+ *
117
+ * ```
118
+ * 09-19 11:12:18.716 ╔═════════════════════════════════════════════
119
+ * 09-19 11:12:18.716 ║ BackgroundGeolocation Service started
120
+ * 09-19 11:12:18.716 ╠═════════════════════════════════════════════
121
+ * 09-19 11:12:18.723 [c.t.l.BackgroundGeolocationService d]
122
+ * 09-19 11:12:18.723 ✅ Started in foreground
123
+ * 09-19 11:12:18.737 [c.t.l.ActivityRecognitionService a]
124
+ * 09-19 11:12:18.737 🎾 Start activity updates: 10000
125
+ * 09-19 11:12:18.761 [c.t.l.BackgroundGeolocationService k]
126
+ * 09-19 11:12:18.761 🔴 Stop heartbeat
127
+ * 09-19 11:12:18.768 [c.t.l.BackgroundGeolocationService a]
128
+ * 09-19 11:12:18.768 🎾 Start heartbeat (60)
129
+ * 09-19 11:12:18.778 [c.t.l.BackgroundGeolocationService a]
130
+ * 09-19 11:12:18.778 🔵 setPace: null → false
131
+ * 09-19 11:12:18.781 [c.t.l.adapter.TSConfig c] ℹ️ Persist config
132
+ * 09-19 11:12:18.794 [c.t.locationmanager.util.b a]
133
+ * 09-19 11:12:18.794 ℹ️ LocationAuthorization: Permission granted
134
+ * 09-19 11:12:18.842 [c.t.l.http.HttpService flush]
135
+ * 09-19 11:12:18.842 ╔═════════════════════════════════════════════
136
+ * 09-19 11:12:18.842 ║ HTTP Service
137
+ * 09-19 11:12:18.842 ╠═════════════════════════════════════════════
138
+ * 09-19 11:12:19.000 [c.t.l.BackgroundGeolocationService onActivityRecognitionResult] still (100%)
139
+ * 09-19 11:12:21.314 [c.t.l.l.SingleLocationRequest$2 onLocationResult]
140
+ * 09-19 11:12:21.314 ╔═════════════════════════════════════════════
141
+ * 09-19 11:12:21.314 ║ SingleLocationRequest: 1
142
+ * 09-19 11:12:21.314 ╠═════════════════════════════════════════════
143
+ * 09-19 11:12:21.314 ╟─ 📍 Location[fused 45.519239,-73.617058 hAcc=15]999923706055 vAcc=2 sAcc=??? bAcc=???
144
+ * 09-19 11:12:21.327 [c.t.l.l.TSLocationManager onSingleLocationResult]
145
+ * 09-19 11:12:21.327 🔵 Acquired motionchange position, isMoving: false
146
+ * 09-19 11:12:21.342 [c.t.l.l.TSLocationManager a] 15.243
147
+ * 09-19 11:12:21.405 [c.t.locationmanager.data.a.c persist]
148
+ * 09-19 11:12:21.405 ✅ INSERT: bca5acc8-e358-4d8f-827f-b8c0d556b7bb
149
+ * 09-19 11:12:21.423 [c.t.l.http.HttpService flush]
150
+ * 09-19 11:12:21.423 ╔═════════════════════════════════════════════
151
+ * 09-19 11:12:21.423 ║ HTTP Service
152
+ * 09-19 11:12:21.423 ╠═════════════════════════════════════════════
153
+ * 09-19 11:12:21.446 [c.t.locationmanager.data.a.c first]
154
+ * 09-19 11:12:21.446 ✅ Locked 1 records
155
+ * 09-19 11:12:21.454 [c.t.l.http.HttpService a]
156
+ * 09-19 11:12:21.454 🔵 HTTP POST: bca5acc8-e358-4d8f-827f-b8c0d556b7bb
157
+ * 09-19 11:12:22.083 [c.t.l.http.HttpService$a onResponse]
158
+ * 09-19 11:12:22.083 🔵 Response: 200
159
+ * 09-19 11:12:22.100 [c.t.locationmanager.data.a.c destroy]
160
+ * 09-19 11:12:22.100 ✅ DESTROY: bca5acc8-e358-4d8f-827f-b8c0d556b7bb
161
+ * 09-19 11:12:55.226 [c.t.l.BackgroundGeolocationService onActivityRecognitionResult] still (100%)
162
+ * ```
163
+ *
164
+ * @category Logger
165
+ */
166
+ export interface Logger {
167
+ /** Sort ascending when querying logs. Mirrors {@link Logger.ORDER_ASC} constant. */
168
+ readonly ORDER_ASC: 1;
169
+ /** Sort descending when querying logs. Mirrors {@link Logger.ORDER_DESC} constant. */
170
+ readonly ORDER_DESC: -1;
171
+ /**
172
+ * Inserts a debug log message into the SDK's log database
173
+ *
174
+ * @example
175
+ * ```typescript
176
+ * BackgroundGeolocation.logger.debug("This is a debug message");
177
+ * ```
178
+ * &nbsp;
179
+ * ```
180
+ * D TSLocationManager: [c.t.l.logger.TSLog log] This is a debug message
181
+ * ```
182
+ */
183
+ debug(message: string): void;
184
+ /**
185
+ * Inserts an "error" log message into the SDK's log database
186
+ *
187
+ * @example
188
+ * ```typescript
189
+ * BackgroundGeolocation.logger.error("Something BAD");
190
+ * ```
191
+ * &nbsp;
192
+ * ```
193
+ * E TSLocationManager: [c.t.l.logger.TSLog log]
194
+ * E TSLocationManager: ‼ Something BAD
195
+ * ```
196
+ */
197
+ error(message: string): void;
198
+ /**
199
+ * Inserts a "warning" log message into the SDK's log database
200
+ *
201
+ * @example
202
+ * ```typescript
203
+ * BackgroundGeolocation.logger.warn("Something WEIRD");
204
+ * ```
205
+ * &nbsp;
206
+ *
207
+ * ```
208
+ * E TSLocationManager: [c.t.l.logger.TSLog log]
209
+ * E TSLocationManager: ⚠️ Something WEIRD
210
+ * ```
211
+ */
212
+ warn(message: string): void;
213
+ /**
214
+ * Inserts an "info" log message into the SDK's log database
215
+ *
216
+ * @example
217
+ * ```typescript
218
+ * BackgroundGeolocation.logger.info("Something informative");
219
+ * ```
220
+ * &nbsp;
221
+ * ```
222
+ * E TSLocationManager: [c.t.l.logger.TSLog log]
223
+ * I TSLocationManager: ℹ️ Something informative
224
+ * ```
225
+ */
226
+ info(message: string): void;
227
+ /**
228
+ * Inserts a "notice" log message into the SDK's log database
229
+ *
230
+ * @example
231
+ * ```typescript
232
+ * BackgroundGeolocation.logger.notice("A Notice");
233
+ * ```
234
+ * &nbsp;
235
+ * ```
236
+ * E TSLocationManager: [c.t.l.logger.TSLog log]
237
+ * I TSLocationManager: 🔵 A Notice
238
+ * ```
239
+ */
240
+ notice(message: string): void;
241
+ /**
242
+ * Returns the records from log database as a `String`. Provide an optional {@link SQLQuery} to contrain results between dates.
243
+ *
244
+ * Depending on the configured {@link LoggerConfig.logLevel}, the plugin can store an *immense* amount of helpful logging information for debugging location-tracking
245
+ * problems.
246
+ *
247
+ * __ℹ️ See also:__
248
+ * - {@link LoggerConfig.logMaxDays} (default `3` days)
249
+ * - {@link LoggerConfig.logLevel} (default {@link LogLevel.Off})
250
+ * - {@link emailLog}
251
+ * - {@link uploadLog}
252
+ * - {@link getLog}
253
+ * - 📘[Debugging Guide](github:wiki/Debugging)
254
+ *
255
+ * @example
256
+ * ```typescript
257
+ * BackgroundGeolocation.logger.getLog().then((log) => {
258
+ * // Warning: this string could be several megabytes.
259
+ * console.log("[log] success: ", log);
260
+ * });
261
+ *
262
+ * // Or constrain results by providing a SQLQuery
263
+ * let Logger = BackgroundGeolocation.logger;
264
+ *
265
+ * let log = await Logger.getLog({
266
+ * start: Date.parse("2019-09-19 11:12"),
267
+ * end: Date.parse("2019-09-19 11:13"),
268
+ * order: Logger.ORDER_ASC,
269
+ * limit: 100
270
+ * });
271
+ * ```
272
+ *
273
+ * ```
274
+ * 09-19 11:12:18.716 ╔═════════════════════════════════════════════
275
+ * 09-19 11:12:18.716 ║ BackgroundGeolocation Service started
276
+ * 09-19 11:12:18.716 ╠═════════════════════════════════════════════
277
+ * 09-19 11:12:18.723 [c.t.l.BackgroundGeolocationService d]
278
+ * 09-19 11:12:18.723 ✅ Started in foreground
279
+ * 09-19 11:12:18.737 [c.t.l.ActivityRecognitionService a]
280
+ * 09-19 11:12:18.737 🎾 Start activity updates: 10000
281
+ * 09-19 11:12:18.761 [c.t.l.BackgroundGeolocationService k]
282
+ * 09-19 11:12:18.761 🔴 Stop heartbeat
283
+ * 09-19 11:12:18.768 [c.t.l.BackgroundGeolocationService a]
284
+ * 09-19 11:12:18.768 🎾 Start heartbeat (60)
285
+ * 09-19 11:12:18.778 [c.t.l.BackgroundGeolocationService a]
286
+ * 09-19 11:12:18.778 🔵 setPace: null → false
287
+ * 09-19 11:12:18.781 [c.t.l.adapter.TSConfig c] ℹ️ Persist config
288
+ * 09-19 11:12:18.794 [c.t.locationmanager.util.b a]
289
+ * 09-19 11:12:18.794 ℹ️ LocationAuthorization: Permission granted
290
+ * 09-19 11:12:18.842 [c.t.l.http.HttpService flush]
291
+ * 09-19 11:12:18.842 ╔═════════════════════════════════════════════
292
+ * 09-19 11:12:18.842 ║ HTTP Service
293
+ * 09-19 11:12:18.842 ╠═════════════════════════════════════════════
294
+ * 09-19 11:12:19.000 [c.t.l.BackgroundGeolocationService onActivityRecognitionResult] still (100%)
295
+ * 09-19 11:12:21.314 [c.t.l.l.SingleLocationRequest$2 onLocationResult]
296
+ * 09-19 11:12:21.314 ╔═════════════════════════════════════════════
297
+ * 09-19 11:12:21.314 ║ SingleLocationRequest: 1
298
+ * 09-19 11:12:21.314 ╠═════════════════════════════════════════════
299
+ * 09-19 11:12:21.314 ╟─ 📍 Location[fused 45.519239,-73.617058 hAcc=15]999923706055 vAcc=2 sAcc=??? bAcc=???
300
+ * 09-19 11:12:21.327 [c.t.l.l.TSLocationManager onSingleLocationResult]
301
+ * 09-19 11:12:21.327 🔵 Acquired motionchange position, isMoving: false
302
+ * 09-19 11:12:21.342 [c.t.l.l.TSLocationManager a] 15.243
303
+ * 09-19 11:12:21.405 [c.t.locationmanager.data.a.c persist]
304
+ * 09-19 11:12:21.405 ✅ INSERT: bca5acc8-e358-4d8f-827f-b8c0d556b7bb
305
+ * 09-19 11:12:21.423 [c.t.l.http.HttpService flush]
306
+ * 09-19 11:12:21.423 ╔═════════════════════════════════════════════
307
+ * 09-19 11:12:21.423 ║ HTTP Service
308
+ * 09-19 11:12:21.423 ╠═════════════════════════════════════════════
309
+ * 09-19 11:12:21.446 [c.t.locationmanager.data.a.c first]
310
+ * 09-19 11:12:21.446 ✅ Locked 1 records
311
+ * 09-19 11:12:21.454 [c.t.l.http.HttpService a]
312
+ * 09-19 11:12:21.454 🔵 HTTP POST: bca5acc8-e358-4d8f-827f-b8c0d556b7bb
313
+ * 09-19 11:12:22.083 [c.t.l.http.HttpService$a onResponse]
314
+ * 09-19 11:12:22.083 🔵 Response: 200
315
+ * 09-19 11:12:22.100 [c.t.locationmanager.data.a.c destroy]
316
+ * 09-19 11:12:22.100 ✅ DESTROY: bca5acc8-e358-4d8f-827f-b8c0d556b7bb
317
+ * 09-19 11:12:55.226 [c.t.l.BackgroundGeolocationService onActivityRecognitionResult] still (100%)
318
+ *```
319
+ */
320
+ getLog(query?: SQLQuery): Promise<string>;
321
+ /**
322
+ * Email the result of {@link Logger.getLog} using device's mail client.
323
+ *
324
+ * @example
325
+ * ```typescript
326
+ * let Logger = BackgroundGeolocation.logger;
327
+ * Logger.emailLog("foo@bar.com").then((success) => {
328
+ * console.log("[emailLog] success");
329
+ * }).catch((error) => {
330
+ * console.log("[emailLog] FAILURE: ", error);
331
+ * });
332
+ *
333
+ * // Or constrain results by providing a SQLQuery
334
+ * Logger.emailLog("foo@bar.com", {
335
+ * start: Date.parse("2019-09-19"),
336
+ * end: Date.parse("2019-09-20"),
337
+ * order: Logger.ORDER_ASC,
338
+ * limit: 1000
339
+ * });
340
+ * ```
341
+ *
342
+ * __ℹ️ See also:__
343
+ * - {@link LoggerConfig.logLevel}
344
+ * - {@link Logger.getLog}
345
+ * - {@link Logger.uploadLog}
346
+ * - 📘[Debugging Guide](github:wiki/Debugging).
347
+ */
348
+ emailLog(email: string, query?: SQLQuery): Promise<void | boolean>;
349
+ /**
350
+ * Upload the result of {@link getLog} to provided url. Provide an optional {@link SQLQuery} to contrain results between dates. The file-upload
351
+ * request will attach your configured {@link HttpConfig.headers} for authentication.
352
+ *
353
+ * @example
354
+ *
355
+ * ```typescript
356
+ * BackgroundGeolocation.logger.uploadLog("https://my.server.com/users/123/logs").then((success) => {
357
+ * console.log("[uploadLog] success");
358
+ * }).catch((error) => {
359
+ * console.log("[uploadLog] FAILURE:", error);
360
+ * });
361
+ *
362
+ * // Or constrain results by providing a [SQLQuery]:
363
+ * BackgroundGeolocation.logger.uploadLog("https://my.server.com/users/123/logs", {
364
+ * start: Date.parse("2019-10-20 09:00"),
365
+ * end: Date.parse("2019-10-20 11:59")
366
+ * }).then((success) => {
367
+ * console.log("[uploadLog] success");
368
+ * }).catch((error) => {
369
+ * console.log("[uploadLog] FAILURE:", error);
370
+ * });
371
+ * ```
372
+ *
373
+ * __MultiPart File Upload__
374
+ * The SDK will upload the gzipped log-file to your server as a *Multi-part* file upload, the same log-file as used in {@link emailLog}. This is what I see with my [Node server](https://github.com/transistorsoft/background-geolocation-console) at `request.files`:
375
+ *
376
+ * ```typescript
377
+ * app.post("/log", async function(req, res) {
378
+ * console.log("[body]: ", req.body);
379
+ * console.log("[files]: ", req.files);
380
+ * res.status(200).send();
381
+ * });
382
+ * ```
383
+ * ![](https://dl.dropbox.com/s/cn86cu0vieor0j4/uploadLog-npm-server-request.png?dl=1)
384
+ *
385
+ * __Form Part__
386
+ *
387
+ * In addition to the log-file, the SDK will upload a form as well, containing the following parameters:
388
+ *
389
+ * | Key | Value |
390
+ * |--------------|------------------------------------------|
391
+ * | **`state`** | *JSON-encoded result of SDK's `#getState`*|
392
+ * | **`model`** | *Device model* |
393
+ * | **`manufacturer`** | *Device manufacturer* |
394
+ * | **`platform`** | *iOS or Android* |
395
+ * | **`version`** | *OS version* |
396
+ *
397
+ * ### ℹ️ See also:
398
+ * - {@link LoggerConfig.logLevel}
399
+ * - {@link getLog}
400
+ * - {@link emailLog}
401
+ * - {@link destroyLog}
402
+ * - 📘[Debugging Guide](github:wiki/Debugging).
403
+ */
404
+ uploadLog(url: string, query?: SQLQuery): Promise<void | boolean>;
405
+ /**
406
+ * Destroy the entire contents of SDK's log database.
407
+ *
408
+ * @example
409
+ * ```typescript
410
+ * BackgroundGeolocation.logger.destroyLog();
411
+ * ```
412
+ *
413
+ * __ℹ️ See also:__
414
+ * - {@link LoggerConfig.logLevel}
415
+ * - {@link getLog}
416
+ * - {@link emailLog}
417
+ * - {@link uploadLog}
418
+ * - 📘[Debugging Guide](github:wiki/Debugging)
419
+ */
420
+ destroyLog(): Promise<void>;
421
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,75 @@
1
+ import type { Config } from '../config/Config';
2
+ import type { TrackingMode } from '../../enums/TrackingMode';
3
+ /**
4
+ * Effective runtime state returned by `BackgroundGeolocation.ready/getState`.
5
+ *
6
+ * `State` **is** the active {@link Config} (compound), plus runtime-only fields.
7
+ *
8
+ * @category Primary API
9
+ */
10
+ export interface State extends Config {
11
+ /** Whether the SDK has been enabled via `start` or `startGeofences`. */
12
+ enabled: boolean;
13
+ /**
14
+ * Whether the SDK is currently in the *moving* state (vs stationary).
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * // If the SDK is currently in the *stationary* state, with State.isMoving == false:
19
+ *
20
+ * BackgroundGeolocation.onMotionChange((isMoving) => {
21
+ * console.log('[onMotionChange] isMoving?', isMoving);
22
+ * });
23
+ *
24
+ * await BackgroundGeolocation.changePace(true);
25
+ * // State.isMoving is now true.
26
+ * ```
27
+ */
28
+ isMoving: boolean;
29
+ /**
30
+ * `true` when a schedule is configured and `startSchedule()` executed.
31
+ * `stopSchedule()` will set this to `false`.
32
+ */
33
+ schedulerEnabled: boolean;
34
+ /**
35
+ * Tracking mode.
36
+ *
37
+ * | Value | Name | Description |
38
+ * |------:|------------|-------------------------------|
39
+ * | 0 | Geofences | Monitor geofences only. |
40
+ * | 1 | Location | Monitor location + geofences. |
41
+ *
42
+ * @example
43
+ * ```typescript
44
+ * await BackgroundGeolocation.start();
45
+ *
46
+ * const state = await BackgroundGeolocation.getState();
47
+ * console.log('Tracking mode:', state.trackingMode);
48
+ * > 'Tracking mode: 1'
49
+ *
50
+ * await BackgroundGeolocation.startGeofences();
51
+ * console.log('Tracking mode:', state.trackingMode);
52
+ * > 'Tracking mode: 0'
53
+ * ```
54
+ */
55
+ trackingMode: TrackingMode;
56
+ /**
57
+ * Current distance-traveled in meters.
58
+ * See: {@link odometerError}, {@link BackgroundGeolocation.setOdometer}, {@link BackgroundGeolocation.getOdometer}.
59
+ */
60
+ odometer: number;
61
+ /**
62
+ * The accumulated error in the odometer (in meters).
63
+ */
64
+ odometerError: number;
65
+ /**
66
+ * iOS only. `true` when the app was launched in the background due to a
67
+ * background event (fetch, geofence exit, stationary geofence exit).
68
+ * Always `false` on Android.
69
+ */
70
+ didLaunchInBackground: boolean;
71
+ /**
72
+ * Indicates if the app was launched after a device reboot.
73
+ */
74
+ didDeviceReboot: boolean;
75
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });