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

@pusher/chatkit-server

Package Overview
Dependencies
Maintainers
9
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pusher/chatkit-server - npm Package Compare versions

Comparing version 2.2.0 to 2.4.0

7

CHANGELOG.md

@@ -10,2 +10,9 @@ # Changelog

## [2.4.0](https://github.com/pusher/chatkit-server-node/compare/2.2.0...2.4.0)
### Additions
- Adds message editing via `edit{Simple,Multipart,}Message`.
## 2.3.0 Yanked
## [2.2.0](https://github.com/pusher/chatkit-server-node/compare/2.1.1...2.2.0)

@@ -12,0 +19,0 @@

2

package.json
{
"name": "@pusher/chatkit-server",
"description": "Pusher Chatkit server SDK",
"version": "2.2.0",
"version": "2.4.0",
"main": "target/src/index.js",

@@ -6,0 +6,0 @@ "license": "MIT",

{
"name": "@pusher/chatkit-server",
"description": "Pusher Chatkit server SDK",
"version": "2.2.0",
"version": "2.4.0",
"main": "target/src/index.js",

@@ -6,0 +6,0 @@ "license": "MIT",

@@ -42,2 +42,10 @@ /// <reference types="node" />

}
export interface EditMessageOptions extends UserIdOptions {
text: string;
attachment?: AttachmentOptions;
}
export interface EditMultipartMessageOptions {
userId: string;
parts: Array<NewPart>;
}
export interface DeleteMessageOptions {

@@ -230,2 +238,5 @@ messageId: string;

sendMultipartMessage(options: SendMultipartMessageOptions): Promise<any>;
editMessage(roomId: string, messageId: string, options: EditMessageOptions): Promise<void>;
editSimpleMessage(roomId: string, messageId: string, options: EditMessageOptions): Promise<void>;
editMultipartMessage(roomId: string, messageId: string, options: EditMultipartMessageOptions): Promise<void>;
private uploadAttachment;

@@ -232,0 +243,0 @@ deleteMessage(options: DeleteMessageOptions): Promise<void>;

@@ -233,2 +233,50 @@ "use strict";

}
editMessage(roomId, messageId, options) {
let messagePayload = { text: options.text };
if (options.attachment) {
messagePayload.attachment = {
resource_link: options.attachment.resourceLink,
type: options.attachment.type,
};
}
return this.serverInstanceV2
.request({
method: "PUT",
path: `/rooms/${encodeURIComponent(roomId)}/messages/${encodeURIComponent(messageId)}`,
jwt: this.generateAccessToken({
su: true,
userId: options.userId,
}).token,
body: messagePayload,
})
.then(() => { });
}
editSimpleMessage(roomId, messageId, options) {
return this.editMultipartMessage(roomId, messageId, {
userId: options.userId,
parts: [{ type: "text/plain", content: options.text }],
});
}
editMultipartMessage(roomId, messageId, options) {
if (options.parts.length === 0) {
return Promise.reject(new TypeError("message must contain at least one part"));
}
return Promise.all(options.parts.map((part) => part.file
? this.uploadAttachment({
userId: options.userId,
roomId: roomId,
part,
})
: part))
.then(parts => this.serverInstance.request({
method: "PUT",
path: `/rooms/${encodeURIComponent(roomId)}/messages/${encodeURIComponent(messageId)}`,
jwt: this.generateAccessToken({
su: true,
userId: options.userId,
}).token,
body: { parts },
}))
.then(() => { });
}
uploadAttachment({ userId, roomId, part: { type, name, customData, file }, }) {

@@ -235,0 +283,0 @@ return this.serverInstance

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