Socket
Socket
Sign inDemoInstall

@slack/client

Package Overview
Dependencies
151
Maintainers
4
Versions
57
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.1.0 to 4.2.0

docs/_posts/2018-04-25-v4.2.0.md

2

dist/IncomingWebhook.js

@@ -20,3 +20,3 @@ "use strict";

// NOTE: no support for TLS config
let payload = this.defaults;
let payload = Object.assign({}, this.defaults);
if (typeof message === 'string') {

@@ -23,0 +23,0 @@ payload.text = message;

@@ -47,2 +47,10 @@ import { RTMClient } from './';

private logger;
/**
* Flag that indicates whether this object is still monitoring.
*/
isMonitoring?: Boolean;
/**
* Flag that indicates whether recommend_reconnect event has been emitted and stop() has not been called.
*/
recommendReconnect?: Boolean;
constructor({clientPingTimeout, serverPongTimeout, logger, logLevel}?: KeepAliveOptions);

@@ -49,0 +57,0 @@ /**

@@ -40,2 +40,3 @@ "use strict";

this.client = client;
this.isMonitoring = true;
this.client.on('outgoing_message', this.setPingTimer, this);

@@ -52,2 +53,3 @@ this.setPingTimer();

this.lastPing = this.client = undefined;
this.recommendReconnect = this.isMonitoring = false;
}

@@ -108,7 +110,8 @@ /**

}
// signal that this pong is done being handled
this.client.off('slack_event', attemptAcknowledgePong);
// no pong received to acknowledge the last ping within the serverPongTimeout
this.logger.debug('pong timer expired, recommend reconnect');
this.recommendReconnect = true;
this.emit('recommend_reconnect');
// signal that this pong is done being handled
this.client.off('slack_event', attemptAcknowledgePong);
}, this.serverPongTimeout);

@@ -115,0 +118,0 @@ this.client.on('slack_event', attemptAcknowledgePong, this);

@@ -74,2 +74,4 @@ /// <reference types="node" />

}[];
callback_id?: string;
mrkdwn_in?: ('pretext' | 'text' | 'fields')[];
}

@@ -113,3 +115,3 @@ export interface LinkUnfurls {

name: string;
validate: boolean;
validate?: boolean;
};

@@ -597,2 +599,7 @@ export declare type ChannelsKickArguments = TokenOverridable & {

};
export declare type UsersConversationsArguments = TokenOverridable & CursorPaginationEnabled & {
exclude_archived?: boolean;
types?: string;
user?: string;
};
export declare type UsersDeletePhotoArguments = TokenOverridable;

@@ -599,0 +606,0 @@ export declare type UsersGetPresenceArguments = TokenOverridable & {

@@ -99,2 +99,18 @@ "use strict";

.state('handshaking') // a state in which to wait until the 'server hello' event
.on('websocket close')
.transitionTo('reconnecting').withCondition(() => this.autoReconnect)
.withAction((_from, _to, context) => {
this.logger.debug(`reconnecting after unexpected close ${context.eventPayload.reason}
${context.eventPayload.code} with isMonitoring set to ${this.keepAlive.isMonitoring}
and recommendReconnect set to ${this.keepAlive.recommendReconnect}`);
})
.transitionTo('disconnected')
.withAction((_from, _to, context) => {
this.logger.debug(`disconnected after unexpected close ${context.eventPayload.reason}
${context.eventPayload.code} with isMonitoring set to ${this.keepAlive.isMonitoring}
and recommendReconnect set to ${this.keepAlive.recommendReconnect}`);
// this transition circumvents the 'disconnecting' state (since the websocket is already closed),
// so we need to execute its onExit behavior here.
this.teardownWebsocket();
})
.global()

@@ -101,0 +117,0 @@ .onStateEnter((state) => {

@@ -321,2 +321,3 @@ import EventEmitter = require('eventemitter3');

readonly users: {
conversations: Method<methods.UsersConversationsArguments>;
deletePhoto: Method<methods.TokenOverridable>;

@@ -323,0 +324,0 @@ getPresence: Method<methods.UsersGetPresenceArguments>;

@@ -295,2 +295,3 @@ "use strict";

this.users = {
conversations: (this.apiCall.bind(this, 'users.conversations')),
deletePhoto: (this.apiCall.bind(this, 'users.deletePhoto')),

@@ -297,0 +298,0 @@ getPresence: (this.apiCall.bind(this, 'users.getPresence')),

{
"name": "@slack/client",
"version": "4.1.0",
"version": "4.2.0",
"description": "Slack Developer Kit - official clients for the Web API, RTM API, and Incoming Webhooks",

@@ -5,0 +5,0 @@ "author": "Slack Technologies, Inc.",

@@ -74,3 +74,23 @@ require('mocha');

});
describe('lifecycle', function () {
beforeEach(function () {
this.scope = nock('https://hooks.slack.com')
.post(/services/)
.reply(500);
});
it('should not overwrite the default parameters after a call', function (done) {
const defaultParams = { channel: 'default' };
const expectedParams = Object.assign({}, defaultParams);
const webhook = new IncomingWebhook(url, defaultParams);
webhook.send({ channel: 'different' }, () => {
assert.deepEqual(webhook.defaults, expectedParams);
done();
});
});
});
});
});

@@ -40,3 +40,3 @@ import got = require('got'); // tslint:disable-line:no-require-imports

// NOTE: no support for TLS config
let payload: IncomingWebhookSendArguments = this.defaults;
let payload: IncomingWebhookSendArguments = Object.assign({}, this.defaults);

@@ -43,0 +43,0 @@ if (typeof message === 'string') {

@@ -60,2 +60,12 @@ import { RTMClient, ErrorCode } from './';

/**
* Flag that indicates whether this object is still monitoring.
*/
public isMonitoring?: Boolean;
/**
* Flag that indicates whether recommend_reconnect event has been emitted and stop() has not been called.
*/
public recommendReconnect?: Boolean;
constructor({

@@ -101,2 +111,3 @@ clientPingTimeout = 6000,

this.client = client;
this.isMonitoring = true;
this.client.on('outgoing_message', this.setPingTimer, this);

@@ -114,2 +125,3 @@ this.setPingTimer();

this.lastPing = this.client = undefined;
this.recommendReconnect = this.isMonitoring = false;
}

@@ -180,9 +192,9 @@

}
// signal that this pong is done being handled
this.client.off('slack_event', attemptAcknowledgePong);
// no pong received to acknowledge the last ping within the serverPongTimeout
this.logger.debug('pong timer expired, recommend reconnect');
this.recommendReconnect = true;
this.emit('recommend_reconnect');
// signal that this pong is done being handled
this.client.off('slack_event', attemptAcknowledgePong);
}, this.serverPongTimeout);

