diff --git a/src/core/Actions.ts b/src/core/Actions.ts index 30461675..fda837a7 100644 --- a/src/core/Actions.ts +++ b/src/core/Actions.ts @@ -1,7 +1,7 @@ import { Parser, NavigateAction } from '../parser/index.js'; import { InnertubeError } from '../utils/Utils.js'; -import type Session from './Session.js'; +import type { Session } from './index.js'; import type { IBrowseResponse, IGetNotificationsMenuResponse, diff --git a/src/core/Session.ts b/src/core/Session.ts index b6f81492..9b7b30e0 100644 --- a/src/core/Session.ts +++ b/src/core/Session.ts @@ -1,9 +1,9 @@ -import Player from './Player.js'; import OAuth from './OAuth.js'; -import Actions from './Actions.js'; import { Log, EventEmitter, HTTPClient } from '../utils/index.js'; import * as Constants from '../utils/Constants.js'; import * as Proto from '../proto/index.js'; +import Actions from './Actions.js'; +import Player from './Player.js'; import { generateRandomString, getRandomUserAgent, diff --git a/src/core/clients/Kids.ts b/src/core/clients/Kids.ts index 5f160742..43caedc3 100644 --- a/src/core/clients/Kids.ts +++ b/src/core/clients/Kids.ts @@ -10,8 +10,7 @@ import { import { BlocklistPickerEndpoint } from '../endpoints/kids/index.js'; -import type Session from '../Session.js'; -import type { ApiResponse } from '../index.js'; +import type { Session, ApiResponse } from '../index.js'; export default class Kids { #session: Session; diff --git a/src/core/clients/Music.ts b/src/core/clients/Music.ts index 2fa45d99..9820bf9f 100644 --- a/src/core/clients/Music.ts +++ b/src/core/clients/Music.ts @@ -29,8 +29,7 @@ import { GetSearchSuggestionsEndpoint } from '../endpoints/music/index.js'; import type { ObservedArray } from '../../parser/helpers.js'; import type { MusicSearchFilters } from '../../types/index.js'; -import type Session from '../Session.js'; -import type Actions from '../Actions.js'; +import type { Actions, Session } from '../index.js'; export default class Music { #session: Session; diff --git a/src/core/clients/Studio.ts b/src/core/clients/Studio.ts index 8e47a12f..81ebd31c 100644 --- a/src/core/clients/Studio.ts +++ b/src/core/clients/Studio.ts @@ -4,8 +4,7 @@ import { InnertubeError, MissingParamError, Platform } from '../../utils/Utils.j import { CreateVideoEndpoint } from '../endpoints/upload/index.js'; import type { UpdateVideoMetadataOptions, UploadedVideoMetadataOptions } from '../../types/Clients.js'; -import type Session from '../Session.js'; -import type { ApiResponse } from '../Actions.js'; +import type { ApiResponse, Session } from '../index.js'; interface UploadResult { status: string; diff --git a/src/core/managers/AccountManager.ts b/src/core/managers/AccountManager.ts index 9ae8c8ea..a5bf551d 100644 --- a/src/core/managers/AccountManager.ts +++ b/src/core/managers/AccountManager.ts @@ -1,3 +1,5 @@ +import type { Actions, ApiResponse } from '../index.js'; + import AccountInfo from '../../parser/youtube/AccountInfo.js'; import Analytics from '../../parser/youtube/Analytics.js'; import Settings from '../../parser/youtube/Settings.js'; @@ -7,9 +9,6 @@ import * as Proto from '../../proto/index.js'; import { InnertubeError } from '../../utils/Utils.js'; import { Account, BrowseEndpoint, Channel } from '../endpoints/index.js'; -import type Actions from '../Actions.js'; -import type { ApiResponse } from '../Actions.js'; - export default class AccountManager { #actions: Actions; diff --git a/src/core/managers/InteractionManager.ts b/src/core/managers/InteractionManager.ts index df11aa3d..adfadfbe 100644 --- a/src/core/managers/InteractionManager.ts +++ b/src/core/managers/InteractionManager.ts @@ -6,8 +6,7 @@ import { SubscribeEndpoint, UnsubscribeEndpoint } from '../endpoints/subscriptio import { CreateCommentEndpoint, PerformCommentActionEndpoint } from '../endpoints/comment/index.js'; import { ModifyChannelPreferenceEndpoint } from '../endpoints/notification/index.js'; -import type Actions from '../Actions.js'; -import type { ApiResponse } from '../Actions.js'; +import type { Actions, ApiResponse } from '../index.js'; export default class InteractionManager { #actions: Actions; diff --git a/src/core/managers/PlaylistManager.ts b/src/core/managers/PlaylistManager.ts index bb908b89..7c1cc8f1 100644 --- a/src/core/managers/PlaylistManager.ts +++ b/src/core/managers/PlaylistManager.ts @@ -4,7 +4,7 @@ import { BrowseEndpoint } from '../endpoints/index.js'; import { CreateEndpoint, DeleteEndpoint } from '../endpoints/playlist/index.js'; import Playlist from '../../parser/youtube/Playlist.js'; -import type Actions from '../Actions.js'; +import type { Actions } from '../index.js'; import type { Feed } from '../mixins/index.js'; import type { EditPlaylistEndpointOptions } from '../../types/index.js'; diff --git a/src/core/mixins/Feed.ts b/src/core/mixins/Feed.ts index e23fdfd5..5c490652 100644 --- a/src/core/mixins/Feed.ts +++ b/src/core/mixins/Feed.ts @@ -25,6 +25,7 @@ import TwoColumnBrowseResults from '../../parser/classes/TwoColumnBrowseResults. import TwoColumnSearchResults from '../../parser/classes/TwoColumnSearchResults.js'; import WatchCardCompactVideo from '../../parser/classes/WatchCardCompactVideo.js'; +import type { ApiResponse, Actions } from '../index.js'; import type { Memo, ObservedArray, SuperParsedResult, YTNode @@ -33,8 +34,6 @@ import type MusicQueue from '../../parser/classes/MusicQueue.js'; import type RichGrid from '../../parser/classes/RichGrid.js'; import type SectionList from '../../parser/classes/SectionList.js'; import type { IParsedResponse } from '../../parser/types/index.js'; -import type Actions from '../Actions.js'; -import type { ApiResponse } from '../Actions.js'; export default class Feed { #page: T; diff --git a/src/core/mixins/FilterableFeed.ts b/src/core/mixins/FilterableFeed.ts index bc42c2ea..1ca89246 100644 --- a/src/core/mixins/FilterableFeed.ts +++ b/src/core/mixins/FilterableFeed.ts @@ -5,8 +5,7 @@ import { InnertubeError } from '../../utils/Utils.js'; import type { ObservedArray } from '../../parser/helpers.js'; import type { IParsedResponse } from '../../parser/types/index.js'; -import type Actions from '../Actions.js'; -import type { ApiResponse } from '../Actions.js'; +import type { ApiResponse, Actions } from '../index.js'; export default class FilterableFeed extends Feed { #chips?: ObservedArray; diff --git a/src/core/mixins/MediaInfo.ts b/src/core/mixins/MediaInfo.ts index 6dced399..36fb3c15 100644 --- a/src/core/mixins/MediaInfo.ts +++ b/src/core/mixins/MediaInfo.ts @@ -6,12 +6,11 @@ import { Parser } from '../../parser/index.js'; import { TranscriptInfo } from '../../parser/youtube/index.js'; import ContinuationItem from '../../parser/classes/ContinuationItem.js'; +import type { ApiResponse, Actions } from '../index.js'; import type { INextResponse, IPlayerConfig, IPlayerResponse } from '../../parser/index.js'; import type { DownloadOptions, FormatFilter, FormatOptions, URLTransformer } from '../../types/FormatUtils.js'; import type Format from '../../parser/classes/misc/Format.js'; import type { DashOptions } from '../../types/DashOptions.js'; -import type Actions from '../Actions.js'; -import type { ApiResponse } from '../Actions.js'; export default class MediaInfo { #page: [IPlayerResponse, INextResponse?]; diff --git a/src/core/mixins/TabbedFeed.ts b/src/core/mixins/TabbedFeed.ts index 855f8fd2..3a509f01 100644 --- a/src/core/mixins/TabbedFeed.ts +++ b/src/core/mixins/TabbedFeed.ts @@ -2,8 +2,7 @@ import { Feed } from './index.js'; import { InnertubeError } from '../../utils/Utils.js'; import Tab from '../../parser/classes/Tab.js'; -import type Actions from '../Actions.js'; -import type { ApiResponse } from '../Actions.js'; +import type { Actions, ApiResponse } from '../index.js'; import type { ObservedArray } from '../../parser/helpers.js'; import type { IParsedResponse } from '../../parser/types/ParsedResponse.js'; diff --git a/src/parser/helpers.ts b/src/parser/helpers.ts index 4de57368..a49da0ad 100644 --- a/src/parser/helpers.ts +++ b/src/parser/helpers.ts @@ -1,4 +1,4 @@ -import { Log } from '../utils/index.js'; +import Log from '../utils/Log.js'; import { deepCompare, ParsingError } from '../utils/Utils.js'; const isObserved = Symbol('ObservedArray.isObserved'); @@ -66,7 +66,7 @@ export class Maybe { #TAG = 'Maybe'; #value; - constructor(value: any) { + constructor (value: any) { this.#value = value; } @@ -309,12 +309,12 @@ export class Maybe { } export interface Constructor { - new(...args: any[]): T; + new (...args: any[]): T; } export interface YTNodeConstructor { - new(data: any): T; - readonly type: string; + new(data: any): T; + readonly type: string; } /** @@ -354,38 +354,38 @@ export class SuperParsedResult { export type ObservedArray = Array & { - /** - * Returns the first object to match the rule. - */ - get: (rule: object, del_item?: boolean) => T | undefined; - /** - * Returns all objects that match the rule. - */ - getAll: (rule: object, del_items?: boolean) => T[]; - /** - * Returns the first object to match the condition. - */ - matchCondition: (condition: (node: T) => boolean) => T | undefined; - /** - * Removes the item at the given index. - */ - remove: (index: number) => T[]; - /** - * Get all items of a specific type - */ - filterType[]>(...types: K): ObservedArray>; - /** - * Get the first of a specific type - */ - firstOfType[]>(...types: K): InstanceType | undefined; - /** - * Get the first item - */ - first: () => T; - /** - * This is similar to filter but throws if there's a type mismatch. - */ - as[]>(...types: K): ObservedArray>; + /** + * Returns the first object to match the rule. + */ + get: (rule: object, del_item?: boolean) => T | undefined; + /** + * Returns all objects that match the rule. + */ + getAll: (rule: object, del_items?: boolean) => T[]; + /** + * Returns the first object to match the condition. + */ + matchCondition: (condition: (node: T) => boolean) => T | undefined; + /** + * Removes the item at the given index. + */ + remove: (index: number) => T[]; + /** + * Get all items of a specific type + */ + filterType[]>(...types: K): ObservedArray>; + /** + * Get the first of a specific type + */ + firstOfType[]>(...types: K): InstanceType | undefined; + /** + * Get the first item + */ + first: () => T; + /** + * This is similar to filter but throws if there's a type mismatch. + */ + as[]>(...types: K): ObservedArray>; }; /**