@xpoz/xpoz 0.3.2 → 0.4.1
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 +213 -9
- package/dist/index.cjs +10 -4
- package/dist/index.d.cts +9 -57
- package/dist/index.d.ts +9 -57
- package/dist/index.js +10 -4
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ The SDK wraps Xpoz's [MCP](https://modelcontextprotocol.io) server, abstracting
|
|
|
30
30
|
|
|
31
31
|
## Features
|
|
32
32
|
|
|
33
|
-
- **
|
|
33
|
+
- **40 data methods** across Twitter, Instagram, Reddit, and TikTok
|
|
34
34
|
- **Fully async** — all methods return `Promise<T>`
|
|
35
35
|
- **Automatic operation polling** — long-running queries are abstracted away
|
|
36
36
|
- **Response types** — choose between fast (immediate), paging (full pagination), or CSV export
|
|
@@ -38,7 +38,7 @@ The SDK wraps Xpoz's [MCP](https://modelcontextprotocol.io) server, abstracting
|
|
|
38
38
|
- **CSV export** — `exportCsv()` on any paginated result
|
|
39
39
|
- **Field selection** — request only the fields you need
|
|
40
40
|
- **TypeScript-first** — fully typed results with autocomplete support
|
|
41
|
-
- **Namespaced API** — `client.twitter.*`, `client.instagram.*`, `client.reddit.*`
|
|
41
|
+
- **Namespaced API** — `client.twitter.*`, `client.instagram.*`, `client.reddit.*`, `client.tiktok.*`, `client.tracking.*`
|
|
42
42
|
|
|
43
43
|
## Quick Start
|
|
44
44
|
|
|
@@ -200,10 +200,12 @@ The following methods accept both `responseType` and `limit`:
|
|
|
200
200
|
- `twitter.getPostsByAuthor()`, `twitter.searchPosts()`, `twitter.getUsersByKeywords()`
|
|
201
201
|
- `instagram.getPostsByUser()`, `instagram.searchPosts()`, `instagram.getUsersByKeywords()`
|
|
202
202
|
- `reddit.searchPosts()`
|
|
203
|
+
- `tiktok.getPostsByUser()`, `tiktok.searchPosts()`, `tiktok.getUsersByKeywords()`
|
|
203
204
|
|
|
204
205
|
These methods accept `limit` only:
|
|
205
206
|
|
|
206
207
|
- `twitter.searchUsers()`, `instagram.searchUsers()`, `reddit.searchUsers()`, `reddit.searchSubreddits()`
|
|
208
|
+
- `tiktok.searchUsers()`
|
|
207
209
|
|
|
208
210
|
## Query Syntax
|
|
209
211
|
|
|
@@ -574,6 +576,122 @@ const subs = await client.reddit.getSubredditsByKeywords("cryptocurrency");
|
|
|
574
576
|
|
|
575
577
|
---
|
|
576
578
|
|
|
579
|
+
### TikTok — `client.tiktok`
|
|
580
|
+
|
|
581
|
+
#### `getUser(identifier, options?) -> Promise<TiktokUser>`
|
|
582
|
+
|
|
583
|
+
```typescript
|
|
584
|
+
const user = await client.tiktok.getUser("charlidamelio");
|
|
585
|
+
console.log(`${user.nickname} — ${user.followerCount?.toLocaleString()} followers`);
|
|
586
|
+
|
|
587
|
+
// By numeric ID
|
|
588
|
+
const user = await client.tiktok.getUser("123456789", { identifierType: "id" });
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
#### `searchUsers(name, options?) -> Promise<TiktokUser[]>`
|
|
592
|
+
|
|
593
|
+
Search users by name. Use `limit` to adjust the number of results.
|
|
594
|
+
|
|
595
|
+
```typescript
|
|
596
|
+
const users = await client.tiktok.searchUsers("charli");
|
|
597
|
+
const topFive = await client.tiktok.searchUsers("charli", { limit: 5 });
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
#### `getUsersByKeywords(query, options?) -> Promise<PaginatedResult<TiktokUser>>`
|
|
601
|
+
|
|
602
|
+
Find users who authored posts matching a keyword query. Supports `responseType` and `limit`.
|
|
603
|
+
|
|
604
|
+
```typescript
|
|
605
|
+
const users = await client.tiktok.getUsersByKeywords('"machine learning"', {
|
|
606
|
+
responseType: ResponseType.Fast,
|
|
607
|
+
limit: 20,
|
|
608
|
+
});
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
#### `getPostsByIds(postIds, options?) -> Promise<TiktokPost[]>`
|
|
612
|
+
|
|
613
|
+
Get 1-100 posts by their IDs.
|
|
614
|
+
|
|
615
|
+
```typescript
|
|
616
|
+
const posts = await client.tiktok.getPostsByIds(["7123456789012345678"]);
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
#### `getPostsByUser(identifier, options?) -> Promise<PaginatedResult<TiktokPost>>`
|
|
620
|
+
|
|
621
|
+
Get all posts by a user. Supports `responseType` and `limit`.
|
|
622
|
+
|
|
623
|
+
```typescript
|
|
624
|
+
const results = await client.tiktok.getPostsByUser("charlidamelio", {
|
|
625
|
+
startDate: "2025-01-01",
|
|
626
|
+
responseType: ResponseType.Fast,
|
|
627
|
+
limit: 50,
|
|
628
|
+
});
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
#### `searchPosts(query, options?) -> Promise<PaginatedResult<TiktokPost>>`
|
|
632
|
+
|
|
633
|
+
Full-text search with filters. Supports `responseType` and `limit`.
|
|
634
|
+
|
|
635
|
+
```typescript
|
|
636
|
+
const results = await client.tiktok.searchPosts("travel vlog", {
|
|
637
|
+
startDate: "2025-01-01",
|
|
638
|
+
responseType: ResponseType.Fast,
|
|
639
|
+
limit: 30,
|
|
640
|
+
});
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
#### `getComments(postId, options?) -> Promise<PaginatedResult<TiktokComment>>`
|
|
644
|
+
|
|
645
|
+
```typescript
|
|
646
|
+
const comments = await client.tiktok.getComments("7123456789012345678");
|
|
647
|
+
```
|
|
648
|
+
|
|
649
|
+
---
|
|
650
|
+
|
|
651
|
+
### Tracking — `client.tracking`
|
|
652
|
+
|
|
653
|
+
Manage tracked items (keywords, users, subreddits) that Xpoz monitors on your behalf. Import the enums to build items:
|
|
654
|
+
|
|
655
|
+
```typescript
|
|
656
|
+
import { XpozClient, TrackedItemType, TrackedItemPlatform } from "@xpoz/xpoz";
|
|
657
|
+
```
|
|
658
|
+
|
|
659
|
+
#### `getTrackedItems() -> Promise<TrackedItem[]>`
|
|
660
|
+
|
|
661
|
+
List all currently tracked items on your account.
|
|
662
|
+
|
|
663
|
+
```typescript
|
|
664
|
+
const items = await client.tracking.getTrackedItems();
|
|
665
|
+
for (const item of items) {
|
|
666
|
+
console.log(`${item.platform} / ${item.type}: ${item.phrase}`);
|
|
667
|
+
}
|
|
668
|
+
```
|
|
669
|
+
|
|
670
|
+
#### `addTrackedItems(items) -> Promise<AddTrackedItemsResult>`
|
|
671
|
+
|
|
672
|
+
Add one or more items to track.
|
|
673
|
+
|
|
674
|
+
```typescript
|
|
675
|
+
const result = await client.tracking.addTrackedItems([
|
|
676
|
+
{ phrase: "bitcoin", type: TrackedItemType.Keyword, platform: TrackedItemPlatform.Twitter },
|
|
677
|
+
{ phrase: "nasa", type: TrackedItemType.User, platform: TrackedItemPlatform.Instagram },
|
|
678
|
+
]);
|
|
679
|
+
console.log(`Added ${result.addedCount} items (${result.currentCount}/${result.maxTrackedItems} used)`);
|
|
680
|
+
```
|
|
681
|
+
|
|
682
|
+
#### `removeTrackedItems(items) -> Promise<RemoveTrackedItemsResult>`
|
|
683
|
+
|
|
684
|
+
Remove one or more tracked items.
|
|
685
|
+
|
|
686
|
+
```typescript
|
|
687
|
+
const result = await client.tracking.removeTrackedItems([
|
|
688
|
+
{ phrase: "bitcoin", type: TrackedItemType.Keyword, platform: TrackedItemPlatform.Twitter },
|
|
689
|
+
]);
|
|
690
|
+
console.log(`Removed ${result.removedCount} items`);
|
|
691
|
+
```
|
|
692
|
+
|
|
693
|
+
---
|
|
694
|
+
|
|
577
695
|
## Type Models
|
|
578
696
|
|
|
579
697
|
All fields are optional and typed as their respective TypeScript types. Unknown fields are preserved on the object.
|
|
@@ -596,15 +714,20 @@ All fields are optional and typed as their respective TypeScript types. Unknown
|
|
|
596
714
|
| `hashtags` | `string[]` | Hashtags in tweet |
|
|
597
715
|
| `mentions` | `string[]` | Mentioned usernames |
|
|
598
716
|
| `mediaUrls` | `string[]` | Media attachment URLs |
|
|
599
|
-
| `urls` | `string[]` | URLs in tweet
|
|
717
|
+
| `urls` | `string[]` | URLs in tweet text |
|
|
600
718
|
| `country` | `string` | Country (if geo-tagged) |
|
|
601
719
|
| `createdAt` | `string` | Creation timestamp |
|
|
602
720
|
| `createdAtDate` | `string` | Creation date (YYYY-MM-DD) |
|
|
603
721
|
| `conversationId` | `string` | Thread conversation ID |
|
|
604
722
|
| `quotedTweetId` | `string` | ID of quoted tweet |
|
|
605
723
|
| `replyToTweetId` | `string` | ID of parent tweet |
|
|
606
|
-
| `isRetweet` | `boolean` | Whether this is a retweet |
|
|
607
724
|
| `possiblySensitive` | `boolean` | Sensitive content flag |
|
|
725
|
+
| `isRetweet` | `boolean` | Whether this is a retweet |
|
|
726
|
+
| `hasBirdwatchNotes` | `boolean` | Has community notes |
|
|
727
|
+
| `birdwatchNotesId` | `string` | Birdwatch note ID |
|
|
728
|
+
| `birdwatchNotesText`| `string` | Birdwatch note text |
|
|
729
|
+
| `birdwatchNotesUrl` | `string` | Birdwatch note URL |
|
|
730
|
+
| `status` | `string` | Tweet status |
|
|
608
731
|
|
|
609
732
|
### TwitterUser
|
|
610
733
|
|
|
@@ -624,9 +747,6 @@ All fields are optional and typed as their respective TypeScript types. Unknown
|
|
|
624
747
|
| `profileImageUrl` | `string` | Profile picture URL |
|
|
625
748
|
| `createdAt` | `string` | Account creation timestamp |
|
|
626
749
|
| `accountBasedIn` | `string` | Account location |
|
|
627
|
-
| `isInauthentic` | `boolean` | Inauthenticity flag |
|
|
628
|
-
| `isInauthenticProbScore` | `number` | Inauthenticity probability |
|
|
629
|
-
| `avgTweetsPerDayLastMonth` | `number` | Tweeting frequency |
|
|
630
750
|
|
|
631
751
|
### InstagramPost
|
|
632
752
|
|
|
@@ -642,8 +762,10 @@ All fields are optional and typed as their respective TypeScript types. Unknown
|
|
|
642
762
|
| `videoPlayCount` | `number` | Video play count |
|
|
643
763
|
| `mediaType` | `string` | Media type |
|
|
644
764
|
| `imageUrl` | `string` | Image URL |
|
|
645
|
-
| `videoUrl`
|
|
646
|
-
| `createdAtDate`
|
|
765
|
+
| `videoUrl` | `string` | Video URL |
|
|
766
|
+
| `createdAtDate` | `string` | Creation date |
|
|
767
|
+
| `genAiChatWithAiCtaInfo` | `string` | Gen AI chat CTA info |
|
|
768
|
+
| `hasHighRiskGenAiInformTreatment` | `boolean` | High risk Gen AI treatment flag |
|
|
647
769
|
|
|
648
770
|
### InstagramUser
|
|
649
771
|
|
|
@@ -731,6 +853,88 @@ All fields are optional and typed as their respective TypeScript types. Unknown
|
|
|
731
853
|
| `over18` | `boolean` | NSFW flag |
|
|
732
854
|
| `createdAtDate` | `string` | Creation date |
|
|
733
855
|
|
|
856
|
+
### TiktokPost
|
|
857
|
+
|
|
858
|
+
| Field | Type | Description |
|
|
859
|
+
| ---------------------------- | --------- | ---------------------------- |
|
|
860
|
+
| `id` | `string` | Post ID |
|
|
861
|
+
| `description` | `string` | Post caption/description |
|
|
862
|
+
| `descriptionLanguage` | `string` | Language of description |
|
|
863
|
+
| `userId` | `string` | Author user ID |
|
|
864
|
+
| `username` | `string` | Author username |
|
|
865
|
+
| `nickname` | `string` | Author display name |
|
|
866
|
+
| `likeCount` | `number` | Number of likes |
|
|
867
|
+
| `commentCount` | `number` | Number of comments |
|
|
868
|
+
| `playCount` | `number` | Video play count |
|
|
869
|
+
| `collectCount` | `number` | Number of collects/saves |
|
|
870
|
+
| `downloadCount` | `number` | Number of downloads |
|
|
871
|
+
| `forwardCount` | `number` | Number of forwards/shares |
|
|
872
|
+
| `videoThumbnail` | `string` | Thumbnail URL |
|
|
873
|
+
| `postType` | `number` | Post type code |
|
|
874
|
+
| `isPrivate` | `boolean` | Private post flag |
|
|
875
|
+
| `createdAt` | `string` | Creation timestamp |
|
|
876
|
+
| `createdAtDate` | `string` | Creation date (YYYY-MM-DD) |
|
|
877
|
+
|
|
878
|
+
### TiktokUser
|
|
879
|
+
|
|
880
|
+
| Field | Type | Description |
|
|
881
|
+
| ---------------- | --------- | ------------------------ |
|
|
882
|
+
| `id` | `string` | User ID |
|
|
883
|
+
| `username` | `string` | Username |
|
|
884
|
+
| `nickname` | `string` | Display name |
|
|
885
|
+
| `signature` | `string` | Bio text |
|
|
886
|
+
| `secUid` | `string` | Secure user ID |
|
|
887
|
+
| `avatar` | `string` | Profile picture URL |
|
|
888
|
+
| `isPrivate` | `boolean` | Private account |
|
|
889
|
+
| `isVerified` | `boolean` | Verified status |
|
|
890
|
+
| `followerCount` | `number` | Number of followers |
|
|
891
|
+
| `followingCount` | `number` | Number of following |
|
|
892
|
+
| `likeCount` | `number` | Total likes received |
|
|
893
|
+
| `postCount` | `number` | Total posts |
|
|
894
|
+
| `language` | `string` | Profile language |
|
|
895
|
+
| `region` | `string` | Account region |
|
|
896
|
+
| `createdAt` | `string` | Account creation date |
|
|
897
|
+
|
|
898
|
+
### TiktokComment
|
|
899
|
+
|
|
900
|
+
| Field | Type | Description |
|
|
901
|
+
| --------------- | -------- | ------------------------ |
|
|
902
|
+
| `id` | `string` | Comment ID |
|
|
903
|
+
| `postId` | `string` | Parent post ID |
|
|
904
|
+
| `userId` | `string` | Author user ID |
|
|
905
|
+
| `username` | `string` | Author username |
|
|
906
|
+
| `text` | `string` | Comment text |
|
|
907
|
+
| `likeCount` | `number` | Number of likes |
|
|
908
|
+
| `createdAt` | `string` | Creation timestamp |
|
|
909
|
+
| `createdAtDate` | `string` | Creation date (YYYY-MM-DD) |
|
|
910
|
+
|
|
911
|
+
### TrackedItem
|
|
912
|
+
|
|
913
|
+
| Field | Type | Description |
|
|
914
|
+
| ---------- | ---------------------- | -------------------------------------------------------- |
|
|
915
|
+
| `phrase` | `string` | Keyword, username, or subreddit name to track |
|
|
916
|
+
| `type` | `TrackedItemType` | `"keyword"`, `"user"`, or `"subreddit"` |
|
|
917
|
+
| `platform` | `TrackedItemPlatform` | `"twitter"`, `"instagram"`, `"reddit"`, or `"tiktok"` |
|
|
918
|
+
|
|
919
|
+
### AddTrackedItemsResult
|
|
920
|
+
|
|
921
|
+
| Field | Type | Description |
|
|
922
|
+
| ----------------- | --------- | ---------------------------------- |
|
|
923
|
+
| `success` | `boolean` | Whether the operation succeeded |
|
|
924
|
+
| `addedCount` | `number` | Number of items added |
|
|
925
|
+
| `message` | `string` | Status message |
|
|
926
|
+
| `currentCount` | `number` | Total tracked items after addition |
|
|
927
|
+
| `maxTrackedItems` | `number` | Plan limit for tracked items |
|
|
928
|
+
| `planName` | `string` | Current plan name |
|
|
929
|
+
|
|
930
|
+
### RemoveTrackedItemsResult
|
|
931
|
+
|
|
932
|
+
| Field | Type | Description |
|
|
933
|
+
| -------------- | --------- | ------------------------------- |
|
|
934
|
+
| `success` | `boolean` | Whether the operation succeeded |
|
|
935
|
+
| `removedCount` | `number` | Number of items removed |
|
|
936
|
+
| `message` | `string` | Status message |
|
|
937
|
+
|
|
734
938
|
### Composite Types
|
|
735
939
|
|
|
736
940
|
**`RedditPostWithComments`** — returned by `getPostWithComments()`:
|
package/dist/index.cjs
CHANGED
|
@@ -296,7 +296,7 @@ function coerce(value) {
|
|
|
296
296
|
}
|
|
297
297
|
|
|
298
298
|
// src/version.ts
|
|
299
|
-
var VERSION = "0.
|
|
299
|
+
var VERSION = "0.4.1";
|
|
300
300
|
|
|
301
301
|
// src/mcp/transport.ts
|
|
302
302
|
var USER_AGENT = `xpoz-ts-sdk/${VERSION}`;
|
|
@@ -439,14 +439,14 @@ async function waitForResult(callTool, operationId, timeoutMs = DEFAULT_TIMEOUT_
|
|
|
439
439
|
while (true) {
|
|
440
440
|
const result = await callTool("checkOperationStatus", { operationId });
|
|
441
441
|
const status = result["status"];
|
|
442
|
-
if (status === "
|
|
442
|
+
if (status === "error") {
|
|
443
443
|
const error = result["error"] ?? "Unknown error";
|
|
444
444
|
throw new OperationFailedError(operationId, String(error));
|
|
445
445
|
}
|
|
446
446
|
if (status === "cancelled") {
|
|
447
447
|
throw new OperationCancelledError(operationId);
|
|
448
448
|
}
|
|
449
|
-
if (status === "
|
|
449
|
+
if (status === "success" || status === "no_data" || "results" in result || "downloadUrl" in result) {
|
|
450
450
|
return result;
|
|
451
451
|
}
|
|
452
452
|
const elapsed = Date.now() - start;
|
|
@@ -534,7 +534,13 @@ var BaseNamespace = class {
|
|
|
534
534
|
}
|
|
535
535
|
async callAndMaybePoll(toolName, args) {
|
|
536
536
|
const result = await this.callTool(toolName, args);
|
|
537
|
-
if ("
|
|
537
|
+
if (result["status"] === "error") {
|
|
538
|
+
throw new OperationFailedError(
|
|
539
|
+
"",
|
|
540
|
+
String(result["error"] ?? "Unknown error")
|
|
541
|
+
);
|
|
542
|
+
}
|
|
543
|
+
if (result["status"] === "success" || result["status"] === "no_data" || "results" in result) {
|
|
538
544
|
return result;
|
|
539
545
|
}
|
|
540
546
|
const operationId = result["operationId"];
|
package/dist/index.d.cts
CHANGED
|
@@ -53,11 +53,15 @@ interface TwitterPost {
|
|
|
53
53
|
conversationId?: string | null;
|
|
54
54
|
lang?: string | null;
|
|
55
55
|
source?: string | null;
|
|
56
|
-
status?: string | null;
|
|
57
56
|
deleted?: boolean | null;
|
|
58
57
|
suspended?: boolean | null;
|
|
59
58
|
possiblySensitive?: boolean | null;
|
|
60
59
|
isRetweet?: boolean | null;
|
|
60
|
+
hasBirdwatchNotes?: boolean | null;
|
|
61
|
+
birdwatchNotesId?: string | null;
|
|
62
|
+
birdwatchNotesText?: string | null;
|
|
63
|
+
birdwatchNotesUrl?: string | null;
|
|
64
|
+
status?: string | null;
|
|
61
65
|
likeCount?: number | null;
|
|
62
66
|
retweetCount?: number | null;
|
|
63
67
|
replyCount?: number | null;
|
|
@@ -71,22 +75,16 @@ interface TwitterPost {
|
|
|
71
75
|
replyToUsername?: string | null;
|
|
72
76
|
originalTweetId?: string | null;
|
|
73
77
|
editedTweets?: string[] | null;
|
|
74
|
-
replySettings?: string | null;
|
|
75
78
|
hashtags?: string[] | null;
|
|
76
79
|
mentions?: string[] | null;
|
|
77
80
|
mediaUrls?: string[] | null;
|
|
78
|
-
grokGeneratedContent?: Record<string, unknown>[] | null;
|
|
79
81
|
urls?: string[] | null;
|
|
82
|
+
grokGeneratedContent?: Record<string, unknown>[] | null;
|
|
80
83
|
country?: string | null;
|
|
81
84
|
region?: string | null;
|
|
82
85
|
city?: string | null;
|
|
83
|
-
hasBirdwatchNotes?: boolean | null;
|
|
84
|
-
birdwatchNotesId?: string | null;
|
|
85
|
-
birdwatchNotesText?: string | null;
|
|
86
|
-
birdwatchNotesUrl?: string | null;
|
|
87
86
|
createdAt?: string | null;
|
|
88
87
|
createdAtDate?: string | null;
|
|
89
|
-
xFetchedAt?: string | null;
|
|
90
88
|
[key: string]: unknown;
|
|
91
89
|
}
|
|
92
90
|
interface TwitterUser {
|
|
@@ -115,25 +113,13 @@ interface TwitterUser {
|
|
|
115
113
|
locationAccurate?: boolean | null;
|
|
116
114
|
label?: string | null;
|
|
117
115
|
labelType?: string | null;
|
|
118
|
-
collectedFollowingCount?: number | null;
|
|
119
|
-
collectedFollowersCount?: number | null;
|
|
120
|
-
collectedFollowersCoverage?: number | null;
|
|
121
|
-
collectedFollowingCoverage?: number | null;
|
|
122
|
-
avgTweetsPerDayLastMonth?: number | null;
|
|
123
116
|
nLang?: number | null;
|
|
124
117
|
nLangsFiltered?: number | null;
|
|
125
|
-
inauthenticType?: string | null;
|
|
126
|
-
isInauthentic?: boolean | null;
|
|
127
|
-
isInauthenticProbScore?: number | null;
|
|
128
|
-
isInauthenticCalculatedAt?: string | null;
|
|
129
118
|
verifiedSinceDatetime?: string | null;
|
|
130
119
|
usernameChanges?: string[] | null;
|
|
131
120
|
lastUsernameChangeDatetime?: string | null;
|
|
132
121
|
createdAt?: string | null;
|
|
133
|
-
createdAtDate?: string | null;
|
|
134
|
-
xFetchedAt?: string | null;
|
|
135
122
|
modifiedAt?: string | null;
|
|
136
|
-
xModifiedAt?: string | null;
|
|
137
123
|
aggRelevance?: number | null;
|
|
138
124
|
relevantTweetsCount?: number | null;
|
|
139
125
|
relevantTweetsImpressionsSum?: number | null;
|
|
@@ -246,12 +232,11 @@ interface InstagramPost {
|
|
|
246
232
|
reshareCount?: number | null;
|
|
247
233
|
videoPlayCount?: number | null;
|
|
248
234
|
location?: string | null;
|
|
235
|
+
genAiChatWithAiCtaInfo?: string | null;
|
|
236
|
+
hasHighRiskGenAiInformTreatment?: boolean | null;
|
|
249
237
|
createdAt?: string | null;
|
|
250
238
|
createdAtTimestamp?: number | null;
|
|
251
239
|
createdAtDate?: string | null;
|
|
252
|
-
lastFetch?: string | null;
|
|
253
|
-
lastFetchDatetime?: string | null;
|
|
254
|
-
xLastUpdated?: string | null;
|
|
255
240
|
[key: string]: unknown;
|
|
256
241
|
}
|
|
257
242
|
interface InstagramUser {
|
|
@@ -269,9 +254,6 @@ interface InstagramUser {
|
|
|
269
254
|
profileUrl?: string | null;
|
|
270
255
|
externalUrl?: string | null;
|
|
271
256
|
hasAnonymousProfilePicture?: boolean | null;
|
|
272
|
-
lastFetch?: string | null;
|
|
273
|
-
lastFetchDatetime?: string | null;
|
|
274
|
-
xLastUpdated?: string | null;
|
|
275
257
|
aggRelevance?: number | null;
|
|
276
258
|
relevantPostsCount?: number | null;
|
|
277
259
|
relevantPostsLikesSum?: number | null;
|
|
@@ -299,9 +281,6 @@ interface InstagramComment {
|
|
|
299
281
|
createdAt?: string | null;
|
|
300
282
|
createdAtTimestamp?: number | null;
|
|
301
283
|
createdAtDate?: string | null;
|
|
302
|
-
lastFetch?: string | null;
|
|
303
|
-
lastFetchDatetime?: string | null;
|
|
304
|
-
xLastUpdated?: string | null;
|
|
305
284
|
[key: string]: unknown;
|
|
306
285
|
}
|
|
307
286
|
|
|
@@ -392,9 +371,6 @@ interface RedditPost {
|
|
|
392
371
|
createdAt?: string | null;
|
|
393
372
|
createdAtTimestamp?: number | null;
|
|
394
373
|
createdAtDate?: string | null;
|
|
395
|
-
lastFetch?: string | null;
|
|
396
|
-
lastFetchDatetime?: string | null;
|
|
397
|
-
xLastUpdated?: string | null;
|
|
398
374
|
[key: string]: unknown;
|
|
399
375
|
}
|
|
400
376
|
interface RedditUser {
|
|
@@ -425,9 +401,6 @@ interface RedditUser {
|
|
|
425
401
|
createdAt?: string | null;
|
|
426
402
|
createdAtTimestamp?: number | null;
|
|
427
403
|
createdAtDate?: string | null;
|
|
428
|
-
lastFetch?: string | null;
|
|
429
|
-
lastFetchDatetime?: string | null;
|
|
430
|
-
xLastUpdated?: string | null;
|
|
431
404
|
aggRelevance?: number | null;
|
|
432
405
|
relevantPostsCount?: number | null;
|
|
433
406
|
relevantPostsUpvotesSum?: number | null;
|
|
@@ -456,9 +429,6 @@ interface RedditComment {
|
|
|
456
429
|
createdAt?: string | null;
|
|
457
430
|
createdAtTimestamp?: number | null;
|
|
458
431
|
createdAtDate?: string | null;
|
|
459
|
-
lastFetch?: string | null;
|
|
460
|
-
lastFetchDatetime?: string | null;
|
|
461
|
-
xLastUpdated?: string | null;
|
|
462
432
|
[key: string]: unknown;
|
|
463
433
|
}
|
|
464
434
|
interface RedditSubreddit {
|
|
@@ -481,9 +451,6 @@ interface RedditSubreddit {
|
|
|
481
451
|
createdAt?: string | null;
|
|
482
452
|
createdAtTimestamp?: number | null;
|
|
483
453
|
createdAtDate?: string | null;
|
|
484
|
-
lastFetch?: string | null;
|
|
485
|
-
lastFetchDatetime?: string | null;
|
|
486
|
-
xLastUpdated?: string | null;
|
|
487
454
|
aggRelevance?: number | null;
|
|
488
455
|
relevantPostsCount?: number | null;
|
|
489
456
|
relevantPostsUpvotesSum?: number | null;
|
|
@@ -578,15 +545,6 @@ interface TiktokPost {
|
|
|
578
545
|
createdAt?: string | null;
|
|
579
546
|
createdAtTimestamp?: number | null;
|
|
580
547
|
createdAtDate?: string | null;
|
|
581
|
-
lastFetch?: string | null;
|
|
582
|
-
lastFetchDatetime?: string | null;
|
|
583
|
-
xLastUpdated?: string | null;
|
|
584
|
-
aggRelevance?: number | null;
|
|
585
|
-
relevantPostsCount?: number | null;
|
|
586
|
-
relevantPostsLikesSum?: number | null;
|
|
587
|
-
relevantPostsCommentsSum?: number | null;
|
|
588
|
-
relevantPostsPlaysSum?: number | null;
|
|
589
|
-
relevantPostsForwardsSum?: number | null;
|
|
590
548
|
[key: string]: unknown;
|
|
591
549
|
}
|
|
592
550
|
interface TiktokUser {
|
|
@@ -606,9 +564,6 @@ interface TiktokUser {
|
|
|
606
564
|
region?: string | null;
|
|
607
565
|
createdAt?: string | null;
|
|
608
566
|
usernameModifyTime?: string | null;
|
|
609
|
-
lastFetch?: string | null;
|
|
610
|
-
lastFetchDatetime?: string | null;
|
|
611
|
-
xLastUpdated?: string | null;
|
|
612
567
|
aggRelevance?: number | null;
|
|
613
568
|
relevantPostsCount?: number | null;
|
|
614
569
|
relevantPostsLikesSum?: number | null;
|
|
@@ -627,9 +582,6 @@ interface TiktokComment {
|
|
|
627
582
|
createdAt?: string | null;
|
|
628
583
|
createdAtTimestamp?: number | null;
|
|
629
584
|
createdAtDate?: string | null;
|
|
630
|
-
lastFetch?: string | null;
|
|
631
|
-
lastFetchDatetime?: string | null;
|
|
632
|
-
xLastUpdated?: string | null;
|
|
633
585
|
[key: string]: unknown;
|
|
634
586
|
}
|
|
635
587
|
|
|
@@ -758,7 +710,7 @@ declare class OperationCancelledError extends XpozError {
|
|
|
758
710
|
constructor(operationId: string);
|
|
759
711
|
}
|
|
760
712
|
|
|
761
|
-
declare const VERSION = "0.
|
|
713
|
+
declare const VERSION = "0.4.1";
|
|
762
714
|
|
|
763
715
|
declare function checkForUpdates(): Promise<void>;
|
|
764
716
|
|
package/dist/index.d.ts
CHANGED
|
@@ -53,11 +53,15 @@ interface TwitterPost {
|
|
|
53
53
|
conversationId?: string | null;
|
|
54
54
|
lang?: string | null;
|
|
55
55
|
source?: string | null;
|
|
56
|
-
status?: string | null;
|
|
57
56
|
deleted?: boolean | null;
|
|
58
57
|
suspended?: boolean | null;
|
|
59
58
|
possiblySensitive?: boolean | null;
|
|
60
59
|
isRetweet?: boolean | null;
|
|
60
|
+
hasBirdwatchNotes?: boolean | null;
|
|
61
|
+
birdwatchNotesId?: string | null;
|
|
62
|
+
birdwatchNotesText?: string | null;
|
|
63
|
+
birdwatchNotesUrl?: string | null;
|
|
64
|
+
status?: string | null;
|
|
61
65
|
likeCount?: number | null;
|
|
62
66
|
retweetCount?: number | null;
|
|
63
67
|
replyCount?: number | null;
|
|
@@ -71,22 +75,16 @@ interface TwitterPost {
|
|
|
71
75
|
replyToUsername?: string | null;
|
|
72
76
|
originalTweetId?: string | null;
|
|
73
77
|
editedTweets?: string[] | null;
|
|
74
|
-
replySettings?: string | null;
|
|
75
78
|
hashtags?: string[] | null;
|
|
76
79
|
mentions?: string[] | null;
|
|
77
80
|
mediaUrls?: string[] | null;
|
|
78
|
-
grokGeneratedContent?: Record<string, unknown>[] | null;
|
|
79
81
|
urls?: string[] | null;
|
|
82
|
+
grokGeneratedContent?: Record<string, unknown>[] | null;
|
|
80
83
|
country?: string | null;
|
|
81
84
|
region?: string | null;
|
|
82
85
|
city?: string | null;
|
|
83
|
-
hasBirdwatchNotes?: boolean | null;
|
|
84
|
-
birdwatchNotesId?: string | null;
|
|
85
|
-
birdwatchNotesText?: string | null;
|
|
86
|
-
birdwatchNotesUrl?: string | null;
|
|
87
86
|
createdAt?: string | null;
|
|
88
87
|
createdAtDate?: string | null;
|
|
89
|
-
xFetchedAt?: string | null;
|
|
90
88
|
[key: string]: unknown;
|
|
91
89
|
}
|
|
92
90
|
interface TwitterUser {
|
|
@@ -115,25 +113,13 @@ interface TwitterUser {
|
|
|
115
113
|
locationAccurate?: boolean | null;
|
|
116
114
|
label?: string | null;
|
|
117
115
|
labelType?: string | null;
|
|
118
|
-
collectedFollowingCount?: number | null;
|
|
119
|
-
collectedFollowersCount?: number | null;
|
|
120
|
-
collectedFollowersCoverage?: number | null;
|
|
121
|
-
collectedFollowingCoverage?: number | null;
|
|
122
|
-
avgTweetsPerDayLastMonth?: number | null;
|
|
123
116
|
nLang?: number | null;
|
|
124
117
|
nLangsFiltered?: number | null;
|
|
125
|
-
inauthenticType?: string | null;
|
|
126
|
-
isInauthentic?: boolean | null;
|
|
127
|
-
isInauthenticProbScore?: number | null;
|
|
128
|
-
isInauthenticCalculatedAt?: string | null;
|
|
129
118
|
verifiedSinceDatetime?: string | null;
|
|
130
119
|
usernameChanges?: string[] | null;
|
|
131
120
|
lastUsernameChangeDatetime?: string | null;
|
|
132
121
|
createdAt?: string | null;
|
|
133
|
-
createdAtDate?: string | null;
|
|
134
|
-
xFetchedAt?: string | null;
|
|
135
122
|
modifiedAt?: string | null;
|
|
136
|
-
xModifiedAt?: string | null;
|
|
137
123
|
aggRelevance?: number | null;
|
|
138
124
|
relevantTweetsCount?: number | null;
|
|
139
125
|
relevantTweetsImpressionsSum?: number | null;
|
|
@@ -246,12 +232,11 @@ interface InstagramPost {
|
|
|
246
232
|
reshareCount?: number | null;
|
|
247
233
|
videoPlayCount?: number | null;
|
|
248
234
|
location?: string | null;
|
|
235
|
+
genAiChatWithAiCtaInfo?: string | null;
|
|
236
|
+
hasHighRiskGenAiInformTreatment?: boolean | null;
|
|
249
237
|
createdAt?: string | null;
|
|
250
238
|
createdAtTimestamp?: number | null;
|
|
251
239
|
createdAtDate?: string | null;
|
|
252
|
-
lastFetch?: string | null;
|
|
253
|
-
lastFetchDatetime?: string | null;
|
|
254
|
-
xLastUpdated?: string | null;
|
|
255
240
|
[key: string]: unknown;
|
|
256
241
|
}
|
|
257
242
|
interface InstagramUser {
|
|
@@ -269,9 +254,6 @@ interface InstagramUser {
|
|
|
269
254
|
profileUrl?: string | null;
|
|
270
255
|
externalUrl?: string | null;
|
|
271
256
|
hasAnonymousProfilePicture?: boolean | null;
|
|
272
|
-
lastFetch?: string | null;
|
|
273
|
-
lastFetchDatetime?: string | null;
|
|
274
|
-
xLastUpdated?: string | null;
|
|
275
257
|
aggRelevance?: number | null;
|
|
276
258
|
relevantPostsCount?: number | null;
|
|
277
259
|
relevantPostsLikesSum?: number | null;
|
|
@@ -299,9 +281,6 @@ interface InstagramComment {
|
|
|
299
281
|
createdAt?: string | null;
|
|
300
282
|
createdAtTimestamp?: number | null;
|
|
301
283
|
createdAtDate?: string | null;
|
|
302
|
-
lastFetch?: string | null;
|
|
303
|
-
lastFetchDatetime?: string | null;
|
|
304
|
-
xLastUpdated?: string | null;
|
|
305
284
|
[key: string]: unknown;
|
|
306
285
|
}
|
|
307
286
|
|
|
@@ -392,9 +371,6 @@ interface RedditPost {
|
|
|
392
371
|
createdAt?: string | null;
|
|
393
372
|
createdAtTimestamp?: number | null;
|
|
394
373
|
createdAtDate?: string | null;
|
|
395
|
-
lastFetch?: string | null;
|
|
396
|
-
lastFetchDatetime?: string | null;
|
|
397
|
-
xLastUpdated?: string | null;
|
|
398
374
|
[key: string]: unknown;
|
|
399
375
|
}
|
|
400
376
|
interface RedditUser {
|
|
@@ -425,9 +401,6 @@ interface RedditUser {
|
|
|
425
401
|
createdAt?: string | null;
|
|
426
402
|
createdAtTimestamp?: number | null;
|
|
427
403
|
createdAtDate?: string | null;
|
|
428
|
-
lastFetch?: string | null;
|
|
429
|
-
lastFetchDatetime?: string | null;
|
|
430
|
-
xLastUpdated?: string | null;
|
|
431
404
|
aggRelevance?: number | null;
|
|
432
405
|
relevantPostsCount?: number | null;
|
|
433
406
|
relevantPostsUpvotesSum?: number | null;
|
|
@@ -456,9 +429,6 @@ interface RedditComment {
|
|
|
456
429
|
createdAt?: string | null;
|
|
457
430
|
createdAtTimestamp?: number | null;
|
|
458
431
|
createdAtDate?: string | null;
|
|
459
|
-
lastFetch?: string | null;
|
|
460
|
-
lastFetchDatetime?: string | null;
|
|
461
|
-
xLastUpdated?: string | null;
|
|
462
432
|
[key: string]: unknown;
|
|
463
433
|
}
|
|
464
434
|
interface RedditSubreddit {
|
|
@@ -481,9 +451,6 @@ interface RedditSubreddit {
|
|
|
481
451
|
createdAt?: string | null;
|
|
482
452
|
createdAtTimestamp?: number | null;
|
|
483
453
|
createdAtDate?: string | null;
|
|
484
|
-
lastFetch?: string | null;
|
|
485
|
-
lastFetchDatetime?: string | null;
|
|
486
|
-
xLastUpdated?: string | null;
|
|
487
454
|
aggRelevance?: number | null;
|
|
488
455
|
relevantPostsCount?: number | null;
|
|
489
456
|
relevantPostsUpvotesSum?: number | null;
|
|
@@ -578,15 +545,6 @@ interface TiktokPost {
|
|
|
578
545
|
createdAt?: string | null;
|
|
579
546
|
createdAtTimestamp?: number | null;
|
|
580
547
|
createdAtDate?: string | null;
|
|
581
|
-
lastFetch?: string | null;
|
|
582
|
-
lastFetchDatetime?: string | null;
|
|
583
|
-
xLastUpdated?: string | null;
|
|
584
|
-
aggRelevance?: number | null;
|
|
585
|
-
relevantPostsCount?: number | null;
|
|
586
|
-
relevantPostsLikesSum?: number | null;
|
|
587
|
-
relevantPostsCommentsSum?: number | null;
|
|
588
|
-
relevantPostsPlaysSum?: number | null;
|
|
589
|
-
relevantPostsForwardsSum?: number | null;
|
|
590
548
|
[key: string]: unknown;
|
|
591
549
|
}
|
|
592
550
|
interface TiktokUser {
|
|
@@ -606,9 +564,6 @@ interface TiktokUser {
|
|
|
606
564
|
region?: string | null;
|
|
607
565
|
createdAt?: string | null;
|
|
608
566
|
usernameModifyTime?: string | null;
|
|
609
|
-
lastFetch?: string | null;
|
|
610
|
-
lastFetchDatetime?: string | null;
|
|
611
|
-
xLastUpdated?: string | null;
|
|
612
567
|
aggRelevance?: number | null;
|
|
613
568
|
relevantPostsCount?: number | null;
|
|
614
569
|
relevantPostsLikesSum?: number | null;
|
|
@@ -627,9 +582,6 @@ interface TiktokComment {
|
|
|
627
582
|
createdAt?: string | null;
|
|
628
583
|
createdAtTimestamp?: number | null;
|
|
629
584
|
createdAtDate?: string | null;
|
|
630
|
-
lastFetch?: string | null;
|
|
631
|
-
lastFetchDatetime?: string | null;
|
|
632
|
-
xLastUpdated?: string | null;
|
|
633
585
|
[key: string]: unknown;
|
|
634
586
|
}
|
|
635
587
|
|
|
@@ -758,7 +710,7 @@ declare class OperationCancelledError extends XpozError {
|
|
|
758
710
|
constructor(operationId: string);
|
|
759
711
|
}
|
|
760
712
|
|
|
761
|
-
declare const VERSION = "0.
|
|
713
|
+
declare const VERSION = "0.4.1";
|
|
762
714
|
|
|
763
715
|
declare function checkForUpdates(): Promise<void>;
|
|
764
716
|
|
package/dist/index.js
CHANGED
|
@@ -248,7 +248,7 @@ function coerce(value) {
|
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
// src/version.ts
|
|
251
|
-
var VERSION = "0.
|
|
251
|
+
var VERSION = "0.4.1";
|
|
252
252
|
|
|
253
253
|
// src/mcp/transport.ts
|
|
254
254
|
var USER_AGENT = `xpoz-ts-sdk/${VERSION}`;
|
|
@@ -391,14 +391,14 @@ async function waitForResult(callTool, operationId, timeoutMs = DEFAULT_TIMEOUT_
|
|
|
391
391
|
while (true) {
|
|
392
392
|
const result = await callTool("checkOperationStatus", { operationId });
|
|
393
393
|
const status = result["status"];
|
|
394
|
-
if (status === "
|
|
394
|
+
if (status === "error") {
|
|
395
395
|
const error = result["error"] ?? "Unknown error";
|
|
396
396
|
throw new OperationFailedError(operationId, String(error));
|
|
397
397
|
}
|
|
398
398
|
if (status === "cancelled") {
|
|
399
399
|
throw new OperationCancelledError(operationId);
|
|
400
400
|
}
|
|
401
|
-
if (status === "
|
|
401
|
+
if (status === "success" || status === "no_data" || "results" in result || "downloadUrl" in result) {
|
|
402
402
|
return result;
|
|
403
403
|
}
|
|
404
404
|
const elapsed = Date.now() - start;
|
|
@@ -486,7 +486,13 @@ var BaseNamespace = class {
|
|
|
486
486
|
}
|
|
487
487
|
async callAndMaybePoll(toolName, args) {
|
|
488
488
|
const result = await this.callTool(toolName, args);
|
|
489
|
-
if ("
|
|
489
|
+
if (result["status"] === "error") {
|
|
490
|
+
throw new OperationFailedError(
|
|
491
|
+
"",
|
|
492
|
+
String(result["error"] ?? "Unknown error")
|
|
493
|
+
);
|
|
494
|
+
}
|
|
495
|
+
if (result["status"] === "success" || result["status"] === "no_data" || "results" in result) {
|
|
490
496
|
return result;
|
|
491
497
|
}
|
|
492
498
|
const operationId = result["operationId"];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xpoz/xpoz",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "TypeScript SDK for the Xpoz social media intelligence platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
],
|
|
19
19
|
"scripts": {
|
|
20
20
|
"build": "tsup src/index.ts --format cjs,esm --dts --clean",
|
|
21
|
+
"build:scripts": "tsup src/scripts/generate-expectations.ts --format esm --out-dir dist/scripts",
|
|
22
|
+
"generate-expectations": "node dist/scripts/generate-expectations.js",
|
|
21
23
|
"typecheck": "tsc --noEmit",
|
|
22
24
|
"test": "vitest run",
|
|
23
25
|
"prepublishOnly": "npm run build"
|