@xpoz/xpoz 0.3.1 → 0.4.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 CHANGED
@@ -30,7 +30,7 @@ The SDK wraps Xpoz's [MCP](https://modelcontextprotocol.io) server, abstracting
30
30
 
31
31
  ## Features
32
32
 
33
- - **30 data methods** across Twitter, Instagram, and Reddit
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.
@@ -731,6 +849,88 @@ All fields are optional and typed as their respective TypeScript types. Unknown
731
849
  | `over18` | `boolean` | NSFW flag |
732
850
  | `createdAtDate` | `string` | Creation date |
733
851
 
852
+ ### TiktokPost
853
+
854
+ | Field | Type | Description |
855
+ | ---------------------------- | --------- | ---------------------------- |
856
+ | `id` | `string` | Post ID |
857
+ | `description` | `string` | Post caption/description |
858
+ | `descriptionLanguage` | `string` | Language of description |
859
+ | `userId` | `string` | Author user ID |
860
+ | `username` | `string` | Author username |
861
+ | `nickname` | `string` | Author display name |
862
+ | `likeCount` | `number` | Number of likes |
863
+ | `commentCount` | `number` | Number of comments |
864
+ | `playCount` | `number` | Video play count |
865
+ | `collectCount` | `number` | Number of collects/saves |
866
+ | `downloadCount` | `number` | Number of downloads |
867
+ | `forwardCount` | `number` | Number of forwards/shares |
868
+ | `videoThumbnail` | `string` | Thumbnail URL |
869
+ | `postType` | `number` | Post type code |
870
+ | `isPrivate` | `boolean` | Private post flag |
871
+ | `createdAt` | `string` | Creation timestamp |
872
+ | `createdAtDate` | `string` | Creation date (YYYY-MM-DD) |
873
+
874
+ ### TiktokUser
875
+
876
+ | Field | Type | Description |
877
+ | ---------------- | --------- | ------------------------ |
878
+ | `id` | `string` | User ID |
879
+ | `username` | `string` | Username |
880
+ | `nickname` | `string` | Display name |
881
+ | `signature` | `string` | Bio text |
882
+ | `secUid` | `string` | Secure user ID |
883
+ | `avatar` | `string` | Profile picture URL |
884
+ | `isPrivate` | `boolean` | Private account |
885
+ | `isVerified` | `boolean` | Verified status |
886
+ | `followerCount` | `number` | Number of followers |
887
+ | `followingCount` | `number` | Number of following |
888
+ | `likeCount` | `number` | Total likes received |
889
+ | `postCount` | `number` | Total posts |
890
+ | `language` | `string` | Profile language |
891
+ | `region` | `string` | Account region |
892
+ | `createdAt` | `string` | Account creation date |
893
+
894
+ ### TiktokComment
895
+
896
+ | Field | Type | Description |
897
+ | --------------- | -------- | ------------------------ |
898
+ | `id` | `string` | Comment ID |
899
+ | `postId` | `string` | Parent post ID |
900
+ | `userId` | `string` | Author user ID |
901
+ | `username` | `string` | Author username |
902
+ | `text` | `string` | Comment text |
903
+ | `likeCount` | `number` | Number of likes |
904
+ | `createdAt` | `string` | Creation timestamp |
905
+ | `createdAtDate` | `string` | Creation date (YYYY-MM-DD) |
906
+
907
+ ### TrackedItem
908
+
909
+ | Field | Type | Description |
910
+ | ---------- | ---------------------- | -------------------------------------------------------- |
911
+ | `phrase` | `string` | Keyword, username, or subreddit name to track |
912
+ | `type` | `TrackedItemType` | `"keyword"`, `"user"`, or `"subreddit"` |
913
+ | `platform` | `TrackedItemPlatform` | `"twitter"`, `"instagram"`, `"reddit"`, or `"tiktok"` |
914
+
915
+ ### AddTrackedItemsResult
916
+
917
+ | Field | Type | Description |
918
+ | ----------------- | --------- | ---------------------------------- |
919
+ | `success` | `boolean` | Whether the operation succeeded |
920
+ | `addedCount` | `number` | Number of items added |
921
+ | `message` | `string` | Status message |
922
+ | `currentCount` | `number` | Total tracked items after addition |
923
+ | `maxTrackedItems` | `number` | Plan limit for tracked items |
924
+ | `planName` | `string` | Current plan name |
925
+
926
+ ### RemoveTrackedItemsResult
927
+
928
+ | Field | Type | Description |
929
+ | -------------- | --------- | ------------------------------- |
930
+ | `success` | `boolean` | Whether the operation succeeded |
931
+ | `removedCount` | `number` | Number of items removed |
932
+ | `message` | `string` | Status message |
933
+
734
934
  ### Composite Types
