@postrun/js 0.1.0 → 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
@@ -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,188 @@ z__namespace.object({
1096
1150
  id: z__namespace.string()
1097
1151
  });
1098
1152
  z__namespace.object({
1099
- connect_session_token: z__namespace.string(),
1100
- connect_url: z__namespace.string(),
1153
+ hosted_connect_url: z__namespace.string(),
1154
+ connect_token: z__namespace.string(),
1101
1155
  expires_at: z__namespace.string()
1102
1156
  });
1157
+ z__namespace.object({
1158
+ limit: z__namespace.int().gte(1).lte(100).optional().default(20),
1159
+ offset: z__namespace.int().gte(0).lte(9007199254740991).optional().default(0),
1160
+ profile_id: z__namespace.string().optional(),
1161
+ status: z__namespace.enum([
1162
+ "uploading",
1163
+ "processing",
1164
+ "ready",
1165
+ "failed"
1166
+ ]).optional(),
1167
+ kind: z__namespace.enum([
1168
+ "image",
1169
+ "video",
1170
+ "gif",
1171
+ "document"
1172
+ ]).optional(),
1173
+ external_id: z__namespace.string().optional(),
1174
+ metadata: z__namespace.record(z__namespace.string(), z__namespace.union([
1175
+ z__namespace.string().max(500),
1176
+ z__namespace.number(),
1177
+ z__namespace.boolean()
1178
+ ])).optional()
1179
+ });
1180
+ z__namespace.object({
1181
+ object: z__namespace.literal("list"),
1182
+ data: z__namespace.array(z__namespace.object({
1183
+ id: z__namespace.string(),
1184
+ object: z__namespace.literal("media"),
1185
+ profile_id: z__namespace.string(),
1186
+ kind: z__namespace.enum([
1187
+ "image",
1188
+ "video",
1189
+ "gif",
1190
+ "document"
1191
+ ]).nullable(),
1192
+ content_type: z__namespace.string().nullable(),
1193
+ status: z__namespace.enum([
1194
+ "uploading",
1195
+ "processing",
1196
+ "ready",
1197
+ "failed"
1198
+ ]),
1199
+ raw: z__namespace.boolean(),
1200
+ error: z__namespace.object({
1201
+ code: z__namespace.enum([
1202
+ "media_unprobeable",
1203
+ "media_format_indeterminate",
1204
+ "media_too_large",
1205
+ "media_aspect_ratio_unsupported",
1206
+ "media_resolution_too_low",
1207
+ "media_gif_unsupported",
1208
+ "media_format_recompressed",
1209
+ "media_resolution_downscaled",
1210
+ "video_container_unsupported",
1211
+ "video_codec_unsupported",
1212
+ "video_audio_codec_unsupported",
1213
+ "video_too_large",
1214
+ "video_too_small",
1215
+ "video_dimensions_unsupported",
1216
+ "video_dimensions_too_large",
1217
+ "video_fps_unsupported",
1218
+ "video_fps_too_low",
1219
+ "video_aspect_unsupported",
1220
+ "video_duration_too_short",
1221
+ "video_duration_exceeds_max",
1222
+ "video_transform_failed",
1223
+ "media_fetch_failed",
1224
+ "document_format_unsupported",
1225
+ "document_too_large",
1226
+ "document_too_many_pages",
1227
+ "media_unsupported"
1228
+ ]),
1229
+ message: z__namespace.string(),
1230
+ hint: z__namespace.string().optional(),
1231
+ allowed: z__namespace.array(z__namespace.string()).optional(),
1232
+ got: z__namespace.string().optional()
1233
+ }).nullable(),
1234
+ source: z__namespace.object({
1235
+ format: z__namespace.string(),
1236
+ bytes: z__namespace.int().gte(0).lte(9007199254740991),
1237
+ width: z__namespace.int().gt(0).lte(9007199254740991).nullable(),
1238
+ height: z__namespace.int().gt(0).lte(9007199254740991).nullable(),
1239
+ duration_ms: z__namespace.int().gte(0).lte(9007199254740991).nullable()
1240
+ }).nullable(),
1241
+ alt_text: z__namespace.string().max(1e3).nullable(),
1242
+ per_platform: z__namespace.record(z__namespace.string(), z__namespace.object({
1243
+ status: z__namespace.enum([
1244
+ "processing",
1245
+ "ready",
1246
+ "failed"
1247
+ ]),
1248
+ url: z__namespace.string().nullable(),
1249
+ width: z__namespace.int().gt(0).lte(9007199254740991).nullable(),
1250
+ height: z__namespace.int().gt(0).lte(9007199254740991).nullable(),
1251
+ bytes: z__namespace.int().gte(0).lte(9007199254740991).nullable(),
1252
+ warnings: z__namespace.array(z__namespace.object({
1253
+ code: z__namespace.enum([
1254
+ "media_unprobeable",
1255
+ "media_format_indeterminate",
1256
+ "media_too_large",
1257
+ "media_aspect_ratio_unsupported",
1258
+ "media_resolution_too_low",
1259
+ "media_gif_unsupported",
1260
+ "media_format_recompressed",
1261
+ "media_resolution_downscaled",
1262
+ "video_container_unsupported",
1263
+ "video_codec_unsupported",
1264
+ "video_audio_codec_unsupported",
1265
+ "video_too_large",
1266
+ "video_too_small",
1267
+ "video_dimensions_unsupported",
1268
+ "video_dimensions_too_large",
1269
+ "video_fps_unsupported",
1270
+ "video_fps_too_low",
1271
+ "video_aspect_unsupported",
1272
+ "video_duration_too_short",
1273
+ "video_duration_exceeds_max",
1274
+ "video_transform_failed",
1275
+ "media_fetch_failed",
1276
+ "document_format_unsupported",
1277
+ "document_too_large",
1278
+ "document_too_many_pages",
1279
+ "media_unsupported"
1280
+ ]),
1281
+ message: z__namespace.string(),
1282
+ hint: z__namespace.string().optional(),
1283
+ allowed: z__namespace.array(z__namespace.string()).optional(),
1284
+ got: z__namespace.string().optional()
1285
+ })),
1286
+ errors: z__namespace.array(z__namespace.object({
1287
+ code: z__namespace.enum([
1288
+ "media_unprobeable",
1289
+ "media_format_indeterminate",
1290
+ "media_too_large",
1291
+ "media_aspect_ratio_unsupported",
1292
+ "media_resolution_too_low",
1293
+ "media_gif_unsupported",
1294
+ "media_format_recompressed",
1295
+ "media_resolution_downscaled",
1296
+ "video_container_unsupported",
1297
+ "video_codec_unsupported",
1298
+ "video_audio_codec_unsupported",
1299
+ "video_too_large",
1300
+ "video_too_small",
1301
+ "video_dimensions_unsupported",
1302
+ "video_dimensions_too_large",
1303
+ "video_fps_unsupported",
1304
+ "video_fps_too_low",
1305
+ "video_aspect_unsupported",
1306
+ "video_duration_too_short",
1307
+ "video_duration_exceeds_max",
1308
+ "video_transform_failed",
1309
+ "media_fetch_failed",
1310
+ "document_format_unsupported",
1311
+ "document_too_large",
1312
+ "document_too_many_pages",
1313
+ "media_unsupported"
1314
+ ]),
1315
+ message: z__namespace.string(),
1316
+ hint: z__namespace.string().optional(),
1317
+ allowed: z__namespace.array(z__namespace.string()).optional(),
1318
+ got: z__namespace.string().optional()
1319
+ }))
1320
+ })),
1321
+ external_id: z__namespace.string().nullable(),
1322
+ metadata: z__namespace.record(z__namespace.string(), z__namespace.union([
1323
+ z__namespace.string().max(500),
1324
+ z__namespace.number(),
1325
+ z__namespace.boolean()
1326
+ ])),
1327
+ created_at: z__namespace.string(),
1328
+ updated_at: z__namespace.string()
1329
+ })),
1330
+ total: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
1331
+ limit: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
1332
+ offset: z__namespace.int().gte(-9007199254740991).lte(9007199254740991),
1333
+ has_more: z__namespace.boolean()
1334
+ });
1103
1335
  z__namespace.object({
1104
1336
  profile_id: z__namespace.string(),
1105
1337
  kind: z__namespace.enum([
@@ -1107,7 +1339,7 @@ z__namespace.object({
1107
1339
  "video",
1108
1340
  "gif",
1109
1341
  "document"
1110
- ]),
1342
+ ]).optional(),
1111
1343
  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
1344
  source_url: z__namespace.url().optional(),
1113
1345
  targets: z__namespace.array(z__namespace.enum([
@@ -1136,7 +1368,8 @@ z__namespace.object({
1136
1368
  "video",
1137
1369
  "gif",
1138
1370
  "document"
1139
- ]),
1371
+ ]).nullable(),
1372
+ content_type: z__namespace.string().nullable(),
1140
1373
  status: z__namespace.enum([
1141
1374
  "uploading",
1142
1375
  "processing",
@@ -1147,6 +1380,7 @@ z__namespace.object({
1147
1380
  error: z__namespace.object({
1148
1381
  code: z__namespace.enum([
1149
1382
  "media_unprobeable",
1383
+ "media_format_indeterminate",
1150
1384
  "media_too_large",
1151
1385
  "media_aspect_ratio_unsupported",
1152
1386
  "media_resolution_too_low",
@@ -1165,6 +1399,8 @@ z__namespace.object({
1165
1399
  "video_aspect_unsupported",
1166
1400
  "video_duration_too_short",
1167
1401
  "video_duration_exceeds_max",
1402
+ "video_transform_failed",
1403
+ "media_fetch_failed",
1168
1404
  "document_format_unsupported",
1169
1405
  "document_too_large",
1170
1406
  "document_too_many_pages",
@@ -1196,6 +1432,7 @@ z__namespace.object({
1196
1432
  warnings: z__namespace.array(z__namespace.object({
1197
1433
  code: z__namespace.enum([
1198
1434
  "media_unprobeable",
1435
+ "media_format_indeterminate",
1199
1436
  "media_too_large",
1200
1437
  "media_aspect_ratio_unsupported",
1201
1438
  "media_resolution_too_low",
@@ -1214,6 +1451,8 @@ z__namespace.object({
1214
1451
  "video_aspect_unsupported",
1215
1452
  "video_duration_too_short",
1216
1453
  "video_duration_exceeds_max",
1454
+ "video_transform_failed",
1455
+ "media_fetch_failed",
1217
1456
  "document_format_unsupported",
1218
1457
  "document_too_large",
1219
1458
  "document_too_many_pages",
@@ -1227,6 +1466,7 @@ z__namespace.object({
1227
1466
  errors: z__namespace.array(z__namespace.object({
1228
1467
  code: z__namespace.enum([
1229
1468
  "media_unprobeable",
1469
+ "media_format_indeterminate",
1230
1470
  "media_too_large",
1231
1471
  "media_aspect_ratio_unsupported",
1232
1472
  "media_resolution_too_low",
@@ -1245,6 +1485,8 @@ z__namespace.object({
1245
1485
  "video_aspect_unsupported",
1246
1486
  "video_duration_too_short",
1247
1487
  "video_duration_exceeds_max",
1488
+ "video_transform_failed",
1489
+ "media_fetch_failed",
1248
1490
  "document_format_unsupported",
1249
1491
  "document_too_large",
1250
1492
  "document_too_many_pages",
@@ -1291,7 +1533,8 @@ z__namespace.object({
1291
1533
  "video",
1292
1534
  "gif",
1293
1535
  "document"
1294
- ]),
1536
+ ]).nullable(),
1537
+ content_type: z__namespace.string().nullable(),
1295
1538
  status: z__namespace.enum([
1296
1539
  "uploading",
1297
1540
  "processing",
@@ -1302,6 +1545,7 @@ z__namespace.object({
1302
1545
  error: z__namespace.object({
1303
1546
  code: z__namespace.enum([
1304
1547
  "media_unprobeable",
1548
+ "media_format_indeterminate",
1305
1549
  "media_too_large",
1306
1550
  "media_aspect_ratio_unsupported",
1307
1551
  "media_resolution_too_low",
@@ -1320,6 +1564,8 @@ z__namespace.object({
1320
1564
  "video_aspect_unsupported",
1321
1565
  "video_duration_too_short",
1322
1566
  "video_duration_exceeds_max",
1567
+ "video_transform_failed",
1568
+ "media_fetch_failed",
1323
1569
  "document_format_unsupported",
1324
1570
  "document_too_large",
1325
1571
  "document_too_many_pages",
@@ -1351,6 +1597,7 @@ z__namespace.object({
1351
1597
  warnings: z__namespace.array(z__namespace.object({
1352
1598
  code: z__namespace.enum([
1353
1599
  "media_unprobeable",
1600
+ "media_format_indeterminate",
1354
1601
  "media_too_large",
1355
1602
  "media_aspect_ratio_unsupported",
1356
1603
  "media_resolution_too_low",
@@ -1369,6 +1616,8 @@ z__namespace.object({
1369
1616
  "video_aspect_unsupported",
1370
1617
  "video_duration_too_short",
1371
1618
  "video_duration_exceeds_max",
1619
+ "video_transform_failed",
1620
+ "media_fetch_failed",
1372
1621
  "document_format_unsupported",
1373
1622
  "document_too_large",
1374
1623
  "document_too_many_pages",
@@ -1382,6 +1631,7 @@ z__namespace.object({
1382
1631
  errors: z__namespace.array(z__namespace.object({
1383
1632
  code: z__namespace.enum([
1384
1633
  "media_unprobeable",
1634
+ "media_format_indeterminate",
1385
1635
  "media_too_large",
1386
1636
  "media_aspect_ratio_unsupported",
1387
1637
  "media_resolution_too_low",
@@ -1400,6 +1650,8 @@ z__namespace.object({
1400
1650
  "video_aspect_unsupported",
1401
1651
  "video_duration_too_short",
1402
1652
  "video_duration_exceeds_max",
1653
+ "video_transform_failed",
1654
+ "media_fetch_failed",
1403
1655
  "document_format_unsupported",
1404
1656
  "document_too_large",
1405
1657
  "document_too_many_pages",
@@ -1449,7 +1701,8 @@ z__namespace.object({
1449
1701
  "video",
1450
1702
  "gif",
1451
1703
  "document"
1452
- ]),
1704
+ ]).nullable(),
1705
+ content_type: z__namespace.string().nullable(),
1453
1706
  status: z__namespace.enum([
1454
1707
  "uploading",
1455
1708
  "processing",
@@ -1460,6 +1713,7 @@ z__namespace.object({
1460
1713
  error: z__namespace.object({
1461
1714
  code: z__namespace.enum([
1462
1715
  "media_unprobeable",
1716
+ "media_format_indeterminate",
1463
1717
  "media_too_large",
1464
1718
  "media_aspect_ratio_unsupported",
1465
1719
  "media_resolution_too_low",
@@ -1478,6 +1732,8 @@ z__namespace.object({
1478
1732
  "video_aspect_unsupported",
1479
1733
  "video_duration_too_short",
1480
1734
  "video_duration_exceeds_max",
1735
+ "video_transform_failed",
1736
+ "media_fetch_failed",
1481
1737
  "document_format_unsupported",
1482
1738
  "document_too_large",
1483
1739
  "document_too_many_pages",
@@ -1509,6 +1765,7 @@ z__namespace.object({
1509
1765
  warnings: z__namespace.array(z__namespace.object({
1510
1766
  code: z__namespace.enum([
1511
1767
  "media_unprobeable",
1768
+ "media_format_indeterminate",
1512
1769
  "media_too_large",
1513
1770
  "media_aspect_ratio_unsupported",
1514
1771
  "media_resolution_too_low",
@@ -1527,6 +1784,8 @@ z__namespace.object({
1527
1784
  "video_aspect_unsupported",
1528
1785
  "video_duration_too_short",
1529
1786
  "video_duration_exceeds_max",
1787
+ "video_transform_failed",
1788
+ "media_fetch_failed",
1530
1789
  "document_format_unsupported",
1531
1790
  "document_too_large",
1532
1791
  "document_too_many_pages",
@@ -1540,6 +1799,7 @@ z__namespace.object({
1540
1799
  errors: z__namespace.array(z__namespace.object({
1541
1800
  code: z__namespace.enum([
1542
1801
  "media_unprobeable",
1802
+ "media_format_indeterminate",
1543
1803
  "media_too_large",
1544
1804
  "media_aspect_ratio_unsupported",
1545
1805
  "media_resolution_too_low",
@@ -1558,6 +1818,8 @@ z__namespace.object({
1558
1818
  "video_aspect_unsupported",
1559
1819
  "video_duration_too_short",
1560
1820
  "video_duration_exceeds_max",
1821
+ "video_transform_failed",
1822
+ "media_fetch_failed",
1561
1823
  "document_format_unsupported",
1562
1824
  "document_too_large",
1563
1825
  "document_too_many_pages",
@@ -1846,6 +2108,38 @@ z__namespace.object({
1846
2108
  settings: z__namespace.object({
1847
2109
  link: z__namespace.url().optional()
1848
2110
  }).optional().default({})
2111
+ }),
2112
+ z__namespace.object({
2113
+ platform: z__namespace.literal("tiktok"),
2114
+ post_type: z__namespace.enum([
2115
+ "video",
2116
+ "single_image",
2117
+ "carousel"
2118
+ ]),
2119
+ connection_id: z__namespace.string(),
2120
+ body: z__namespace.string().optional(),
2121
+ media: z__namespace.array(z__namespace.object({
2122
+ media_id: z__namespace.string(),
2123
+ crop_box: z__namespace.record(z__namespace.string(), z__namespace.unknown()).nullish(),
2124
+ alt_text_override: z__namespace.string().nullish()
2125
+ })).optional().default([]),
2126
+ settings: z__namespace.object({
2127
+ privacy_level: z__namespace.enum([
2128
+ "PUBLIC_TO_EVERYONE",
2129
+ "MUTUAL_FOLLOW_FRIENDS",
2130
+ "FOLLOWER_OF_CREATOR",
2131
+ "SELF_ONLY"
2132
+ ]).optional(),
2133
+ disable_comment: z__namespace.boolean().optional(),
2134
+ disable_duet: z__namespace.boolean().optional(),
2135
+ disable_stitch: z__namespace.boolean().optional(),
2136
+ video_cover_timestamp_ms: z__namespace.int().gte(0).lte(9007199254740991).optional(),
2137
+ photo_cover_index: z__namespace.int().gte(0).lte(9007199254740991).optional(),
2138
+ auto_add_music: z__namespace.boolean().optional(),
2139
+ brand_content_toggle: z__namespace.boolean().optional(),
2140
+ brand_organic_toggle: z__namespace.boolean().optional(),
2141
+ is_aigc: z__namespace.boolean().optional()
2142
+ }).optional().default({})
1849
2143
  })
1850
2144
  ])).min(1)
1851
2145
  });
@@ -2169,6 +2463,38 @@ z__namespace.object({
2169
2463
  settings: z__namespace.object({
2170
2464
  link: z__namespace.url().optional()
2171
2465
  }).optional().default({})
2466
+ }),
2467
+ z__namespace.object({
2468
+ platform: z__namespace.literal("tiktok"),
2469
+ post_type: z__namespace.enum([
2470
+ "video",
2471
+ "single_image",
2472
+ "carousel"
2473
+ ]),
2474
+ connection_id: z__namespace.string(),
2475
+ body: z__namespace.string().optional(),
2476
+ media: z__namespace.array(z__namespace.object({
2477
+ media_id: z__namespace.string(),
2478
+ crop_box: z__namespace.record(z__namespace.string(), z__namespace.unknown()).nullish(),
2479
+ alt_text_override: z__namespace.string().nullish()
2480
+ })).optional().default([]),
2481
+ settings: z__namespace.object({
2482
+ privacy_level: z__namespace.enum([
2483
+ "PUBLIC_TO_EVERYONE",
2484
+ "MUTUAL_FOLLOW_FRIENDS",
2485
+ "FOLLOWER_OF_CREATOR",
2486
+ "SELF_ONLY"
2487
+ ]).optional(),
2488
+ disable_comment: z__namespace.boolean().optional(),
2489
+ disable_duet: z__namespace.boolean().optional(),
2490
+ disable_stitch: z__namespace.boolean().optional(),
2491
+ video_cover_timestamp_ms: z__namespace.int().gte(0).lte(9007199254740991).optional(),
2492
+ photo_cover_index: z__namespace.int().gte(0).lte(9007199254740991).optional(),
2493
+ auto_add_music: z__namespace.boolean().optional(),
2494
+ brand_content_toggle: z__namespace.boolean().optional(),
2495
+ brand_organic_toggle: z__namespace.boolean().optional(),
2496
+ is_aigc: z__namespace.boolean().optional()
2497
+ }).optional().default({})
2172
2498
  })
2173
2499
  ])).min(1).optional()
2174
2500
  });
@@ -4193,6 +4519,19 @@ var connectionsConnect = (options) => (options.client ?? client).post({
4193
4519
  ...options.headers
4194
4520
  }
4195
4521
  });
4522
+ var mediaList = (options) => (options?.client ?? client).get({
4523
+ security: [{
4524
+ key: "secretKey",
4525
+ scheme: "bearer",
4526
+ type: "http"
4527
+ }, {
4528
+ key: "frontendToken",
4529
+ scheme: "bearer",
4530
+ type: "http"
4531
+ }],
4532
+ url: "/media",
4533
+ ...options
4534
+ });
4196
4535
  var mediaCreate = (options) => (options.client ?? client).post({
4197
4536
  security: [{
4198
4537
  key: "secretKey",
@@ -5300,11 +5639,39 @@ var instagramHandler = {
5300
5639
  settings
5301
5640
  })
5302
5641
  };
5642
+ var tiktokHandler = {
5643
+ derivePostType: (media) => {
5644
+ if (media.length === 0) {
5645
+ throw new ComposeError("TikTok requires at least one media item.");
5646
+ }
5647
+ rejectDocuments(media, "TikTok");
5648
+ const { images, videos } = countKinds(media);
5649
+ if (images > 0 && videos > 0) {
5650
+ throw new ComposeError(
5651
+ "TikTok can't combine images and video in one post \u2014 split them into separate posts."
5652
+ );
5653
+ }
5654
+ if (videos > 1) {
5655
+ throw new ComposeError("TikTok allows at most one video per post.");
5656
+ }
5657
+ if (videos === 1) return "video";
5658
+ return images >= 2 ? "carousel" : "single_image";
5659
+ },
5660
+ buildVariant: ({ settings, postType, connectionId, body, media }) => ({
5661
+ platform: "tiktok",
5662
+ post_type: postType,
5663
+ connection_id: connectionId,
5664
+ body,
5665
+ media: [...media],
5666
+ settings
5667
+ })
5668
+ };
5303
5669
  var PLATFORM_HANDLERS = {
5304
5670
  x: xHandler,
5305
5671
  linkedin: linkedInHandler,
5306
5672
  facebook_page: facebookHandler,
5307
- instagram: instagramHandler
5673
+ instagram: instagramHandler,
5674
+ tiktok: tiktokHandler
5308
5675
  };
5309
5676
  function isPostPlatform(value) {
5310
5677
  return Object.prototype.hasOwnProperty.call(PLATFORM_HANDLERS, value);
@@ -5330,15 +5697,22 @@ function buildChannel(handler, platform, config, content, connections) {
5330
5697
  media: media.map((item) => ({ media_id: item.id }))
5331
5698
  });
5332
5699
  }
5700
+ function collectChannel(platform, channels, content, connections) {
5701
+ const config = channels[platform];
5702
+ if (!config) return void 0;
5703
+ return buildChannel(
5704
+ PLATFORM_HANDLERS[platform],
5705
+ platform,
5706
+ config,
5707
+ content,
5708
+ connections
5709
+ );
5710
+ }
5333
5711
  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));
5712
+ const variants = POST_PLATFORMS.flatMap((platform) => {
5713
+ const variant = collectChannel(platform, channels, content, connections);
5714
+ return variant ? [variant] : [];
5715
+ });
5342
5716
  if (variants.length === 0) {
5343
5717
  throw new ComposeError("At least one channel is required.");
5344
5718
  }
@@ -5444,6 +5818,7 @@ exports.logsList = logsList;
5444
5818
  exports.mediaCreate = mediaCreate;
5445
5819
  exports.mediaDelete = mediaDelete;
5446
5820
  exports.mediaGet = mediaGet;
5821
+ exports.mediaList = mediaList;
5447
5822
  exports.mediaUpdate = mediaUpdate;
5448
5823
  exports.metaAccount = metaAccount;
5449
5824
  exports.metaAd = metaAd;