Socket
Socket
Sign inDemoInstall

@slack/web-api

Package Overview
Dependencies
Maintainers
13
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@slack/web-api - npm Package Compare versions

Comparing version 6.1.0 to 6.2.0-rc.0

dist/response/AdminAnalyticsGetFileResponse.d.ts

3

dist/methods.js

@@ -132,2 +132,5 @@ "use strict";

invalidate: bindApiCall(this, 'admin.users.session.invalidate'),
getSettings: bindApiCall(this, 'admin.users.session.getSettings'),
setSettings: bindApiCall(this, 'admin.users.session.setSettings'),
clearSettings: bindApiCall(this, 'admin.users.session.clearSettings'),
},

@@ -134,0 +137,0 @@ setAdmin: bindApiCall(this, 'admin.users.setAdmin'),

2

dist/WebClient.d.ts

@@ -105,3 +105,3 @@ /// <reference types="node" />

/**
* Processes an HTTP response into a WebAPICallResult by performing JSON parsing on the body and merging relevent
* Processes an HTTP response into a WebAPICallResult by performing JSON parsing on the body and merging relevant
* HTTP headers into the object.

@@ -108,0 +108,0 @@ * @param response - an http response

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

*/
constructor(token, { slackApiUrl = 'https://slack.com/api/', logger = undefined, logLevel = logger_1.LogLevel.INFO, maxRequestConcurrency = 3, retryConfig = retry_policies_1.default.tenRetriesInAboutThirtyMinutes, agent = undefined, tls = undefined, rejectRateLimitedCalls = false, headers = {}, teamId = undefined, } = {}) {
constructor(token, { slackApiUrl = 'https://slack.com/api/', logger = undefined, logLevel = undefined, maxRequestConcurrency = 3, retryConfig = retry_policies_1.default.tenRetriesInAboutThirtyMinutes, agent = undefined, tls = undefined, rejectRateLimitedCalls = false, headers = {}, teamId = undefined, } = {}) {
super();

@@ -93,3 +93,3 @@ this.token = token;

else {
this.logger = logger_1.getLogger(WebClient.loggerName, logLevel, logger);
this.logger = logger_1.getLogger(WebClient.loggerName, logLevel !== null && logLevel !== void 0 ? logLevel : logger_1.LogLevel.INFO, logger);
}

@@ -125,2 +125,3 @@ this.axios = axios_1.default.create({

warnDeprecations(method, this.logger);
warnIfFallbackIsMissing(method, this.logger, options);
if (typeof options === 'string' || typeof options === 'number' || typeof options === 'boolean') {

@@ -365,3 +366,3 @@ throw new TypeError(`Expected an options argument but instead received a ${typeof options}`);

/**
* Processes an HTTP response into a WebAPICallResult by performing JSON parsing on the body and merging relevent
* Processes an HTTP response into a WebAPICallResult by performing JSON parsing on the body and merging relevant
* HTTP headers into the object.

@@ -460,2 +461,26 @@ * @param response - an http response

}
/**
* Log a warning when using chat.postMessage without text argument or attachments with fallback argument
* @param method api method being called
* @param logger instance of we clients logger
*/
function warnIfFallbackIsMissing(method, logger, options) {
const targetMethods = ['chat.postEphemeral', 'chat.postMessage', 'chat.scheduleMessage', 'chat.update'];
const isTargetMethod = targetMethods.includes(method);
const missingAttachmentFallbackDetected = (args) => Array.isArray(args.attachments)
&& args.attachments.some(attachment => !attachment.fallback || attachment.fallback.trim() === 0);
const isEmptyText = (args) => args.text === undefined || args.text === null || args.text === '';
const buildWarningMessage = (missing) => `The \`${missing}\` argument is missing in the request payload for a ${method} call - ` +
`It's a best practice to always provide a \`${missing}\` argument when posting a message. ` +
`The \`${missing}\` is used in places where the content cannot be rendered such as: ` +
'system push notifications, assistive technology such as screen readers, etc.';
if (isTargetMethod && typeof options === 'object' && isEmptyText(options)) {
if (missingAttachmentFallbackDetected(options)) {
logger.warn(buildWarningMessage('fallback'));
}
else {
logger.warn(buildWarningMessage('text'));
}
}
}
//# sourceMappingURL=WebClient.js.map
{
"name": "@slack/web-api",
"version": "6.1.0",
"version": "6.2.0-rc.0",
"description": "Official library for using the Slack Platform's Web API",

@@ -48,4 +48,4 @@ "author": "Slack Technologies, Inc.",

"dependencies": {
"@slack/logger": ">=1.0.0 <3.0.0",
"@slack/types": "^1.7.0",
"@slack/logger": "^3.0.0",
"@slack/types": "^2.0.0",
"@types/is-stream": "^1.1.0",

@@ -52,0 +52,0 @@ "@types/node": ">=12.0.0",

# Slack Web API
[![build-ci](https://github.com/slackapi/node-slack-sdk/workflows/CI%20Build/badge.svg)](https://github.com/slackapi/node-slack-sdk/actions?query=workflow%3A%22CI+Build%22)
<!-- TODO: per-flag badge https://docs.codecov.io/docs/flags#section-flag-badges-and-graphs -->
[![codecov](https://codecov.io/gh/slackapi/node-slack-sdk/branch/master/graph/badge.svg)](https://codecov.io/gh/slackapi/node-slack-sdk)
<!-- TODO: npm versions with scoped packages: https://github.com/rvagg/nodei.co/issues/24 -->
The `@slack/web-api` package contains a simple, convenient, and configurable HTTP client for making requests to Slack's

@@ -9,0 +4,0 @@ [Web API](https://api.slack.com/web). Use it in your app to call any of the over 130

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

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