@crosspost/types 0.1.2

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/mod.ts ADDED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @crosspost/types
3
+ * Shared type definitions for Crosspost API
4
+ *
5
+ * This is the Deno entry point for the package.
6
+ */
7
+
8
+ // Export everything from the source directly
9
+ export * from './src/index.ts';
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@crosspost/types",
3
+ "version": "0.1.2",
4
+ "description": "Shared type definitions for Crosspost API",
5
+ "type": "module",
6
+ "main": "dist/index.cjs",
7
+ "module": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist",
18
+ "src",
19
+ "mod.ts"
20
+ ],
21
+ "scripts": {
22
+ "build": "npm run build:node",
23
+ "build:node": "tsup src/index.ts --format cjs,esm --dts --tsconfig tsconfig.node.json",
24
+ "clean": "rimraf dist",
25
+ "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
26
+ "lint": "eslint src --ext .ts",
27
+ "typecheck": "tsc --noEmit",
28
+ "prepublishOnly": "npm run clean && npm run build"
29
+ },
30
+ "keywords": [
31
+ "crosspost",
32
+ "types",
33
+ "api",
34
+ "social-media"
35
+ ],
36
+ "author": "crosspost.near",
37
+ "license": "MIT",
38
+ "devDependencies": {
39
+ "eslint": "^8.56.0",
40
+ "rimraf": "^5.0.5",
41
+ "tsup": "^8.0.1",
42
+ "typescript": "^5.3.3"
43
+ },
44
+ "publishConfig": {
45
+ "access": "public"
46
+ },
47
+ "dependencies": {
48
+ "hono": "^4.7.6",
49
+ "zod": "^3.24.2"
50
+ }
51
+ }
package/src/auth.ts ADDED
@@ -0,0 +1,121 @@
1
+ /**
2
+ * Auth Schemas and Types
3
+ * Defines Zod schemas for authentication-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
+ // Platform parameter schema
12
+ export const PlatformParamSchema = z.object({
13
+ platform: z.string().describe('Social media platform'),
14
+ }).describe('Platform parameter');
15
+
16
+ // Auth initialization request schema
17
+ export const AuthInitRequestSchema = z.object({
18
+ successUrl: z.string().url().optional().describe(
19
+ 'URL to redirect to on successful authentication',
20
+ ),
21
+ errorUrl: z.string().url().optional().describe('URL to redirect to on authentication error'),
22
+ }).describe('Auth initialization request');
23
+
24
+ // Auth URL response schema
25
+ export const AuthUrlResponseSchema = EnhancedResponseSchema(
26
+ z.object({
27
+ url: z.string().describe('Authentication URL to redirect the user to'),
28
+ state: z.string().describe('State parameter for CSRF protection'),
29
+ platform: PlatformSchema,
30
+ }),
31
+ ).describe('Auth URL response');
32
+
33
+ // Auth callback query schema
34
+ export const AuthCallbackQuerySchema = z.object({
35
+ code: z.string().describe('Authorization code from OAuth provider'),
36
+ state: z.string().describe('State parameter for CSRF protection'),
37
+ }).describe('Auth callback query');
38
+
39
+ // Auth callback response schema
40
+ export const AuthCallbackResponseSchema = EnhancedResponseSchema(
41
+ z.object({
42
+ success: z.boolean().describe('Whether the authentication was successful'),
43
+ platform: PlatformSchema,
44
+ userId: z.string().describe('User ID'),
45
+ redirectUrl: z.string().optional().describe('URL to redirect the user to after authentication'),
46
+ }),
47
+ ).describe('Auth callback response');
48
+
49
+ // Auth status response schema
50
+ export const AuthStatusResponseSchema = EnhancedResponseSchema(
51
+ z.object({
52
+ platform: PlatformSchema,
53
+ userId: z.string().describe('User ID'),
54
+ authenticated: z.boolean().describe('Whether the user is authenticated'),
55
+ tokenStatus: z.object({
56
+ valid: z.boolean().describe('Whether the token is valid'),
57
+ expired: z.boolean().describe('Whether the token is expired'),
58
+ expiresAt: z.string().optional().describe('When the token expires'),
59
+ }),
60
+ }),
61
+ ).describe('Auth status response');
62
+
63
+ // Auth revoke response schema
64
+ export const AuthRevokeResponseSchema = EnhancedResponseSchema(
65
+ z.object({
66
+ success: z.boolean().describe('Whether the revocation was successful'),
67
+ platform: PlatformSchema,
68
+ userId: z.string().describe('User ID'),
69
+ }),
70
+ ).describe('Auth revoke response');
71
+
72
+ // Connected account schema
73
+ export const ConnectedAccountSchema = z.object({
74
+ platform: PlatformSchema,
75
+ userId: z.string().describe('User ID on the platform'),
76
+ username: z.string().optional().describe('Username on the platform (if available)'),
77
+ profileUrl: z.string().optional().describe('URL to the user profile'),
78
+ connectedAt: z.string().optional().describe('When the account was connected'),
79
+ }).describe('Connected account');
80
+
81
+ // Connected accounts response schema
82
+ export const ConnectedAccountsResponseSchema = EnhancedResponseSchema(
83
+ z.array(ConnectedAccountSchema),
84
+ ).describe('Connected accounts response');
85
+
86
+ // NEAR authorization request schema
87
+ export const NearAuthorizationRequestSchema = z.object({
88
+ // No additional parameters needed, as the NEAR account ID is extracted from the signature
89
+ }).describe('NEAR authorization request');
90
+
91
+ // NEAR authorization response schema
92
+ export const NearAuthorizationResponseSchema = EnhancedResponseSchema(
93
+ z.object({
94
+ success: z.boolean().describe('Whether the authorization was successful'),
95
+ nearAccount: z.string().describe('NEAR account ID'),
96
+ authorized: z.boolean().describe('Whether the account is authorized'),
97
+ }),
98
+ ).describe('NEAR authorization response');
99
+
100
+ // NEAR authorization status response schema
101
+ export const NearAuthorizationStatusResponseSchema = EnhancedResponseSchema(
102
+ z.object({
103
+ nearAccount: z.string().describe('NEAR account ID'),
104
+ authorized: z.boolean().describe('Whether the account is authorized'),
105
+ authorizedAt: z.string().optional().describe('When the account was authorized'),
106
+ }),
107
+ ).describe('NEAR authorization status response');
108
+
109
+ // Derive TypeScript types from Zod schemas
110
+ export type PlatformParam = z.infer<typeof PlatformParamSchema>;
111
+ export type AuthInitRequest = z.infer<typeof AuthInitRequestSchema>;
112
+ export type AuthUrlResponse = z.infer<typeof AuthUrlResponseSchema>;
113
+ export type AuthCallbackQuery = z.infer<typeof AuthCallbackQuerySchema>;
114
+ export type AuthCallbackResponse = z.infer<typeof AuthCallbackResponseSchema>;
115
+ export type AuthStatusResponse = z.infer<typeof AuthStatusResponseSchema>;
116
+ export type AuthRevokeResponse = z.infer<typeof AuthRevokeResponseSchema>;
117
+ export type ConnectedAccount = z.infer<typeof ConnectedAccountSchema>;
118
+ export type ConnectedAccountsResponse = z.infer<typeof ConnectedAccountsResponseSchema>;
119
+ export type NearAuthorizationRequest = z.infer<typeof NearAuthorizationRequestSchema>;
120
+ export type NearAuthorizationResponse = z.infer<typeof NearAuthorizationResponseSchema>;
121
+ export type NearAuthorizationStatusResponse = z.infer<typeof NearAuthorizationStatusResponseSchema>;
package/src/common.ts ADDED
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Common Schemas and Types
3
+ * Defines common Zod schemas and derived TypeScript types used across the API
4
+ */
5
+
6
+ import { z } from 'zod';
7
+
8
+ /**
9
+ * Platform schema
10
+ */
11
+ export const PlatformSchema = z.enum([
12
+ 'unknown',
13
+ 'twitter',
14
+ // Add more platforms as they're implemented
15
+ // 'linkedin',
16
+ // 'facebook',
17
+ // 'instagram',
18
+ ]).describe('Social media platform');
19
+
20
+ // Derive TypeScript types from Zod schemas
21
+ export type PlatformName = z.infer<typeof PlatformSchema>;
22
+
23
+ /**
24
+ * Enum for supported platforms (for backward compatibility)
25
+ */
26
+ export enum Platform {
27
+ UNKNOWN = 'unknown',
28
+ TWITTER = 'twitter',
29
+ // Add more platforms as they're implemented
30
+ // LINKEDIN = 'linkedin',
31
+ // FACEBOOK = 'facebook',
32
+ // INSTAGRAM = 'instagram',
33
+ }
@@ -0,0 +1,153 @@
1
+ import type { StatusCode } from 'hono/utils/http-status';
2
+ import { BaseError } from './base-error.ts';
3
+
4
+ /**
5
+ * API Error codes for standardized error identification
6
+ */
7
+ export enum ApiErrorCode {
8
+ // General errors
9
+ UNKNOWN_ERROR = 'UNKNOWN_ERROR',
10
+ INTERNAL_ERROR = 'INTERNAL_ERROR',
11
+
12
+ // Authentication/Authorization errors
13
+ UNAUTHORIZED = 'UNAUTHORIZED',
14
+ FORBIDDEN = 'FORBIDDEN',
15
+
16
+ // Validation errors
17
+ VALIDATION_ERROR = 'VALIDATION_ERROR',
18
+ INVALID_REQUEST = 'INVALID_REQUEST',
19
+
20
+ // Rate limiting
21
+ RATE_LIMITED = 'RATE_LIMITED',
22
+
23
+ // Resource errors
24
+ NOT_FOUND = 'NOT_FOUND',
25
+
26
+ // Platform-specific errors
27
+ PLATFORM_ERROR = 'PLATFORM_ERROR',
28
+ PLATFORM_UNAVAILABLE = 'PLATFORM_UNAVAILABLE',
29
+
30
+ // Content errors
31
+ CONTENT_POLICY_VIOLATION = 'CONTENT_POLICY_VIOLATION',
32
+ DUPLICATE_CONTENT = 'DUPLICATE_CONTENT',
33
+
34
+ // Media errors
35
+ MEDIA_UPLOAD_FAILED = 'MEDIA_UPLOAD_FAILED',
36
+
37
+ // Post errors
38
+ POST_CREATION_FAILED = 'POST_CREATION_FAILED',
39
+ THREAD_CREATION_FAILED = 'THREAD_CREATION_FAILED',
40
+ POST_DELETION_FAILED = 'POST_DELETION_FAILED',
41
+ POST_INTERACTION_FAILED = 'POST_INTERACTION_FAILED',
42
+
43
+ // Network errors
44
+ NETWORK_ERROR = 'NETWORK_ERROR',
45
+ }
46
+
47
+ /**
48
+ * API Error class for application-level errors
49
+ */
50
+ export class ApiError extends BaseError {
51
+ public readonly code: ApiErrorCode;
52
+ public readonly status: StatusCode;
53
+ public readonly details?: Record<string, any>;
54
+ public readonly recoverable: boolean;
55
+
56
+ constructor(
57
+ message: string,
58
+ code: ApiErrorCode = ApiErrorCode.INTERNAL_ERROR,
59
+ status: StatusCode = 500,
60
+ details?: Record<string, any>,
61
+ recoverable: boolean = false,
62
+ ) {
63
+ super(message);
64
+ this.code = code;
65
+ this.status = status;
66
+ this.details = details;
67
+ this.recoverable = recoverable;
68
+ }
69
+
70
+ /**
71
+ * Create a validation error
72
+ */
73
+ static validation(message: string, details?: Record<string, any>): ApiError {
74
+ return new ApiError(
75
+ message,
76
+ ApiErrorCode.VALIDATION_ERROR,
77
+ 400,
78
+ details,
79
+ true,
80
+ );
81
+ }
82
+
83
+ /**
84
+ * Create an unauthorized error
85
+ */
86
+ static unauthorized(message: string = 'Unauthorized'): ApiError {
87
+ return new ApiError(
88
+ message,
89
+ ApiErrorCode.UNAUTHORIZED,
90
+ 401,
91
+ undefined,
92
+ true,
93
+ );
94
+ }
95
+
96
+ /**
97
+ * Create a forbidden error
98
+ */
99
+ static forbidden(message: string = 'Forbidden'): ApiError {
100
+ return new ApiError(
101
+ message,
102
+ ApiErrorCode.FORBIDDEN,
103
+ 403,
104
+ undefined,
105
+ false,
106
+ );
107
+ }
108
+
109
+ /**
110
+ * Create a not found error
111
+ */
112
+ static notFound(message: string = 'Resource not found'): ApiError {
113
+ return new ApiError(
114
+ message,
115
+ ApiErrorCode.NOT_FOUND,
116
+ 404,
117
+ undefined,
118
+ false,
119
+ );
120
+ }
121
+
122
+ /**
123
+ * Create a rate limit error
124
+ */
125
+ static rateLimited(
126
+ message: string = 'Rate limit exceeded',
127
+ details?: Record<string, any>,
128
+ ): ApiError {
129
+ return new ApiError(
130
+ message,
131
+ ApiErrorCode.RATE_LIMITED,
132
+ 429,
133
+ details,
134
+ true,
135
+ );
136
+ }
137
+
138
+ /**
139
+ * Create an internal server error
140
+ */
141
+ static internal(
142
+ message: string = 'Internal server error',
143
+ details?: Record<string, any>,
144
+ ): ApiError {
145
+ return new ApiError(
146
+ message,
147
+ ApiErrorCode.INTERNAL_ERROR,
148
+ 500,
149
+ details,
150
+ false,
151
+ );
152
+ }
153
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Base Error class for all application errors
3
+ */
4
+ export class BaseError extends Error {
5
+ constructor(message: string) {
6
+ super(message);
7
+ this.name = this.constructor.name;
8
+ // Maintains proper stack trace for where our error was thrown
9
+ if (Error.captureStackTrace) {
10
+ Error.captureStackTrace(this, this.constructor);
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Error types for the Crosspost API
3
+ */
4
+
5
+ export * from './base-error.ts';
6
+ export * from './api-error.ts';
7
+ export * from './platform-error.ts';
@@ -0,0 +1,34 @@
1
+ import { ApiErrorCode } from './api-error.ts';
2
+ import type { PlatformName } from '../common.ts';
3
+ import type { StatusCode } from 'hono/utils/http-status';
4
+
5
+ /**
6
+ * Platform Error
7
+ * Custom error class for platform-specific errors
8
+ */
9
+ export class PlatformError extends Error {
10
+ public readonly code: ApiErrorCode;
11
+ public readonly recoverable: boolean;
12
+ public readonly platform: PlatformName;
13
+ public readonly userId?: string;
14
+ public readonly details?: Record<string, any>;
15
+
16
+ constructor(
17
+ message: string,
18
+ platform: PlatformName,
19
+ code: ApiErrorCode = ApiErrorCode.PLATFORM_ERROR,
20
+ recoverable: boolean = false,
21
+ public originalError?: unknown,
22
+ public status?: StatusCode,
23
+ userId?: string,
24
+ details?: Record<string, any>,
25
+ ) {
26
+ super(message);
27
+ this.name = 'PlatformError';
28
+ this.code = code;
29
+ this.recoverable = recoverable;
30
+ this.platform = platform;
31
+ this.userId = userId;
32
+ this.details = details;
33
+ }
34
+ }
package/src/index.ts ADDED
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @crosspost/types
3
+ * Shared TypeScript type definitions and Zod schemas for the Crosspost API ecosystem
4
+ */
5
+
6
+ // Export common types and schemas
7
+ export * from './common.ts';
8
+
9
+ // Export enhanced response types and schemas
10
+ export * from './response.ts';
11
+
12
+ // Export error types
13
+ export * from './errors/index.ts';
14
+
15
+ // Export domain-specific types and schemas
16
+ export * from './auth.ts';
17
+ export * from './post.ts';
18
+ export * from './rate-limit.ts';
19
+ export * from './leaderboard.ts';
20
+ export * from './user-profile.ts';
@@ -0,0 +1,179 @@
1
+ /**
2
+ * Leaderboard Schemas and Types
3
+ * Defines Zod schemas for leaderboard-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
+ * Leaderboard query schema
13
+ */
14
+ export const LeaderboardQuerySchema = z.object({
15
+ timeframe: z.enum(['day', 'week', 'month', 'all']).optional().describe(
16
+ 'Timeframe for the leaderboard',
17
+ ),
18
+ limit: z.string().optional()
19
+ .transform((val) => val ? parseInt(val, 10) : undefined)
20
+ .pipe(z.number().min(1).max(100).optional())
21
+ .describe('Maximum number of results to return (1-100)'),
22
+ offset: z.string().optional()
23
+ .transform((val) => val ? parseInt(val, 10) : undefined)
24
+ .pipe(z.number().min(0).optional())
25
+ .describe('Offset for pagination'),
26
+ }).describe('Leaderboard query');
27
+
28
+ /**
29
+ * Account activity entry schema
30
+ */
31
+ export const AccountActivityEntrySchema = z.object({
32
+ signerId: z.string().describe('NEAR account ID'),
33
+ totalPosts: z.number().describe('Total number of posts'),
34
+ totalLikes: z.number().describe('Total number of likes'),
35
+ totalReposts: z.number().describe('Total number of reposts'),
36
+ totalReplies: z.number().describe('Total number of replies'),
37
+ totalQuotes: z.number().describe('Total number of quote posts'),
38
+ totalScore: z.number().describe('Total activity score'),
39
+ rank: z.number().describe('Rank on the leaderboard'),
40
+ lastActive: z.string().datetime().describe('Timestamp of last activity'),
41
+ }).describe('Account activity entry');
42
+
43
+ /**
44
+ * Leaderboard response schema
45
+ */
46
+ export const LeaderboardResponseSchema = EnhancedResponseSchema(
47
+ z.object({
48
+ timeframe: z.enum(['day', 'week', 'month', 'all']).describe('Timeframe for the leaderboard'),
49
+ entries: z.array(AccountActivityEntrySchema).describe('Leaderboard entries'),
50
+ total: z.number().describe('Total number of entries in the leaderboard'),
51
+ limit: z.number().describe('Maximum number of results returned'),
52
+ offset: z.number().describe('Offset for pagination'),
53
+ generatedAt: z.string().datetime().describe('Timestamp when the leaderboard was generated'),
54
+ }),
55
+ ).describe('Leaderboard response');
56
+
57
+ /**
58
+ * Account activity params schema
59
+ */
60
+ export const AccountActivityParamsSchema = z.object({
61
+ signerId: z.string().describe('NEAR account ID'),
62
+ }).describe('Account activity params');
63
+
64
+ /**
65
+ * Account activity query schema
66
+ */
67
+ export const AccountActivityQuerySchema = z.object({
68
+ timeframe: z.enum(['day', 'week', 'month', 'all']).optional().describe(
69
+ 'Timeframe for the activity',
70
+ ),
71
+ }).describe('Account activity query');
72
+
73
+ /**
74
+ * Platform activity schema
75
+ */
76
+ export const PlatformActivitySchema = z.object({
77
+ platform: PlatformSchema,
78
+ posts: z.number().describe('Number of posts on this platform'),
79
+ likes: z.number().describe('Number of likes on this platform'),
80
+ reposts: z.number().describe('Number of reposts on this platform'),
81
+ replies: z.number().describe('Number of replies on this platform'),
82
+ quotes: z.number().describe('Number of quote posts on this platform'),
83
+ score: z.number().describe('Activity score on this platform'),
84
+ lastActive: z.string().datetime().describe('Timestamp of last activity on this platform'),
85
+ }).describe('Platform activity');
86
+
87
+ /**
88
+ * Account activity response schema
89
+ */
90
+ export const AccountActivityResponseSchema = EnhancedResponseSchema(
91
+ z.object({
92
+ signerId: z.string().describe('NEAR account ID'),
93
+ timeframe: z.enum(['day', 'week', 'month', 'all']).describe('Timeframe for the activity'),
94
+ totalPosts: z.number().describe('Total number of posts across all platforms'),
95
+ totalLikes: z.number().describe('Total number of likes across all platforms'),
96
+ totalReposts: z.number().describe('Total number of reposts across all platforms'),
97
+ totalReplies: z.number().describe('Total number of replies across all platforms'),
98
+ totalQuotes: z.number().describe('Total number of quote posts across all platforms'),
99
+ totalScore: z.number().describe('Total activity score across all platforms'),
100
+ rank: z.number().describe('Rank on the leaderboard'),
101
+ lastActive: z.string().datetime().describe('Timestamp of last activity across all platforms'),
102
+ platforms: z.array(PlatformActivitySchema).describe('Activity breakdown by platform'),
103
+ }),
104
+ ).describe('Account activity response');
105
+
106
+ /**
107
+ * Account posts params schema
108
+ */
109
+ export const AccountPostsParamsSchema = z.object({
110
+ signerId: z.string().describe('NEAR account ID'),
111
+ }).describe('Account posts params');
112
+
113
+ /**
114
+ * Account posts query schema
115
+ */
116
+ export const AccountPostsQuerySchema = z.object({
117
+ platform: z.string().optional().describe('Filter by platform (optional)'),
118
+ limit: z.string().optional()
119
+ .transform((val) => val ? parseInt(val, 10) : undefined)
120
+ .pipe(z.number().min(1).max(100).optional())
121
+ .describe('Maximum number of results to return (1-100)'),
122
+ offset: z.string().optional()
123
+ .transform((val) => val ? parseInt(val, 10) : undefined)
124
+ .pipe(z.number().min(0).optional())
125
+ .describe('Offset for pagination'),
126
+ type: z.enum(['post', 'repost', 'reply', 'quote', 'like', 'all']).optional().describe(
127
+ 'Filter by post type (optional)',
128
+ ),
129
+ }).describe('Account posts query');
130
+
131
+ /**
132
+ * Account post schema
133
+ */
134
+ export const AccountPostSchema = z.object({
135
+ id: z.string().describe('Post ID'),
136
+ platform: PlatformSchema,
137
+ type: z.enum(['post', 'repost', 'reply', 'quote', 'like']).describe('Type of post'),
138
+ content: z.string().optional().describe('Post content (if available)'),
139
+ url: z.string().url().optional().describe('URL to the post on the platform (if available)'),
140
+ createdAt: z.string().datetime().describe('Timestamp when the post was created'),
141
+ metrics: z.object({
142
+ likes: z.number().optional().describe('Number of likes (if available)'),
143
+ reposts: z.number().optional().describe('Number of reposts (if available)'),
144
+ replies: z.number().optional().describe('Number of replies (if available)'),
145
+ quotes: z.number().optional().describe('Number of quotes (if available)'),
146
+ }).optional().describe('Post metrics (if available)'),
147
+ inReplyToId: z.string().optional().describe('ID of the post this is a reply to (if applicable)'),
148
+ quotedPostId: z.string().optional().describe('ID of the post this is quoting (if applicable)'),
149
+ }).describe('Account post');
150
+
151
+ /**
152
+ * Account posts response schema
153
+ */
154
+ export const AccountPostsResponseSchema = EnhancedResponseSchema(
155
+ z.object({
156
+ signerId: z.string().describe('NEAR account ID'),
157
+ posts: z.array(AccountPostSchema).describe('List of posts'),
158
+ total: z.number().describe('Total number of posts matching the query'),
159
+ limit: z.number().describe('Maximum number of results returned'),
160
+ offset: z.number().describe('Offset for pagination'),
161
+ platform: z.string().optional().describe('Platform filter (if applied)'),
162
+ type: z.enum(['post', 'repost', 'reply', 'quote', 'like', 'all']).optional().describe(
163
+ 'Post type filter (if applied)',
164
+ ),
165
+ }),
166
+ ).describe('Account posts response');
167
+
168
+ // Derive TypeScript types from Zod schemas
169
+ export type LeaderboardQuery = z.infer<typeof LeaderboardQuerySchema>;
170
+ export type AccountActivityEntry = z.infer<typeof AccountActivityEntrySchema>;
171
+ export type LeaderboardResponse = z.infer<typeof LeaderboardResponseSchema>;
172
+ export type AccountActivityParams = z.infer<typeof AccountActivityParamsSchema>;
173
+ export type AccountActivityQuery = z.infer<typeof AccountActivityQuerySchema>;
174
+ export type PlatformActivity = z.infer<typeof PlatformActivitySchema>;
175
+ export type AccountActivityResponse = z.infer<typeof AccountActivityResponseSchema>;
176
+ export type AccountPostsParams = z.infer<typeof AccountPostsParamsSchema>;
177
+ export type AccountPostsQuery = z.infer<typeof AccountPostsQuerySchema>;
178
+ export type AccountPost = z.infer<typeof AccountPostSchema>;
179
+ export type AccountPostsResponse = z.infer<typeof AccountPostsResponseSchema>;