@crosspost/types 0.1.13 → 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
@@ -36,6 +36,7 @@ __export(index_exports, {
36
36
  AuthRevokeResponseSchema: () => AuthRevokeResponseSchema,
37
37
  AuthStatusParamsSchema: () => AuthStatusParamsSchema,
38
38
  AuthStatusResponseSchema: () => AuthStatusResponseSchema,
39
+ AuthStatusSchema: () => AuthStatusSchema,
39
40
  AuthTokenRequestSchema: () => AuthTokenRequestSchema,
40
41
  AuthUrlResponseSchema: () => AuthUrlResponseSchema,
41
42
  ConnectedAccountSchema: () => ConnectedAccountSchema,
@@ -54,6 +55,7 @@ __export(index_exports, {
54
55
  MediaContentSchema: () => MediaContentSchema,
55
56
  MediaSchema: () => MediaSchema,
56
57
  MultiStatusDataSchema: () => MultiStatusDataSchema,
58
+ MultiStatusSummarySchema: () => MultiStatusSummarySchema,
57
59
  NearAuthorizationRequestSchema: () => NearAuthorizationRequestSchema,
58
60
  NearAuthorizationResponseSchema: () => NearAuthorizationResponseSchema,
59
61
  NearAuthorizationStatusResponseSchema: () => NearAuthorizationStatusResponseSchema,
@@ -65,11 +67,9 @@ __export(index_exports, {
65
67
  PlatformSchema: () => PlatformSchema,
66
68
  PostContentSchema: () => PostContentSchema,
67
69
  PostMetricsSchema: () => PostMetricsSchema,
68
- PostMultiStatusResponseSchema: () => PostMultiStatusResponseSchema,
69
70
  PostResponseSchema: () => PostResponseSchema,
70
71
  PostResultSchema: () => PostResultSchema,
71
72
  PostSchema: () => PostSchema,
72
- PostSuccessDetailSchema: () => PostSuccessDetailSchema,
73
73
  PostToDeleteSchema: () => PostToDeleteSchema,
74
74
  ProfileRefreshResponseSchema: () => ProfileRefreshResponseSchema,
75
75
  QuotePostRequestSchema: () => QuotePostRequestSchema,
@@ -142,6 +142,8 @@ var ApiErrorCode = /* @__PURE__ */ ((ApiErrorCode2) => {
142
142
  ApiErrorCode2["POST_INTERACTION_FAILED"] = "POST_INTERACTION_FAILED";
143
143
  ApiErrorCode2["NETWORK_ERROR"] = "NETWORK_ERROR";
144
144
  ApiErrorCode2["INVALID_RESPONSE"] = "INVALID_RESPONSE";
145
+ ApiErrorCode2["TOKEN_REFRESH_FAILED"] = "TOKEN_REFRESH_FAILED";
146
+ ApiErrorCode2["PROFILE_REFRESH_FAILED"] = "PROFILE_REFRESH_FAILED";
145
147
  return ApiErrorCode2;
146
148
  })(ApiErrorCode || {});
147
149
  var ApiErrorCodeSchema = import_zod2.z.enum(Object.values(ApiErrorCode));
@@ -165,7 +167,9 @@ var errorCodeToStatusCode = {
165
167
  ["POST_DELETION_FAILED" /* POST_DELETION_FAILED */]: 500,
166
168
  ["POST_INTERACTION_FAILED" /* POST_INTERACTION_FAILED */]: 500,
167
169
  ["NETWORK_ERROR" /* NETWORK_ERROR */]: 503,
168
- ["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
169
173
  };
170
174
  var ErrorDetailSchema = import_zod2.z.object({
171
175
  message: import_zod2.z.string().describe("Human-readable error message"),
@@ -197,7 +201,7 @@ var ResponseMetaSchema = import_zod3.z.object({
197
201
  var SuccessDetailSchema = import_zod3.z.object({
198
202
  platform: import_zod3.z.string(),
199
203
  userId: import_zod3.z.string(),
200
- additionalData: import_zod3.z.any().optional(),
204
+ details: import_zod3.z.any().optional(),
201
205
  status: import_zod3.z.literal("success")
202
206
  }).catchall(import_zod3.z.any());
203
207
  var HealthStatusSchema = import_zod3.z.object({
@@ -205,12 +209,13 @@ var HealthStatusSchema = import_zod3.z.object({
205
209
  version: import_zod3.z.string().optional().describe("API version"),
206
210
  timestamp: import_zod3.z.string().datetime().describe("Current server time")
207
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
+ });
208
217
  var MultiStatusDataSchema = import_zod3.z.object({
209
- summary: import_zod3.z.object({
210
- total: import_zod3.z.number().int().nonnegative(),
211
- succeeded: import_zod3.z.number().int().nonnegative(),
212
- failed: import_zod3.z.number().int().nonnegative()
213
- }),
218
+ summary: MultiStatusSummarySchema,
214
219
  results: import_zod3.z.array(SuccessDetailSchema),
215
220
  errors: import_zod3.z.array(ErrorDetailSchema)
216
221
  });
@@ -237,6 +242,11 @@ var ProfileRefreshResponseSchema = import_zod4.z.object({
237
242
  var PlatformParamSchema = import_zod5.z.object({
238
243
  platform: import_zod5.z.string().describe("Social media platform")
239
244
  }).describe("Platform parameter");
245
+ var AuthStatusSchema = import_zod5.z.object({
246
+ message: import_zod5.z.string().describe("User-friendly status message"),
247
+ code: import_zod5.z.string().describe("Status code for programmatic handling"),
248
+ details: import_zod5.z.string().optional().describe("Additional status details")
249
+ }).describe("Authentication status information");
240
250
  var AuthInitRequestSchema = import_zod5.z.object({
241
251
  successUrl: import_zod5.z.string().url().optional().describe(
242
252
  "URL to redirect to on successful authentication"
@@ -256,7 +266,8 @@ var AuthCallbackQuerySchema = import_zod5.z.object({
256
266
  var AuthCallbackResponseSchema = import_zod5.z.object({
257
267
  platform: PlatformSchema,
258
268
  userId: import_zod5.z.string().describe("User ID"),
259
- redirectUrl: import_zod5.z.string().optional().describe("URL to redirect the user to after authentication")
269
+ redirectUrl: import_zod5.z.string().optional().describe("URL to redirect the user to after authentication"),
270
+ status: AuthStatusSchema.describe("Authentication status information")
260
271
  }).describe("Auth callback response");
261
272
  var AuthStatusParamsSchema = import_zod5.z.object({
262
273
  platform: import_zod5.z.string().describe("Social media platform"),
@@ -356,13 +367,6 @@ var LikeResultSchema = import_zod6.z.object({
356
367
  success: import_zod6.z.boolean().describe("Whether the like was successful"),
357
368
  id: import_zod6.z.string().describe("ID of the liked post")
358
369
  }).describe("Like result");
359
- var PostSuccessDetailSchema = import_zod6.z.object({
360
- platform: PlatformSchema,
361
- userId: import_zod6.z.string().describe("User ID"),
362
- status: import_zod6.z.literal("success"),
363
- postId: import_zod6.z.string().optional().describe("Post ID"),
364
- postUrl: import_zod6.z.string().optional().describe("URL to the post")
365
- }).catchall(import_zod6.z.any()).describe("Post success detail");
366
370
  var TargetSchema = import_zod6.z.object({
367
371
  platform: PlatformSchema.describe('The platform to post to (e.g., "twitter")'),
368
372
  userId: import_zod6.z.string().describe("User ID on the platform")
@@ -439,15 +443,6 @@ var LikePostResponseSchema = import_zod6.z.object({
439
443
  var UnlikePostResponseSchema = import_zod6.z.object({
440
444
  id: import_zod6.z.string().describe("ID of the unliked post")
441
445
  }).describe("Unlike post response");
442
- var PostMultiStatusResponseSchema = import_zod6.z.object({
443
- summary: import_zod6.z.object({
444
- total: import_zod6.z.number().describe("Total number of operations"),
445
- succeeded: import_zod6.z.number().describe("Number of successful operations"),
446
- failed: import_zod6.z.number().describe("Number of failed operations")
447
- }),
448
- results: import_zod6.z.array(PostSuccessDetailSchema).describe("Successful operations"),
449
- errors: import_zod6.z.array(ErrorDetailSchema).describe("Failed operations")
450
- }).describe("Multi-status response for post operations");
451
446
 
452
447
  // src/rate-limit.ts
453
448
  var import_zod7 = require("zod");
@@ -655,6 +650,7 @@ var AccountPostsResponseSchema = import_zod8.z.object({
655
650
  AuthRevokeResponseSchema,
656
651
  AuthStatusParamsSchema,
657
652
  AuthStatusResponseSchema,
653
+ AuthStatusSchema,
658
654
  AuthTokenRequestSchema,
659
655
  AuthUrlResponseSchema,
660
656
  ConnectedAccountSchema,
@@ -673,6 +669,7 @@ var AccountPostsResponseSchema = import_zod8.z.object({
673
669
  MediaContentSchema,
674
670
  MediaSchema,
675
671
  MultiStatusDataSchema,
672
+ MultiStatusSummarySchema,
676
673
  NearAuthorizationRequestSchema,
677
674
  NearAuthorizationResponseSchema,
678
675
  NearAuthorizationStatusResponseSchema,
@@ -684,11 +681,9 @@ var AccountPostsResponseSchema = import_zod8.z.object({
684
681
  PlatformSchema,
685
682
  PostContentSchema,
686
683
  PostMetricsSchema,
687
- PostMultiStatusResponseSchema,
688
684
  PostResponseSchema,
689
685
  PostResultSchema,
690
686
  PostSchema,
691
- PostSuccessDetailSchema,
692
687
  PostToDeleteSchema,
693
688
  ProfileRefreshResponseSchema,
694
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
 
@@ -296,6 +312,19 @@ declare const PlatformParamSchema: z.ZodObject<{
296
312
  }, {
297
313
  platform: string;
298
314
  }>;
315
+ declare const AuthStatusSchema: z.ZodObject<{
316
+ message: z.ZodString;
317
+ code: z.ZodString;
318
+ details: z.ZodOptional<z.ZodString>;
319
+ }, "strip", z.ZodTypeAny, {
320
+ code: string;
321
+ message: string;
322
+ details?: string | undefined;
323
+ }, {
324
+ code: string;
325
+ message: string;
326
+ details?: string | undefined;
327
+ }>;
299
328
  declare const AuthInitRequestSchema: z.ZodObject<{
300
329
  successUrl: z.ZodOptional<z.ZodString>;
301
330
  errorUrl: z.ZodOptional<z.ZodString>;
@@ -330,11 +359,34 @@ declare const AuthCallbackResponseSchema: z.ZodObject<{
330
359
  platform: z.ZodNativeEnum<typeof Platform>;
331
360
  userId: z.ZodString;
332
361
  redirectUrl: z.ZodOptional<z.ZodString>;
362
+ status: z.ZodObject<{
363
+ message: z.ZodString;
364
+ code: z.ZodString;
365
+ details: z.ZodOptional<z.ZodString>;
366
+ }, "strip", z.ZodTypeAny, {
367
+ code: string;
368
+ message: string;
369
+ details?: string | undefined;
370
+ }, {
371
+ code: string;
372
+ message: string;
373
+ details?: string | undefined;
374
+ }>;
333
375
  }, "strip", z.ZodTypeAny, {
376
+ status: {
377
+ code: string;
378
+ message: string;
379
+ details?: string | undefined;
380
+ };
334
381
  platform: Platform;
335
382
  userId: string;
336
383
  redirectUrl?: string | undefined;
337
384
  }, {
385
+ status: {
386
+ code: string;
387
+ message: string;
388
+ details?: string | undefined;
389
+ };
338
390
  platform: Platform;
339
391
  userId: string;
340
392
  redirectUrl?: string | undefined;
@@ -595,6 +647,7 @@ type NearAuthorizationStatusResponse = z.infer<typeof NearAuthorizationStatusRes
595
647
  type AuthTokenRequest = z.infer<typeof AuthTokenRequestSchema>;
596
648
  type AuthStatusParams = z.infer<typeof AuthStatusParamsSchema>;
597
649
  type NearUnauthorizationResponse = z.infer<typeof NearUnauthorizationResponseSchema>;
650
+ type AuthStatus = z.infer<typeof AuthStatusSchema>;
598
651
 
599
652
  declare const MediaContentSchema: z.ZodObject<{
600
653
  data: z.ZodUnion<[z.ZodString, z.ZodType<buffer.Blob, z.ZodTypeDef, buffer.Blob>]>;
@@ -797,25 +850,6 @@ declare const LikeResultSchema: z.ZodObject<{
797
850
  success: boolean;
798
851
  id: string;
799
852
  }>;
800
- declare const PostSuccessDetailSchema: z.ZodObject<{
801
- platform: z.ZodNativeEnum<typeof Platform>;
802
- userId: z.ZodString;
803
- status: z.ZodLiteral<"success">;
804
- postId: z.ZodOptional<z.ZodString>;
805
- postUrl: z.ZodOptional<z.ZodString>;
806
- }, "strip", z.ZodAny, z.objectOutputType<{
807
- platform: z.ZodNativeEnum<typeof Platform>;
808
- userId: z.ZodString;
809
- status: z.ZodLiteral<"success">;
810
- postId: z.ZodOptional<z.ZodString>;
811
- postUrl: z.ZodOptional<z.ZodString>;
812
- }, z.ZodAny, "strip">, z.objectInputType<{
813
- platform: z.ZodNativeEnum<typeof Platform>;
814
- userId: z.ZodString;
815
- status: z.ZodLiteral<"success">;
816
- postId: z.ZodOptional<z.ZodString>;
817
- postUrl: z.ZodOptional<z.ZodString>;
818
- }, z.ZodAny, "strip">>;
819
853
  declare const TargetSchema: z.ZodObject<{
820
854
  platform: z.ZodNativeEnum<typeof Platform>;
821
855
  userId: z.ZodString;
@@ -909,18 +943,18 @@ declare const RepostRequestSchema: z.ZodObject<{
909
943
  postId: z.ZodString;
910
944
  }, "strip", z.ZodTypeAny, {
911
945
  platform: Platform;
912
- postId: string;
913
946
  targets: {
914
947
  platform: Platform;
915
948
  userId: string;
916
949
  }[];
950
+ postId: string;
917
951
  }, {
918
952
  platform: Platform;
919
- postId: string;
920
953
  targets: {
921
954
  platform: Platform;
922
955
  userId: string;
923
956
  }[];
957
+ postId: string;
924
958
  }>;
925
959
  declare const QuotePostRequestSchema: z.ZodObject<{
926
960
  targets: z.ZodArray<z.ZodObject<{
@@ -967,7 +1001,6 @@ declare const QuotePostRequestSchema: z.ZodObject<{
967
1001
  }>, "many">;
968
1002
  }, "strip", z.ZodTypeAny, {
969
1003
  platform: Platform;
970
- postId: string;
971
1004
  targets: {
972
1005
  platform: Platform;
973
1006
  userId: string;
@@ -980,9 +1013,9 @@ declare const QuotePostRequestSchema: z.ZodObject<{
980
1013
  altText?: string | undefined;
981
1014
  }[] | undefined;
982
1015
  }[];
1016
+ postId: string;
983
1017
  }, {
984
1018
  platform: Platform;
985
- postId: string;
986
1019
  targets: {
987
1020
  platform: Platform;
988
1021
  userId: string;
@@ -995,6 +1028,7 @@ declare const QuotePostRequestSchema: z.ZodObject<{
995
1028
  altText?: string | undefined;
996
1029
  }[] | undefined;
997
1030
  }[];
1031
+ postId: string;
998
1032
  }>;
999
1033
  declare const ReplyToPostRequestSchema: z.ZodObject<{
1000
1034
  targets: z.ZodArray<z.ZodObject<{
@@ -1041,7 +1075,6 @@ declare const ReplyToPostRequestSchema: z.ZodObject<{
1041
1075
  }>, "many">;
1042
1076
  }, "strip", z.ZodTypeAny, {
1043
1077
  platform: Platform;
1044
- postId: string;
1045
1078
  targets: {
1046
1079
  platform: Platform;
1047
1080
  userId: string;
@@ -1054,9 +1087,9 @@ declare const ReplyToPostRequestSchema: z.ZodObject<{
1054
1087
  altText?: string | undefined;
1055
1088
  }[] | undefined;
1056
1089
  }[];
1090
+ postId: string;
1057
1091
  }, {
1058
1092
  platform: Platform;
1059
- postId: string;
1060
1093
  targets: {
1061
1094
  platform: Platform;
1062
1095
  userId: string;
@@ -1069,6 +1102,7 @@ declare const ReplyToPostRequestSchema: z.ZodObject<{
1069
1102
  altText?: string | undefined;
1070
1103
  }[] | undefined;
1071
1104
  }[];
1105
+ postId: string;
1072
1106
  }>;
1073
1107
  declare const PostToDeleteSchema: z.ZodObject<{
1074
1108
  platform: z.ZodNativeEnum<typeof Platform>;
@@ -1143,18 +1177,18 @@ declare const LikePostRequestSchema: z.ZodObject<{
1143
1177
  postId: z.ZodString;
1144
1178
  }, "strip", z.ZodTypeAny, {
1145
1179
  platform: Platform;
1146
- postId: string;
1147
1180
  targets: {
1148
1181
  platform: Platform;
1149
1182
  userId: string;
1150
1183
  }[];
1184
+ postId: string;
1151
1185
  }, {
1152
1186
  platform: Platform;
1153
- postId: string;
1154
1187
  targets: {
1155
1188
  platform: Platform;
1156
1189
  userId: string;
1157
1190
  }[];
1191
+ postId: string;
1158
1192
  }>;
1159
1193
  declare const UnlikePostRequestSchema: z.ZodObject<{
1160
1194
  targets: z.ZodArray<z.ZodObject<{
@@ -1171,18 +1205,18 @@ declare const UnlikePostRequestSchema: z.ZodObject<{
1171
1205
  postId: z.ZodString;
1172
1206
  }, "strip", z.ZodTypeAny, {
1173
1207
  platform: Platform;
1174
- postId: string;
1175
1208
  targets: {
1176
1209
  platform: Platform;
1177
1210
  userId: string;
1178
1211
  }[];
1212
+ postId: string;
1179
1213
  }, {
1180
1214
  platform: Platform;
1181
- postId: string;
1182
1215
  targets: {
1183
1216
  platform: Platform;
1184
1217
  userId: string;
1185
1218
  }[];
1219
+ postId: string;
1186
1220
  }>;
1187
1221
  declare const PostResponseSchema: z.ZodUnion<[z.ZodObject<{
1188
1222
  id: z.ZodString;
@@ -1980,94 +2014,6 @@ declare const UnlikePostResponseSchema: z.ZodObject<{
1980
2014
  }, {
1981
2015
  id: string;
1982
2016
  }>;
1983
- declare const PostMultiStatusResponseSchema: z.ZodObject<{
1984
- summary: z.ZodObject<{
1985
- total: z.ZodNumber;
1986
- succeeded: z.ZodNumber;
1987
- failed: z.ZodNumber;
1988
- }, "strip", z.ZodTypeAny, {
1989
- total: number;
1990
- succeeded: number;
1991
- failed: number;
1992
- }, {
1993
- total: number;
1994
- succeeded: number;
1995
- failed: number;
1996
- }>;
1997
- results: z.ZodArray<z.ZodObject<{
1998
- platform: z.ZodNativeEnum<typeof Platform>;
1999
- userId: z.ZodString;
2000
- status: z.ZodLiteral<"success">;
2001
- postId: z.ZodOptional<z.ZodString>;
2002
- postUrl: z.ZodOptional<z.ZodString>;
2003
- }, "strip", z.ZodAny, z.objectOutputType<{
2004
- platform: z.ZodNativeEnum<typeof Platform>;
2005
- userId: z.ZodString;
2006
- status: z.ZodLiteral<"success">;
2007
- postId: z.ZodOptional<z.ZodString>;
2008
- postUrl: z.ZodOptional<z.ZodString>;
2009
- }, z.ZodAny, "strip">, z.objectInputType<{
2010
- platform: z.ZodNativeEnum<typeof Platform>;
2011
- userId: z.ZodString;
2012
- status: z.ZodLiteral<"success">;
2013
- postId: z.ZodOptional<z.ZodString>;
2014
- postUrl: z.ZodOptional<z.ZodString>;
2015
- }, z.ZodAny, "strip">>, "many">;
2016
- errors: z.ZodArray<z.ZodObject<{
2017
- message: z.ZodString;
2018
- code: z.ZodEnum<[string, ...string[]]>;
2019
- recoverable: z.ZodBoolean;
2020
- details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2021
- }, "strip", z.ZodTypeAny, {
2022
- code: string;
2023
- message: string;
2024
- recoverable: boolean;
2025
- details?: Record<string, unknown> | undefined;
2026
- }, {
2027
- code: string;
2028
- message: string;
2029
- recoverable: boolean;
2030
- details?: Record<string, unknown> | undefined;
2031
- }>, "many">;
2032
- }, "strip", z.ZodTypeAny, {
2033
- summary: {
2034
- total: number;
2035
- succeeded: number;
2036
- failed: number;
2037
- };
2038
- results: z.objectOutputType<{
2039
- platform: z.ZodNativeEnum<typeof Platform>;
2040
- userId: z.ZodString;
2041
- status: z.ZodLiteral<"success">;
2042
- postId: z.ZodOptional<z.ZodString>;
2043
- postUrl: z.ZodOptional<z.ZodString>;
2044
- }, z.ZodAny, "strip">[];
2045
- errors: {
2046
- code: string;
2047
- message: string;
2048
- recoverable: boolean;
2049
- details?: Record<string, unknown> | undefined;
2050
- }[];
2051
- }, {
2052
- summary: {
2053
- total: number;
2054
- succeeded: number;
2055
- failed: number;
2056
- };
2057
- results: z.objectInputType<{
2058
- platform: z.ZodNativeEnum<typeof Platform>;
2059
- userId: z.ZodString;
2060
- status: z.ZodLiteral<"success">;
2061
- postId: z.ZodOptional<z.ZodString>;
2062
- postUrl: z.ZodOptional<z.ZodString>;
2063
- }, z.ZodAny, "strip">[];
2064
- errors: {
2065
- code: string;
2066
- message: string;
2067
- recoverable: boolean;
2068
- details?: Record<string, unknown> | undefined;
2069
- }[];
2070
- }>;
2071
2017
  type Media = z.infer<typeof MediaSchema>;
2072
2018
  type MediaContent = z.infer<typeof MediaContentSchema>;
2073
2019
  type PostMetrics = z.infer<typeof PostMetricsSchema>;
@@ -2076,7 +2022,6 @@ type PostContent = z.infer<typeof PostContentSchema>;
2076
2022
  type PostResult = z.infer<typeof PostResultSchema>;
2077
2023
  type DeleteResult = z.infer<typeof DeleteResultSchema>;
2078
2024
  type LikeResult = z.infer<typeof LikeResultSchema>;
2079
- type PostSuccessDetail = z.infer<typeof PostSuccessDetailSchema>;
2080
2025
  type Target = z.infer<typeof TargetSchema>;
2081
2026
  type PostToDelete = z.infer<typeof PostToDeleteSchema>;
2082
2027
  type CreatePostRequest = z.infer<typeof CreatePostRequestSchema>;
@@ -2086,7 +2031,6 @@ type ReplyToPostRequest = z.infer<typeof ReplyToPostRequestSchema>;
2086
2031
  type DeletePostRequest = z.infer<typeof DeletePostRequestSchema>;
2087
2032
  type LikePostRequest = z.infer<typeof LikePostRequestSchema>;
2088
2033
  type UnlikePostRequest = z.infer<typeof UnlikePostRequestSchema>;
2089
- type PostResponse = z.infer<typeof PostResponseSchema>;
2090
2034
  type CreatePostResponse = z.infer<typeof CreatePostResponseSchema>;
2091
2035
  type RepostResponse = z.infer<typeof RepostResponseSchema>;
2092
2036
  type QuotePostResponse = z.infer<typeof QuotePostResponseSchema>;
@@ -2094,7 +2038,6 @@ type ReplyToPostResponse = z.infer<typeof ReplyToPostResponseSchema>;
2094
2038
  type DeletePostResponse = z.infer<typeof DeletePostResponseSchema>;
2095
2039
  type LikePostResponse = z.infer<typeof LikePostResponseSchema>;
2096
2040
  type UnlikePostResponse = z.infer<typeof UnlikePostResponseSchema>;
2097
- type PostMultiStatusResponse = z.infer<typeof PostMultiStatusResponseSchema>;
2098
2041
 
2099
2042
  declare const RateLimitEndpointParamSchema: z.ZodObject<{
2100
2043
  endpoint: z.ZodOptional<z.ZodString>;
@@ -3178,4 +3121,4 @@ declare const ProfileRefreshResponseSchema: z.ZodObject<{
3178
3121
  type UserProfile = z.infer<typeof UserProfileSchema>;
3179
3122
  type ProfileRefreshResponse = z.infer<typeof ProfileRefreshResponseSchema>;
3180
3123
 
3181
- 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 };
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
 
@@ -296,6 +312,19 @@ declare const PlatformParamSchema: z.ZodObject<{
296
312
  }, {
297
313
  platform: string;
298
314
  }>;
315
+ declare const AuthStatusSchema: z.ZodObject<{
316
+ message: z.ZodString;
317
+ code: z.ZodString;
318
+ details: z.ZodOptional<z.ZodString>;
319
+ }, "strip", z.ZodTypeAny, {
320
+ code: string;
321
+ message: string;
322
+ details?: string | undefined;
323
+ }, {
324
+ code: string;
325
+ message: string;
326
+ details?: string | undefined;
327
+ }>;
299
328
  declare const AuthInitRequestSchema: z.ZodObject<{
300
329
  successUrl: z.ZodOptional<z.ZodString>;
301
330
  errorUrl: z.ZodOptional<z.ZodString>;
@@ -330,11 +359,34 @@ declare const AuthCallbackResponseSchema: z.ZodObject<{
330
359
  platform: z.ZodNativeEnum<typeof Platform>;
331
360
  userId: z.ZodString;
332
361
  redirectUrl: z.ZodOptional<z.ZodString>;
362
+ status: z.ZodObject<{
363
+ message: z.ZodString;
364
+ code: z.ZodString;
365
+ details: z.ZodOptional<z.ZodString>;
366
+ }, "strip", z.ZodTypeAny, {
367
+ code: string;
368
+ message: string;
369
+ details?: string | undefined;
370
+ }, {
371
+ code: string;
372
+ message: string;
373
+ details?: string | undefined;
374
+ }>;
333
375
  }, "strip", z.ZodTypeAny, {
376
+ status: {
377
+ code: string;
378
+ message: string;
379
+ details?: string | undefined;
380
+ };
334
381
  platform: Platform;
335
382
  userId: string;
336
383
  redirectUrl?: string | undefined;
337
384
  }, {
385
+ status: {
386
+ code: string;
387
+ message: string;
388
+ details?: string | undefined;
389
+ };
338
390
  platform: Platform;
339
391
  userId: string;
340
392
  redirectUrl?: string | undefined;
@@ -595,6 +647,7 @@ type NearAuthorizationStatusResponse = z.infer<typeof NearAuthorizationStatusRes
595
647
  type AuthTokenRequest = z.infer<typeof AuthTokenRequestSchema>;
596
648
  type AuthStatusParams = z.infer<typeof AuthStatusParamsSchema>;
597
649
  type NearUnauthorizationResponse = z.infer<typeof NearUnauthorizationResponseSchema>;
650
+ type AuthStatus = z.infer<typeof AuthStatusSchema>;
598
651
 
599
652
  declare const MediaContentSchema: z.ZodObject<{
600
653
  data: z.ZodUnion<[z.ZodString, z.ZodType<buffer.Blob, z.ZodTypeDef, buffer.Blob>]>;
@@ -797,25 +850,6 @@ declare const LikeResultSchema: z.ZodObject<{
797
850
  success: boolean;
798
851
  id: string;
799
852
  }>;
800
- declare const PostSuccessDetailSchema: z.ZodObject<{
801
- platform: z.ZodNativeEnum<typeof Platform>;
802
- userId: z.ZodString;
803
- status: z.ZodLiteral<"success">;
804
- postId: z.ZodOptional<z.ZodString>;
805
- postUrl: z.ZodOptional<z.ZodString>;
806
- }, "strip", z.ZodAny, z.objectOutputType<{
807
- platform: z.ZodNativeEnum<typeof Platform>;
808
- userId: z.ZodString;
809
- status: z.ZodLiteral<"success">;
810
- postId: z.ZodOptional<z.ZodString>;
811
- postUrl: z.ZodOptional<z.ZodString>;
812
- }, z.ZodAny, "strip">, z.objectInputType<{
813
- platform: z.ZodNativeEnum<typeof Platform>;
814
- userId: z.ZodString;
815
- status: z.ZodLiteral<"success">;
816
- postId: z.ZodOptional<z.ZodString>;
817
- postUrl: z.ZodOptional<z.ZodString>;
818
- }, z.ZodAny, "strip">>;
819
853
  declare const TargetSchema: z.ZodObject<{
820
854
  platform: z.ZodNativeEnum<typeof Platform>;
821
855
  userId: z.ZodString;
@@ -909,18 +943,18 @@ declare const RepostRequestSchema: z.ZodObject<{
909
943
  postId: z.ZodString;
910
944
  }, "strip", z.ZodTypeAny, {
911
945
  platform: Platform;
912
- postId: string;
913
946
  targets: {
914
947
  platform: Platform;
915
948
  userId: string;
916
949
  }[];
950
+ postId: string;
917
951
  }, {
918
952
  platform: Platform;
919
- postId: string;
920
953
  targets: {
921
954
  platform: Platform;
922
955
  userId: string;
923
956
  }[];
957
+ postId: string;
924
958
  }>;
925
959
  declare const QuotePostRequestSchema: z.ZodObject<{
926
960
  targets: z.ZodArray<z.ZodObject<{
@@ -967,7 +1001,6 @@ declare const QuotePostRequestSchema: z.ZodObject<{
967
1001
  }>, "many">;
968
1002
  }, "strip", z.ZodTypeAny, {
969
1003
  platform: Platform;
970
- postId: string;
971
1004
  targets: {
972
1005
  platform: Platform;
973
1006
  userId: string;
@@ -980,9 +1013,9 @@ declare const QuotePostRequestSchema: z.ZodObject<{
980
1013
  altText?: string | undefined;
981
1014
  }[] | undefined;
982
1015
  }[];
1016
+ postId: string;
983
1017
  }, {
984
1018
  platform: Platform;
985
- postId: string;
986
1019
  targets: {
987
1020
  platform: Platform;
988
1021
  userId: string;
@@ -995,6 +1028,7 @@ declare const QuotePostRequestSchema: z.ZodObject<{
995
1028
  altText?: string | undefined;
996
1029
  }[] | undefined;
997
1030
  }[];
1031
+ postId: string;
998
1032
  }>;
999
1033
  declare const ReplyToPostRequestSchema: z.ZodObject<{
1000
1034
  targets: z.ZodArray<z.ZodObject<{
@@ -1041,7 +1075,6 @@ declare const ReplyToPostRequestSchema: z.ZodObject<{
1041
1075
  }>, "many">;
1042
1076
  }, "strip", z.ZodTypeAny, {
1043
1077
  platform: Platform;
1044
- postId: string;
1045
1078
  targets: {
1046
1079
  platform: Platform;
1047
1080
  userId: string;
@@ -1054,9 +1087,9 @@ declare const ReplyToPostRequestSchema: z.ZodObject<{
1054
1087
  altText?: string | undefined;
1055
1088
  }[] | undefined;
1056
1089
  }[];
1090
+ postId: string;
1057
1091
  }, {
1058
1092
  platform: Platform;
1059
- postId: string;
1060
1093
  targets: {
1061
1094
  platform: Platform;
1062
1095
  userId: string;
@@ -1069,6 +1102,7 @@ declare const ReplyToPostRequestSchema: z.ZodObject<{
1069
1102
  altText?: string | undefined;
1070
1103
  }[] | undefined;
1071
1104
  }[];
1105
+ postId: string;
1072
1106
  }>;
1073
1107
  declare const PostToDeleteSchema: z.ZodObject<{
1074
1108
  platform: z.ZodNativeEnum<typeof Platform>;
@@ -1143,18 +1177,18 @@ declare const LikePostRequestSchema: z.ZodObject<{
1143
1177
  postId: z.ZodString;
1144
1178
  }, "strip", z.ZodTypeAny, {
1145
1179
  platform: Platform;
1146
- postId: string;
1147
1180
  targets: {
1148
1181
  platform: Platform;
1149
1182
  userId: string;
1150
1183
  }[];
1184
+ postId: string;
1151
1185
  }, {
1152
1186
  platform: Platform;
1153
- postId: string;
1154
1187
  targets: {
1155
1188
  platform: Platform;
1156
1189
  userId: string;
1157
1190
  }[];
1191
+ postId: string;
1158
1192
  }>;
1159
1193
  declare const UnlikePostRequestSchema: z.ZodObject<{
1160
1194
  targets: z.ZodArray<z.ZodObject<{
@@ -1171,18 +1205,18 @@ declare const UnlikePostRequestSchema: z.ZodObject<{
1171
1205
  postId: z.ZodString;
1172
1206
  }, "strip", z.ZodTypeAny, {
1173
1207
  platform: Platform;
1174
- postId: string;
1175
1208
  targets: {
1176
1209
  platform: Platform;
1177
1210
  userId: string;
1178
1211
  }[];
1212
+ postId: string;
1179
1213
  }, {
1180
1214
  platform: Platform;
1181
- postId: string;
1182
1215
  targets: {
1183
1216
  platform: Platform;
1184
1217
  userId: string;
1185
1218
  }[];
1219
+ postId: string;
1186
1220
  }>;
1187
1221
  declare const PostResponseSchema: z.ZodUnion<[z.ZodObject<{
1188
1222
  id: z.ZodString;
@@ -1980,94 +2014,6 @@ declare const UnlikePostResponseSchema: z.ZodObject<{
1980
2014
  }, {
1981
2015
  id: string;
1982
2016
  }>;
1983
- declare const PostMultiStatusResponseSchema: z.ZodObject<{
1984
- summary: z.ZodObject<{
1985
- total: z.ZodNumber;
1986
- succeeded: z.ZodNumber;
1987
- failed: z.ZodNumber;
1988
- }, "strip", z.ZodTypeAny, {
1989
- total: number;
1990
- succeeded: number;
1991
- failed: number;
1992
- }, {
1993
- total: number;
1994
- succeeded: number;
1995
- failed: number;
1996
- }>;
1997
- results: z.ZodArray<z.ZodObject<{
1998
- platform: z.ZodNativeEnum<typeof Platform>;
1999
- userId: z.ZodString;
2000
- status: z.ZodLiteral<"success">;
2001
- postId: z.ZodOptional<z.ZodString>;
2002
- postUrl: z.ZodOptional<z.ZodString>;
2003
- }, "strip", z.ZodAny, z.objectOutputType<{
2004
- platform: z.ZodNativeEnum<typeof Platform>;
2005
- userId: z.ZodString;
2006
- status: z.ZodLiteral<"success">;
2007
- postId: z.ZodOptional<z.ZodString>;
2008
- postUrl: z.ZodOptional<z.ZodString>;
2009
- }, z.ZodAny, "strip">, z.objectInputType<{
2010
- platform: z.ZodNativeEnum<typeof Platform>;
2011
- userId: z.ZodString;
2012
- status: z.ZodLiteral<"success">;
2013
- postId: z.ZodOptional<z.ZodString>;
2014
- postUrl: z.ZodOptional<z.ZodString>;
2015
- }, z.ZodAny, "strip">>, "many">;
2016
- errors: z.ZodArray<z.ZodObject<{
2017
- message: z.ZodString;
2018
- code: z.ZodEnum<[string, ...string[]]>;
2019
- recoverable: z.ZodBoolean;
2020
- details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2021
- }, "strip", z.ZodTypeAny, {
2022
- code: string;
2023
- message: string;
2024
- recoverable: boolean;
2025
- details?: Record<string, unknown> | undefined;
2026
- }, {
2027
- code: string;
2028
- message: string;
2029
- recoverable: boolean;
2030
- details?: Record<string, unknown> | undefined;
2031
- }>, "many">;
2032
- }, "strip", z.ZodTypeAny, {
2033
- summary: {
2034
- total: number;
2035
- succeeded: number;
2036
- failed: number;
2037
- };
2038
- results: z.objectOutputType<{
2039
- platform: z.ZodNativeEnum<typeof Platform>;
2040
- userId: z.ZodString;
2041
- status: z.ZodLiteral<"success">;
2042
- postId: z.ZodOptional<z.ZodString>;
2043
- postUrl: z.ZodOptional<z.ZodString>;
2044
- }, z.ZodAny, "strip">[];
2045
- errors: {
2046
- code: string;
2047
- message: string;
2048
- recoverable: boolean;
2049
- details?: Record<string, unknown> | undefined;
2050
- }[];
2051
- }, {
2052
- summary: {
2053
- total: number;
2054
- succeeded: number;
2055
- failed: number;
2056
- };
2057
- results: z.objectInputType<{
2058
- platform: z.ZodNativeEnum<typeof Platform>;
2059
- userId: z.ZodString;
2060
- status: z.ZodLiteral<"success">;
2061
- postId: z.ZodOptional<z.ZodString>;
2062
- postUrl: z.ZodOptional<z.ZodString>;
2063
- }, z.ZodAny, "strip">[];
2064
- errors: {
2065
- code: string;
2066
- message: string;
2067
- recoverable: boolean;
2068
- details?: Record<string, unknown> | undefined;
2069
- }[];
2070
- }>;
2071
2017
  type Media = z.infer<typeof MediaSchema>;
2072
2018
  type MediaContent = z.infer<typeof MediaContentSchema>;
2073
2019
  type PostMetrics = z.infer<typeof PostMetricsSchema>;
@@ -2076,7 +2022,6 @@ type PostContent = z.infer<typeof PostContentSchema>;
2076
2022
  type PostResult = z.infer<typeof PostResultSchema>;
2077
2023
  type DeleteResult = z.infer<typeof DeleteResultSchema>;
2078
2024
  type LikeResult = z.infer<typeof LikeResultSchema>;
2079
- type PostSuccessDetail = z.infer<typeof PostSuccessDetailSchema>;
2080
2025
  type Target = z.infer<typeof TargetSchema>;
2081
2026
  type PostToDelete = z.infer<typeof PostToDeleteSchema>;
2082
2027
  type CreatePostRequest = z.infer<typeof CreatePostRequestSchema>;
@@ -2086,7 +2031,6 @@ type ReplyToPostRequest = z.infer<typeof ReplyToPostRequestSchema>;
2086
2031
  type DeletePostRequest = z.infer<typeof DeletePostRequestSchema>;
2087
2032
  type LikePostRequest = z.infer<typeof LikePostRequestSchema>;
2088
2033
  type UnlikePostRequest = z.infer<typeof UnlikePostRequestSchema>;
2089
- type PostResponse = z.infer<typeof PostResponseSchema>;
2090
2034
  type CreatePostResponse = z.infer<typeof CreatePostResponseSchema>;
2091
2035
  type RepostResponse = z.infer<typeof RepostResponseSchema>;
2092
2036
  type QuotePostResponse = z.infer<typeof QuotePostResponseSchema>;
@@ -2094,7 +2038,6 @@ type ReplyToPostResponse = z.infer<typeof ReplyToPostResponseSchema>;
2094
2038
  type DeletePostResponse = z.infer<typeof DeletePostResponseSchema>;
2095
2039
  type LikePostResponse = z.infer<typeof LikePostResponseSchema>;
2096
2040
  type UnlikePostResponse = z.infer<typeof UnlikePostResponseSchema>;
2097
- type PostMultiStatusResponse = z.infer<typeof PostMultiStatusResponseSchema>;
2098
2041
 
2099
2042
  declare const RateLimitEndpointParamSchema: z.ZodObject<{
2100
2043
  endpoint: z.ZodOptional<z.ZodString>;
@@ -3178,4 +3121,4 @@ declare const ProfileRefreshResponseSchema: z.ZodObject<{
3178
3121
  type UserProfile = z.infer<typeof UserProfileSchema>;
3179
3122
  type ProfileRefreshResponse = z.infer<typeof ProfileRefreshResponseSchema>;
3180
3123
 
3181
- 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 };
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
  });
@@ -137,6 +142,11 @@ var ProfileRefreshResponseSchema = z4.object({
137
142
  var PlatformParamSchema = z5.object({
138
143
  platform: z5.string().describe("Social media platform")
139
144
  }).describe("Platform parameter");
145
+ var AuthStatusSchema = z5.object({
146
+ message: z5.string().describe("User-friendly status message"),
147
+ code: z5.string().describe("Status code for programmatic handling"),
148
+ details: z5.string().optional().describe("Additional status details")
149
+ }).describe("Authentication status information");
140
150
  var AuthInitRequestSchema = z5.object({
141
151
  successUrl: z5.string().url().optional().describe(
142
152
  "URL to redirect to on successful authentication"
@@ -156,7 +166,8 @@ var AuthCallbackQuerySchema = z5.object({
156
166
  var AuthCallbackResponseSchema = z5.object({
157
167
  platform: PlatformSchema,
158
168
  userId: z5.string().describe("User ID"),
159
- redirectUrl: z5.string().optional().describe("URL to redirect the user to after authentication")
169
+ redirectUrl: z5.string().optional().describe("URL to redirect the user to after authentication"),
170
+ status: AuthStatusSchema.describe("Authentication status information")
160
171
  }).describe("Auth callback response");
161
172
  var AuthStatusParamsSchema = z5.object({
162
173
  platform: z5.string().describe("Social media platform"),
@@ -256,13 +267,6 @@ var LikeResultSchema = z6.object({
256
267
  success: z6.boolean().describe("Whether the like was successful"),
257
268
  id: z6.string().describe("ID of the liked post")
258
269
  }).describe("Like result");
259
- var PostSuccessDetailSchema = z6.object({
260
- platform: PlatformSchema,
261
- userId: z6.string().describe("User ID"),
262
- status: z6.literal("success"),
263
- postId: z6.string().optional().describe("Post ID"),
264
- postUrl: z6.string().optional().describe("URL to the post")
265
- }).catchall(z6.any()).describe("Post success detail");
266
270
  var TargetSchema = z6.object({
267
271
  platform: PlatformSchema.describe('The platform to post to (e.g., "twitter")'),
268
272
  userId: z6.string().describe("User ID on the platform")
@@ -339,15 +343,6 @@ var LikePostResponseSchema = z6.object({
339
343
  var UnlikePostResponseSchema = z6.object({
340
344
  id: z6.string().describe("ID of the unliked post")
341
345
  }).describe("Unlike post response");
342
- var PostMultiStatusResponseSchema = z6.object({
343
- summary: z6.object({
344
- total: z6.number().describe("Total number of operations"),
345
- succeeded: z6.number().describe("Number of successful operations"),
346
- failed: z6.number().describe("Number of failed operations")
347
- }),
348
- results: z6.array(PostSuccessDetailSchema).describe("Successful operations"),
349
- errors: z6.array(ErrorDetailSchema).describe("Failed operations")
350
- }).describe("Multi-status response for post operations");
351
346
 
352
347
  // src/rate-limit.ts
353
348
  import { z as z7 } from "zod";
@@ -554,6 +549,7 @@ export {
554
549
  AuthRevokeResponseSchema,
555
550
  AuthStatusParamsSchema,
556
551
  AuthStatusResponseSchema,
552
+ AuthStatusSchema,
557
553
  AuthTokenRequestSchema,
558
554
  AuthUrlResponseSchema,
559
555
  ConnectedAccountSchema,
@@ -572,6 +568,7 @@ export {
572
568
  MediaContentSchema,
573
569
  MediaSchema,
574
570
  MultiStatusDataSchema,
571
+ MultiStatusSummarySchema,
575
572
  NearAuthorizationRequestSchema,
576
573
  NearAuthorizationResponseSchema,
577
574
  NearAuthorizationStatusResponseSchema,
@@ -583,11 +580,9 @@ export {
583
580
  PlatformSchema,
584
581
  PostContentSchema,
585
582
  PostMetricsSchema,
586
- PostMultiStatusResponseSchema,
587
583
  PostResponseSchema,
588
584
  PostResultSchema,
589
585
  PostSchema,
590
- PostSuccessDetailSchema,
591
586
  PostToDeleteSchema,
592
587
  ProfileRefreshResponseSchema,
593
588
  QuotePostRequestSchema,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crosspost/types",
3
- "version": "0.1.13",
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/auth.ts CHANGED
@@ -6,6 +6,12 @@ export const PlatformParamSchema = z.object({
6
6
  platform: z.string().describe('Social media platform'),
7
7
  }).describe('Platform parameter');
8
8
 
9
+ export const AuthStatusSchema = z.object({
10
+ message: z.string().describe('User-friendly status message'),
11
+ code: z.string().describe('Status code for programmatic handling'),
12
+ details: z.string().optional().describe('Additional status details'),
13
+ }).describe('Authentication status information');
14
+
9
15
  export const AuthInitRequestSchema = z.object({
10
16
  successUrl: z.string().url().optional().describe(
11
17
  'URL to redirect to on successful authentication',
@@ -29,6 +35,7 @@ export const AuthCallbackResponseSchema = z.object({
29
35
  platform: PlatformSchema,
30
36
  userId: z.string().describe('User ID'),
31
37
  redirectUrl: z.string().optional().describe('URL to redirect the user to after authentication'),
38
+ status: AuthStatusSchema.describe('Authentication status information'),
32
39
  }).describe('Auth callback response');
33
40
 
34
41
  export const AuthStatusParamsSchema = z.object({
@@ -102,3 +109,4 @@ export type NearAuthorizationStatusResponse = z.infer<typeof NearAuthorizationSt
102
109
  export type AuthTokenRequest = z.infer<typeof AuthTokenRequestSchema>;
103
110
  export type AuthStatusParams = z.infer<typeof AuthStatusParamsSchema>;
104
111
  export type NearUnauthorizationResponse = z.infer<typeof NearUnauthorizationResponseSchema>;
112
+ export type AuthStatus = z.infer<typeof AuthStatusSchema>;
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>;