@postrun/js 2.0.0 → 2.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
@@ -813,6 +813,7 @@ var zErrorCode = z__namespace.enum([
813
813
  "connection_not_pending",
814
814
  "not_implemented",
815
815
  "connection_discovery_failed",
816
+ "tiktok_creator_info_unavailable",
816
817
  "media_processing",
817
818
  "not_publishable",
818
819
  "invalid_connection",
@@ -861,13 +862,16 @@ var zErrorCode = z__namespace.enum([
861
862
  "publishing_unavailable",
862
863
  "x_duplicate_content",
863
864
  "x_not_authorized",
865
+ "x_access_not_permitted",
864
866
  "x_rate_limited",
865
867
  "x_publish_failed",
866
868
  "x_media_upload_failed",
867
869
  "linkedin_duplicate_content",
868
870
  "linkedin_auth_expired",
869
871
  "linkedin_permission_denied",
872
+ "linkedin_rate_limited",
870
873
  "linkedin_media_processing",
874
+ "linkedin_media_failed",
871
875
  "linkedin_media_upload_failed",
872
876
  "linkedin_publish_failed",
873
877
  "instagram_media_processing",
@@ -887,6 +891,8 @@ var zErrorCode = z__namespace.enum([
887
891
  "tiktok_not_authorized",
888
892
  "tiktok_rate_limited",
889
893
  "tiktok_publish_failed",
894
+ "post_publish_failed",
895
+ "post_partially_published",
890
896
  "connection_platform_mismatch",
891
897
  "connection_removed"
892
898
  ]);
@@ -2824,6 +2830,7 @@ z__namespace.object({
2824
2830
  "connection_not_pending",
2825
2831
  "not_implemented",
2826
2832
  "connection_discovery_failed",
2833
+ "tiktok_creator_info_unavailable",
2827
2834
  "media_processing",
2828
2835
  "not_publishable",
2829
2836
  "invalid_connection",
@@ -2872,13 +2879,16 @@ z__namespace.object({
2872
2879
  "publishing_unavailable",
2873
2880
  "x_duplicate_content",
2874
2881
  "x_not_authorized",
2882
+ "x_access_not_permitted",
2875
2883
  "x_rate_limited",
2876
2884
  "x_publish_failed",
2877
2885
  "x_media_upload_failed",
2878
2886
  "linkedin_duplicate_content",
2879
2887
  "linkedin_auth_expired",
2880
2888
  "linkedin_permission_denied",
2889
+ "linkedin_rate_limited",
2881
2890
  "linkedin_media_processing",
2891
+ "linkedin_media_failed",
2882
2892
  "linkedin_media_upload_failed",
2883
2893
  "linkedin_publish_failed",
2884
2894
  "instagram_media_processing",
@@ -2898,6 +2908,8 @@ z__namespace.object({
2898
2908
  "tiktok_not_authorized",
2899
2909
  "tiktok_rate_limited",
2900
2910
  "tiktok_publish_failed",
2911
+ "post_publish_failed",
2912
+ "post_partially_published",
2901
2913
  "connection_platform_mismatch",
2902
2914
  "connection_removed"
2903
2915
  ]),
@@ -4368,6 +4380,28 @@ z__namespace.object({
4368
4380
  dry_run: z__namespace.boolean(),
4369
4381
  executed: z__namespace.boolean()
4370
4382
  });
4383
+ z__namespace.object({
4384
+ id: z__namespace.string()
4385
+ });
4386
+ z__namespace.object({
4387
+ creator: z__namespace.object({
4388
+ nickname: z__namespace.string(),
4389
+ username: z__namespace.string(),
4390
+ avatar_url: z__namespace.string().nullable()
4391
+ }),
4392
+ privacy_options: z__namespace.array(z__namespace.enum([
4393
+ "PUBLIC_TO_EVERYONE",
4394
+ "MUTUAL_FOLLOW_FRIENDS",
4395
+ "FOLLOWER_OF_CREATOR",
4396
+ "SELF_ONLY"
4397
+ ])),
4398
+ interaction: z__namespace.object({
4399
+ comment: z__namespace.boolean(),
4400
+ duet: z__namespace.boolean(),
4401
+ stitch: z__namespace.boolean()
4402
+ }),
4403
+ max_video_duration_sec: z__namespace.int().gte(-9007199254740991).lte(9007199254740991)
4404
+ });
4371
4405
  z__namespace.object({
4372
4406
  limit: z__namespace.int().gte(1).lte(100).optional().default(20),
4373
4407
  offset: z__namespace.int().gte(0).lte(9007199254740991).optional().default(0),
@@ -4430,6 +4464,41 @@ z__namespace.object({
4430
4464
  request_body: z__namespace.unknown().nullish(),
4431
4465
  response_body: z__namespace.unknown().nullish(),
4432
4466
  error: z__namespace.unknown().nullish(),
4467
+ outcome: z__namespace.object({
4468
+ status: z__namespace.enum([
4469
+ "draft",
4470
+ "scheduled",
4471
+ "publishing",
4472
+ "partially_published",
4473
+ "published",
4474
+ "failed"
4475
+ ]),
4476
+ targets: z__namespace.array(z__namespace.object({
4477
+ variant_id: z__namespace.string(),
4478
+ connection_id: z__namespace.string().nullable(),
4479
+ platform: z__namespace.enum([
4480
+ "x",
4481
+ "linkedin",
4482
+ "facebook_page",
4483
+ "instagram",
4484
+ "tiktok"
4485
+ ]),
4486
+ status: z__namespace.enum([
4487
+ "draft",
4488
+ "scheduled",
4489
+ "publishing",
4490
+ "published",
4491
+ "failed"
4492
+ ]),
4493
+ platform_post_id: z__namespace.string().nullable(),
4494
+ permalink: z__namespace.string().nullable(),
4495
+ published_at: z__namespace.string().nullable(),
4496
+ error: z__namespace.object({
4497
+ code: z__namespace.string(),
4498
+ message: z__namespace.string()
4499
+ }).nullable()
4500
+ }))
4501
+ }).nullable(),
4433
4502
  external_id: z__namespace.string().nullable(),
4434
4503
  idempotency_key: z__namespace.string().nullable(),
4435
4504
  request_id: z__namespace.string().nullable(),
@@ -4478,6 +4547,41 @@ z__namespace.object({
4478
4547
  request_body: z__namespace.unknown().nullish(),
4479
4548
  response_body: z__namespace.unknown().nullish(),
4480
4549
  error: z__namespace.unknown().nullish(),
4550
+ outcome: z__namespace.object({
4551
+ status: z__namespace.enum([
4552
+ "draft",
4553
+ "scheduled",
4554
+ "publishing",
4555
+ "partially_published",
4556
+ "published",
4557
+ "failed"
4558
+ ]),
4559
+ targets: z__namespace.array(z__namespace.object({
4560
+ variant_id: z__namespace.string(),
4561
+ connection_id: z__namespace.string().nullable(),
4562
+ platform: z__namespace.enum([
4563
+ "x",
4564
+ "linkedin",
4565
+ "facebook_page",
4566
+ "instagram",
4567
+ "tiktok"
4568
+ ]),
4569
+ status: z__namespace.enum([
4570
+ "draft",
4571
+ "scheduled",
4572
+ "publishing",
4573
+ "published",
4574
+ "failed"
4575
+ ]),
4576
+ platform_post_id: z__namespace.string().nullable(),
4577
+ permalink: z__namespace.string().nullable(),
4578
+ published_at: z__namespace.string().nullable(),
4579
+ error: z__namespace.object({
4580
+ code: z__namespace.string(),
4581
+ message: z__namespace.string()
4582
+ }).nullable()
4583
+ }))
4584
+ }).nullable(),
4481
4585
  external_id: z__namespace.string().nullable(),
4482
4586
  idempotency_key: z__namespace.string().nullable(),
4483
4587
  request_id: z__namespace.string().nullable(),
@@ -5773,6 +5877,19 @@ var googleUploadImageAsset = (options) => (options.client ?? client).post({
5773
5877
  ...options.headers
5774
5878
  }
5775
5879
  });
5880
+ var tiktokCreatorInfo = (options) => (options.client ?? client).get({
5881
+ security: [{
5882
+ key: "secretKey",
5883
+ scheme: "bearer",
5884
+ type: "http"
5885
+ }, {
5886
+ key: "frontendToken",
5887
+ scheme: "bearer",
5888
+ type: "http"
5889
+ }],
5890
+ url: "/connections/{id}/tiktok/creator-info",
5891
+ ...options
5892
+ });
5776
5893
  var logsList = (options) => (options?.client ?? client).get({
5777
5894
  security: [{
5778
5895
  key: "secretKey",
@@ -5889,6 +6006,24 @@ var tokensMint = (options) => (options.client ?? client).post({
5889
6006
  }
5890
6007
  });
5891
6008
 
6009
+ // src/resources.ts
6010
+ var isPublished = (post) => post.status === "published";
6011
+ var failedVariants = (post) => post.variants.filter((variant) => variant.status === "failed");
6012
+
6013
+ // src/tiktok.ts
6014
+ function tiktokPrivacyLabel(value) {
6015
+ switch (value) {
6016
+ case "PUBLIC_TO_EVERYONE":
6017
+ return "Everyone";
6018
+ case "MUTUAL_FOLLOW_FRIENDS":
6019
+ return "Friends";
6020
+ case "FOLLOWER_OF_CREATOR":
6021
+ return "Followers";
6022
+ case "SELF_ONLY":
6023
+ return "Only you";
6024
+ }
6025
+ }
6026
+
5892
6027
  // src/compose.ts
5893
6028
  var ComposeError = class extends Error {
5894
6029
  constructor(message) {
@@ -6090,6 +6225,7 @@ exports.connectionsListAccounts = connectionsListAccounts;
6090
6225
  exports.connectionsListByProfile = connectionsListByProfile;
6091
6226
  exports.connectionsSelect = connectionsSelect;
6092
6227
  exports.createPostrunClient = createPostrunClient;
6228
+ exports.failedVariants = failedVariants;
6093
6229
  exports.googleCreateAd = googleCreateAd;
6094
6230
  exports.googleCreateAdGroup = googleCreateAdGroup;
6095
6231
  exports.googleCreateBudget = googleCreateBudget;
@@ -6133,6 +6269,7 @@ exports.googleSetKeywordBid = googleSetKeywordBid;
6133
6269
  exports.googleUploadConversions = googleUploadConversions;
6134
6270
  exports.googleUploadImageAsset = googleUploadImageAsset;
6135
6271
  exports.isPostPlatform = isPostPlatform;
6272
+ exports.isPublished = isPublished;
6136
6273
  exports.logsGet = logsGet;
6137
6274
  exports.logsList = logsList;
6138
6275
  exports.mediaCreate = mediaCreate;
@@ -6159,6 +6296,8 @@ exports.profilesDelete = profilesDelete;
6159
6296
  exports.profilesGet = profilesGet;
6160
6297
  exports.profilesList = profilesList;
6161
6298
  exports.profilesUpdate = profilesUpdate;
6299
+ exports.tiktokCreatorInfo = tiktokCreatorInfo;
6300
+ exports.tiktokPrivacyLabel = tiktokPrivacyLabel;
6162
6301
  exports.tokensMint = tokensMint;
6163
6302
  exports.webhooksCreateEndpoint = webhooksCreateEndpoint;
6164
6303
  exports.webhooksCreatePortal = webhooksCreatePortal;