@posty5/social-publisher-post 4.2.0 β†’ 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -106,6 +106,33 @@ console.log("YouTube:", status.youtube?.postInfo.currentStatus);
106
106
 
107
107
  ---
108
108
 
109
+ ## πŸ”’ Versioned writes (5.0.0)
110
+
111
+ Every write to an existing document carries the version you read, so two
112
+ people (or two scripts) can never silently overwrite each other.
113
+
114
+ - **Where `__v` comes from:** every entity this SDK returns (`get`, `list`,
115
+ and every write) has `__v`. Keep the `__v` a write returns for your next write.
116
+ - **A stale version** throws `ConflictError` (409). It carries
117
+ `currentVersion`, the document's version now.
118
+ - **Merging deliberately:** reload, re-apply your change, and resend with the
119
+ fresh version (`currentVersion`). There is no "overwrite anyway" flag;
120
+ resending blindly is exactly the lost update this prevents.
121
+ - Versioned writes are never retried automatically.
122
+
123
+ ```ts
124
+ import { ConflictError } from "@posty5/core";
125
+
126
+ try {
127
+ const post = await client.getStatus(id);
128
+ await client.reschedulePost(id, { schedule: 'now' }, post.__v);
129
+ } catch (error) {
130
+ if (error instanceof ConflictError) {
131
+ // error.currentVersion: reload, merge, and resend with the fresh __v
132
+ } else throw error;
133
+ }
134
+ ```
135
+
109
136
  ## Γ°ΕΈβ€œΕ‘ API Reference & Examples
110
137
 
111
138
  ### publishShortVideo()
@@ -1126,6 +1153,21 @@ We're here to help you succeed with Posty5!
1126
1153
 
1127
1154
  ---
1128
1155
 
1156
+ ## πŸ“ Text posts and stories (4.6.0)
1157
+
1158
+ ```ts
1159
+ await posts.createTextPostToWorkspace({ workspaceId, caption: "Launching today!", threads: { topic_tag: "launch" } });
1160
+ await posts.createTextPostToAccount({ accountId, caption: "Hello X", twitter: { reply_settings: "following" } });
1161
+
1162
+ await posts.createStoryPostToWorkspace({ workspaceId, kind: "image", image: { source: "image-url", externalUrl } });
1163
+ await posts.createStoryPostToAccount({ accountId, platform: "instagram", kind: "video", source: "video-url", videoURL });
1164
+ ```
1165
+
1166
+ Each answers `{ _id, refusedTargets?, truncatedTargets?, skippedPlatforms? }`.
1167
+ Story media is by URL in this release.
1168
+
1169
+ ---
1170
+
1129
1171
  ## Γ°ΕΈβ€œβ€ž License
1130
1172
 
1131
1173
  MIT License - see [LICENSE](./LICENSE) file for details.
package/dist/index.d.mts CHANGED
@@ -27,6 +27,96 @@ type SocialPublisherAccountPlatformType = "youtube" | "facebook" | "tiktok";
27
27
  type SocialPublisherAccountAccountType = "facebook" | "instagram" | "youtube" | "tiktok";
28
28
  type SocialPublisherAccountStatusType = "active" | "inactive" | "authenticationExpired";
29
29
 
30
+ /** Facebook's override for a text post. Without it the shared caption is used. */
31
+ interface IFacebookTextConfig {
32
+ /** The status text. */
33
+ description?: string;
34
+ /** Kept for other surfaces; Facebook ignores it. */
35
+ title?: string;
36
+ /** An http(s) link Facebook previews. Posty5 never requests it. */
37
+ link?: string;
38
+ }
39
+ /** Threads' override for a text post β€” at most 500 characters. */
40
+ interface IThreadsTextConfig {
41
+ text?: string;
42
+ reply_control?: "everyone" | "accounts_you_follow" | "mentioned_only" | "parent_post_author_only" | "followers_only";
43
+ /** The ONE topic Threads links (letters, digits, `_`). */
44
+ topic_tag?: string;
45
+ /** An http(s) link shown as a preview card. */
46
+ link?: string;
47
+ }
48
+ /** X's settings for a text post (requires the Pro plan or higher on the API side). */
49
+ interface ITwitterTextConfig {
50
+ /** At most 280 weighted characters. */
51
+ text?: string;
52
+ reply_settings?: "everyone" | "mentionedUsers" | "following";
53
+ /** 2–4 options of up to 25 characters; 5–10080 minutes. Not with `quote_tweet_id`. */
54
+ poll?: {
55
+ options: string[];
56
+ duration_minutes?: number;
57
+ };
58
+ quote_tweet_id?: string;
59
+ }
60
+ /** UTM parameters added to tracked links. */
61
+ interface IPostUtmConfig {
62
+ medium?: string;
63
+ campaign?: string;
64
+ }
65
+ /** Fields every text post takes, whichever target. */
66
+ interface ICreateTextPostBase {
67
+ /** The post's text. */
68
+ caption: string;
69
+ facebook?: IFacebookTextConfig;
70
+ threads?: IThreadsTextConfig;
71
+ twitter?: ITwitterTextConfig;
72
+ schedule?: IScheduleConfig;
73
+ comments?: ICommentRequest[];
74
+ /** Saved hashtag groups merged into the caption (at most 5). */
75
+ hashtagGroupIds?: string[];
76
+ /** At most 30. */
77
+ hashtags?: string[];
78
+ /** Turn links in the caption into tracked short links. */
79
+ trackLinks?: boolean;
80
+ utm?: IPostUtmConfig;
81
+ refId?: string;
82
+ tag?: string;
83
+ }
84
+ /** A text post to every text-capable account in a workspace. */
85
+ interface ICreateTextPostToWorkspaceRequest extends ICreateTextPostBase {
86
+ workspaceId: string;
87
+ }
88
+ /** A text post to one account. */
89
+ interface ICreateTextPostToAccountRequest extends ICreateTextPostBase {
90
+ accountId: string;
91
+ }
92
+ /**
93
+ * A story. Media by URL only in this SDK release: an image as
94
+ * `image: { source: "image-url", externalUrl }`, a video as
95
+ * `source: "video-url"` + `videoURL`.
96
+ */
97
+ interface ICreateStoryPostBase {
98
+ kind: "image" | "video";
99
+ /** For `kind: "image"`. */
100
+ image?: IImageMediaRequest;
101
+ /** For `kind: "video"`. */
102
+ source?: "video-url";
103
+ /** For `kind: "video"`: a direct, public video URL. */
104
+ videoURL?: string;
105
+ schedule?: IScheduleConfig;
106
+ refId?: string;
107
+ tag?: string;
108
+ }
109
+ /** A story to every story-capable account in a workspace. */
110
+ interface ICreateStoryPostToWorkspaceRequest extends ICreateStoryPostBase {
111
+ workspaceId: string;
112
+ }
113
+ /** A story to one account. */
114
+ interface ICreateStoryPostToAccountRequest extends ICreateStoryPostBase {
115
+ accountId: string;
116
+ /** The account's platform β€” required by the API for a story to one account. */
117
+ platform: "youtube" | "tiktok" | "facebook" | "instagram" | "threads" | "twitter";
118
+ }
119
+
30
120
  interface IYouTubeConfig {
31
121
  title: string;
32
122
  description: string;
@@ -841,6 +931,21 @@ interface IReschedulePostRequest {
841
931
  caption?: string;
842
932
  }
843
933
 
934
+ /** What creating a text or story post answers. */
935
+ interface ICreatePostResult {
936
+ /** The created post's id β€” `getStatus(_id)` follows it. */
937
+ _id: string;
938
+ /** Connected platforms dropped from the post, with why (e.g. X below the Pro plan). */
939
+ refusedTargets?: {
940
+ platform: string;
941
+ reason: string;
942
+ }[];
943
+ /** Platforms whose text was built from the shared caption and cut to fit (X). */
944
+ truncatedTargets?: string[];
945
+ /** Connected platforms that cannot take this post type. */
946
+ skippedPlatforms?: string[];
947
+ }
948
+
844
949
  interface IUploadConfig {
845
950
  url: string;
846
951
  fields: Record<string, string>;
@@ -897,6 +1002,8 @@ interface IRemovePostPlatformResult {
897
1002
  }
898
1003
  interface IRemovePostResponse {
899
1004
  _id: string;
1005
+ /** The post's new version */
1006
+ __v: number;
900
1007
  results: Partial<Record<"youtube" | "facebook" | "instagram" | "tiktok", IRemovePostPlatformResult>>;
901
1008
  }
902
1009
  interface ISocialPublisherPostStatusLog {
@@ -985,6 +1092,8 @@ interface ISocialPublisherPostPlatform {
985
1092
  }
986
1093
  interface ISocialPublisherPostResponse {
987
1094
  _id: string;
1095
+ /** Document version: pass it to versioned writes (`update`, `delete`, ...). */
1096
+ __v: number;
988
1097
  numbering: string;
989
1098
  caption: string;
990
1099
  createdAt: Date;
@@ -1027,6 +1136,8 @@ interface ISocialPublisherPostResponse {
1027
1136
  }
1028
1137
  interface ISocialPublisherPostStatusResponse {
1029
1138
  _id: string;
1139
+ /** Document version: pass it to versioned writes (`update`, `delete`, ...). */
1140
+ __v: number;
1030
1141
  numbering: string;
1031
1142
  type: "shortVideo" | "longVideo" | "image";
1032
1143
  source: SocialPublisherPostSourceType;
@@ -1300,15 +1411,17 @@ declare class SocialPublisherPostClient {
1300
1411
  * cannot be removed programmatically and no credits are charged.
1301
1412
  *
1302
1413
  * @param id - Post ID
1303
- * @returns Per-platform removal results
1414
+ * @param version - The post's `__v` as you read it. A stale one throws `ConflictError`.
1415
+ * @returns Per-platform removal results, `__v` set to the post's new version
1304
1416
  *
1305
1417
  * @example
1306
1418
  * ```ts
1307
- * const { results } = await client.removePost("post_123");
1419
+ * const post = await client.getStatus("post_123");
1420
+ * const { results } = await client.removePost("post_123", post.__v);
1308
1421
  * // results.youtube?.success === true
1309
1422
  * ```
1310
1423
  */
1311
- removePost(id: string): Promise<IRemovePostResponse>;
1424
+ removePost(id: string, version: number): Promise<IRemovePostResponse>;
1312
1425
  /**
1313
1426
  * Get next and previous post IDs
1314
1427
  * @param id - Current Post ID
@@ -1361,6 +1474,22 @@ declare class SocialPublisherPostClient {
1361
1474
  * platforms in the request are ignored.
1362
1475
  */
1363
1476
  createImagePostToAccount(data: ICreateImagePostToAccountRequest, id?: string): Promise<string>;
1477
+ /**
1478
+ * Publish a text-only post to every text-capable account in a workspace
1479
+ * (Facebook, Threads, X). Platforms that cannot take text are reported in
1480
+ * `skippedPlatforms`; X below the Pro plan is dropped into `refusedTargets`.
1481
+ */
1482
+ createTextPostToWorkspace(data: ICreateTextPostToWorkspaceRequest): Promise<ICreatePostResult>;
1483
+ /** Publish a text-only post to one account. */
1484
+ createTextPostToAccount(data: ICreateTextPostToAccountRequest): Promise<ICreatePostResult>;
1485
+ /**
1486
+ * Publish a story to every story-capable account in a workspace. Media by URL
1487
+ * only in this release: `image: { source: "image-url", externalUrl }`, or
1488
+ * `source: "video-url"` with `videoURL`.
1489
+ */
1490
+ createStoryPostToWorkspace(data: ICreateStoryPostToWorkspaceRequest): Promise<ICreatePostResult>;
1491
+ /** Publish a story to one account. Media by URL only, as for the workspace form. */
1492
+ createStoryPostToAccount(data: ICreateStoryPostToAccountRequest): Promise<ICreatePostResult>;
1364
1493
  /**
1365
1494
  * Handle thumbnail upload - accepts either File or URL string
1366
1495
  * @param thumb - Thumbnail as File (will be uploaded) or URL string (will be passed directly)
@@ -1509,11 +1638,18 @@ declare class SocialPublisherPostClient {
1509
1638
  *
1510
1639
  * @example
1511
1640
  * ```ts
1512
- * await client.reschedulePost("post_123", { schedule: new Date("2026-09-01T09:00:00Z") });
1513
- * await client.reschedulePost("post_123", { schedule: "now" });
1641
+ * const post = await client.getStatus("post_123");
1642
+ * const { __v } = await client.reschedulePost("post_123", { schedule: new Date("2026-09-01T09:00:00Z") }, post.__v);
1643
+ * await client.reschedulePost("post_123", { schedule: "now" }, __v);
1514
1644
  * ```
1645
+ *
1646
+ * @param version - The post's `__v` as you read it. A stale one throws `ConflictError`.
1647
+ * @returns `{ _id, __v }`, `__v` being the new version
1515
1648
  */
1516
- reschedulePost(id: string, data: IReschedulePostRequest): Promise<void>;
1649
+ reschedulePost(id: string, data: IReschedulePostRequest, version: number): Promise<{
1650
+ _id: string;
1651
+ __v: number;
1652
+ }>;
1517
1653
  /**
1518
1654
  * Delete a post that has not published yet, releasing its uploaded media in
1519
1655
  * the same request.
@@ -1524,10 +1660,12 @@ declare class SocialPublisherPostClient {
1524
1660
  *
1525
1661
  * @example
1526
1662
  * ```ts
1527
- * await client.deletePost("post_123");
1663
+ * await client.deletePost("post_123", post.__v);
1528
1664
  * ```
1665
+ *
1666
+ * @param version - The post's `__v` as you read it. A stale one throws `ConflictError`.
1529
1667
  */
1530
- deletePost(id: string): Promise<void>;
1668
+ deletePost(id: string, version: number): Promise<void>;
1531
1669
  /**
1532
1670
  * Upload a long video and return the URL to publish from.
1533
1671
  *
@@ -1631,4 +1769,4 @@ declare function terminateUpload(uploadUrl: string): Promise<boolean>;
1631
1769
  */
1632
1770
  declare function uploadResumable(target: IUploadTarget, file: Blob, options?: IResumableUploadOptions): Promise<string>;
1633
1771
 
1634
- export { type CommentStatusType, DEFAULT_CHUNK_SIZE, type IAccountPostSetting, type IBaseStatusHistoryGroupedDay, type IBaseStatusHistoryGroupedItem, type ICommentInfoDTO, type ICommentRequest, type ICommentStatusDTO, type ICreateImagePostToAccountRequest, type ICreateImagePostToWorkspaceRequest, type ICreateSocialPublisherAccountPostRequest, type ICreateSocialPublisherPostRequest, type IDefaultSettingsResponse, type IFacebookPageConfig, type IGenerateUploadUrlsRequest, type IGenerateUploadUrlsResponse, type IImageDTO, type IImageMediaRequest, type IInstagramConfig, type IListParams, type ILongVideoPlatformVerdict, type ILongVideoQuoteResponse, type ILongVideoRefusedTarget, type ILongVideoUploadControls, type IPostSetting, 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 ITikTokConfig, 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 };
1772
+ 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 };
package/dist/index.d.ts CHANGED
@@ -27,6 +27,96 @@ type SocialPublisherAccountPlatformType = "youtube" | "facebook" | "tiktok";
27
27
  type SocialPublisherAccountAccountType = "facebook" | "instagram" | "youtube" | "tiktok";
28
28
  type SocialPublisherAccountStatusType = "active" | "inactive" | "authenticationExpired";
29
29
 
30
+ /** Facebook's override for a text post. Without it the shared caption is used. */
31
+ interface IFacebookTextConfig {
32
+ /** The status text. */
33
+ description?: string;
34
+ /** Kept for other surfaces; Facebook ignores it. */
35
+ title?: string;
36
+ /** An http(s) link Facebook previews. Posty5 never requests it. */
37
+ link?: string;
38
+ }
39
+ /** Threads' override for a text post β€” at most 500 characters. */
40
+ interface IThreadsTextConfig {
41
+ text?: string;
42
+ reply_control?: "everyone" | "accounts_you_follow" | "mentioned_only" | "parent_post_author_only" | "followers_only";
43
+ /** The ONE topic Threads links (letters, digits, `_`). */
44
+ topic_tag?: string;
45
+ /** An http(s) link shown as a preview card. */
46
+ link?: string;
47
+ }
48
+ /** X's settings for a text post (requires the Pro plan or higher on the API side). */
49
+ interface ITwitterTextConfig {
50
+ /** At most 280 weighted characters. */
51
+ text?: string;
52
+ reply_settings?: "everyone" | "mentionedUsers" | "following";
53
+ /** 2–4 options of up to 25 characters; 5–10080 minutes. Not with `quote_tweet_id`. */
54
+ poll?: {
55
+ options: string[];
56
+ duration_minutes?: number;
57
+ };
58
+ quote_tweet_id?: string;
59
+ }
60
+ /** UTM parameters added to tracked links. */
61
+ interface IPostUtmConfig {
62
+ medium?: string;
63
+ campaign?: string;
64
+ }
65
+ /** Fields every text post takes, whichever target. */
66
+ interface ICreateTextPostBase {
67
+ /** The post's text. */
68
+ caption: string;
69
+ facebook?: IFacebookTextConfig;
70
+ threads?: IThreadsTextConfig;
71
+ twitter?: ITwitterTextConfig;
72
+ schedule?: IScheduleConfig;
73
+ comments?: ICommentRequest[];
74
+ /** Saved hashtag groups merged into the caption (at most 5). */
75
+ hashtagGroupIds?: string[];
76
+ /** At most 30. */
77
+ hashtags?: string[];
78
+ /** Turn links in the caption into tracked short links. */
79
+ trackLinks?: boolean;
80
+ utm?: IPostUtmConfig;
81
+ refId?: string;
82
+ tag?: string;
83
+ }
84
+ /** A text post to every text-capable account in a workspace. */
85
+ interface ICreateTextPostToWorkspaceRequest extends ICreateTextPostBase {
86
+ workspaceId: string;
87
+ }
88
+ /** A text post to one account. */
89
+ interface ICreateTextPostToAccountRequest extends ICreateTextPostBase {
90
+ accountId: string;
91
+ }
92
+ /**
93
+ * A story. Media by URL only in this SDK release: an image as
94
+ * `image: { source: "image-url", externalUrl }`, a video as
95
+ * `source: "video-url"` + `videoURL`.
96
+ */
97
+ interface ICreateStoryPostBase {
98
+ kind: "image" | "video";
99
+ /** For `kind: "image"`. */
100
+ image?: IImageMediaRequest;
101
+ /** For `kind: "video"`. */
102
+ source?: "video-url";
103
+ /** For `kind: "video"`: a direct, public video URL. */
104
+ videoURL?: string;
105
+ schedule?: IScheduleConfig;
106
+ refId?: string;
107
+ tag?: string;
108
+ }
109
+ /** A story to every story-capable account in a workspace. */
110
+ interface ICreateStoryPostToWorkspaceRequest extends ICreateStoryPostBase {
111
+ workspaceId: string;
112
+ }
113
+ /** A story to one account. */
114
+ interface ICreateStoryPostToAccountRequest extends ICreateStoryPostBase {
115
+ accountId: string;
116
+ /** The account's platform β€” required by the API for a story to one account. */
117
+ platform: "youtube" | "tiktok" | "facebook" | "instagram" | "threads" | "twitter";
118
+ }
119
+
30
120
  interface IYouTubeConfig {
31
121
  title: string;
32
122
  description: string;
@@ -841,6 +931,21 @@ interface IReschedulePostRequest {
841
931
  caption?: string;
842
932
  }
843
933
 
934
+ /** What creating a text or story post answers. */
935
+ interface ICreatePostResult {
936
+ /** The created post's id β€” `getStatus(_id)` follows it. */
937
+ _id: string;
938
+ /** Connected platforms dropped from the post, with why (e.g. X below the Pro plan). */
939
+ refusedTargets?: {
940
+ platform: string;
941
+ reason: string;
942
+ }[];
943
+ /** Platforms whose text was built from the shared caption and cut to fit (X). */
944
+ truncatedTargets?: string[];
945
+ /** Connected platforms that cannot take this post type. */
946
+ skippedPlatforms?: string[];
947
+ }
948
+
844
949
  interface IUploadConfig {
845
950
  url: string;
846
951
  fields: Record<string, string>;
@@ -897,6 +1002,8 @@ interface IRemovePostPlatformResult {
897
1002
  }
898
1003
  interface IRemovePostResponse {
899
1004
  _id: string;
1005
+ /** The post's new version */
1006
+ __v: number;
900
1007
  results: Partial<Record<"youtube" | "facebook" | "instagram" | "tiktok", IRemovePostPlatformResult>>;
901
1008
  }
902
1009
  interface ISocialPublisherPostStatusLog {
@@ -985,6 +1092,8 @@ interface ISocialPublisherPostPlatform {
985
1092
  }
986
1093
  interface ISocialPublisherPostResponse {
987
1094
  _id: string;
1095
+ /** Document version: pass it to versioned writes (`update`, `delete`, ...). */
1096
+ __v: number;
988
1097
  numbering: string;
989
1098
  caption: string;
990
1099
  createdAt: Date;
@@ -1027,6 +1136,8 @@ interface ISocialPublisherPostResponse {
1027
1136
  }
1028
1137
  interface ISocialPublisherPostStatusResponse {
1029
1138
  _id: string;
1139
+ /** Document version: pass it to versioned writes (`update`, `delete`, ...). */
1140
+ __v: number;
1030
1141
  numbering: string;
1031
1142
  type: "shortVideo" | "longVideo" | "image";
1032
1143
  source: SocialPublisherPostSourceType;
@@ -1300,15 +1411,17 @@ declare class SocialPublisherPostClient {
1300
1411
  * cannot be removed programmatically and no credits are charged.
1301
1412
  *
1302
1413
  * @param id - Post ID
1303
- * @returns Per-platform removal results
1414
+ * @param version - The post's `__v` as you read it. A stale one throws `ConflictError`.
1415
+ * @returns Per-platform removal results, `__v` set to the post's new version
1304
1416
  *
1305
1417
  * @example
1306
1418
  * ```ts
1307
- * const { results } = await client.removePost("post_123");
1419
+ * const post = await client.getStatus("post_123");
1420
+ * const { results } = await client.removePost("post_123", post.__v);
1308
1421
  * // results.youtube?.success === true
1309
1422
  * ```
1310
1423
  */
1311
- removePost(id: string): Promise<IRemovePostResponse>;
1424
+ removePost(id: string, version: number): Promise<IRemovePostResponse>;
1312
1425
  /**
1313
1426
  * Get next and previous post IDs
1314
1427
  * @param id - Current Post ID
@@ -1361,6 +1474,22 @@ declare class SocialPublisherPostClient {
1361
1474
  * platforms in the request are ignored.
1362
1475
  */
1363
1476
  createImagePostToAccount(data: ICreateImagePostToAccountRequest, id?: string): Promise<string>;
1477
+ /**
1478
+ * Publish a text-only post to every text-capable account in a workspace
1479
+ * (Facebook, Threads, X). Platforms that cannot take text are reported in
1480
+ * `skippedPlatforms`; X below the Pro plan is dropped into `refusedTargets`.
1481
+ */
1482
+ createTextPostToWorkspace(data: ICreateTextPostToWorkspaceRequest): Promise<ICreatePostResult>;
1483
+ /** Publish a text-only post to one account. */
1484
+ createTextPostToAccount(data: ICreateTextPostToAccountRequest): Promise<ICreatePostResult>;
1485
+ /**
1486
+ * Publish a story to every story-capable account in a workspace. Media by URL
1487
+ * only in this release: `image: { source: "image-url", externalUrl }`, or
1488
+ * `source: "video-url"` with `videoURL`.
1489
+ */
1490
+ createStoryPostToWorkspace(data: ICreateStoryPostToWorkspaceRequest): Promise<ICreatePostResult>;
1491
+ /** Publish a story to one account. Media by URL only, as for the workspace form. */
1492
+ createStoryPostToAccount(data: ICreateStoryPostToAccountRequest): Promise<ICreatePostResult>;
1364
1493
  /**
1365
1494
  * Handle thumbnail upload - accepts either File or URL string
1366
1495
  * @param thumb - Thumbnail as File (will be uploaded) or URL string (will be passed directly)
@@ -1509,11 +1638,18 @@ declare class SocialPublisherPostClient {
1509
1638
  *
1510
1639
  * @example
1511
1640
  * ```ts
1512
- * await client.reschedulePost("post_123", { schedule: new Date("2026-09-01T09:00:00Z") });
1513
- * await client.reschedulePost("post_123", { schedule: "now" });
1641
+ * const post = await client.getStatus("post_123");
1642
+ * const { __v } = await client.reschedulePost("post_123", { schedule: new Date("2026-09-01T09:00:00Z") }, post.__v);
1643
+ * await client.reschedulePost("post_123", { schedule: "now" }, __v);
1514
1644
  * ```
1645
+ *
1646
+ * @param version - The post's `__v` as you read it. A stale one throws `ConflictError`.
1647
+ * @returns `{ _id, __v }`, `__v` being the new version
1515
1648
  */
1516
- reschedulePost(id: string, data: IReschedulePostRequest): Promise<void>;
1649
+ reschedulePost(id: string, data: IReschedulePostRequest, version: number): Promise<{
1650
+ _id: string;
1651
+ __v: number;
1652
+ }>;
1517
1653
  /**
1518
1654
  * Delete a post that has not published yet, releasing its uploaded media in
1519
1655
  * the same request.
@@ -1524,10 +1660,12 @@ declare class SocialPublisherPostClient {
1524
1660
  *
1525
1661
  * @example
1526
1662
  * ```ts
1527
- * await client.deletePost("post_123");
1663
+ * await client.deletePost("post_123", post.__v);
1528
1664
  * ```
1665
+ *
1666
+ * @param version - The post's `__v` as you read it. A stale one throws `ConflictError`.
1529
1667
  */
1530
- deletePost(id: string): Promise<void>;
1668
+ deletePost(id: string, version: number): Promise<void>;
1531
1669
  /**
1532
1670
  * Upload a long video and return the URL to publish from.
1533
1671
  *
@@ -1631,4 +1769,4 @@ declare function terminateUpload(uploadUrl: string): Promise<boolean>;
1631
1769
  */
1632
1770
  declare function uploadResumable(target: IUploadTarget, file: Blob, options?: IResumableUploadOptions): Promise<string>;
1633
1771
 
1634
- export { type CommentStatusType, DEFAULT_CHUNK_SIZE, type IAccountPostSetting, type IBaseStatusHistoryGroupedDay, type IBaseStatusHistoryGroupedItem, type ICommentInfoDTO, type ICommentRequest, type ICommentStatusDTO, type ICreateImagePostToAccountRequest, type ICreateImagePostToWorkspaceRequest, type ICreateSocialPublisherAccountPostRequest, type ICreateSocialPublisherPostRequest, type IDefaultSettingsResponse, type IFacebookPageConfig, type IGenerateUploadUrlsRequest, type IGenerateUploadUrlsResponse, type IImageDTO, type IImageMediaRequest, type IInstagramConfig, type IListParams, type ILongVideoPlatformVerdict, type ILongVideoQuoteResponse, type ILongVideoRefusedTarget, type ILongVideoUploadControls, type IPostSetting, 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 ITikTokConfig, 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 };
1772
+ 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 };