social-mcp 2.0.0 → 2.2.0
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/README.md +128 -1
- package/dist/index.js +71 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/config.d.ts +33 -0
- package/dist/lib/config.js +33 -0
- package/dist/lib/config.js.map +1 -1
- package/dist/services/beehiiv-service.d.ts +69 -0
- package/dist/services/beehiiv-service.js +97 -0
- package/dist/services/beehiiv-service.js.map +1 -0
- package/dist/services/devto-service.d.ts +99 -0
- package/dist/services/devto-service.js +92 -0
- package/dist/services/devto-service.js.map +1 -0
- package/dist/services/ghost-service.d.ts +80 -0
- package/dist/services/ghost-service.js +123 -0
- package/dist/services/ghost-service.js.map +1 -0
- package/dist/services/hashnode-service.d.ts +86 -0
- package/dist/services/hashnode-service.js +161 -0
- package/dist/services/hashnode-service.js.map +1 -0
- package/dist/services/medium-service.d.ts +30 -0
- package/dist/services/medium-service.js +68 -0
- package/dist/services/medium-service.js.map +1 -0
- package/dist/services/tumblr-service.d.ts +73 -0
- package/dist/services/tumblr-service.js +113 -0
- package/dist/services/tumblr-service.js.map +1 -0
- package/dist/services/twitch-service.d.ts +85 -0
- package/dist/services/twitch-service.js +135 -0
- package/dist/services/twitch-service.js.map +1 -0
- package/dist/tools/beehiiv-tools/create-post.d.ts +40 -0
- package/dist/tools/beehiiv-tools/create-post.js +49 -0
- package/dist/tools/beehiiv-tools/create-post.js.map +1 -0
- package/dist/tools/beehiiv-tools/get-posts.d.ts +20 -0
- package/dist/tools/beehiiv-tools/get-posts.js +51 -0
- package/dist/tools/beehiiv-tools/get-posts.js.map +1 -0
- package/dist/tools/beehiiv-tools/get-subscribers.d.ts +20 -0
- package/dist/tools/beehiiv-tools/get-subscribers.js +48 -0
- package/dist/tools/beehiiv-tools/get-subscribers.js.map +1 -0
- package/dist/tools/devto-tools/create-article.d.ts +30 -0
- package/dist/tools/devto-tools/create-article.js +47 -0
- package/dist/tools/devto-tools/create-article.js.map +1 -0
- package/dist/tools/devto-tools/get-article.d.ts +16 -0
- package/dist/tools/devto-tools/get-article.js +40 -0
- package/dist/tools/devto-tools/get-article.js.map +1 -0
- package/dist/tools/devto-tools/get-articles.d.ts +18 -0
- package/dist/tools/devto-tools/get-articles.js +41 -0
- package/dist/tools/devto-tools/get-articles.js.map +1 -0
- package/dist/tools/devto-tools/update-article.d.ts +28 -0
- package/dist/tools/devto-tools/update-article.js +51 -0
- package/dist/tools/devto-tools/update-article.js.map +1 -0
- package/dist/tools/ghost-tools/create-post.d.ts +36 -0
- package/dist/tools/ghost-tools/create-post.js +51 -0
- package/dist/tools/ghost-tools/create-post.js.map +1 -0
- package/dist/tools/ghost-tools/delete-post.d.ts +18 -0
- package/dist/tools/ghost-tools/delete-post.js +28 -0
- package/dist/tools/ghost-tools/delete-post.js.map +1 -0
- package/dist/tools/ghost-tools/get-posts.d.ts +30 -0
- package/dist/tools/ghost-tools/get-posts.js +51 -0
- package/dist/tools/ghost-tools/get-posts.js.map +1 -0
- package/dist/tools/ghost-tools/update-post.d.ts +36 -0
- package/dist/tools/ghost-tools/update-post.js +58 -0
- package/dist/tools/ghost-tools/update-post.js.map +1 -0
- package/dist/tools/hashnode-tools/create-post.d.ts +34 -0
- package/dist/tools/hashnode-tools/create-post.js +46 -0
- package/dist/tools/hashnode-tools/create-post.js.map +1 -0
- package/dist/tools/hashnode-tools/get-posts.d.ts +18 -0
- package/dist/tools/hashnode-tools/get-posts.js +48 -0
- package/dist/tools/hashnode-tools/get-posts.js.map +1 -0
- package/dist/tools/hashnode-tools/get-publication.d.ts +16 -0
- package/dist/tools/hashnode-tools/get-publication.js +36 -0
- package/dist/tools/hashnode-tools/get-publication.js.map +1 -0
- package/dist/tools/medium-tools/create-post.d.ts +34 -0
- package/dist/tools/medium-tools/create-post.js +61 -0
- package/dist/tools/medium-tools/create-post.js.map +1 -0
- package/dist/tools/medium-tools/get-user.d.ts +14 -0
- package/dist/tools/medium-tools/get-user.js +37 -0
- package/dist/tools/medium-tools/get-user.js.map +1 -0
- package/dist/tools/tumblr-tools/create-post.d.ts +34 -0
- package/dist/tools/tumblr-tools/create-post.js +45 -0
- package/dist/tools/tumblr-tools/create-post.js.map +1 -0
- package/dist/tools/tumblr-tools/delete-post.d.ts +18 -0
- package/dist/tools/tumblr-tools/delete-post.js +28 -0
- package/dist/tools/tumblr-tools/delete-post.js.map +1 -0
- package/dist/tools/tumblr-tools/get-blog-info.d.ts +16 -0
- package/dist/tools/tumblr-tools/get-blog-info.js +38 -0
- package/dist/tools/tumblr-tools/get-blog-info.js.map +1 -0
- package/dist/tools/tumblr-tools/get-posts.d.ts +40 -0
- package/dist/tools/tumblr-tools/get-posts.js +53 -0
- package/dist/tools/tumblr-tools/get-posts.js.map +1 -0
- package/dist/tools/twitch-tools/get-channel-info.d.ts +18 -0
- package/dist/tools/twitch-tools/get-channel-info.js +38 -0
- package/dist/tools/twitch-tools/get-channel-info.js.map +1 -0
- package/dist/tools/twitch-tools/get-streams.d.ts +22 -0
- package/dist/tools/twitch-tools/get-streams.js +50 -0
- package/dist/tools/twitch-tools/get-streams.js.map +1 -0
- package/dist/tools/twitch-tools/get-user.d.ts +18 -0
- package/dist/tools/twitch-tools/get-user.js +39 -0
- package/dist/tools/twitch-tools/get-user.js.map +1 -0
- package/dist/tools/twitch-tools/search-channels.d.ts +22 -0
- package/dist/tools/twitch-tools/search-channels.js +41 -0
- package/dist/tools/twitch-tools/search-channels.js.map +1 -0
- package/dist/tools/twitch-tools/send-chat-message.d.ts +24 -0
- package/dist/tools/twitch-tools/send-chat-message.js +39 -0
- package/dist/tools/twitch-tools/send-chat-message.js.map +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
declare const articleSchema: z.ZodObject<{
|
|
3
|
+
id: z.ZodNumber;
|
|
4
|
+
title: z.ZodString;
|
|
5
|
+
description: z.ZodOptional<z.ZodString>;
|
|
6
|
+
url: z.ZodOptional<z.ZodString>;
|
|
7
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
8
|
+
published: z.ZodOptional<z.ZodBoolean>;
|
|
9
|
+
published_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
10
|
+
tag_list: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
11
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
12
|
+
reading_time_minutes: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
comments_count: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
positive_reactions_count: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
page_views_count: z.ZodOptional<z.ZodNumber>;
|
|
16
|
+
body_markdown: z.ZodOptional<z.ZodString>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export type DevToArticle = z.infer<typeof articleSchema>;
|
|
19
|
+
export interface DevToCredentials {
|
|
20
|
+
apiKey: string;
|
|
21
|
+
}
|
|
22
|
+
export declare class DevToService {
|
|
23
|
+
private baseUrl;
|
|
24
|
+
private headers;
|
|
25
|
+
constructor(credentials?: DevToCredentials);
|
|
26
|
+
getMyArticles(page?: number, perPage?: number): Promise<{
|
|
27
|
+
id: number;
|
|
28
|
+
title: string;
|
|
29
|
+
description?: string | undefined;
|
|
30
|
+
url?: string | undefined;
|
|
31
|
+
slug?: string | undefined;
|
|
32
|
+
published?: boolean | undefined;
|
|
33
|
+
published_at?: string | null | undefined;
|
|
34
|
+
tag_list?: string | string[] | undefined;
|
|
35
|
+
tags?: string[] | undefined;
|
|
36
|
+
reading_time_minutes?: number | undefined;
|
|
37
|
+
comments_count?: number | undefined;
|
|
38
|
+
positive_reactions_count?: number | undefined;
|
|
39
|
+
page_views_count?: number | undefined;
|
|
40
|
+
body_markdown?: string | undefined;
|
|
41
|
+
}[]>;
|
|
42
|
+
getArticle(id: number): Promise<{
|
|
43
|
+
id: number;
|
|
44
|
+
title: string;
|
|
45
|
+
description?: string | undefined;
|
|
46
|
+
url?: string | undefined;
|
|
47
|
+
slug?: string | undefined;
|
|
48
|
+
published?: boolean | undefined;
|
|
49
|
+
published_at?: string | null | undefined;
|
|
50
|
+
tag_list?: string | string[] | undefined;
|
|
51
|
+
tags?: string[] | undefined;
|
|
52
|
+
reading_time_minutes?: number | undefined;
|
|
53
|
+
comments_count?: number | undefined;
|
|
54
|
+
positive_reactions_count?: number | undefined;
|
|
55
|
+
page_views_count?: number | undefined;
|
|
56
|
+
body_markdown?: string | undefined;
|
|
57
|
+
}>;
|
|
58
|
+
createArticle(title: string, bodyMarkdown: string, tags?: string[], published?: boolean, description?: string, canonicalUrl?: string, series?: string, mainImage?: string): Promise<{
|
|
59
|
+
id: number;
|
|
60
|
+
title: string;
|
|
61
|
+
description?: string | undefined;
|
|
62
|
+
url?: string | undefined;
|
|
63
|
+
slug?: string | undefined;
|
|
64
|
+
published?: boolean | undefined;
|
|
65
|
+
published_at?: string | null | undefined;
|
|
66
|
+
tag_list?: string | string[] | undefined;
|
|
67
|
+
tags?: string[] | undefined;
|
|
68
|
+
reading_time_minutes?: number | undefined;
|
|
69
|
+
comments_count?: number | undefined;
|
|
70
|
+
positive_reactions_count?: number | undefined;
|
|
71
|
+
page_views_count?: number | undefined;
|
|
72
|
+
body_markdown?: string | undefined;
|
|
73
|
+
}>;
|
|
74
|
+
updateArticle(id: number, updates: {
|
|
75
|
+
title?: string;
|
|
76
|
+
body_markdown?: string;
|
|
77
|
+
published?: boolean;
|
|
78
|
+
tags?: string[];
|
|
79
|
+
description?: string;
|
|
80
|
+
canonical_url?: string;
|
|
81
|
+
}): Promise<{
|
|
82
|
+
id: number;
|
|
83
|
+
title: string;
|
|
84
|
+
description?: string | undefined;
|
|
85
|
+
url?: string | undefined;
|
|
86
|
+
slug?: string | undefined;
|
|
87
|
+
published?: boolean | undefined;
|
|
88
|
+
published_at?: string | null | undefined;
|
|
89
|
+
tag_list?: string | string[] | undefined;
|
|
90
|
+
tags?: string[] | undefined;
|
|
91
|
+
reading_time_minutes?: number | undefined;
|
|
92
|
+
comments_count?: number | undefined;
|
|
93
|
+
positive_reactions_count?: number | undefined;
|
|
94
|
+
page_views_count?: number | undefined;
|
|
95
|
+
body_markdown?: string | undefined;
|
|
96
|
+
}>;
|
|
97
|
+
}
|
|
98
|
+
export declare function getDevToService(): DevToService;
|
|
99
|
+
export {};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { config } from "../lib/config.js";
|
|
3
|
+
import { CredentialsError } from "../lib/errors.js";
|
|
4
|
+
import { fetchJson } from "../lib/http.js";
|
|
5
|
+
const articleSchema = z.object({
|
|
6
|
+
id: z.number(),
|
|
7
|
+
title: z.string(),
|
|
8
|
+
description: z.string().optional(),
|
|
9
|
+
url: z.string().optional(),
|
|
10
|
+
slug: z.string().optional(),
|
|
11
|
+
published: z.boolean().optional(),
|
|
12
|
+
published_at: z.string().nullable().optional(),
|
|
13
|
+
tag_list: z.union([z.string(), z.array(z.string())]).optional(),
|
|
14
|
+
tags: z.array(z.string()).optional(),
|
|
15
|
+
reading_time_minutes: z.number().optional(),
|
|
16
|
+
comments_count: z.number().optional(),
|
|
17
|
+
positive_reactions_count: z.number().optional(),
|
|
18
|
+
page_views_count: z.number().optional(),
|
|
19
|
+
body_markdown: z.string().optional(),
|
|
20
|
+
});
|
|
21
|
+
const articleResponseSchema = z.object({
|
|
22
|
+
id: z.number(),
|
|
23
|
+
title: z.string(),
|
|
24
|
+
description: z.string().optional(),
|
|
25
|
+
url: z.string().optional(),
|
|
26
|
+
slug: z.string().optional(),
|
|
27
|
+
published: z.boolean().optional(),
|
|
28
|
+
published_at: z.string().nullable().optional(),
|
|
29
|
+
tag_list: z.union([z.string(), z.array(z.string())]).optional(),
|
|
30
|
+
tags: z.array(z.string()).optional(),
|
|
31
|
+
reading_time_minutes: z.number().optional(),
|
|
32
|
+
comments_count: z.number().optional(),
|
|
33
|
+
positive_reactions_count: z.number().optional(),
|
|
34
|
+
page_views_count: z.number().optional(),
|
|
35
|
+
body_markdown: z.string().optional(),
|
|
36
|
+
});
|
|
37
|
+
export class DevToService {
|
|
38
|
+
baseUrl = config.devto.baseUrl;
|
|
39
|
+
headers;
|
|
40
|
+
constructor(credentials) {
|
|
41
|
+
const apiKey = credentials?.apiKey ?? config.devto.apiKey;
|
|
42
|
+
if (!apiKey) {
|
|
43
|
+
throw new CredentialsError("Dev.to", ["DEVTO_API_KEY"]);
|
|
44
|
+
}
|
|
45
|
+
this.headers = {
|
|
46
|
+
"api-key": apiKey,
|
|
47
|
+
"Content-Type": "application/json",
|
|
48
|
+
Accept: "application/vnd.forem.api-v1+json",
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
async getMyArticles(page = 1, perPage = 30) {
|
|
52
|
+
return fetchJson(`${this.baseUrl}/articles/me?page=${page}&per_page=${perPage}`, { method: "GET", headers: this.headers }, z.array(articleSchema));
|
|
53
|
+
}
|
|
54
|
+
async getArticle(id) {
|
|
55
|
+
return fetchJson(`${this.baseUrl}/articles/${id}`, { method: "GET", headers: this.headers }, articleResponseSchema);
|
|
56
|
+
}
|
|
57
|
+
async createArticle(title, bodyMarkdown, tags = [], published = false, description, canonicalUrl, series, mainImage) {
|
|
58
|
+
const article = {
|
|
59
|
+
title,
|
|
60
|
+
body_markdown: bodyMarkdown,
|
|
61
|
+
published,
|
|
62
|
+
tags,
|
|
63
|
+
};
|
|
64
|
+
if (description)
|
|
65
|
+
article.description = description;
|
|
66
|
+
if (canonicalUrl)
|
|
67
|
+
article.canonical_url = canonicalUrl;
|
|
68
|
+
if (series)
|
|
69
|
+
article.series = series;
|
|
70
|
+
if (mainImage)
|
|
71
|
+
article.main_image = mainImage;
|
|
72
|
+
return fetchJson(`${this.baseUrl}/articles`, {
|
|
73
|
+
method: "POST",
|
|
74
|
+
headers: this.headers,
|
|
75
|
+
body: JSON.stringify({ article }),
|
|
76
|
+
}, articleResponseSchema);
|
|
77
|
+
}
|
|
78
|
+
async updateArticle(id, updates) {
|
|
79
|
+
return fetchJson(`${this.baseUrl}/articles/${id}`, {
|
|
80
|
+
method: "PUT",
|
|
81
|
+
headers: this.headers,
|
|
82
|
+
body: JSON.stringify({ article: updates }),
|
|
83
|
+
}, articleResponseSchema);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
let _instance;
|
|
87
|
+
export function getDevToService() {
|
|
88
|
+
if (!_instance)
|
|
89
|
+
_instance = new DevToService();
|
|
90
|
+
return _instance;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=devto-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"devto-service.js","sourceRoot":"","sources":["../../src/services/devto-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACjC,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAC9C,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC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|
|
1
|
+
export interface GhostCredentials {
|
|
2
|
+
siteUrl: string;
|
|
3
|
+
adminApiKey: string;
|
|
4
|
+
}
|
|
5
|
+
export declare class GhostService {
|
|
6
|
+
private siteUrl;
|
|
7
|
+
private keyId;
|
|
8
|
+
private keySecret;
|
|
9
|
+
constructor(credentials?: GhostCredentials);
|
|
10
|
+
private generateJwt;
|
|
11
|
+
private get headers();
|
|
12
|
+
private get adminBase();
|
|
13
|
+
getPosts(page?: number, limit?: number, status?: "all" | "published" | "draft"): Promise<{
|
|
14
|
+
posts: {
|
|
15
|
+
id: string;
|
|
16
|
+
title?: string | undefined;
|
|
17
|
+
slug?: string | undefined;
|
|
18
|
+
status?: string | undefined;
|
|
19
|
+
url?: string | undefined;
|
|
20
|
+
published_at?: string | null | undefined;
|
|
21
|
+
updated_at?: string | null | undefined;
|
|
22
|
+
excerpt?: string | null | undefined;
|
|
23
|
+
tags?: {
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
slug: string;
|
|
27
|
+
}[] | undefined;
|
|
28
|
+
}[];
|
|
29
|
+
meta?: {
|
|
30
|
+
pagination?: {
|
|
31
|
+
page: number;
|
|
32
|
+
limit: number;
|
|
33
|
+
pages: number;
|
|
34
|
+
total: number;
|
|
35
|
+
} | undefined;
|
|
36
|
+
} | undefined;
|
|
37
|
+
}>;
|
|
38
|
+
createPost(title: string, html?: string, lexical?: string, status?: "draft" | "published" | "scheduled", tags?: string[], excerpt?: string, publishedAt?: string): Promise<{
|
|
39
|
+
posts: {
|
|
40
|
+
id: string;
|
|
41
|
+
title?: string | undefined;
|
|
42
|
+
slug?: string | undefined;
|
|
43
|
+
status?: string | undefined;
|
|
44
|
+
url?: string | undefined;
|
|
45
|
+
published_at?: string | null | undefined;
|
|
46
|
+
updated_at?: string | null | undefined;
|
|
47
|
+
excerpt?: string | null | undefined;
|
|
48
|
+
tags?: {
|
|
49
|
+
id: string;
|
|
50
|
+
name: string;
|
|
51
|
+
slug: string;
|
|
52
|
+
}[] | undefined;
|
|
53
|
+
}[];
|
|
54
|
+
}>;
|
|
55
|
+
updatePost(id: string, updatedAt: string, updates: {
|
|
56
|
+
title?: string;
|
|
57
|
+
html?: string;
|
|
58
|
+
status?: "draft" | "published";
|
|
59
|
+
tags?: string[];
|
|
60
|
+
custom_excerpt?: string;
|
|
61
|
+
}): Promise<{
|
|
62
|
+
posts: {
|
|
63
|
+
id: string;
|
|
64
|
+
title?: string | undefined;
|
|
65
|
+
slug?: string | undefined;
|
|
66
|
+
status?: string | undefined;
|
|
67
|
+
url?: string | undefined;
|
|
68
|
+
published_at?: string | null | undefined;
|
|
69
|
+
updated_at?: string | null | undefined;
|
|
70
|
+
excerpt?: string | null | undefined;
|
|
71
|
+
tags?: {
|
|
72
|
+
id: string;
|
|
73
|
+
name: string;
|
|
74
|
+
slug: string;
|
|
75
|
+
}[] | undefined;
|
|
76
|
+
}[];
|
|
77
|
+
}>;
|
|
78
|
+
deletePost(id: string): Promise<void>;
|
|
79
|
+
}
|
|
80
|
+
export declare function getGhostService(): GhostService;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { createHmac } from "node:crypto";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { config } from "../lib/config.js";
|
|
4
|
+
import { CredentialsError } from "../lib/errors.js";
|
|
5
|
+
import { fetchJson } from "../lib/http.js";
|
|
6
|
+
const postSchema = z.object({
|
|
7
|
+
id: z.string(),
|
|
8
|
+
title: z.string().optional(),
|
|
9
|
+
slug: z.string().optional(),
|
|
10
|
+
status: z.string().optional(),
|
|
11
|
+
url: z.string().optional(),
|
|
12
|
+
published_at: z.string().nullable().optional(),
|
|
13
|
+
updated_at: z.string().nullable().optional(),
|
|
14
|
+
excerpt: z.string().nullable().optional(),
|
|
15
|
+
tags: z.array(z.object({ id: z.string(), name: z.string(), slug: z.string() })).optional(),
|
|
16
|
+
});
|
|
17
|
+
const postsResponseSchema = z.object({
|
|
18
|
+
posts: z.array(postSchema),
|
|
19
|
+
meta: z.object({
|
|
20
|
+
pagination: z.object({
|
|
21
|
+
page: z.number(),
|
|
22
|
+
limit: z.number(),
|
|
23
|
+
pages: z.number(),
|
|
24
|
+
total: z.number(),
|
|
25
|
+
}).optional(),
|
|
26
|
+
}).optional(),
|
|
27
|
+
});
|
|
28
|
+
const singlePostResponseSchema = z.object({
|
|
29
|
+
posts: z.array(postSchema),
|
|
30
|
+
});
|
|
31
|
+
export class GhostService {
|
|
32
|
+
siteUrl;
|
|
33
|
+
keyId;
|
|
34
|
+
keySecret;
|
|
35
|
+
constructor(credentials) {
|
|
36
|
+
const siteUrl = credentials?.siteUrl ?? config.ghost.siteUrl;
|
|
37
|
+
const adminApiKey = credentials?.adminApiKey ?? config.ghost.adminApiKey;
|
|
38
|
+
if (!siteUrl || !adminApiKey) {
|
|
39
|
+
throw new CredentialsError("Ghost", ["GHOST_SITE_URL", "GHOST_ADMIN_API_KEY"]);
|
|
40
|
+
}
|
|
41
|
+
const parts = adminApiKey.split(":");
|
|
42
|
+
if (parts.length !== 2) {
|
|
43
|
+
throw new Error("GHOST_ADMIN_API_KEY must be in the format 'id:secret'");
|
|
44
|
+
}
|
|
45
|
+
this.siteUrl = siteUrl.replace(/\/$/, "");
|
|
46
|
+
this.keyId = parts[0];
|
|
47
|
+
this.keySecret = parts[1];
|
|
48
|
+
}
|
|
49
|
+
generateJwt() {
|
|
50
|
+
const now = Math.floor(Date.now() / 1000);
|
|
51
|
+
const header = Buffer.from(JSON.stringify({ alg: "HS256", typ: "JWT", kid: this.keyId })).toString("base64url");
|
|
52
|
+
const payload = Buffer.from(JSON.stringify({ iat: now, exp: now + 300, aud: "/admin/" })).toString("base64url");
|
|
53
|
+
const signing = `${header}.${payload}`;
|
|
54
|
+
const signature = createHmac("sha256", Buffer.from(this.keySecret, "hex"))
|
|
55
|
+
.update(signing)
|
|
56
|
+
.digest("base64url");
|
|
57
|
+
return `${signing}.${signature}`;
|
|
58
|
+
}
|
|
59
|
+
get headers() {
|
|
60
|
+
return {
|
|
61
|
+
Authorization: `Ghost ${this.generateJwt()}`,
|
|
62
|
+
"Content-Type": "application/json",
|
|
63
|
+
"Accept-Version": "v5.0",
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
get adminBase() {
|
|
67
|
+
return `${this.siteUrl}/ghost/api/admin`;
|
|
68
|
+
}
|
|
69
|
+
async getPosts(page = 1, limit = 10, status = "all") {
|
|
70
|
+
const params = new URLSearchParams({ page: String(page), limit: String(limit), filter: `status:${status}` });
|
|
71
|
+
if (status === "all")
|
|
72
|
+
params.delete("filter");
|
|
73
|
+
else
|
|
74
|
+
params.set("filter", `status:${status}`);
|
|
75
|
+
return fetchJson(`${this.adminBase}/posts?${params}`, { method: "GET", headers: this.headers }, postsResponseSchema);
|
|
76
|
+
}
|
|
77
|
+
async createPost(title, html, lexical, status = "draft", tags = [], excerpt, publishedAt) {
|
|
78
|
+
const post = {
|
|
79
|
+
title,
|
|
80
|
+
status,
|
|
81
|
+
tags: tags.map((name) => ({ name })),
|
|
82
|
+
};
|
|
83
|
+
if (html)
|
|
84
|
+
post.html = html;
|
|
85
|
+
if (lexical)
|
|
86
|
+
post.lexical = lexical;
|
|
87
|
+
if (excerpt)
|
|
88
|
+
post.custom_excerpt = excerpt;
|
|
89
|
+
if (publishedAt)
|
|
90
|
+
post.published_at = publishedAt;
|
|
91
|
+
return fetchJson(`${this.adminBase}/posts`, {
|
|
92
|
+
method: "POST",
|
|
93
|
+
headers: this.headers,
|
|
94
|
+
body: JSON.stringify({ posts: [post] }),
|
|
95
|
+
}, singlePostResponseSchema);
|
|
96
|
+
}
|
|
97
|
+
async updatePost(id, updatedAt, updates) {
|
|
98
|
+
const body = { ...updates, updated_at: updatedAt };
|
|
99
|
+
if (updates.tags)
|
|
100
|
+
body.tags = updates.tags.map((name) => ({ name }));
|
|
101
|
+
return fetchJson(`${this.adminBase}/posts/${id}`, {
|
|
102
|
+
method: "PUT",
|
|
103
|
+
headers: this.headers,
|
|
104
|
+
body: JSON.stringify({ posts: [body] }),
|
|
105
|
+
}, singlePostResponseSchema);
|
|
106
|
+
}
|
|
107
|
+
async deletePost(id) {
|
|
108
|
+
const response = await fetch(`${this.adminBase}/posts/${id}`, {
|
|
109
|
+
method: "DELETE",
|
|
110
|
+
headers: this.headers,
|
|
111
|
+
});
|
|
112
|
+
if (!response.ok) {
|
|
113
|
+
throw new Error(`Ghost API error ${response.status}: ${response.statusText}`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
let _instance;
|
|
118
|
+
export function getGhostService() {
|
|
119
|
+
if (!_instance)
|
|
120
|
+
_instance = new GhostService();
|
|
121
|
+
return _instance;
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=ghost-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ghost-service.js","sourceRoot":"","sources":["../../src/services/ghost-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE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AAG,IAAI,CAAC,SAAS,UAAU,EAAE,EAAE,EAAE;YAC7D,MAAM,EAAE,QAAQ;YAChB,OAAO,EAAE,IAAI,CAAC,OAAO;SACrB,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,mBAAmB,QAAQ,CAAC,MAAM,KAAK,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;QAC/E,CAAC;IACF,CAAC;CACD;AAED,IAAI,SAAmC,CAAC;AACxC,MAAM,UAAU,eAAe;IAC9B,IAAI,CAAC,SAAS;QAAE,SAAS,GAAG,IAAI,YAAY,EAAE,CAAC;IAC/C,OAAO,SAAS,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export interface HashnodeCredentials {
|
|
2
|
+
accessToken: string;
|
|
3
|
+
publicationId?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare class HashnodeService {
|
|
6
|
+
private baseUrl;
|
|
7
|
+
private accessToken;
|
|
8
|
+
private publicationId;
|
|
9
|
+
constructor(credentials?: HashnodeCredentials);
|
|
10
|
+
private gql;
|
|
11
|
+
getPublication(publicationId?: string): Promise<{
|
|
12
|
+
id: string;
|
|
13
|
+
title?: string | undefined;
|
|
14
|
+
url?: string | undefined;
|
|
15
|
+
displayTitle?: string | undefined;
|
|
16
|
+
posts?: {
|
|
17
|
+
edges: {
|
|
18
|
+
node: {
|
|
19
|
+
id: string;
|
|
20
|
+
title: string;
|
|
21
|
+
slug?: string | undefined;
|
|
22
|
+
url?: string | undefined;
|
|
23
|
+
brief?: string | undefined;
|
|
24
|
+
publishedAt?: string | undefined;
|
|
25
|
+
tags?: {
|
|
26
|
+
name: string;
|
|
27
|
+
slug: string;
|
|
28
|
+
}[] | undefined;
|
|
29
|
+
reactionCount?: number | undefined;
|
|
30
|
+
responseCount?: number | undefined;
|
|
31
|
+
};
|
|
32
|
+
}[];
|
|
33
|
+
pageInfo?: {
|
|
34
|
+
hasNextPage?: boolean | undefined;
|
|
35
|
+
endCursor?: string | null | undefined;
|
|
36
|
+
} | undefined;
|
|
37
|
+
} | undefined;
|
|
38
|
+
} | null | undefined>;
|
|
39
|
+
getPosts(publicationId?: string, first?: number): Promise<{
|
|
40
|
+
id: string;
|
|
41
|
+
title?: string | undefined;
|
|
42
|
+
url?: string | undefined;
|
|
43
|
+
displayTitle?: string | undefined;
|
|
44
|
+
posts?: {
|
|
45
|
+
edges: {
|
|
46
|
+
node: {
|
|
47
|
+
id: string;
|
|
48
|
+
title: string;
|
|
49
|
+
slug?: string | undefined;
|
|
50
|
+
url?: string | undefined;
|
|
51
|
+
brief?: string | undefined;
|
|
52
|
+
publishedAt?: string | undefined;
|
|
53
|
+
tags?: {
|
|
54
|
+
name: string;
|
|
55
|
+
slug: string;
|
|
56
|
+
}[] | undefined;
|
|
57
|
+
reactionCount?: number | undefined;
|
|
58
|
+
responseCount?: number | undefined;
|
|
59
|
+
};
|
|
60
|
+
}[];
|
|
61
|
+
pageInfo?: {
|
|
62
|
+
hasNextPage?: boolean | undefined;
|
|
63
|
+
endCursor?: string | null | undefined;
|
|
64
|
+
} | undefined;
|
|
65
|
+
} | undefined;
|
|
66
|
+
} | null | undefined>;
|
|
67
|
+
createPost(title: string, contentMarkdown: string, tags?: {
|
|
68
|
+
name: string;
|
|
69
|
+
slug: string;
|
|
70
|
+
}[], publicationId?: string, subtitle?: string, coverImageUrl?: string, disableComments?: boolean): Promise<{
|
|
71
|
+
data?: {
|
|
72
|
+
publishPost: {
|
|
73
|
+
post: {
|
|
74
|
+
id: string;
|
|
75
|
+
title: string;
|
|
76
|
+
slug?: string | undefined;
|
|
77
|
+
url?: string | undefined;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
} | undefined;
|
|
81
|
+
errors?: {
|
|
82
|
+
message: string;
|
|
83
|
+
}[] | undefined;
|
|
84
|
+
}>;
|
|
85
|
+
}
|
|
86
|
+
export declare function getHashnodeService(): HashnodeService;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { config } from "../lib/config.js";
|
|
3
|
+
import { CredentialsError } from "../lib/errors.js";
|
|
4
|
+
const publicationSchema = z.object({
|
|
5
|
+
id: z.string(),
|
|
6
|
+
title: z.string().optional(),
|
|
7
|
+
url: z.string().optional(),
|
|
8
|
+
displayTitle: z.string().optional(),
|
|
9
|
+
});
|
|
10
|
+
const postSchema = z.object({
|
|
11
|
+
id: z.string(),
|
|
12
|
+
title: z.string(),
|
|
13
|
+
slug: z.string().optional(),
|
|
14
|
+
url: z.string().optional(),
|
|
15
|
+
brief: z.string().optional(),
|
|
16
|
+
publishedAt: z.string().optional(),
|
|
17
|
+
tags: z.array(z.object({ name: z.string(), slug: z.string() })).optional(),
|
|
18
|
+
reactionCount: z.number().optional(),
|
|
19
|
+
responseCount: z.number().optional(),
|
|
20
|
+
});
|
|
21
|
+
const publishPostResponseSchema = z.object({
|
|
22
|
+
data: z.object({
|
|
23
|
+
publishPost: z.object({
|
|
24
|
+
post: z.object({
|
|
25
|
+
id: z.string(),
|
|
26
|
+
title: z.string(),
|
|
27
|
+
slug: z.string().optional(),
|
|
28
|
+
url: z.string().optional(),
|
|
29
|
+
}),
|
|
30
|
+
}),
|
|
31
|
+
}).optional(),
|
|
32
|
+
errors: z.array(z.object({ message: z.string() })).optional(),
|
|
33
|
+
});
|
|
34
|
+
const publicationQuerySchema = z.object({
|
|
35
|
+
data: z.object({
|
|
36
|
+
publication: z.object({
|
|
37
|
+
id: z.string(),
|
|
38
|
+
title: z.string().optional(),
|
|
39
|
+
url: z.string().optional(),
|
|
40
|
+
displayTitle: z.string().optional(),
|
|
41
|
+
posts: z.object({
|
|
42
|
+
edges: z.array(z.object({ node: postSchema })),
|
|
43
|
+
pageInfo: z.object({
|
|
44
|
+
hasNextPage: z.boolean().optional(),
|
|
45
|
+
endCursor: z.string().nullable().optional(),
|
|
46
|
+
}).optional(),
|
|
47
|
+
}).optional(),
|
|
48
|
+
}).nullable(),
|
|
49
|
+
}).optional(),
|
|
50
|
+
errors: z.array(z.object({ message: z.string() })).optional(),
|
|
51
|
+
});
|
|
52
|
+
export class HashnodeService {
|
|
53
|
+
baseUrl = config.hashnode.baseUrl;
|
|
54
|
+
accessToken;
|
|
55
|
+
publicationId;
|
|
56
|
+
constructor(credentials) {
|
|
57
|
+
const accessToken = credentials?.accessToken ?? config.hashnode.accessToken;
|
|
58
|
+
if (!accessToken) {
|
|
59
|
+
throw new CredentialsError("Hashnode", ["HASHNODE_ACCESS_TOKEN"]);
|
|
60
|
+
}
|
|
61
|
+
this.accessToken = accessToken;
|
|
62
|
+
this.publicationId = credentials?.publicationId ?? config.hashnode.publicationId;
|
|
63
|
+
}
|
|
64
|
+
async gql(query, variables, schema) {
|
|
65
|
+
const response = await fetch(this.baseUrl, {
|
|
66
|
+
method: "POST",
|
|
67
|
+
headers: {
|
|
68
|
+
"Content-Type": "application/json",
|
|
69
|
+
Authorization: this.accessToken,
|
|
70
|
+
},
|
|
71
|
+
body: JSON.stringify({ query, variables }),
|
|
72
|
+
});
|
|
73
|
+
if (!response.ok) {
|
|
74
|
+
throw new Error(`Hashnode API error ${response.status}: ${response.statusText}`);
|
|
75
|
+
}
|
|
76
|
+
const data = await response.json();
|
|
77
|
+
if (data.errors?.length) {
|
|
78
|
+
throw new Error(`Hashnode GraphQL error: ${data.errors.map((e) => e.message).join("; ")}`);
|
|
79
|
+
}
|
|
80
|
+
return schema.parse(data);
|
|
81
|
+
}
|
|
82
|
+
async getPublication(publicationId) {
|
|
83
|
+
const id = publicationId ?? this.publicationId;
|
|
84
|
+
if (!id)
|
|
85
|
+
throw new Error("publicationId is required. Set HASHNODE_PUBLICATION_ID or pass it explicitly.");
|
|
86
|
+
const query = `query GetPublication($id: ObjectId!) {
|
|
87
|
+
publication(id: $id) {
|
|
88
|
+
id
|
|
89
|
+
title
|
|
90
|
+
url
|
|
91
|
+
displayTitle
|
|
92
|
+
}
|
|
93
|
+
}`;
|
|
94
|
+
const result = await this.gql(query, { id }, publicationQuerySchema);
|
|
95
|
+
return result.data?.publication;
|
|
96
|
+
}
|
|
97
|
+
async getPosts(publicationId, first = 10) {
|
|
98
|
+
const id = publicationId ?? this.publicationId;
|
|
99
|
+
if (!id)
|
|
100
|
+
throw new Error("publicationId is required. Set HASHNODE_PUBLICATION_ID or pass it explicitly.");
|
|
101
|
+
const query = `query GetPosts($id: ObjectId!, $first: Int!) {
|
|
102
|
+
publication(id: $id) {
|
|
103
|
+
id
|
|
104
|
+
title
|
|
105
|
+
url
|
|
106
|
+
posts(first: $first) {
|
|
107
|
+
edges {
|
|
108
|
+
node {
|
|
109
|
+
id
|
|
110
|
+
title
|
|
111
|
+
slug
|
|
112
|
+
url
|
|
113
|
+
brief
|
|
114
|
+
publishedAt
|
|
115
|
+
reactionCount
|
|
116
|
+
responseCount
|
|
117
|
+
tags { name slug }
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
pageInfo { hasNextPage endCursor }
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}`;
|
|
124
|
+
const result = await this.gql(query, { id, first }, publicationQuerySchema);
|
|
125
|
+
return result.data?.publication;
|
|
126
|
+
}
|
|
127
|
+
async createPost(title, contentMarkdown, tags = [], publicationId, subtitle, coverImageUrl, disableComments = false) {
|
|
128
|
+
const id = publicationId ?? this.publicationId;
|
|
129
|
+
if (!id)
|
|
130
|
+
throw new Error("publicationId is required. Set HASHNODE_PUBLICATION_ID or pass it explicitly.");
|
|
131
|
+
const mutation = `mutation PublishPost($input: PublishPostInput!) {
|
|
132
|
+
publishPost(input: $input) {
|
|
133
|
+
post {
|
|
134
|
+
id
|
|
135
|
+
title
|
|
136
|
+
slug
|
|
137
|
+
url
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}`;
|
|
141
|
+
const input = {
|
|
142
|
+
title,
|
|
143
|
+
contentMarkdown,
|
|
144
|
+
tags,
|
|
145
|
+
publicationId: id,
|
|
146
|
+
disableComments,
|
|
147
|
+
};
|
|
148
|
+
if (subtitle)
|
|
149
|
+
input.subtitle = subtitle;
|
|
150
|
+
if (coverImageUrl)
|
|
151
|
+
input.coverImageOptions = { coverImageURL: coverImageUrl };
|
|
152
|
+
return this.gql(mutation, { input }, publishPostResponseSchema);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
let _instance;
|
|
156
|
+
export function getHashnodeService() {
|
|
157
|
+
if (!_instance)
|
|
158
|
+
_instance = new HashnodeService();
|
|
159
|
+
return _instance;
|
|
160
|
+
}
|
|
161
|
+
//# sourceMappingURL=hashnode-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hashnode-service.js","sourceRoot":"","sources":["../../src/services/hashnode-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACnC,CAAC,CAAC;AAEH,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,KAAK,EAAE,CA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