@azure/communication-common
Advanced tools
Comparing version 1.0.0-alpha.20210121.1 to 1.0.0-alpha.20210122.1
@@ -8,5 +8,7 @@ # Release History | ||
- Added `MicrosoftTeamsUserIdentifier` and `isMicrosoftTeamsUserIdentifier`. | ||
- Added optional `id` property to communication identifiers. | ||
### Breaking Changes | ||
- Changed identifier `kind` property to use lowerCamelCase. | ||
- Renamed `CommunicationUserCredential` to `CommunicationTokenCredential`. | ||
@@ -13,0 +15,0 @@ - Renamed `RefreshOptions` to `CommunicationTokenRefreshOptions`. |
@@ -50,15 +50,15 @@ // Copyright (c) Microsoft Corporation. | ||
if (isCommunicationUserIdentifier(identifier)) { | ||
return Object.assign(Object.assign({}, identifier), { kind: "CommunicationUser" }); | ||
return Object.assign(Object.assign({}, identifier), { kind: "communicationUser" }); | ||
} | ||
if (isPhoneNumberIdentifier(identifier)) { | ||
return Object.assign(Object.assign({}, identifier), { kind: "PhoneNumber" }); | ||
return Object.assign(Object.assign({}, identifier), { kind: "phoneNumber" }); | ||
} | ||
if (isCallingApplicationIdentifier(identifier)) { | ||
return Object.assign(Object.assign({}, identifier), { kind: "CallingApplication" }); | ||
return Object.assign(Object.assign({}, identifier), { kind: "callingApplication" }); | ||
} | ||
if (isMicrosoftTeamsUserIdentifier(identifier)) { | ||
return Object.assign(Object.assign({}, identifier), { kind: "MicrosoftTeamsUser" }); | ||
return Object.assign(Object.assign({}, identifier), { kind: "microsoftTeamsUser" }); | ||
} | ||
return Object.assign(Object.assign({}, identifier), { kind: "Unknown" }); | ||
return Object.assign(Object.assign({}, identifier), { kind: "unknown" }); | ||
}; | ||
//# sourceMappingURL=identifierModels.js.map |
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
import { getIdentifierKind } from "./identifierModels"; | ||
const addIdIfExisting = (identifier, id) => { | ||
return id === undefined ? identifier : Object.assign(Object.assign({}, identifier), { id }); | ||
}; | ||
/** | ||
@@ -10,17 +13,19 @@ * @internal | ||
export const _serializeCommunicationIdentifier = (identifier) => { | ||
var _a, _b; | ||
const identifierKind = getIdentifierKind(identifier); | ||
switch (identifierKind.kind) { | ||
case "CommunicationUser": | ||
case "communicationUser": | ||
return { kind: "communicationUser", id: identifierKind.communicationUserId }; | ||
case "CallingApplication": | ||
case "callingApplication": | ||
return { kind: "callingApplication", id: identifierKind.callingApplicationId }; | ||
case "PhoneNumber": | ||
return { kind: "phoneNumber", phoneNumber: identifierKind.phoneNumber }; | ||
case "MicrosoftTeamsUser": | ||
return { | ||
case "phoneNumber": | ||
return addIdIfExisting({ kind: "phoneNumber", phoneNumber: identifierKind.phoneNumber }, identifierKind.id); | ||
case "microsoftTeamsUser": | ||
return addIdIfExisting({ | ||
kind: "microsoftTeamsUser", | ||
microsoftTeamsUserId: identifierKind.microsoftTeamsUserId, | ||
isAnonymous: identifierKind.isAnonymous | ||
}; | ||
case "Unknown": | ||
isAnonymous: (_a = identifierKind.isAnonymous) !== null && _a !== void 0 ? _a : false, | ||
cloud: (_b = identifierKind.cloud) !== null && _b !== void 0 ? _b : "public" | ||
}, identifierKind.id); | ||
case "unknown": | ||
return { kind: "unknown", id: identifierKind.id }; | ||
@@ -40,25 +45,30 @@ default: | ||
return { | ||
kind: "CommunicationUser", | ||
communicationUserId: assertNotNullOrUndefined(serializedIdentifier, "id") | ||
kind: "communicationUser", | ||
communicationUserId: assertNotNullOrUndefined(serializedIdentifier, "id"), | ||
id: assertNotNullOrUndefined(serializedIdentifier, "id") | ||
}; | ||
case "callingApplication": | ||
return { | ||
kind: "CallingApplication", | ||
callingApplicationId: assertNotNullOrUndefined(serializedIdentifier, "id") | ||
kind: "callingApplication", | ||
callingApplicationId: assertNotNullOrUndefined(serializedIdentifier, "id"), | ||
id: assertNotNullOrUndefined(serializedIdentifier, "id") | ||
}; | ||
case "phoneNumber": | ||
return { | ||
kind: "PhoneNumber", | ||
phoneNumber: assertNotNullOrUndefined(serializedIdentifier, "phoneNumber") | ||
kind: "phoneNumber", | ||
phoneNumber: assertNotNullOrUndefined(serializedIdentifier, "phoneNumber"), | ||
id: assertNotNullOrUndefined(serializedIdentifier, "id") | ||
}; | ||
case "microsoftTeamsUser": | ||
return { | ||
kind: "MicrosoftTeamsUser", | ||
kind: "microsoftTeamsUser", | ||
microsoftTeamsUserId: assertNotNullOrUndefined(serializedIdentifier, "microsoftTeamsUserId"), | ||
isAnonymous: assertNotNullOrUndefined(serializedIdentifier, "isAnonymous") | ||
isAnonymous: assertNotNullOrUndefined(serializedIdentifier, "isAnonymous"), | ||
cloud: assertNotNullOrUndefined(serializedIdentifier, "cloud"), | ||
id: assertNotNullOrUndefined(serializedIdentifier, "id") | ||
}; | ||
case "unknown": | ||
return { kind: "Unknown", id: assertNotNullOrUndefined(serializedIdentifier, "id") }; | ||
return { kind: "unknown", id: assertNotNullOrUndefined(serializedIdentifier, "id") }; | ||
default: | ||
return { kind: "Unknown", id: assertNotNullOrUndefined(serializedIdentifier, "id") }; | ||
return { kind: "unknown", id: assertNotNullOrUndefined(serializedIdentifier, "id") }; | ||
} | ||
@@ -65,0 +75,0 @@ }; |
@@ -387,17 +387,20 @@ 'use strict'; | ||
if (isCommunicationUserIdentifier(identifier)) { | ||
return Object.assign(Object.assign({}, identifier), { kind: "CommunicationUser" }); | ||
return Object.assign(Object.assign({}, identifier), { kind: "communicationUser" }); | ||
} | ||
if (isPhoneNumberIdentifier(identifier)) { | ||
return Object.assign(Object.assign({}, identifier), { kind: "PhoneNumber" }); | ||
return Object.assign(Object.assign({}, identifier), { kind: "phoneNumber" }); | ||
} | ||
if (isCallingApplicationIdentifier(identifier)) { | ||
return Object.assign(Object.assign({}, identifier), { kind: "CallingApplication" }); | ||
return Object.assign(Object.assign({}, identifier), { kind: "callingApplication" }); | ||
} | ||
if (isMicrosoftTeamsUserIdentifier(identifier)) { | ||
return Object.assign(Object.assign({}, identifier), { kind: "MicrosoftTeamsUser" }); | ||
return Object.assign(Object.assign({}, identifier), { kind: "microsoftTeamsUser" }); | ||
} | ||
return Object.assign(Object.assign({}, identifier), { kind: "Unknown" }); | ||
return Object.assign(Object.assign({}, identifier), { kind: "unknown" }); | ||
}; | ||
// Copyright (c) Microsoft Corporation. | ||
const addIdIfExisting = (identifier, id) => { | ||
return id === undefined ? identifier : Object.assign(Object.assign({}, identifier), { id }); | ||
}; | ||
/** | ||
@@ -409,17 +412,19 @@ * @internal | ||
const _serializeCommunicationIdentifier = (identifier) => { | ||
var _a, _b; | ||
const identifierKind = getIdentifierKind(identifier); | ||
switch (identifierKind.kind) { | ||
case "CommunicationUser": | ||
case "communicationUser": | ||
return { kind: "communicationUser", id: identifierKind.communicationUserId }; | ||
case "CallingApplication": | ||
case "callingApplication": | ||
return { kind: "callingApplication", id: identifierKind.callingApplicationId }; | ||
case "PhoneNumber": | ||
return { kind: "phoneNumber", phoneNumber: identifierKind.phoneNumber }; | ||
case "MicrosoftTeamsUser": | ||
return { | ||
case "phoneNumber": | ||
return addIdIfExisting({ kind: "phoneNumber", phoneNumber: identifierKind.phoneNumber }, identifierKind.id); | ||
case "microsoftTeamsUser": | ||
return addIdIfExisting({ | ||
kind: "microsoftTeamsUser", | ||
microsoftTeamsUserId: identifierKind.microsoftTeamsUserId, | ||
isAnonymous: identifierKind.isAnonymous | ||
}; | ||
case "Unknown": | ||
isAnonymous: (_a = identifierKind.isAnonymous) !== null && _a !== void 0 ? _a : false, | ||
cloud: (_b = identifierKind.cloud) !== null && _b !== void 0 ? _b : "public" | ||
}, identifierKind.id); | ||
case "unknown": | ||
return { kind: "unknown", id: identifierKind.id }; | ||
@@ -439,25 +444,30 @@ default: | ||
return { | ||
kind: "CommunicationUser", | ||
communicationUserId: assertNotNullOrUndefined(serializedIdentifier, "id") | ||
kind: "communicationUser", | ||
communicationUserId: assertNotNullOrUndefined(serializedIdentifier, "id"), | ||
id: assertNotNullOrUndefined(serializedIdentifier, "id") | ||
}; | ||
case "callingApplication": | ||
return { | ||
kind: "CallingApplication", | ||
callingApplicationId: assertNotNullOrUndefined(serializedIdentifier, "id") | ||
kind: "callingApplication", | ||
callingApplicationId: assertNotNullOrUndefined(serializedIdentifier, "id"), | ||
id: assertNotNullOrUndefined(serializedIdentifier, "id") | ||
}; | ||
case "phoneNumber": | ||
return { | ||
kind: "PhoneNumber", | ||
phoneNumber: assertNotNullOrUndefined(serializedIdentifier, "phoneNumber") | ||
kind: "phoneNumber", | ||
phoneNumber: assertNotNullOrUndefined(serializedIdentifier, "phoneNumber"), | ||
id: assertNotNullOrUndefined(serializedIdentifier, "id") | ||
}; | ||
case "microsoftTeamsUser": | ||
return { | ||
kind: "MicrosoftTeamsUser", | ||
kind: "microsoftTeamsUser", | ||
microsoftTeamsUserId: assertNotNullOrUndefined(serializedIdentifier, "microsoftTeamsUserId"), | ||
isAnonymous: assertNotNullOrUndefined(serializedIdentifier, "isAnonymous") | ||
isAnonymous: assertNotNullOrUndefined(serializedIdentifier, "isAnonymous"), | ||
cloud: assertNotNullOrUndefined(serializedIdentifier, "cloud"), | ||
id: assertNotNullOrUndefined(serializedIdentifier, "id") | ||
}; | ||
case "unknown": | ||
return { kind: "Unknown", id: assertNotNullOrUndefined(serializedIdentifier, "id") }; | ||
return { kind: "unknown", id: assertNotNullOrUndefined(serializedIdentifier, "id") }; | ||
default: | ||
return { kind: "Unknown", id: assertNotNullOrUndefined(serializedIdentifier, "id") }; | ||
return { kind: "unknown", id: assertNotNullOrUndefined(serializedIdentifier, "id") }; | ||
} | ||
@@ -464,0 +474,0 @@ }; |
{ | ||
"name": "@azure/communication-common", | ||
"version": "1.0.0-alpha.20210121.1", | ||
"version": "1.0.0-alpha.20210122.1", | ||
"description": "Common package for Azure Communication services.", | ||
@@ -5,0 +5,0 @@ "sdk-type": "client", |
@@ -39,3 +39,3 @@ import { AbortSignalLike } from '@azure/core-http'; | ||
*/ | ||
export declare interface CallingApplicationIdentifier { | ||
export declare interface CallingApplicationIdentifier extends WithOptionalFullId { | ||
/** | ||
@@ -54,3 +54,3 @@ * Id of the CallingApplication. | ||
*/ | ||
kind: "CallingApplication"; | ||
kind: "callingApplication"; | ||
} | ||
@@ -105,3 +105,3 @@ | ||
*/ | ||
export declare interface CommunicationUserIdentifier { | ||
export declare interface CommunicationUserIdentifier extends WithOptionalFullId { | ||
/** | ||
@@ -120,3 +120,3 @@ * Id of the CommunicationUser as returned from the Communication Service. | ||
*/ | ||
kind: "CommunicationUser"; | ||
kind: "communicationUser"; | ||
} | ||
@@ -209,3 +209,3 @@ | ||
*/ | ||
export declare interface MicrosoftTeamsUserIdentifier { | ||
export declare interface MicrosoftTeamsUserIdentifier extends WithOptionalFullId { | ||
/** | ||
@@ -216,5 +216,9 @@ * Id of the Microsoft Teams user. If the user isn't anonymous, the id is the AAD object id of the user. | ||
/** | ||
* True if the user is anonymous, for example when joining a meeting with a share link. | ||
* 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 | undefined; | ||
isAnonymous?: boolean; | ||
/** | ||
* The cloud that the Microsoft Teams user belongs to. If missing, the cloud is "public". | ||
*/ | ||
cloud?: "public" | "dod" | "gcch"; | ||
} | ||
@@ -229,3 +233,3 @@ | ||
*/ | ||
kind: "MicrosoftTeamsUser"; | ||
kind: "microsoftTeamsUser"; | ||
} | ||
@@ -252,3 +256,3 @@ | ||
*/ | ||
export declare interface PhoneNumberIdentifier { | ||
export declare interface PhoneNumberIdentifier extends WithOptionalFullId { | ||
/** | ||
@@ -267,3 +271,3 @@ * The phone number in E.164 format. | ||
*/ | ||
kind: "PhoneNumber"; | ||
kind: "phoneNumber"; | ||
} | ||
@@ -273,2 +277,4 @@ | ||
/* Excluded from this release type: _SerializedCommunicationCloudEnvironment */ | ||
/* Excluded from this release type: _SerializedCommunicationIdentifier */ | ||
@@ -295,3 +301,3 @@ | ||
*/ | ||
kind: "Unknown"; | ||
kind: "unknown"; | ||
} | ||
@@ -307,2 +313,9 @@ | ||
export declare interface WithOptionalFullId { | ||
/** | ||
* Optional full id of the identifier. | ||
*/ | ||
id?: string; | ||
} | ||
export { } |
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 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
148680
1302