Skip to content

Commit

Permalink
Merge branch 'master' into add_code_of_conduct_file
Browse files Browse the repository at this point in the history
  • Loading branch information
clavin committed Jul 25, 2019
2 parents ab6cb64 + dd26e23 commit f4f0a30
Show file tree
Hide file tree
Showing 60 changed files with 2,034 additions and 1,463 deletions.
2 changes: 1 addition & 1 deletion docs/_packages/rtm_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ Import the `HttpsProxyAgent` class, and create an instance that can be used as t

```javascript
const { RTMClient } = require('@slack/rtm-api');
const { HttpsProxyAgent } = require('https-proxy-agent');
const HttpsProxyAgent = require('https-proxy-agent');
const token = process.env.SLACK_BOT_TOKEN;

// One of the ways you can configure HttpsProxyAgent is using a simple string.
Expand Down
2 changes: 1 addition & 1 deletion docs/_packages/web_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ Import the `HttpsProxyAgent` class, and create an instance that can be used as t

```javascript
const { WebClient } = require('@slack/web-api');
const { HttpsProxyAgent } = require('https-proxy-agent');
const HttpsProxyAgent = require('https-proxy-agent');
const token = process.env.SLACK_TOKEN;

// One of the ways you can configure HttpsProxyAgent is using a simple string.
Expand Down
6 changes: 3 additions & 3 deletions docs/_packages/webhook.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ The webhook can be initialized with default arguments that are reused each time
parameter to the constructor to set the default arguments.

```javascript
const IncomingWebhook = require('@slack/webhook');
const { IncomingWebhook } = require('@slack/webhook');
const url = process.env.SLACK_WEBHOOK_URL;

// Initialize with defaults
Expand All @@ -72,7 +72,7 @@ Something interesting just happened in your app, so its time to send the notific
the message. The method returns a `Promise` that resolves once the notification is sent.

```javascript
const IncomingWebhook = require('@slack/webhook');
const { IncomingWebhook } = require('@slack/webhook');
const url = process.env.SLACK_WEBHOOK_URL;

const webhook = new IncomingWebhook(url);
Expand Down Expand Up @@ -107,7 +107,7 @@ Import the `HttpsProxyAgent` class, and create an instance that can be used as t

