@hardlydifficult/social 1.0.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 +55 -0
- package/dist/SocialClient.d.ts +19 -0
- package/dist/SocialClient.d.ts.map +1 -0
- package/dist/SocialClient.js +27 -0
- package/dist/SocialClient.js.map +1 -0
- package/dist/SocialLikeWatcher.d.ts +20 -0
- package/dist/SocialLikeWatcher.d.ts.map +1 -0
- package/dist/SocialLikeWatcher.js +78 -0
- package/dist/SocialLikeWatcher.js.map +1 -0
- package/dist/SocialProviderClient.d.ts +11 -0
- package/dist/SocialProviderClient.d.ts.map +1 -0
- package/dist/SocialProviderClient.js +3 -0
- package/dist/SocialProviderClient.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/mastodon/MastodonSocialClient.d.ts +16 -0
- package/dist/mastodon/MastodonSocialClient.d.ts.map +1 -0
- package/dist/mastodon/MastodonSocialClient.js +20 -0
- package/dist/mastodon/MastodonSocialClient.js.map +1 -0
- package/dist/types.d.ts +35 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/x/XSocialClient.d.ts +24 -0
- package/dist/x/XSocialClient.d.ts.map +1 -0
- package/dist/x/XSocialClient.js +95 -0
- package/dist/x/XSocialClient.js.map +1 -0
- package/dist/x/index.d.ts +2 -0
- package/dist/x/index.d.ts.map +1 -0
- package/dist/x/index.js +6 -0
- package/dist/x/index.js.map +1 -0
- package/package.json +22 -0
package/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# @hardlydifficult/social
|
|
2
|
+
|
|
3
|
+
Provider-agnostic social read client with an X implementation in this version.
|
|
4
|
+
|
|
5
|
+
## Current scope (read-first)
|
|
6
|
+
|
|
7
|
+
This package is intentionally read-only for now:
|
|
8
|
+
|
|
9
|
+
- Read timeline content
|
|
10
|
+
- Read liked content
|
|
11
|
+
- Watch for newly liked posts
|
|
12
|
+
|
|
13
|
+
Write operations (posting, liking, reposting) are intentionally not included yet.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @hardlydifficult/social
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```typescript
|
|
24
|
+
import { createSocial } from "@hardlydifficult/social";
|
|
25
|
+
|
|
26
|
+
const social = createSocial(); // defaults to "x"
|
|
27
|
+
|
|
28
|
+
const timeline = await social.timeline({ maxResults: 10 });
|
|
29
|
+
const liked = await social.likedPosts({ maxResults: 10 });
|
|
30
|
+
|
|
31
|
+
const watcher = social.watchLikes({
|
|
32
|
+
pollIntervalMs: 30_000,
|
|
33
|
+
onLike: ({ post }) => {
|
|
34
|
+
console.log(`New like: ${post.url}`);
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
watcher.start();
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## X configuration
|
|
42
|
+
|
|
43
|
+
Set environment variables, or pass explicit config through `createSocialClient`.
|
|
44
|
+
|
|
45
|
+
- `X_BEARER_TOKEN` (required)
|
|
46
|
+
- Get a bearer token from the X Developer Portal: https://developer.x.com/en/docs/authentication/oauth-2-0/bearer-tokens
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
import { createSocialClient } from "@hardlydifficult/social";
|
|
50
|
+
|
|
51
|
+
const social = createSocialClient({
|
|
52
|
+
type: "x",
|
|
53
|
+
bearerToken: process.env.X_BEARER_TOKEN,
|
|
54
|
+
});
|
|
55
|
+
```
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SocialLikeWatcher, type SocialLikeWatcherOptions } from "./SocialLikeWatcher.js";
|
|
2
|
+
import type { SocialProviderClient } from "./SocialProviderClient.js";
|
|
3
|
+
import type { SocialPost } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
export declare class SocialClient {
|
|
8
|
+
private readonly provider;
|
|
9
|
+
constructor(provider: SocialProviderClient);
|
|
10
|
+
getPost(postId: string): Promise<SocialPost | null>;
|
|
11
|
+
timeline(options?: {
|
|
12
|
+
maxResults?: number;
|
|
13
|
+
}): Promise<readonly SocialPost[]>;
|
|
14
|
+
likedPosts(options?: {
|
|
15
|
+
maxResults?: number;
|
|
16
|
+
}): Promise<readonly SocialPost[]>;
|
|
17
|
+
watchLikes(options: SocialLikeWatcherOptions): SocialLikeWatcher;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=SocialClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SocialClient.d.ts","sourceRoot":"","sources":["../src/SocialClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,KAAK,wBAAwB,EAC9B,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C;;GAEG;AACH,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,oBAAoB;IAE3D,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAInD,QAAQ,CAAC,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,SAAS,UAAU,EAAE,CAAC;IAI3E,UAAU,CAAC,OAAO,CAAC,EAAE;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO,CAAC,SAAS,UAAU,EAAE,CAAC;IAIlC,UAAU,CAAC,OAAO,EAAE,wBAAwB,GAAG,iBAAiB;CAGjE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SocialClient = void 0;
|
|
4
|
+
const SocialLikeWatcher_js_1 = require("./SocialLikeWatcher.js");
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
class SocialClient {
|
|
9
|
+
provider;
|
|
10
|
+
constructor(provider) {
|
|
11
|
+
this.provider = provider;
|
|
12
|
+
}
|
|
13
|
+
getPost(postId) {
|
|
14
|
+
return this.provider.getPost(postId);
|
|
15
|
+
}
|
|
16
|
+
timeline(options) {
|
|
17
|
+
return this.provider.getTimeline(options);
|
|
18
|
+
}
|
|
19
|
+
likedPosts(options) {
|
|
20
|
+
return this.provider.getLikedPosts(options);
|
|
21
|
+
}
|
|
22
|
+
watchLikes(options) {
|
|
23
|
+
return SocialLikeWatcher_js_1.SocialLikeWatcher.create(this.provider, options);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.SocialClient = SocialClient;
|
|
27
|
+
//# sourceMappingURL=SocialClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SocialClient.js","sourceRoot":"","sources":["../src/SocialClient.ts"],"names":[],"mappings":";;;AAAA,iEAGgC;AAIhC;;GAEG;AACH,MAAa,YAAY;IACM;IAA7B,YAA6B,QAA8B;QAA9B,aAAQ,GAAR,QAAQ,CAAsB;IAAG,CAAC;IAE/D,OAAO,CAAC,MAAc;QACpB,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;IAED,QAAQ,CAAC,OAAiC;QACxC,OAAO,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;IAED,UAAU,CAAC,OAEV;QACC,OAAO,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED,UAAU,CAAC,OAAiC;QAC1C,OAAO,wCAAiB,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC1D,CAAC;CACF;AApBD,oCAoBC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { SocialProviderClient } from "./SocialProviderClient.js";
|
|
2
|
+
import type { LikeWatcherOptions } from "./types.js";
|
|
3
|
+
export type SocialLikeWatcherOptions = LikeWatcherOptions;
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
export declare class SocialLikeWatcher {
|
|
8
|
+
private readonly provider;
|
|
9
|
+
private readonly options;
|
|
10
|
+
private timer;
|
|
11
|
+
private polling;
|
|
12
|
+
private seeded;
|
|
13
|
+
private readonly knownLikeIds;
|
|
14
|
+
constructor(provider: SocialProviderClient, options: Required<Pick<LikeWatcherOptions, "pollIntervalMs">> & Pick<LikeWatcherOptions, "onLike" | "onError">);
|
|
15
|
+
static create(provider: SocialProviderClient, options: LikeWatcherOptions): SocialLikeWatcher;
|
|
16
|
+
start(): void;
|
|
17
|
+
stop(): void;
|
|
18
|
+
poll(): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=SocialLikeWatcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SocialLikeWatcher.d.ts","sourceRoot":"","sources":["../src/SocialLikeWatcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,KAAK,EAAoB,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEvE,MAAM,MAAM,wBAAwB,GAAG,kBAAkB,CAAC;AAE1D;;GAEG;AACH,qBAAa,iBAAiB;IAO1B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAP1B,OAAO,CAAC,KAAK,CAA+C;IAC5D,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAqB;gBAG/B,QAAQ,EAAE,oBAAoB,EAC9B,OAAO,EAAE,QAAQ,CAChC,IAAI,CAAC,kBAAkB,EAAE,gBAAgB,CAAC,CAC3C,GACC,IAAI,CAAC,kBAAkB,EAAE,QAAQ,GAAG,SAAS,CAAC;IAGlD,MAAM,CAAC,MAAM,CACX,QAAQ,EAAE,oBAAoB,EAC9B,OAAO,EAAE,kBAAkB,GAC1B,iBAAiB;IAOpB,KAAK,IAAI,IAAI;IAYb,IAAI,IAAI,IAAI;IAON,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CA6C5B"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SocialLikeWatcher = void 0;
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
class SocialLikeWatcher {
|
|
8
|
+
provider;
|
|
9
|
+
options;
|
|
10
|
+
timer = null;
|
|
11
|
+
polling = false;
|
|
12
|
+
seeded = false;
|
|
13
|
+
knownLikeIds = new Set();
|
|
14
|
+
constructor(provider, options) {
|
|
15
|
+
this.provider = provider;
|
|
16
|
+
this.options = options;
|
|
17
|
+
}
|
|
18
|
+
static create(provider, options) {
|
|
19
|
+
return new SocialLikeWatcher(provider, {
|
|
20
|
+
...options,
|
|
21
|
+
pollIntervalMs: options.pollIntervalMs ?? 60_000,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
start() {
|
|
25
|
+
if (this.timer !== null) {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
void this.poll();
|
|
29
|
+
this.timer = setInterval(() => void this.poll(), this.options.pollIntervalMs);
|
|
30
|
+
}
|
|
31
|
+
stop() {
|
|
32
|
+
if (this.timer !== null) {
|
|
33
|
+
clearInterval(this.timer);
|
|
34
|
+
this.timer = null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async poll() {
|
|
38
|
+
if (this.polling) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
this.polling = true;
|
|
42
|
+
try {
|
|
43
|
+
const liked = await this.provider.getLikedPosts();
|
|
44
|
+
const now = new Date().toISOString();
|
|
45
|
+
if (!this.seeded) {
|
|
46
|
+
for (const post of liked) {
|
|
47
|
+
this.knownLikeIds.add(post.id);
|
|
48
|
+
}
|
|
49
|
+
this.seeded = true;
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const notifications = [];
|
|
53
|
+
for (const post of liked) {
|
|
54
|
+
if (!this.knownLikeIds.has(post.id)) {
|
|
55
|
+
this.knownLikeIds.add(post.id);
|
|
56
|
+
notifications.push({ post, seenAt: now });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
for (const notification of notifications.reverse()) {
|
|
60
|
+
this.options.onLike(notification);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
const normalizedError = error instanceof Error ? error : new Error(String(error));
|
|
65
|
+
if (this.options.onError) {
|
|
66
|
+
this.options.onError(normalizedError);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
console.error("SocialLikeWatcher: poll failed:", normalizedError.message);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
finally {
|
|
73
|
+
this.polling = false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.SocialLikeWatcher = SocialLikeWatcher;
|
|
78
|
+
//# sourceMappingURL=SocialLikeWatcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SocialLikeWatcher.js","sourceRoot":"","sources":["../src/SocialLikeWatcher.ts"],"names":[],"mappings":";;;AAKA;;GAEG;AACH,MAAa,iBAAiB;IAOT;IACA;IAPX,KAAK,GAA0C,IAAI,CAAC;IACpD,OAAO,GAAG,KAAK,CAAC;IAChB,MAA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
|
|
3
|
+
getPost(postId: string): Promise<SocialPost | null>;
|
|
4
|
+
getTimeline(options?: {
|
|
5
|
+
maxResults?: number;
|
|
6
|
+
}): Promise<readonly SocialPost[]>;
|
|
7
|
+
getLikedPosts(options?: {
|
|
8
|
+
maxResults?: number;
|
|
9
|
+
}): Promise<readonly SocialPost[]>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=SocialProviderClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SocialProviderClient.d.ts","sourceRoot":"","sources":["../src/SocialProviderClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,WAAW,oBAAoB;IACnC,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IACpD,WAAW,CAAC,OAAO,CAAC,EAAE;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO,CAAC,SAAS,UAAU,EAAE,CAAC,CAAC;IACnC,aAAa,CAAC,OAAO,CAAC,EAAE;QACtB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO,CAAC,SAAS,UAAU,EAAE,CAAC,CAAC;CACpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SocialProviderClient.js","sourceRoot":"","sources":["../src/SocialProviderClient.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type { Provider, XConfig, SocialConfig, SocialPost, SocialAuthor, SocialPostMetrics, LikeWatcherOptions, LikeNotification, } from "./types.js";
|
|
2
|
+
export type { SocialProviderClient } from "./SocialProviderClient.js";
|
|
3
|
+
export { SocialClient } from "./SocialClient.js";
|
|
4
|
+
export { SocialLikeWatcher, type SocialLikeWatcherOptions, } from "./SocialLikeWatcher.js";
|
|
5
|
+
export { XSocialClient } from "./x";
|
|
6
|
+
export { MastodonSocialClient } from "./mastodon/MastodonSocialClient.js";
|
|
7
|
+
import { SocialClient } from "./SocialClient.js";
|
|
8
|
+
import type { SocialConfig } from "./types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Create a social client from explicit provider configuration.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createSocialClient(config: SocialConfig): SocialClient;
|
|
13
|
+
/**
|
|
14
|
+
* Create a social client using default provider configuration.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createSocial(): SocialClient;
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEtE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EACL,iBAAiB,EACjB,KAAK,wBAAwB,GAC9B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAE1E,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAG/C;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CAErE;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,YAAY,CAE3C"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MastodonSocialClient = exports.XSocialClient = exports.SocialLikeWatcher = exports.SocialClient = void 0;
|
|
4
|
+
exports.createSocialClient = createSocialClient;
|
|
5
|
+
exports.createSocial = createSocial;
|
|
6
|
+
var SocialClient_js_1 = require("./SocialClient.js");
|
|
7
|
+
Object.defineProperty(exports, "SocialClient", { enumerable: true, get: function () { return SocialClient_js_1.SocialClient; } });
|
|
8
|
+
var SocialLikeWatcher_js_1 = require("./SocialLikeWatcher.js");
|
|
9
|
+
Object.defineProperty(exports, "SocialLikeWatcher", { enumerable: true, get: function () { return SocialLikeWatcher_js_1.SocialLikeWatcher; } });
|
|
10
|
+
var x_1 = require("./x");
|
|
11
|
+
Object.defineProperty(exports, "XSocialClient", { enumerable: true, get: function () { return x_1.XSocialClient; } });
|
|
12
|
+
var MastodonSocialClient_js_1 = require("./mastodon/MastodonSocialClient.js");
|
|
13
|
+
Object.defineProperty(exports, "MastodonSocialClient", { enumerable: true, get: function () { return MastodonSocialClient_js_1.MastodonSocialClient; } });
|
|
14
|
+
const SocialClient_js_2 = require("./SocialClient.js");
|
|
15
|
+
const x_2 = require("./x");
|
|
16
|
+
/**
|
|
17
|
+
* Create a social client from explicit provider configuration.
|
|
18
|
+
*/
|
|
19
|
+
function createSocialClient(config) {
|
|
20
|
+
return new SocialClient_js_2.SocialClient(new x_2.XSocialClient(config));
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Create a social client using default provider configuration.
|
|
24
|
+
*/
|
|
25
|
+
function createSocial() {
|
|
26
|
+
return createSocialClient({ type: "x" });
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AA6BA,gDAEC;AAKD,oCAEC;AAzBD,qDAAiD;AAAxC,+GAAA,YAAY,OAAA;AACrB,+DAGgC;AAF9B,yHAAA,iBAAiB,OAAA;AAInB,yBAAoC;AAA3B,kGAAA,aAAa,OAAA;AACtB,8EAA0E;AAAjE,+HAAA,oBAAoB,OAAA;AAE7B,uDAAiD;AAEjD,2BAAoC;AAEpC;;GAEG;AACH,SAAgB,kBAAkB,CAAC,MAAoB;IACrD,OAAO,IAAI,8BAAY,CAAC,IAAI,iBAAa,CAAC,MAAM,CAAC,CAAC,CAAC;AACrD,CAAC;AAED;;GAEG;AACH,SAAgB,YAAY;IAC1B,OAAO,kBAAkB,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SocialProviderClient } from "../SocialProviderClient.js";
|
|
2
|
+
import type { SocialPost } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
export declare class MastodonSocialClient implements SocialProviderClient {
|
|
7
|
+
private readonly message;
|
|
8
|
+
getPost(_postId: string): Promise<SocialPost | null>;
|
|
9
|
+
getTimeline(_options?: {
|
|
10
|
+
maxResults?: number;
|
|
11
|
+
}): Promise<readonly SocialPost[]>;
|
|
12
|
+
getLikedPosts(_options?: {
|
|
13
|
+
maxResults?: number;
|
|
14
|
+
}): Promise<readonly SocialPost[]>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=MastodonSocialClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MastodonSocialClient.d.ts","sourceRoot":"","sources":["../../src/mastodon/MastodonSocialClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;GAEG;AACH,qBAAa,oBAAqB,YAAW,oBAAoB;IAC/D,OAAO,CAAC,QAAQ,CAAC,OAAO,CACiF;IAEzG,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAIpD,WAAW,CAAC,QAAQ,CAAC,EAAE;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO,CAAC,SAAS,UAAU,EAAE,CAAC;IAIlC,aAAa,CAAC,QAAQ,CAAC,EAAE;QACvB,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO,CAAC,SAAS,UAAU,EAAE,CAAC;CAGnC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MastodonSocialClient = void 0;
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
class MastodonSocialClient {
|
|
8
|
+
message = 'MastodonSocialClient is not yet supported in @hardlydifficult/social. Use provider type "x" for now.';
|
|
9
|
+
getPost(_postId) {
|
|
10
|
+
throw new Error(this.message);
|
|
11
|
+
}
|
|
12
|
+
getTimeline(_options) {
|
|
13
|
+
throw new Error(this.message);
|
|
14
|
+
}
|
|
15
|
+
getLikedPosts(_options) {
|
|
16
|
+
throw new Error(this.message);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.MastodonSocialClient = MastodonSocialClient;
|
|
20
|
+
//# sourceMappingURL=MastodonSocialClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MastodonSocialClient.js","sourceRoot":"","sources":["../../src/mastodon/MastodonSocialClient.ts"],"names":[],"mappings":";;;AAGA;;GAEG;AACH,MAAa,oBAAoB;IACd,OAAO,GACtB,sGAAsG,CAAC;IAEzG,OAAO,CAAC,OAAe;QACrB,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAED,WAAW,CAAC,QAEX;QACC,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAED,aAAa,CAAC,QAEb;QACC,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;CACF;AAnBD,oDAmBC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export type Provider = "x";
|
|
2
|
+
export interface XConfig {
|
|
3
|
+
readonly type: "x";
|
|
4
|
+
readonly bearerToken?: string;
|
|
5
|
+
readonly maxResults?: number;
|
|
6
|
+
}
|
|
7
|
+
export type SocialConfig = XConfig;
|
|
8
|
+
export interface SocialAuthor {
|
|
9
|
+
readonly id: string;
|
|
10
|
+
readonly username: string;
|
|
11
|
+
readonly displayName: string;
|
|
12
|
+
}
|
|
13
|
+
export interface SocialPostMetrics {
|
|
14
|
+
readonly likes: number;
|
|
15
|
+
readonly replies: number;
|
|
16
|
+
readonly reposts: number;
|
|
17
|
+
}
|
|
18
|
+
export interface SocialPost {
|
|
19
|
+
readonly id: string;
|
|
20
|
+
readonly text: string;
|
|
21
|
+
readonly createdAt: string;
|
|
22
|
+
readonly url: string;
|
|
23
|
+
readonly author: SocialAuthor;
|
|
24
|
+
readonly metrics: SocialPostMetrics;
|
|
25
|
+
}
|
|
26
|
+
export interface LikeNotification {
|
|
27
|
+
readonly post: SocialPost;
|
|
28
|
+
readonly seenAt: string;
|
|
29
|
+
}
|
|
30
|
+
export interface LikeWatcherOptions {
|
|
31
|
+
readonly pollIntervalMs?: number;
|
|
32
|
+
readonly onLike: (notification: LikeNotification) => void;
|
|
33
|
+
readonly onError?: (error: Error) => void;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,GAAG,CAAC;AAE3B,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC;IACnB,QAAQ,CAAC,WAAW,CAAC,EAAE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
|
|
1
|
+
import type { SocialProviderClient } from "../SocialProviderClient.js";
|
|
2
|
+
import type { SocialPost, XConfig } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
export declare class XSocialClient implements SocialProviderClient {
|
|
7
|
+
private readonly bearerToken;
|
|
8
|
+
private readonly maxResults;
|
|
9
|
+
constructor(config: XConfig);
|
|
10
|
+
getPost(postId: string): Promise<SocialPost | null>;
|
|
11
|
+
getTimeline(options?: {
|
|
12
|
+
maxResults?: number;
|
|
13
|
+
}): Promise<readonly SocialPost[]>;
|
|
14
|
+
getLikedPosts(options?: {
|
|
15
|
+
maxResults?: number;
|
|
16
|
+
}): Promise<readonly SocialPost[]>;
|
|
17
|
+
private buildQuery;
|
|
18
|
+
private request;
|
|
19
|
+
private readSingleTweet;
|
|
20
|
+
private readTweetList;
|
|
21
|
+
private isTweet;
|
|
22
|
+
private normalizeTweet;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=XSocialClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"XSocialClient.d.ts","sourceRoot":"","sources":["../../src/x/XSocialClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AA2BvD;;GAEG;AACH,qBAAa,aAAc,YAAW,oBAAoB;IACxD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;gBAExB,MAAM,EAAE,OAAO;IASrB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;IAYnD,WAAW,CAAC,OAAO,CAAC,EAAE;QAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO,CAAC,SAAS,UAAU,EAAE,CAAC;IAU5B,aAAa,CAAC,OAAO,CAAC,EAAE;QAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;KACrB,GAAG,OAAO,CAAC,SAAS,UAAU,EAAE,CAAC;IAUlC,OAAO,CAAC,UAAU;YAWJ,OAAO;IAgBrB,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,OAAO;IAWf,OAAO,CAAC,cAAc;CAoBvB"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.XSocialClient = void 0;
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
class XSocialClient {
|
|
8
|
+
bearerToken;
|
|
9
|
+
maxResults;
|
|
10
|
+
constructor(config) {
|
|
11
|
+
this.bearerToken = config.bearerToken ?? process.env.X_BEARER_TOKEN ?? "";
|
|
12
|
+
this.maxResults = config.maxResults ?? 25;
|
|
13
|
+
if (this.bearerToken.length === 0) {
|
|
14
|
+
throw new Error("X bearer token is required. Set X_BEARER_TOKEN.");
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
async getPost(postId) {
|
|
18
|
+
const response = await this.request(`/tweets/${postId}${this.buildQuery()}`);
|
|
19
|
+
const tweet = this.readSingleTweet(response.data);
|
|
20
|
+
if (!tweet) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
return this.normalizeTweet(tweet, response.includes?.users ?? []);
|
|
24
|
+
}
|
|
25
|
+
async getTimeline(options) {
|
|
26
|
+
const response = await this.request(`/users/me/timelines/reverse_chronological${this.buildQuery(options?.maxResults)}`);
|
|
27
|
+
return this.readTweetList(response.data).map((tweet) => this.normalizeTweet(tweet, response.includes?.users ?? []));
|
|
28
|
+
}
|
|
29
|
+
async getLikedPosts(options) {
|
|
30
|
+
const response = await this.request(`/users/me/liked_tweets${this.buildQuery(options?.maxResults)}`);
|
|
31
|
+
return this.readTweetList(response.data).map((tweet) => this.normalizeTweet(tweet, response.includes?.users ?? []));
|
|
32
|
+
}
|
|
33
|
+
buildQuery(maxResults) {
|
|
34
|
+
const params = new URLSearchParams({
|
|
35
|
+
expansions: "author_id",
|
|
36
|
+
"tweet.fields": "created_at,public_metrics",
|
|
37
|
+
"user.fields": "name,username",
|
|
38
|
+
max_results: String(maxResults ?? this.maxResults),
|
|
39
|
+
});
|
|
40
|
+
return `?${params.toString()}`;
|
|
41
|
+
}
|
|
42
|
+
async request(path) {
|
|
43
|
+
const response = await fetch(`https://api.x.com/2${path}`, {
|
|
44
|
+
headers: {
|
|
45
|
+
Authorization: `Bearer ${this.bearerToken}`,
|
|
46
|
+
"Content-Type": "application/json",
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
if (!response.ok) {
|
|
50
|
+
const status = String(response.status);
|
|
51
|
+
throw new Error(`X API request failed: ${status} ${response.statusText}`);
|
|
52
|
+
}
|
|
53
|
+
return (await response.json());
|
|
54
|
+
}
|
|
55
|
+
readSingleTweet(data) {
|
|
56
|
+
if (!this.isTweet(data)) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
return data;
|
|
60
|
+
}
|
|
61
|
+
readTweetList(data) {
|
|
62
|
+
if (!Array.isArray(data)) {
|
|
63
|
+
return [];
|
|
64
|
+
}
|
|
65
|
+
return data.filter((item) => this.isTweet(item));
|
|
66
|
+
}
|
|
67
|
+
isTweet(value) {
|
|
68
|
+
if (typeof value !== "object" || value === null) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
const candidate = value;
|
|
72
|
+
return (typeof candidate.id === "string" && typeof candidate.text === "string");
|
|
73
|
+
}
|
|
74
|
+
normalizeTweet(tweet, users) {
|
|
75
|
+
const author = users.find((user) => user.id === tweet.author_id);
|
|
76
|
+
return {
|
|
77
|
+
id: tweet.id,
|
|
78
|
+
text: tweet.text,
|
|
79
|
+
createdAt: tweet.created_at ?? new Date(0).toISOString(),
|
|
80
|
+
url: `https://x.com/${author?.username ?? "i"}/status/${tweet.id}`,
|
|
81
|
+
author: {
|
|
82
|
+
id: author?.id ?? tweet.author_id ?? "unknown",
|
|
83
|
+
username: author?.username ?? "unknown",
|
|
84
|
+
displayName: author?.name ?? author?.username ?? "Unknown",
|
|
85
|
+
},
|
|
86
|
+
metrics: {
|
|
87
|
+
likes: tweet.public_metrics?.like_count ?? 0,
|
|
88
|
+
replies: tweet.public_metrics?.reply_count ?? 0,
|
|
89
|
+
reposts: tweet.public_metrics?.retweet_count ?? 0,
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.XSocialClient = XSocialClient;
|
|
95
|
+
//# sourceMappingURL=XSocialClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"XSocialClient.js","sourceRoot":"","sources":["../../src/x/XSocialClient.ts"],"names":[],"mappings":";;;AA4BA;;GAEG;AACH,MAAa,aAAa;IACP,WAAW,CAAS;IACpB,UAAU,CAAS;IAEpC,YAAY,MAAe;QACzB,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,EAAE,CAAC;QAC1E,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC;QAE1C,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAClC,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACrE,CAAC;IACH,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,MAAc;QAC1B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CACjC,WAAW,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,EAAE,CACxC,CAAC;QACF,MAAM,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAClD,IAAI,CAAC,KAAK,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,KAAa,EAAE,KAAuB;QAC3D,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,KAAK,CAAC,SAAS,CAAC,CAAC;QAEjE,OAAO;YACL,EAAE,EAAE,KAAK,CAAC,EAAE;YACZ,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,SAAS,EAAE,KAAK,CAAC,UAAU,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE;YACxD,GAAG,EAAE,iBAAiB,MAAM,EAAE,QAAQ,IAAI,GAAG,WAAW,KAAK,CAAC,EAAE,EAAE;YAClE,MAAM,EAAE;gBACN,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,KAAK,CAAC,SAAS,IAAI,SAAS;gBAC9C,QAAQ,EAAE,MAAM,EAAE,QAAQ,IAAI,SAAS;gBACvC,WAAW,EAAE,MAAM,EAAE,IAAI,IAAI,MAAM,EAAE,QAAQ,IAAI,SAAS;aAC3D;YACD,OAAO,EAAE;gBACP,KAAK,EAAE,KAAK,CAAC,cAAc,EAAE,UAAU,IAAI,CAAC;gBAC5C,OAAO,EAAE,KAAK,CAAC,cAAc,EAAE,WAAW,IAAI,CAAC;gBAC/C,OAAO,EAAE,KAAK,CAAC,cAAc,EAAE,aAAa,IAAI,CAAC;aAClD;SACF,CAAC;IACJ,CAAC;CACF;AA3HD,sCA2HC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/x/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/x/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.XSocialClient = void 0;
|
|
4
|
+
var XSocialClient_js_1 = require("./XSocialClient.js");
|
|
5
|
+
Object.defineProperty(exports, "XSocialClient", { enumerable: true, get: function () { return XSocialClient_js_1.XSocialClient; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/x/index.ts"],"names":[],"mappings":";;;AAAA,uDAAmD;AAA1C,iHAAA,aAAa,OAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hardlydifficult/social",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "./dist/index.js",
|
|
5
|
+
"types": "./dist/index.d.ts",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "tsc",
|
|
11
|
+
"test": "vitest run",
|
|
12
|
+
"test:watch": "vitest",
|
|
13
|
+
"test:coverage": "vitest run --coverage",
|
|
14
|
+
"lint": "tsc --noEmit",
|
|
15
|
+
"clean": "rm -rf dist"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@types/node": "25.2.3",
|
|
19
|
+
"typescript": "5.9.3",
|
|
20
|
+
"vitest": "4.0.18"
|
|
21
|
+
}
|
|
22
|
+
}
|