@crosspost/types 0.1.2 → 0.1.3

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
@@ -28,6 +28,8 @@ __export(index_exports, {
28
28
  AccountPostsParamsSchema: () => AccountPostsParamsSchema,
29
29
  AccountPostsQuerySchema: () => AccountPostsQuerySchema,
30
30
  AccountPostsResponseSchema: () => AccountPostsResponseSchema,
31
+ ActivityLeaderboardQuerySchema: () => ActivityLeaderboardQuerySchema,
32
+ ActivityLeaderboardResponseSchema: () => ActivityLeaderboardResponseSchema,
31
33
  AllRateLimitsResponseSchema: () => AllRateLimitsResponseSchema,
32
34
  ApiError: () => ApiError,
33
35
  ApiErrorCode: () => ApiErrorCode,
@@ -55,8 +57,6 @@ __export(index_exports, {
55
57
  EnhancedResponseSchema: () => EnhancedResponseSchema,
56
58
  ErrorDetailSchema: () => ErrorDetailSchema,
57
59
  ErrorResponseSchema: () => ErrorResponseSchema,
58
- LeaderboardQuerySchema: () => LeaderboardQuerySchema,
59
- LeaderboardResponseSchema: () => LeaderboardResponseSchema,
60
60
  LikePostRequestSchema: () => LikePostRequestSchema,
61
61
  LikePostResponseSchema: () => LikePostResponseSchema,
62
62
  LikeResultSchema: () => LikeResultSchema,
@@ -95,6 +95,7 @@ __export(index_exports, {
95
95
  RepostResponseSchema: () => RepostResponseSchema,
96
96
  SuccessDetailSchema: () => SuccessDetailSchema,
97
97
  TargetSchema: () => TargetSchema,
98
+ TimePeriod: () => TimePeriod,
98
99
  UnlikePostRequestSchema: () => UnlikePostRequestSchema,
99
100
  UnlikePostResponseSchema: () => UnlikePostResponseSchema,
100
101
  UsageRateLimitSchema: () => UsageRateLimitSchema,
@@ -750,15 +751,23 @@ var EndpointRateLimitResponseSchema = import_zod5.z.object({
750
751
  signerId: import_zod5.z.string().describe("NEAR account ID")
751
752
  }).describe("Endpoint rate limit response");
752
753
 
753
- // src/leaderboard.ts
754
+ // src/activity.ts
754
755
  var import_zod6 = require("zod");
755
- var LeaderboardQuerySchema = import_zod6.z.object({
756
+ var TimePeriod = /* @__PURE__ */ ((TimePeriod2) => {
757
+ TimePeriod2["ALL_TIME"] = "all";
758
+ TimePeriod2["YEARLY"] = "yearly";
759
+ TimePeriod2["MONTHLY"] = "monthly";
760
+ TimePeriod2["WEEKLY"] = "weekly";
761
+ TimePeriod2["DAILY"] = "daily";
762
+ return TimePeriod2;
763
+ })(TimePeriod || {});
764
+ var ActivityLeaderboardQuerySchema = import_zod6.z.object({
756
765
  timeframe: import_zod6.z.enum(["day", "week", "month", "all"]).optional().describe(
757
766
  "Timeframe for the leaderboard"
758
767
  ),
759
768
  limit: import_zod6.z.string().optional().transform((val) => val ? parseInt(val, 10) : void 0).pipe(import_zod6.z.number().min(1).max(100).optional()).describe("Maximum number of results to return (1-100)"),
760
769
  offset: import_zod6.z.string().optional().transform((val) => val ? parseInt(val, 10) : void 0).pipe(import_zod6.z.number().min(0).optional()).describe("Offset for pagination")
761
- }).describe("Leaderboard query");
770
+ }).describe("Activity leaderboard query");
762
771
  var AccountActivityEntrySchema = import_zod6.z.object({
763
772
  signerId: import_zod6.z.string().describe("NEAR account ID"),
764
773
  totalPosts: import_zod6.z.number().describe("Total number of posts"),
@@ -770,7 +779,7 @@ var AccountActivityEntrySchema = import_zod6.z.object({
770
779
  rank: import_zod6.z.number().describe("Rank on the leaderboard"),
771
780
  lastActive: import_zod6.z.string().datetime().describe("Timestamp of last activity")
772
781
  }).describe("Account activity entry");
773
- var LeaderboardResponseSchema = EnhancedResponseSchema(
782
+ var ActivityLeaderboardResponseSchema = EnhancedResponseSchema(
774
783
  import_zod6.z.object({
775
784
  timeframe: import_zod6.z.enum(["day", "week", "month", "all"]).describe("Timeframe for the leaderboard"),
776
785
  entries: import_zod6.z.array(AccountActivityEntrySchema).describe("Leaderboard entries"),
@@ -779,7 +788,7 @@ var LeaderboardResponseSchema = EnhancedResponseSchema(
779
788
  offset: import_zod6.z.number().describe("Offset for pagination"),
780
789
  generatedAt: import_zod6.z.string().datetime().describe("Timestamp when the leaderboard was generated")
781
790
  })
782
- ).describe("Leaderboard response");
791
+ ).describe("Activity leaderboard response");
783
792
  var AccountActivityParamsSchema = import_zod6.z.object({
784
793
  signerId: import_zod6.z.string().describe("NEAR account ID")
785
794
  }).describe("Account activity params");
@@ -883,6 +892,8 @@ var ProfileRefreshResponseSchema = EnhancedResponseSchema(
883
892
  AccountPostsParamsSchema,
884
893
  AccountPostsQuerySchema,
885
894
  AccountPostsResponseSchema,
895
+ ActivityLeaderboardQuerySchema,
896
+ ActivityLeaderboardResponseSchema,
886
897
  AllRateLimitsResponseSchema,
887
898
  ApiError,
888
899
  ApiErrorCode,
@@ -910,8 +921,6 @@ var ProfileRefreshResponseSchema = EnhancedResponseSchema(
910
921
  EnhancedResponseSchema,
911
922
  ErrorDetailSchema,
912
923
  ErrorResponseSchema,
913
- LeaderboardQuerySchema,
914
- LeaderboardResponseSchema,
915
924
  LikePostRequestSchema,
916
925
  LikePostResponseSchema,
917
926
  LikeResultSchema,
@@ -950,6 +959,7 @@ var ProfileRefreshResponseSchema = EnhancedResponseSchema(
950
959
  RepostResponseSchema,
951
960
  SuccessDetailSchema,
952
961
  TargetSchema,
962
+ TimePeriod,
953
963
  UnlikePostRequestSchema,
954
964
  UnlikePostResponseSchema,
955
965
  UsageRateLimitSchema,
package/dist/index.d.cts CHANGED
@@ -6187,25 +6187,35 @@ type RateLimitResponse = z.infer<typeof RateLimitResponseSchema>;
6187
6187
  type EndpointRateLimitResponse = z.infer<typeof EndpointRateLimitResponseSchema>;
6188
6188
 
6189
6189
  /**
6190
- * Leaderboard Schemas and Types
6191
- * Defines Zod schemas for leaderboard-related requests and responses
6190
+ * Activity Schemas and Types
6191
+ * Defines Zod schemas for activity-related requests and responses
6192
6192
  * TypeScript types are derived from Zod schemas for type safety
6193
6193
  */
6194
6194
 
6195
6195
  /**
6196
- * Leaderboard query schema
6196
+ * Time periods for activity filtering
6197
6197
  */
6198
- declare const LeaderboardQuerySchema: z.ZodObject<{
6198
+ declare enum TimePeriod {
6199
+ ALL_TIME = "all",
6200
+ YEARLY = "yearly",
6201
+ MONTHLY = "monthly",
6202
+ WEEKLY = "weekly",
6203
+ DAILY = "daily"
6204
+ }
6205
+ /**
6206
+ * Activity leaderboard query schema
6207
+ */
6208
+ declare const ActivityLeaderboardQuerySchema: z.ZodObject<{
6199
6209
  timeframe: z.ZodOptional<z.ZodEnum<["day", "week", "month", "all"]>>;
6200
6210
  limit: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodString>, number | undefined, string | undefined>, z.ZodOptional<z.ZodNumber>>;
6201
6211
  offset: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodString>, number | undefined, string | undefined>, z.ZodOptional<z.ZodNumber>>;
6202
6212
  }, "strip", z.ZodTypeAny, {
6203
6213
  limit?: number | undefined;
6204
- timeframe?: "day" | "week" | "month" | "all" | undefined;
6214
+ timeframe?: "all" | "day" | "week" | "month" | undefined;
6205
6215
  offset?: number | undefined;
6206
6216
  }, {
6207
6217
  limit?: string | undefined;
6208
- timeframe?: "day" | "week" | "month" | "all" | undefined;
6218
+ timeframe?: "all" | "day" | "week" | "month" | undefined;
6209
6219
  offset?: string | undefined;
6210
6220
  }>;
6211
6221
  /**
@@ -6243,9 +6253,9 @@ declare const AccountActivityEntrySchema: z.ZodObject<{
6243
6253
  lastActive: string;
6244
6254
  }>;
6245
6255
  /**
6246
- * Leaderboard response schema
6256
+ * Activity leaderboard response schema
6247
6257
  */
6248
- declare const LeaderboardResponseSchema: z.ZodObject<{
6258
+ declare const ActivityLeaderboardResponseSchema: z.ZodObject<{
6249
6259
  success: z.ZodBoolean;
6250
6260
  data: z.ZodObject<{
6251
6261
  timeframe: z.ZodEnum<["day", "week", "month", "all"]>;
@@ -6298,7 +6308,7 @@ declare const LeaderboardResponseSchema: z.ZodObject<{
6298
6308
  }[];
6299
6309
  limit: number;
6300
6310
  total: number;
6301
- timeframe: "day" | "week" | "month" | "all";
6311
+ timeframe: "all" | "day" | "week" | "month";
6302
6312
  offset: number;
6303
6313
  generatedAt: string;
6304
6314
  }, {
@@ -6315,7 +6325,7 @@ declare const LeaderboardResponseSchema: z.ZodObject<{
6315
6325
  }[];
6316
6326
  limit: number;
6317
6327
  total: number;
6318
- timeframe: "day" | "week" | "month" | "all";
6328
+ timeframe: "all" | "day" | "week" | "month";
6319
6329
  offset: number;
6320
6330
  generatedAt: string;
6321
6331
  }>;
@@ -6405,7 +6415,7 @@ declare const LeaderboardResponseSchema: z.ZodObject<{
6405
6415
  }[];
6406
6416
  limit: number;
6407
6417
  total: number;
6408
- timeframe: "day" | "week" | "month" | "all";
6418
+ timeframe: "all" | "day" | "week" | "month";
6409
6419
  offset: number;
6410
6420
  generatedAt: string;
6411
6421
  };
@@ -6442,7 +6452,7 @@ declare const LeaderboardResponseSchema: z.ZodObject<{
6442
6452
  }[];
6443
6453
  limit: number;
6444
6454
  total: number;
6445
- timeframe: "day" | "week" | "month" | "all";
6455
+ timeframe: "all" | "day" | "week" | "month";
6446
6456
  offset: number;
6447
6457
  generatedAt: string;
6448
6458
  };
@@ -6481,9 +6491,9 @@ declare const AccountActivityParamsSchema: z.ZodObject<{
6481
6491
  declare const AccountActivityQuerySchema: z.ZodObject<{
6482
6492
  timeframe: z.ZodOptional<z.ZodEnum<["day", "week", "month", "all"]>>;
6483
6493
  }, "strip", z.ZodTypeAny, {
6484
- timeframe?: "day" | "week" | "month" | "all" | undefined;
6494
+ timeframe?: "all" | "day" | "week" | "month" | undefined;
6485
6495
  }, {
6486
- timeframe?: "day" | "week" | "month" | "all" | undefined;
6496
+ timeframe?: "all" | "day" | "week" | "month" | undefined;
6487
6497
  }>;
6488
6498
  /**
6489
6499
  * Platform activity schema
@@ -6572,7 +6582,7 @@ declare const AccountActivityResponseSchema: z.ZodObject<{
6572
6582
  score: number;
6573
6583
  }[];
6574
6584
  signerId: string;
6575
- timeframe: "day" | "week" | "month" | "all";
6585
+ timeframe: "all" | "day" | "week" | "month";
6576
6586
  totalPosts: number;
6577
6587
  totalLikes: number;
6578
6588
  totalReposts: number;
@@ -6593,7 +6603,7 @@ declare const AccountActivityResponseSchema: z.ZodObject<{
6593
6603
  score: number;
6594
6604
  }[];
6595
6605
  signerId: string;
6596
- timeframe: "day" | "week" | "month" | "all";
6606
+ timeframe: "all" | "day" | "week" | "month";
6597
6607
  totalPosts: number;
6598
6608
  totalLikes: number;
6599
6609
  totalReposts: number;
@@ -6687,7 +6697,7 @@ declare const AccountActivityResponseSchema: z.ZodObject<{
6687
6697
  score: number;
6688
6698
  }[];
6689
6699
  signerId: string;
6690
- timeframe: "day" | "week" | "month" | "all";
6700
+ timeframe: "all" | "day" | "week" | "month";
6691
6701
  totalPosts: number;
6692
6702
  totalLikes: number;
6693
6703
  totalReposts: number;
@@ -6728,7 +6738,7 @@ declare const AccountActivityResponseSchema: z.ZodObject<{
6728
6738
  score: number;
6729
6739
  }[];
6730
6740
  signerId: string;
6731
- timeframe: "day" | "week" | "month" | "all";
6741
+ timeframe: "all" | "day" | "week" | "month";
6732
6742
  totalPosts: number;
6733
6743
  totalLikes: number;
6734
6744
  totalReposts: number;
@@ -7118,9 +7128,56 @@ declare const AccountPostsResponseSchema: z.ZodObject<{
7118
7128
  timestamp?: string | undefined;
7119
7129
  } | undefined;
7120
7130
  }>;
7121
- type LeaderboardQuery = z.infer<typeof LeaderboardQuerySchema>;
7131
+ /**
7132
+ * Interface for account activity data
7133
+ */
7134
+ interface AccountActivity {
7135
+ signerId: string;
7136
+ postCount: number;
7137
+ firstPostTimestamp: number;
7138
+ lastPostTimestamp: number;
7139
+ }
7140
+ /**
7141
+ * Interface for platform-specific account activity data
7142
+ */
7143
+ interface PlatformAccountActivity extends AccountActivity {
7144
+ platform: string;
7145
+ }
7146
+ /**
7147
+ * Interface for post record data (storage optimized)
7148
+ */
7149
+ interface PostRecord {
7150
+ id: string;
7151
+ p: string;
7152
+ t: number;
7153
+ u: string;
7154
+ }
7155
+ /**
7156
+ * Interface for post record data (API response)
7157
+ */
7158
+ interface PostRecordResponse {
7159
+ postId: string;
7160
+ platform: string;
7161
+ timestamp: string;
7162
+ userId: string;
7163
+ }
7164
+ /**
7165
+ * Interface for leaderboard entry
7166
+ */
7167
+ interface LeaderboardEntry {
7168
+ signerId: string;
7169
+ postCount: number;
7170
+ lastPostTimestamp: number;
7171
+ }
7172
+ /**
7173
+ * Interface for platform-specific leaderboard entry
7174
+ */
7175
+ interface PlatformLeaderboardEntry extends LeaderboardEntry {
7176
+ platform: string;
7177
+ }
7178
+ type ActivityLeaderboardQuery = z.infer<typeof ActivityLeaderboardQuerySchema>;
7122
7179
  type AccountActivityEntry = z.infer<typeof AccountActivityEntrySchema>;
7123
- type LeaderboardResponse = z.infer<typeof LeaderboardResponseSchema>;
7180
+ type ActivityLeaderboardResponse = z.infer<typeof ActivityLeaderboardResponseSchema>;
7124
7181
  type AccountActivityParams = z.infer<typeof AccountActivityParamsSchema>;
7125
7182
  type AccountActivityQuery = z.infer<typeof AccountActivityQuerySchema>;
7126
7183
  type PlatformActivity = z.infer<typeof PlatformActivitySchema>;
@@ -7129,6 +7186,8 @@ type AccountPostsParams = z.infer<typeof AccountPostsParamsSchema>;
7129
7186
  type AccountPostsQuery = z.infer<typeof AccountPostsQuerySchema>;
7130
7187
  type AccountPost = z.infer<typeof AccountPostSchema>;
7131
7188
  type AccountPostsResponse = z.infer<typeof AccountPostsResponseSchema>;
7189
+ type LeaderboardQuery = ActivityLeaderboardQuery;
7190
+ type LeaderboardResponse = ActivityLeaderboardResponse;
7132
7191
 
7133
7192
  /**
7134
7193
  * User Profile Schemas and Types
@@ -7418,4 +7477,4 @@ type UserProfile = z.infer<typeof UserProfileSchema>;
7418
7477
  type ProfileRefreshResult = z.infer<typeof ProfileRefreshResultSchema>;
7419
7478
  type ProfileRefreshResponse = z.infer<typeof ProfileRefreshResponseSchema>;
7420
7479
 
7421
- export { type AccountActivityEntry, AccountActivityEntrySchema, type AccountActivityParams, AccountActivityParamsSchema, type AccountActivityQuery, AccountActivityQuerySchema, type AccountActivityResponse, AccountActivityResponseSchema, type AccountPost, AccountPostSchema, type AccountPostsParams, AccountPostsParamsSchema, type AccountPostsQuery, AccountPostsQuerySchema, type AccountPostsResponse, AccountPostsResponseSchema, type AllRateLimitsResponse, AllRateLimitsResponseSchema, ApiError, ApiErrorCode, type ApiResponse, ApiResponseSchema, type AuthCallbackQuery, AuthCallbackQuerySchema, type AuthCallbackResponse, AuthCallbackResponseSchema, type AuthInitRequest, AuthInitRequestSchema, type AuthRevokeResponse, AuthRevokeResponseSchema, type AuthStatusResponse, AuthStatusResponseSchema, type AuthUrlResponse, AuthUrlResponseSchema, BaseError, type ConnectedAccount, ConnectedAccountSchema, type ConnectedAccountsResponse, ConnectedAccountsResponseSchema, type CreatePostRequest, CreatePostRequestSchema, type CreatePostResponse, CreatePostResponseLegacySchema, CreatePostResponseSchema, type CreatePostTargetError, CreatePostTargetErrorSchema, type CreatePostTargetResult, CreatePostTargetResultSchema, type DeletePostRequest, DeletePostRequestSchema, type DeletePostResponse, DeletePostResponseSchema, type DeleteResult, DeleteResultSchema, type EndpointRateLimitResponse, EndpointRateLimitResponseSchema, type EnhancedApiResponse, type EnhancedErrorResponse, EnhancedErrorResponseSchema, type EnhancedResponseMeta, EnhancedResponseMetaSchema, EnhancedResponseSchema, type ErrorDetail, ErrorDetailSchema, type ErrorResponse, ErrorResponseSchema, type LeaderboardQuery, LeaderboardQuerySchema, type LeaderboardResponse, LeaderboardResponseSchema, type LikePostRequest, LikePostRequestSchema, type LikePostResponse, LikePostResponseSchema, type LikeResult, LikeResultSchema, type Media, type MediaContent, MediaContentSchema, MediaSchema, type MultiStatusResponse, MultiStatusResponseSchema, type NearAuthorizationRequest, NearAuthorizationRequestSchema, type NearAuthorizationResponse, NearAuthorizationResponseSchema, type NearAuthorizationStatusResponse, NearAuthorizationStatusResponseSchema, Platform, type PlatformActivity, PlatformActivitySchema, PlatformError, type PlatformName, type PlatformParam, PlatformParamSchema, type PlatformRateLimit, PlatformRateLimitSchema, PlatformSchema, type Post, type PostContent, PostContentSchema, type PostMetrics, PostMetricsSchema, type PostMultiStatusResponse, PostMultiStatusResponseSchema, type PostResponse, PostResponseSchema, type PostResult, PostResultSchema, PostSchema, type PostSuccessDetail, PostSuccessDetailSchema, type PostToDelete, PostToDeleteSchema, type ProfileRefreshResponse, ProfileRefreshResponseSchema, type ProfileRefreshResult, ProfileRefreshResultSchema, type QuotePostRequest, QuotePostRequestSchema, type QuotePostResponse, QuotePostResponseSchema, type RateLimitEndpoint, type RateLimitEndpointParam, RateLimitEndpointParamSchema, RateLimitEndpointSchema, type RateLimitResponse, RateLimitResponseSchema, type RateLimitStatus, type RateLimitStatusResponse, RateLimitStatusResponseSchema, RateLimitStatusSchema, type ReplyToPostRequest, ReplyToPostRequestSchema, type ReplyToPostResponse, ReplyToPostResponseSchema, type RepostRequest, RepostRequestSchema, type RepostResponse, RepostResponseSchema, type SuccessDetail, SuccessDetailSchema, type Target, TargetSchema, type UnlikePostRequest, UnlikePostRequestSchema, type UnlikePostResponse, UnlikePostResponseSchema, type UsageRateLimit, UsageRateLimitSchema, type UserProfile, UserProfileSchema, createApiResponse, createEnhancedApiResponse, createEnhancedErrorResponse, createErrorDetail, createErrorResponse, createMultiStatusResponse, createSuccessDetail };
7480
+ export { type AccountActivity, type AccountActivityEntry, AccountActivityEntrySchema, type AccountActivityParams, AccountActivityParamsSchema, type AccountActivityQuery, AccountActivityQuerySchema, type AccountActivityResponse, AccountActivityResponseSchema, type AccountPost, AccountPostSchema, type AccountPostsParams, AccountPostsParamsSchema, type AccountPostsQuery, AccountPostsQuerySchema, type AccountPostsResponse, AccountPostsResponseSchema, type ActivityLeaderboardQuery, ActivityLeaderboardQuerySchema, type ActivityLeaderboardResponse, ActivityLeaderboardResponseSchema, type AllRateLimitsResponse, AllRateLimitsResponseSchema, ApiError, ApiErrorCode, type ApiResponse, ApiResponseSchema, type AuthCallbackQuery, AuthCallbackQuerySchema, type AuthCallbackResponse, AuthCallbackResponseSchema, type AuthInitRequest, AuthInitRequestSchema, type AuthRevokeResponse, AuthRevokeResponseSchema, type AuthStatusResponse, AuthStatusResponseSchema, type AuthUrlResponse, AuthUrlResponseSchema, BaseError, type ConnectedAccount, ConnectedAccountSchema, type ConnectedAccountsResponse, ConnectedAccountsResponseSchema, type CreatePostRequest, CreatePostRequestSchema, type CreatePostResponse, CreatePostResponseLegacySchema, CreatePostResponseSchema, type CreatePostTargetError, CreatePostTargetErrorSchema, type CreatePostTargetResult, CreatePostTargetResultSchema, type DeletePostRequest, DeletePostRequestSchema, type DeletePostResponse, DeletePostResponseSchema, type DeleteResult, DeleteResultSchema, type EndpointRateLimitResponse, EndpointRateLimitResponseSchema, type EnhancedApiResponse, type EnhancedErrorResponse, EnhancedErrorResponseSchema, type EnhancedResponseMeta, EnhancedResponseMetaSchema, EnhancedResponseSchema, type ErrorDetail, ErrorDetailSchema, type ErrorResponse, ErrorResponseSchema, type LeaderboardEntry, type LeaderboardQuery, type LeaderboardResponse, type LikePostRequest, LikePostRequestSchema, type LikePostResponse, LikePostResponseSchema, type LikeResult, LikeResultSchema, type Media, type MediaContent, MediaContentSchema, MediaSchema, type MultiStatusResponse, MultiStatusResponseSchema, type NearAuthorizationRequest, NearAuthorizationRequestSchema, type NearAuthorizationResponse, NearAuthorizationResponseSchema, type NearAuthorizationStatusResponse, NearAuthorizationStatusResponseSchema, Platform, type PlatformAccountActivity, type PlatformActivity, PlatformActivitySchema, PlatformError, type PlatformLeaderboardEntry, type PlatformName, type PlatformParam, PlatformParamSchema, type PlatformRateLimit, PlatformRateLimitSchema, PlatformSchema, type Post, type PostContent, PostContentSchema, type PostMetrics, PostMetricsSchema, type PostMultiStatusResponse, PostMultiStatusResponseSchema, type PostRecord, type PostRecordResponse, type PostResponse, PostResponseSchema, type PostResult, PostResultSchema, PostSchema, type PostSuccessDetail, PostSuccessDetailSchema, type PostToDelete, PostToDeleteSchema, type ProfileRefreshResponse, ProfileRefreshResponseSchema, type ProfileRefreshResult, ProfileRefreshResultSchema, type QuotePostRequest, QuotePostRequestSchema, type QuotePostResponse, QuotePostResponseSchema, type RateLimitEndpoint, type RateLimitEndpointParam, RateLimitEndpointParamSchema, RateLimitEndpointSchema, type RateLimitResponse, RateLimitResponseSchema, type RateLimitStatus, type RateLimitStatusResponse, RateLimitStatusResponseSchema, RateLimitStatusSchema, type ReplyToPostRequest, ReplyToPostRequestSchema, type ReplyToPostResponse, ReplyToPostResponseSchema, type RepostRequest, RepostRequestSchema, type RepostResponse, RepostResponseSchema, type SuccessDetail, SuccessDetailSchema, type Target, TargetSchema, TimePeriod, type UnlikePostRequest, UnlikePostRequestSchema, type UnlikePostResponse, UnlikePostResponseSchema, type UsageRateLimit, UsageRateLimitSchema, type UserProfile, UserProfileSchema, createApiResponse, createEnhancedApiResponse, createEnhancedErrorResponse, createErrorDetail, createErrorResponse, createMultiStatusResponse, createSuccessDetail };
package/dist/index.d.ts CHANGED
@@ -6187,25 +6187,35 @@ type RateLimitResponse = z.infer<typeof RateLimitResponseSchema>;
6187
6187
  type EndpointRateLimitResponse = z.infer<typeof EndpointRateLimitResponseSchema>;
6188
6188
 
6189
6189
  /**
6190
- * Leaderboard Schemas and Types
6191
- * Defines Zod schemas for leaderboard-related requests and responses
6190
+ * Activity Schemas and Types
6191
+ * Defines Zod schemas for activity-related requests and responses
6192
6192
  * TypeScript types are derived from Zod schemas for type safety
6193
6193
  */
6194
6194
 
6195
6195
  /**
6196
- * Leaderboard query schema
6196
+ * Time periods for activity filtering
6197
6197
  */
6198
- declare const LeaderboardQuerySchema: z.ZodObject<{
6198
+ declare enum TimePeriod {
6199
+ ALL_TIME = "all",
6200
+ YEARLY = "yearly",
6201
+ MONTHLY = "monthly",
6202
+ WEEKLY = "weekly",
6203
+ DAILY = "daily"
6204
+ }
6205
+ /**
6206
+ * Activity leaderboard query schema
6207
+ */
6208
+ declare const ActivityLeaderboardQuerySchema: z.ZodObject<{
6199
6209
  timeframe: z.ZodOptional<z.ZodEnum<["day", "week", "month", "all"]>>;
6200
6210
  limit: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodString>, number | undefined, string | undefined>, z.ZodOptional<z.ZodNumber>>;
6201
6211
  offset: z.ZodPipeline<z.ZodEffects<z.ZodOptional<z.ZodString>, number | undefined, string | undefined>, z.ZodOptional<z.ZodNumber>>;
6202
6212
  }, "strip", z.ZodTypeAny, {
6203
6213
  limit?: number | undefined;
6204
- timeframe?: "day" | "week" | "month" | "all" | undefined;
6214
+ timeframe?: "all" | "day" | "week" | "month" | undefined;
6205
6215
  offset?: number | undefined;
6206
6216
  }, {
6207
6217
  limit?: string | undefined;
6208
- timeframe?: "day" | "week" | "month" | "all" | undefined;
6218
+ timeframe?: "all" | "day" | "week" | "month" | undefined;
6209
6219
  offset?: string | undefined;
6210
6220
  }>;
6211
6221
  /**
@@ -6243,9 +6253,9 @@ declare const AccountActivityEntrySchema: z.ZodObject<{
6243
6253
  lastActive: string;
6244
6254
  }>;
6245
6255
  /**
6246
- * Leaderboard response schema
6256
+ * Activity leaderboard response schema
6247
6257
  */
6248
- declare const LeaderboardResponseSchema: z.ZodObject<{
6258
+ declare const ActivityLeaderboardResponseSchema: z.ZodObject<{
6249
6259
  success: z.ZodBoolean;
6250
6260
  data: z.ZodObject<{
6251
6261
  timeframe: z.ZodEnum<["day", "week", "month", "all"]>;
@@ -6298,7 +6308,7 @@ declare const LeaderboardResponseSchema: z.ZodObject<{
6298
6308
  }[];
6299
6309
  limit: number;
6300
6310
  total: number;
6301
- timeframe: "day" | "week" | "month" | "all";
6311
+ timeframe: "all" | "day" | "week" | "month";
6302
6312
  offset: number;
6303
6313
  generatedAt: string;
6304
6314
  }, {
@@ -6315,7 +6325,7 @@ declare const LeaderboardResponseSchema: z.ZodObject<{
6315
6325
  }[];
6316
6326
  limit: number;
6317
6327
  total: number;
6318
- timeframe: "day" | "week" | "month" | "all";
6328
+ timeframe: "all" | "day" | "week" | "month";
6319
6329
  offset: number;
6320
6330
  generatedAt: string;
6321
6331
  }>;
@@ -6405,7 +6415,7 @@ declare const LeaderboardResponseSchema: z.ZodObject<{
6405
6415
  }[];
6406
6416
  limit: number;
6407
6417
  total: number;
6408
- timeframe: "day" | "week" | "month" | "all";
6418
+ timeframe: "all" | "day" | "week" | "month";
6409
6419
  offset: number;
6410
6420
  generatedAt: string;
6411
6421
  };
@@ -6442,7 +6452,7 @@ declare const LeaderboardResponseSchema: z.ZodObject<{
6442
6452
  }[];
6443
6453
  limit: number;
6444
6454
  total: number;
6445
- timeframe: "day" | "week" | "month" | "all";
6455
+ timeframe: "all" | "day" | "week" | "month";
6446
6456
  offset: number;
6447
6457
  generatedAt: string;
6448
6458
  };
@@ -6481,9 +6491,9 @@ declare const AccountActivityParamsSchema: z.ZodObject<{
6481
6491
  declare const AccountActivityQuerySchema: z.ZodObject<{
6482
6492
  timeframe: z.ZodOptional<z.ZodEnum<["day", "week", "month", "all"]>>;
6483
6493
  }, "strip", z.ZodTypeAny, {
6484
- timeframe?: "day" | "week" | "month" | "all" | undefined;
6494
+ timeframe?: "all" | "day" | "week" | "month" | undefined;
6485
6495
  }, {
6486
- timeframe?: "day" | "week" | "month" | "all" | undefined;
6496
+ timeframe?: "all" | "day" | "week" | "month" | undefined;
6487
6497
  }>;
6488
6498
  /**
6489
6499
  * Platform activity schema
@@ -6572,7 +6582,7 @@ declare const AccountActivityResponseSchema: z.ZodObject<{
6572
6582
  score: number;
6573
6583
  }[];
6574
6584
  signerId: string;
6575
- timeframe: "day" | "week" | "month" | "all";
6585
+ timeframe: "all" | "day" | "week" | "month";
6576
6586
  totalPosts: number;
6577
6587
  totalLikes: number;
6578
6588
  totalReposts: number;
@@ -6593,7 +6603,7 @@ declare const AccountActivityResponseSchema: z.ZodObject<{
6593
6603
  score: number;
6594
6604
  }[];
6595
6605
  signerId: string;
6596
- timeframe: "day" | "week" | "month" | "all";
6606
+ timeframe: "all" | "day" | "week" | "month";
6597
6607
  totalPosts: number;
6598
6608
  totalLikes: number;
6599
6609
  totalReposts: number;
@@ -6687,7 +6697,7 @@ declare const AccountActivityResponseSchema: z.ZodObject<{
6687
6697
  score: number;
6688
6698
  }[];
6689
6699
  signerId: string;
6690
- timeframe: "day" | "week" | "month" | "all";
6700
+ timeframe: "all" | "day" | "week" | "month";
6691
6701
  totalPosts: number;
6692
6702
  totalLikes: number;
6693
6703
  totalReposts: number;
@@ -6728,7 +6738,7 @@ declare const AccountActivityResponseSchema: z.ZodObject<{
6728
6738
  score: number;
6729
6739
  }[];
6730
6740
  signerId: string;
6731
- timeframe: "day" | "week" | "month" | "all";
6741
+ timeframe: "all" | "day" | "week" | "month";
6732
6742
  totalPosts: number;
6733
6743
  totalLikes: number;
6734
6744
  totalReposts: number;
@@ -7118,9 +7128,56 @@ declare const AccountPostsResponseSchema: z.ZodObject<{
7118
7128
  timestamp?: string | undefined;
7119
7129
  } | undefined;
7120
7130
  }>;
7121
- type LeaderboardQuery = z.infer<typeof LeaderboardQuerySchema>;
7131
+ /**
7132
+ * Interface for account activity data
7133
+ */
7134
+ interface AccountActivity {
7135
+ signerId: string;
7136
+ postCount: number;
7137
+ firstPostTimestamp: number;
7138
+ lastPostTimestamp: number;
7139
+ }
7140
+ /**
7141
+ * Interface for platform-specific account activity data
7142
+ */
7143
+ interface PlatformAccountActivity extends AccountActivity {
7144
+ platform: string;
7145
+ }
7146
+ /**
7147
+ * Interface for post record data (storage optimized)
7148
+ */
7149
+ interface PostRecord {
7150
+ id: string;
7151
+ p: string;
7152
+ t: number;
7153
+ u: string;
7154
+ }
7155
+ /**
7156
+ * Interface for post record data (API response)
7157
+ */
7158
+ interface PostRecordResponse {
7159
+ postId: string;
7160
+ platform: string;
7161
+ timestamp: string;
7162
+ userId: string;
7163
+ }
7164
+ /**
7165
+ * Interface for leaderboard entry
7166
+ */
7167
+ interface LeaderboardEntry {
7168
+ signerId: string;
7169
+ postCount: number;
7170
+ lastPostTimestamp: number;
7171
+ }
7172
+ /**
7173
+ * Interface for platform-specific leaderboard entry
7174
+ */
7175
+ interface PlatformLeaderboardEntry extends LeaderboardEntry {
7176
+ platform: string;
7177
+ }
7178
+ type ActivityLeaderboardQuery = z.infer<typeof ActivityLeaderboardQuerySchema>;
7122
7179
  type AccountActivityEntry = z.infer<typeof AccountActivityEntrySchema>;
7123
- type LeaderboardResponse = z.infer<typeof LeaderboardResponseSchema>;
7180
+ type ActivityLeaderboardResponse = z.infer<typeof ActivityLeaderboardResponseSchema>;
7124
7181
  type AccountActivityParams = z.infer<typeof AccountActivityParamsSchema>;
7125
7182
  type AccountActivityQuery = z.infer<typeof AccountActivityQuerySchema>;
7126
7183
  type PlatformActivity = z.infer<typeof PlatformActivitySchema>;
@@ -7129,6 +7186,8 @@ type AccountPostsParams = z.infer<typeof AccountPostsParamsSchema>;
7129
7186
  type AccountPostsQuery = z.infer<typeof AccountPostsQuerySchema>;
7130
7187
  type AccountPost = z.infer<typeof AccountPostSchema>;
7131
7188
  type AccountPostsResponse = z.infer<typeof AccountPostsResponseSchema>;
7189
+ type LeaderboardQuery = ActivityLeaderboardQuery;
7190
+ type LeaderboardResponse = ActivityLeaderboardResponse;
7132
7191
 
7133
7192
  /**
7134
7193
  * User Profile Schemas and Types
@@ -7418,4 +7477,4 @@ type UserProfile = z.infer<typeof UserProfileSchema>;
7418
7477
  type ProfileRefreshResult = z.infer<typeof ProfileRefreshResultSchema>;
7419
7478
  type ProfileRefreshResponse = z.infer<typeof ProfileRefreshResponseSchema>;
7420
7479
 
7421
- export { type AccountActivityEntry, AccountActivityEntrySchema, type AccountActivityParams, AccountActivityParamsSchema, type AccountActivityQuery, AccountActivityQuerySchema, type AccountActivityResponse, AccountActivityResponseSchema, type AccountPost, AccountPostSchema, type AccountPostsParams, AccountPostsParamsSchema, type AccountPostsQuery, AccountPostsQuerySchema, type AccountPostsResponse, AccountPostsResponseSchema, type AllRateLimitsResponse, AllRateLimitsResponseSchema, ApiError, ApiErrorCode, type ApiResponse, ApiResponseSchema, type AuthCallbackQuery, AuthCallbackQuerySchema, type AuthCallbackResponse, AuthCallbackResponseSchema, type AuthInitRequest, AuthInitRequestSchema, type AuthRevokeResponse, AuthRevokeResponseSchema, type AuthStatusResponse, AuthStatusResponseSchema, type AuthUrlResponse, AuthUrlResponseSchema, BaseError, type ConnectedAccount, ConnectedAccountSchema, type ConnectedAccountsResponse, ConnectedAccountsResponseSchema, type CreatePostRequest, CreatePostRequestSchema, type CreatePostResponse, CreatePostResponseLegacySchema, CreatePostResponseSchema, type CreatePostTargetError, CreatePostTargetErrorSchema, type CreatePostTargetResult, CreatePostTargetResultSchema, type DeletePostRequest, DeletePostRequestSchema, type DeletePostResponse, DeletePostResponseSchema, type DeleteResult, DeleteResultSchema, type EndpointRateLimitResponse, EndpointRateLimitResponseSchema, type EnhancedApiResponse, type EnhancedErrorResponse, EnhancedErrorResponseSchema, type EnhancedResponseMeta, EnhancedResponseMetaSchema, EnhancedResponseSchema, type ErrorDetail, ErrorDetailSchema, type ErrorResponse, ErrorResponseSchema, type LeaderboardQuery, LeaderboardQuerySchema, type LeaderboardResponse, LeaderboardResponseSchema, type LikePostRequest, LikePostRequestSchema, type LikePostResponse, LikePostResponseSchema, type LikeResult, LikeResultSchema, type Media, type MediaContent, MediaContentSchema, MediaSchema, type MultiStatusResponse, MultiStatusResponseSchema, type NearAuthorizationRequest, NearAuthorizationRequestSchema, type NearAuthorizationResponse, NearAuthorizationResponseSchema, type NearAuthorizationStatusResponse, NearAuthorizationStatusResponseSchema, Platform, type PlatformActivity, PlatformActivitySchema, PlatformError, type PlatformName, type PlatformParam, PlatformParamSchema, type PlatformRateLimit, PlatformRateLimitSchema, PlatformSchema, type Post, type PostContent, PostContentSchema, type PostMetrics, PostMetricsSchema, type PostMultiStatusResponse, PostMultiStatusResponseSchema, type PostResponse, PostResponseSchema, type PostResult, PostResultSchema, PostSchema, type PostSuccessDetail, PostSuccessDetailSchema, type PostToDelete, PostToDeleteSchema, type ProfileRefreshResponse, ProfileRefreshResponseSchema, type ProfileRefreshResult, ProfileRefreshResultSchema, type QuotePostRequest, QuotePostRequestSchema, type QuotePostResponse, QuotePostResponseSchema, type RateLimitEndpoint, type RateLimitEndpointParam, RateLimitEndpointParamSchema, RateLimitEndpointSchema, type RateLimitResponse, RateLimitResponseSchema, type RateLimitStatus, type RateLimitStatusResponse, RateLimitStatusResponseSchema, RateLimitStatusSchema, type ReplyToPostRequest, ReplyToPostRequestSchema, type ReplyToPostResponse, ReplyToPostResponseSchema, type RepostRequest, RepostRequestSchema, type RepostResponse, RepostResponseSchema, type SuccessDetail, SuccessDetailSchema, type Target, TargetSchema, type UnlikePostRequest, UnlikePostRequestSchema, type UnlikePostResponse, UnlikePostResponseSchema, type UsageRateLimit, UsageRateLimitSchema, type UserProfile, UserProfileSchema, createApiResponse, createEnhancedApiResponse, createEnhancedErrorResponse, createErrorDetail, createErrorResponse, createMultiStatusResponse, createSuccessDetail };
7480
+ export { type AccountActivity, type AccountActivityEntry, AccountActivityEntrySchema, type AccountActivityParams, AccountActivityParamsSchema, type AccountActivityQuery, AccountActivityQuerySchema, type AccountActivityResponse, AccountActivityResponseSchema, type AccountPost, AccountPostSchema, type AccountPostsParams, AccountPostsParamsSchema, type AccountPostsQuery, AccountPostsQuerySchema, type AccountPostsResponse, AccountPostsResponseSchema, type ActivityLeaderboardQuery, ActivityLeaderboardQuerySchema, type ActivityLeaderboardResponse, ActivityLeaderboardResponseSchema, type AllRateLimitsResponse, AllRateLimitsResponseSchema, ApiError, ApiErrorCode, type ApiResponse, ApiResponseSchema, type AuthCallbackQuery, AuthCallbackQuerySchema, type AuthCallbackResponse, AuthCallbackResponseSchema, type AuthInitRequest, AuthInitRequestSchema, type AuthRevokeResponse, AuthRevokeResponseSchema, type AuthStatusResponse, AuthStatusResponseSchema, type AuthUrlResponse, AuthUrlResponseSchema, BaseError, type ConnectedAccount, ConnectedAccountSchema, type ConnectedAccountsResponse, ConnectedAccountsResponseSchema, type CreatePostRequest, CreatePostRequestSchema, type CreatePostResponse, CreatePostResponseLegacySchema, CreatePostResponseSchema, type CreatePostTargetError, CreatePostTargetErrorSchema, type CreatePostTargetResult, CreatePostTargetResultSchema, type DeletePostRequest, DeletePostRequestSchema, type DeletePostResponse, DeletePostResponseSchema, type DeleteResult, DeleteResultSchema, type EndpointRateLimitResponse, EndpointRateLimitResponseSchema, type EnhancedApiResponse, type EnhancedErrorResponse, EnhancedErrorResponseSchema, type EnhancedResponseMeta, EnhancedResponseMetaSchema, EnhancedResponseSchema, type ErrorDetail, ErrorDetailSchema, type ErrorResponse, ErrorResponseSchema, type LeaderboardEntry, type LeaderboardQuery, type LeaderboardResponse, type LikePostRequest, LikePostRequestSchema, type LikePostResponse, LikePostResponseSchema, type LikeResult, LikeResultSchema, type Media, type MediaContent, MediaContentSchema, MediaSchema, type MultiStatusResponse, MultiStatusResponseSchema, type NearAuthorizationRequest, NearAuthorizationRequestSchema, type NearAuthorizationResponse, NearAuthorizationResponseSchema, type NearAuthorizationStatusResponse, NearAuthorizationStatusResponseSchema, Platform, type PlatformAccountActivity, type PlatformActivity, PlatformActivitySchema, PlatformError, type PlatformLeaderboardEntry, type PlatformName, type PlatformParam, PlatformParamSchema, type PlatformRateLimit, PlatformRateLimitSchema, PlatformSchema, type Post, type PostContent, PostContentSchema, type PostMetrics, PostMetricsSchema, type PostMultiStatusResponse, PostMultiStatusResponseSchema, type PostRecord, type PostRecordResponse, type PostResponse, PostResponseSchema, type PostResult, PostResultSchema, PostSchema, type PostSuccessDetail, PostSuccessDetailSchema, type PostToDelete, PostToDeleteSchema, type ProfileRefreshResponse, ProfileRefreshResponseSchema, type ProfileRefreshResult, ProfileRefreshResultSchema, type QuotePostRequest, QuotePostRequestSchema, type QuotePostResponse, QuotePostResponseSchema, type RateLimitEndpoint, type RateLimitEndpointParam, RateLimitEndpointParamSchema, RateLimitEndpointSchema, type RateLimitResponse, RateLimitResponseSchema, type RateLimitStatus, type RateLimitStatusResponse, RateLimitStatusResponseSchema, RateLimitStatusSchema, type ReplyToPostRequest, ReplyToPostRequestSchema, type ReplyToPostResponse, ReplyToPostResponseSchema, type RepostRequest, RepostRequestSchema, type RepostResponse, RepostResponseSchema, type SuccessDetail, SuccessDetailSchema, type Target, TargetSchema, TimePeriod, type UnlikePostRequest, UnlikePostRequestSchema, type UnlikePostResponse, UnlikePostResponseSchema, type UsageRateLimit, UsageRateLimitSchema, type UserProfile, UserProfileSchema, createApiResponse, createEnhancedApiResponse, createEnhancedErrorResponse, createErrorDetail, createErrorResponse, createMultiStatusResponse, createSuccessDetail };
package/dist/index.js CHANGED
@@ -639,15 +639,23 @@ var EndpointRateLimitResponseSchema = z5.object({
639
639
  signerId: z5.string().describe("NEAR account ID")
640
640
  }).describe("Endpoint rate limit response");
641
641
 
642
- // src/leaderboard.ts
642
+ // src/activity.ts
643
643
  import { z as z6 } from "zod";
644
- var LeaderboardQuerySchema = z6.object({
644
+ var TimePeriod = /* @__PURE__ */ ((TimePeriod2) => {
645
+ TimePeriod2["ALL_TIME"] = "all";
646
+ TimePeriod2["YEARLY"] = "yearly";
647
+ TimePeriod2["MONTHLY"] = "monthly";
648
+ TimePeriod2["WEEKLY"] = "weekly";
649
+ TimePeriod2["DAILY"] = "daily";
650
+ return TimePeriod2;
651
+ })(TimePeriod || {});
652
+ var ActivityLeaderboardQuerySchema = z6.object({
645
653
  timeframe: z6.enum(["day", "week", "month", "all"]).optional().describe(
646
654
  "Timeframe for the leaderboard"
647
655
  ),
648
656
  limit: z6.string().optional().transform((val) => val ? parseInt(val, 10) : void 0).pipe(z6.number().min(1).max(100).optional()).describe("Maximum number of results to return (1-100)"),
649
657
  offset: z6.string().optional().transform((val) => val ? parseInt(val, 10) : void 0).pipe(z6.number().min(0).optional()).describe("Offset for pagination")
650
- }).describe("Leaderboard query");
658
+ }).describe("Activity leaderboard query");
651
659
  var AccountActivityEntrySchema = z6.object({
652
660
  signerId: z6.string().describe("NEAR account ID"),
653
661
  totalPosts: z6.number().describe("Total number of posts"),
@@ -659,7 +667,7 @@ var AccountActivityEntrySchema = z6.object({
659
667
  rank: z6.number().describe("Rank on the leaderboard"),
660
668
  lastActive: z6.string().datetime().describe("Timestamp of last activity")
661
669
  }).describe("Account activity entry");
662
- var LeaderboardResponseSchema = EnhancedResponseSchema(
670
+ var ActivityLeaderboardResponseSchema = EnhancedResponseSchema(
663
671
  z6.object({
664
672
  timeframe: z6.enum(["day", "week", "month", "all"]).describe("Timeframe for the leaderboard"),
665
673
  entries: z6.array(AccountActivityEntrySchema).describe("Leaderboard entries"),
@@ -668,7 +676,7 @@ var LeaderboardResponseSchema = EnhancedResponseSchema(
668
676
  offset: z6.number().describe("Offset for pagination"),
669
677
  generatedAt: z6.string().datetime().describe("Timestamp when the leaderboard was generated")
670
678
  })
671
- ).describe("Leaderboard response");
679
+ ).describe("Activity leaderboard response");
672
680
  var AccountActivityParamsSchema = z6.object({
673
681
  signerId: z6.string().describe("NEAR account ID")
674
682
  }).describe("Account activity params");
@@ -771,6 +779,8 @@ export {
771
779
  AccountPostsParamsSchema,
772
780
  AccountPostsQuerySchema,
773
781
  AccountPostsResponseSchema,
782
+ ActivityLeaderboardQuerySchema,
783
+ ActivityLeaderboardResponseSchema,
774
784
  AllRateLimitsResponseSchema,
775
785
  ApiError,
776
786
  ApiErrorCode,
@@ -798,8 +808,6 @@ export {
798
808
  EnhancedResponseSchema,
799
809
  ErrorDetailSchema,
800
810
  ErrorResponseSchema,
801
- LeaderboardQuerySchema,
802
- LeaderboardResponseSchema,
803
811
  LikePostRequestSchema,
804
812
  LikePostResponseSchema,
805
813
  LikeResultSchema,
@@ -838,6 +846,7 @@ export {
838
846
  RepostResponseSchema,
839
847
  SuccessDetailSchema,
840
848
  TargetSchema,
849
+ TimePeriod,
841
850
  UnlikePostRequestSchema,
842
851
  UnlikePostResponseSchema,
843
852
  UsageRateLimitSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crosspost/types",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Shared type definitions for Crosspost API",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -0,0 +1,247 @@
1
+ /**
2
+ * Activity Schemas and Types
3
+ * Defines Zod schemas for activity-related requests and responses
4
+ * TypeScript types are derived from Zod schemas for type safety
5
+ */
6
+
7
+ import { z } from 'zod';
8
+ import { EnhancedResponseSchema } from './response.ts';
9
+ import { PlatformSchema } from './common.ts';
10
+
11
+ /**
12
+ * Time periods for activity filtering
13
+ */
14
+ export enum TimePeriod {
15
+ ALL_TIME = 'all',
16
+ YEARLY = 'yearly',
17
+ MONTHLY = 'monthly',
18
+ WEEKLY = 'weekly',
19
+ DAILY = 'daily',
20
+ }
21
+
22
+ /**
23
+ * Activity leaderboard query schema
24
+ */
25
+ export const ActivityLeaderboardQuerySchema = z.object({
26
+ timeframe: z.enum(['day', 'week', 'month', 'all']).optional().describe(
27
+ 'Timeframe for the leaderboard',
28
+ ),
29
+ limit: z.string().optional()
30
+ .transform((val) => val ? parseInt(val, 10) : undefined)
31
+ .pipe(z.number().min(1).max(100).optional())
32
+ .describe('Maximum number of results to return (1-100)'),
33
+ offset: z.string().optional()
34
+ .transform((val) => val ? parseInt(val, 10) : undefined)
35
+ .pipe(z.number().min(0).optional())
36
+ .describe('Offset for pagination'),
37
+ }).describe('Activity leaderboard query');
38
+
39
+ /**
40
+ * Account activity entry schema
41
+ */
42
+ export const AccountActivityEntrySchema = z.object({
43
+ signerId: z.string().describe('NEAR account ID'),
44
+ totalPosts: z.number().describe('Total number of posts'),
45
+ totalLikes: z.number().describe('Total number of likes'),
46
+ totalReposts: z.number().describe('Total number of reposts'),
47
+ totalReplies: z.number().describe('Total number of replies'),
48
+ totalQuotes: z.number().describe('Total number of quote posts'),
49
+ totalScore: z.number().describe('Total activity score'),
50
+ rank: z.number().describe('Rank on the leaderboard'),
51
+ lastActive: z.string().datetime().describe('Timestamp of last activity'),
52
+ }).describe('Account activity entry');
53
+
54
+ /**
55
+ * Activity leaderboard response schema
56
+ */
57
+ export const ActivityLeaderboardResponseSchema = EnhancedResponseSchema(
58
+ z.object({
59
+ timeframe: z.enum(['day', 'week', 'month', 'all']).describe('Timeframe for the leaderboard'),
60
+ entries: z.array(AccountActivityEntrySchema).describe('Leaderboard entries'),
61
+ total: z.number().describe('Total number of entries in the leaderboard'),
62
+ limit: z.number().describe('Maximum number of results returned'),
63
+ offset: z.number().describe('Offset for pagination'),
64
+ generatedAt: z.string().datetime().describe('Timestamp when the leaderboard was generated'),
65
+ }),
66
+ ).describe('Activity leaderboard response');
67
+
68
+ /**
69
+ * Account activity params schema
70
+ */
71
+ export const AccountActivityParamsSchema = z.object({
72
+ signerId: z.string().describe('NEAR account ID'),
73
+ }).describe('Account activity params');
74
+
75
+ /**
76
+ * Account activity query schema
77
+ */
78
+ export const AccountActivityQuerySchema = z.object({
79
+ timeframe: z.enum(['day', 'week', 'month', 'all']).optional().describe(
80
+ 'Timeframe for the activity',
81
+ ),
82
+ }).describe('Account activity query');
83
+
84
+ /**
85
+ * Platform activity schema
86
+ */
87
+ export const PlatformActivitySchema = z.object({
88
+ platform: PlatformSchema,
89
+ posts: z.number().describe('Number of posts on this platform'),
90
+ likes: z.number().describe('Number of likes on this platform'),
91
+ reposts: z.number().describe('Number of reposts on this platform'),
92
+ replies: z.number().describe('Number of replies on this platform'),
93
+ quotes: z.number().describe('Number of quote posts on this platform'),
94
+ score: z.number().describe('Activity score on this platform'),
95
+ lastActive: z.string().datetime().describe('Timestamp of last activity on this platform'),
96
+ }).describe('Platform activity');
97
+
98
+ /**
99
+ * Account activity response schema
100
+ */
101
+ export const AccountActivityResponseSchema = EnhancedResponseSchema(
102
+ z.object({
103
+ signerId: z.string().describe('NEAR account ID'),
104
+ timeframe: z.enum(['day', 'week', 'month', 'all']).describe('Timeframe for the activity'),
105
+ totalPosts: z.number().describe('Total number of posts across all platforms'),
106
+ totalLikes: z.number().describe('Total number of likes across all platforms'),
107
+ totalReposts: z.number().describe('Total number of reposts across all platforms'),
108
+ totalReplies: z.number().describe('Total number of replies across all platforms'),
109
+ totalQuotes: z.number().describe('Total number of quote posts across all platforms'),
110
+ totalScore: z.number().describe('Total activity score across all platforms'),
111
+ rank: z.number().describe('Rank on the leaderboard'),
112
+ lastActive: z.string().datetime().describe('Timestamp of last activity across all platforms'),
113
+ platforms: z.array(PlatformActivitySchema).describe('Activity breakdown by platform'),
114
+ }),
115
+ ).describe('Account activity response');
116
+
117
+ /**
118
+ * Account posts params schema
119
+ */
120
+ export const AccountPostsParamsSchema = z.object({
121
+ signerId: z.string().describe('NEAR account ID'),
122
+ }).describe('Account posts params');
123
+
124
+ /**
125
+ * Account posts query schema
126
+ */
127
+ export const AccountPostsQuerySchema = z.object({
128
+ platform: z.string().optional().describe('Filter by platform (optional)'),
129
+ limit: z.string().optional()
130
+ .transform((val) => val ? parseInt(val, 10) : undefined)
131
+ .pipe(z.number().min(1).max(100).optional())
132
+ .describe('Maximum number of results to return (1-100)'),
133
+ offset: z.string().optional()
134
+ .transform((val) => val ? parseInt(val, 10) : undefined)
135
+ .pipe(z.number().min(0).optional())
136
+ .describe('Offset for pagination'),
137
+ type: z.enum(['post', 'repost', 'reply', 'quote', 'like', 'all']).optional().describe(
138
+ 'Filter by post type (optional)',
139
+ ),
140
+ }).describe('Account posts query');
141
+
142
+ /**
143
+ * Account post schema
144
+ */
145
+ export const AccountPostSchema = z.object({
146
+ id: z.string().describe('Post ID'),
147
+ platform: PlatformSchema,
148
+ type: z.enum(['post', 'repost', 'reply', 'quote', 'like']).describe('Type of post'),
149
+ content: z.string().optional().describe('Post content (if available)'),
150
+ url: z.string().url().optional().describe('URL to the post on the platform (if available)'),
151
+ createdAt: z.string().datetime().describe('Timestamp when the post was created'),
152
+ metrics: z.object({
153
+ likes: z.number().optional().describe('Number of likes (if available)'),
154
+ reposts: z.number().optional().describe('Number of reposts (if available)'),
155
+ replies: z.number().optional().describe('Number of replies (if available)'),
156
+ quotes: z.number().optional().describe('Number of quotes (if available)'),
157
+ }).optional().describe('Post metrics (if available)'),
158
+ inReplyToId: z.string().optional().describe('ID of the post this is a reply to (if applicable)'),
159
+ quotedPostId: z.string().optional().describe('ID of the post this is quoting (if applicable)'),
160
+ }).describe('Account post');
161
+
162
+ /**
163
+ * Account posts response schema
164
+ */
165
+ export const AccountPostsResponseSchema = EnhancedResponseSchema(
166
+ z.object({
167
+ signerId: z.string().describe('NEAR account ID'),
168
+ posts: z.array(AccountPostSchema).describe('List of posts'),
169
+ total: z.number().describe('Total number of posts matching the query'),
170
+ limit: z.number().describe('Maximum number of results returned'),
171
+ offset: z.number().describe('Offset for pagination'),
172
+ platform: z.string().optional().describe('Platform filter (if applied)'),
173
+ type: z.enum(['post', 'repost', 'reply', 'quote', 'like', 'all']).optional().describe(
174
+ 'Post type filter (if applied)',
175
+ ),
176
+ }),
177
+ ).describe('Account posts response');
178
+
179
+ /**
180
+ * Interface for account activity data
181
+ */
182
+ export interface AccountActivity {
183
+ signerId: string;
184
+ postCount: number;
185
+ firstPostTimestamp: number;
186
+ lastPostTimestamp: number;
187
+ }
188
+
189
+ /**
190
+ * Interface for platform-specific account activity data
191
+ */
192
+ export interface PlatformAccountActivity extends AccountActivity {
193
+ platform: string;
194
+ }
195
+
196
+ /**
197
+ * Interface for post record data (storage optimized)
198
+ */
199
+ export interface PostRecord {
200
+ id: string; // postId
201
+ p: string; // platform
202
+ t: number; // timestamp
203
+ u: string; // userId
204
+ }
205
+
206
+ /**
207
+ * Interface for post record data (API response)
208
+ */
209
+ export interface PostRecordResponse {
210
+ postId: string;
211
+ platform: string;
212
+ timestamp: string;
213
+ userId: string;
214
+ }
215
+
216
+ /**
217
+ * Interface for leaderboard entry
218
+ */
219
+ export interface LeaderboardEntry {
220
+ signerId: string;
221
+ postCount: number;
222
+ lastPostTimestamp: number;
223
+ }
224
+
225
+ /**
226
+ * Interface for platform-specific leaderboard entry
227
+ */
228
+ export interface PlatformLeaderboardEntry extends LeaderboardEntry {
229
+ platform: string;
230
+ }
231
+
232
+ // Derive TypeScript types from Zod schemas
233
+ export type ActivityLeaderboardQuery = z.infer<typeof ActivityLeaderboardQuerySchema>;
234
+ export type AccountActivityEntry = z.infer<typeof AccountActivityEntrySchema>;
235
+ export type ActivityLeaderboardResponse = z.infer<typeof ActivityLeaderboardResponseSchema>;
236
+ export type AccountActivityParams = z.infer<typeof AccountActivityParamsSchema>;
237
+ export type AccountActivityQuery = z.infer<typeof AccountActivityQuerySchema>;
238
+ export type PlatformActivity = z.infer<typeof PlatformActivitySchema>;
239
+ export type AccountActivityResponse = z.infer<typeof AccountActivityResponseSchema>;
240
+ export type AccountPostsParams = z.infer<typeof AccountPostsParamsSchema>;
241
+ export type AccountPostsQuery = z.infer<typeof AccountPostsQuerySchema>;
242
+ export type AccountPost = z.infer<typeof AccountPostSchema>;
243
+ export type AccountPostsResponse = z.infer<typeof AccountPostsResponseSchema>;
244
+
245
+ // Legacy type aliases for backward compatibility
246
+ export type LeaderboardQuery = ActivityLeaderboardQuery;
247
+ export type LeaderboardResponse = ActivityLeaderboardResponse;
package/src/index.ts CHANGED
@@ -16,5 +16,5 @@ export * from './errors/index.ts';
16
16
  export * from './auth.ts';
17
17
  export * from './post.ts';
18
18
  export * from './rate-limit.ts';
19
- export * from './leaderboard.ts';
19
+ export * from './activity.ts';
20
20
  export * from './user-profile.ts';