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