@crosspost/types 0.1.14 → 0.2.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
@@ -27,6 +27,7 @@ __export(index_exports, {
27
27
  AccountPostsParamsSchema: () => AccountPostsParamsSchema,
28
28
  AccountPostsQuerySchema: () => AccountPostsQuerySchema,
29
29
  ActivityLeaderboardQuerySchema: () => ActivityLeaderboardQuerySchema,
30
+ ActivityType: () => ActivityType,
30
31
  AllRateLimitsResponseSchema: () => AllRateLimitsResponseSchema,
31
32
  ApiErrorCode: () => ApiErrorCode,
32
33
  ApiErrorCodeSchema: () => ApiErrorCodeSchema,
@@ -48,6 +49,7 @@ __export(index_exports, {
48
49
  DeleteResultSchema: () => DeleteResultSchema,
49
50
  EndpointRateLimitResponseSchema: () => EndpointRateLimitResponseSchema,
50
51
  ErrorDetailSchema: () => ErrorDetailSchema,
52
+ FilterSchema: () => FilterSchema,
51
53
  HealthStatusSchema: () => HealthStatusSchema,
52
54
  LikePostRequestSchema: () => LikePostRequestSchema,
53
55
  LikePostResponseSchema: () => LikePostResponseSchema,
@@ -55,10 +57,12 @@ __export(index_exports, {
55
57
  MediaContentSchema: () => MediaContentSchema,
56
58
  MediaSchema: () => MediaSchema,
57
59
  MultiStatusDataSchema: () => MultiStatusDataSchema,
60
+ MultiStatusSummarySchema: () => MultiStatusSummarySchema,
58
61
  NearAuthorizationRequestSchema: () => NearAuthorizationRequestSchema,
59
62
  NearAuthorizationResponseSchema: () => NearAuthorizationResponseSchema,
60
63
  NearAuthorizationStatusResponseSchema: () => NearAuthorizationStatusResponseSchema,
61
64
  NearUnauthorizationResponseSchema: () => NearUnauthorizationResponseSchema,
65
+ PaginationSchema: () => PaginationSchema,
62
66
  Platform: () => Platform,
63
67
  PlatformActivitySchema: () => PlatformActivitySchema,
64
68
  PlatformParamSchema: () => PlatformParamSchema,
@@ -66,11 +70,9 @@ __export(index_exports, {
66
70
  PlatformSchema: () => PlatformSchema,
67
71
  PostContentSchema: () => PostContentSchema,
68
72
  PostMetricsSchema: () => PostMetricsSchema,
69
- PostMultiStatusResponseSchema: () => PostMultiStatusResponseSchema,
70
73
  PostResponseSchema: () => PostResponseSchema,
71
74
  PostResultSchema: () => PostResultSchema,
72
75
  PostSchema: () => PostSchema,
73
- PostSuccessDetailSchema: () => PostSuccessDetailSchema,
74
76
  PostToDeleteSchema: () => PostToDeleteSchema,
75
77
  ProfileRefreshResponseSchema: () => ProfileRefreshResponseSchema,
76
78
  QuotePostRequestSchema: () => QuotePostRequestSchema,
@@ -143,6 +145,8 @@ var ApiErrorCode = /* @__PURE__ */ ((ApiErrorCode2) => {
143
145
  ApiErrorCode2["POST_INTERACTION_FAILED"] = "POST_INTERACTION_FAILED";
144
146
  ApiErrorCode2["NETWORK_ERROR"] = "NETWORK_ERROR";
145
147
  ApiErrorCode2["INVALID_RESPONSE"] = "INVALID_RESPONSE";
148
+ ApiErrorCode2["TOKEN_REFRESH_FAILED"] = "TOKEN_REFRESH_FAILED";
149
+ ApiErrorCode2["PROFILE_REFRESH_FAILED"] = "PROFILE_REFRESH_FAILED";
146
150
  return ApiErrorCode2;
147
151
  })(ApiErrorCode || {});
148
152
  var ApiErrorCodeSchema = import_zod2.z.enum(Object.values(ApiErrorCode));
@@ -166,7 +170,9 @@ var errorCodeToStatusCode = {
166
170
  ["POST_DELETION_FAILED" /* POST_DELETION_FAILED */]: 500,
167
171
  ["POST_INTERACTION_FAILED" /* POST_INTERACTION_FAILED */]: 500,
168
172
  ["NETWORK_ERROR" /* NETWORK_ERROR */]: 503,
169
- ["INVALID_RESPONSE" /* INVALID_RESPONSE */]: 500
173
+ ["INVALID_RESPONSE" /* INVALID_RESPONSE */]: 500,
174
+ ["TOKEN_REFRESH_FAILED" /* TOKEN_REFRESH_FAILED */]: 500,
175
+ ["PROFILE_REFRESH_FAILED" /* PROFILE_REFRESH_FAILED */]: 500
170
176
  };
171
177
  var ErrorDetailSchema = import_zod2.z.object({
172
178
  message: import_zod2.z.string().describe("Human-readable error message"),
@@ -185,20 +191,15 @@ var ResponseMetaSchema = import_zod3.z.object({
185
191
  reset: import_zod3.z.number().int().positive().describe("Unix timestamp (seconds)")
186
192
  }).optional().describe("Rate limit information if applicable"),
187
193
  pagination: import_zod3.z.object({
188
- page: import_zod3.z.number().int().positive().optional(),
189
- perPage: import_zod3.z.number().int().positive().optional(),
190
- total: import_zod3.z.number().int().nonnegative().optional(),
191
194
  limit: import_zod3.z.number().int().nonnegative().optional(),
192
195
  offset: import_zod3.z.number().int().nonnegative().optional(),
193
- totalPages: import_zod3.z.number().int().nonnegative().optional(),
194
- nextCursor: import_zod3.z.string().optional(),
195
- prevCursor: import_zod3.z.string().optional()
196
+ total: import_zod3.z.number().int().nonnegative().optional()
196
197
  }).optional().describe("Pagination information if applicable")
197
198
  });
198
199
  var SuccessDetailSchema = import_zod3.z.object({
199
200
  platform: import_zod3.z.string(),
200
201
  userId: import_zod3.z.string(),
201
- additionalData: import_zod3.z.any().optional(),
202
+ details: import_zod3.z.any().optional(),
202
203
  status: import_zod3.z.literal("success")
203
204
  }).catchall(import_zod3.z.any());
204
205
  var HealthStatusSchema = import_zod3.z.object({
@@ -206,12 +207,13 @@ var HealthStatusSchema = import_zod3.z.object({
206
207
  version: import_zod3.z.string().optional().describe("API version"),
207
208
  timestamp: import_zod3.z.string().datetime().describe("Current server time")
208
209
  }).describe("Health status response");
210
+ var MultiStatusSummarySchema = import_zod3.z.object({
211
+ total: import_zod3.z.number().int().nonnegative(),
212
+ succeeded: import_zod3.z.number().int().nonnegative(),
213
+ failed: import_zod3.z.number().int().nonnegative()
214
+ });
209
215
  var MultiStatusDataSchema = import_zod3.z.object({
210
- summary: import_zod3.z.object({
211
- total: import_zod3.z.number().int().nonnegative(),
212
- succeeded: import_zod3.z.number().int().nonnegative(),
213
- failed: import_zod3.z.number().int().nonnegative()
214
- }),
216
+ summary: MultiStatusSummarySchema,
215
217
  results: import_zod3.z.array(SuccessDetailSchema),
216
218
  errors: import_zod3.z.array(ErrorDetailSchema)
217
219
  });
@@ -363,13 +365,6 @@ var LikeResultSchema = import_zod6.z.object({
363
365
  success: import_zod6.z.boolean().describe("Whether the like was successful"),
364
366
  id: import_zod6.z.string().describe("ID of the liked post")
365
367
  }).describe("Like result");
366
- var PostSuccessDetailSchema = import_zod6.z.object({
367
- platform: PlatformSchema,
368
- userId: import_zod6.z.string().describe("User ID"),
369
- status: import_zod6.z.literal("success"),
370
- postId: import_zod6.z.string().optional().describe("Post ID"),
371
- postUrl: import_zod6.z.string().optional().describe("URL to the post")
372
- }).catchall(import_zod6.z.any()).describe("Post success detail");
373
368
  var TargetSchema = import_zod6.z.object({
374
369
  platform: PlatformSchema.describe('The platform to post to (e.g., "twitter")'),
375
370
  userId: import_zod6.z.string().describe("User ID on the platform")
@@ -446,15 +441,6 @@ var LikePostResponseSchema = import_zod6.z.object({
446
441
  var UnlikePostResponseSchema = import_zod6.z.object({
447
442
  id: import_zod6.z.string().describe("ID of the unliked post")
448
443
  }).describe("Unlike post response");
449
- var PostMultiStatusResponseSchema = import_zod6.z.object({
450
- summary: import_zod6.z.object({
451
- total: import_zod6.z.number().describe("Total number of operations"),
452
- succeeded: import_zod6.z.number().describe("Number of successful operations"),
453
- failed: import_zod6.z.number().describe("Number of failed operations")
454
- }),
455
- results: import_zod6.z.array(PostSuccessDetailSchema).describe("Successful operations"),
456
- errors: import_zod6.z.array(ErrorDetailSchema).describe("Failed operations")
457
- }).describe("Multi-status response for post operations");
458
444
 
459
445
  // src/rate-limit.ts
460
446
  var import_zod7 = require("zod");
@@ -546,6 +532,16 @@ var EndpointRateLimitResponseSchema = import_zod7.z.object({
546
532
 
547
533
  // src/activity.ts
548
534
  var import_zod8 = require("zod");
535
+ var ActivityType = /* @__PURE__ */ ((ActivityType2) => {
536
+ ActivityType2["POST"] = "post";
537
+ ActivityType2["REPOST"] = "repost";
538
+ ActivityType2["REPLY"] = "reply";
539
+ ActivityType2["QUOTE"] = "quote";
540
+ ActivityType2["LIKE"] = "like";
541
+ ActivityType2["UNLIKE"] = "unlike";
542
+ ActivityType2["DELETE"] = "delete";
543
+ return ActivityType2;
544
+ })(ActivityType || {});
549
545
  var TimePeriod = /* @__PURE__ */ ((TimePeriod2) => {
550
546
  TimePeriod2["ALL"] = "all";
551
547
  TimePeriod2["YEARLY"] = "year";
@@ -554,13 +550,45 @@ var TimePeriod = /* @__PURE__ */ ((TimePeriod2) => {
554
550
  TimePeriod2["DAILY"] = "day";
555
551
  return TimePeriod2;
556
552
  })(TimePeriod || {});
557
- var ActivityLeaderboardQuerySchema = import_zod8.z.object({
558
- timeframe: import_zod8.z.nativeEnum(TimePeriod).optional().describe(
559
- "Timeframe for the leaderboard"
560
- ),
553
+ var FilterSchema = import_zod8.z.object({
554
+ platforms: import_zod8.z.string().optional().transform((val) => {
555
+ if (!val) return void 0;
556
+ return val.split(",").map((p) => p.trim()).map((p) => {
557
+ try {
558
+ return Platform[p.toUpperCase()];
559
+ } catch (_e) {
560
+ return p;
561
+ }
562
+ });
563
+ }).pipe(
564
+ import_zod8.z.array(import_zod8.z.nativeEnum(Platform)).optional()
565
+ ).describe("Filter by platforms (comma-separated list, optional)"),
566
+ types: import_zod8.z.string().optional().transform((val) => {
567
+ if (!val) return void 0;
568
+ return val.split(",").map((t) => t.trim()).map((t) => {
569
+ try {
570
+ return ActivityType[t.toUpperCase()];
571
+ } catch (_e) {
572
+ return t;
573
+ }
574
+ });
575
+ }).pipe(
576
+ import_zod8.z.array(import_zod8.z.nativeEnum(ActivityType)).optional()
577
+ ).describe("Filter by activity types (comma-separated list, optional)"),
578
+ timeframe: import_zod8.z.nativeEnum(TimePeriod).optional().transform((val) => {
579
+ if (!val) return "all" /* ALL */;
580
+ return val;
581
+ }).describe(
582
+ "Timeframe for filtering (optional)"
583
+ )
584
+ }).describe("Filter parameters");
585
+ var PaginationSchema = import_zod8.z.object({
561
586
  limit: import_zod8.z.string().optional().transform((val) => val ? parseInt(val, 10) : void 0).pipe(import_zod8.z.number().min(1).max(100).optional()).describe("Maximum number of results to return (1-100)"),
562
587
  offset: import_zod8.z.string().optional().transform((val) => val ? parseInt(val, 10) : void 0).pipe(import_zod8.z.number().min(0).optional()).describe("Offset for pagination")
563
- }).describe("Activity leaderboard query");
588
+ }).describe("Pagination parameters");
589
+ var ActivityLeaderboardQuerySchema = import_zod8.z.object({
590
+ filter: FilterSchema.optional()
591
+ }).describe("Account leaderboard query").merge(PaginationSchema);
564
592
  var AccountActivityEntrySchema = import_zod8.z.object({
565
593
  signerId: import_zod8.z.string().describe("NEAR account ID"),
566
594
  totalPosts: import_zod8.z.number().describe("Total number of posts"),
@@ -570,22 +598,21 @@ var AccountActivityEntrySchema = import_zod8.z.object({
570
598
  totalQuotes: import_zod8.z.number().describe("Total number of quote posts"),
571
599
  totalScore: import_zod8.z.number().describe("Total activity score"),
572
600
  rank: import_zod8.z.number().describe("Rank on the leaderboard"),
573
- lastActive: import_zod8.z.string().datetime().describe("Timestamp of last activity")
601
+ lastActive: import_zod8.z.string().datetime().describe("Timestamp of last activity"),
602
+ firstPostTimestamp: import_zod8.z.string().datetime().describe("Timestamp of the first post")
574
603
  }).describe("Account activity entry");
575
604
  var ActivityLeaderboardResponseSchema = import_zod8.z.object({
576
605
  timeframe: import_zod8.z.nativeEnum(TimePeriod).describe("Timeframe for the leaderboard"),
577
606
  entries: import_zod8.z.array(AccountActivityEntrySchema).describe("Leaderboard entries"),
578
607
  generatedAt: import_zod8.z.string().datetime().describe("Timestamp when the leaderboard was generated"),
579
- platform: PlatformSchema.optional().describe("Platform filter (if applied)")
608
+ platforms: import_zod8.z.array(PlatformSchema).optional().describe("Platform filters (if applied)")
580
609
  });
581
610
  var AccountActivityParamsSchema = import_zod8.z.object({
582
611
  signerId: import_zod8.z.string().describe("NEAR account ID")
583
612
  }).describe("Account activity params");
584
613
  var AccountActivityQuerySchema = import_zod8.z.object({
585
- timeframe: import_zod8.z.nativeEnum(TimePeriod).optional().describe(
586
- "Timeframe for the activity"
587
- )
588
- }).describe("Account activity query");
614
+ filter: FilterSchema.optional()
615
+ }).describe("Account activity query").merge(PaginationSchema);
589
616
  var PlatformActivitySchema = import_zod8.z.object({
590
617
  platform: PlatformSchema,
591
618
  posts: import_zod8.z.number().describe("Number of posts on this platform"),
@@ -613,17 +640,13 @@ var AccountPostsParamsSchema = import_zod8.z.object({
613
640
  signerId: import_zod8.z.string().describe("NEAR account ID")
614
641
  }).describe("Account posts params");
615
642
  var AccountPostsQuerySchema = import_zod8.z.object({
616
- platform: import_zod8.z.string().optional().describe("Filter by platform (optional)"),
617
- limit: import_zod8.z.string().optional().transform((val) => val ? parseInt(val, 10) : void 0).pipe(import_zod8.z.number().min(1).max(100).optional()).describe("Maximum number of results to return (1-100)"),
618
- offset: import_zod8.z.string().optional().transform((val) => val ? parseInt(val, 10) : void 0).pipe(import_zod8.z.number().min(0).optional()).describe("Offset for pagination"),
619
- type: import_zod8.z.enum(["post", "repost", "reply", "quote", "like", "all"]).optional().describe(
620
- "Filter by post type (optional)"
621
- )
622
- }).describe("Account posts query");
643
+ filter: FilterSchema.optional()
644
+ }).describe("Account posts query").merge(PaginationSchema);
623
645
  var AccountPostSchema = import_zod8.z.object({
624
646
  id: import_zod8.z.string().describe("Post ID"),
625
647
  platform: PlatformSchema,
626
- type: import_zod8.z.enum(["post", "repost", "reply", "quote", "like"]).describe("Type of post"),
648
+ userId: import_zod8.z.string().describe("User ID on the platform"),
649
+ type: import_zod8.z.nativeEnum(ActivityType).describe("Type of post"),
627
650
  content: import_zod8.z.string().optional().describe("Post content (if available)"),
628
651
  url: import_zod8.z.string().url().optional().describe("URL to the post on the platform (if available)"),
629
652
  createdAt: import_zod8.z.string().datetime().describe("Timestamp when the post was created"),
@@ -639,10 +662,8 @@ var AccountPostSchema = import_zod8.z.object({
639
662
  var AccountPostsResponseSchema = import_zod8.z.object({
640
663
  signerId: import_zod8.z.string().describe("NEAR account ID"),
641
664
  posts: import_zod8.z.array(AccountPostSchema).describe("List of posts"),
642
- platform: import_zod8.z.string().optional().describe("Platform filter (if applied)"),
643
- type: import_zod8.z.enum(["post", "repost", "reply", "quote", "like", "all"]).optional().describe(
644
- "Post type filter (if applied)"
645
- )
665
+ platforms: import_zod8.z.array(import_zod8.z.string()).optional().describe("Platform filters (if applied)"),
666
+ types: import_zod8.z.array(import_zod8.z.string()).optional().describe("Post type filters (if applied)")
646
667
  });
647
668
  // Annotate the CommonJS export names for ESM import in node:
648
669
  0 && (module.exports = {
@@ -653,6 +674,7 @@ var AccountPostsResponseSchema = import_zod8.z.object({
653
674
  AccountPostsParamsSchema,
654
675
  AccountPostsQuerySchema,
655
676
  ActivityLeaderboardQuerySchema,
677
+ ActivityType,
656
678
  AllRateLimitsResponseSchema,
657
679
  ApiErrorCode,
658
680
  ApiErrorCodeSchema,
@@ -674,6 +696,7 @@ var AccountPostsResponseSchema = import_zod8.z.object({
674
696
  DeleteResultSchema,
675
697
  EndpointRateLimitResponseSchema,
676
698
  ErrorDetailSchema,
699
+ FilterSchema,
677
700
  HealthStatusSchema,
678
701
  LikePostRequestSchema,
679
702
  LikePostResponseSchema,
@@ -681,10 +704,12 @@ var AccountPostsResponseSchema = import_zod8.z.object({
681
704
  MediaContentSchema,
682
705
  MediaSchema,
683
706
  MultiStatusDataSchema,
707
+ MultiStatusSummarySchema,
684
708
  NearAuthorizationRequestSchema,
685
709
  NearAuthorizationResponseSchema,
686
710
  NearAuthorizationStatusResponseSchema,
687
711
  NearUnauthorizationResponseSchema,
712
+ PaginationSchema,
688
713
  Platform,
689
714
  PlatformActivitySchema,
690
715
  PlatformParamSchema,
@@ -692,11 +717,9 @@ var AccountPostsResponseSchema = import_zod8.z.object({
692
717
  PlatformSchema,
693
718
  PostContentSchema,
694
719
  PostMetricsSchema,
695
- PostMultiStatusResponseSchema,
696
720
  PostResponseSchema,
697
721
  PostResultSchema,
698
722
  PostSchema,
699
- PostSuccessDetailSchema,
700
723
  PostToDeleteSchema,
701
724
  ProfileRefreshResponseSchema,
702
725
  QuotePostRequestSchema,