Skip to content

Commit

Permalink
Extract AuthorizeResult from install-provider.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
seratch committed Feb 21, 2022
1 parent 0ec1867 commit 512f2b1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions packages/oauth/package.json
Expand Up @@ -47,7 +47,7 @@
"lodash.isstring": "^4.0.1"
},
"devDependencies": {
"@microsoft/api-extractor": "^7.3.4",
"@microsoft/api-extractor": "^7.19.4",
"@types/chai": "^4.2.11",
"@types/mocha": "^9.1.0",
"@types/sinon": "^10.0.11",
Expand All @@ -61,7 +61,7 @@
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsdoc": "^30.6.1",
"eslint-plugin-node": "^11.1.0",
"mocha": "^9.1.0",
"mocha": "^9.2.1",
"nop": "^1.0.0",
"nyc": "^15.1.0",
"rewiremock": "^3.13.9",
Expand Down
15 changes: 15 additions & 0 deletions packages/oauth/src/authorize-result.ts
@@ -0,0 +1,15 @@
// This is intentionally structurally identical to AuthorizeResult from App
// It is redefined so that this class remains loosely coupled to the rest
// of Bolt.
export interface AuthorizeResult {
botToken?: string;
botRefreshToken?: string;
botTokenExpiresAt?: number; // utc, seconds
userToken?: string;
userRefreshToken?: string;
userTokenExpiresAt?: number; // utc, seconds
botId?: string;
botUserId?: string;
teamId?: string;
enterpriseId?: string;
}
2 changes: 1 addition & 1 deletion packages/oauth/src/index.ts
Expand Up @@ -2,10 +2,10 @@
// export * from './errors';

export { Logger, LogLevel } from './logger';
export { AuthorizeResult } from './authorize-result';
export { CallbackOptions } from './callback-options';
export {
InstallProvider,
AuthorizeResult,
OAuthV2TokenRefreshResponse,
OAuthV2Response,
} from './install-provider';
Expand Down
17 changes: 1 addition & 16 deletions packages/oauth/src/install-provider.ts
Expand Up @@ -3,6 +3,7 @@ import { URLSearchParams, URL } from 'url';

import { WebAPICallResult, WebClient, WebClientOptions } from '@slack/web-api';

import { AuthorizeResult } from './authorize-result';
import { CallbackOptions, defaultCallbackFailure, defaultCallbackSuccess } from './callback-options';
import {
InstallerInitializationError,
Expand Down Expand Up @@ -525,22 +526,6 @@ export class InstallProvider {
}
}

// This is intentionally structurally identical to AuthorizeResult from App
// It is redefined so that this class remains loosely coupled to the rest
// of Bolt.
export interface AuthorizeResult {
botToken?: string;
botRefreshToken?: string;
botTokenExpiresAt?: number; // utc, seconds
userToken?: string;
userRefreshToken?: string;
userTokenExpiresAt?: number; // utc, seconds
botId?: string;
botUserId?: string;
teamId?: string;
enterpriseId?: string;
}

// Response shape from oauth.v2.access - https://api.slack.com/methods/oauth.v2.access#response
export interface OAuthV2Response extends WebAPICallResult {
app_id: string;
Expand Down

0 comments on commit 512f2b1

Please sign in to comment.