@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.mjs CHANGED
@@ -12011,7 +12011,7 @@ var require_follow_redirects = __commonJS({
12011
12011
  return URL2 && value instanceof URL2;
12012
12012
  }
12013
12013
  function escapeRegex(regex) {
12014
- return regex.replace(/[[\]\\/()*+?.^$|]/g, "\\$&");
12014
+ return regex.replace(/[\^$\\.*+?()[\]{}|]/g, "\\$&");
12015
12015
  }
12016
12016
  module.exports = wrap({ http: http3, https: https2 });
12017
12017
  module.exports.wrap = wrap;
@@ -14119,7 +14119,7 @@ var import_https_proxy_agent = __toESM(require_dist());
14119
14119
  var import_follow_redirects = __toESM(require_follow_redirects());
14120
14120
 
14121
14121
  // ../node_modules/axios/lib/env/data.js
14122
- var VERSION = "1.21.0";
14122
+ var VERSION = "1.21.1";
14123
14123
 
14124
14124
  // ../node_modules/axios/lib/helpers/parseProtocol.js
14125
14125
  function parseProtocol(url2) {
@@ -17596,8 +17596,11 @@ function throwIfCancellationRequested(config) {
17596
17596
  throw new CanceledError_default(null, config);
17597
17597
  }
17598
17598
  }
17599
- function elapsedSince(start) {
17600
- return Math.max(0, Date.now() - start);
17599
+ function resolveClock() {
17600
+ return typeof performance !== "undefined" && utils_default.isFunction(performance.now) ? () => performance.now() : Date.now;
17601
+ }
17602
+ function elapsedSince(now, start) {
17603
+ return Math.max(0, Math.round(now() - start));
17601
17604
  }
17602
17605
  function dispatchRequest(_config) {
17603
17606
  const config = utils_default.toSafeFlatObject(_config);
@@ -17608,11 +17611,12 @@ function dispatchRequest(_config) {
17608
17611
  config.headers.setContentType("application/x-www-form-urlencoded", false);
17609
17612
  }
17610
17613
  const adapter2 = adapters_default.getAdapter(config.adapter || defaults_default.adapter, config);
17611
- const start = Date.now();
17614
+ const now = resolveClock();
17615
+ const start = now();
17612
17616
  return adapter2(config).then(
17613
17617
  function onAdapterResolution(response) {
17614
17618
  throwIfCancellationRequested(config);
17615
- response.duration = elapsedSince(start);
17619
+ response.duration = elapsedSince(now, start);
17616
17620
  config.response = response;
17617
17621
  try {
17618
17622
  response.data = transformData.call(config, config.transformResponse, response);
@@ -17626,7 +17630,7 @@ function dispatchRequest(_config) {
17626
17630
  if (!isCancel(reason)) {
17627
17631
  throwIfCancellationRequested(config);
17628
17632
  if (reason && reason.response) {
17629
- reason.response.duration = elapsedSince(start);
17633
+ reason.response.duration = elapsedSince(now, start);
17630
17634
  config.response = reason.response;
17631
17635
  try {
17632
17636
  reason.response.data = transformData.call(
@@ -19151,7 +19155,15 @@ var SocialPublisherPostClient = class {
19151
19155
  * cannot be removed programmatically and no credits are charged.
19152
19156
  *
19153
19157
  * @param id - Post ID
19158
+ * Pass `platform` to remove the post from that one platform only. The other
19159
+ * platforms keep their copies and the post becomes `partiallyRemoved`. The
19160
+ * post must have been published there (platform status `done` or
19161
+ * `removeFailed`), or the API refuses the call. A `partiallyRemoved` post can
19162
+ * be removed again. Needs the API with per-platform removal.
19163
+ *
19164
+ * @param id - Post ID
19154
19165
  * @param version - The post's `__v` as you read it. A stale one throws `ConflictError`.
19166
+ * @param platform - Optional (5.2.0): remove from this platform only. Omit to remove from every platform.
19155
19167
  * @returns Per-platform removal results, `__v` set to the post's new version
19156
19168
  *
19157
19169
  * @example
@@ -19159,11 +19171,15 @@ var SocialPublisherPostClient = class {
19159
19171
  * const post = await client.getStatus("post_123");
19160
19172
  * const { results } = await client.removePost("post_123", post.__v);
19161
19173
  * // results.youtube?.success === true
19174
+ *
19175
+ * // Only the YouTube copy:
19176
+ * await client.removePost("post_123", post.__v, "youtube");
19162
19177
  * ```
19163
19178
  */
19164
- async removePost(id, version) {
19179
+ async removePost(id, version, platform) {
19165
19180
  assertVersion(version);
19166
- const response = await this.http.post(`${this.basePath}/${encodeURIComponent(id)}/remove`, {}, { version });
19181
+ const body = platform ? { platform } : {};
19182
+ const response = await this.http.post(`${this.basePath}/${encodeURIComponent(id)}/remove`, body, { version });
19167
19183
  return withVersion(response, id);
19168
19184
  }
19169
19185
  /**
@@ -19487,7 +19503,9 @@ var SocialPublisherPostClient = class {
19487
19503
  source: "video-file",
19488
19504
  tag: options.tag,
19489
19505
  refId: options.refId,
19490
- comment: options.comment
19506
+ comment: options.comment,
19507
+ comments: options.comments,
19508
+ allowPostDefaultComments: options.allowPostDefaultComments
19491
19509
  };
19492
19510
  const source = this.detectVideoSource(options.video);
19493
19511
  switch (source) {
@@ -19532,7 +19550,9 @@ var SocialPublisherPostClient = class {
19532
19550
  source: "video-file",
19533
19551
  tag: options.tag,
19534
19552
  refId: options.refId,
19535
- comment: options.comment
19553
+ comment: options.comment,
19554
+ comments: options.comments,
19555
+ allowPostDefaultComments: options.allowPostDefaultComments
19536
19556
  };
19537
19557
  switch (source) {
19538
19558
  case "file": {
@@ -19645,7 +19665,9 @@ var SocialPublisherPostClient = class {
19645
19665
  thumbURL: thumb?.thumbFileURL,
19646
19666
  tag: options.tag,
19647
19667
  refId: options.refId,
19648
- comment: options.comment
19668
+ comment: options.comment,
19669
+ comments: options.comments,
19670
+ allowPostDefaultComments: options.allowPostDefaultComments
19649
19671
  };
19650
19672
  const target = isFile2 ? "by-file" : "by-url";
19651
19673
  const id = postId ?? thumb?.postId;
@@ -19697,7 +19719,9 @@ var SocialPublisherPostClient = class {
19697
19719
  thumbURL: thumb?.thumbFileURL,
19698
19720
  tag: options.tag,
19699
19721
  refId: options.refId,
19700
- comment: options.comment
19722
+ comment: options.comment,
19723
+ comments: options.comments,
19724
+ allowPostDefaultComments: options.allowPostDefaultComments
19701
19725
  };
19702
19726
  const target = isFile2 ? "by-file" : "by-url";
19703
19727
  const id = postId ?? thumb?.postId;
@@ -19837,7 +19861,9 @@ var SocialPublisherPostClient = class {
19837
19861
  };
19838
19862
 
19839
19863
  // src/interfaces/requests/index.ts
19840
- var MAX_POST_COMMENTS = 5;
19864
+ var MAX_POST_COMMENTS_PER_PLATFORM = 10;
19865
+ var MAX_POST_COMMENTS_TOTAL = 30;
19866
+ var MAX_POST_COMMENTS = MAX_POST_COMMENTS_PER_PLATFORM;
19841
19867
  var MAX_COMMENT_LENGTH = 2200;
19842
19868
  var MAX_COMMENT_DELAY_MINUTES = 24 * 60;
19843
19869
  var LONG_VIDEO_MAX_DURATION_SECONDS = 3600;
@@ -19861,6 +19887,6 @@ mime-types/index.js:
19861
19887
  *)
19862
19888
  */
19863
19889
 
19864
- export { DEFAULT_CHUNK_SIZE2 as DEFAULT_CHUNK_SIZE, HttpClient, LONG_VIDEO_CREDIT_UNIT_SECONDS, LONG_VIDEO_MAX_DURATION_SECONDS, MAX_COMMENT_DELAY_MINUTES, MAX_COMMENT_LENGTH, MAX_POST_COMMENTS, SocialPublisherPostClient, supportsResumableUpload, terminateUpload, uploadResumable, uploadToR2 };
19890
+ export { DEFAULT_CHUNK_SIZE2 as DEFAULT_CHUNK_SIZE, HttpClient, 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, SocialPublisherPostClient, supportsResumableUpload, terminateUpload, uploadResumable, uploadToR2 };
19865
19891
  //# sourceMappingURL=index.mjs.map
19866
19892
  //# sourceMappingURL=index.mjs.map