@crosspost/types 0.1.10 → 0.1.11
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 +276 -275
- package/dist/index.d.cts +124 -36
- package/dist/index.d.ts +124 -36
- package/dist/index.js +276 -275
- package/package.json +1 -1
- package/src/auth.ts +3 -3
package/dist/index.js
CHANGED
@@ -116,198 +116,214 @@ var MultiStatusDataSchema = z3.object({
|
|
116
116
|
});
|
117
117
|
|
118
118
|
// src/auth.ts
|
119
|
+
import { z as z5 } from "zod";
|
120
|
+
|
121
|
+
// src/user-profile.ts
|
119
122
|
import { z as z4 } from "zod";
|
120
|
-
var
|
121
|
-
|
123
|
+
var UserProfileSchema = z4.object({
|
124
|
+
userId: z4.string().describe("User ID on the platform"),
|
125
|
+
username: z4.string().describe("Username on the platform"),
|
126
|
+
url: z4.string().url().optional().describe("URL to the user profile"),
|
127
|
+
profileImageUrl: z4.string().describe("URL to the user profile image"),
|
128
|
+
isPremium: z4.boolean().optional().describe("Whether the user has a premium account"),
|
129
|
+
platform: PlatformSchema.describe("The platform the user profile is from"),
|
130
|
+
lastUpdated: z4.number().describe("Timestamp when the profile was last updated")
|
131
|
+
}).describe("User profile");
|
132
|
+
var ProfileRefreshResponseSchema = z4.object({
|
133
|
+
profile: UserProfileSchema.optional().describe("The refreshed user profile (if successful)")
|
134
|
+
}).describe("Profile refresh response");
|
135
|
+
|
136
|
+
// src/auth.ts
|
137
|
+
var PlatformParamSchema = z5.object({
|
138
|
+
platform: z5.string().describe("Social media platform")
|
122
139
|
}).describe("Platform parameter");
|
123
|
-
var AuthInitRequestSchema =
|
124
|
-
successUrl:
|
140
|
+
var AuthInitRequestSchema = z5.object({
|
141
|
+
successUrl: z5.string().url().optional().describe(
|
125
142
|
"URL to redirect to on successful authentication"
|
126
143
|
),
|
127
|
-
errorUrl:
|
128
|
-
redirect:
|
144
|
+
errorUrl: z5.string().url().optional().describe("URL to redirect to on authentication error"),
|
145
|
+
redirect: z5.boolean().optional().default(false).describe(
|
129
146
|
"Whether to redirect to successUrl/errorUrl (true) or return data directly (false)"
|
130
147
|
)
|
131
148
|
}).describe("Auth initialization request");
|
132
|
-
var AuthUrlResponseSchema =
|
133
|
-
url:
|
134
|
-
state:
|
149
|
+
var AuthUrlResponseSchema = z5.object({
|
150
|
+
url: z5.string().describe("Authentication URL to redirect the user to"),
|
151
|
+
state: z5.string().describe("State parameter for CSRF protection"),
|
135
152
|
platform: PlatformSchema
|
136
153
|
}).describe("Auth URL response");
|
137
|
-
var AuthCallbackQuerySchema =
|
138
|
-
code:
|
139
|
-
state:
|
154
|
+
var AuthCallbackQuerySchema = z5.object({
|
155
|
+
code: z5.string().describe("Authorization code from OAuth provider"),
|
156
|
+
state: z5.string().describe("State parameter for CSRF protection")
|
140
157
|
}).describe("Auth callback query");
|
141
|
-
var AuthCallbackResponseSchema =
|
158
|
+
var AuthCallbackResponseSchema = z5.object({
|
142
159
|
platform: PlatformSchema,
|
143
|
-
userId:
|
144
|
-
redirectUrl:
|
160
|
+
userId: z5.string().describe("User ID"),
|
161
|
+
redirectUrl: z5.string().optional().describe("URL to redirect the user to after authentication")
|
145
162
|
}).describe("Auth callback response");
|
146
|
-
var AuthStatusParamsSchema =
|
147
|
-
platform:
|
148
|
-
userId:
|
163
|
+
var AuthStatusParamsSchema = z5.object({
|
164
|
+
platform: z5.string().describe("Social media platform"),
|
165
|
+
userId: z5.string().describe("User ID on the platform")
|
149
166
|
}).describe("Token status parameters");
|
150
|
-
var NearUnauthorizationResponseSchema =
|
151
|
-
success:
|
152
|
-
nearAccount:
|
167
|
+
var NearUnauthorizationResponseSchema = z5.object({
|
168
|
+
success: z5.boolean().describe("Whether the unauthorized operation was successful"),
|
169
|
+
nearAccount: z5.string().describe("NEAR account ID that was unauthorized")
|
153
170
|
}).describe("NEAR unauthorized response");
|
154
|
-
var AuthStatusResponseSchema =
|
171
|
+
var AuthStatusResponseSchema = z5.object({
|
155
172
|
platform: PlatformSchema,
|
156
|
-
userId:
|
157
|
-
authenticated:
|
158
|
-
tokenStatus:
|
159
|
-
valid:
|
160
|
-
expired:
|
161
|
-
expiresAt:
|
173
|
+
userId: z5.string().describe("User ID"),
|
174
|
+
authenticated: z5.boolean().describe("Whether the user is authenticated"),
|
175
|
+
tokenStatus: z5.object({
|
176
|
+
valid: z5.boolean().describe("Whether the token is valid"),
|
177
|
+
expired: z5.boolean().describe("Whether the token is expired"),
|
178
|
+
expiresAt: z5.string().optional().describe("When the token expires")
|
162
179
|
})
|
163
180
|
}).describe("Auth status response");
|
164
|
-
var AuthTokenRequestSchema =
|
165
|
-
userId:
|
181
|
+
var AuthTokenRequestSchema = z5.object({
|
182
|
+
userId: z5.string().describe("User ID on the platform")
|
166
183
|
}).describe("Auth token request");
|
167
|
-
var AuthRevokeResponseSchema =
|
184
|
+
var AuthRevokeResponseSchema = z5.object({
|
168
185
|
platform: PlatformSchema,
|
169
|
-
userId:
|
186
|
+
userId: z5.string().describe("User ID")
|
170
187
|
}).describe("Auth revoke response");
|
171
|
-
var ConnectedAccountSchema =
|
188
|
+
var ConnectedAccountSchema = z5.object({
|
172
189
|
platform: PlatformSchema,
|
173
|
-
userId:
|
174
|
-
|
175
|
-
|
176
|
-
connectedAt: z4.string().optional().describe("When the account was connected")
|
190
|
+
userId: z5.string().describe("User ID on the platform"),
|
191
|
+
connectedAt: z5.string().describe("When the account was connected"),
|
192
|
+
profile: UserProfileSchema.nullable().describe("Full user profile data")
|
177
193
|
}).describe("Connected account");
|
178
|
-
var ConnectedAccountsResponseSchema =
|
179
|
-
accounts:
|
194
|
+
var ConnectedAccountsResponseSchema = z5.object({
|
195
|
+
accounts: z5.array(ConnectedAccountSchema)
|
180
196
|
}).describe("Response containing an array of connected accounts");
|
181
|
-
var NearAuthorizationRequestSchema =
|
197
|
+
var NearAuthorizationRequestSchema = z5.object({
|
182
198
|
// No additional parameters needed, as the NEAR account ID is extracted from the signature
|
183
199
|
}).describe("NEAR authorization request");
|
184
|
-
var NearAuthorizationResponseSchema =
|
185
|
-
nearAccount:
|
186
|
-
authorized:
|
200
|
+
var NearAuthorizationResponseSchema = z5.object({
|
201
|
+
nearAccount: z5.string().describe("NEAR account ID"),
|
202
|
+
authorized: z5.boolean().describe("Whether the account is authorized")
|
187
203
|
}).describe("NEAR authorization response");
|
188
|
-
var NearAuthorizationStatusResponseSchema =
|
189
|
-
nearAccount:
|
190
|
-
authorized:
|
191
|
-
authorizedAt:
|
204
|
+
var NearAuthorizationStatusResponseSchema = z5.object({
|
205
|
+
nearAccount: z5.string().describe("NEAR account ID"),
|
206
|
+
authorized: z5.boolean().describe("Whether the account is authorized"),
|
207
|
+
authorizedAt: z5.string().optional().describe("When the account was authorized")
|
192
208
|
}).describe("NEAR authorization status response");
|
193
209
|
|
194
210
|
// src/post.ts
|
195
|
-
import { z as
|
196
|
-
var MediaContentSchema =
|
197
|
-
data:
|
198
|
-
mimeType:
|
199
|
-
altText:
|
211
|
+
import { z as z6 } from "zod";
|
212
|
+
var MediaContentSchema = z6.object({
|
213
|
+
data: z6.union([z6.string(), z6.instanceof(Blob)]).describe("Media data as string or Blob"),
|
214
|
+
mimeType: z6.string().optional().describe("Media MIME type"),
|
215
|
+
altText: z6.string().optional().describe("Alt text for the media")
|
200
216
|
}).describe("Media content object");
|
201
|
-
var MediaSchema =
|
202
|
-
id:
|
203
|
-
type:
|
204
|
-
url:
|
205
|
-
altText:
|
217
|
+
var MediaSchema = z6.object({
|
218
|
+
id: z6.string().describe("Media ID"),
|
219
|
+
type: z6.enum(["image", "video", "gif"]).describe("Media type"),
|
220
|
+
url: z6.string().optional().describe("Media URL"),
|
221
|
+
altText: z6.string().optional().describe("Alt text for the media")
|
206
222
|
}).describe("Media object");
|
207
|
-
var PostMetricsSchema =
|
208
|
-
retweets:
|
209
|
-
quotes:
|
210
|
-
likes:
|
211
|
-
replies:
|
223
|
+
var PostMetricsSchema = z6.object({
|
224
|
+
retweets: z6.number().describe("Number of retweets"),
|
225
|
+
quotes: z6.number().describe("Number of quotes"),
|
226
|
+
likes: z6.number().describe("Number of likes"),
|
227
|
+
replies: z6.number().describe("Number of replies")
|
212
228
|
}).describe("Post metrics");
|
213
|
-
var PostSchema =
|
214
|
-
id:
|
215
|
-
text:
|
216
|
-
createdAt:
|
217
|
-
authorId:
|
218
|
-
media:
|
229
|
+
var PostSchema = z6.object({
|
230
|
+
id: z6.string().describe("Post ID"),
|
231
|
+
text: z6.string().describe("Post text content"),
|
232
|
+
createdAt: z6.string().describe("Post creation date"),
|
233
|
+
authorId: z6.string().describe("Author ID"),
|
234
|
+
media: z6.array(MediaSchema).optional().describe("Media attached to the post"),
|
219
235
|
metrics: PostMetricsSchema.optional().describe("Post metrics"),
|
220
|
-
inReplyToId:
|
221
|
-
quotedPostId:
|
236
|
+
inReplyToId: z6.string().optional().describe("ID of the post this is a reply to"),
|
237
|
+
quotedPostId: z6.string().optional().describe("ID of the post this is quoting")
|
222
238
|
}).describe("Post object");
|
223
|
-
var PostContentSchema =
|
224
|
-
text:
|
225
|
-
media:
|
239
|
+
var PostContentSchema = z6.object({
|
240
|
+
text: z6.string().optional().describe("Text content for the post"),
|
241
|
+
media: z6.array(MediaContentSchema).optional().describe("Media attachments for the post")
|
226
242
|
}).describe("Post content");
|
227
|
-
var PostResultSchema =
|
228
|
-
id:
|
229
|
-
text:
|
230
|
-
createdAt:
|
231
|
-
mediaIds:
|
232
|
-
threadIds:
|
233
|
-
quotedPostId:
|
234
|
-
inReplyToId:
|
235
|
-
success:
|
236
|
-
}).catchall(
|
237
|
-
var DeleteResultSchema =
|
238
|
-
success:
|
239
|
-
id:
|
243
|
+
var PostResultSchema = z6.object({
|
244
|
+
id: z6.string().describe("Post ID"),
|
245
|
+
text: z6.string().optional().describe("Post text content"),
|
246
|
+
createdAt: z6.string().describe("Post creation date"),
|
247
|
+
mediaIds: z6.array(z6.string()).optional().describe("Media IDs attached to the post"),
|
248
|
+
threadIds: z6.array(z6.string()).optional().describe("Thread IDs for threaded posts"),
|
249
|
+
quotedPostId: z6.string().optional().describe("ID of the post this is quoting"),
|
250
|
+
inReplyToId: z6.string().optional().describe("ID of the post this is a reply to"),
|
251
|
+
success: z6.boolean().optional().describe("Whether the operation was successful")
|
252
|
+
}).catchall(z6.any()).describe("Post result");
|
253
|
+
var DeleteResultSchema = z6.object({
|
254
|
+
success: z6.boolean().describe("Whether the deletion was successful"),
|
255
|
+
id: z6.string().describe("ID of the deleted post")
|
240
256
|
}).describe("Delete result");
|
241
|
-
var LikeResultSchema =
|
242
|
-
success:
|
243
|
-
id:
|
257
|
+
var LikeResultSchema = z6.object({
|
258
|
+
success: z6.boolean().describe("Whether the like was successful"),
|
259
|
+
id: z6.string().describe("ID of the liked post")
|
244
260
|
}).describe("Like result");
|
245
|
-
var PostSuccessDetailSchema =
|
261
|
+
var PostSuccessDetailSchema = z6.object({
|
246
262
|
platform: PlatformSchema,
|
247
|
-
userId:
|
248
|
-
status:
|
249
|
-
postId:
|
250
|
-
postUrl:
|
251
|
-
}).catchall(
|
252
|
-
var TargetSchema =
|
263
|
+
userId: z6.string().describe("User ID"),
|
264
|
+
status: z6.literal("success"),
|
265
|
+
postId: z6.string().optional().describe("Post ID"),
|
266
|
+
postUrl: z6.string().optional().describe("URL to the post")
|
267
|
+
}).catchall(z6.any()).describe("Post success detail");
|
268
|
+
var TargetSchema = z6.object({
|
253
269
|
platform: PlatformSchema.describe('The platform to post to (e.g., "twitter")'),
|
254
|
-
userId:
|
270
|
+
userId: z6.string().describe("User ID on the platform")
|
255
271
|
}).describe("Target for posting operations");
|
256
|
-
var CreatePostRequestSchema =
|
257
|
-
targets:
|
258
|
-
content:
|
272
|
+
var CreatePostRequestSchema = z6.object({
|
273
|
+
targets: z6.array(TargetSchema).describe("Array of targets to post to (can be a single target)"),
|
274
|
+
content: z6.array(PostContentSchema).describe(
|
259
275
|
"The content of the post, always an array of PostContent objects, even for a single post"
|
260
276
|
)
|
261
277
|
}).describe("Create post request");
|
262
|
-
var RepostRequestSchema =
|
263
|
-
targets:
|
278
|
+
var RepostRequestSchema = z6.object({
|
279
|
+
targets: z6.array(TargetSchema).describe("Array of targets to post to"),
|
264
280
|
platform: PlatformSchema.describe("Platform of the post being reposted"),
|
265
|
-
postId:
|
281
|
+
postId: z6.string().describe("ID of the post to repost")
|
266
282
|
}).describe("Repost request");
|
267
|
-
var QuotePostRequestSchema =
|
268
|
-
targets:
|
283
|
+
var QuotePostRequestSchema = z6.object({
|
284
|
+
targets: z6.array(TargetSchema).describe(
|
269
285
|
"Array of targets to post to (must be on the same platform as the post being quoted)"
|
270
286
|
),
|
271
287
|
platform: PlatformSchema.describe("Platform of the post being quoted"),
|
272
|
-
postId:
|
273
|
-
content:
|
288
|
+
postId: z6.string().describe("ID of the post to quote"),
|
289
|
+
content: z6.array(PostContentSchema).describe(
|
274
290
|
"Content for the quote post(s), always an array, even for a single post"
|
275
291
|
)
|
276
292
|
}).describe("Quote post request");
|
277
|
-
var ReplyToPostRequestSchema =
|
278
|
-
targets:
|
293
|
+
var ReplyToPostRequestSchema = z6.object({
|
294
|
+
targets: z6.array(TargetSchema).describe(
|
279
295
|
"Array of targets to post to (must be on the same platform as the post being replied to)"
|
280
296
|
),
|
281
297
|
platform: PlatformSchema.describe("Platform of the post being replied to"),
|
282
|
-
postId:
|
283
|
-
content:
|
298
|
+
postId: z6.string().describe("ID of the post to reply to"),
|
299
|
+
content: z6.array(PostContentSchema).describe(
|
284
300
|
"Content for the reply post(s), always an array, even for a single post"
|
285
301
|
)
|
286
302
|
}).describe("Reply to post request");
|
287
|
-
var PostToDeleteSchema =
|
303
|
+
var PostToDeleteSchema = z6.object({
|
288
304
|
platform: PlatformSchema.describe("Platform of the post to delete"),
|
289
|
-
userId:
|
290
|
-
postId:
|
305
|
+
userId: z6.string().describe("User ID on the platform"),
|
306
|
+
postId: z6.string().describe("ID of the post to delete")
|
291
307
|
}).describe("Post to delete");
|
292
|
-
var DeletePostRequestSchema =
|
293
|
-
targets:
|
294
|
-
posts:
|
308
|
+
var DeletePostRequestSchema = z6.object({
|
309
|
+
targets: z6.array(TargetSchema).describe("Array of targets to delete posts"),
|
310
|
+
posts: z6.array(PostToDeleteSchema).describe("Array of posts to delete")
|
295
311
|
}).describe("Delete post request");
|
296
|
-
var LikePostRequestSchema =
|
297
|
-
targets:
|
312
|
+
var LikePostRequestSchema = z6.object({
|
313
|
+
targets: z6.array(TargetSchema).describe(
|
298
314
|
"Array of targets to like the post (must be on the same platform as the post being liked)"
|
299
315
|
),
|
300
316
|
platform: PlatformSchema.describe("Platform of the post being liked"),
|
301
|
-
postId:
|
317
|
+
postId: z6.string().describe("ID of the post to like")
|
302
318
|
}).describe("Like post request");
|
303
|
-
var UnlikePostRequestSchema =
|
304
|
-
targets:
|
319
|
+
var UnlikePostRequestSchema = z6.object({
|
320
|
+
targets: z6.array(TargetSchema).describe(
|
305
321
|
"Array of targets to unlike the post (must be on the same platform as the post being unliked)"
|
306
322
|
),
|
307
323
|
platform: PlatformSchema.describe("Platform of the post being unliked"),
|
308
|
-
postId:
|
324
|
+
postId: z6.string().describe("ID of the post to unlike")
|
309
325
|
}).describe("Unlike post request");
|
310
|
-
var PostResponseSchema =
|
326
|
+
var PostResponseSchema = z6.union([PostSchema, z6.array(PostSchema)]).describe(
|
311
327
|
"Post response"
|
312
328
|
);
|
313
329
|
var CreatePostResponseSchema = PostResponseSchema.describe(
|
@@ -316,115 +332,115 @@ var CreatePostResponseSchema = PostResponseSchema.describe(
|
|
316
332
|
var RepostResponseSchema = PostResponseSchema.describe("Repost response");
|
317
333
|
var QuotePostResponseSchema = PostResponseSchema.describe("Quote post response");
|
318
334
|
var ReplyToPostResponseSchema = PostResponseSchema.describe("Reply to post response");
|
319
|
-
var DeletePostResponseSchema =
|
320
|
-
id:
|
335
|
+
var DeletePostResponseSchema = z6.object({
|
336
|
+
id: z6.string().describe("ID of the deleted post")
|
321
337
|
}).describe("Delete post response");
|
322
|
-
var LikePostResponseSchema =
|
323
|
-
id:
|
338
|
+
var LikePostResponseSchema = z6.object({
|
339
|
+
id: z6.string().describe("ID of the liked post")
|
324
340
|
}).describe("Like post response");
|
325
|
-
var UnlikePostResponseSchema =
|
326
|
-
id:
|
341
|
+
var UnlikePostResponseSchema = z6.object({
|
342
|
+
id: z6.string().describe("ID of the unliked post")
|
327
343
|
}).describe("Unlike post response");
|
328
|
-
var PostMultiStatusResponseSchema =
|
329
|
-
summary:
|
330
|
-
total:
|
331
|
-
succeeded:
|
332
|
-
failed:
|
344
|
+
var PostMultiStatusResponseSchema = z6.object({
|
345
|
+
summary: z6.object({
|
346
|
+
total: z6.number().describe("Total number of operations"),
|
347
|
+
succeeded: z6.number().describe("Number of successful operations"),
|
348
|
+
failed: z6.number().describe("Number of failed operations")
|
333
349
|
}),
|
334
|
-
results:
|
335
|
-
errors:
|
350
|
+
results: z6.array(PostSuccessDetailSchema).describe("Successful operations"),
|
351
|
+
errors: z6.array(ErrorDetailSchema).describe("Failed operations")
|
336
352
|
}).describe("Multi-status response for post operations");
|
337
353
|
|
338
354
|
// src/rate-limit.ts
|
339
|
-
import { z as
|
340
|
-
var RateLimitEndpointParamSchema =
|
341
|
-
endpoint:
|
355
|
+
import { z as z7 } from "zod";
|
356
|
+
var RateLimitEndpointParamSchema = z7.object({
|
357
|
+
endpoint: z7.string().optional().describe(
|
342
358
|
"Specific endpoint to get rate limit information for (optional)"
|
343
359
|
)
|
344
360
|
}).describe("Rate limit endpoint parameter");
|
345
|
-
var RateLimitEndpointSchema =
|
346
|
-
endpoint:
|
347
|
-
method:
|
348
|
-
limit:
|
349
|
-
remaining:
|
350
|
-
reset:
|
351
|
-
resetDate:
|
361
|
+
var RateLimitEndpointSchema = z7.object({
|
362
|
+
endpoint: z7.string().describe("API endpoint"),
|
363
|
+
method: z7.enum(["GET", "POST", "PUT", "DELETE"]).describe("HTTP method"),
|
364
|
+
limit: z7.number().describe("Rate limit"),
|
365
|
+
remaining: z7.number().describe("Remaining requests"),
|
366
|
+
reset: z7.number().describe("Reset timestamp (Unix timestamp in seconds)"),
|
367
|
+
resetDate: z7.string().describe("Reset date (ISO string)")
|
352
368
|
}).describe("Rate limit endpoint");
|
353
|
-
var RateLimitStatusSchema =
|
354
|
-
endpoint:
|
355
|
-
limit:
|
356
|
-
remaining:
|
357
|
-
reset:
|
358
|
-
resetSeconds:
|
369
|
+
var RateLimitStatusSchema = z7.object({
|
370
|
+
endpoint: z7.string().describe("API endpoint or action"),
|
371
|
+
limit: z7.number().describe("Maximum number of requests allowed in the time window"),
|
372
|
+
remaining: z7.number().describe("Number of requests remaining in the current time window"),
|
373
|
+
reset: z7.string().datetime().describe("Timestamp when the rate limit will reset"),
|
374
|
+
resetSeconds: z7.number().describe("Seconds until the rate limit will reset")
|
359
375
|
}).describe("Rate limit status");
|
360
|
-
var PlatformRateLimitSchema =
|
376
|
+
var PlatformRateLimitSchema = z7.object({
|
361
377
|
platform: PlatformSchema,
|
362
|
-
endpoints:
|
378
|
+
endpoints: z7.record(z7.string(), RateLimitStatusSchema).describe(
|
363
379
|
"Rate limit status for each endpoint"
|
364
380
|
)
|
365
381
|
}).describe("Platform-specific rate limit");
|
366
|
-
var UsageRateLimitSchema =
|
367
|
-
endpoint:
|
368
|
-
limit:
|
369
|
-
remaining:
|
370
|
-
reset:
|
371
|
-
resetSeconds:
|
372
|
-
timeWindow:
|
382
|
+
var UsageRateLimitSchema = z7.object({
|
383
|
+
endpoint: z7.string().describe("API endpoint or action"),
|
384
|
+
limit: z7.number().describe("Maximum number of requests allowed in the time window"),
|
385
|
+
remaining: z7.number().describe("Number of requests remaining in the current time window"),
|
386
|
+
reset: z7.string().datetime().describe("Timestamp when the rate limit will reset"),
|
387
|
+
resetSeconds: z7.number().describe("Seconds until the rate limit will reset"),
|
388
|
+
timeWindow: z7.string().describe("Time window for the rate limit")
|
373
389
|
}).describe("Usage rate limit");
|
374
|
-
var RateLimitStatusResponseSchema =
|
390
|
+
var RateLimitStatusResponseSchema = z7.object({
|
375
391
|
platform: PlatformSchema,
|
376
|
-
userId:
|
377
|
-
endpoints:
|
378
|
-
app:
|
379
|
-
limit:
|
380
|
-
remaining:
|
381
|
-
reset:
|
382
|
-
resetDate:
|
392
|
+
userId: z7.string().optional().describe("User ID"),
|
393
|
+
endpoints: z7.array(RateLimitEndpointSchema).describe("Rate limits for specific endpoints"),
|
394
|
+
app: z7.object({
|
395
|
+
limit: z7.number().describe("App-wide rate limit"),
|
396
|
+
remaining: z7.number().describe("Remaining requests"),
|
397
|
+
reset: z7.number().describe("Reset timestamp (Unix timestamp in seconds)"),
|
398
|
+
resetDate: z7.string().describe("Reset date (ISO string)")
|
383
399
|
}).optional().describe("App-wide rate limits")
|
384
400
|
}).describe("Rate limit status response");
|
385
|
-
var AllRateLimitsResponseSchema =
|
386
|
-
platforms:
|
401
|
+
var AllRateLimitsResponseSchema = z7.object({
|
402
|
+
platforms: z7.record(
|
387
403
|
PlatformSchema,
|
388
|
-
|
389
|
-
users:
|
390
|
-
|
391
|
-
|
392
|
-
endpoints:
|
404
|
+
z7.object({
|
405
|
+
users: z7.record(
|
406
|
+
z7.string(),
|
407
|
+
z7.object({
|
408
|
+
endpoints: z7.array(RateLimitEndpointSchema).describe(
|
393
409
|
"Rate limits for specific endpoints"
|
394
410
|
),
|
395
|
-
lastUpdated:
|
411
|
+
lastUpdated: z7.string().describe("Last updated date (ISO string)")
|
396
412
|
})
|
397
413
|
).describe("User-specific rate limits"),
|
398
|
-
app:
|
399
|
-
limit:
|
400
|
-
remaining:
|
401
|
-
reset:
|
402
|
-
resetDate:
|
414
|
+
app: z7.object({
|
415
|
+
limit: z7.number().describe("App-wide rate limit"),
|
416
|
+
remaining: z7.number().describe("Remaining requests"),
|
417
|
+
reset: z7.number().describe("Reset timestamp (Unix timestamp in seconds)"),
|
418
|
+
resetDate: z7.string().describe("Reset date (ISO string)")
|
403
419
|
}).optional().describe("App-wide rate limits")
|
404
420
|
})
|
405
421
|
).describe("Rate limits by platform")
|
406
422
|
}).describe("All rate limits response");
|
407
|
-
var RateLimitResponseSchema =
|
408
|
-
platformLimits:
|
409
|
-
usageLimits:
|
423
|
+
var RateLimitResponseSchema = z7.object({
|
424
|
+
platformLimits: z7.array(PlatformRateLimitSchema).describe("Platform-specific rate limits"),
|
425
|
+
usageLimits: z7.record(z7.string(), UsageRateLimitSchema).describe(
|
410
426
|
"Usage-based rate limits for the NEAR account"
|
411
427
|
),
|
412
|
-
signerId:
|
428
|
+
signerId: z7.string().describe("NEAR account ID")
|
413
429
|
}).describe("Rate limit response");
|
414
|
-
var EndpointRateLimitResponseSchema =
|
415
|
-
platformLimits:
|
416
|
-
|
430
|
+
var EndpointRateLimitResponseSchema = z7.object({
|
431
|
+
platformLimits: z7.array(
|
432
|
+
z7.object({
|
417
433
|
platform: PlatformSchema,
|
418
434
|
status: RateLimitStatusSchema.describe("Rate limit status for the endpoint")
|
419
435
|
})
|
420
436
|
).describe("Platform-specific rate limits for the endpoint"),
|
421
437
|
usageLimit: UsageRateLimitSchema.describe("Usage-based rate limit for the NEAR account"),
|
422
|
-
endpoint:
|
423
|
-
signerId:
|
438
|
+
endpoint: z7.string().describe("API endpoint or action"),
|
439
|
+
signerId: z7.string().describe("NEAR account ID")
|
424
440
|
}).describe("Endpoint rate limit response");
|
425
441
|
|
426
442
|
// src/activity.ts
|
427
|
-
import { z as
|
443
|
+
import { z as z8 } from "zod";
|
428
444
|
var TimePeriod = /* @__PURE__ */ ((TimePeriod2) => {
|
429
445
|
TimePeriod2["ALL"] = "all";
|
430
446
|
TimePeriod2["YEARLY"] = "year";
|
@@ -433,111 +449,96 @@ var TimePeriod = /* @__PURE__ */ ((TimePeriod2) => {
|
|
433
449
|
TimePeriod2["DAILY"] = "day";
|
434
450
|
return TimePeriod2;
|
435
451
|
})(TimePeriod || {});
|
436
|
-
var ActivityLeaderboardQuerySchema =
|
437
|
-
timeframe:
|
452
|
+
var ActivityLeaderboardQuerySchema = z8.object({
|
453
|
+
timeframe: z8.nativeEnum(TimePeriod).optional().describe(
|
438
454
|
"Timeframe for the leaderboard"
|
439
455
|
),
|
440
|
-
limit:
|
441
|
-
offset:
|
456
|
+
limit: z8.string().optional().transform((val) => val ? parseInt(val, 10) : void 0).pipe(z8.number().min(1).max(100).optional()).describe("Maximum number of results to return (1-100)"),
|
457
|
+
offset: z8.string().optional().transform((val) => val ? parseInt(val, 10) : void 0).pipe(z8.number().min(0).optional()).describe("Offset for pagination")
|
442
458
|
}).describe("Activity leaderboard query");
|
443
|
-
var AccountActivityEntrySchema =
|
444
|
-
signerId:
|
445
|
-
totalPosts:
|
446
|
-
totalLikes:
|
447
|
-
totalReposts:
|
448
|
-
totalReplies:
|
449
|
-
totalQuotes:
|
450
|
-
totalScore:
|
451
|
-
rank:
|
452
|
-
lastActive:
|
459
|
+
var AccountActivityEntrySchema = z8.object({
|
460
|
+
signerId: z8.string().describe("NEAR account ID"),
|
461
|
+
totalPosts: z8.number().describe("Total number of posts"),
|
462
|
+
totalLikes: z8.number().describe("Total number of likes"),
|
463
|
+
totalReposts: z8.number().describe("Total number of reposts"),
|
464
|
+
totalReplies: z8.number().describe("Total number of replies"),
|
465
|
+
totalQuotes: z8.number().describe("Total number of quote posts"),
|
466
|
+
totalScore: z8.number().describe("Total activity score"),
|
467
|
+
rank: z8.number().describe("Rank on the leaderboard"),
|
468
|
+
lastActive: z8.string().datetime().describe("Timestamp of last activity")
|
453
469
|
}).describe("Account activity entry");
|
454
|
-
var ActivityLeaderboardResponseSchema =
|
455
|
-
timeframe:
|
456
|
-
entries:
|
457
|
-
generatedAt:
|
470
|
+
var ActivityLeaderboardResponseSchema = z8.object({
|
471
|
+
timeframe: z8.nativeEnum(TimePeriod).describe("Timeframe for the leaderboard"),
|
472
|
+
entries: z8.array(AccountActivityEntrySchema).describe("Leaderboard entries"),
|
473
|
+
generatedAt: z8.string().datetime().describe("Timestamp when the leaderboard was generated"),
|
458
474
|
platform: PlatformSchema.optional().describe("Platform filter (if applied)")
|
459
475
|
});
|
460
|
-
var AccountActivityParamsSchema =
|
461
|
-
signerId:
|
476
|
+
var AccountActivityParamsSchema = z8.object({
|
477
|
+
signerId: z8.string().describe("NEAR account ID")
|
462
478
|
}).describe("Account activity params");
|
463
|
-
var AccountActivityQuerySchema =
|
464
|
-
timeframe:
|
479
|
+
var AccountActivityQuerySchema = z8.object({
|
480
|
+
timeframe: z8.nativeEnum(TimePeriod).optional().describe(
|
465
481
|
"Timeframe for the activity"
|
466
482
|
)
|
467
483
|
}).describe("Account activity query");
|
468
|
-
var PlatformActivitySchema =
|
484
|
+
var PlatformActivitySchema = z8.object({
|
469
485
|
platform: PlatformSchema,
|
470
|
-
posts:
|
471
|
-
likes:
|
472
|
-
reposts:
|
473
|
-
replies:
|
474
|
-
quotes:
|
475
|
-
score:
|
476
|
-
lastActive:
|
486
|
+
posts: z8.number().describe("Number of posts on this platform"),
|
487
|
+
likes: z8.number().describe("Number of likes on this platform"),
|
488
|
+
reposts: z8.number().describe("Number of reposts on this platform"),
|
489
|
+
replies: z8.number().describe("Number of replies on this platform"),
|
490
|
+
quotes: z8.number().describe("Number of quote posts on this platform"),
|
491
|
+
score: z8.number().describe("Activity score on this platform"),
|
492
|
+
lastActive: z8.string().datetime().describe("Timestamp of last activity on this platform")
|
477
493
|
}).describe("Platform activity");
|
478
|
-
var AccountActivityResponseSchema =
|
479
|
-
signerId:
|
480
|
-
timeframe:
|
481
|
-
totalPosts:
|
482
|
-
totalLikes:
|
483
|
-
totalReposts:
|
484
|
-
totalReplies:
|
485
|
-
totalQuotes:
|
486
|
-
totalScore:
|
487
|
-
rank:
|
488
|
-
lastActive:
|
489
|
-
platforms:
|
494
|
+
var AccountActivityResponseSchema = z8.object({
|
495
|
+
signerId: z8.string().describe("NEAR account ID"),
|
496
|
+
timeframe: z8.nativeEnum(TimePeriod).describe("Timeframe for the activity"),
|
497
|
+
totalPosts: z8.number().describe("Total number of posts across all platforms"),
|
498
|
+
totalLikes: z8.number().describe("Total number of likes across all platforms"),
|
499
|
+
totalReposts: z8.number().describe("Total number of reposts across all platforms"),
|
500
|
+
totalReplies: z8.number().describe("Total number of replies across all platforms"),
|
501
|
+
totalQuotes: z8.number().describe("Total number of quote posts across all platforms"),
|
502
|
+
totalScore: z8.number().describe("Total activity score across all platforms"),
|
503
|
+
rank: z8.number().describe("Rank on the leaderboard"),
|
504
|
+
lastActive: z8.string().datetime().describe("Timestamp of last activity across all platforms"),
|
505
|
+
platforms: z8.array(PlatformActivitySchema).describe("Activity breakdown by platform")
|
490
506
|
});
|
491
|
-
var AccountPostsParamsSchema =
|
492
|
-
signerId:
|
507
|
+
var AccountPostsParamsSchema = z8.object({
|
508
|
+
signerId: z8.string().describe("NEAR account ID")
|
493
509
|
}).describe("Account posts params");
|
494
|
-
var AccountPostsQuerySchema =
|
495
|
-
platform:
|
496
|
-
limit:
|
497
|
-
offset:
|
498
|
-
type:
|
510
|
+
var AccountPostsQuerySchema = z8.object({
|
511
|
+
platform: z8.string().optional().describe("Filter by platform (optional)"),
|
512
|
+
limit: z8.string().optional().transform((val) => val ? parseInt(val, 10) : void 0).pipe(z8.number().min(1).max(100).optional()).describe("Maximum number of results to return (1-100)"),
|
513
|
+
offset: z8.string().optional().transform((val) => val ? parseInt(val, 10) : void 0).pipe(z8.number().min(0).optional()).describe("Offset for pagination"),
|
514
|
+
type: z8.enum(["post", "repost", "reply", "quote", "like", "all"]).optional().describe(
|
499
515
|
"Filter by post type (optional)"
|
500
516
|
)
|
501
517
|
}).describe("Account posts query");
|
502
|
-
var AccountPostSchema =
|
503
|
-
id:
|
518
|
+
var AccountPostSchema = z8.object({
|
519
|
+
id: z8.string().describe("Post ID"),
|
504
520
|
platform: PlatformSchema,
|
505
|
-
type:
|
506
|
-
content:
|
507
|
-
url:
|
508
|
-
createdAt:
|
509
|
-
metrics:
|
510
|
-
likes:
|
511
|
-
reposts:
|
512
|
-
replies:
|
513
|
-
quotes:
|
521
|
+
type: z8.enum(["post", "repost", "reply", "quote", "like"]).describe("Type of post"),
|
522
|
+
content: z8.string().optional().describe("Post content (if available)"),
|
523
|
+
url: z8.string().url().optional().describe("URL to the post on the platform (if available)"),
|
524
|
+
createdAt: z8.string().datetime().describe("Timestamp when the post was created"),
|
525
|
+
metrics: z8.object({
|
526
|
+
likes: z8.number().optional().describe("Number of likes (if available)"),
|
527
|
+
reposts: z8.number().optional().describe("Number of reposts (if available)"),
|
528
|
+
replies: z8.number().optional().describe("Number of replies (if available)"),
|
529
|
+
quotes: z8.number().optional().describe("Number of quotes (if available)")
|
514
530
|
}).optional().describe("Post metrics (if available)"),
|
515
|
-
inReplyToId:
|
516
|
-
quotedPostId:
|
531
|
+
inReplyToId: z8.string().optional().describe("ID of the post this is a reply to (if applicable)"),
|
532
|
+
quotedPostId: z8.string().optional().describe("ID of the post this is quoting (if applicable)")
|
517
533
|
}).describe("Account post");
|
518
|
-
var AccountPostsResponseSchema =
|
519
|
-
signerId:
|
520
|
-
posts:
|
521
|
-
platform:
|
522
|
-
type:
|
534
|
+
var AccountPostsResponseSchema = z8.object({
|
535
|
+
signerId: z8.string().describe("NEAR account ID"),
|
536
|
+
posts: z8.array(AccountPostSchema).describe("List of posts"),
|
537
|
+
platform: z8.string().optional().describe("Platform filter (if applied)"),
|
538
|
+
type: z8.enum(["post", "repost", "reply", "quote", "like", "all"]).optional().describe(
|
523
539
|
"Post type filter (if applied)"
|
524
540
|
)
|
525
541
|
});
|
526
|
-
|
527
|
-
// src/user-profile.ts
|
528
|
-
import { z as z8 } from "zod";
|
529
|
-
var UserProfileSchema = z8.object({
|
530
|
-
userId: z8.string().describe("User ID on the platform"),
|
531
|
-
username: z8.string().describe("Username on the platform"),
|
532
|
-
url: z8.string().url().optional().describe("URL to the user profile"),
|
533
|
-
profileImageUrl: z8.string().describe("URL to the user profile image"),
|
534
|
-
isPremium: z8.boolean().optional().describe("Whether the user has a premium account"),
|
535
|
-
platform: PlatformSchema.describe("The platform the user profile is from"),
|
536
|
-
lastUpdated: z8.number().describe("Timestamp when the profile was last updated")
|
537
|
-
}).describe("User profile");
|
538
|
-
var ProfileRefreshResponseSchema = z8.object({
|
539
|
-
profile: UserProfileSchema.optional().describe("The refreshed user profile (if successful)")
|
540
|
-
}).describe("Profile refresh response");
|
541
542
|
export {
|
542
543
|
AccountActivityEntrySchema,
|
543
544
|
AccountActivityParamsSchema,
|