@telemetryos/root-sdk 1.2.0 → 1.4.0
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/CHANGELOG.md +16 -0
- package/README.md +68 -13
- package/dist/client.d.ts +44 -3
- package/dist/device.d.ts +26 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +53 -8
- package/dist/index.js +447 -198
- package/dist/media.d.ts +13 -24
- package/dist/proxy.d.ts +48 -0
- package/dist/root-settings-navigation.d.ts +1 -1
- package/dist/users.d.ts +1 -4
- package/dist/weather.d.ts +214 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { z as
|
|
2
|
-
const
|
|
3
|
-
version:
|
|
1
|
+
import { z as N } from "./index-B98VDFRY.js";
|
|
2
|
+
const q = "1.4.0", A = {
|
|
3
|
+
version: q
|
|
4
4
|
};
|
|
5
|
-
class
|
|
5
|
+
class E {
|
|
6
6
|
constructor(e) {
|
|
7
7
|
this._client = e;
|
|
8
8
|
}
|
|
@@ -15,10 +15,13 @@ class q {
|
|
|
15
15
|
* @returns A promise that resolves to the current account object
|
|
16
16
|
*/
|
|
17
17
|
async getCurrent() {
|
|
18
|
-
|
|
18
|
+
const e = await this._client.request("accounts.getCurrent", {});
|
|
19
|
+
if (!e.success)
|
|
20
|
+
throw new Error("Failed to fetch current account");
|
|
21
|
+
return e.account;
|
|
19
22
|
}
|
|
20
23
|
}
|
|
21
|
-
class
|
|
24
|
+
class I {
|
|
22
25
|
constructor(e) {
|
|
23
26
|
this._client = e;
|
|
24
27
|
}
|
|
@@ -36,7 +39,7 @@ class P {
|
|
|
36
39
|
* @returns A promise that resolves to an array of applications having the specified mount point
|
|
37
40
|
*/
|
|
38
41
|
async getAllByMountPoint(e) {
|
|
39
|
-
return (await this._client.request("applications.
|
|
42
|
+
return (await this._client.request("applications.getAllByMountPoint", {
|
|
40
43
|
mountPoint: e
|
|
41
44
|
})).applications;
|
|
42
45
|
}
|
|
@@ -80,10 +83,34 @@ class P {
|
|
|
80
83
|
});
|
|
81
84
|
}
|
|
82
85
|
}
|
|
83
|
-
|
|
86
|
+
class P {
|
|
87
|
+
constructor(e) {
|
|
88
|
+
this._client = e;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Retrieves hardware information about the current physical device.
|
|
92
|
+
*
|
|
93
|
+
* This method returns details about the device running the application, such as
|
|
94
|
+
* serial number, model, manufacturer, and platform. This information is only
|
|
95
|
+
* available when running on a physical device (player), not in the admin UI.
|
|
96
|
+
*
|
|
97
|
+
* @returns A promise that resolves to the device hardware information
|
|
98
|
+
* @example
|
|
99
|
+
* // Get hardware info of the current device
|
|
100
|
+
* const info = await devices.getInformation();
|
|
101
|
+
* console.log(`Device: ${info.deviceManufacturer} ${info.deviceModel}`);
|
|
102
|
+
*/
|
|
103
|
+
async getInformation() {
|
|
104
|
+
const e = await this._client.request("devices.getInformation", {});
|
|
105
|
+
if (!e.success)
|
|
106
|
+
throw new Error("Failed to get device information");
|
|
107
|
+
return e.deviceInformation;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function F(o, e = console.error) {
|
|
84
111
|
o().catch(e);
|
|
85
112
|
}
|
|
86
|
-
class
|
|
113
|
+
class D {
|
|
87
114
|
constructor(e) {
|
|
88
115
|
this._client = e;
|
|
89
116
|
}
|
|
@@ -91,7 +118,7 @@ class R {
|
|
|
91
118
|
return (await this._client.request("environment.getColorScheme", {})).colorScheme;
|
|
92
119
|
}
|
|
93
120
|
subscribeColorScheme(e) {
|
|
94
|
-
|
|
121
|
+
F(async () => {
|
|
95
122
|
this._client.on("environment.colorSchemeChanged", e), e(await this.getColorScheme());
|
|
96
123
|
});
|
|
97
124
|
}
|
|
@@ -99,70 +126,53 @@ class R {
|
|
|
99
126
|
this._client.off("environment.colorSchemeChanged", e);
|
|
100
127
|
}
|
|
101
128
|
}
|
|
102
|
-
class
|
|
129
|
+
class M {
|
|
103
130
|
constructor(e) {
|
|
104
131
|
this._client = e;
|
|
105
132
|
}
|
|
106
133
|
/**
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
* This method allows you to search for media folders that match specific criteria,
|
|
110
|
-
* such as name, ID, or other folder properties.
|
|
134
|
+
* Retrieves all media folders in the account.
|
|
111
135
|
*
|
|
112
|
-
* @
|
|
113
|
-
* @returns A promise that resolves to an array of matching media folders
|
|
136
|
+
* @returns A promise that resolves to an array of all media folders
|
|
114
137
|
*/
|
|
115
|
-
async
|
|
116
|
-
return (await this._client.request("
|
|
117
|
-
query: e
|
|
118
|
-
})).folders;
|
|
138
|
+
async getAllFolders() {
|
|
139
|
+
return (await this._client.request("mediaFolders.getAll", {})).folders;
|
|
119
140
|
}
|
|
120
141
|
/**
|
|
121
|
-
* Retrieves media
|
|
142
|
+
* Retrieves all media content within a specific folder.
|
|
122
143
|
*
|
|
123
|
-
* @param
|
|
124
|
-
* @returns A promise that resolves to an array of media
|
|
144
|
+
* @param folderId The unique identifier of the folder
|
|
145
|
+
* @returns A promise that resolves to an array of media content in the folder
|
|
125
146
|
*/
|
|
126
|
-
async
|
|
127
|
-
return (await this._client.request("media.
|
|
128
|
-
|
|
129
|
-
})).
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Retrieves a specific media folder by its ID.
|
|
133
|
-
*
|
|
134
|
-
* @param id The unique identifier of the folder to retrieve
|
|
135
|
-
* @returns A promise that resolves to the media folder with the specified ID
|
|
136
|
-
*/
|
|
137
|
-
async getFolderById(e) {
|
|
138
|
-
return (await this._client.request("media.getMediaFolderById", {
|
|
139
|
-
id: e
|
|
140
|
-
})).folder;
|
|
147
|
+
async getAllByFolderId(e) {
|
|
148
|
+
return (await this._client.request("media.getAllByFolderId", {
|
|
149
|
+
folderId: e
|
|
150
|
+
})).contents;
|
|
141
151
|
}
|
|
142
152
|
/**
|
|
143
|
-
* Retrieves
|
|
153
|
+
* Retrieves media content that has been tagged with a specific tag.
|
|
144
154
|
*
|
|
145
|
-
* @param
|
|
146
|
-
* @returns A promise that resolves to an array of media content
|
|
155
|
+
* @param tagName The name of the tag to search for
|
|
156
|
+
* @returns A promise that resolves to an array of media content with the specified tag
|
|
147
157
|
*/
|
|
148
|
-
async
|
|
149
|
-
return (await this._client.request("media.
|
|
150
|
-
|
|
151
|
-
})).
|
|
158
|
+
async getAllByTag(e) {
|
|
159
|
+
return (await this._client.request("media.getAllByTag", {
|
|
160
|
+
tagName: e
|
|
161
|
+
})).contents;
|
|
152
162
|
}
|
|
153
163
|
/**
|
|
154
164
|
* Retrieves a specific media content item by its ID.
|
|
155
165
|
*
|
|
156
166
|
* @param id The unique identifier of the media content to retrieve
|
|
157
|
-
* @returns A promise that resolves to the media content
|
|
167
|
+
* @returns A promise that resolves to the media content with the specified ID
|
|
158
168
|
*/
|
|
159
|
-
async
|
|
160
|
-
return (await this._client.request("media.
|
|
169
|
+
async getById(e) {
|
|
170
|
+
return (await this._client.request("media.getById", {
|
|
161
171
|
id: e
|
|
162
172
|
})).content;
|
|
163
173
|
}
|
|
164
174
|
}
|
|
165
|
-
class
|
|
175
|
+
class B {
|
|
166
176
|
constructor(e) {
|
|
167
177
|
this._client = e;
|
|
168
178
|
}
|
|
@@ -176,7 +186,7 @@ class k {
|
|
|
176
186
|
* @returns A StoreSlice instance for the application scope
|
|
177
187
|
*/
|
|
178
188
|
get application() {
|
|
179
|
-
return new
|
|
189
|
+
return new _("application", "", this._client);
|
|
180
190
|
}
|
|
181
191
|
/**
|
|
182
192
|
* Provides access to the instance store scope.
|
|
@@ -190,7 +200,7 @@ class k {
|
|
|
190
200
|
* @returns A StoreSlice instance for the instance scope
|
|
191
201
|
*/
|
|
192
202
|
get instance() {
|
|
193
|
-
return new
|
|
203
|
+
return new _("instance", this._client.applicationSpecifier, this._client);
|
|
194
204
|
}
|
|
195
205
|
/**
|
|
196
206
|
* Provides access to the device store scope.
|
|
@@ -205,7 +215,7 @@ class k {
|
|
|
205
215
|
* @returns A StoreSlice instance for the device scope
|
|
206
216
|
*/
|
|
207
217
|
get device() {
|
|
208
|
-
return new
|
|
218
|
+
return new _("device", this._client.applicationSpecifier, this._client);
|
|
209
219
|
}
|
|
210
220
|
/**
|
|
211
221
|
* Provides access to the shared store scope with a specified namespace.
|
|
@@ -221,12 +231,12 @@ class k {
|
|
|
221
231
|
* @returns A StoreSlice instance for the specified shared namespace
|
|
222
232
|
*/
|
|
223
233
|
shared(e) {
|
|
224
|
-
return new
|
|
234
|
+
return new _("shared", e, this._client);
|
|
225
235
|
}
|
|
226
236
|
}
|
|
227
|
-
class
|
|
228
|
-
constructor(e, t,
|
|
229
|
-
this._kind = e, this._namespace = t, this._client =
|
|
237
|
+
class _ {
|
|
238
|
+
constructor(e, t, n) {
|
|
239
|
+
this._kind = e, this._namespace = t, this._client = n;
|
|
230
240
|
}
|
|
231
241
|
/**
|
|
232
242
|
* Saves a value in the store.
|
|
@@ -318,7 +328,7 @@ class w {
|
|
|
318
328
|
})).success;
|
|
319
329
|
}
|
|
320
330
|
}
|
|
321
|
-
class
|
|
331
|
+
class C {
|
|
322
332
|
constructor(e) {
|
|
323
333
|
this._client = e;
|
|
324
334
|
}
|
|
@@ -335,14 +345,156 @@ class E {
|
|
|
335
345
|
* console.log(`Current user ID: ${userResult.user.id}`);
|
|
336
346
|
*/
|
|
337
347
|
async getCurrent() {
|
|
338
|
-
|
|
348
|
+
const e = await this._client.request("users.getCurrent", {});
|
|
349
|
+
if (!e.success)
|
|
350
|
+
throw new Error("Failed to fetch current user");
|
|
351
|
+
return e.user;
|
|
339
352
|
}
|
|
340
353
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
354
|
+
class k {
|
|
355
|
+
constructor(e) {
|
|
356
|
+
this._client = e;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Retrieves current weather conditions for a specified location using WeatherBit.
|
|
360
|
+
*
|
|
361
|
+
* @param params - Weather request parameters including location and units
|
|
362
|
+
* @returns A promise that resolves to the current weather conditions
|
|
363
|
+
* @throws {Error} If the request fails or location is invalid
|
|
364
|
+
*
|
|
365
|
+
* @example
|
|
366
|
+
* ```typescript
|
|
367
|
+
* // Get weather by city
|
|
368
|
+
* const weather = await weather.getConditions({ city: 'New York', units: 'imperial' })
|
|
369
|
+
*
|
|
370
|
+
* // Get weather by postal code
|
|
371
|
+
* const weather = await weather.getConditions({ postalCode: '10001', units: 'metric' })
|
|
372
|
+
*
|
|
373
|
+
* // Get weather by coordinates
|
|
374
|
+
* const weather = await weather.getConditions({ lat: '40.7128', lon: '-74.0060' })
|
|
375
|
+
* ```
|
|
376
|
+
*/
|
|
377
|
+
async getConditions(e) {
|
|
378
|
+
const t = await this._client.request("weather.getConditions", e);
|
|
379
|
+
if (!t.success || !t.conditions)
|
|
380
|
+
throw new Error(t.error || "Failed to fetch weather conditions");
|
|
381
|
+
return t.conditions;
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Retrieves daily weather forecast for a specified location using WeatherBit.
|
|
385
|
+
*
|
|
386
|
+
* @param params - Forecast request parameters including location, units, and number of days
|
|
387
|
+
* @returns A promise that resolves to an array of daily forecast data
|
|
388
|
+
* @throws {Error} If the request fails or location is invalid
|
|
389
|
+
*
|
|
390
|
+
* @example
|
|
391
|
+
* ```typescript
|
|
392
|
+
* // Get 5-day forecast
|
|
393
|
+
* const forecast = await weather.getDailyForecast({
|
|
394
|
+
* city: 'London',
|
|
395
|
+
* units: 'metric',
|
|
396
|
+
* days: 5
|
|
397
|
+
* })
|
|
398
|
+
* ```
|
|
399
|
+
*/
|
|
400
|
+
async getDailyForecast(e) {
|
|
401
|
+
const t = await this._client.request("weather.getDailyForecast", e);
|
|
402
|
+
if (!t.success || !t.forecast)
|
|
403
|
+
throw new Error(t.error || "Failed to fetch daily forecast");
|
|
404
|
+
return t.forecast;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Retrieves hourly weather forecast for a specified location using WeatherBit.
|
|
408
|
+
*
|
|
409
|
+
* @param params - Forecast request parameters including location, units, and number of hours
|
|
410
|
+
* @returns A promise that resolves to an array of hourly forecast data
|
|
411
|
+
* @throws {Error} If the request fails or location is invalid
|
|
412
|
+
*
|
|
413
|
+
* @example
|
|
414
|
+
* ```typescript
|
|
415
|
+
* // Get 24-hour forecast
|
|
416
|
+
* const forecast = await weather.getHourlyForecast({
|
|
417
|
+
* city: 'Tokyo',
|
|
418
|
+
* units: 'metric',
|
|
419
|
+
* hours: 24
|
|
420
|
+
* })
|
|
421
|
+
* ```
|
|
422
|
+
*/
|
|
423
|
+
async getHourlyForecast(e) {
|
|
424
|
+
const t = await this._client.request("weather.getHourlyForecast", e);
|
|
425
|
+
if (!t.success || !t.forecast)
|
|
426
|
+
throw new Error(t.error || "Failed to fetch hourly forecast");
|
|
427
|
+
return t.forecast;
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Retrieves current weather conditions using AccuWeather.
|
|
431
|
+
*
|
|
432
|
+
* @param params - Weather request parameters including location and units
|
|
433
|
+
* @returns A promise that resolves to the AccuWeather conditions data
|
|
434
|
+
* @throws {Error} If the request fails or location is invalid
|
|
435
|
+
*
|
|
436
|
+
* @example
|
|
437
|
+
* ```typescript
|
|
438
|
+
* const weather = await weather.getAccuWeatherConditions({
|
|
439
|
+
* city: 'Paris',
|
|
440
|
+
* units: 'metric'
|
|
441
|
+
* })
|
|
442
|
+
* ```
|
|
443
|
+
*/
|
|
444
|
+
async getAccuWeatherConditions(e) {
|
|
445
|
+
const t = await this._client.request("weather.getAccuWeatherConditions", e);
|
|
446
|
+
if (!t.success || !t.data)
|
|
447
|
+
throw new Error(t.error || "Failed to fetch AccuWeather conditions");
|
|
448
|
+
return t.data;
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Retrieves daily forecast using AccuWeather.
|
|
452
|
+
*
|
|
453
|
+
* @param params - Forecast request parameters including location and units
|
|
454
|
+
* @returns A promise that resolves to the AccuWeather daily forecast data
|
|
455
|
+
* @throws {Error} If the request fails or location is invalid
|
|
456
|
+
*
|
|
457
|
+
* @example
|
|
458
|
+
* ```typescript
|
|
459
|
+
* const forecast = await weather.getAccuWeatherDailyForecast({
|
|
460
|
+
* city: 'Sydney',
|
|
461
|
+
* units: 'metric'
|
|
462
|
+
* })
|
|
463
|
+
* ```
|
|
464
|
+
*/
|
|
465
|
+
async getAccuWeatherDailyForecast(e) {
|
|
466
|
+
const t = await this._client.request("weather.getAccuWeatherDailyForecast", e);
|
|
467
|
+
if (!t.success || !t.data)
|
|
468
|
+
throw new Error(t.error || "Failed to fetch AccuWeather daily forecast");
|
|
469
|
+
return t.data;
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Retrieves hourly forecast using AccuWeather.
|
|
473
|
+
*
|
|
474
|
+
* @param params - Forecast request parameters including location and units
|
|
475
|
+
* @returns A promise that resolves to the AccuWeather hourly forecast data
|
|
476
|
+
* @throws {Error} If the request fails or location is invalid
|
|
477
|
+
*
|
|
478
|
+
* @example
|
|
479
|
+
* ```typescript
|
|
480
|
+
* const forecast = await weather.getAccuWeatherHourlyForecast({
|
|
481
|
+
* city: 'Berlin',
|
|
482
|
+
* units: 'metric'
|
|
483
|
+
* })
|
|
484
|
+
* ```
|
|
485
|
+
*/
|
|
486
|
+
async getAccuWeatherHourlyForecast(e) {
|
|
487
|
+
const t = await this._client.request("weather.getAccuWeatherHourlyForecast", e);
|
|
488
|
+
if (!t.success || !t.data)
|
|
489
|
+
throw new Error(t.error || "Failed to fetch AccuWeather hourly forecast");
|
|
490
|
+
return t.data;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
const T = N.object({
|
|
494
|
+
name: N.string(),
|
|
495
|
+
data: N.any()
|
|
344
496
|
});
|
|
345
|
-
class
|
|
497
|
+
class $ {
|
|
346
498
|
/**
|
|
347
499
|
* Creates a new RootSettingsNavigation API instance.
|
|
348
500
|
*
|
|
@@ -350,7 +502,7 @@ class A {
|
|
|
350
502
|
* @throws {Error} If used by an application not mounted at the 'rootSettingsNavigation' mount point
|
|
351
503
|
*/
|
|
352
504
|
constructor(e) {
|
|
353
|
-
if (e._client.
|
|
505
|
+
if (e._client._applicationSpecifier !== "rootSettingsNavigation")
|
|
354
506
|
throw new Error("RootSettingsNavigation can only be used in the rootSettingsNavigation mount point");
|
|
355
507
|
this._store = e;
|
|
356
508
|
}
|
|
@@ -365,11 +517,11 @@ class A {
|
|
|
365
517
|
* @returns A promise that resolves when the navigation has been registered
|
|
366
518
|
*/
|
|
367
519
|
async setRootSettingsNavigation(e) {
|
|
368
|
-
const t = this._store.shared("root-settings-navigation"),
|
|
369
|
-
|
|
370
|
-
|
|
520
|
+
const t = this._store.shared("root-settings-navigation"), n = await t.get("navigation"), r = this._store._client._applicationSpecifier;
|
|
521
|
+
n[r] = {
|
|
522
|
+
applicationSpecifier: r,
|
|
371
523
|
entries: e.entries
|
|
372
|
-
}, t.set("navigation",
|
|
524
|
+
}, t.set("navigation", n);
|
|
373
525
|
}
|
|
374
526
|
/**
|
|
375
527
|
* Retrieves the current navigation entries for this root application.
|
|
@@ -380,8 +532,8 @@ class A {
|
|
|
380
532
|
* @returns A promise that resolves to the navigation state for this application
|
|
381
533
|
*/
|
|
382
534
|
async getRootSettingsNavigation() {
|
|
383
|
-
const t = await this._store.shared("root-settings-navigation").get("navigation"),
|
|
384
|
-
return t[
|
|
535
|
+
const t = await this._store.shared("root-settings-navigation").get("navigation"), n = this._store._client._applicationSpecifier;
|
|
536
|
+
return t[n];
|
|
385
537
|
}
|
|
386
538
|
/**
|
|
387
539
|
* Retrieves the navigation entries for all root applications.
|
|
@@ -396,8 +548,47 @@ class A {
|
|
|
396
548
|
return this._store.shared("root-settings-navigation").get("navigation");
|
|
397
549
|
}
|
|
398
550
|
}
|
|
551
|
+
class x {
|
|
552
|
+
constructor(e) {
|
|
553
|
+
this._client = e;
|
|
554
|
+
}
|
|
555
|
+
async fetch(e, t) {
|
|
556
|
+
let n;
|
|
557
|
+
typeof e == "string" ? n = e : e instanceof URL ? n = e.toString() : (n = e.url, t || (t = {
|
|
558
|
+
method: e.method,
|
|
559
|
+
headers: e.headers,
|
|
560
|
+
body: e.body,
|
|
561
|
+
credentials: e.credentials,
|
|
562
|
+
cache: e.cache,
|
|
563
|
+
redirect: e.redirect,
|
|
564
|
+
referrer: e.referrer,
|
|
565
|
+
integrity: e.integrity
|
|
566
|
+
}));
|
|
567
|
+
let r = {};
|
|
568
|
+
t != null && t.headers && (t.headers instanceof Headers ? t.headers.forEach((p, c) => {
|
|
569
|
+
r[c] = p;
|
|
570
|
+
}) : Array.isArray(t.headers) ? t.headers.forEach(([p, c]) => {
|
|
571
|
+
r[p] = c;
|
|
572
|
+
}) : r = t.headers);
|
|
573
|
+
const s = await this._client.request("proxy.fetch", {
|
|
574
|
+
url: n,
|
|
575
|
+
method: (t == null ? void 0 : t.method) || "GET",
|
|
576
|
+
headers: r,
|
|
577
|
+
body: (t == null ? void 0 : t.body) || null
|
|
578
|
+
});
|
|
579
|
+
if (!s.success)
|
|
580
|
+
throw new Error(`Proxy fetch failed: ${s.statusText}`);
|
|
581
|
+
const l = new Headers(s.headers), u = {
|
|
582
|
+
status: s.status,
|
|
583
|
+
statusText: s.statusText,
|
|
584
|
+
headers: l
|
|
585
|
+
};
|
|
586
|
+
let a = null;
|
|
587
|
+
return s.body !== null && s.body !== void 0 && (typeof s.body == "string" || s.body instanceof ArrayBuffer ? a = s.body : typeof s.body == "object" && (a = JSON.stringify(s.body))), new Response(a, u);
|
|
588
|
+
}
|
|
589
|
+
}
|
|
399
590
|
const g = 1e3 * 30;
|
|
400
|
-
class
|
|
591
|
+
class W {
|
|
401
592
|
/**
|
|
402
593
|
* Creates a new Client instance for communicating with the TelemetryOS platform.
|
|
403
594
|
*
|
|
@@ -423,7 +614,7 @@ class T {
|
|
|
423
614
|
* @returns An Accounts instance bound to this client
|
|
424
615
|
*/
|
|
425
616
|
get accounts() {
|
|
426
|
-
return new
|
|
617
|
+
return new E(this);
|
|
427
618
|
}
|
|
428
619
|
/**
|
|
429
620
|
* Provides access to the users API for retrieving TelemetryOS user information.
|
|
@@ -437,13 +628,13 @@ class T {
|
|
|
437
628
|
* @returns A Users instance bound to this client
|
|
438
629
|
*/
|
|
439
630
|
get users() {
|
|
440
|
-
return new
|
|
631
|
+
return new C(this);
|
|
441
632
|
}
|
|
442
633
|
/**
|
|
443
634
|
* Provides access to the store API for data persistence with multiple storage scopes.
|
|
444
635
|
*
|
|
445
636
|
* This property returns a new Store instance that allows saving, retrieving, and
|
|
446
|
-
* subscribing to data changes across different scopes (
|
|
637
|
+
* subscribing to data changes across different scopes (application, instance, device, shared).
|
|
447
638
|
*
|
|
448
639
|
* NOTE: Most application developers should use the global store() function
|
|
449
640
|
* instead of accessing this property directly.
|
|
@@ -451,13 +642,13 @@ class T {
|
|
|
451
642
|
* @returns A Store instance bound to this client
|
|
452
643
|
*/
|
|
453
644
|
get store() {
|
|
454
|
-
return new
|
|
645
|
+
return new B(this);
|
|
455
646
|
}
|
|
456
647
|
/**
|
|
457
|
-
* Provides access to the applications API for discovering
|
|
648
|
+
* Provides access to the applications API for discovering other TelemetryOS applications.
|
|
458
649
|
*
|
|
459
650
|
* This property returns a new Applications instance that allows querying for applications
|
|
460
|
-
* by name or mount point, and
|
|
651
|
+
* by name or mount point, and setting application dependencies.
|
|
461
652
|
*
|
|
462
653
|
* NOTE: Most application developers should use the global applications() function
|
|
463
654
|
* instead of accessing this property directly.
|
|
@@ -465,7 +656,7 @@ class T {
|
|
|
465
656
|
* @returns An Applications instance bound to this client
|
|
466
657
|
*/
|
|
467
658
|
get applications() {
|
|
468
|
-
return new
|
|
659
|
+
return new I(this);
|
|
469
660
|
}
|
|
470
661
|
/**
|
|
471
662
|
* Provides access to the media API for working with content hosted on the TelemetryOS platform.
|
|
@@ -480,7 +671,36 @@ class T {
|
|
|
480
671
|
* @returns A Media instance bound to this client
|
|
481
672
|
*/
|
|
482
673
|
get media() {
|
|
483
|
-
return new
|
|
674
|
+
return new M(this);
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* Provides access to the proxy API for fetching third-party content through the TelemetryOS proxy service.
|
|
678
|
+
*
|
|
679
|
+
* This property returns a new Proxy instance that allows applications to fetch content from external
|
|
680
|
+
* URLs through the platform's proxy service, which handles authentication, caching, and CORS issues.
|
|
681
|
+
*
|
|
682
|
+
* NOTE: Most application developers should use the global proxy() function
|
|
683
|
+
* instead of accessing this property directly.
|
|
684
|
+
*
|
|
685
|
+
* @returns A Proxy instance bound to this client
|
|
686
|
+
*/
|
|
687
|
+
get proxy() {
|
|
688
|
+
return new x(this);
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* Provides access to the devices API for interacting with the current device.
|
|
692
|
+
*
|
|
693
|
+
* This property returns a new Devices instance that allows applications to get information
|
|
694
|
+
* about the specific device the application is running on, subscribe to device changes,
|
|
695
|
+
* and access device hardware information.
|
|
696
|
+
*
|
|
697
|
+
* NOTE: Most application developers should use the global devices() function
|
|
698
|
+
* instead of accessing this property directly.
|
|
699
|
+
*
|
|
700
|
+
* @returns A Devices instance bound to this client
|
|
701
|
+
*/
|
|
702
|
+
get devices() {
|
|
703
|
+
return new P(this);
|
|
484
704
|
}
|
|
485
705
|
/**
|
|
486
706
|
* Provides access to the root settings navigation API for TelemetryOS administration UI integration.
|
|
@@ -498,7 +718,22 @@ class T {
|
|
|
498
718
|
* @throws {Error} If used by an application not mounted at the 'rootSettingsNavigation' mount point
|
|
499
719
|
*/
|
|
500
720
|
get rootSettingsNavigation() {
|
|
501
|
-
return new
|
|
721
|
+
return new $(this.store);
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Provides access to the weather API for retrieving weather data.
|
|
725
|
+
*
|
|
726
|
+
* This property returns a new Weather instance that allows applications to fetch
|
|
727
|
+
* current weather conditions and forecasts from various providers (WeatherBit, AccuWeather)
|
|
728
|
+
* through the General Integrations Service.
|
|
729
|
+
*
|
|
730
|
+
* NOTE: Most application developers should use the global weather() function
|
|
731
|
+
* instead of accessing this property directly.
|
|
732
|
+
*
|
|
733
|
+
* @returns A Weather instance bound to this client
|
|
734
|
+
*/
|
|
735
|
+
get weather() {
|
|
736
|
+
return new k(this);
|
|
502
737
|
}
|
|
503
738
|
get applicationName() {
|
|
504
739
|
return this._applicationName;
|
|
@@ -526,33 +761,33 @@ class T {
|
|
|
526
761
|
*/
|
|
527
762
|
bind() {
|
|
528
763
|
var e;
|
|
529
|
-
const t = new URL(window.location.href),
|
|
530
|
-
this._applicationInstance = (e =
|
|
531
|
-
const r =
|
|
764
|
+
const t = new URL(window.location.href), n = t.searchParams;
|
|
765
|
+
this._applicationInstance = (e = n.get("telemetryApplicationId")) !== null && e !== void 0 ? e : "";
|
|
766
|
+
const r = n.get("applicationSpecifier");
|
|
532
767
|
if (r)
|
|
533
768
|
this._applicationSpecifier = r;
|
|
534
769
|
else {
|
|
535
|
-
const
|
|
536
|
-
this._applicationSpecifier =
|
|
770
|
+
const s = t.hostname.split(".");
|
|
771
|
+
this._applicationSpecifier = s[0] || "";
|
|
537
772
|
}
|
|
538
773
|
if (!this._applicationSpecifier || this._applicationSpecifier.length !== 40)
|
|
539
774
|
throw new Error(`Invalid applicationSpecifier: expected 40-character hash, got "${this._applicationSpecifier}"`);
|
|
540
775
|
if (!this._applicationInstance)
|
|
541
776
|
throw new Error("Missing telemetryApplicationId query parameter");
|
|
542
|
-
this._windowMessageHandler = (
|
|
543
|
-
if (
|
|
777
|
+
this._windowMessageHandler = (s) => {
|
|
778
|
+
if (s.source === window)
|
|
544
779
|
return;
|
|
545
780
|
for (let c = 0; c < window.frames.length; c += 1)
|
|
546
|
-
window.frames[c].postMessage(
|
|
547
|
-
const l =
|
|
781
|
+
window.frames[c].postMessage(s.data, "*");
|
|
782
|
+
const l = T.safeParse(s.data);
|
|
548
783
|
if (!l.success)
|
|
549
784
|
return;
|
|
550
|
-
const u = l.data, a = this._onHandlers.get(u.name),
|
|
785
|
+
const u = l.data, a = this._onHandlers.get(u.name), p = this._onceHandlers.get(u.name);
|
|
551
786
|
if (a)
|
|
552
787
|
for (const c of a)
|
|
553
788
|
c(u.data);
|
|
554
|
-
if (
|
|
555
|
-
for (const c of
|
|
789
|
+
if (p) {
|
|
790
|
+
for (const c of p)
|
|
556
791
|
c(u.data);
|
|
557
792
|
this._onceHandlers.delete(u.name);
|
|
558
793
|
}
|
|
@@ -588,15 +823,15 @@ class T {
|
|
|
588
823
|
* @param data The data payload to include with the message
|
|
589
824
|
*/
|
|
590
825
|
send(e, t) {
|
|
591
|
-
const
|
|
592
|
-
telemetrySdkVersion:
|
|
826
|
+
const n = {
|
|
827
|
+
telemetrySdkVersion: b,
|
|
593
828
|
applicationName: this._applicationName,
|
|
594
829
|
applicationSpecifier: this._applicationSpecifier,
|
|
595
830
|
applicationInstance: this._applicationInstance,
|
|
596
831
|
name: e,
|
|
597
832
|
data: t
|
|
598
833
|
};
|
|
599
|
-
window.parent.postMessage(
|
|
834
|
+
window.parent.postMessage(n, "*");
|
|
600
835
|
}
|
|
601
836
|
/**
|
|
602
837
|
* Sends a message to the TelemetryOS platform and waits for a response.
|
|
@@ -616,37 +851,37 @@ class T {
|
|
|
616
851
|
* @throws {Error} If the request times out
|
|
617
852
|
*/
|
|
618
853
|
request(e, t) {
|
|
619
|
-
const
|
|
620
|
-
telemetrySdkVersion:
|
|
854
|
+
const n = y(), r = {
|
|
855
|
+
telemetrySdkVersion: b,
|
|
621
856
|
applicationName: this._applicationName,
|
|
622
857
|
applicationSpecifier: this._applicationSpecifier,
|
|
623
858
|
applicationInstance: this._applicationInstance,
|
|
624
859
|
name: e,
|
|
625
860
|
data: t,
|
|
626
|
-
responseName:
|
|
861
|
+
responseName: n
|
|
627
862
|
};
|
|
628
863
|
window.parent.postMessage(r, "*");
|
|
629
|
-
let
|
|
630
|
-
const u = new Promise((
|
|
631
|
-
const d = new Error(`${e} message request with response name of ${
|
|
864
|
+
let s = !1, l;
|
|
865
|
+
const u = new Promise((p, c) => {
|
|
866
|
+
const d = new Error(`${e} message request with response name of ${n} timed out after ${g}`);
|
|
632
867
|
setTimeout(() => {
|
|
633
|
-
|
|
868
|
+
s = !0, this.off(n, l), c(d);
|
|
634
869
|
}, g);
|
|
635
|
-
}), a = new Promise((
|
|
870
|
+
}), a = new Promise((p) => {
|
|
636
871
|
l = (c) => {
|
|
637
|
-
|
|
638
|
-
}, this.once(
|
|
872
|
+
s || p(c);
|
|
873
|
+
}, this.once(n, p);
|
|
639
874
|
});
|
|
640
875
|
return Promise.race([u, a]);
|
|
641
876
|
}
|
|
642
|
-
async subscribe(e, t,
|
|
643
|
-
let r,
|
|
644
|
-
typeof t == "function" ?
|
|
645
|
-
const l =
|
|
877
|
+
async subscribe(e, t, n) {
|
|
878
|
+
let r, s;
|
|
879
|
+
typeof t == "function" ? s = t : (r = t, s = n);
|
|
880
|
+
const l = y(), u = y();
|
|
646
881
|
let a = this._subscriptionNamesBySubjectName.get(e);
|
|
647
|
-
a || (a = [], this._subscriptionNamesBySubjectName.set(e, a)), a.push(l), this._subscriptionNamesByHandler.set(
|
|
648
|
-
const
|
|
649
|
-
telemetrySdkVersion:
|
|
882
|
+
a || (a = [], this._subscriptionNamesBySubjectName.set(e, a)), a.push(l), this._subscriptionNamesByHandler.set(s, l), this.on(l, s);
|
|
883
|
+
const p = {
|
|
884
|
+
telemetrySdkVersion: b,
|
|
650
885
|
applicationName: this._applicationName,
|
|
651
886
|
applicationSpecifier: this._applicationSpecifier,
|
|
652
887
|
applicationInstance: this._applicationInstance,
|
|
@@ -655,36 +890,36 @@ class T {
|
|
|
655
890
|
responseName: u,
|
|
656
891
|
subscriptionName: l
|
|
657
892
|
};
|
|
658
|
-
window.parent.postMessage(
|
|
893
|
+
window.parent.postMessage(p, "*");
|
|
659
894
|
let c = !1, d;
|
|
660
|
-
const S = new Promise((
|
|
895
|
+
const S = new Promise((w, f) => {
|
|
661
896
|
const m = new Error(`${e} subscribe request with subscription name of ${l} and response name of ${u} timed out after ${g}`);
|
|
662
897
|
setTimeout(() => {
|
|
663
898
|
c = !0, this.off(u, d), f(m);
|
|
664
899
|
}, g);
|
|
665
|
-
}),
|
|
900
|
+
}), v = new Promise((w) => {
|
|
666
901
|
d = (f) => {
|
|
667
|
-
c ||
|
|
668
|
-
}, this.on(u,
|
|
902
|
+
c || w(f);
|
|
903
|
+
}, this.on(u, w);
|
|
669
904
|
});
|
|
670
|
-
return Promise.race([S,
|
|
905
|
+
return Promise.race([S, v]);
|
|
671
906
|
}
|
|
672
|
-
async unsubscribe(e, t,
|
|
673
|
-
let r,
|
|
674
|
-
typeof t == "function" ?
|
|
675
|
-
const l =
|
|
907
|
+
async unsubscribe(e, t, n) {
|
|
908
|
+
let r, s;
|
|
909
|
+
typeof t == "function" ? s = t : (r = t, s = n);
|
|
910
|
+
const l = y();
|
|
676
911
|
let u = [];
|
|
677
|
-
if (
|
|
678
|
-
const a = this._subscriptionNamesByHandler.get(
|
|
912
|
+
if (s) {
|
|
913
|
+
const a = this._subscriptionNamesByHandler.get(s);
|
|
679
914
|
if (!a)
|
|
680
915
|
return { success: !1 };
|
|
681
|
-
u = [a], this._subscriptionNamesByHandler.delete(
|
|
916
|
+
u = [a], this._subscriptionNamesByHandler.delete(s);
|
|
682
917
|
} else if (!this._subscriptionNamesBySubjectName.get(e))
|
|
683
918
|
return { success: !1 };
|
|
684
919
|
for await (const a of u) {
|
|
685
|
-
this.off(a,
|
|
686
|
-
const
|
|
687
|
-
telemetrySdkVersion:
|
|
920
|
+
this.off(a, s);
|
|
921
|
+
const p = {
|
|
922
|
+
telemetrySdkVersion: b,
|
|
688
923
|
applicationInstance: this._applicationInstance,
|
|
689
924
|
applicationName: this._applicationName,
|
|
690
925
|
applicationSpecifier: this._applicationSpecifier,
|
|
@@ -693,19 +928,19 @@ class T {
|
|
|
693
928
|
responseName: l,
|
|
694
929
|
unsubscribeName: a
|
|
695
930
|
};
|
|
696
|
-
window.parent.postMessage(
|
|
931
|
+
window.parent.postMessage(p, "*");
|
|
697
932
|
let c = !1, d;
|
|
698
933
|
const S = new Promise((f, m) => {
|
|
699
|
-
const
|
|
934
|
+
const H = new Error(`${e} unsubscribe request with unsubscribe name of ${a} and response name of ${l} timed out after ${g}`);
|
|
700
935
|
setTimeout(() => {
|
|
701
|
-
c = !0, this.off(l, d), m(
|
|
936
|
+
c = !0, this.off(l, d), m(H);
|
|
702
937
|
}, g);
|
|
703
|
-
}),
|
|
938
|
+
}), v = new Promise((f) => {
|
|
704
939
|
d = (m) => {
|
|
705
940
|
c || f(m);
|
|
706
941
|
}, this.once(l, f);
|
|
707
942
|
});
|
|
708
|
-
if (!(await Promise.race([S,
|
|
943
|
+
if (!(await Promise.race([S, v])).success)
|
|
709
944
|
return { success: !1 };
|
|
710
945
|
}
|
|
711
946
|
return { success: !0 };
|
|
@@ -728,8 +963,8 @@ class T {
|
|
|
728
963
|
* @param handler The callback function to execute when messages are received
|
|
729
964
|
*/
|
|
730
965
|
on(e, t) {
|
|
731
|
-
var
|
|
732
|
-
const r = (
|
|
966
|
+
var n;
|
|
967
|
+
const r = (n = this._onHandlers.get(e)) !== null && n !== void 0 ? n : [];
|
|
733
968
|
r.length === 0 && this._onHandlers.set(e, r), r.push(t);
|
|
734
969
|
}
|
|
735
970
|
/**
|
|
@@ -747,8 +982,8 @@ class T {
|
|
|
747
982
|
* @param handler The callback function to execute when the message is received
|
|
748
983
|
*/
|
|
749
984
|
once(e, t) {
|
|
750
|
-
var
|
|
751
|
-
const r = (
|
|
985
|
+
var n;
|
|
986
|
+
const r = (n = this._onceHandlers.get(e)) !== null && n !== void 0 ? n : [];
|
|
752
987
|
r.length === 0 && this._onceHandlers.set(e, r), r.push(t);
|
|
753
988
|
}
|
|
754
989
|
/**
|
|
@@ -767,101 +1002,115 @@ class T {
|
|
|
767
1002
|
* all handlers for this message type will be removed.
|
|
768
1003
|
*/
|
|
769
1004
|
off(e, t) {
|
|
770
|
-
const
|
|
771
|
-
if (!(!
|
|
772
|
-
if (
|
|
773
|
-
for (let
|
|
774
|
-
t && s
|
|
775
|
-
|
|
1005
|
+
const n = this._onHandlers.get(e), r = this._onceHandlers.get(e);
|
|
1006
|
+
if (!(!n && !r)) {
|
|
1007
|
+
if (n) {
|
|
1008
|
+
for (let s = 0; s < n.length; s += 1)
|
|
1009
|
+
t && n[s] !== t || (n.splice(s, 1), s -= 1);
|
|
1010
|
+
n.length === 0 && this._onHandlers.delete(e);
|
|
776
1011
|
}
|
|
777
1012
|
if (r) {
|
|
778
|
-
for (let
|
|
779
|
-
t && r[
|
|
1013
|
+
for (let s = 0; s < r.length; s += 1)
|
|
1014
|
+
t && r[s] !== t || (r.splice(s, 1), s -= 1);
|
|
780
1015
|
r.length === 0 && this._onceHandlers.delete(e);
|
|
781
1016
|
}
|
|
782
1017
|
}
|
|
783
1018
|
}
|
|
784
1019
|
}
|
|
785
|
-
function
|
|
1020
|
+
function y() {
|
|
786
1021
|
return Math.random().toString(36).slice(2, 9);
|
|
787
1022
|
}
|
|
788
|
-
const
|
|
789
|
-
let
|
|
1023
|
+
const b = A.version;
|
|
1024
|
+
let i = null;
|
|
790
1025
|
function j() {
|
|
791
|
-
return
|
|
792
|
-
}
|
|
793
|
-
function D(o) {
|
|
794
|
-
n = new T(o), n.bind();
|
|
1026
|
+
return i;
|
|
795
1027
|
}
|
|
796
|
-
function L() {
|
|
797
|
-
|
|
1028
|
+
function L(o) {
|
|
1029
|
+
i = new W(o), i.bind();
|
|
798
1030
|
}
|
|
799
|
-
function U(
|
|
800
|
-
|
|
801
|
-
}
|
|
802
|
-
function x(...o) {
|
|
803
|
-
return p(n), n.once(...o);
|
|
1031
|
+
function U() {
|
|
1032
|
+
i == null || i.unbind(), i = null;
|
|
804
1033
|
}
|
|
805
1034
|
function V(...o) {
|
|
806
|
-
return
|
|
1035
|
+
return h(i), i.on(...o);
|
|
807
1036
|
}
|
|
808
1037
|
function z(...o) {
|
|
809
|
-
return
|
|
810
|
-
}
|
|
811
|
-
function K(...o) {
|
|
812
|
-
return p(n), n.request(...o);
|
|
1038
|
+
return h(i), i.once(...o);
|
|
813
1039
|
}
|
|
814
1040
|
function G(...o) {
|
|
815
|
-
return
|
|
1041
|
+
return h(i), i.off(...o);
|
|
816
1042
|
}
|
|
817
1043
|
function J(...o) {
|
|
818
|
-
return
|
|
1044
|
+
return h(i), i.send(...o);
|
|
1045
|
+
}
|
|
1046
|
+
function K(...o) {
|
|
1047
|
+
return h(i), i.request(...o);
|
|
819
1048
|
}
|
|
820
|
-
function
|
|
821
|
-
return
|
|
1049
|
+
function O(...o) {
|
|
1050
|
+
return h(i), i.subscribe(...o);
|
|
822
1051
|
}
|
|
823
|
-
function
|
|
824
|
-
return
|
|
1052
|
+
function Q(...o) {
|
|
1053
|
+
return h(i), i.unsubscribe(...o);
|
|
825
1054
|
}
|
|
826
1055
|
function X() {
|
|
827
|
-
return
|
|
1056
|
+
return h(i), i.store;
|
|
828
1057
|
}
|
|
829
1058
|
function Y() {
|
|
830
|
-
return
|
|
1059
|
+
return h(i), i.applications;
|
|
831
1060
|
}
|
|
832
1061
|
function Z() {
|
|
833
|
-
return
|
|
1062
|
+
return h(i), i.media;
|
|
1063
|
+
}
|
|
1064
|
+
function ee() {
|
|
1065
|
+
return h(i), i.accounts;
|
|
1066
|
+
}
|
|
1067
|
+
function te() {
|
|
1068
|
+
return h(i), i.users;
|
|
1069
|
+
}
|
|
1070
|
+
function se() {
|
|
1071
|
+
return h(i), i.devices;
|
|
1072
|
+
}
|
|
1073
|
+
function ne() {
|
|
1074
|
+
return h(i), i.proxy;
|
|
1075
|
+
}
|
|
1076
|
+
function ie() {
|
|
1077
|
+
return h(i), i.rootSettingsNavigation;
|
|
834
1078
|
}
|
|
835
|
-
function
|
|
836
|
-
return
|
|
1079
|
+
function re() {
|
|
1080
|
+
return h(i), i.weather;
|
|
837
1081
|
}
|
|
838
|
-
function
|
|
1082
|
+
function h(o) {
|
|
839
1083
|
if (!o)
|
|
840
1084
|
throw new Error("SDK is not configured");
|
|
841
1085
|
}
|
|
842
1086
|
export {
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
1087
|
+
E as Accounts,
|
|
1088
|
+
I as Applications,
|
|
1089
|
+
W as Client,
|
|
1090
|
+
P as Devices,
|
|
1091
|
+
D as Environment,
|
|
1092
|
+
M as Media,
|
|
1093
|
+
B as Store,
|
|
1094
|
+
C as Users,
|
|
1095
|
+
k as Weather,
|
|
1096
|
+
ee as accounts,
|
|
1097
|
+
Y as applications,
|
|
1098
|
+
L as configure,
|
|
1099
|
+
U as destroy,
|
|
1100
|
+
se as devices,
|
|
854
1101
|
j as globalClient,
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
1102
|
+
Z as media,
|
|
1103
|
+
G as off,
|
|
1104
|
+
V as on,
|
|
1105
|
+
z as once,
|
|
1106
|
+
ne as proxy,
|
|
859
1107
|
K as request,
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
1108
|
+
ie as rootSettingsNavigation,
|
|
1109
|
+
J as send,
|
|
1110
|
+
X as store,
|
|
1111
|
+
O as subscribe,
|
|
1112
|
+
b as telemetrySdkVersion,
|
|
1113
|
+
Q as unsubscribe,
|
|
1114
|
+
te as users,
|
|
1115
|
+
re as weather
|
|
867
1116
|
};
|