@xpoz/xpoz 0.1.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.
@@ -0,0 +1,579 @@
1
+ interface PaginationInfo {
2
+ tableName?: string | null;
3
+ totalRows: number;
4
+ totalPages: number;
5
+ pageNumber: number;
6
+ pageSize: number;
7
+ resultsCount: number;
8
+ }
9
+
10
+ type FetchPage<T> = (pageNumber: number, tableName: string | null | undefined) => Promise<PaginatedResult<T>>;
11
+ type FetchExport = (exportOperationId: string) => Promise<string>;
12
+ declare class PaginatedResult<T> {
13
+ data: T[];
14
+ pagination: PaginationInfo;
15
+ private _tableName;
16
+ private _exportOperationId;
17
+ private _fetchPage;
18
+ private _fetchExport;
19
+ constructor(options: {
20
+ data: T[];
21
+ pagination: PaginationInfo;
22
+ tableName: string | null | undefined;
23
+ exportOperationId: string | null | undefined;
24
+ fetchPage: FetchPage<T>;
25
+ fetchExport: FetchExport | null;
26
+ });
27
+ hasNextPage(): boolean;
28
+ nextPage(): Promise<PaginatedResult<T>>;
29
+ getPage(pageNumber: number): Promise<PaginatedResult<T>>;
30
+ exportCsv(): Promise<string>;
31
+ private _fetchPageResult;
32
+ toString(): string;
33
+ }
34
+
35
+ type CallTool = (name: string, args: Record<string, unknown>) => Promise<Record<string, unknown>>;
36
+ type RawDict = Record<string, unknown>;
37
+ declare class BaseNamespace {
38
+ protected callTool: CallTool;
39
+ protected timeoutMs: number;
40
+ constructor(callTool: CallTool, timeoutMs?: number);
41
+ protected callAndMaybePoll(toolName: string, args: RawDict): Promise<RawDict>;
42
+ protected buildPaginatedResult<T>(raw: RawDict, parseItem: (item: RawDict) => T, toolName: string, baseArgs: RawDict): PaginatedResult<T>;
43
+ protected buildArgs(args: Record<string, unknown>): RawDict;
44
+ protected extractPagination(raw: RawDict): PaginationInfo;
45
+ protected extractResults(raw: RawDict): RawDict[];
46
+ }
47
+
48
+ interface TwitterPost {
49
+ id?: string | null;
50
+ text?: string | null;
51
+ authorId?: string | null;
52
+ authorUsername?: string | null;
53
+ conversationId?: string | null;
54
+ lang?: string | null;
55
+ source?: string | null;
56
+ status?: string | null;
57
+ deleted?: boolean | null;
58
+ suspended?: boolean | null;
59
+ possiblySensitive?: boolean | null;
60
+ isRetweet?: boolean | null;
61
+ likeCount?: number | null;
62
+ retweetCount?: number | null;
63
+ replyCount?: number | null;
64
+ quoteCount?: number | null;
65
+ impressionCount?: number | null;
66
+ bookmarkCount?: number | null;
67
+ quotedTweetId?: string | null;
68
+ retweetedTweetId?: string | null;
69
+ replyToTweetId?: string | null;
70
+ replyToUserId?: string | null;
71
+ replyToUsername?: string | null;
72
+ originalTweetId?: string | null;
73
+ editedTweets?: string[] | null;
74
+ replySettings?: string | null;
75
+ hashtags?: string[] | null;
76
+ mentions?: string[] | null;
77
+ mediaUrls?: string[] | null;
78
+ grokGeneratedContent?: Record<string, unknown>[] | null;
79
+ urls?: string[] | null;
80
+ country?: string | null;
81
+ region?: string | null;
82
+ city?: string | null;
83
+ hasBirdwatchNotes?: boolean | null;
84
+ birdwatchNotesId?: string | null;
85
+ birdwatchNotesText?: string | null;
86
+ birdwatchNotesUrl?: string | null;
87
+ createdAt?: string | null;
88
+ createdAtDate?: string | null;
89
+ xFetchedAt?: string | null;
90
+ [key: string]: unknown;
91
+ }
92
+ interface TwitterUser {
93
+ id?: string | null;
94
+ username?: string | null;
95
+ name?: string | null;
96
+ description?: string | null;
97
+ location?: string | null;
98
+ verified?: boolean | null;
99
+ verifiedType?: string | null;
100
+ protected?: boolean | null;
101
+ status?: string | null;
102
+ followersCount?: number | null;
103
+ followingCount?: number | null;
104
+ tweetCount?: number | null;
105
+ listedCount?: number | null;
106
+ likesCount?: number | null;
107
+ mediaCount?: number | null;
108
+ profileImageUrl?: string | null;
109
+ profileBannerUrl?: string | null;
110
+ profileInterstitialType?: string | null;
111
+ pinnedTweetId?: string | null;
112
+ source?: string | null;
113
+ isVerified?: boolean | null;
114
+ accountBasedIn?: string | null;
115
+ locationAccurate?: boolean | null;
116
+ label?: string | null;
117
+ labelType?: string | null;
118
+ collectedFollowingCount?: number | null;
119
+ collectedFollowersCount?: number | null;
120
+ collectedFollowersCoverage?: number | null;
121
+ collectedFollowingCoverage?: number | null;
122
+ avgTweetsPerDayLastMonth?: number | null;
123
+ nLang?: number | null;
124
+ nLangsFiltered?: number | null;
125
+ inauthenticType?: string | null;
126
+ isInauthentic?: boolean | null;
127
+ isInauthenticProbScore?: number | null;
128
+ isInauthenticCalculatedAt?: string | null;
129
+ verifiedSinceDatetime?: string | null;
130
+ usernameChanges?: string[] | null;
131
+ lastUsernameChangeDatetime?: string | null;
132
+ createdAt?: string | null;
133
+ createdAtDate?: string | null;
134
+ xFetchedAt?: string | null;
135
+ modifiedAt?: string | null;
136
+ xModifiedAt?: string | null;
137
+ aggRelevance?: number | null;
138
+ relevantTweetsCount?: number | null;
139
+ relevantTweetsImpressionsSum?: number | null;
140
+ relevantTweetsLikesSum?: number | null;
141
+ relevantTweetsQuotesSum?: number | null;
142
+ relevantTweetsRepliesSum?: number | null;
143
+ relevantTweetsRetweetsSum?: number | null;
144
+ [key: string]: unknown;
145
+ }
146
+
147
+ declare class TwitterNamespace extends BaseNamespace {
148
+ getPostsByIds(postIds: string[], options?: {
149
+ fields?: string[];
150
+ forceLatest?: boolean;
151
+ }): Promise<TwitterPost[]>;
152
+ getPostsByAuthor(identifier: string, options?: {
153
+ identifierType?: string;
154
+ fields?: string[];
155
+ startDate?: string;
156
+ endDate?: string;
157
+ forceLatest?: boolean;
158
+ }): Promise<PaginatedResult<TwitterPost>>;
159
+ searchPosts(query: string, options?: {
160
+ fields?: string[];
161
+ startDate?: string;
162
+ endDate?: string;
163
+ authorUsername?: string;
164
+ authorId?: string;
165
+ language?: string;
166
+ forceLatest?: boolean;
167
+ responseType?: string;
168
+ }): Promise<PaginatedResult<TwitterPost>>;
169
+ getRetweets(postId: string, options?: {
170
+ fields?: string[];
171
+ startDate?: string;
172
+ }): Promise<PaginatedResult<TwitterPost>>;
173
+ getQuotes(postId: string, options?: {
174
+ fields?: string[];
175
+ startDate?: string;
176
+ forceLatest?: boolean;
177
+ }): Promise<PaginatedResult<TwitterPost>>;
178
+ getComments(postId: string, options?: {
179
+ fields?: string[];
180
+ startDate?: string;
181
+ forceLatest?: boolean;
182
+ }): Promise<PaginatedResult<TwitterPost>>;
183
+ getPostInteractingUsers(postId: string, interactionType: string, options?: {
184
+ fields?: string[];
185
+ forceLatest?: boolean;
186
+ }): Promise<PaginatedResult<TwitterUser>>;
187
+ countPosts(phrase: string, options?: {
188
+ startDate?: string;
189
+ endDate?: string;
190
+ }): Promise<number>;
191
+ getUser(identifier: string, options?: {
192
+ identifierType?: string;
193
+ fields?: string[];
194
+ }): Promise<TwitterUser>;
195
+ searchUsers(name: string, options?: {
196
+ limit?: number;
197
+ fields?: string[];
198
+ }): Promise<TwitterUser[]>;
199
+ getUserConnections(username: string, connectionType: string, options?: {
200
+ fields?: string[];
201
+ forceLatest?: boolean;
202
+ }): Promise<PaginatedResult<TwitterUser>>;
203
+ getUsersByKeywords(query: string, options?: {
204
+ fields?: string[];
205
+ startDate?: string;
206
+ endDate?: string;
207
+ language?: string;
208
+ forceLatest?: boolean;
209
+ }): Promise<PaginatedResult<TwitterUser>>;
210
+ }
211
+
212
+ interface InstagramPost {
213
+ id?: string | null;
214
+ postType?: string | null;
215
+ userId?: string | null;
216
+ username?: string | null;
217
+ fullName?: string | null;
218
+ caption?: string | null;
219
+ mediaType?: string | null;
220
+ codeUrl?: string | null;
221
+ imageUrl?: string | null;
222
+ videoUrl?: string | null;
223
+ audioOnlyUrl?: string | null;
224
+ profilePicUrl?: string | null;
225
+ videoSubtitlesUri?: string | null;
226
+ subtitles?: string | null;
227
+ videoDuration?: number | null;
228
+ likeCount?: number | null;
229
+ commentCount?: number | null;
230
+ reshareCount?: number | null;
231
+ videoPlayCount?: number | null;
232
+ location?: string | null;
233
+ createdAt?: string | null;
234
+ createdAtTimestamp?: number | null;
235
+ createdAtDate?: string | null;
236
+ lastFetch?: string | null;
237
+ lastFetchDatetime?: string | null;
238
+ xLastUpdated?: string | null;
239
+ [key: string]: unknown;
240
+ }
241
+ interface InstagramUser {
242
+ id?: string | null;
243
+ username?: string | null;
244
+ fullName?: string | null;
245
+ biography?: string | null;
246
+ isPrivate?: boolean | null;
247
+ isVerified?: boolean | null;
248
+ followerCount?: number | null;
249
+ followingCount?: number | null;
250
+ mediaCount?: number | null;
251
+ profilePicUrl?: string | null;
252
+ profilePicId?: string | null;
253
+ profileUrl?: string | null;
254
+ externalUrl?: string | null;
255
+ hasAnonymousProfilePicture?: boolean | null;
256
+ lastFetch?: string | null;
257
+ lastFetchDatetime?: string | null;
258
+ xLastUpdated?: string | null;
259
+ aggRelevance?: number | null;
260
+ relevantPostsCount?: number | null;
261
+ relevantPostsLikesSum?: number | null;
262
+ relevantPostsCommentsSum?: number | null;
263
+ relevantPostsResharesSum?: number | null;
264
+ relevantPostsVideoPlaysSum?: number | null;
265
+ [key: string]: unknown;
266
+ }
267
+ interface InstagramComment {
268
+ id?: string | null;
269
+ text?: string | null;
270
+ parentPostId?: string | null;
271
+ parentPostUserId?: string | null;
272
+ type?: string | null;
273
+ parentCommentId?: string | null;
274
+ repliedToCommentId?: string | null;
275
+ childCommentCount?: number | null;
276
+ userId?: string | null;
277
+ username?: string | null;
278
+ fullName?: string | null;
279
+ likeCount?: number | null;
280
+ status?: string | null;
281
+ isSpam?: boolean | null;
282
+ hasTranslation?: boolean | null;
283
+ createdAt?: string | null;
284
+ createdAtTimestamp?: number | null;
285
+ createdAtDate?: string | null;
286
+ lastFetch?: string | null;
287
+ lastFetchDatetime?: string | null;
288
+ xLastUpdated?: string | null;
289
+ [key: string]: unknown;
290
+ }
291
+
292
+ declare class InstagramNamespace extends BaseNamespace {
293
+ getPostsByIds(postIds: string[], options?: {
294
+ fields?: string[];
295
+ forceLatest?: boolean;
296
+ }): Promise<InstagramPost[]>;
297
+ getPostsByUser(identifier: string, options?: {
298
+ identifierType?: string;
299
+ fields?: string[];
300
+ startDate?: string;
301
+ endDate?: string;
302
+ forceLatest?: boolean;
303
+ }): Promise<PaginatedResult<InstagramPost>>;
304
+ searchPosts(query: string, options?: {
305
+ fields?: string[];
306
+ startDate?: string;
307
+ endDate?: string;
308
+ forceLatest?: boolean;
309
+ }): Promise<PaginatedResult<InstagramPost>>;
310
+ getComments(postId: string, options?: {
311
+ fields?: string[];
312
+ startDate?: string;
313
+ endDate?: string;
314
+ forceLatest?: boolean;
315
+ }): Promise<PaginatedResult<InstagramComment>>;
316
+ getUser(identifier: string, options?: {
317
+ identifierType?: string;
318
+ fields?: string[];
319
+ }): Promise<InstagramUser>;
320
+ searchUsers(name: string, options?: {
321
+ limit?: number;
322
+ fields?: string[];
323
+ }): Promise<InstagramUser[]>;
324
+ getUserConnections(username: string, connectionType: string, options?: {
325
+ fields?: string[];
326
+ forceLatest?: boolean;
327
+ }): Promise<PaginatedResult<InstagramUser>>;
328
+ getPostInteractingUsers(postId: string, interactionType: string, options?: {
329
+ fields?: string[];
330
+ forceLatest?: boolean;
331
+ }): Promise<PaginatedResult<InstagramUser>>;
332
+ getUsersByKeywords(query: string, options?: {
333
+ fields?: string[];
334
+ startDate?: string;
335
+ endDate?: string;
336
+ forceLatest?: boolean;
337
+ }): Promise<PaginatedResult<InstagramUser>>;
338
+ }
339
+
340
+ interface RedditPost {
341
+ id?: string | null;
342
+ title?: string | null;
343
+ selftext?: string | null;
344
+ url?: string | null;
345
+ permalink?: string | null;
346
+ postUrl?: string | null;
347
+ thumbnail?: string | null;
348
+ authorId?: string | null;
349
+ authorUsername?: string | null;
350
+ subredditName?: string | null;
351
+ subredditId?: string | null;
352
+ score?: number | null;
353
+ upvotes?: number | null;
354
+ downvotes?: number | null;
355
+ upvoteRatio?: number | null;
356
+ commentsCount?: number | null;
357
+ crosspostsCount?: number | null;
358
+ isSelf?: boolean | null;
359
+ isVideo?: boolean | null;
360
+ isOriginalContent?: boolean | null;
361
+ over18?: boolean | null;
362
+ spoiler?: boolean | null;
363
+ locked?: boolean | null;
364
+ stickied?: boolean | null;
365
+ archived?: boolean | null;
366
+ linkFlairText?: string | null;
367
+ postHint?: string | null;
368
+ domain?: string | null;
369
+ crosspostParent?: string | null;
370
+ createdAt?: string | null;
371
+ createdAtTimestamp?: number | null;
372
+ createdAtDate?: string | null;
373
+ lastFetch?: string | null;
374
+ lastFetchDatetime?: string | null;
375
+ xLastUpdated?: string | null;
376
+ [key: string]: unknown;
377
+ }
378
+ interface RedditUser {
379
+ id?: string | null;
380
+ username?: string | null;
381
+ profileUrl?: string | null;
382
+ profilePicUrl?: string | null;
383
+ snoovatarImg?: string | null;
384
+ linkKarma?: number | null;
385
+ commentKarma?: number | null;
386
+ totalKarma?: number | null;
387
+ awardeeKarma?: number | null;
388
+ awarderKarma?: number | null;
389
+ isGold?: boolean | null;
390
+ isMod?: boolean | null;
391
+ isEmployee?: boolean | null;
392
+ hasVerifiedEmail?: boolean | null;
393
+ isSuspended?: boolean | null;
394
+ verified?: boolean | null;
395
+ isBlocked?: boolean | null;
396
+ acceptFollowers?: boolean | null;
397
+ hasSubscribed?: boolean | null;
398
+ hideFromRobots?: boolean | null;
399
+ prefShowSnoovatar?: boolean | null;
400
+ profileDescription?: string | null;
401
+ profileBannerUrl?: string | null;
402
+ profileTitle?: string | null;
403
+ createdAt?: string | null;
404
+ createdAtTimestamp?: number | null;
405
+ createdAtDate?: string | null;
406
+ lastFetch?: string | null;
407
+ lastFetchDatetime?: string | null;
408
+ xLastUpdated?: string | null;
409
+ aggRelevance?: number | null;
410
+ relevantPostsCount?: number | null;
411
+ relevantPostsUpvotesSum?: number | null;
412
+ relevantPostsCommentsCountSum?: number | null;
413
+ [key: string]: unknown;
414
+ }
415
+ interface RedditComment {
416
+ id?: string | null;
417
+ body?: string | null;
418
+ parentPostId?: string | null;
419
+ parentId?: string | null;
420
+ authorId?: string | null;
421
+ authorUsername?: string | null;
422
+ postSubredditName?: string | null;
423
+ postSubredditId?: string | null;
424
+ score?: number | null;
425
+ upvotes?: number | null;
426
+ downvotes?: number | null;
427
+ controversiality?: number | null;
428
+ depth?: number | null;
429
+ isSubmitter?: boolean | null;
430
+ stickied?: boolean | null;
431
+ collapsed?: boolean | null;
432
+ edited?: boolean | null;
433
+ distinguished?: string | null;
434
+ createdAt?: string | null;
435
+ createdAtTimestamp?: number | null;
436
+ createdAtDate?: string | null;
437
+ lastFetch?: string | null;
438
+ lastFetchDatetime?: string | null;
439
+ xLastUpdated?: string | null;
440
+ [key: string]: unknown;
441
+ }
442
+ interface RedditSubreddit {
443
+ id?: string | null;
444
+ displayName?: string | null;
445
+ title?: string | null;
446
+ publicDescription?: string | null;
447
+ description?: string | null;
448
+ subscribersCount?: number | null;
449
+ activeUserCount?: number | null;
450
+ subredditType?: string | null;
451
+ over18?: boolean | null;
452
+ lang?: string | null;
453
+ url?: string | null;
454
+ subredditUrl?: string | null;
455
+ iconImg?: string | null;
456
+ bannerImg?: string | null;
457
+ headerImg?: string | null;
458
+ communityIcon?: string | null;
459
+ createdAt?: string | null;
460
+ createdAtTimestamp?: number | null;
461
+ createdAtDate?: string | null;
462
+ lastFetch?: string | null;
463
+ lastFetchDatetime?: string | null;
464
+ xLastUpdated?: string | null;
465
+ aggRelevance?: number | null;
466
+ relevantPostsCount?: number | null;
467
+ relevantPostsUpvotesSum?: number | null;
468
+ relevantPostsCommentsCountSum?: number | null;
469
+ [key: string]: unknown;
470
+ }
471
+ interface RedditPostWithComments {
472
+ post?: RedditPost | null;
473
+ comments?: RedditComment[] | null;
474
+ commentsPagination?: PaginationInfo | null;
475
+ commentsTableName?: string | null;
476
+ }
477
+ interface SubredditWithPosts {
478
+ subreddit?: RedditSubreddit | null;
479
+ posts?: RedditPost[] | null;
480
+ postsPagination?: PaginationInfo | null;
481
+ postsTableName?: string | null;
482
+ }
483
+
484
+ declare class RedditNamespace extends BaseNamespace {
485
+ searchPosts(query: string, options?: {
486
+ fields?: string[];
487
+ startDate?: string;
488
+ endDate?: string;
489
+ sort?: string;
490
+ time?: string;
491
+ subreddit?: string;
492
+ forceLatest?: boolean;
493
+ }): Promise<PaginatedResult<RedditPost>>;
494
+ getPostWithComments(postId: string, options?: {
495
+ postFields?: string[];
496
+ commentFields?: string[];
497
+ forceLatest?: boolean;
498
+ }): Promise<RedditPostWithComments>;
499
+ searchComments(query: string, options?: {
500
+ fields?: string[];
501
+ startDate?: string;
502
+ endDate?: string;
503
+ subreddit?: string;
504
+ }): Promise<PaginatedResult<RedditComment>>;
505
+ getUser(username: string, options?: {
506
+ fields?: string[];
507
+ }): Promise<RedditUser>;
508
+ searchUsers(name: string, options?: {
509
+ limit?: number;
510
+ fields?: string[];
511
+ }): Promise<RedditUser[]>;
512
+ getUsersByKeywords(query: string, options?: {
513
+ fields?: string[];
514
+ startDate?: string;
515
+ endDate?: string;
516
+ subreddit?: string;
517
+ forceLatest?: boolean;
518
+ }): Promise<PaginatedResult<RedditUser>>;
519
+ searchSubreddits(query: string, options?: {
520
+ limit?: number;
521
+ fields?: string[];
522
+ }): Promise<RedditSubreddit[]>;
523
+ getSubredditWithPosts(subredditName: string, options?: {
524
+ subredditFields?: string[];
525
+ postFields?: string[];
526
+ forceLatest?: boolean;
527
+ }): Promise<SubredditWithPosts>;
528
+ getSubredditsByKeywords(query: string, options?: {
529
+ fields?: string[];
530
+ startDate?: string;
531
+ endDate?: string;
532
+ forceLatest?: boolean;
533
+ }): Promise<PaginatedResult<RedditSubreddit>>;
534
+ private _parsePostWithComments;
535
+ private _parseSubredditWithPosts;
536
+ }
537
+
538
+ declare class XpozClient {
539
+ twitter: TwitterNamespace;
540
+ instagram: InstagramNamespace;
541
+ reddit: RedditNamespace;
542
+ private transport;
543
+ constructor(options?: {
544
+ apiKey?: string;
545
+ serverUrl?: string;
546
+ timeoutMs?: number;
547
+ });
548
+ connect(): Promise<void>;
549
+ close(): Promise<void>;
550
+ [Symbol.asyncDispose](): Promise<void>;
551
+ }
552
+
553
+ declare class XpozError extends Error {
554
+ constructor(message: string);
555
+ }
556
+ declare class AuthenticationError extends XpozError {
557
+ constructor(message: string);
558
+ }
559
+ declare class XpozConnectionError extends XpozError {
560
+ constructor(message: string);
561
+ }
562
+ declare class OperationTimeoutError extends XpozError {
563
+ operationId: string;
564
+ elapsedMs: number;
565
+ constructor(operationId: string, elapsedMs: number);
566
+ }
567
+ declare class OperationFailedError extends XpozError {
568
+ operationId: string;
569
+ operationError: string;
570
+ constructor(operationId: string, error: string);
571
+ }
572
+ declare class OperationCancelledError extends XpozError {
573
+ operationId: string;
574
+ constructor(operationId: string);
575
+ }
576
+
577
+ declare const VERSION = "0.1.0";
578
+
579
+ export { AuthenticationError, type InstagramComment, type InstagramPost, type InstagramUser, OperationCancelledError, OperationFailedError, OperationTimeoutError, PaginatedResult, type PaginationInfo, type RedditComment, type RedditPost, type RedditPostWithComments, type RedditSubreddit, type RedditUser, type SubredditWithPosts, type TwitterPost, type TwitterUser, VERSION, XpozClient, XpozConnectionError, XpozError };