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