@hasna/connectors 1.3.36 → 1.3.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/index.js +167 -241
- package/bin/mcp.js +190 -267
- package/bin/serve.js +264 -341
- package/connectors/bluesky/README.md +34 -0
- package/connectors/bluesky/package.json +41 -0
- package/connectors/bluesky/src/api/client.test.ts +122 -0
- package/connectors/bluesky/src/api/client.ts +194 -0
- package/connectors/bluesky/src/api/index.ts +108 -0
- package/connectors/bluesky/src/index.ts +17 -0
- package/connectors/bluesky/src/types/index.ts +46 -0
- package/connectors/bluesky/tsconfig.json +16 -0
- package/connectors/x/src/api/media.ts +4 -3
- package/dashboard/dist/assets/index-CUbp3qRv.js +284 -0
- package/dashboard/dist/assets/index-ClBXkNbL.css +1 -0
- package/dashboard/dist/index.html +2 -2
- package/dist/.types/connectors/bluesky/src/api/client.d.ts +73 -0
- package/dist/.types/connectors/bluesky/src/api/index.d.ts +76 -0
- package/dist/.types/connectors/bluesky/src/index.d.ts +11 -0
- package/dist/.types/connectors/bluesky/src/types/index.d.ts +33 -0
- package/dist/.types/connectors/x/src/api/client.d.ts +96 -0
- package/dist/.types/connectors/x/src/api/index.d.ts +80 -0
- package/dist/.types/connectors/x/src/api/media.d.ts +54 -0
- package/dist/.types/connectors/x/src/api/oauth.d.ts +82 -0
- package/dist/.types/connectors/x/src/api/oauth1.d.ts +68 -0
- package/dist/.types/connectors/x/src/api/tweets.d.ts +175 -0
- package/dist/.types/connectors/x/src/api/users.d.ts +127 -0
- package/dist/.types/connectors/x/src/cli/index.d.ts +2 -0
- package/dist/.types/connectors/x/src/index.d.ts +6 -0
- package/dist/.types/connectors/x/src/types/index.d.ts +156 -0
- package/dist/.types/connectors/x/src/utils/config.d.ts +99 -0
- package/dist/.types/connectors/x/src/utils/output.d.ts +8 -0
- package/dist/.types/src/social/bluesky.d.ts +65 -0
- package/dist/.types/src/social/errors.d.ts +9 -0
- package/dist/.types/src/social/googlebusinessprofile.d.ts +40 -0
- package/dist/.types/src/social/http.d.ts +37 -0
- package/dist/.types/src/social/index.d.ts +16 -0
- package/dist/.types/src/social/linkedin.d.ts +29 -0
- package/dist/.types/src/social/mastodon.d.ts +32 -0
- package/dist/.types/src/social/pinterest.d.ts +31 -0
- package/dist/.types/src/social/reddit.d.ts +31 -0
- package/dist/.types/src/social/tiktok.d.ts +24 -0
- package/dist/.types/src/social/types.d.ts +79 -0
- package/dist/.types/src/social/util.d.ts +5 -0
- package/dist/.types/src/social/x.d.ts +82 -0
- package/dist/.types/src/social/youtube.d.ts +29 -0
- package/dist/cli/components/App.d.ts +1 -2
- package/dist/cli/components/CategorySelect.d.ts +1 -2
- package/dist/cli/components/ConnectorSelect.d.ts +1 -2
- package/dist/cli/components/Header.d.ts +1 -2
- package/dist/cli/components/InstallProgress.d.ts +1 -2
- package/dist/cli/components/SearchView.d.ts +1 -2
- package/dist/index.js +122 -109
- package/dist/social/index.js +2303 -0
- package/package.json +7 -3
- package/dashboard/dist/assets/index-DJjxFlTl.css +0 -1
- package/dashboard/dist/assets/index-DNPZ58_i.js +0 -284
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared, bundle-safe HTTP helper for the stateless social adapters.
|
|
3
|
+
*
|
|
4
|
+
* Provides an injectable `FetchLike` (so tests can mock the network) and a small
|
|
5
|
+
* JSON request helper. Uses only `globalThis.fetch` / `URLSearchParams` / `Buffer`
|
|
6
|
+
* — NO `node:fs`, NO `child_process`, NO db/runner/storage imports.
|
|
7
|
+
*/
|
|
8
|
+
/** Injectable fetch so tests can mock the network without real I/O. */
|
|
9
|
+
export type FetchLike = (input: string, init?: {
|
|
10
|
+
method?: string;
|
|
11
|
+
headers?: Record<string, string>;
|
|
12
|
+
body?: unknown;
|
|
13
|
+
}) => Promise<{
|
|
14
|
+
ok: boolean;
|
|
15
|
+
status: number;
|
|
16
|
+
statusText?: string;
|
|
17
|
+
/** Present on real fetch Responses; some adapters (e.g. resumable uploads) read it. */
|
|
18
|
+
headers?: {
|
|
19
|
+
get(name: string): string | null;
|
|
20
|
+
};
|
|
21
|
+
text(): Promise<string>;
|
|
22
|
+
}>;
|
|
23
|
+
export declare function resolveFetch(fetchImpl?: FetchLike): FetchLike;
|
|
24
|
+
export interface JsonRequestOptions {
|
|
25
|
+
method?: string;
|
|
26
|
+
headers?: Record<string, string>;
|
|
27
|
+
body?: unknown;
|
|
28
|
+
query?: Record<string, string | number | boolean | undefined | null>;
|
|
29
|
+
/** Override how the error message is extracted from a parsed error body. */
|
|
30
|
+
errorLabel?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Perform a JSON request and parse the response. Throws on non-2xx with a useful
|
|
34
|
+
* message. `body` is JSON-serialized for non-GET requests unless it is already a
|
|
35
|
+
* string or FormData.
|
|
36
|
+
*/
|
|
37
|
+
export declare function jsonRequest<T>(fetchImpl: FetchLike, url: string, options?: JsonRequestOptions): Promise<T>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { ConnectorOperationNotSupported } from "./errors";
|
|
2
|
+
export type { AccountMeResult, AnalyticsPostInput, AnalyticsPostResult, MediaUploadInput, MediaUploadResult, MentionItem, MentionsListInput, MentionsListResult, PostCreateInput, PostCreateResult, PostDeleteInput, PostDeleteResult, SocialConnectorSlug, SocialOperation, } from "./types";
|
|
3
|
+
export interface RunSocialOperationArgs {
|
|
4
|
+
connector: string;
|
|
5
|
+
operation: string;
|
|
6
|
+
input?: Record<string, unknown>;
|
|
7
|
+
credentials?: Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
/** List the social connector slugs supported by this SDK. */
|
|
10
|
+
export declare function listSocialConnectors(): string[];
|
|
11
|
+
/** List the normalized operations a connector implements. */
|
|
12
|
+
export declare function getSocialOperations(connector: string): string[];
|
|
13
|
+
/**
|
|
14
|
+
* Execute one normalized social operation. Stateless: all credentials are passed in.
|
|
15
|
+
*/
|
|
16
|
+
export declare function runSocialOperation(args: RunSocialOperationArgs): Promise<unknown>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type FetchLike } from "./http";
|
|
2
|
+
import type { AccountMeResult, AnalyticsPostInput, AnalyticsPostResult, MediaUploadInput, MediaUploadResult, MentionsListInput, MentionsListResult, PostCreateInput, PostCreateResult, PostDeleteInput, PostDeleteResult, SocialAdapter } from "./types";
|
|
3
|
+
export interface LinkedInCredentials {
|
|
4
|
+
accessToken: string;
|
|
5
|
+
/** Author URN, e.g. "urn:li:person:abc123". Resolved from /me if omitted. */
|
|
6
|
+
authorUrn?: string;
|
|
7
|
+
baseUrl?: string;
|
|
8
|
+
}
|
|
9
|
+
/** LinkedIn `post.create` extras. */
|
|
10
|
+
export interface LinkedInPostExtras {
|
|
11
|
+
/** Visibility: PUBLIC (default) or CONNECTIONS. */
|
|
12
|
+
visibility?: "PUBLIC" | "CONNECTIONS";
|
|
13
|
+
}
|
|
14
|
+
export declare class LinkedInAdapter implements SocialAdapter {
|
|
15
|
+
private readonly accessToken;
|
|
16
|
+
private readonly baseUrl;
|
|
17
|
+
private authorUrn?;
|
|
18
|
+
private readonly fetchImpl;
|
|
19
|
+
constructor(creds: LinkedInCredentials, fetchImpl?: FetchLike);
|
|
20
|
+
static fromCredentials(creds: LinkedInCredentials, fetchImpl?: FetchLike): LinkedInAdapter;
|
|
21
|
+
private headers;
|
|
22
|
+
private resolveAuthorUrn;
|
|
23
|
+
accountMe(): Promise<AccountMeResult>;
|
|
24
|
+
postCreate(input: PostCreateInput & LinkedInPostExtras): Promise<PostCreateResult>;
|
|
25
|
+
postDelete(input: PostDeleteInput): Promise<PostDeleteResult>;
|
|
26
|
+
mediaUpload(input: MediaUploadInput): Promise<MediaUploadResult>;
|
|
27
|
+
mentionsList(_input?: MentionsListInput): Promise<MentionsListResult>;
|
|
28
|
+
analyticsPost(_input: AnalyticsPostInput): Promise<AnalyticsPostResult>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { AccountMeResult, AnalyticsPostInput, AnalyticsPostResult, MediaUploadInput, MentionsListInput, MentionsListResult, PostCreateInput, PostCreateResult, PostDeleteInput, PostDeleteResult, SocialAdapter } from "./types";
|
|
2
|
+
/** Injectable fetch so tests can mock the network. */
|
|
3
|
+
export type FetchLike = (input: string, init?: {
|
|
4
|
+
method?: string;
|
|
5
|
+
headers?: Record<string, string>;
|
|
6
|
+
body?: unknown;
|
|
7
|
+
}) => Promise<{
|
|
8
|
+
ok: boolean;
|
|
9
|
+
status: number;
|
|
10
|
+
statusText?: string;
|
|
11
|
+
text(): Promise<string>;
|
|
12
|
+
}>;
|
|
13
|
+
export interface MastodonCredentials {
|
|
14
|
+
accessToken: string;
|
|
15
|
+
baseUrl: string;
|
|
16
|
+
}
|
|
17
|
+
export declare class MastodonAdapter implements SocialAdapter {
|
|
18
|
+
private readonly accessToken;
|
|
19
|
+
private readonly baseUrl;
|
|
20
|
+
private readonly fetchImpl;
|
|
21
|
+
constructor(creds: MastodonCredentials, fetchImpl?: FetchLike);
|
|
22
|
+
static fromCredentials(creds: MastodonCredentials, fetchImpl?: FetchLike): MastodonAdapter;
|
|
23
|
+
private call;
|
|
24
|
+
accountMe(): Promise<AccountMeResult>;
|
|
25
|
+
postCreate(input: PostCreateInput): Promise<PostCreateResult>;
|
|
26
|
+
postDelete(input: PostDeleteInput): Promise<PostDeleteResult>;
|
|
27
|
+
mediaUpload(input: MediaUploadInput): Promise<{
|
|
28
|
+
mediaId: string;
|
|
29
|
+
}>;
|
|
30
|
+
mentionsList(input?: MentionsListInput): Promise<MentionsListResult>;
|
|
31
|
+
analyticsPost(input: AnalyticsPostInput): Promise<AnalyticsPostResult>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type FetchLike } from "./http";
|
|
2
|
+
import type { AccountMeResult, AnalyticsPostInput, AnalyticsPostResult, MediaUploadInput, MediaUploadResult, MentionsListInput, MentionsListResult, PostCreateInput, PostCreateResult, PostDeleteInput, PostDeleteResult, SocialAdapter } from "./types";
|
|
3
|
+
export interface PinterestCredentials {
|
|
4
|
+
accessToken: string;
|
|
5
|
+
boardId?: string;
|
|
6
|
+
}
|
|
7
|
+
/** Pinterest `post.create` extras. A pin needs an image: a mediaId or an imageUrl. */
|
|
8
|
+
export interface PinterestPostExtras {
|
|
9
|
+
/** Board to pin to (REQUIRED unless provided via credentials). */
|
|
10
|
+
boardId?: string;
|
|
11
|
+
/** Public image URL (used when no uploaded mediaId is supplied). */
|
|
12
|
+
imageUrl?: string;
|
|
13
|
+
/** Destination link for the pin. */
|
|
14
|
+
link?: string;
|
|
15
|
+
/** Pin title (defaults to undefined; `text` becomes the description). */
|
|
16
|
+
title?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare class PinterestAdapter implements SocialAdapter {
|
|
19
|
+
private readonly accessToken;
|
|
20
|
+
private readonly defaultBoardId?;
|
|
21
|
+
private readonly fetchImpl;
|
|
22
|
+
constructor(creds: PinterestCredentials, fetchImpl?: FetchLike);
|
|
23
|
+
static fromCredentials(creds: PinterestCredentials, fetchImpl?: FetchLike): PinterestAdapter;
|
|
24
|
+
private headers;
|
|
25
|
+
accountMe(): Promise<AccountMeResult>;
|
|
26
|
+
postCreate(input: PostCreateInput & PinterestPostExtras): Promise<PostCreateResult>;
|
|
27
|
+
postDelete(input: PostDeleteInput): Promise<PostDeleteResult>;
|
|
28
|
+
mediaUpload(input: MediaUploadInput): Promise<MediaUploadResult>;
|
|
29
|
+
mentionsList(_input?: MentionsListInput): Promise<MentionsListResult>;
|
|
30
|
+
analyticsPost(input: AnalyticsPostInput): Promise<AnalyticsPostResult>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type FetchLike } from "./http";
|
|
2
|
+
import type { AccountMeResult, AnalyticsPostInput, AnalyticsPostResult, MediaUploadInput, MediaUploadResult, MentionsListInput, MentionsListResult, PostCreateInput, PostCreateResult, PostDeleteInput, PostDeleteResult, SocialAdapter } from "./types";
|
|
3
|
+
export interface RedditCredentials {
|
|
4
|
+
accessToken: string;
|
|
5
|
+
userAgent?: string;
|
|
6
|
+
}
|
|
7
|
+
/** Reddit `post.create` extras (title + subreddit are required). */
|
|
8
|
+
export interface RedditPostExtras {
|
|
9
|
+
title: string;
|
|
10
|
+
subreddit: string;
|
|
11
|
+
/** "self" (text post, default) or "link" (url post). */
|
|
12
|
+
kind?: "self" | "link";
|
|
13
|
+
/** URL for a `kind: "link"` post. */
|
|
14
|
+
url?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class RedditAdapter implements SocialAdapter {
|
|
17
|
+
private readonly accessToken;
|
|
18
|
+
private readonly userAgent;
|
|
19
|
+
private readonly fetchImpl;
|
|
20
|
+
constructor(creds: RedditCredentials, fetchImpl?: FetchLike);
|
|
21
|
+
static fromCredentials(creds: RedditCredentials, fetchImpl?: FetchLike): RedditAdapter;
|
|
22
|
+
private headers;
|
|
23
|
+
/** Reddit form endpoints want application/x-www-form-urlencoded. */
|
|
24
|
+
private form;
|
|
25
|
+
accountMe(): Promise<AccountMeResult>;
|
|
26
|
+
postCreate(input: PostCreateInput & Partial<RedditPostExtras>): Promise<PostCreateResult>;
|
|
27
|
+
postDelete(input: PostDeleteInput): Promise<PostDeleteResult>;
|
|
28
|
+
mediaUpload(_input: MediaUploadInput): Promise<MediaUploadResult>;
|
|
29
|
+
mentionsList(input?: MentionsListInput): Promise<MentionsListResult>;
|
|
30
|
+
analyticsPost(input: AnalyticsPostInput): Promise<AnalyticsPostResult>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type FetchLike } from "./http";
|
|
2
|
+
import type { AccountMeResult, AnalyticsPostInput, AnalyticsPostResult, MediaUploadInput, MediaUploadResult, MentionsListInput, MentionsListResult, PostCreateInput, PostCreateResult, PostDeleteInput, PostDeleteResult, SocialAdapter } from "./types";
|
|
3
|
+
export interface TikTokCredentials {
|
|
4
|
+
accessToken: string;
|
|
5
|
+
openId?: string;
|
|
6
|
+
}
|
|
7
|
+
/** TikTok `post.create` extras. */
|
|
8
|
+
export interface TikTokPostExtras {
|
|
9
|
+
/** PUBLIC_TO_EVERYONE (default), MUTUAL_FOLLOW_FRIENDS, SELF_ONLY. */
|
|
10
|
+
privacyLevel?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare class TikTokAdapter implements SocialAdapter {
|
|
13
|
+
private readonly accessToken;
|
|
14
|
+
private readonly fetchImpl;
|
|
15
|
+
constructor(creds: TikTokCredentials, fetchImpl?: FetchLike);
|
|
16
|
+
static fromCredentials(creds: TikTokCredentials, fetchImpl?: FetchLike): TikTokAdapter;
|
|
17
|
+
private headers;
|
|
18
|
+
accountMe(): Promise<AccountMeResult>;
|
|
19
|
+
postCreate(input: PostCreateInput & TikTokPostExtras): Promise<PostCreateResult>;
|
|
20
|
+
postDelete(_input: PostDeleteInput): Promise<PostDeleteResult>;
|
|
21
|
+
mediaUpload(input: MediaUploadInput): Promise<MediaUploadResult>;
|
|
22
|
+
mentionsList(_input?: MentionsListInput): Promise<MentionsListResult>;
|
|
23
|
+
analyticsPost(_input: AnalyticsPostInput): Promise<AnalyticsPostResult>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Normalized, network-agnostic types for the stateless social transport SDK.
|
|
3
|
+
*
|
|
4
|
+
* These types are intentionally self-contained: the public `@hasna/connectors/social`
|
|
5
|
+
* surface must NOT leak connector-internal types. Everything here is plain data so the
|
|
6
|
+
* entry point stays bundle-safe (no fs/db/runner imports).
|
|
7
|
+
*/
|
|
8
|
+
/** Slugs supported by this deliverable. */
|
|
9
|
+
export type SocialConnectorSlug = "x" | "mastodon" | "bluesky" | "linkedin" | "reddit" | "tiktok" | "youtube" | "pinterest" | "googlebusinessprofile";
|
|
10
|
+
/** Normalized operation names. */
|
|
11
|
+
export type SocialOperation = "account.me" | "post.create" | "post.delete" | "media.upload" | "mentions.list" | "analytics.post";
|
|
12
|
+
export interface AccountMeResult {
|
|
13
|
+
id: string;
|
|
14
|
+
username?: string;
|
|
15
|
+
displayName?: string;
|
|
16
|
+
url?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface PostCreateInput {
|
|
19
|
+
text: string;
|
|
20
|
+
replyToId?: string;
|
|
21
|
+
mediaIds?: string[];
|
|
22
|
+
/**
|
|
23
|
+
* Network-specific extras (e.g. reddit `title`/`subreddit`, pinterest `boardId`,
|
|
24
|
+
* googlebusinessprofile `accountId`/`locationId`). Each adapter reads the ones it
|
|
25
|
+
* needs; see each adapter's `*PostExtras` interface.
|
|
26
|
+
*/
|
|
27
|
+
[key: string]: unknown;
|
|
28
|
+
}
|
|
29
|
+
export interface PostCreateResult {
|
|
30
|
+
id: string;
|
|
31
|
+
url?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface PostDeleteInput {
|
|
34
|
+
id: string;
|
|
35
|
+
}
|
|
36
|
+
export interface PostDeleteResult {
|
|
37
|
+
id: string;
|
|
38
|
+
deleted: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface MediaUploadInput {
|
|
41
|
+
dataBase64: string;
|
|
42
|
+
mimeType: string;
|
|
43
|
+
altText?: string;
|
|
44
|
+
}
|
|
45
|
+
export interface MediaUploadResult {
|
|
46
|
+
mediaId: string;
|
|
47
|
+
}
|
|
48
|
+
export interface MentionsListInput {
|
|
49
|
+
sinceId?: string;
|
|
50
|
+
limit?: number;
|
|
51
|
+
}
|
|
52
|
+
export interface MentionItem {
|
|
53
|
+
id: string;
|
|
54
|
+
text: string;
|
|
55
|
+
authorId?: string;
|
|
56
|
+
authorHandle?: string;
|
|
57
|
+
createdAt?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface MentionsListResult {
|
|
60
|
+
items: MentionItem[];
|
|
61
|
+
}
|
|
62
|
+
export interface AnalyticsPostInput {
|
|
63
|
+
id: string;
|
|
64
|
+
}
|
|
65
|
+
export interface AnalyticsPostResult {
|
|
66
|
+
metrics: Record<string, number>;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* A connector adapter: maps each normalized operation onto a network's transport.
|
|
70
|
+
* Credentials are caller-owned and passed in per construction — no local storage.
|
|
71
|
+
*/
|
|
72
|
+
export interface SocialAdapter {
|
|
73
|
+
accountMe(input?: Record<string, unknown>): Promise<AccountMeResult>;
|
|
74
|
+
postCreate(input: PostCreateInput): Promise<PostCreateResult>;
|
|
75
|
+
postDelete(input: PostDeleteInput): Promise<PostDeleteResult>;
|
|
76
|
+
mediaUpload(input: MediaUploadInput): Promise<MediaUploadResult>;
|
|
77
|
+
mentionsList(input?: MentionsListInput): Promise<MentionsListResult>;
|
|
78
|
+
analyticsPost(input: AnalyticsPostInput): Promise<AnalyticsPostResult>;
|
|
79
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { AccountMeResult, AnalyticsPostInput, AnalyticsPostResult, MediaUploadInput, MediaUploadResult, MentionsListInput, MentionsListResult, PostCreateInput, PostCreateResult, PostDeleteInput, PostDeleteResult, SocialAdapter } from "./types";
|
|
2
|
+
/** Minimal structural type for the X transport so tests can inject a mock. */
|
|
3
|
+
export interface XTransport {
|
|
4
|
+
tweets: {
|
|
5
|
+
create(opts: {
|
|
6
|
+
text: string;
|
|
7
|
+
replyToTweetId?: string;
|
|
8
|
+
mediaIds?: string[];
|
|
9
|
+
}): Promise<{
|
|
10
|
+
data: {
|
|
11
|
+
id: string;
|
|
12
|
+
text: string;
|
|
13
|
+
};
|
|
14
|
+
}>;
|
|
15
|
+
delete(id: string): Promise<{
|
|
16
|
+
data: {
|
|
17
|
+
deleted: boolean;
|
|
18
|
+
};
|
|
19
|
+
}>;
|
|
20
|
+
get(id: string, options?: unknown): Promise<{
|
|
21
|
+
data: {
|
|
22
|
+
id: string;
|
|
23
|
+
public_metrics?: Record<string, number>;
|
|
24
|
+
};
|
|
25
|
+
}>;
|
|
26
|
+
getUserMentions(userId: string, options?: unknown): Promise<{
|
|
27
|
+
data: Array<{
|
|
28
|
+
id: string;
|
|
29
|
+
text: string;
|
|
30
|
+
author_id?: string;
|
|
31
|
+
created_at?: string;
|
|
32
|
+
}>;
|
|
33
|
+
includes?: {
|
|
34
|
+
users?: Array<{
|
|
35
|
+
id: string;
|
|
36
|
+
username: string;
|
|
37
|
+
}>;
|
|
38
|
+
};
|
|
39
|
+
}>;
|
|
40
|
+
};
|
|
41
|
+
users: {
|
|
42
|
+
me(): Promise<{
|
|
43
|
+
data: {
|
|
44
|
+
id: string;
|
|
45
|
+
username: string;
|
|
46
|
+
name?: string;
|
|
47
|
+
};
|
|
48
|
+
}>;
|
|
49
|
+
};
|
|
50
|
+
media?: {
|
|
51
|
+
uploadBuffer(data: Buffer, mimeType: string, options?: {
|
|
52
|
+
altText?: string;
|
|
53
|
+
}): Promise<{
|
|
54
|
+
media_id_string: string;
|
|
55
|
+
}>;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export interface XCredentials {
|
|
59
|
+
apiKey: string;
|
|
60
|
+
apiSecret: string;
|
|
61
|
+
accessToken?: string;
|
|
62
|
+
refreshToken?: string;
|
|
63
|
+
bearerToken?: string;
|
|
64
|
+
oauth1AccessToken?: string;
|
|
65
|
+
oauth1AccessTokenSecret?: string;
|
|
66
|
+
clientId?: string;
|
|
67
|
+
clientSecret?: string;
|
|
68
|
+
}
|
|
69
|
+
export declare class XAdapter implements SocialAdapter {
|
|
70
|
+
private readonly x;
|
|
71
|
+
/** Cached authenticated user (id + username) to build URLs / mentions. */
|
|
72
|
+
private me?;
|
|
73
|
+
constructor(x: XTransport);
|
|
74
|
+
static fromCredentials(creds: XCredentials): XAdapter;
|
|
75
|
+
private resolveMe;
|
|
76
|
+
accountMe(): Promise<AccountMeResult>;
|
|
77
|
+
postCreate(input: PostCreateInput): Promise<PostCreateResult>;
|
|
78
|
+
postDelete(input: PostDeleteInput): Promise<PostDeleteResult>;
|
|
79
|
+
mediaUpload(input: MediaUploadInput): Promise<MediaUploadResult>;
|
|
80
|
+
mentionsList(input?: MentionsListInput): Promise<MentionsListResult>;
|
|
81
|
+
analyticsPost(input: AnalyticsPostInput): Promise<AnalyticsPostResult>;
|
|
82
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type FetchLike } from "./http";
|
|
2
|
+
import type { AccountMeResult, AnalyticsPostInput, AnalyticsPostResult, MediaUploadInput, MediaUploadResult, MentionsListInput, MentionsListResult, PostCreateInput, PostCreateResult, PostDeleteInput, PostDeleteResult, SocialAdapter } from "./types";
|
|
3
|
+
export interface YouTubeCredentials {
|
|
4
|
+
accessToken: string;
|
|
5
|
+
refreshToken?: string;
|
|
6
|
+
clientId?: string;
|
|
7
|
+
clientSecret?: string;
|
|
8
|
+
}
|
|
9
|
+
/** YouTube `post.create` extras. */
|
|
10
|
+
export interface YouTubePostExtras {
|
|
11
|
+
title?: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
privacyStatus?: "public" | "private" | "unlisted";
|
|
14
|
+
/** Numeric category id (default "22" = People & Blogs). */
|
|
15
|
+
categoryId?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare class YouTubeAdapter implements SocialAdapter {
|
|
18
|
+
private readonly accessToken;
|
|
19
|
+
private readonly fetchImpl;
|
|
20
|
+
constructor(creds: YouTubeCredentials, fetchImpl?: FetchLike);
|
|
21
|
+
static fromCredentials(creds: YouTubeCredentials, fetchImpl?: FetchLike): YouTubeAdapter;
|
|
22
|
+
private headers;
|
|
23
|
+
accountMe(): Promise<AccountMeResult>;
|
|
24
|
+
postCreate(input: PostCreateInput & YouTubePostExtras): Promise<PostCreateResult>;
|
|
25
|
+
postDelete(input: PostDeleteInput): Promise<PostDeleteResult>;
|
|
26
|
+
mediaUpload(input: MediaUploadInput & YouTubePostExtras): Promise<MediaUploadResult>;
|
|
27
|
+
mentionsList(_input?: MentionsListInput): Promise<MentionsListResult>;
|
|
28
|
+
analyticsPost(input: AnalyticsPostInput): Promise<AnalyticsPostResult>;
|
|
29
|
+
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
interface AppProps {
|
|
3
2
|
initialConnectors?: string[];
|
|
4
3
|
overwrite?: boolean;
|
|
5
4
|
}
|
|
6
|
-
export declare function App({ initialConnectors, overwrite }: AppProps):
|
|
5
|
+
export declare function App({ initialConnectors, overwrite }: AppProps): import("react/jsx-runtime").JSX.Element;
|
|
7
6
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
interface CategorySelectProps {
|
|
3
2
|
onSelect: (category: string) => void;
|
|
4
3
|
onBack?: () => void;
|
|
5
4
|
}
|
|
6
|
-
export declare function CategorySelect({ onSelect, onBack }: CategorySelectProps):
|
|
5
|
+
export declare function CategorySelect({ onSelect, onBack }: CategorySelectProps): import("react/jsx-runtime").JSX.Element;
|
|
7
6
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { ConnectorMeta } from "../../lib/registry.js";
|
|
3
2
|
interface ConnectorSelectProps {
|
|
4
3
|
connectors: ConnectorMeta[];
|
|
@@ -7,5 +6,5 @@ interface ConnectorSelectProps {
|
|
|
7
6
|
onConfirm: () => void;
|
|
8
7
|
onBack: () => void;
|
|
9
8
|
}
|
|
10
|
-
export declare function ConnectorSelect({ connectors, selected, onToggle, onConfirm, onBack, }: ConnectorSelectProps):
|
|
9
|
+
export declare function ConnectorSelect({ connectors, selected, onToggle, onConfirm, onBack, }: ConnectorSelectProps): import("react/jsx-runtime").JSX.Element;
|
|
11
10
|
export {};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
interface HeaderProps {
|
|
3
2
|
title?: string;
|
|
4
3
|
subtitle?: string;
|
|
5
4
|
}
|
|
6
|
-
export declare function Header({ title, subtitle }: HeaderProps):
|
|
5
|
+
export declare function Header({ title, subtitle }: HeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
7
6
|
export {};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { InstallResult } from "../../lib/installer.js";
|
|
3
2
|
interface InstallProgressProps {
|
|
4
3
|
connectors: string[];
|
|
5
4
|
overwrite?: boolean;
|
|
6
5
|
onComplete: (results: InstallResult[]) => void;
|
|
7
6
|
}
|
|
8
|
-
export declare function InstallProgress({ connectors, overwrite, onComplete, }: InstallProgressProps):
|
|
7
|
+
export declare function InstallProgress({ connectors, overwrite, onComplete, }: InstallProgressProps): import("react/jsx-runtime").JSX.Element;
|
|
9
8
|
export {};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
interface SearchViewProps {
|
|
3
2
|
selected: Set<string>;
|
|
4
3
|
onToggle: (name: string) => void;
|
|
5
4
|
onConfirm: () => void;
|
|
6
5
|
onBack: () => void;
|
|
7
6
|
}
|
|
8
|
-
export declare function SearchView({ selected, onToggle, onConfirm, onBack, }: SearchViewProps):
|
|
7
|
+
export declare function SearchView({ selected, onToggle, onConfirm, onBack, }: SearchViewProps): import("react/jsx-runtime").JSX.Element;
|
|
9
8
|
export {};
|