@telemetryos/root-sdk 1.13.2 → 1.15.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telemetryos/root-sdk",
3
- "version": "1.13.2",
3
+ "version": "1.15.0",
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",
@@ -11,11 +11,6 @@
11
11
  "types": "./dist/index.d.ts",
12
12
  "import": "./dist/index.js",
13
13
  "require": "./dist/index.cjs"
14
- },
15
- "./bridge": {
16
- "types": "./dist/bridge.d.ts",
17
- "import": "./dist/bridge.js",
18
- "require": "./dist/bridge.cjs"
19
14
  }
20
15
  },
21
16
  "files": [
@@ -40,6 +35,7 @@
40
35
  "license": "",
41
36
  "repository": "github:TelemetryTV/Application-API",
42
37
  "dependencies": {
38
+ "@telemetryos/sdk-bridge": "^1.15.0",
43
39
  "zod": "^3.24.4"
44
40
  },
45
41
  "devDependencies": {
@@ -1,5 +0,0 @@
1
- import { z } from 'zod';
2
- import { bridgeMessageValidator } from './bridge-message-validator.js';
3
- type Message = z.infer<typeof bridgeMessageValidator>;
4
- export declare function formatBridgeMessage(data: Omit<Message, 'type'>): Message;
5
- export {};
@@ -1,14 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const bridgeMessageValidator: z.ZodObject<{
3
- type: z.ZodLiteral<"bridge">;
4
- name: z.ZodString;
5
- data: z.ZodAny;
6
- }, "strip", z.ZodTypeAny, {
7
- type: "bridge";
8
- name: string;
9
- data?: any;
10
- }, {
11
- type: "bridge";
12
- name: string;
13
- data?: any;
14
- }>;
package/dist/bridge.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./types-mYnxD5LM.cjs");function r(n){return{...n,type:"bridge"}}const o=e.objectType({type:e.literalType("client"),telemetrySdkVersion:e.stringType(),applicationSpecifier:e.stringType(),applicationInstance:e.stringType(),name:e.stringType(),data:e.anyType(),responseName:e.stringType().optional(),subscriptionName:e.stringType().optional(),unsubscribeName:e.stringType().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.d.ts DELETED
@@ -1,45 +0,0 @@
1
- import { z } from 'zod';
2
- import { clientMessageValidator } from './client-message-validator.js';
3
- import { bridgeMessageValidator } from './bridge-message-validator.js';
4
- /**
5
- * Defines the structure of a client message as defined in the
6
- * clientMessageValidator.
7
- */
8
- export type ClientMessage = Omit<z.infer<typeof clientMessageValidator>, 'type'>;
9
- /**
10
- * Defines the structure of a bridge message as defined in the
11
- * bridgeMessageValidator.
12
- */
13
- export type BridgeMessage = Omit<z.infer<typeof bridgeMessageValidator>, 'type'>;
14
- /**
15
- * The Bridge class is provides a way for host applications to communicate with
16
- * TelemetryOS applications. It listens for window message events and sends
17
- * messages to all frames.
18
- *
19
- * SDK Clients will be listening for these messages, discriminating for messages
20
- * specifically for them.
21
- */
22
- export declare class Bridge {
23
- /**
24
- * Must be provided you the host application when using the Bridge. This
25
- * function will be called when a message is received. The message will be
26
- * passed to the function.
27
- */
28
- onMessage?: (message: ClientMessage) => void;
29
- _windowMessageHandler?: (event: MessageEvent) => void;
30
- /**
31
- * Binds the Bridge to the window message event. This will allow the Bridge
32
- * to listen for messages from the host application.
33
- */
34
- bind(): void;
35
- /**
36
- * Unbinds the Bridge from the window message event. Useful if the host
37
- * application no longer needs to communicate with SDK clients.
38
- */
39
- unbind(): void;
40
- /**
41
- * Sends a message to SDK clients.
42
- * @param message The message to send.
43
- */
44
- send(message: BridgeMessage): void;
45
- }
package/dist/bridge.js DELETED
@@ -1,51 +0,0 @@
1
- import { o, s, a as r, l as d } from "./types-CCzf8sMT.js";
2
- function l(i) {
3
- return { ...i, type: "bridge" };
4
- }
5
- const p = o({
6
- type: d("client"),
7
- telemetrySdkVersion: s(),
8
- applicationSpecifier: s(),
9
- applicationInstance: s(),
10
- name: s(),
11
- data: r(),
12
- responseName: s().optional(),
13
- subscriptionName: s().optional(),
14
- unsubscribeName: s().optional()
15
- });
16
- class w {
17
- /**
18
- * Binds the Bridge to the window message event. This will allow the Bridge
19
- * to listen for messages from the host application.
20
- */
21
- bind() {
22
- this._windowMessageHandler = (a) => {
23
- var e;
24
- if (a.source === window)
25
- return;
26
- const n = p.safeParse(a.data);
27
- if (!n.success)
28
- return;
29
- const t = n.data;
30
- (e = this.onMessage) === null || e === void 0 || e.call(this, t);
31
- }, window.addEventListener("message", this._windowMessageHandler);
32
- }
33
- /**
34
- * Unbinds the Bridge from the window message event. Useful if the host
35
- * application no longer needs to communicate with SDK clients.
36
- */
37
- unbind() {
38
- this._windowMessageHandler && window.removeEventListener("message", this._windowMessageHandler);
39
- }
40
- /**
41
- * Sends a message to SDK clients.
42
- * @param message The message to send.
43
- */
44
- send(a) {
45
- for (let e = 0; e < window.frames.length; e += 1)
46
- window.frames[e].postMessage(l(a), "*");
47
- }
48
- }
49
- export {
50
- w as Bridge
51
- };
@@ -1,5 +0,0 @@
1
- import { z } from 'zod';
2
- import { clientMessageValidator } from './client-message-validator.js';
3
- type Message = z.infer<typeof clientMessageValidator>;
4
- export declare function formatClientMessage(data: Omit<Message, 'type'>): Message;
5
- export {};
@@ -1,32 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const clientMessageValidator: z.ZodObject<{
3
- type: z.ZodLiteral<"client">;
4
- telemetrySdkVersion: z.ZodString;
5
- applicationSpecifier: z.ZodString;
6
- applicationInstance: z.ZodString;
7
- name: z.ZodString;
8
- data: z.ZodAny;
9
- responseName: z.ZodOptional<z.ZodString>;
10
- subscriptionName: z.ZodOptional<z.ZodString>;
11
- unsubscribeName: z.ZodOptional<z.ZodString>;
12
- }, "strip", z.ZodTypeAny, {
13
- type: "client";
14
- telemetrySdkVersion: string;
15
- applicationSpecifier: string;
16
- applicationInstance: string;
17
- name: string;
18
- data?: any;
19
- responseName?: string | undefined;
20
- subscriptionName?: string | undefined;
21
- unsubscribeName?: string | undefined;
22
- }, {
23
- type: "client";
24
- telemetrySdkVersion: string;
25
- applicationSpecifier: string;
26
- applicationInstance: string;
27
- name: string;
28
- data?: any;
29
- responseName?: string | undefined;
30
- subscriptionName?: string | undefined;
31
- unsubscribeName?: string | undefined;
32
- }>;