@azure/communication-signaling
Advanced tools
Comparing version 1.0.0-beta.19 to 1.0.0-beta.20
{ | ||
"name": "@azure/communication-signaling", | ||
"version": "1.0.0-beta.19", | ||
"version": "1.0.0-beta.20", | ||
"description": "Azure Communication Signaling Client", | ||
@@ -5,0 +5,0 @@ "sdk-type": "client", |
@@ -91,13 +91,2 @@ # Azure Communication Signaling client library for JavaScript | ||
### Signaling Client Options | ||
```js | ||
export interface SignalingClientOptions { | ||
environment?: string; | ||
resourceEndpoint?: string; | ||
} | ||
``` | ||
To support the inline image sent from Teams user in a Teams interoperability chat, please pass in your Azure communication `resourceEndpoint` (such as "https://xxxxxxx.communication.azure.net/") | ||
[azure_cli]: https://docs.microsoft.com/cli/azure | ||
@@ -104,0 +93,0 @@ [azure_sub]: https://azure.microsoft.com/free/ |
@@ -24,6 +24,9 @@ // Copyright (c) Microsoft Corporation. | ||
// EUDB URLs | ||
export const EUDB_TROUTER_SERVICE_URL = "https://go-eu.trouter.teams.microsoft.com/v4/a"; | ||
// Public URLs | ||
export const PUBLIC_TROUTER_SERVICE_URL = "https://go.trouter.skype.com/v4/a"; | ||
export const PUBLIC_TROUTER_SERVICE_URL = "https://go.trouter.teams.microsoft.com/v4/a"; | ||
export const PUBLIC_REGISTRAR_SERVICE_URL = | ||
"https://edge.skype.com/registrar/prod/v3/registrations"; | ||
"https://teams.microsoft.com/registrar/prod/v3/registrations"; | ||
@@ -46,1 +49,3 @@ // Gov cloud types | ||
} | ||
export const EudbCountries = ["europe", "france", "germany", "norway", "switzerland", "sweden"]; |
@@ -25,7 +25,2 @@ // Copyright (c) Microsoft Corporation. | ||
shareHistoryTime?: Date; | ||
/** | ||
* Metadata of the participant. | ||
*/ | ||
metadata: Record<string, string>; | ||
} | ||
@@ -41,7 +36,2 @@ | ||
topic: string; | ||
/** | ||
* Metadata of the thread. | ||
*/ | ||
metadata: Record<string, string>; | ||
} | ||
@@ -48,0 +38,0 @@ |
@@ -66,10 +66,4 @@ // Copyright (c) Microsoft Corporation. | ||
shareHistoryTime?: string; | ||
memberMetaData?: string; | ||
} | ||
export interface ChatThreadPropertiesPayload { | ||
topic: string; | ||
acsChatThreadMetadata?: string; | ||
} | ||
export interface ChatThreadCreatedPayload extends ChatThreadPayload { | ||
@@ -76,0 +70,0 @@ createTime: string; |
@@ -6,3 +6,3 @@ // Copyright (c) Microsoft Corporation. | ||
import { CommunicationTokenCredential, SignalingClientOptions } from "./SignalingClient"; | ||
import { parseTokenCredential } from "./TrouterUtils"; | ||
import { isEudbLocation, parseTokenCredential } from "./TrouterUtils"; | ||
import { | ||
@@ -18,3 +18,4 @@ PUBLIC_TROUTER_SERVICE_URL, | ||
CloudType, | ||
GCC_TROUTER_SERVICE_URL | ||
GCC_TROUTER_SERVICE_URL, | ||
EUDB_TROUTER_SERVICE_URL | ||
} from "./constants"; | ||
@@ -87,2 +88,10 @@ | ||
const createEudbSettings = (): TrouterSettings => { | ||
const settings = createDefaultSettings(); | ||
settings.registrarServiceUrl = PUBLIC_REGISTRAR_SERVICE_URL; | ||
settings.trouterServiceUrl = EUDB_TROUTER_SERVICE_URL; | ||
return settings; | ||
}; | ||
export const createSettings = async ( | ||
@@ -104,2 +113,7 @@ credential: CommunicationTokenCredential, | ||
settings = createGccSettings(); | ||
} else if ( | ||
parsedTokenCredential.cloudType === CloudType.Public && | ||
isEudbLocation(parsedTokenCredential.resourceLocation) | ||
) { | ||
settings = createEudbSettings(); | ||
} else { | ||
@@ -106,0 +120,0 @@ settings = createDefaultSettings(); |
@@ -26,4 +26,3 @@ // Copyright (c) Microsoft Corporation. | ||
ChatParticipantPayload, | ||
ChatAttachment, | ||
ChatThreadPropertiesPayload | ||
ChatAttachment | ||
} from "./TrouterNotificationPayload"; | ||
@@ -53,3 +52,3 @@ import { | ||
import { isNode } from "@azure/core-http"; | ||
import { CloudPrefix, CloudType } from "./constants"; | ||
import { CloudPrefix, CloudType, EudbCountries } from "./constants"; | ||
@@ -196,5 +195,12 @@ const eventIds = new Map<ChatEventId, number>([ | ||
const membersPayload = JSON.parse(unescape(payload.members)) as ChatParticipantPayload[]; | ||
const createdBy = toChatParticipant(createdByPayload); | ||
const propertiesPayload = JSON.parse(unescape(payload.properties)) as ChatThreadProperties; | ||
const createdBy: ChatParticipant = { | ||
id: constructIdentifierKindFromMri(createdByPayload.participantId), | ||
displayName: createdByPayload.displayName | ||
}; | ||
const chatParticipants: ChatParticipant[] = membersPayload.map((m) => { | ||
return toChatParticipant(m); | ||
return { | ||
id: constructIdentifierKindFromMri(m.participantId), | ||
displayName: m.displayName | ||
}; | ||
}); | ||
@@ -207,5 +213,3 @@ const eventPayload: ChatThreadCreatedEvent = { | ||
participants: chatParticipants, | ||
properties: toThreadProperties( | ||
JSON.parse(unescape(payload.properties)) as ChatThreadPropertiesPayload | ||
) | ||
properties: propertiesPayload | ||
}; | ||
@@ -218,3 +222,7 @@ return eventPayload; | ||
const updatedByPayload = JSON.parse(unescape(payload.editedBy)) as ChatParticipantPayload; | ||
const updatedBy = toChatParticipant(updatedByPayload); | ||
const propertiesPayload = JSON.parse(unescape(payload.properties)) as ChatThreadProperties; | ||
const updatedBy: ChatParticipant = { | ||
id: constructIdentifierKindFromMri(updatedByPayload.participantId), | ||
displayName: updatedByPayload.displayName | ||
}; | ||
const eventPayload: ChatThreadPropertiesUpdatedEvent = { | ||
@@ -225,5 +233,3 @@ threadId: payload.threadId, | ||
version: payload.version, | ||
properties: toThreadProperties( | ||
JSON.parse(unescape(payload.properties)) as ChatThreadPropertiesPayload | ||
) | ||
properties: propertiesPayload | ||
}; | ||
@@ -235,5 +241,7 @@ return eventPayload; | ||
const payload = genericPayload as ChatThreadDeletedPayload; | ||
const deletedBy = toChatParticipant( | ||
JSON.parse(unescape(payload.deletedBy)) as ChatParticipantPayload | ||
); | ||
const deletedByPayload = JSON.parse(unescape(payload.deletedBy)) as ChatParticipantPayload; | ||
const deletedBy: ChatParticipant = { | ||
id: constructIdentifierKindFromMri(deletedByPayload.participantId), | ||
displayName: deletedByPayload.displayName | ||
}; | ||
const eventPayload: ChatThreadDeletedEvent = { | ||
@@ -254,5 +262,12 @@ threadId: payload.threadId, | ||
) as ChatParticipantPayload[]; | ||
const addedBy = toChatParticipant(addedByPayload); | ||
const addedBy: ChatParticipant = { | ||
id: constructIdentifierKindFromMri(addedByPayload.participantId), | ||
displayName: addedByPayload.displayName | ||
}; | ||
const chatParticipants: ChatParticipant[] = participantsAddedPayload.map((m) => { | ||
return toChatParticipant(m); | ||
return { | ||
id: constructIdentifierKindFromMri(m.participantId), | ||
displayName: m.displayName, | ||
shareHistoryTime: new Date(m.shareHistoryTime) | ||
}; | ||
}); | ||
@@ -275,5 +290,12 @@ const eventPayload: ParticipantsAddedEvent = { | ||
) as ChatParticipantPayload[]; | ||
const removedBy = toChatParticipant(removedByPayload); | ||
const removedBy: ChatParticipant = { | ||
id: constructIdentifierKindFromMri(removedByPayload.participantId), | ||
displayName: removedByPayload.displayName | ||
}; | ||
const chatParticipants: ChatParticipant[] = participantsRemovedPayload.map((m) => { | ||
return toChatParticipant(m); | ||
return { | ||
id: constructIdentifierKindFromMri(m.participantId), | ||
displayName: m.displayName, | ||
shareHistoryTime: new Date(m.shareHistoryTime) | ||
}; | ||
}); | ||
@@ -293,23 +315,2 @@ const eventPayload: ParticipantsRemovedEvent = { | ||
const toChatParticipant = (payload: ChatParticipantPayload): ChatParticipant => { | ||
const participant: ChatParticipant = { | ||
id: constructIdentifierKindFromMri(payload.participantId), | ||
displayName: payload.displayName, | ||
metadata: (parseJsonString(payload.memberMetaData ?? "") as Record<string, string>) || {} | ||
}; | ||
if (payload.shareHistoryTime) { | ||
participant.shareHistoryTime = new Date(payload.shareHistoryTime); | ||
} | ||
return participant; | ||
}; | ||
const toThreadProperties = (payload: ChatThreadPropertiesPayload): ChatThreadProperties => { | ||
return { | ||
topic: payload.topic, | ||
metadata: (parseJsonString(payload.acsChatThreadMetadata ?? "") as Record<string, string>) || {} | ||
}; | ||
}; | ||
export const toLogProvider = (logger: AzureLogger): LogProvider => { | ||
@@ -482,2 +483,6 @@ return { | ||
export function isEudbLocation(location: string): boolean { | ||
return !!location && !!EudbCountries.find((euLocation) => euLocation === location); | ||
} | ||
function getCloudTypeFromSkypeId(skypeId: string): CloudType { | ||
@@ -484,0 +489,0 @@ const cloudPrefix = skypeId.substring(0, skypeId.indexOf(":")); |
@@ -9,4 +9,5 @@ export declare const MAX_NUMBER_OF_TOKEN_FETCH_RETRIES = 3; | ||
export declare const INT_REGISTRAR_SERVICE_URL = "https://edge.skype.net/registrar/testenv/v3/registrations"; | ||
export declare const PUBLIC_TROUTER_SERVICE_URL = "https://go.trouter.skype.com/v4/a"; | ||
export declare const PUBLIC_REGISTRAR_SERVICE_URL = "https://edge.skype.com/registrar/prod/v3/registrations"; | ||
export declare const EUDB_TROUTER_SERVICE_URL = "https://go-eu.trouter.teams.microsoft.com/v4/a"; | ||
export declare const PUBLIC_TROUTER_SERVICE_URL = "https://go.trouter.teams.microsoft.com/v4/a"; | ||
export declare const PUBLIC_REGISTRAR_SERVICE_URL = "https://teams.microsoft.com/registrar/prod/v3/registrations"; | ||
export declare enum CloudType { | ||
@@ -26,1 +27,2 @@ Public = "Public", | ||
} | ||
export declare const EudbCountries: string[]; |
@@ -19,6 +19,2 @@ import { CommunicationIdentifierKind } from "./identifierModels"; | ||
shareHistoryTime?: Date; | ||
/** | ||
* Metadata of the participant. | ||
*/ | ||
metadata: Record<string, string>; | ||
} | ||
@@ -33,6 +29,2 @@ /** | ||
topic: string; | ||
/** | ||
* Metadata of the thread. | ||
*/ | ||
metadata: Record<string, string>; | ||
} | ||
@@ -39,0 +31,0 @@ /** |
@@ -55,8 +55,3 @@ export interface BasePayload { | ||
shareHistoryTime?: string; | ||
memberMetaData?: string; | ||
} | ||
export interface ChatThreadPropertiesPayload { | ||
topic: string; | ||
acsChatThreadMetadata?: string; | ||
} | ||
export interface ChatThreadCreatedPayload extends ChatThreadPayload { | ||
@@ -63,0 +58,0 @@ createTime: string; |
@@ -18,1 +18,2 @@ import { MessageHandler, LogProvider, ITelemetrySender } from "@skype/tstrouter"; | ||
}; | ||
export declare function isEudbLocation(location: string): boolean; |
@@ -152,6 +152,2 @@ import { AbortSignalLike } from '@azure/core-http'; | ||
shareHistoryTime?: Date; | ||
/** | ||
* Metadata of the participant. | ||
*/ | ||
metadata: Record<string, string>; | ||
} | ||
@@ -207,6 +203,2 @@ | ||
topic: string; | ||
/** | ||
* Metadata of the thread. | ||
*/ | ||
metadata: Record<string, string>; | ||
} | ||
@@ -213,0 +205,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
12105
3128694
95