@telemetryos/root-sdk 1.4.2 → 1.4.4
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 +12 -0
- package/dist/applications.d.ts +2 -2
- package/dist/bridge-message-formatter.d.ts +1 -4
- package/dist/bridge-message-validator.d.ts +3 -0
- package/dist/bridge.cjs +1 -1
- package/dist/bridge.js +14 -10
- package/dist/client-message-formatter.d.ts +1 -11
- package/dist/client-message-validator.d.ts +3 -0
- package/dist/client.d.ts +4 -5
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +6 -7
- package/dist/index.js +153 -206
- package/dist/proxy.d.ts +5 -5
- package/dist/store.d.ts +5 -5
- package/dist/weather.d.ts +5 -54
- package/package.json +1 -1
- /package/dist/{device.d.ts → devices.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @telemetryos/root-sdk
|
|
2
2
|
|
|
3
|
+
## 1.4.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Correctly pass on messages from deeply nested applications up to the parent page and in the reverse
|
|
8
|
+
|
|
9
|
+
## 1.4.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Fix doc comments
|
|
14
|
+
|
|
3
15
|
## 1.4.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/applications.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export type Application = {
|
|
|
10
10
|
export type GetUrlResult = {
|
|
11
11
|
url: string;
|
|
12
12
|
};
|
|
13
|
-
export type
|
|
13
|
+
export type ApplicationsState = {
|
|
14
14
|
ready: string[];
|
|
15
15
|
unavailable: string[];
|
|
16
16
|
};
|
|
@@ -61,5 +61,5 @@ export declare class Applications {
|
|
|
61
61
|
* // result.unavailable: ['app2-hash'] - these failed to load
|
|
62
62
|
* ```
|
|
63
63
|
*/
|
|
64
|
-
setDependencies(applicationSpecifiers: string[]): Promise<
|
|
64
|
+
setDependencies(applicationSpecifiers: string[]): Promise<ApplicationsState>;
|
|
65
65
|
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { bridgeMessageValidator } from './bridge-message-validator.js';
|
|
3
3
|
export type Message = z.infer<typeof bridgeMessageValidator>;
|
|
4
|
-
export declare function formatBridgeMessage(data: Message):
|
|
5
|
-
name: string;
|
|
6
|
-
data?: any;
|
|
7
|
-
};
|
|
4
|
+
export declare function formatBridgeMessage(data: Omit<Message, 'type'>): Message;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const bridgeMessageValidator: z.ZodObject<{
|
|
3
|
+
type: z.ZodLiteral<"bridge">;
|
|
3
4
|
name: z.ZodString;
|
|
4
5
|
data: z.ZodAny;
|
|
5
6
|
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
type: "bridge";
|
|
6
8
|
name: string;
|
|
7
9
|
data?: any;
|
|
8
10
|
}, {
|
|
11
|
+
type: "bridge";
|
|
9
12
|
name: string;
|
|
10
13
|
data?: any;
|
|
11
14
|
}>;
|
package/dist/bridge.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-JDXm3DEz.cjs");const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-JDXm3DEz.cjs");function r(n){return{...n,type:"bridge"}}const o=e.z.object({type:e.z.literal("client"),telemetrySdkVersion:e.z.string(),applicationName:e.z.string(),applicationSpecifier:e.z.string(),applicationInstance:e.z.string(),name:e.z.string(),data:e.z.any(),responseName:e.z.string().optional(),subscriptionName:e.z.string().optional(),unsubscribeName:e.z.string().optional()});class d{bind(){this._windowMessageHandler=i=>{var s;if(i.source===window)return;const t=o.safeParse(i.data);if(!t.success)return;const a=t.data;(s=this.onMessage)===null||s===void 0||s.call(this,a)},window.addEventListener("message",this._windowMessageHandler)}unbind(){this._windowMessageHandler&&window.removeEventListener("message",this._windowMessageHandler)}send(i){for(let s=0;s<window.frames.length;s+=1)window.frames[s].postMessage(r(i),"*")}}exports.Bridge=d;
|
package/dist/bridge.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { z as e } from "./index-B98VDFRY.js";
|
|
2
|
-
|
|
2
|
+
function r(n) {
|
|
3
|
+
return { ...n, type: "bridge" };
|
|
4
|
+
}
|
|
5
|
+
const o = e.object({
|
|
6
|
+
type: e.literal("client"),
|
|
3
7
|
telemetrySdkVersion: e.string(),
|
|
4
8
|
applicationName: e.string(),
|
|
5
9
|
applicationSpecifier: e.string(),
|
|
@@ -10,20 +14,20 @@ const t = e.object({
|
|
|
10
14
|
subscriptionName: e.string().optional(),
|
|
11
15
|
unsubscribeName: e.string().optional()
|
|
12
16
|
});
|
|
13
|
-
class
|
|
17
|
+
class l {
|
|
14
18
|
/**
|
|
15
19
|
* Binds the Bridge to the window message event. This will allow the Bridge
|
|
16
20
|
* to listen for messages from the host application.
|
|
17
21
|
*/
|
|
18
22
|
bind() {
|
|
19
|
-
this._windowMessageHandler = (
|
|
23
|
+
this._windowMessageHandler = (i) => {
|
|
20
24
|
var s;
|
|
21
|
-
if (
|
|
25
|
+
if (i.source === window)
|
|
22
26
|
return;
|
|
23
|
-
const
|
|
24
|
-
if (!
|
|
27
|
+
const t = o.safeParse(i.data);
|
|
28
|
+
if (!t.success)
|
|
25
29
|
return;
|
|
26
|
-
const a =
|
|
30
|
+
const a = t.data;
|
|
27
31
|
(s = this.onMessage) === null || s === void 0 || s.call(this, a);
|
|
28
32
|
}, window.addEventListener("message", this._windowMessageHandler);
|
|
29
33
|
}
|
|
@@ -38,11 +42,11 @@ class d {
|
|
|
38
42
|
* Sends a message to SDK clients.
|
|
39
43
|
* @param message The message to send.
|
|
40
44
|
*/
|
|
41
|
-
send(
|
|
45
|
+
send(i) {
|
|
42
46
|
for (let s = 0; s < window.frames.length; s += 1)
|
|
43
|
-
window.frames[s].postMessage(
|
|
47
|
+
window.frames[s].postMessage(r(i), "*");
|
|
44
48
|
}
|
|
45
49
|
}
|
|
46
50
|
export {
|
|
47
|
-
|
|
51
|
+
l as Bridge
|
|
48
52
|
};
|
|
@@ -1,14 +1,4 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { clientMessageValidator } from './client-message-validator.js';
|
|
3
3
|
export type Message = z.infer<typeof clientMessageValidator>;
|
|
4
|
-
export declare function formatClientMessage(data: Message):
|
|
5
|
-
telemetrySdkVersion: string;
|
|
6
|
-
applicationName: string;
|
|
7
|
-
applicationSpecifier: string;
|
|
8
|
-
applicationInstance: string;
|
|
9
|
-
name: string;
|
|
10
|
-
data?: any;
|
|
11
|
-
responseName?: string | undefined;
|
|
12
|
-
subscriptionName?: string | undefined;
|
|
13
|
-
unsubscribeName?: string | undefined;
|
|
14
|
-
};
|
|
4
|
+
export declare function formatClientMessage(data: Omit<Message, 'type'>): Message;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const clientMessageValidator: z.ZodObject<{
|
|
3
|
+
type: z.ZodLiteral<"client">;
|
|
3
4
|
telemetrySdkVersion: z.ZodString;
|
|
4
5
|
applicationName: z.ZodString;
|
|
5
6
|
applicationSpecifier: z.ZodString;
|
|
@@ -10,6 +11,7 @@ export declare const clientMessageValidator: z.ZodObject<{
|
|
|
10
11
|
subscriptionName: z.ZodOptional<z.ZodString>;
|
|
11
12
|
unsubscribeName: z.ZodOptional<z.ZodString>;
|
|
12
13
|
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
type: "client";
|
|
13
15
|
telemetrySdkVersion: string;
|
|
14
16
|
applicationName: string;
|
|
15
17
|
applicationSpecifier: string;
|
|
@@ -20,6 +22,7 @@ export declare const clientMessageValidator: z.ZodObject<{
|
|
|
20
22
|
subscriptionName?: string | undefined;
|
|
21
23
|
unsubscribeName?: string | undefined;
|
|
22
24
|
}, {
|
|
25
|
+
type: "client";
|
|
23
26
|
telemetrySdkVersion: string;
|
|
24
27
|
applicationName: string;
|
|
25
28
|
applicationSpecifier: string;
|
package/dist/client.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { RootSettingsNavigation } from './root-settings-navigation.js';
|
|
|
5
5
|
import { Accounts } from './accounts.js';
|
|
6
6
|
import { Users } from './users.js';
|
|
7
7
|
import { Proxy } from './proxy.js';
|
|
8
|
-
import { Devices } from './
|
|
8
|
+
import { Devices } from './devices.js';
|
|
9
9
|
import { Weather } from './weather.js';
|
|
10
10
|
/**
|
|
11
11
|
* The maximum time in milliseconds to wait for a response to a request call.
|
|
@@ -128,10 +128,10 @@ export declare class Client {
|
|
|
128
128
|
*/
|
|
129
129
|
get media(): Media;
|
|
130
130
|
/**
|
|
131
|
-
* Provides access to the proxy API for fetching third-party content through the TelemetryOS
|
|
131
|
+
* Provides access to the proxy API for fetching third-party content through the TelemetryOS API.
|
|
132
132
|
*
|
|
133
133
|
* This property returns a new Proxy instance that allows applications to fetch content from external
|
|
134
|
-
* URLs through the platform
|
|
134
|
+
* URLs through the platform, which handles authentication, caching, and CORS issues.
|
|
135
135
|
*
|
|
136
136
|
* NOTE: Most application developers should use the global proxy() function
|
|
137
137
|
* instead of accessing this property directly.
|
|
@@ -172,8 +172,7 @@ export declare class Client {
|
|
|
172
172
|
* Provides access to the weather API for retrieving weather data.
|
|
173
173
|
*
|
|
174
174
|
* This property returns a new Weather instance that allows applications to fetch
|
|
175
|
-
* current weather conditions and forecasts
|
|
176
|
-
* through the General Integrations Service.
|
|
175
|
+
* current weather conditions and forecasts through the TelemetryOS API.
|
|
177
176
|
*
|
|
178
177
|
* NOTE: Most application developers should use the global weather() function
|
|
179
178
|
* instead of accessing this property directly.
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("./index-JDXm3DEz.cjs"),B="1.4.2",k={version:B};class H{constructor(e){this._client=e}async getCurrent(){const e=await this._client.request("accounts.getCurrent",{});if(!e.success)throw new Error("Failed to fetch current account");return e.account}}class q{constructor(e){this._client=e}async getAllByMountPoint(e){return(await this._client.request("applications.getAllByMountPoint",{mountPoint:e})).applications}async getByName(e){return(await this._client.request("applications.getByName",{name:e})).application}async setDependencies(e){return await this._client.request("applications.setDependencies",{applicationSpecifiers:e})}}class A{constructor(e){this._client=e}async getInformation(){const e=await this._client.request("devices.getInformation",{});if(!e.success)throw new Error("Failed to get device information");return e.deviceInformation}}function T(o,e=console.error){o().catch(e)}class ${constructor(e){this._client=e}async getColorScheme(){return(await this._client.request("environment.getColorScheme",{})).colorScheme}subscribeColorScheme(e){T(async()=>{this._client.on("environment.colorSchemeChanged",e),e(await this.getColorScheme())})}unsubscribeColorScheme(e){this._client.off("environment.colorSchemeChanged",e)}}class E{constructor(e){this._client=e}async getAllFolders(){return(await this._client.request("mediaFolders.getAll",{})).folders}async getAllByFolderId(e){return(await this._client.request("media.getAllByFolderId",{folderId:e})).contents}async getAllByTag(e){return(await this._client.request("media.getAllByTag",{tagName:e})).contents}async getById(e){return(await this._client.request("media.getById",{id:e})).content}}class I{constructor(e){this._client=e}get application(){return new y("application","",this._client)}get instance(){return new y("instance",this._client.applicationSpecifier,this._client)}get device(){return new y("device",this._client.applicationSpecifier,this._client)}shared(e){return new y("shared",e,this._client)}}class y{constructor(e,t,n){this._kind=e,this._namespace=t,this._client=n}async set(e,t){return(await this._client.request("store.set",{kind:this._kind,namespace:this._namespace,key:e,value:t})).success}async get(e){return(await this._client.request("store.get",{kind:this._kind,namespace:this._namespace,key:e})).value}async subscribe(e,t){return(await this._client.subscribe("store.subscribe",{kind:this._kind,namespace:this._namespace,key:e},t)).success}async unsubscribe(e,t){return(await this._client.unsubscribe("store.unsubscribe",{kind:this._kind,namespace:this._namespace,key:e},t)).success}async delete(e){return(await this._client.request("store.delete",{kind:this._kind,namespace:this._namespace,key:e})).success}}class P{constructor(e){this._client=e}async getCurrent(){const e=await this._client.request("users.getCurrent",{});if(!e.success)throw new Error("Failed to fetch current user");return e.user}}class M{constructor(e){this._client=e}async getConditions(e){const t=await this._client.request("weather.getConditions",e);if(!t.success||!t.conditions)throw new Error(t.error||"Failed to fetch weather conditions");return t.conditions}async getDailyForecast(e){const t=await this._client.request("weather.getDailyForecast",e);if(!t.success||!t.forecast)throw new Error(t.error||"Failed to fetch daily forecast");return t.forecast}async getHourlyForecast(e){const t=await this._client.request("weather.getHourlyForecast",e);if(!t.success||!t.forecast)throw new Error(t.error||"Failed to fetch hourly forecast");return t.forecast}async getAccuWeatherConditions(e){const t=await this._client.request("weather.getAccuWeatherConditions",e);if(!t.success||!t.data)throw new Error(t.error||"Failed to fetch AccuWeather conditions");return t.data}async getAccuWeatherDailyForecast(e){const t=await this._client.request("weather.getAccuWeatherDailyForecast",e);if(!t.success||!t.data)throw new Error(t.error||"Failed to fetch AccuWeather daily forecast");return t.data}async getAccuWeatherHourlyForecast(e){const t=await this._client.request("weather.getAccuWeatherHourlyForecast",e);if(!t.success||!t.data)throw new Error(t.error||"Failed to fetch AccuWeather hourly forecast");return t.data}}const x=N.z.object({name:N.z.string(),data:N.z.any()});class W{constructor(e){if(e._client._applicationSpecifier!=="rootSettingsNavigation")throw new Error("RootSettingsNavigation can only be used in the rootSettingsNavigation mount point");this._store=e}async setRootSettingsNavigation(e){const t=this._store.shared("root-settings-navigation"),n=await t.get("navigation"),r=this._store._client._applicationSpecifier;n[r]={applicationSpecifier:r,entries:e.entries},t.set("navigation",n)}async getRootSettingsNavigation(){const t=await this._store.shared("root-settings-navigation").get("navigation"),n=this._store._client._applicationSpecifier;return t[n]}async getAllRootSettingsNavigation(){return this._store.shared("root-settings-navigation").get("navigation")}}class D{constructor(e){this._client=e}async fetch(e,t){let n;typeof e=="string"?n=e:e instanceof URL?n=e.toString():(n=e.url,t||(t={method:e.method,headers:e.headers,body:e.body,credentials:e.credentials,cache:e.cache,redirect:e.redirect,referrer:e.referrer,integrity:e.integrity}));let r={};t!=null&&t.headers&&(t.headers instanceof Headers?t.headers.forEach((p,c)=>{r[c]=p}):Array.isArray(t.headers)?t.headers.forEach(([p,c])=>{r[p]=c}):r=t.headers);const s=await this._client.request("proxy.fetch",{url:n,method:(t==null?void 0:t.method)||"GET",headers:r,body:(t==null?void 0:t.body)||null});if(!s.success)throw new Error(`Proxy fetch failed: ${s.statusText}`);const l=new Headers(s.headers),u={status:s.status,statusText:s.statusText,headers:l};let a=null;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)}}const g=1e3*30;class C{constructor(e){this._applicationName=e,this._applicationInstance="",this._applicationSpecifier="",this._onHandlers=new Map,this._onceHandlers=new Map,this._subscriptionNamesByHandler=new Map,this._subscriptionNamesBySubjectName=new Map}get accounts(){return new H(this)}get users(){return new P(this)}get store(){return new I(this)}get applications(){return new q(this)}get media(){return new E(this)}get proxy(){return new D(this)}get devices(){return new A(this)}get rootSettingsNavigation(){return new W(this.store)}get weather(){return new M(this)}get applicationName(){return this._applicationName}get applicationSpecifier(){return this._applicationSpecifier}get applicationInstance(){return this._applicationInstance}bind(){var e;const t=new URL(window.location.href),n=t.searchParams;this._applicationInstance=(e=n.get("telemetryApplicationId"))!==null&&e!==void 0?e:"";const r=n.get("applicationSpecifier");if(r)this._applicationSpecifier=r;else{const s=t.hostname.split(".");this._applicationSpecifier=s[0]||""}if(!this._applicationSpecifier||this._applicationSpecifier.length!==40)throw new Error(`Invalid applicationSpecifier: expected 40-character hash, got "${this._applicationSpecifier}"`);if(!this._applicationInstance)throw new Error("Missing telemetryApplicationId query parameter");this._windowMessageHandler=s=>{if(s.source===window)return;for(let c=0;c<window.frames.length;c+=1)window.frames[c].postMessage(s.data,"*");const l=x.safeParse(s.data);if(!l.success)return;const u=l.data,a=this._onHandlers.get(u.name),p=this._onceHandlers.get(u.name);if(a)for(const c of a)c(u.data);if(p){for(const c of p)c(u.data);this._onceHandlers.delete(u.name)}},window.addEventListener("message",this._windowMessageHandler)}unbind(){this._windowMessageHandler&&window.removeEventListener("message",this._windowMessageHandler)}send(e,t){const n={telemetrySdkVersion:w,applicationName:this._applicationName,applicationSpecifier:this._applicationSpecifier,applicationInstance:this._applicationInstance,name:e,data:t};window.parent.postMessage(n,"*")}request(e,t){const n=b(),r={telemetrySdkVersion:w,applicationName:this._applicationName,applicationSpecifier:this._applicationSpecifier,applicationInstance:this._applicationInstance,name:e,data:t,responseName:n};window.parent.postMessage(r,"*");let s=!1,l;const u=new Promise((p,c)=>{const d=new Error(`${e} message request with response name of ${n} timed out after ${g}`);setTimeout(()=>{s=!0,this.off(n,l),c(d)},g)}),a=new Promise(p=>{l=c=>{s||p(c)},this.once(n,p)});return Promise.race([u,a])}async subscribe(e,t,n){let r,s;typeof t=="function"?s=t:(r=t,s=n);const l=b(),u=b();let a=this._subscriptionNamesBySubjectName.get(e);a||(a=[],this._subscriptionNamesBySubjectName.set(e,a)),a.push(l),this._subscriptionNamesByHandler.set(s,l),this.on(l,s);const p={telemetrySdkVersion:w,applicationName:this._applicationName,applicationSpecifier:this._applicationSpecifier,applicationInstance:this._applicationInstance,name:e,data:r,responseName:u,subscriptionName:l};window.parent.postMessage(p,"*");let c=!1,d;const S=new Promise((_,f)=>{const m=new Error(`${e} subscribe request with subscription name of ${l} and response name of ${u} timed out after ${g}`);setTimeout(()=>{c=!0,this.off(u,d),f(m)},g)}),v=new Promise(_=>{d=f=>{c||_(f)},this.on(u,_)});return Promise.race([S,v])}async unsubscribe(e,t,n){let r,s;typeof t=="function"?s=t:(r=t,s=n);const l=b();let u=[];if(s){const a=this._subscriptionNamesByHandler.get(s);if(!a)return{success:!1};u=[a],this._subscriptionNamesByHandler.delete(s)}else if(!this._subscriptionNamesBySubjectName.get(e))return{success:!1};for await(const a of u){this.off(a,s);const p={telemetrySdkVersion:w,applicationInstance:this._applicationInstance,applicationName:this._applicationName,applicationSpecifier:this._applicationSpecifier,name:e,data:r,responseName:l,unsubscribeName:a};window.parent.postMessage(p,"*");let c=!1,d;const S=new Promise((f,m)=>{const F=new Error(`${e} unsubscribe request with unsubscribe name of ${a} and response name of ${l} timed out after ${g}`);setTimeout(()=>{c=!0,this.off(l,d),m(F)},g)}),v=new Promise(f=>{d=m=>{c||f(m)},this.once(l,f)});if(!(await Promise.race([S,v])).success)return{success:!1}}return{success:!0}}on(e,t){var n;const r=(n=this._onHandlers.get(e))!==null&&n!==void 0?n:[];r.length===0&&this._onHandlers.set(e,r),r.push(t)}once(e,t){var n;const r=(n=this._onceHandlers.get(e))!==null&&n!==void 0?n:[];r.length===0&&this._onceHandlers.set(e,r),r.push(t)}off(e,t){const n=this._onHandlers.get(e),r=this._onceHandlers.get(e);if(!(!n&&!r)){if(n){for(let s=0;s<n.length;s+=1)t&&n[s]!==t||(n.splice(s,1),s-=1);n.length===0&&this._onHandlers.delete(e)}if(r){for(let s=0;s<r.length;s+=1)t&&r[s]!==t||(r.splice(s,1),s-=1);r.length===0&&this._onceHandlers.delete(e)}}}}function b(){return Math.random().toString(36).slice(2,9)}const w=k.version;let i=null;function R(){return i}function j(o){i=new C(o),i.bind()}function L(){i==null||i.unbind(),i=null}function U(...o){return h(i),i.on(...o)}function z(...o){return h(i),i.once(...o)}function V(...o){return h(i),i.off(...o)}function O(...o){return h(i),i.send(...o)}function G(...o){return h(i),i.request(...o)}function J(...o){return h(i),i.subscribe(...o)}function K(...o){return h(i),i.unsubscribe(...o)}function Q(){return h(i),i.store}function X(){return h(i),i.applications}function Y(){return h(i),i.media}function Z(){return h(i),i.accounts}function ee(){return h(i),i.users}function te(){return h(i),i.devices}function se(){return h(i),i.proxy}function ne(){return h(i),i.rootSettingsNavigation}function ie(){return h(i),i.weather}function h(o){if(!o)throw new Error("SDK is not configured")}exports.Accounts=H;exports.Applications=q;exports.Client=C;exports.Devices=A;exports.Environment=$;exports.Media=E;exports.Store=I;exports.Users=P;exports.Weather=M;exports.accounts=Z;exports.applications=X;exports.configure=j;exports.destroy=L;exports.devices=te;exports.globalClient=R;exports.media=Y;exports.off=V;exports.on=U;exports.once=z;exports.proxy=se;exports.request=G;exports.rootSettingsNavigation=ne;exports.send=O;exports.store=Q;exports.subscribe=J;exports.telemetrySdkVersion=w;exports.unsubscribe=K;exports.users=ee;exports.weather=ie;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("./index-JDXm3DEz.cjs"),F="1.4.4",T={version:F};class q{constructor(e){this._client=e}async getCurrent(){const e=await this._client.request("accounts.getCurrent",{});if(!e.success)throw new Error("Failed to fetch current account");return e.account}}class I{constructor(e){this._client=e}async getAllByMountPoint(e){return(await this._client.request("applications.getAllByMountPoint",{mountPoint:e})).applications}async getByName(e){return(await this._client.request("applications.getByName",{name:e})).application}async setDependencies(e){return await this._client.request("applications.setDependencies",{applicationSpecifiers:e})}}class P{constructor(e){this._client=e}async getInformation(){const e=await this._client.request("devices.getInformation",{});if(!e.success)throw new Error("Failed to get device information");return e.deviceInformation}}function $(o,e=console.error){o().catch(e)}class x{constructor(e){this._client=e}async getColorScheme(){return(await this._client.request("environment.getColorScheme",{})).colorScheme}subscribeColorScheme(e){$(async()=>{this._client.on("environment.colorSchemeChanged",e),e(await this.getColorScheme())})}unsubscribeColorScheme(e){this._client.off("environment.colorSchemeChanged",e)}}class E{constructor(e){this._client=e}async getAllFolders(){return(await this._client.request("mediaFolders.getAll",{})).folders}async getAllByFolderId(e){return(await this._client.request("media.getAllByFolderId",{folderId:e})).contents}async getAllByTag(e){return(await this._client.request("media.getAllByTag",{tagName:e})).contents}async getById(e){return(await this._client.request("media.getById",{id:e})).content}}class M{constructor(e){this._client=e}get application(){return new b("application","",this._client)}get instance(){return new b("instance",this._client.applicationSpecifier,this._client)}get device(){return new b("device",this._client.applicationSpecifier,this._client)}shared(e){return new b("shared",e,this._client)}}class b{constructor(e,t,n){this._kind=e,this._namespace=t,this._client=n}async set(e,t){return(await this._client.request("store.set",{kind:this._kind,namespace:this._namespace,key:e,value:t})).success}async get(e){return(await this._client.request("store.get",{kind:this._kind,namespace:this._namespace,key:e})).value}async subscribe(e,t){return(await this._client.subscribe("store.subscribe",{kind:this._kind,namespace:this._namespace,key:e},t)).success}async unsubscribe(e,t){return(await this._client.unsubscribe("store.unsubscribe",{kind:this._kind,namespace:this._namespace,key:e},t)).success}async delete(e){return(await this._client.request("store.delete",{kind:this._kind,namespace:this._namespace,key:e})).success}}class A{constructor(e){this._client=e}async getCurrent(){const e=await this._client.request("users.getCurrent",{});if(!e.success)throw new Error("Failed to fetch current user");return e.user}}class B{constructor(e){this._client=e}async getConditions(e){const t=await this._client.request("weather.getConditions",e);if(!t.success||!t.conditions)throw new Error(t.error||"Failed to fetch weather conditions");return t.conditions}async getDailyForecast(e){const t=await this._client.request("weather.getDailyForecast",e);if(!t.success||!t.forecast)throw new Error(t.error||"Failed to fetch daily forecast");return t.forecast}async getHourlyForecast(e){const t=await this._client.request("weather.getHourlyForecast",e);if(!t.success||!t.forecast)throw new Error(t.error||"Failed to fetch hourly forecast");return t.forecast}}function S(o){return{...o,type:"client"}}const R=y.z.object({type:y.z.literal("bridge"),name:y.z.string(),data:y.z.any()});class j{constructor(e){if(e._client._applicationSpecifier!=="rootSettingsNavigation")throw new Error("RootSettingsNavigation can only be used in the rootSettingsNavigation mount point");this._store=e}async setRootSettingsNavigation(e){var t;const n=this._store.shared("root-settings-navigation"),r=(t=await n.get("navigation"))!==null&&t!==void 0?t:{},s=this._store._client._applicationSpecifier;r[s]={applicationSpecifier:s,entries:e.entries},n.set("navigation",r)}async getRootSettingsNavigation(){var e;const n=(e=await this._store.shared("root-settings-navigation").get("navigation"))!==null&&e!==void 0?e:{},r=this._store._client._applicationSpecifier;return n[r]}async getAllRootSettingsNavigation(){var e;return(e=await this._store.shared("root-settings-navigation").get("navigation"))!==null&&e!==void 0?e:{}}}class D{constructor(e){this._client=e}async fetch(e,t){let n;typeof e=="string"?n=e:e instanceof URL?n=e.toString():(n=e.url,t||(t={method:e.method,headers:e.headers,body:e.body,credentials:e.credentials,cache:e.cache,redirect:e.redirect,referrer:e.referrer,integrity:e.integrity}));let r={};t!=null&&t.headers&&(t.headers instanceof Headers?t.headers.forEach((h,c)=>{r[c]=h}):Array.isArray(t.headers)?t.headers.forEach(([h,c])=>{r[h]=c}):r=t.headers);const s=await this._client.request("proxy.fetch",{url:n,method:(t==null?void 0:t.method)||"GET",headers:r,body:(t==null?void 0:t.body)||null});if(!s.success)throw new Error(`Proxy fetch failed: ${s.statusText}`);const l=new Headers(s.headers),u={status:s.status,statusText:s.statusText,headers:l};let a=null;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)}}const g=1e3*30;class C{constructor(e){this._applicationName=e,this._applicationInstance="",this._applicationSpecifier="",this._onHandlers=new Map,this._onceHandlers=new Map,this._subscriptionNamesByHandler=new Map,this._subscriptionNamesBySubjectName=new Map}get accounts(){return new q(this)}get users(){return new A(this)}get store(){return new M(this)}get applications(){return new I(this)}get media(){return new E(this)}get proxy(){return new D(this)}get devices(){return new P(this)}get rootSettingsNavigation(){return new j(this.store)}get weather(){return new B(this)}get applicationName(){return this._applicationName}get applicationSpecifier(){return this._applicationSpecifier}get applicationInstance(){return this._applicationInstance}bind(){var e;const t=new URL(window.location.href),n=t.searchParams;this._applicationInstance=(e=n.get("telemetryApplicationId"))!==null&&e!==void 0?e:"";const r=n.get("applicationSpecifier");if(r)this._applicationSpecifier=r;else{const s=t.hostname.split(".");this._applicationSpecifier=s[0]||""}if(!this._applicationSpecifier||this._applicationSpecifier.length!==40)throw new Error(`Invalid applicationSpecifier: expected 40-character hash, got "${this._applicationSpecifier}"`);if(!this._applicationInstance)throw new Error("Missing telemetryApplicationId query parameter");this._windowMessageHandler=s=>{if(s.source===window||!s.data||!("type"in s.data)||s.data.type!=="client"&&s.data.type!=="bridge")return;if(s.data.type==="client"){window.parent.postMessage(s.data,"*");return}const l=R.safeParse(s.data);if(!l.success)return;const u=l.data,a=this._onHandlers.get(u.name),h=this._onceHandlers.get(u.name);if(a)for(const c of a)c(u.data);if(h){for(const c of h)c(u.data);this._onceHandlers.delete(u.name)}for(let c=0;c<window.frames.length;c+=1)window.frames[c].postMessage(s.data,"*")},window.addEventListener("message",this._windowMessageHandler)}unbind(){this._windowMessageHandler&&window.removeEventListener("message",this._windowMessageHandler)}send(e,t){const n=S({telemetrySdkVersion:_,applicationName:this._applicationName,applicationSpecifier:this._applicationSpecifier,applicationInstance:this._applicationInstance,name:e,data:t});window.parent.postMessage(n,"*")}request(e,t){const n=v(),r=S({telemetrySdkVersion:_,applicationName:this._applicationName,applicationSpecifier:this._applicationSpecifier,applicationInstance:this._applicationInstance,name:e,data:t,responseName:n});window.parent.postMessage(r,"*");let s=!1,l;const u=new Promise((h,c)=>{const d=new Error(`${e} message request with response name of ${n} timed out after ${g}`);setTimeout(()=>{s=!0,this.off(n,l),c(d)},g)}),a=new Promise(h=>{l=c=>{s||h(c)},this.once(n,h)});return Promise.race([u,a])}async subscribe(e,t,n){let r,s;typeof t=="function"?s=t:(r=t,s=n);const l=v(),u=v();let a=this._subscriptionNamesBySubjectName.get(e);a||(a=[],this._subscriptionNamesBySubjectName.set(e,a)),a.push(l),this._subscriptionNamesByHandler.set(s,l),this.on(l,s);const h=S({telemetrySdkVersion:_,applicationName:this._applicationName,applicationSpecifier:this._applicationSpecifier,applicationInstance:this._applicationInstance,name:e,data:r,responseName:u,subscriptionName:l});window.parent.postMessage(h,"*");let c=!1,d;const N=new Promise((w,f)=>{const m=new Error(`${e} subscribe request with subscription name of ${l} and response name of ${u} timed out after ${g}`);setTimeout(()=>{c=!0,this.off(u,d),f(m)},g)}),H=new Promise(w=>{d=f=>{c||w(f)},this.on(u,w)});return Promise.race([N,H])}async unsubscribe(e,t,n){let r,s;typeof t=="function"?s=t:(r=t,s=n);const l=v();let u=[];if(s){const a=this._subscriptionNamesByHandler.get(s);if(!a)return{success:!1};u=[a],this._subscriptionNamesByHandler.delete(s)}else if(!this._subscriptionNamesBySubjectName.get(e))return{success:!1};for await(const a of u){this.off(a,s);const h=S({telemetrySdkVersion:_,applicationInstance:this._applicationInstance,applicationName:this._applicationName,applicationSpecifier:this._applicationSpecifier,name:e,data:r,responseName:l,unsubscribeName:a});window.parent.postMessage(h,"*");let c=!1,d;const N=new Promise((f,m)=>{const k=new Error(`${e} unsubscribe request with unsubscribe name of ${a} and response name of ${l} timed out after ${g}`);setTimeout(()=>{c=!0,this.off(l,d),m(k)},g)}),H=new Promise(f=>{d=m=>{c||f(m)},this.once(l,f)});if(!(await Promise.race([N,H])).success)return{success:!1}}return{success:!0}}on(e,t){var n;const r=(n=this._onHandlers.get(e))!==null&&n!==void 0?n:[];r.length===0&&this._onHandlers.set(e,r),r.push(t)}once(e,t){var n;const r=(n=this._onceHandlers.get(e))!==null&&n!==void 0?n:[];r.length===0&&this._onceHandlers.set(e,r),r.push(t)}off(e,t){const n=this._onHandlers.get(e),r=this._onceHandlers.get(e);if(!(!n&&!r)){if(n){for(let s=0;s<n.length;s+=1)t&&n[s]!==t||(n.splice(s,1),s-=1);n.length===0&&this._onHandlers.delete(e)}if(r){for(let s=0;s<r.length;s+=1)t&&r[s]!==t||(r.splice(s,1),s-=1);r.length===0&&this._onceHandlers.delete(e)}}}}function v(){return Math.random().toString(36).slice(2,9)}const _=T.version;let i=null;function z(){return i}function L(o){i=new C(o),i.bind()}function U(){i==null||i.unbind(),i=null}function V(...o){return p(i),i.on(...o)}function O(...o){return p(i),i.once(...o)}function W(...o){return p(i),i.off(...o)}function G(...o){return p(i),i.send(...o)}function J(...o){return p(i),i.request(...o)}function K(...o){return p(i),i.subscribe(...o)}function Q(...o){return p(i),i.unsubscribe(...o)}function X(){return p(i),i.store}function Y(){return p(i),i.applications}function Z(){return p(i),i.media}function ee(){return p(i),i.accounts}function te(){return p(i),i.users}function se(){return p(i),i.devices}function ne(){return p(i),i.proxy}function ie(){return p(i),i.rootSettingsNavigation}function re(){return p(i),i.weather}function p(o){if(!o)throw new Error("SDK is not configured")}exports.Accounts=q;exports.Applications=I;exports.Client=C;exports.Devices=P;exports.Environment=x;exports.Media=E;exports.Store=M;exports.Users=A;exports.Weather=B;exports.accounts=ee;exports.applications=Y;exports.configure=L;exports.destroy=U;exports.devices=se;exports.globalClient=z;exports.media=Z;exports.off=W;exports.on=V;exports.once=O;exports.proxy=ne;exports.request=J;exports.rootSettingsNavigation=ie;exports.send=G;exports.store=X;exports.subscribe=K;exports.telemetrySdkVersion=_;exports.unsubscribe=Q;exports.users=te;exports.weather=re;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Accounts } from './accounts.js';
|
|
2
2
|
export { Applications } from './applications.js';
|
|
3
|
-
export { Devices } from './
|
|
3
|
+
export { Devices } from './devices.js';
|
|
4
4
|
export { Environment } from './environment.js';
|
|
5
5
|
export { Media } from './media.js';
|
|
6
6
|
export { Store } from './store.js';
|
|
@@ -219,12 +219,12 @@ export declare function users(): import("./users.js").Users;
|
|
|
219
219
|
* @returns The Devices API object
|
|
220
220
|
* @throws {Error} If called before configure() or after destroy()
|
|
221
221
|
*/
|
|
222
|
-
export declare function devices(): import("./
|
|
222
|
+
export declare function devices(): import("./devices.js").Devices;
|
|
223
223
|
/**
|
|
224
|
-
* Provides access to the proxy API for fetching third-party content through the TelemetryOS
|
|
224
|
+
* Provides access to the proxy API for fetching third-party content through the TelemetryOS API.
|
|
225
225
|
*
|
|
226
|
-
* This API allows applications to fetch content from external URLs through the platform
|
|
227
|
-
*
|
|
226
|
+
* This API allows applications to fetch content from external URLs through the platform,
|
|
227
|
+
* which handles authentication, caching, bandwidth quotas, and CORS issues.
|
|
228
228
|
* The proxy is useful for accessing external APIs or content that may have CORS restrictions.
|
|
229
229
|
*
|
|
230
230
|
* @returns The Proxy API object
|
|
@@ -254,8 +254,7 @@ export declare function rootSettingsNavigation(): import("./root-settings-naviga
|
|
|
254
254
|
* Provides access to the weather API for retrieving weather information.
|
|
255
255
|
*
|
|
256
256
|
* This API allows applications to fetch current weather conditions and forecasts
|
|
257
|
-
* for specified locations through the TelemetryOS
|
|
258
|
-
* It supports multiple weather providers including WeatherBit and AccuWeather.
|
|
257
|
+
* for specified locations through the TelemetryOS API.
|
|
259
258
|
*
|
|
260
259
|
* @returns The Weather API object
|
|
261
260
|
* @throws {Error} If called before configure() or after destroy()
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { z as
|
|
2
|
-
const
|
|
3
|
-
version:
|
|
1
|
+
import { z as w } from "./index-B98VDFRY.js";
|
|
2
|
+
const I = "1.4.4", P = {
|
|
3
|
+
version: I
|
|
4
4
|
};
|
|
5
5
|
class E {
|
|
6
6
|
constructor(e) {
|
|
@@ -21,7 +21,7 @@ class E {
|
|
|
21
21
|
return e.account;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
class
|
|
24
|
+
class M {
|
|
25
25
|
constructor(e) {
|
|
26
26
|
this._client = e;
|
|
27
27
|
}
|
|
@@ -83,7 +83,7 @@ class I {
|
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
-
class
|
|
86
|
+
class A {
|
|
87
87
|
constructor(e) {
|
|
88
88
|
this._client = e;
|
|
89
89
|
}
|
|
@@ -107,10 +107,10 @@ class P {
|
|
|
107
107
|
return e.deviceInformation;
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function B(o, e = console.error) {
|
|
111
111
|
o().catch(e);
|
|
112
112
|
}
|
|
113
|
-
class
|
|
113
|
+
class L {
|
|
114
114
|
constructor(e) {
|
|
115
115
|
this._client = e;
|
|
116
116
|
}
|
|
@@ -118,7 +118,7 @@ class D {
|
|
|
118
118
|
return (await this._client.request("environment.getColorScheme", {})).colorScheme;
|
|
119
119
|
}
|
|
120
120
|
subscribeColorScheme(e) {
|
|
121
|
-
|
|
121
|
+
B(async () => {
|
|
122
122
|
this._client.on("environment.colorSchemeChanged", e), e(await this.getColorScheme());
|
|
123
123
|
});
|
|
124
124
|
}
|
|
@@ -126,7 +126,7 @@ class D {
|
|
|
126
126
|
this._client.off("environment.colorSchemeChanged", e);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
class
|
|
129
|
+
class C {
|
|
130
130
|
constructor(e) {
|
|
131
131
|
this._client = e;
|
|
132
132
|
}
|
|
@@ -172,7 +172,7 @@ class M {
|
|
|
172
172
|
})).content;
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
class
|
|
175
|
+
class F {
|
|
176
176
|
constructor(e) {
|
|
177
177
|
this._client = e;
|
|
178
178
|
}
|
|
@@ -186,7 +186,7 @@ class B {
|
|
|
186
186
|
* @returns A StoreSlice instance for the application scope
|
|
187
187
|
*/
|
|
188
188
|
get application() {
|
|
189
|
-
return new
|
|
189
|
+
return new y("application", "", this._client);
|
|
190
190
|
}
|
|
191
191
|
/**
|
|
192
192
|
* Provides access to the instance store scope.
|
|
@@ -200,7 +200,7 @@ class B {
|
|
|
200
200
|
* @returns A StoreSlice instance for the instance scope
|
|
201
201
|
*/
|
|
202
202
|
get instance() {
|
|
203
|
-
return new
|
|
203
|
+
return new y("instance", this._client.applicationSpecifier, this._client);
|
|
204
204
|
}
|
|
205
205
|
/**
|
|
206
206
|
* Provides access to the device store scope.
|
|
@@ -215,7 +215,7 @@ class B {
|
|
|
215
215
|
* @returns A StoreSlice instance for the device scope
|
|
216
216
|
*/
|
|
217
217
|
get device() {
|
|
218
|
-
return new
|
|
218
|
+
return new y("device", this._client.applicationSpecifier, this._client);
|
|
219
219
|
}
|
|
220
220
|
/**
|
|
221
221
|
* Provides access to the shared store scope with a specified namespace.
|
|
@@ -231,10 +231,10 @@ class B {
|
|
|
231
231
|
* @returns A StoreSlice instance for the specified shared namespace
|
|
232
232
|
*/
|
|
233
233
|
shared(e) {
|
|
234
|
-
return new
|
|
234
|
+
return new y("shared", e, this._client);
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
|
-
class
|
|
237
|
+
class y {
|
|
238
238
|
constructor(e, t, n) {
|
|
239
239
|
this._kind = e, this._namespace = t, this._client = n;
|
|
240
240
|
}
|
|
@@ -302,7 +302,7 @@ class _ {
|
|
|
302
302
|
*
|
|
303
303
|
* @param key The key to unsubscribe from
|
|
304
304
|
* @param handler Optional. The specific handler to remove. If not provided, all handlers for this key will be removed.
|
|
305
|
-
* @returns A promise that resolves to true if the
|
|
305
|
+
* @returns A promise that resolves to true if the unsubscribe was successful
|
|
306
306
|
*/
|
|
307
307
|
async unsubscribe(e, t) {
|
|
308
308
|
return (await this._client.unsubscribe("store.unsubscribe", {
|
|
@@ -328,7 +328,7 @@ class _ {
|
|
|
328
328
|
})).success;
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
|
-
class
|
|
331
|
+
class k {
|
|
332
332
|
constructor(e) {
|
|
333
333
|
this._client = e;
|
|
334
334
|
}
|
|
@@ -351,12 +351,12 @@ class C {
|
|
|
351
351
|
return e.user;
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
|
-
class
|
|
354
|
+
class T {
|
|
355
355
|
constructor(e) {
|
|
356
356
|
this._client = e;
|
|
357
357
|
}
|
|
358
358
|
/**
|
|
359
|
-
* Retrieves current weather conditions for a specified location
|
|
359
|
+
* Retrieves current weather conditions for a specified location.
|
|
360
360
|
*
|
|
361
361
|
* @param params - Weather request parameters including location and units
|
|
362
362
|
* @returns A promise that resolves to the current weather conditions
|
|
@@ -381,7 +381,7 @@ class k {
|
|
|
381
381
|
return t.conditions;
|
|
382
382
|
}
|
|
383
383
|
/**
|
|
384
|
-
* Retrieves daily weather forecast for a specified location
|
|
384
|
+
* Retrieves daily weather forecast for a specified location.
|
|
385
385
|
*
|
|
386
386
|
* @param params - Forecast request parameters including location, units, and number of days
|
|
387
387
|
* @returns A promise that resolves to an array of daily forecast data
|
|
@@ -404,7 +404,7 @@ class k {
|
|
|
404
404
|
return t.forecast;
|
|
405
405
|
}
|
|
406
406
|
/**
|
|
407
|
-
* Retrieves hourly weather forecast for a specified location
|
|
407
|
+
* Retrieves hourly weather forecast for a specified location.
|
|
408
408
|
*
|
|
409
409
|
* @param params - Forecast request parameters including location, units, and number of hours
|
|
410
410
|
* @returns A promise that resolves to an array of hourly forecast data
|
|
@@ -426,75 +426,16 @@ class k {
|
|
|
426
426
|
throw new Error(t.error || "Failed to fetch hourly forecast");
|
|
427
427
|
return t.forecast;
|
|
428
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
429
|
}
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
430
|
+
function b(o) {
|
|
431
|
+
return { ...o, type: "client" };
|
|
432
|
+
}
|
|
433
|
+
const $ = w.object({
|
|
434
|
+
type: w.literal("bridge"),
|
|
435
|
+
name: w.string(),
|
|
436
|
+
data: w.any()
|
|
496
437
|
});
|
|
497
|
-
class
|
|
438
|
+
class x {
|
|
498
439
|
/**
|
|
499
440
|
* Creates a new RootSettingsNavigation API instance.
|
|
500
441
|
*
|
|
@@ -517,11 +458,12 @@ class $ {
|
|
|
517
458
|
* @returns A promise that resolves when the navigation has been registered
|
|
518
459
|
*/
|
|
519
460
|
async setRootSettingsNavigation(e) {
|
|
520
|
-
|
|
521
|
-
n
|
|
522
|
-
|
|
461
|
+
var t;
|
|
462
|
+
const n = this._store.shared("root-settings-navigation"), r = (t = await n.get("navigation")) !== null && t !== void 0 ? t : {}, s = this._store._client._applicationSpecifier;
|
|
463
|
+
r[s] = {
|
|
464
|
+
applicationSpecifier: s,
|
|
523
465
|
entries: e.entries
|
|
524
|
-
},
|
|
466
|
+
}, n.set("navigation", r);
|
|
525
467
|
}
|
|
526
468
|
/**
|
|
527
469
|
* Retrieves the current navigation entries for this root application.
|
|
@@ -532,8 +474,9 @@ class $ {
|
|
|
532
474
|
* @returns A promise that resolves to the navigation state for this application
|
|
533
475
|
*/
|
|
534
476
|
async getRootSettingsNavigation() {
|
|
535
|
-
|
|
536
|
-
|
|
477
|
+
var e;
|
|
478
|
+
const n = (e = await this._store.shared("root-settings-navigation").get("navigation")) !== null && e !== void 0 ? e : {}, r = this._store._client._applicationSpecifier;
|
|
479
|
+
return n[r];
|
|
537
480
|
}
|
|
538
481
|
/**
|
|
539
482
|
* Retrieves the navigation entries for all root applications.
|
|
@@ -545,10 +488,11 @@ class $ {
|
|
|
545
488
|
* @returns A promise that resolves to the navigation state for all applications
|
|
546
489
|
*/
|
|
547
490
|
async getAllRootSettingsNavigation() {
|
|
548
|
-
|
|
491
|
+
var e;
|
|
492
|
+
return (e = await this._store.shared("root-settings-navigation").get("navigation")) !== null && e !== void 0 ? e : {};
|
|
549
493
|
}
|
|
550
494
|
}
|
|
551
|
-
class
|
|
495
|
+
class R {
|
|
552
496
|
constructor(e) {
|
|
553
497
|
this._client = e;
|
|
554
498
|
}
|
|
@@ -565,10 +509,10 @@ class x {
|
|
|
565
509
|
integrity: e.integrity
|
|
566
510
|
}));
|
|
567
511
|
let r = {};
|
|
568
|
-
t != null && t.headers && (t.headers instanceof Headers ? t.headers.forEach((
|
|
569
|
-
r[c] =
|
|
570
|
-
}) : Array.isArray(t.headers) ? t.headers.forEach(([
|
|
571
|
-
r[
|
|
512
|
+
t != null && t.headers && (t.headers instanceof Headers ? t.headers.forEach((h, c) => {
|
|
513
|
+
r[c] = h;
|
|
514
|
+
}) : Array.isArray(t.headers) ? t.headers.forEach(([h, c]) => {
|
|
515
|
+
r[h] = c;
|
|
572
516
|
}) : r = t.headers);
|
|
573
517
|
const s = await this._client.request("proxy.fetch", {
|
|
574
518
|
url: n,
|
|
@@ -588,7 +532,7 @@ class x {
|
|
|
588
532
|
}
|
|
589
533
|
}
|
|
590
534
|
const g = 1e3 * 30;
|
|
591
|
-
class
|
|
535
|
+
class j {
|
|
592
536
|
/**
|
|
593
537
|
* Creates a new Client instance for communicating with the TelemetryOS platform.
|
|
594
538
|
*
|
|
@@ -628,7 +572,7 @@ class W {
|
|
|
628
572
|
* @returns A Users instance bound to this client
|
|
629
573
|
*/
|
|
630
574
|
get users() {
|
|
631
|
-
return new
|
|
575
|
+
return new k(this);
|
|
632
576
|
}
|
|
633
577
|
/**
|
|
634
578
|
* Provides access to the store API for data persistence with multiple storage scopes.
|
|
@@ -642,7 +586,7 @@ class W {
|
|
|
642
586
|
* @returns A Store instance bound to this client
|
|
643
587
|
*/
|
|
644
588
|
get store() {
|
|
645
|
-
return new
|
|
589
|
+
return new F(this);
|
|
646
590
|
}
|
|
647
591
|
/**
|
|
648
592
|
* Provides access to the applications API for discovering other TelemetryOS applications.
|
|
@@ -656,7 +600,7 @@ class W {
|
|
|
656
600
|
* @returns An Applications instance bound to this client
|
|
657
601
|
*/
|
|
658
602
|
get applications() {
|
|
659
|
-
return new
|
|
603
|
+
return new M(this);
|
|
660
604
|
}
|
|
661
605
|
/**
|
|
662
606
|
* Provides access to the media API for working with content hosted on the TelemetryOS platform.
|
|
@@ -671,13 +615,13 @@ class W {
|
|
|
671
615
|
* @returns A Media instance bound to this client
|
|
672
616
|
*/
|
|
673
617
|
get media() {
|
|
674
|
-
return new
|
|
618
|
+
return new C(this);
|
|
675
619
|
}
|
|
676
620
|
/**
|
|
677
|
-
* Provides access to the proxy API for fetching third-party content through the TelemetryOS
|
|
621
|
+
* Provides access to the proxy API for fetching third-party content through the TelemetryOS API.
|
|
678
622
|
*
|
|
679
623
|
* This property returns a new Proxy instance that allows applications to fetch content from external
|
|
680
|
-
* URLs through the platform
|
|
624
|
+
* URLs through the platform, which handles authentication, caching, and CORS issues.
|
|
681
625
|
*
|
|
682
626
|
* NOTE: Most application developers should use the global proxy() function
|
|
683
627
|
* instead of accessing this property directly.
|
|
@@ -685,7 +629,7 @@ class W {
|
|
|
685
629
|
* @returns A Proxy instance bound to this client
|
|
686
630
|
*/
|
|
687
631
|
get proxy() {
|
|
688
|
-
return new
|
|
632
|
+
return new R(this);
|
|
689
633
|
}
|
|
690
634
|
/**
|
|
691
635
|
* Provides access to the devices API for interacting with the current device.
|
|
@@ -700,7 +644,7 @@ class W {
|
|
|
700
644
|
* @returns A Devices instance bound to this client
|
|
701
645
|
*/
|
|
702
646
|
get devices() {
|
|
703
|
-
return new
|
|
647
|
+
return new A(this);
|
|
704
648
|
}
|
|
705
649
|
/**
|
|
706
650
|
* Provides access to the root settings navigation API for TelemetryOS administration UI integration.
|
|
@@ -718,14 +662,13 @@ class W {
|
|
|
718
662
|
* @throws {Error} If used by an application not mounted at the 'rootSettingsNavigation' mount point
|
|
719
663
|
*/
|
|
720
664
|
get rootSettingsNavigation() {
|
|
721
|
-
return new
|
|
665
|
+
return new x(this.store);
|
|
722
666
|
}
|
|
723
667
|
/**
|
|
724
668
|
* Provides access to the weather API for retrieving weather data.
|
|
725
669
|
*
|
|
726
670
|
* This property returns a new Weather instance that allows applications to fetch
|
|
727
|
-
* current weather conditions and forecasts
|
|
728
|
-
* through the General Integrations Service.
|
|
671
|
+
* current weather conditions and forecasts through the TelemetryOS API.
|
|
729
672
|
*
|
|
730
673
|
* NOTE: Most application developers should use the global weather() function
|
|
731
674
|
* instead of accessing this property directly.
|
|
@@ -733,7 +676,7 @@ class W {
|
|
|
733
676
|
* @returns A Weather instance bound to this client
|
|
734
677
|
*/
|
|
735
678
|
get weather() {
|
|
736
|
-
return new
|
|
679
|
+
return new T(this);
|
|
737
680
|
}
|
|
738
681
|
get applicationName() {
|
|
739
682
|
return this._applicationName;
|
|
@@ -775,22 +718,26 @@ class W {
|
|
|
775
718
|
if (!this._applicationInstance)
|
|
776
719
|
throw new Error("Missing telemetryApplicationId query parameter");
|
|
777
720
|
this._windowMessageHandler = (s) => {
|
|
778
|
-
if (s.source === window)
|
|
721
|
+
if (s.source === window || !s.data || !("type" in s.data) || s.data.type !== "client" && s.data.type !== "bridge")
|
|
779
722
|
return;
|
|
780
|
-
|
|
781
|
-
window.
|
|
782
|
-
|
|
723
|
+
if (s.data.type === "client") {
|
|
724
|
+
window.parent.postMessage(s.data, "*");
|
|
725
|
+
return;
|
|
726
|
+
}
|
|
727
|
+
const l = $.safeParse(s.data);
|
|
783
728
|
if (!l.success)
|
|
784
729
|
return;
|
|
785
|
-
const u = l.data, a = this._onHandlers.get(u.name),
|
|
730
|
+
const u = l.data, a = this._onHandlers.get(u.name), h = this._onceHandlers.get(u.name);
|
|
786
731
|
if (a)
|
|
787
732
|
for (const c of a)
|
|
788
733
|
c(u.data);
|
|
789
|
-
if (
|
|
790
|
-
for (const c of
|
|
734
|
+
if (h) {
|
|
735
|
+
for (const c of h)
|
|
791
736
|
c(u.data);
|
|
792
737
|
this._onceHandlers.delete(u.name);
|
|
793
738
|
}
|
|
739
|
+
for (let c = 0; c < window.frames.length; c += 1)
|
|
740
|
+
window.frames[c].postMessage(s.data, "*");
|
|
794
741
|
}, window.addEventListener("message", this._windowMessageHandler);
|
|
795
742
|
}
|
|
796
743
|
/**
|
|
@@ -823,14 +770,14 @@ class W {
|
|
|
823
770
|
* @param data The data payload to include with the message
|
|
824
771
|
*/
|
|
825
772
|
send(e, t) {
|
|
826
|
-
const n = {
|
|
827
|
-
telemetrySdkVersion:
|
|
773
|
+
const n = b({
|
|
774
|
+
telemetrySdkVersion: v,
|
|
828
775
|
applicationName: this._applicationName,
|
|
829
776
|
applicationSpecifier: this._applicationSpecifier,
|
|
830
777
|
applicationInstance: this._applicationInstance,
|
|
831
778
|
name: e,
|
|
832
779
|
data: t
|
|
833
|
-
};
|
|
780
|
+
});
|
|
834
781
|
window.parent.postMessage(n, "*");
|
|
835
782
|
}
|
|
836
783
|
/**
|
|
@@ -851,37 +798,37 @@ class W {
|
|
|
851
798
|
* @throws {Error} If the request times out
|
|
852
799
|
*/
|
|
853
800
|
request(e, t) {
|
|
854
|
-
const n =
|
|
855
|
-
telemetrySdkVersion:
|
|
801
|
+
const n = S(), r = b({
|
|
802
|
+
telemetrySdkVersion: v,
|
|
856
803
|
applicationName: this._applicationName,
|
|
857
804
|
applicationSpecifier: this._applicationSpecifier,
|
|
858
805
|
applicationInstance: this._applicationInstance,
|
|
859
806
|
name: e,
|
|
860
807
|
data: t,
|
|
861
808
|
responseName: n
|
|
862
|
-
};
|
|
809
|
+
});
|
|
863
810
|
window.parent.postMessage(r, "*");
|
|
864
811
|
let s = !1, l;
|
|
865
|
-
const u = new Promise((
|
|
812
|
+
const u = new Promise((h, c) => {
|
|
866
813
|
const d = new Error(`${e} message request with response name of ${n} timed out after ${g}`);
|
|
867
814
|
setTimeout(() => {
|
|
868
815
|
s = !0, this.off(n, l), c(d);
|
|
869
816
|
}, g);
|
|
870
|
-
}), a = new Promise((
|
|
817
|
+
}), a = new Promise((h) => {
|
|
871
818
|
l = (c) => {
|
|
872
|
-
s ||
|
|
873
|
-
}, this.once(n,
|
|
819
|
+
s || h(c);
|
|
820
|
+
}, this.once(n, h);
|
|
874
821
|
});
|
|
875
822
|
return Promise.race([u, a]);
|
|
876
823
|
}
|
|
877
824
|
async subscribe(e, t, n) {
|
|
878
825
|
let r, s;
|
|
879
826
|
typeof t == "function" ? s = t : (r = t, s = n);
|
|
880
|
-
const l =
|
|
827
|
+
const l = S(), u = S();
|
|
881
828
|
let a = this._subscriptionNamesBySubjectName.get(e);
|
|
882
829
|
a || (a = [], this._subscriptionNamesBySubjectName.set(e, a)), a.push(l), this._subscriptionNamesByHandler.set(s, l), this.on(l, s);
|
|
883
|
-
const
|
|
884
|
-
telemetrySdkVersion:
|
|
830
|
+
const h = b({
|
|
831
|
+
telemetrySdkVersion: v,
|
|
885
832
|
applicationName: this._applicationName,
|
|
886
833
|
applicationSpecifier: this._applicationSpecifier,
|
|
887
834
|
applicationInstance: this._applicationInstance,
|
|
@@ -889,25 +836,25 @@ class W {
|
|
|
889
836
|
data: r,
|
|
890
837
|
responseName: u,
|
|
891
838
|
subscriptionName: l
|
|
892
|
-
};
|
|
893
|
-
window.parent.postMessage(
|
|
839
|
+
});
|
|
840
|
+
window.parent.postMessage(h, "*");
|
|
894
841
|
let c = !1, d;
|
|
895
|
-
const
|
|
842
|
+
const N = new Promise((_, f) => {
|
|
896
843
|
const m = new Error(`${e} subscribe request with subscription name of ${l} and response name of ${u} timed out after ${g}`);
|
|
897
844
|
setTimeout(() => {
|
|
898
845
|
c = !0, this.off(u, d), f(m);
|
|
899
846
|
}, g);
|
|
900
|
-
}),
|
|
847
|
+
}), H = new Promise((_) => {
|
|
901
848
|
d = (f) => {
|
|
902
|
-
c ||
|
|
903
|
-
}, this.on(u,
|
|
849
|
+
c || _(f);
|
|
850
|
+
}, this.on(u, _);
|
|
904
851
|
});
|
|
905
|
-
return Promise.race([
|
|
852
|
+
return Promise.race([N, H]);
|
|
906
853
|
}
|
|
907
854
|
async unsubscribe(e, t, n) {
|
|
908
855
|
let r, s;
|
|
909
856
|
typeof t == "function" ? s = t : (r = t, s = n);
|
|
910
|
-
const l =
|
|
857
|
+
const l = S();
|
|
911
858
|
let u = [];
|
|
912
859
|
if (s) {
|
|
913
860
|
const a = this._subscriptionNamesByHandler.get(s);
|
|
@@ -918,8 +865,8 @@ class W {
|
|
|
918
865
|
return { success: !1 };
|
|
919
866
|
for await (const a of u) {
|
|
920
867
|
this.off(a, s);
|
|
921
|
-
const
|
|
922
|
-
telemetrySdkVersion:
|
|
868
|
+
const h = b({
|
|
869
|
+
telemetrySdkVersion: v,
|
|
923
870
|
applicationInstance: this._applicationInstance,
|
|
924
871
|
applicationName: this._applicationName,
|
|
925
872
|
applicationSpecifier: this._applicationSpecifier,
|
|
@@ -927,20 +874,20 @@ class W {
|
|
|
927
874
|
data: r,
|
|
928
875
|
responseName: l,
|
|
929
876
|
unsubscribeName: a
|
|
930
|
-
};
|
|
931
|
-
window.parent.postMessage(
|
|
877
|
+
});
|
|
878
|
+
window.parent.postMessage(h, "*");
|
|
932
879
|
let c = !1, d;
|
|
933
|
-
const
|
|
934
|
-
const
|
|
880
|
+
const N = new Promise((f, m) => {
|
|
881
|
+
const q = new Error(`${e} unsubscribe request with unsubscribe name of ${a} and response name of ${l} timed out after ${g}`);
|
|
935
882
|
setTimeout(() => {
|
|
936
|
-
c = !0, this.off(l, d), m(
|
|
883
|
+
c = !0, this.off(l, d), m(q);
|
|
937
884
|
}, g);
|
|
938
|
-
}),
|
|
885
|
+
}), H = new Promise((f) => {
|
|
939
886
|
d = (m) => {
|
|
940
887
|
c || f(m);
|
|
941
888
|
}, this.once(l, f);
|
|
942
889
|
});
|
|
943
|
-
if (!(await Promise.race([
|
|
890
|
+
if (!(await Promise.race([N, H])).success)
|
|
944
891
|
return { success: !1 };
|
|
945
892
|
}
|
|
946
893
|
return { success: !0 };
|
|
@@ -1017,100 +964,100 @@ class W {
|
|
|
1017
964
|
}
|
|
1018
965
|
}
|
|
1019
966
|
}
|
|
1020
|
-
function
|
|
967
|
+
function S() {
|
|
1021
968
|
return Math.random().toString(36).slice(2, 9);
|
|
1022
969
|
}
|
|
1023
|
-
const
|
|
970
|
+
const v = P.version;
|
|
1024
971
|
let i = null;
|
|
1025
|
-
function
|
|
972
|
+
function U() {
|
|
1026
973
|
return i;
|
|
1027
974
|
}
|
|
1028
|
-
function
|
|
1029
|
-
i = new
|
|
975
|
+
function V(o) {
|
|
976
|
+
i = new j(o), i.bind();
|
|
1030
977
|
}
|
|
1031
|
-
function
|
|
978
|
+
function z() {
|
|
1032
979
|
i == null || i.unbind(), i = null;
|
|
1033
980
|
}
|
|
1034
|
-
function V(...o) {
|
|
1035
|
-
return h(i), i.on(...o);
|
|
1036
|
-
}
|
|
1037
|
-
function z(...o) {
|
|
1038
|
-
return h(i), i.once(...o);
|
|
1039
|
-
}
|
|
1040
981
|
function G(...o) {
|
|
1041
|
-
return
|
|
982
|
+
return p(i), i.on(...o);
|
|
1042
983
|
}
|
|
1043
984
|
function J(...o) {
|
|
1044
|
-
return
|
|
985
|
+
return p(i), i.once(...o);
|
|
1045
986
|
}
|
|
1046
987
|
function K(...o) {
|
|
1047
|
-
return
|
|
988
|
+
return p(i), i.off(...o);
|
|
1048
989
|
}
|
|
1049
990
|
function O(...o) {
|
|
1050
|
-
return
|
|
991
|
+
return p(i), i.send(...o);
|
|
992
|
+
}
|
|
993
|
+
function W(...o) {
|
|
994
|
+
return p(i), i.request(...o);
|
|
1051
995
|
}
|
|
1052
996
|
function Q(...o) {
|
|
1053
|
-
return
|
|
997
|
+
return p(i), i.subscribe(...o);
|
|
1054
998
|
}
|
|
1055
|
-
function X() {
|
|
1056
|
-
return
|
|
999
|
+
function X(...o) {
|
|
1000
|
+
return p(i), i.unsubscribe(...o);
|
|
1057
1001
|
}
|
|
1058
1002
|
function Y() {
|
|
1059
|
-
return
|
|
1003
|
+
return p(i), i.store;
|
|
1060
1004
|
}
|
|
1061
1005
|
function Z() {
|
|
1062
|
-
return
|
|
1006
|
+
return p(i), i.applications;
|
|
1063
1007
|
}
|
|
1064
1008
|
function ee() {
|
|
1065
|
-
return
|
|
1009
|
+
return p(i), i.media;
|
|
1066
1010
|
}
|
|
1067
1011
|
function te() {
|
|
1068
|
-
return
|
|
1012
|
+
return p(i), i.accounts;
|
|
1069
1013
|
}
|
|
1070
1014
|
function se() {
|
|
1071
|
-
return
|
|
1015
|
+
return p(i), i.users;
|
|
1072
1016
|
}
|
|
1073
1017
|
function ne() {
|
|
1074
|
-
return
|
|
1018
|
+
return p(i), i.devices;
|
|
1075
1019
|
}
|
|
1076
1020
|
function ie() {
|
|
1077
|
-
return
|
|
1021
|
+
return p(i), i.proxy;
|
|
1078
1022
|
}
|
|
1079
1023
|
function re() {
|
|
1080
|
-
return
|
|
1024
|
+
return p(i), i.rootSettingsNavigation;
|
|
1025
|
+
}
|
|
1026
|
+
function oe() {
|
|
1027
|
+
return p(i), i.weather;
|
|
1081
1028
|
}
|
|
1082
|
-
function
|
|
1029
|
+
function p(o) {
|
|
1083
1030
|
if (!o)
|
|
1084
1031
|
throw new Error("SDK is not configured");
|
|
1085
1032
|
}
|
|
1086
1033
|
export {
|
|
1087
1034
|
E as Accounts,
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1035
|
+
M as Applications,
|
|
1036
|
+
j as Client,
|
|
1037
|
+
A as Devices,
|
|
1038
|
+
L as Environment,
|
|
1039
|
+
C as Media,
|
|
1040
|
+
F as Store,
|
|
1041
|
+
k as Users,
|
|
1042
|
+
T as Weather,
|
|
1043
|
+
te as accounts,
|
|
1044
|
+
Z as applications,
|
|
1045
|
+
V as configure,
|
|
1046
|
+
z as destroy,
|
|
1047
|
+
ne as devices,
|
|
1048
|
+
U as globalClient,
|
|
1049
|
+
ee as media,
|
|
1050
|
+
K as off,
|
|
1051
|
+
G as on,
|
|
1052
|
+
J as once,
|
|
1053
|
+
ie as proxy,
|
|
1054
|
+
W as request,
|
|
1055
|
+
re as rootSettingsNavigation,
|
|
1056
|
+
O as send,
|
|
1057
|
+
Y as store,
|
|
1058
|
+
Q as subscribe,
|
|
1059
|
+
v as telemetrySdkVersion,
|
|
1060
|
+
X as unsubscribe,
|
|
1061
|
+
se as users,
|
|
1062
|
+
oe as weather
|
|
1116
1063
|
};
|
package/dist/proxy.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { Client } from './client.js';
|
|
2
2
|
/**
|
|
3
|
-
* Provides a proxy API for fetching third-party content through the TelemetryOS
|
|
3
|
+
* Provides a proxy API for fetching third-party content through the TelemetryOS API.
|
|
4
4
|
*
|
|
5
|
-
* This API allows applications to fetch content from external URLs through the platform
|
|
6
|
-
*
|
|
5
|
+
* This API allows applications to fetch content from external URLs through the platform,
|
|
6
|
+
* which handles authentication, caching, bandwidth quotas, and CORS issues.
|
|
7
7
|
* The proxy is useful for accessing external APIs or content that may have CORS restrictions.
|
|
8
8
|
*/
|
|
9
9
|
export declare class Proxy {
|
|
10
10
|
_client: Client;
|
|
11
11
|
constructor(client: Client);
|
|
12
12
|
/**
|
|
13
|
-
* Fetches content from an external URL through the TelemetryOS
|
|
13
|
+
* Fetches content from an external URL through the TelemetryOS API.
|
|
14
14
|
*
|
|
15
15
|
* This method has the same interface as the native `fetch()` API but routes the request through
|
|
16
|
-
* the platform
|
|
16
|
+
* the platform. This is useful for:
|
|
17
17
|
* - Accessing external APIs that have CORS restrictions
|
|
18
18
|
* - Fetching content with platform authentication
|
|
19
19
|
* - Benefiting from platform caching and bandwidth management
|
package/dist/store.d.ts
CHANGED
|
@@ -78,7 +78,7 @@ declare class StoreSlice {
|
|
|
78
78
|
* @param value The value to store - must be JSON serializable
|
|
79
79
|
* @returns A promise that resolves to true if the value was saved successfully
|
|
80
80
|
*/
|
|
81
|
-
set(key: string, value:
|
|
81
|
+
set<T>(key: string, value: T): Promise<boolean>;
|
|
82
82
|
/**
|
|
83
83
|
* Retrieves a value from the store.
|
|
84
84
|
*
|
|
@@ -90,7 +90,7 @@ declare class StoreSlice {
|
|
|
90
90
|
* @param key The key to retrieve the value for
|
|
91
91
|
* @returns A promise that resolves to the stored value, or undefined if the key does not exist
|
|
92
92
|
*/
|
|
93
|
-
get<T>(key: string): Promise<T>;
|
|
93
|
+
get<T>(key: string): Promise<T | undefined>;
|
|
94
94
|
/**
|
|
95
95
|
* Subscribes to changes in the store for a specific key.
|
|
96
96
|
*
|
|
@@ -103,7 +103,7 @@ declare class StoreSlice {
|
|
|
103
103
|
* @param handler The callback function to call when the value changes
|
|
104
104
|
* @returns A promise that resolves to true if the subscription was successful
|
|
105
105
|
*/
|
|
106
|
-
subscribe(key: string, handler: MessageHandler<
|
|
106
|
+
subscribe<T>(key: string, handler: MessageHandler<T | undefined>): Promise<boolean>;
|
|
107
107
|
/**
|
|
108
108
|
* Unsubscribes from changes in the store for a specific key.
|
|
109
109
|
*
|
|
@@ -112,9 +112,9 @@ declare class StoreSlice {
|
|
|
112
112
|
*
|
|
113
113
|
* @param key The key to unsubscribe from
|
|
114
114
|
* @param handler Optional. The specific handler to remove. If not provided, all handlers for this key will be removed.
|
|
115
|
-
* @returns A promise that resolves to true if the
|
|
115
|
+
* @returns A promise that resolves to true if the unsubscribe was successful
|
|
116
116
|
*/
|
|
117
|
-
unsubscribe(key: string, handler?: MessageHandler<
|
|
117
|
+
unsubscribe<T>(key: string, handler?: MessageHandler<T | undefined>): Promise<boolean>;
|
|
118
118
|
/**
|
|
119
119
|
* Deletes a value from the store.
|
|
120
120
|
*
|
package/dist/weather.d.ts
CHANGED
|
@@ -99,16 +99,15 @@ export type HourlyForecastParams = WeatherRequestParams & {
|
|
|
99
99
|
hours?: number;
|
|
100
100
|
};
|
|
101
101
|
/**
|
|
102
|
-
* Weather API for retrieving weather data
|
|
102
|
+
* Weather API for retrieving weather data
|
|
103
103
|
*
|
|
104
|
-
* Provides access to current conditions and forecasts
|
|
105
|
-
* and AccuWeather through the General Integrations Service.
|
|
104
|
+
* Provides access to current conditions and forecasts through the TelemetryOS API.
|
|
106
105
|
*/
|
|
107
106
|
export declare class Weather {
|
|
108
107
|
_client: Client;
|
|
109
108
|
constructor(client: Client);
|
|
110
109
|
/**
|
|
111
|
-
* Retrieves current weather conditions for a specified location
|
|
110
|
+
* Retrieves current weather conditions for a specified location.
|
|
112
111
|
*
|
|
113
112
|
* @param params - Weather request parameters including location and units
|
|
114
113
|
* @returns A promise that resolves to the current weather conditions
|
|
@@ -128,7 +127,7 @@ export declare class Weather {
|
|
|
128
127
|
*/
|
|
129
128
|
getConditions(params: WeatherRequestParams): Promise<WeatherConditions>;
|
|
130
129
|
/**
|
|
131
|
-
* Retrieves daily weather forecast for a specified location
|
|
130
|
+
* Retrieves daily weather forecast for a specified location.
|
|
132
131
|
*
|
|
133
132
|
* @param params - Forecast request parameters including location, units, and number of days
|
|
134
133
|
* @returns A promise that resolves to an array of daily forecast data
|
|
@@ -146,7 +145,7 @@ export declare class Weather {
|
|
|
146
145
|
*/
|
|
147
146
|
getDailyForecast(params: DailyForecastParams): Promise<WeatherForecast[]>;
|
|
148
147
|
/**
|
|
149
|
-
* Retrieves hourly weather forecast for a specified location
|
|
148
|
+
* Retrieves hourly weather forecast for a specified location.
|
|
150
149
|
*
|
|
151
150
|
* @param params - Forecast request parameters including location, units, and number of hours
|
|
152
151
|
* @returns A promise that resolves to an array of hourly forecast data
|
|
@@ -163,52 +162,4 @@ export declare class Weather {
|
|
|
163
162
|
* ```
|
|
164
163
|
*/
|
|
165
164
|
getHourlyForecast(params: HourlyForecastParams): Promise<WeatherForecast[]>;
|
|
166
|
-
/**
|
|
167
|
-
* Retrieves current weather conditions using AccuWeather.
|
|
168
|
-
*
|
|
169
|
-
* @param params - Weather request parameters including location and units
|
|
170
|
-
* @returns A promise that resolves to the AccuWeather conditions data
|
|
171
|
-
* @throws {Error} If the request fails or location is invalid
|
|
172
|
-
*
|
|
173
|
-
* @example
|
|
174
|
-
* ```typescript
|
|
175
|
-
* const weather = await weather.getAccuWeatherConditions({
|
|
176
|
-
* city: 'Paris',
|
|
177
|
-
* units: 'metric'
|
|
178
|
-
* })
|
|
179
|
-
* ```
|
|
180
|
-
*/
|
|
181
|
-
getAccuWeatherConditions(params: WeatherRequestParams): Promise<Record<string, any>>;
|
|
182
|
-
/**
|
|
183
|
-
* Retrieves daily forecast using AccuWeather.
|
|
184
|
-
*
|
|
185
|
-
* @param params - Forecast request parameters including location and units
|
|
186
|
-
* @returns A promise that resolves to the AccuWeather daily forecast data
|
|
187
|
-
* @throws {Error} If the request fails or location is invalid
|
|
188
|
-
*
|
|
189
|
-
* @example
|
|
190
|
-
* ```typescript
|
|
191
|
-
* const forecast = await weather.getAccuWeatherDailyForecast({
|
|
192
|
-
* city: 'Sydney',
|
|
193
|
-
* units: 'metric'
|
|
194
|
-
* })
|
|
195
|
-
* ```
|
|
196
|
-
*/
|
|
197
|
-
getAccuWeatherDailyForecast(params: WeatherRequestParams): Promise<Record<string, any>>;
|
|
198
|
-
/**
|
|
199
|
-
* Retrieves hourly forecast using AccuWeather.
|
|
200
|
-
*
|
|
201
|
-
* @param params - Forecast request parameters including location and units
|
|
202
|
-
* @returns A promise that resolves to the AccuWeather hourly forecast data
|
|
203
|
-
* @throws {Error} If the request fails or location is invalid
|
|
204
|
-
*
|
|
205
|
-
* @example
|
|
206
|
-
* ```typescript
|
|
207
|
-
* const forecast = await weather.getAccuWeatherHourlyForecast({
|
|
208
|
-
* city: 'Berlin',
|
|
209
|
-
* units: 'metric'
|
|
210
|
-
* })
|
|
211
|
-
* ```
|
|
212
|
-
*/
|
|
213
|
-
getAccuWeatherHourlyForecast(params: WeatherRequestParams): Promise<Record<string, any>>;
|
|
214
165
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telemetryos/root-sdk",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.4",
|
|
4
4
|
"description": "The official TelemetryOS root application sdk package. Provides types and apis for building root TelemetryOS applications.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
File without changes
|