@crosspost/types 0.1.7 → 0.1.9

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 CHANGED
@@ -34,6 +34,7 @@ __export(index_exports, {
34
34
  AuthCallbackResponseSchema: () => AuthCallbackResponseSchema,
35
35
  AuthInitRequestSchema: () => AuthInitRequestSchema,
36
36
  AuthRevokeResponseSchema: () => AuthRevokeResponseSchema,
37
+ AuthStatusParamsSchema: () => AuthStatusParamsSchema,
37
38
  AuthStatusResponseSchema: () => AuthStatusResponseSchema,
38
39
  AuthTokenRequestSchema: () => AuthTokenRequestSchema,
39
40
  AuthUrlResponseSchema: () => AuthUrlResponseSchema,
@@ -46,6 +47,7 @@ __export(index_exports, {
46
47
  DeleteResultSchema: () => DeleteResultSchema,
47
48
  EndpointRateLimitResponseSchema: () => EndpointRateLimitResponseSchema,
48
49
  ErrorDetailSchema: () => ErrorDetailSchema,
50
+ HealthStatusSchema: () => HealthStatusSchema,
49
51
  LikePostRequestSchema: () => LikePostRequestSchema,
50
52
  LikePostResponseSchema: () => LikePostResponseSchema,
51
53
  LikeResultSchema: () => LikeResultSchema,
@@ -55,6 +57,7 @@ __export(index_exports, {
55
57
  NearAuthorizationRequestSchema: () => NearAuthorizationRequestSchema,
56
58
  NearAuthorizationResponseSchema: () => NearAuthorizationResponseSchema,
57
59
  NearAuthorizationStatusResponseSchema: () => NearAuthorizationStatusResponseSchema,
60
+ NearUnauthorizationResponseSchema: () => NearUnauthorizationResponseSchema,
58
61
  Platform: () => Platform,
59
62
  PlatformActivitySchema: () => PlatformActivitySchema,
60
63
  PlatformParamSchema: () => PlatformParamSchema,
@@ -138,6 +141,7 @@ var ApiErrorCode = /* @__PURE__ */ ((ApiErrorCode2) => {
138
141
  ApiErrorCode2["POST_DELETION_FAILED"] = "POST_DELETION_FAILED";
139
142
  ApiErrorCode2["POST_INTERACTION_FAILED"] = "POST_INTERACTION_FAILED";
140
143
  ApiErrorCode2["NETWORK_ERROR"] = "NETWORK_ERROR";
144
+ ApiErrorCode2["INVALID_RESPONSE"] = "INVALID_RESPONSE";
141
145
  return ApiErrorCode2;
142
146
  })(ApiErrorCode || {});
143
147
  var ApiErrorCodeSchema = import_zod2.z.enum(Object.values(ApiErrorCode));
@@ -160,7 +164,8 @@ var errorCodeToStatusCode = {
160
164
  ["THREAD_CREATION_FAILED" /* THREAD_CREATION_FAILED */]: 500,
161
165
  ["POST_DELETION_FAILED" /* POST_DELETION_FAILED */]: 500,
162
166
  ["POST_INTERACTION_FAILED" /* POST_INTERACTION_FAILED */]: 500,
163
- ["NETWORK_ERROR" /* NETWORK_ERROR */]: 503
167
+ ["NETWORK_ERROR" /* NETWORK_ERROR */]: 503,
168
+ ["INVALID_RESPONSE" /* INVALID_RESPONSE */]: 500
164
169
  };
165
170
  var ErrorDetailSchema = import_zod2.z.object({
166
171
  message: import_zod2.z.string().describe("Human-readable error message"),
@@ -195,6 +200,11 @@ var SuccessDetailSchema = import_zod3.z.object({
195
200
  additionalData: import_zod3.z.any().optional(),
196
201
  status: import_zod3.z.literal("success")
197
202
  }).catchall(import_zod3.z.any());
203
+ var HealthStatusSchema = import_zod3.z.object({
204
+ status: import_zod3.z.string().describe("Health status of the API"),
205
+ version: import_zod3.z.string().optional().describe("API version"),
206
+ timestamp: import_zod3.z.string().datetime().describe("Current server time")
207
+ }).describe("Health status response");
198
208
  var MultiStatusDataSchema = import_zod3.z.object({
199
209
  summary: import_zod3.z.object({
200
210
  total: import_zod3.z.number().int().nonnegative(),
@@ -230,6 +240,14 @@ var AuthCallbackResponseSchema = import_zod4.z.object({
230
240
  userId: import_zod4.z.string().describe("User ID"),
231
241
  redirectUrl: import_zod4.z.string().optional().describe("URL to redirect the user to after authentication")
232
242
  }).describe("Auth callback response");
243
+ var AuthStatusParamsSchema = import_zod4.z.object({
244
+ platform: import_zod4.z.string().describe("Social media platform"),
245
+ userId: import_zod4.z.string().describe("User ID on the platform")
246
+ }).describe("Token status parameters");
247
+ var NearUnauthorizationResponseSchema = import_zod4.z.object({
248
+ success: import_zod4.z.boolean().describe("Whether the unauthorized operation was successful"),
249
+ nearAccount: import_zod4.z.string().describe("NEAR account ID that was unauthorized")
250
+ }).describe("NEAR unauthorized response");
233
251
  var AuthStatusResponseSchema = import_zod4.z.object({
234
252
  platform: PlatformSchema,
235
253
  userId: import_zod4.z.string().describe("User ID"),
@@ -633,6 +651,7 @@ var ProfileRefreshResponseSchema = import_zod8.z.object({
633
651
  AuthCallbackResponseSchema,
634
652
  AuthInitRequestSchema,
635
653
  AuthRevokeResponseSchema,
654
+ AuthStatusParamsSchema,
636
655
  AuthStatusResponseSchema,
637
656
  AuthTokenRequestSchema,
638
657
  AuthUrlResponseSchema,
@@ -645,6 +664,7 @@ var ProfileRefreshResponseSchema = import_zod8.z.object({
645
664
  DeleteResultSchema,
646
665
  EndpointRateLimitResponseSchema,
647
666
  ErrorDetailSchema,
667
+ HealthStatusSchema,
648
668
  LikePostRequestSchema,
649
669
  LikePostResponseSchema,
650
670
  LikeResultSchema,
@@ -654,6 +674,7 @@ var ProfileRefreshResponseSchema = import_zod8.z.object({
654
674
  NearAuthorizationRequestSchema,
655
675
  NearAuthorizationResponseSchema,
656
676
  NearAuthorizationStatusResponseSchema,
677
+ NearUnauthorizationResponseSchema,
657
678
  Platform,
658
679
  PlatformActivitySchema,
659
680
  PlatformParamSchema,
package/dist/index.d.cts CHANGED
@@ -45,7 +45,8 @@ declare enum ApiErrorCode {
45
45
  THREAD_CREATION_FAILED = "THREAD_CREATION_FAILED",
46
46
  POST_DELETION_FAILED = "POST_DELETION_FAILED",
47
47
  POST_INTERACTION_FAILED = "POST_INTERACTION_FAILED",
48
- NETWORK_ERROR = "NETWORK_ERROR"
48
+ NETWORK_ERROR = "NETWORK_ERROR",
49
+ INVALID_RESPONSE = "INVALID_RESPONSE"
49
50
  }
50
51
  declare const ApiErrorCodeSchema: z.ZodEnum<[string, ...string[]]>;
51
52
  /**
@@ -181,6 +182,19 @@ declare const SuccessDetailSchema: z.ZodObject<{
181
182
  additionalData: z.ZodOptional<z.ZodAny>;
182
183
  status: z.ZodLiteral<"success">;
183
184
  }, z.ZodAny, "strip">>;
185
+ declare const HealthStatusSchema: z.ZodObject<{
186
+ status: z.ZodString;
187
+ version: z.ZodOptional<z.ZodString>;
188
+ timestamp: z.ZodString;
189
+ }, "strip", z.ZodTypeAny, {
190
+ status: string;
191
+ timestamp: string;
192
+ version?: string | undefined;
193
+ }, {
194
+ status: string;
195
+ timestamp: string;
196
+ version?: string | undefined;
197
+ }>;
184
198
  declare const MultiStatusDataSchema: z.ZodObject<{
185
199
  summary: z.ZodObject<{
186
200
  total: z.ZodNumber;
@@ -273,6 +287,7 @@ interface ApiResponse<T> {
273
287
  type ResponseMeta = z.infer<typeof ResponseMetaSchema>;
274
288
  type SuccessDetail = z.infer<typeof SuccessDetailSchema>;
275
289
  type MultiStatusData = z.infer<typeof MultiStatusDataSchema>;
290
+ type HealthStatus = z.infer<typeof HealthStatusSchema>;
276
291
 
277
292
  declare const PlatformParamSchema: z.ZodObject<{
278
293
  platform: z.ZodString;
@@ -327,6 +342,26 @@ declare const AuthCallbackResponseSchema: z.ZodObject<{
327
342
  userId: string;
328
343
  redirectUrl?: string | undefined;
329
344
  }>;
345
+ declare const AuthStatusParamsSchema: z.ZodObject<{
346
+ platform: z.ZodString;
347
+ userId: z.ZodString;
348
+ }, "strip", z.ZodTypeAny, {
349
+ platform: string;
350
+ userId: string;
351
+ }, {
352
+ platform: string;
353
+ userId: string;
354
+ }>;
355
+ declare const NearUnauthorizationResponseSchema: z.ZodObject<{
356
+ success: z.ZodBoolean;
357
+ nearAccount: z.ZodString;
358
+ }, "strip", z.ZodTypeAny, {
359
+ success: boolean;
360
+ nearAccount: string;
361
+ }, {
362
+ success: boolean;
363
+ nearAccount: string;
364
+ }>;
330
365
  declare const AuthStatusResponseSchema: z.ZodObject<{
331
366
  platform: z.ZodNativeEnum<typeof Platform>;
332
367
  userId: z.ZodString;
@@ -455,6 +490,8 @@ type NearAuthorizationRequest = z.infer<typeof NearAuthorizationRequestSchema>;
455
490
  type NearAuthorizationResponse = z.infer<typeof NearAuthorizationResponseSchema>;
456
491
  type NearAuthorizationStatusResponse = z.infer<typeof NearAuthorizationStatusResponseSchema>;
457
492
  type AuthTokenRequest = z.infer<typeof AuthTokenRequestSchema>;
493
+ type AuthStatusParams = z.infer<typeof AuthStatusParamsSchema>;
494
+ type NearUnauthorizationResponse = z.infer<typeof NearUnauthorizationResponseSchema>;
458
495
 
459
496
  declare const MediaContentSchema: z.ZodObject<{
460
497
  data: z.ZodUnion<[z.ZodString, z.ZodType<buffer.Blob, z.ZodTypeDef, buffer.Blob>]>;
@@ -3038,4 +3075,4 @@ declare const ProfileRefreshResponseSchema: z.ZodObject<{
3038
3075
  type UserProfile = z.infer<typeof UserProfileSchema>;
3039
3076
  type ProfileRefreshResponse = z.infer<typeof ProfileRefreshResponseSchema>;
3040
3077
 
3041
- export { type AccountActivity, type AccountActivityEntry, AccountActivityEntrySchema, type AccountActivityParams, AccountActivityParamsSchema, type AccountActivityQuery, AccountActivityQuerySchema, type AccountActivityResponse, type AccountPost, AccountPostSchema, type AccountPostsParams, AccountPostsParamsSchema, type AccountPostsQuery, AccountPostsQuerySchema, type AccountPostsResponse, type ActivityLeaderboardQuery, ActivityLeaderboardQuerySchema, type ActivityLeaderboardResponse, type AllRateLimitsResponse, AllRateLimitsResponseSchema, ApiErrorCode, ApiErrorCodeSchema, type ApiErrorResponse, type ApiResponse, type AuthCallbackQuery, AuthCallbackQuerySchema, type AuthCallbackResponse, AuthCallbackResponseSchema, type AuthInitRequest, AuthInitRequestSchema, type AuthRevokeResponse, AuthRevokeResponseSchema, type AuthStatusResponse, AuthStatusResponseSchema, type AuthTokenRequest, AuthTokenRequestSchema, type AuthUrlResponse, AuthUrlResponseSchema, type ConnectedAccount, ConnectedAccountSchema, type ConnectedAccountsResponse, ConnectedAccountsResponseSchema, type CreatePostRequest, CreatePostRequestSchema, type CreatePostResponse, CreatePostResponseSchema, type DeletePostRequest, DeletePostRequestSchema, type DeletePostResponse, DeletePostResponseSchema, type DeleteResult, DeleteResultSchema, type EndpointRateLimitResponse, EndpointRateLimitResponseSchema, type ErrorDetail, ErrorDetailSchema, type ErrorDetails, type LikePostRequest, LikePostRequestSchema, type LikePostResponse, LikePostResponseSchema, type LikeResult, LikeResultSchema, type Media, type MediaContent, MediaContentSchema, MediaSchema, type MultiStatusData, MultiStatusDataSchema, type NearAuthorizationRequest, NearAuthorizationRequestSchema, type NearAuthorizationResponse, NearAuthorizationResponseSchema, type NearAuthorizationStatusResponse, NearAuthorizationStatusResponseSchema, Platform, type PlatformAccountActivity, type PlatformActivity, PlatformActivitySchema, type PlatformName, type PlatformParam, PlatformParamSchema, type PlatformRateLimit, PlatformRateLimitSchema, PlatformSchema, type Post, type PostContent, PostContentSchema, type PostMetrics, PostMetricsSchema, type PostMultiStatusResponse, PostMultiStatusResponseSchema, type PostRecord, type PostResponse, PostResponseSchema, type PostResult, PostResultSchema, PostSchema, type PostSuccessDetail, PostSuccessDetailSchema, type PostToDelete, PostToDeleteSchema, type ProfileRefreshResponse, ProfileRefreshResponseSchema, type QuotePostRequest, QuotePostRequestSchema, type QuotePostResponse, QuotePostResponseSchema, type RateLimitEndpoint, type RateLimitEndpointParam, RateLimitEndpointParamSchema, RateLimitEndpointSchema, type RateLimitResponse, RateLimitResponseSchema, type RateLimitStatus, type RateLimitStatusResponse, RateLimitStatusResponseSchema, RateLimitStatusSchema, type ReplyToPostRequest, ReplyToPostRequestSchema, type ReplyToPostResponse, ReplyToPostResponseSchema, type RepostRequest, RepostRequestSchema, type RepostResponse, RepostResponseSchema, type ResponseMeta, ResponseMetaSchema, SUPPORTED_PLATFORMS, type SuccessDetail, SuccessDetailSchema, type SupportedPlatformName, SupportedPlatformSchema, type Target, TargetSchema, TimePeriod, type UnlikePostRequest, UnlikePostRequestSchema, type UnlikePostResponse, UnlikePostResponseSchema, type UsageRateLimit, UsageRateLimitSchema, type UserProfile, UserProfileSchema, errorCodeToStatusCode, isPlatformSupported };
3078
+ export { type AccountActivity, type AccountActivityEntry, AccountActivityEntrySchema, type AccountActivityParams, AccountActivityParamsSchema, type AccountActivityQuery, AccountActivityQuerySchema, type AccountActivityResponse, type AccountPost, AccountPostSchema, type AccountPostsParams, AccountPostsParamsSchema, type AccountPostsQuery, AccountPostsQuerySchema, type AccountPostsResponse, type ActivityLeaderboardQuery, ActivityLeaderboardQuerySchema, type ActivityLeaderboardResponse, type AllRateLimitsResponse, AllRateLimitsResponseSchema, ApiErrorCode, ApiErrorCodeSchema, type ApiErrorResponse, type ApiResponse, type AuthCallbackQuery, AuthCallbackQuerySchema, type AuthCallbackResponse, AuthCallbackResponseSchema, type AuthInitRequest, AuthInitRequestSchema, type AuthRevokeResponse, AuthRevokeResponseSchema, type AuthStatusParams, AuthStatusParamsSchema, type AuthStatusResponse, AuthStatusResponseSchema, type AuthTokenRequest, AuthTokenRequestSchema, type AuthUrlResponse, AuthUrlResponseSchema, type ConnectedAccount, ConnectedAccountSchema, type ConnectedAccountsResponse, ConnectedAccountsResponseSchema, type CreatePostRequest, CreatePostRequestSchema, type CreatePostResponse, CreatePostResponseSchema, type DeletePostRequest, DeletePostRequestSchema, type DeletePostResponse, DeletePostResponseSchema, type DeleteResult, DeleteResultSchema, type EndpointRateLimitResponse, EndpointRateLimitResponseSchema, type ErrorDetail, ErrorDetailSchema, type ErrorDetails, type HealthStatus, HealthStatusSchema, type LikePostRequest, LikePostRequestSchema, type LikePostResponse, LikePostResponseSchema, type LikeResult, LikeResultSchema, type Media, type MediaContent, MediaContentSchema, MediaSchema, type MultiStatusData, MultiStatusDataSchema, type NearAuthorizationRequest, NearAuthorizationRequestSchema, type NearAuthorizationResponse, NearAuthorizationResponseSchema, type NearAuthorizationStatusResponse, NearAuthorizationStatusResponseSchema, type NearUnauthorizationResponse, NearUnauthorizationResponseSchema, Platform, type PlatformAccountActivity, type PlatformActivity, PlatformActivitySchema, type PlatformName, type PlatformParam, PlatformParamSchema, type PlatformRateLimit, PlatformRateLimitSchema, PlatformSchema, type Post, type PostContent, PostContentSchema, type PostMetrics, PostMetricsSchema, type PostMultiStatusResponse, PostMultiStatusResponseSchema, type PostRecord, type PostResponse, PostResponseSchema, type PostResult, PostResultSchema, PostSchema, type PostSuccessDetail, PostSuccessDetailSchema, type PostToDelete, PostToDeleteSchema, type ProfileRefreshResponse, ProfileRefreshResponseSchema, type QuotePostRequest, QuotePostRequestSchema, type QuotePostResponse, QuotePostResponseSchema, type RateLimitEndpoint, type RateLimitEndpointParam, RateLimitEndpointParamSchema, RateLimitEndpointSchema, type RateLimitResponse, RateLimitResponseSchema, type RateLimitStatus, type RateLimitStatusResponse, RateLimitStatusResponseSchema, RateLimitStatusSchema, type ReplyToPostRequest, ReplyToPostRequestSchema, type ReplyToPostResponse, ReplyToPostResponseSchema, type RepostRequest, RepostRequestSchema, type RepostResponse, RepostResponseSchema, type ResponseMeta, ResponseMetaSchema, SUPPORTED_PLATFORMS, type SuccessDetail, SuccessDetailSchema, type SupportedPlatformName, SupportedPlatformSchema, type Target, TargetSchema, TimePeriod, type UnlikePostRequest, UnlikePostRequestSchema, type UnlikePostResponse, UnlikePostResponseSchema, type UsageRateLimit, UsageRateLimitSchema, type UserProfile, UserProfileSchema, errorCodeToStatusCode, isPlatformSupported };
package/dist/index.d.ts CHANGED
@@ -45,7 +45,8 @@ declare enum ApiErrorCode {
45
45
  THREAD_CREATION_FAILED = "THREAD_CREATION_FAILED",
46
46
  POST_DELETION_FAILED = "POST_DELETION_FAILED",
47
47
  POST_INTERACTION_FAILED = "POST_INTERACTION_FAILED",
48
- NETWORK_ERROR = "NETWORK_ERROR"
48
+ NETWORK_ERROR = "NETWORK_ERROR",
49
+ INVALID_RESPONSE = "INVALID_RESPONSE"
49
50
  }
50
51
  declare const ApiErrorCodeSchema: z.ZodEnum<[string, ...string[]]>;
51
52
  /**
@@ -181,6 +182,19 @@ declare const SuccessDetailSchema: z.ZodObject<{
181
182
  additionalData: z.ZodOptional<z.ZodAny>;
182
183
  status: z.ZodLiteral<"success">;
183
184
  }, z.ZodAny, "strip">>;
185
+ declare const HealthStatusSchema: z.ZodObject<{
186
+ status: z.ZodString;
187
+ version: z.ZodOptional<z.ZodString>;
188
+ timestamp: z.ZodString;
189
+ }, "strip", z.ZodTypeAny, {
190
+ status: string;
191
+ timestamp: string;
192
+ version?: string | undefined;
193
+ }, {
194
+ status: string;
195
+ timestamp: string;
196
+ version?: string | undefined;
197
+ }>;
184
198
  declare const MultiStatusDataSchema: z.ZodObject<{
185
199
  summary: z.ZodObject<{
186
200
  total: z.ZodNumber;
@@ -273,6 +287,7 @@ interface ApiResponse<T> {
273
287
  type ResponseMeta = z.infer<typeof ResponseMetaSchema>;
274
288
  type SuccessDetail = z.infer<typeof SuccessDetailSchema>;
275
289
  type MultiStatusData = z.infer<typeof MultiStatusDataSchema>;
290
+ type HealthStatus = z.infer<typeof HealthStatusSchema>;
276
291
 
277
292
  declare const PlatformParamSchema: z.ZodObject<{
278
293
  platform: z.ZodString;
@@ -327,6 +342,26 @@ declare const AuthCallbackResponseSchema: z.ZodObject<{
327
342
  userId: string;
328
343
  redirectUrl?: string | undefined;
329
344
  }>;
345
+ declare const AuthStatusParamsSchema: z.ZodObject<{
346
+ platform: z.ZodString;
347
+ userId: z.ZodString;
348
+ }, "strip", z.ZodTypeAny, {
349
+ platform: string;
350
+ userId: string;
351
+ }, {
352
+ platform: string;
353
+ userId: string;
354
+ }>;
355
+ declare const NearUnauthorizationResponseSchema: z.ZodObject<{
356
+ success: z.ZodBoolean;
357
+ nearAccount: z.ZodString;
358
+ }, "strip", z.ZodTypeAny, {
359
+ success: boolean;
360
+ nearAccount: string;
361
+ }, {
362
+ success: boolean;
363
+ nearAccount: string;
364
+ }>;
330
365
  declare const AuthStatusResponseSchema: z.ZodObject<{
331
366
  platform: z.ZodNativeEnum<typeof Platform>;
332
367
  userId: z.ZodString;
@@ -455,6 +490,8 @@ type NearAuthorizationRequest = z.infer<typeof NearAuthorizationRequestSchema>;
455
490
  type NearAuthorizationResponse = z.infer<typeof NearAuthorizationResponseSchema>;
456
491
  type NearAuthorizationStatusResponse = z.infer<typeof NearAuthorizationStatusResponseSchema>;
457
492
  type AuthTokenRequest = z.infer<typeof AuthTokenRequestSchema>;
493
+ type AuthStatusParams = z.infer<typeof AuthStatusParamsSchema>;
494
+ type NearUnauthorizationResponse = z.infer<typeof NearUnauthorizationResponseSchema>;
458
495
 
459
496
  declare const MediaContentSchema: z.ZodObject<{
460
497
  data: z.ZodUnion<[z.ZodString, z.ZodType<buffer.Blob, z.ZodTypeDef, buffer.Blob>]>;
@@ -3038,4 +3075,4 @@ declare const ProfileRefreshResponseSchema: z.ZodObject<{
3038
3075
  type UserProfile = z.infer<typeof UserProfileSchema>;
3039
3076
  type ProfileRefreshResponse = z.infer<typeof ProfileRefreshResponseSchema>;
3040
3077
 
3041
- export { type AccountActivity, type AccountActivityEntry, AccountActivityEntrySchema, type AccountActivityParams, AccountActivityParamsSchema, type AccountActivityQuery, AccountActivityQuerySchema, type AccountActivityResponse, type AccountPost, AccountPostSchema, type AccountPostsParams, AccountPostsParamsSchema, type AccountPostsQuery, AccountPostsQuerySchema, type AccountPostsResponse, type ActivityLeaderboardQuery, ActivityLeaderboardQuerySchema, type ActivityLeaderboardResponse, type AllRateLimitsResponse, AllRateLimitsResponseSchema, ApiErrorCode, ApiErrorCodeSchema, type ApiErrorResponse, type ApiResponse, type AuthCallbackQuery, AuthCallbackQuerySchema, type AuthCallbackResponse, AuthCallbackResponseSchema, type AuthInitRequest, AuthInitRequestSchema, type AuthRevokeResponse, AuthRevokeResponseSchema, type AuthStatusResponse, AuthStatusResponseSchema, type AuthTokenRequest, AuthTokenRequestSchema, type AuthUrlResponse, AuthUrlResponseSchema, type ConnectedAccount, ConnectedAccountSchema, type ConnectedAccountsResponse, ConnectedAccountsResponseSchema, type CreatePostRequest, CreatePostRequestSchema, type CreatePostResponse, CreatePostResponseSchema, type DeletePostRequest, DeletePostRequestSchema, type DeletePostResponse, DeletePostResponseSchema, type DeleteResult, DeleteResultSchema, type EndpointRateLimitResponse, EndpointRateLimitResponseSchema, type ErrorDetail, ErrorDetailSchema, type ErrorDetails, type LikePostRequest, LikePostRequestSchema, type LikePostResponse, LikePostResponseSchema, type LikeResult, LikeResultSchema, type Media, type MediaContent, MediaContentSchema, MediaSchema, type MultiStatusData, MultiStatusDataSchema, type NearAuthorizationRequest, NearAuthorizationRequestSchema, type NearAuthorizationResponse, NearAuthorizationResponseSchema, type NearAuthorizationStatusResponse, NearAuthorizationStatusResponseSchema, Platform, type PlatformAccountActivity, type PlatformActivity, PlatformActivitySchema, type PlatformName, type PlatformParam, PlatformParamSchema, type PlatformRateLimit, PlatformRateLimitSchema, PlatformSchema, type Post, type PostContent, PostContentSchema, type PostMetrics, PostMetricsSchema, type PostMultiStatusResponse, PostMultiStatusResponseSchema, type PostRecord, type PostResponse, PostResponseSchema, type PostResult, PostResultSchema, PostSchema, type PostSuccessDetail, PostSuccessDetailSchema, type PostToDelete, PostToDeleteSchema, type ProfileRefreshResponse, ProfileRefreshResponseSchema, type QuotePostRequest, QuotePostRequestSchema, type QuotePostResponse, QuotePostResponseSchema, type RateLimitEndpoint, type RateLimitEndpointParam, RateLimitEndpointParamSchema, RateLimitEndpointSchema, type RateLimitResponse, RateLimitResponseSchema, type RateLimitStatus, type RateLimitStatusResponse, RateLimitStatusResponseSchema, RateLimitStatusSchema, type ReplyToPostRequest, ReplyToPostRequestSchema, type ReplyToPostResponse, ReplyToPostResponseSchema, type RepostRequest, RepostRequestSchema, type RepostResponse, RepostResponseSchema, type ResponseMeta, ResponseMetaSchema, SUPPORTED_PLATFORMS, type SuccessDetail, SuccessDetailSchema, type SupportedPlatformName, SupportedPlatformSchema, type Target, TargetSchema, TimePeriod, type UnlikePostRequest, UnlikePostRequestSchema, type UnlikePostResponse, UnlikePostResponseSchema, type UsageRateLimit, UsageRateLimitSchema, type UserProfile, UserProfileSchema, errorCodeToStatusCode, isPlatformSupported };
3078
+ export { type AccountActivity, type AccountActivityEntry, AccountActivityEntrySchema, type AccountActivityParams, AccountActivityParamsSchema, type AccountActivityQuery, AccountActivityQuerySchema, type AccountActivityResponse, type AccountPost, AccountPostSchema, type AccountPostsParams, AccountPostsParamsSchema, type AccountPostsQuery, AccountPostsQuerySchema, type AccountPostsResponse, type ActivityLeaderboardQuery, ActivityLeaderboardQuerySchema, type ActivityLeaderboardResponse, type AllRateLimitsResponse, AllRateLimitsResponseSchema, ApiErrorCode, ApiErrorCodeSchema, type ApiErrorResponse, type ApiResponse, type AuthCallbackQuery, AuthCallbackQuerySchema, type AuthCallbackResponse, AuthCallbackResponseSchema, type AuthInitRequest, AuthInitRequestSchema, type AuthRevokeResponse, AuthRevokeResponseSchema, type AuthStatusParams, AuthStatusParamsSchema, type AuthStatusResponse, AuthStatusResponseSchema, type AuthTokenRequest, AuthTokenRequestSchema, type AuthUrlResponse, AuthUrlResponseSchema, type ConnectedAccount, ConnectedAccountSchema, type ConnectedAccountsResponse, ConnectedAccountsResponseSchema, type CreatePostRequest, CreatePostRequestSchema, type CreatePostResponse, CreatePostResponseSchema, type DeletePostRequest, DeletePostRequestSchema, type DeletePostResponse, DeletePostResponseSchema, type DeleteResult, DeleteResultSchema, type EndpointRateLimitResponse, EndpointRateLimitResponseSchema, type ErrorDetail, ErrorDetailSchema, type ErrorDetails, type HealthStatus, HealthStatusSchema, type LikePostRequest, LikePostRequestSchema, type LikePostResponse, LikePostResponseSchema, type LikeResult, LikeResultSchema, type Media, type MediaContent, MediaContentSchema, MediaSchema, type MultiStatusData, MultiStatusDataSchema, type NearAuthorizationRequest, NearAuthorizationRequestSchema, type NearAuthorizationResponse, NearAuthorizationResponseSchema, type NearAuthorizationStatusResponse, NearAuthorizationStatusResponseSchema, type NearUnauthorizationResponse, NearUnauthorizationResponseSchema, Platform, type PlatformAccountActivity, type PlatformActivity, PlatformActivitySchema, type PlatformName, type PlatformParam, PlatformParamSchema, type PlatformRateLimit, PlatformRateLimitSchema, PlatformSchema, type Post, type PostContent, PostContentSchema, type PostMetrics, PostMetricsSchema, type PostMultiStatusResponse, PostMultiStatusResponseSchema, type PostRecord, type PostResponse, PostResponseSchema, type PostResult, PostResultSchema, PostSchema, type PostSuccessDetail, PostSuccessDetailSchema, type PostToDelete, PostToDeleteSchema, type ProfileRefreshResponse, ProfileRefreshResponseSchema, type QuotePostRequest, QuotePostRequestSchema, type QuotePostResponse, QuotePostResponseSchema, type RateLimitEndpoint, type RateLimitEndpointParam, RateLimitEndpointParamSchema, RateLimitEndpointSchema, type RateLimitResponse, RateLimitResponseSchema, type RateLimitStatus, type RateLimitStatusResponse, RateLimitStatusResponseSchema, RateLimitStatusSchema, type ReplyToPostRequest, ReplyToPostRequestSchema, type ReplyToPostResponse, ReplyToPostResponseSchema, type RepostRequest, RepostRequestSchema, type RepostResponse, RepostResponseSchema, type ResponseMeta, ResponseMetaSchema, SUPPORTED_PLATFORMS, type SuccessDetail, SuccessDetailSchema, type SupportedPlatformName, SupportedPlatformSchema, type Target, TargetSchema, TimePeriod, type UnlikePostRequest, UnlikePostRequestSchema, type UnlikePostResponse, UnlikePostResponseSchema, type UsageRateLimit, UsageRateLimitSchema, type UserProfile, UserProfileSchema, errorCodeToStatusCode, isPlatformSupported };
package/dist/index.js CHANGED
@@ -41,6 +41,7 @@ var ApiErrorCode = /* @__PURE__ */ ((ApiErrorCode2) => {
41
41
  ApiErrorCode2["POST_DELETION_FAILED"] = "POST_DELETION_FAILED";
42
42
  ApiErrorCode2["POST_INTERACTION_FAILED"] = "POST_INTERACTION_FAILED";
43
43
  ApiErrorCode2["NETWORK_ERROR"] = "NETWORK_ERROR";
44
+ ApiErrorCode2["INVALID_RESPONSE"] = "INVALID_RESPONSE";
44
45
  return ApiErrorCode2;
45
46
  })(ApiErrorCode || {});
46
47
  var ApiErrorCodeSchema = z2.enum(Object.values(ApiErrorCode));
@@ -63,7 +64,8 @@ var errorCodeToStatusCode = {
63
64
  ["THREAD_CREATION_FAILED" /* THREAD_CREATION_FAILED */]: 500,
64
65
  ["POST_DELETION_FAILED" /* POST_DELETION_FAILED */]: 500,
65
66
  ["POST_INTERACTION_FAILED" /* POST_INTERACTION_FAILED */]: 500,
66
- ["NETWORK_ERROR" /* NETWORK_ERROR */]: 503
67
+ ["NETWORK_ERROR" /* NETWORK_ERROR */]: 503,
68
+ ["INVALID_RESPONSE" /* INVALID_RESPONSE */]: 500
67
69
  };
68
70
  var ErrorDetailSchema = z2.object({
69
71
  message: z2.string().describe("Human-readable error message"),
@@ -98,6 +100,11 @@ var SuccessDetailSchema = z3.object({
98
100
  additionalData: z3.any().optional(),
99
101
  status: z3.literal("success")
100
102
  }).catchall(z3.any());
103
+ var HealthStatusSchema = z3.object({
104
+ status: z3.string().describe("Health status of the API"),
105
+ version: z3.string().optional().describe("API version"),
106
+ timestamp: z3.string().datetime().describe("Current server time")
107
+ }).describe("Health status response");
101
108
  var MultiStatusDataSchema = z3.object({
102
109
  summary: z3.object({
103
110
  total: z3.number().int().nonnegative(),
@@ -133,6 +140,14 @@ var AuthCallbackResponseSchema = z4.object({
133
140
  userId: z4.string().describe("User ID"),
134
141
  redirectUrl: z4.string().optional().describe("URL to redirect the user to after authentication")
135
142
  }).describe("Auth callback response");
143
+ var AuthStatusParamsSchema = z4.object({
144
+ platform: z4.string().describe("Social media platform"),
145
+ userId: z4.string().describe("User ID on the platform")
146
+ }).describe("Token status parameters");
147
+ var NearUnauthorizationResponseSchema = z4.object({
148
+ success: z4.boolean().describe("Whether the unauthorized operation was successful"),
149
+ nearAccount: z4.string().describe("NEAR account ID that was unauthorized")
150
+ }).describe("NEAR unauthorized response");
136
151
  var AuthStatusResponseSchema = z4.object({
137
152
  platform: PlatformSchema,
138
153
  userId: z4.string().describe("User ID"),
@@ -535,6 +550,7 @@ export {
535
550
  AuthCallbackResponseSchema,
536
551
  AuthInitRequestSchema,
537
552
  AuthRevokeResponseSchema,
553
+ AuthStatusParamsSchema,
538
554
  AuthStatusResponseSchema,
539
555
  AuthTokenRequestSchema,
540
556
  AuthUrlResponseSchema,
@@ -547,6 +563,7 @@ export {
547
563
  DeleteResultSchema,
548
564
  EndpointRateLimitResponseSchema,
549
565
  ErrorDetailSchema,
566
+ HealthStatusSchema,
550
567
  LikePostRequestSchema,
551
568
  LikePostResponseSchema,
552
569
  LikeResultSchema,
@@ -556,6 +573,7 @@ export {
556
573
  NearAuthorizationRequestSchema,
557
574
  NearAuthorizationResponseSchema,
558
575
  NearAuthorizationStatusResponseSchema,
576
+ NearUnauthorizationResponseSchema,
559
577
  Platform,
560
578
  PlatformActivitySchema,
561
579
  PlatformParamSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crosspost/types",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "Shared type definitions for Crosspost API",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
package/src/auth.ts CHANGED
@@ -29,6 +29,16 @@ export const AuthCallbackResponseSchema = z.object({
29
29
  redirectUrl: z.string().optional().describe('URL to redirect the user to after authentication'),
30
30
  }).describe('Auth callback response');
31
31
 
32
+ export const AuthStatusParamsSchema = z.object({
33
+ platform: z.string().describe('Social media platform'),
34
+ userId: z.string().describe('User ID on the platform'),
35
+ }).describe('Token status parameters');
36
+
37
+ export const NearUnauthorizationResponseSchema = z.object({
38
+ success: z.boolean().describe('Whether the unauthorized operation was successful'),
39
+ nearAccount: z.string().describe('NEAR account ID that was unauthorized'),
40
+ }).describe('NEAR unauthorized response');
41
+
32
42
  export const AuthStatusResponseSchema = z.object({
33
43
  platform: PlatformSchema,
34
44
  userId: z.string().describe('User ID'),
@@ -89,3 +99,5 @@ export type NearAuthorizationRequest = z.infer<typeof NearAuthorizationRequestSc
89
99
  export type NearAuthorizationResponse = z.infer<typeof NearAuthorizationResponseSchema>;
90
100
  export type NearAuthorizationStatusResponse = z.infer<typeof NearAuthorizationStatusResponseSchema>;
91
101
  export type AuthTokenRequest = z.infer<typeof AuthTokenRequestSchema>;
102
+ export type AuthStatusParams = z.infer<typeof AuthStatusParamsSchema>;
103
+ export type NearUnauthorizationResponse = z.infer<typeof NearUnauthorizationResponseSchema>;
package/src/errors.ts CHANGED
@@ -42,6 +42,9 @@ export enum ApiErrorCode {
42
42
 
43
43
  // Network errors
44
44
  NETWORK_ERROR = 'NETWORK_ERROR',
45
+
46
+ // Response format errors
47
+ INVALID_RESPONSE = 'INVALID_RESPONSE',
45
48
  }
46
49
 
47
50
  export const ApiErrorCodeSchema = z.enum(Object.values(ApiErrorCode) as [string, ...string[]]);
@@ -70,6 +73,7 @@ export const errorCodeToStatusCode: Record<ApiErrorCode, StatusCode> = {
70
73
  [ApiErrorCode.POST_DELETION_FAILED]: 500,
71
74
  [ApiErrorCode.POST_INTERACTION_FAILED]: 500,
72
75
  [ApiErrorCode.NETWORK_ERROR]: 503,
76
+ [ApiErrorCode.INVALID_RESPONSE]: 500,
73
77
  };
74
78
 
75
79
  /**
package/src/response.ts CHANGED
@@ -28,6 +28,12 @@ export const SuccessDetailSchema = z.object({
28
28
  status: z.literal('success'),
29
29
  }).catchall(z.any());
30
30
 
31
+ export const HealthStatusSchema = z.object({
32
+ status: z.string().describe('Health status of the API'),
33
+ version: z.string().optional().describe('API version'),
34
+ timestamp: z.string().datetime().describe('Current server time'),
35
+ }).describe('Health status response');
36
+
31
37
  export const MultiStatusDataSchema = z.object({
32
38
  summary: z.object({
33
39
  total: z.number().int().nonnegative(),
@@ -48,3 +54,4 @@ export interface ApiResponse<T> {
48
54
  export type ResponseMeta = z.infer<typeof ResponseMetaSchema>;
49
55
  export type SuccessDetail = z.infer<typeof SuccessDetailSchema>;
50
56
  export type MultiStatusData = z.infer<typeof MultiStatusDataSchema>;
57
+ export type HealthStatus = z.infer<typeof HealthStatusSchema>;