@postrun/js 2.16.0 → 2.18.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
@@ -1,8 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  var z = require('zod');
4
- var axios = require('axios');
5
- var pRetry = require('p-retry');
4
+ var Uppy = require('@uppy/core');
5
+ var AwsS3 = require('@uppy/aws-s3');
6
6
 
7
7
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
8
 
@@ -25,8 +25,8 @@ function _interopNamespace(e) {
25
25
  }
26
26
 
27
27
  var z__namespace = /*#__PURE__*/_interopNamespace(z);
28
- var axios__default = /*#__PURE__*/_interopDefault(axios);
29
- var pRetry__default = /*#__PURE__*/_interopDefault(pRetry);
28
+ var Uppy__default = /*#__PURE__*/_interopDefault(Uppy);
29
+ var AwsS3__default = /*#__PURE__*/_interopDefault(AwsS3);
30
30
 
31
31
  // src/client/core/bodySerializer.gen.ts
32
32
  var jsonBodySerializer = {
@@ -821,6 +821,8 @@ var zErrorCode = z__namespace.enum([
821
821
  "connection_discovery_failed",
822
822
  "tiktok_creator_info_unavailable",
823
823
  "media_processing",
824
+ "media_upload_init_failed",
825
+ "media_upload_incomplete",
824
826
  "not_publishable",
825
827
  "invalid_connection",
826
828
  "invalid_media",
@@ -885,11 +887,16 @@ var zErrorCode = z__namespace.enum([
885
887
  "instagram_container_expired",
886
888
  "instagram_container_failed",
887
889
  "instagram_rate_limited",
890
+ "instagram_daily_limit_reached",
891
+ "instagram_aspect_ratio_unsupported",
892
+ "instagram_media_unsupported",
888
893
  "instagram_not_authorized",
889
894
  "instagram_publish_failed",
890
895
  "facebook_reel_processing",
891
896
  "facebook_reel_failed",
892
897
  "facebook_rate_limited",
898
+ "facebook_duplicate_content",
899
+ "facebook_temporarily_blocked",
893
900
  "facebook_not_authorized",
894
901
  "facebook_publish_failed",
895
902
  "tiktok_privacy_not_allowed",
@@ -900,7 +907,18 @@ var zErrorCode = z__namespace.enum([
900
907
  "tiktok_url_ownership_unverified",
901
908
  "tiktok_unaudited_private_only",
902
909
  "tiktok_spam_risk",
910
+ "tiktok_file_format_invalid",
911
+ "tiktok_duration_invalid",
912
+ "tiktok_frame_rate_invalid",
913
+ "tiktok_resolution_invalid",
914
+ "tiktok_media_pull_failed",
915
+ "tiktok_server_error",
903
916
  "tiktok_publish_failed",
917
+ "google_rate_limited",
918
+ "google_server_error",
919
+ "google_auth_expired",
920
+ "google_permission_denied",
921
+ "google_request_failed",
904
922
  "post_publish_failed",
905
923
  "post_partially_published",
906
924
  "connection_platform_mismatch",
@@ -1974,9 +1992,9 @@ z__namespace.object({
1974
1992
  created_at: z__namespace.string(),
1975
1993
  updated_at: z__namespace.string(),
1976
1994
  upload: z__namespace.object({
1977
- url: z__namespace.url(),
1978
- method: z__namespace.literal("PUT"),
1979
- headers: z__namespace.record(z__namespace.string(), z__namespace.string()),
1995
+ upload_id: z__namespace.string(),
1996
+ key: z__namespace.string(),
1997
+ part_size: z__namespace.int().gt(0).lte(9007199254740991),
1980
1998
  expires_at: z__namespace.string()
1981
1999
  }).nullable()
1982
2000
  });
@@ -2011,6 +2029,37 @@ z__namespace.object({
2011
2029
  z__namespace.object({
2012
2030
  id: z__namespace.string()
2013
2031
  });
2032
+ z__namespace.object({
2033
+ part_number: z__namespace.int().gte(1).lte(1e4)
2034
+ });
2035
+ z__namespace.object({
2036
+ id: z__namespace.string()
2037
+ });
2038
+ z__namespace.object({
2039
+ url: z__namespace.url()
2040
+ });
2041
+ z__namespace.object({
2042
+ id: z__namespace.string()
2043
+ });
2044
+ z__namespace.object({
2045
+ parts: z__namespace.array(z__namespace.object({
2046
+ part_number: z__namespace.int().gte(1).lte(9007199254740991),
2047
+ etag: z__namespace.string(),
2048
+ size: z__namespace.int().gte(0).lte(9007199254740991)
2049
+ }))
2050
+ });
2051
+ z__namespace.object({
2052
+ parts: z__namespace.array(z__namespace.object({
2053
+ part_number: z__namespace.int().gte(1).lte(1e4),
2054
+ etag: z__namespace.string().min(1)
2055
+ })).min(1)
2056
+ });
2057
+ z__namespace.object({
2058
+ id: z__namespace.string()
2059
+ });
2060
+ z__namespace.object({
2061
+ id: z__namespace.string()
2062
+ });
2014
2063
  z__namespace.object({
2015
2064
  limit: z__namespace.int().gte(1).lte(100).optional().default(20),
2016
2065
  offset: z__namespace.int().gte(0).lte(9007199254740991).optional().default(0),
@@ -2146,6 +2195,8 @@ z__namespace.object({
2146
2195
  "connection_discovery_failed",
2147
2196
  "tiktok_creator_info_unavailable",
2148
2197
  "media_processing",
2198
+ "media_upload_init_failed",
2199
+ "media_upload_incomplete",
2149
2200
  "not_publishable",
2150
2201
  "invalid_connection",
2151
2202
  "invalid_media",
@@ -2210,11 +2261,16 @@ z__namespace.object({
2210
2261
  "instagram_container_expired",
2211
2262
  "instagram_container_failed",
2212
2263
  "instagram_rate_limited",
2264
+ "instagram_daily_limit_reached",
2265
+ "instagram_aspect_ratio_unsupported",
2266
+ "instagram_media_unsupported",
2213
2267
  "instagram_not_authorized",
2214
2268
  "instagram_publish_failed",
2215
2269
  "facebook_reel_processing",
2216
2270
  "facebook_reel_failed",
2217
2271
  "facebook_rate_limited",
2272
+ "facebook_duplicate_content",
2273
+ "facebook_temporarily_blocked",
2218
2274
  "facebook_not_authorized",
2219
2275
  "facebook_publish_failed",
2220
2276
  "tiktok_privacy_not_allowed",
@@ -2225,7 +2281,18 @@ z__namespace.object({
2225
2281
  "tiktok_url_ownership_unverified",
2226
2282
  "tiktok_unaudited_private_only",
2227
2283
  "tiktok_spam_risk",
2284
+ "tiktok_file_format_invalid",
2285
+ "tiktok_duration_invalid",
2286
+ "tiktok_frame_rate_invalid",
2287
+ "tiktok_resolution_invalid",
2288
+ "tiktok_media_pull_failed",
2289
+ "tiktok_server_error",
2228
2290
  "tiktok_publish_failed",
2291
+ "google_rate_limited",
2292
+ "google_server_error",
2293
+ "google_auth_expired",
2294
+ "google_permission_denied",
2295
+ "google_request_failed",
2229
2296
  "post_publish_failed",
2230
2297
  "post_partially_published",
2231
2298
  "connection_platform_mismatch",
@@ -2475,8 +2542,8 @@ z__namespace.object({
2475
2542
  "conversions"
2476
2543
  ]),
2477
2544
  segments: z__namespace.array(z__namespace.enum(["date", "device"])).optional(),
2478
- since: z__namespace.string().regex(/^\d{4}-\d{2}-\d{2}$/),
2479
- until: z__namespace.string().regex(/^\d{4}-\d{2}-\d{2}$/)
2545
+ since: z__namespace.iso.date(),
2546
+ until: z__namespace.iso.date()
2480
2547
  });
2481
2548
  z__namespace.object({
2482
2549
  connection_id: z__namespace.string()
@@ -2601,7 +2668,9 @@ z__namespace.object({
2601
2668
  "TARGET_OUTRANK_SHARE",
2602
2669
  "TARGET_ROAS",
2603
2670
  "TARGET_SPEND"
2604
- ])
2671
+ ]),
2672
+ start_date_time: z__namespace.string().nullable(),
2673
+ end_date_time: z__namespace.string().nullable()
2605
2674
  }))
2606
2675
  });
2607
2676
  z__namespace.object({
@@ -2692,7 +2761,9 @@ z__namespace.object({
2692
2761
  "TARGET_OUTRANK_SHARE",
2693
2762
  "TARGET_ROAS",
2694
2763
  "TARGET_SPEND"
2695
- ])
2764
+ ]),
2765
+ start_date_time: z__namespace.string().nullable(),
2766
+ end_date_time: z__namespace.string().nullable()
2696
2767
  });
2697
2768
  z__namespace.object({
2698
2769
  name: z__namespace.string().min(1).max(255),
@@ -2737,6 +2808,164 @@ z__namespace.object({
2737
2808
  z__namespace.object({
2738
2809
  connection_id: z__namespace.string()
2739
2810
  });
2811
+ z__namespace.object({
2812
+ q: z__namespace.string().min(1),
2813
+ country_code: z__namespace.string().length(2).optional()
2814
+ });
2815
+ z__namespace.object({
2816
+ object: z__namespace.literal("list"),
2817
+ data: z__namespace.array(z__namespace.object({
2818
+ id: z__namespace.string(),
2819
+ resource_name: z__namespace.string().nullable(),
2820
+ name: z__namespace.string().nullable(),
2821
+ canonical_name: z__namespace.string().nullable(),
2822
+ country_code: z__namespace.string().nullable(),
2823
+ target_type: z__namespace.string().nullable(),
2824
+ status: z__namespace.enum([
2825
+ "UNSPECIFIED",
2826
+ "UNKNOWN",
2827
+ "ENABLED",
2828
+ "REMOVAL_PLANNED"
2829
+ ])
2830
+ }))
2831
+ });
2832
+ z__namespace.object({
2833
+ connection_id: z__namespace.string(),
2834
+ campaign_id: z__namespace.string().regex(/^\d+$/)
2835
+ });
2836
+ z__namespace.object({
2837
+ object: z__namespace.literal("list"),
2838
+ data: z__namespace.array(z__namespace.union([
2839
+ z__namespace.object({
2840
+ type: z__namespace.literal("LOCATION"),
2841
+ criterion_id: z__namespace.string(),
2842
+ status: z__namespace.enum([
2843
+ "UNSPECIFIED",
2844
+ "UNKNOWN",
2845
+ "ENABLED",
2846
+ "PAUSED",
2847
+ "REMOVED"
2848
+ ]),
2849
+ negative: z__namespace.boolean(),
2850
+ geo_target_constant: z__namespace.string().nullable()
2851
+ }),
2852
+ z__namespace.object({
2853
+ type: z__namespace.literal("LANGUAGE"),
2854
+ criterion_id: z__namespace.string(),
2855
+ status: z__namespace.enum([
2856
+ "UNSPECIFIED",
2857
+ "UNKNOWN",
2858
+ "ENABLED",
2859
+ "PAUSED",
2860
+ "REMOVED"
2861
+ ]),
2862
+ negative: z__namespace.boolean(),
2863
+ language_constant: z__namespace.string().nullable()
2864
+ }),
2865
+ z__namespace.object({
2866
+ type: z__namespace.enum([
2867
+ "UNSPECIFIED",
2868
+ "UNKNOWN",
2869
+ "KEYWORD",
2870
+ "PLACEMENT",
2871
+ "MOBILE_APP_CATEGORY",
2872
+ "MOBILE_APPLICATION",
2873
+ "DEVICE",
2874
+ "LISTING_GROUP",
2875
+ "AD_SCHEDULE",
2876
+ "AGE_RANGE",
2877
+ "GENDER",
2878
+ "INCOME_RANGE",
2879
+ "PARENTAL_STATUS",
2880
+ "YOUTUBE_VIDEO",
2881
+ "YOUTUBE_CHANNEL",
2882
+ "USER_LIST",
2883
+ "PROXIMITY",
2884
+ "TOPIC",
2885
+ "LISTING_SCOPE",
2886
+ "IP_BLOCK",
2887
+ "CONTENT_LABEL",
2888
+ "CARRIER",
2889
+ "USER_INTEREST",
2890
+ "WEBPAGE",
2891
+ "OPERATING_SYSTEM_VERSION",
2892
+ "APP_PAYMENT_MODEL",
2893
+ "MOBILE_DEVICE",
2894
+ "CUSTOM_AFFINITY",
2895
+ "CUSTOM_INTENT",
2896
+ "LOCATION_GROUP",
2897
+ "CUSTOM_AUDIENCE",
2898
+ "COMBINED_AUDIENCE",
2899
+ "KEYWORD_THEME",
2900
+ "AUDIENCE",
2901
+ "NEGATIVE_KEYWORD_LIST",
2902
+ "LOCAL_SERVICE_ID",
2903
+ "SEARCH_THEME",
2904
+ "BRAND",
2905
+ "BRAND_LIST",
2906
+ "LIFE_EVENT",
2907
+ "WEBPAGE_LIST",
2908
+ "VIDEO_LINEUP",
2909
+ "PLACEMENT_LIST",
2910
+ "VERTICAL_ADS_ITEM_GROUP_RULE_LIST",
2911
+ "VERTICAL_ADS_ITEM_GROUP_RULE"
2912
+ ]),
2913
+ criterion_id: z__namespace.string()
2914
+ })
2915
+ ]))
2916
+ });
2917
+ z__namespace.object({
2918
+ dry_run: z__namespace.boolean().optional().default(false),
2919
+ type: z__namespace.union([
2920
+ z__namespace.literal("location"),
2921
+ z__namespace.literal("language")
2922
+ ]),
2923
+ geo_target_constant: z__namespace.string().regex(/^geoTargetConstants\/\d+$/).optional(),
2924
+ negative: z__namespace.boolean().optional().default(false),
2925
+ language_constant: z__namespace.string().min(1).optional()
2926
+ });
2927
+ z__namespace.object({
2928
+ connection_id: z__namespace.string(),
2929
+ campaign_id: z__namespace.string().regex(/^\d+$/)
2930
+ });
2931
+ z__namespace.object({
2932
+ id: z__namespace.string().nullable(),
2933
+ resource_name: z__namespace.string().nullable(),
2934
+ dry_run: z__namespace.boolean(),
2935
+ executed: z__namespace.boolean()
2936
+ });
2937
+ z__namespace.object({
2938
+ dry_run: z__namespace.boolean().optional().default(false)
2939
+ });
2940
+ z__namespace.object({
2941
+ connection_id: z__namespace.string(),
2942
+ campaign_id: z__namespace.string().regex(/^\d+$/),
2943
+ criterion_id: z__namespace.string().regex(/^\d+$/)
2944
+ });
2945
+ z__namespace.object({
2946
+ id: z__namespace.string(),
2947
+ removed: z__namespace.boolean(),
2948
+ dry_run: z__namespace.boolean(),
2949
+ executed: z__namespace.boolean()
2950
+ });
2951
+ z__namespace.object({
2952
+ dry_run: z__namespace.boolean().optional().default(false),
2953
+ positive_geo_target_type: z__namespace.enum(["PRESENCE_OR_INTEREST", "PRESENCE"]).optional(),
2954
+ negative_geo_target_type: z__namespace.enum(["PRESENCE_OR_INTEREST", "PRESENCE"]).optional()
2955
+ });
2956
+ z__namespace.object({
2957
+ connection_id: z__namespace.string(),
2958
+ campaign_id: z__namespace.string().regex(/^\d+$/)
2959
+ });
2960
+ z__namespace.object({
2961
+ id: z__namespace.string(),
2962
+ resource_name: z__namespace.string(),
2963
+ dry_run: z__namespace.boolean(),
2964
+ executed: z__namespace.boolean()
2965
+ });
2966
+ z__namespace.object({
2967
+ connection_id: z__namespace.string()
2968
+ });
2740
2969
  z__namespace.object({
2741
2970
  object: z__namespace.literal("list"),
2742
2971
  data: z__namespace.array(z__namespace.object({
@@ -2896,6 +3125,323 @@ z__namespace.object({
2896
3125
  dry_run: z__namespace.boolean(),
2897
3126
  executed: z__namespace.boolean()
2898
3127
  });
3128
+ z__namespace.object({
3129
+ connection_id: z__namespace.string(),
3130
+ ad_group_id: z__namespace.string().regex(/^\d+$/)
3131
+ });
3132
+ z__namespace.object({
3133
+ object: z__namespace.literal("list"),
3134
+ data: z__namespace.array(z__namespace.union([
3135
+ z__namespace.object({
3136
+ type: z__namespace.literal("AGE_RANGE"),
3137
+ criterion_id: z__namespace.string(),
3138
+ status: z__namespace.enum([
3139
+ "UNSPECIFIED",
3140
+ "UNKNOWN",
3141
+ "ENABLED",
3142
+ "PAUSED",
3143
+ "REMOVED"
3144
+ ]),
3145
+ negative: z__namespace.boolean(),
3146
+ age_range: z__namespace.enum([
3147
+ "UNSPECIFIED",
3148
+ "UNKNOWN",
3149
+ "AGE_RANGE_18_24",
3150
+ "AGE_RANGE_25_34",
3151
+ "AGE_RANGE_35_44",
3152
+ "AGE_RANGE_45_54",
3153
+ "AGE_RANGE_55_64",
3154
+ "AGE_RANGE_65_UP",
3155
+ "AGE_RANGE_UNDETERMINED"
3156
+ ])
3157
+ }),
3158
+ z__namespace.object({
3159
+ type: z__namespace.literal("GENDER"),
3160
+ criterion_id: z__namespace.string(),
3161
+ status: z__namespace.enum([
3162
+ "UNSPECIFIED",
3163
+ "UNKNOWN",
3164
+ "ENABLED",
3165
+ "PAUSED",
3166
+ "REMOVED"
3167
+ ]),
3168
+ negative: z__namespace.boolean(),
3169
+ gender: z__namespace.enum([
3170
+ "UNSPECIFIED",
3171
+ "UNKNOWN",
3172
+ "MALE",
3173
+ "FEMALE",
3174
+ "UNDETERMINED"
3175
+ ])
3176
+ }),
3177
+ z__namespace.object({
3178
+ type: z__namespace.literal("INCOME_RANGE"),
3179
+ criterion_id: z__namespace.string(),
3180
+ status: z__namespace.enum([
3181
+ "UNSPECIFIED",
3182
+ "UNKNOWN",
3183
+ "ENABLED",
3184
+ "PAUSED",
3185
+ "REMOVED"
3186
+ ]),
3187
+ negative: z__namespace.boolean(),
3188
+ income_range: z__namespace.enum([
3189
+ "UNSPECIFIED",
3190
+ "UNKNOWN",
3191
+ "INCOME_RANGE_0_50",
3192
+ "INCOME_RANGE_50_60",
3193
+ "INCOME_RANGE_60_70",
3194
+ "INCOME_RANGE_70_80",
3195
+ "INCOME_RANGE_80_90",
3196
+ "INCOME_RANGE_90_UP",
3197
+ "INCOME_RANGE_UNDETERMINED"
3198
+ ])
3199
+ }),
3200
+ z__namespace.object({
3201
+ type: z__namespace.literal("PARENTAL_STATUS"),
3202
+ criterion_id: z__namespace.string(),
3203
+ status: z__namespace.enum([
3204
+ "UNSPECIFIED",
3205
+ "UNKNOWN",
3206
+ "ENABLED",
3207
+ "PAUSED",
3208
+ "REMOVED"
3209
+ ]),
3210
+ negative: z__namespace.boolean(),
3211
+ parental_status: z__namespace.enum([
3212
+ "UNSPECIFIED",
3213
+ "UNKNOWN",
3214
+ "PARENT",
3215
+ "NOT_A_PARENT",
3216
+ "UNDETERMINED"
3217
+ ])
3218
+ }),
3219
+ z__namespace.object({
3220
+ type: z__namespace.literal("USER_LIST"),
3221
+ criterion_id: z__namespace.string(),
3222
+ status: z__namespace.enum([
3223
+ "UNSPECIFIED",
3224
+ "UNKNOWN",
3225
+ "ENABLED",
3226
+ "PAUSED",
3227
+ "REMOVED"
3228
+ ]),
3229
+ negative: z__namespace.boolean(),
3230
+ user_list: z__namespace.string().nullable()
3231
+ }),
3232
+ z__namespace.object({
3233
+ type: z__namespace.literal("AUDIENCE"),
3234
+ criterion_id: z__namespace.string(),
3235
+ status: z__namespace.enum([
3236
+ "UNSPECIFIED",
3237
+ "UNKNOWN",
3238
+ "ENABLED",
3239
+ "PAUSED",
3240
+ "REMOVED"
3241
+ ]),
3242
+ negative: z__namespace.boolean(),
3243
+ audience: z__namespace.string().nullable()
3244
+ }),
3245
+ z__namespace.object({
3246
+ type: z__namespace.literal("CUSTOM_AUDIENCE"),
3247
+ criterion_id: z__namespace.string(),
3248
+ status: z__namespace.enum([
3249
+ "UNSPECIFIED",
3250
+ "UNKNOWN",
3251
+ "ENABLED",
3252
+ "PAUSED",
3253
+ "REMOVED"
3254
+ ]),
3255
+ negative: z__namespace.boolean(),
3256
+ custom_audience: z__namespace.string().nullable()
3257
+ }),
3258
+ z__namespace.object({
3259
+ type: z__namespace.enum([
3260
+ "UNSPECIFIED",
3261
+ "UNKNOWN",
3262
+ "KEYWORD",
3263
+ "PLACEMENT",
3264
+ "MOBILE_APP_CATEGORY",
3265
+ "MOBILE_APPLICATION",
3266
+ "DEVICE",
3267
+ "LOCATION",
3268
+ "LISTING_GROUP",
3269
+ "AD_SCHEDULE",
3270
+ "YOUTUBE_VIDEO",
3271
+ "YOUTUBE_CHANNEL",
3272
+ "PROXIMITY",
3273
+ "TOPIC",
3274
+ "LISTING_SCOPE",
3275
+ "LANGUAGE",
3276
+ "IP_BLOCK",
3277
+ "CONTENT_LABEL",
3278
+ "CARRIER",
3279
+ "USER_INTEREST",
3280
+ "WEBPAGE",
3281
+ "OPERATING_SYSTEM_VERSION",
3282
+ "APP_PAYMENT_MODEL",
3283
+ "MOBILE_DEVICE",
3284
+ "CUSTOM_AFFINITY",
3285
+ "CUSTOM_INTENT",
3286
+ "LOCATION_GROUP",
3287
+ "COMBINED_AUDIENCE",
3288
+ "KEYWORD_THEME",
3289
+ "NEGATIVE_KEYWORD_LIST",
3290
+ "LOCAL_SERVICE_ID",
3291
+ "SEARCH_THEME",
3292
+ "BRAND",
3293
+ "BRAND_LIST",
3294
+ "LIFE_EVENT",
3295
+ "WEBPAGE_LIST",
3296
+ "VIDEO_LINEUP",
3297
+ "PLACEMENT_LIST",
3298
+ "VERTICAL_ADS_ITEM_GROUP_RULE_LIST",
3299
+ "VERTICAL_ADS_ITEM_GROUP_RULE"
3300
+ ]),
3301
+ criterion_id: z__namespace.string()
3302
+ })
3303
+ ]))
3304
+ });
3305
+ z__namespace.object({
3306
+ dry_run: z__namespace.boolean().optional().default(false),
3307
+ type: z__namespace.union([
3308
+ z__namespace.literal("age_range"),
3309
+ z__namespace.literal("gender"),
3310
+ z__namespace.literal("income_range"),
3311
+ z__namespace.literal("parental_status"),
3312
+ z__namespace.literal("user_list"),
3313
+ z__namespace.literal("audience"),
3314
+ z__namespace.literal("custom_audience")
3315
+ ]),
3316
+ age_range: z__namespace.enum([
3317
+ "AGE_RANGE_18_24",
3318
+ "AGE_RANGE_25_34",
3319
+ "AGE_RANGE_35_44",
3320
+ "AGE_RANGE_45_54",
3321
+ "AGE_RANGE_55_64",
3322
+ "AGE_RANGE_65_UP",
3323
+ "AGE_RANGE_UNDETERMINED"
3324
+ ]).optional(),
3325
+ negative: z__namespace.boolean().optional().default(false),
3326
+ gender: z__namespace.enum([
3327
+ "MALE",
3328
+ "FEMALE",
3329
+ "UNDETERMINED"
3330
+ ]).optional(),
3331
+ income_range: z__namespace.enum([
3332
+ "INCOME_RANGE_0_50",
3333
+ "INCOME_RANGE_50_60",
3334
+ "INCOME_RANGE_60_70",
3335
+ "INCOME_RANGE_70_80",
3336
+ "INCOME_RANGE_80_90",
3337
+ "INCOME_RANGE_90_UP",
3338
+ "INCOME_RANGE_UNDETERMINED"
3339
+ ]).optional(),
3340
+ parental_status: z__namespace.enum([
3341
+ "PARENT",
3342
+ "NOT_A_PARENT",
3343
+ "UNDETERMINED"
3344
+ ]).optional(),
3345
+ user_list: z__namespace.string().regex(/^customers\/\d+\/userLists\/\d+$/).optional(),
3346
+ audience: z__namespace.string().regex(/^customers\/\d+\/audiences\/\d+$/).optional(),
3347
+ custom_audience: z__namespace.string().regex(/^customers\/\d+\/customAudiences\/\d+$/).optional()
3348
+ });
3349
+ z__namespace.object({
3350
+ connection_id: z__namespace.string(),
3351
+ ad_group_id: z__namespace.string().regex(/^\d+$/)
3352
+ });
3353
+ z__namespace.object({
3354
+ id: z__namespace.string().nullable(),
3355
+ resource_name: z__namespace.string().nullable(),
3356
+ dry_run: z__namespace.boolean(),
3357
+ executed: z__namespace.boolean()
3358
+ });
3359
+ z__namespace.object({
3360
+ dry_run: z__namespace.boolean().optional().default(false)
3361
+ });
3362
+ z__namespace.object({
3363
+ connection_id: z__namespace.string(),
3364
+ ad_group_id: z__namespace.string().regex(/^\d+$/),
3365
+ criterion_id: z__namespace.string().regex(/^\d+$/)
3366
+ });
3367
+ z__namespace.object({
3368
+ id: z__namespace.string(),
3369
+ removed: z__namespace.boolean(),
3370
+ dry_run: z__namespace.boolean(),
3371
+ executed: z__namespace.boolean()
3372
+ });
3373
+ z__namespace.object({
3374
+ connection_id: z__namespace.string()
3375
+ });
3376
+ z__namespace.object({
3377
+ q: z__namespace.string().min(1).optional(),
3378
+ kind: z__namespace.enum([
3379
+ "user_list",
3380
+ "audience",
3381
+ "custom_audience"
3382
+ ]).optional()
3383
+ });
3384
+ z__namespace.object({
3385
+ object: z__namespace.literal("list"),
3386
+ data: z__namespace.array(z__namespace.union([z__namespace.object({
3387
+ kind: z__namespace.literal("user_list"),
3388
+ id: z__namespace.string(),
3389
+ resource_name: z__namespace.string(),
3390
+ name: z__namespace.string().nullable(),
3391
+ type: z__namespace.enum([
3392
+ "UNSPECIFIED",
3393
+ "UNKNOWN",
3394
+ "REMARKETING",
3395
+ "LOGICAL",
3396
+ "EXTERNAL_REMARKETING",
3397
+ "RULE_BASED",
3398
+ "SIMILAR",
3399
+ "CRM_BASED",
3400
+ "LOOKALIKE"
3401
+ ]),
3402
+ membership_status: z__namespace.enum([
3403
+ "UNSPECIFIED",
3404
+ "UNKNOWN",
3405
+ "OPEN",
3406
+ "CLOSED"
3407
+ ])
3408
+ }), z__namespace.object({
3409
+ kind: z__namespace.literal("audience"),
3410
+ id: z__namespace.string(),
3411
+ resource_name: z__namespace.string(),
3412
+ name: z__namespace.string().nullable(),
3413
+ status: z__namespace.enum([
3414
+ "UNSPECIFIED",
3415
+ "UNKNOWN",
3416
+ "ENABLED",
3417
+ "REMOVED"
3418
+ ])
3419
+ })]))
3420
+ });
3421
+ z__namespace.object({
3422
+ dry_run: z__namespace.boolean().optional().default(false),
3423
+ targeting_dimension: z__namespace.enum([
3424
+ "KEYWORD",
3425
+ "AUDIENCE",
3426
+ "TOPIC",
3427
+ "GENDER",
3428
+ "AGE_RANGE",
3429
+ "PLACEMENT",
3430
+ "PARENTAL_STATUS",
3431
+ "INCOME_RANGE"
3432
+ ]),
3433
+ bid_only: z__namespace.boolean()
3434
+ });
3435
+ z__namespace.object({
3436
+ connection_id: z__namespace.string(),
3437
+ campaign_id: z__namespace.string().regex(/^\d+$/)
3438
+ });
3439
+ z__namespace.object({
3440
+ id: z__namespace.string(),
3441
+ resource_name: z__namespace.string(),
3442
+ dry_run: z__namespace.boolean(),
3443
+ executed: z__namespace.boolean()
3444
+ });
2899
3445
  z__namespace.object({
2900
3446
  connection_id: z__namespace.string()
2901
3447
  });
@@ -4336,6 +4882,66 @@ var mediaUpdate = (options) => (options.client ?? client).patch({
4336
4882
  ...options.headers
4337
4883
  }
4338
4884
  });
4885
+ var mediaSignPart = (options) => (options.client ?? client).post({
4886
+ security: [{
4887
+ key: "secretKey",
4888
+ scheme: "bearer",
4889
+ type: "http"
4890
+ }, {
4891
+ key: "frontendToken",
4892
+ scheme: "bearer",
4893
+ type: "http"
4894
+ }],
4895
+ url: "/media/{id}/multipart/sign",
4896
+ ...options,
4897
+ headers: {
4898
+ "Content-Type": "application/json",
4899
+ ...options.headers
4900
+ }
4901
+ });
4902
+ var mediaListParts = (options) => (options.client ?? client).get({
4903
+ security: [{
4904
+ key: "secretKey",
4905
+ scheme: "bearer",
4906
+ type: "http"
4907
+ }, {
4908
+ key: "frontendToken",
4909
+ scheme: "bearer",
4910
+ type: "http"
4911
+ }],
4912
+ url: "/media/{id}/multipart/parts",
4913
+ ...options
4914
+ });
4915
+ var mediaComplete = (options) => (options.client ?? client).post({
4916
+ security: [{
4917
+ key: "secretKey",
4918
+ scheme: "bearer",
4919
+ type: "http"
4920
+ }, {
4921
+ key: "frontendToken",
4922
+ scheme: "bearer",
4923
+ type: "http"
4924
+ }],
4925
+ url: "/media/{id}/multipart/complete",
4926
+ ...options,
4927
+ headers: {
4928
+ "Content-Type": "application/json",
4929
+ ...options.headers
4930
+ }
4931
+ });
4932
+ var mediaAbort = (options) => (options.client ?? client).post({
4933
+ security: [{
4934
+ key: "secretKey",
4935
+ scheme: "bearer",
4936
+ type: "http"
4937
+ }, {
4938
+ key: "frontendToken",
4939
+ scheme: "bearer",
4940
+ type: "http"
4941
+ }],
4942
+ url: "/media/{id}/multipart/abort",
4943
+ ...options
4944
+ });
4339
4945
  var postsList = (options) => (options?.client ?? client).get({
4340
4946
  security: [{
4341
4947
  key: "secretKey",
@@ -4731,6 +5337,83 @@ var googleEnableCampaign = (options) => (options.client ?? client).post({
4731
5337
  ...options.headers
4732
5338
  }
4733
5339
  });
5340
+ var googleSearchGeoTargets = (options) => (options.client ?? client).get({
5341
+ security: [{
5342
+ key: "secretKey",
5343
+ scheme: "bearer",
5344
+ type: "http"
5345
+ }, {
5346
+ key: "frontendToken",
5347
+ scheme: "bearer",
5348
+ type: "http"
5349
+ }],
5350
+ url: "/google/{connection_id}/geo-targets/search",
5351
+ ...options
5352
+ });
5353
+ var googleListCampaignCriteria = (options) => (options.client ?? client).get({
5354
+ security: [{
5355
+ key: "secretKey",
5356
+ scheme: "bearer",
5357
+ type: "http"
5358
+ }, {
5359
+ key: "frontendToken",
5360
+ scheme: "bearer",
5361
+ type: "http"
5362
+ }],
5363
+ url: "/google/{connection_id}/campaigns/{campaign_id}/criteria",
5364
+ ...options
5365
+ });
5366
+ var googleCreateCampaignCriterion = (options) => (options.client ?? client).post({
5367
+ security: [{
5368
+ key: "secretKey",
5369
+ scheme: "bearer",
5370
+ type: "http"
5371
+ }, {
5372
+ key: "frontendToken",
5373
+ scheme: "bearer",
5374
+ type: "http"
5375
+ }],
5376
+ url: "/google/{connection_id}/campaigns/{campaign_id}/criteria",
5377
+ ...options,
5378
+ headers: {
5379
+ "Content-Type": "application/json",
5380
+ ...options.headers
5381
+ }
5382
+ });
5383
+ var googleDeleteCampaignCriterion = (options) => (options.client ?? client).delete({
5384
+ security: [{
5385
+ key: "secretKey",
5386
+ scheme: "bearer",
5387
+ type: "http"
5388
+ }, {
5389
+ key: "frontendToken",
5390
+ scheme: "bearer",
5391
+ type: "http"
5392
+ }],
5393
+ url: "/google/{connection_id}/campaigns/{campaign_id}/criteria/{criterion_id}",
5394
+ ...options,
5395
+ headers: {
5396
+ "Content-Type": "application/json",
5397
+ ...options.headers
5398
+ }
5399
+ });
5400
+ var googleSetCampaignGeoSettings = (options) => (options.client ?? client).patch({
5401
+ security: [{
5402
+ key: "secretKey",
5403
+ scheme: "bearer",
5404
+ type: "http"
5405
+ }, {
5406
+ key: "frontendToken",
5407
+ scheme: "bearer",
5408
+ type: "http"
5409
+ }],
5410
+ url: "/google/{connection_id}/campaigns/{campaign_id}/geo-settings",
5411
+ ...options,
5412
+ headers: {
5413
+ "Content-Type": "application/json",
5414
+ ...options.headers
5415
+ }
5416
+ });
4734
5417
  var googleListAdGroups = (options) => (options.client ?? client).get({
4735
5418
  security: [{
4736
5419
  key: "secretKey",
@@ -4855,6 +5538,83 @@ var googleEnableAdGroup = (options) => (options.client ?? client).post({
4855
5538
  ...options.headers
4856
5539
  }
4857
5540
  });
5541
+ var googleListAdGroupCriteria = (options) => (options.client ?? client).get({
5542
+ security: [{
5543
+ key: "secretKey",
5544
+ scheme: "bearer",
5545
+ type: "http"
5546
+ }, {
5547
+ key: "frontendToken",
5548
+ scheme: "bearer",
5549
+ type: "http"
5550
+ }],
5551
+ url: "/google/{connection_id}/ad-groups/{ad_group_id}/criteria",
5552
+ ...options
5553
+ });
5554
+ var googleCreateAdGroupCriterion = (options) => (options.client ?? client).post({
5555
+ security: [{
5556
+ key: "secretKey",
5557
+ scheme: "bearer",
5558
+ type: "http"
5559
+ }, {
5560
+ key: "frontendToken",
5561
+ scheme: "bearer",
5562
+ type: "http"
5563
+ }],
5564
+ url: "/google/{connection_id}/ad-groups/{ad_group_id}/criteria",
5565
+ ...options,
5566
+ headers: {
5567
+ "Content-Type": "application/json",
5568
+ ...options.headers
5569
+ }
5570
+ });
5571
+ var googleDeleteAdGroupCriterion = (options) => (options.client ?? client).delete({
5572
+ security: [{
5573
+ key: "secretKey",
5574
+ scheme: "bearer",
5575
+ type: "http"
5576
+ }, {
5577
+ key: "frontendToken",
5578
+ scheme: "bearer",
5579
+ type: "http"
5580
+ }],
5581
+ url: "/google/{connection_id}/ad-groups/{ad_group_id}/criteria/{criterion_id}",
5582
+ ...options,
5583
+ headers: {
5584
+ "Content-Type": "application/json",
5585
+ ...options.headers
5586
+ }
5587
+ });
5588
+ var googleListAudiences = (options) => (options.client ?? client).get({
5589
+ security: [{
5590
+ key: "secretKey",
5591
+ scheme: "bearer",
5592
+ type: "http"
5593
+ }, {
5594
+ key: "frontendToken",
5595
+ scheme: "bearer",
5596
+ type: "http"
5597
+ }],
5598
+ url: "/google/{connection_id}/audiences",
5599
+ ...options
5600
+ });
5601
+ var googleSetCampaignTargetingSetting = (options) => (options.client ?? client).patch({
5602
+ security: [{
5603
+ key: "secretKey",
5604
+ scheme: "bearer",
5605
+ type: "http"
5606
+ }, {
5607
+ key: "frontendToken",
5608
+ scheme: "bearer",
5609
+ type: "http"
5610
+ }],
5611
+ url: "/google/{connection_id}/campaigns/{campaign_id}/targeting-setting",
5612
+ ...options,
5613
+ headers: {
5614
+ "Content-Type": "application/json",
5615
+ ...options.headers
5616
+ }
5617
+ });
4858
5618
  var googleListAds = (options) => (options.client ?? client).get({
4859
5619
  security: [{
4860
5620
  key: "secretKey",
@@ -5312,61 +6072,111 @@ var tokensMint = (options) => (options.client ?? client).post({
5312
6072
  // src/resources.ts
5313
6073
  var isPublished = (post) => post.status === "published";
5314
6074
  var failedVariants = (post) => post.variants.filter((variant) => variant.status === "failed");
6075
+
6076
+ // src/upload/casing.ts
6077
+ function listedPartsToS3(parts) {
6078
+ return parts.map((part) => ({
6079
+ PartNumber: part.part_number,
6080
+ ETag: part.etag,
6081
+ Size: part.size
6082
+ }));
6083
+ }
6084
+ function s3PartsToComplete(parts) {
6085
+ return parts.map((part) => {
6086
+ if (part.PartNumber === void 0 || part.ETag === void 0) {
6087
+ throw new Error(
6088
+ "Multipart complete received a part without PartNumber/ETag."
6089
+ );
6090
+ }
6091
+ return { part_number: part.PartNumber, etag: part.ETag };
6092
+ });
6093
+ }
6094
+
6095
+ // src/upload/upload-error.ts
5315
6096
  var UploadError = class extends Error {
5316
- status;
5317
- constructor(status, message) {
5318
- super(message);
6097
+ constructor(message, options) {
6098
+ super(message, options);
5319
6099
  this.name = "UploadError";
5320
- this.status = status;
5321
6100
  }
5322
6101
  };
5323
- function isTerminal(status) {
5324
- return status >= 400 && status < 500 && status !== 429;
5325
- }
5326
- async function uploadToTarget(file, target, opts = {}) {
5327
- const { onProgress, signal } = opts;
5328
- async function putOnce() {
5329
- try {
5330
- await axios__default.default.request({
5331
- method: target.method,
5332
- url: target.url,
5333
- data: file,
5334
- headers: target.headers,
5335
- signal,
5336
- onUploadProgress: (event) => {
5337
- if (event.total) {
5338
- onProgress?.(event.loaded / event.total);
5339
- }
5340
- }
6102
+
6103
+ // src/upload/upload-file.ts
6104
+ async function uploadFile(file, options) {
6105
+ const { mediaId, session, client: client2, onProgress, signal } = options;
6106
+ if (signal?.aborted) {
6107
+ throw new DOMException("Upload aborted", "AbortError");
6108
+ }
6109
+ const uppy = new Uppy__default.default({ autoProceed: false }).use(AwsS3__default.default, {
6110
+ // Every file is one resumable multipart upload — no size-threshold split, so
6111
+ // the path is uniform and a tiny file is just a 1-part upload (PLAN §2). The
6112
+ // literal `true` (not a `() => true`) selects Uppy's always-multipart variant.
6113
+ shouldUseMultipart: true,
6114
+ // Pin Uppy's chunk size to the server's part size — every part except the
6115
+ // last MUST be exactly this (an R2 requirement the session encodes).
6116
+ getChunkSize: () => session.part_size,
6117
+ // Start: hand back the cached session from the create response — NO HTTP.
6118
+ createMultipartUpload: () => ({
6119
+ uploadId: session.upload_id,
6120
+ key: session.key
6121
+ }),
6122
+ // Sign one part → POST /media/{id}/multipart/sign. The sub-endpoint reads the
6123
+ // upload id from the asset row, so the body carries only the part number.
6124
+ signPart: async (_file, { partNumber }) => {
6125
+ const { data } = await mediaSignPart({
6126
+ client: client2,
6127
+ path: { id: mediaId },
6128
+ body: { part_number: partNumber }
6129
+ });
6130
+ return { url: data.url };
6131
+ },
6132
+ // Resume: GET /media/{id}/multipart/parts → map snake_case → S3 PascalCase so
6133
+ // Uppy skips the parts R2 already holds after a dropped connection.
6134
+ listParts: async () => {
6135
+ const { data } = await mediaListParts({
6136
+ client: client2,
6137
+ path: { id: mediaId }
6138
+ });
6139
+ return listedPartsToS3(data.parts);
6140
+ },
6141
+ // Finish: map Uppy's S3 parts → snake_case → POST /media/{id}/multipart/complete.
6142
+ completeMultipartUpload: async (_file, { parts }) => {
6143
+ await mediaComplete({
6144
+ client: client2,
6145
+ path: { id: mediaId },
6146
+ body: { parts: s3PartsToComplete(parts) }
6147
+ });
6148
+ return {};
6149
+ },
6150
+ // Cancel: POST /media/{id}/multipart/abort (idempotent server-side).
6151
+ abortMultipartUpload: async () => {
6152
+ await mediaAbort({ client: client2, path: { id: mediaId } });
6153
+ }
6154
+ });
6155
+ uppy.on("progress", (percent) => onProgress?.(percent / 100));
6156
+ const onAbort = () => {
6157
+ uppy.cancelAll();
6158
+ };
6159
+ signal?.addEventListener("abort", onAbort, { once: true });
6160
+ try {
6161
+ uppy.addFile({ name: fileName(file), type: file.type, data: file });
6162
+ const result = await uppy.upload();
6163
+ if (signal?.aborted) {
6164
+ throw new DOMException("Upload aborted", "AbortError");
6165
+ }
6166
+ const failed = result?.failed ?? [];
6167
+ if (failed.length > 0) {
6168
+ throw new UploadError("Multipart upload failed.", {
6169
+ cause: failed[0]?.error
5341
6170
  });
5342
- onProgress?.(1);
5343
- } catch (error) {
5344
- if (signal?.aborted) {
5345
- throw error;
5346
- }
5347
- if (axios.isAxiosError(error)) {
5348
- const status = error.response?.status ?? 0;
5349
- throw new UploadError(
5350
- status,
5351
- status ? `Upload failed (HTTP ${status}).` : "Upload failed: network error."
5352
- );
5353
- }
5354
- throw error;
5355
6171
  }
6172
+ onProgress?.(1);
6173
+ } finally {
6174
+ signal?.removeEventListener("abort", onAbort);
6175
+ uppy.destroy();
5356
6176
  }
5357
- await pRetry__default.default(
5358
- async () => {
5359
- try {
5360
- await putOnce();
5361
- } catch (error) {
5362
- if (error instanceof UploadError && isTerminal(error.status)) {
5363
- throw new pRetry.AbortError(error);
5364
- }
5365
- throw error;
5366
- }
5367
- },
5368
- { retries: opts.retries ?? 3, signal }
5369
- );
6177
+ }
6178
+ function fileName(file) {
6179
+ return file instanceof File ? file.name : "upload";
5370
6180
  }
5371
6181
 
5372
6182
  // src/tiktok.ts
@@ -5749,15 +6559,19 @@ exports.defaultTikTokOptions = defaultTikTokOptions;
5749
6559
  exports.failedVariants = failedVariants;
5750
6560
  exports.googleCreateAd = googleCreateAd;
5751
6561
  exports.googleCreateAdGroup = googleCreateAdGroup;
6562
+ exports.googleCreateAdGroupCriterion = googleCreateAdGroupCriterion;
5752
6563
  exports.googleCreateBudget = googleCreateBudget;
5753
6564
  exports.googleCreateCampaign = googleCreateCampaign;
6565
+ exports.googleCreateCampaignCriterion = googleCreateCampaignCriterion;
5754
6566
  exports.googleCreateConversionAction = googleCreateConversionAction;
5755
6567
  exports.googleCreateDisplayAd = googleCreateDisplayAd;
5756
6568
  exports.googleCreateKeyword = googleCreateKeyword;
5757
6569
  exports.googleDeleteAd = googleDeleteAd;
5758
6570
  exports.googleDeleteAdGroup = googleDeleteAdGroup;
6571
+ exports.googleDeleteAdGroupCriterion = googleDeleteAdGroupCriterion;
5759
6572
  exports.googleDeleteBudget = googleDeleteBudget;
5760
6573
  exports.googleDeleteCampaign = googleDeleteCampaign;
6574
+ exports.googleDeleteCampaignCriterion = googleDeleteCampaignCriterion;
5761
6575
  exports.googleDeleteKeyword = googleDeleteKeyword;
5762
6576
  exports.googleEditAdGroup = googleEditAdGroup;
5763
6577
  exports.googleEditBudget = googleEditBudget;
@@ -5773,8 +6587,11 @@ exports.googleGetCampaign = googleGetCampaign;
5773
6587
  exports.googleGetConversionAction = googleGetConversionAction;
5774
6588
  exports.googleGetInsights = googleGetInsights;
5775
6589
  exports.googleGetKeyword = googleGetKeyword;
6590
+ exports.googleListAdGroupCriteria = googleListAdGroupCriteria;
5776
6591
  exports.googleListAdGroups = googleListAdGroups;
5777
6592
  exports.googleListAds = googleListAds;
6593
+ exports.googleListAudiences = googleListAudiences;
6594
+ exports.googleListCampaignCriteria = googleListCampaignCriteria;
5778
6595
  exports.googleListCampaigns = googleListCampaigns;
5779
6596
  exports.googleListConversionActions = googleListConversionActions;
5780
6597
  exports.googleListConversionGoals = googleListConversionGoals;
@@ -5784,7 +6601,10 @@ exports.googlePauseAdGroup = googlePauseAdGroup;
5784
6601
  exports.googlePauseCampaign = googlePauseCampaign;
5785
6602
  exports.googlePauseKeyword = googlePauseKeyword;
5786
6603
  exports.googleRunGaql = googleRunGaql;
6604
+ exports.googleSearchGeoTargets = googleSearchGeoTargets;
5787
6605
  exports.googleSetAdGroupBids = googleSetAdGroupBids;
6606
+ exports.googleSetCampaignGeoSettings = googleSetCampaignGeoSettings;
6607
+ exports.googleSetCampaignTargetingSetting = googleSetCampaignTargetingSetting;
5788
6608
  exports.googleSetConversionGoal = googleSetConversionGoal;
5789
6609
  exports.googleSetKeywordBid = googleSetKeywordBid;
5790
6610
  exports.googleUploadConversions = googleUploadConversions;
@@ -5797,10 +6617,14 @@ exports.isPublished = isPublished;
5797
6617
  exports.linkedinPollDurationLabel = linkedinPollDurationLabel;
5798
6618
  exports.logsGet = logsGet;
5799
6619
  exports.logsList = logsList;
6620
+ exports.mediaAbort = mediaAbort;
6621
+ exports.mediaComplete = mediaComplete;
5800
6622
  exports.mediaCreate = mediaCreate;
5801
6623
  exports.mediaDelete = mediaDelete;
5802
6624
  exports.mediaGet = mediaGet;
5803
6625
  exports.mediaList = mediaList;
6626
+ exports.mediaListParts = mediaListParts;
6627
+ exports.mediaSignPart = mediaSignPart;
5804
6628
  exports.mediaUpdate = mediaUpdate;
5805
6629
  exports.metaAccount = metaAccount;
5806
6630
  exports.metaAd = metaAd;
@@ -5831,7 +6655,7 @@ exports.tiktokPrivacyLabel = tiktokPrivacyLabel;
5831
6655
  exports.tiktokSettings = tiktokSettings;
5832
6656
  exports.toggleInteraction = toggleInteraction;
5833
6657
  exports.tokensMint = tokensMint;
5834
- exports.uploadToTarget = uploadToTarget;
6658
+ exports.uploadFile = uploadFile;
5835
6659
  exports.webhooksCreateEndpoint = webhooksCreateEndpoint;
5836
6660
  exports.webhooksCreatePortal = webhooksCreatePortal;
5837
6661
  exports.webhooksDeleteEndpoint = webhooksDeleteEndpoint;