@azure/communication-signaling
Advanced tools
Comparing version 1.0.0-beta.25 to 1.0.0-beta.26
{ | ||
"name": "@azure/communication-signaling", | ||
"version": "1.0.0-beta.25", | ||
"version": "1.0.0-beta.26", | ||
"description": "Azure Communication Signaling Client", | ||
@@ -5,0 +5,0 @@ "sdk-type": "client", |
@@ -52,3 +52,3 @@ // Copyright (c) Microsoft Corporation. | ||
export const enum ConnectionState { | ||
export enum ConnectionState { | ||
Unknown = 0, | ||
@@ -64,2 +64,3 @@ Connected = 2, | ||
resourceEndpoint?: string; | ||
gatewayApiVersion?: string; | ||
} | ||
@@ -71,4 +72,4 @@ | ||
BaseChatMessageEvent, | ||
ChatAttachment, | ||
ChatAttachmentType, | ||
ChatAttachment, | ||
ChatMessageReceivedEvent, | ||
@@ -176,2 +177,3 @@ ChatMessageEditedEvent, | ||
private resourceEndpoint: string; | ||
private gatewayApiVersion: string; | ||
@@ -188,2 +190,3 @@ constructor( | ||
this.resourceEndpoint = this.options?.resourceEndpoint || ""; | ||
this.gatewayApiVersion = this.options?.gatewayApiVersion || "2024-03-07" | ||
if (this.config === undefined) { | ||
@@ -263,4 +266,4 @@ this.config = { | ||
} | ||
this.trouter.registerMessageHandler(toMessageHandler(event, listener, this.resourceEndpoint)); | ||
this.trouter.registerMessageHandler(toMessageHandler(event, listener, this.resourceEndpoint, this.gatewayApiVersion)); | ||
} | ||
} |
@@ -79,3 +79,4 @@ // Copyright (c) Microsoft Corporation. | ||
listener: (payload: any) => any, | ||
resourceEndpoint: string | ||
resourceEndpoint: string, | ||
gatewayApiVersion: string | ||
): MessageHandler => { | ||
@@ -92,3 +93,3 @@ const eventId = eventIds.get(event); | ||
} | ||
const eventPayload = toEventPayload(event, genericPayload, resourceEndpoint); | ||
const eventPayload = toEventPayload(event, genericPayload, resourceEndpoint, gatewayApiVersion); | ||
if (eventPayload === null) { | ||
@@ -103,3 +104,3 @@ return undefined; | ||
const toEventPayload = (event: ChatEventId, genericPayload: any, resourceEndpoint: string): any => { | ||
const toEventPayload = (event: ChatEventId, genericPayload: any, resourceEndpoint: string, gatewayApiVersion: string): any => { | ||
if (event === "chatMessageReceived") { | ||
@@ -120,3 +121,4 @@ const payload = genericPayload as MessageReceivedPayload; | ||
(parseJsonString(payload.attachments) as ChatAttachment[]) || [], | ||
resourceEndpoint | ||
resourceEndpoint, | ||
gatewayApiVersion | ||
) | ||
@@ -143,3 +145,4 @@ }; | ||
(parseJsonString(payload.attachments) as ChatAttachment[]) || [], | ||
resourceEndpoint | ||
resourceEndpoint, | ||
gatewayApiVersion | ||
) | ||
@@ -395,12 +398,9 @@ }; | ||
const createMediaUrlString = (urlString: string, resourceEndpoint: string): string => { | ||
const createMediaUrlString = (urlString: string, resourceEndpoint: string, gatewayApiVersion: string): string => { | ||
let url: URL | undefined; | ||
try { | ||
url = new URL(urlString); | ||
const queryString = url.search; | ||
if (url.protocol === "http:" || url.protocol === "https:") { | ||
// If its already a full url, substitute the origin | ||
url = new URL(url.pathname, resourceEndpoint); | ||
url.search = queryString; | ||
} | ||
@@ -417,2 +417,4 @@ } catch (_) { | ||
} | ||
// Append api-version query and return string | ||
url.searchParams.set('api-version', gatewayApiVersion); | ||
return url.toString(); | ||
@@ -433,3 +435,4 @@ }; | ||
attachments: ChatAttachment[], | ||
resourceEndpoint: string | ||
resourceEndpoint: string, | ||
gatewayApiVersion: string | ||
): ChatAttachment[] => { | ||
@@ -448,6 +451,6 @@ if ( | ||
if (attachment.previewUrl) { | ||
attachment.previewUrl = createMediaUrlString(attachment.previewUrl, resourceEndpoint); | ||
attachment.previewUrl = createMediaUrlString(attachment.previewUrl, resourceEndpoint, gatewayApiVersion); | ||
} | ||
if (attachment.url) { | ||
attachment.url = createMediaUrlString(attachment.url, resourceEndpoint); | ||
attachment.url = createMediaUrlString(attachment.url, resourceEndpoint, gatewayApiVersion); | ||
} | ||
@@ -498,5 +501,3 @@ }); | ||
export function isEudbLocation(location: string): boolean { | ||
return !!location && !!EudbCountries.find((euLocation) => euLocation === location); | ||
} | ||
export const isEudbLocation = (location: string): boolean => !!location && !!EudbCountries.find((euLocation) => euLocation === location); | ||
@@ -503,0 +504,0 @@ function getCloudTypeFromSkypeId(skypeId: string): CloudType { |
@@ -5,3 +5,3 @@ import { ChatEventId, BaseChatEvent, BaseChatMessageEvent, ChatMessageReceivedEvent, ChatMessageEditedEvent, ChatMessageDeletedEvent, ReadReceiptReceivedEvent, TypingIndicatorReceivedEvent, BaseChatThreadEvent, ChatParticipant, ChatAttachment, ChatAttachmentType, ChatThreadProperties, ChatThreadCreatedEvent, ChatThreadDeletedEvent, ChatThreadPropertiesUpdatedEvent, ParticipantsAddedEvent, ParticipantsRemovedEvent } from "./events/chat"; | ||
import { AbortSignalLike, AccessToken } from "@azure/core-http"; | ||
export declare const enum ConnectionState { | ||
export declare enum ConnectionState { | ||
Unknown = 0, | ||
@@ -16,4 +16,5 @@ Connected = 2, | ||
resourceEndpoint?: string; | ||
gatewayApiVersion?: string; | ||
} | ||
export { ChatEventId, BaseChatEvent, BaseChatMessageEvent, ChatAttachmentType, ChatAttachment, ChatMessageReceivedEvent, ChatMessageEditedEvent, ChatMessageDeletedEvent, ReadReceiptReceivedEvent, TypingIndicatorReceivedEvent, BaseChatThreadEvent, ChatParticipant, ChatThreadProperties, ChatThreadCreatedEvent, ChatThreadDeletedEvent, ChatThreadPropertiesUpdatedEvent, ParticipantsAddedEvent, ParticipantsRemovedEvent, CommunicationIdentifier, CommunicationUserIdentifier, PhoneNumberIdentifier, MicrosoftTeamsUserIdentifier, UnknownIdentifier, CommunicationIdentifierKind, CommunicationUserKind, PhoneNumberKind, MicrosoftTeamsUserKind, MicrosoftTeamsAppKind, MicrosoftTeamsAppIdentifier, UnknownIdentifierKind }; | ||
export { ChatEventId, BaseChatEvent, BaseChatMessageEvent, ChatAttachment, ChatAttachmentType, ChatMessageReceivedEvent, ChatMessageEditedEvent, ChatMessageDeletedEvent, ReadReceiptReceivedEvent, TypingIndicatorReceivedEvent, BaseChatThreadEvent, ChatParticipant, ChatThreadProperties, ChatThreadCreatedEvent, ChatThreadDeletedEvent, ChatThreadPropertiesUpdatedEvent, ParticipantsAddedEvent, ParticipantsRemovedEvent, CommunicationIdentifier, CommunicationUserIdentifier, PhoneNumberIdentifier, MicrosoftTeamsUserIdentifier, UnknownIdentifier, CommunicationIdentifierKind, CommunicationUserKind, PhoneNumberKind, MicrosoftTeamsUserKind, MicrosoftTeamsAppKind, MicrosoftTeamsAppIdentifier, UnknownIdentifierKind }; | ||
export interface CommunicationGetTokenOptions { | ||
@@ -88,2 +89,3 @@ abortSignal?: AbortSignalLike; | ||
private resourceEndpoint; | ||
private gatewayApiVersion; | ||
constructor(credential: CommunicationTokenCredential, logger: AzureLogger, options?: SignalingClientOptions); | ||
@@ -90,0 +92,0 @@ start(): Promise<void>; |
@@ -6,3 +6,3 @@ import { MessageHandler, LogProvider, ITelemetrySender } from "@skype/tstrouter"; | ||
import { CloudType } from "./constants"; | ||
export declare const toMessageHandler: (event: ChatEventId, listener: (payload: any) => any, resourceEndpoint: string) => MessageHandler; | ||
export declare const toMessageHandler: (event: ChatEventId, listener: (payload: any) => any, resourceEndpoint: string, gatewayApiVersion: string) => MessageHandler; | ||
export declare const toLogProvider: (logger: AzureLogger) => LogProvider; | ||
@@ -19,2 +19,2 @@ export declare const toTelemetrySender: (logger: AzureLogger) => ITelemetrySender; | ||
}; | ||
export declare function isEudbLocation(location: string): boolean; | ||
export declare const isEudbLocation: (location: string) => boolean; |
@@ -243,2 +243,3 @@ import { AbortSignalLike } from '@azure/core-http'; | ||
private resourceEndpoint; | ||
private gatewayApiVersion; | ||
constructor(credential: CommunicationTokenCredential, logger: AzureLogger, options?: SignalingClientOptions); | ||
@@ -284,3 +285,3 @@ start(): Promise<void>; | ||
export declare const enum ConnectionState { | ||
export declare enum ConnectionState { | ||
Unknown = 0, | ||
@@ -489,2 +490,3 @@ Connected = 2, | ||
resourceEndpoint?: string; | ||
gatewayApiVersion?: string; | ||
} | ||
@@ -491,0 +493,0 @@ |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3145505
12248