@zernio/node 0.2.146 → 0.2.147
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 +7 -0
- package/dist/index.d.ts +7 -0
- package/package.json +1 -1
- package/src/generated/sdk.gen.ts +18 -2
- package/src/generated/types.gen.ts +7 -0
package/dist/index.d.mts
CHANGED
|
@@ -6141,6 +6141,13 @@ type CreatePostData = {
|
|
|
6141
6141
|
*/
|
|
6142
6142
|
queueId?: string;
|
|
6143
6143
|
};
|
|
6144
|
+
headers?: {
|
|
6145
|
+
/**
|
|
6146
|
+
* 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.
|
|
6147
|
+
*
|
|
6148
|
+
*/
|
|
6149
|
+
'x-request-id'?: string;
|
|
6150
|
+
};
|
|
6144
6151
|
};
|
|
6145
6152
|
type CreatePostResponse = (PostCreateResponse);
|
|
6146
6153
|
type CreatePostError = ({
|
package/dist/index.d.ts
CHANGED
|
@@ -6141,6 +6141,13 @@ type CreatePostData = {
|
|
|
6141
6141
|
*/
|
|
6142
6142
|
queueId?: string;
|
|
6143
6143
|
};
|
|
6144
|
+
headers?: {
|
|
6145
|
+
/**
|
|
6146
|
+
* 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.
|
|
6147
|
+
*
|
|
6148
|
+
*/
|
|
6149
|
+
'x-request-id'?: string;
|
|
6150
|
+
};
|
|
6144
6151
|
};
|
|
6145
6152
|
type CreatePostResponse = (PostCreateResponse);
|
|
6146
6153
|
type CreatePostError = ({
|
package/package.json
CHANGED
package/src/generated/sdk.gen.ts
CHANGED
|
@@ -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
|
|
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>) => {
|
|
@@ -5797,6 +5797,13 @@ export type CreatePostData = {
|
|
|
5797
5797
|
*/
|
|
5798
5798
|
queueId?: string;
|
|
5799
5799
|
};
|
|
5800
|
+
headers?: {
|
|
5801
|
+
/**
|
|
5802
|
+
* 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.
|
|
5803
|
+
*
|
|
5804
|
+
*/
|
|
5805
|
+
'x-request-id'?: string;
|
|
5806
|
+
};
|
|
5800
5807
|
};
|
|
5801
5808
|
|
|
5802
5809
|
export type CreatePostResponse = (PostCreateResponse);
|