@hussra/logos-proclaim 0.0.0-stage → 1.0.3

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Bitfocus AS - Open Source
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,49 @@
1
- # Temporary Holding Version
1
+ # logos-proclaim
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A Node module to communicate with the [Logos Proclaim](https://proclaim.logos.com/) presentation software through its
4
+ [App Command](https://support.proclaim.logos.com/hc/en-us/articles/19864456647053-Proclaim-App-Command-API) and
5
+ Local Wi-Fi APIs.
6
+
7
+ ```TypeScript
8
+ import { ProclaimAPI } from '@hussra/logos-proclaim'
9
+
10
+ const proclaim = new ProclaimAPI()
11
+ await proclaim.configure('192.168.100.10', 'proclaim') // or just configure() if Proclaim is running on localhost
12
+ ```
13
+
14
+ Status information is obtained from `proclaim.status` which has many properties, and can have event listeners registered
15
+ on it to receive notice of status changes.
16
+
17
+ ```TypeScript
18
+ proclaim.status.on('connected', ({data}) => {
19
+ console.log(`Are we connected? ${data}`)
20
+ })
21
+ ```
22
+
23
+ Look at the properties of the `ProclaimStatus` class for more details.
24
+
25
+ The `proclaim.status.presentation` property will surface information about the on-air presentation (only while it is on air).
26
+
27
+ The `log` event is used to provide a logging-framework-agnostic way for the library to emit log information.
28
+
29
+ Commands using Proclaim's App Command API can be sent using `proclaim.sendAppCommand()` e.g.
30
+
31
+ ```TypeScript
32
+ import { AppCommand } from '@hussra/logos-proclaim'
33
+
34
+ await proclaim.sendAppCommand({command: AppCommand.GoOnAir})
35
+ ```
36
+
37
+ or
38
+
39
+ ```TypeScript
40
+ await proclaim.sendAppCommand({command: AppCommand.GoToSong, index: 1})
41
+ ```
42
+
43
+ One command - not available via the App Command API but only through the Local Wi-Fi API - allows you to jump to a specific
44
+ service item by ID, and slide within that service item. You will first need to find that service item's ID by digging into
45
+ `proclaim.status.presentation`, then do something like:
46
+
47
+ ```TypeScript
48
+ await proclaim.goToServiceItemAndSlide('abcdef12-3456-7890-abcd-ef1234567890', 2)
49
+ ```
@@ -0,0 +1,111 @@
1
+ import { ProclaimStatus } from './proclaim-status.js';
2
+ import { IndexedAppCommand, SimpleAppCommand } from './proclaim-types.js';
3
+ export * from './proclaim-types.js';
4
+ export * from './proclaim-status.js';
5
+ /**
6
+ * Encapsulate the Proclaim API connections
7
+ */
8
+ export declare class ProclaimAPI {
9
+ #private;
10
+ /**
11
+ * The IP address of the computer where Proclaim is running
12
+ */
13
+ get ip(): string | undefined;
14
+ /**
15
+ * The password to use to connection to the App Command API
16
+ */
17
+ get password(): string | undefined;
18
+ /**
19
+ * Authentication is required for IPs other than 127.0.0.1
20
+ */
21
+ get authRequired(): boolean;
22
+ /**
23
+ * The status object representing the current state of the API connection and any on-air presentation
24
+ */
25
+ get status(): ProclaimStatus;
26
+ /**
27
+ * Config is valid if we have an IP address, and (unless IP is 127.0.0.1) we have a password specified
28
+ * @returns boolean
29
+ */
30
+ private configIsValid;
31
+ /**
32
+ * Configure this ProclaimAPI instance
33
+ * @param ip - IP address where Proclaim is running
34
+ * @param password - Proclaim local remote password - required if ip is other than 127.0.0.1
35
+ */
36
+ configure(ip?: string, password?: string): Promise<void>;
37
+ /**
38
+ * Add internal event listeners for ProclaimStatus events - these listeners respond
39
+ * to our own state changes triggering further internal actions
40
+ */
41
+ private addEventListeners;
42
+ /**
43
+ * Calculate status properties that depend on the currently live service item:
44
+ * itemIndex, itemTitle, itemKind, itemSlideCount, servicePart
45
+ * @param data - ID of live service item
46
+ */
47
+ private setItemProperties;
48
+ /**
49
+ * Initialise polling to check if Proclaim has gone on air - every 1 second
50
+ */
51
+ private initOnAirPolling;
52
+ /**
53
+ * Poll to see whether Proclaim has gone on air. If already on air, does nothing - going off
54
+ * air is detected by presentation status changes
55
+ */
56
+ private onAirPoll;
57
+ /**
58
+ * Load details of the on-air presentation
59
+ */
60
+ private loadPresentation;
61
+ /**
62
+ * Call /onair/statusChanged to get current presentation status, passing the current session ID, presentation
63
+ * local revision and step. If the details sent are all current, Proclaim will long-poll for up to a minute
64
+ * before responding.
65
+ */
66
+ private getPresentationStatus;
67
+ /**
68
+ * Get an auth token for the App Command API
69
+ */
70
+ private getAppCommandAPIAuthToken;
71
+ /**
72
+ * Refresh auth tokens for App Command and Local Wi-Fi APIs
73
+ */
74
+ reconnect(): Promise<void>;
75
+ /**
76
+ * Send any App Command to Proclaim
77
+ * @param command - The App Command to send: see documentation at
78
+ * https://support.proclaim.logos.com/hc/en-us/articles/19864456647053-Proclaim-App-Command-API
79
+ * @param index - For certain App Commands (annotated with an * at the API reference), the index to use (1-254)
80
+ * e.g. service item number, slide number, verse number etc.
81
+ * @returns Whether the command was sent successfully
82
+ */
83
+ sendAppCommand(cmd: {
84
+ command: SimpleAppCommand;
85
+ } | {
86
+ command: IndexedAppCommand;
87
+ index: number;
88
+ }): Promise<boolean>;
89
+ /**
90
+ * Get an auth token for the Local Wi-Fi API
91
+ */
92
+ private getLocalWiFiRemoteAuthToken;
93
+ /**
94
+ * Jump to a specific service item by ID, and optionally a specific slide number
95
+ * @param itemId - ID of the service item to jump to
96
+ * @param slideIndex - slide number to jump to within that service item (0-based)
97
+ * @returns Whether the command was sent successfully
98
+ */
99
+ goToServiceItemAndSlide(itemId: string, slideIndex?: number): Promise<boolean>;
100
+ /**
101
+ * On being destroyed, clear the on-air polling interval
102
+ */
103
+ destroy(): void;
104
+ /**
105
+ * Sleep
106
+ * @param ms - number of milliseconds to sleep
107
+ * @returns Promise that will resolve after the specified time
108
+ */
109
+ private sleep;
110
+ }
111
+ //# sourceMappingURL=proclaim-api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proclaim-api.d.ts","sourceRoot":"","sources":["../src/proclaim-api.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC/D,OAAO,EACN,iBAAiB,EAGjB,gBAAgB,EAKhB,MAAM,qBAAqB,CAAA;AAE5B,cAAc,qBAAqB,CAAA;AACnC,cAAc,sBAAsB,CAAA;AASpC;;GAEG;AACH,qBAAa,WAAW;;IAUvB;;OAEG;IACH,IAAI,EAAE,uBAEL;IAED;;OAEG;IACH,IAAI,QAAQ,uBAEX;IAED;;OAEG;IACH,IAAI,YAAY,YAEf;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,cAAc,CAE3B;IAED;;;OAGG;IACH,OAAO,CAAC,aAAa;IAYrB;;;;OAIG;IACG,SAAS,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;IAmB9C;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAyEzB;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAgCzB;;OAEG;YACW,gBAAgB;IA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