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