Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@azure/communication-chat

Package Overview
Dependencies
Maintainers
3
Versions
287
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@azure/communication-chat - npm Package Compare versions

Comparing version 1.0.0-alpha.20210226.1 to 1.0.0-alpha.20210301.1

3

CHANGELOG.md

@@ -5,3 +5,6 @@ # Release History

### Breaking Changes
- Removed `_response` from returned models.
## 1.0.0-beta.4 (2021-02-09)

@@ -8,0 +11,0 @@

16

dist-esm/src/chatClient.js
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
/// <reference lib="esnext.asynciterable" />
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await, __awaiter } from "tslib";
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await, __awaiter, __rest } from "tslib";
import { logger } from "./models/logger";

@@ -14,3 +14,3 @@ import { EventEmitter } from "events";

import { ChatThreadClient } from "./chatThreadClient";
import { mapToChatThreadSdkModel, attachHttpResponse, mapToChatParticipantRestModel } from "./models/mappers";
import { mapToChatThreadSdkModel, mapToChatParticipantRestModel } from "./models/mappers";
import { ChatApiClient } from "./generated/src";

@@ -77,6 +77,7 @@ import { createCommunicationTokenCredentialPolicy } from "./credential/communicationTokenCredentialPolicy";

try {
return yield this.client.chat.createChatThread({
const _b = yield this.client.chat.createChatThread({
topic: request.topic,
participants: (_a = request.participants) === null || _a === void 0 ? void 0 : _a.map((participant) => mapToChatParticipantRestModel(participant))
}, operationOptionsToRequestOptionsBase(updatedOptions));
}, operationOptionsToRequestOptionsBase(updatedOptions)), { _response } = _b, result = __rest(_b, ["_response"]);
return result;
}

