@zernio/node 0.2.146 → 0.2.148

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.mts CHANGED
@@ -1822,7 +1822,7 @@ type ErrorResponse = {
1822
1822
  };
1823
1823
  };
1824
1824
  /**
1825
- * Feed posts support up to 10 images (no mixed video+image). Stories require single media (24h, no captions). Reels require single vertical video (9:16, 3-60s). Geo-restriction is a hard visibility restriction: users outside the specified countries cannot see the post. Not supported for stories.
1825
+ * Feed posts support up to 10 images (no mixed video+image). Stories require single media (24h, no captions). Reels require single vertical video (9:16, 3-60s). Carousel posts (carouselCards) render a 2-5 card multi-link post, images only, mutually exclusive with story/reel. Geo-restriction is a hard visibility restriction: users outside the specified countries cannot see the post. Not supported for stories.
1826
1826
  *
1827
1827
  */
1828
1828
  type FacebookPlatformData = {
@@ -1847,6 +1847,29 @@ type FacebookPlatformData = {
1847
1847
  */
1848
1848
  pageId?: string;
1849
1849
  geoRestriction?: GeoRestriction;
1850
+ /**
1851
+ * Renders the post as a multi-link carousel (organic Page post). When set, mediaItems must be provided with the same length and all items must be images (no videos). Each cards[i] adds the click-through link and headline for the image at mediaItems[i]. Mutually exclusive with contentType=story|reel. Facebook display truncates name at ~35 chars and description at ~30 chars; longer strings are accepted but get truncated on render.
1852
+ *
1853
+ */
1854
+ carouselCards?: Array<{
1855
+ /**
1856
+ * Per-card click destination (required).
1857
+ */
1858
+ link: string;
1859
+ /**
1860
+ * Per-card headline (optional, ~35-char display).
1861
+ */
1862
+ name?: string;
1863
+ /**
1864
+ * Per-card subhead (optional, ~30-char display).
1865
+ */
1866
+ description?: string;
1867
+ }>;
1868
+ /**
1869
+ * Optional top-level "See more" destination shown on the carousel end card. Defaults to the first card's link when omitted. Only used together with carouselCards.
1870
+ *
1871
+ */
1872
+ carouselLink?: string;
1850
1873
  };
1851
1874
  /**
1852
1875
  * Set to 'story' for Page Stories (24h ephemeral) or 'reel' for Reels (short vertical video). Defaults to feed post if omitted.
@@ -6141,6 +6164,13 @@ type CreatePostData = {
6141
6164
  */
6142
6165
  queueId?: string;
6143
6166
  };
6167
+ headers?: {
6168
+ /**
6169
+ * Optional client-generated request identifier for safe retry (idempotency). When two requests carry the same value, the second is treated as a retry of the first and returns the original post (HTTP 200) instead of creating a duplicate. Window is ~5 minutes from the first request. Generate a UUID per logical call. SDKs do this automatically; HTTP clients should set it themselves or omit it. See the operation description for the full idempotency contract.
6170
+ *
6171
+ */
6172
+ 'x-request-id'?: string;
6173
+ };
6144
6174
  };
6145
6175
  type CreatePostResponse = (PostCreateResponse);
6146
6176
  type CreatePostError = ({
package/dist/index.d.ts CHANGED
@@ -1822,7 +1822,7 @@ type ErrorResponse = {
1822
1822
  };
1823
1823
  };
1824
1824
  /**
1825
- * Feed posts support up to 10 images (no mixed video+image). Stories require single media (24h, no captions). Reels require single vertical video (9:16, 3-60s). Geo-restriction is a hard visibility restriction: users outside the specified countries cannot see the post. Not supported for stories.
1825
+ * Feed posts support up to 10 images (no mixed video+image). Stories require single media (24h, no captions). Reels require single vertical video (9:16, 3-60s). Carousel posts (carouselCards) render a 2-5 card multi-link post, images only, mutually exclusive with story/reel. Geo-restriction is a hard visibility restriction: users outside the specified countries cannot see the post. Not supported for stories.
1826
1826
  *
1827
1827
  */
1828
1828
  type FacebookPlatformData = {
@@ -1847,6 +1847,29 @@ type FacebookPlatformData = {
1847
1847
  */
1848
1848
  pageId?: string;
1849
1849
  geoRestriction?: GeoRestriction;
1850
+ /**
1851
+ * Renders the post as a multi-link carousel (organic Page post). When set, mediaItems must be provided with the same length and all items must be images (no videos). Each cards[i] adds the click-through link and headline for the image at mediaItems[i]. Mutually exclusive with contentType=story|reel. Facebook display truncates name at ~35 chars and description at ~30 chars; longer strings are accepted but get truncated on render.
1852
+ *
1853
+ */
1854
+ carouselCards?: Array<{
1855
+ /**
1856
+ * Per-card click destination (required).
1857
+ */
1858
+ link: string;
1859
+ /**
1860
+ * Per-card headline (optional, ~35-char display).
1861
+ */
1862
+ name?: string;
1863
+ /**
1864
+ * Per-card subhead (optional, ~30-char display).
1865
+ */
1866
+ description?: string;
1867
+ }>;
1868
+ /**
1869
+ * Optional top-level "See more" destination shown on the carousel end card. Defaults to the first card's link when omitted. Only used together with carouselCards.
1870
+ *
1871
+ */
1872
+ carouselLink?: string;
1850
1873
  };
1851
1874
  /**
1852
1875
  * Set to 'story' for Page Stories (24h ephemeral) or 'reel' for Reels (short vertical video). Defaults to feed post if omitted.
@@ -6141,6 +6164,13 @@ type CreatePostData = {
6141
6164
  */
6142
6165
  queueId?: string;
6143
6166
  };
6167
+ headers?: {
6168
+ /**
6169
+ * Optional client-generated request identifier for safe retry (idempotency). When two requests carry the same value, the second is treated as a retry of the first and returns the original post (HTTP 200) instead of creating a duplicate. Window is ~5 minutes from the first request. Generate a UUID per logical call. SDKs do this automatically; HTTP clients should set it themselves or omit it. See the operation description for the full idempotency contract.
6170
+ *
6171
+ */
6172
+ 'x-request-id'?: string;
6173
+ };
6144
6174
  };
6145
6175
  type CreatePostResponse = (PostCreateResponse);
6146
6176
  type CreatePostError = ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zernio/node",
3
- "version": "0.2.146",
3
+ "version": "0.2.148",
4
4
  "description": "The official Node.js library for the Zernio API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -510,8 +510,24 @@ export const listPosts = <ThrowOnError extends boolean = false>(options?: Option
510
510
 
511
511
  /**
512
512
  * Create post
513
- * Create and optionally publish a post. Immediate posts (publishNow: true) include platformPostUrl in the response.
514
- * Content is optional when media is attached or all platforms have customContent. See each platform's schema for media constraints.
513
+ * Create and optionally publish a post. Immediate posts (`publishNow: true`) include `platformPostUrl` in the response.
514
+ * Content is optional when media is attached or all platforms have `customContent`. See each platform's schema for media constraints.
515
+ *
516
+ * ## Idempotency
517
+ *
518
+ * Two layers of duplicate-protection apply, so safe-to-retry callers (network blips, n8n / Zapier retries, etc.) don't accidentally double-post.
519
+ *
520
+ * **1. Same-request idempotency (5-minute window).**
521
+ * Pass an `x-request-id` header to mark a logical request. If a second request arrives with the same `x-request-id` while the first is in-flight (or within ~5 minutes of completion), we return **HTTP 200** with the original post in the `existingPost` field — no new post is created. The official Zernio SDKs auto-generate a unique `x-request-id` per call. If you're using a generic HTTP client (curl, n8n's HTTP node, Zapier, custom code), either:
522
+ * - Set a unique `x-request-id` per logical call (recommended — UUIDv4 is fine)
523
+ * - Or simply omit the header — we'll treat each request as new
524
+ *
525
+ * **Common pitfall**: if your workflow tool uses a single execution-level request ID and reuses it across multiple HTTP nodes (e.g. one ID for the whole run, shared across 6 different platform calls), every call after the first will look like a retry of the first and return its post. Generate a fresh ID per node.
526
+ *
527
+ * **2. Content-hash dedup (24-hour window).**
528
+ * Independently, we hash `(platform, accountId, content + media URLs)` and reject duplicates within 24 hours with **HTTP 409**. This catches genuine "same content posted twice to the same account" cases regardless of `x-request-id`. Returns `error`, `accountId`, `platform`, and `existingPostId` so you can find the original. To intentionally re-post identical content within 24h, change something (the caption, the media, the account) — the dedup is keyed on the full content fingerprint.
529
+ *
530
+ * Order: same-`x-request-id` retries (200) are checked first; if no idempotency match, the content-hash dedup (409) runs.
515
531
  *
516
532
  */
