Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@azure/communication-signaling

Package Overview
Dependencies
Maintainers
3
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@azure/communication-signaling - npm Package Compare versions

Comparing version 1.0.0-beta.2 to 1.0.0-beta.3

NOTICE.txt

3

package.json
{
"name": "@azure/communication-signaling",
"version": "1.0.0-beta.2",
"version": "1.0.0-beta.3",
"description": "Azure Communication Signaling Client",

@@ -42,2 +42,3 @@ "sdk-type": "client",

"README.md",
"NOTICE.txt",
"LICENSE",

@@ -44,0 +45,0 @@ "src"

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
/**
* An Azure Communication user.
*/
export interface CommunicationUserIdentifier {
/**
* Id of Azure Communication user.
*/
communicationUserId: string;
}
import {
CommunicationIdentifierKind
} from "./identifierModels";

@@ -19,9 +13,8 @@ /**

/**
* The user identity of the event initiator.
* in the format `8:acs...`.
* The id of the chat participant.
*/
user: CommunicationUserIdentifier;
id: CommunicationIdentifierKind;
/**
* The display name of the event initiator.
* Display name for the chat participant.
*/

@@ -32,5 +25,5 @@ displayName: string;

* Time from which the chat history is shared with the chat participant.
* The timestamp is in ISO8601 format: `yyyy-MM-ddTHH:mm:ssZ`.
* The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`.
*/
shareHistoryTime?: string;
shareHistoryTime?: Date;
}

@@ -51,3 +44,3 @@

*/
export interface BaseEvent {
export interface BaseChatEvent {
/**

@@ -61,8 +54,13 @@ * Thread Id of the event.

*/
sender: ChatParticipant;
sender: CommunicationIdentifierKind;
/**
* The display name of the event sender.
*/
senderDisplayName: string;
/**
* The Id of the event recipient.
*/
recipient: CommunicationUserIdentifier;
recipient: CommunicationIdentifierKind;
}

@@ -73,3 +71,3 @@

*/
export interface ChatMessageEvent {
export interface BaseChatMessageEvent extends BaseChatEvent {
/**

@@ -81,6 +79,6 @@ * The Id of the message. This Id is server generated.

/**
* The timestamp when the message arrived at the server. The timestamp is in ISO8601 format:
* The timestamp when the message arrived at the server. The timestamp is in RFC3339 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
*/
createdOn: string;
createdOn: Date;

@@ -99,3 +97,6 @@ /**

export interface ChatThreadEvent {
/**
* Event for chat thread operations
*/
export interface BaseChatThreadEvent {
/**

@@ -117,7 +118,7 @@ * Thread Id of the event.

*/
export interface ChatMessageReceivedEvent extends BaseEvent, ChatMessageEvent {
export interface ChatMessageReceivedEvent extends BaseChatMessageEvent {
/**
* Content of the message.
*/
content: string;
message: string;
}

@@ -129,13 +130,13 @@

*/
export interface ChatMessageEditedEvent extends BaseEvent, ChatMessageEvent {
export interface ChatMessageEditedEvent extends BaseChatMessageEvent {
/**
* Content of the edited message.
*/
content: string;
message: string;
/**
* The timestamp when the message was edited. The timestamp is in ISO8601 format:
* The timestamp when the message was edited. The timestamp is in RFC3339 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
*/
editedOn: string;
editedOn: Date;
}

@@ -147,8 +148,8 @@

*/
export interface ChatMessageDeletedEvent extends BaseEvent, ChatMessageEvent {
export interface ChatMessageDeletedEvent extends BaseChatMessageEvent {
/**
* The timestamp when the message was deleted. The timestamp is in ISO8601 format:
* The timestamp when the message was deleted. The timestamp is in RFC3339 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
*/
deletedOn: string;
deletedOn: Date;
}

@@ -160,3 +161,3 @@

*/
export interface TypingIndicatorReceivedEvent extends BaseEvent {
export interface TypingIndicatorReceivedEvent extends BaseChatEvent {
/**

@@ -168,6 +169,6 @@ * Version of the message.

/**
* The timestamp when the message arrived at the server. The timestamp is in ISO8601 format:
* The timestamp when the message arrived at the server. The timestamp is in RFC3339 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
*/
receivedOn: string;
receivedOn: Date;
}

@@ -178,3 +179,3 @@

*/
export interface ReadReceiptReceivedEvent extends BaseEvent {
export interface ReadReceiptReceivedEvent extends BaseChatEvent {
/**

@@ -186,5 +187,5 @@ * The id of the last read chat message.

/**
* The timestamp when the message was read. The timestamp is in ISO8601 format: yyyy-MM-ddTHH:mm:ssZ
* The timestamp when the message was read. The timestamp is in RFC3339 format: yyyy-MM-ddTHH:mm:ssZ
*/
readOn: string;
readOn: Date;
}

@@ -196,8 +197,8 @@

*/
export interface ChatThreadCreatedEvent extends ChatThreadEvent {
export interface ChatThreadCreatedEvent extends BaseChatThreadEvent {
/**
* The timestamp when the thread was created. The timestamp is in ISO8601 format:
* The timestamp when the thread was created. The timestamp is in RFC3339 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
*/
createdOn: string;
createdOn: Date;

@@ -215,3 +216,3 @@ /**

/**
* The information of the user that created the chat thread.
* Id of the user that created the chat thread.
*/

@@ -225,3 +226,3 @@ createdBy: ChatParticipant;

*/
export interface ChatThreadPropertiesUpdatedEvent extends ChatThreadEvent {
export interface ChatThreadPropertiesUpdatedEvent extends BaseChatThreadEvent {
/**

@@ -233,9 +234,9 @@ * The properties of the thread.

/**
* The timestamp when the thread was updated. The timestamp is in ISO8601 format:
* The timestamp when the thread was updated. The timestamp is in RFC3339 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
*/
updatedOn: string;
updatedOn: Date;
/**
* The information of the user that updated the chat thread.
* Id of the user that updated the chat thread.
*/

@@ -249,11 +250,11 @@ updatedBy: ChatParticipant;

*/
export interface ChatThreadDeletedEvent extends ChatThreadEvent {
export interface ChatThreadDeletedEvent extends BaseChatThreadEvent {
/**
* The timestamp when the thread was deleted. The timestamp is in ISO8601 format:
* The timestamp when the thread was deleted. The timestamp is in RFC3339 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
*/
deletedOn: string;
deletedOn: Date;
/**
* The information of the user that deleted the chat thread.
* Id of the user that deleted the chat thread.
*/

@@ -267,8 +268,8 @@ deletedBy: ChatParticipant;

*/
export interface ParticipantsAddedEvent extends ChatThreadEvent {
export interface ParticipantsAddedEvent extends BaseChatThreadEvent {
/**
* The timestamp when the member was added. The timestamp is in ISO8601 format:
* The timestamp when the member was added. The timestamp is in RFC3339 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
*/
addedOn: string;
addedOn: Date;

@@ -281,3 +282,3 @@ /**

/**
* The information of the user that added the chat participants.
* Id of the user that added the chat participants.
*/

@@ -291,8 +292,8 @@ addedBy: ChatParticipant;

*/
export interface ParticipantsRemovedEvent extends ChatThreadEvent {
export interface ParticipantsRemovedEvent extends BaseChatThreadEvent {
/**
* The timestamp when the member was removed. The timestamp is in ISO8601 format:
* The timestamp when the member was removed. The timestamp is in RFC3339 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
*/
removedOn: string;
removedOn: Date;

@@ -305,3 +306,3 @@ /**

/**
* The information of the user that removed the chat participants.
* Id of the user that removed the chat participants.
*/

@@ -308,0 +309,0 @@ removedBy: ChatParticipant;

@@ -0,0 +0,0 @@ // Copyright (c) Microsoft Corporation.

@@ -14,6 +14,5 @@ // Copyright (c) Microsoft Corporation.

import {
CommunicationUserIdentifier,
ChatEventId,
BaseEvent,
ChatMessageEvent,
BaseChatEvent,
BaseChatMessageEvent,
ChatMessageReceivedEvent,

@@ -24,3 +23,3 @@ ChatMessageEditedEvent,

TypingIndicatorReceivedEvent,
ChatThreadEvent,
BaseChatThreadEvent,
ChatParticipant,

@@ -34,2 +33,14 @@ ChatThreadProperties,

} from "./events/chat";
import {
CommunicationIdentifier,
CommunicationUserIdentifier,
PhoneNumberIdentifier,
MicrosoftTeamsUserIdentifier,
UnknownIdentifier,
CommunicationIdentifierKind,
CommunicationUserKind,
PhoneNumberKind,
MicrosoftTeamsUserKind,
UnknownIdentifierKind
} from "./events/identifierModels";
import { AzureLogger } from "@azure/logger";

@@ -50,6 +61,5 @@ import { AbortSignalLike, AccessToken } from '@azure/core-http';

export {
CommunicationUserIdentifier,
ChatEventId,
BaseEvent,
ChatMessageEvent,
BaseChatEvent,
BaseChatMessageEvent,
ChatMessageReceivedEvent,

@@ -60,3 +70,3 @@ ChatMessageEditedEvent,

TypingIndicatorReceivedEvent,
ChatThreadEvent,
BaseChatThreadEvent,
ChatParticipant,

@@ -68,9 +78,23 @@ ChatThreadProperties,

ParticipantsAddedEvent,
ParticipantsRemovedEvent
ParticipantsRemovedEvent,
CommunicationIdentifier,
CommunicationUserIdentifier,
PhoneNumberIdentifier,
MicrosoftTeamsUserIdentifier,
UnknownIdentifier,
CommunicationIdentifierKind,
CommunicationUserKind,
PhoneNumberKind,
MicrosoftTeamsUserKind,
UnknownIdentifierKind
};
export interface CommunicationUserCredential {
getToken(abortSignal?: AbortSignalLike): Promise<AccessToken>;
export interface CommunicationGetTokenOptions {
abortSignal?: AbortSignalLike;
}
export interface CommunicationTokenCredential {
getToken(options?: CommunicationGetTokenOptions): Promise<AccessToken>;
}
export interface SignalingClient {

@@ -164,3 +188,3 @@ /**

constructor(
credential: CommunicationUserCredential,
credential: CommunicationTokenCredential,
private readonly logger: AzureLogger,

@@ -167,0 +191,0 @@ options?: SignalingClientOptions

@@ -42,2 +42,8 @@ // Copyright (c) Microsoft Corporation.

} from "./events/chat";
import {
CommunicationUserKind,
PhoneNumberKind,
MicrosoftTeamsUserKind,
UnknownIdentifierKind
} from "./events/identifierModels";

@@ -57,2 +63,10 @@ const eventIds = new Map<ChatEventId, number>([

const publicTeamsUserPrefix = '8:orgid:';
const dodTeamsUserPrefix = '8:dod:';
const gcchTeamsUserPrefix = '8:gcch:';
const teamsVisitorUserPrefix = '8:teamsvisitor:';
const phoneNumberPrefix = '4:';
const acsUserPrefix = '8:acs:';
const spoolUserPrefix = '8:spool:';
export const toMessageHandler = (

@@ -87,14 +101,10 @@ event: ChatEventId,

threadId: payload.groupId,
sender: {
user: { communicationUserId: payload.senderId },
displayName: payload.senderDisplayName
},
recipient: {
communicationUserId: `8:${payload.recipientId}`
}, // TODO: Need to fix this inconsistency in CNS/PNH
sender: constructIdentifierKindFromMri(payload.senderId),
senderDisplayName: payload.senderDisplayName,
recipient: constructIdentifierKindFromMri(`8:${payload.recipientId}`), // TODO: Need to fix this inconsistency in CNS/PNH
id: payload.messageId,
createdOn: payload.originalArrivalTime,
createdOn: new Date(payload.originalArrivalTime),
version: payload.version,
type: payload.messageType,
content: payload.messageBody
message: payload.messageBody
};

@@ -108,12 +118,10 @@ return eventPayload;

threadId: payload.groupId,
sender: {
user: { communicationUserId: payload.senderId },
displayName: payload.senderDisplayName
},
recipient: { communicationUserId: `8:${payload.recipientId}` }, // TODO: Need to fix this inconsistency in CNS/PNH
sender: constructIdentifierKindFromMri(payload.senderId),
senderDisplayName: payload.senderDisplayName,
recipient: constructIdentifierKindFromMri(`8:${payload.recipientId}`), // TODO: Need to fix this inconsistency in CNS/PNH
id: payload.messageId,
createdOn: payload.originalArrivalTime,
createdOn: new Date(payload.originalArrivalTime),
version: payload.version,
content: payload.messageBody,
editedOn: payload.edittime,
message: payload.messageBody,
editedOn: new Date(payload.edittime),
type: payload.messageType

@@ -128,11 +136,9 @@ };

threadId: payload.groupId,
sender: {
user: { communicationUserId: payload.senderId },
displayName: payload.senderDisplayName
},
recipient: { communicationUserId: `8:${payload.recipientId}` }, // TODO: Need to fix this inconsistency in CNS/PNH
sender: constructIdentifierKindFromMri(payload.senderId),
senderDisplayName: payload.senderDisplayName,
recipient: constructIdentifierKindFromMri(`8:${payload.recipientId}`), // TODO: Need to fix this inconsistency in CNS/PNH
id: payload.messageId,
createdOn: payload.originalArrivalTime,
createdOn: new Date(payload.originalArrivalTime),
version: payload.version,
deletedOn: payload.deletetime,
deletedOn: new Date(payload.deletetime),
type: payload.messageType

@@ -147,9 +153,7 @@ };

threadId: payload.groupId,
sender: {
user: { communicationUserId: payload.senderId },
displayName: ""
},
recipient: { communicationUserId: `8:${payload.recipientId}` }, // TODO: Need to fix this inconsistency in CNS/PNH
sender: constructIdentifierKindFromMri(payload.senderId),
senderDisplayName: "",
recipient: constructIdentifierKindFromMri(`8:${payload.recipientId}`), // TODO: Need to fix this inconsistency in CNS/PNH
version: payload.version,
receivedOn: payload.originalArrivalTime
receivedOn: new Date(payload.originalArrivalTime)
};

@@ -163,12 +167,9 @@ return eventPayload;

const consumptionHorizon = readReceiptMessageBody.consumptionhorizon.split(";");
const readOn = new Date(+consumptionHorizon[1]).toISOString();
const eventPayload: ReadReceiptReceivedEvent = {
threadId: payload.groupId,
sender: {
user: { communicationUserId: payload.senderId },
displayName: ""
},
recipient: { communicationUserId: `8:${payload.recipientId}` }, // TODO: Need to fix this inconsistency in CNS/PNH
sender: constructIdentifierKindFromMri(payload.senderId),
senderDisplayName: "",
recipient: constructIdentifierKindFromMri(`8:${payload.recipientId}`), // TODO: Need to fix this inconsistency in CNS/PNH
chatMessageId: payload.messageId,
readOn: readOn
readOn: new Date(+consumptionHorizon[1])
};

@@ -184,3 +185,3 @@ return eventPayload;

const createdBy: ChatParticipant = {
user: { communicationUserId: createdByPayload.participantId },
id: constructIdentifierKindFromMri(createdByPayload.participantId),
displayName: createdByPayload.displayName

@@ -190,3 +191,3 @@ };

m => { return {
user: { communicationUserId: m.participantId },
id: constructIdentifierKindFromMri(m.participantId),
displayName: m.displayName

@@ -196,3 +197,3 @@ };});

threadId: payload.threadId,
createdOn: payload.createTime,
createdOn: new Date(payload.createTime),
createdBy: createdBy,

@@ -211,3 +212,3 @@ version: payload.version,

const updatedBy: ChatParticipant = {
user: { communicationUserId: updatedByPayload.participantId },
id: constructIdentifierKindFromMri(updatedByPayload.participantId),
displayName: updatedByPayload.displayName

@@ -217,3 +218,3 @@ };

threadId: payload.threadId,
updatedOn: payload.editTime,
updatedOn: new Date(payload.editTime),
updatedBy: updatedBy,

@@ -230,3 +231,3 @@ version: payload.version,

const deletedBy: ChatParticipant = {
user: { communicationUserId: deletedByPayload.participantId },
id: constructIdentifierKindFromMri(deletedByPayload.participantId),
displayName: deletedByPayload.displayName

@@ -236,3 +237,3 @@ };

threadId: payload.threadId,
deletedOn: payload.deleteTime,
deletedOn: new Date(payload.deleteTime),
deletedBy: deletedBy,

@@ -249,3 +250,3 @@ version: payload.version,

const addedBy: ChatParticipant = {
user: { communicationUserId: addedByPayload.participantId },
id: constructIdentifierKindFromMri(addedByPayload.participantId),
displayName: addedByPayload.displayName

@@ -255,9 +256,9 @@ };

m => { return {
user: { communicationUserId: m.participantId },
id: constructIdentifierKindFromMri(m.participantId),
displayName: m.displayName,
shareHistoryTime: new Date(m.shareHistoryTime).toISOString()
shareHistoryTime: new Date(m.shareHistoryTime)
};});
const eventPayload: ParticipantsAddedEvent = {
threadId: payload.threadId,
addedOn: payload.time,
addedOn: new Date(payload.time),
addedBy: addedBy,

@@ -275,3 +276,3 @@ version: payload.version,

const removedBy: ChatParticipant = {
user: { communicationUserId: removedByPayload.participantId },
id: constructIdentifierKindFromMri(removedByPayload.participantId),
displayName: removedByPayload.displayName

@@ -281,9 +282,9 @@ };

m => { return {
user: { communicationUserId: m.participantId },
id: constructIdentifierKindFromMri(m.participantId),
displayName: m.displayName,
shareHistoryTime: new Date(m.shareHistoryTime).toISOString()
shareHistoryTime: new Date(m.shareHistoryTime)
};});
const eventPayload: ParticipantsRemovedEvent = {
threadId: payload.threadId,
removedOn: payload.time,
removedOn: new Date(payload.time),
removedBy: removedBy,

@@ -314,1 +315,20 @@ version: payload.version,

};
const constructIdentifierKindFromMri = (mri: string): CommunicationUserKind | PhoneNumberKind |
MicrosoftTeamsUserKind | UnknownIdentifierKind => {
if (mri.startsWith(publicTeamsUserPrefix)) {
return { kind: "microsoftTeamsUser", rawId: mri, microsoftTeamsUserId: mri.substring(publicTeamsUserPrefix.length), isAnonymous: false, cloud: 'public' };
} else if (mri.startsWith(dodTeamsUserPrefix)) {
return { kind: "microsoftTeamsUser", rawId: mri, microsoftTeamsUserId: mri.substring(dodTeamsUserPrefix.length), isAnonymous: false, cloud: 'dod' };
} else if (mri.startsWith(gcchTeamsUserPrefix)) {
return { kind: "microsoftTeamsUser", rawId: mri, microsoftTeamsUserId: mri.substring(gcchTeamsUserPrefix.length), isAnonymous: false, cloud: 'gcch' };
} else if (mri.startsWith(teamsVisitorUserPrefix)) {
return { kind: "microsoftTeamsUser", rawId: mri, microsoftTeamsUserId: mri.substring(teamsVisitorUserPrefix.length), isAnonymous: true };
} else if (mri.startsWith(phoneNumberPrefix)) {
return { kind: "phoneNumber", rawId: mri, phoneNumber: mri.substring(phoneNumberPrefix.length) };
} else if (mri.startsWith(acsUserPrefix) || mri.startsWith(spoolUserPrefix)) {
return { kind: "communicationUser", communicationUserId: mri };
} else {
return { kind: "unknown", id: mri };
}
}

@@ -0,11 +1,3 @@

import { CommunicationIdentifierKind } from "./identifierModels";
/**
* An Azure Communication user.
*/
export interface CommunicationUserIdentifier {
/**
* Id of Azure Communication user.
*/
communicationUserId: string;
}
/**
* An Azure Communication chat participant.

@@ -15,8 +7,7 @@ */

/**
* The user identity of the event initiator.
* in the format `8:acs...`.
* The id of the chat participant.
*/
user: CommunicationUserIdentifier;
id: CommunicationIdentifierKind;
/**
* The display name of the event initiator.
* Display name for the chat participant.
*/

@@ -26,5 +17,5 @@ displayName: string;

* Time from which the chat history is shared with the chat participant.
* The timestamp is in ISO8601 format: `yyyy-MM-ddTHH:mm:ssZ`.
* The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`.
*/
shareHistoryTime?: string;
shareHistoryTime?: Date;
}

