@slack/client
Advanced tools
Comparing version 3.5.0 to 3.5.1
@@ -10,4 +10,4 @@ | ||
var rtm = new RtmClient(token, { | ||
logLevel: 'info', // check this out for more on logger: https://github.com/winstonjs/winston | ||
dataStore: new MemoryDataStore({}) // pass a new MemoryDataStore instance to cache information | ||
logLevel: 'error', // check this out for more on logger: https://github.com/winstonjs/winston | ||
dataStore: new MemoryDataStore() // pass a new MemoryDataStore instance to cache information | ||
}); | ||
@@ -14,0 +14,0 @@ |
@@ -9,3 +9,3 @@ /** | ||
var cloneDeep = require('lodash').cloneDeep; | ||
var contains = require('lodash').contains; | ||
var includes = require('lodash').includes; | ||
var hasKey = require('lodash').has; | ||
@@ -262,3 +262,3 @@ var inherits = require('inherits'); | ||
// Any of these mean this client is unusable, so don't attempt to auto-reconnect | ||
if (data && contains(UNRECOVERABLE_RTM_START_ERRS, data.error)) { | ||
if (data && includes(UNRECOVERABLE_RTM_START_ERRS, data.error)) { | ||
errMsg = 'unrecoverable failure connecting to the RTM API'; | ||
@@ -411,3 +411,3 @@ this.logger('error', errMsg + ': ' + data.error); | ||
if (contains(RTM_CLIENT_INTERNAL_EVENT_TYPES, message.type)) { | ||
if (includes(RTM_CLIENT_INTERNAL_EVENT_TYPES, message.type)) { | ||
this._handleWsMessageInternal(message.type, message); | ||
@@ -558,3 +558,3 @@ } else { | ||
pendingMessageIds = keys(this._pendingMessages); | ||
forEach(pendingMessageIds, function handlePendingMessage(messageId) { | ||
forEach(pendingMessageIds, bind(function handlePendingMessage(messageId) { | ||
// If the message id is less than the most recent reply to id, assume that the message has | ||
@@ -572,3 +572,3 @@ // been processed. If it's greater than the most recent reply to, then it's likely that the | ||
} | ||
}, this); | ||
}, this)); | ||
}; | ||
@@ -575,0 +575,0 @@ |
@@ -38,6 +38,6 @@ /** | ||
makeAPICall = bind(this._makeAPICall, this); | ||
forEach(facets, function registerWebClientFacet(Facet) { | ||
forEach(facets, bind(function registerWebClientFacet(Facet) { | ||
newFacet = new Facet(makeAPICall); | ||
this[newFacet.name] = newFacet; | ||
}, this); | ||
}, this)); | ||
@@ -44,0 +44,0 @@ // Add a dm alias for the im and mpim facets |
@@ -34,5 +34,5 @@ /* eslint no-unused-vars: 0 */ | ||
forEach(messageHandlers, function anonRegisterMessageHandler(handler, event) { | ||
forEach(messageHandlers, bind(function anonRegisterMessageHandler(handler, event) { | ||
this.registerMessageHandler(event, handler); | ||
}, this); | ||
}, this)); | ||
} | ||
@@ -391,18 +391,18 @@ | ||
forEach(data.users || [], function cacheRtmUser(user) { | ||
forEach(data.users || [], bind(function cacheRtmUser(user) { | ||
this.setUser(new models.User(user)); | ||
}, this); | ||
forEach(data.channels || [], function cacheRtmChannel(channel) { | ||
}, this)); | ||
forEach(data.channels || [], bind(function cacheRtmChannel(channel) { | ||
this.setChannel(new models.Channel(channel)); | ||
}, this); | ||
forEach(data.ims || [], function cacheRtmDM(dm) { | ||
}, this)); | ||
forEach(data.ims || [], bind(function cacheRtmDM(dm) { | ||
this.setDM(new models.DM(dm)); | ||
}, this); | ||
forEach(data.groups || [], function cacheRtmGroup(group) { | ||
}, this)); | ||
forEach(data.groups || [], bind(function cacheRtmGroup(group) { | ||
this.setGroup(new models.Group(group)); | ||
}, this); | ||
forEach(data.bots || [], function cacheRtmBot(bot) { | ||
}, this)); | ||
forEach(data.bots || [], bind(function cacheRtmBot(bot) { | ||
// Bots don't have a separate type currently, so treat them as simple objects | ||
this.setBot(bot); | ||
}, this); | ||
}, this)); | ||
@@ -409,0 +409,0 @@ this.getUserById(data.self.id).update(data.self); |
@@ -85,3 +85,3 @@ /** | ||
SlackMemoryDataStore.prototype.getUserByName = function getUserByName(name) { | ||
return find(this.users, 'name', name); | ||
return find(this.users, ['name', name]); | ||
}; | ||
@@ -111,3 +111,3 @@ | ||
var transformedName = name.replace(/^#/, ''); | ||
return find(this.channels, 'name', transformedName); | ||
return find(this.channels, ['name', transformedName]); | ||
}; | ||
@@ -124,3 +124,3 @@ | ||
SlackMemoryDataStore.prototype.getGroupByName = function getGroupByName(name) { | ||
return find(this.groups, 'name', name); | ||
return find(this.groups, ['name', name]); | ||
}; | ||
@@ -138,3 +138,3 @@ | ||
var user = this.getUserByName(name); | ||
return find(this.dms, 'user', user.id); | ||
return find(this.dms, ['user', user.id]); | ||
}; | ||
@@ -151,3 +151,3 @@ | ||
SlackMemoryDataStore.prototype.getBotByName = function getBotByName(name) { | ||
return find(this.bots, 'name', name); | ||
return find(this.bots, ['name', name]); | ||
}; | ||
@@ -154,0 +154,0 @@ |
@@ -5,3 +5,3 @@ /** | ||
var zipObject = require('lodash').zipObject; | ||
var fromPairs = require('lodash').fromPairs; | ||
@@ -29,2 +29,2 @@ var RTM_EVENTS = require('../../clients/events/rtm').EVENTS; | ||
module.exports = zipObject(handlers); | ||
module.exports = fromPairs(handlers); |
@@ -5,3 +5,3 @@ /** | ||
var zipObject = require('lodash').zipObject; | ||
var fromPairs = require('lodash').fromPairs; | ||
@@ -62,2 +62,2 @@ var RTM_EVENTS = require('../../clients/events/rtm').EVENTS; | ||
module.exports = zipObject(handlers); | ||
module.exports = fromPairs(handlers); |
@@ -5,3 +5,3 @@ /** | ||
var zipObject = require('lodash').zipObject; | ||
var fromPairs = require('lodash').fromPairs; | ||
@@ -52,2 +52,2 @@ var RTM_EVENTS = require('../../clients/events/rtm').EVENTS; | ||
module.exports = zipObject(handlers); | ||
module.exports = fromPairs(handlers); |
@@ -5,3 +5,3 @@ /** | ||
var zipObject = require('lodash').zipObject; | ||
var fromPairs = require('lodash').fromPairs; | ||
@@ -53,2 +53,2 @@ var RTM_EVENTS = require('../../clients/events/rtm').EVENTS; | ||
module.exports = zipObject(handlers); | ||
module.exports = fromPairs(handlers); |
@@ -6,3 +6,3 @@ /** | ||
var findIndex = require('lodash').findIndex; | ||
var zipObject = require('lodash').zipObject; | ||
var fromPairs = require('lodash').fromPairs; | ||
@@ -79,2 +79,2 @@ var MESSAGE_SUBTYPES = require('../../clients/events/rtm').MESSAGE_SUBTYPES; | ||
module.exports = zipObject(handlers); | ||
module.exports = fromPairs(handlers); |
@@ -5,3 +5,3 @@ /** | ||
var zipObject = require('lodash').zipObject; | ||
var fromPairs = require('lodash').fromPairs; | ||
@@ -32,2 +32,2 @@ var RTM_EVENTS = require('../../clients/events/rtm').EVENTS; | ||
module.exports = zipObject(handlers); | ||
module.exports = fromPairs(handlers); |
@@ -7,3 +7,3 @@ /** | ||
var partial = require('lodash').partial; | ||
var zipObject = require('lodash').zipObject; | ||
var fromPairs = require('lodash').fromPairs; | ||
@@ -96,2 +96,2 @@ var RTM_EVENTS = require('../../clients/events/rtm').EVENTS; | ||
module.exports = zipObject(handlers); | ||
module.exports = fromPairs(handlers); |
@@ -5,3 +5,3 @@ /** | ||
var zipObject = require('lodash').zipObject; | ||
var fromPairs = require('lodash').fromPairs; | ||
@@ -18,2 +18,2 @@ var RTM_EVENTS = require('../../clients/events/rtm').EVENTS; | ||
module.exports = zipObject(handlers); | ||
module.exports = fromPairs(handlers); |
/** | ||
* Handlers for all RTM `team_` events. | ||
*/ | ||
var zipObject = require('lodash').zipObject; | ||
var fromPairs = require('lodash').fromPairs; | ||
@@ -46,2 +46,2 @@ var RTM_EVENTS = require('../../clients/events/rtm').EVENTS; | ||
module.exports = zipObject(handlers); | ||
module.exports = fromPairs(handlers); |
@@ -5,3 +5,3 @@ /** | ||
var zipObject = require('lodash').zipObject; | ||
var fromPairs = require('lodash').fromPairs; | ||
@@ -40,2 +40,2 @@ var RTM_EVENTS = require('../../clients/events/rtm').EVENTS; | ||
module.exports = zipObject(handlers); | ||
module.exports = fromPairs(handlers); |
@@ -91,3 +91,3 @@ /** | ||
forEachRight(this.history, function checkMessageIsUnread(message) { | ||
forEachRight(this.history, bind(function checkMessageIsUnread(message) { | ||
if (message.ts > this.lastRead) { | ||
@@ -100,3 +100,3 @@ this.unreadCount++; | ||
return continueIterating; | ||
}, this); | ||
}, this)); | ||
@@ -103,0 +103,0 @@ return this.unreadCount; |
@@ -6,2 +6,3 @@ /** | ||
var forEach = require('lodash').forEach; | ||
var bind = require('lodash').bind; | ||
var has = require('lodash').has; | ||
@@ -58,3 +59,3 @@ var isArray = require('lodash').isArray; | ||
Model.prototype._setProperties = function setProperties(opts) { | ||
forEach(opts, this._setModelProperty, this); | ||
forEach(opts, bind(this._setModelProperty, this)); | ||
}; | ||
@@ -157,3 +158,3 @@ | ||
Model.prototype.toJSON = function toJSON() { | ||
var objRepresentation = mapValues(this._properties, function mapModelPropertiesToJSON(val, key) { | ||
var objRepresentation = mapValues(this._properties, bind(function mapModelPropsToJSON(val, key) { | ||
var res; | ||
@@ -172,3 +173,3 @@ | ||
return res; | ||
}, this); | ||
}, this)); | ||
@@ -175,0 +176,0 @@ return objRepresentation; |
{ | ||
"name": "@slack/client", | ||
"version": "3.5.0", | ||
"version": "3.5.1", | ||
"description": "A library for creating a Slack client", | ||
@@ -32,3 +32,3 @@ "main": "./index", | ||
"inherits": "^2.0.1", | ||
"lodash": "^3.10.1", | ||
"lodash": "^4.13.1", | ||
"request": "^2.64.0", | ||
@@ -35,0 +35,0 @@ "retry": "^0.9.0", |
@@ -30,3 +30,3 @@ # Node Library for the Slack APIs | ||
* [Data stores] (#data-stores) | ||
* [Send direct messages] (#send-dms) | ||
* [Send direct messages] (#send-direct-messages) | ||
* [RTM Client Lifecycle](#rtm-client-lifecycle) | ||
@@ -127,7 +127,3 @@ * [Web Client](#web-client) | ||
// Initialise a data store for our client, this will load additional helper functions for the storing and retrieval of data | ||
dataStore: new MemoryDataStore(), | ||
// Boolean indicating whether Slack should automatically reconnect after an error response | ||
autoReconnect: true, | ||
// Boolean indicating whether each message should be marked as read or not after it is processed | ||
autoMark: true | ||
dataStore: new MemoryDataStore() | ||
}); | ||
@@ -134,0 +130,0 @@ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
6710
261628
223
3
- Removedlodash@3.10.1(transitive)
Updatedlodash@^4.13.1