517
533
  export const createPost = <ThrowOnError extends boolean = false>(options: OptionsLegacyParser<CreatePostData, ThrowOnError>) => {
@@ -1227,7 +1227,7 @@ export type ErrorResponse = {
1227
1227
  };
1228
1228
 
1229
1229
  /**
1230
- * Feed posts support up to 10 images (no mixed video+image). Stories require single media (24h, no captions). Reels require single vertical video (9:16, 3-60s). Geo-restriction is a hard visibility restriction: users outside the specified countries cannot see the post. Not supported for stories.
1230
+ * Feed posts support up to 10 images (no mixed video+image). Stories require single media (24h, no captions). Reels require single vertical video (9:16, 3-60s). Carousel posts (carouselCards) render a 2-5 card multi-link post, images only, mutually exclusive with story/reel. Geo-restriction is a hard visibility restriction: users outside the specified countries cannot see the post. Not supported for stories.
1231
1231
  *
1232
1232
  */
1233
1233
  export type FacebookPlatformData = {
@@ -1252,6 +1252,29 @@ export type FacebookPlatformData = {
1252
1252
  */
1253
1253
  pageId?: string;
1254
1254
  geoRestriction?: GeoRestriction;
1255
+ /**
1256
+ * Renders the post as a multi-link carousel (organic Page post). When set, mediaItems must be provided with the same length and all items must be images (no videos). Each cards[i] adds the click-through link and headline for the image at mediaItems[i]. Mutually exclusive with contentType=story|reel. Facebook display truncates name at ~35 chars and description at ~30 chars; longer strings are accepted but get truncated on render.
1257
+ *
1258
+ */
1259
+ carouselCards?: Array<{
1260
+ /**
1261
+ * Per-card click destination (required).
1262
+ */
1263
+ link: string;
1264
+ /**
1265
+ * Per-card headline (optional, ~35-char display).
1266
+ */
1267
+ name?: string;
1268
+ /**
1269
+ * Per-card subhead (optional, ~30-char display).
1270
+ */
1271
+ description?: string;
1272
+ }>;
1273
+ /**
1274
+ * Optional top-level "See more" destination shown on the carousel end card. Defaults to the first card's link when omitted. Only used together with carouselCards.
1275
+ *
1276
+ */
1277
+ carouselLink?: string;
1255
1278
  };
1256
1279
 
1257
1280
  /**
@@ -5797,6 +5820,13 @@ export type CreatePostData = {
5797
5820
  */
5798
5821
  queueId?: string;
5799
5822
  };
5823
+ headers?: {
5824
+ /**
5825
+ * Optional client-generated request identifier for safe retry (idempotency). When two requests carry the same value, the second is treated as a retry of the first and returns the original post (HTTP 200) instead of creating a duplicate. Window is ~5 minutes from the first request. Generate a UUID per logical call. SDKs do this automatically; HTTP clients should set it themselves or omit it. See the operation description for the full idempotency contract.
5826
+ *
5827
+ */
5828
+ 'x-request-id'?: string;
5829
+ };
5800
5830
  };
5801
5831
 
5802
5832
  export type CreatePostResponse = (PostCreateResponse);