735
935
 
736
936
  **`RedditPostWithComments`** — returned by `getPostWithComments()`:
package/dist/index.cjs CHANGED
@@ -36,6 +36,8 @@ __export(index_exports, {
36
36
  OperationTimeoutError: () => OperationTimeoutError,
37
37
  PaginatedResult: () => PaginatedResult,
38
38
  ResponseType: () => ResponseType,
39
+ TrackedItemPlatform: () => TrackedItemPlatform,
40
+ TrackedItemType: () => TrackedItemType,
39
41
  VERSION: () => VERSION,
40
42
  XpozClient: () => XpozClient,
41
43
  XpozConnectionError: () => XpozConnectionError,
@@ -294,7 +296,7 @@ function coerce(value) {
294
296
  }
295
297
 
296
298
  // src/version.ts
297
- var VERSION = "0.3.1";
299
+ var VERSION = "0.4.0";
298
300
 
299
301
  // src/mcp/transport.ts
300
302
  var USER_AGENT = `xpoz-ts-sdk/${VERSION}`;
@@ -437,14 +439,14 @@ async function waitForResult(callTool, operationId, timeoutMs = DEFAULT_TIMEOUT_
437
439
  while (true) {
438
440
  const result = await callTool("checkOperationStatus", { operationId });
439
441
  const status = result["status"];
440
- if (status === "failed") {
442
+ if (status === "error") {
441
443
  const error = result["error"] ?? "Unknown error";
442
444
  throw new OperationFailedError(operationId, String(error));
443
445
  }
444
446
  if (status === "cancelled") {
445
447
  throw new OperationCancelledError(operationId);
446
448
  }
447
- if (status === "completed" || "results" in result || "downloadUrl" in result) {
449
+ if (status === "success" || status === "no_data" || "results" in result || "downloadUrl" in result) {
448
450
  return result;
449
451
  }
450
452
  const elapsed = Date.now() - start;
@@ -532,7 +534,13 @@ var BaseNamespace = class {
532
534
  }
533
535
  async callAndMaybePoll(toolName, args) {
534
536
  const result = await this.callTool(toolName, args);
535
- if ("results" in result) {
537
+ if (result["status"] === "error") {
538
+ throw new OperationFailedError(
539
+ "",
540
+ String(result["error"] ?? "Unknown error")
541
+ );
542
+ }
543
+ if (result["status"] === "success" || "results" in result) {
536
544
  return result;
537
545
  }
538
546
  const operationId = result["operationId"];
@@ -625,6 +633,9 @@ var GET_TIKTOK_COMMENTS = "getTiktokCommentsByPostId";
625
633
  var GET_TIKTOK_USER = "getTiktokUser";
626
634
  var SEARCH_TIKTOK_USERS = "searchTiktokUsers";
627
635
  var GET_TIKTOK_USERS_BY_KEYWORDS = "getTiktokUsersByKeywords";
636
+ var GET_TRACKED_ITEMS = "getTrackedItems";
637
+ var ADD_TRACKED_ITEMS = "addTrackedItems";
638
+ var REMOVE_TRACKED_ITEMS = "removeTrackedItems";
628
639
 
629
640
  // src/namespaces/twitter.ts
630
641
  function parseTwitterPost(item) {
@@ -1118,6 +1129,24 @@ var TiktokNamespace = class extends BaseNamespace {
1118
1129
  }
1119
1130
  };
1120
1131
 
1132
+ // src/namespaces/tracking.ts
1133
+ var TrackingNamespace = class extends BaseNamespace {
1134
+ async getTrackedItems() {
1135
+ const result = await this.callTool(GET_TRACKED_ITEMS, {});
1136
+ return result["data"] ?? [];
1137
+ }
1138
+ async addTrackedItems(items) {
1139
+ const args = this.buildArgs({ items });
1140
+ const result = await this.callTool(ADD_TRACKED_ITEMS, args);
1141
+ return result;
1142
+ }
1143
+ async removeTrackedItems(items) {
1144
+ const args = this.buildArgs({ items });
1145
+ const result = await this.callTool(REMOVE_TRACKED_ITEMS, args);
1146
+ return result;
1147
+ }
1148
+ };
1149
+
1121
1150
  // src/versionCheck.ts
1122
1151
  var NPM_REGISTRY_URL = "https://registry.npmjs.org/@xpoz/xpoz/latest";
1123
1152
  var CHECK_TIMEOUT_MS = 3e3;
@@ -1164,6 +1193,7 @@ var XpozClient = class {
1164
1193
  instagram;
1165
1194
  reddit;
1166
1195
  tiktok;
1196
+ tracking;
1167
1197
  transport;
1168
1198
  versionCheck;
1169
1199
  constructor(options = {}) {
@@ -1182,6 +1212,7 @@ var XpozClient = class {
1182
1212
  this.instagram = new InstagramNamespace(callTool, timeoutMs);
1183
1213
  this.reddit = new RedditNamespace(callTool, timeoutMs);
1184
1214
  this.tiktok = new TiktokNamespace(callTool, timeoutMs);
1215
+ this.tracking = new TrackingNamespace(callTool, timeoutMs);
1185
1216
  }
1186
1217
  async connect() {
1187
1218
  await this.transport.connect();
@@ -1196,6 +1227,21 @@ var XpozClient = class {
1196
1227
  await this.close();
1197
1228
  }
1198
1229
  };
1230
+
1231
+ // src/types/tracking.ts
1232
+ var TrackedItemType = /* @__PURE__ */ ((TrackedItemType2) => {
1233
+ TrackedItemType2["Keyword"] = "keyword";
1234
+ TrackedItemType2["User"] = "user";
1235
+ TrackedItemType2["Subreddit"] = "subreddit";
1236
+ return TrackedItemType2;
1237
+ })(TrackedItemType || {});
1238
+ var TrackedItemPlatform = /* @__PURE__ */ ((TrackedItemPlatform2) => {
1239
+ TrackedItemPlatform2["Twitter"] = "twitter";
1240
+ TrackedItemPlatform2["Instagram"] = "instagram";
1241
+ TrackedItemPlatform2["Reddit"] = "reddit";
1242
+ TrackedItemPlatform2["TikTok"] = "tiktok";
1243
+ return TrackedItemPlatform2;
1244
+ })(TrackedItemPlatform || {});
1199
1245
  // Annotate the CommonJS export names for ESM import in node:
1200
1246
  0 && (module.exports = {
1201
1247
  AuthenticationError,
@@ -1204,6 +1250,8 @@ var XpozClient = class {
1204
1250
  OperationTimeoutError,
1205
1251
  PaginatedResult,
1206
1252
  ResponseType,
1253
+ TrackedItemPlatform,
1254
+ TrackedItemType,
1207
1255
  VERSION,
1208
1256
  XpozClient,
1209
1257
  XpozConnectionError,
package/dist/index.d.cts CHANGED
@@ -679,11 +679,48 @@ declare class TiktokNamespace extends BaseNamespace {
679
679
  }): Promise<PaginatedResult<TiktokUser>>;
680
680
  }
681
681
 
682
+ declare enum TrackedItemType {
683
+ Keyword = "keyword",
684
+ User = "user",
685
+ Subreddit = "subreddit"
686
+ }
687
+ declare enum TrackedItemPlatform {
688
+ Twitter = "twitter",
689
+ Instagram = "instagram",
690
+ Reddit = "reddit",
691
+ TikTok = "tiktok"
692
+ }
693
+ interface TrackedItem {
694
+ phrase?: string;
695
+ type?: TrackedItemType;
696
+ platform?: TrackedItemPlatform;
697
+ }
698
+ interface AddTrackedItemsResult {
699
+ success?: boolean;
700
+ addedCount?: number;
701
+ message?: string;
702
+ currentCount?: number;
703
+ maxTrackedItems?: number;
704
+ planName?: string;
705
+ }
706
+ interface RemoveTrackedItemsResult {
707
+ success?: boolean;
708
+ removedCount?: number;
709
+ message?: string;
710
+ }
711
+
712
+ declare class TrackingNamespace extends BaseNamespace {
713
+ getTrackedItems(): Promise<TrackedItem[]>;
714
+ addTrackedItems(items: TrackedItem[]): Promise<AddTrackedItemsResult>;
715
+ removeTrackedItems(items: TrackedItem[]): Promise<RemoveTrackedItemsResult>;
716
+ }
717
+
682
718
  declare class XpozClient {
683
719
  twitter: TwitterNamespace;
684
720
  instagram: InstagramNamespace;
685
721
  reddit: RedditNamespace;
686
722
  tiktok: TiktokNamespace;
723
+ tracking: TrackingNamespace;
687
724
  private transport;
688
725
  private versionCheck;
689
726
  constructor(options?: {
@@ -721,8 +758,8 @@ declare class OperationCancelledError extends XpozError {
721
758
  constructor(operationId: string);
722
759
  }
723
760
 
724
- declare const VERSION = "0.3.1";
761
+ declare const VERSION = "0.4.0";
725
762
 
726
763
  declare function checkForUpdates(): Promise<void>;
727
764
 
728
- export { AuthenticationError, type InstagramComment, type InstagramPost, type InstagramUser, OperationCancelledError, OperationFailedError, OperationTimeoutError, PaginatedResult, type PaginationInfo, type RedditComment, type RedditPost, type RedditPostWithComments, type RedditSubreddit, type RedditUser, ResponseType, type SubredditWithPosts, type TiktokComment, type TiktokPost, type TiktokUser, type TwitterPost, type TwitterUser, VERSION, XpozClient, XpozConnectionError, XpozError, checkForUpdates };
765
+ export { type AddTrackedItemsResult, AuthenticationError, type InstagramComment, type InstagramPost, type InstagramUser, OperationCancelledError, OperationFailedError, OperationTimeoutError, PaginatedResult, type PaginationInfo, type RedditComment, type RedditPost, type RedditPostWithComments, type RedditSubreddit, type RedditUser, type RemoveTrackedItemsResult, ResponseType, type SubredditWithPosts, type TiktokComment, type TiktokPost, type TiktokUser, type TrackedItem, TrackedItemPlatform, TrackedItemType, type TwitterPost, type TwitterUser, VERSION, XpozClient, XpozConnectionError, XpozError, checkForUpdates };
package/dist/index.d.ts CHANGED
@@ -679,11 +679,48 @@ declare class TiktokNamespace extends BaseNamespace {
679
679
  }): Promise<PaginatedResult<TiktokUser>>;
680
680
  }
681
681
 
682
+ declare enum TrackedItemType {
683
+ Keyword = "keyword",
684
+ User = "user",
685
+ Subreddit = "subreddit"
686
+ }
687
+ declare enum TrackedItemPlatform {
688
+ Twitter = "twitter",
689
+ Instagram = "instagram",
690
+ Reddit = "reddit",
691
+ TikTok = "tiktok"
692
+ }
693
+ interface TrackedItem {
694
+ phrase?: string;
695
+ type?: TrackedItemType;
696
+ platform?: TrackedItemPlatform;
697
+ }
698
+ interface AddTrackedItemsResult {
699
+ success?: boolean;
700
+ addedCount?: number;
701
+ message?: string;
702
+ currentCount?: number;
703
+ maxTrackedItems?: number;
704
+ planName?: string;
705
+ }
706
+ interface RemoveTrackedItemsResult {
707
+ success?: boolean;
708
+ removedCount?: number;
709
+ message?: string;
710
+ }
711
+
712
+ declare class TrackingNamespace extends BaseNamespace {
713
+ getTrackedItems(): Promise<TrackedItem[]>;
714
+ addTrackedItems(items: TrackedItem[]): Promise<AddTrackedItemsResult>;
715
+ removeTrackedItems(items: TrackedItem[]): Promise<RemoveTrackedItemsResult>;
716
+ }
717
+
682
718
  declare class XpozClient {
683
719
  twitter: TwitterNamespace;
684
720
  instagram: InstagramNamespace;
685
721
  reddit: RedditNamespace;
686
722
  tiktok: TiktokNamespace;
723
+ tracking: TrackingNamespace;
687
724
  private transport;
688
725
  private versionCheck;
689
726
  constructor(options?: {
@@ -721,8 +758,8 @@ declare class OperationCancelledError extends XpozError {
721
758
  constructor(operationId: string);
722
759
  }
723
760
 
724
- declare const VERSION = "0.3.1";
761
+ declare const VERSION = "0.4.0";
725
762
 
726
763
  declare function checkForUpdates(): Promise<void>;
727
764
 
728
- export { AuthenticationError, type InstagramComment, type InstagramPost, type InstagramUser, OperationCancelledError, OperationFailedError, OperationTimeoutError, PaginatedResult, type PaginationInfo, type RedditComment, type RedditPost, type RedditPostWithComments, type RedditSubreddit, type RedditUser, ResponseType, type SubredditWithPosts, type TiktokComment, type TiktokPost, type TiktokUser, type TwitterPost, type TwitterUser, VERSION, XpozClient, XpozConnectionError, XpozError, checkForUpdates };
765
+ export { type AddTrackedItemsResult, AuthenticationError, type InstagramComment, type InstagramPost, type InstagramUser, OperationCancelledError, OperationFailedError, OperationTimeoutError, PaginatedResult, type PaginationInfo, type RedditComment, type RedditPost, type RedditPostWithComments, type RedditSubreddit, type RedditUser, type RemoveTrackedItemsResult, ResponseType, type SubredditWithPosts, type TiktokComment, type TiktokPost, type TiktokUser, type TrackedItem, TrackedItemPlatform, TrackedItemType, type TwitterPost, type TwitterUser, VERSION, XpozClient, XpozConnectionError, XpozError, checkForUpdates };
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.3.1";
251
+ var VERSION = "0.4.0";
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 === "failed") {
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 === "completed" || "results" in result || "downloadUrl" in result) {
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 ("results" in result) {
489
+ if (result["status"] === "error") {
490
+ throw new OperationFailedError(
491
+ "",
492
+ String(result["error"] ?? "Unknown error")
493
+ );
494
+ }
495
+ if (result["status"] === "success" || "results" in result) {
490
496
  return result;
491
497
  }
492
498
  const operationId = result["operationId"];
@@ -579,6 +585,9 @@ var GET_TIKTOK_COMMENTS = "getTiktokCommentsByPostId";
579
585
  var GET_TIKTOK_USER = "getTiktokUser";
580
586
  var SEARCH_TIKTOK_USERS = "searchTiktokUsers";
581
587
  var GET_TIKTOK_USERS_BY_KEYWORDS = "getTiktokUsersByKeywords";
588
+ var GET_TRACKED_ITEMS = "getTrackedItems";
589
+ var ADD_TRACKED_ITEMS = "addTrackedItems";
590
+ var REMOVE_TRACKED_ITEMS = "removeTrackedItems";
582
591
 
583
592
  // src/namespaces/twitter.ts
584
593
  function parseTwitterPost(item) {
@@ -1072,6 +1081,24 @@ var TiktokNamespace = class extends BaseNamespace {
1072
1081
  }
1073
1082
  };
1074
1083
 
1084
+ // src/namespaces/tracking.ts
1085
+ var TrackingNamespace = class extends BaseNamespace {
1086
+ async getTrackedItems() {
1087
+ const result = await this.callTool(GET_TRACKED_ITEMS, {});
1088
+ return result["data"] ?? [];
1089
+ }
1090
+ async addTrackedItems(items) {
1091
+ const args = this.buildArgs({ items });
1092
+ const result = await this.callTool(ADD_TRACKED_ITEMS, args);
1093
+ return result;
1094
+ }
1095
+ async removeTrackedItems(items) {
1096
+ const args = this.buildArgs({ items });
1097
+ const result = await this.callTool(REMOVE_TRACKED_ITEMS, args);
1098
+ return result;
1099
+ }
1100
+ };
1101
+
1075
1102
  // src/versionCheck.ts
1076
1103
  var NPM_REGISTRY_URL = "https://registry.npmjs.org/@xpoz/xpoz/latest";
1077
1104
  var CHECK_TIMEOUT_MS = 3e3;
@@ -1118,6 +1145,7 @@ var XpozClient = class {
1118
1145
  instagram;
1119
1146
  reddit;
1120
1147
  tiktok;
1148
+ tracking;
1121
1149
  transport;
1122
1150
  versionCheck;
1123
1151
  constructor(options = {}) {
@@ -1136,6 +1164,7 @@ var XpozClient = class {
1136
1164
  this.instagram = new InstagramNamespace(callTool, timeoutMs);
1137
1165
  this.reddit = new RedditNamespace(callTool, timeoutMs);
1138
1166
  this.tiktok = new TiktokNamespace(callTool, timeoutMs);
1167
+ this.tracking = new TrackingNamespace(callTool, timeoutMs);
1139
1168
  }
1140
1169
  async connect() {
1141
1170
  await this.transport.connect();
@@ -1150,6 +1179,21 @@ var XpozClient = class {
1150
1179
  await this.close();
1151
1180
  }
1152
1181
  };
1182
+
1183
+ // src/types/tracking.ts
1184
+ var TrackedItemType = /* @__PURE__ */ ((TrackedItemType2) => {
1185
+ TrackedItemType2["Keyword"] = "keyword";
1186
+ TrackedItemType2["User"] = "user";
1187
+ TrackedItemType2["Subreddit"] = "subreddit";
1188
+ return TrackedItemType2;
1189
+ })(TrackedItemType || {});
1190
+ var TrackedItemPlatform = /* @__PURE__ */ ((TrackedItemPlatform2) => {
1191
+ TrackedItemPlatform2["Twitter"] = "twitter";
1192
+ TrackedItemPlatform2["Instagram"] = "instagram";
1193
+ TrackedItemPlatform2["Reddit"] = "reddit";
1194
+ TrackedItemPlatform2["TikTok"] = "tiktok";
1195
+ return TrackedItemPlatform2;
1196
+ })(TrackedItemPlatform || {});
1153
1197
  export {
1154
1198
  AuthenticationError,
1155
1199
  OperationCancelledError,
@@ -1157,6 +1201,8 @@ export {
1157
1201
  OperationTimeoutError,
1158
1202
  PaginatedResult,
1159
1203
  ResponseType,
1204
+ TrackedItemPlatform,
1205
+ TrackedItemType,
1160
1206
  VERSION,
1161
1207
  XpozClient,
1162
1208
  XpozConnectionError,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xpoz/xpoz",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "TypeScript SDK for the Xpoz social media intelligence platform",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",