diff --git a/lint-configs/.eslintrc.js b/lint-configs/.eslintrc.js index 06b8ba60d..32946c517 100644 --- a/lint-configs/.eslintrc.js +++ b/lint-configs/.eslintrc.js @@ -247,6 +247,23 @@ module.exports = { }, ], + // Rules about import ordering/sorting + 'import/order': ['error', { + 'groups': [ + 'builtin', + 'external', + 'internal', + ['parent', 'sibling', 'index'], + 'object', + 'type' + ], + 'newlines-between': 'always', + 'alphabetize': { + 'order': 'asc', + 'caseInsensitive': true + } + }], + 'sort-imports': ['error', { 'ignoreDeclarationSort': true }], // Allow cyclical imports. Turning this rule on is mainly a way to manage the performance concern for linting // time. Our projects are not large enough to warrant this. Overrides AirBnB styles. 'import/no-cycle': 'off', diff --git a/packages/cli-test/package.json b/packages/cli-test/package.json index dae155240..27df5f45b 100644 --- a/packages/cli-test/package.json +++ b/packages/cli-test/package.json @@ -21,7 +21,7 @@ "url": "https://github.com/slackapi/node-slack-sdk/issues" }, "scripts": { - "lint": "eslint --ext .ts src", + "lint": "eslint --fix --ext .ts src", "build": "npm run build:clean && tsc", "build:clean": "shx rm -rf ./dist ./coverage", "prepare": "npm run build", diff --git a/packages/cli-test/src/cli/cli-process.spec.ts b/packages/cli-test/src/cli/cli-process.spec.ts index d55db6be1..6f7aaf025 100644 --- a/packages/cli-test/src/cli/cli-process.spec.ts +++ b/packages/cli-test/src/cli/cli-process.spec.ts @@ -1,7 +1,8 @@ import { assert } from 'chai'; import sinon from 'sinon'; -import { shell } from './shell'; + import { SlackCLIProcess } from './cli-process'; +import { shell } from './shell'; describe('SlackCLIProcess class', () => { const sandbox = sinon.createSandbox(); diff --git a/packages/cli-test/src/cli/cli-process.ts b/packages/cli-test/src/cli/cli-process.ts index 5111a02ad..bbebd8550 100644 --- a/packages/cli-test/src/cli/cli-process.ts +++ b/packages/cli-test/src/cli/cli-process.ts @@ -1,6 +1,7 @@ -import type { SpawnOptionsWithoutStdio } from 'node:child_process'; import { shell } from './shell'; + import type { ShellProcess } from '../utils/types'; +import type { SpawnOptionsWithoutStdio } from 'node:child_process'; /* * some parameters used in the 'shell' calls that are CLI-specific and probably should not exist there: * @param skipUpdate skip auto update notification diff --git a/packages/cli-test/src/cli/commands/auth.ts b/packages/cli-test/src/cli/commands/auth.ts index d1cbdda11..eabc89ccc 100644 --- a/packages/cli-test/src/cli/commands/auth.ts +++ b/packages/cli-test/src/cli/commands/auth.ts @@ -1,7 +1,8 @@ -import type { ShellProcess } from '../../utils/types'; -import { SlackCLIProcess, SlackCLIGlobalOptions, SlackCLICommandOptions } from '../cli-process'; +import { SlackCLICommandOptions, SlackCLIGlobalOptions, SlackCLIProcess } from '../cli-process'; import commandError from '../command-error'; +import type { ShellProcess } from '../../utils/types'; + export default { /** * `slack login --no-prompt` diff --git a/packages/cli-test/src/cli/commands/create.ts b/packages/cli-test/src/cli/commands/create.ts index 0e5e2093f..20d68598e 100644 --- a/packages/cli-test/src/cli/commands/create.ts +++ b/packages/cli-test/src/cli/commands/create.ts @@ -1,5 +1,6 @@ import { SpawnOptionsWithoutStdio } from 'node:child_process'; -import { SlackCLIProcess, SlackCLICommandOptions, SlackCLIGlobalOptions } from '../cli-process'; + +import { SlackCLICommandOptions, SlackCLIGlobalOptions, SlackCLIProcess } from '../cli-process'; import commandError from '../command-error'; /** diff --git a/packages/cli-test/src/cli/commands/platform.ts b/packages/cli-test/src/cli/commands/platform.ts index 156f1dc55..d592677a5 100644 --- a/packages/cli-test/src/cli/commands/platform.ts +++ b/packages/cli-test/src/cli/commands/platform.ts @@ -1,9 +1,10 @@ +import { SlackTracerId } from '../../utils/constants'; import logger from '../../utils/logger'; import { SlackCLIProcess } from '../cli-process'; +import commandError from '../command-error'; import { shell } from '../shell'; + import type { ShellProcess } from '../../utils/types'; -import commandError from '../command-error'; -import { SlackTracerId } from '../../utils/constants'; // TODO: the options for these methods could be DRYed up diff --git a/packages/cli-test/src/cli/index.spec.ts b/packages/cli-test/src/cli/index.spec.ts index ae0f736ad..87887a8ae 100644 --- a/packages/cli-test/src/cli/index.spec.ts +++ b/packages/cli-test/src/cli/index.spec.ts @@ -1,6 +1,7 @@ import sinon from 'sinon'; -import logger from '../utils/logger'; + import { SlackCLI } from './index'; +import logger from '../utils/logger'; describe('cli module', () => { const sandbox = sinon.createSandbox(); diff --git a/packages/cli-test/src/cli/index.ts b/packages/cli-test/src/cli/index.ts index 0af5c6c0d..0a566e476 100644 --- a/packages/cli-test/src/cli/index.ts +++ b/packages/cli-test/src/cli/index.ts @@ -1,6 +1,6 @@ import * as fs from 'node:fs'; import * as path from 'node:path'; -import logger from '../utils/logger'; + import appCommands from './commands/app'; import authCommands from './commands/auth'; import collaboratorCommands from './commands/collaborator'; @@ -11,6 +11,7 @@ import functionCommands from './commands/function'; import manifestCommands from './commands/manifest'; import platformCommands from './commands/platform'; import triggerCommands from './commands/trigger'; +import logger from '../utils/logger'; /** * Set of functions to spawn and interact with Slack Platform CLI processes and commands diff --git a/packages/cli-test/src/cli/shell.spec.ts b/packages/cli-test/src/cli/shell.spec.ts index 2adefa2f6..57cb5d67d 100644 --- a/packages/cli-test/src/cli/shell.spec.ts +++ b/packages/cli-test/src/cli/shell.spec.ts @@ -1,9 +1,12 @@ -import { assert } from 'chai'; -import sinon from 'sinon'; import child from 'child_process'; -import stream from 'stream'; import EventEmitter from 'events'; +import stream from 'stream'; + +import { assert } from 'chai'; +import sinon from 'sinon'; + import { shell } from './shell'; + import type { ShellProcess } from '../utils/types'; describe('shell module', () => { diff --git a/packages/cli-test/src/cli/shell.ts b/packages/cli-test/src/cli/shell.ts index 7df1f7496..26d0a40cd 100644 --- a/packages/cli-test/src/cli/shell.ts +++ b/packages/cli-test/src/cli/shell.ts @@ -1,7 +1,10 @@ import child from 'child_process'; + import treekill from 'tree-kill'; -import logger from '../utils/logger'; + import { timeouts } from '../utils/constants'; +import logger from '../utils/logger'; + import type { ShellProcess } from '../utils/types'; export const shell = { diff --git a/packages/cli-test/src/index.spec.ts b/packages/cli-test/src/index.spec.ts index ab1645d5c..b6ef216b9 100644 --- a/packages/cli-test/src/index.spec.ts +++ b/packages/cli-test/src/index.spec.ts @@ -1,5 +1,6 @@ import { assert } from 'chai'; import sinon from 'sinon'; + import { SlackCLI, SlackTracerId } from '.'; describe('main module', () => { diff --git a/packages/cli-test/src/utils/logger.ts b/packages/cli-test/src/utils/logger.ts index 12910a48f..294594c96 100644 --- a/packages/cli-test/src/utils/logger.ts +++ b/packages/cli-test/src/utils/logger.ts @@ -1,4 +1,4 @@ -import { createLogger, format, transports, Logger } from 'winston'; +import { Logger, createLogger, format, transports } from 'winston'; // Configure CLI log level // Winston logging levels, see: https://github.com/winstonjs/winston#logging diff --git a/packages/logger/package.json b/packages/logger/package.json index 6ee773304..a121b1b81 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -29,7 +29,7 @@ "prepare": "npm run build", "build": "npm run build:clean && tsc", "build:clean": "shx rm -rf ./dist ./coverage", - "lint": "eslint --ext .ts src", + "lint": "eslint --fix --ext .ts src", "mocha": "mocha --config .mocharc.json src/*.spec.js", "test:unit": "npm run build && npm run mocha", "test": "npm run lint && npm run coverage", diff --git a/packages/oauth/src/callback-options.spec.ts b/packages/oauth/src/callback-options.spec.ts index 411649a40..b8cb3817f 100644 --- a/packages/oauth/src/callback-options.spec.ts +++ b/packages/oauth/src/callback-options.spec.ts @@ -1,7 +1,8 @@ +import { IncomingMessage, ServerResponse } from 'http'; + import { assert } from 'chai'; import { describe, it } from 'mocha'; import sinon from 'sinon'; -import { IncomingMessage, ServerResponse } from 'http'; import { CallbackOptions, escapeHtml } from './callback-options'; import { MissingStateError } from './errors'; diff --git a/packages/oauth/src/callback-options.ts b/packages/oauth/src/callback-options.ts index a37968bf0..7e4f06a7f 100644 --- a/packages/oauth/src/callback-options.ts +++ b/packages/oauth/src/callback-options.ts @@ -1,4 +1,5 @@ import { IncomingMessage, ServerResponse } from 'http'; + import { CodedError, ErrorCode } from './errors'; import { InstallURLOptions } from './install-url-options'; import { Installation, OrgInstallation } from './installation'; diff --git a/packages/oauth/src/install-path-options.spec.ts b/packages/oauth/src/install-path-options.spec.ts index c168554fd..43ecb19f2 100644 --- a/packages/oauth/src/install-path-options.spec.ts +++ b/packages/oauth/src/install-path-options.spec.ts @@ -1,7 +1,8 @@ +import { IncomingMessage, ServerResponse } from 'http'; + import { assert } from 'chai'; import { describe, it } from 'mocha'; import sinon from 'sinon'; -import { IncomingMessage, ServerResponse } from 'http'; import { InstallPathOptions } from './install-path-options'; diff --git a/packages/oauth/src/install-path-options.ts b/packages/oauth/src/install-path-options.ts index a95d18e91..b1c6733b5 100644 --- a/packages/oauth/src/install-path-options.ts +++ b/packages/oauth/src/install-path-options.ts @@ -1,4 +1,5 @@ import { IncomingMessage, ServerResponse } from 'http'; + import { InstallURLOptions } from './install-url-options'; /** diff --git a/packages/oauth/src/install-provider-options.spec.ts b/packages/oauth/src/install-provider-options.spec.ts index e2245d5b5..40df9c299 100644 --- a/packages/oauth/src/install-provider-options.spec.ts +++ b/packages/oauth/src/install-provider-options.spec.ts @@ -1,5 +1,6 @@ import { assert } from 'chai'; import { describe, it } from 'mocha'; + import { InstallProviderOptions } from './install-provider-options'; describe('InstallProviderOptions', async () => { diff --git a/packages/oauth/src/install-provider-options.ts b/packages/oauth/src/install-provider-options.ts index a4aa79972..bc9583fab 100644 --- a/packages/oauth/src/install-provider-options.ts +++ b/packages/oauth/src/install-provider-options.ts @@ -1,8 +1,9 @@ -import { Logger, LogLevel } from '@slack/logger'; +import { LogLevel, Logger } from '@slack/logger'; import { WebClientOptions } from '@slack/web-api'; -import { StateStore } from './state-stores'; -import { InstallationStore } from './installation-stores'; + import { InstallURLOptions } from './install-url-options'; +import { InstallationStore } from './installation-stores'; +import { StateStore } from './state-stores'; export interface InstallProviderOptions { diff --git a/packages/oauth/src/install-provider.ts b/packages/oauth/src/install-provider.ts index 5d15a3e3e..a27054f8c 100644 --- a/packages/oauth/src/install-provider.ts +++ b/packages/oauth/src/install-provider.ts @@ -1,30 +1,30 @@ import { IncomingMessage, ServerResponse } from 'http'; -import { URLSearchParams, URL } from 'url'; +import { URL, URLSearchParams } from 'url'; import { WebAPICallResult, WebClient, WebClientOptions } from '@slack/web-api'; import { AuthorizeResult } from './authorize-result'; import { CallbackOptions, defaultCallbackFailure, defaultCallbackSuccess } from './callback-options'; +import defaultRenderHtmlForInstallPath from './default-render-html-for-install-path'; import { - InstallerInitializationError, - UnknownError, - MissingStateError, - InvalidStateError, - MissingCodeError, - GenerateInstallUrlError, AuthorizationError, CodedError, ErrorCode, + GenerateInstallUrlError, + InstallerInitializationError, + InvalidStateError, + MissingCodeError, + MissingStateError, + UnknownError, } from './errors'; +import { InstallPathOptions } from './install-path-options'; +import { InstallProviderOptions } from './install-provider-options'; +import { InstallURLOptions } from './install-url-options'; import { Installation } from './installation'; import { InstallationQuery } from './installation-query'; -import { InstallURLOptions } from './install-url-options'; -import { InstallProviderOptions } from './install-provider-options'; -import { Logger, LogLevel, getLogger } from './logger'; -import { ClearStateStore, StateStore } from './state-stores'; import { InstallationStore, MemoryInstallationStore } from './installation-stores'; -import defaultRenderHtmlForInstallPath from './default-render-html-for-install-path'; -import { InstallPathOptions } from './install-path-options'; +import { LogLevel, Logger, getLogger } from './logger'; +import { ClearStateStore, StateStore } from './state-stores'; /** * InstallProvider Class. Refer to InsallProviderOptions interface for the details of constructor arguments. diff --git a/packages/oauth/src/install-url-options.spec.ts b/packages/oauth/src/install-url-options.spec.ts index 3c1b2b70e..0916e1bdf 100644 --- a/packages/oauth/src/install-url-options.spec.ts +++ b/packages/oauth/src/install-url-options.spec.ts @@ -1,5 +1,6 @@ import { assert } from 'chai'; import { describe, it } from 'mocha'; + import { InstallURLOptions } from './install-url-options'; describe('InstallURLOptions', async () => { diff --git a/packages/oauth/src/installation-query.spec.ts b/packages/oauth/src/installation-query.spec.ts index 371c1667c..529f8bc45 100644 --- a/packages/oauth/src/installation-query.spec.ts +++ b/packages/oauth/src/installation-query.spec.ts @@ -1,5 +1,6 @@ import { assert } from 'chai'; import { describe, it } from 'mocha'; + import { InstallationQuery } from './installation-query'; describe('InstallationQuery', async () => { diff --git a/packages/oauth/src/installation-stores/file-store.ts b/packages/oauth/src/installation-stores/file-store.ts index c31b9f3c7..fca180953 100644 --- a/packages/oauth/src/installation-stores/file-store.ts +++ b/packages/oauth/src/installation-stores/file-store.ts @@ -1,7 +1,8 @@ import fs from 'fs'; -import path from 'path'; import { homedir } from 'os'; -import { Installation, InstallationStore, InstallationQuery } from '../index'; +import path from 'path'; + +import { Installation, InstallationQuery, InstallationStore } from '../index'; import { Logger } from '../logger'; export interface FileInstallationOptions { diff --git a/packages/oauth/src/installation-stores/interface.ts b/packages/oauth/src/installation-stores/interface.ts index bb6260716..1c363724b 100644 --- a/packages/oauth/src/installation-stores/interface.ts +++ b/packages/oauth/src/installation-stores/interface.ts @@ -1,4 +1,5 @@ import { Logger } from '@slack/logger'; + import { Installation, InstallationQuery } from '..'; export interface InstallationStore { diff --git a/packages/oauth/src/installation-stores/memory-store.ts b/packages/oauth/src/installation-stores/memory-store.ts index b68fae356..a20b07491 100644 --- a/packages/oauth/src/installation-stores/memory-store.ts +++ b/packages/oauth/src/installation-stores/memory-store.ts @@ -1,4 +1,4 @@ -import { Installation, InstallationStore, InstallationQuery, OrgInstallation } from '../index'; +import { Installation, InstallationQuery, InstallationStore, OrgInstallation } from '../index'; import { Logger } from '../logger'; // using a javascript object as a makeshift database for development diff --git a/packages/oauth/src/installation.spec.ts b/packages/oauth/src/installation.spec.ts index f785da49d..856511a3c 100644 --- a/packages/oauth/src/installation.spec.ts +++ b/packages/oauth/src/installation.spec.ts @@ -1,5 +1,6 @@ import { assert } from 'chai'; import { describe, it } from 'mocha'; + import { Installation } from './installation'; describe('Installation', async () => { diff --git a/packages/oauth/src/logger.ts b/packages/oauth/src/logger.ts index d8b7d7421..5d98b1477 100644 --- a/packages/oauth/src/logger.ts +++ b/packages/oauth/src/logger.ts @@ -1,4 +1,4 @@ -import { Logger, LogLevel, ConsoleLogger } from '@slack/logger'; +import { ConsoleLogger, LogLevel, Logger } from '@slack/logger'; export { Logger, LogLevel } from '@slack/logger'; diff --git a/packages/oauth/src/state-stores/clear-state-store.ts b/packages/oauth/src/state-stores/clear-state-store.ts index 12e55f0d1..465b7fc71 100644 --- a/packages/oauth/src/state-stores/clear-state-store.ts +++ b/packages/oauth/src/state-stores/clear-state-store.ts @@ -1,7 +1,8 @@ import { sign, verify } from 'jsonwebtoken'; -import { InstallURLOptions } from '../install-url-options'; -import { StateStore, StateObj } from './interface'; + +import { StateObj, StateStore } from './interface'; import { InvalidStateError } from '../errors'; +import { InstallURLOptions } from '../install-url-options'; // default implementation of StateStore export default class ClearStateStore implements StateStore { diff --git a/packages/oauth/src/state-stores/file-state-store.spec.ts b/packages/oauth/src/state-stores/file-state-store.spec.ts index 803d51602..97295fe69 100644 --- a/packages/oauth/src/state-stores/file-state-store.spec.ts +++ b/packages/oauth/src/state-stores/file-state-store.spec.ts @@ -1,4 +1,5 @@ import os from 'os'; + import { FileStateStore } from './file-state-store'; import { StateStoreChaiTestRunner } from './spec-utils'; diff --git a/packages/oauth/src/state-stores/file-state-store.ts b/packages/oauth/src/state-stores/file-state-store.ts index d91d59fc4..8d1bdb5ea 100644 --- a/packages/oauth/src/state-stores/file-state-store.ts +++ b/packages/oauth/src/state-stores/file-state-store.ts @@ -1,10 +1,12 @@ -import { homedir } from 'os'; import fs from 'fs'; +import { homedir } from 'os'; import path from 'path'; + import { ConsoleLogger, Logger } from '@slack/logger'; -import { StateStore, StateObj } from './interface'; -import { InstallURLOptions } from '../install-url-options'; + +import { StateObj, StateStore } from './interface'; import { InvalidStateError } from '../errors'; +import { InstallURLOptions } from '../install-url-options'; export interface FileStateStoreArgs { stateExpirationSeconds?: number; diff --git a/packages/oauth/src/state-stores/spec-utils.ts b/packages/oauth/src/state-stores/spec-utils.ts index 5f8361f3e..59ee22efe 100644 --- a/packages/oauth/src/state-stores/spec-utils.ts +++ b/packages/oauth/src/state-stores/spec-utils.ts @@ -1,6 +1,7 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable import/no-extraneous-dependencies */ import { assert } from 'chai'; + import { StateStore } from './interface'; import { InstallURLOptions } from '../install-url-options'; diff --git a/packages/rtm-api/src/KeepAlive.ts b/packages/rtm-api/src/KeepAlive.ts index 6c043e0e6..831881b45 100644 --- a/packages/rtm-api/src/KeepAlive.ts +++ b/packages/rtm-api/src/KeepAlive.ts @@ -1,7 +1,8 @@ import { EventEmitter } from 'eventemitter3'; -import { RTMClient } from './RTMClient'; + +import { CodedError, ErrorCode } from './errors'; import { LogLevel, Logger, getLogger } from './logger'; -import { ErrorCode, CodedError } from './errors'; +import { RTMClient } from './RTMClient'; export interface KeepAliveOptions { logger?: Logger; diff --git a/packages/rtm-api/src/RTMClient.ts b/packages/rtm-api/src/RTMClient.ts index 253f9dedb..42ae8f4c9 100644 --- a/packages/rtm-api/src/RTMClient.ts +++ b/packages/rtm-api/src/RTMClient.ts @@ -1,31 +1,31 @@ import { Agent } from 'http'; -import { EventEmitter } from 'eventemitter3'; -import WebSocket from 'ws'; -import Finity, { StateMachine } from 'finity'; -import PQueue from 'p-queue'; -import PCancelable from 'p-cancelable'; import { - WebClient, - WebAPICallResult, - WebAPICallError, ErrorCode as APICallErrorCode, - RetryOptions, - TLSOptions, RTMConnectArguments, RTMStartArguments, + RetryOptions, + TLSOptions, + WebAPICallError, + WebAPICallResult, + WebClient, addAppMetadata, } from '@slack/web-api'; +import { EventEmitter } from 'eventemitter3'; +import Finity, { StateMachine } from 'finity'; +import PCancelable from 'p-cancelable'; +import PQueue from 'p-queue'; +import WebSocket from 'ws'; -import { KeepAlive } from './KeepAlive'; -import { LogLevel, Logger, getLogger } from './logger'; import { - websocketErrorWithOriginal, - platformErrorFromEvent, noReplyReceivedError, + platformErrorFromEvent, sendWhileDisconnectedError, sendWhileNotReadyError, + websocketErrorWithOriginal, } from './errors'; +import { KeepAlive } from './KeepAlive'; +import { LogLevel, Logger, getLogger } from './logger'; const packageJson = require('../package.json'); // eslint-disable-line import/no-commonjs, @typescript-eslint/no-var-requires diff --git a/packages/rtm-api/src/logger.ts b/packages/rtm-api/src/logger.ts index 9d83aa562..db9318513 100644 --- a/packages/rtm-api/src/logger.ts +++ b/packages/rtm-api/src/logger.ts @@ -1,4 +1,4 @@ -import { Logger, LogLevel, ConsoleLogger } from '@slack/logger'; +import { ConsoleLogger, LogLevel, Logger } from '@slack/logger'; export { Logger, LogLevel } from '@slack/logger'; diff --git a/packages/socket-mode/package.json b/packages/socket-mode/package.json index d1d7e7408..8d4ce02e9 100644 --- a/packages/socket-mode/package.json +++ b/packages/socket-mode/package.json @@ -39,7 +39,7 @@ "prepare": "npm run build", "build": "npm run build:clean && tsc", "build:clean": "shx rm -rf ./dist ./coverage", - "lint": "eslint --ext .ts src", + "lint": "eslint --fix --ext .ts src", "test:unit": "mocha --config .mocharc.json src/**/*.spec.ts", "test:coverage": "c8 npm run test:unit", "test:integration": "mocha --config .mocharc.json test/integration.spec.js", diff --git a/packages/socket-mode/src/SlackWebSocket.spec.ts b/packages/socket-mode/src/SlackWebSocket.spec.ts index 2781553c4..4ceb86bfa 100644 --- a/packages/socket-mode/src/SlackWebSocket.spec.ts +++ b/packages/socket-mode/src/SlackWebSocket.spec.ts @@ -1,7 +1,8 @@ +import { ConsoleLogger } from '@slack/logger'; import { assert } from 'chai'; -import sinon from 'sinon'; import EventEmitter from 'eventemitter3'; -import { ConsoleLogger } from '@slack/logger'; +import sinon from 'sinon'; + import logModule from './logger'; import { SlackWebSocket } from './SlackWebSocket'; diff --git a/packages/socket-mode/src/SlackWebSocket.ts b/packages/socket-mode/src/SlackWebSocket.ts index 026714948..f2606b234 100644 --- a/packages/socket-mode/src/SlackWebSocket.ts +++ b/packages/socket-mode/src/SlackWebSocket.ts @@ -1,8 +1,10 @@ -import { ClientOptions as WebSocketClientOptions, WebSocket } from 'ws'; import { Agent } from 'http'; + import { EventEmitter } from 'eventemitter3'; -import log, { LogLevel, Logger } from './logger'; +import { WebSocket, ClientOptions as WebSocketClientOptions } from 'ws'; + import { websocketErrorWithOriginal } from './errors'; +import log, { LogLevel, Logger } from './logger'; // Maps ws `readyState` to human readable labels https://github.com/websockets/ws/blob/HEAD/doc/ws.md#ready-state-constants export const WS_READY_STATES = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED']; diff --git a/packages/socket-mode/src/SocketModeClient.spec.ts b/packages/socket-mode/src/SocketModeClient.spec.ts index 96d67617e..118d5314b 100644 --- a/packages/socket-mode/src/SocketModeClient.spec.ts +++ b/packages/socket-mode/src/SocketModeClient.spec.ts @@ -1,6 +1,7 @@ +import { ConsoleLogger } from '@slack/logger'; import { assert } from 'chai'; import sinon from 'sinon'; -import { ConsoleLogger } from '@slack/logger'; + import logModule from './logger'; import { SocketModeClient } from './SocketModeClient'; diff --git a/packages/socket-mode/src/SocketModeClient.ts b/packages/socket-mode/src/SocketModeClient.ts index 870fdacd2..c03023094 100644 --- a/packages/socket-mode/src/SocketModeClient.ts +++ b/packages/socket-mode/src/SocketModeClient.ts @@ -1,22 +1,23 @@ -import { EventEmitter } from 'eventemitter3'; -import WebSocket from 'ws'; import { - WebClient, + ErrorCode as APICallErrorCode, AppsConnectionsOpenResponse, WebAPICallError, - ErrorCode as APICallErrorCode, - addAppMetadata, + WebClient, WebClientOptions, + addAppMetadata, } from '@slack/web-api'; -import log, { LogLevel, Logger } from './logger'; +import { EventEmitter } from 'eventemitter3'; +import WebSocket from 'ws'; + import { - websocketErrorWithOriginal, sendWhileDisconnectedError, sendWhileNotReadyError, + websocketErrorWithOriginal, } from './errors'; -import { UnrecoverableSocketModeStartError } from './UnrecoverableSocketModeStartError'; -import { SocketModeOptions } from './SocketModeOptions'; +import log, { LogLevel, Logger } from './logger'; import { SlackWebSocket, WS_READY_STATES } from './SlackWebSocket'; +import { SocketModeOptions } from './SocketModeOptions'; +import { UnrecoverableSocketModeStartError } from './UnrecoverableSocketModeStartError'; import packageJson from '../package.json'; // Lifecycle events as described in the README diff --git a/packages/socket-mode/src/SocketModeOptions.ts b/packages/socket-mode/src/SocketModeOptions.ts index a55fc15f8..5e2856098 100644 --- a/packages/socket-mode/src/SocketModeOptions.ts +++ b/packages/socket-mode/src/SocketModeOptions.ts @@ -1,5 +1,5 @@ -import type { WebClientOptions } from '@slack/web-api'; import type { LogLevel, Logger } from './logger'; +import type { WebClientOptions } from '@slack/web-api'; export interface SocketModeOptions { /** diff --git a/packages/socket-mode/src/logger.ts b/packages/socket-mode/src/logger.ts index eb3e182e2..4ff13337f 100644 --- a/packages/socket-mode/src/logger.ts +++ b/packages/socket-mode/src/logger.ts @@ -1,4 +1,4 @@ -import { Logger, LogLevel, ConsoleLogger } from '@slack/logger'; +import { ConsoleLogger, LogLevel, Logger } from '@slack/logger'; export { Logger, LogLevel }; diff --git a/packages/types/package.json b/packages/types/package.json index 5783bd970..594779d79 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -31,7 +31,7 @@ "prepare": "npm run build", "build": "npm run build:clean && tsc", "build:clean": "shx rm -rf ./dist", - "lint": "eslint --ext .ts src", + "lint": "eslint --fix --ext .ts src", "test": "npm run lint && npm run build && npm run test:types", "test:types": "tsd", "ref-docs:model": "api-extractor run" diff --git a/packages/types/src/block-kit/block-elements.ts b/packages/types/src/block-kit/block-elements.ts index 2447c73a5..00ba2420b 100644 --- a/packages/types/src/block-kit/block-elements.ts +++ b/packages/types/src/block-kit/block-elements.ts @@ -1,5 +1,14 @@ // This file contains objects documented here: https://api.slack.com/reference/block-kit/block-elements +import { RichTextBlock } from './blocks'; +import { + ColorScheme, + Option, + PlainTextElement, + PlainTextOption, + SlackFileImageObject, + UrlImageObject, +} from './composition-objects'; import { Actionable, Confirmable, @@ -11,15 +20,6 @@ import { RichTextStyleable, URLRespondable, } from './extensions'; -import { - ColorScheme, - Option, - PlainTextElement, - PlainTextOption, - SlackFileImageObject, - UrlImageObject, -} from './composition-objects'; -import { RichTextBlock } from './blocks'; /** * @description Allows users a direct path to performing basic actions. diff --git a/packages/types/src/block-kit/blocks.ts b/packages/types/src/block-kit/blocks.ts index e9a157367..101ca11c5 100644 --- a/packages/types/src/block-kit/blocks.ts +++ b/packages/types/src/block-kit/blocks.ts @@ -1,15 +1,9 @@ // This file contains objects documented here: https://api.slack.com/reference/block-kit/blocks -import { - PlainTextElement, - TextObject, - UrlImageObject, - SlackFileImageObject, -} from './composition-objects'; import { Button, Checkboxes, - Datepicker, DateTimepicker, + Datepicker, EmailInput, FileInput, ImageElement, @@ -18,16 +12,22 @@ import { Overflow, PlainTextInput, RadioButtons, + RichTextInput, + RichTextList, + RichTextPreformatted, + RichTextQuote, + RichTextSection, Select, Timepicker, URLInput, WorkflowButton, - RichTextSection, - RichTextList, - RichTextQuote, - RichTextPreformatted, - RichTextInput, } from './block-elements'; +import { + PlainTextElement, + SlackFileImageObject, + TextObject, + UrlImageObject, +} from './composition-objects'; export interface Block { /** diff --git a/packages/types/src/block-kit/extensions.ts b/packages/types/src/block-kit/extensions.ts index 81feee8f8..5204f414f 100644 --- a/packages/types/src/block-kit/extensions.ts +++ b/packages/types/src/block-kit/extensions.ts @@ -1,5 +1,5 @@ // This file contains reusable extensions/mixins that other Block Kit elements will extend from. -import { ConfirmationDialog, PlainTextElement, DispatchActionConfig } from './composition-objects'; +import { ConfirmationDialog, DispatchActionConfig, PlainTextElement } from './composition-objects'; // TODO: breaking change: remove `Action` and move properties to `Actionable` on next major release. /** diff --git a/packages/types/src/message-attachments.ts b/packages/types/src/message-attachments.ts index 59c301f42..9426465ea 100644 --- a/packages/types/src/message-attachments.ts +++ b/packages/types/src/message-attachments.ts @@ -1,5 +1,5 @@ -import { PlainTextElement } from './block-kit/composition-objects'; import { AnyBlock } from './block-kit/blocks'; +import { PlainTextElement } from './block-kit/composition-objects'; // TODO: breaking changes, use discriminated union for `fallback`, `text` and `block` properties, maybe LegacyAttachment // vs. BlocksAttachment? as per https://api.slack.com/reference/messaging/attachments#legacy_fields diff --git a/packages/web-api/package.json b/packages/web-api/package.json index f047537d6..eee3d9210 100644 --- a/packages/web-api/package.json +++ b/packages/web-api/package.json @@ -36,7 +36,7 @@ "prepare": "npm run build", "build": "npm run build:clean && tsc", "build:clean": "shx rm -rf ./dist ./coverage", - "lint": "eslint --ext .ts src", + "lint": "eslint --fix --ext .ts src", "mocha": "mocha --config .mocharc.json src/*.spec.js", "test": "npm run lint && npm run test:types && npm run test:integration && npm run test:unit", "test:integration": "npm run build && node test/integration/commonjs-project/index.js && node test/integration/esm-project/index.mjs", diff --git a/packages/web-api/src/WebClient.ts b/packages/web-api/src/WebClient.ts index 953e26086..07a0d7609 100644 --- a/packages/web-api/src/WebClient.ts +++ b/packages/web-api/src/WebClient.ts @@ -1,48 +1,50 @@ -import { stringify as qsStringify } from 'querystring'; import { Agent } from 'http'; import { basename } from 'path'; +import { stringify as qsStringify } from 'querystring'; import { Readable } from 'stream'; import { SecureContextOptions } from 'tls'; - -import zlib from 'zlib'; import { TextDecoder } from 'util'; -import isStream from 'is-stream'; -import pQueue from 'p-queue'; -import pRetry, { AbortError } from 'p-retry'; +import zlib from 'zlib'; + import axios, { AxiosHeaderValue, AxiosInstance, AxiosResponse } from 'axios'; import FormData from 'form-data'; import isElectron from 'is-electron'; +import isStream from 'is-stream'; +import pQueue from 'p-queue'; +import pRetry, { AbortError } from 'p-retry'; + import { - AdminAnalyticsMemberDetails, - AdminAnalyticsPublicChannelDetails, - AdminAnalyticsPublicChannelMetadataDetails, - FilesCompleteUploadExternalResponse, - FilesGetUploadURLExternalResponse, -} from './types/response'; -import { CursorPaginationEnabled } from './types/request/common'; -import { Methods } from './methods'; -import type { - FilesUploadV2Arguments, - FileUploadV2Job, - FilesGetUploadURLExternalArguments, - FilesCompleteUploadExternalArguments, -} from './types/request/files'; -import { getUserAgent } from './instrument'; -import { - requestErrorWithOriginal, httpErrorFromResponse, platformErrorFromResult, rateLimitedErrorWithDelay, + requestErrorWithOriginal, } from './errors'; -import { LogLevel, Logger, getLogger } from './logger'; -import { RetryOptions, tenRetriesInAboutThirtyMinutes } from './retry-policies'; -import delay from './helpers'; import { - warnIfNotUsingFilesUploadV2, + getAllFileUploadsToComplete, getFileUploadJob, getMultipleFileUploadJobs, - getAllFileUploadsToComplete, + warnIfNotUsingFilesUploadV2, } from './file-upload'; +import delay from './helpers'; +import { getUserAgent } from './instrument'; +import { LogLevel, Logger, getLogger } from './logger'; +import { Methods } from './methods'; +import { RetryOptions, tenRetriesInAboutThirtyMinutes } from './retry-policies'; +import { CursorPaginationEnabled } from './types/request/common'; + +import type { + FileUploadV2Job, + FilesCompleteUploadExternalArguments, + FilesGetUploadURLExternalArguments, + FilesUploadV2Arguments, +} from './types/request/files'; +import type { + AdminAnalyticsMemberDetails, + AdminAnalyticsPublicChannelDetails, + AdminAnalyticsPublicChannelMetadataDetails, + FilesCompleteUploadExternalResponse, + FilesGetUploadURLExternalResponse, +} from './types/response'; /* * Helpers diff --git a/packages/web-api/src/errors.ts b/packages/web-api/src/errors.ts index efec40292..13213ee9e 100644 --- a/packages/web-api/src/errors.ts +++ b/packages/web-api/src/errors.ts @@ -1,5 +1,7 @@ import { IncomingHttpHeaders } from 'http'; + import { AxiosResponse } from 'axios'; + import { WebAPICallResult } from './WebClient'; /** diff --git a/packages/web-api/src/file-upload.ts b/packages/web-api/src/file-upload.ts index 76c19357f..78e26f3fd 100644 --- a/packages/web-api/src/file-upload.ts +++ b/packages/web-api/src/file-upload.ts @@ -1,12 +1,14 @@ import { readFileSync } from 'fs'; import { Readable } from 'stream'; + import { Logger } from '@slack/logger'; -import { errorWithCode, ErrorCode } from './errors'; + +import { ErrorCode, errorWithCode } from './errors'; import { - FilesCompleteUploadExternalArguments, - FilesUploadV2Arguments, FileUploadV2, FileUploadV2Job, + FilesCompleteUploadExternalArguments, + FilesUploadV2Arguments, } from './types/request/files'; export async function getFileUploadJob( diff --git a/packages/web-api/src/logger.ts b/packages/web-api/src/logger.ts index aad8c36c4..e9509fdb8 100644 --- a/packages/web-api/src/logger.ts +++ b/packages/web-api/src/logger.ts @@ -1,4 +1,4 @@ -import { Logger, LogLevel, ConsoleLogger } from '@slack/logger'; +import { ConsoleLogger, LogLevel, Logger } from '@slack/logger'; export { Logger, LogLevel } from '@slack/logger'; diff --git a/packages/web-api/src/methods.ts b/packages/web-api/src/methods.ts index dfe4d8c45..018c91450 100644 --- a/packages/web-api/src/methods.ts +++ b/packages/web-api/src/methods.ts @@ -1,6 +1,253 @@ import { EventEmitter } from 'eventemitter3'; + import { WebAPICallResult, WebClient, WebClientEvent } from './WebClient'; + // Response types +import type { + APITestArguments, + AdminAnalyticsGetFileArguments, + AdminAppsActivitiesListArguments, + AdminAppsApproveArguments, + AdminAppsApprovedListArguments, + AdminAppsClearResolutionArguments, + AdminAppsConfigLookupArguments, + AdminAppsConfigSetArguments, + AdminAppsRequestsCancelArguments, + AdminAppsRequestsListArguments, + AdminAppsRestrictArguments, + AdminAppsRestrictedListArguments, + AdminAppsUninstallArguments, + AdminAuthPolicyAssignEntitiesArguments, + AdminAuthPolicyGetEntitiesArguments, + AdminAuthPolicyRemoveEntitiesArguments, + AdminBarriersCreateArguments, + AdminBarriersDeleteArguments, + AdminBarriersListArguments, + AdminBarriersUpdateArguments, + AdminConversationsArchiveArguments, + AdminConversationsBulkArchiveArguments, + AdminConversationsBulkDeleteArguments, + AdminConversationsBulkMoveArguments, + AdminConversationsConvertToPrivateArguments, + AdminConversationsConvertToPublicArguments, + AdminConversationsCreateArguments, + AdminConversationsDeleteArguments, + AdminConversationsDisconnectSharedArguments, + AdminConversationsEKMListOriginalConnectedChannelInfoArguments, + AdminConversationsGetConversationPrefsArguments, + AdminConversationsGetCustomRetentionArguments, + AdminConversationsGetTeamsArguments, + AdminConversationsInviteArguments, + AdminConversationsLookupArguments, + AdminConversationsRemoveCustomRetentionArguments, + AdminConversationsRenameArguments, + AdminConversationsRestrictAccessAddGroupArguments, + AdminConversationsRestrictAccessListGroupsArguments, + AdminConversationsRestrictAccessRemoveGroupArguments, + AdminConversationsSearchArguments, + AdminConversationsSetConversationPrefsArguments, + AdminConversationsSetCustomRetentionArguments, + AdminConversationsSetTeamsArguments, + AdminConversationsUnarchiveArguments, + AdminEmojiAddAliasArguments, + AdminEmojiAddArguments, + AdminEmojiListArguments, + AdminEmojiRemoveArguments, + AdminEmojiRenameArguments, + AdminFunctionsListArguments, + AdminFunctionsPermissionsLookupArguments, + AdminFunctionsPermissionsSetArguments, + AdminInviteRequestsApproveArguments, + AdminInviteRequestsApprovedListArguments, + AdminInviteRequestsDeniedListArguments, + AdminInviteRequestsDenyArguments, + AdminInviteRequestsListArguments, + AdminRolesAddAssignmentsArguments, + AdminRolesListAssignmentsArguments, + AdminRolesRemoveAssignmentsArguments, + AdminTeamsAdminsListArguments, + AdminTeamsCreateArguments, + AdminTeamsListArguments, + AdminTeamsOwnersListArguments, + AdminTeamsSettingsInfoArguments, + AdminTeamsSettingsSetDefaultChannelsArguments, + AdminTeamsSettingsSetDescriptionArguments, + AdminTeamsSettingsSetDiscoverabilityArguments, + AdminTeamsSettingsSetIconArguments, + AdminTeamsSettingsSetNameArguments, + AdminUsergroupsAddChannelsArguments, + AdminUsergroupsAddTeamsArguments, + AdminUsergroupsListChannelsArguments, + AdminUsergroupsRemoveChannelsArguments, + AdminUsersAssignArguments, + AdminUsersInviteArguments, + AdminUsersListArguments, + AdminUsersRemoveArguments, + AdminUsersSessionClearSettingsArguments, + AdminUsersSessionGetSettingsArguments, + AdminUsersSessionInvalidateArguments, + AdminUsersSessionListArguments, + AdminUsersSessionResetArguments, + AdminUsersSessionResetBulkArguments, + AdminUsersSessionSetSettingsArguments, + AdminUsersSetAdminArguments, + AdminUsersSetExpirationArguments, + AdminUsersSetOwnerArguments, + AdminUsersSetRegularArguments, + AdminUsersUnsupportedVersionsExportArguments, + AdminWorkflowsCollaboratorsAddArguments, + AdminWorkflowsCollaboratorsRemoveArguments, + AdminWorkflowsPermissionsLookupArguments, + AdminWorkflowsSearchArguments, + AdminWorkflowsUnpublishArguments, + AppsConnectionsOpenArguments, + AppsEventAuthorizationsListArguments, + AppsManifestCreateArguments, + AppsManifestDeleteArguments, + AppsManifestExportArguments, + AppsManifestUpdateArguments, + AppsManifestValidateArguments, + AppsUninstallArguments, + AuthRevokeArguments, + AuthTeamsListArguments, + AuthTestArguments, + BookmarksAddArguments, + BookmarksEditArguments, + BookmarksListArguments, + BookmarksRemoveArguments, + BotsInfoArguments, + CallsAddArguments, + CallsEndArguments, + CallsInfoArguments, + CallsParticipantsAddArguments, + CallsParticipantsRemoveArguments, + CallsUpdateArguments, + CanvasesAccessDeleteArguments, + CanvasesAccessSetArguments, + CanvasesCreateArguments, + CanvasesDeleteArguments, + CanvasesEditArguments, + CanvasesSectionsLookupArguments, + ChatDeleteArguments, + ChatDeleteScheduledMessageArguments, + ChatGetPermalinkArguments, + ChatMeMessageArguments, + ChatPostEphemeralArguments, + ChatPostMessageArguments, + ChatScheduleMessageArguments, + ChatScheduledMessagesListArguments, + ChatUnfurlArguments, + ChatUpdateArguments, + ConversationsAcceptSharedInviteArguments, + ConversationsApproveSharedInviteArguments, + ConversationsArchiveArguments, + ConversationsCanvasesCreateArguments, + ConversationsCloseArguments, + ConversationsCreateArguments, + ConversationsDeclineSharedInviteArguments, + ConversationsHistoryArguments, + ConversationsInfoArguments, + ConversationsInviteArguments, + ConversationsInviteSharedArguments, + ConversationsJoinArguments, + ConversationsKickArguments, + ConversationsLeaveArguments, + ConversationsListArguments, + ConversationsListConnectInvitesArguments, + ConversationsMarkArguments, + ConversationsMembersArguments, + ConversationsOpenArguments, + ConversationsRenameArguments, + ConversationsRepliesArguments, + ConversationsSetPurposeArguments, + ConversationsSetTopicArguments, + ConversationsUnarchiveArguments, + DialogOpenArguments, + DndEndDndArguments, + DndEndSnoozeArguments, + DndInfoArguments, + DndSetSnoozeArguments, + DndTeamInfoArguments, + EmojiListArguments, + FilesCommentsDeleteArguments, + FilesCompleteUploadExternalArguments, + FilesDeleteArguments, + FilesGetUploadURLExternalArguments, + FilesInfoArguments, + FilesListArguments, + FilesRemoteAddArguments, + FilesRemoteInfoArguments, + FilesRemoteListArguments, + FilesRemoteRemoveArguments, + FilesRemoteShareArguments, + FilesRemoteUpdateArguments, + FilesRevokePublicURLArguments, + FilesSharedPublicURLArguments, + FilesUploadArguments, + FilesUploadV2Arguments, + FunctionsCompleteErrorArguments, + FunctionsCompleteSuccessArguments, + MigrationExchangeArguments, + OAuthAccessArguments, + OAuthV2AccessArguments, + OAuthV2ExchangeArguments, + OpenIDConnectTokenArguments, + OpenIDConnectUserInfoArguments, + PinsAddArguments, + PinsListArguments, + PinsRemoveArguments, + RTMConnectArguments, + RTMStartArguments, + ReactionsAddArguments, + ReactionsGetArguments, + ReactionsListArguments, + ReactionsRemoveArguments, + RemindersAddArguments, + RemindersCompleteArguments, + RemindersDeleteArguments, + RemindersInfoArguments, + RemindersListArguments, + SearchAllArguments, + SearchFilesArguments, + SearchMessagesArguments, + StarsAddRemoveArguments, + StarsListArguments, + TeamAccessLogsArguments, + TeamBillableInfoArguments, + TeamBillingInfoArguments, + TeamExternalTeamsListArguments, + TeamInfoArguments, + TeamIntegrationLogsArguments, + TeamPreferencesListArguments, + TeamProfileGetArguments, + ToolingTokensRotateArguments, + UsergroupsCreateArguments, + UsergroupsDisableArguments, + UsergroupsEnableArguments, + UsergroupsListArguments, + UsergroupsUpdateArguments, + UsergroupsUsersListArguments, + UsergroupsUsersUpdateArguments, + UsersConversationsArguments, + UsersDeletePhotoArguments, + UsersDiscoverableContactsLookupArguments, + UsersGetPresenceArguments, + UsersIdentityArguments, + UsersInfoArguments, + UsersListArguments, + UsersLookupByEmailArguments, + UsersProfileGetArguments, + UsersProfileSetArguments, + UsersSetPhotoArguments, + UsersSetPresenceArguments, + ViewsOpenArguments, + ViewsPublishArguments, + ViewsPushArguments, + ViewsUpdateArguments, + WorkflowsStepCompletedArguments, + WorkflowsStepFailedArguments, + WorkflowsUpdateStepArguments, +} from './types/request/index'; import type { AdminAnalyticsGetFileResponse, AdminAppsActivitiesListResponse, @@ -22,6 +269,9 @@ import type { AdminBarriersListResponse, AdminBarriersUpdateResponse, AdminConversationsArchiveResponse, + AdminConversationsBulkArchiveResponse, + AdminConversationsBulkDeleteResponse, + AdminConversationsBulkMoveResponse, AdminConversationsConvertToPrivateResponse, AdminConversationsConvertToPublicResponse, AdminConversationsCreateResponse, @@ -29,23 +279,20 @@ import type { AdminConversationsDisconnectSharedResponse, AdminConversationsEkmListOriginalConnectedChannelInfoResponse, AdminConversationsGetConversationPrefsResponse, + AdminConversationsGetCustomRetentionResponse, AdminConversationsGetTeamsResponse, AdminConversationsInviteResponse, AdminConversationsLookupResponse, + AdminConversationsRemoveCustomRetentionResponse, AdminConversationsRenameResponse, AdminConversationsRestrictAccessAddGroupResponse, AdminConversationsRestrictAccessListGroupsResponse, AdminConversationsRestrictAccessRemoveGroupResponse, AdminConversationsSearchResponse, AdminConversationsSetConversationPrefsResponse, + AdminConversationsSetCustomRetentionResponse, AdminConversationsSetTeamsResponse, AdminConversationsUnarchiveResponse, - AdminConversationsGetCustomRetentionResponse, - AdminConversationsSetCustomRetentionResponse, - AdminConversationsRemoveCustomRetentionResponse, - AdminConversationsBulkArchiveResponse, - AdminConversationsBulkDeleteResponse, - AdminConversationsBulkMoveResponse, AdminEmojiAddAliasResponse, AdminEmojiAddResponse, AdminEmojiListResponse, @@ -80,13 +327,13 @@ import type { AdminUsersInviteResponse, AdminUsersListResponse, AdminUsersRemoveResponse, - AdminUsersSessionGetSettingsResponse, - AdminUsersSessionSetSettingsResponse, AdminUsersSessionClearSettingsResponse, + AdminUsersSessionGetSettingsResponse, AdminUsersSessionInvalidateResponse, AdminUsersSessionListResponse, - AdminUsersSessionResetResponse, AdminUsersSessionResetBulkResponse, + AdminUsersSessionResetResponse, + AdminUsersSessionSetSettingsResponse, AdminUsersSetAdminResponse, AdminUsersSetExpirationResponse, AdminUsersSetOwnerResponse, @@ -117,9 +364,9 @@ import type { CallsAddResponse, CallsEndResponse, CallsInfoResponse, - CallsUpdateResponse, CallsParticipantsAddResponse, CallsParticipantsRemoveResponse, + CallsUpdateResponse, CanvasesAccessDeleteResponse, CanvasesAccessSetResponse, CanvasesCreateResponse, @@ -138,19 +385,19 @@ import type { ChatUpdateResponse, ConversationsAcceptSharedInviteResponse, ConversationsApproveSharedInviteResponse, - ConversationsCanvasesCreateResponse, - ConversationsDeclineSharedInviteResponse, - ConversationsInviteSharedResponse, - ConversationsListConnectInvitesResponse, ConversationsArchiveResponse, + ConversationsCanvasesCreateResponse, ConversationsCloseResponse, ConversationsCreateResponse, + ConversationsDeclineSharedInviteResponse, ConversationsHistoryResponse, ConversationsInfoResponse, ConversationsInviteResponse, + ConversationsInviteSharedResponse, ConversationsJoinResponse, ConversationsKickResponse, ConversationsLeaveResponse, + ConversationsListConnectInvitesResponse, ConversationsListResponse, ConversationsMarkResponse, ConversationsMembersResponse, @@ -247,251 +494,6 @@ import type { WorkflowsUpdateStepResponse, } from './types/response/index'; // Request types -import type { - AdminAnalyticsGetFileArguments, - AdminAppsActivitiesListArguments, - AdminAppsApproveArguments, - AdminAppsApprovedListArguments, - AdminAppsClearResolutionArguments, - AdminAppsConfigLookupArguments, - AdminAppsConfigSetArguments, - AdminAppsRequestsCancelArguments, - AdminAppsRequestsListArguments, - AdminAppsRestrictArguments, - AdminAppsRestrictedListArguments, - AdminAppsUninstallArguments, - AdminAuthPolicyAssignEntitiesArguments, - AdminAuthPolicyGetEntitiesArguments, - AdminAuthPolicyRemoveEntitiesArguments, - AdminBarriersCreateArguments, - AdminBarriersDeleteArguments, - AdminBarriersListArguments, - AdminBarriersUpdateArguments, - AdminConversationsArchiveArguments, - AdminConversationsBulkArchiveArguments, - AdminConversationsBulkDeleteArguments, - AdminConversationsBulkMoveArguments, - AdminConversationsConvertToPrivateArguments, - AdminConversationsConvertToPublicArguments, - AdminConversationsCreateArguments, - AdminConversationsDeleteArguments, - AdminConversationsDisconnectSharedArguments, - AdminConversationsEKMListOriginalConnectedChannelInfoArguments, - AdminConversationsGetConversationPrefsArguments, - AdminConversationsGetCustomRetentionArguments, - AdminConversationsGetTeamsArguments, - AdminConversationsInviteArguments, - AdminConversationsLookupArguments, - AdminConversationsRemoveCustomRetentionArguments, - AdminConversationsRenameArguments, - AdminConversationsRestrictAccessAddGroupArguments, - AdminConversationsRestrictAccessListGroupsArguments, - AdminConversationsRestrictAccessRemoveGroupArguments, - AdminConversationsSearchArguments, - AdminConversationsSetConversationPrefsArguments, - AdminConversationsSetCustomRetentionArguments, - AdminConversationsSetTeamsArguments, - AdminConversationsUnarchiveArguments, - AdminEmojiAddArguments, - AdminEmojiAddAliasArguments, - AdminEmojiListArguments, - AdminEmojiRemoveArguments, - AdminEmojiRenameArguments, - AdminFunctionsListArguments, - AdminFunctionsPermissionsLookupArguments, - AdminFunctionsPermissionsSetArguments, - AdminInviteRequestsApproveArguments, - AdminInviteRequestsApprovedListArguments, - AdminInviteRequestsDeniedListArguments, - AdminInviteRequestsDenyArguments, - AdminInviteRequestsListArguments, - AdminRolesAddAssignmentsArguments, - AdminRolesListAssignmentsArguments, - AdminRolesRemoveAssignmentsArguments, - AdminTeamsAdminsListArguments, - AdminTeamsCreateArguments, - AdminTeamsListArguments, - AdminTeamsOwnersListArguments, - AdminTeamsSettingsInfoArguments, - AdminTeamsSettingsSetDefaultChannelsArguments, - AdminTeamsSettingsSetDescriptionArguments, - AdminTeamsSettingsSetDiscoverabilityArguments, - AdminTeamsSettingsSetIconArguments, - AdminTeamsSettingsSetNameArguments, - AdminUsergroupsAddChannelsArguments, - AdminUsergroupsAddTeamsArguments, - AdminUsergroupsListChannelsArguments, - AdminUsergroupsRemoveChannelsArguments, - AdminUsersAssignArguments, - AdminUsersInviteArguments, - AdminUsersListArguments, - AdminUsersRemoveArguments, - AdminUsersSessionListArguments, - AdminUsersSessionClearSettingsArguments, - AdminUsersSessionGetSettingsArguments, - AdminUsersSessionInvalidateArguments, - AdminUsersSessionResetArguments, - AdminUsersSessionResetBulkArguments, - AdminUsersSessionSetSettingsArguments, - AdminUsersSetAdminArguments, - AdminUsersSetExpirationArguments, - AdminUsersSetOwnerArguments, - AdminUsersSetRegularArguments, - AdminUsersUnsupportedVersionsExportArguments, - AdminWorkflowsCollaboratorsAddArguments, - AdminWorkflowsCollaboratorsRemoveArguments, - AdminWorkflowsPermissionsLookupArguments, - AdminWorkflowsSearchArguments, - AdminWorkflowsUnpublishArguments, - WorkflowsStepCompletedArguments, - WorkflowsStepFailedArguments, - WorkflowsUpdateStepArguments, - ViewsUpdateArguments, - ViewsOpenArguments, - ViewsPushArguments, - ViewsPublishArguments, - UsersConversationsArguments, - UsersDiscoverableContactsLookupArguments, - UsersInfoArguments, - UsersListArguments, - UsersIdentityArguments, - UsersSetPhotoArguments, - UsersProfileGetArguments, - UsersProfileSetArguments, - UsersDeletePhotoArguments, - UsersGetPresenceArguments, - UsersSetPresenceArguments, - UsersLookupByEmailArguments, - ToolingTokensRotateArguments, - SearchAllArguments, - SearchFilesArguments, - SearchMessagesArguments, - UsergroupsCreateArguments, - UsergroupsDisableArguments, - UsergroupsEnableArguments, - UsergroupsListArguments, - UsergroupsUpdateArguments, - UsergroupsUsersListArguments, - UsergroupsUsersUpdateArguments, - TeamAccessLogsArguments, - TeamBillableInfoArguments, - TeamBillingInfoArguments, - TeamExternalTeamsListArguments, - TeamInfoArguments, - TeamIntegrationLogsArguments, - TeamPreferencesListArguments, - TeamProfileGetArguments, - StarsAddRemoveArguments, - StarsListArguments, - RTMConnectArguments, - RTMStartArguments, - RemindersAddArguments, - RemindersInfoArguments, - RemindersListArguments, - RemindersDeleteArguments, - RemindersCompleteArguments, - ReactionsAddArguments, - ReactionsGetArguments, - ReactionsListArguments, - ReactionsRemoveArguments, - PinsAddArguments, - PinsListArguments, - PinsRemoveArguments, - OpenIDConnectTokenArguments, - OpenIDConnectUserInfoArguments, - OAuthAccessArguments, - OAuthV2AccessArguments, - OAuthV2ExchangeArguments, - MigrationExchangeArguments, - FilesDeleteArguments, - FunctionsCompleteErrorArguments, - FunctionsCompleteSuccessArguments, - FilesInfoArguments, - FilesListArguments, - FilesRevokePublicURLArguments, - FilesSharedPublicURLArguments, - FilesUploadArguments, - FilesUploadV2Arguments, - FilesCompleteUploadExternalArguments, - FilesGetUploadURLExternalArguments, - FilesCommentsDeleteArguments, - FilesRemoteUpdateArguments, - FilesRemoteRemoveArguments, - FilesRemoteShareArguments, - FilesRemoteListArguments, - FilesRemoteInfoArguments, - FilesRemoteAddArguments, - EmojiListArguments, - DndEndDndArguments, - DndEndSnoozeArguments, - DndInfoArguments, - DndSetSnoozeArguments, - DndTeamInfoArguments, - DialogOpenArguments, - ConversationsAcceptSharedInviteArguments, - ConversationsApproveSharedInviteArguments, - ConversationsArchiveArguments, - ConversationsCanvasesCreateArguments, - ConversationsCloseArguments, - ConversationsCreateArguments, - ConversationsDeclineSharedInviteArguments, - ConversationsHistoryArguments, - ConversationsInfoArguments, - ConversationsInviteArguments, - ConversationsInviteSharedArguments, - ConversationsJoinArguments, - ConversationsKickArguments, - ConversationsLeaveArguments, - ConversationsListArguments, - ConversationsListConnectInvitesArguments, - ConversationsMarkArguments, - ConversationsMembersArguments, - ConversationsOpenArguments, - ConversationsRenameArguments, - ConversationsRepliesArguments, - ConversationsSetPurposeArguments, - ConversationsSetTopicArguments, - ConversationsUnarchiveArguments, - ChatDeleteArguments, - ChatDeleteScheduledMessageArguments, - ChatGetPermalinkArguments, - ChatMeMessageArguments, - ChatPostEphemeralArguments, - ChatPostMessageArguments, - ChatScheduleMessageArguments, - ChatScheduledMessagesListArguments, - ChatUnfurlArguments, - ChatUpdateArguments, - CanvasesAccessDeleteArguments, - CanvasesAccessSetArguments, - CanvasesCreateArguments, - CanvasesDeleteArguments, - CanvasesEditArguments, - CanvasesSectionsLookupArguments, - CallsAddArguments, - CallsEndArguments, - CallsInfoArguments, - CallsUpdateArguments, - CallsParticipantsAddArguments, - CallsParticipantsRemoveArguments, - BotsInfoArguments, - BookmarksAddArguments, - BookmarksEditArguments, - BookmarksListArguments, - BookmarksRemoveArguments, - AuthRevokeArguments, - AuthTestArguments, - AuthTeamsListArguments, - AppsConnectionsOpenArguments, - AppsEventAuthorizationsListArguments, - AppsManifestCreateArguments, - AppsManifestDeleteArguments, - AppsManifestExportArguments, - AppsManifestUpdateArguments, - AppsManifestValidateArguments, - AppsUninstallArguments, - APITestArguments, -} from './types/request/index'; /** * Generic method definition diff --git a/packages/web-api/src/types/request/admin/apps.ts b/packages/web-api/src/types/request/admin/apps.ts index 1f8c9366b..a2a971a84 100644 --- a/packages/web-api/src/types/request/admin/apps.ts +++ b/packages/web-api/src/types/request/admin/apps.ts @@ -1,6 +1,7 @@ -import type { AppID, CursorPaginationEnabled, TokenOverridable } from '../common'; import { OptionalArgument } from '../../helpers'; +import type { AppID, CursorPaginationEnabled, TokenOverridable } from '../common'; + interface RequestID { /** @description The id of the request. */ request_id: string; diff --git a/packages/web-api/src/types/request/admin/barriers.ts b/packages/web-api/src/types/request/admin/barriers.ts index 6990e1037..0b12aac27 100644 --- a/packages/web-api/src/types/request/admin/barriers.ts +++ b/packages/web-api/src/types/request/admin/barriers.ts @@ -1,6 +1,7 @@ -import type { CursorPaginationEnabled, TokenOverridable } from '../common'; import { OptionalArgument } from '../../helpers'; +import type { CursorPaginationEnabled, TokenOverridable } from '../common'; + interface BarrierID { /** @description The ID of the barrier. */ barrier_id: string; diff --git a/packages/web-api/src/types/request/admin/conversations.ts b/packages/web-api/src/types/request/admin/conversations.ts index ad605f68c..a4700bacb 100644 --- a/packages/web-api/src/types/request/admin/conversations.ts +++ b/packages/web-api/src/types/request/admin/conversations.ts @@ -1,3 +1,5 @@ +import { OptionalArgument } from '../../helpers'; + import type { ChannelIDs, CursorPaginationEnabled, @@ -5,7 +7,6 @@ import type { TokenOverridable, UserIDs, } from '../common'; -import { OptionalArgument } from '../../helpers'; interface ChannelID { // an identical interface exists in src/types/request/conversations.ts, but it is only for invites /** @description Encoded channel ID. */ diff --git a/packages/web-api/src/types/request/admin/emoji.ts b/packages/web-api/src/types/request/admin/emoji.ts index 79088ae2e..f56f799a9 100644 --- a/packages/web-api/src/types/request/admin/emoji.ts +++ b/packages/web-api/src/types/request/admin/emoji.ts @@ -1,6 +1,7 @@ -import type { CursorPaginationEnabled, TokenOverridable } from '../common'; import { OptionalArgument } from '../../helpers'; +import type { CursorPaginationEnabled, TokenOverridable } from '../common'; + interface Name { /** * @description The name of the emoji. Colons (:myemoji:) around the value are not required, diff --git a/packages/web-api/src/types/request/admin/roles.ts b/packages/web-api/src/types/request/admin/roles.ts index 7ddb552b9..64a00affa 100644 --- a/packages/web-api/src/types/request/admin/roles.ts +++ b/packages/web-api/src/types/request/admin/roles.ts @@ -1,6 +1,7 @@ -import type { CursorPaginationEnabled, SortDir, TokenOverridable, UserIDs } from '../common'; import { OptionalArgument } from '../../helpers'; +import type { CursorPaginationEnabled, SortDir, TokenOverridable, UserIDs } from '../common'; + interface EntityIDs { /** * @description List of the entity IDs for which roles will be assigned/listed/removed. diff --git a/packages/web-api/src/types/request/admin/teams.ts b/packages/web-api/src/types/request/admin/teams.ts index 77740c617..85569ef89 100644 --- a/packages/web-api/src/types/request/admin/teams.ts +++ b/packages/web-api/src/types/request/admin/teams.ts @@ -1,6 +1,7 @@ -import type { ChannelIDs, CursorPaginationEnabled, TeamID, TokenOverridable } from '../common'; import { OptionalArgument } from '../../helpers'; +import type { ChannelIDs, CursorPaginationEnabled, TeamID, TokenOverridable } from '../common'; + type TeamDiscoverability = 'open' | 'closed' | 'invite_only' | 'unlisted'; // https://api.slack.com/methods/admin.teams.admins.list diff --git a/packages/web-api/src/types/request/admin/users.ts b/packages/web-api/src/types/request/admin/users.ts index ed8795703..e72604dcf 100644 --- a/packages/web-api/src/types/request/admin/users.ts +++ b/packages/web-api/src/types/request/admin/users.ts @@ -1,3 +1,5 @@ +import { OptionalArgument } from '../../helpers'; + import type { ChannelIDs, CursorPaginationEnabled, @@ -6,7 +8,6 @@ import type { TokenOverridable, UserIDs, } from '../common'; -import { OptionalArgument } from '../../helpers'; interface UserID { /** @description The ID of the user. */ diff --git a/packages/web-api/src/types/request/admin/workflows.ts b/packages/web-api/src/types/request/admin/workflows.ts index 56fbe7ddf..23a9c11b4 100644 --- a/packages/web-api/src/types/request/admin/workflows.ts +++ b/packages/web-api/src/types/request/admin/workflows.ts @@ -1,6 +1,7 @@ -import type { AppID, CursorPaginationEnabled, SortDir, TokenOverridable } from '../common'; import { OptionalArgument } from '../../helpers'; +import type { AppID, CursorPaginationEnabled, SortDir, TokenOverridable } from '../common'; + interface CollaboratorIDs { /** @description Array of collaborators (encoded user IDs) - maximum of 50 items. */ collaborator_ids: [string, ...string[]]; diff --git a/packages/web-api/src/types/request/apps.ts b/packages/web-api/src/types/request/apps.ts index 227b8cb17..7a69e51bc 100644 --- a/packages/web-api/src/types/request/apps.ts +++ b/packages/web-api/src/types/request/apps.ts @@ -1,7 +1,8 @@ -import type { AppID, CursorPaginationEnabled, TokenOverridable, OAuthCredentials } from './common'; -import type { Manifest } from './manifest'; import { OptionalArgument } from '../helpers'; +import type { AppID, CursorPaginationEnabled, OAuthCredentials, TokenOverridable } from './common'; +import type { Manifest } from './manifest'; + // https://api.slack.com/methods/apps.connections.open export type AppsConnectionsOpenArguments = OptionalArgument; diff --git a/packages/web-api/src/types/request/bots.ts b/packages/web-api/src/types/request/bots.ts index 77ee5e4e0..f49b512b1 100644 --- a/packages/web-api/src/types/request/bots.ts +++ b/packages/web-api/src/types/request/bots.ts @@ -1,6 +1,7 @@ -import type { OptionalTeamAssignable, TokenOverridable } from './common'; import { OptionalArgument } from '../helpers'; +import type { OptionalTeamAssignable, TokenOverridable } from './common'; + // https://api.slack.com/methods/bots.info export type BotsInfoArguments = OptionalArgument