@@ -189,0 +201,0 @@

@@ -94,2 +94,4 @@ import { Stream } from 'stream';

}[];
callback_id?: string;
mrkdwn_in?: ('pretext' | 'text' | 'fields')[];
}

@@ -158,3 +160,3 @@

name: string;
validate: boolean;
validate?: boolean;
};

@@ -729,2 +731,7 @@ export type ChannelsKickArguments = TokenOverridable & {

*/
export type UsersConversationsArguments = TokenOverridable & CursorPaginationEnabled & {
exclude_archived?: boolean;
types?: string; // comma-separated list of conversation types
user?: string;
};
export type UsersDeletePhotoArguments = TokenOverridable;

@@ -731,0 +738,0 @@ export type UsersGetPresenceArguments = TokenOverridable & {

@@ -148,2 +148,18 @@ import { Agent } from 'http';

.state('handshaking') // a state in which to wait until the 'server hello' event
.on('websocket close')
.transitionTo('reconnecting').withCondition(() => this.autoReconnect)
.withAction((_from, _to, context) => {
this.logger.debug(`reconnecting after unexpected close ${context.eventPayload.reason}
${context.eventPayload.code} with isMonitoring set to ${this.keepAlive.isMonitoring}
and recommendReconnect set to ${this.keepAlive.recommendReconnect}`);
})
.transitionTo('disconnected')
.withAction((_from, _to, context) => {
this.logger.debug(`disconnected after unexpected close ${context.eventPayload.reason}
${context.eventPayload.code} with isMonitoring set to ${this.keepAlive.isMonitoring}
and recommendReconnect set to ${this.keepAlive.recommendReconnect}`);
// this transition circumvents the 'disconnecting' state (since the websocket is already closed),
// so we need to execute its onExit behavior here.
this.teardownWebsocket();
})
.global()

@@ -150,0 +166,0 @@ .onStateEnter((state) => {

@@ -488,2 +488,3 @@ import { basename } from 'path';

public readonly users = {
conversations: (this.apiCall.bind(this, 'users.conversations')) as Method<methods.UsersConversationsArguments>,
deletePhoto: (this.apiCall.bind(this, 'users.deletePhoto')) as Method<methods.UsersDeletePhotoArguments>,

@@ -490,0 +491,0 @@ getPresence: (this.apiCall.bind(this, 'users.getPresence')) as Method<methods.UsersGetPresenceArguments>,

@@ -11,2 +11,4 @@ /**

* @extends EventEmitter
* @property {Boolean} [isMonitoring] Flag that indicates whether this object is still monitoring.
* @property {Boolean} [recommendReconnect] Flag that indicates whether recommend_reconnect event has been emitted and stop() has not been called.
*/

@@ -13,0 +15,0 @@ export class KeepAlive {

@@ -60,2 +60,4 @@ /**

* @property {Array<module:@slack/client/dist/methods.__type>} [actions]
* @property {string} [callback_id]
* @property {Array<"pretext" | "text" | "fields">} [mrkdwn_in]
*/

@@ -62,0 +64,0 @@ export class MessageAttachment {

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

/**
/**
* @module @slack/client

@@ -153,3 +153,3 @@ */

* will buffer until the client is in a state where they can be sent.
*
*
* If the awaitReply parameter is set to true, then the returned Promise is resolved with the platform's

@@ -159,3 +159,3 @@ * acknowledgement response. Not all message types will result in an acknowledgement response, so use this carefully.

* reconnects before recieving the acknowledgement response.
*
*
* If the awaitReply parameter is set to false, then the returned Promise is resolved as soon as the message is sent

@@ -359,3 +359,3 @@ * from the websocket.

* A client for Slack's Web API
*
*
* This client provides an alias for each {@link https://api.slack.com/methods|Web API method}. Each method is

@@ -362,0 +362,0 @@ * a convenience wrapper for calling the {@link WebClient#apiCall} method using the method name as the first parameter.

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc