@posty5/social-publisher-post 5.1.0 → 5.3.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.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import { IPaginationResponse, HttpClient, IPaginationParams } from '@posty5/core';
2
2
  export { HttpClient, IHttpClientConfig, IPosty5Config, uploadToR2 } from '@posty5/core';
3
3
 
4
- type SocialPublisherPostStatusType = "pending" | "processing" | "processingInPlatform" | "failedByPlatform" | "done" | "error" | "canceled" | "needsMaintenance" | "invalidVideoURL" | "invalidPostVideoURL" | "retrying" | "removing" | "removed" | "removeFailed";
4
+ type SocialPublisherPostStatusType = "pending" | "processing" | "processingInPlatform" | "failedByPlatform" | "done" | "error" | "canceled" | "needsMaintenance" | "invalidVideoURL" | "invalidPostVideoURL" | "retrying" | "removing" | "removed" | "removeFailed"
5
+ /** Removed from some platforms while at least one copy is still live (5.2.0). */
6
+ | "partiallyRemoved";
5
7
  /**
6
8
  * Content type of a post.
7
9
  *
@@ -23,6 +25,8 @@ type SocialPublisherPostSourceType = "video-file" | "video-url";
23
25
  * - `notSupported`: platform does not allow programmatic comments (TikTok)
24
26
  */
25
27
  type CommentStatusType = "pending" | "processing" | "done" | "error" | "skipped" | "notSupported";
28
+ /** A platform `removePost` can target on its own (5.2.0). */
29
+ type SocialPublisherPostRemovePlatformType = "youtube" | "facebook" | "instagram" | "tiktok" | "threads" | "twitter";
26
30
  type SocialPublisherAccountPlatformType = "youtube" | "facebook" | "tiktok";
27
31
  type SocialPublisherAccountAccountType = "facebook" | "instagram" | "youtube" | "tiktok";
28
32
  type SocialPublisherAccountStatusType = "active" | "inactive" | "authenticationExpired";
@@ -71,6 +75,12 @@ interface ICreateTextPostBase {
71
75
  twitter?: ITwitterTextConfig;
72
76
  schedule?: IScheduleConfig;
73
77
  comments?: ICommentRequest[];
78
+ /**
79
+ * Add the saved default comments (default: **true**): the workspace's for
80
+ * text posts plus account defaults marked `applyToWorkspacePosts`, or the
81
+ * account's own. Charged like any other comment. `false` adds none.
82
+ */
83
+ allowPostDefaultComments?: boolean;
74
84
  /** Saved hashtag groups merged into the caption (at most 5). */
75
85
  hashtagGroupIds?: string[];
76
86
  /** At most 30. */
@@ -198,7 +208,7 @@ interface ICreateImagePostToWorkspaceRequest {
198
208
  */
199
209
  comment?: ICommentRequest;
200
210
  /**
201
- * Up to {@link MAX_POST_COMMENTS} post-publish comments, in the order they
211
+ * Up to {@link MAX_POST_COMMENTS_PER_PLATFORM} post-publish comments per platform ({@link MAX_POST_COMMENTS_TOTAL} in all), in the order they
202
212
  * post.
203
213
  *
204
214
  * Each carries its own delay, its own optional image and its own per-platform
@@ -207,6 +217,20 @@ interface ICreateImagePostToWorkspaceRequest {
207
217
  * dropped before it is charged.
208
218
  */
209
219
  comments?: ICommentRequest[];
220
+ /**
221
+ * Add the saved default comments (default: **true**).
222
+ *
223
+ * On a workspace post: the workspace's defaults for this post type, plus the
224
+ * account defaults marked `applyToWorkspacePosts`. On an account post: that
225
+ * account's defaults. They are added after `comments`, copied onto the post
226
+ * now, and **charged like any other comment**. Defaults past a platform's
227
+ * ceiling are dropped and reported in the result's `warnings`.
228
+ *
229
+ * Send `false` to add none. When omitted and `comments` already carries a
230
+ * `defaultCommentId`, none are added either. Nothing is added when the plan
231
+ * does not include comments.
232
+ */
233
+ allowPostDefaultComments?: boolean;
210
234
  tag?: string;
211
235
  refId?: string;
212
236
  }
@@ -233,7 +257,7 @@ interface ICreateImagePostToAccountRequest {
233
257
  */
234
258
  comment?: ICommentRequest;
235
259
  /**
236
- * Up to {@link MAX_POST_COMMENTS} post-publish comments, in the order they
260
+ * Up to {@link MAX_POST_COMMENTS_PER_PLATFORM} post-publish comments per platform ({@link MAX_POST_COMMENTS_TOTAL} in all), in the order they
237
261
  * post.
238
262
  *
239
263
  * Each carries its own delay, its own optional image and its own per-platform
@@ -242,11 +266,29 @@ interface ICreateImagePostToAccountRequest {
242
266
  * dropped before it is charged.
243
267
  */
244
268
  comments?: ICommentRequest[];
269
+ /**
270
+ * Add the saved default comments (default: **true**).
271
+ *
272
+ * On a workspace post: the workspace's defaults for this post type, plus the
273
+ * account defaults marked `applyToWorkspacePosts`. On an account post: that
274
+ * account's defaults. They are added after `comments`, copied onto the post
275
+ * now, and **charged like any other comment**. Defaults past a platform's
276
+ * ceiling are dropped and reported in the result's `warnings`.
277
+ *
278
+ * Send `false` to add none. When omitted and `comments` already carries a
279
+ * `defaultCommentId`, none are added either. Nothing is added when the plan
280
+ * does not include comments.
281
+ */
282
+ allowPostDefaultComments?: boolean;
245
283
  tag?: string;
246
284
  refId?: string;
247
285
  }
248
- /** At most this many comments may ride on one post. Enforced server-side. */
249
- declare const MAX_POST_COMMENTS = 5;
286
+ /** At most this many comments one post may send to ONE platform. Enforced server-side. */
287
+ declare const MAX_POST_COMMENTS_PER_PLATFORM = 10;
288
+ /** At most this many comments one post may carry in all. Enforced server-side. */
289
+ declare const MAX_POST_COMMENTS_TOTAL = 30;
290
+ /** @deprecated Use {@link MAX_POST_COMMENTS_PER_PLATFORM}; it is the per-platform ceiling now. */
291
+ declare const MAX_POST_COMMENTS = 10;
250
292
  /** Longest a comment may be. */
251
293
  declare const MAX_COMMENT_LENGTH = 2200;
252
294
  /** Longest a comment may wait after the post before it is published. */
@@ -306,6 +348,18 @@ interface ICommentRequest {
306
348
  postToYoutube?: boolean;
307
349
  /** Post the comment on TikTok (default: false — not supported by TikTok). */
308
350
  postToTiktok?: boolean;
351
+ /** Post the comment as a Threads reply (default: true). */
352
+ postToThreads?: boolean;
353
+ /** Post the comment as a reply on X (default: true). */
354
+ postToTwitter?: boolean;
355
+ /**
356
+ * Set when this comment was copied from a default comment (for example from
357
+ * `resolveDefaultComments`). A default already carried this way is not added
358
+ * a second time.
359
+ */
360
+ defaultCommentId?: string;
361
+ /** Which kind of default `defaultCommentId` names. */
362
+ defaultCommentSource?: "workspace" | "account";
309
363
  }
310
364
  interface ICreateSocialPublisherPostRequest {
311
365
  /** Workspace ID */
@@ -327,7 +381,7 @@ interface ICreateSocialPublisherPostRequest {
327
381
  */
328
382
  comment?: ICommentRequest;
329
383
  /**
330
- * Up to {@link MAX_POST_COMMENTS} post-publish comments, in the order they
384
+ * Up to {@link MAX_POST_COMMENTS_PER_PLATFORM} post-publish comments per platform ({@link MAX_POST_COMMENTS_TOTAL} in all), in the order they
331
385
  * post.
332
386
  *
333
387
  * Each carries its own delay, its own optional image and its own per-platform
@@ -336,6 +390,20 @@ interface ICreateSocialPublisherPostRequest {
336
390
  * dropped before it is charged.
337
391
  */
338
392
  comments?: ICommentRequest[];
393
+ /**
394
+ * Add the saved default comments (default: **true**).
395
+ *
396
+ * On a workspace post: the workspace's defaults for this post type, plus the
397
+ * account defaults marked `applyToWorkspacePosts`. On an account post: that
398
+ * account's defaults. They are added after `comments`, copied onto the post
399
+ * now, and **charged like any other comment**. Defaults past a platform's
400
+ * ceiling are dropped and reported in the result's `warnings`.
401
+ *
402
+ * Send `false` to add none. When omitted and `comments` already carries a
403
+ * `defaultCommentId`, none are added either. Nothing is added when the plan
404
+ * does not include comments.
405
+ */
406
+ allowPostDefaultComments?: boolean;
339
407
  /**
340
408
  * Tag (optional)
341
409
  * Use this field to filter posts by tag.
@@ -369,7 +437,7 @@ interface ICreateSocialPublisherAccountPostRequest {
369
437
  */
370
438
  comment?: ICommentRequest;
371
439
  /**
372
- * Up to {@link MAX_POST_COMMENTS} post-publish comments, in the order they
440
+ * Up to {@link MAX_POST_COMMENTS_PER_PLATFORM} post-publish comments per platform ({@link MAX_POST_COMMENTS_TOTAL} in all), in the order they
373
441
  * post.
374
442
  *
375
443
  * Each carries its own delay, its own optional image and its own per-platform
@@ -378,6 +446,20 @@ interface ICreateSocialPublisherAccountPostRequest {
378
446
  * dropped before it is charged.
379
447
  */
380
448
  comments?: ICommentRequest[];
449
+ /**
450
+ * Add the saved default comments (default: **true**).
451
+ *
452
+ * On a workspace post: the workspace's defaults for this post type, plus the
453
+ * account defaults marked `applyToWorkspacePosts`. On an account post: that
454
+ * account's defaults. They are added after `comments`, copied onto the post
455
+ * now, and **charged like any other comment**. Defaults past a platform's
456
+ * ceiling are dropped and reported in the result's `warnings`.
457
+ *
458
+ * Send `false` to add none. When omitted and `comments` already carries a
459
+ * `defaultCommentId`, none are added either. Nothing is added when the plan
460
+ * does not include comments.
461
+ */
462
+ allowPostDefaultComments?: boolean;
381
463
  /**
382
464
  * Tag (optional)
383
465
  * Use this field to filter posts by tag.
@@ -409,7 +491,7 @@ interface IPostSetting {
409
491
  */
410
492
  comment?: ICommentRequest;
411
493
  /**
412
- * Up to {@link MAX_POST_COMMENTS} post-publish comments, in the order they
494
+ * Up to {@link MAX_POST_COMMENTS_PER_PLATFORM} post-publish comments per platform ({@link MAX_POST_COMMENTS_TOTAL} in all), in the order they
413
495
  * post.
414
496
  *
415
497
  * Each carries its own delay, its own optional image and its own per-platform
@@ -418,6 +500,20 @@ interface IPostSetting {
418
500
  * dropped before it is charged.
419
501
  */
420
502
  comments?: ICommentRequest[];
503
+ /**
504
+ * Add the saved default comments (default: **true**).
505
+ *
506
+ * On a workspace post: the workspace's defaults for this post type, plus the
507
+ * account defaults marked `applyToWorkspacePosts`. On an account post: that
508
+ * account's defaults. They are added after `comments`, copied onto the post
509
+ * now, and **charged like any other comment**. Defaults past a platform's
510
+ * ceiling are dropped and reported in the result's `warnings`.
511
+ *
512
+ * Send `false` to add none. When omitted and `comments` already carries a
513
+ * `defaultCommentId`, none are added either. Nothing is added when the plan
514
+ * does not include comments.
515
+ */
516
+ allowPostDefaultComments?: boolean;
421
517
  /** Optional caller-supplied tag, persisted on the created post for filtering. */
422
518
  tag?: string;
423
519
  /** Optional caller-supplied reference ID, persisted on the created post for filtering. */
@@ -441,7 +537,7 @@ interface IAccountPostSetting {
441
537
  */
442
538
  comment?: ICommentRequest;
443
539
  /**
444
- * Up to {@link MAX_POST_COMMENTS} post-publish comments, in the order they
540
+ * Up to {@link MAX_POST_COMMENTS_PER_PLATFORM} post-publish comments per platform ({@link MAX_POST_COMMENTS_TOTAL} in all), in the order they
445
541
  * post.
446
542
  *
447
543
  * Each carries its own delay, its own optional image and its own per-platform
@@ -450,6 +546,20 @@ interface IAccountPostSetting {
450
546
  * dropped before it is charged.
451
547
  */
452
548
  comments?: ICommentRequest[];
549
+ /**
550
+ * Add the saved default comments (default: **true**).
551
+ *
552
+ * On a workspace post: the workspace's defaults for this post type, plus the
553
+ * account defaults marked `applyToWorkspacePosts`. On an account post: that
554
+ * account's defaults. They are added after `comments`, copied onto the post
555
+ * now, and **charged like any other comment**. Defaults past a platform's
556
+ * ceiling are dropped and reported in the result's `warnings`.
557
+ *
558
+ * Send `false` to add none. When omitted and `comments` already carries a
559
+ * `defaultCommentId`, none are added either. Nothing is added when the plan
560
+ * does not include comments.
561
+ */
562
+ allowPostDefaultComments?: boolean;
453
563
  /** Optional caller-supplied tag, persisted on the created post for filtering. */
454
564
  tag?: string;
455
565
  /** Optional caller-supplied reference ID, persisted on the created post for filtering. */
@@ -534,7 +644,7 @@ interface IPublishOptions {
534
644
  */
535
645
  comment?: ICommentRequest;
536
646
  /**
537
- * Up to {@link MAX_POST_COMMENTS} post-publish comments, in the order they
647
+ * Up to {@link MAX_POST_COMMENTS_PER_PLATFORM} post-publish comments per platform ({@link MAX_POST_COMMENTS_TOTAL} in all), in the order they
538
648
  * post.
539
649
  *
540
650
  * Each carries its own delay, its own optional image and its own per-platform
@@ -543,6 +653,20 @@ interface IPublishOptions {
543
653
  * dropped before it is charged.
544
654
  */
545
655
  comments?: ICommentRequest[];
656
+ /**
657
+ * Add the saved default comments (default: **true**).
658
+ *
659
+ * On a workspace post: the workspace's defaults for this post type, plus the
660
+ * account defaults marked `applyToWorkspacePosts`. On an account post: that
661
+ * account's defaults. They are added after `comments`, copied onto the post
662
+ * now, and **charged like any other comment**. Defaults past a platform's
663
+ * ceiling are dropped and reported in the result's `warnings`.
664
+ *
665
+ * Send `false` to add none. When omitted and `comments` already carries a
666
+ * `defaultCommentId`, none are added either. Nothing is added when the plan
667
+ * does not include comments.
668
+ */
669
+ allowPostDefaultComments?: boolean;
546
670
  }
547
671
  /**
548
672
  * Options for publishing to an account
@@ -611,7 +735,7 @@ interface IPublishToAccountOptions {
611
735
  */
612
736
  comment?: ICommentRequest;
613
737
  /**
614
- * Up to {@link MAX_POST_COMMENTS} post-publish comments, in the order they
738
+ * Up to {@link MAX_POST_COMMENTS_PER_PLATFORM} post-publish comments per platform ({@link MAX_POST_COMMENTS_TOTAL} in all), in the order they
615
739
  * post.
616
740
  *
617
741
  * Each carries its own delay, its own optional image and its own per-platform
@@ -620,6 +744,20 @@ interface IPublishToAccountOptions {
620
744
  * dropped before it is charged.
621
745
  */
622
746
  comments?: ICommentRequest[];
747
+ /**
748
+ * Add the saved default comments (default: **true**).
749
+ *
750
+ * On a workspace post: the workspace's defaults for this post type, plus the
751
+ * account defaults marked `applyToWorkspacePosts`. On an account post: that
752
+ * account's defaults. They are added after `comments`, copied onto the post
753
+ * now, and **charged like any other comment**. Defaults past a platform's
754
+ * ceiling are dropped and reported in the result's `warnings`.
755
+ *
756
+ * Send `false` to add none. When omitted and `comments` already carries a
757
+ * `defaultCommentId`, none are added either. Nothing is added when the plan
758
+ * does not include comments.
759
+ */
760
+ allowPostDefaultComments?: boolean;
623
761
  }
624
762
  /**
625
763
  * Base interface for quick publish options
@@ -680,7 +818,7 @@ interface IQuickPublishBaseOptions {
680
818
  */
681
819
  comment?: ICommentRequest;
682
820
  /**
683
- * Up to {@link MAX_POST_COMMENTS} post-publish comments, in the order they
821
+ * Up to {@link MAX_POST_COMMENTS_PER_PLATFORM} post-publish comments per platform ({@link MAX_POST_COMMENTS_TOTAL} in all), in the order they
684
822
  * post.
685
823
  *
686
824
  * Each carries its own delay, its own optional image and its own per-platform
@@ -689,6 +827,20 @@ interface IQuickPublishBaseOptions {
689
827
  * dropped before it is charged.
690
828
  */
691
829
  comments?: ICommentRequest[];
830
+ /**
831
+ * Add the saved default comments (default: **true**).
832
+ *
833
+ * On a workspace post: the workspace's defaults for this post type, plus the
834
+ * account defaults marked `applyToWorkspacePosts`. On an account post: that
835
+ * account's defaults. They are added after `comments`, copied onto the post
836
+ * now, and **charged like any other comment**. Defaults past a platform's
837
+ * ceiling are dropped and reported in the result's `warnings`.
838
+ *
839
+ * Send `false` to add none. When omitted and `comments` already carries a
840
+ * `defaultCommentId`, none are added either. Nothing is added when the plan
841
+ * does not include comments.
842
+ */
843
+ allowPostDefaultComments?: boolean;
692
844
  }
693
845
  /**
694
846
  * Quick publish options for YouTube only
@@ -957,6 +1109,15 @@ interface ICreatePostResult {
957
1109
  truncatedTargets?: string[];
958
1110
  /** Connected platforms that cannot take this post type. */
959
1111
  skippedPlatforms?: string[];
1112
+ /** Default comments left off because a platform (or the post) was at its comment ceiling. */
1113
+ warnings?: IDefaultCommentWarning[];
1114
+ }
1115
+ /** Why some default comments were not added to a post. */
1116
+ interface IDefaultCommentWarning {
1117
+ code: "DEFAULT_COMMENTS_TRUNCATED" | string;
1118
+ /** The platform whose ceiling was hit, or `all` for the post's total ceiling. */
1119
+ platform: string;
1120
+ dropped: number;
960
1121
  }
961
1122
 
962
1123
  interface IUploadConfig {
@@ -1017,7 +1178,8 @@ interface IRemovePostResponse {
1017
1178
  _id: string;
1018
1179
  /** The post's new version */
1019
1180
  __v: number;
1020
- results: Partial<Record<"youtube" | "facebook" | "instagram" | "tiktok", IRemovePostPlatformResult>>;
1181
+ /** One entry per platform the removal targeted: only `platform` when one was passed. */
1182
+ results: Partial<Record<SocialPublisherPostRemovePlatformType, IRemovePostPlatformResult>>;
1021
1183
  }
1022
1184
  interface ISocialPublisherPostStatusLog {
1023
1185
  status: SocialPublisherPostStatusType;
@@ -1424,7 +1586,15 @@ declare class SocialPublisherPostClient {
1424
1586
  * cannot be removed programmatically and no credits are charged.
1425
1587
  *
1426
1588
  * @param id - Post ID
1589
+ * Pass `platform` to remove the post from that one platform only. The other
1590
+ * platforms keep their copies and the post becomes `partiallyRemoved`. The
1591
+ * post must have been published there (platform status `done` or
1592
+ * `removeFailed`), or the API refuses the call. A `partiallyRemoved` post can
1593
+ * be removed again. Needs the API with per-platform removal.
1594
+ *
1595
+ * @param id - Post ID
1427
1596
  * @param version - The post's `__v` as you read it. A stale one throws `ConflictError`.
1597
+ * @param platform - Optional (5.2.0): remove from this platform only. Omit to remove from every platform.
1428
1598
  * @returns Per-platform removal results, `__v` set to the post's new version
1429
1599
  *
1430
1600
  * @example
@@ -1432,9 +1602,12 @@ declare class SocialPublisherPostClient {
1432
1602
  * const post = await client.getStatus("post_123");
1433
1603
  * const { results } = await client.removePost("post_123", post.__v);
1434
1604
  * // results.youtube?.success === true
1605
+ *
1606
+ * // Only the YouTube copy:
1607
+ * await client.removePost("post_123", post.__v, "youtube");
1435
1608
  * ```
1436
1609
  */
1437
- removePost(id: string, version: number): Promise<IRemovePostResponse>;
1610
+ removePost(id: string, version: number, platform?: SocialPublisherPostRemovePlatformType): Promise<IRemovePostResponse>;
1438
1611
  /**
1439
1612
  * Get next and previous post IDs
1440
1613
  * @param id - Current Post ID
@@ -1782,4 +1955,4 @@ declare function terminateUpload(uploadUrl: string): Promise<boolean>;
1782
1955
  */
1783
1956
  declare function uploadResumable(target: IUploadTarget, file: Blob, options?: IResumableUploadOptions): Promise<string>;
1784
1957
 
1785
- export { type CommentStatusType, DEFAULT_CHUNK_SIZE, type IAccountPostSetting, type IBaseStatusHistoryGroupedDay, type IBaseStatusHistoryGroupedItem, type ICommentInfoDTO, type ICommentRequest, type ICommentStatusDTO, type ICreateImagePostToAccountRequest, type ICreateImagePostToWorkspaceRequest, type ICreatePostResult, type ICreateSocialPublisherAccountPostRequest, type ICreateSocialPublisherPostRequest, type ICreateStoryPostBase, type ICreateStoryPostToAccountRequest, type ICreateStoryPostToWorkspaceRequest, type ICreateTextPostBase, type ICreateTextPostToAccountRequest, type ICreateTextPostToWorkspaceRequest, type IDefaultSettingsResponse, type IFacebookPageConfig, type IFacebookTextConfig, type IGenerateUploadUrlsRequest, type IGenerateUploadUrlsResponse, type IImageDTO, type IImageMediaRequest, type IInstagramConfig, type IListParams, type ILongVideoPlatformVerdict, type ILongVideoQuoteResponse, type ILongVideoRefusedTarget, type ILongVideoUploadControls, type IPostSetting, type IPostUtmConfig, type IPublishLongVideoOptions, type IPublishLongVideoResult, type IPublishLongVideoToAccountOptions, type IPublishOptions, type IPublishToAccountOptions, type IQuickPublishAllOptions, type IQuickPublishBaseOptions, type IQuickPublishFacebookOptions, type IQuickPublishInstagramOptions, type IQuickPublishTikTokOptions, type IQuickPublishYouTubeOptions, type IRemovePostPlatformResult, type IRemovePostResponse, type IReschedulePostRequest, type IResumableUploadOptions, type IScheduleConfig, type ISearchSocialPublisherPostResponse, type ISocialPublisherAccount, type ISocialPublisherPostAccount, type ISocialPublisherPostFacebookPagePostDetails, type ISocialPublisherPostInfo, type ISocialPublisherPostInstagramPostDetails, type ISocialPublisherPostNextPreviousResponse, type ISocialPublisherPostPlatform, type ISocialPublisherPostResponse, type ISocialPublisherPostStatusLog, type ISocialPublisherPostStatusResponse, type ISocialPublisherPostTikTokPostDetails, type ISocialPublisherPostYouTubePostDetails, type ISocialPublisherWorkspace, type IThreadsTextConfig, type ITikTokConfig, type ITwitterTextConfig, type IUploadConfig, type IUploadTarget, type IVideoDTO, type IYouTubeConfig, type ImageSourceType, LONG_VIDEO_CREDIT_UNIT_SECONDS, LONG_VIDEO_MAX_DURATION_SECONDS, MAX_COMMENT_DELAY_MINUTES, MAX_COMMENT_LENGTH, MAX_POST_COMMENTS, type SocialPublisherAccountAccountType, type SocialPublisherAccountPlatformType, type SocialPublisherAccountStatusType, type SocialPublisherPostAccountType, SocialPublisherPostClient, type SocialPublisherPostScheduleType, type SocialPublisherPostSourceType, type SocialPublisherPostStatusType, type SocialPublisherPostType, supportsResumableUpload, terminateUpload, uploadResumable };
1958
+ export { type CommentStatusType, DEFAULT_CHUNK_SIZE, type IAccountPostSetting, type IBaseStatusHistoryGroupedDay, type IBaseStatusHistoryGroupedItem, type ICommentInfoDTO, type ICommentRequest, type ICommentStatusDTO, type ICreateImagePostToAccountRequest, type ICreateImagePostToWorkspaceRequest, type ICreatePostResult, type ICreateSocialPublisherAccountPostRequest, type ICreateSocialPublisherPostRequest, type ICreateStoryPostBase, type ICreateStoryPostToAccountRequest, type ICreateStoryPostToWorkspaceRequest, type ICreateTextPostBase, type ICreateTextPostToAccountRequest, type ICreateTextPostToWorkspaceRequest, type IDefaultCommentWarning, type IDefaultSettingsResponse, type IFacebookPageConfig, type IFacebookTextConfig, type IGenerateUploadUrlsRequest, type IGenerateUploadUrlsResponse, type IImageDTO, type IImageMediaRequest, type IInstagramConfig, type IListParams, type ILongVideoPlatformVerdict, type ILongVideoQuoteResponse, type ILongVideoRefusedTarget, type ILongVideoUploadControls, type IPostSetting, type IPostUtmConfig, type IPublishLongVideoOptions, type IPublishLongVideoResult, type IPublishLongVideoToAccountOptions, type IPublishOptions, type IPublishToAccountOptions, type IQuickPublishAllOptions, type IQuickPublishBaseOptions, type IQuickPublishFacebookOptions, type IQuickPublishInstagramOptions, type IQuickPublishTikTokOptions, type IQuickPublishYouTubeOptions, type IRemovePostPlatformResult, type IRemovePostResponse, type IReschedulePostRequest, type IResumableUploadOptions, type IScheduleConfig, type ISearchSocialPublisherPostResponse, type ISocialPublisherAccount, type ISocialPublisherPostAccount, type ISocialPublisherPostFacebookPagePostDetails, type ISocialPublisherPostInfo, type ISocialPublisherPostInstagramPostDetails, type ISocialPublisherPostNextPreviousResponse, type ISocialPublisherPostPlatform, type ISocialPublisherPostResponse, type ISocialPublisherPostStatusLog, type ISocialPublisherPostStatusResponse, type ISocialPublisherPostTikTokPostDetails, type ISocialPublisherPostYouTubePostDetails, type ISocialPublisherWorkspace, type IThreadsTextConfig, type ITikTokConfig, type ITwitterTextConfig, type IUploadConfig, type IUploadTarget, type IVideoDTO, type IYouTubeConfig, type ImageSourceType, LONG_VIDEO_CREDIT_UNIT_SECONDS, LONG_VIDEO_MAX_DURATION_SECONDS, MAX_COMMENT_DELAY_MINUTES, MAX_COMMENT_LENGTH, MAX_POST_COMMENTS, MAX_POST_COMMENTS_PER_PLATFORM, MAX_POST_COMMENTS_TOTAL, type SocialPublisherAccountAccountType, type SocialPublisherAccountPlatformType, type SocialPublisherAccountStatusType, type SocialPublisherPostAccountType, SocialPublisherPostClient, type SocialPublisherPostRemovePlatformType, type SocialPublisherPostScheduleType, type SocialPublisherPostSourceType, type SocialPublisherPostStatusType, type SocialPublisherPostType, supportsResumableUpload, terminateUpload, uploadResumable };
package/dist/index.js CHANGED
@@ -12024,7 +12024,7 @@ var require_follow_redirects = __commonJS({
12024
12024
  return URL2 && value instanceof URL2;
12025
12025
  }
12026
12026
  function escapeRegex(regex) {
12027
- return regex.replace(/[[\]\\/()*+?.^$|]/g, "\\$&");
12027
+ return regex.replace(/[\^$\\.*+?()[\]{}|]/g, "\\$&");
12028
12028
  }
12029
12029
  module.exports = wrap({ http: http3, https: https2 });
12030
12030
  module.exports.wrap = wrap;
@@ -14132,7 +14132,7 @@ var import_https_proxy_agent = __toESM(require_dist());
14132
14132
  var import_follow_redirects = __toESM(require_follow_redirects());
14133
14133
 
14134
14134
  // ../node_modules/axios/lib/env/data.js
14135
- var VERSION = "1.21.0";
14135
+ var VERSION = "1.21.1";
14136
14136
 
14137
14137
  // ../node_modules/axios/lib/helpers/parseProtocol.js
14138
14138
  function parseProtocol(url2) {
@@ -17609,8 +17609,11 @@ function throwIfCancellationRequested(config) {
17609
17609
  throw new CanceledError_default(null, config);
17610
17610
  }
17611
17611
  }
17612
- function elapsedSince(start) {
17613
- return Math.max(0, Date.now() - start);
17612
+ function resolveClock() {
17613
+ return typeof performance !== "undefined" && utils_default.isFunction(performance.now) ? () => performance.now() : Date.now;
17614
+ }
17615
+ function elapsedSince(now, start) {
17616
+ return Math.max(0, Math.round(now() - start));
17614
17617
  }
17615
17618
  function dispatchRequest(_config) {
17616
17619
  const config = utils_default.toSafeFlatObject(_config);
@@ -17621,11 +17624,12 @@ function dispatchRequest(_config) {
17621
17624
  config.headers.setContentType("application/x-www-form-urlencoded", false);
17622
17625
  }
17623
17626
  const adapter2 = adapters_default.getAdapter(config.adapter || defaults_default.adapter, config);
17624
- const start = Date.now();
17627
+ const now = resolveClock();
17628
+ const start = now();
17625
17629
  return adapter2(config).then(
17626
17630
  function onAdapterResolution(response) {
17627
17631
  throwIfCancellationRequested(config);
17628
- response.duration = elapsedSince(start);
17632
+ response.duration = elapsedSince(now, start);
17629
17633
  config.response = response;
17630
17634
  try {
17631
17635
  response.data = transformData.call(config, config.transformResponse, response);
@@ -17639,7 +17643,7 @@ function dispatchRequest(_config) {
17639
17643
  if (!isCancel(reason)) {
17640
17644
  throwIfCancellationRequested(config);
17641
17645
  if (reason && reason.response) {
17642
- reason.response.duration = elapsedSince(start);
17646
+ reason.response.duration = elapsedSince(now, start);
17643
17647
  config.response = reason.response;
17644
17648
  try {
17645
17649
  reason.response.data = transformData.call(
@@ -19164,7 +19168,15 @@ var SocialPublisherPostClient = class {
19164
19168
  * cannot be removed programmatically and no credits are charged.
19165
19169
  *
19166
19170
  * @param id - Post ID
19171
+ * Pass `platform` to remove the post from that one platform only. The other
19172
+ * platforms keep their copies and the post becomes `partiallyRemoved`. The
19173
+ * post must have been published there (platform status `done` or
19174
+ * `removeFailed`), or the API refuses the call. A `partiallyRemoved` post can
19175
+ * be removed again. Needs the API with per-platform removal.
19176
+ *
19177
+ * @param id - Post ID
19167
19178
  * @param version - The post's `__v` as you read it. A stale one throws `ConflictError`.
19179
+ * @param platform - Optional (5.2.0): remove from this platform only. Omit to remove from every platform.
19168
19180
  * @returns Per-platform removal results, `__v` set to the post's new version
19169
19181
  *
19170
19182
  * @example
@@ -19172,11 +19184,15 @@ var SocialPublisherPostClient = class {
19172
19184
  * const post = await client.getStatus("post_123");
19173
19185
  * const { results } = await client.removePost("post_123", post.__v);
19174
19186
  * // results.youtube?.success === true
19187
+ *
19188
+ * // Only the YouTube copy:
19189
+ * await client.removePost("post_123", post.__v, "youtube");
19175
19190
  * ```
19176
19191
  */
19177
- async removePost(id, version) {
19192
+ async removePost(id, version, platform) {
19178
19193
  assertVersion(version);
19179
- const response = await this.http.post(`${this.basePath}/${encodeURIComponent(id)}/remove`, {}, { version });
19194
+ const body = platform ? { platform } : {};
19195
+ const response = await this.http.post(`${this.basePath}/${encodeURIComponent(id)}/remove`, body, { version });
19180
19196
  return withVersion(response, id);
19181
19197
  }
19182
19198
  /**
@@ -19500,7 +19516,9 @@ var SocialPublisherPostClient = class {
19500
19516
  source: "video-file",
19501
19517
  tag: options.tag,
19502
19518
  refId: options.refId,
19503
- comment: options.comment
19519
+ comment: options.comment,
19520
+ comments: options.comments,
19521
+ allowPostDefaultComments: options.allowPostDefaultComments
19504
19522
  };
19505
19523
  const source = this.detectVideoSource(options.video);
19506
19524
  switch (source) {
@@ -19545,7 +19563,9 @@ var SocialPublisherPostClient = class {
19545
19563
  source: "video-file",
19546
19564
  tag: options.tag,
19547
19565
  refId: options.refId,
19548
- comment: options.comment
19566
+ comment: options.comment,
19567
+ comments: options.comments,
19568
+ allowPostDefaultComments: options.allowPostDefaultComments
19549
19569
  };
19550
19570
  switch (source) {
19551
19571
  case "file": {
@@ -19658,7 +19678,9 @@ var SocialPublisherPostClient = class {
19658
19678
  thumbURL: thumb?.thumbFileURL,
19659
19679
  tag: options.tag,
19660
19680
  refId: options.refId,
19661
- comment: options.comment
19681
+ comment: options.comment,
19682
+ comments: options.comments,
19683
+ allowPostDefaultComments: options.allowPostDefaultComments
19662
19684
  };
19663
19685
  const target = isFile2 ? "by-file" : "by-url";
19664
19686
  const id = postId ?? thumb?.postId;
@@ -19710,7 +19732,9 @@ var SocialPublisherPostClient = class {
19710
19732
  thumbURL: thumb?.thumbFileURL,
19711
19733
  tag: options.tag,
19712
19734
  refId: options.refId,
19713
- comment: options.comment
19735
+ comment: options.comment,
19736
+ comments: options.comments,
19737
+ allowPostDefaultComments: options.allowPostDefaultComments
19714
19738
  };
19715
19739
  const target = isFile2 ? "by-file" : "by-url";
19716
19740
  const id = postId ?? thumb?.postId;
@@ -19850,7 +19874,9 @@ var SocialPublisherPostClient = class {
19850
19874
  };
19851
19875
 
19852
19876
  // src/interfaces/requests/index.ts
19853
- var MAX_POST_COMMENTS = 5;
19877
+ var MAX_POST_COMMENTS_PER_PLATFORM = 10;
19878
+ var MAX_POST_COMMENTS_TOTAL = 30;
19879
+ var MAX_POST_COMMENTS = MAX_POST_COMMENTS_PER_PLATFORM;
19854
19880
  var MAX_COMMENT_LENGTH = 2200;
19855
19881
  var MAX_COMMENT_DELAY_MINUTES = 24 * 60;
19856
19882
  var LONG_VIDEO_MAX_DURATION_SECONDS = 3600;
@@ -19881,6 +19907,8 @@ exports.LONG_VIDEO_MAX_DURATION_SECONDS = LONG_VIDEO_MAX_DURATION_SECONDS;
19881
19907
  exports.MAX_COMMENT_DELAY_MINUTES = MAX_COMMENT_DELAY_MINUTES;
19882
19908
  exports.MAX_COMMENT_LENGTH = MAX_COMMENT_LENGTH;
19883
19909
  exports.MAX_POST_COMMENTS = MAX_POST_COMMENTS;
19910
+ exports.MAX_POST_COMMENTS_PER_PLATFORM = MAX_POST_COMMENTS_PER_PLATFORM;
19911
+ exports.MAX_POST_COMMENTS_TOTAL = MAX_POST_COMMENTS_TOTAL;
19884
19912
  exports.SocialPublisherPostClient = SocialPublisherPostClient;
19885
19913
  exports.supportsResumableUpload = supportsResumableUpload;
19886
19914
  exports.terminateUpload = terminateUpload;