@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.cjs +379 -684
- package/dist/index.d.cts +1469 -5908
- package/dist/index.d.ts +1469 -5908
- package/dist/index.js +374 -660
- package/package.json +1 -1
- package/src/activity.ts +30 -115
- package/src/auth.ts +40 -70
- package/src/common.ts +8 -10
- package/src/errors.ts +97 -0
- package/src/index.ts +1 -13
- package/src/post.ts +22 -168
- package/src/rate-limit.ts +33 -72
- package/src/response.ts +41 -288
- package/src/user-profile.ts +2 -26
- package/src/errors/api-error.ts +0 -155
- package/src/errors/base-error.ts +0 -13
- package/src/errors/composite-api-error.ts +0 -33
- package/src/errors/index.ts +0 -8
- package/src/errors/platform-error.ts +0 -34
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
|
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
|
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
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
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/
|
301
|
-
var
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
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
|
316
|
-
var PlatformParamSchema =
|
317
|
-
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 =
|
320
|
-
successUrl:
|
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:
|
120
|
+
errorUrl: z4.string().url().optional().describe("URL to redirect to on authentication error")
|
324
121
|
}).describe("Auth initialization request");
|
325
|
-
var AuthUrlResponseSchema =
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
).describe("
|
332
|
-
|
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 =
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
).describe("
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
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
|
363
|
-
var
|
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:
|
366
|
-
username:
|
367
|
-
profileUrl:
|
368
|
-
connectedAt:
|
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 =
|
371
|
-
|
372
|
-
)
|
373
|
-
var NearAuthorizationRequestSchema =
|
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 =
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
).describe("
|
383
|
-
|
384
|
-
|
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
|
393
|
-
var MediaContentSchema =
|
394
|
-
data:
|
395
|
-
mimeType:
|
396
|
-
altText:
|
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 =
|
399
|
-
id:
|
400
|
-
type:
|
401
|
-
url:
|
402
|
-
altText:
|
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 =
|
405
|
-
retweets:
|
406
|
-
quotes:
|
407
|
-
likes:
|
408
|
-
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 =
|
411
|
-
id:
|
412
|
-
text:
|
413
|
-
createdAt:
|
414
|
-
authorId:
|
415
|
-
media:
|
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:
|
418
|
-
quotedPostId:
|
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 =
|
421
|
-
text:
|
422
|
-
media:
|
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 =
|
425
|
-
id:
|
426
|
-
text:
|
427
|
-
createdAt:
|
428
|
-
mediaIds:
|
429
|
-
threadIds:
|
430
|
-
quotedPostId:
|
431
|
-
inReplyToId:
|
432
|
-
success:
|
433
|
-
}).catchall(
|
434
|
-
var DeleteResultSchema =
|
435
|
-
success:
|
436
|
-
id:
|
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 =
|
439
|
-
success:
|
440
|
-
id:
|
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 =
|
227
|
+
var PostSuccessDetailSchema = z5.object({
|
443
228
|
platform: PlatformSchema,
|
444
|
-
userId:
|
445
|
-
status:
|
446
|
-
postId:
|
447
|
-
postUrl:
|
448
|
-
}).catchall(
|
449
|
-
var TargetSchema =
|
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:
|
236
|
+
userId: z5.string().describe("User ID on the platform")
|
452
237
|
}).describe("Target for posting operations");
|
453
|
-
var CreatePostRequestSchema =
|
454
|
-
targets:
|
455
|
-
content:
|
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 =
|
460
|
-
targets:
|
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:
|
247
|
+
postId: z5.string().describe("ID of the post to repost")
|
463
248
|
}).describe("Repost request");
|
464
|
-
var QuotePostRequestSchema =
|
465
|
-
targets:
|
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:
|
470
|
-
content:
|
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 =
|
475
|
-
targets:
|
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:
|
480
|
-
content:
|
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 =
|
269
|
+
var PostToDeleteSchema = z5.object({
|
485
270
|
platform: PlatformSchema.describe("Platform of the post to delete"),
|
486
|
-
userId:
|
487
|
-
postId:
|
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 =
|
490
|
-
targets:
|
491
|
-
posts:
|
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 =
|
494
|
-
targets:
|
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:
|
283
|
+
postId: z5.string().describe("ID of the post to like")
|
499
284
|
}).describe("Like post request");
|
500
|
-
var UnlikePostRequestSchema =
|
501
|
-
targets:
|
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:
|
290
|
+
postId: z5.string().describe("ID of the post to unlike")
|
506
291
|
}).describe("Unlike post request");
|
507
|
-
var PostResponseSchema =
|
508
|
-
|
509
|
-
)
|
510
|
-
var
|
511
|
-
"Create post response
|
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 =
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
).describe("
|
522
|
-
var
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
).describe("
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
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
|
569
|
-
var RateLimitEndpointParamSchema =
|
570
|
-
endpoint:
|
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 =
|
575
|
-
endpoint:
|
576
|
-
method:
|
577
|
-
limit:
|
578
|
-
remaining:
|
579
|
-
reset:
|
580
|
-
resetDate:
|
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 =
|
583
|
-
endpoint:
|
584
|
-
limit:
|
585
|
-
remaining:
|
586
|
-
reset:
|
587
|
-
resetSeconds:
|
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 =
|
342
|
+
var PlatformRateLimitSchema = z6.object({
|
590
343
|
platform: PlatformSchema,
|
591
|
-
endpoints:
|
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 =
|
596
|
-
endpoint:
|
597
|
-
limit:
|
598
|
-
remaining:
|
599
|
-
reset:
|
600
|
-
resetSeconds:
|
601
|
-
timeWindow:
|
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 =
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
).describe("
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
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:
|
394
|
+
signerId: z6.string().describe("NEAR account ID")
|
646
395
|
}).describe("Rate limit response");
|
647
|
-
var EndpointRateLimitResponseSchema =
|
648
|
-
platformLimits:
|
649
|
-
|
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:
|
656
|
-
signerId:
|
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
|
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 =
|
670
|
-
timeframe:
|
418
|
+
var ActivityLeaderboardQuerySchema = z7.object({
|
419
|
+
timeframe: z7.nativeEnum(TimePeriod).optional().describe(
|
671
420
|
"Timeframe for the leaderboard"
|
672
421
|
),
|
673
|
-
limit:
|
674
|
-
offset:
|
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 =
|
677
|
-
signerId:
|
678
|
-
totalPosts:
|
679
|
-
totalLikes:
|
680
|
-
totalReposts:
|
681
|
-
totalReplies:
|
682
|
-
totalQuotes:
|
683
|
-
totalScore:
|
684
|
-
rank:
|
685
|
-
lastActive:
|
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 =
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
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 =
|
701
|
-
timeframe:
|
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 =
|
450
|
+
var PlatformActivitySchema = z7.object({
|
706
451
|
platform: PlatformSchema,
|
707
|
-
posts:
|
708
|
-
likes:
|
709
|
-
reposts:
|
710
|
-
replies:
|
711
|
-
quotes:
|
712
|
-
score:
|
713
|
-
lastActive:
|
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 =
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
).describe("
|
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 =
|
734
|
-
platform:
|
735
|
-
limit:
|
736
|
-
offset:
|
737
|
-
type:
|
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 =
|
742
|
-
id:
|
484
|
+
var AccountPostSchema = z7.object({
|
485
|
+
id: z7.string().describe("Post ID"),
|
743
486
|
platform: PlatformSchema,
|
744
|
-
type:
|
745
|
-
content:
|
746
|
-
url:
|
747
|
-
createdAt:
|
748
|
-
metrics:
|
749
|
-
likes:
|
750
|
-
reposts:
|
751
|
-
replies:
|
752
|
-
quotes:
|
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:
|
755
|
-
quotedPostId:
|
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 =
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
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
|
773
|
-
var UserProfileSchema =
|
774
|
-
userId:
|
775
|
-
username:
|
776
|
-
url:
|
777
|
-
profileImageUrl:
|
778
|
-
isPremium:
|
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:
|
518
|
+
lastUpdated: z8.number().describe("Timestamp when the profile was last updated")
|
781
519
|
}).describe("User profile");
|
782
|
-
var
|
783
|
-
|
784
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
875
|
-
createEnhancedApiResponse,
|
876
|
-
createEnhancedErrorResponse,
|
877
|
-
createErrorDetail,
|
878
|
-
createErrorResponse,
|
879
|
-
createMultiStatusResponse,
|
880
|
-
createSuccessDetail,
|
594
|
+
errorCodeToStatusCode,
|
881
595
|
isPlatformSupported
|
882
596
|
};
|