@ohos-ports/genesys-cloud-streaming-client 20.1.0-beta.1
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/README.md +47 -0
- package/dist/cjs/alerting-leader.d.ts +29 -0
- package/dist/cjs/alerting-leader.js +163 -0
- package/dist/cjs/client.d.ts +84 -0
- package/dist/cjs/client.js +680 -0
- package/dist/cjs/connection-manager.d.ts +18 -0
- package/dist/cjs/connection-manager.js +120 -0
- package/dist/cjs/connection-transfer.d.ts +7 -0
- package/dist/cjs/connection-transfer.js +20 -0
- package/dist/cjs/http-client.d.ts +18 -0
- package/dist/cjs/http-client.js +230 -0
- package/dist/cjs/index.d.ts +10 -0
- package/dist/cjs/index.js +31 -0
- package/dist/cjs/messenger.d.ts +37 -0
- package/dist/cjs/messenger.js +54 -0
- package/dist/cjs/notifications.d.ts +94 -0
- package/dist/cjs/notifications.js +495 -0
- package/dist/cjs/ping.d.ts +21 -0
- package/dist/cjs/ping.js +60 -0
- package/dist/cjs/polyfills.d.ts +0 -0
- package/dist/cjs/polyfills.js +6 -0
- package/dist/cjs/server-monitor.d.ts +16 -0
- package/dist/cjs/server-monitor.js +44 -0
- package/dist/cjs/stanza-definitions/webrtc-signaling.d.ts +29 -0
- package/dist/cjs/stanza-definitions/webrtc-signaling.js +113 -0
- package/dist/cjs/stanza-definitions/xep0051.d.ts +19 -0
- package/dist/cjs/stanza-definitions/xep0051.js +28 -0
- package/dist/cjs/stats-formatter.d.ts +6 -0
- package/dist/cjs/stats-formatter.js +63 -0
- package/dist/cjs/types/genesys-cloud-media-session.d.ts +64 -0
- package/dist/cjs/types/genesys-cloud-media-session.js +353 -0
- package/dist/cjs/types/interfaces.d.ts +310 -0
- package/dist/cjs/types/interfaces.js +22 -0
- package/dist/cjs/types/libs.d.ts +32 -0
- package/dist/cjs/types/libs.js +1 -0
- package/dist/cjs/types/media-session.d.ts +76 -0
- package/dist/cjs/types/media-session.js +2 -0
- package/dist/cjs/types/named-agent.d.ts +13 -0
- package/dist/cjs/types/named-agent.js +2 -0
- package/dist/cjs/types/offline-error.d.ts +2 -0
- package/dist/cjs/types/offline-error.js +5 -0
- package/dist/cjs/types/sasl-error.d.ts +8 -0
- package/dist/cjs/types/sasl-error.js +12 -0
- package/dist/cjs/types/stanza-media-session.d.ts +56 -0
- package/dist/cjs/types/stanza-media-session.js +255 -0
- package/dist/cjs/types/streaming-client-extension.d.ts +14 -0
- package/dist/cjs/types/streaming-client-extension.js +2 -0
- package/dist/cjs/types/timeout-error.d.ts +3 -0
- package/dist/cjs/types/timeout-error.js +9 -0
- package/dist/cjs/types/user-cancelled-error.d.ts +2 -0
- package/dist/cjs/types/user-cancelled-error.js +5 -0
- package/dist/cjs/utils.d.ts +34 -0
- package/dist/cjs/utils.js +202 -0
- package/dist/cjs/webrtc.d.ts +126 -0
- package/dist/cjs/webrtc.js +891 -0
- package/dist/deploy-info.json +21 -0
- package/dist/es/alerting-leader.d.ts +29 -0
- package/dist/es/alerting-leader.js +177 -0
- package/dist/es/client.d.ts +84 -0
- package/dist/es/client.js +699 -0
- package/dist/es/connection-manager.d.ts +18 -0
- package/dist/es/connection-manager.js +124 -0
- package/dist/es/connection-transfer.d.ts +7 -0
- package/dist/es/connection-transfer.js +16 -0
- package/dist/es/http-client.d.ts +18 -0
- package/dist/es/http-client.js +194 -0
- package/dist/es/index.bundle.js +39629 -0
- package/dist/es/index.d.ts +10 -0
- package/dist/es/index.js +10 -0
- package/dist/es/messenger.d.ts +37 -0
- package/dist/es/messenger.js +62 -0
- package/dist/es/notifications.d.ts +94 -0
- package/dist/es/notifications.js +507 -0
- package/dist/es/ping.d.ts +21 -0
- package/dist/es/ping.js +68 -0
- package/dist/es/polyfills.d.ts +0 -0
- package/dist/es/polyfills.js +6 -0
- package/dist/es/server-monitor.d.ts +16 -0
- package/dist/es/server-monitor.js +41 -0
- package/dist/es/stanza-definitions/webrtc-signaling.d.ts +29 -0
- package/dist/es/stanza-definitions/webrtc-signaling.js +110 -0
- package/dist/es/stanza-definitions/xep0051.d.ts +19 -0
- package/dist/es/stanza-definitions/xep0051.js +25 -0
- package/dist/es/stats-formatter.d.ts +6 -0
- package/dist/es/stats-formatter.js +54 -0
- package/dist/es/types/genesys-cloud-media-session.d.ts +64 -0
- package/dist/es/types/genesys-cloud-media-session.js +379 -0
- package/dist/es/types/interfaces.d.ts +310 -0
- package/dist/es/types/interfaces.js +19 -0
- package/dist/es/types/libs.d.ts +32 -0
- package/dist/es/types/libs.js +1 -0
- package/dist/es/types/media-session.d.ts +76 -0
- package/dist/es/types/media-session.js +1 -0
- package/dist/es/types/named-agent.d.ts +13 -0
- package/dist/es/types/named-agent.js +1 -0
- package/dist/es/types/offline-error.d.ts +2 -0
- package/dist/es/types/offline-error.js +2 -0
- package/dist/es/types/sasl-error.d.ts +8 -0
- package/dist/es/types/sasl-error.js +9 -0
- package/dist/es/types/stanza-media-session.d.ts +56 -0
- package/dist/es/types/stanza-media-session.js +264 -0
- package/dist/es/types/streaming-client-extension.d.ts +14 -0
- package/dist/es/types/streaming-client-extension.js +1 -0
- package/dist/es/types/timeout-error.d.ts +3 -0
- package/dist/es/types/timeout-error.js +5 -0
- package/dist/es/types/user-cancelled-error.d.ts +2 -0
- package/dist/es/types/user-cancelled-error.js +2 -0
- package/dist/es/utils.d.ts +34 -0
- package/dist/es/utils.js +192 -0
- package/dist/es/webrtc.d.ts +126 -0
- package/dist/es/webrtc.js +917 -0
- package/dist/manifest.json +19 -0
- package/dist/npm/CHANGELOG.md +637 -0
- package/dist/npm/README.md +47 -0
- package/dist/npm/alerting-leader.d.ts +29 -0
- package/dist/npm/alerting-leader.js +163 -0
- package/dist/npm/client.d.ts +84 -0
- package/dist/npm/client.js +680 -0
- package/dist/npm/connection-manager.d.ts +18 -0
- package/dist/npm/connection-manager.js +120 -0
- package/dist/npm/connection-transfer.d.ts +7 -0
- package/dist/npm/connection-transfer.js +20 -0
- package/dist/npm/http-client.d.ts +18 -0
- package/dist/npm/http-client.js +230 -0
- package/dist/npm/index.d.ts +10 -0
- package/dist/npm/index.js +31 -0
- package/dist/npm/messenger.d.ts +37 -0
- package/dist/npm/messenger.js +54 -0
- package/dist/npm/module.js +10 -0
- package/dist/npm/notifications.d.ts +94 -0
- package/dist/npm/notifications.js +495 -0
- package/dist/npm/ping.d.ts +21 -0
- package/dist/npm/ping.js +60 -0
- package/dist/npm/polyfills.d.ts +0 -0
- package/dist/npm/polyfills.js +6 -0
- package/dist/npm/server-monitor.d.ts +16 -0
- package/dist/npm/server-monitor.js +44 -0
- package/dist/npm/stanza-definitions/webrtc-signaling.d.ts +29 -0
- package/dist/npm/stanza-definitions/webrtc-signaling.js +113 -0
- package/dist/npm/stanza-definitions/xep0051.d.ts +19 -0
- package/dist/npm/stanza-definitions/xep0051.js +28 -0
- package/dist/npm/stats-formatter.d.ts +6 -0
- package/dist/npm/stats-formatter.js +63 -0
- package/dist/npm/types/genesys-cloud-media-session.d.ts +64 -0
- package/dist/npm/types/genesys-cloud-media-session.js +353 -0
- package/dist/npm/types/interfaces.d.ts +310 -0
- package/dist/npm/types/interfaces.js +22 -0
- package/dist/npm/types/libs.d.ts +32 -0
- package/dist/npm/types/libs.js +1 -0
- package/dist/npm/types/media-session.d.ts +76 -0
- package/dist/npm/types/media-session.js +2 -0
- package/dist/npm/types/named-agent.d.ts +13 -0
- package/dist/npm/types/named-agent.js +2 -0
- package/dist/npm/types/offline-error.d.ts +2 -0
- package/dist/npm/types/offline-error.js +5 -0
- package/dist/npm/types/sasl-error.d.ts +8 -0
- package/dist/npm/types/sasl-error.js +12 -0
- package/dist/npm/types/stanza-media-session.d.ts +56 -0
- package/dist/npm/types/stanza-media-session.js +255 -0
- package/dist/npm/types/streaming-client-extension.d.ts +14 -0
- package/dist/npm/types/streaming-client-extension.js +2 -0
- package/dist/npm/types/timeout-error.d.ts +3 -0
- package/dist/npm/types/timeout-error.js +9 -0
- package/dist/npm/types/user-cancelled-error.d.ts +2 -0
- package/dist/npm/types/user-cancelled-error.js +5 -0
- package/dist/npm/utils.d.ts +34 -0
- package/dist/npm/utils.js +207 -0
- package/dist/npm/webrtc.d.ts +126 -0
- package/dist/npm/webrtc.js +893 -0
- package/dist/streaming-client.browser.js +2 -0
- package/dist/streaming-client.browser.js.LICENSE.txt +12 -0
- package/dist/v20/streaming-client.browser.js +2 -0
- package/dist/v20/streaming-client.browser.js.LICENSE.txt +12 -0
- package/dist/v20.1.0/streaming-client.browser.js +2 -0
- package/dist/v20.1.0/streaming-client.browser.js.LICENSE.txt +12 -0
- package/package.json +132 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference path="types/libs.d.ts" />
|
|
2
|
+
import { Client } from './client';
|
|
3
|
+
export * from './types/genesys-cloud-media-session';
|
|
4
|
+
export * from './types/stanza-media-session';
|
|
5
|
+
export * from './types/media-session';
|
|
6
|
+
export * from './types/interfaces';
|
|
7
|
+
export * from './messenger';
|
|
8
|
+
export { HttpClient } from './http-client';
|
|
9
|
+
export { StreamingClientError, StreamingSubscriptionError, parseJwt } from './utils';
|
|
10
|
+
export default Client;
|
package/dist/es/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference path="types/libs.ts" />
|
|
2
|
+
import { Client } from './client';
|
|
3
|
+
export * from './types/genesys-cloud-media-session';
|
|
4
|
+
export * from './types/stanza-media-session';
|
|
5
|
+
export * from './types/media-session';
|
|
6
|
+
export * from './types/interfaces';
|
|
7
|
+
export * from './messenger';
|
|
8
|
+
export { HttpClient } from './http-client';
|
|
9
|
+
export { StreamingClientError, StreamingSubscriptionError, parseJwt } from './utils';
|
|
10
|
+
export default Client;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ReceivedMessage } from 'stanza/protocol';
|
|
2
|
+
import { Client } from './client';
|
|
3
|
+
import { NamedAgent } from './types/named-agent';
|
|
4
|
+
import { GenesysMediaMessage, StreamingClientExtension } from './types/interfaces';
|
|
5
|
+
import { Emitter } from 'strict-event-emitter';
|
|
6
|
+
declare type MessageWithMediaMessage = {
|
|
7
|
+
from?: string;
|
|
8
|
+
id?: string;
|
|
9
|
+
to?: string;
|
|
10
|
+
mediaMessage: GenesysMediaMessage;
|
|
11
|
+
};
|
|
12
|
+
export declare type MediaMessageEvent = MessageWithMediaMessage & {
|
|
13
|
+
fromMyUser: boolean;
|
|
14
|
+
fromMyClient: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare type MessengerEvents = {
|
|
17
|
+
mediaMessage: [MediaMessageEvent];
|
|
18
|
+
};
|
|
19
|
+
export declare class MessengerExtension extends Emitter<MessengerEvents> implements StreamingClientExtension {
|
|
20
|
+
private client;
|
|
21
|
+
private stanzaInstance;
|
|
22
|
+
constructor(client: Client, stanzaInstance: NamedAgent);
|
|
23
|
+
get bareJid(): string;
|
|
24
|
+
handleStanzaInstanceChange(stanzaInstance: NamedAgent): void;
|
|
25
|
+
isMediaMessage(msg: any): msg is MessageWithMediaMessage;
|
|
26
|
+
handleMessage(msg: ReceivedMessage): void;
|
|
27
|
+
/**
|
|
28
|
+
* @param msg
|
|
29
|
+
* @returns Promise<messageId>
|
|
30
|
+
*/
|
|
31
|
+
broadcastMessage(msg: MessageWithMediaMessage): Promise<string>;
|
|
32
|
+
get expose(): MessengerExtensionApi;
|
|
33
|
+
}
|
|
34
|
+
export interface MessengerExtensionApi extends Pick<Emitter<MessengerEvents>, 'on' | 'off' | 'once' | 'addListener' | 'removeListener'> {
|
|
35
|
+
broadcastMessage(msg: MessageWithMediaMessage): Promise<string>;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
import { Emitter } from 'strict-event-emitter';
|
|
12
|
+
import { toBare } from 'stanza/JID';
|
|
13
|
+
export class MessengerExtension extends Emitter {
|
|
14
|
+
constructor(client, stanzaInstance) {
|
|
15
|
+
super();
|
|
16
|
+
this.client = client;
|
|
17
|
+
this.stanzaInstance = stanzaInstance;
|
|
18
|
+
}
|
|
19
|
+
get bareJid() {
|
|
20
|
+
return toBare(this.stanzaInstance.jid);
|
|
21
|
+
}
|
|
22
|
+
handleStanzaInstanceChange(stanzaInstance) {
|
|
23
|
+
this.stanzaInstance = stanzaInstance;
|
|
24
|
+
}
|
|
25
|
+
isMediaMessage(msg) {
|
|
26
|
+
return !!msg.mediaMessage;
|
|
27
|
+
}
|
|
28
|
+
handleMessage(msg) {
|
|
29
|
+
if (!this.isMediaMessage(msg)) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const fromMyClient = msg.from === this.stanzaInstance.jid;
|
|
33
|
+
const fromMyUser = toBare(msg.from) === this.bareJid;
|
|
34
|
+
this.emit('mediaMessage', Object.assign(Object.assign({}, msg), { fromMyClient, fromMyUser }));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @param msg
|
|
38
|
+
* @returns Promise<messageId>
|
|
39
|
+
*/
|
|
40
|
+
broadcastMessage(msg) {
|
|
41
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
const id = globalThis.crypto.randomUUID();
|
|
43
|
+
msg.id = id;
|
|
44
|
+
msg.from = this.stanzaInstance.jid;
|
|
45
|
+
if (!msg.to) {
|
|
46
|
+
msg.to = this.bareJid;
|
|
47
|
+
}
|
|
48
|
+
yield this.stanzaInstance.send('message', msg);
|
|
49
|
+
return id;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
get expose() {
|
|
53
|
+
return {
|
|
54
|
+
broadcastMessage: this.broadcastMessage.bind(this),
|
|
55
|
+
on: this.on.bind(this),
|
|
56
|
+
once: this.once.bind(this),
|
|
57
|
+
off: this.off.bind(this),
|
|
58
|
+
removeListener: this.removeListener.bind(this),
|
|
59
|
+
addListener: this.addListener.bind(this)
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { PubsubEvent, PubsubSubscription, PubsubSubscriptionWithOptions } from 'stanza/protocol';
|
|
2
|
+
import { Client } from './client';
|
|
3
|
+
import { IClientOptions, StreamingClientExtension } from './types/interfaces';
|
|
4
|
+
import { NamedAgent } from './types/named-agent';
|
|
5
|
+
import { AxiosResponse } from 'axios';
|
|
6
|
+
export declare class Notifications implements StreamingClientExtension {
|
|
7
|
+
client: Client;
|
|
8
|
+
stanzaInstance?: NamedAgent;
|
|
9
|
+
subscriptions: any;
|
|
10
|
+
bulkSubscriptions: any;
|
|
11
|
+
topicPriorities: any;
|
|
12
|
+
debouncedResubscribe: () => Promise<BulkSubscribeResult>;
|
|
13
|
+
enablePartialBulkResubscribe: boolean;
|
|
14
|
+
private internalSubscriptions;
|
|
15
|
+
private pendingBulkSubscribeRetry?;
|
|
16
|
+
private pendingConnectedWait?;
|
|
17
|
+
constructor(client: any, options?: IClientOptions);
|
|
18
|
+
get pubsubHost(): string;
|
|
19
|
+
handleStanzaInstanceChange(stanza: NamedAgent): void;
|
|
20
|
+
topicHandlers(topic: string): Array<(obj?: any) => void>;
|
|
21
|
+
pubsubEvent({ pubsub }: {
|
|
22
|
+
pubsub: PubsubEvent;
|
|
23
|
+
}): void;
|
|
24
|
+
xmppSubscribe(topic: string): Promise<PubsubSubscriptionWithOptions | void>;
|
|
25
|
+
xmppUnsubscribe(topic: string): Promise<PubsubSubscription | void>;
|
|
26
|
+
mapCombineTopics(topics: string[]): Array<{
|
|
27
|
+
id: string;
|
|
28
|
+
}>;
|
|
29
|
+
prioritizeTopicList(topics: Array<{
|
|
30
|
+
id: string;
|
|
31
|
+
}>): Array<{
|
|
32
|
+
id: string;
|
|
33
|
+
}>;
|
|
34
|
+
getTopicPriority(topic: string, returnDefault?: boolean): number;
|
|
35
|
+
truncateTopicList(topics: Array<{
|
|
36
|
+
id: string;
|
|
37
|
+
}>): Array<{
|
|
38
|
+
id: string;
|
|
39
|
+
}>;
|
|
40
|
+
makeBulkSubscribeRequest(topics: string[], options: any): Promise<AxiosResponse<ChannelTopicsEntityListing>>;
|
|
41
|
+
createSubscription(topic: string, handler: (obj?: any) => void): void;
|
|
42
|
+
removeSubscription(topic: string, handler: (obj?: any) => void): void;
|
|
43
|
+
removeTopicPriority(topic: string): void;
|
|
44
|
+
getActiveIndividualTopics(): string[];
|
|
45
|
+
resubscribe(): Promise<BulkSubscribeResult>;
|
|
46
|
+
subscriptionsKeepAlive(): void;
|
|
47
|
+
getTopicParts(topic: string): {
|
|
48
|
+
prefix: string;
|
|
49
|
+
postfixes: string[];
|
|
50
|
+
};
|
|
51
|
+
setTopicPriorities(priorities?: {}): void;
|
|
52
|
+
subscribe(topic: string, handler?: (..._: any[]) => void, immediate?: boolean, priority?: number): Promise<TopicSubscribeResult>;
|
|
53
|
+
/**
|
|
54
|
+
* Use `_subscribeInternal` when subscribing to a topic from within streaming-client itself.
|
|
55
|
+
* Internal subscriptions won't be overwritten by subscriptions from consumers and will be prioritized
|
|
56
|
+
* over subscriptions from consumers.
|
|
57
|
+
*/
|
|
58
|
+
_subscribeInternal(topic: string): Promise<PubsubSubscriptionWithOptions | void>;
|
|
59
|
+
unsubscribe(topic: string, handler?: (..._: any[]) => void, immediate?: boolean): Promise<any>;
|
|
60
|
+
bulkSubscribe(topics: string[], options?: BulkSubscribeOpts, priorities?: {
|
|
61
|
+
[topicName: string]: number;
|
|
62
|
+
}): Promise<BulkSubscribeResult>;
|
|
63
|
+
get expose(): NotificationsAPI;
|
|
64
|
+
}
|
|
65
|
+
export interface NotificationsAPI {
|
|
66
|
+
subscribe(topic: string, handler?: (..._: any[]) => void, immediate?: boolean, priority?: number): Promise<any>;
|
|
67
|
+
unsubscribe(topic: string, handler?: (..._: any[]) => void, immediate?: boolean): Promise<any>;
|
|
68
|
+
bulkSubscribe(topics: string[], options?: BulkSubscribeOpts, priorities?: {
|
|
69
|
+
[topicName: string]: number;
|
|
70
|
+
}): Promise<any>;
|
|
71
|
+
}
|
|
72
|
+
export interface BulkSubscribeOpts {
|
|
73
|
+
replace?: boolean;
|
|
74
|
+
force?: boolean;
|
|
75
|
+
}
|
|
76
|
+
export interface BulkSubscribeResult {
|
|
77
|
+
[topic: string]: TopicSubscribeResult;
|
|
78
|
+
}
|
|
79
|
+
export interface TopicSubscribeResult {
|
|
80
|
+
topic: string;
|
|
81
|
+
state: 'Permitted' | 'Rejected' | 'Unknown';
|
|
82
|
+
rejectionReason?: string;
|
|
83
|
+
missingPermissions?: string[];
|
|
84
|
+
}
|
|
85
|
+
export interface ChannelTopicResponseEntity {
|
|
86
|
+
id: string;
|
|
87
|
+
state: 'Permitted' | 'Rejected';
|
|
88
|
+
rejectionReason?: string;
|
|
89
|
+
missingPermissions?: string[];
|
|
90
|
+
selfUri?: string;
|
|
91
|
+
}
|
|
92
|
+
export interface ChannelTopicsEntityListing {
|
|
93
|
+
entities: ChannelTopicResponseEntity[];
|
|
94
|
+
}
|