Socket
Socket
Sign inDemoInstall

@azure/communication-common

Package Overview
Dependencies
Maintainers
3
Versions
214
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@azure/communication-common - npm Package Compare versions

Comparing version 1.0.0-alpha.20210118.1 to 1.0.0-alpha.20210120.1

dist-esm/src/identifierModelSerializer.js

1

dist-esm/src/index.js

@@ -6,2 +6,3 @@ // Copyright (c) Microsoft Corporation.

export * from "./identifierModels";
export * from "./identifierModelSerializer";
//# sourceMappingURL=index.js.map

@@ -395,3 +395,73 @@ 'use strict';

// Copyright (c) Microsoft Corporation.
/**
* @internal
* Translates a CommunicationIdentifier to its serialized format for sending a request.
* @param identifier The CommunicationIdentifier to be serialized.
*/
const _serializeCommunicationIdentifier = (identifier) => {
const identifierKind = getIdentifierKind(identifier);
switch (identifierKind.kind) {
case "CommunicationUser":
return { kind: "communicationUser", id: identifierKind.communicationUserId };
case "CallingApplication":
return { kind: "callingApplication", id: identifierKind.callingApplicationId };
case "PhoneNumber":
return { kind: "phoneNumber", phoneNumber: identifierKind.phoneNumber };
case "MicrosoftTeamsUser":
return {
kind: "microsoftTeamsUser",
microsoftTeamsUserId: identifierKind.microsoftTeamsUserId,
isAnonymous: identifierKind.isAnonymous
};
case "Unknown":
return { kind: "unknown", id: identifierKind.id };
default:
throw new Error(`Can't serialize an identifier with kind ${identifierKind.kind}`);
}
};
/**
* @internal
* Translates the serialized format of a communication identifier to CommunicationIdentifier.
* @param serializedIdentifier The SerializedCommunicationIdentifier to be deserialized.
*/
const _deserializeCommunicationIdentifier = (serializedIdentifier) => {
switch (serializedIdentifier.kind) {
case "communicationUser":
return {
kind: "CommunicationUser",
communicationUserId: assertNotNullOrUndefined(serializedIdentifier, "id")
};
case "callingApplication":
return {
kind: "CallingApplication",
callingApplicationId: assertNotNullOrUndefined(serializedIdentifier, "id")
};
case "phoneNumber":
return {
kind: "PhoneNumber",
phoneNumber: assertNotNullOrUndefined(serializedIdentifier, "phoneNumber")
};
case "microsoftTeamsUser":
return {
kind: "MicrosoftTeamsUser",
microsoftTeamsUserId: assertNotNullOrUndefined(serializedIdentifier, "microsoftTeamsUserId"),
isAnonymous: assertNotNullOrUndefined(serializedIdentifier, "isAnonymous")
};
case "unknown":
return { kind: "Unknown", id: assertNotNullOrUndefined(serializedIdentifier, "id") };
default:
return { kind: "Unknown", id: assertNotNullOrUndefined(serializedIdentifier, "id") };
}
};
const assertNotNullOrUndefined = (obj, prop) => {
if (prop in obj) {
return obj[prop];
}
throw new Error(`Property ${prop} is required for identifier of kind ${obj.kind}.`);
};
exports.AzureCommunicationTokenCredential = AzureCommunicationTokenCredential;
exports._deserializeCommunicationIdentifier = _deserializeCommunicationIdentifier;
exports._serializeCommunicationIdentifier = _serializeCommunicationIdentifier;
exports.createCommunicationAccessKeyCredentialPolicy = createCommunicationAccessKeyCredentialPolicy;

@@ -398,0 +468,0 @@ exports.createCommunicationAuthPolicy = createCommunicationAuthPolicy;

2

package.json
{
"name": "@azure/communication-common",
"version": "1.0.0-alpha.20210118.1",
"version": "1.0.0-alpha.20210120.1",
"description": "Common package for Azure Communication services.",

@@ -5,0 +5,0 @@ "sdk-type": "client",

@@ -136,2 +136,4 @@ import { AbortSignalLike } from '@azure/core-http';

/* Excluded from this release type: _deserializeCommunicationIdentifier */
/**

@@ -238,2 +240,8 @@ * Returns the CommunicationIdentifierKind for a given CommunicationIdentifier. Returns undefined if the kind couldn't be inferred.

/* Excluded from this release type: _serializeCommunicationIdentifier */
/* Excluded from this release type: _SerializedCommunicationIdentifier */
/* Excluded from this release type: _SerializedCommunicationIdentifierKind */
/**

@@ -240,0 +248,0 @@ * An unknown identifier that doesn't fit any of the other identifier types.

Sorry, the diff of this file is not supported yet

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