@crosspost/types 0.1.14 → 0.2.0

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
@@ -55,6 +55,7 @@ __export(index_exports, {
55
55
  MediaContentSchema: () => MediaContentSchema,
56
56
  MediaSchema: () => MediaSchema,
57
57
  MultiStatusDataSchema: () => MultiStatusDataSchema,
58
+ MultiStatusSummarySchema: () => MultiStatusSummarySchema,
58
59
  NearAuthorizationRequestSchema: () => NearAuthorizationRequestSchema,
59
60
  NearAuthorizationResponseSchema: () => NearAuthorizationResponseSchema,
60
61
  NearAuthorizationStatusResponseSchema: () => NearAuthorizationStatusResponseSchema,
@@ -66,11 +67,9 @@ __export(index_exports, {
66
67
  PlatformSchema: () => PlatformSchema,
67
68
  PostContentSchema: () => PostContentSchema,
68
69
  PostMetricsSchema: () => PostMetricsSchema,
69
- PostMultiStatusResponseSchema: () => PostMultiStatusResponseSchema,
70
70
  PostResponseSchema: () => PostResponseSchema,
71
71
  PostResultSchema: () => PostResultSchema,
72
72
  PostSchema: () => PostSchema,
73
- PostSuccessDetailSchema: () => PostSuccessDetailSchema,
74
73
  PostToDeleteSchema: () => PostToDeleteSchema,
75
74
  ProfileRefreshResponseSchema: () => ProfileRefreshResponseSchema,
76
75
  QuotePostRequestSchema: () => QuotePostRequestSchema,
@@ -143,6 +142,8 @@ var ApiErrorCode = /* @__PURE__ */ ((ApiErrorCode2) => {
143
142
  ApiErrorCode2["POST_INTERACTION_FAILED"] = "POST_INTERACTION_FAILED";
144
143
  ApiErrorCode2["NETWORK_ERROR"] = "NETWORK_ERROR";
145
144
  ApiErrorCode2["INVALID_RESPONSE"] = "INVALID_RESPONSE";
145
+ ApiErrorCode2["TOKEN_REFRESH_FAILED"] = "TOKEN_REFRESH_FAILED";
146
+ ApiErrorCode2["PROFILE_REFRESH_FAILED"] = "PROFILE_REFRESH_FAILED";
146
147
  return ApiErrorCode2;
147
148
  })(ApiErrorCode || {});
148
149
  var ApiErrorCodeSchema = import_zod2.z.enum(Object.values(ApiErrorCode));
@@ -166,7 +167,9 @@ var errorCodeToStatusCode = {
166
167
  ["POST_DELETION_FAILED" /* POST_DELETION_FAILED */]: 500,
167
168
  ["POST_INTERACTION_FAILED" /* POST_INTERACTION_FAILED */]: 500,
168
169
  ["NETWORK_ERROR" /* NETWORK_ERROR */]: 503,
169
- ["INVALID_RESPONSE" /* INVALID_RESPONSE */]: 500
170
+ ["INVALID_RESPONSE" /* INVALID_RESPONSE */]: 500,
171
+ ["TOKEN_REFRESH_FAILED" /* TOKEN_REFRESH_FAILED */]: 500,
172
+ ["PROFILE_REFRESH_FAILED" /* PROFILE_REFRESH_FAILED */]: 500
170
173
  };
171
174
  var ErrorDetailSchema = import_zod2.z.object({
172
175
  message: import_zod2.z.string().describe("Human-readable error message"),
@@ -198,7 +201,7 @@ var ResponseMetaSchema = import_zod3.z.object({
198
201
  var SuccessDetailSchema = import_zod3.z.object({
199
202
  platform: import_zod3.z.string(),
200
203
  userId: import_zod3.z.string(),
201
- additionalData: import_zod3.z.any().optional(),
204
+ details: import_zod3.z.any().optional(),
202
205
  status: import_zod3.z.literal("success")
203
206
  }).catchall(import_zod3.z.any());
204
207
  var HealthStatusSchema = import_zod3.z.object({
@@ -206,12 +209,13 @@ var HealthStatusSchema = import_zod3.z.object({
206
209
  version: import_zod3.z.string().optional().describe("API version"),
207
210
  timestamp: import_zod3.z.string().datetime().describe("Current server time")
208
211
  }).describe("Health status response");
212
+ var MultiStatusSummarySchema = import_zod3.z.object({
213
+ total: import_zod3.z.number().int().nonnegative(),
214
+ succeeded: import_zod3.z.number().int().nonnegative(),
215
+ failed: import_zod3.z.number().int().nonnegative()
216
+ });
209
217
  var MultiStatusDataSchema = import_zod3.z.object({
210
- summary: import_zod3.z.object({
211
- total: import_zod3.z.number().int().nonnegative(),
212
- succeeded: import_zod3.z.number().int().nonnegative(),
213
- failed: import_zod3.z.number().int().nonnegative()
214
- }),
218
+ summary: MultiStatusSummarySchema,
215
219
  results: import_zod3.z.array(SuccessDetailSchema),
216
220
  errors: import_zod3.z.array(ErrorDetailSchema)
217
221
  });
@@ -363,13 +367,6 @@ var LikeResultSchema = import_zod6.z.object({
363
367
  success: import_zod6.z.boolean().describe("Whether the like was successful"),
364
368
  id: import_zod6.z.string().describe("ID of the liked post")
365
369
  }).describe("Like result");
366
- var PostSuccessDetailSchema = import_zod6.z.object({
367
- platform: PlatformSchema,
368
- userId: import_zod6.z.string().describe("User ID"),
369
- status: import_zod6.z.literal("success"),
370
- postId: import_zod6.z.string().optional().describe("Post ID"),
371
- postUrl: import_zod6.z.string().optional().describe("URL to the post")
372
- }).catchall(import_zod6.z.any()).describe("Post success detail");
373
370
  var TargetSchema = import_zod6.z.object({
374
371
  platform: PlatformSchema.describe('The platform to post to (e.g., "twitter")'),
375
372
  userId: import_zod6.z.string().describe("User ID on the platform")
@@ -446,15 +443,6 @@ var LikePostResponseSchema = import_zod6.z.object({
446
443
  var UnlikePostResponseSchema = import_zod6.z.object({
447
444
  id: import_zod6.z.string().describe("ID of the unliked post")
448
445
  }).describe("Unlike post response");
449
- var PostMultiStatusResponseSchema = import_zod6.z.object({
450
- summary: import_zod6.z.object({
451
- total: import_zod6.z.number().describe("Total number of operations"),
452
- succeeded: import_zod6.z.number().describe("Number of successful operations"),
453
- failed: import_zod6.z.number().describe("Number of failed operations")
454
- }),
455
- results: import_zod6.z.array(PostSuccessDetailSchema).describe("Successful operations"),
456
- errors: import_zod6.z.array(ErrorDetailSchema).describe("Failed operations")
457
- }).describe("Multi-status response for post operations");
458
446
 
459
447
  // src/rate-limit.ts
460
448
  var import_zod7 = require("zod");
@@ -681,6 +669,7 @@ var AccountPostsResponseSchema = import_zod8.z.object({
681
669
  MediaContentSchema,
682
670
  MediaSchema,
683
671
  MultiStatusDataSchema,
672
+ MultiStatusSummarySchema,
684
673
  NearAuthorizationRequestSchema,
685
674
  NearAuthorizationResponseSchema,
686
675
  NearAuthorizationStatusResponseSchema,
@@ -692,11 +681,9 @@ var AccountPostsResponseSchema = import_zod8.z.object({
692
681
  PlatformSchema,
693
682
  PostContentSchema,
694
683
  PostMetricsSchema,
695
- PostMultiStatusResponseSchema,
696
684
  PostResponseSchema,
697
685
  PostResultSchema,
698
686
  PostSchema,
699
- PostSuccessDetailSchema,
700
687
  PostToDeleteSchema,
701
688
  ProfileRefreshResponseSchema,
702
689
  QuotePostRequestSchema,
package/dist/index.d.cts CHANGED
@@ -46,7 +46,9 @@ declare enum ApiErrorCode {
46
46
  POST_DELETION_FAILED = "POST_DELETION_FAILED",
47
47
  POST_INTERACTION_FAILED = "POST_INTERACTION_FAILED",
48
48
  NETWORK_ERROR = "NETWORK_ERROR",
49
- INVALID_RESPONSE = "INVALID_RESPONSE"
49
+ INVALID_RESPONSE = "INVALID_RESPONSE",
50
+ TOKEN_REFRESH_FAILED = "TOKEN_REFRESH_FAILED",
51
+ PROFILE_REFRESH_FAILED = "PROFILE_REFRESH_FAILED"
50
52
  }
51
53
  declare const ApiErrorCodeSchema: z.ZodEnum<[string, ...string[]]>;
52
54
  /**
@@ -169,17 +171,17 @@ declare const ResponseMetaSchema: z.ZodObject<{
169
171
  declare const SuccessDetailSchema: z.ZodObject<{
170
172
  platform: z.ZodString;
171
173
  userId: z.ZodString;
172
- additionalData: z.ZodOptional<z.ZodAny>;
174
+ details: z.ZodOptional<z.ZodAny>;
173
175
  status: z.ZodLiteral<"success">;
174
176
  }, "strip", z.ZodAny, z.objectOutputType<{
175
177
  platform: z.ZodString;
176
178
  userId: z.ZodString;
177
- additionalData: z.ZodOptional<z.ZodAny>;
179
+ details: z.ZodOptional<z.ZodAny>;
178
180
  status: z.ZodLiteral<"success">;
179
181
  }, z.ZodAny, "strip">, z.objectInputType<{
180
182
  platform: z.ZodString;
181
183
  userId: z.ZodString;
182
- additionalData: z.ZodOptional<z.ZodAny>;
184
+ details: z.ZodOptional<z.ZodAny>;
183
185
  status: z.ZodLiteral<"success">;
184
186
  }, z.ZodAny, "strip">>;
185
187
  declare const HealthStatusSchema: z.ZodObject<{
@@ -195,6 +197,19 @@ declare const HealthStatusSchema: z.ZodObject<{
195
197
  timestamp: string;
196
198
  version?: string | undefined;
197
199
  }>;
200
+ declare const MultiStatusSummarySchema: z.ZodObject<{
201
+ total: z.ZodNumber;
202
+ succeeded: z.ZodNumber;
203
+ failed: z.ZodNumber;
204
+ }, "strip", z.ZodTypeAny, {
205
+ total: number;
206
+ succeeded: number;
207
+ failed: number;
208
+ }, {
209
+ total: number;
210
+ succeeded: number;
211
+ failed: number;
212
+ }>;
198
213
  declare const MultiStatusDataSchema: z.ZodObject<{
199
214
  summary: z.ZodObject<{
200
215
  total: z.ZodNumber;
@@ -212,17 +227,17 @@ declare const MultiStatusDataSchema: z.ZodObject<{
212
227
  results: z.ZodArray<z.ZodObject<{
213
228
  platform: z.ZodString;
214
229
  userId: z.ZodString;
215
- additionalData: z.ZodOptional<z.ZodAny>;
230
+ details: z.ZodOptional<z.ZodAny>;
216
231
  status: z.ZodLiteral<"success">;
217
232
  }, "strip", z.ZodAny, z.objectOutputType<{
218
233
  platform: z.ZodString;
219
234
  userId: z.ZodString;
220
- additionalData: z.ZodOptional<z.ZodAny>;
235
+ details: z.ZodOptional<z.ZodAny>;
221
236
  status: z.ZodLiteral<"success">;
222
237
  }, z.ZodAny, "strip">, z.objectInputType<{
223
238
  platform: z.ZodString;
224
239
  userId: z.ZodString;
225
- additionalData: z.ZodOptional<z.ZodAny>;
240
+ details: z.ZodOptional<z.ZodAny>;
226
241
  status: z.ZodLiteral<"success">;
227
242
  }, z.ZodAny, "strip">>, "many">;
228
243
  errors: z.ZodArray<z.ZodObject<{
@@ -250,7 +265,7 @@ declare const MultiStatusDataSchema: z.ZodObject<{
250
265
  results: z.objectOutputType<{
251
266
  platform: z.ZodString;
252
267
  userId: z.ZodString;
253
- additionalData: z.ZodOptional<z.ZodAny>;
268
+ details: z.ZodOptional<z.ZodAny>;
254
269
  status: z.ZodLiteral<"success">;
255
270
  }, z.ZodAny, "strip">[];
256
271
  errors: {
@@ -268,7 +283,7 @@ declare const MultiStatusDataSchema: z.ZodObject<{
268
283
  results: z.objectInputType<{
269
284
  platform: z.ZodString;
270
285
  userId: z.ZodString;
271
- additionalData: z.ZodOptional<z.ZodAny>;
286
+ details: z.ZodOptional<z.ZodAny>;
272
287
  status: z.ZodLiteral<"success">;
273
288
  }, z.ZodAny, "strip">[];
274
289
  errors: {
@@ -286,6 +301,7 @@ interface ApiResponse<T> {
286
301
  }
287
302
  type ResponseMeta = z.infer<typeof ResponseMetaSchema>;
288
303
  type SuccessDetail = z.infer<typeof SuccessDetailSchema>;
304
+ type MultiStatusSummary = z.infer<typeof MultiStatusSummarySchema>;
289
305
  type MultiStatusData = z.infer<typeof MultiStatusDataSchema>;
290
306
  type HealthStatus = z.infer<typeof HealthStatusSchema>;
291
307
 
@@ -834,25 +850,6 @@ declare const LikeResultSchema: z.ZodObject<{
834
850
  success: boolean;
835
851
  id: string;
836
852
  }>;
837
- declare const PostSuccessDetailSchema: z.ZodObject<{
838
- platform: z.ZodNativeEnum<typeof Platform>;
839
- userId: z.ZodString;
840
- status: z.ZodLiteral<"success">;
841
- postId: z.ZodOptional<z.ZodString>;
842
- postUrl: z.ZodOptional<z.ZodString>;
843
- }, "strip", z.ZodAny, z.objectOutputType<{
844
- platform: z.ZodNativeEnum<typeof Platform>;
845
- userId: z.ZodString;
846
- status: z.ZodLiteral<"success">;
847
- postId: z.ZodOptional<z.ZodString>;
848
- postUrl: z.ZodOptional<z.ZodString>;
849
- }, z.ZodAny, "strip">, z.objectInputType<{
850
- platform: z.ZodNativeEnum<typeof Platform>;
851
- userId: z.ZodString;
852
- status: z.ZodLiteral<"success">;
853
- postId: z.ZodOptional<z.ZodString>;
854
- postUrl: z.ZodOptional<z.ZodString>;
855
- }, z.ZodAny, "strip">>;
856
853
  declare const TargetSchema: z.ZodObject<{
857
854
  platform: z.ZodNativeEnum<typeof Platform>;
858
855
  userId: z.ZodString;
@@ -946,18 +943,18 @@ declare const RepostRequestSchema: z.ZodObject<{
946
943
  postId: z.ZodString;
947
944
  }, "strip", z.ZodTypeAny, {
948
945
  platform: Platform;
949
- postId: string;
950
946
  targets: {
951
947
  platform: Platform;
952
948
  userId: string;
953
949
  }[];
950
+ postId: string;
954
951
  }, {
955
952
  platform: Platform;
956
- postId: string;
957
953
  targets: {
958
954
  platform: Platform;
959
955
  userId: string;
960
956
  }[];
957
+ postId: string;
961
958
  }>;
962
959
  declare const QuotePostRequestSchema: z.ZodObject<{
963
960
  targets: z.ZodArray<z.ZodObject<{
@@ -1004,7 +1001,6 @@ declare const QuotePostRequestSchema: z.ZodObject<{
1004
1001
  }>, "many">;
1005
1002
  }, "strip", z.ZodTypeAny, {
1006
1003
  platform: Platform;
1007
- postId: string;
1008
1004
  targets: {
1009
1005
  platform: Platform;
1010
1006
  userId: string;
@@ -1017,9 +1013,9 @@ declare const QuotePostRequestSchema: z.ZodObject<{
1017
1013
  altText?: string | undefined;
1018
1014
  }[] | undefined;
1019
1015
  }[];
1016
+ postId: string;
1020
1017
  }, {
1021
1018
  platform: Platform;
1022
- postId: string;
1023
1019
  targets: {
1024
1020
  platform: Platform;
1025
1021
  userId: string;
@@ -1032,6 +1028,7 @@ declare const QuotePostRequestSchema: z.ZodObject<{
1032
1028
  altText?: string | undefined;
1033
1029
  }[] | undefined;
1034
1030
  }[];
1031
+ postId: string;
1035
1032
  }>;
1036
1033
  declare const ReplyToPostRequestSchema: z.ZodObject<{
1037
1034
  targets: z.ZodArray<z.ZodObject<{
@@ -1078,7 +1075,6 @@ declare const ReplyToPostRequestSchema: z.ZodObject<{
1078
1075
  }>, "many">;
1079
1076
  }, "strip", z.ZodTypeAny, {
1080
1077
  platform: Platform;
1081
- postId: string;
1082
1078
  targets: {
1083
1079
  platform: Platform;
1084
1080
  userId: string;
@@ -1091,9 +1087,9 @@ declare const ReplyToPostRequestSchema: z.ZodObject<{
1091
1087
  altText?: string | undefined;
1092
1088
  }[] | undefined;
1093
1089
  }[];
1090
+ postId: string;
1094
1091
  }, {
1095
1092
  platform: Platform;
1096
- postId: string;
1097
1093
  targets: {
1098
1094
  platform: Platform;
1099
1095
  userId: string;
@@ -1106,6 +1102,7 @@ declare const ReplyToPostRequestSchema: z.ZodObject<{
1106
1102
  altText?: string | undefined;
1107
1103
  }[] | undefined;
1108
1104
  }[];
1105
+ postId: string;
1109
1106
  }>;
1110
1107
  declare const PostToDeleteSchema: z.ZodObject<{
1111
1108
  platform: z.ZodNativeEnum<typeof Platform>;
@@ -1180,18 +1177,18 @@ declare const LikePostRequestSchema: z.ZodObject<{
1180
1177
  postId: z.ZodString;
1181
1178
  }, "strip", z.ZodTypeAny, {
1182
1179
  platform: Platform;
1183
- postId: string;
1184
1180
  targets: {
1185
1181
  platform: Platform;
1186
1182
  userId: string;
1187
1183
  }[];
1184
+ postId: string;
1188
1185
  }, {
1189
1186
  platform: Platform;
1190
- postId: string;
1191
1187
  targets: {
1192
1188
  platform: Platform;
1193
1189
  userId: string;
1194
1190
  }[];
1191
+ postId: string;
1195
1192
  }>;
1196
1193
  declare const UnlikePostRequestSchema: z.ZodObject<{
1197
1194
  targets: z.ZodArray<z.ZodObject<{
@@ -1208,18 +1205,18 @@ declare const UnlikePostRequestSchema: z.ZodObject<{
1208
1205
  postId: z.ZodString;
1209
1206
  }, "strip", z.ZodTypeAny, {
1210
1207
  platform: Platform;
1211
- postId: string;
1212
1208
  targets: {
1213
1209
  platform: Platform;
1214
1210
  userId: string;
1215
1211
  }[];
1212
+ postId: string;
1216
1213
  }, {
1217
1214
  platform: Platform;
1218
- postId: string;
1219
1215
  targets: {
1220
1216
  platform: Platform;
1221
1217
  userId: string;
1222
1218
  }[];
1219
+ postId: string;
1223
1220
  }>;
1224
1221
  declare const PostResponseSchema: z.ZodUnion<[z.ZodObject<{
1225
1222
  id: z.ZodString;
@@ -2017,94 +2014,6 @@ declare const UnlikePostResponseSchema: z.ZodObject<{
2017
2014
  }, {
2018
2015
  id: string;
2019
2016
  }>;
2020
- declare const PostMultiStatusResponseSchema: z.ZodObject<{
2021
- summary: z.ZodObject<{
2022
- total: z.ZodNumber;
2023
- succeeded: z.ZodNumber;
2024
- failed: z.ZodNumber;
2025
- }, "strip", z.ZodTypeAny, {
2026
- total: number;
2027
- succeeded: number;
2028
- failed: number;
2029
- }, {
2030
- total: number;
2031
- succeeded: number;
2032
- failed: number;
2033
- }>;
2034
- results: z.ZodArray<z.ZodObject<{
2035
- platform: z.ZodNativeEnum<typeof Platform>;
2036
- userId: z.ZodString;
2037
- status: z.ZodLiteral<"success">;
2038
- postId: z.ZodOptional<z.ZodString>;
2039
- postUrl: z.ZodOptional<z.ZodString>;
2040
- }, "strip", z.ZodAny, z.objectOutputType<{
2041
- platform: z.ZodNativeEnum<typeof Platform>;
2042
- userId: z.ZodString;
2043
- status: z.ZodLiteral<"success">;
2044
- postId: z.ZodOptional<z.ZodString>;
2045
- postUrl: z.ZodOptional<z.ZodString>;
2046
- }, z.ZodAny, "strip">, z.objectInputType<{
2047
- platform: z.ZodNativeEnum<typeof Platform>;
2048
- userId: z.ZodString;
2049
- status: z.ZodLiteral<"success">;
2050
- postId: z.ZodOptional<z.ZodString>;
2051
- postUrl: z.ZodOptional<z.ZodString>;
2052
- }, z.ZodAny, "strip">>, "many">;
2053
- errors: z.ZodArray<z.ZodObject<{
2054
- message: z.ZodString;
2055
- code: z.ZodEnum<[string, ...string[]]>;
2056
- recoverable: z.ZodBoolean;
2057
- details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2058
- }, "strip", z.ZodTypeAny, {
2059
- code: string;
2060
- message: string;
2061
- recoverable: boolean;
2062
- details?: Record<string, unknown> | undefined;
2063
- }, {
2064
- code: string;
2065
- message: string;
2066
- recoverable: boolean;
2067
- details?: Record<string, unknown> | undefined;
2068
- }>, "many">;
2069
- }, "strip", z.ZodTypeAny, {
2070
- summary: {
2071
- total: number;
2072
- succeeded: number;
2073
- failed: number;
2074
- };
2075
- results: z.objectOutputType<{
2076
- platform: z.ZodNativeEnum<typeof Platform>;
2077
- userId: z.ZodString;
2078
- status: z.ZodLiteral<"success">;
2079
- postId: z.ZodOptional<z.ZodString>;
2080
- postUrl: z.ZodOptional<z.ZodString>;
2081
- }, z.ZodAny, "strip">[];
2082
- errors: {
2083
- code: string;
2084
- message: string;
2085
- recoverable: boolean;
2086
- details?: Record<string, unknown> | undefined;
2087
- }[];
2088
- }, {
2089
- summary: {
2090
- total: number;
2091
- succeeded: number;
2092
- failed: number;
2093
- };
2094
- results: z.objectInputType<{
2095
- platform: z.ZodNativeEnum<typeof Platform>;
2096
- userId: z.ZodString;
2097
- status: z.ZodLiteral<"success">;
2098
- postId: z.ZodOptional<z.ZodString>;
2099
- postUrl: z.ZodOptional<z.ZodString>;
2100
- }, z.ZodAny, "strip">[];
2101
- errors: {
2102
- code: string;
2103
- message: string;
2104
- recoverable: boolean;
2105
- details?: Record<string, unknown> | undefined;
2106
- }[];
2107
- }>;
2108
2017
  type Media = z.infer<typeof MediaSchema>;
2109
2018
  type MediaContent = z.infer<typeof MediaContentSchema>;
2110
2019
  type PostMetrics = z.infer<typeof PostMetricsSchema>;
@@ -2113,7 +2022,6 @@ type PostContent = z.infer<typeof PostContentSchema>;
2113
2022
  type PostResult = z.infer<typeof PostResultSchema>;
2114
2023
  type DeleteResult = z.infer<typeof DeleteResultSchema>;
2115
2024
  type LikeResult = z.infer<typeof LikeResultSchema>;
2116
- type PostSuccessDetail = z.infer<typeof PostSuccessDetailSchema>;
2117
2025
  type Target = z.infer<typeof TargetSchema>;
2118
2026
  type PostToDelete = z.infer<typeof PostToDeleteSchema>;
2119
2027
  type CreatePostRequest = z.infer<typeof CreatePostRequestSchema>;
@@ -2123,7 +2031,6 @@ type ReplyToPostRequest = z.infer<typeof ReplyToPostRequestSchema>;
2123
2031
  type DeletePostRequest = z.infer<typeof DeletePostRequestSchema>;
2124
2032
  type LikePostRequest = z.infer<typeof LikePostRequestSchema>;
2125
2033
  type UnlikePostRequest = z.infer<typeof UnlikePostRequestSchema>;
2126
- type PostResponse = z.infer<typeof PostResponseSchema>;
2127
2034
  type CreatePostResponse = z.infer<typeof CreatePostResponseSchema>;
2128
2035
  type RepostResponse = z.infer<typeof RepostResponseSchema>;
2129
2036
  type QuotePostResponse = z.infer<typeof QuotePostResponseSchema>;
@@ -2131,7 +2038,6 @@ type ReplyToPostResponse = z.infer<typeof ReplyToPostResponseSchema>;
2131
2038
  type DeletePostResponse = z.infer<typeof DeletePostResponseSchema>;
2132
2039
  type LikePostResponse = z.infer<typeof LikePostResponseSchema>;
2133
2040
  type UnlikePostResponse = z.infer<typeof UnlikePostResponseSchema>;
2134
- type PostMultiStatusResponse = z.infer<typeof PostMultiStatusResponseSchema>;
2135
2041
 
2136
2042
  declare const RateLimitEndpointParamSchema: z.ZodObject<{
2137
2043
  endpoint: z.ZodOptional<z.ZodString>;
@@ -3215,4 +3121,4 @@ declare const ProfileRefreshResponseSchema: z.ZodObject<{
3215
3121
  type UserProfile = z.infer<typeof UserProfileSchema>;
3216
3122
  type ProfileRefreshResponse = z.infer<typeof ProfileRefreshResponseSchema>;
3217
3123
 
3218
- 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 AuthStatus, type AuthStatusParams, AuthStatusParamsSchema, type AuthStatusResponse, AuthStatusResponseSchema, AuthStatusSchema, 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 };
3124
+ 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 AuthStatus, type AuthStatusParams, AuthStatusParamsSchema, type AuthStatusResponse, AuthStatusResponseSchema, AuthStatusSchema, 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 MultiStatusSummary, MultiStatusSummarySchema, 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 PostRecord, PostResponseSchema, type PostResult, PostResultSchema, PostSchema, 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
@@ -46,7 +46,9 @@ declare enum ApiErrorCode {
46
46
  POST_DELETION_FAILED = "POST_DELETION_FAILED",
47
47
  POST_INTERACTION_FAILED = "POST_INTERACTION_FAILED",
48
48
  NETWORK_ERROR = "NETWORK_ERROR",
49
- INVALID_RESPONSE = "INVALID_RESPONSE"
49
+ INVALID_RESPONSE = "INVALID_RESPONSE",
50
+ TOKEN_REFRESH_FAILED = "TOKEN_REFRESH_FAILED",
51
+ PROFILE_REFRESH_FAILED = "PROFILE_REFRESH_FAILED"
50
52
  }
51
53
  declare const ApiErrorCodeSchema: z.ZodEnum<[string, ...string[]]>;
52
54
  /**
@@ -169,17 +171,17 @@ declare const ResponseMetaSchema: z.ZodObject<{
169
171
  declare const SuccessDetailSchema: z.ZodObject<{
170
172
  platform: z.ZodString;
171
173
  userId: z.ZodString;
172
- additionalData: z.ZodOptional<z.ZodAny>;
174
+ details: z.ZodOptional<z.ZodAny>;
173
175
  status: z.ZodLiteral<"success">;
174
176
  }, "strip", z.ZodAny, z.objectOutputType<{
175
177
  platform: z.ZodString;
176
178
  userId: z.ZodString;
177
- additionalData: z.ZodOptional<z.ZodAny>;
179
+ details: z.ZodOptional<z.ZodAny>;
178
180
  status: z.ZodLiteral<"success">;
179
181
  }, z.ZodAny, "strip">, z.objectInputType<{
180
182
  platform: z.ZodString;
181
183
  userId: z.ZodString;
182
- additionalData: z.ZodOptional<z.ZodAny>;
184
+ details: z.ZodOptional<z.ZodAny>;
183
185
  status: z.ZodLiteral<"success">;
184
186
  }, z.ZodAny, "strip">>;
185
187
  declare const HealthStatusSchema: z.ZodObject<{
@@ -195,6 +197,19 @@ declare const HealthStatusSchema: z.ZodObject<{
195
197
  timestamp: string;
196
198
  version?: string | undefined;
197
199
  }>;
200
+ declare const MultiStatusSummarySchema: z.ZodObject<{
201
+ total: z.ZodNumber;
202
+ succeeded: z.ZodNumber;
203
+ failed: z.ZodNumber;
204
+ }, "strip", z.ZodTypeAny, {
205
+ total: number;
206
+ succeeded: number;
207
+ failed: number;
208
+ }, {
209
+ total: number;
210
+ succeeded: number;
211
+ failed: number;
212
+ }>;
198
213
  declare const MultiStatusDataSchema: z.ZodObject<{
199
214
  summary: z.ZodObject<{
200
215
  total: z.ZodNumber;
@@ -212,17 +227,17 @@ declare const MultiStatusDataSchema: z.ZodObject<{
212
227
  results: z.ZodArray<z.ZodObject<{
213
228
  platform: z.ZodString;
214
229
  userId: z.ZodString;
215
- additionalData: z.ZodOptional<z.ZodAny>;
230
+ details: z.ZodOptional<z.ZodAny>;
216
231
  status: z.ZodLiteral<"success">;
217
232
  }, "strip", z.ZodAny, z.objectOutputType<{
218
233
  platform: z.ZodString;
219
234
  userId: z.ZodString;
220
- additionalData: z.ZodOptional<z.ZodAny>;
235
+ details: z.ZodOptional<z.ZodAny>;
221
236
  status: z.ZodLiteral<"success">;
222
237
  }, z.ZodAny, "strip">, z.objectInputType<{
223
238
  platform: z.ZodString;
224
239
  userId: z.ZodString;
225
- additionalData: z.ZodOptional<z.ZodAny>;
240
+ details: z.ZodOptional<z.ZodAny>;
226
241
  status: z.ZodLiteral<"success">;
227
242
  }, z.ZodAny, "strip">>, "many">;
228
243
  errors: z.ZodArray<z.ZodObject<{
@@ -250,7 +265,7 @@ declare const MultiStatusDataSchema: z.ZodObject<{
250
265
  results: z.objectOutputType<{
251
266
  platform: z.ZodString;
252
267
  userId: z.ZodString;
253
- additionalData: z.ZodOptional<z.ZodAny>;
268
+ details: z.ZodOptional<z.ZodAny>;
254
269
  status: z.ZodLiteral<"success">;
255
270
  }, z.ZodAny, "strip">[];
256
271
  errors: {
@@ -268,7 +283,7 @@ declare const MultiStatusDataSchema: z.ZodObject<{
268
283
  results: z.objectInputType<{
269
284
  platform: z.ZodString;
270
285
  userId: z.ZodString;
271
- additionalData: z.ZodOptional<z.ZodAny>;
286
+ details: z.ZodOptional<z.ZodAny>;
272
287
  status: z.ZodLiteral<"success">;
273
288
  }, z.ZodAny, "strip">[];
274
289
  errors: {
@@ -286,6 +301,7 @@ interface ApiResponse<T> {
286
301
  }
287
302
  type ResponseMeta = z.infer<typeof ResponseMetaSchema>;
288
303
  type SuccessDetail = z.infer<typeof SuccessDetailSchema>;
304
+ type MultiStatusSummary = z.infer<typeof MultiStatusSummarySchema>;
289
305
  type MultiStatusData = z.infer<typeof MultiStatusDataSchema>;
290
306
  type HealthStatus = z.infer<typeof HealthStatusSchema>;
291
307
 
@@ -834,25 +850,6 @@ declare const LikeResultSchema: z.ZodObject<{
834
850
  success: boolean;
835
851
  id: string;
836
852
  }>;
837
- declare const PostSuccessDetailSchema: z.ZodObject<{
838
- platform: z.ZodNativeEnum<typeof Platform>;
839
- userId: z.ZodString;
840
- status: z.ZodLiteral<"success">;
841
- postId: z.ZodOptional<z.ZodString>;
842
- postUrl: z.ZodOptional<z.ZodString>;
843
- }, "strip", z.ZodAny, z.objectOutputType<{
844
- platform: z.ZodNativeEnum<typeof Platform>;
845
- userId: z.ZodString;
846
- status: z.ZodLiteral<"success">;
847
- postId: z.ZodOptional<z.ZodString>;
848
- postUrl: z.ZodOptional<z.ZodString>;
849
- }, z.ZodAny, "strip">, z.objectInputType<{
850
- platform: z.ZodNativeEnum<typeof Platform>;
851
- userId: z.ZodString;
852
- status: z.ZodLiteral<"success">;
853
- postId: z.ZodOptional<z.ZodString>;
854
- postUrl: z.ZodOptional<z.ZodString>;
855
- }, z.ZodAny, "strip">>;
856
853
  declare const TargetSchema: z.ZodObject<{
857
854
  platform: z.ZodNativeEnum<typeof Platform>;
858
855
  userId: z.ZodString;
@@ -946,18 +943,18 @@ declare const RepostRequestSchema: z.ZodObject<{
946
943
  postId: z.ZodString;
947
944
  }, "strip", z.ZodTypeAny, {
948
945
  platform: Platform;
949
- postId: string;
950
946
  targets: {
951
947
  platform: Platform;
952
948
  userId: string;
953
949
  }[];
950
+ postId: string;
954
951
  }, {
955
952
  platform: Platform;
956
- postId: string;
957
953
  targets: {
958
954
  platform: Platform;
959
955
  userId: string;
960
956
  }[];
957
+ postId: string;
961
958
  }>;
962
959
  declare const QuotePostRequestSchema: z.ZodObject<{
963
960
  targets: z.ZodArray<z.ZodObject<{
@@ -1004,7 +1001,6 @@ declare const QuotePostRequestSchema: z.ZodObject<{
1004
1001
  }>, "many">;
1005
1002
  }, "strip", z.ZodTypeAny, {
1006
1003
  platform: Platform;
1007
- postId: string;
1008
1004
  targets: {
1009
1005
  platform: Platform;
1010
1006
  userId: string;
@@ -1017,9 +1013,9 @@ declare const QuotePostRequestSchema: z.ZodObject<{
1017
1013
  altText?: string | undefined;
1018
1014
  }[] | undefined;
1019
1015
  }[];
1016
+ postId: string;
1020
1017
  }, {
1021
1018
  platform: Platform;
1022
- postId: string;
1023
1019
  targets: {
1024
1020
  platform: Platform;
1025
1021
  userId: string;
@@ -1032,6 +1028,7 @@ declare const QuotePostRequestSchema: z.ZodObject<{
1032
1028
  altText?: string | undefined;
1033
1029
  }[] | undefined;
1034
1030
  }[];
1031
+ postId: string;
1035
1032
  }>;
1036
1033
  declare const ReplyToPostRequestSchema: z.ZodObject<{
1037
1034
  targets: z.ZodArray<z.ZodObject<{
@@ -1078,7 +1075,6 @@ declare const ReplyToPostRequestSchema: z.ZodObject<{
1078
1075
  }>, "many">;
1079
1076
  }, "strip", z.ZodTypeAny, {
1080
1077
  platform: Platform;
1081
- postId: string;
1082
1078
  targets: {
1083
1079
  platform: Platform;
1084
1080
  userId: string;
@@ -1091,9 +1087,9 @@ declare const ReplyToPostRequestSchema: z.ZodObject<{
1091
1087
  altText?: string | undefined;
1092
1088
  }[] | undefined;
1093
1089
  }[];
1090
+ postId: string;
1094
1091
  }, {
1095
1092
  platform: Platform;
1096
- postId: string;
1097
1093
  targets: {
1098
1094
  platform: Platform;
1099
1095
  userId: string;
@@ -1106,6 +1102,7 @@ declare const ReplyToPostRequestSchema: z.ZodObject<{
1106
1102
  altText?: string | undefined;
1107
1103
  }[] | undefined;
1108
1104
  }[];
1105
+ postId: string;
1109
1106
  }>;
1110
1107
  declare const PostToDeleteSchema: z.ZodObject<{
1111
1108
  platform: z.ZodNativeEnum<typeof Platform>;
@@ -1180,18 +1177,18 @@ declare const LikePostRequestSchema: z.ZodObject<{
1180
1177
  postId: z.ZodString;
1181
1178
  }, "strip", z.ZodTypeAny, {
1182
1179
  platform: Platform;
1183
- postId: string;
1184
1180
  targets: {
1185
1181
  platform: Platform;
1186
1182
  userId: string;
1187
1183
  }[];
1184
+ postId: string;
1188
1185
  }, {
1189
1186
  platform: Platform;
1190
- postId: string;
1191
1187
  targets: {
1192
1188
  platform: Platform;
1193
1189
  userId: string;
1194
1190
  }[];
1191
+ postId: string;
1195
1192
  }>;
1196
1193
  declare const UnlikePostRequestSchema: z.ZodObject<{
1197
1194
  targets: z.ZodArray<z.ZodObject<{
@@ -1208,18 +1205,18 @@ declare const UnlikePostRequestSchema: z.ZodObject<{
1208
1205
  postId: z.ZodString;
1209
1206
  }, "strip", z.ZodTypeAny, {
1210
1207
  platform: Platform;
1211
- postId: string;
1212
1208
  targets: {
1213
1209
  platform: Platform;
1214
1210
  userId: string;
1215
1211
  }[];
1212
+ postId: string;
1216
1213
  }, {
1217
1214
  platform: Platform;
1218
- postId: string;
1219
1215
  targets: {
1220
1216
  platform: Platform;
1221
1217
  userId: string;
1222
1218
  }[];
1219
+ postId: string;
1223
1220
  }>;
1224
1221
  declare const PostResponseSchema: z.ZodUnion<[z.ZodObject<{
1225
1222
  id: z.ZodString;
@@ -2017,94 +2014,6 @@ declare const UnlikePostResponseSchema: z.ZodObject<{
2017
2014
  }, {
2018
2015
  id: string;
2019
2016
  }>;
2020
- declare const PostMultiStatusResponseSchema: z.ZodObject<{
2021
- summary: z.ZodObject<{
2022
- total: z.ZodNumber;
2023
- succeeded: z.ZodNumber;
2024
- failed: z.ZodNumber;
2025
- }, "strip", z.ZodTypeAny, {
2026
- total: number;
2027
- succeeded: number;
2028
- failed: number;
2029
- }, {
2030
- total: number;
2031
- succeeded: number;
2032
- failed: number;
2033
- }>;
2034
- results: z.ZodArray<z.ZodObject<{
2035
- platform: z.ZodNativeEnum<typeof Platform>;
2036
- userId: z.ZodString;
2037
- status: z.ZodLiteral<"success">;
2038
- postId: z.ZodOptional<z.ZodString>;
2039
- postUrl: z.ZodOptional<z.ZodString>;
2040
- }, "strip", z.ZodAny, z.objectOutputType<{
2041
- platform: z.ZodNativeEnum<typeof Platform>;
2042
- userId: z.ZodString;
2043
- status: z.ZodLiteral<"success">;
2044
- postId: z.ZodOptional<z.ZodString>;
2045
- postUrl: z.ZodOptional<z.ZodString>;
2046
- }, z.ZodAny, "strip">, z.objectInputType<{
2047
- platform: z.ZodNativeEnum<typeof Platform>;
2048
- userId: z.ZodString;
2049
- status: z.ZodLiteral<"success">;
2050
- postId: z.ZodOptional<z.ZodString>;
2051
- postUrl: z.ZodOptional<z.ZodString>;
2052
- }, z.ZodAny, "strip">>, "many">;
2053
- errors: z.ZodArray<z.ZodObject<{
2054
- message: z.ZodString;
2055
- code: z.ZodEnum<[string, ...string[]]>;
2056
- recoverable: z.ZodBoolean;
2057
- details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2058
- }, "strip", z.ZodTypeAny, {
2059
- code: string;
2060
- message: string;
2061
- recoverable: boolean;
2062
- details?: Record<string, unknown> | undefined;
2063
- }, {
2064
- code: string;
2065
- message: string;
2066
- recoverable: boolean;
2067
- details?: Record<string, unknown> | undefined;
2068
- }>, "many">;
2069
- }, "strip", z.ZodTypeAny, {
2070
- summary: {
2071
- total: number;
2072
- succeeded: number;
2073
- failed: number;
2074
- };
2075
- results: z.objectOutputType<{
2076
- platform: z.ZodNativeEnum<typeof Platform>;
2077
- userId: z.ZodString;
2078
- status: z.ZodLiteral<"success">;
2079
- postId: z.ZodOptional<z.ZodString>;
2080
- postUrl: z.ZodOptional<z.ZodString>;
2081
- }, z.ZodAny, "strip">[];
2082
- errors: {
2083
- code: string;
2084
- message: string;
2085
- recoverable: boolean;
2086
- details?: Record<string, unknown> | undefined;
2087
- }[];
2088
- }, {
2089
- summary: {
2090
- total: number;
2091
- succeeded: number;
2092
- failed: number;
2093
- };
2094
- results: z.objectInputType<{
2095
- platform: z.ZodNativeEnum<typeof Platform>;
2096
- userId: z.ZodString;
2097
- status: z.ZodLiteral<"success">;
2098
- postId: z.ZodOptional<z.ZodString>;
2099
- postUrl: z.ZodOptional<z.ZodString>;
2100
- }, z.ZodAny, "strip">[];
2101
- errors: {
2102
- code: string;
2103
- message: string;
2104
- recoverable: boolean;
2105
- details?: Record<string, unknown> | undefined;
2106
- }[];
2107
- }>;
2108
2017
  type Media = z.infer<typeof MediaSchema>;
2109
2018
  type MediaContent = z.infer<typeof MediaContentSchema>;
2110
2019
  type PostMetrics = z.infer<typeof PostMetricsSchema>;
@@ -2113,7 +2022,6 @@ type PostContent = z.infer<typeof PostContentSchema>;
2113
2022
  type PostResult = z.infer<typeof PostResultSchema>;
2114
2023
  type DeleteResult = z.infer<typeof DeleteResultSchema>;
2115
2024
  type LikeResult = z.infer<typeof LikeResultSchema>;
2116
- type PostSuccessDetail = z.infer<typeof PostSuccessDetailSchema>;
2117
2025
  type Target = z.infer<typeof TargetSchema>;
2118
2026
  type PostToDelete = z.infer<typeof PostToDeleteSchema>;
2119
2027
  type CreatePostRequest = z.infer<typeof CreatePostRequestSchema>;
@@ -2123,7 +2031,6 @@ type ReplyToPostRequest = z.infer<typeof ReplyToPostRequestSchema>;
2123
2031
  type DeletePostRequest = z.infer<typeof DeletePostRequestSchema>;
2124
2032
  type LikePostRequest = z.infer<typeof LikePostRequestSchema>;
2125
2033
  type UnlikePostRequest = z.infer<typeof UnlikePostRequestSchema>;
2126
- type PostResponse = z.infer<typeof PostResponseSchema>;
2127
2034
  type CreatePostResponse = z.infer<typeof CreatePostResponseSchema>;
2128
2035
  type RepostResponse = z.infer<typeof RepostResponseSchema>;
2129
2036
  type QuotePostResponse = z.infer<typeof QuotePostResponseSchema>;
@@ -2131,7 +2038,6 @@ type ReplyToPostResponse = z.infer<typeof ReplyToPostResponseSchema>;
2131
2038
  type DeletePostResponse = z.infer<typeof DeletePostResponseSchema>;
2132
2039
  type LikePostResponse = z.infer<typeof LikePostResponseSchema>;
2133
2040
  type UnlikePostResponse = z.infer<typeof UnlikePostResponseSchema>;
2134
- type PostMultiStatusResponse = z.infer<typeof PostMultiStatusResponseSchema>;
2135
2041
 
2136
2042
  declare const RateLimitEndpointParamSchema: z.ZodObject<{
2137
2043
  endpoint: z.ZodOptional<z.ZodString>;
@@ -3215,4 +3121,4 @@ declare const ProfileRefreshResponseSchema: z.ZodObject<{
3215
3121
  type UserProfile = z.infer<typeof UserProfileSchema>;
3216
3122
  type ProfileRefreshResponse = z.infer<typeof ProfileRefreshResponseSchema>;
3217
3123
 
3218
- 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 AuthStatus, type AuthStatusParams, AuthStatusParamsSchema, type AuthStatusResponse, AuthStatusResponseSchema, AuthStatusSchema, 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 };
3124
+ 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 AuthStatus, type AuthStatusParams, AuthStatusParamsSchema, type AuthStatusResponse, AuthStatusResponseSchema, AuthStatusSchema, 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 MultiStatusSummary, MultiStatusSummarySchema, 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 PostRecord, PostResponseSchema, type PostResult, PostResultSchema, PostSchema, 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
@@ -42,6 +42,8 @@ var ApiErrorCode = /* @__PURE__ */ ((ApiErrorCode2) => {
42
42
  ApiErrorCode2["POST_INTERACTION_FAILED"] = "POST_INTERACTION_FAILED";
43
43
  ApiErrorCode2["NETWORK_ERROR"] = "NETWORK_ERROR";
44
44
  ApiErrorCode2["INVALID_RESPONSE"] = "INVALID_RESPONSE";
45
+ ApiErrorCode2["TOKEN_REFRESH_FAILED"] = "TOKEN_REFRESH_FAILED";
46
+ ApiErrorCode2["PROFILE_REFRESH_FAILED"] = "PROFILE_REFRESH_FAILED";
45
47
  return ApiErrorCode2;
46
48
  })(ApiErrorCode || {});
47
49
  var ApiErrorCodeSchema = z2.enum(Object.values(ApiErrorCode));
@@ -65,7 +67,9 @@ var errorCodeToStatusCode = {
65
67
  ["POST_DELETION_FAILED" /* POST_DELETION_FAILED */]: 500,
66
68
  ["POST_INTERACTION_FAILED" /* POST_INTERACTION_FAILED */]: 500,
67
69
  ["NETWORK_ERROR" /* NETWORK_ERROR */]: 503,
68
- ["INVALID_RESPONSE" /* INVALID_RESPONSE */]: 500
70
+ ["INVALID_RESPONSE" /* INVALID_RESPONSE */]: 500,
71
+ ["TOKEN_REFRESH_FAILED" /* TOKEN_REFRESH_FAILED */]: 500,
72
+ ["PROFILE_REFRESH_FAILED" /* PROFILE_REFRESH_FAILED */]: 500
69
73
  };
70
74
  var ErrorDetailSchema = z2.object({
71
75
  message: z2.string().describe("Human-readable error message"),
@@ -97,7 +101,7 @@ var ResponseMetaSchema = z3.object({
97
101
  var SuccessDetailSchema = z3.object({
98
102
  platform: z3.string(),
99
103
  userId: z3.string(),
100
- additionalData: z3.any().optional(),
104
+ details: z3.any().optional(),
101
105
  status: z3.literal("success")
102
106
  }).catchall(z3.any());
103
107
  var HealthStatusSchema = z3.object({
@@ -105,12 +109,13 @@ var HealthStatusSchema = z3.object({
105
109
  version: z3.string().optional().describe("API version"),
106
110
  timestamp: z3.string().datetime().describe("Current server time")
107
111
  }).describe("Health status response");
112
+ var MultiStatusSummarySchema = z3.object({
113
+ total: z3.number().int().nonnegative(),
114
+ succeeded: z3.number().int().nonnegative(),
115
+ failed: z3.number().int().nonnegative()
116
+ });
108
117
  var MultiStatusDataSchema = z3.object({
109
- summary: z3.object({
110
- total: z3.number().int().nonnegative(),
111
- succeeded: z3.number().int().nonnegative(),
112
- failed: z3.number().int().nonnegative()
113
- }),
118
+ summary: MultiStatusSummarySchema,
114
119
  results: z3.array(SuccessDetailSchema),
115
120
  errors: z3.array(ErrorDetailSchema)
116
121
  });
@@ -262,13 +267,6 @@ var LikeResultSchema = z6.object({
262
267
  success: z6.boolean().describe("Whether the like was successful"),
263
268
  id: z6.string().describe("ID of the liked post")
264
269
  }).describe("Like result");
265
- var PostSuccessDetailSchema = z6.object({
266
- platform: PlatformSchema,
267
- userId: z6.string().describe("User ID"),
268
- status: z6.literal("success"),
269
- postId: z6.string().optional().describe("Post ID"),
270
- postUrl: z6.string().optional().describe("URL to the post")
271
- }).catchall(z6.any()).describe("Post success detail");
272
270
  var TargetSchema = z6.object({
273
271
  platform: PlatformSchema.describe('The platform to post to (e.g., "twitter")'),
274
272
  userId: z6.string().describe("User ID on the platform")
@@ -345,15 +343,6 @@ var LikePostResponseSchema = z6.object({
345
343
  var UnlikePostResponseSchema = z6.object({
346
344
  id: z6.string().describe("ID of the unliked post")
347
345
  }).describe("Unlike post response");
348
- var PostMultiStatusResponseSchema = z6.object({
349
- summary: z6.object({
350
- total: z6.number().describe("Total number of operations"),
351
- succeeded: z6.number().describe("Number of successful operations"),
352
- failed: z6.number().describe("Number of failed operations")
353
- }),
354
- results: z6.array(PostSuccessDetailSchema).describe("Successful operations"),
355
- errors: z6.array(ErrorDetailSchema).describe("Failed operations")
356
- }).describe("Multi-status response for post operations");
357
346
 
358
347
  // src/rate-limit.ts
359
348
  import { z as z7 } from "zod";
@@ -579,6 +568,7 @@ export {
579
568
  MediaContentSchema,
580
569
  MediaSchema,
581
570
  MultiStatusDataSchema,
571
+ MultiStatusSummarySchema,
582
572
  NearAuthorizationRequestSchema,
583
573
  NearAuthorizationResponseSchema,
584
574
  NearAuthorizationStatusResponseSchema,
@@ -590,11 +580,9 @@ export {
590
580
  PlatformSchema,
591
581
  PostContentSchema,
592
582
  PostMetricsSchema,
593
- PostMultiStatusResponseSchema,
594
583
  PostResponseSchema,
595
584
  PostResultSchema,
596
585
  PostSchema,
597
- PostSuccessDetailSchema,
598
586
  PostToDeleteSchema,
599
587
  ProfileRefreshResponseSchema,
600
588
  QuotePostRequestSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crosspost/types",
3
- "version": "0.1.14",
3
+ "version": "0.2.0",
4
4
  "description": "Shared type definitions for Crosspost API",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
package/src/errors.ts CHANGED
@@ -45,6 +45,10 @@ export enum ApiErrorCode {
45
45
 
46
46
  // Response format errors
47
47
  INVALID_RESPONSE = 'INVALID_RESPONSE',
48
+
49
+ // Refresh errors
50
+ TOKEN_REFRESH_FAILED = 'TOKEN_REFRESH_FAILED',
51
+ PROFILE_REFRESH_FAILED = 'PROFILE_REFRESH_FAILED',
48
52
  }
49
53
 
50
54
  export const ApiErrorCodeSchema = z.enum(Object.values(ApiErrorCode) as [string, ...string[]]);
@@ -74,6 +78,8 @@ export const errorCodeToStatusCode: Record<ApiErrorCode, StatusCode> = {
74
78
  [ApiErrorCode.POST_INTERACTION_FAILED]: 500,
75
79
  [ApiErrorCode.NETWORK_ERROR]: 503,
76
80
  [ApiErrorCode.INVALID_RESPONSE]: 500,
81
+ [ApiErrorCode.TOKEN_REFRESH_FAILED]: 500,
82
+ [ApiErrorCode.PROFILE_REFRESH_FAILED]: 500,
77
83
  };
78
84
 
79
85
  /**
package/src/post.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { z } from 'zod';
2
2
  import { PlatformSchema } from './common.ts';
3
- import { ErrorDetailSchema } from './errors.ts';
4
3
 
5
4
  export const MediaContentSchema = z.object({
6
5
  data: z.union([z.string(), z.instanceof(Blob)]).describe('Media data as string or Blob'),
@@ -59,14 +58,6 @@ export const LikeResultSchema = z.object({
59
58
  id: z.string().describe('ID of the liked post'),
60
59
  }).describe('Like result');
61
60
 
62
- export const PostSuccessDetailSchema = z.object({
63
- platform: PlatformSchema,
64
- userId: z.string().describe('User ID'),
65
- status: z.literal('success'),
66
- postId: z.string().optional().describe('Post ID'),
67
- postUrl: z.string().optional().describe('URL to the post'),
68
- }).catchall(z.any()).describe('Post success detail');
69
-
70
61
  export const TargetSchema = z.object({
71
62
  platform: PlatformSchema.describe('The platform to post to (e.g., "twitter")'),
72
63
  userId: z.string().describe('User ID on the platform'),
@@ -160,16 +151,6 @@ export const UnlikePostResponseSchema = z.object({
160
151
  id: z.string().describe('ID of the unliked post'),
161
152
  }).describe('Unlike post response');
162
153
 
163
- export const PostMultiStatusResponseSchema = z.object({
164
- summary: z.object({
165
- total: z.number().describe('Total number of operations'),
166
- succeeded: z.number().describe('Number of successful operations'),
167
- failed: z.number().describe('Number of failed operations'),
168
- }),
169
- results: z.array(PostSuccessDetailSchema).describe('Successful operations'),
170
- errors: z.array(ErrorDetailSchema).describe('Failed operations'),
171
- }).describe('Multi-status response for post operations');
172
-
173
154
  export type Media = z.infer<typeof MediaSchema>;
174
155
  export type MediaContent = z.infer<typeof MediaContentSchema>;
175
156
  export type PostMetrics = z.infer<typeof PostMetricsSchema>;
@@ -178,7 +159,6 @@ export type PostContent = z.infer<typeof PostContentSchema>;
178
159
  export type PostResult = z.infer<typeof PostResultSchema>;
179
160
  export type DeleteResult = z.infer<typeof DeleteResultSchema>;
180
161
  export type LikeResult = z.infer<typeof LikeResultSchema>;
181
- export type PostSuccessDetail = z.infer<typeof PostSuccessDetailSchema>;
182
162
  export type Target = z.infer<typeof TargetSchema>;
183
163
  export type PostToDelete = z.infer<typeof PostToDeleteSchema>;
184
164
 
@@ -190,7 +170,6 @@ export type DeletePostRequest = z.infer<typeof DeletePostRequestSchema>;
190
170
  export type LikePostRequest = z.infer<typeof LikePostRequestSchema>;
191
171
  export type UnlikePostRequest = z.infer<typeof UnlikePostRequestSchema>;
192
172
 
193
- export type PostResponse = z.infer<typeof PostResponseSchema>;
194
173
  export type CreatePostResponse = z.infer<typeof CreatePostResponseSchema>;
195
174
  export type RepostResponse = z.infer<typeof RepostResponseSchema>;
196
175
  export type QuotePostResponse = z.infer<typeof QuotePostResponseSchema>;
@@ -198,4 +177,3 @@ export type ReplyToPostResponse = z.infer<typeof ReplyToPostResponseSchema>;
198
177
  export type DeletePostResponse = z.infer<typeof DeletePostResponseSchema>;
199
178
  export type LikePostResponse = z.infer<typeof LikePostResponseSchema>;
200
179
  export type UnlikePostResponse = z.infer<typeof UnlikePostResponseSchema>;
201
- export type PostMultiStatusResponse = z.infer<typeof PostMultiStatusResponseSchema>;
package/src/response.ts CHANGED
@@ -24,7 +24,7 @@ export const ResponseMetaSchema = z.object({
24
24
  export const SuccessDetailSchema = z.object({
25
25
  platform: z.string(),
26
26
  userId: z.string(),
27
- additionalData: z.any().optional(),
27
+ details: z.any().optional(),
28
28
  status: z.literal('success'),
29
29
  }).catchall(z.any());
30
30
 
@@ -34,24 +34,27 @@ export const HealthStatusSchema = z.object({
34
34
  timestamp: z.string().datetime().describe('Current server time'),
35
35
  }).describe('Health status response');
36
36
 
37
+ export const MultiStatusSummarySchema = z.object({
38
+ total: z.number().int().nonnegative(),
39
+ succeeded: z.number().int().nonnegative(),
40
+ failed: z.number().int().nonnegative(),
41
+ });
42
+
37
43
  export const MultiStatusDataSchema = z.object({
38
- summary: z.object({
39
- total: z.number().int().nonnegative(),
40
- succeeded: z.number().int().nonnegative(),
41
- failed: z.number().int().nonnegative(),
42
- }),
44
+ summary: MultiStatusSummarySchema,
43
45
  results: z.array(SuccessDetailSchema),
44
46
  errors: z.array(ErrorDetailSchema),
45
47
  });
46
48
 
47
49
  export interface ApiResponse<T> {
48
50
  success: boolean;
49
- data?: T | MultiStatusData | null; // Allow null for success without data
51
+ data?: T | MultiStatusData | null; // Allow null for success without data, updated type name
50
52
  errors?: ErrorDetail[] | null; // Allow null for success
51
53
  meta: ResponseMeta; // Mandatory, holds request id
52
54
  }
53
55
 
54
56
  export type ResponseMeta = z.infer<typeof ResponseMetaSchema>;
55
57
  export type SuccessDetail = z.infer<typeof SuccessDetailSchema>;
56
- export type MultiStatusData = z.infer<typeof MultiStatusDataSchema>;
58
+ export type MultiStatusSummary = z.infer<typeof MultiStatusSummarySchema>;
59
+ export type MultiStatusData = z.infer<typeof MultiStatusDataSchema>; // Renamed type
57
60
  export type HealthStatus = z.infer<typeof HealthStatusSchema>;