```javascript
const { IncomingWebhook } = require('@slack/webhook');
const { HttpsProxyAgent } = require('https-proxy-agent');
const HttpsProxyAgent = require('https-proxy-agent');
const url = process.env.SLACK_WEBHOOK_URL;

// One of the ways you can configure HttpsProxyAgent is using a simple string.
Expand Down
68 changes: 63 additions & 5 deletions integration-tests/types/webclient-paginate-types.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,73 @@
// tslint:disable:no-unused-expression
import { WebClient } from '@slack/web-api';
import { WebClient, WebAPICallResult } from '@slack/web-api';

const web = new WebClient();

/* Testing the return type of WebClient#paginate() */

// $ExpectType AsyncIterator<WebAPICallResult>
web.paginate('conversations.list');
/**
* SO. For all intents and purposes, this thing below is just an AsyncIterator. That's what it's meant to be. "So why
* not just put `AsyncIterator`," you ask. Good question. Let me tell you a tale:
*
* In the year 2019, all was happy, all was cheerful. These integration tests $ExpectedType AsyncIterator and this
* redundant interface was naught. Birds chirped with glee. Children played in the fields. Not a thing in the world
* could possibly go wrong.
*
* Then something went wrong. From each cardinal direction a storm approached. Its winds ripped trees from their roots
* and separated hatchlings from their mothers. Mercilessly, the storm tore apart the meadow and everything it
* supported.
*
* This storm has not been forgotten. We keep its bittersweet memory in our hearts. Some cower at the foul beast's name:
* `[email protected]`.
*
* For, you see, this was not your average storm. No, this storm approached instead as something to be celebrated. It
* boasted updated generator types and it advertised comfortable iterator ergonomics. Alas, in hindsight this was but a
* mirage--a trojan horse, even--masquerading the terror that followed. It knocked with its weapon upfront: no longer
* was it `AsyncIterator<T>`, but rather `AsyncIterator<T, TReturn = any, TNext = undefined>`.
*
* It struck right at the edge: the integration tests. For, you see, their foundation is dtslint, which (at the time of
* the storm) tests against each minor release of TypeScript from 2.0 all the way to `typescript@next`. Whilst usage
* remain unaffected, the same could not be said of our types integration tests. These tests now failed, for their
* single generic argument was unequal to the three dtslint expected.
*
* Our most trustworthy guard, Travis (CI), attempted to warn us of the dangerous storm, but by the time the message
* reached us the damage was done. Builds were failing. PRs reported failures. Builds were a sea of red ✗'s (read: a sea
* of blood).
*
* This is why we've enacted this memorial: the __DangerouslyOutmodedAsyncIteratorSignatureWrapper. Its purpose is not
* only to remember the sorrows of past maintiners, but to also appease the storm by wrapping `AsyncIterator` in a new
* type that is fully equivalent, yet named different under `$ExpectType` (that is, the same across TypeScript
* versions).
*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*
* Just as there is a calm before the storm, there must also be one after.
*
* We dream of a day where dtslint only runs a specific range of supported versions. We dream of a day where dtslint can
* see the equality of an expected type without explicit defaults and the type with its defaults filled in[1]. We dream
* of a future after the storm.
*
* Once we reach that future, this memorial will have served its purpose[2]. It will be safe to remove in that future we
* dream of.
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* [1]: That is, `AsyncIterator<T>` is equal to `AsyncIterator<T, any, undefined>` because the defaults cause them to
* become equal.
* [2]: This interface is no longer needed once TypeScript 3.6 or higher is the supported range, or once dtslint can
* better compare type assertions.
*
* For more information, search the history books for PR #836.
*/
interface __DangerouslyOutmodedAsyncIteratorSignatureWrapper<T> extends AsyncIterator<T> {
// same as AsyncIterator<T>.
}

// $ExpectType AsyncIterator<WebAPICallResult>
web.paginate('conversations.list', {});
// $ExpectType __DangerouslyOutmodedAsyncIteratorSignatureWrapper<WebAPICallResult>
web.paginate('conversations.list') as __DangerouslyOutmodedAsyncIteratorSignatureWrapper<WebAPICallResult>;

// $ExpectType __DangerouslyOutmodedAsyncIteratorSignatureWrapper<WebAPICallResult>
web.paginate('conversations.list', {}) as __DangerouslyOutmodedAsyncIteratorSignatureWrapper<WebAPICallResult>;

// $ExpectType Promise<void>
web.paginate('conversations.list', {}, () => false);
Expand Down
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"npm": ">= 5.5.1"
},
"repository": "slackapi/node-slack-sdk",
"homepage": "https://slack.dev/node-slack-sdk/tutorials/migrating-to-v5/",
"homepage": "https://slack.dev/node-slack-sdk/tutorials/migrating-to-v5",
"publishConfig": {
"access": "public"
},
Expand Down
6 changes: 0 additions & 6 deletions packages/events-api/.babelrc

This file was deleted.

4 changes: 0 additions & 4 deletions packages/events-api/.eslintignore

This file was deleted.

3 changes: 3 additions & 0 deletions packages/events-api/.mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"require": ["ts-node/register", "source-map-support/register"]
}
14 changes: 14 additions & 0 deletions packages/events-api/.nycrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"include": [
"src/**/*.ts"
],
"exclude": [
"**/*.spec.js"
],
"reporter": ["lcov"],
"extension": [
".ts"
],
"all": false,
"cache": true
}
3 changes: 3 additions & 0 deletions packages/events-api/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typescript.tsdk": "./node_modules/typescript/lib"
}
36 changes: 19 additions & 17 deletions packages/events-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,40 +36,42 @@
},
"scripts": {
"prepare": "npm run build",
"build": "babel src -d dist --source-maps both",
"lint": "eslint src test",
"test": "npm run build && nyc --reporter=html mocha test/**/*.js",
"coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov -F eventsapi"
"build": "npm run build:clean && tsc",
"build:clean": "shx rm -rf ./dist ./coverage ./.nyc_output",
"lint": "tslint --project .",
"test": "nyc mocha --config .mocharc.json src/*.spec.js test/integration/*.js",
"coverage": "codecov -F eventsapi --root=$PWD"
},
"dependencies": {
"@types/debug": "^4.1.4",
"@types/express": "^4.17.0",
"@types/lodash.isstring": "^4.0.6",
"@types/node": ">=4.2.0",
"@types/yargs": "^13.0.0",
"debug": "^2.6.1",
"lodash.isstring": "^4.0.1",
"raw-body": "^2.3.3",
"tsscmp": "^1.0.6",
"yargs": "^6.6.0"
},
"devDependencies": {
"babel-cli": "^6.18.0",
"babel-eslint": "^7.1.1",
"babel-preset-es2015": "^6.18.0",
"babel-preset-es2016": "^6.16.0",
"chai": "^4.1.2",
"chai": "^4.2.0",
"codecov": "^3.0.4",
"eslint": "^3.12.2",
"eslint-config-airbnb": "^13.0.0",
"eslint-config-airbnb-base": "^11.0.0",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^2.2.3",
"eslint-plugin-react": "^6.8.0",
"express": "^4.14.0",
"get-random-port": "0.0.1",
"lodash.isfunction": "^3.0.8",
"mocha": "^5.2.0",
"mocha": "^6.1.4",
"nop": "^1.0.0",
"nyc": "^12.0.2",
"nyc": "^14.1.1",
"proxyquire": "^1.7.10",
"shx": "^0.3.2",
"sinon": "^4.5.0",
"source-map-support": "^0.5.12",
"superagent": "^3.3.1",
"ts-node": "^8.2.0",
"tslint": "^5.17.0",
"tslint-config-airbnb": "^5.11.1",
"typescript": "^3.5.1",
"uncaughtException": "^1.0.0"
},
"optionalDependencies": {
Expand Down
7 changes: 0 additions & 7 deletions packages/events-api/src/.eslintrc

This file was deleted.

81 changes: 0 additions & 81 deletions packages/events-api/src/adapter.js

This file was deleted.

Loading

0 comments on commit f4f0a30

Please sign in to comment.