@postrun/js 0.1.0 → 1.0.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
@@ -808,13 +808,15 @@ var zErrorCode = z__namespace.enum([
808
808
  "idempotency_key_invalid",
809
809
  "idempotency_key_reused",
810
810
  "idempotency_request_in_progress",
811
- "source_url_unsupported",
812
811
  "account_not_available",
813
812
  "connection_reauth_required",
814
813
  "connection_not_pending",
814
+ "connection_in_use",
815
815
  "not_implemented",
816
+ "connection_discovery_failed",
816
817
  "media_processing",
817
818
  "not_publishable",
819
+ "profile_scope_invalid",
818
820
  "media_unprobeable",
819
821
  "media_too_large",
820
822
  "media_aspect_ratio_unsupported",
@@ -834,9 +836,12 @@ var zErrorCode = z__namespace.enum([
834
836
  "video_aspect_unsupported",
835
837
  "video_duration_too_short",
836
838
  "video_duration_exceeds_max",
839
+ "video_transform_failed",
840
+ "media_fetch_failed",
837
841
  "document_format_unsupported",
838
842
  "document_too_large",
839
843
  "document_too_many_pages",
844
+ "media_format_indeterminate",
840
845
  "media_count_invalid",
841
846
  "body_too_long",
842
847
  "content_missing",
@@ -846,6 +851,7 @@ var zErrorCode = z__namespace.enum([
846
851
  "media_type_mismatch",
847
852
  "tag_limit_exceeded",
848
853
  "reel_field_on_non_reel",
854
+ "field_placement_invalid",
849
855
  "media_not_ready",
850
856
  "media_failed",
851
857
  "media_unsupported",
@@ -873,6 +879,12 @@ var zErrorCode = z__namespace.enum([
873
879
  "facebook_rate_limited",
874
880
  "facebook_not_authorized",
875
881
  "facebook_publish_failed",
882
+ "tiktok_privacy_not_allowed",
883
+ "tiktok_duration_exceeds_max",
884
+ "tiktok_media_processing",
885
+ "tiktok_not_authorized",
886
+ "tiktok_rate_limited",
887
+ "tiktok_publish_failed",
876
888
  "connection_platform_mismatch"
877
889
  ]);
878
890
  z__namespace.object({
@@ -983,7 +995,14 @@ z__namespace.object({
983
995
  });
984
996
  z__namespace.object({
985
997
  limit: z__namespace.int().gte(1).lte(100).optional().default(20),
986
- offset: z__namespace.int().gte(0).lte(9007199254740991).optional().default(0)
998
+ offset: z__namespace.int().gte(0).lte(9007199254740991).optional().default(0),
999
+ nango_connection_id: z__namespace.string().min(1).optional(),
1000
+ kind: z__namespace.enum(["posting", "ads"]).optional(),
1001
+ status: z__namespace.enum([
1002
+ "pending",
1003
+ "active",
1004
+ "needs_reauth"
1005
+ ]).optional()
987
1006
  });
988
1007
  z__namespace.object({
989
1008
  object: z__namespace.literal("list"),
@@ -1000,8 +1019,18 @@ z__namespace.object({
1000
1019
  "instagram",
1001
1020
  "tiktok"
1002
1021
  ]),
1022
+ kind: z__namespace.enum(["posting", "ads"]),
1023
+ status: z__namespace.enum([
1024
+ "pending",
1025
+ "active",
1026
+ "needs_reauth"
1027
+ ]),
1003
1028
  external_account_id: z__namespace.string().nullable(),
1004
1029
  external_account_name: z__namespace.string().nullable(),
1030
+ username: z__namespace.string().nullable(),
1031
+ avatar_url: z__namespace.string().nullable(),
1032
+ profile_url: z__namespace.string().nullable(),
1033
+ reauth_at: z__namespace.string().nullable(),
1005
1034
  currency: z__namespace.string().nullable(),
1006
1035
  created_at: z__namespace.string().nullable(),
1007
1036
  updated_at: z__namespace.string().nullable()
@@ -1035,8 +1064,18 @@ z__namespace.object({
1035
1064
  "instagram",
1036
1065
  "tiktok"
1037
1066
  ]),
1067
+ kind: z__namespace.enum(["posting", "ads"]),
1068
+ status: z__namespace.enum([
1069
+ "pending",
1070
+ "active",
1071
+ "needs_reauth"
1072
+ ]),
1038
1073
  external_account_id: z__namespace.string().nullable(),
1039
1074
  external_account_name: z__namespace.string().nullable(),
1075
+ username: z__namespace.string().nullable(),
1076
+ avatar_url: z__namespace.string().nullable(),
1077
+ profile_url: z__namespace.string().nullable(),
1078
+ reauth_at: z__namespace.string().nullable(),
1040
1079
  currency: z__namespace.string().nullable(),
1041
1080
  created_at: z__namespace.string().nullable(),
1042
1081
  updated_at: z__namespace.string().nullable()
@@ -1060,8 +1099,18 @@ z__namespace.object({
1060
1099
  "instagram",
1061
1100
  "tiktok"
1062
1101
  ]),
1102
+ kind: z__namespace.enum(["posting", "ads"]),
1103
+ status: z__namespace.enum([
1104
+ "pending",
1105
+ "active",
1106
+ "needs_reauth"
1107
+ ]),
1063
1108
  external_account_id: z__namespace.string().nullable(),
1064
1109
  external_account_name: z__namespace.string().nullable(),
1110
+ username: z__namespace.string().nullable(),
1111
+ avatar_url: z__namespace.string().nullable(),
1112
+ profile_url: z__namespace.string().nullable(),
1113
+ reauth_at: z__namespace.string().nullable(),
1065
1114
  currency: z__namespace.string().nullable(),
1066
1115
  created_at: z__namespace.string().nullable(),
1067
1116
  updated_at: z__namespace.string().nullable()
@@ -1075,9 +1124,15 @@ z__namespace.object({
1075
1124
  external_account_id: z__namespace.string(),
1076
1125
  name: z__namespace.string().nullable(),
1077
1126
  currency: z__namespace.string().nullable(),
1127
+ username: z__namespace.string().nullish(),
1128
+ avatar_url: z__namespace.string().nullish(),
1129
+ profile_url: z__namespace.string().nullish(),
1078
1130
  instagram: z__namespace.object({
1079
1131
  external_account_id: z__namespace.string(),
1080
- name: z__namespace.string().nullable()
1132
+ name: z__namespace.string().nullable(),
1133
+ username: z__namespace.string().nullish(),
1134
+ avatar_url: z__namespace.string().nullish(),
1135
+ profile_url: z__namespace.string().nullish()
1081
1136
  }).nullish()
1082
1137
  }))
1083
1138
  });
@@ -1085,7 +1140,6 @@ z__namespace.object({
1085
1140
  platform: z__namespace.enum([
1086
1141
  "meta_ads",
1087
1142
  "google_ads",
1088
- "tiktok_ads",
1089
1143
  "x",
1090
1144
  "linkedin",
1091
1145
  "facebook_page",
@@ -1096,10 +1150,200 @@ z__namespace.object({
1096
1150
  id: z__namespace.string()
1097
1151
  });
1098
1152
  z__namespace.object({
1153
+ hosted_connect_url: z__namespace.string(),
1154
+ connect_token: z__namespace.string(),
1099
1155
  connect_session_token: z__namespace.string(),
1100
- connect_url: z__namespace.string(),
1156
+ provider_config_key: z__namespace.string(),
1157
+ nango_host: z__namespace.string(),
1101
1158
  expires_at: z__namespace.string()
1102
1159
  });
1160
+ z__namespace.object({
1161
+ limit: z__namespace.int().gte(1).lte(100).optional().default(20),
1162
+ offset: z__namespace.int().gte(0).lte(9007199254740991).optional().default(0),
1163
+ profile_id: z__namespace.string().optional(),
1164
+ status: z__namespace.enum([
1165
+ "uploading",
1166
+ "processing",
1167
+ "ready",
1168
+ "failed"
1169
+ ]).optional(),
1170
+ kind: z__namespace.enum([
1171
+ "image",
1172
+ "video",
1173
+ "gif",
1174
+ "document"
1175
+ ]).optional(),
1176
+ external_id: z__namespace.string().optional(),
1177
+ metadata: z__namespace.record(z__namespace.string(), z__namespace.union([
1178
+ z__namespace.string().max(500),
1179
+ z__namespace.number(),
1180
+ z__namespace.boolean()
1181
+ ])).optional()
1182
+ });
1183
+ z__namespace.object({
1184
+ object: z__namespace.literal("list"),
1185
+ data: z__namespace.array(z__namespace.object({
1186
+ id: z__namespace.string(),
1187
+ object: z__namespace.literal("media"),
1188
+ profile_id: z__namespace.string(),
1189
+ kind: z__namespace.enum([
1190
+ "image",
1191
+ "video",
1192
+ "gif",
1193
+ "document"
1194
+ ]).nullable(),
1195
+ content_type: z__namespace.string().nullable(),
1196
+ status: z__namespace.enum([
1197
+ "uploading",
1198
+ "processing",
1199
+ "ready",
1200
+ "failed"
1201
+ ]),
1202
+ progress: z__namespace.object({
1203
+ stage: z__namespace.enum([
1204
+ "queued",
1205
+ "analyzing",
1206
+ "transcoding",
1207
+ "done"
1208
+ ]),
1209
+ percent: z__namespace.int().gte(0).lte(100)
1210
+ }),
1211
+ raw: z__namespace.boolean(),
1212
+ error: z__namespace.object({
1213
+ code: z__namespace.enum([
1214
+ "media_unprobeable",
1215
+ "media_format_indeterminate",
1216
+ "media_too_large",
1217
+ "media_aspect_ratio_unsupported",
1218
+ "media_resolution_too_low",
1219
+ "media_gif_unsupported",
1220
+ "media_format_recompressed",
1221
+ "media_resolution_downscaled",
1222
+ "video_container_unsupported",
1223
+ "video_codec_unsupported",
1224
+ "video_audio_codec_unsupported",
1225
+ "video_too_large",
1226
+ "video_too_small",
1227
+ "video_dimensions_unsupported",
1228
+ "video_dimensions_too_large",
1229
+ "video_fps_unsupported",
1230
+ "video_fps_too_low",
1231
+ "video_aspect_unsupported",
1232
+ "video_duration_too_short",
1233
+ "video_duration_exceeds_max",
1234
+ "video_transform_failed",
1235
+ "media_fetch_failed",
1236
+ "document_format_unsupported",
1237
+ "document_too_large",
1238
+ "document_too_many_pages",
1239
+ "media_unsupported"
1240
+ ]),
1241
+ message: z__namespace.string(),
1242
+ hint: z__namespace.string().optional(),
1243
+ allowed: z__namespace.array(z__namespace.string()).optional(),
1244
+ got: z__namespace.string().optional()
1245
+ }).nullable(),
1246
+ source: z__namespace.object({
1247
+ format: z__namespace.string(),
1248
+ bytes: z__namespace.int().gte(0).lte(9007199254740991),
1249
+ width: z__namespace.int().gt(0).lte(9007199254740991).nullable(),
1250
+ height: z__namespace.int().gt(0).lte(9007199254740991).nullable(),
1251
+ duration_ms: z__namespace.int().gte(0).lte(9007199254740991).nullable()
1252
+ }).nullable(),
1253
+ alt_text: z__namespace.string().max(1e3).nullable(),
1254
+ per_platform: z__namespace.record(z__namespace.string(), z__namespace.object({
1255
+ status: z__namespace.enum([
1256
+ "processing",
1257
+ "ready",
1258
+ "failed"
1259
+ ]),
1260
+ url: z__namespace.string().nullable(),
1261
+ width: z__namespace.int().gt(0).lte(9007199254740991).nullable(),
1262
+ height: z__namespace.int().gt(0).lte(9007199254740991).nullable(),
1263
+ bytes: z__namespace.int().gte(0).lte(9007199254740991).nullable(),
1264
+ warnings: z__namespace.array(z__namespace.object({
1265
+ code: z__namespace.enum([
1266
+ "media_unprobeable",
1267
+ "media_format_indeterminate",
1268
+ "media_too_large",
1269
+ "media_aspect_ratio_unsupported",
1270
+ "media_resolution_too_low",
1271
+ "media_gif_unsupported",
1272
+ "media_format_recompressed",
1273
+ "media_resolution_downscaled",
1274
+ "video_container_unsupported",
1275
+ "video_codec_unsupported",
1276
+ "video_audio_codec_unsupported",
1277
+ "video_too_large",
1278
+ "video_too_small",
1279
+ "video_dimensions_unsupported",
1280
+ "video_dimensions_too_large",
1281
+ "video_fps_unsupported",
1282
+ "video_fps_too_low",
1283
+ "video_aspect_unsupported",
1284
+ "video_duration_too_short",
1285
+ "video_duration_exceeds_max",
1286
+ "video_transform_failed",
1287
+ "media_fetch_failed",
1288
+ "document_format_unsupported",
1289
+ "document_too_large",
1290
+ "document_too_many_pages",
1291
+ "media_unsupported"
1292
+ ]),
1293
+ message: z__namespace.string(),
1294
+ hint: z__namespace.string().optional(),
1295
+ allowed: z__namespace.array(z__namespace.string()).optional(),
1296
+ got: z__namespace.string().optional()
1297
+ })),
1298
+ errors: z__namespace.array(z__namespace.object({
1299
+ code: z__namespace.enum([
1300
+ "media_unprobeable",
1301
+ "media_format_indeterminate",
1302
+ "media_too_large",
1303
+ "media_aspect_ratio_unsupported",
1304
+ "media_resolution_too_low",
1305
+ "media_gif_unsupported",
1306
+ "media_format_recompressed",
1307
+ "media_resolution_downscaled",
1308
+ "video_container_unsupported",
1309
+ "video_codec_unsupported",
1310
+ "video_audio_codec_unsupported",
1311
+ "video_too_large",
1312
+ "video_too_small",
1313
+ "video_dimensions_unsupported",
1314
+ "video_dimensions_too_large",
1315
+ "video_fps_unsupported",
1316
+ "video_fps_too_low",
1317
+ "video_aspect_unsupported",
1318
+ "video_duration_too_short",
1319
+ "video_duration_exceeds_max",
1320
+ "video_transform_failed",
1321
+ "media_fetch_failed",
1322
+ "document_format_unsupported",
1323
+ "document_too_large",
1324
+ "document_too_many_pages",
1325
+ "media_unsupported"
1326
+ ]),
1327
+ message: z__namespace.string(),
1328
+ hint: z__namespace.string().optional(),
1329
+ allowed: z__namespace.array(z__namespace.string()).optional(),
1330
+ got: z__namespace.string().optional()
1331
+ }))
1332
+ })),
1333
+ external_id: z__namespace.string().nullable(),
1334
+ metadata: z__namespace.record(z__namespace.string(), z__namespace.union([
1335
+ z__namespace.string().max(500),
1336
+ z__namespace.number(),
1337
+ z__namespace.boolean()
1338
+ ])),
1339
+ created_at: z__namespace.string(),
1340
+ updated_at: z__namespace.string()
1341
+ })),
1342
+ total: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
1343
+ limit: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
1344
+ offset: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
1345
+ has_more: z__namespace.boolean()
1346
+ });
1103
1347
  z__namespace.object({
1104
1348
  profile_id: z__namespace.string(),
1105
1349
  kind: z__namespace.enum([
@@ -1107,7 +1351,7 @@ z__namespace.object({
1107
1351
  "video",
1108
1352
  "gif",
1109
1353
  "document"
1110
- ]),
1354
+ ]).optional(),
1111
1355
  content_type: z__namespace.string().min(1).regex(/^(?:(?:image|video)\/[A-Za-z0-9][A-Za-z0-9!#$&^_.+-]*|application\/pdf|application\/msword|application\/vnd\.openxmlformats-officedocument\.wordprocessingml\.document|application\/vnd\.ms-powerpoint|application\/vnd\.openxmlformats-officedocument\.presentationml\.presentation)$/).optional(),
1112
1356
  source_url: z__namespace.url().optional(),
1113
1357
  targets: z__namespace.array(z__namespace.enum([
@@ -1136,17 +1380,28 @@ z__namespace.object({
1136
1380
  "video",
1137
1381
  "gif",
1138
1382
  "document"
1139
- ]),
1383
+ ]).nullable(),
1384
+ content_type: z__namespace.string().nullable(),
1140
1385
  status: z__namespace.enum([
1141
1386
  "uploading",
1142
1387
  "processing",
1143
1388
  "ready",
1144
1389
  "failed"
1145
1390
  ]),
1391
+ progress: z__namespace.object({
1392
+ stage: z__namespace.enum([
1393
+ "queued",
1394
+ "analyzing",
1395
+ "transcoding",
1396
+ "done"
1397
+ ]),
1398
+ percent: z__namespace.int().gte(0).lte(100)
1399
+ }),
1146
1400
  raw: z__namespace.boolean(),
1147
1401
  error: z__namespace.object({
1148
1402
  code: z__namespace.enum([
1149
1403
  "media_unprobeable",
1404
+ "media_format_indeterminate",
1150
1405
  "media_too_large",
1151
1406
  "media_aspect_ratio_unsupported",
1152
1407
  "media_resolution_too_low",
@@ -1165,6 +1420,8 @@ z__namespace.object({
1165
1420
  "video_aspect_unsupported",
1166
1421
  "video_duration_too_short",
1167
1422
  "video_duration_exceeds_max",
1423
+ "video_transform_failed",
1424
+ "media_fetch_failed",
1168
1425
  "document_format_unsupported",
1169
1426
  "document_too_large",
1170
1427
  "document_too_many_pages",
@@ -1196,6 +1453,7 @@ z__namespace.object({
1196
1453
  warnings: z__namespace.array(z__namespace.object({
1197
1454
  code: z__namespace.enum([
1198
1455
  "media_unprobeable",
1456
+ "media_format_indeterminate",
1199
1457
  "media_too_large",
1200
1458
  "media_aspect_ratio_unsupported",
1201
1459
  "media_resolution_too_low",
@@ -1214,6 +1472,8 @@ z__namespace.object({
1214
1472
  "video_aspect_unsupported",
1215
1473
  "video_duration_too_short",
1216
1474
  "video_duration_exceeds_max",
1475
+ "video_transform_failed",
1476
+ "media_fetch_failed",
1217
1477
  "document_format_unsupported",
1218
1478
  "document_too_large",
1219
1479
  "document_too_many_pages",
@@ -1227,6 +1487,7 @@ z__namespace.object({
1227
1487
  errors: z__namespace.array(z__namespace.object({
1228
1488
  code: z__namespace.enum([
1229
1489
  "media_unprobeable",
1490
+ "media_format_indeterminate",
1230
1491
  "media_too_large",
1231
1492
  "media_aspect_ratio_unsupported",
1232
1493
  "media_resolution_too_low",
@@ -1245,6 +1506,8 @@ z__namespace.object({
1245
1506
  "video_aspect_unsupported",
1246
1507
  "video_duration_too_short",
1247
1508
  "video_duration_exceeds_max",
1509
+ "video_transform_failed",
1510
+ "media_fetch_failed",
1248
1511
  "document_format_unsupported",
1249
1512
  "document_too_large",
1250
1513
  "document_too_many_pages",
@@ -1291,17 +1554,28 @@ z__namespace.object({
1291
1554
  "video",
1292
1555
  "gif",
1293
1556
  "document"
1294
- ]),
1557
+ ]).nullable(),
1558
+ content_type: z__namespace.string().nullable(),
1295
1559
  status: z__namespace.enum([
1296
1560
  "uploading",
1297
1561
  "processing",
1298
1562
  "ready",
1299
1563
  "failed"
1300
1564
  ]),
1565
+ progress: z__namespace.object({
1566
+ stage: z__namespace.enum([
1567
+ "queued",
1568
+ "analyzing",
1569
+ "transcoding",
1570
+ "done"
1571
+ ]),
1572
+ percent: z__namespace.int().gte(0).lte(100)
1573
+ }),
1301
1574
  raw: z__namespace.boolean(),
1302
1575
  error: z__namespace.object({
1303
1576
  code: z__namespace.enum([
1304
1577
  "media_unprobeable",
1578
+ "media_format_indeterminate",
1305
1579
  "media_too_large",
1306
1580
  "media_aspect_ratio_unsupported",
1307
1581
  "media_resolution_too_low",
@@ -1320,6 +1594,8 @@ z__namespace.object({
1320
1594
  "video_aspect_unsupported",
1321
1595
  "video_duration_too_short",
1322
1596
  "video_duration_exceeds_max",
1597
+ "video_transform_failed",
1598
+ "media_fetch_failed",
1323
1599
  "document_format_unsupported",
1324
1600
  "document_too_large",
1325
1601
  "document_too_many_pages",
@@ -1351,6 +1627,7 @@ z__namespace.object({
1351
1627
  warnings: z__namespace.array(z__namespace.object({
1352
1628
  code: z__namespace.enum([
1353
1629
  "media_unprobeable",
1630
+ "media_format_indeterminate",
1354
1631
  "media_too_large",
1355
1632
  "media_aspect_ratio_unsupported",
1356
1633
  "media_resolution_too_low",
@@ -1369,6 +1646,8 @@ z__namespace.object({
1369
1646
  "video_aspect_unsupported",
1370
1647
  "video_duration_too_short",
1371
1648
  "video_duration_exceeds_max",
1649
+ "video_transform_failed",
1650
+ "media_fetch_failed",
1372
1651
  "document_format_unsupported",
1373
1652
  "document_too_large",
1374
1653
  "document_too_many_pages",
@@ -1382,6 +1661,7 @@ z__namespace.object({
1382
1661
  errors: z__namespace.array(z__namespace.object({
1383
1662
  code: z__namespace.enum([
1384
1663
  "media_unprobeable",
1664
+ "media_format_indeterminate",
1385
1665
  "media_too_large",
1386
1666
  "media_aspect_ratio_unsupported",
1387
1667
  "media_resolution_too_low",
@@ -1400,6 +1680,8 @@ z__namespace.object({
1400
1680
  "video_aspect_unsupported",
1401
1681
  "video_duration_too_short",
1402
1682
  "video_duration_exceeds_max",
1683
+ "video_transform_failed",
1684
+ "media_fetch_failed",
1403
1685
  "document_format_unsupported",
1404
1686
  "document_too_large",
1405
1687
  "document_too_many_pages",
@@ -1449,17 +1731,28 @@ z__namespace.object({
1449
1731
  "video",
1450
1732
  "gif",
1451
1733
  "document"
1452
- ]),
1734
+ ]).nullable(),
1735
+ content_type: z__namespace.string().nullable(),
1453
1736
  status: z__namespace.enum([
1454
1737
  "uploading",
1455
1738
  "processing",
1456
1739
  "ready",
1457
1740
  "failed"
1458
1741
  ]),
1742
+ progress: z__namespace.object({
1743
+ stage: z__namespace.enum([
1744
+ "queued",
1745
+ "analyzing",
1746
+ "transcoding",
1747
+ "done"
1748
+ ]),
1749
+ percent: z__namespace.int().gte(0).lte(100)
1750
+ }),
1459
1751
  raw: z__namespace.boolean(),
1460
1752
  error: z__namespace.object({
1461
1753
  code: z__namespace.enum([
1462
1754
  "media_unprobeable",
1755
+ "media_format_indeterminate",
1463
1756
  "media_too_large",
1464
1757
  "media_aspect_ratio_unsupported",
1465
1758
  "media_resolution_too_low",
@@ -1478,6 +1771,8 @@ z__namespace.object({
1478
1771
  "video_aspect_unsupported",
1479
1772
  "video_duration_too_short",
1480
1773
  "video_duration_exceeds_max",
1774
+ "video_transform_failed",
1775
+ "media_fetch_failed",
1481
1776
  "document_format_unsupported",
1482
1777
  "document_too_large",
1483
1778
  "document_too_many_pages",
@@ -1509,6 +1804,7 @@ z__namespace.object({
1509
1804
  warnings: z__namespace.array(z__namespace.object({
1510
1805
  code: z__namespace.enum([
1511
1806
  "media_unprobeable",
1807
+ "media_format_indeterminate",
1512
1808
  "media_too_large",
1513
1809
  "media_aspect_ratio_unsupported",
1514
1810
  "media_resolution_too_low",
@@ -1527,6 +1823,8 @@ z__namespace.object({
1527
1823
  "video_aspect_unsupported",
1528
1824
  "video_duration_too_short",
1529
1825
  "video_duration_exceeds_max",
1826
+ "video_transform_failed",
1827
+ "media_fetch_failed",
1530
1828
  "document_format_unsupported",
1531
1829
  "document_too_large",
1532
1830
  "document_too_many_pages",
@@ -1540,6 +1838,7 @@ z__namespace.object({
1540
1838
  errors: z__namespace.array(z__namespace.object({
1541
1839
  code: z__namespace.enum([
1542
1840
  "media_unprobeable",
1841
+ "media_format_indeterminate",
1543
1842
  "media_too_large",
1544
1843
  "media_aspect_ratio_unsupported",
1545
1844
  "media_resolution_too_low",
@@ -1558,6 +1857,8 @@ z__namespace.object({
1558
1857
  "video_aspect_unsupported",
1559
1858
  "video_duration_too_short",
1560
1859
  "video_duration_exceeds_max",
1860
+ "video_transform_failed",
1861
+ "media_fetch_failed",
1561
1862
  "document_format_unsupported",
1562
1863
  "document_too_large",
1563
1864
  "document_too_many_pages",
@@ -1846,6 +2147,38 @@ z__namespace.object({
1846
2147
  settings: z__namespace.object({
1847
2148
  link: z__namespace.url().optional()
1848
2149
  }).optional().default({})
2150
+ }),
2151
+ z__namespace.object({
2152
+ platform: z__namespace.literal("tiktok"),
2153
+ post_type: z__namespace.enum([
2154
+ "video",
2155
+ "single_image",
2156
+ "carousel"
2157
+ ]),
2158
+ connection_id: z__namespace.string(),
2159
+ body: z__namespace.string().optional(),
2160
+ media: z__namespace.array(z__namespace.object({
2161
+ media_id: z__namespace.string(),
2162
+ crop_box: z__namespace.record(z__namespace.string(), z__namespace.unknown()).nullish(),
2163
+ alt_text_override: z__namespace.string().nullish()
2164
+ })).optional().default([]),
2165
+ settings: z__namespace.object({
2166
+ privacy_level: z__namespace.enum([
2167
+ "PUBLIC_TO_EVERYONE",
2168
+ "MUTUAL_FOLLOW_FRIENDS",
2169
+ "FOLLOWER_OF_CREATOR",
2170
+ "SELF_ONLY"
2171
+ ]).optional(),
2172
+ disable_comment: z__namespace.boolean().optional(),
2173
+ disable_duet: z__namespace.boolean().optional(),
2174
+ disable_stitch: z__namespace.boolean().optional(),
2175
+ video_cover_timestamp_ms: z__namespace.int().gte(0).lte(9007199254740991).optional(),
2176
+ photo_cover_index: z__namespace.int().gte(0).lte(9007199254740991).optional(),
2177
+ auto_add_music: z__namespace.boolean().optional(),
2178
+ brand_content_toggle: z__namespace.boolean().optional(),
2179
+ brand_organic_toggle: z__namespace.boolean().optional(),
2180
+ is_aigc: z__namespace.boolean().optional()
2181
+ }).optional().default({})
1849
2182
  })
1850
2183
  ])).min(1)
1851
2184
  });
@@ -2169,6 +2502,38 @@ z__namespace.object({
2169
2502
  settings: z__namespace.object({
2170
2503
  link: z__namespace.url().optional()
2171
2504
  }).optional().default({})
2505
+ }),
2506
+ z__namespace.object({
2507
+ platform: z__namespace.literal("tiktok"),
2508
+ post_type: z__namespace.enum([
2509
+ "video",
2510
+ "single_image",
2511
+ "carousel"
2512
+ ]),
2513
+ connection_id: z__namespace.string(),
2514
+ body: z__namespace.string().optional(),
2515
+ media: z__namespace.array(z__namespace.object({
2516
+ media_id: z__namespace.string(),
2517
+ crop_box: z__namespace.record(z__namespace.string(), z__namespace.unknown()).nullish(),
2518
+ alt_text_override: z__namespace.string().nullish()
2519
+ })).optional().default([]),
2520
+ settings: z__namespace.object({
2521
+ privacy_level: z__namespace.enum([
2522
+ "PUBLIC_TO_EVERYONE",
2523
+ "MUTUAL_FOLLOW_FRIENDS",
2524
+ "FOLLOWER_OF_CREATOR",
2525
+ "SELF_ONLY"
2526
+ ]).optional(),
2527
+ disable_comment: z__namespace.boolean().optional(),
2528
+ disable_duet: z__namespace.boolean().optional(),
2529
+ disable_stitch: z__namespace.boolean().optional(),
2530
+ video_cover_timestamp_ms: z__namespace.int().gte(0).lte(9007199254740991).optional(),
2531
+ photo_cover_index: z__namespace.int().gte(0).lte(9007199254740991).optional(),
2532
+ auto_add_music: z__namespace.boolean().optional(),
2533
+ brand_content_toggle: z__namespace.boolean().optional(),
2534
+ brand_organic_toggle: z__namespace.boolean().optional(),
2535
+ is_aigc: z__namespace.boolean().optional()
2536
+ }).optional().default({})
2172
2537
  })
2173
2538
  ])).min(1).optional()
2174
2539
  });
@@ -4193,6 +4558,19 @@ var connectionsConnect = (options) => (options.client ?? client).post({
4193
4558
  ...options.headers
4194
4559
  }
4195
4560
  });
4561
+ var mediaList = (options) => (options?.client ?? client).get({
4562
+ security: [{
4563
+ key: "secretKey",
4564
+ scheme: "bearer",
4565
+ type: "http"
4566
+ }, {
4567
+ key: "frontendToken",
4568
+ scheme: "bearer",
4569
+ type: "http"
4570
+ }],
4571
+ url: "/media",
4572
+ ...options
4573
+ });
4196
4574
  var mediaCreate = (options) => (options.client ?? client).post({
4197
4575
  security: [{
4198
4576
  key: "secretKey",
@@ -5300,11 +5678,39 @@ var instagramHandler = {
5300
5678
  settings
5301
5679
  })
5302
5680
  };
5681
+ var tiktokHandler = {
5682
+ derivePostType: (media) => {
5683
+ if (media.length === 0) {
5684
+ throw new ComposeError("TikTok requires at least one media item.");
5685
+ }
5686
+ rejectDocuments(media, "TikTok");
5687
+ const { images, videos } = countKinds(media);
5688
+ if (images > 0 && videos > 0) {
5689
+ throw new ComposeError(
5690
+ "TikTok can't combine images and video in one post \u2014 split them into separate posts."
5691
+ );
5692
+ }
5693
+ if (videos > 1) {
5694
+ throw new ComposeError("TikTok allows at most one video per post.");
5695
+ }
5696
+ if (videos === 1) return "video";
5697
+ return images >= 2 ? "carousel" : "single_image";
5698
+ },
5699
+ buildVariant: ({ settings, postType, connectionId, body, media }) => ({
5700
+ platform: "tiktok",
5701
+ post_type: postType,
5702
+ connection_id: connectionId,
5703
+ body,
5704
+ media: [...media],
5705
+ settings
5706
+ })
5707
+ };
5303
5708
  var PLATFORM_HANDLERS = {
5304
5709
  x: xHandler,
5305
5710
  linkedin: linkedInHandler,
5306
5711
  facebook_page: facebookHandler,
5307
- instagram: instagramHandler
5712
+ instagram: instagramHandler,
5713
+ tiktok: tiktokHandler
5308
5714
  };
5309
5715
  function isPostPlatform(value) {
5310
5716
  return Object.prototype.hasOwnProperty.call(PLATFORM_HANDLERS, value);
@@ -5330,15 +5736,22 @@ function buildChannel(handler, platform, config, content, connections) {
5330
5736
  media: media.map((item) => ({ media_id: item.id }))
5331
5737
  });
5332
5738
  }
5739
+ function collectChannel(platform, channels, content, connections) {
5740
+ const config = channels[platform];
5741
+ if (!config) return void 0;
5742
+ return buildChannel(
5743
+ PLATFORM_HANDLERS[platform],
5744
+ platform,
5745
+ config,
5746
+ content,
5747
+ connections
5748
+ );
5749
+ }
5333
5750
  function buildVariants(content, channels, connections) {
5334
- const variants = [];
5335
- if (channels.x) variants.push(buildChannel(xHandler, "x", channels.x, content, connections));
5336
- if (channels.linkedin)
5337
- variants.push(buildChannel(linkedInHandler, "linkedin", channels.linkedin, content, connections));
5338
- if (channels.facebook_page)
5339
- variants.push(buildChannel(facebookHandler, "facebook_page", channels.facebook_page, content, connections));
5340
- if (channels.instagram)
5341
- variants.push(buildChannel(instagramHandler, "instagram", channels.instagram, content, connections));
5751
+ const variants = POST_PLATFORMS.flatMap((platform) => {
5752
+ const variant = collectChannel(platform, channels, content, connections);
5753
+ return variant ? [variant] : [];
5754
+ });
5342
5755
  if (variants.length === 0) {
5343
5756
  throw new ComposeError("At least one channel is required.");
5344
5757
  }
@@ -5444,6 +5857,7 @@ exports.logsList = logsList;
5444
5857
  exports.mediaCreate = mediaCreate;
5445
5858
  exports.mediaDelete = mediaDelete;
5446
5859
  exports.mediaGet = mediaGet;
5860
+ exports.mediaList = mediaList;
5447
5861
  exports.mediaUpdate = mediaUpdate;
5448
5862
  exports.metaAccount = metaAccount;
5449
5863
  exports.metaAd = metaAd;