@robono/calling 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/SBOM.spdx.json +8 -8
- package/dist/messenger.d.ts +8 -0
- package/dist/messenger.js +23 -0
- package/package.json +6 -2
package/CHANGELOG.md
CHANGED
package/SBOM.spdx.json
CHANGED
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
"spdxVersion": "SPDX-2.3",
|
|
3
3
|
"dataLicense": "CC0-1.0",
|
|
4
4
|
"SPDXID": "SPDXRef-DOCUMENT",
|
|
5
|
-
"name": "@robono/calling@0.
|
|
6
|
-
"documentNamespace": "http://spdx.org/spdxdocs/@robono%2fcalling-0.
|
|
5
|
+
"name": "@robono/calling@0.4.0",
|
|
6
|
+
"documentNamespace": "http://spdx.org/spdxdocs/@robono%2fcalling-0.4.0-***",
|
|
7
7
|
"creationInfo": {
|
|
8
|
-
"created": "2026-
|
|
8
|
+
"created": "2026-11-04T11:34:49.725Z",
|
|
9
9
|
"creators": [
|
|
10
10
|
"Tool: npm/cli-11.6.2"
|
|
11
11
|
]
|
|
12
12
|
},
|
|
13
13
|
"documentDescribes": [
|
|
14
|
-
"SPDXRef-Package-robono.calling-0.
|
|
14
|
+
"SPDXRef-Package-robono.calling-0.4.0"
|
|
15
15
|
],
|
|
16
16
|
"packages": [
|
|
17
17
|
{
|
|
18
18
|
"name": "@robono/calling",
|
|
19
|
-
"SPDXID": "SPDXRef-Package-robono.calling-0.
|
|
20
|
-
"versionInfo": "0.
|
|
19
|
+
"SPDXID": "SPDXRef-Package-robono.calling-0.4.0",
|
|
20
|
+
"versionInfo": "0.4.0",
|
|
21
21
|
"packageFileName": "",
|
|
22
22
|
"description": "WebRTC voice, video, group calling and screen sharing within apps and across Robono Bridge networks.",
|
|
23
23
|
"primaryPackagePurpose": "LIBRARY",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
{
|
|
30
30
|
"referenceCategory": "PACKAGE-MANAGER",
|
|
31
31
|
"referenceType": "purl",
|
|
32
|
-
"referenceLocator": "pkg:npm/%40robono/calling@0.
|
|
32
|
+
"referenceLocator": "pkg:npm/%40robono/calling@0.4.0"
|
|
33
33
|
}
|
|
34
34
|
]
|
|
35
35
|
}
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"relationships": [
|
|
38
38
|
{
|
|
39
39
|
"spdxElementId": "SPDXRef-DOCUMENT",
|
|
40
|
-
"relatedSpdxElement": "SPDXRef-Package-robono.calling-0.
|
|
40
|
+
"relatedSpdxElement": "SPDXRef-Package-robono.calling-0.4.0",
|
|
41
41
|
"relationshipType": "DESCRIBES"
|
|
42
42
|
}
|
|
43
43
|
]
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type {Request} from './index.js';
|
|
2
|
+
export interface MessengerCallingTransport {
|
|
3
|
+
request:Request;appearance:Record<string,unknown>;revision:number;
|
|
4
|
+
features:{voice:boolean;video:boolean;groups?:boolean;screenSharing?:boolean};expiresAt:number;
|
|
5
|
+
dispose():Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
/** The hostRequest callback uses the customer's authenticated server route. */
|
|
8
|
+
export function createMessengerCallingTransport(options:{request:(operation:string,input:Record<string,unknown>)=>Promise<any>;WebSocketImpl?:typeof WebSocket}):Promise<MessengerCallingTransport>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {subscribeCallingEvents} from './events.js';
|
|
2
|
+
/** Calling through the customer's signed-in route. The separate event token
|
|
3
|
+
* cannot fetch state, start a call, answer, read history, or control media. */
|
|
4
|
+
export async function createMessengerCallingTransport({request:hostRequest,WebSocketImpl=globalThis.WebSocket}){
|
|
5
|
+
const session=await hostRequest('session',{});
|
|
6
|
+
if(session.disabled===true&&session.features?.voice===false&&session.features?.video===false)return {request:async()=>{throw Error('calling_not_enabled');},appearance:session.appearance??{},revision:session.revision??0,features:session.features,expiresAt:Date.now()+300000,dispose:async()=>{}};
|
|
7
|
+
let url;try{url=new URL(session.serviceUrl);}catch{throw Error('Invalid calling service.');}
|
|
8
|
+
if(url.protocol!=='https:'||url.username||url.password||url.search||url.hash||typeof session.handle!=='string'||!session.handle||typeof session.eventsToken!=='string'||!session.eventsToken||!Number.isFinite(session.expiresAt)||session.expiresAt<=Date.now())throw Error('Invalid calling session.');
|
|
9
|
+
let closed=false;const subscriptions=new Set();
|
|
10
|
+
const request=async(operation,input={})=>{
|
|
11
|
+
if(closed)throw Object.assign(Error('calling_session_expired'),{status:401});
|
|
12
|
+
return hostRequest(operation,{handle:session.handle,input});
|
|
13
|
+
};
|
|
14
|
+
if(WebSocketImpl)request.subscribe=callbacks=>{
|
|
15
|
+
if(closed){queueMicrotask(()=>callbacks.onError?.(Object.assign(Error('calling_session_expired'),{status:401})));return {setEnabled(){},close(){}};}
|
|
16
|
+
const underlying=subscribeCallingEvents({baseUrl:session.serviceUrl,token:session.eventsToken,WebSocketImpl},callbacks);
|
|
17
|
+
const entry={setEnabled:enabled=>underlying.setEnabled(enabled),close(){underlying.close();subscriptions.delete(entry);}};
|
|
18
|
+
subscriptions.add(entry);return entry;
|
|
19
|
+
};
|
|
20
|
+
return {request,appearance:session.appearance??{},revision:session.revision??0,features:session.features??{voice:false,video:false},expiresAt:session.expiresAt,
|
|
21
|
+
async dispose(){if(closed)return;closed=true;for(const entry of [...subscriptions])entry.close();await hostRequest('close',{handle:session.handle,input:{}});},
|
|
22
|
+
};
|
|
23
|
+
}
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"provenance": true
|
|
18
18
|
},
|
|
19
19
|
"name": "@robono/calling",
|
|
20
|
-
"version": "0.
|
|
20
|
+
"version": "0.4.0",
|
|
21
21
|
"description": "WebRTC voice, video, group calling and screen sharing within apps and across Robono Bridge networks.",
|
|
22
22
|
"homepage": "https://robono.com/docs#calling",
|
|
23
23
|
"repository": {
|
|
@@ -39,6 +39,10 @@
|
|
|
39
39
|
"./groups": {
|
|
40
40
|
"types": "./dist/groups.d.ts",
|
|
41
41
|
"import": "./dist/groups.js"
|
|
42
|
+
},
|
|
43
|
+
"./messenger": {
|
|
44
|
+
"types": "./dist/messenger.d.ts",
|
|
45
|
+
"import": "./dist/messenger.js"
|
|
42
46
|
}
|
|
43
47
|
},
|
|
44
48
|
"files": [
|
|
@@ -53,7 +57,7 @@
|
|
|
53
57
|
},
|
|
54
58
|
"scripts": {
|
|
55
59
|
"build": "node build.mjs",
|
|
56
|
-
"test": "npm run build && node --test test/client.test.mjs test/package.test.mjs test/group-client.test.mjs test/sharing.test.mjs test/telemetry.test.mjs test/events.test.mjs",
|
|
60
|
+
"test": "npm run build && node --test test/client.test.mjs test/package.test.mjs test/group-client.test.mjs test/sharing.test.mjs test/telemetry.test.mjs test/events.test.mjs test/messenger.test.mjs",
|
|
57
61
|
"prepack": "npm run build && node ../../scripts/generate-package-sbom.mjs",
|
|
58
62
|
"prepublishOnly": "npm test"
|
|
59
63
|
}
|