chore: fix lint issues
This commit is contained in:
+1
-1
@@ -8,7 +8,6 @@ export {
|
||||
type TwitterCookies,
|
||||
} from './cookies.js';
|
||||
export { runtimeQueryIds } from './runtime-query-ids.js';
|
||||
export type { TweetResult, UploadMediaResult } from './twitter-client-types.js';
|
||||
export {
|
||||
type CurrentUserResult,
|
||||
type FollowingResult,
|
||||
@@ -19,3 +18,4 @@ export {
|
||||
type TwitterClientOptions,
|
||||
type TwitterUser,
|
||||
} from './twitter-client.js';
|
||||
export type { TweetResult, UploadMediaResult } from './twitter-client-types.js';
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { randomBytes, randomUUID } from 'node:crypto';
|
||||
import { QUERY_IDS, TARGET_QUERY_ID_OPERATIONS, type OperationName } from './twitter-client-constants.js';
|
||||
import { runtimeQueryIds } from './runtime-query-ids.js';
|
||||
import { normalizeQuoteDepth } from './twitter-client-utils.js';
|
||||
import { type OperationName, QUERY_IDS, TARGET_QUERY_ID_OPERATIONS } from './twitter-client-constants.js';
|
||||
import type { CurrentUserResult, TwitterClientOptions } from './twitter-client-types.js';
|
||||
import { normalizeQuoteDepth } from './twitter-client-utils.js';
|
||||
|
||||
export type Constructor<T = {}> = new (...args: any[]) => T;
|
||||
export type AbstractConstructor<T = {}> = abstract new (...args: any[]) => T;
|
||||
export type Constructor<T = object> = new (...args: unknown[]) => T;
|
||||
export type AbstractConstructor<T = object> = abstract new (...args: unknown[]) => T;
|
||||
|
||||
export abstract class TwitterClientBase {
|
||||
protected authToken: string;
|
||||
@@ -59,9 +59,7 @@ export abstract class TwitterClientBase {
|
||||
|
||||
protected async getSearchTimelineQueryIds(): Promise<string[]> {
|
||||
const primary = await this.getQueryId('SearchTimeline');
|
||||
return Array.from(
|
||||
new Set([primary, 'M1jEez78PEfVfbQLvlWMvQ', '5h0kNbk3ii97rmfY6CdgAA', 'Tp1sewRU1AsZpBWhqCZicQ']),
|
||||
);
|
||||
return Array.from(new Set([primary, 'M1jEez78PEfVfbQLvlWMvQ', '5h0kNbk3ii97rmfY6CdgAA', 'Tp1sewRU1AsZpBWhqCZicQ']));
|
||||
}
|
||||
|
||||
protected async fetchWithTimeout(url: string, init: RequestInit): Promise<Response> {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { AbstractConstructor, TwitterClientBase } from './twitter-client-base.js';
|
||||
import { TWITTER_MEDIA_METADATA_URL, TWITTER_UPLOAD_URL } from './twitter-client-constants.js';
|
||||
import { type AbstractConstructor, type TwitterClientBase } from './twitter-client-base.js';
|
||||
import type { UploadMediaResult } from './twitter-client-types.js';
|
||||
|
||||
export function withMedia<TBase extends AbstractConstructor<TwitterClientBase>>(Base: TBase) {
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import {
|
||||
TWITTER_API_BASE,
|
||||
TWITTER_GRAPHQL_POST_URL,
|
||||
TWITTER_STATUS_UPDATE_URL,
|
||||
} from './twitter-client-constants.js';
|
||||
import type { AbstractConstructor, TwitterClientBase } from './twitter-client-base.js';
|
||||
import { TWITTER_API_BASE, TWITTER_GRAPHQL_POST_URL, TWITTER_STATUS_UPDATE_URL } from './twitter-client-constants.js';
|
||||
import { buildTweetCreateFeatures } from './twitter-client-features.js';
|
||||
import { type AbstractConstructor, type TwitterClientBase } from './twitter-client-base.js';
|
||||
import type { CreateTweetResponse, TweetResult } from './twitter-client-types.js';
|
||||
|
||||
export function withPosting<TBase extends AbstractConstructor<TwitterClientBase>>(Base: TBase) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AbstractConstructor, TwitterClientBase } from './twitter-client-base.js';
|
||||
import { TWITTER_API_BASE } from './twitter-client-constants.js';
|
||||
import { buildSearchFeatures } from './twitter-client-features.js';
|
||||
import { type AbstractConstructor, type TwitterClientBase } from './twitter-client-base.js';
|
||||
import type { SearchResult, TweetData } from './twitter-client-types.js';
|
||||
import { extractCursorFromInstructions, parseTweetsFromInstructions } from './twitter-client-utils.js';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AbstractConstructor, TwitterClientBase } from './twitter-client-base.js';
|
||||
import { TWITTER_API_BASE } from './twitter-client-constants.js';
|
||||
import { buildBookmarksFeatures, buildLikesFeatures } from './twitter-client-features.js';
|
||||
import { type AbstractConstructor, type TwitterClientBase } from './twitter-client-base.js';
|
||||
import type { SearchResult } from './twitter-client-types.js';
|
||||
import { parseTweetsFromInstructions } from './twitter-client-utils.js';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AbstractConstructor, TwitterClientBase } from './twitter-client-base.js';
|
||||
import { TWITTER_API_BASE } from './twitter-client-constants.js';
|
||||
import { buildArticleFeatures, buildArticleFieldToggles, buildTweetDetailFeatures } from './twitter-client-features.js';
|
||||
import { type AbstractConstructor, type TwitterClientBase } from './twitter-client-base.js';
|
||||
import type { GetTweetResult, GraphqlTweetResult, SearchResult } from './twitter-client-types.js';
|
||||
import {
|
||||
extractArticleText,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { AbstractConstructor, TwitterClientBase } from './twitter-client-base.js';
|
||||
import {
|
||||
SETTINGS_NAME_REGEX,
|
||||
SETTINGS_SCREEN_NAME_REGEX,
|
||||
@@ -5,7 +6,6 @@ import {
|
||||
TWITTER_API_BASE,
|
||||
} from './twitter-client-constants.js';
|
||||
import { buildFollowingFeatures } from './twitter-client-features.js';
|
||||
import { type AbstractConstructor, type TwitterClientBase } from './twitter-client-base.js';
|
||||
import type { CurrentUserResult, FollowingResult } from './twitter-client-types.js';
|
||||
import { parseUsersFromInstructions } from './twitter-client-utils.js';
|
||||
|
||||
|
||||
@@ -6,7 +6,9 @@ import { withTimelines } from './twitter-client-timelines.js';
|
||||
import { withTweetDetails } from './twitter-client-tweet-detail.js';
|
||||
import { withUsers } from './twitter-client-users.js';
|
||||
|
||||
const MixedTwitterClient = withUsers(withTimelines(withSearch(withTweetDetails(withPosting(withMedia(TwitterClientBase))))));
|
||||
const MixedTwitterClient = withUsers(
|
||||
withTimelines(withSearch(withTweetDetails(withPosting(withMedia(TwitterClientBase))))),
|
||||
);
|
||||
|
||||
export class TwitterClient extends MixedTwitterClient {}
|
||||
|
||||
@@ -16,8 +18,8 @@ export type {
|
||||
GetTweetResult,
|
||||
SearchResult,
|
||||
TweetData,
|
||||
TwitterClientOptions,
|
||||
TweetResult,
|
||||
TwitterClientOptions,
|
||||
TwitterUser,
|
||||
UploadMediaResult,
|
||||
} from './twitter-client-types.js';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { TwitterClient } from '../src/lib/twitter-client.js';
|
||||
import type { TwitterClient } from '../src/lib/twitter-client.js';
|
||||
|
||||
export const validCookies = {
|
||||
authToken: 'test_auth_token',
|
||||
|
||||
@@ -172,9 +172,7 @@ describe('TwitterClient getTweet', () => {
|
||||
const result = await client.getTweet('article123');
|
||||
|
||||
expect(result.success).toBe(true);
|
||||
expect(result.tweet?.text).toBe(
|
||||
'2025 LLM Year in Review\n\nIntro paragraph of the article.\n\nSecond paragraph.',
|
||||
);
|
||||
expect(result.tweet?.text).toBe('2025 LLM Year in Review\n\nIntro paragraph of the article.\n\nSecond paragraph.');
|
||||
});
|
||||
|
||||
it('should fall back to user article timeline for plain text', async () => {
|
||||
|
||||
@@ -551,9 +551,7 @@ describe('TwitterClient bookmark folders', () => {
|
||||
expect(result.success).toBe(true);
|
||||
expect(mockFetch).toHaveBeenCalledTimes(2);
|
||||
|
||||
const firstVars = JSON.parse(
|
||||
new URL(mockFetch.mock.calls[0][0] as string).searchParams.get('variables') as string,
|
||||
);
|
||||
const firstVars = JSON.parse(new URL(mockFetch.mock.calls[0][0] as string).searchParams.get('variables') as string);
|
||||
const secondVars = JSON.parse(
|
||||
new URL(mockFetch.mock.calls[1][0] as string).searchParams.get('variables') as string,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user