Socket
Socket
Sign inDemoInstall

@azure/communication-signaling

Package Overview
Dependencies
Maintainers
1
Versions
28
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.17 to 1.0.0-beta.18

4

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

@@ -77,3 +77,3 @@ "sdk-type": "client",

"@types/mocha": "^9.0.0",
"@types/node": "^12.12.30",
"@types/node": "^14.18.36",
"@types/sinon": "^7.5.1",

@@ -80,0 +80,0 @@ "@typescript-eslint/eslint-plugin": "^2.0.0",

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

/** The type of attachment. */
attachmentType: "teamsInlineImage"
attachmentType: AttachmentType;
/** The type of content of the attachment, if available */

@@ -56,2 +56,5 @@ contentType?: string;

/** Type of Supported Attachments. */
export type AttachmentType = "teamsInlineImage" | "teamsImage" | "file";
/**

@@ -58,0 +61,0 @@ * Base class for chat event

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

ChatParticipant,
AttachmentType,
ChatAttachment,

@@ -67,2 +68,3 @@ ChatThreadProperties,

BaseChatMessageEvent,
AttachmentType,
ChatAttachment,

@@ -189,5 +191,3 @@ ChatMessageReceivedEvent,

throw new Error(
`Access token is expired and failed to fetch a valid one after ${
MAX_NUMBER_OF_TOKEN_FETCH_RETRIES
} retries`
`Access token is expired and failed to fetch a valid one after ${MAX_NUMBER_OF_TOKEN_FETCH_RETRIES} retries`
);

@@ -194,0 +194,0 @@ }

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

id: string;
attachmentType: "teamsInlineImage";
attachmentType: AttachmentType;
contentType?: string;

@@ -107,1 +107,3 @@ name?: string;

}
export type AttachmentType = "teamsInlineImage" | "teamsImage" | "file";

@@ -114,4 +114,7 @@ // Copyright (c) Microsoft Corporation.

message: payload.messageBody,
metadata: parseJsonString(payload.acsChatMessageMetadata) as Record<string, string> || {},
attachments: transformEndpoint(parseJsonString(payload.attachments) as ChatAttachment[] || [], resourceEndpoint)
metadata: (parseJsonString(payload.acsChatMessageMetadata) as Record<string, string>) || {},
attachments: transformEndpoint(
(parseJsonString(payload.attachments) as ChatAttachment[]) || [],
resourceEndpoint
)
};

@@ -134,4 +137,7 @@ return eventPayload;

type: payload.messageType,
metadata: parseJsonString(payload.acsChatMessageMetadata) as Record<string, string> || {},
attachments: transformEndpoint(parseJsonString(payload.attachments) as ChatAttachment[] || [], resourceEndpoint)
metadata: (parseJsonString(payload.acsChatMessageMetadata) as Record<string, string>) || {},
attachments: transformEndpoint(
(parseJsonString(payload.attachments) as ChatAttachment[]) || [],
resourceEndpoint
)
};

@@ -371,7 +377,14 @@ return eventPayload;

const parseJsonString = (str: string): any => {
if (str === undefined || str === null || str === "" || str === "null" || str === "{}" || str === "[]") {
if (
str === undefined ||
str === null ||
str === "" ||
str === "null" ||
str === "{}" ||
str === "[]"
) {
return undefined;
}
return JSON.parse(str);
}
};

@@ -382,5 +395,4 @@ const replaceEndpoint = (url: string, resourceEndpoint: string): string => {

return url.replace(urlOrigin, resourceEndpointOrigin);
}
};
const isValidURL = (str: string): boolean => {

@@ -394,26 +406,35 @@ let url;

return url.protocol === "http:" || url.protocol === "https:";
}
};
const transformEndpoint = (attachments: ChatAttachment[], resourceEndpoint: string): ChatAttachment[] => {
if (resourceEndpoint === undefined ||
const transformEndpoint = (
attachments: ChatAttachment[],
resourceEndpoint: string
): ChatAttachment[] => {
if (
resourceEndpoint === undefined ||
resourceEndpoint === null ||
resourceEndpoint === "" ||
!isValidURL(resourceEndpoint)) {
!isValidURL(resourceEndpoint)
) {
return attachments;
}
attachments
.filter((e) => e.attachmentType.toLowerCase() === "teamsInlineImage".toLowerCase())
.map((attachment) => {
if (attachment.previewUrl) {
attachment.previewUrl = replaceEndpoint(attachment.previewUrl, resourceEndpoint);
}
if (attachment.url) {
attachment.url = replaceEndpoint(attachment.url, resourceEndpoint);
}
});
.filter(
(e) =>
e.attachmentType.toLowerCase() === "teamsInlineImage".toLowerCase() ||
e.attachmentType.toLowerCase() === "teamsImage".toLowerCase()
)
.map((attachment) => {
if (attachment.previewUrl) {
attachment.previewUrl = replaceEndpoint(attachment.previewUrl, resourceEndpoint);
}
if (attachment.url) {
attachment.url = replaceEndpoint(attachment.url, resourceEndpoint);
}
});
return attachments;
}
};
export const base64decode = (encodedString: string): string => !isNode ? atob(encodedString) : Buffer.from(encodedString, "base64").toString();
export const base64decode = (encodedString: string): string =>
!isNode ? atob(encodedString) : Buffer.from(encodedString, "base64").toString();

@@ -420,0 +441,0 @@ const parseJWT = (token: string): any => {

@@ -36,3 +36,3 @@ import { CommunicationIdentifierKind } from "./identifierModels";

/** The type of attachment. */
attachmentType: "teamsInlineImage";
attachmentType: AttachmentType;
/** The type of content of the attachment, if available */

