Fix connection class imports

This commit is contained in:
Puyodead1 2023-08-06 22:56:13 -04:00
parent 033e2108e7
commit 5c8359ec45
No known key found for this signature in database
GPG Key ID: A4FA4FEC0DD353FC
16 changed files with 30 additions and 30 deletions

View File

@ -23,9 +23,9 @@ import {
ConnectionStore, ConnectionStore,
DiscordApiErrors, DiscordApiErrors,
FieldErrors, FieldErrors,
RefreshableConnection,
} from "@spacebar/util"; } from "@spacebar/util";
import { Request, Response, Router } from "express"; import { Request, Response, Router } from "express";
import RefreshableConnection from "../../../../../../../util/connections/RefreshableConnection";
const router = Router(); const router = Router();
// TODO: this route is only used for spotify, twitch, and youtube. (battlenet seems to be able to PUT, maybe others also) // TODO: this route is only used for spotify, twitch, and youtube. (battlenet seems to be able to PUT, maybe others also)

View File

@ -22,9 +22,9 @@ import {
ConnectionCallbackSchema, ConnectionCallbackSchema,
ConnectionLoader, ConnectionLoader,
DiscordApiErrors, DiscordApiErrors,
Connection,
} from "@spacebar/util"; } from "@spacebar/util";
import wretch from "wretch"; import wretch from "wretch";
import Connection from "../../util/connections/Connection";
import { BattleNetSettings } from "./BattleNetSettings"; import { BattleNetSettings } from "./BattleNetSettings";
interface BattleNetConnectionUser { interface BattleNetConnectionUser {
@ -33,10 +33,10 @@ interface BattleNetConnectionUser {
battletag: string; battletag: string;
} }
interface BattleNetErrorResponse { // interface BattleNetErrorResponse {
error: string; // error: string;
error_description: string; // error_description: string;
} // }
export default class BattleNetConnection extends Connection { export default class BattleNetConnection extends Connection {
public readonly id = "battlenet"; public readonly id = "battlenet";

View File

@ -22,9 +22,9 @@ import {
ConnectionCallbackSchema, ConnectionCallbackSchema,
ConnectionLoader, ConnectionLoader,
DiscordApiErrors, DiscordApiErrors,
Connection,
} from "@spacebar/util"; } from "@spacebar/util";
import wretch from "wretch"; import wretch from "wretch";
import Connection from "../../util/connections/Connection";
import { DiscordSettings } from "./DiscordSettings"; import { DiscordSettings } from "./DiscordSettings";
interface UserResponse { interface UserResponse {

View File

@ -22,9 +22,9 @@ import {
ConnectionCallbackSchema, ConnectionCallbackSchema,
ConnectionLoader, ConnectionLoader,
DiscordApiErrors, DiscordApiErrors,
Connection,
} from "@spacebar/util"; } from "@spacebar/util";
import wretch from "wretch"; import wretch from "wretch";
import Connection from "../../util/connections/Connection";
import { EpicGamesSettings } from "./EpicGamesSettings"; import { EpicGamesSettings } from "./EpicGamesSettings";
export interface UserResponse { export interface UserResponse {

View File

@ -22,9 +22,9 @@ import {
ConnectionCallbackSchema, ConnectionCallbackSchema,
ConnectionLoader, ConnectionLoader,
DiscordApiErrors, DiscordApiErrors,
Connection,
} from "@spacebar/util"; } from "@spacebar/util";
import wretch from "wretch"; import wretch from "wretch";
import Connection from "../../util/connections/Connection";
import { FacebookSettings } from "./FacebookSettings"; import { FacebookSettings } from "./FacebookSettings";
export interface FacebookErrorResponse { export interface FacebookErrorResponse {

View File

@ -22,9 +22,9 @@ import {
ConnectionCallbackSchema, ConnectionCallbackSchema,
ConnectionLoader, ConnectionLoader,
DiscordApiErrors, DiscordApiErrors,
Connection,
} from "@spacebar/util"; } from "@spacebar/util";
import wretch from "wretch"; import wretch from "wretch";
import Connection from "../../util/connections/Connection";
import { GitHubSettings } from "./GitHubSettings"; import { GitHubSettings } from "./GitHubSettings";
interface UserResponse { interface UserResponse {

View File

@ -22,9 +22,9 @@ import {
ConnectionCallbackSchema, ConnectionCallbackSchema,
ConnectionLoader, ConnectionLoader,
DiscordApiErrors, DiscordApiErrors,
Connection,
} from "@spacebar/util"; } from "@spacebar/util";
import wretch from "wretch"; import wretch from "wretch";
import Connection from "../../util/connections/Connection";
import { RedditSettings } from "./RedditSettings"; import { RedditSettings } from "./RedditSettings";
export interface UserResponse { export interface UserResponse {

View File

@ -22,9 +22,9 @@ import {
ConnectionCallbackSchema, ConnectionCallbackSchema,
ConnectionLoader, ConnectionLoader,
DiscordApiErrors, DiscordApiErrors,
RefreshableConnection,
} from "@spacebar/util"; } from "@spacebar/util";
import wretch from "wretch"; import wretch from "wretch";
import RefreshableConnection from "../../util/connections/RefreshableConnection";
import { SpotifySettings } from "./SpotifySettings"; import { SpotifySettings } from "./SpotifySettings";
export interface UserResponse { export interface UserResponse {

View File

@ -22,9 +22,9 @@ import {
ConnectionCallbackSchema, ConnectionCallbackSchema,
ConnectionLoader, ConnectionLoader,
DiscordApiErrors, DiscordApiErrors,
RefreshableConnection,
} from "@spacebar/util"; } from "@spacebar/util";
import wretch from "wretch"; import wretch from "wretch";
import RefreshableConnection from "../../util/connections/RefreshableConnection";
import { TwitchSettings } from "./TwitchSettings"; import { TwitchSettings } from "./TwitchSettings";
interface TwitchConnectionUserResponse { interface TwitchConnectionUserResponse {

View File

@ -22,9 +22,9 @@ import {
ConnectionCallbackSchema, ConnectionCallbackSchema,
ConnectionLoader, ConnectionLoader,
DiscordApiErrors, DiscordApiErrors,
RefreshableConnection,
} from "@spacebar/util"; } from "@spacebar/util";
import wretch from "wretch"; import wretch from "wretch";
import RefreshableConnection from "../../util/connections/RefreshableConnection";
import { TwitterSettings } from "./TwitterSettings"; import { TwitterSettings } from "./TwitterSettings";
interface TwitterUserResponse { interface TwitterUserResponse {
@ -40,10 +40,10 @@ interface TwitterUserResponse {
}; };
} }
interface TwitterErrorResponse { // interface TwitterErrorResponse {
error: string; // error: string;
error_description: string; // error_description: string;
} // }
export default class TwitterConnection extends RefreshableConnection { export default class TwitterConnection extends RefreshableConnection {
public readonly id = "twitter"; public readonly id = "twitter";

View File

@ -22,9 +22,9 @@ import {
ConnectionCallbackSchema, ConnectionCallbackSchema,
ConnectionLoader, ConnectionLoader,
DiscordApiErrors, DiscordApiErrors,
Connection,
} from "@spacebar/util"; } from "@spacebar/util";
import wretch from "wretch"; import wretch from "wretch";
import Connection from "../../util/connections/Connection";
import { XboxSettings } from "./XboxSettings"; import { XboxSettings } from "./XboxSettings";
interface XboxUserResponse { interface XboxUserResponse {
@ -44,10 +44,10 @@ interface XboxUserResponse {
}; };
} }
interface XboxErrorResponse { // interface XboxErrorResponse {
error: string; // error: string;
error_description: string; // error_description: string;
} // }
export default class XboxConnection extends Connection { export default class XboxConnection extends Connection {
public readonly id = "xbox"; public readonly id = "xbox";

View File

@ -22,9 +22,9 @@ import {
ConnectionCallbackSchema, ConnectionCallbackSchema,
ConnectionLoader, ConnectionLoader,
DiscordApiErrors, DiscordApiErrors,
Connection,
} from "@spacebar/util"; } from "@spacebar/util";
import wretch from "wretch"; import wretch from "wretch";
import Connection from "../../util/connections/Connection";
import { YoutubeSettings } from "./YoutubeSettings"; import { YoutubeSettings } from "./YoutubeSettings";
interface YouTubeConnectionChannelListResult { interface YouTubeConnectionChannelListResult {

View File

@ -24,7 +24,7 @@ import { Config, DiscordApiErrors } from "../util";
/** /**
* A connection that can be used to connect to an external service. * A connection that can be used to connect to an external service.
*/ */
export default abstract class Connection { export abstract class Connection {
id: string; id: string;
settings: { enabled: boolean }; settings: { enabled: boolean };
states: Map<string, string> = new Map(); states: Map<string, string> = new Map();

View File

@ -18,7 +18,7 @@
import fs from "fs"; import fs from "fs";
import path from "path"; import path from "path";
import Connection from "./Connection"; import { Connection } from "@spacebar/util";
import { ConnectionConfig } from "./ConnectionConfig"; import { ConnectionConfig } from "./ConnectionConfig";
import { ConnectionStore } from "./ConnectionStore"; import { ConnectionStore } from "./ConnectionStore";

View File

@ -16,8 +16,8 @@
along with this program. If not, see <https://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import Connection from "./Connection"; import { Connection } from "./Connection";
import RefreshableConnection from "./RefreshableConnection"; import { RefreshableConnection } from "./RefreshableConnection";
export class ConnectionStore { export class ConnectionStore {
public static connections: Map<string, Connection | RefreshableConnection> = public static connections: Map<string, Connection | RefreshableConnection> =

View File

@ -18,12 +18,12 @@
import { ConnectedAccount } from "../entities"; import { ConnectedAccount } from "../entities";
import { ConnectedAccountCommonOAuthTokenResponse } from "../interfaces"; import { ConnectedAccountCommonOAuthTokenResponse } from "../interfaces";
import Connection from "./Connection"; import { Connection } from "./Connection";
/** /**
* A connection that can refresh its token. * A connection that can refresh its token.
*/ */
export default abstract class RefreshableConnection extends Connection { export abstract class RefreshableConnection extends Connection {
refreshEnabled = true; refreshEnabled = true;
/** /**
* Refreshes the token for a connected account. * Refreshes the token for a connected account.