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