@crosspost/types 0.1.5 → 0.1.7

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.js CHANGED
@@ -17,167 +17,10 @@ function isPlatformSupported(platform) {
17
17
  }
18
18
 
19
19
  // src/response.ts
20
- import { z as z2 } from "zod";
21
- var ApiResponseSchema = z2.object({
22
- data: z2.any().describe("Response data"),
23
- meta: z2.object({
24
- rateLimit: z2.object({
25
- remaining: z2.number().describe("Number of requests remaining in the current window"),
26
- limit: z2.number().describe("Total number of requests allowed in the window"),
27
- reset: z2.number().describe("Timestamp when the rate limit resets (in seconds since epoch)")
28
- }).optional().describe("Rate limit information"),
29
- pagination: z2.object({
30
- page: z2.number().describe("Current page number"),
31
- perPage: z2.number().describe("Number of items per page"),
32
- total: z2.number().describe("Total number of items"),
33
- totalPages: z2.number().describe("Total number of pages"),
34
- nextCursor: z2.string().optional().describe("Next page cursor (if applicable)"),
35
- prevCursor: z2.string().optional().describe("Previous page cursor (if applicable)")
36
- }).optional().describe("Pagination information")
37
- }).optional().describe("Response metadata")
38
- }).describe("Standard API response");
39
- var ErrorResponseSchema = z2.object({
40
- error: z2.object({
41
- type: z2.string().describe("Error type"),
42
- message: z2.string().describe("Error message"),
43
- code: z2.string().optional().describe("Error code (if applicable)"),
44
- details: z2.any().optional().describe("Additional error details")
45
- }).describe("Error information")
46
- }).describe("Error response");
47
- var EnhancedResponseMetaSchema = z2.object({
48
- requestId: z2.string().optional().describe("Unique request identifier"),
49
- timestamp: z2.string().optional().describe("Request timestamp"),
50
- rateLimit: z2.object({
51
- remaining: z2.number().describe("Number of requests remaining in the current window"),
52
- limit: z2.number().describe("Total number of requests allowed in the window"),
53
- reset: z2.number().describe("Timestamp when the rate limit resets (in seconds since epoch)")
54
- }).optional().describe("Rate limit information"),
55
- pagination: z2.object({
56
- page: z2.number().describe("Current page number"),
57
- perPage: z2.number().describe("Number of items per page"),
58
- total: z2.number().describe("Total number of items"),
59
- totalPages: z2.number().describe("Total number of pages"),
60
- nextCursor: z2.string().optional().describe("Next page cursor (if applicable)"),
61
- prevCursor: z2.string().optional().describe("Previous page cursor (if applicable)")
62
- }).optional().describe("Pagination information")
63
- }).optional().describe("Response metadata");
64
- var ErrorDetailSchema = z2.object({
65
- platform: z2.string().optional().describe("Platform associated with the error (if applicable)"),
66
- userId: z2.string().optional().describe("User ID associated with the error (if applicable)"),
67
- status: z2.literal("error").describe("Error status"),
68
- error: z2.string().describe("Human-readable error message"),
69
- errorCode: z2.string().describe("Machine-readable error code"),
70
- recoverable: z2.boolean().describe("Whether the error is recoverable (can be retried)"),
71
- details: z2.record(z2.any()).optional().describe("Additional error details (platform-specific)")
72
- }).describe("Error detail");
73
- var EnhancedErrorResponseSchema = z2.object({
74
- success: z2.literal(false).describe("Success indicator (always false for error responses)"),
75
- errors: z2.array(ErrorDetailSchema).describe("Error information")
76
- }).describe("Enhanced error response");
77
- var SuccessDetailSchema = z2.object({
78
- platform: z2.string().describe("Platform associated with the success"),
79
- userId: z2.string().describe("User ID associated with the success"),
80
- status: z2.literal("success").describe("Success status"),
81
- postId: z2.string().optional().describe("Post ID (if applicable)"),
82
- postUrl: z2.string().optional().describe("Post URL (if applicable)")
83
- }).catchall(z2.any()).describe("Success detail");
84
- var MultiStatusResponseSchema = z2.object({
85
- success: z2.boolean().describe("Success indicator (true if at least one operation succeeded)"),
86
- data: z2.object({
87
- summary: z2.object({
88
- total: z2.number().describe("Total number of operations"),
89
- succeeded: z2.number().describe("Number of successful operations"),
90
- failed: z2.number().describe("Number of failed operations")
91
- }).describe("Summary of operations"),
92
- results: z2.array(SuccessDetailSchema).describe("Successful results"),
93
- errors: z2.array(ErrorDetailSchema).describe("Failed results")
94
- }).describe("Response data")
95
- }).describe("Multi-status response");
96
- function EnhancedResponseSchema(schema) {
97
- return z2.object({
98
- success: z2.boolean().describe("Whether the request was successful"),
99
- data: schema,
100
- meta: EnhancedResponseMetaSchema
101
- });
102
- }
103
- function createEnhancedApiResponse(data, meta) {
104
- return {
105
- success: true,
106
- data,
107
- meta
108
- };
109
- }
110
- function createApiResponse(data, meta) {
111
- return {
112
- data,
113
- meta
114
- };
115
- }
116
- function createErrorResponse(type, message, code, details) {
117
- return {
118
- error: {
119
- type,
120
- message,
121
- ...code ? { code } : {},
122
- ...details ? { details } : {}
123
- }
124
- };
125
- }
126
- function createEnhancedErrorResponse(errors) {
127
- return {
128
- success: false,
129
- errors
130
- };
131
- }
132
- function createErrorDetail(error, errorCode, recoverable, platform, userId, details) {
133
- return {
134
- platform,
135
- userId,
136
- status: "error",
137
- error,
138
- errorCode,
139
- recoverable,
140
- details
141
- };
142
- }
143
- function createSuccessDetail(platform, userId, additionalData) {
144
- return {
145
- platform,
146
- userId,
147
- status: "success",
148
- ...additionalData
149
- };
150
- }
151
- function createMultiStatusResponse(results, errors) {
152
- const total = results.length + errors.length;
153
- const succeeded = results.length;
154
- const failed = errors.length;
155
- return {
156
- success: succeeded > 0,
157
- data: {
158
- summary: {
159
- total,
160
- succeeded,
161
- failed
162
- },
163
- results,
164
- errors
165
- }
166
- };
167
- }
168
-
169
- // src/errors/base-error.ts
170
- var BaseError = class extends Error {
171
- constructor(message) {
172
- super(message);
173
- this.name = this.constructor.name;
174
- if (Error.captureStackTrace) {
175
- Error.captureStackTrace(this, this.constructor);
176
- }
177
- }
178
- };
20
+ import { z as z3 } from "zod";
179
21
 
