@telemetryos/root-sdk 1.0.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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,71 @@
1
+ import { Client } from './client.js';
2
+ type MediaContentUser = {};
3
+ type MediaContent = {
4
+ id: string;
5
+ contentFolderId: string;
6
+ contentType: string;
7
+ name: string;
8
+ description: string;
9
+ thumbnailUrl: string;
10
+ keys: string[];
11
+ publicUrls: string[];
12
+ hidden: boolean;
13
+ validFrom?: Date;
14
+ validTo?: Date;
15
+ createdBy?: MediaContentUser;
16
+ transcodedAt?: Date;
17
+ createdAt: Date;
18
+ updatedAt: Date;
19
+ };
20
+ type MediaFolder = {
21
+ id: string;
22
+ parentId: string;
23
+ name: string;
24
+ size: number;
25
+ default: boolean;
26
+ updatedAt: Date;
27
+ createdAt: Date;
28
+ };
29
+ export declare class Media {
30
+ _client: Client;
31
+ constructor(client: Client);
32
+ /**
33
+ * Queries for media folders based on folder properties.
34
+ *
35
+ * This method allows you to search for media folders that match specific criteria,
36
+ * such as name, ID, or other folder properties.
37
+ *
38
+ * @param query An object with partial MediaFolder properties to match against
39
+ * @returns A promise that resolves to an array of matching media folders
40
+ */
41
+ queryFolders(query: Partial<MediaFolder>): Promise<MediaFolder[]>;
42
+ /**
43
+ * Retrieves media folders that have been tagged with a specific tag.
44
+ *
45
+ * @param tagName The name of the tag to search for
46
+ * @returns A promise that resolves to an array of media folders with the specified tag
47
+ */
48
+ getFoldersByTag(tagName: string): Promise<MediaFolder[]>;
49
+ /**
50
+ * Retrieves a specific media folder by its ID.
51
+ *
52
+ * @param id The unique identifier of the folder to retrieve
53
+ * @returns A promise that resolves to the media folder with the specified ID
54
+ */
55
+ getFolderById(id: string): Promise<MediaFolder>;
56
+ /**
57
+ * Retrieves all media content items within a specific folder.
58
+ *
59
+ * @param folderId The unique identifier of the folder to get content from
60
+ * @returns A promise that resolves to an array of media content items in the folder
61
+ */
62
+ getMediaContentByFolderId(folderId: string): Promise<MediaContent[]>;
63
+ /**
64
+ * Retrieves a specific media content item by its ID.
65
+ *
66
+ * @param id The unique identifier of the media content to retrieve
67
+ * @returns A promise that resolves to the media content item with the specified ID
68
+ */
69
+ getMediaContentById(id: string): Promise<MediaContent>;
70
+ }
71
+ export {};
@@ -0,0 +1,59 @@
1
+ import { Store } from './store.js';
2
+ type RootSettingsNavigationEntry = {
3
+ label: string;
4
+ path: string;
5
+ entities: RootSettingsNavigationSubEntry[];
6
+ };
7
+ type RootSettingsNavigationSubEntry = {
8
+ label: string;
9
+ path: string;
10
+ };
11
+ type RootSettingsNavigationOpts = {
12
+ entries: RootSettingsNavigationEntry[];
13
+ };
14
+ export type RootSettingsApplicationNavigationState = {
15
+ applicationId: string;
16
+ entries: RootSettingsNavigationEntry[];
17
+ };
18
+ type RootSettingsNavigationState = Record<string, RootSettingsApplicationNavigationState>;
19
+ export declare class RootSettingsNavigation {
20
+ _store: Store;
21
+ /**
22
+ * Creates a new RootSettingsNavigation API instance.
23
+ *
24
+ * @param store The Store instance to use for persistence
25
+ * @throws {Error} If used by an application not mounted at the 'rootSettingsNavigation' mount point
26
+ */
27
+ constructor(store: Store);
28
+ /**
29
+ * Registers navigation entries for the root application in the TelemetryOS admin UI.
30
+ *
31
+ * This method allows a root application to define its sidebar navigation structure
32
+ * within the TelemetryOS administration UI. The navigation entries will appear in the
33
+ * sidebar menu, allowing users to navigate to different sections of the application.
34
+ *
35
+ * @param navigation An object containing the navigation entries to register
36
+ * @returns A promise that resolves when the navigation has been registered
37
+ */
38
+ setRootSettingsNavigation(navigation: RootSettingsNavigationOpts): Promise<void>;
39
+ /**
40
+ * Retrieves the current navigation entries for this root application.
41
+ *
42
+ * This method returns the navigation structure that was previously registered
43
+ * for this application using setRootSettingsNavigation().
44
+ *
45
+ * @returns A promise that resolves to the navigation state for this application
46
+ */
47
+ getRootSettingsNavigation(): Promise<RootSettingsApplicationNavigationState>;
48
+ /**
49
+ * Retrieves the navigation entries for all root applications.
50
+ *
51
+ * This method returns the navigation structures for all root applications registered
52
+ * in the TelemetryOS administration UI. This can be useful for coordination between
53
+ * different root applications.
54
+ *
55
+ * @returns A promise that resolves to the navigation state for all applications
56
+ */
57
+ getAllRootSettingsNavigation(): Promise<RootSettingsNavigationState>;
58
+ }
59
+ export {};
@@ -0,0 +1,129 @@
1
+ import { Client, MessageHandler } from './client.js';
2
+ export declare class Store {
3
+ _client: Client;
4
+ constructor(client: Client);
5
+ /**
6
+ * Provides access to the application store scope.
7
+ *
8
+ * Data stored in the application scope is shared across all instances of your application
9
+ * within the current account. Use this scope for application-wide settings, shared resources,
10
+ * or any data that should be consistent across all instances.
11
+ *
12
+ * @returns A StoreSlice instance for the application scope
13
+ */
14
+ get application(): StoreSlice;
15
+ /**
16
+ * Provides access to the instance store scope.
17
+ *
18
+ * Data stored in the instance scope is only available to the current instance of your
19
+ * application. This is ideal for instance-specific settings, UI state, temporary data,
20
+ * or any information that shouldn't be shared with other instances.
21
+ *
22
+ * The namespace for instance data includes both the application name and the instance ID.
23
+ *
24
+ * @returns A StoreSlice instance for the instance scope
25
+ */
26
+ get instance(): StoreSlice;
27
+ /**
28
+ * Provides access to the device store scope.
29
+ *
30
+ * Data stored in the device scope is only available to the application on the
31
+ * current physical device. This is useful for device-specific settings, caching, or
32
+ * any data that should persist across application instances but only on a single device.
33
+ *
34
+ * Note: This scope cannot be used for Settings-related mount points as the User
35
+ * Administration UI does not run on a device.
36
+ *
37
+ * @returns A StoreSlice instance for the device scope
38
+ */
39
+ get device(): StoreSlice;
40
+ /**
41
+ * Provides access to the shared store scope with a specified namespace.
42
+ *
43
+ * The shared scope enables data sharing between different applications within the
44
+ * same account. By specifying a common namespace, any two applications can exchange
45
+ * data and communicate with each other.
46
+ *
47
+ * This is particularly useful for application ecosystems where multiple applications
48
+ * need to coordinate or share configuration.
49
+ *
50
+ * @param namespace A string identifier for the shared data space
51
+ * @returns A StoreSlice instance for the specified shared namespace
52
+ */
53
+ shared(namespace: string): StoreSlice;
54
+ }
55
+ /**
56
+ * Provides methods for saving, retrieving, and subscribing to data in a specific store scope.
57
+ *
58
+ * StoreSlice is the concrete implementation for interacting with a particular storage scope
59
+ * (application, instance, device, or shared). It offers methods to set and get values, subscribe
60
+ * to changes, and delete data within its specific scope and namespace.
61
+ *
62
+ * This class is not typically instantiated directly by applications. Instead, use the
63
+ * properties and methods of the Store class to access the appropriate StoreSlice.
64
+ */
65
+ declare class StoreSlice {
66
+ _kind: string;
67
+ _namespace: string;
68
+ _client: Client;
69
+ constructor(kind: string, namespace: string, client: Client);
70
+ /**
71
+ * Saves a value in the store.
72
+ *
73
+ * This method stores data under the specified key within the current store scope and namespace.
74
+ * The value must be serializable (can be converted to JSON). Complex objects like Date instances
75
+ * will be serialized and deserialize as regular objects, losing their prototype methods.
76
+ *
77
+ * @param key The key to save the value under
78
+ * @param value The value to store - must be JSON serializable
79
+ * @returns A promise that resolves to true if the value was saved successfully
80
+ */
81
+ set(key: string, value: any): Promise<boolean>;
82
+ /**
83
+ * Retrieves a value from the store.
84
+ *
85
+ * This method fetches data stored under the specified key within the current store scope
86
+ * and namespace. For real-time applications that need to respond to changes, consider
87
+ * using subscribe() instead.
88
+ *
89
+ * @template T The expected type of the stored value
90
+ * @param key The key to retrieve the value for
91
+ * @returns A promise that resolves to the stored value, or undefined if the key does not exist
92
+ */
93
+ get<T>(key: string): Promise<T>;
94
+ /**
95
+ * Subscribes to changes in the store for a specific key.
96
+ *
97
+ * This method sets up a subscription that will call the provided handler whenever
98
+ * the value associated with the specified key changes. This is the recommended way
99
+ * to access store data in long-running applications that need to stay responsive
100
+ * to data changes.
101
+ *
102
+ * @param key The key to subscribe to
103
+ * @param handler The callback function to call when the value changes
104
+ * @returns A promise that resolves to true if the subscription was successful
105
+ */
106
+ subscribe(key: string, handler: MessageHandler<any>): Promise<boolean>;
107
+ /**
108
+ * Unsubscribes from changes in the store for a specific key.
109
+ *
110
+ * This method removes a subscription previously created with subscribe(). It can
111
+ * either remove a specific handler or all handlers for the given key.
112
+ *
113
+ * @param key The key to unsubscribe from
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 unsubscription was successful
116
+ */
117
+ unsubscribe(key: string, handler?: MessageHandler<any>): Promise<boolean>;
118
+ /**
119
+ * Deletes a value from the store.
120
+ *
121
+ * This method removes the data stored under the specified key within the
122
+ * current store scope and namespace.
123
+ *
124
+ * @param key The key to delete
125
+ * @returns A promise that resolves to true if the value was deleted successfully
126
+ */
127
+ delete(key: string): Promise<boolean>;
128
+ }
129
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,25 @@
1
+ import { Client } from './index.js';
2
+ type CurrentUser = {
3
+ id: string;
4
+ };
5
+ type GetCurrentUserResult = {
6
+ user: CurrentUser;
7
+ };
8
+ export declare class Users {
9
+ _client: Client;
10
+ constructor(client: Client);
11
+ /**
12
+ * Retrieves information about the user associated with the current session.
13
+ *
14
+ * This method allows an application to get details about the TelemetryOS user
15
+ * who is currently using the application.
16
+ *
17
+ * @returns A promise that resolves to the current user result object
18
+ * @example
19
+ * // Get the current user information
20
+ * const userResult = await users.getCurrent();
21
+ * console.log(`Current user ID: ${userResult.user.id}`);
22
+ */
23
+ getCurrent(): Promise<GetCurrentUserResult>;
24
+ }
25
+ export {};
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@telemetryos/root-sdk",
3
+ "version": "1.0.0",
4
+ "description": "The official TelemetryOS root application sdk package. Provides types and apis for building root TelemetryOS applications.",
5
+ "type": "module",
6
+ "main": "dist/index.cjs",
7
+ "module": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
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
+ }
20
+ },
21
+ "files": [
22
+ "dist/*.js",
23
+ "dist/*.cjs",
24
+ "dist/*.map",
25
+ "dist/*.d.ts",
26
+ "README.md",
27
+ "MIGRATION.md",
28
+ "CHANGELOG.md"
29
+ ],
30
+ "keywords": [
31
+ "TelemetryTV",
32
+ "interactive kiosk",
33
+ "digital signage",
34
+ "digital menu board",
35
+ "digital directory",
36
+ "display management",
37
+ "displays at scale"
38
+ ],
39
+ "author": "TelemetryTV <support@telemetrytv.com>",
40
+ "license": "",
41
+ "repository": "github:TelemetryTV/Application-API",
42
+ "dependencies": {
43
+ "zod": "^3.24.4"
44
+ },
45
+ "devDependencies": {
46
+ "@eslint/js": "^9.26.0",
47
+ "@rollup/plugin-typescript": "^12.1.2",
48
+ "@types/node": "^22.15.3",
49
+ "@typescript-eslint/eslint-plugin": "^8.32.0",
50
+ "@typescript-eslint/parser": "^8.32.0",
51
+ "eslint": "^9.26.0",
52
+ "eslint-config-prettier": "^10.1.2",
53
+ "eslint-plugin-prettier": "^5.4.0",
54
+ "globals": "^16.0.0",
55
+ "happy-dom": "^17.4.6",
56
+ "prettier": "^3.5.3",
57
+ "typescript": "^5.8.3",
58
+ "typescript-eslint": "^8.32.0",
59
+ "vite": "^6.3.5",
60
+ "vite-plugin-dts": "^4.5.3",
61
+ "vitest": "^3.1.3"
62
+ },
63
+ "scripts": {
64
+ "lint": "eslint ./src",
65
+ "test": "vitest run",
66
+ "build": "vite build",
67
+ "watch": "vite build -w"
68
+ }
69
+ }