@crosspost/types 0.2.6 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -96,6 +96,8 @@ __export(index_exports, {
96
96
  UnlikePostResponseSchema: () => UnlikePostResponseSchema,
97
97
  UsageRateLimitSchema: () => UsageRateLimitSchema,
98
98
  UserProfileSchema: () => UserProfileSchema,
99
+ createMultiStatusDataSchema: () => createMultiStatusDataSchema,
100
+ createSuccessDetailSchema: () => createSuccessDetailSchema,
99
101
  errorCodeToStatusCode: () => errorCodeToStatusCode,
100
102
  isPlatformSupported: () => isPlatformSupported
101
103
  });
@@ -196,12 +198,13 @@ var ResponseMetaSchema = import_zod3.z.object({
196
198
  total: import_zod3.z.number().int().nonnegative().optional()
197
199
  }).optional().describe("Pagination information if applicable")
198
200
  });
199
- var SuccessDetailSchema = import_zod3.z.object({
201
+ var createSuccessDetailSchema = (detailsSchema = import_zod3.z.any().optional()) => import_zod3.z.object({
200
202
  platform: import_zod3.z.string(),
201
203
  userId: import_zod3.z.string(),
202
- details: import_zod3.z.any().optional(),
204
+ details: detailsSchema,
203
205
  status: import_zod3.z.literal("success")
204
206
  }).catchall(import_zod3.z.any());
207
+ var SuccessDetailSchema = createSuccessDetailSchema();
205
208
  var HealthStatusSchema = import_zod3.z.object({
206
209
  status: import_zod3.z.string().describe("Health status of the API"),
207
210
  version: import_zod3.z.string().optional().describe("API version"),
@@ -212,11 +215,15 @@ var MultiStatusSummarySchema = import_zod3.z.object({
212
215
  succeeded: import_zod3.z.number().int().nonnegative(),
213
216
  failed: import_zod3.z.number().int().nonnegative()
214
217
  });
215
- var MultiStatusDataSchema = import_zod3.z.object({
218
+ var createMultiStatusDataSchema = (detailsSchema) => import_zod3.z.object({
216
219
  summary: MultiStatusSummarySchema,
217
- results: import_zod3.z.array(SuccessDetailSchema),
220
+ results: import_zod3.z.array(
221
+ detailsSchema ? createSuccessDetailSchema(detailsSchema) : SuccessDetailSchema
222
+ // Uses default createSuccessDetailSchema() if no specific schema passed
223
+ ),
218
224
  errors: import_zod3.z.array(ErrorDetailSchema)
219
225
  });
226
+ var MultiStatusDataSchema = createMultiStatusDataSchema();
220
227
 
221
228
  // src/auth.ts
222
229
  var import_zod5 = require("zod");
@@ -743,6 +750,8 @@ var AccountPostsResponseSchema = import_zod8.z.object({
743
750
  UnlikePostResponseSchema,
744
751
  UsageRateLimitSchema,
745
752
  UserProfileSchema,
753
+ createMultiStatusDataSchema,
754
+ createSuccessDetailSchema,
746
755
  errorCodeToStatusCode,
747
756
  isPlatformSupported
748
757
  });
package/dist/index.d.cts CHANGED
@@ -143,20 +143,36 @@ declare const ResponseMetaSchema: z.ZodObject<{
143
143
  total?: number | undefined;
144
144
  } | undefined;
145
145
  }>;
146
+ declare const createSuccessDetailSchema: <T extends z.ZodTypeAny = z.ZodAny>(detailsSchema?: T) => z.ZodObject<{
147
+ platform: z.ZodString;
148
+ userId: z.ZodString;
149
+ details: T;
150
+ status: z.ZodLiteral<"success">;
151
+ }, "strip", z.ZodAny, z.objectOutputType<{
152
+ platform: z.ZodString;
153
+ userId: z.ZodString;
154
+ details: T;
155
+ status: z.ZodLiteral<"success">;
156
+ }, z.ZodAny, "strip">, z.objectInputType<{
157
+ platform: z.ZodString;
158
+ userId: z.ZodString;
159
+ details: T;
160
+ status: z.ZodLiteral<"success">;
161
+ }, z.ZodAny, "strip">>;
146
162
  declare const SuccessDetailSchema: z.ZodObject<{
147
163
  platform: z.ZodString;
148
164
  userId: z.ZodString;
149
- details: z.ZodOptional<z.ZodAny>;
165
+ details: z.ZodAny;
150
166
  status: z.ZodLiteral<"success">;
151
167
  }, "strip", z.ZodAny, z.objectOutputType<{
152
168
  platform: z.ZodString;
153
169
  userId: z.ZodString;
154
- details: z.ZodOptional<z.ZodAny>;
170
+ details: z.ZodAny;
155
171
  status: z.ZodLiteral<"success">;
156
172
  }, z.ZodAny, "strip">, z.objectInputType<{
157
173
  platform: z.ZodString;
158
174
  userId: z.ZodString;
159
- details: z.ZodOptional<z.ZodAny>;
175
+ details: z.ZodAny;
160
176
  status: z.ZodLiteral<"success">;
161
177
  }, z.ZodAny, "strip">>;
162
178
  declare const HealthStatusSchema: z.ZodObject<{
@@ -185,6 +201,114 @@ declare const MultiStatusSummarySchema: z.ZodObject<{
185
201
  succeeded: number;
186
202
  failed: number;
187
203
  }>;
204
+ declare const createMultiStatusDataSchema: <TDetailSchema extends z.ZodTypeAny = z.ZodAny>(detailsSchema?: TDetailSchema) => z.ZodObject<{
205
+ summary: z.ZodObject<{
206
+ total: z.ZodNumber;
207
+ succeeded: z.ZodNumber;
208
+ failed: z.ZodNumber;
209
+ }, "strip", z.ZodTypeAny, {
210
+ total: number;
211
+ succeeded: number;
212
+ failed: number;
213
+ }, {
214
+ total: number;
215
+ succeeded: number;
216
+ failed: number;
217
+ }>;
218
+ results: z.ZodArray<z.ZodObject<{
219
+ platform: z.ZodString;
220
+ userId: z.ZodString;
221
+ details: z.ZodAny;
222
+ status: z.ZodLiteral<"success">;
223
+ }, "strip", z.ZodAny, z.objectOutputType<{
224
+ platform: z.ZodString;
225
+ userId: z.ZodString;
226
+ details: z.ZodAny;
227
+ status: z.ZodLiteral<"success">;
228
+ }, z.ZodAny, "strip">, z.objectInputType<{
229
+ platform: z.ZodString;
230
+ userId: z.ZodString;
231
+ details: z.ZodAny;
232
+ status: z.ZodLiteral<"success">;
233
+ }, z.ZodAny, "strip">> | z.ZodObject<{
234
+ platform: z.ZodString;
235
+ userId: z.ZodString;
236
+ details: TDetailSchema;
237
+ status: z.ZodLiteral<"success">;
238
+ }, "strip", z.ZodAny, z.objectOutputType<{
239
+ platform: z.ZodString;
240
+ userId: z.ZodString;
241
+ details: TDetailSchema;
242
+ status: z.ZodLiteral<"success">;
243
+ }, z.ZodAny, "strip">, z.objectInputType<{
244
+ platform: z.ZodString;
245
+ userId: z.ZodString;
246
+ details: TDetailSchema;
247
+ status: z.ZodLiteral<"success">;
248
+ }, z.ZodAny, "strip">>, "many">;
249
+ errors: z.ZodArray<z.ZodObject<{
250
+ message: z.ZodString;
251
+ code: z.ZodEnum<[string, ...string[]]>;
252
+ recoverable: z.ZodBoolean;
253
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
254
+ }, "strip", z.ZodTypeAny, {
255
+ code: string;
256
+ message: string;
257
+ recoverable: boolean;
258
+ details?: Record<string, unknown> | undefined;
259
+ }, {
260
+ code: string;
261
+ message: string;
262
+ recoverable: boolean;
263
+ details?: Record<string, unknown> | undefined;
264
+ }>, "many">;
265
+ }, "strip", z.ZodTypeAny, {
266
+ summary: {
267
+ total: number;
268
+ succeeded: number;
269
+ failed: number;
270
+ };
271
+ results: (z.objectOutputType<{
272
+ platform: z.ZodString;
273
+ userId: z.ZodString;
274
+ details: z.ZodAny;
275
+ status: z.ZodLiteral<"success">;
276
+ }, z.ZodAny, "strip"> | z.objectOutputType<{
277
+ platform: z.ZodString;
278
+ userId: z.ZodString;
279
+ details: TDetailSchema;
280
+ status: z.ZodLiteral<"success">;
281
+ }, z.ZodAny, "strip">)[];
282
+ errors: {
283
+ code: string;
284
+ message: string;
285
+ recoverable: boolean;
286
+ details?: Record<string, unknown> | undefined;
287
+ }[];
288
+ }, {
289
+ summary: {
290
+ total: number;
291
+ succeeded: number;
292
+ failed: number;
293
+ };
294
+ results: (z.objectInputType<{
295
+ platform: z.ZodString;
296
+ userId: z.ZodString;
297
+ details: z.ZodAny;
298
+ status: z.ZodLiteral<"success">;
299
+ }, z.ZodAny, "strip"> | z.objectInputType<{
300
+ platform: z.ZodString;
301
+ userId: z.ZodString;
302
+ details: TDetailSchema;
303
+ status: z.ZodLiteral<"success">;
304
+ }, z.ZodAny, "strip">)[];
305
+ errors: {
306
+ code: string;
307
+ message: string;
308
+ recoverable: boolean;
309
+ details?: Record<string, unknown> | undefined;
310
+ }[];
311
+ }>;
188
312
  declare const MultiStatusDataSchema: z.ZodObject<{
189
313
  summary: z.ZodObject<{
190
314
  total: z.ZodNumber;
@@ -202,17 +326,17 @@ declare const MultiStatusDataSchema: z.ZodObject<{
202
326
  results: z.ZodArray<z.ZodObject<{
203
327
  platform: z.ZodString;
204
328
  userId: z.ZodString;
205
- details: z.ZodOptional<z.ZodAny>;
329
+ details: z.ZodAny;
206
330
  status: z.ZodLiteral<"success">;
207
331
  }, "strip", z.ZodAny, z.objectOutputType<{
208
332
  platform: z.ZodString;
209
333
  userId: z.ZodString;
210
- details: z.ZodOptional<z.ZodAny>;
334
+ details: z.ZodAny;
211
335
  status: z.ZodLiteral<"success">;
212
336
  }, z.ZodAny, "strip">, z.objectInputType<{
213
337
  platform: z.ZodString;
214
338
  userId: z.ZodString;
215
- details: z.ZodOptional<z.ZodAny>;
339
+ details: z.ZodAny;
216
340
  status: z.ZodLiteral<"success">;
217
341
  }, z.ZodAny, "strip">>, "many">;
218
342
  errors: z.ZodArray<z.ZodObject<{
@@ -240,7 +364,7 @@ declare const MultiStatusDataSchema: z.ZodObject<{
240
364
  results: z.objectOutputType<{
241
365
  platform: z.ZodString;
242
366
  userId: z.ZodString;
243
- details: z.ZodOptional<z.ZodAny>;
367
+ details: z.ZodAny;
244
368
  status: z.ZodLiteral<"success">;
245
369
  }, z.ZodAny, "strip">[];
246
370
  errors: {
@@ -258,7 +382,7 @@ declare const MultiStatusDataSchema: z.ZodObject<{
258
382
  results: z.objectInputType<{
259
383
  platform: z.ZodString;
260
384
  userId: z.ZodString;
261
- details: z.ZodOptional<z.ZodAny>;
385
+ details: z.ZodAny;
262
386
  status: z.ZodLiteral<"success">;
263
387
  }, z.ZodAny, "strip">[];
264
388
  errors: {
@@ -275,9 +399,15 @@ interface ApiResponse<T> {
275
399
  meta: ResponseMeta;
276
400
  }
277
401
  type ResponseMeta = z.infer<typeof ResponseMetaSchema>;
278
- type SuccessDetail = z.infer<typeof SuccessDetailSchema>;
402
+ type SuccessDetail<T = any> = Omit<z.infer<typeof SuccessDetailSchema>, 'details'> & {
403
+ details?: T;
404
+ };
279
405
  type MultiStatusSummary = z.infer<typeof MultiStatusSummarySchema>;
280
- type MultiStatusData = z.infer<typeof MultiStatusDataSchema>;
406
+ type MultiStatusData<TDetail = any> = {
407
+ summary: MultiStatusSummary;
408
+ results: SuccessDetail<TDetail>[];
409
+ errors: ErrorDetail[];
410
+ };
281
411
  type HealthStatus = z.infer<typeof HealthStatusSchema>;
282
412
 
283
413
  declare const PlatformParamSchema: z.ZodObject<{
@@ -3228,4 +3358,4 @@ declare const ProfileRefreshResponseSchema: z.ZodObject<{
3228
3358
  type UserProfile = z.infer<typeof UserProfileSchema>;
3229
3359
  type ProfileRefreshResponse = z.infer<typeof ProfileRefreshResponseSchema>;
3230
3360
 
3231
- 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, ActivityType, 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 Filter, FilterSchema, 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, PaginationSchema, 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 };
3361
+ 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, ActivityType, 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 Filter, FilterSchema, 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, PaginationSchema, 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, createMultiStatusDataSchema, createSuccessDetailSchema, errorCodeToStatusCode, isPlatformSupported };
package/dist/index.d.ts CHANGED
@@ -143,20 +143,36 @@ declare const ResponseMetaSchema: z.ZodObject<{
143
143
  total?: number | undefined;
144
144
  } | undefined;
145
145
  }>;
146
+ declare const createSuccessDetailSchema: <T extends z.ZodTypeAny = z.ZodAny>(detailsSchema?: T) => z.ZodObject<{
147
+ platform: z.ZodString;
148
+ userId: z.ZodString;
149
+ details: T;
150
+ status: z.ZodLiteral<"success">;
151
+ }, "strip", z.ZodAny, z.objectOutputType<{
152
+ platform: z.ZodString;
153
+ userId: z.ZodString;
154
+ details: T;
155
+ status: z.ZodLiteral<"success">;
156
+ }, z.ZodAny, "strip">, z.objectInputType<{
157
+ platform: z.ZodString;
158
+ userId: z.ZodString;
159
+ details: T;
160
+ status: z.ZodLiteral<"success">;
161
+ }, z.ZodAny, "strip">>;
146
162
  declare const SuccessDetailSchema: z.ZodObject<{
147
163
  platform: z.ZodString;
148
164
  userId: z.ZodString;
149
- details: z.ZodOptional<z.ZodAny>;
165
+ details: z.ZodAny;
150
166
  status: z.ZodLiteral<"success">;
151
167
  }, "strip", z.ZodAny, z.objectOutputType<{
152
168
  platform: z.ZodString;
153
169
  userId: z.ZodString;
154
- details: z.ZodOptional<z.ZodAny>;
170
+ details: z.ZodAny;
155
171
  status: z.ZodLiteral<"success">;
156
172
  }, z.ZodAny, "strip">, z.objectInputType<{
157
173
  platform: z.ZodString;
158
174
  userId: z.ZodString;
159
- details: z.ZodOptional<z.ZodAny>;
175
+ details: z.ZodAny;
160
176
  status: z.ZodLiteral<"success">;
161
177
  }, z.ZodAny, "strip">>;
162
178
  declare const HealthStatusSchema: z.ZodObject<{
@@ -185,6 +201,114 @@ declare const MultiStatusSummarySchema: z.ZodObject<{
185
201
  succeeded: number;
186
202
  failed: number;
187
203
  }>;
204
+ declare const createMultiStatusDataSchema: <TDetailSchema extends z.ZodTypeAny = z.ZodAny>(detailsSchema?: TDetailSchema) => z.ZodObject<{
205
+ summary: z.ZodObject<{
206
+ total: z.ZodNumber;
207
+ succeeded: z.ZodNumber;
208
+ failed: z.ZodNumber;
209
+ }, "strip", z.ZodTypeAny, {
210
+ total: number;
211
+ succeeded: number;
212
+ failed: number;
213
+ }, {
214
+ total: number;
215
+ succeeded: number;
216
+ failed: number;
217
+ }>;
218
+ results: z.ZodArray<z.ZodObject<{
219
+ platform: z.ZodString;
220
+ userId: z.ZodString;
221
+ details: z.ZodAny;
222
+ status: z.ZodLiteral<"success">;
223
+ }, "strip", z.ZodAny, z.objectOutputType<{
224
+ platform: z.ZodString;
225
+ userId: z.ZodString;
226
+ details: z.ZodAny;
227
+ status: z.ZodLiteral<"success">;
228
+ }, z.ZodAny, "strip">, z.objectInputType<{
229
+ platform: z.ZodString;
230
+ userId: z.ZodString;
231
+ details: z.ZodAny;
232
+ status: z.ZodLiteral<"success">;
233
+ }, z.ZodAny, "strip">> | z.ZodObject<{
234
+ platform: z.ZodString;
235
+ userId: z.ZodString;
236
+ details: TDetailSchema;
237
+ status: z.ZodLiteral<"success">;
238
+ }, "strip", z.ZodAny, z.objectOutputType<{
239
+ platform: z.ZodString;
240
+ userId: z.ZodString;
241
+ details: TDetailSchema;
242
+ status: z.ZodLiteral<"success">;
243
+ }, z.ZodAny, "strip">, z.objectInputType<{
244
+ platform: z.ZodString;
245
+ userId: z.ZodString;
246
+ details: TDetailSchema;
247
+ status: z.ZodLiteral<"success">;
248
+ }, z.ZodAny, "strip">>, "many">;
249
+ errors: z.ZodArray<z.ZodObject<{
250
+ message: z.ZodString;
251
+ code: z.ZodEnum<[string, ...string[]]>;
252
+ recoverable: z.ZodBoolean;
253
+ details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
254
+ }, "strip", z.ZodTypeAny, {
255
+ code: string;
256
+ message: string;
257
+ recoverable: boolean;
258
+ details?: Record<string, unknown> | undefined;
259
+ }, {
260
+ code: string;
261
+ message: string;
262
+ recoverable: boolean;
263
+ details?: Record<string, unknown> | undefined;
264
+ }>, "many">;
265
+ }, "strip", z.ZodTypeAny, {
266
+ summary: {
267
+ total: number;
268
+ succeeded: number;
269
+ failed: number;
270
+ };
271
+ results: (z.objectOutputType<{
272
+ platform: z.ZodString;
273
+ userId: z.ZodString;
274
+ details: z.ZodAny;
275
+ status: z.ZodLiteral<"success">;
276
+ }, z.ZodAny, "strip"> | z.objectOutputType<{
277
+ platform: z.ZodString;
278
+ userId: z.ZodString;
279
+ details: TDetailSchema;
280
+ status: z.ZodLiteral<"success">;
281
+ }, z.ZodAny, "strip">)[];
282
+ errors: {
283
+ code: string;
284
+ message: string;
285
+ recoverable: boolean;
286
+ details?: Record<string, unknown> | undefined;
287
+ }[];
288
+ }, {
289
+ summary: {
290
+ total: number;
291
+ succeeded: number;
292
+ failed: number;
293
+ };
294
+ results: (z.objectInputType<{
295
+ platform: z.ZodString;
296
+ userId: z.ZodString;
297
+ details: z.ZodAny;
298
+ status: z.ZodLiteral<"success">;
299
+ }, z.ZodAny, "strip"> | z.objectInputType<{
300
+ platform: z.ZodString;
301
+ userId: z.ZodString;
302
+ details: TDetailSchema;
303
+ status: z.ZodLiteral<"success">;
304
+ }, z.ZodAny, "strip">)[];
305
+ errors: {
306
+ code: string;
307
+ message: string;
308
+ recoverable: boolean;
309
+ details?: Record<string, unknown> | undefined;
310
+ }[];
311
+ }>;
188
312
  declare const MultiStatusDataSchema: z.ZodObject<{
189
313
  summary: z.ZodObject<{
190
314
  total: z.ZodNumber;
@@ -202,17 +326,17 @@ declare const MultiStatusDataSchema: z.ZodObject<{
202
326
  results: z.ZodArray<z.ZodObject<{
203
327
  platform: z.ZodString;
204
328
  userId: z.ZodString;
205
- details: z.ZodOptional<z.ZodAny>;
329
+ details: z.ZodAny;
206
330
  status: z.ZodLiteral<"success">;
207
331
  }, "strip", z.ZodAny, z.objectOutputType<{
208
332
  platform: z.ZodString;
209
333
  userId: z.ZodString;
210
- details: z.ZodOptional<z.ZodAny>;
334
+ details: z.ZodAny;
211
335
  status: z.ZodLiteral<"success">;
212
336
  }, z.ZodAny, "strip">, z.objectInputType<{
213
337
  platform: z.ZodString;
214
338
  userId: z.ZodString;
215
- details: z.ZodOptional<z.ZodAny>;
339
+ details: z.ZodAny;
216
340
  status: z.ZodLiteral<"success">;
217
341
  }, z.ZodAny, "strip">>, "many">;
218
342
  errors: z.ZodArray<z.ZodObject<{
@@ -240,7 +364,7 @@ declare const MultiStatusDataSchema: z.ZodObject<{
240
364
  results: z.objectOutputType<{
241
365
  platform: z.ZodString;
242
366
  userId: z.ZodString;
243
- details: z.ZodOptional<z.ZodAny>;
367
+ details: z.ZodAny;
244
368
  status: z.ZodLiteral<"success">;
245
369
  }, z.ZodAny, "strip">[];
246
370
  errors: {
@@ -258,7 +382,7 @@ declare const MultiStatusDataSchema: z.ZodObject<{
258
382
  results: z.objectInputType<{
259
383
  platform: z.ZodString;
260
384
  userId: z.ZodString;
261
- details: z.ZodOptional<z.ZodAny>;
385
+ details: z.ZodAny;
262
386
  status: z.ZodLiteral<"success">;
263
387
  }, z.ZodAny, "strip">[];
264
388
  errors: {
@@ -275,9 +399,15 @@ interface ApiResponse<T> {
275
399
  meta: ResponseMeta;
276
400
  }
277
401
  type ResponseMeta = z.infer<typeof ResponseMetaSchema>;
278
- type SuccessDetail = z.infer<typeof SuccessDetailSchema>;
402
+ type SuccessDetail<T = any> = Omit<z.infer<typeof SuccessDetailSchema>, 'details'> & {
403
+ details?: T;
404
+ };
279
405
  type MultiStatusSummary = z.infer<typeof MultiStatusSummarySchema>;
280
- type MultiStatusData = z.infer<typeof MultiStatusDataSchema>;
406
+ type MultiStatusData<TDetail = any> = {
407
+ summary: MultiStatusSummary;
408
+ results: SuccessDetail<TDetail>[];
409
+ errors: ErrorDetail[];
410
+ };
281
411
  type HealthStatus = z.infer<typeof HealthStatusSchema>;
282
412
 
283
413
  declare const PlatformParamSchema: z.ZodObject<{
@@ -3228,4 +3358,4 @@ declare const ProfileRefreshResponseSchema: z.ZodObject<{
3228
3358
  type UserProfile = z.infer<typeof UserProfileSchema>;
3229
3359
  type ProfileRefreshResponse = z.infer<typeof ProfileRefreshResponseSchema>;
3230
3360
 
3231
- 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, ActivityType, 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 Filter, FilterSchema, 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, PaginationSchema, 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 };
3361
+ 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, ActivityType, 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 Filter, FilterSchema, 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, PaginationSchema, 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, createMultiStatusDataSchema, createSuccessDetailSchema, errorCodeToStatusCode, isPlatformSupported };
package/dist/index.js CHANGED
@@ -93,12 +93,13 @@ var ResponseMetaSchema = z3.object({
93
93
  total: z3.number().int().nonnegative().optional()
94
94
  }).optional().describe("Pagination information if applicable")
95
95
  });
96
- var SuccessDetailSchema = z3.object({
96
+ var createSuccessDetailSchema = (detailsSchema = z3.any().optional()) => z3.object({
97
97
  platform: z3.string(),
98
98
  userId: z3.string(),
99
- details: z3.any().optional(),
99
+ details: detailsSchema,
100
100
  status: z3.literal("success")
101
101
  }).catchall(z3.any());
102
+ var SuccessDetailSchema = createSuccessDetailSchema();
102
103
  var HealthStatusSchema = z3.object({
103
104
  status: z3.string().describe("Health status of the API"),
104
105
  version: z3.string().optional().describe("API version"),
@@ -109,11 +110,15 @@ var MultiStatusSummarySchema = z3.object({
109
110
  succeeded: z3.number().int().nonnegative(),
110
111
  failed: z3.number().int().nonnegative()
111
112
  });
112
- var MultiStatusDataSchema = z3.object({
113
+ var createMultiStatusDataSchema = (detailsSchema) => z3.object({
113
114
  summary: MultiStatusSummarySchema,
114
- results: z3.array(SuccessDetailSchema),
115
+ results: z3.array(
116
+ detailsSchema ? createSuccessDetailSchema(detailsSchema) : SuccessDetailSchema
117
+ // Uses default createSuccessDetailSchema() if no specific schema passed
118
+ ),
115
119
  errors: z3.array(ErrorDetailSchema)
116
120
  });
121
+ var MultiStatusDataSchema = createMultiStatusDataSchema();
117
122
 
118
123
  // src/auth.ts
119
124
  import { z as z5 } from "zod";
@@ -639,6 +644,8 @@ export {
639
644
  UnlikePostResponseSchema,
640
645
  UsageRateLimitSchema,
641
646
  UserProfileSchema,
647
+ createMultiStatusDataSchema,
648
+ createSuccessDetailSchema,
642
649
  errorCodeToStatusCode,
643
650
  isPlatformSupported
644
651
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crosspost/types",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "description": "Shared type definitions for Crosspost API",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
package/src/response.ts CHANGED
@@ -16,12 +16,17 @@ export const ResponseMetaSchema = z.object({
16
16
  }).optional().describe('Pagination information if applicable'),
17
17
  });
18
18
 
19
- export const SuccessDetailSchema = z.object({
20
- platform: z.string(),
21
- userId: z.string(),
22
- details: z.any().optional(),
23
- status: z.literal('success'),
24
- }).catchall(z.any());
19
+ export const createSuccessDetailSchema = <T extends z.ZodTypeAny = z.ZodAny>(
20
+ detailsSchema: T = z.any().optional() as unknown as T,
21
+ ) =>
22
+ z.object({
23
+ platform: z.string(),
24
+ userId: z.string(),
25
+ details: detailsSchema,
26
+ status: z.literal('success'),
27
+ }).catchall(z.any());
28
+
29
+ export const SuccessDetailSchema = createSuccessDetailSchema(); // Default to any
25
30
 
26
31
  export const HealthStatusSchema = z.object({
27
32
  status: z.string().describe('Health status of the API'),
@@ -35,11 +40,20 @@ export const MultiStatusSummarySchema = z.object({
35
40
  failed: z.number().int().nonnegative(),
36
41
  });
37
42
 
38
- export const MultiStatusDataSchema = z.object({
39
- summary: MultiStatusSummarySchema,
40
- results: z.array(SuccessDetailSchema),
41
- errors: z.array(ErrorDetailSchema),
42
- });
43
+ export const createMultiStatusDataSchema = <
44
+ TDetailSchema extends z.ZodTypeAny = z.ZodAny,
45
+ >(
46
+ detailsSchema?: TDetailSchema,
47
+ ) =>
48
+ z.object({
49
+ summary: MultiStatusSummarySchema,
50
+ results: z.array(
51
+ detailsSchema ? createSuccessDetailSchema(detailsSchema) : SuccessDetailSchema, // Uses default createSuccessDetailSchema() if no specific schema passed
52
+ ),
53
+ errors: z.array(ErrorDetailSchema),
54
+ });
55
+
56
+ export const MultiStatusDataSchema = createMultiStatusDataSchema(); // Default to any for details
43
57
 
44
58
  export interface ApiResponse<T> {
45
59
  success: boolean;
@@ -49,7 +63,14 @@ export interface ApiResponse<T> {
49
63
  }
50
64
 
51
65
  export type ResponseMeta = z.infer<typeof ResponseMetaSchema>;
52
- export type SuccessDetail = z.infer<typeof SuccessDetailSchema>;
66
+ export type SuccessDetail<T = any> = Omit<z.infer<typeof SuccessDetailSchema>, 'details'> & {
67
+ details?: T;
68
+ };
53
69
  export type MultiStatusSummary = z.infer<typeof MultiStatusSummarySchema>;
54
- export type MultiStatusData = z.infer<typeof MultiStatusDataSchema>; // Renamed type
70
+
71
+ export type MultiStatusData<TDetail = any> = {
72
+ summary: MultiStatusSummary;
73
+ results: SuccessDetail<TDetail>[];
74
+ errors: ErrorDetail[];
75
+ };
55
76
  export type HealthStatus = z.infer<typeof HealthStatusSchema>;