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