diff --git "a/src/api/routes/users/@me/connections/\043connection_name/\043connection_id/access-token.ts" "b/src/api/routes/users/@me/connections/\043connection_name/\043connection_id/access-token.ts" index 9031f3c..789a787 100644 --- "a/src/api/routes/users/@me/connections/\043connection_name/\043connection_id/access-token.ts" +++ "b/src/api/routes/users/@me/connections/\043connection_name/\043connection_id/access-token.ts" @@ -23,9 +23,9 @@ ConnectionStore, DiscordApiErrors, FieldErrors, + RefreshableConnection, } from "@spacebar/util"; import { Request, Response, Router } from "express"; -import RefreshableConnection from "../../../../../../../util/connections/RefreshableConnection"; const router = Router(); // TODO: this route is only used for spotify, twitch, and youtube. (battlenet seems to be able to PUT, maybe others also) diff --git a/src/connections/BattleNet/index.ts b/src/connections/BattleNet/index.ts index 7edc2e9..65ee8ab 100644 --- a/src/connections/BattleNet/index.ts +++ b/src/connections/BattleNet/index.ts @@ -22,9 +22,9 @@ ConnectionCallbackSchema, ConnectionLoader, DiscordApiErrors, + Connection, } from "@spacebar/util"; import wretch from "wretch"; -import Connection from "../../util/connections/Connection"; import { BattleNetSettings } from "./BattleNetSettings"; interface BattleNetConnectionUser { @@ -33,10 +33,10 @@ battletag: string; } -interface BattleNetErrorResponse { - error: string; - error_description: string; -} +// interface BattleNetErrorResponse { +// error: string; +// error_description: string; +// } export default class BattleNetConnection extends Connection { public readonly id = "battlenet"; diff --git a/src/connections/Discord/index.ts b/src/connections/Discord/index.ts index 76de33b..098ce99 100644 --- a/src/connections/Discord/index.ts +++ b/src/connections/Discord/index.ts @@ -22,9 +22,9 @@ ConnectionCallbackSchema, ConnectionLoader, DiscordApiErrors, + Connection, } from "@spacebar/util"; import wretch from "wretch"; -import Connection from "../../util/connections/Connection"; import { DiscordSettings } from "./DiscordSettings"; interface UserResponse { diff --git a/src/connections/EpicGames/index.ts b/src/connections/EpicGames/index.ts index bd7c7ee..8521a6f 100644 --- a/src/connections/EpicGames/index.ts +++ b/src/connections/EpicGames/index.ts @@ -22,9 +22,9 @@ ConnectionCallbackSchema, ConnectionLoader, DiscordApiErrors, + Connection, } from "@spacebar/util"; import wretch from "wretch"; -import Connection from "../../util/connections/Connection"; import { EpicGamesSettings } from "./EpicGamesSettings"; export interface UserResponse { diff --git a/src/connections/Facebook/index.ts b/src/connections/Facebook/index.ts index 6ce722d..f3c16cf 100644 --- a/src/connections/Facebook/index.ts +++ b/src/connections/Facebook/index.ts @@ -22,9 +22,9 @@ ConnectionCallbackSchema, ConnectionLoader, DiscordApiErrors, + Connection, } from "@spacebar/util"; import wretch from "wretch"; -import Connection from "../../util/connections/Connection"; import { FacebookSettings } from "./FacebookSettings"; export interface FacebookErrorResponse { diff --git a/src/connections/GitHub/index.ts b/src/connections/GitHub/index.ts index a675873..101b205 100644 --- a/src/connections/GitHub/index.ts +++ b/src/connections/GitHub/index.ts @@ -22,9 +22,9 @@ ConnectionCallbackSchema, ConnectionLoader, DiscordApiErrors, + Connection, } from "@spacebar/util"; import wretch from "wretch"; -import Connection from "../../util/connections/Connection"; import { GitHubSettings } from "./GitHubSettings"; interface UserResponse { diff --git a/src/connections/Reddit/index.ts b/src/connections/Reddit/index.ts index 191c645..6194d25 100644 --- a/src/connections/Reddit/index.ts +++ b/src/connections/Reddit/index.ts @@ -22,9 +22,9 @@ ConnectionCallbackSchema, ConnectionLoader, DiscordApiErrors, + Connection, } from "@spacebar/util"; import wretch from "wretch"; -import Connection from "../../util/connections/Connection"; import { RedditSettings } from "./RedditSettings"; export interface UserResponse { diff --git a/src/connections/Spotify/index.ts b/src/connections/Spotify/index.ts index 61b1736..50f14a3 100644 --- a/src/connections/Spotify/index.ts +++ b/src/connections/Spotify/index.ts @@ -22,9 +22,9 @@ ConnectionCallbackSchema, ConnectionLoader, DiscordApiErrors, + RefreshableConnection, } from "@spacebar/util"; import wretch from "wretch"; -import RefreshableConnection from "../../util/connections/RefreshableConnection"; import { SpotifySettings } from "./SpotifySettings"; export interface UserResponse { diff --git a/src/connections/Twitch/index.ts b/src/connections/Twitch/index.ts index 6d679aa..f9412a1 100644 --- a/src/connections/Twitch/index.ts +++ b/src/connections/Twitch/index.ts @@ -22,9 +22,9 @@ ConnectionCallbackSchema, ConnectionLoader, DiscordApiErrors, + RefreshableConnection, } from "@spacebar/util"; import wretch from "wretch"; -import RefreshableConnection from "../../util/connections/RefreshableConnection"; import { TwitchSettings } from "./TwitchSettings"; interface TwitchConnectionUserResponse { diff --git a/src/connections/Twitter/index.ts b/src/connections/Twitter/index.ts index aa48ca1..4526fdf 100644 --- a/src/connections/Twitter/index.ts +++ b/src/connections/Twitter/index.ts @@ -22,9 +22,9 @@ ConnectionCallbackSchema, ConnectionLoader, DiscordApiErrors, + RefreshableConnection, } from "@spacebar/util"; import wretch from "wretch"; -import RefreshableConnection from "../../util/connections/RefreshableConnection"; import { TwitterSettings } from "./TwitterSettings"; interface TwitterUserResponse { @@ -40,10 +40,10 @@ }; } -interface TwitterErrorResponse { - error: string; - error_description: string; -} +// interface TwitterErrorResponse { +// error: string; +// error_description: string; +// } export default class TwitterConnection extends RefreshableConnection { public readonly id = "twitter"; diff --git a/src/connections/Xbox/index.ts b/src/connections/Xbox/index.ts index c592fd0..3df09e2 100644 --- a/src/connections/Xbox/index.ts +++ b/src/connections/Xbox/index.ts @@ -22,9 +22,9 @@ ConnectionCallbackSchema, ConnectionLoader, DiscordApiErrors, + Connection, } from "@spacebar/util"; import wretch from "wretch"; -import Connection from "../../util/connections/Connection"; import { XboxSettings } from "./XboxSettings"; interface XboxUserResponse { @@ -44,10 +44,10 @@ }; } -interface XboxErrorResponse { - error: string; - error_description: string; -} +// interface XboxErrorResponse { +// error: string; +// error_description: string; +// } export default class XboxConnection extends Connection { public readonly id = "xbox"; diff --git a/src/connections/Youtube/index.ts b/src/connections/Youtube/index.ts index f3a43fc..faab44c 100644 --- a/src/connections/Youtube/index.ts +++ b/src/connections/Youtube/index.ts @@ -22,9 +22,9 @@ ConnectionCallbackSchema, ConnectionLoader, DiscordApiErrors, + Connection, } from "@spacebar/util"; import wretch from "wretch"; -import Connection from "../../util/connections/Connection"; import { YoutubeSettings } from "./YoutubeSettings"; interface YouTubeConnectionChannelListResult { diff --git a/src/util/connections/Connection.ts b/src/util/connections/Connection.ts index becee58..5bdebd4 100644 --- a/src/util/connections/Connection.ts +++ b/src/util/connections/Connection.ts @@ -24,7 +24,7 @@ /** * A connection that can be used to connect to an external service. */ -export default abstract class Connection { +export abstract class Connection { id: string; settings: { enabled: boolean }; states: Map = new Map(); diff --git a/src/util/connections/ConnectionLoader.ts b/src/util/connections/ConnectionLoader.ts index 28f1a20..6b27bae 100644 --- a/src/util/connections/ConnectionLoader.ts +++ b/src/util/connections/ConnectionLoader.ts @@ -18,7 +18,7 @@ import fs from "fs"; import path from "path"; -import Connection from "./Connection"; +import { Connection } from "@spacebar/util"; import { ConnectionConfig } from "./ConnectionConfig"; import { ConnectionStore } from "./ConnectionStore"; diff --git a/src/util/connections/ConnectionStore.ts b/src/util/connections/ConnectionStore.ts index 39abfea..95e54fd 100644 --- a/src/util/connections/ConnectionStore.ts +++ b/src/util/connections/ConnectionStore.ts @@ -16,8 +16,8 @@ along with this program. If not, see . */ -import Connection from "./Connection"; -import RefreshableConnection from "./RefreshableConnection"; +import { Connection } from "./Connection"; +import { RefreshableConnection } from "./RefreshableConnection"; export class ConnectionStore { public static connections: Map = diff --git a/src/util/connections/RefreshableConnection.ts b/src/util/connections/RefreshableConnection.ts index fd93adf..eaa88c1 100644 --- a/src/util/connections/RefreshableConnection.ts +++ b/src/util/connections/RefreshableConnection.ts @@ -18,12 +18,12 @@ import { ConnectedAccount } from "../entities"; import { ConnectedAccountCommonOAuthTokenResponse } from "../interfaces"; -import Connection from "./Connection"; +import { Connection } from "./Connection"; /** * A connection that can refresh its token. */ -export default abstract class RefreshableConnection extends Connection { +export abstract class RefreshableConnection extends Connection { refreshEnabled = true; /** * Refreshes the token for a connected account.