Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@slack/web-api making request and response shapes type-safe, and chat.postMessage arguments prototype #1670

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 4 additions & 15 deletions packages/web-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,16 @@ The `@slack/web-api` package contains a simple, convenient, and configurable HTT

## Requirements

This package supports Node v14 and higher. It's highly recommended to use [the latest LTS version of
This package supports Node v18 and higher. It's highly recommended to use [the latest LTS version of
node](https://github.com/nodejs/Release#release-schedule), and the documentation is written using syntax and features
from that version.

This package also has experimental support for Deno v1.15.2 and higher, though not all features are supported at this
time.

## Installation

### Node.js

```shell
$ npm install @slack/web-api
```

### Deno

```typescript
import { WebClient } from 'https://deno.land/x/slack_web_api/mod.js';
```

<!-- START: Remove before copying into the docs directory -->

## Usage
Expand Down Expand Up @@ -394,6 +383,6 @@ If you get stuck, we're here to help. The following are the best ways to get ass

* [Issue Tracker](http://github.com/slackapi/node-slack-sdk/issues) for questions, feature requests, bug reports and
general discussion related to these packages. Try searching before you create a new issue.
* [Email us](mailto:developers@slack.com) in Slack developer support: `developers@slack.com`
* [Bot Developers Hangout](https://community.botkit.ai/): a Slack community for developers
building all types of bots. You can find the maintainers and users of these packages in **#sdk-node-slack-sdk**.
* [Email us](mailto:feedback@slack.com): `feedback@slack.com`
* [Community Slack](https://community.slack.com/): a Slack community for developers
building all kinds of Slack apps. You can find the maintainers and users of these packages in **#lang-javascript**.
65 changes: 31 additions & 34 deletions packages/web-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
"dist/**/*"
],
"engines": {
"node": ">= 12.13.0",
"npm": ">= 6.12.0"
"node": ">= 18",
"npm": ">= 8.6.0"
},
"repository": "slackapi/node-slack-sdk",
"homepage": "https://slack.dev/node-slack-sdk/web-api",
Expand All @@ -37,51 +37,48 @@
"build": "npm run build:clean && tsc",
"build:clean": "shx rm -rf ./dist ./coverage ./.nyc_output",
"lint": "eslint --ext .ts src",
"test": "npm run lint && npm run build && npm run test:mocha && npm run test:types",
"test:mocha": "nyc mocha --config .mocharc.json src/*.spec.js",
"mocha": "mocha --config .mocharc.json src/*.spec.js",
"test": "npm run lint && npm run test:unit && npm run test:types",
"test:unit": "npm run build && nyc --reporter=text-summary npm run mocha",
"test:types": "tsd",
"coverage": "codecov -F webapi --root=$PWD",
"ref-docs:model": "api-extractor run",
"watch": "npx nodemon --watch 'src' --ext 'ts' --exec npm run build",
"build:deno": "esbuild --bundle --define:process.cwd=String --define:process.version='\"v1.15.2\"' --define:process.title='\"deno\"' --define:Buffer=dummy_buffer --inject:./deno-shims/buffer-shim.js --inject:./deno-shims/xhr-shim.js --target=esnext --format=esm --outfile=./mod.js src/index.ts"
"watch": "npx nodemon --watch 'src' --ext 'ts' --exec npm run build"
},
"dependencies": {
"@slack/logger": "^3.0.0",
"@slack/types": "^2.8.0",
"@types/is-stream": "^1.1.0",
"@types/node": ">=12.0.0",
"axios": "^0.27.2",
"eventemitter3": "^3.1.0",
"form-data": "^2.5.0",
"@slack/logger": "^4.0.0",
"@slack/types": "^2.9.0",
"@types/node": ">=18.0.0",
"axios": "^1.5.1",
"eventemitter3": "^5.0.1",
"form-data": "^4.0.0",
"is-electron": "2.2.2",
"is-stream": "^1.1.0",
"p-queue": "^6.6.1",
"p-retry": "^4.0.0"
"is-stream": "^2.0.0",
"p-queue": "^6.6.2",
"p-retry": "^4.6.1",
"retry": "^0.13.1"
},
"devDependencies": {
"@aoberoi/capture-console": "^1.1.0",
"@microsoft/api-extractor": "^7.3.4",
"@types/chai": "^4.1.7",
"@types/mocha": "^5.2.6",
"@typescript-eslint/eslint-plugin": "^4.4.1",
"@typescript-eslint/parser": "^4.4.0",
"@microsoft/api-extractor": "^7.38.0",
"@types/chai": "^4.3.5",
"@types/mocha": "^10.0.1",
"@typescript-eslint/eslint-plugin": "^6.4.1",
"@typescript-eslint/parser": "^6.4.0",
"busboy": "^1.6.0",
"chai": "^4.2.0",
"codecov": "^3.2.0",
"esbuild": "^0.13.15",
"eslint": "^7.32.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-config-airbnb-typescript": "^12.3.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsdoc": "^30.6.1",
"chai": "^4.3.8",
"eslint": "^8.47.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^17.1.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jsdoc": "^46.5.0",
"eslint-plugin-node": "^11.1.0",
"mocha": "^9.1.0",
"nock": "^13.2.6",
"mocha": "^10.2.0",
"nock": "^13.3.3",
"nyc": "^15.1.0",
"shelljs": "^0.8.3",
"shx": "^0.3.2",
"sinon": "^7.2.7",
"source-map-support": "^0.5.10",
"sinon": "^15.2.0",
"source-map-support": "^0.5.21",
"ts-node": "^10.8.1",
"tsd": "0.29.0",
"typescript": "^4.1"
Expand Down
15 changes: 0 additions & 15 deletions packages/web-api/src/WebClient.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,6 @@ describe('WebClient', function () {
assert.instanceOf(client, WebClient);
assert.notExists(client.axios.defaults.headers.Authorization);
});
it('should not modify global defaults in axios', function () {
// https://github.com/slackapi/node-slack-sdk/issues/1037
const client = new WebClient();

const globalDefault = axios.defaults.headers.post['Content-Type'];
// The axios.default's defaults should not be modified.
// Specifically, defaults.headers.post should be kept as-is
assert.exists(globalDefault);

const instanceDefault = client.axios.defaults.headers.post['Content-Type'];
// WebClient intentionally removes the default Content-Type
// from the underlying AxiosInstance used for performing web API calls
assert.notExists(instanceDefault)
});
});

describe('Methods superclass', function () {
Expand Down Expand Up @@ -149,7 +135,6 @@ describe('WebClient', function () {
assert.equal(error.code, ErrorCode.RequestError);
assert.equal(error.original.config.timeout, timeoutOverride);
assert.equal(error.original.isAxiosError, true);
assert.equal(error.original.request.aborted, true);
done();
} catch (err) {
done(err);
Expand Down
Loading
Loading