@xpoz/xpoz 0.3.0 → 0.3.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/dist/index.cjs CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/index.ts
@@ -284,10 +294,18 @@ function coerce(value) {
284
294
  }
285
295
 
286
296
  // src/version.ts
287
- var VERSION = "0.3.0";
297
+ var VERSION = "0.3.1";
288
298
 
289
299
  // src/mcp/transport.ts
290
300
  var USER_AGENT = `xpoz-ts-sdk/${VERSION}`;
301
+ function getProxyUrl() {
302
+ return process.env.HTTPS_PROXY ?? process.env.https_proxy ?? process.env.HTTP_PROXY ?? process.env.http_proxy;
303
+ }
304
+ async function createProxyFetch(proxyUrl) {
305
+ const { ProxyAgent, fetch: undiciFetch } = await import("undici");
306
+ const dispatcher = new ProxyAgent(proxyUrl);
307
+ return ((input, init) => undiciFetch(input, { ...init, dispatcher }));
308
+ }
291
309
  var McpTransport = class {
292
310
  serverUrl;
293
311
  apiKey;
@@ -302,8 +320,11 @@ var McpTransport = class {
302
320
  "User-Agent": USER_AGENT,
303
321
  Authorization: `Bearer ${this.apiKey}`
304
322
  };
323
+ const proxyUrl = getProxyUrl();
324
+ const customFetch = proxyUrl ? await createProxyFetch(proxyUrl) : void 0;
305
325
  this.transport = new import_streamableHttp.StreamableHTTPClientTransport(new URL(this.serverUrl), {
306
- requestInit: { headers }
326
+ requestInit: { headers },
327
+ ...customFetch ? { fetch: customFetch } : {}
307
328
  });
308
329
  this.client = new import_client.Client(
309
330
  { name: "xpoz-ts-sdk", version: VERSION },
@@ -313,6 +334,10 @@ var McpTransport = class {
313
334
  }
314
335
  async close() {
315
336
  if (this.client) {
337
+ try {
338
+ await this.transport?.terminateSession();
339
+ } catch {
340
+ }
316
341
  try {
317
342
  await this.client.close();
318
343
  } catch {
@@ -593,6 +618,13 @@ var GET_REDDIT_USERS_BY_KEYWORDS = "getRedditUsersByKeywords";
593
618
  var SEARCH_REDDIT_SUBREDDITS = "searchRedditSubreddits";
594
619
  var GET_REDDIT_SUBREDDIT_WITH_POSTS = "getRedditSubredditWithPostsByName";
595
620
  var GET_REDDIT_SUBREDDITS_BY_KEYWORDS = "getRedditSubredditsByKeywords";
621
+ var GET_TIKTOK_POSTS_BY_IDS = "getTiktokPostsByIds";
622
+ var GET_TIKTOK_POSTS_BY_USER = "getTiktokPostsByUser";
623
+ var SEARCH_TIKTOK_POSTS = "getTiktokPostsByKeywords";
624
+ var GET_TIKTOK_COMMENTS = "getTiktokCommentsByPostId";
625
+ var GET_TIKTOK_USER = "getTiktokUser";
626
+ var SEARCH_TIKTOK_USERS = "searchTiktokUsers";
627
+ var GET_TIKTOK_USERS_BY_KEYWORDS = "getTiktokUsersByKeywords";
596
628
 
597
629
  // src/namespaces/twitter.ts
598
630
  function parseTwitterPost(item) {
@@ -1003,6 +1035,89 @@ var RedditNamespace = class extends BaseNamespace {
1003
1035
  }
1004
1036
  };
1005
1037
 
1038
+ // src/namespaces/tiktok.ts
1039
+ function parsePost3(item) {
1040
+ return item;
1041
+ }
1042
+ function parseUser4(item) {
1043
+ return item;
1044
+ }
1045
+ function parseComment3(item) {
1046
+ return item;
1047
+ }
1048
+ var TiktokNamespace = class extends BaseNamespace {
1049
+ async getPostsByIds(postIds, options = {}) {
1050
+ const args = this.buildArgs({ postIds, ...options });
1051
+ const result = await this.callAndMaybePoll(GET_TIKTOK_POSTS_BY_IDS, args);
1052
+ return (result["results"] ?? []).map(parsePost3);
1053
+ }
1054
+ async getPostsByUser(identifier, options = {}) {
1055
+ const args = this.buildArgs({
1056
+ identifier,
1057
+ identifierType: options.identifierType ?? "username",
1058
+ fields: options.fields,
1059
+ startDate: options.startDate,
1060
+ endDate: options.endDate,
1061
+ forceLatest: options.forceLatest,
1062
+ responseType: options.responseType,
1063
+ limit: options.limit
1064
+ });
1065
+ const result = await this.callAndMaybePoll(GET_TIKTOK_POSTS_BY_USER, args);
1066
+ return this.buildPaginatedResult(
1067
+ result,
1068
+ parsePost3,
1069
+ GET_TIKTOK_POSTS_BY_USER,
1070
+ args
1071
+ );
1072
+ }
1073
+ async searchPosts(query, options = {}) {
1074
+ const args = this.buildArgs({
1075
+ query,
1076
+ fields: options.fields,
1077
+ startDate: options.startDate,
1078
+ endDate: options.endDate,
1079
+ forceLatest: options.forceLatest,
1080
+ responseType: options.responseType,
1081
+ limit: options.limit
1082
+ });
1083
+ const result = await this.callAndMaybePoll(SEARCH_TIKTOK_POSTS, args);
1084
+ return this.buildPaginatedResult(result, parsePost3, SEARCH_TIKTOK_POSTS, args);
1085
+ }
1086
+ async getComments(postId, options = {}) {
1087
+ const args = this.buildArgs({ postId, ...options });
1088
+ const result = await this.callAndMaybePoll(GET_TIKTOK_COMMENTS, args);
1089
+ return this.buildPaginatedResult(result, parseComment3, GET_TIKTOK_COMMENTS, args);
1090
+ }
1091
+ async getUser(identifier, options = {}) {
1092
+ const args = this.buildArgs({
1093
+ identifier,
1094
+ identifierType: options.identifierType ?? "username",
1095
+ fields: options.fields
1096
+ });
1097
+ const result = await this.callAndMaybePoll(GET_TIKTOK_USER, args);
1098
+ const results = result["results"];
1099
+ if (Array.isArray(results) && results.length > 0) {
1100
+ return results[0];
1101
+ }
1102
+ return result;
1103
+ }
1104
+ async searchUsers(name, options = {}) {
1105
+ const args = this.buildArgs({ name, ...options });
1106
+ const result = await this.callAndMaybePoll(SEARCH_TIKTOK_USERS, args);
1107
+ return (result["results"] ?? []).map(parseUser4);
1108
+ }
1109
+ async getUsersByKeywords(query, options = {}) {
1110
+ const args = this.buildArgs({ query, ...options });
1111
+ const result = await this.callAndMaybePoll(GET_TIKTOK_USERS_BY_KEYWORDS, args);
1112
+ return this.buildPaginatedResult(
1113
+ result,
1114
+ parseUser4,
1115
+ GET_TIKTOK_USERS_BY_KEYWORDS,
1116
+ args
1117
+ );
1118
+ }
1119
+ };
1120
+
1006
1121
  // src/versionCheck.ts
1007
1122
  var NPM_REGISTRY_URL = "https://registry.npmjs.org/@xpoz/xpoz/latest";
1008
1123
  var CHECK_TIMEOUT_MS = 3e3;
@@ -1048,6 +1163,7 @@ var XpozClient = class {
1048
1163
  twitter;
1049
1164
  instagram;
1050
1165
  reddit;
1166
+ tiktok;
1051
1167
  transport;
1052
1168
  versionCheck;
1053
1169
  constructor(options = {}) {
@@ -1065,6 +1181,7 @@ var XpozClient = class {
1065
1181
  this.twitter = new TwitterNamespace(callTool, timeoutMs);
1066
1182
  this.instagram = new InstagramNamespace(callTool, timeoutMs);
1067
1183
  this.reddit = new RedditNamespace(callTool, timeoutMs);
1184
+ this.tiktok = new TiktokNamespace(callTool, timeoutMs);
1068
1185
  }
1069
1186
  async connect() {
1070
1187
  await this.transport.connect();
package/dist/index.d.cts CHANGED
@@ -559,10 +559,131 @@ declare class RedditNamespace extends BaseNamespace {
559
559
  private _parseSubredditWithPosts;
560
560
  }
561
561
 
562
+ interface TiktokPost {
563
+ id?: string | null;
564
+ postType?: number | null;
565
+ isPrivate?: boolean | null;
566
+ videoThumbnail?: string | null;
567
+ description?: string | null;
568
+ descriptionLanguage?: string | null;
569
+ userId?: string | null;
570
+ username?: string | null;
571
+ nickname?: string | null;
572
+ collectCount?: number | null;
573
+ commentCount?: number | null;
574
+ likeCount?: number | null;
575
+ downloadCount?: number | null;
576
+ forwardCount?: number | null;
577
+ playCount?: number | null;
578
+ createdAt?: string | null;
579
+ createdAtTimestamp?: number | null;
580
+ 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
+ [key: string]: unknown;
591
+ }
592
+ interface TiktokUser {
593
+ id?: string | null;
594
+ username?: string | null;
595
+ nickname?: string | null;
596
+ signature?: string | null;
597
+ secUid?: string | null;
598
+ avatar?: string | null;
599
+ isPrivate?: boolean | null;
600
+ isVerified?: boolean | null;
601
+ followerCount?: number | null;
602
+ followingCount?: number | null;
603
+ likeCount?: number | null;
604
+ postCount?: number | null;
605
+ language?: string | null;
606
+ region?: string | null;
607
+ createdAt?: string | null;
608
+ usernameModifyTime?: string | null;
609
+ lastFetch?: string | null;
610
+ lastFetchDatetime?: string | null;
611
+ xLastUpdated?: string | null;
612
+ aggRelevance?: number | null;
613
+ relevantPostsCount?: number | null;
614
+ relevantPostsLikesSum?: number | null;
615
+ relevantPostsCommentsSum?: number | null;
616
+ relevantPostsPlaysSum?: number | null;
617
+ relevantPostsForwardsSum?: number | null;
618
+ [key: string]: unknown;
619
+ }
620
+ interface TiktokComment {
621
+ id?: string | null;
622
+ postId?: string | null;
623
+ userId?: string | null;
624
+ username?: string | null;
625
+ text?: string | null;
626
+ likeCount?: number | null;
627
+ createdAt?: string | null;
628
+ createdAtTimestamp?: number | null;
629
+ createdAtDate?: string | null;
630
+ lastFetch?: string | null;
631
+ lastFetchDatetime?: string | null;
632
+ xLastUpdated?: string | null;
633
+ [key: string]: unknown;
634
+ }
635
+
636
+ declare class TiktokNamespace extends BaseNamespace {
637
+ getPostsByIds(postIds: string[], options?: {
638
+ fields?: string[];
639
+ forceLatest?: boolean;
640
+ }): Promise<TiktokPost[]>;
641
+ getPostsByUser(identifier: string, options?: {
642
+ identifierType?: string;
643
+ fields?: string[];
644
+ startDate?: string;
645
+ endDate?: string;
646
+ forceLatest?: boolean;
647
+ responseType?: ResponseType;
648
+ limit?: number;
649
+ }): Promise<PaginatedResult<TiktokPost>>;
650
+ searchPosts(query: string, options?: {
651
+ fields?: string[];
652
+ startDate?: string;
653
+ endDate?: string;
654
+ forceLatest?: boolean;
655
+ responseType?: ResponseType;
656
+ limit?: number;
657
+ }): Promise<PaginatedResult<TiktokPost>>;
658
+ getComments(postId: string, options?: {
659
+ fields?: string[];
660
+ startDate?: string;
661
+ endDate?: string;
662
+ forceLatest?: boolean;
663
+ }): Promise<PaginatedResult<TiktokComment>>;
664
+ getUser(identifier: string, options?: {
665
+ identifierType?: string;
666
+ fields?: string[];
667
+ }): Promise<TiktokUser>;
668
+ searchUsers(name: string, options?: {
669
+ limit?: number;
670
+ fields?: string[];
671
+ }): Promise<TiktokUser[]>;
672
+ getUsersByKeywords(query: string, options?: {
673
+ fields?: string[];
674
+ startDate?: string;
675
+ endDate?: string;
676
+ forceLatest?: boolean;
677
+ responseType?: ResponseType;
678
+ limit?: number;
679
+ }): Promise<PaginatedResult<TiktokUser>>;
680
+ }
681
+
562
682
  declare class XpozClient {
563
683
  twitter: TwitterNamespace;
564
684
  instagram: InstagramNamespace;
565
685
  reddit: RedditNamespace;
686
+ tiktok: TiktokNamespace;
566
687
  private transport;
567
688
  private versionCheck;
568
689
  constructor(options?: {
@@ -600,8 +721,8 @@ declare class OperationCancelledError extends XpozError {
600
721
  constructor(operationId: string);
601
722
  }
602
723
 
603
- declare const VERSION = "0.3.0";
724
+ declare const VERSION = "0.3.1";
604
725
 
605
726
  declare function checkForUpdates(): Promise<void>;
606
727
 
607
- 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 TwitterPost, type TwitterUser, VERSION, XpozClient, XpozConnectionError, XpozError, checkForUpdates };
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 };
package/dist/index.d.ts CHANGED
@@ -559,10 +559,131 @@ declare class RedditNamespace extends BaseNamespace {
559
559
  private _parseSubredditWithPosts;
560
560
  }
561
561
 
562
+ interface TiktokPost {
563
+ id?: string | null;
564
+ postType?: number | null;
565
+ isPrivate?: boolean | null;
566
+ videoThumbnail?: string | null;
567
+ description?: string | null;
568
+ descriptionLanguage?: string | null;
569
+ userId?: string | null;
570
+ username?: string | null;
571
+ nickname?: string | null;
572
+ collectCount?: number | null;
573
+ commentCount?: number | null;
574
+ likeCount?: number | null;
575
+ downloadCount?: number | null;
576
+ forwardCount?: number | null;
577
+ playCount?: number | null;
578
+ createdAt?: string | null;
579
+ createdAtTimestamp?: number | null;
580
+ 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
+ [key: string]: unknown;
591
+ }
592
+ interface TiktokUser {
593
+ id?: string | null;
594
+ username?: string | null;
595
+ nickname?: string | null;
596
+ signature?: string | null;
597
+ secUid?: string | null;
598
+ avatar?: string | null;
599
+ isPrivate?: boolean | null;
600
+ isVerified?: boolean | null;
601
+ followerCount?: number | null;
602
+ followingCount?: number | null;
603
+ likeCount?: number | null;
604
+ postCount?: number | null;
605
+ language?: string | null;
606
+ region?: string | null;
607
+ createdAt?: string | null;
608
+ usernameModifyTime?: string | null;
609
+ lastFetch?: string | null;
610
+ lastFetchDatetime?: string | null;
611
+ xLastUpdated?: string | null;
612
+ aggRelevance?: number | null;
613
+ relevantPostsCount?: number | null;
614
+ relevantPostsLikesSum?: number | null;
615
+ relevantPostsCommentsSum?: number | null;
616
+ relevantPostsPlaysSum?: number | null;
617
+ relevantPostsForwardsSum?: number | null;
618
+ [key: string]: unknown;
619
+ }
620
+ interface TiktokComment {
621
+ id?: string | null;
622
+ postId?: string | null;
623
+ userId?: string | null;
624
+ username?: string | null;
625
+ text?: string | null;
626
+ likeCount?: number | null;
627
+ createdAt?: string | null;
628
+ createdAtTimestamp?: number | null;
629
+ createdAtDate?: string | null;
630
+ lastFetch?: string | null;
631
+ lastFetchDatetime?: string | null;
632
+ xLastUpdated?: string | null;
633
+ [key: string]: unknown;
634
+ }
635
+
636
+ declare class TiktokNamespace extends BaseNamespace {
637
+ getPostsByIds(postIds: string[], options?: {
638
+ fields?: string[];
639
+ forceLatest?: boolean;
640
+ }): Promise<TiktokPost[]>;
641
+ getPostsByUser(identifier: string, options?: {
642
+ identifierType?: string;
643
+ fields?: string[];
644
+ startDate?: string;
645
+ endDate?: string;
646
+ forceLatest?: boolean;
647
+ responseType?: ResponseType;
648
+ limit?: number;
649
+ }): Promise<PaginatedResult<TiktokPost>>;
650
+ searchPosts(query: string, options?: {
651
+ fields?: string[];
652
+ startDate?: string;
653
+ endDate?: string;
654
+ forceLatest?: boolean;
655
+ responseType?: ResponseType;
656
+ limit?: number;
657
+ }): Promise<PaginatedResult<TiktokPost>>;
658
+ getComments(postId: string, options?: {
659
+ fields?: string[];
660
+ startDate?: string;
661
+ endDate?: string;
662
+ forceLatest?: boolean;
663
+ }): Promise<PaginatedResult<TiktokComment>>;
664
+ getUser(identifier: string, options?: {
665
+ identifierType?: string;
666
+ fields?: string[];
667
+ }): Promise<TiktokUser>;
668
+ searchUsers(name: string, options?: {
669
+ limit?: number;
670
+ fields?: string[];
671
+ }): Promise<TiktokUser[]>;
672
+ getUsersByKeywords(query: string, options?: {
673
+ fields?: string[];
674
+ startDate?: string;
675
+ endDate?: string;
676
+ forceLatest?: boolean;
677
+ responseType?: ResponseType;
678
+ limit?: number;
679
+ }): Promise<PaginatedResult<TiktokUser>>;
680
+ }
681
+
562
682
  declare class XpozClient {
563
683
  twitter: TwitterNamespace;
564
684
  instagram: InstagramNamespace;
565
685
  reddit: RedditNamespace;
686
+ tiktok: TiktokNamespace;
566
687
  private transport;
567
688
  private versionCheck;
568
689
  constructor(options?: {
@@ -600,8 +721,8 @@ declare class OperationCancelledError extends XpozError {
600
721
  constructor(operationId: string);
601
722
  }
602
723
 
603
- declare const VERSION = "0.3.0";
724
+ declare const VERSION = "0.3.1";
604
725
 
605
726
  declare function checkForUpdates(): Promise<void>;
606
727
 
607
- 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 TwitterPost, type TwitterUser, VERSION, XpozClient, XpozConnectionError, XpozError, checkForUpdates };
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 };
package/dist/index.js CHANGED
@@ -248,10 +248,18 @@ function coerce(value) {
248
248
  }
249
249
 
250
250
  // src/version.ts
251
- var VERSION = "0.3.0";
251
+ var VERSION = "0.3.1";
252
252
 
253
253
  // src/mcp/transport.ts
254
254
  var USER_AGENT = `xpoz-ts-sdk/${VERSION}`;
255
+ function getProxyUrl() {
256
+ return process.env.HTTPS_PROXY ?? process.env.https_proxy ?? process.env.HTTP_PROXY ?? process.env.http_proxy;
257
+ }
258
+ async function createProxyFetch(proxyUrl) {
259
+ const { ProxyAgent, fetch: undiciFetch } = await import("undici");
260
+ const dispatcher = new ProxyAgent(proxyUrl);
261
+ return ((input, init) => undiciFetch(input, { ...init, dispatcher }));
262
+ }
255
263
  var McpTransport = class {
256
264
  serverUrl;
257
265
  apiKey;
@@ -266,8 +274,11 @@ var McpTransport = class {
266
274
  "User-Agent": USER_AGENT,
267
275
  Authorization: `Bearer ${this.apiKey}`
268
276
  };
277
+ const proxyUrl = getProxyUrl();
278
+ const customFetch = proxyUrl ? await createProxyFetch(proxyUrl) : void 0;
269
279
  this.transport = new StreamableHTTPClientTransport(new URL(this.serverUrl), {
270
- requestInit: { headers }
280
+ requestInit: { headers },
281
+ ...customFetch ? { fetch: customFetch } : {}
271
282
  });
272
283
  this.client = new Client(
273
284
  { name: "xpoz-ts-sdk", version: VERSION },
@@ -277,6 +288,10 @@ var McpTransport = class {
277
288
  }
278
289
  async close() {
279
290
  if (this.client) {
291
+ try {
292
+ await this.transport?.terminateSession();
293
+ } catch {
294
+ }
280
295
  try {
281
296
  await this.client.close();
282
297
  } catch {
@@ -557,6 +572,13 @@ var GET_REDDIT_USERS_BY_KEYWORDS = "getRedditUsersByKeywords";
557
572
  var SEARCH_REDDIT_SUBREDDITS = "searchRedditSubreddits";
558
573
  var GET_REDDIT_SUBREDDIT_WITH_POSTS = "getRedditSubredditWithPostsByName";
559
574
  var GET_REDDIT_SUBREDDITS_BY_KEYWORDS = "getRedditSubredditsByKeywords";
575
+ var GET_TIKTOK_POSTS_BY_IDS = "getTiktokPostsByIds";
576
+ var GET_TIKTOK_POSTS_BY_USER = "getTiktokPostsByUser";
577
+ var SEARCH_TIKTOK_POSTS = "getTiktokPostsByKeywords";
578
+ var GET_TIKTOK_COMMENTS = "getTiktokCommentsByPostId";
579
+ var GET_TIKTOK_USER = "getTiktokUser";
580
+ var SEARCH_TIKTOK_USERS = "searchTiktokUsers";
581
+ var GET_TIKTOK_USERS_BY_KEYWORDS = "getTiktokUsersByKeywords";
560
582
 
561
583
  // src/namespaces/twitter.ts
562
584
  function parseTwitterPost(item) {
@@ -967,6 +989,89 @@ var RedditNamespace = class extends BaseNamespace {
967
989
  }
968
990
  };
969
991
 
992
+ // src/namespaces/tiktok.ts
993
+ function parsePost3(item) {
994
+ return item;
995
+ }
996
+ function parseUser4(item) {
997
+ return item;
998
+ }
999
+ function parseComment3(item) {
1000
+ return item;
1001
+ }
1002
+ var TiktokNamespace = class extends BaseNamespace {
1003
+ async getPostsByIds(postIds, options = {}) {
1004
+ const args = this.buildArgs({ postIds, ...options });
1005
+ const result = await this.callAndMaybePoll(GET_TIKTOK_POSTS_BY_IDS, args);
1006
+ return (result["results"] ?? []).map(parsePost3);
1007
+ }
1008
+ async getPostsByUser(identifier, options = {}) {
1009
+ const args = this.buildArgs({
1010
+ identifier,
1011
+ identifierType: options.identifierType ?? "username",
1012
+ fields: options.fields,
1013
+ startDate: options.startDate,
1014
+ endDate: options.endDate,
1015
+ forceLatest: options.forceLatest,
1016
+ responseType: options.responseType,
1017
+ limit: options.limit
1018
+ });
1019
+ const result = await this.callAndMaybePoll(GET_TIKTOK_POSTS_BY_USER, args);
1020
+ return this.buildPaginatedResult(
1021
+ result,
1022
+ parsePost3,
1023
+ GET_TIKTOK_POSTS_BY_USER,
1024
+ args
1025
+ );
1026
+ }
1027
+ async searchPosts(query, options = {}) {
1028
+ const args = this.buildArgs({
1029
+ query,
1030
+ fields: options.fields,
1031
+ startDate: options.startDate,
1032
+ endDate: options.endDate,
1033
+ forceLatest: options.forceLatest,
1034
+ responseType: options.responseType,
1035
+ limit: options.limit
1036
+ });
1037
+ const result = await this.callAndMaybePoll(SEARCH_TIKTOK_POSTS, args);
1038
+ return this.buildPaginatedResult(result, parsePost3, SEARCH_TIKTOK_POSTS, args);
1039
+ }
1040
+ async getComments(postId, options = {}) {
1041
+ const args = this.buildArgs({ postId, ...options });
1042
+ const result = await this.callAndMaybePoll(GET_TIKTOK_COMMENTS, args);
1043
+ return this.buildPaginatedResult(result, parseComment3, GET_TIKTOK_COMMENTS, args);
1044
+ }
1045
+ async getUser(identifier, options = {}) {
1046
+ const args = this.buildArgs({
1047
+ identifier,
1048
+ identifierType: options.identifierType ?? "username",
1049
+ fields: options.fields
1050
+ });
1051
+ const result = await this.callAndMaybePoll(GET_TIKTOK_USER, args);
1052
+ const results = result["results"];
1053
+ if (Array.isArray(results) && results.length > 0) {
1054
+ return results[0];
1055
+ }
1056
+ return result;
1057
+ }
1058
+ async searchUsers(name, options = {}) {
1059
+ const args = this.buildArgs({ name, ...options });
1060
+ const result = await this.callAndMaybePoll(SEARCH_TIKTOK_USERS, args);
1061
+ return (result["results"] ?? []).map(parseUser4);
1062
+ }
1063
+ async getUsersByKeywords(query, options = {}) {
1064
+ const args = this.buildArgs({ query, ...options });
1065
+ const result = await this.callAndMaybePoll(GET_TIKTOK_USERS_BY_KEYWORDS, args);
1066
+ return this.buildPaginatedResult(
1067
+ result,
1068
+ parseUser4,
1069
+ GET_TIKTOK_USERS_BY_KEYWORDS,
1070
+ args
1071
+ );
1072
+ }
1073
+ };
1074
+
970
1075
  // src/versionCheck.ts
971
1076
  var NPM_REGISTRY_URL = "https://registry.npmjs.org/@xpoz/xpoz/latest";
972
1077
  var CHECK_TIMEOUT_MS = 3e3;
@@ -1012,6 +1117,7 @@ var XpozClient = class {
1012
1117
  twitter;
1013
1118
  instagram;
1014
1119
  reddit;
1120
+ tiktok;
1015
1121
  transport;
1016
1122
  versionCheck;
1017
1123
  constructor(options = {}) {
@@ -1029,6 +1135,7 @@ var XpozClient = class {
1029
1135
  this.twitter = new TwitterNamespace(callTool, timeoutMs);
1030
1136
  this.instagram = new InstagramNamespace(callTool, timeoutMs);
1031
1137
  this.reddit = new RedditNamespace(callTool, timeoutMs);
1138
+ this.tiktok = new TiktokNamespace(callTool, timeoutMs);
1032
1139
  }
1033
1140
  async connect() {
1034
1141
  await this.transport.connect();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xpoz/xpoz",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "TypeScript SDK for the Xpoz social media intelligence platform",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -23,7 +23,8 @@
23
23
  "prepublishOnly": "npm run build"
24
24
  },
25
25
  "dependencies": {
26
- "@modelcontextprotocol/sdk": "^1.0.0"
26
+ "@modelcontextprotocol/sdk": "^1.0.0",
27
+ "undici": "^7.24.6"
27
28
  },
28
29
  "devDependencies": {
29
30
  "@types/node": "^25.3.0",