@@ -43,3 +34,3 @@ /**

*/
export interface BaseEvent {
export interface BaseChatEvent {
/**

@@ -52,7 +43,11 @@ * Thread Id of the event.

*/
sender: ChatParticipant;
sender: CommunicationIdentifierKind;
/**
* The display name of the event sender.
*/
senderDisplayName: string;
/**
* The Id of the event recipient.
*/
recipient: CommunicationUserIdentifier;
recipient: CommunicationIdentifierKind;
}

@@ -62,3 +57,3 @@ /**

*/
export interface ChatMessageEvent {
export interface BaseChatMessageEvent extends BaseChatEvent {
/**

@@ -69,6 +64,6 @@ * The Id of the message. This Id is server generated.

/**
* The timestamp when the message arrived at the server. The timestamp is in ISO8601 format:
* The timestamp when the message arrived at the server. The timestamp is in RFC3339 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
*/
createdOn: string;
createdOn: Date;
/**

@@ -84,3 +79,6 @@ * Version of the message. This version is an epoch time in a numeric unsigned Int64 format:

}
export interface ChatThreadEvent {
/**
* Event for chat thread operations
*/
export interface BaseChatThreadEvent {
/**

@@ -100,7 +98,7 @@ * Thread Id of the event.

*/
export interface ChatMessageReceivedEvent extends BaseEvent, ChatMessageEvent {
export interface ChatMessageReceivedEvent extends BaseChatMessageEvent {
/**
* Content of the message.
*/
content: string;
message: string;
}

@@ -111,12 +109,12 @@ /**

*/
export interface ChatMessageEditedEvent extends BaseEvent, ChatMessageEvent {
export interface ChatMessageEditedEvent extends BaseChatMessageEvent {
/**
* Content of the edited message.
*/
content: string;
message: string;
/**
* The timestamp when the message was edited. The timestamp is in ISO8601 format:
* The timestamp when the message was edited. The timestamp is in RFC3339 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
*/
editedOn: string;
editedOn: Date;
}

@@ -127,8 +125,8 @@ /**

*/
export interface ChatMessageDeletedEvent extends BaseEvent, ChatMessageEvent {
export interface ChatMessageDeletedEvent extends BaseChatMessageEvent {
/**
* The timestamp when the message was deleted. The timestamp is in ISO8601 format:
* The timestamp when the message was deleted. The timestamp is in RFC3339 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
*/
deletedOn: string;
deletedOn: Date;
}

@@ -139,3 +137,3 @@ /**

*/
export interface TypingIndicatorReceivedEvent extends BaseEvent {
export interface TypingIndicatorReceivedEvent extends BaseChatEvent {
/**

@@ -146,6 +144,6 @@ * Version of the message.

/**
* The timestamp when the message arrived at the server. The timestamp is in ISO8601 format:
* The timestamp when the message arrived at the server. The timestamp is in RFC3339 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
*/
receivedOn: string;
receivedOn: Date;
}

@@ -155,3 +153,3 @@ /**

*/
export interface ReadReceiptReceivedEvent extends BaseEvent {
export interface ReadReceiptReceivedEvent extends BaseChatEvent {
/**

@@ -162,5 +160,5 @@ * The id of the last read chat message.

/**
* The timestamp when the message was read. The timestamp is in ISO8601 format: yyyy-MM-ddTHH:mm:ssZ
* The timestamp when the message was read. The timestamp is in RFC3339 format: yyyy-MM-ddTHH:mm:ssZ
*/
readOn: string;
readOn: Date;
}

@@ -171,8 +169,8 @@ /**

*/
export interface ChatThreadCreatedEvent extends ChatThreadEvent {
export interface ChatThreadCreatedEvent extends BaseChatThreadEvent {
/**
* The timestamp when the thread was created. The timestamp is in ISO8601 format:
* The timestamp when the thread was created. The timestamp is in RFC3339 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
*/
createdOn: string;
createdOn: Date;
/**

@@ -187,3 +185,3 @@ * The properties of the thread.

/**
* The information of the user that created the chat thread.
* Id of the user that created the chat thread.
*/

@@ -196,3 +194,3 @@ createdBy: ChatParticipant;

*/
export interface ChatThreadPropertiesUpdatedEvent extends ChatThreadEvent {
export interface ChatThreadPropertiesUpdatedEvent extends BaseChatThreadEvent {
/**

@@ -203,8 +201,8 @@ * The properties of the thread.

/**
* The timestamp when the thread was updated. The timestamp is in ISO8601 format:
* The timestamp when the thread was updated. The timestamp is in RFC3339 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
*/
updatedOn: string;
updatedOn: Date;
/**
* The information of the user that updated the chat thread.
* Id of the user that updated the chat thread.
*/

@@ -217,10 +215,10 @@ updatedBy: ChatParticipant;

*/
export interface ChatThreadDeletedEvent extends ChatThreadEvent {
export interface ChatThreadDeletedEvent extends BaseChatThreadEvent {
/**
* The timestamp when the thread was deleted. The timestamp is in ISO8601 format:
* The timestamp when the thread was deleted. The timestamp is in RFC3339 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
*/
deletedOn: string;
deletedOn: Date;
/**
* The information of the user that deleted the chat thread.
* Id of the user that deleted the chat thread.
*/

@@ -233,8 +231,8 @@ deletedBy: ChatParticipant;

*/
export interface ParticipantsAddedEvent extends ChatThreadEvent {
export interface ParticipantsAddedEvent extends BaseChatThreadEvent {
/**
* The timestamp when the member was added. The timestamp is in ISO8601 format:
* The timestamp when the member was added. The timestamp is in RFC3339 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
*/
addedOn: string;
addedOn: Date;
/**

@@ -245,3 +243,3 @@ * The participants added to the thread.

/**
* The information of the user that added the chat participants.
* Id of the user that added the chat participants.
*/

@@ -254,8 +252,8 @@ addedBy: ChatParticipant;

*/
export interface ParticipantsRemovedEvent extends ChatThreadEvent {
export interface ParticipantsRemovedEvent extends BaseChatThreadEvent {
/**
* The timestamp when the member was removed. The timestamp is in ISO8601 format:
* The timestamp when the member was removed. The timestamp is in RFC3339 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
*/
removedOn: string;
removedOn: Date;
/**

@@ -266,3 +264,3 @@ * The participants removed from the thread.

/**
* The information of the user that removed the chat participants.
* Id of the user that removed the chat participants.
*/

@@ -269,0 +267,0 @@ removedBy: ChatParticipant;

@@ -1,2 +0,3 @@

import { CommunicationUserIdentifier, ChatEventId, BaseEvent, ChatMessageEvent, ChatMessageReceivedEvent, ChatMessageEditedEvent, ChatMessageDeletedEvent, ReadReceiptReceivedEvent, TypingIndicatorReceivedEvent, ChatThreadEvent, ChatParticipant, ChatThreadProperties, ChatThreadCreatedEvent, ChatThreadDeletedEvent, ChatThreadPropertiesUpdatedEvent, ParticipantsAddedEvent, ParticipantsRemovedEvent } from "./events/chat";
import { ChatEventId, BaseChatEvent, BaseChatMessageEvent, ChatMessageReceivedEvent, ChatMessageEditedEvent, ChatMessageDeletedEvent, ReadReceiptReceivedEvent, TypingIndicatorReceivedEvent, BaseChatThreadEvent, ChatParticipant, ChatThreadProperties, ChatThreadCreatedEvent, ChatThreadDeletedEvent, ChatThreadPropertiesUpdatedEvent, ParticipantsAddedEvent, ParticipantsRemovedEvent } from "./events/chat";
import { CommunicationIdentifier, CommunicationUserIdentifier, PhoneNumberIdentifier, MicrosoftTeamsUserIdentifier, UnknownIdentifier, CommunicationIdentifierKind, CommunicationUserKind, PhoneNumberKind, MicrosoftTeamsUserKind, UnknownIdentifierKind } from "./events/identifierModels";
import { AzureLogger } from "@azure/logger";

@@ -13,6 +14,9 @@ import { AbortSignalLike, AccessToken } from '@azure/core-http';

}
export { CommunicationUserIdentifier, ChatEventId, BaseEvent, ChatMessageEvent, ChatMessageReceivedEvent, ChatMessageEditedEvent, ChatMessageDeletedEvent, ReadReceiptReceivedEvent, TypingIndicatorReceivedEvent, ChatThreadEvent, ChatParticipant, ChatThreadProperties, ChatThreadCreatedEvent, ChatThreadDeletedEvent, ChatThreadPropertiesUpdatedEvent, ParticipantsAddedEvent, ParticipantsRemovedEvent };
export interface CommunicationUserCredential {
getToken(abortSignal?: AbortSignalLike): Promise<AccessToken>;
export { ChatEventId, BaseChatEvent, BaseChatMessageEvent, ChatMessageReceivedEvent, ChatMessageEditedEvent, ChatMessageDeletedEvent, ReadReceiptReceivedEvent, TypingIndicatorReceivedEvent, BaseChatThreadEvent, ChatParticipant, ChatThreadProperties, ChatThreadCreatedEvent, ChatThreadDeletedEvent, ChatThreadPropertiesUpdatedEvent, ParticipantsAddedEvent, ParticipantsRemovedEvent, CommunicationIdentifier, CommunicationUserIdentifier, PhoneNumberIdentifier, MicrosoftTeamsUserIdentifier, UnknownIdentifier, CommunicationIdentifierKind, CommunicationUserKind, PhoneNumberKind, MicrosoftTeamsUserKind, UnknownIdentifierKind };
export interface CommunicationGetTokenOptions {
abortSignal?: AbortSignalLike;
}
export interface CommunicationTokenCredential {
getToken(options?: CommunicationGetTokenOptions): Promise<AccessToken>;
}
export interface SignalingClient {

@@ -77,3 +81,3 @@ /**

private stateChangedListener;
constructor(credential: CommunicationUserCredential, logger: AzureLogger, options?: SignalingClientOptions);
constructor(credential: CommunicationTokenCredential, logger: AzureLogger, options?: SignalingClientOptions);
start(): void;

@@ -80,0 +84,0 @@ stop(): void;

@@ -8,3 +8,3 @@ import { AbortSignalLike } from '@azure/core-http';

*/
export declare interface BaseEvent {
export declare interface BaseChatEvent {
/**

@@ -17,10 +17,53 @@ * Thread Id of the event.

*/
sender: ChatParticipant;
sender: CommunicationIdentifierKind;
/**
* The display name of the event sender.
*/
senderDisplayName: string;
/**
* The Id of the event recipient.
*/
recipient: CommunicationUserIdentifier;
recipient: CommunicationIdentifierKind;
}
/**
* Event for chat message operations
*/
export declare interface BaseChatMessageEvent extends BaseChatEvent {
/**
* The Id of the message. This Id is server generated.
*/
id: string;
/**
* The timestamp when the message arrived at the server. The timestamp is in RFC3339 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
*/
createdOn: Date;
/**
* Version of the message. This version is an epoch time in a numeric unsigned Int64 format:
* `1593117207131`
*/
version: string;
/**
* Type of the chat message. Possible types are "Text" and "RichText/Html".
*/
type: string;
}
/**
* Event for chat thread operations
*/
export declare interface BaseChatThreadEvent {
/**
* Thread Id of the event.
*/
threadId: string;
/**
* Version of the thread. This version is an epoch time in a numeric unsigned Int64 format:
* `1593117207131`
*/
version: string;
}
/**
* Defines values for chat event.

@@ -34,8 +77,8 @@ */

*/
export declare interface ChatMessageDeletedEvent extends BaseEvent, ChatMessageEvent {
export declare interface ChatMessageDeletedEvent extends BaseChatMessageEvent {
/**
* The timestamp when the message was deleted. The timestamp is in ISO8601 format:
* The timestamp when the message was deleted. The timestamp is in RFC3339 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
*/
deletedOn: string;
deletedOn: Date;
}

@@ -47,47 +90,23 @@

*/
export declare interface ChatMessageEditedEvent extends BaseEvent, ChatMessageEvent {
export declare interface ChatMessageEditedEvent extends BaseChatMessageEvent {
/**
* Content of the edited message.
*/
content: string;
message: string;
/**
* The timestamp when the message was edited. The timestamp is in ISO8601 format:
* The timestamp when the message was edited. The timestamp is in RFC3339 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
*/
editedOn: string;
editedOn: Date;
}
/**
* Event for chat message operations
*/
export declare interface ChatMessageEvent {
/**
* The Id of the message. This Id is server generated.
*/
id: string;
/**
* The timestamp when the message arrived at the server. The timestamp is in ISO8601 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
*/
createdOn: string;
/**
* Version of the message. This version is an epoch time in a numeric unsigned Int64 format:
* `1593117207131`
*/
version: string;
/**
* Type of the chat message. Possible types are "Text" and "RichText/Html".
*/
type: string;
}
/**
* Event for a received chat message.
* All chat participants receive this event, including the original sender
*/
export declare interface ChatMessageReceivedEvent extends BaseEvent, ChatMessageEvent {
export declare interface ChatMessageReceivedEvent extends BaseChatMessageEvent {
/**
* Content of the message.
*/
content: string;
message: string;
}

@@ -100,8 +119,7 @@

/**
* The user identity of the event initiator.
* in the format `8:acs...`.
* The id of the chat participant.
*/
user: CommunicationUserIdentifier;
id: CommunicationIdentifierKind;
/**
* The display name of the event initiator.
* Display name for the chat participant.
*/

@@ -111,5 +129,5 @@ displayName: string;

* Time from which the chat history is shared with the chat participant.
* The timestamp is in ISO8601 format: `yyyy-MM-ddTHH:mm:ssZ`.
* The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`.
*/
shareHistoryTime?: string;
shareHistoryTime?: Date;
}

@@ -121,8 +139,8 @@

*/
export declare interface ChatThreadCreatedEvent extends ChatThreadEvent {
export declare interface ChatThreadCreatedEvent extends BaseChatThreadEvent {
/**
* The timestamp when the thread was created. The timestamp is in ISO8601 format:
* The timestamp when the thread was created. The timestamp is in RFC3339 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
*/
createdOn: string;
createdOn: Date;
/**

@@ -137,3 +155,3 @@ * The properties of the thread.

/**
* The information of the user that created the chat thread.
* Id of the user that created the chat thread.
*/

@@ -147,10 +165,10 @@ createdBy: ChatParticipant;

*/
export declare interface ChatThreadDeletedEvent extends ChatThreadEvent {
export declare interface ChatThreadDeletedEvent extends BaseChatThreadEvent {
/**
* The timestamp when the thread was deleted. The timestamp is in ISO8601 format:
* The timestamp when the thread was deleted. The timestamp is in RFC3339 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
*/
deletedOn: string;
deletedOn: Date;
/**
* The information of the user that deleted the chat thread.
* Id of the user that deleted the chat thread.
*/

@@ -160,14 +178,2 @@ deletedBy: ChatParticipant;

export declare interface ChatThreadEvent {
/**
* Thread Id of the event.
*/
threadId: string;
/**
* Version of the thread. This version is an epoch time in a numeric unsigned Int64 format:
* `1593117207131`
*/
version: string;
}
/**

@@ -187,3 +193,3 @@ * Properties of an Azure Communication chat thread.

*/
export declare interface ChatThreadPropertiesUpdatedEvent extends ChatThreadEvent {
export declare interface ChatThreadPropertiesUpdatedEvent extends BaseChatThreadEvent {
/**

@@ -194,8 +200,8 @@ * The properties of the thread.

/**
* The timestamp when the thread was updated. The timestamp is in ISO8601 format:
* The timestamp when the thread was updated. The timestamp is in RFC3339 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
*/
updatedOn: string;
updatedOn: Date;
/**
* The information of the user that updated the chat thread.
* Id of the user that updated the chat thread.
*/

@@ -205,2 +211,16 @@ updatedBy: ChatParticipant;

export declare interface CommunicationGetTokenOptions {
abortSignal?: AbortSignalLike;
}
/**
* Identifies a communication participant.
*/
export declare type CommunicationIdentifier = CommunicationUserIdentifier | PhoneNumberIdentifier | MicrosoftTeamsUserIdentifier | UnknownIdentifier;
/**
* The CommunicationIdentifierKind is a discriminated union that adds a property `kind` to an Identifier.
*/
export declare type CommunicationIdentifierKind = CommunicationUserKind | PhoneNumberKind | MicrosoftTeamsUserKind | UnknownIdentifierKind;
export declare class CommunicationSignalingClient implements SignalingClient {

@@ -211,3 +231,3 @@ private readonly logger;

private stateChangedListener;
constructor(credential: CommunicationUserCredential, logger: AzureLogger, options?: SignalingClientOptions);
constructor(credential: CommunicationTokenCredential, logger: AzureLogger, options?: SignalingClientOptions);
start(): void;

@@ -228,4 +248,4 @@ stop(): void;

export declare interface CommunicationUserCredential {
getToken(abortSignal?: AbortSignalLike): Promise<AccessToken>;
export declare interface CommunicationTokenCredential {
getToken(options?: CommunicationGetTokenOptions): Promise<AccessToken>;
}

@@ -238,3 +258,3 @@

/**
* Id of Azure Communication user.
* Id of the CommunicationUser as returned from the Communication Service.
*/

@@ -244,2 +264,12 @@ communicationUserId: string;

/**
* IdentifierKind for a CommunicationUserIdentifier.
*/
export declare interface CommunicationUserKind extends CommunicationUserIdentifier {
/**
* The identifier kind.
*/
kind: "communicationUser";
}
export declare enum ConnectionState {

@@ -253,11 +283,43 @@ Unknown = 0,

/**
* A Microsoft Teams user.
*/
export declare interface MicrosoftTeamsUserIdentifier {
/**
* Optional raw id of the Microsoft Teams user.
*/
rawId?: string;
/**
* Id of the Microsoft Teams user. If the user isn't anonymous, the id is the AAD object id of the user.
*/
microsoftTeamsUserId: string;
/**
* True if the user is anonymous, for example when joining a meeting with a share link. If missing, the user is not anonymous.
*/
isAnonymous?: boolean;
/**
* The cloud that the Microsoft Teams user belongs to. If missing, the cloud is "public".
*/
cloud?: "public" | "dod" | "gcch";
}
/**
* IdentifierKind for a MicrosoftTeamsUserIdentifier.
*/
export declare interface MicrosoftTeamsUserKind extends MicrosoftTeamsUserIdentifier {
/**
* The identifier kind.
*/
kind: "microsoftTeamsUser";
}
/**
* Event for participants added to a chat thread.
* All chat participants receive this event, including the original sender
*/
export declare interface ParticipantsAddedEvent extends ChatThreadEvent {
export declare interface ParticipantsAddedEvent extends BaseChatThreadEvent {
/**
* The timestamp when the member was added. The timestamp is in ISO8601 format:
* The timestamp when the member was added. The timestamp is in RFC3339 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
*/
addedOn: string;
addedOn: Date;
/**

@@ -268,3 +330,3 @@ * The participants added to the thread.

/**
* The information of the user that added the chat participants.
* Id of the user that added the chat participants.
*/

@@ -278,8 +340,8 @@ addedBy: ChatParticipant;

*/
export declare interface ParticipantsRemovedEvent extends ChatThreadEvent {
export declare interface ParticipantsRemovedEvent extends BaseChatThreadEvent {
/**
* The timestamp when the member was removed. The timestamp is in ISO8601 format:
* The timestamp when the member was removed. The timestamp is in RFC3339 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
*/
removedOn: string;
removedOn: Date;
/**

@@ -290,3 +352,3 @@ * The participants removed from the thread.

/**
* The information of the user that removed the chat participants.
* Id of the user that removed the chat participants.
*/

@@ -297,5 +359,29 @@ removedBy: ChatParticipant;

/**
* A phone number.
*/
export declare interface PhoneNumberIdentifier {
/**
* Optional raw id of the phone number.
*/
rawId?: string;
/**
* The phone number in E.164 format.
*/
phoneNumber: string;
}
/**
* IdentifierKind for a PhoneNumberIdentifier.
*/
export declare interface PhoneNumberKind extends PhoneNumberIdentifier {
/**
* The identifier kind.
*/
kind: "phoneNumber";
}
/**
* Event for a received read receipt
*/
export declare interface ReadReceiptReceivedEvent extends BaseEvent {
export declare interface ReadReceiptReceivedEvent extends BaseChatEvent {
/**

@@ -306,5 +392,5 @@ * The id of the last read chat message.

/**
* The timestamp when the message was read. The timestamp is in ISO8601 format: yyyy-MM-ddTHH:mm:ssZ
* The timestamp when the message was read. The timestamp is in RFC3339 format: yyyy-MM-ddTHH:mm:ssZ
*/
readOn: string;
readOn: Date;
}

@@ -375,3 +461,3 @@

*/
export declare interface TypingIndicatorReceivedEvent extends BaseEvent {
export declare interface TypingIndicatorReceivedEvent extends BaseChatEvent {
/**

@@ -382,8 +468,28 @@ * Version of the message.

/**
* The timestamp when the message arrived at the server. The timestamp is in ISO8601 format:
* The timestamp when the message arrived at the server. The timestamp is in RFC3339 format:
* `yyyy-MM-ddTHH:mm:ssZ`.
*/
receivedOn: string;
receivedOn: Date;
}
/**
* An unknown identifier that doesn't fit any of the other identifier types.
*/
export declare interface UnknownIdentifier {
/**
* Id of the UnknownIdentifier.
*/
id: string;
}
/**
* IdentifierKind for UnkownIdentifer.
*/
export declare interface UnknownIdentifierKind extends UnknownIdentifier {
/**
* The identifier kind.
*/
kind: "unknown";
}
export { }

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc