@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.cjs
CHANGED
@@ -216,198 +216,214 @@ var MultiStatusDataSchema = import_zod3.z.object({
|
|
216
216
|
});
|
217
217
|
|
218
218
|
// src/auth.ts
|
219
|
+
var import_zod5 = require("zod");
|
220
|
+
|
221
|
+
// src/user-profile.ts
|
219
222
|
var import_zod4 = require("zod");
|
220
|
-
var
|
221
|
-
|
223
|
+
var UserProfileSchema = import_zod4.z.object({
|
224
|
+
userId: import_zod4.z.string().describe("User ID on the platform"),
|
225
|
+
username: import_zod4.z.string().describe("Username on the platform"),
|
226
|
+
url: import_zod4.z.string().url().optional().describe("URL to the user profile"),
|
227
|
+
profileImageUrl: import_zod4.z.string().describe("URL to the user profile image"),
|
228
|
+
isPremium: import_zod4.z.boolean().optional().describe("Whether the user has a premium account"),
|
229
|
+
platform: PlatformSchema.describe("The platform the user profile is from"),
|
230
|
+
lastUpdated: import_zod4.z.number().describe("Timestamp when the profile was last updated")
|
231
|
+
}).describe("User profile");
|
232
|
+
var ProfileRefreshResponseSchema = import_zod4.z.object({
|
233
|
+
profile: UserProfileSchema.optional().describe("The refreshed user profile (if successful)")
|
234
|
+
}).describe("Profile refresh response");
|
235
|
+
|
236
|
+
// src/auth.ts
|
237
|
+
var PlatformParamSchema = import_zod5.z.object({
|
238
|
+
platform: import_zod5.z.string().describe("Social media platform")
|
222
239
|
}).describe("Platform parameter");
|
223
|
-
var AuthInitRequestSchema =
|
224
|
-
successUrl:
|
240
|
+
var AuthInitRequestSchema = import_zod5.z.object({
|
241
|
+
successUrl: import_zod5.z.string().url().optional().describe(
|
225
242
|
"URL to redirect to on successful authentication"
|
226
243
|
),
|
227
|
-
errorUrl:
|
228
|
-
redirect:
|
244
|
+
errorUrl: import_zod5.z.string().url().optional().describe("URL to redirect to on authentication error"),
|
245
|
+
redirect: import_zod5.z.boolean().optional().default(false).describe(
|
229
246
|
"Whether to redirect to successUrl/errorUrl (true) or return data directly (false)"
|
230
247
|
)
|
231
248
|
}).describe("Auth initialization request");
|
232
|
-
var AuthUrlResponseSchema =
|
233
|
-
url:
|
234
|
-
state:
|
249
|
+
var AuthUrlResponseSchema = import_zod5.z.object({
|
250
|
+
url: import_zod5.z.string().describe("Authentication URL to redirect the user to"),
|
251
|
+
state: import_zod5.z.string().describe("State parameter for CSRF protection"),
|
235
252
|
platform: PlatformSchema
|
236
253
|
}).describe("Auth URL response");
|
237
|
-
var AuthCallbackQuerySchema =
|
238
|
-
code:
|
239
|
-
state:
|
254
|
+
var AuthCallbackQuerySchema = import_zod5.z.object({
|
255
|
+
code: import_zod5.z.string().describe("Authorization code from OAuth provider"),
|
256
|
+
state: import_zod5.z.string().describe("State parameter for CSRF protection")
|
240
257
|
}).describe("Auth callback query");
|
241
|
-
var AuthCallbackResponseSchema =
|
258
|
+
var AuthCallbackResponseSchema = import_zod5.z.object({
|
242
259
|
platform: PlatformSchema,
|
243
|
-
userId:
|
244
|
-
redirectUrl:
|
260
|
+
userId: import_zod5.z.string().describe("User ID"),
|
261
|
+
redirectUrl: import_zod5.z.string().optional().describe("URL to redirect the user to after authentication")
|
245
262
|
}).describe("Auth callback response");
|
246
|
-
var AuthStatusParamsSchema =
|
247
|
-
platform:
|
248
|
-
userId:
|
263
|
+
var AuthStatusParamsSchema = import_zod5.z.object({
|
264
|
+
platform: import_zod5.z.string().describe("Social media platform"),
|
265
|
+
userId: import_zod5.z.string().describe("User ID on the platform")
|
249
266
|
}).describe("Token status parameters");
|
250
|
-
var NearUnauthorizationResponseSchema =
|
251
|
-
success:
|
252
|
-
nearAccount:
|
267
|
+
var NearUnauthorizationResponseSchema = import_zod5.z.object({
|
268
|
+
success: import_zod5.z.boolean().describe("Whether the unauthorized operation was successful"),
|
269
|
+
nearAccount: import_zod5.z.string().describe("NEAR account ID that was unauthorized")
|
253
270
|
}).describe("NEAR unauthorized response");
|
254
|
-
var AuthStatusResponseSchema =
|
271
|
+
var AuthStatusResponseSchema = import_zod5.z.object({
|
255
272
|
platform: PlatformSchema,
|
256
|
-
userId:
|
257
|
-
authenticated:
|
258
|
-
tokenStatus:
|
259
|
-
valid:
|
260
|
-
expired:
|
261
|
-
expiresAt:
|
273
|
+
userId: import_zod5.z.string().describe("User ID"),
|
274
|
+
authenticated: import_zod5.z.boolean().describe("Whether the user is authenticated"),
|
275
|
+
tokenStatus: import_zod5.z.object({
|
276
|
+
valid: import_zod5.z.boolean().describe("Whether the token is valid"),
|
277
|
+
expired: import_zod5.z.boolean().describe("Whether the token is expired"),
|
278
|
+
expiresAt: import_zod5.z.string().optional().describe("When the token expires")
|
262
279
|
})
|
263
280
|
}).describe("Auth status response");
|
264
|
-
var AuthTokenRequestSchema =
|
265
|
-
userId:
|
281
|
+
var AuthTokenRequestSchema = import_zod5.z.object({
|
282
|
+
userId: import_zod5.z.string().describe("User ID on the platform")
|
266
283
|
}).describe("Auth token request");
|
267
|
-
var AuthRevokeResponseSchema =
|
284
|
+
var AuthRevokeResponseSchema = import_zod5.z.object({
|
268
285
|
platform: PlatformSchema,
|
269
|
-
userId:
|
286
|
+
userId: import_zod5.z.string().describe("User ID")
|
270
287
|
}).describe("Auth revoke response");
|
271
|
-
var ConnectedAccountSchema =
|
288
|
+
var ConnectedAccountSchema = import_zod5.z.object({
|
272
289
|
platform: PlatformSchema,
|
273
|
-
userId:
|
274
|
-
|
275
|
-
|
276
|
-
connectedAt: import_zod4.z.string().optional().describe("When the account was connected")
|
290
|
+
userId: import_zod5.z.string().describe("User ID on the platform"),
|
291
|
+
connectedAt: import_zod5.z.string().describe("When the account was connected"),
|
292
|
+
profile: UserProfileSchema.nullable().describe("Full user profile data")
|
277
293
|
}).describe("Connected account");
|
278
|
-
var ConnectedAccountsResponseSchema =
|
279
|
-
accounts:
|
294
|
+
var ConnectedAccountsResponseSchema = import_zod5.z.object({
|
295
|
+
accounts: import_zod5.z.array(ConnectedAccountSchema)
|
280
296
|
}).describe("Response containing an array of connected accounts");
|
281
|
-
var NearAuthorizationRequestSchema =
|
297
|
+
var NearAuthorizationRequestSchema = import_zod5.z.object({
|
282
298
|
// No additional parameters needed, as the NEAR account ID is extracted from the signature
|
283
299
|
}).describe("NEAR authorization request");
|
284
|
-
var NearAuthorizationResponseSchema =
|
285
|
-
nearAccount:
|
286
|
-
authorized:
|
300
|
+
var NearAuthorizationResponseSchema = import_zod5.z.object({
|
301
|
+
nearAccount: import_zod5.z.string().describe("NEAR account ID"),
|
302
|
+
authorized: import_zod5.z.boolean().describe("Whether the account is authorized")
|
287
303
|
}).describe("NEAR authorization response");
|
288
|
-
var NearAuthorizationStatusResponseSchema =
|
289
|
-
nearAccount:
|
290
|
-
authorized:
|
291
|
-
authorizedAt:
|
304
|
+
var NearAuthorizationStatusResponseSchema = import_zod5.z.object({
|
305
|
+
nearAccount: import_zod5.z.string().describe("NEAR account ID"),
|
306
|
+
authorized: import_zod5.z.boolean().describe("Whether the account is authorized"),
|
307
|
+
authorizedAt: import_zod5.z.string().optional().describe("When the account was authorized")
|
292
308
|
}).describe("NEAR authorization status response");
|
293
309
|
|
294
310
|
// src/post.ts
|
295
|
-
var
|
296
|
-
var MediaContentSchema =
|
297
|
-
data:
|
298
|
-
mimeType:
|
299
|
-
altText:
|
311
|
+
var import_zod6 = require("zod");
|
312
|
+
var MediaContentSchema = import_zod6.z.object({
|
313
|
+
data: import_zod6.z.union([import_zod6.z.string(), import_zod6.z.instanceof(Blob)]).describe("Media data as string or Blob"),
|
314
|
+
mimeType: import_zod6.z.string().optional().describe("Media MIME type"),
|
315
|
+
altText: import_zod6.z.string().optional().describe("Alt text for the media")
|
300
316
|
}).describe("Media content object");
|
301
|
-
var MediaSchema =
|
302
|
-
id:
|
303
|
-
type:
|
304
|
-
url:
|
305
|
-
altText:
|
317
|
+
var MediaSchema = import_zod6.z.object({
|
318
|
+
id: import_zod6.z.string().describe("Media ID"),
|
319
|
+
type: import_zod6.z.enum(["image", "video", "gif"]).describe("Media type"),
|
320
|
+
url: import_zod6.z.string().optional().describe("Media URL"),
|
321
|
+
altText: import_zod6.z.string().optional().describe("Alt text for the media")
|
306
322
|
}).describe("Media object");
|
307
|
-
var PostMetricsSchema =
|
308
|
-
retweets:
|
309
|
-
quotes:
|
310
|
-
likes:
|
311
|
-
replies:
|
323
|
+
var PostMetricsSchema = import_zod6.z.object({
|
324
|
+
retweets: import_zod6.z.number().describe("Number of retweets"),
|
325
|
+
quotes: import_zod6.z.number().describe("Number of quotes"),
|
326
|
+
likes: import_zod6.z.number().describe("Number of likes"),
|
327
|
+
replies: import_zod6.z.number().describe("Number of replies")
|
312
328
|
}).describe("Post metrics");
|
313
|
-
var PostSchema =
|
314
|
-
id:
|
315
|
-
text:
|
316
|
-
createdAt:
|
317
|
-
authorId:
|
318
|
-
media:
|
329
|
+
var PostSchema = import_zod6.z.object({
|
330
|
+
id: import_zod6.z.string().describe("Post ID"),
|
331
|
+
text: import_zod6.z.string().describe("Post text content"),
|
332
|
+
createdAt: import_zod6.z.string().describe("Post creation date"),
|
333
|
+
authorId: import_zod6.z.string().describe("Author ID"),
|
334
|
+
media: import_zod6.z.array(MediaSchema).optional().describe("Media attached to the post"),
|
319
335
|
metrics: PostMetricsSchema.optional().describe("Post metrics"),
|
320
|
-
inReplyToId:
|
321
|
-
quotedPostId:
|
336
|
+
inReplyToId: import_zod6.z.string().optional().describe("ID of the post this is a reply to"),
|
337
|
+
quotedPostId: import_zod6.z.string().optional().describe("ID of the post this is quoting")
|
322
338
|
}).describe("Post object");
|
323
|
-
var PostContentSchema =
|
324
|
-
text:
|
325
|
-
media:
|
339
|
+
var PostContentSchema = import_zod6.z.object({
|
340
|
+
text: import_zod6.z.string().optional().describe("Text content for the post"),
|
341
|
+
media: import_zod6.z.array(MediaContentSchema).optional().describe("Media attachments for the post")
|
326
342
|
}).describe("Post content");
|
327
|
-
var PostResultSchema =
|
328
|
-
id:
|
329
|
-
text:
|
330
|
-
createdAt:
|
331
|
-
mediaIds:
|
332
|
-
threadIds:
|
333
|
-
quotedPostId:
|
334
|
-
inReplyToId:
|
335
|
-
success:
|
336
|
-
}).catchall(
|
337
|
-
var DeleteResultSchema =
|
338
|
-
success:
|
339
|
-
id:
|
343
|
+
var PostResultSchema = import_zod6.z.object({
|
344
|
+
id: import_zod6.z.string().describe("Post ID"),
|
345
|
+
text: import_zod6.z.string().optional().describe("Post text content"),
|
346
|
+
createdAt: import_zod6.z.string().describe("Post creation date"),
|
347
|
+
mediaIds: import_zod6.z.array(import_zod6.z.string()).optional().describe("Media IDs attached to the post"),
|
348
|
+
threadIds: import_zod6.z.array(import_zod6.z.string()).optional().describe("Thread IDs for threaded posts"),
|
349
|
+
quotedPostId: import_zod6.z.string().optional().describe("ID of the post this is quoting"),
|
350
|
+
inReplyToId: import_zod6.z.string().optional().describe("ID of the post this is a reply to"),
|
351
|
+
success: import_zod6.z.boolean().optional().describe("Whether the operation was successful")
|
352
|
+
}).catchall(import_zod6.z.any()).describe("Post result");
|
353
|
+
var DeleteResultSchema = import_zod6.z.object({
|
354
|
+
success: import_zod6.z.boolean().describe("Whether the deletion was successful"),
|
355
|
+
id: import_zod6.z.string().describe("ID of the deleted post")
|
340
356
|
}).describe("Delete result");
|
341
|
-
var LikeResultSchema =
|
342
|
-
success:
|
343
|
-
id:
|
357
|
+
var LikeResultSchema = import_zod6.z.object({
|
358
|
+
success: import_zod6.z.boolean().describe("Whether the like was successful"),
|
359
|
+
id: import_zod6.z.string().describe("ID of the liked post")
|
344
360
|
}).describe("Like result");
|
345
|
-
var PostSuccessDetailSchema =
|
361
|
+
var PostSuccessDetailSchema = import_zod6.z.object({
|
346
362
|
platform: PlatformSchema,
|
347
|
-
userId:
|
348
|
-
status:
|
349
|
-
postId:
|
350
|
-
postUrl:
|
351
|
-
}).catchall(
|
352
|
-
var TargetSchema =
|
363
|
+
userId: import_zod6.z.string().describe("User ID"),
|
364
|
+
status: import_zod6.z.literal("success"),
|
365
|
+
postId: import_zod6.z.string().optional().describe("Post ID"),
|
366
|
+
postUrl: import_zod6.z.string().optional().describe("URL to the post")
|
367
|
+
}).catchall(import_zod6.z.any()).describe("Post success detail");
|
368
|
+
var TargetSchema = import_zod6.z.object({
|
353
369
|
platform: PlatformSchema.describe('The platform to post to (e.g., "twitter")'),
|
354
|
-
userId:
|
370
|
+
userId: import_zod6.z.string().describe("User ID on the platform")
|
355
371
|
}).describe("Target for posting operations");
|
356
|
-
var CreatePostRequestSchema =
|
357
|
-
targets:
|
358
|
-
content:
|
372
|
+
var CreatePostRequestSchema = import_zod6.z.object({
|
373
|
+
targets: import_zod6.z.array(TargetSchema).describe("Array of targets to post to (can be a single target)"),
|
374
|
+
content: import_zod6.z.array(PostContentSchema).describe(
|
359
375
|
"The content of the post, always an array of PostContent objects, even for a single post"
|
360
376
|
)
|
361
377
|
}).describe("Create post request");
|
362
|
-
var RepostRequestSchema =
|
363
|
-
targets:
|
378
|
+
var RepostRequestSchema = import_zod6.z.object({
|
379
|
+
targets: import_zod6.z.array(TargetSchema).describe("Array of targets to post to"),
|
364
380
|
platform: PlatformSchema.describe("Platform of the post being reposted"),
|
365
|
-
postId:
|
381
|
+
postId: import_zod6.z.string().describe("ID of the post to repost")
|
366
382
|
}).describe("Repost request");
|
367
|
-
var QuotePostRequestSchema =
|
368
|
-
targets:
|
383
|
+
var QuotePostRequestSchema = import_zod6.z.object({
|
384
|
+
targets: import_zod6.z.array(TargetSchema).describe(
|
369
385
|
"Array of targets to post to (must be on the same platform as the post being quoted)"
|
370
386
|
),
|
371
387
|
platform: PlatformSchema.describe("Platform of the post being quoted"),
|
372
|
-
postId:
|
373
|
-
content:
|
388
|
+
postId: import_zod6.z.string().describe("ID of the post to quote"),
|
389
|
+
content: import_zod6.z.array(PostContentSchema).describe(
|
374
390
|
"Content for the quote post(s), always an array, even for a single post"
|
375
391
|
)
|
376
392
|
}).describe("Quote post request");
|
377
|
-
var ReplyToPostRequestSchema =
|
378
|
-
targets:
|
393
|
+
var ReplyToPostRequestSchema = import_zod6.z.object({
|
394
|
+
targets: import_zod6.z.array(TargetSchema).describe(
|
379
395
|
"Array of targets to post to (must be on the same platform as the post being replied to)"
|
380
396
|
),
|
381
397
|
platform: PlatformSchema.describe("Platform of the post being replied to"),
|
382
|
-
postId:
|
383
|
-
content:
|
398
|
+
postId: import_zod6.z.string().describe("ID of the post to reply to"),
|
399
|
+
content: import_zod6.z.array(PostContentSchema).describe(
|
384
400
|
"Content for the reply post(s), always an array, even for a single post"
|
385
401
|
)
|
386
402
|
}).describe("Reply to post request");
|
387
|
-
var PostToDeleteSchema =
|
403
|
+
var PostToDeleteSchema = import_zod6.z.object({
|
388
404
|
platform: PlatformSchema.describe("Platform of the post to delete"),
|
389
|
-
userId:
|
390
|
-
postId:
|
405
|
+
userId: import_zod6.z.string().describe("User ID on the platform"),
|
406
|
+
postId: import_zod6.z.string().describe("ID of the post to delete")
|
391
407
|
}).describe("Post to delete");
|
392
|
-
var DeletePostRequestSchema =
|
393
|
-
targets:
|
394
|
-
posts:
|
408
|
+
var DeletePostRequestSchema = import_zod6.z.object({
|
409
|
+
targets: import_zod6.z.array(TargetSchema).describe("Array of targets to delete posts"),
|
410
|
+
posts: import_zod6.z.array(PostToDeleteSchema).describe("Array of posts to delete")
|
395
411
|
}).describe("Delete post request");
|
396
|
-
var LikePostRequestSchema =
|
397
|
-
targets:
|
412
|
+
var LikePostRequestSchema = import_zod6.z.object({
|
413
|
+
targets: import_zod6.z.array(TargetSchema).describe(
|
398
414
|
"Array of targets to like the post (must be on the same platform as the post being liked)"
|
399
415
|
),
|
400
416
|
platform: PlatformSchema.describe("Platform of the post being liked"),
|
401
|
-
postId:
|
417
|
+
postId: import_zod6.z.string().describe("ID of the post to like")
|
402
418
|
}).describe("Like post request");
|
403
|
-
var UnlikePostRequestSchema =
|
404
|
-
targets:
|
419
|
+
var UnlikePostRequestSchema = import_zod6.z.object({
|
420
|
+
targets: import_zod6.z.array(TargetSchema).describe(
|
405
421
|
"Array of targets to unlike the post (must be on the same platform as the post being unliked)"
|
406
422
|
),
|
407
423
|
platform: PlatformSchema.describe("Platform of the post being unliked"),
|
408
|
-
postId:
|
424
|
+
postId: import_zod6.z.string().describe("ID of the post to unlike")
|
409
425
|
}).describe("Unlike post request");
|
410
|
-
var PostResponseSchema =
|
426
|
+
var PostResponseSchema = import_zod6.z.union([PostSchema, import_zod6.z.array(PostSchema)]).describe(
|
411
427
|
"Post response"
|
412
428
|
);
|
413
429
|
var CreatePostResponseSchema = PostResponseSchema.describe(
|
@@ -416,115 +432,115 @@ var CreatePostResponseSchema = PostResponseSchema.describe(
|
|
416
432
|
var RepostResponseSchema = PostResponseSchema.describe("Repost response");
|
417
433
|
var QuotePostResponseSchema = PostResponseSchema.describe("Quote post response");
|
418
434
|
var ReplyToPostResponseSchema = PostResponseSchema.describe("Reply to post response");
|
419
|
-
var DeletePostResponseSchema =
|
420
|
-
id:
|
435
|
+
var DeletePostResponseSchema = import_zod6.z.object({
|
436
|
+
id: import_zod6.z.string().describe("ID of the deleted post")
|
421
437
|
}).describe("Delete post response");
|
422
|
-
var LikePostResponseSchema =
|
423
|
-
id:
|
438
|
+
var LikePostResponseSchema = import_zod6.z.object({
|
439
|
+
id: import_zod6.z.string().describe("ID of the liked post")
|
424
440
|
}).describe("Like post response");
|
425
|
-
var UnlikePostResponseSchema =
|
426
|
-
id:
|
441
|
+
var UnlikePostResponseSchema = import_zod6.z.object({
|
442
|
+
id: import_zod6.z.string().describe("ID of the unliked post")
|
427
443
|
}).describe("Unlike post response");
|
428
|
-
var PostMultiStatusResponseSchema =
|
429
|
-
summary:
|
430
|
-
total:
|
431
|
-
succeeded:
|
432
|
-
failed:
|
444
|
+
var PostMultiStatusResponseSchema = import_zod6.z.object({
|
445
|
+
summary: import_zod6.z.object({
|
446
|
+
total: import_zod6.z.number().describe("Total number of operations"),
|
447
|
+
succeeded: import_zod6.z.number().describe("Number of successful operations"),
|
448
|
+
failed: import_zod6.z.number().describe("Number of failed operations")
|
433
449
|
}),
|
434
|
-
results:
|
435
|
-
errors:
|
450
|
+
results: import_zod6.z.array(PostSuccessDetailSchema).describe("Successful operations"),
|
451
|
+
errors: import_zod6.z.array(ErrorDetailSchema).describe("Failed operations")
|
436
452
|
}).describe("Multi-status response for post operations");
|
437
453
|
|
438
454
|
// src/rate-limit.ts
|
439
|
-
var
|
440
|
-
var RateLimitEndpointParamSchema =
|
441
|
-
endpoint:
|
455
|
+
var import_zod7 = require("zod");
|
456
|
+
var RateLimitEndpointParamSchema = import_zod7.z.object({
|
457
|
+
endpoint: import_zod7.z.string().optional().describe(
|
442
458
|
"Specific endpoint to get rate limit information for (optional)"
|
443
459
|
)
|
444
460
|
}).describe("Rate limit endpoint parameter");
|
445
|
-
var RateLimitEndpointSchema =
|
446
|
-
endpoint:
|
447
|
-
method:
|
448
|
-
limit:
|
449
|
-
remaining:
|
450
|
-
reset:
|
451
|
-
resetDate:
|
461
|
+
var RateLimitEndpointSchema = import_zod7.z.object({
|
462
|
+
endpoint: import_zod7.z.string().describe("API endpoint"),
|
463
|
+
method: import_zod7.z.enum(["GET", "POST", "PUT", "DELETE"]).describe("HTTP method"),
|
464
|
+
limit: import_zod7.z.number().describe("Rate limit"),
|
465
|
+
remaining: import_zod7.z.number().describe("Remaining requests"),
|
466
|
+
reset: import_zod7.z.number().describe("Reset timestamp (Unix timestamp in seconds)"),
|
467
|
+
resetDate: import_zod7.z.string().describe("Reset date (ISO string)")
|
452
468
|
}).describe("Rate limit endpoint");
|
453
|
-
var RateLimitStatusSchema =
|
454
|
-
endpoint:
|
455
|
-
limit:
|
456
|
-
remaining:
|
457
|
-
reset:
|
458
|
-
resetSeconds:
|
469
|
+
var RateLimitStatusSchema = import_zod7.z.object({
|
470
|
+
endpoint: import_zod7.z.string().describe("API endpoint or action"),
|
471
|
+
limit: import_zod7.z.number().describe("Maximum number of requests allowed in the time window"),
|
472
|
+
remaining: import_zod7.z.number().describe("Number of requests remaining in the current time window"),
|
473
|
+
reset: import_zod7.z.string().datetime().describe("Timestamp when the rate limit will reset"),
|
474
|
+
resetSeconds: import_zod7.z.number().describe("Seconds until the rate limit will reset")
|
459
475
|
}).describe("Rate limit status");
|
460
|
-
var PlatformRateLimitSchema =
|
476
|
+
var PlatformRateLimitSchema = import_zod7.z.object({
|
461
477
|
platform: PlatformSchema,
|
462
|
-
endpoints:
|
478
|
+
endpoints: import_zod7.z.record(import_zod7.z.string(), RateLimitStatusSchema).describe(
|
463
479
|
"Rate limit status for each endpoint"
|
464
480
|
)
|
465
481
|
}).describe("Platform-specific rate limit");
|
466
|
-
var UsageRateLimitSchema =
|
467
|
-
endpoint:
|
468
|
-
limit:
|
469
|
-
remaining:
|
470
|
-
reset:
|
471
|
-
resetSeconds:
|
472
|
-
timeWindow:
|
482
|
+
var UsageRateLimitSchema = import_zod7.z.object({
|
483
|
+
endpoint: import_zod7.z.string().describe("API endpoint or action"),
|
484
|
+
limit: import_zod7.z.number().describe("Maximum number of requests allowed in the time window"),
|
485
|
+
remaining: import_zod7.z.number().describe("Number of requests remaining in the current time window"),
|
486
|
+
reset: import_zod7.z.string().datetime().describe("Timestamp when the rate limit will reset"),
|
487
|
+
resetSeconds: import_zod7.z.number().describe("Seconds until the rate limit will reset"),
|
488
|
+
timeWindow: import_zod7.z.string().describe("Time window for the rate limit")
|
473
489
|
}).describe("Usage rate limit");
|
474
|
-
var RateLimitStatusResponseSchema =
|
490
|
+
var RateLimitStatusResponseSchema = import_zod7.z.object({
|
475
491
|
platform: PlatformSchema,
|
476
|
-
userId:
|
477
|
-
endpoints:
|
478
|
-
app:
|
479
|
-
limit:
|
480
|
-
remaining:
|
481
|
-
reset:
|
482
|
-
resetDate:
|
492
|
+
userId: import_zod7.z.string().optional().describe("User ID"),
|
493
|
+
endpoints: import_zod7.z.array(RateLimitEndpointSchema).describe("Rate limits for specific endpoints"),
|
494
|
+
app: import_zod7.z.object({
|
495
|
+
limit: import_zod7.z.number().describe("App-wide rate limit"),
|
496
|
+
remaining: import_zod7.z.number().describe("Remaining requests"),
|
497
|
+
reset: import_zod7.z.number().describe("Reset timestamp (Unix timestamp in seconds)"),
|
498
|
+
resetDate: import_zod7.z.string().describe("Reset date (ISO string)")
|
483
499
|
}).optional().describe("App-wide rate limits")
|
484
500
|
}).describe("Rate limit status response");
|
485
|
-
var AllRateLimitsResponseSchema =
|
486
|
-
platforms:
|
501
|
+
var AllRateLimitsResponseSchema = import_zod7.z.object({
|
502
|
+
platforms: import_zod7.z.record(
|
487
503
|
PlatformSchema,
|
488
|
-
|
489
|
-
users:
|
490
|
-
|
491
|
-
|
492
|
-
endpoints:
|
504
|
+
import_zod7.z.object({
|
505
|
+
users: import_zod7.z.record(
|
506
|
+
import_zod7.z.string(),
|
507
|
+
import_zod7.z.object({
|
508
|
+
endpoints: import_zod7.z.array(RateLimitEndpointSchema).describe(
|
493
509
|
"Rate limits for specific endpoints"
|
494
510
|
),
|
495
|
-
lastUpdated:
|
511
|
+
lastUpdated: import_zod7.z.string().describe("Last updated date (ISO string)")
|
496
512
|
})
|
497
513
|
).describe("User-specific rate limits"),
|
498
|
-
app:
|
499
|
-
limit:
|
500
|
-
remaining:
|
501
|
-
reset:
|
502
|
-
resetDate:
|
514
|
+
app: import_zod7.z.object({
|
515
|
+
limit: import_zod7.z.number().describe("App-wide rate limit"),
|
516
|
+
remaining: import_zod7.z.number().describe("Remaining requests"),
|
517
|
+
reset: import_zod7.z.number().describe("Reset timestamp (Unix timestamp in seconds)"),
|
518
|
+
resetDate: import_zod7.z.string().describe("Reset date (ISO string)")
|
503
519
|
}).optional().describe("App-wide rate limits")
|
504
520
|
})
|
505
521
|
).describe("Rate limits by platform")
|
506
522
|
}).describe("All rate limits response");
|
507
|
-
var RateLimitResponseSchema =
|
508
|
-
platformLimits:
|
509
|
-
usageLimits:
|
523
|
+
var RateLimitResponseSchema = import_zod7.z.object({
|
524
|
+
platformLimits: import_zod7.z.array(PlatformRateLimitSchema).describe("Platform-specific rate limits"),
|
525
|
+
usageLimits: import_zod7.z.record(import_zod7.z.string(), UsageRateLimitSchema).describe(
|
510
526
|
"Usage-based rate limits for the NEAR account"
|
511
527
|
),
|
512
|
-
signerId:
|
528
|
+
signerId: import_zod7.z.string().describe("NEAR account ID")
|
513
529
|
}).describe("Rate limit response");
|
514
|
-
var EndpointRateLimitResponseSchema =
|
515
|
-
platformLimits:
|
516
|
-
|
530
|
+
var EndpointRateLimitResponseSchema = import_zod7.z.object({
|
531
|
+
platformLimits: import_zod7.z.array(
|
532
|
+
import_zod7.z.object({
|
517
533
|
platform: PlatformSchema,
|
518
534
|
status: RateLimitStatusSchema.describe("Rate limit status for the endpoint")
|
519
535
|
})
|
520
536
|
).describe("Platform-specific rate limits for the endpoint"),
|
521
537
|
usageLimit: UsageRateLimitSchema.describe("Usage-based rate limit for the NEAR account"),
|
522
|
-
endpoint:
|
523
|
-
signerId:
|
538
|
+
endpoint: import_zod7.z.string().describe("API endpoint or action"),
|
539
|
+
signerId: import_zod7.z.string().describe("NEAR account ID")
|
524
540
|
}).describe("Endpoint rate limit response");
|
525
541
|
|
526
542
|
// src/activity.ts
|
527
|
-
var
|
543
|
+
var import_zod8 = require("zod");
|
528
544
|
var TimePeriod = /* @__PURE__ */ ((TimePeriod2) => {
|
529
545
|
TimePeriod2["ALL"] = "all";
|
530
546
|
TimePeriod2["YEARLY"] = "year";
|
@@ -533,111 +549,96 @@ var TimePeriod = /* @__PURE__ */ ((TimePeriod2) => {
|
|
533
549
|
TimePeriod2["DAILY"] = "day";
|
534
550
|
return TimePeriod2;
|
535
551
|
})(TimePeriod || {});
|
536
|
-
var ActivityLeaderboardQuerySchema =
|
537
|
-
timeframe:
|
552
|
+
var ActivityLeaderboardQuerySchema = import_zod8.z.object({
|
553
|
+
timeframe: import_zod8.z.nativeEnum(TimePeriod).optional().describe(
|
538
554
|
"Timeframe for the leaderboard"
|
539
555
|
),
|
540
|
-
limit:
|
541
|
-
offset:
|
556
|
+
limit: import_zod8.z.string().optional().transform((val) => val ? parseInt(val, 10) : void 0).pipe(import_zod8.z.number().min(1).max(100).optional()).describe("Maximum number of results to return (1-100)"),
|
557
|
+
offset: import_zod8.z.string().optional().transform((val) => val ? parseInt(val, 10) : void 0).pipe(import_zod8.z.number().min(0).optional()).describe("Offset for pagination")
|
542
558
|
}).describe("Activity leaderboard query");
|
543
|
-
var AccountActivityEntrySchema =
|
544
|
-
signerId:
|
545
|
-
totalPosts:
|
546
|
-
totalLikes:
|
547
|
-
totalReposts:
|
548
|
-
totalReplies:
|
549
|
-
totalQuotes:
|
550
|
-
totalScore:
|
551
|
-
rank:
|
552
|
-
lastActive:
|
559
|
+
var AccountActivityEntrySchema = import_zod8.z.object({
|
560
|
+
signerId: import_zod8.z.string().describe("NEAR account ID"),
|
561
|
+
totalPosts: import_zod8.z.number().describe("Total number of posts"),
|
562
|
+
totalLikes: import_zod8.z.number().describe("Total number of likes"),
|
563
|
+
totalReposts: import_zod8.z.number().describe("Total number of reposts"),
|
564
|
+
totalReplies: import_zod8.z.number().describe("Total number of replies"),
|
565
|
+
totalQuotes: import_zod8.z.number().describe("Total number of quote posts"),
|
566
|
+
totalScore: import_zod8.z.number().describe("Total activity score"),
|
567
|
+
rank: import_zod8.z.number().describe("Rank on the leaderboard"),
|
568
|
+
lastActive: import_zod8.z.string().datetime().describe("Timestamp of last activity")
|
553
569
|
}).describe("Account activity entry");
|
554
|
-
var ActivityLeaderboardResponseSchema =
|
555
|
-
timeframe:
|
556
|
-
entries:
|
557
|
-
generatedAt:
|
570
|
+
var ActivityLeaderboardResponseSchema = import_zod8.z.object({
|
571
|
+
timeframe: import_zod8.z.nativeEnum(TimePeriod).describe("Timeframe for the leaderboard"),
|
572
|
+
entries: import_zod8.z.array(AccountActivityEntrySchema).describe("Leaderboard entries"),
|
573
|
+
generatedAt: import_zod8.z.string().datetime().describe("Timestamp when the leaderboard was generated"),
|
558
574
|
platform: PlatformSchema.optional().describe("Platform filter (if applied)")
|
559
575
|
});
|
560
|
-
var AccountActivityParamsSchema =
|
561
|
-
signerId:
|
576
|
+
var AccountActivityParamsSchema = import_zod8.z.object({
|
577
|
+
signerId: import_zod8.z.string().describe("NEAR account ID")
|
562
578
|
}).describe("Account activity params");
|
563
|
-
var AccountActivityQuerySchema =
|
564
|
-
timeframe:
|
579
|
+
var AccountActivityQuerySchema = import_zod8.z.object({
|
580
|
+
timeframe: import_zod8.z.nativeEnum(TimePeriod).optional().describe(
|
565
581
|
"Timeframe for the activity"
|
566
582
|
)
|
567
583
|
}).describe("Account activity query");
|
568
|
-
var PlatformActivitySchema =
|
584
|
+
var PlatformActivitySchema = import_zod8.z.object({
|
569
585
|
platform: PlatformSchema,
|
570
|
-
posts:
|
571
|
-
likes:
|
572
|
-
reposts:
|
573
|
-
replies:
|
574
|
-
quotes:
|
575
|
-
score:
|
576
|
-
lastActive:
|
586
|
+
posts: import_zod8.z.number().describe("Number of posts on this platform"),
|
587
|
+
likes: import_zod8.z.number().describe("Number of likes on this platform"),
|
588
|
+
reposts: import_zod8.z.number().describe("Number of reposts on this platform"),
|
589
|
+
replies: import_zod8.z.number().describe("Number of replies on this platform"),
|
590
|
+
quotes: import_zod8.z.number().describe("Number of quote posts on this platform"),
|
591
|
+
score: import_zod8.z.number().describe("Activity score on this platform"),
|
592
|
+
lastActive: import_zod8.z.string().datetime().describe("Timestamp of last activity on this platform")
|
577
593
|
}).describe("Platform activity");
|
578
|
-
var AccountActivityResponseSchema =
|
579
|
-
signerId:
|
580
|
-
timeframe:
|
581
|
-
totalPosts:
|
582
|
-
totalLikes:
|
583
|
-
totalReposts:
|
584
|
-
totalReplies:
|
585
|
-
totalQuotes:
|
586
|
-
totalScore:
|
587
|
-
rank:
|
588
|
-
lastActive:
|
589
|
-
platforms:
|
594
|
+
var AccountActivityResponseSchema = import_zod8.z.object({
|
595
|
+
signerId: import_zod8.z.string().describe("NEAR account ID"),
|
596
|
+
timeframe: import_zod8.z.nativeEnum(TimePeriod).describe("Timeframe for the activity"),
|
597
|
+
totalPosts: import_zod8.z.number().describe("Total number of posts across all platforms"),
|
598
|
+
totalLikes: import_zod8.z.number().describe("Total number of likes across all platforms"),
|
599
|
+
totalReposts: import_zod8.z.number().describe("Total number of reposts across all platforms"),
|
600
|
+
totalReplies: import_zod8.z.number().describe("Total number of replies across all platforms"),
|
601
|
+
totalQuotes: import_zod8.z.number().describe("Total number of quote posts across all platforms"),
|
602
|
+
totalScore: import_zod8.z.number().describe("Total activity score across all platforms"),
|
603
|
+
rank: import_zod8.z.number().describe("Rank on the leaderboard"),
|
604
|
+
lastActive: import_zod8.z.string().datetime().describe("Timestamp of last activity across all platforms"),
|
605
|
+
platforms: import_zod8.z.array(PlatformActivitySchema).describe("Activity breakdown by platform")
|
590
606
|
});
|
591
|
-
var AccountPostsParamsSchema =
|
592
|
-
signerId:
|
607
|
+
var AccountPostsParamsSchema = import_zod8.z.object({
|
608
|
+
signerId: import_zod8.z.string().describe("NEAR account ID")
|
593
609
|
}).describe("Account posts params");
|
594
|
-
var AccountPostsQuerySchema =
|
595
|
-
platform:
|
596
|
-
limit:
|
597
|
-
offset:
|
598
|
-
type:
|
610
|
+
var AccountPostsQuerySchema = import_zod8.z.object({
|
611
|
+
platform: import_zod8.z.string().optional().describe("Filter by platform (optional)"),
|
612
|
+
limit: import_zod8.z.string().optional().transform((val) => val ? parseInt(val, 10) : void 0).pipe(import_zod8.z.number().min(1).max(100).optional()).describe("Maximum number of results to return (1-100)"),
|
613
|
+
offset: import_zod8.z.string().optional().transform((val) => val ? parseInt(val, 10) : void 0).pipe(import_zod8.z.number().min(0).optional()).describe("Offset for pagination"),
|
614
|
+
type: import_zod8.z.enum(["post", "repost", "reply", "quote", "like", "all"]).optional().describe(
|
599
615
|
"Filter by post type (optional)"
|
600
616
|
)
|
601
617
|
}).describe("Account posts query");
|
602
|
-
var AccountPostSchema =
|
603
|
-
id:
|
618
|
+
var AccountPostSchema = import_zod8.z.object({
|
619
|
+
id: import_zod8.z.string().describe("Post ID"),
|
604
620
|
platform: PlatformSchema,
|
605
|
-
type:
|
606
|
-
content:
|
607
|
-
url:
|
608
|
-
createdAt:
|
609
|
-
metrics:
|
610
|
-
likes:
|
611
|
-
reposts:
|
612
|
-
replies:
|
613
|
-
quotes:
|
621
|
+
type: import_zod8.z.enum(["post", "repost", "reply", "quote", "like"]).describe("Type of post"),
|
622
|
+
content: import_zod8.z.string().optional().describe("Post content (if available)"),
|
623
|
+
url: import_zod8.z.string().url().optional().describe("URL to the post on the platform (if available)"),
|
624
|
+
createdAt: import_zod8.z.string().datetime().describe("Timestamp when the post was created"),
|
625
|
+
metrics: import_zod8.z.object({
|
626
|
+
likes: import_zod8.z.number().optional().describe("Number of likes (if available)"),
|
627
|
+
reposts: import_zod8.z.number().optional().describe("Number of reposts (if available)"),
|
628
|
+
replies: import_zod8.z.number().optional().describe("Number of replies (if available)"),
|
629
|
+
quotes: import_zod8.z.number().optional().describe("Number of quotes (if available)")
|
614
630
|
}).optional().describe("Post metrics (if available)"),
|
615
|
-
inReplyToId:
|
616
|
-
quotedPostId:
|
631
|
+
inReplyToId: import_zod8.z.string().optional().describe("ID of the post this is a reply to (if applicable)"),
|
632
|
+
quotedPostId: import_zod8.z.string().optional().describe("ID of the post this is quoting (if applicable)")
|
617
633
|
}).describe("Account post");
|
618
|
-
var AccountPostsResponseSchema =
|
619
|
-
signerId:
|
620
|
-
posts:
|
621
|
-
platform:
|
622
|
-
type:
|
634
|
+
var AccountPostsResponseSchema = import_zod8.z.object({
|
635
|
+
signerId: import_zod8.z.string().describe("NEAR account ID"),
|
636
|
+
posts: import_zod8.z.array(AccountPostSchema).describe("List of posts"),
|
637
|
+
platform: import_zod8.z.string().optional().describe("Platform filter (if applied)"),
|
638
|
+
type: import_zod8.z.enum(["post", "repost", "reply", "quote", "like", "all"]).optional().describe(
|
623
639
|
"Post type filter (if applied)"
|
624
640
|
)
|
625
641
|
});
|
626
|
-
|
627
|
-
// src/user-profile.ts
|
628
|
-
var import_zod8 = require("zod");
|
629
|
-
var UserProfileSchema = import_zod8.z.object({
|
630
|
-
userId: import_zod8.z.string().describe("User ID on the platform"),
|
631
|
-
username: import_zod8.z.string().describe("Username on the platform"),
|
632
|
-
url: import_zod8.z.string().url().optional().describe("URL to the user profile"),
|
633
|
-
profileImageUrl: import_zod8.z.string().describe("URL to the user profile image"),
|
634
|
-
isPremium: import_zod8.z.boolean().optional().describe("Whether the user has a premium account"),
|
635
|
-
platform: PlatformSchema.describe("The platform the user profile is from"),
|
636
|
-
lastUpdated: import_zod8.z.number().describe("Timestamp when the profile was last updated")
|
637
|
-
}).describe("User profile");
|
638
|
-
var ProfileRefreshResponseSchema = import_zod8.z.object({
|
639
|
-
profile: UserProfileSchema.optional().describe("The refreshed user profile (if successful)")
|
640
|
-
}).describe("Profile refresh response");
|
641
642
|
// Annotate the CommonJS export names for ESM import in node:
|
642
643
|
0 && (module.exports = {
|
643
644
|
AccountActivityEntrySchema,
|