diff --git a/packages/oauth/package.json b/packages/oauth/package.json index df7638af8..1f28bc81d 100644 --- a/packages/oauth/package.json +++ b/packages/oauth/package.json @@ -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", @@ -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", diff --git a/packages/oauth/src/authorize-result.ts b/packages/oauth/src/authorize-result.ts new file mode 100644 index 000000000..16c50a53c --- /dev/null +++ b/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; +} diff --git a/packages/oauth/src/index.ts b/packages/oauth/src/index.ts index 78cf38791..b37232cc6 100644 --- a/packages/oauth/src/index.ts +++ b/packages/oauth/src/index.ts @@ -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'; diff --git a/packages/oauth/src/install-provider.ts b/packages/oauth/src/install-provider.ts index f27d5e997..af9359a0d 100644 --- a/packages/oauth/src/install-provider.ts +++ b/packages/oauth/src/install-provider.ts @@ -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, @@ -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;