180
- // src/errors/api-error.ts
22
+ // src/errors.ts
23
+ import { z as z2 } from "zod";
181
24
  var ApiErrorCode = /* @__PURE__ */ ((ApiErrorCode2) => {
182
25
  ApiErrorCode2["UNKNOWN_ERROR"] = "UNKNOWN_ERROR";
183
26
  ApiErrorCode2["INTERNAL_ERROR"] = "INTERNAL_ERROR";
@@ -192,6 +35,7 @@ var ApiErrorCode = /* @__PURE__ */ ((ApiErrorCode2) => {
192
35
  ApiErrorCode2["CONTENT_POLICY_VIOLATION"] = "CONTENT_POLICY_VIOLATION";
193
36
  ApiErrorCode2["DUPLICATE_CONTENT"] = "DUPLICATE_CONTENT";
194
37
  ApiErrorCode2["MEDIA_UPLOAD_FAILED"] = "MEDIA_UPLOAD_FAILED";
38
+ ApiErrorCode2["MULTI_STATUS"] = "MULTI_STATUS";
195
39
  ApiErrorCode2["POST_CREATION_FAILED"] = "POST_CREATION_FAILED";
196
40
  ApiErrorCode2["THREAD_CREATION_FAILED"] = "THREAD_CREATION_FAILED";
197
41
  ApiErrorCode2["POST_DELETION_FAILED"] = "POST_DELETION_FAILED";
@@ -199,450 +43,370 @@ var ApiErrorCode = /* @__PURE__ */ ((ApiErrorCode2) => {
199
43
  ApiErrorCode2["NETWORK_ERROR"] = "NETWORK_ERROR";
200
44
  return ApiErrorCode2;
201
45
  })(ApiErrorCode || {});
202
- var ApiError = class _ApiError extends BaseError {
203
- constructor(message, code = "INTERNAL_ERROR" /* INTERNAL_ERROR */, status = 500, details, recoverable = false) {
204
- super(message);
205
- this.code = code;
206
- this.status = status;
207
- this.details = details;
208
- this.recoverable = recoverable;
209
- }
210
- /**
211
- * Create a validation error
212
- */
213
- static validation(message, details) {
214
- return new _ApiError(
215
- message,
216
- "VALIDATION_ERROR" /* VALIDATION_ERROR */,
217
- 400,
218
- details,
219
- true
220
- );
221
- }
222
- /**
223
- * Create an unauthorized error
224
- */
225
- static unauthorized(message = "Unauthorized") {
226
- return new _ApiError(
227
- message,
228
- "UNAUTHORIZED" /* UNAUTHORIZED */,
229
- 401,
230
- void 0,
231
- true
232
- );
233
- }
234
- /**
235
- * Create a forbidden error
236
- */
237
- static forbidden(message = "Forbidden") {
238
- return new _ApiError(
239
- message,
240
- "FORBIDDEN" /* FORBIDDEN */,
241
- 403,
242
- void 0,
243
- false
244
- );
245
- }
246
- /**
247
- * Create a not found error
248
- */
249
- static notFound(message = "Resource not found") {
250
- return new _ApiError(
251
- message,
252
- "NOT_FOUND" /* NOT_FOUND */,
253
- 404,
254
- void 0,
255
- false
256
- );
257
- }
258
- /**
259
- * Create a rate limit error
260
- */
261
- static rateLimited(message = "Rate limit exceeded", details) {
262
- return new _ApiError(
263
- message,
264
- "RATE_LIMITED" /* RATE_LIMITED */,
265
- 429,
266
- details,
267
- true
268
- );
269
- }
270
- /**
271
- * Create an internal server error
272
- */
273
- static internal(message = "Internal server error", details) {
274
- return new _ApiError(
275
- message,
276
- "INTERNAL_ERROR" /* INTERNAL_ERROR */,
277
- 500,
278
- details,
279
- false
280
- );
281
- }
46
+ var ApiErrorCodeSchema = z2.enum(Object.values(ApiErrorCode));
47
+ var errorCodeToStatusCode = {
48
+ ["MULTI_STATUS" /* MULTI_STATUS */]: 207,
49
+ ["UNKNOWN_ERROR" /* UNKNOWN_ERROR */]: 500,
50
+ ["INTERNAL_ERROR" /* INTERNAL_ERROR */]: 500,
51
+ ["VALIDATION_ERROR" /* VALIDATION_ERROR */]: 400,
52
+ ["INVALID_REQUEST" /* INVALID_REQUEST */]: 400,
53
+ ["NOT_FOUND" /* NOT_FOUND */]: 404,
54
+ ["UNAUTHORIZED" /* UNAUTHORIZED */]: 401,
55
+ ["FORBIDDEN" /* FORBIDDEN */]: 403,
56
+ ["RATE_LIMITED" /* RATE_LIMITED */]: 429,
57
+ ["PLATFORM_ERROR" /* PLATFORM_ERROR */]: 502,
58
+ ["PLATFORM_UNAVAILABLE" /* PLATFORM_UNAVAILABLE */]: 503,
59
+ ["CONTENT_POLICY_VIOLATION" /* CONTENT_POLICY_VIOLATION */]: 400,
60
+ ["DUPLICATE_CONTENT" /* DUPLICATE_CONTENT */]: 400,
61
+ ["MEDIA_UPLOAD_FAILED" /* MEDIA_UPLOAD_FAILED */]: 400,
62
+ ["POST_CREATION_FAILED" /* POST_CREATION_FAILED */]: 500,
63
+ ["THREAD_CREATION_FAILED" /* THREAD_CREATION_FAILED */]: 500,
64
+ ["POST_DELETION_FAILED" /* POST_DELETION_FAILED */]: 500,
65
+ ["POST_INTERACTION_FAILED" /* POST_INTERACTION_FAILED */]: 500,
66
+ ["NETWORK_ERROR" /* NETWORK_ERROR */]: 503
282
67
  };
68
+ var ErrorDetailSchema = z2.object({
69
+ message: z2.string().describe("Human-readable error message"),
70
+ code: ApiErrorCodeSchema.describe("Machine-readable error code"),
71
+ recoverable: z2.boolean().describe("Whether the error can be recovered from"),
72
+ details: z2.record(z2.unknown()).optional().describe("Additional error details")
73
+ });
283
74
 
284
- // src/errors/platform-error.ts
285
- var PlatformError = class extends Error {
286
- constructor(message, platform, code = "PLATFORM_ERROR" /* PLATFORM_ERROR */, recoverable = false, originalError, status, userId, details) {
287
- super(message);
288
- this.originalError = originalError;
289
- this.status = status;
290
- this.name = "PlatformError";
291
- this.code = code;
292
- this.recoverable = recoverable;
293
- this.platform = platform;
294
- this.userId = userId;
295
- this.details = details;
296
- }
297
- };
75
+ // src/response.ts
76
+ var ResponseMetaSchema = z3.object({
77
+ requestId: z3.string().uuid().describe("Unique identifier for the request"),
78
+ timestamp: z3.string().datetime().describe("ISO timestamp of response generation"),
79
+ rateLimit: z3.object({
80
+ remaining: z3.number().int().nonnegative(),
81
+ limit: z3.number().int().positive(),
82
+ reset: z3.number().int().positive().describe("Unix timestamp (seconds)")
83
+ }).optional().describe("Rate limit information if applicable"),
84
+ pagination: z3.object({
85
+ page: z3.number().int().positive().optional(),
86
+ perPage: z3.number().int().positive().optional(),
87
+ total: z3.number().int().nonnegative().optional(),
88
+ limit: z3.number().int().nonnegative().optional(),
89
+ offset: z3.number().int().nonnegative().optional(),
90
+ totalPages: z3.number().int().nonnegative().optional(),
91
+ nextCursor: z3.string().optional(),
92
+ prevCursor: z3.string().optional()
93
+ }).optional().describe("Pagination information if applicable")
94
+ });
95
+ var SuccessDetailSchema = z3.object({
96
+ platform: z3.string(),
97
+ userId: z3.string(),
98
+ additionalData: z3.any().optional(),
99
+ status: z3.literal("success")
100
+ }).catchall(z3.any());
101
+ var MultiStatusDataSchema = z3.object({
102
+ summary: z3.object({
103
+ total: z3.number().int().nonnegative(),
104
+ succeeded: z3.number().int().nonnegative(),
105
+ failed: z3.number().int().nonnegative()
106
+ }),
107
+ results: z3.array(SuccessDetailSchema),
108
+ errors: z3.array(ErrorDetailSchema)
109
+ });
298
110
 
299
111
  // src/auth.ts
300
- import { z as z3 } from "zod";
301
- var PlatformParamSchema = z3.object({
302
- platform: z3.string().describe("Social media platform")
112
+ import { z as z4 } from "zod";
113
+ var PlatformParamSchema = z4.object({
114
+ platform: z4.string().describe("Social media platform")
303
115
  }).describe("Platform parameter");
304
- var AuthInitRequestSchema = z3.object({
305
- successUrl: z3.string().url().optional().describe(
116
+ var AuthInitRequestSchema = z4.object({
117
+ successUrl: z4.string().url().optional().describe(
306
118
  "URL to redirect to on successful authentication"
307
119
  ),
308
- errorUrl: z3.string().url().optional().describe("URL to redirect to on authentication error")
120
+ errorUrl: z4.string().url().optional().describe("URL to redirect to on authentication error")
309
121
  }).describe("Auth initialization request");
310
- var AuthUrlResponseSchema = EnhancedResponseSchema(
311
- z3.object({
312
- url: z3.string().describe("Authentication URL to redirect the user to"),
313
- state: z3.string().describe("State parameter for CSRF protection"),
314
- platform: PlatformSchema
315
- })
316
- ).describe("Auth URL response");
317
- var AuthCallbackQuerySchema = z3.object({
318
- code: z3.string().describe("Authorization code from OAuth provider"),
319
- state: z3.string().describe("State parameter for CSRF protection")
122
+ var AuthUrlResponseSchema = z4.object({
123
+ url: z4.string().describe("Authentication URL to redirect the user to"),
124
+ state: z4.string().describe("State parameter for CSRF protection"),
125
+ platform: PlatformSchema
126
+ }).describe("Auth URL response");
127
+ var AuthCallbackQuerySchema = z4.object({
128
+ code: z4.string().describe("Authorization code from OAuth provider"),
129
+ state: z4.string().describe("State parameter for CSRF protection")
320
130
  }).describe("Auth callback query");
321
- var AuthCallbackResponseSchema = EnhancedResponseSchema(
322
- z3.object({
323
- success: z3.boolean().describe("Whether the authentication was successful"),
324
- platform: PlatformSchema,
325
- userId: z3.string().describe("User ID"),
326
- redirectUrl: z3.string().optional().describe("URL to redirect the user to after authentication")
327
- })
328
- ).describe("Auth callback response");
329
- var AuthStatusResponseSchema = EnhancedResponseSchema(
330
- z3.object({
331
- platform: PlatformSchema,
332
- userId: z3.string().describe("User ID"),
333
- authenticated: z3.boolean().describe("Whether the user is authenticated"),
334
- tokenStatus: z3.object({
335
- valid: z3.boolean().describe("Whether the token is valid"),
336
- expired: z3.boolean().describe("Whether the token is expired"),
337
- expiresAt: z3.string().optional().describe("When the token expires")
338
- })
339
- })
340
- ).describe("Auth status response");
341
- var AuthRevokeResponseSchema = EnhancedResponseSchema(
342
- z3.object({
343
- success: z3.boolean().describe("Whether the revocation was successful"),
344
- platform: PlatformSchema,
345
- userId: z3.string().describe("User ID")
131
+ var AuthCallbackResponseSchema = z4.object({
132
+ platform: PlatformSchema,
133
+ userId: z4.string().describe("User ID"),
134
+ redirectUrl: z4.string().optional().describe("URL to redirect the user to after authentication")
135
+ }).describe("Auth callback response");
136
+ var AuthStatusResponseSchema = z4.object({
137
+ platform: PlatformSchema,
138
+ userId: z4.string().describe("User ID"),
139
+ authenticated: z4.boolean().describe("Whether the user is authenticated"),
140
+ tokenStatus: z4.object({
141
+ valid: z4.boolean().describe("Whether the token is valid"),
142
+ expired: z4.boolean().describe("Whether the token is expired"),
143
+ expiresAt: z4.string().optional().describe("When the token expires")
346
144
  })
347
- ).describe("Auth revoke response");
348
- var ConnectedAccountSchema = z3.object({
145
+ }).describe("Auth status response");
146
+ var AuthTokenRequestSchema = z4.object({
147
+ userId: z4.string().describe("User ID on the platform")
148
+ }).describe("Auth token request");
149
+ var AuthRevokeResponseSchema = z4.object({
349
150
  platform: PlatformSchema,
350
- userId: z3.string().describe("User ID on the platform"),
351
- username: z3.string().optional().describe("Username on the platform (if available)"),
352
- profileUrl: z3.string().optional().describe("URL to the user profile"),
353
- connectedAt: z3.string().optional().describe("When the account was connected")
151
+ userId: z4.string().describe("User ID")
152
+ }).describe("Auth revoke response");
153
+ var ConnectedAccountSchema = z4.object({
154
+ platform: PlatformSchema,
155
+ userId: z4.string().describe("User ID on the platform"),
156
+ username: z4.string().optional().describe("Username on the platform (if available)"),
157
+ profileUrl: z4.string().optional().describe("URL to the user profile"),
158
+ connectedAt: z4.string().optional().describe("When the account was connected")
354
159
  }).describe("Connected account");
355
- var ConnectedAccountsResponseSchema = EnhancedResponseSchema(
356
- z3.array(ConnectedAccountSchema)
357
- ).describe("Connected accounts response");
358
- var NearAuthorizationRequestSchema = z3.object({
160
+ var ConnectedAccountsResponseSchema = z4.array(ConnectedAccountSchema).describe(
161
+ "Connected accounts response"
162
+ );
163
+ var NearAuthorizationRequestSchema = z4.object({
359
164
  // No additional parameters needed, as the NEAR account ID is extracted from the signature
360
165
  }).describe("NEAR authorization request");
361
- var NearAuthorizationResponseSchema = EnhancedResponseSchema(
362
- z3.object({
363
- success: z3.boolean().describe("Whether the authorization was successful"),
364
- nearAccount: z3.string().describe("NEAR account ID"),
365
- authorized: z3.boolean().describe("Whether the account is authorized")
366
- })
367
- ).describe("NEAR authorization response");
368
- var NearAuthorizationStatusResponseSchema = EnhancedResponseSchema(
369
- z3.object({
370
- nearAccount: z3.string().describe("NEAR account ID"),
371
- authorized: z3.boolean().describe("Whether the account is authorized"),
372
- authorizedAt: z3.string().optional().describe("When the account was authorized")
373
- })
374
- ).describe("NEAR authorization status response");
166
+ var NearAuthorizationResponseSchema = z4.object({
167
+ nearAccount: z4.string().describe("NEAR account ID"),
168
+ authorized: z4.boolean().describe("Whether the account is authorized")
169
+ }).describe("NEAR authorization response");
170
+ var NearAuthorizationStatusResponseSchema = z4.object({
171
+ nearAccount: z4.string().describe("NEAR account ID"),
172
+ authorized: z4.boolean().describe("Whether the account is authorized"),
173
+ authorizedAt: z4.string().optional().describe("When the account was authorized")
174
+ }).describe("NEAR authorization status response");
375
175
 
376
176
  // src/post.ts
377
- import { z as z4 } from "zod";
378
- var MediaContentSchema = z4.object({
379
- data: z4.union([z4.string(), z4.instanceof(Blob)]).describe("Media data as string or Blob"),
380
- mimeType: z4.string().optional().describe("Media MIME type"),
381
- altText: z4.string().optional().describe("Alt text for the media")
177
+ import { z as z5 } from "zod";
178
+ var MediaContentSchema = z5.object({
179
+ data: z5.union([z5.string(), z5.instanceof(Blob)]).describe("Media data as string or Blob"),
180
+ mimeType: z5.string().optional().describe("Media MIME type"),
181
+ altText: z5.string().optional().describe("Alt text for the media")
382
182
  }).describe("Media content object");
383
- var MediaSchema = z4.object({
384
- id: z4.string().describe("Media ID"),
385
- type: z4.enum(["image", "video", "gif"]).describe("Media type"),
386
- url: z4.string().optional().describe("Media URL"),
387
- altText: z4.string().optional().describe("Alt text for the media")
183
+ var MediaSchema = z5.object({
184
+ id: z5.string().describe("Media ID"),
185
+ type: z5.enum(["image", "video", "gif"]).describe("Media type"),
186
+ url: z5.string().optional().describe("Media URL"),
187
+ altText: z5.string().optional().describe("Alt text for the media")
388
188
  }).describe("Media object");
389
- var PostMetricsSchema = z4.object({
390
- retweets: z4.number().describe("Number of retweets"),
391
- quotes: z4.number().describe("Number of quotes"),
392
- likes: z4.number().describe("Number of likes"),
393
- replies: z4.number().describe("Number of replies")
189
+ var PostMetricsSchema = z5.object({
190
+ retweets: z5.number().describe("Number of retweets"),
191
+ quotes: z5.number().describe("Number of quotes"),
192
+ likes: z5.number().describe("Number of likes"),
193
+ replies: z5.number().describe("Number of replies")
394
194
  }).describe("Post metrics");
395
- var PostSchema = z4.object({
396
- id: z4.string().describe("Post ID"),
397
- text: z4.string().describe("Post text content"),
398
- createdAt: z4.string().describe("Post creation date"),
399
- authorId: z4.string().describe("Author ID"),
400
- media: z4.array(MediaSchema).optional().describe("Media attached to the post"),
195
+ var PostSchema = z5.object({
196
+ id: z5.string().describe("Post ID"),
197
+ text: z5.string().describe("Post text content"),
198
+ createdAt: z5.string().describe("Post creation date"),
199
+ authorId: z5.string().describe("Author ID"),
200
+ media: z5.array(MediaSchema).optional().describe("Media attached to the post"),
401
201
  metrics: PostMetricsSchema.optional().describe("Post metrics"),
402
- inReplyToId: z4.string().optional().describe("ID of the post this is a reply to"),
403
- quotedPostId: z4.string().optional().describe("ID of the post this is quoting")
202
+ inReplyToId: z5.string().optional().describe("ID of the post this is a reply to"),
203
+ quotedPostId: z5.string().optional().describe("ID of the post this is quoting")
404
204
  }).describe("Post object");
405
- var PostContentSchema = z4.object({
406
- text: z4.string().optional().describe("Text content for the post"),
407
- media: z4.array(MediaContentSchema).optional().describe("Media attachments for the post")
205
+ var PostContentSchema = z5.object({
206
+ text: z5.string().optional().describe("Text content for the post"),
207
+ media: z5.array(MediaContentSchema).optional().describe("Media attachments for the post")
408
208
  }).describe("Post content");
409
- var PostResultSchema = z4.object({
410
- id: z4.string().describe("Post ID"),
411
- text: z4.string().optional().describe("Post text content"),
412
- createdAt: z4.string().describe("Post creation date"),
413
- mediaIds: z4.array(z4.string()).optional().describe("Media IDs attached to the post"),
414
- threadIds: z4.array(z4.string()).optional().describe("Thread IDs for threaded posts"),
415
- quotedPostId: z4.string().optional().describe("ID of the post this is quoting"),
416
- inReplyToId: z4.string().optional().describe("ID of the post this is a reply to"),
417
- success: z4.boolean().optional().describe("Whether the operation was successful")
418
- }).catchall(z4.any()).describe("Post result");
419
- var DeleteResultSchema = z4.object({
420
- success: z4.boolean().describe("Whether the deletion was successful"),
421
- id: z4.string().describe("ID of the deleted post")
209
+ var PostResultSchema = z5.object({
210
+ id: z5.string().describe("Post ID"),
211
+ text: z5.string().optional().describe("Post text content"),
212
+ createdAt: z5.string().describe("Post creation date"),
213
+ mediaIds: z5.array(z5.string()).optional().describe("Media IDs attached to the post"),
214
+ threadIds: z5.array(z5.string()).optional().describe("Thread IDs for threaded posts"),
215
+ quotedPostId: z5.string().optional().describe("ID of the post this is quoting"),
216
+ inReplyToId: z5.string().optional().describe("ID of the post this is a reply to"),
217
+ success: z5.boolean().optional().describe("Whether the operation was successful")
218
+ }).catchall(z5.any()).describe("Post result");
219
+ var DeleteResultSchema = z5.object({
220
+ success: z5.boolean().describe("Whether the deletion was successful"),
221
+ id: z5.string().describe("ID of the deleted post")
422
222
  }).describe("Delete result");
423
- var LikeResultSchema = z4.object({
424
- success: z4.boolean().describe("Whether the like was successful"),
425
- id: z4.string().describe("ID of the liked post")
223
+ var LikeResultSchema = z5.object({
224
+ success: z5.boolean().describe("Whether the like was successful"),
225
+ id: z5.string().describe("ID of the liked post")
426
226
  }).describe("Like result");
427
- var PostSuccessDetailSchema = z4.object({
227
+ var PostSuccessDetailSchema = z5.object({
428
228
  platform: PlatformSchema,
429
- userId: z4.string().describe("User ID"),
430
- status: z4.literal("success"),
431
- postId: z4.string().optional().describe("Post ID"),
432
- postUrl: z4.string().optional().describe("URL to the post")
433
- }).catchall(z4.any()).describe("Post success detail");
434
- var TargetSchema = z4.object({
229
+ userId: z5.string().describe("User ID"),
230
+ status: z5.literal("success"),
231
+ postId: z5.string().optional().describe("Post ID"),
232
+ postUrl: z5.string().optional().describe("URL to the post")
233
+ }).catchall(z5.any()).describe("Post success detail");
234
+ var TargetSchema = z5.object({
435
235
  platform: PlatformSchema.describe('The platform to post to (e.g., "twitter")'),
436
- userId: z4.string().describe("User ID on the platform")
236
+ userId: z5.string().describe("User ID on the platform")
437
237
  }).describe("Target for posting operations");
438
- var CreatePostRequestSchema = z4.object({
439
- targets: z4.array(TargetSchema).describe("Array of targets to post to (can be a single target)"),
440
- content: z4.array(PostContentSchema).describe(
238
+ var CreatePostRequestSchema = z5.object({
239
+ targets: z5.array(TargetSchema).describe("Array of targets to post to (can be a single target)"),
240
+ content: z5.array(PostContentSchema).describe(
441
241
  "The content of the post, always an array of PostContent objects, even for a single post"
442
242
  )
443
243
  }).describe("Create post request");
444
- var RepostRequestSchema = z4.object({
445
- targets: z4.array(TargetSchema).describe("Array of targets to post to"),
244
+ var RepostRequestSchema = z5.object({
245
+ targets: z5.array(TargetSchema).describe("Array of targets to post to"),
446
246
  platform: PlatformSchema.describe("Platform of the post being reposted"),
447
- postId: z4.string().describe("ID of the post to repost")
247
+ postId: z5.string().describe("ID of the post to repost")
448
248
  }).describe("Repost request");
449
- var QuotePostRequestSchema = z4.object({
450
- targets: z4.array(TargetSchema).describe(
249
+ var QuotePostRequestSchema = z5.object({
250
+ targets: z5.array(TargetSchema).describe(
451
251
  "Array of targets to post to (must be on the same platform as the post being quoted)"
452
252
  ),
453
253
  platform: PlatformSchema.describe("Platform of the post being quoted"),
454
- postId: z4.string().describe("ID of the post to quote"),
455
- content: z4.array(PostContentSchema).describe(
254
+ postId: z5.string().describe("ID of the post to quote"),
255
+ content: z5.array(PostContentSchema).describe(
456
256
  "Content for the quote post(s), always an array, even for a single post"
457
257
  )
458
258
  }).describe("Quote post request");
459
- var ReplyToPostRequestSchema = z4.object({
460
- targets: z4.array(TargetSchema).describe(
259
+ var ReplyToPostRequestSchema = z5.object({
260
+ targets: z5.array(TargetSchema).describe(
461
261
  "Array of targets to post to (must be on the same platform as the post being replied to)"
462
262
  ),
463
263
  platform: PlatformSchema.describe("Platform of the post being replied to"),
464
- postId: z4.string().describe("ID of the post to reply to"),
465
- content: z4.array(PostContentSchema).describe(
264
+ postId: z5.string().describe("ID of the post to reply to"),
265
+ content: z5.array(PostContentSchema).describe(
466
266
  "Content for the reply post(s), always an array, even for a single post"
467
267
  )
468
268
  }).describe("Reply to post request");
469
- var PostToDeleteSchema = z4.object({
269
+ var PostToDeleteSchema = z5.object({
470
270
  platform: PlatformSchema.describe("Platform of the post to delete"),
471
- userId: z4.string().describe("User ID on the platform"),
472
- postId: z4.string().describe("ID of the post to delete")
271
+ userId: z5.string().describe("User ID on the platform"),
272
+ postId: z5.string().describe("ID of the post to delete")
473
273
  }).describe("Post to delete");
474
- var DeletePostRequestSchema = z4.object({
475
- targets: z4.array(TargetSchema).describe("Array of targets to delete posts"),
476
- posts: z4.array(PostToDeleteSchema).describe("Array of posts to delete")
274
+ var DeletePostRequestSchema = z5.object({
275
+ targets: z5.array(TargetSchema).describe("Array of targets to delete posts"),
276
+ posts: z5.array(PostToDeleteSchema).describe("Array of posts to delete")
477
277
  }).describe("Delete post request");
478
- var LikePostRequestSchema = z4.object({
479
- targets: z4.array(TargetSchema).describe(
278
+ var LikePostRequestSchema = z5.object({
279
+ targets: z5.array(TargetSchema).describe(
480
280
  "Array of targets to like the post (must be on the same platform as the post being liked)"
481
281
  ),
482
282
  platform: PlatformSchema.describe("Platform of the post being liked"),
483
- postId: z4.string().describe("ID of the post to like")
283
+ postId: z5.string().describe("ID of the post to like")
484
284
  }).describe("Like post request");
485
- var UnlikePostRequestSchema = z4.object({
486
- targets: z4.array(TargetSchema).describe(
285
+ var UnlikePostRequestSchema = z5.object({
286
+ targets: z5.array(TargetSchema).describe(
487
287
  "Array of targets to unlike the post (must be on the same platform as the post being unliked)"
488
288
  ),
489
289
  platform: PlatformSchema.describe("Platform of the post being unliked"),
490
- postId: z4.string().describe("ID of the post to unlike")
290
+ postId: z5.string().describe("ID of the post to unlike")
491
291
  }).describe("Unlike post request");
492
- var PostResponseSchema = EnhancedResponseSchema(
493
- z4.union([PostSchema, z4.array(PostSchema)])
494
- ).describe("Post response");
495
- var CreatePostResponseLegacySchema = PostResponseSchema.describe(
496
- "Create post response (legacy)"
292
+ var PostResponseSchema = z5.union([PostSchema, z5.array(PostSchema)]).describe(
293
+ "Post response"
294
+ );
295
+ var CreatePostResponseSchema = PostResponseSchema.describe(
296
+ "Create post response"
497
297
  );
498
298
  var RepostResponseSchema = PostResponseSchema.describe("Repost response");
499
299
  var QuotePostResponseSchema = PostResponseSchema.describe("Quote post response");
500
300
  var ReplyToPostResponseSchema = PostResponseSchema.describe("Reply to post response");
501
- var DeletePostResponseSchema = EnhancedResponseSchema(
502
- z4.object({
503
- success: z4.boolean().describe("Whether the deletion was successful"),
504
- id: z4.string().describe("ID of the deleted post")
505
- })
506
- ).describe("Delete post response");
507
- var LikePostResponseSchema = EnhancedResponseSchema(
508
- z4.object({
509
- success: z4.boolean().describe("Whether the like was successful"),
510
- id: z4.string().describe("ID of the liked post")
511
- })
512
- ).describe("Like post response");
513
- var UnlikePostResponseSchema = EnhancedResponseSchema(
514
- z4.object({
515
- success: z4.boolean().describe("Whether the unlike was successful"),
516
- id: z4.string().describe("ID of the unliked post")
517
- })
518
- ).describe("Unlike post response");
519
- var PostMultiStatusResponseSchema = z4.object({
520
- success: z4.boolean().describe("Whether the operation was partially or fully successful"),
521
- data: z4.object({
522
- summary: z4.object({
523
- total: z4.number().describe("Total number of operations"),
524
- succeeded: z4.number().describe("Number of successful operations"),
525
- failed: z4.number().describe("Number of failed operations")
526
- }),
527
- results: z4.array(PostSuccessDetailSchema).describe("Successful operations"),
528
- errors: z4.array(ErrorDetailSchema).describe("Failed operations")
529
- })
301
+ var DeletePostResponseSchema = z5.object({
302
+ id: z5.string().describe("ID of the deleted post")
303
+ }).describe("Delete post response");
304
+ var LikePostResponseSchema = z5.object({
305
+ id: z5.string().describe("ID of the liked post")
306
+ }).describe("Like post response");
307
+ var UnlikePostResponseSchema = z5.object({
308
+ id: z5.string().describe("ID of the unliked post")
309
+ }).describe("Unlike post response");
310
+ var PostMultiStatusResponseSchema = z5.object({
311
+ summary: z5.object({
312
+ total: z5.number().describe("Total number of operations"),
313
+ succeeded: z5.number().describe("Number of successful operations"),
314
+ failed: z5.number().describe("Number of failed operations")
315
+ }),
316
+ results: z5.array(PostSuccessDetailSchema).describe("Successful operations"),
317
+ errors: z5.array(ErrorDetailSchema).describe("Failed operations")
530
318
  }).describe("Multi-status response for post operations");
531
- var CreatePostTargetResultSchema = z4.object({
532
- platform: PlatformSchema.describe("The platform the post was created on"),
533
- userId: z4.string().describe("The user ID on the platform"),
534
- result: z4.array(z4.any()).describe("The result of the post creation")
535
- }).describe("Create post target result");
536
- var CreatePostTargetErrorSchema = z4.object({
537
- platform: PlatformSchema.optional().describe(
538
- "The platform where the error occurred (if applicable)"
539
- ),
540
- userId: z4.string().optional().describe("The user ID where the error occurred (if applicable)"),
541
- error: z4.string().describe("The error message")
542
- }).describe("Create post target error");
543
- var CreatePostResponseSchema = EnhancedResponseSchema(
544
- z4.object({
545
- results: z4.array(CreatePostTargetResultSchema).describe("Array of successful post results"),
546
- errors: z4.array(CreatePostTargetErrorSchema).optional().describe(
547
- "Array of errors that occurred (if any)"
548
- )
549
- })
550
- ).describe("Create post response");
551
319
 
552
320
  // src/rate-limit.ts
553
- import { z as z5 } from "zod";
554
- var RateLimitEndpointParamSchema = z5.object({
555
- endpoint: z5.string().optional().describe(
321
+ import { z as z6 } from "zod";
322
+ var RateLimitEndpointParamSchema = z6.object({
323
+ endpoint: z6.string().optional().describe(
556
324
  "Specific endpoint to get rate limit information for (optional)"
557
325
  )
558
326
  }).describe("Rate limit endpoint parameter");
559
- var RateLimitEndpointSchema = z5.object({
560
- endpoint: z5.string().describe("API endpoint"),
561
- method: z5.enum(["GET", "POST", "PUT", "DELETE"]).describe("HTTP method"),
562
- limit: z5.number().describe("Rate limit"),
563
- remaining: z5.number().describe("Remaining requests"),
564
- reset: z5.number().describe("Reset timestamp (Unix timestamp in seconds)"),
565
- resetDate: z5.string().describe("Reset date (ISO string)")
327
+ var RateLimitEndpointSchema = z6.object({
328
+ endpoint: z6.string().describe("API endpoint"),
329
+ method: z6.enum(["GET", "POST", "PUT", "DELETE"]).describe("HTTP method"),
330
+ limit: z6.number().describe("Rate limit"),
331
+ remaining: z6.number().describe("Remaining requests"),
332
+ reset: z6.number().describe("Reset timestamp (Unix timestamp in seconds)"),
333
+ resetDate: z6.string().describe("Reset date (ISO string)")
566
334
  }).describe("Rate limit endpoint");
567
- var RateLimitStatusSchema = z5.object({
568
- endpoint: z5.string().describe("API endpoint or action"),
569
- limit: z5.number().describe("Maximum number of requests allowed in the time window"),
570
- remaining: z5.number().describe("Number of requests remaining in the current time window"),
571
- reset: z5.string().datetime().describe("Timestamp when the rate limit will reset"),
572
- resetSeconds: z5.number().describe("Seconds until the rate limit will reset")
335
+ var RateLimitStatusSchema = z6.object({
336
+ endpoint: z6.string().describe("API endpoint or action"),
337
+ limit: z6.number().describe("Maximum number of requests allowed in the time window"),
338
+ remaining: z6.number().describe("Number of requests remaining in the current time window"),
339
+ reset: z6.string().datetime().describe("Timestamp when the rate limit will reset"),
340
+ resetSeconds: z6.number().describe("Seconds until the rate limit will reset")
573
341
  }).describe("Rate limit status");
574
- var PlatformRateLimitSchema = z5.object({
342
+ var PlatformRateLimitSchema = z6.object({
575
343
  platform: PlatformSchema,
576
- endpoints: z5.record(z5.string(), RateLimitStatusSchema).describe(
344
+ endpoints: z6.record(z6.string(), RateLimitStatusSchema).describe(
577
345
  "Rate limit status for each endpoint"
578
346
  )
579
347
  }).describe("Platform-specific rate limit");
580
- var UsageRateLimitSchema = z5.object({
581
- endpoint: z5.string().describe("API endpoint or action"),
582
- limit: z5.number().describe("Maximum number of requests allowed in the time window"),
583
- remaining: z5.number().describe("Number of requests remaining in the current time window"),
584
- reset: z5.string().datetime().describe("Timestamp when the rate limit will reset"),
585
- resetSeconds: z5.number().describe("Seconds until the rate limit will reset"),
586
- timeWindow: z5.string().describe("Time window for the rate limit")
348
+ var UsageRateLimitSchema = z6.object({
349
+ endpoint: z6.string().describe("API endpoint or action"),
350
+ limit: z6.number().describe("Maximum number of requests allowed in the time window"),
351
+ remaining: z6.number().describe("Number of requests remaining in the current time window"),
352
+ reset: z6.string().datetime().describe("Timestamp when the rate limit will reset"),
353
+ resetSeconds: z6.number().describe("Seconds until the rate limit will reset"),
354
+ timeWindow: z6.string().describe("Time window for the rate limit")
587
355
  }).describe("Usage rate limit");
588
- var RateLimitStatusResponseSchema = EnhancedResponseSchema(
589
- z5.object({
590
- platform: PlatformSchema,
591
- userId: z5.string().optional().describe("User ID"),
592
- endpoints: z5.array(RateLimitEndpointSchema).describe("Rate limits for specific endpoints"),
593
- app: z5.object({
594
- limit: z5.number().describe("App-wide rate limit"),
595
- remaining: z5.number().describe("Remaining requests"),
596
- reset: z5.number().describe("Reset timestamp (Unix timestamp in seconds)"),
597
- resetDate: z5.string().describe("Reset date (ISO string)")
598
- }).optional().describe("App-wide rate limits")
599
- })
600
- ).describe("Rate limit status response");
601
- var AllRateLimitsResponseSchema = EnhancedResponseSchema(
602
- z5.object({
603
- platforms: z5.record(
604
- PlatformSchema,
605
- z5.object({
606
- users: z5.record(
607
- z5.string(),
608
- z5.object({
609
- endpoints: z5.array(RateLimitEndpointSchema).describe(
610
- "Rate limits for specific endpoints"
611
- ),
612
- lastUpdated: z5.string().describe("Last updated date (ISO string)")
613
- })
614
- ).describe("User-specific rate limits"),
615
- app: z5.object({
616
- limit: z5.number().describe("App-wide rate limit"),
617
- remaining: z5.number().describe("Remaining requests"),
618
- reset: z5.number().describe("Reset timestamp (Unix timestamp in seconds)"),
619
- resetDate: z5.string().describe("Reset date (ISO string)")
620
- }).optional().describe("App-wide rate limits")
621
- })
622
- ).describe("Rate limits by platform")
623
- })
624
- ).describe("All rate limits response");
625
- var RateLimitResponseSchema = z5.object({
626
- platformLimits: z5.array(PlatformRateLimitSchema).describe("Platform-specific rate limits"),
627
- usageLimits: z5.record(z5.string(), UsageRateLimitSchema).describe(
356
+ var RateLimitStatusResponseSchema = z6.object({
357
+ platform: PlatformSchema,
358
+ userId: z6.string().optional().describe("User ID"),
359
+ endpoints: z6.array(RateLimitEndpointSchema).describe("Rate limits for specific endpoints"),
360
+ app: z6.object({
361
+ limit: z6.number().describe("App-wide rate limit"),
362
+ remaining: z6.number().describe("Remaining requests"),
363
+ reset: z6.number().describe("Reset timestamp (Unix timestamp in seconds)"),
364
+ resetDate: z6.string().describe("Reset date (ISO string)")
365
+ }).optional().describe("App-wide rate limits")
366
+ }).describe("Rate limit status response");
367
+ var AllRateLimitsResponseSchema = z6.object({
368
+ platforms: z6.record(
369
+ PlatformSchema,
370
+ z6.object({
371
+ users: z6.record(
372
+ z6.string(),
373
+ z6.object({
374
+ endpoints: z6.array(RateLimitEndpointSchema).describe(
375
+ "Rate limits for specific endpoints"
376
+ ),
377
+ lastUpdated: z6.string().describe("Last updated date (ISO string)")
378
+ })
379
+ ).describe("User-specific rate limits"),
380
+ app: z6.object({
381
+ limit: z6.number().describe("App-wide rate limit"),
382
+ remaining: z6.number().describe("Remaining requests"),
383
+ reset: z6.number().describe("Reset timestamp (Unix timestamp in seconds)"),
384
+ resetDate: z6.string().describe("Reset date (ISO string)")
385
+ }).optional().describe("App-wide rate limits")
386
+ })
387
+ ).describe("Rate limits by platform")
388
+ }).describe("All rate limits response");
389
+ var RateLimitResponseSchema = z6.object({
390
+ platformLimits: z6.array(PlatformRateLimitSchema).describe("Platform-specific rate limits"),
391
+ usageLimits: z6.record(z6.string(), UsageRateLimitSchema).describe(
628
392
  "Usage-based rate limits for the NEAR account"
629
393
  ),
630
- signerId: z5.string().describe("NEAR account ID")
394
+ signerId: z6.string().describe("NEAR account ID")
631
395
  }).describe("Rate limit response");
632
- var EndpointRateLimitResponseSchema = z5.object({
633
- platformLimits: z5.array(
634
- z5.object({
396
+ var EndpointRateLimitResponseSchema = z6.object({
397
+ platformLimits: z6.array(
398
+ z6.object({
635
399
  platform: PlatformSchema,
636
400
  status: RateLimitStatusSchema.describe("Rate limit status for the endpoint")
637
401
  })
638
402
  ).describe("Platform-specific rate limits for the endpoint"),
639
403
  usageLimit: UsageRateLimitSchema.describe("Usage-based rate limit for the NEAR account"),
640
- endpoint: z5.string().describe("API endpoint or action"),
641
- signerId: z5.string().describe("NEAR account ID")
404
+ endpoint: z6.string().describe("API endpoint or action"),
405
+ signerId: z6.string().describe("NEAR account ID")
642
406
  }).describe("Endpoint rate limit response");
643
407
 
644
408
  // src/activity.ts
645
- import { z as z6 } from "zod";
409
+ import { z as z7 } from "zod";
646
410
  var TimePeriod = /* @__PURE__ */ ((TimePeriod2) => {
647
411
  TimePeriod2["ALL"] = "all";
648
412
  TimePeriod2["YEARLY"] = "year";
@@ -651,177 +415,149 @@ var TimePeriod = /* @__PURE__ */ ((TimePeriod2) => {
651
415
  TimePeriod2["DAILY"] = "day";
652
416
  return TimePeriod2;
653
417
  })(TimePeriod || {});
654
- var ActivityLeaderboardQuerySchema = z6.object({
655
- timeframe: z6.nativeEnum(TimePeriod).optional().describe(
418
+ var ActivityLeaderboardQuerySchema = z7.object({
419
+ timeframe: z7.nativeEnum(TimePeriod).optional().describe(
656
420
  "Timeframe for the leaderboard"
657
421
  ),
658
- limit: z6.string().optional().transform((val) => val ? parseInt(val, 10) : void 0).pipe(z6.number().min(1).max(100).optional()).describe("Maximum number of results to return (1-100)"),
659
- offset: z6.string().optional().transform((val) => val ? parseInt(val, 10) : void 0).pipe(z6.number().min(0).optional()).describe("Offset for pagination")
422
+ limit: z7.string().optional().transform((val) => val ? parseInt(val, 10) : void 0).pipe(z7.number().min(1).max(100).optional()).describe("Maximum number of results to return (1-100)"),
423
+ offset: z7.string().optional().transform((val) => val ? parseInt(val, 10) : void 0).pipe(z7.number().min(0).optional()).describe("Offset for pagination")
660
424
  }).describe("Activity leaderboard query");
661
- var AccountActivityEntrySchema = z6.object({
662
- signerId: z6.string().describe("NEAR account ID"),
663
- totalPosts: z6.number().describe("Total number of posts"),
664
- totalLikes: z6.number().describe("Total number of likes"),
665
- totalReposts: z6.number().describe("Total number of reposts"),
666
- totalReplies: z6.number().describe("Total number of replies"),
667
- totalQuotes: z6.number().describe("Total number of quote posts"),
668
- totalScore: z6.number().describe("Total activity score"),
669
- rank: z6.number().describe("Rank on the leaderboard"),
670
- lastActive: z6.string().datetime().describe("Timestamp of last activity")
425
+ var AccountActivityEntrySchema = z7.object({
426
+ signerId: z7.string().describe("NEAR account ID"),
427
+ totalPosts: z7.number().describe("Total number of posts"),
428
+ totalLikes: z7.number().describe("Total number of likes"),
429
+ totalReposts: z7.number().describe("Total number of reposts"),
430
+ totalReplies: z7.number().describe("Total number of replies"),
431
+ totalQuotes: z7.number().describe("Total number of quote posts"),
432
+ totalScore: z7.number().describe("Total activity score"),
433
+ rank: z7.number().describe("Rank on the leaderboard"),
434
+ lastActive: z7.string().datetime().describe("Timestamp of last activity")
671
435
  }).describe("Account activity entry");
672
- var ActivityLeaderboardResponseSchema = EnhancedResponseSchema(
673
- z6.object({
674
- timeframe: z6.nativeEnum(TimePeriod).describe("Timeframe for the leaderboard"),
675
- entries: z6.array(AccountActivityEntrySchema).describe("Leaderboard entries"),
676
- total: z6.number().describe("Total number of entries in the leaderboard"),
677
- limit: z6.number().describe("Maximum number of results returned"),
678
- offset: z6.number().describe("Offset for pagination"),
679
- generatedAt: z6.string().datetime().describe("Timestamp when the leaderboard was generated")
680
- })
681
- ).describe("Activity leaderboard response");
682
- var AccountActivityParamsSchema = z6.object({
683
- signerId: z6.string().describe("NEAR account ID")
436
+ var ActivityLeaderboardResponseSchema = z7.object({
437
+ timeframe: z7.nativeEnum(TimePeriod).describe("Timeframe for the leaderboard"),
438
+ entries: z7.array(AccountActivityEntrySchema).describe("Leaderboard entries"),
439
+ generatedAt: z7.string().datetime().describe("Timestamp when the leaderboard was generated"),
440
+ platform: PlatformSchema.optional().describe("Platform filter (if applied)")
441
+ });
442
+ var AccountActivityParamsSchema = z7.object({
443
+ signerId: z7.string().describe("NEAR account ID")
684
444
  }).describe("Account activity params");
685
- var AccountActivityQuerySchema = z6.object({
686
- timeframe: z6.nativeEnum(TimePeriod).optional().describe(
445
+ var AccountActivityQuerySchema = z7.object({
446
+ timeframe: z7.nativeEnum(TimePeriod).optional().describe(
687
447
  "Timeframe for the activity"
688
448
  )
689
449
  }).describe("Account activity query");
690
- var PlatformActivitySchema = z6.object({
450
+ var PlatformActivitySchema = z7.object({
691
451
  platform: PlatformSchema,
692
- posts: z6.number().describe("Number of posts on this platform"),
693
- likes: z6.number().describe("Number of likes on this platform"),
694
- reposts: z6.number().describe("Number of reposts on this platform"),
695
- replies: z6.number().describe("Number of replies on this platform"),
696
- quotes: z6.number().describe("Number of quote posts on this platform"),
697
- score: z6.number().describe("Activity score on this platform"),
698
- lastActive: z6.string().datetime().describe("Timestamp of last activity on this platform")
452
+ posts: z7.number().describe("Number of posts on this platform"),
453
+ likes: z7.number().describe("Number of likes on this platform"),
454
+ reposts: z7.number().describe("Number of reposts on this platform"),
455
+ replies: z7.number().describe("Number of replies on this platform"),
456
+ quotes: z7.number().describe("Number of quote posts on this platform"),
457
+ score: z7.number().describe("Activity score on this platform"),
458
+ lastActive: z7.string().datetime().describe("Timestamp of last activity on this platform")
699
459
  }).describe("Platform activity");
700
- var AccountActivityResponseSchema = EnhancedResponseSchema(
701
- z6.object({
702
- signerId: z6.string().describe("NEAR account ID"),
703
- timeframe: z6.nativeEnum(TimePeriod).describe("Timeframe for the activity"),
704
- totalPosts: z6.number().describe("Total number of posts across all platforms"),
705
- totalLikes: z6.number().describe("Total number of likes across all platforms"),
706
- totalReposts: z6.number().describe("Total number of reposts across all platforms"),
707
- totalReplies: z6.number().describe("Total number of replies across all platforms"),
708
- totalQuotes: z6.number().describe("Total number of quote posts across all platforms"),
709
- totalScore: z6.number().describe("Total activity score across all platforms"),
710
- rank: z6.number().describe("Rank on the leaderboard"),
711
- lastActive: z6.string().datetime().describe("Timestamp of last activity across all platforms"),
712
- platforms: z6.array(PlatformActivitySchema).describe("Activity breakdown by platform")
713
- })
714
- ).describe("Account activity response");
715
- var AccountPostsParamsSchema = z6.object({
716
- signerId: z6.string().describe("NEAR account ID")
460
+ var AccountActivityResponseSchema = z7.object({
461
+ signerId: z7.string().describe("NEAR account ID"),
462
+ timeframe: z7.nativeEnum(TimePeriod).describe("Timeframe for the activity"),
463
+ totalPosts: z7.number().describe("Total number of posts across all platforms"),
464
+ totalLikes: z7.number().describe("Total number of likes across all platforms"),
465
+ totalReposts: z7.number().describe("Total number of reposts across all platforms"),
466
+ totalReplies: z7.number().describe("Total number of replies across all platforms"),
467
+ totalQuotes: z7.number().describe("Total number of quote posts across all platforms"),
468
+ totalScore: z7.number().describe("Total activity score across all platforms"),
469
+ rank: z7.number().describe("Rank on the leaderboard"),
470
+ lastActive: z7.string().datetime().describe("Timestamp of last activity across all platforms"),
471
+ platforms: z7.array(PlatformActivitySchema).describe("Activity breakdown by platform")
472
+ });
473
+ var AccountPostsParamsSchema = z7.object({
474
+ signerId: z7.string().describe("NEAR account ID")
717
475
  }).describe("Account posts params");
718
- var AccountPostsQuerySchema = z6.object({
719
- platform: z6.string().optional().describe("Filter by platform (optional)"),
720
- limit: z6.string().optional().transform((val) => val ? parseInt(val, 10) : void 0).pipe(z6.number().min(1).max(100).optional()).describe("Maximum number of results to return (1-100)"),
721
- offset: z6.string().optional().transform((val) => val ? parseInt(val, 10) : void 0).pipe(z6.number().min(0).optional()).describe("Offset for pagination"),
722
- type: z6.enum(["post", "repost", "reply", "quote", "like", "all"]).optional().describe(
476
+ var AccountPostsQuerySchema = z7.object({
477
+ platform: z7.string().optional().describe("Filter by platform (optional)"),
478
+ limit: z7.string().optional().transform((val) => val ? parseInt(val, 10) : void 0).pipe(z7.number().min(1).max(100).optional()).describe("Maximum number of results to return (1-100)"),
479
+ offset: z7.string().optional().transform((val) => val ? parseInt(val, 10) : void 0).pipe(z7.number().min(0).optional()).describe("Offset for pagination"),
480
+ type: z7.enum(["post", "repost", "reply", "quote", "like", "all"]).optional().describe(
723
481
  "Filter by post type (optional)"
724
482
  )
725
483
  }).describe("Account posts query");
726
- var AccountPostSchema = z6.object({
727
- id: z6.string().describe("Post ID"),
484
+ var AccountPostSchema = z7.object({
485
+ id: z7.string().describe("Post ID"),
728
486
  platform: PlatformSchema,
729
- type: z6.enum(["post", "repost", "reply", "quote", "like"]).describe("Type of post"),
730
- content: z6.string().optional().describe("Post content (if available)"),
731
- url: z6.string().url().optional().describe("URL to the post on the platform (if available)"),
732
- createdAt: z6.string().datetime().describe("Timestamp when the post was created"),
733
- metrics: z6.object({
734
- likes: z6.number().optional().describe("Number of likes (if available)"),
735
- reposts: z6.number().optional().describe("Number of reposts (if available)"),
736
- replies: z6.number().optional().describe("Number of replies (if available)"),
737
- quotes: z6.number().optional().describe("Number of quotes (if available)")
487
+ type: z7.enum(["post", "repost", "reply", "quote", "like"]).describe("Type of post"),
488
+ content: z7.string().optional().describe("Post content (if available)"),
489
+ url: z7.string().url().optional().describe("URL to the post on the platform (if available)"),
490
+ createdAt: z7.string().datetime().describe("Timestamp when the post was created"),
491
+ metrics: z7.object({
492
+ likes: z7.number().optional().describe("Number of likes (if available)"),
493
+ reposts: z7.number().optional().describe("Number of reposts (if available)"),
494
+ replies: z7.number().optional().describe("Number of replies (if available)"),
495
+ quotes: z7.number().optional().describe("Number of quotes (if available)")
738
496
  }).optional().describe("Post metrics (if available)"),
739
- inReplyToId: z6.string().optional().describe("ID of the post this is a reply to (if applicable)"),
740
- quotedPostId: z6.string().optional().describe("ID of the post this is quoting (if applicable)")
497
+ inReplyToId: z7.string().optional().describe("ID of the post this is a reply to (if applicable)"),
498
+ quotedPostId: z7.string().optional().describe("ID of the post this is quoting (if applicable)")
741
499
  }).describe("Account post");
742
- var AccountPostsResponseSchema = EnhancedResponseSchema(
743
- z6.object({
744
- signerId: z6.string().describe("NEAR account ID"),
745
- posts: z6.array(AccountPostSchema).describe("List of posts"),
746
- total: z6.number().describe("Total number of posts matching the query"),
747
- limit: z6.number().describe("Maximum number of results returned"),
748
- offset: z6.number().describe("Offset for pagination"),
749
- platform: z6.string().optional().describe("Platform filter (if applied)"),
750
- type: z6.enum(["post", "repost", "reply", "quote", "like", "all"]).optional().describe(
751
- "Post type filter (if applied)"
752
- )
753
- })
754
- ).describe("Account posts response");
500
+ var AccountPostsResponseSchema = z7.object({
501
+ signerId: z7.string().describe("NEAR account ID"),
502
+ posts: z7.array(AccountPostSchema).describe("List of posts"),
503
+ platform: z7.string().optional().describe("Platform filter (if applied)"),
504
+ type: z7.enum(["post", "repost", "reply", "quote", "like", "all"]).optional().describe(
505
+ "Post type filter (if applied)"
506
+ )
507
+ });
755
508
 
756
509
  // src/user-profile.ts
757
- import { z as z7 } from "zod";
758
- var UserProfileSchema = z7.object({
759
- userId: z7.string().describe("User ID on the platform"),
760
- username: z7.string().describe("Username on the platform"),
761
- url: z7.string().url().optional().describe("URL to the user profile"),
762
- profileImageUrl: z7.string().describe("URL to the user profile image"),
763
- isPremium: z7.boolean().optional().describe("Whether the user has a premium account"),
510
+ import { z as z8 } from "zod";
511
+ var UserProfileSchema = z8.object({
512
+ userId: z8.string().describe("User ID on the platform"),
513
+ username: z8.string().describe("Username on the platform"),
514
+ url: z8.string().url().optional().describe("URL to the user profile"),
515
+ profileImageUrl: z8.string().describe("URL to the user profile image"),
516
+ isPremium: z8.boolean().optional().describe("Whether the user has a premium account"),
764
517
  platform: PlatformSchema.describe("The platform the user profile is from"),
765
- lastUpdated: z7.number().describe("Timestamp when the profile was last updated")
518
+ lastUpdated: z8.number().describe("Timestamp when the profile was last updated")
766
519
  }).describe("User profile");
767
- var ProfileRefreshResultSchema = z7.object({
768
- success: z7.boolean().describe("Whether the profile refresh was successful"),
769
- profile: UserProfileSchema.optional().describe("The refreshed user profile (if successful)"),
770
- error: z7.string().optional().describe("Error message (if unsuccessful)")
771
- }).describe("Profile refresh result");
772
- var ProfileRefreshResponseSchema = EnhancedResponseSchema(
773
- ProfileRefreshResultSchema
774
- ).describe("Profile refresh response");
520
+ var ProfileRefreshResponseSchema = z8.object({
521
+ profile: UserProfileSchema.optional().describe("The refreshed user profile (if successful)")
522
+ }).describe("Profile refresh response");
775
523
  export {
776
524
  AccountActivityEntrySchema,
777
525
  AccountActivityParamsSchema,
778
526
  AccountActivityQuerySchema,
779
- AccountActivityResponseSchema,
780
527
  AccountPostSchema,
781
528
  AccountPostsParamsSchema,
782
529
  AccountPostsQuerySchema,
783
- AccountPostsResponseSchema,
784
530
  ActivityLeaderboardQuerySchema,
785
- ActivityLeaderboardResponseSchema,
786
531
  AllRateLimitsResponseSchema,
787
- ApiError,
788
532
  ApiErrorCode,
789
- ApiResponseSchema,
533
+ ApiErrorCodeSchema,
790
534
  AuthCallbackQuerySchema,
791
535
  AuthCallbackResponseSchema,
792
536
  AuthInitRequestSchema,
793
537
  AuthRevokeResponseSchema,
794
538
  AuthStatusResponseSchema,
539
+ AuthTokenRequestSchema,
795
540
  AuthUrlResponseSchema,
796
- BaseError,
797
541
  ConnectedAccountSchema,
798
542
  ConnectedAccountsResponseSchema,
799
543
  CreatePostRequestSchema,
800
- CreatePostResponseLegacySchema,
801
544
  CreatePostResponseSchema,
802
- CreatePostTargetErrorSchema,
803
- CreatePostTargetResultSchema,
804
545
  DeletePostRequestSchema,
805
546
  DeletePostResponseSchema,
806
547
  DeleteResultSchema,
807
548
  EndpointRateLimitResponseSchema,
808
- EnhancedErrorResponseSchema,
809
- EnhancedResponseMetaSchema,
810
- EnhancedResponseSchema,
811
549
  ErrorDetailSchema,
812
- ErrorResponseSchema,
813
550
  LikePostRequestSchema,
814
551
  LikePostResponseSchema,
815
552
  LikeResultSchema,
816
553
  MediaContentSchema,
817
554
  MediaSchema,
818
- MultiStatusResponseSchema,
555
+ MultiStatusDataSchema,
819
556
  NearAuthorizationRequestSchema,
820
557
  NearAuthorizationResponseSchema,
821
558
  NearAuthorizationStatusResponseSchema,
822
559
  Platform,
823
560
  PlatformActivitySchema,
824
- PlatformError,
825
561
  PlatformParamSchema,
826
562
  PlatformRateLimitSchema,
827
563
  PlatformSchema,
@@ -834,7 +570,6 @@ export {
834
570
  PostSuccessDetailSchema,
835
571
  PostToDeleteSchema,
836
572
  ProfileRefreshResponseSchema,
837
- ProfileRefreshResultSchema,
838
573
  QuotePostRequestSchema,
839
574
  QuotePostResponseSchema,
840
575
  RateLimitEndpointParamSchema,
@@ -846,6 +581,7 @@ export {
846
581
  ReplyToPostResponseSchema,
847
582
  RepostRequestSchema,
848
583
  RepostResponseSchema,
584
+ ResponseMetaSchema,
849
585
  SUPPORTED_PLATFORMS,
850
586
  SuccessDetailSchema,
851
587
  SupportedPlatformSchema,
@@ -855,12 +591,6 @@ export {
855
591
  UnlikePostResponseSchema,
856
592
  UsageRateLimitSchema,
857
593
  UserProfileSchema,
858
- createApiResponse,
859
- createEnhancedApiResponse,
860
- createEnhancedErrorResponse,
861
- createErrorDetail,
862
- createErrorResponse,
863
- createMultiStatusResponse,
864
- createSuccessDetail,
594
+ errorCodeToStatusCode,
865
595
  isPlatformSupported
866
596
  };