@@ -47,2 +47,4 @@ contentType?: string;

}
/** Type of Supported Attachments. */
export declare type AttachmentType = "teamsInlineImage" | "teamsImage" | "file";
/**

@@ -49,0 +51,0 @@ * Base class for chat event

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

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

@@ -16,3 +16,3 @@ import { AzureLogger } from "@azure/logger";

}
export { ChatEventId, BaseChatEvent, BaseChatMessageEvent, ChatAttachment, ChatMessageReceivedEvent, ChatMessageEditedEvent, ChatMessageDeletedEvent, ReadReceiptReceivedEvent, TypingIndicatorReceivedEvent, BaseChatThreadEvent, ChatParticipant, ChatThreadProperties, ChatThreadCreatedEvent, ChatThreadDeletedEvent, ChatThreadPropertiesUpdatedEvent, ParticipantsAddedEvent, ParticipantsRemovedEvent, CommunicationIdentifier, CommunicationUserIdentifier, PhoneNumberIdentifier, MicrosoftTeamsUserIdentifier, UnknownIdentifier, CommunicationIdentifierKind, CommunicationUserKind, PhoneNumberKind, MicrosoftTeamsUserKind, UnknownIdentifierKind };
export { ChatEventId, BaseChatEvent, BaseChatMessageEvent, AttachmentType, ChatAttachment, 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 {

@@ -19,0 +19,0 @@ abortSignal?: AbortSignalLike;

@@ -83,3 +83,3 @@ export interface BasePayload {

id: string;
attachmentType: "teamsInlineImage";
attachmentType: AttachmentType;
contentType?: string;

@@ -90,1 +90,2 @@ name?: string;

}
export declare type AttachmentType = "teamsInlineImage" | "teamsImage" | "file";

@@ -8,5 +8,5 @@ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.

"packageName": "@microsoft/api-extractor",
"packageVersion": "7.34.2"
"packageVersion": "7.34.4"
}
]
}

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

/** Type of Supported Attachments. */
export declare type AttachmentType = "teamsInlineImage" | "teamsImage" | "file";
/**

@@ -74,3 +77,3 @@ * Base class for chat event

/** The type of attachment. */
attachmentType: "teamsInlineImage";
attachmentType: AttachmentType;
/** The type of content of the attachment, if available */

@@ -77,0 +80,0 @@ contentType?: string;

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