@hasna/connectors 1.3.37 → 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/dashboard/dist/assets/{index-DvfmyAO4.js → index-CUbp3qRv.js} +20 -20
- package/dashboard/dist/index.html +1 -1
- 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/linkedin.d.ts +29 -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 +7 -1
- package/dist/.types/src/social/youtube.d.ts +29 -0
- package/dist/social/index.js +776 -4
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>Hasna Connectors</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-CUbp3qRv.js"></script>
|
|
8
8
|
<link rel="stylesheet" crossorigin href="/assets/index-ClBXkNbL.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body>
|
|
@@ -0,0 +1,40 @@
|
|
|
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 GoogleBusinessProfileCredentials {
|
|
4
|
+
accessToken: string;
|
|
5
|
+
accountId?: string;
|
|
6
|
+
locationId?: string;
|
|
7
|
+
}
|
|
8
|
+
/** Google Business Profile `post.create` extras (accountId + locationId required). */
|
|
9
|
+
export interface GoogleBusinessProfilePostExtras {
|
|
10
|
+
accountId?: string;
|
|
11
|
+
locationId?: string;
|
|
12
|
+
/** Call-to-action, e.g. { actionType: "LEARN_MORE", url: "https://..." }. */
|
|
13
|
+
cta?: {
|
|
14
|
+
actionType: string;
|
|
15
|
+
url?: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/** Google Business Profile `media.upload` extras. */
|
|
19
|
+
export interface GoogleBusinessProfileMediaExtras {
|
|
20
|
+
accountId?: string;
|
|
21
|
+
locationId?: string;
|
|
22
|
+
/** Public URL of the image to attach (GBP media items are created from a URL). */
|
|
23
|
+
sourceUrl?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare class GoogleBusinessProfileAdapter implements SocialAdapter {
|
|
26
|
+
private readonly accessToken;
|
|
27
|
+
private readonly defaultAccountId?;
|
|
28
|
+
private readonly defaultLocationId?;
|
|
29
|
+
private readonly fetchImpl;
|
|
30
|
+
constructor(creds: GoogleBusinessProfileCredentials, fetchImpl?: FetchLike);
|
|
31
|
+
static fromCredentials(creds: GoogleBusinessProfileCredentials, fetchImpl?: FetchLike): GoogleBusinessProfileAdapter;
|
|
32
|
+
private headers;
|
|
33
|
+
private resolveIds;
|
|
34
|
+
accountMe(): Promise<AccountMeResult>;
|
|
35
|
+
postCreate(input: PostCreateInput & GoogleBusinessProfilePostExtras): Promise<PostCreateResult>;
|
|
36
|
+
postDelete(input: PostDeleteInput): Promise<PostDeleteResult>;
|
|
37
|
+
mediaUpload(input: MediaUploadInput & GoogleBusinessProfileMediaExtras): Promise<MediaUploadResult>;
|
|
38
|
+
mentionsList(_input?: MentionsListInput): Promise<MentionsListResult>;
|
|
39
|
+
analyticsPost(_input: AnalyticsPostInput): Promise<AnalyticsPostResult>;
|
|
40
|
+
}
|
|
@@ -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,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,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
|
+
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* entry point stays bundle-safe (no fs/db/runner imports).
|
|
7
7
|
*/
|
|
8
8
|
/** Slugs supported by this deliverable. */
|
|
9
|
-
export type SocialConnectorSlug = "x" | "mastodon" | "bluesky";
|
|
9
|
+
export type SocialConnectorSlug = "x" | "mastodon" | "bluesky" | "linkedin" | "reddit" | "tiktok" | "youtube" | "pinterest" | "googlebusinessprofile";
|
|
10
10
|
/** Normalized operation names. */
|
|
11
11
|
export type SocialOperation = "account.me" | "post.create" | "post.delete" | "media.upload" | "mentions.list" | "analytics.post";
|
|
12
12
|
export interface AccountMeResult {
|
|
@@ -19,6 +19,12 @@ export interface PostCreateInput {
|
|
|
19
19
|
text: string;
|
|
20
20
|
replyToId?: string;
|
|
21
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;
|
|
22
28
|
}
|
|
23
29
|
export interface PostCreateResult {
|
|
24
30
|
id: string;
|
|
@@ -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
|
+
}
|