@@ -105,5 +106,4 @@ catch (e) {

try {
const response = yield this.client.chat.getChatThread(threadId, operationOptionsToRequestOptionsBase(updatedOptions));
const thread = mapToChatThreadSdkModel(response);
return attachHttpResponse(thread, response._response);
const _a = yield this.client.chat.getChatThread(threadId, operationOptionsToRequestOptionsBase(updatedOptions)), { _response } = _a, result = __rest(_a, ["_response"]);
return mapToChatThreadSdkModel(result);
}

@@ -202,3 +202,3 @@ catch (e) {

try {
return yield this.client.chat.deleteChatThread(threadId, operationOptionsToRequestOptionsBase(updatedOptions));
yield this.client.chat.deleteChatThread(threadId, operationOptionsToRequestOptionsBase(updatedOptions));
}

@@ -205,0 +205,0 @@ catch (e) {

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await, __awaiter } from "tslib";
import { __asyncDelegator, __asyncGenerator, __asyncValues, __await, __awaiter, __rest } from "tslib";
import { logger } from "./models/logger";

@@ -10,3 +10,3 @@ import { SDK_VERSION } from "./constants";

import { ChatApiClient } from "./generated/src";
import { mapToAddChatParticipantsRequestRestModel, mapToChatMessageSdkModel, attachHttpResponse, mapToChatParticipantSdkModel, mapToReadReceiptSdkModel } from "./models/mappers";
import { mapToAddChatParticipantsRequestRestModel, mapToChatMessageSdkModel, mapToChatParticipantSdkModel, mapToReadReceiptSdkModel } from "./models/mappers";
import { createCommunicationTokenCredentialPolicy } from "./credential/communicationTokenCredentialPolicy";

@@ -20,3 +20,2 @@ const minimumTypingIntervalInMilliSeconds = 8000;

this.url = url;
this.disposed = false;
this.timeOfLastTypingRequest = undefined;

@@ -53,3 +52,3 @@ this.threadId = threadId;

try {
return yield this.client.chatThread.updateChatThread(this.threadId, { topic: options.topic }, operationOptionsToRequestOptionsBase(updatedOptions));
yield this.client.chatThread.updateChatThread(this.threadId, { topic: options.topic }, operationOptionsToRequestOptionsBase(updatedOptions));
}

@@ -80,3 +79,4 @@ catch (e) {

this.timeOfLastTypingRequest = undefined;
return yield this.client.chatThread.sendChatMessage(this.threadId, Object.assign(Object.assign({}, request), options), operationOptionsToRequestOptionsBase(updatedOptions));
const _a = yield this.client.chatThread.sendChatMessage(this.threadId, Object.assign(Object.assign({}, request), options), operationOptionsToRequestOptionsBase(updatedOptions)), { _response } = _a, result = __rest(_a, ["_response"]);
return result;
}

@@ -105,5 +105,4 @@ catch (e) {

try {
const response = yield this.client.chatThread.getChatMessage(this.threadId, messageId, operationOptionsToRequestOptionsBase(updatedOptions));
const message = mapToChatMessageSdkModel(response);
return attachHttpResponse(message, response._response);
const _a = yield this.client.chatThread.getChatMessage(this.threadId, messageId, operationOptionsToRequestOptionsBase(updatedOptions)), { _response } = _a, result = __rest(_a, ["_response"]);
return mapToChatMessageSdkModel(result);
}

@@ -203,3 +202,3 @@ catch (e) {

try {
return yield this.client.chatThread.deleteChatMessage(this.threadId, messageId, operationOptionsToRequestOptionsBase(updatedOptions));
yield this.client.chatThread.deleteChatMessage(this.threadId, messageId, operationOptionsToRequestOptionsBase(updatedOptions));
}

@@ -227,3 +226,3 @@ catch (e) {

try {
return yield this.client.chatThread.updateChatMessage(this.threadId, messageId, options, operationOptionsToRequestOptionsBase(updatedOptions));
yield this.client.chatThread.updateChatMessage(this.threadId, messageId, options, operationOptionsToRequestOptionsBase(updatedOptions));
}

@@ -251,3 +250,4 @@ catch (e) {

try {
return yield this.client.chatThread.addChatParticipants(this.threadId, mapToAddChatParticipantsRequestRestModel(request), operationOptionsToRequestOptionsBase(updatedOptions));
const _a = yield this.client.chatThread.addChatParticipants(this.threadId, mapToAddChatParticipantsRequestRestModel(request), operationOptionsToRequestOptionsBase(updatedOptions)), { _response } = _a, result = __rest(_a, ["_response"]);
return result;
}

@@ -347,3 +347,3 @@ catch (e) {

try {
return yield this.client.chatThread.removeChatParticipant(this.threadId, participant.communicationUserId, operationOptionsToRequestOptionsBase(updatedOptions));
yield this.client.chatThread.removeChatParticipant(this.threadId, participant.communicationUserId, operationOptionsToRequestOptionsBase(updatedOptions));
}

@@ -403,3 +403,3 @@ catch (e) {

try {
return yield this.client.chatThread.sendChatReadReceipt(this.threadId, request, operationOptionsToRequestOptionsBase(updatedOptions));
yield this.client.chatThread.sendChatReadReceipt(this.threadId, request, operationOptionsToRequestOptionsBase(updatedOptions));
}

@@ -490,11 +490,2 @@ catch (e) {

}
/**
* Dispose method.
*/
dispose() {
if (this.disposed) {
return;
}
this.disposed = true;
}
canPostTypingNotification(dateNow) {

@@ -501,0 +492,0 @@ if (this.timeOfLastTypingRequest) {

@@ -75,11 +75,2 @@ // Copyright (c) Microsoft Corporation.

};
/**
* Attach http response to a model
*/
export const attachHttpResponse = (model, httpResponse) => {
const { parsedBody, bodyAsText } = httpResponse, r = __rest(httpResponse, ["parsedBody", "bodyAsText"]);
return Object.defineProperty(model, "_response", {
value: r
});
};
//# sourceMappingURL=mappers.js.map
{
"name": "@azure/communication-chat",
"version": "1.0.0-alpha.20210226.1",
"version": "1.0.0-alpha.20210301.1",
"description": "Azure client library for Azure Communication Chat services",

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

@@ -11,3 +11,2 @@ /// <reference lib="esnext.asynciterable" />

import * as coreHttp from '@azure/core-http';
import { HttpResponse } from '@azure/core-http';
import { OperationOptions } from '@azure/core-http';

@@ -37,7 +36,2 @@ import { PagedAsyncIterableIterator } from '@azure/core-paging';

/**
* Represents the response from adding chat participants
*/
export declare type AddChatParticipantsResponse = WithResponse<AddChatParticipantsResult>;
/** Result of the add chat participants operation. */

@@ -84,3 +78,3 @@ export declare interface AddChatParticipantsResult {

*/
createChatThread(request: CreateChatThreadRequest, options?: CreateChatThreadOptions): Promise<CreateChatThreadResponse>;
createChatThread(request: CreateChatThreadRequest, options?: CreateChatThreadOptions): Promise<CreateChatThreadResult>;
/**

@@ -92,3 +86,3 @@ * Gets a chat thread.

*/
getChatThread(threadId: string, options?: GetChatThreadOptions): Promise<GetChatThreadResponse>;
getChatThread(threadId: string, options?: GetChatThreadOptions): Promise<ChatThread>;
private listChatThreadsPage;

@@ -106,3 +100,3 @@ private listChatThreadsAll;

*/
deleteChatThread(threadId: string, options?: DeleteChatThreadOptions): Promise<OperationResponse>;
deleteChatThread(threadId: string, options?: DeleteChatThreadOptions): Promise<void>;
/**

@@ -327,3 +321,2 @@ * Start receiving realtime notifications.

private readonly client;
private disposed;
private timeOfLastTypingRequest;

@@ -335,3 +328,3 @@ constructor(threadId: string, url: string, credential: CommunicationTokenCredential, options?: ChatThreadClientOptions);

*/
updateThread(options?: UpdateThreadOptions): Promise<OperationResponse>;
updateThread(options?: UpdateThreadOptions): Promise<void>;
/**

@@ -343,3 +336,3 @@ * Sends a chat message to a thread identified by threadId.

*/
sendMessage(request: SendMessageRequest, options?: SendMessageOptions): Promise<SendChatMessageResponse>;
sendMessage(request: SendMessageRequest, options?: SendMessageOptions): Promise<SendChatMessageResult>;
/**

@@ -351,3 +344,3 @@ * Gets a chat message identified by messageId.

*/
getMessage(messageId: string, options?: GetMessageOptions): Promise<GetChatMessageResponse>;
getMessage(messageId: string, options?: GetMessageOptions): Promise<ChatMessage>;
private listMessagesPage;

@@ -366,3 +359,3 @@ private listMessagesAll;

*/
deleteMessage(messageId: string, options?: DeleteMessageOptions): Promise<OperationResponse>;
deleteMessage(messageId: string, options?: DeleteMessageOptions): Promise<void>;
/**

@@ -373,3 +366,3 @@ * Updates a message identified by threadId and messageId

*/
updateMessage(messageId: string, options?: UpdateMessageOptions): Promise<OperationResponse>;
updateMessage(messageId: string, options?: UpdateMessageOptions): Promise<void>;
/**

@@ -394,3 +387,3 @@ * Adds the details of chat participants belonging to the thread identified by threadId.

*/
removeParticipant(participant: CommunicationUserIdentifier, options?: RemoveParticipantOptions): Promise<OperationResponse>;
removeParticipant(participant: CommunicationUserIdentifier, options?: RemoveParticipantOptions): Promise<void>;
/**

@@ -409,3 +402,3 @@ * Sends a typing notification to the thread.

*/
sendReadReceipt(request: SendReadReceiptRequest, options?: SendReadReceiptOptions): Promise<OperationResponse>;
sendReadReceipt(request: SendReadReceiptRequest, options?: SendReadReceiptOptions): Promise<void>;
private listReadReceiptsPage;

@@ -419,6 +412,2 @@ private listReadReceiptsAll;

listReadReceipts(options?: ListReadReceiptsOptions): PagedAsyncIterableIterator<ChatMessageReadReceipt>;
/**
* Dispose method.
*/
dispose(): void;
private canPostTypingNotification;

@@ -495,7 +484,2 @@ }

/**
* Represents the response from creating a chat thread
*/
export declare type CreateChatThreadResponse = WithResponse<CreateChatThreadResult>;
/** Result of the create chat thread operation. */

@@ -520,7 +504,2 @@ export declare interface CreateChatThreadResult {

/**
* Represents the response from getting a chat message
*/
export declare type GetChatMessageResponse = WithResponse<ChatMessage>;
/**
* Options to get a chat thread.

@@ -531,7 +510,2 @@ */

/**
* Represents the response from getting a chat thread
*/
export declare type GetChatThreadResponse = WithResponse<ChatThread>;
/**
* Options to get a chat message.

@@ -573,12 +547,2 @@ */

/**
* Represents the repsonse for operations
*/
export declare interface OperationResponse {
/**
* The underlying HTTP response containing both raw and deserialized response data.
*/
_response: HttpResponse;
}
/**
* Options to remove a chat participant.

@@ -734,7 +698,2 @@ */

/**
* Represents the response from sending a chat message
*/
export declare type SendChatMessageResponse = WithResponse<SendChatMessageResult>;
/** Result of the send message operation. */

@@ -786,9 +745,2 @@ export declare interface SendChatMessageResult {

/**
* Represents an object with a non-enumerable _response property which provides
*/
export declare type WithResponse<T> = T & {
_response: HttpResponse;
};
export { }

@@ -8,3 +8,3 @@ /// <reference lib="esnext.asynciterable" />

import { ChatClientOptions, CreateChatThreadOptions, GetChatThreadOptions, ListChatThreadsOptions, DeleteChatThreadOptions } from "./models/options";
import { CreateChatThreadResponse, GetChatThreadResponse, OperationResponse } from "./models/models";
import { ChatThread, CreateChatThreadResult } from "./models/models";
import { ChatThreadInfo } from "./generated/src";

@@ -43,3 +43,3 @@ import { CreateChatThreadRequest } from "./models/requests";

*/
createChatThread(request: CreateChatThreadRequest, options?: CreateChatThreadOptions): Promise<CreateChatThreadResponse>;
createChatThread(request: CreateChatThreadRequest, options?: CreateChatThreadOptions): Promise<CreateChatThreadResult>;
/**

@@ -51,3 +51,3 @@ * Gets a chat thread.

*/
getChatThread(threadId: string, options?: GetChatThreadOptions): Promise<GetChatThreadResponse>;
getChatThread(threadId: string, options?: GetChatThreadOptions): Promise<ChatThread>;
private listChatThreadsPage;

@@ -65,3 +65,3 @@ private listChatThreadsAll;

*/
deleteChatThread(threadId: string, options?: DeleteChatThreadOptions): Promise<OperationResponse>;
deleteChatThread(threadId: string, options?: DeleteChatThreadOptions): Promise<void>;
/**

@@ -68,0 +68,0 @@ * Start receiving realtime notifications.

@@ -5,5 +5,5 @@ import { CommunicationUserIdentifier, CommunicationTokenCredential } from "@azure/communication-common";

import { AddChatParticipantsResult, SendReadReceiptRequest } from "./generated/src";
import { OperationResponse } from "./models/models";
import { SendChatMessageResult } from "./models/models";
import { ChatThreadClientOptions, SendMessageOptions, GetMessageOptions, DeleteMessageOptions, ListMessagesOptions, UpdateMessageOptions, UpdateThreadOptions, AddParticipantsOptions, ListParticipantsOptions, RemoveParticipantOptions, SendTypingNotificationOptions, SendReadReceiptOptions, ListReadReceiptsOptions } from "./models/options";
import { ChatMessage, ChatParticipant, GetChatMessageResponse, ChatMessageReadReceipt, SendChatMessageResponse } from "./models/models";
import { ChatMessage, ChatParticipant, ChatMessageReadReceipt } from "./models/models";
export { SendReadReceiptRequest } from "./generated/src/models";

@@ -21,3 +21,2 @@ /**

private readonly client;
private disposed;
private timeOfLastTypingRequest;

@@ -29,3 +28,3 @@ constructor(threadId: string, url: string, credential: CommunicationTokenCredential, options?: ChatThreadClientOptions);

*/
updateThread(options?: UpdateThreadOptions): Promise<OperationResponse>;
updateThread(options?: UpdateThreadOptions): Promise<void>;
/**

@@ -37,3 +36,3 @@ * Sends a chat message to a thread identified by threadId.

*/
sendMessage(request: SendMessageRequest, options?: SendMessageOptions): Promise<SendChatMessageResponse>;
sendMessage(request: SendMessageRequest, options?: SendMessageOptions): Promise<SendChatMessageResult>;
/**

@@ -45,3 +44,3 @@ * Gets a chat message identified by messageId.

*/
getMessage(messageId: string, options?: GetMessageOptions): Promise<GetChatMessageResponse>;
getMessage(messageId: string, options?: GetMessageOptions): Promise<ChatMessage>;
private listMessagesPage;

@@ -60,3 +59,3 @@ private listMessagesAll;

*/
deleteMessage(messageId: string, options?: DeleteMessageOptions): Promise<OperationResponse>;
deleteMessage(messageId: string, options?: DeleteMessageOptions): Promise<void>;
/**

@@ -67,3 +66,3 @@ * Updates a message identified by threadId and messageId

*/
updateMessage(messageId: string, options?: UpdateMessageOptions): Promise<OperationResponse>;
updateMessage(messageId: string, options?: UpdateMessageOptions): Promise<void>;
/**

@@ -88,3 +87,3 @@ * Adds the details of chat participants belonging to the thread identified by threadId.

*/
removeParticipant(participant: CommunicationUserIdentifier, options?: RemoveParticipantOptions): Promise<OperationResponse>;
removeParticipant(participant: CommunicationUserIdentifier, options?: RemoveParticipantOptions): Promise<void>;
/**

@@ -103,3 +102,3 @@ * Sends a typing notification to the thread.

*/
sendReadReceipt(request: SendReadReceiptRequest, options?: SendReadReceiptOptions): Promise<OperationResponse>;
sendReadReceipt(request: SendReadReceiptRequest, options?: SendReadReceiptOptions): Promise<void>;
private listReadReceiptsPage;

@@ -113,8 +112,4 @@ private listReadReceiptsAll;

listReadReceipts(options?: ListReadReceiptsOptions): PagedAsyncIterableIterator<ChatMessageReadReceipt>;
/**
* Dispose method.
*/
dispose(): void;
private canPostTypingNotification;
}
//# sourceMappingURL=chatThreadClient.d.ts.map
import * as RestModel from "../generated/src/models";
import { HttpResponse } from "@azure/core-http";
import { AddChatParticipantsRequest } from "./requests";
import { ChatMessage, ChatThread, ChatParticipant, ChatMessageReadReceipt, ChatMessageContent, WithResponse } from "./models";
import { ChatMessage, ChatThread, ChatParticipant, ChatMessageReadReceipt, ChatMessageContent } from "./models";
/**

@@ -34,9 +33,2 @@ * Mapping chat participant customer model to chat participant REST model

export declare const mapToReadReceiptSdkModel: (readReceipt: RestModel.ChatMessageReadReceipt) => ChatMessageReadReceipt;
/**
* Attach http response to a model
*/
export declare const attachHttpResponse: <T>(model: T, httpResponse: HttpResponse & {
bodyAsText: string;
parsedBody: any;
}) => WithResponse<T>;
//# sourceMappingURL=mappers.d.ts.map
import { CommunicationUserIdentifier } from "@azure/communication-common";
import { HttpResponse } from "@azure/core-http";
import { SendChatMessageResult, ChatMessage as RestChatMessage, ChatThread as RestChatThread, ChatParticipant as RestChatParticipant, ChatMessageReadReceipt as RestChatMessageReadReceipt, ChatMessageContent as RestChatMessageContent, ChatMessageType, CreateChatThreadResult, CreateChatThreadErrors, AddChatParticipantsResult, AddChatParticipantsErrors, CommunicationError } from "../generated/src/models";

@@ -61,37 +60,2 @@ export { RestChatMessage, RestChatThread, RestChatParticipant, RestChatMessageContent, RestChatMessageReadReceipt, CreateChatThreadResult, CreateChatThreadErrors, SendChatMessageResult, AddChatParticipantsResult, AddChatParticipantsErrors, ChatMessageType, CommunicationError };

}
/**
* Represents the repsonse for operations
*/
export interface OperationResponse {
/**
* The underlying HTTP response containing both raw and deserialized response data.
*/
_response: HttpResponse;
}
/**
* Represents an object with a non-enumerable _response property which provides
*/
export declare type WithResponse<T> = T & {
_response: HttpResponse;
};
/**
* Represents the response from getting a chat message
*/
export declare type GetChatMessageResponse = WithResponse<ChatMessage>;
/**
* Represents the response from getting a chat thread
*/
export declare type GetChatThreadResponse = WithResponse<ChatThread>;
/**
* Represents the response from sending a chat message
*/
export declare type SendChatMessageResponse = WithResponse<SendChatMessageResult>;
/**
* Represents the response from creating a chat thread
*/
export declare type CreateChatThreadResponse = WithResponse<CreateChatThreadResult>;
/**
* Represents the response from adding chat participants
*/
export declare type AddChatParticipantsResponse = WithResponse<AddChatParticipantsResult>;
//# sourceMappingURL=models.d.ts.map

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

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

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

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