@zernio/node 0.2.1520 → 0.2.1522

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
@@ -18874,13 +18874,17 @@ type TikTokPlatformData = {
18874
18874
  */
18875
18875
  mediaType?: 'video' | 'photo';
18876
18876
  /**
18877
- * Optional for video posts. Timestamp in milliseconds to select which frame to use as thumbnail (defaults to 1000ms/1 second). Ignored when videoCoverImageUrl is provided.
18877
+ * Optional for video posts. Timestamp in milliseconds to select which frame to use as thumbnail (defaults to 1000ms/1 second). Ignored when the videoCoverImageUrl image becomes the cover, and used when Zernio skips that image (see videoCoverImageUrl).
18878
18878
  */
18879
18879
  videoCoverTimestampMs?: number;
18880
18880
  /**
18881
18881
  * Optional for video posts. URL of a custom thumbnail image (JPG, PNG, or WebP, max 20MB). Any downloadable URL works: we rehost it ourselves. Overrides videoCoverTimestampMs when provided.
18882
18882
  *
18883
- * The image is stitched as a single frame at the start of the video to serve as the cover. Accounts connected through the TikTok for Business app instead hand it to TikTok as the cover, with no stitching, falling back to videoCoverTimestampMs without it.
18883
+ * The image is stitched as a single frame at the start of the video to serve as the cover.
18884
+ *
18885
+ * When the image shape is far from the video shape (it would fill less than half of the frame, for example a landscape cover on a vertical video), or the stitch fails, Zernio skips the image and TikTok uses videoCoverTimestampMs.
18886
+ *
18887
+ * Accounts connected through the TikTok for Business app instead hand it to TikTok as the cover, with no stitching, falling back to videoCoverTimestampMs without it.
18884
18888
  *
18885
18889
  */
18886
18890
  videoCoverImageUrl?: string;
@@ -25985,6 +25989,10 @@ type ValidatePostResponse = (({
25985
25989
  errors?: Array<{
25986
25990
  platform?: string;
25987
25991
  error?: string;
25992
+ /**
25993
+ * Present on media errors. MEDIA_UNDECODABLE means the bytes at the URL are not a valid image, video or PDF.
25994
+ */
25995
+ code?: 'MEDIA_UNDECODABLE';
25988
25996
  }>;
25989
25997
  warnings?: Array<{
25990
25998
  platform?: string;
@@ -26007,13 +26015,39 @@ type ValidateMediaResponse = ({
26007
26015
  * Error message if valid is false
26008
26016
  */
26009
26017
  error?: string;
26018
+ /**
26019
+ * Stable reason when valid is false. MEDIA_UNDECODABLE: the bytes are not a valid image, video or PDF. MEDIA_URL_UNREACHABLE: HTTP error, timeout or network failure. MEDIA_URL_NOT_ALLOWED: not a public HTTP(S) URL.
26020
+ */
26021
+ code?: 'MEDIA_UNDECODABLE' | 'MEDIA_URL_UNREACHABLE' | 'MEDIA_URL_NOT_ALLOWED';
26022
+ /**
26023
+ * Content-Type header the server sent (may disagree with the detected format)
26024
+ */
26010
26025
  contentType?: string;
26011
26026
  /**
26012
26027
  * File size in bytes
26013
26028
  */
26014
26029
  size?: (number) | null;
26015
26030
  sizeFormatted?: string;
26016
- type?: 'image' | 'video' | 'unknown';
26031
+ /**
26032
+ * Detected from the file bytes
26033
+ */
26034
+ type?: 'image' | 'video' | 'document';
26035
+ /**
26036
+ * Detected format (jpeg, png, webp, gif, heif, mp4, mov, webm, pdf, ...)
26037
+ */
26038
+ format?: string;
26039
+ /**
26040
+ * Image width in pixels (images only)
26041
+ */
26042
+ width?: number;
26043
+ /**
26044
+ * Image height in pixels (images only)
26045
+ */
26046
+ height?: number;
26047
+ /**
26048
+ * How deeply the content was verified. decoded: every pixel decoded. header: file signature and header verified (videos, PDFs, HEIC/AVIF, images over 32 MB).
26049
+ */
26050
+ inspection?: 'decoded' | 'header';
26017
26051
  /**
26018
26052
  * Per-platform size limit comparison (only present when size and type are known)
26019
26053
  */
package/dist/index.d.ts CHANGED
@@ -18874,13 +18874,17 @@ type TikTokPlatformData = {
18874
18874
  */
18875
18875
  mediaType?: 'video' | 'photo';
18876
18876
  /**
18877
- * Optional for video posts. Timestamp in milliseconds to select which frame to use as thumbnail (defaults to 1000ms/1 second). Ignored when videoCoverImageUrl is provided.
18877
+ * Optional for video posts. Timestamp in milliseconds to select which frame to use as thumbnail (defaults to 1000ms/1 second). Ignored when the videoCoverImageUrl image becomes the cover, and used when Zernio skips that image (see videoCoverImageUrl).
18878
18878
  */
18879
18879
  videoCoverTimestampMs?: number;
18880
18880
  /**
18881
18881
  * Optional for video posts. URL of a custom thumbnail image (JPG, PNG, or WebP, max 20MB). Any downloadable URL works: we rehost it ourselves. Overrides videoCoverTimestampMs when provided.
18882
18882
  *
18883
- * The image is stitched as a single frame at the start of the video to serve as the cover. Accounts connected through the TikTok for Business app instead hand it to TikTok as the cover, with no stitching, falling back to videoCoverTimestampMs without it.
18883
+ * The image is stitched as a single frame at the start of the video to serve as the cover.
18884
+ *
18885
+ * When the image shape is far from the video shape (it would fill less than half of the frame, for example a landscape cover on a vertical video), or the stitch fails, Zernio skips the image and TikTok uses videoCoverTimestampMs.
18886
+ *
18887
+ * Accounts connected through the TikTok for Business app instead hand it to TikTok as the cover, with no stitching, falling back to videoCoverTimestampMs without it.
18884
18888
  *
18885
18889
  */
18886
18890
  videoCoverImageUrl?: string;
@@ -25985,6 +25989,10 @@ type ValidatePostResponse = (({
25985
25989
  errors?: Array<{
25986
25990
  platform?: string;
25987
25991
  error?: string;
25992
+ /**
25993
+ * Present on media errors. MEDIA_UNDECODABLE means the bytes at the URL are not a valid image, video or PDF.
25994
+ */
25995
+ code?: 'MEDIA_UNDECODABLE';
25988
25996
  }>;
25989
25997
  warnings?: Array<{
25990
25998
  platform?: string;
@@ -26007,13 +26015,39 @@ type ValidateMediaResponse = ({
26007
26015
  * Error message if valid is false
26008
26016
  */
26009
26017
  error?: string;
26018
+ /**
26019
+ * Stable reason when valid is false. MEDIA_UNDECODABLE: the bytes are not a valid image, video or PDF. MEDIA_URL_UNREACHABLE: HTTP error, timeout or network failure. MEDIA_URL_NOT_ALLOWED: not a public HTTP(S) URL.
26020
+ */
26021
+ code?: 'MEDIA_UNDECODABLE' | 'MEDIA_URL_UNREACHABLE' | 'MEDIA_URL_NOT_ALLOWED';
26022
+ /**
26023
+ * Content-Type header the server sent (may disagree with the detected format)
26024
+ */
26010
26025
  contentType?: string;
26011
26026
  /**
26012
26027
  * File size in bytes
26013
26028
  */
26014
26029
  size?: (number) | null;
26015
26030
  sizeFormatted?: string;
26016
- type?: 'image' | 'video' | 'unknown';
26031
+ /**
26032
+ * Detected from the file bytes
26033
+ */
26034
+ type?: 'image' | 'video' | 'document';
26035
+ /**
26036
+ * Detected format (jpeg, png, webp, gif, heif, mp4, mov, webm, pdf, ...)
26037
+ */
26038
+ format?: string;
26039
+ /**
26040
+ * Image width in pixels (images only)
26041
+ */
26042
+ width?: number;
26043
+ /**
26044
+ * Image height in pixels (images only)
26045
+ */
26046
+ height?: number;
26047
+ /**
26048
+ * How deeply the content was verified. decoded: every pixel decoded. header: file signature and header verified (videos, PDFs, HEIC/AVIF, images over 32 MB).
26049
+ */
26050
+ inspection?: 'decoded' | 'header';
26017
26051
  /**
26018
26052
  * Per-platform size limit comparison (only present when size and type are known)
26019
26053
  */
package/dist/index.js CHANGED
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(index_exports);
36
36
  // package.json
37
37
  var package_default = {
38
38
  name: "@zernio/node",
39
- version: "0.2.1520",
39
+ version: "0.2.1522",
40
40
  description: "The official Node.js library for the Zernio API",
41
41
  main: "dist/index.js",
42
42
  module: "dist/index.mjs",
package/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
5
5
  // package.json
6
6
  var package_default = {
7
7
  name: "@zernio/node",
8
- version: "0.2.1520",
8
+ version: "0.2.1522",
9
9
  description: "The official Node.js library for the Zernio API",
10
10
  main: "dist/index.js",
11
11
  module: "dist/index.mjs",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zernio/node",
3
- "version": "0.2.1520",
3
+ "version": "0.2.1522",
4
4
  "description": "The official Node.js library for the Zernio API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -43,7 +43,9 @@ export const validatePostLength = <ThrowOnError extends boolean = false>(options
43
43
  * Validate post content
44
44
  * Dry-run the full post validation pipeline without publishing. Catches issues like missing media for Instagram/TikTok/YouTube, hashtag limits, invalid thread formats, Facebook Reel requirements, and character limit violations.
45
45
  *
46
- * Accepts the same body as POST /v1/posts. Does NOT validate accounts, process media, or track usage. Account lookups are limit-only: a twitter accountId is resolved, scoped to the caller, only to pick the 280 vs 25000 character limit. Missing, foreign, or invalid ids fall back to 280 and never error.
46
+ * Accepts the same body as POST /v1/posts. Does NOT validate accounts, transform media, or track usage. Account lookups are limit-only: a twitter accountId is resolved, scoped to the caller, only to pick the 280 vs 25000 character limit. Missing, foreign, or invalid ids fall back to 280 and never error.
47
+ *
48
+ * Every image, gif and video URL in `mediaItems` and `customMedia` is fetched and checked: a file that is not a real image, video or PDF (wrong bytes, truncated, corrupt) is an error with code `MEDIA_UNDECODABLE`. Images are checked at header level (the full file is decoded only when the header is not enough); use POST /v1/tools/validate/media for a full pixel decode. A URL our servers cannot fetch is reported as a warning, not an error, because the platform may still reach it.
47
49
  *
48
50
  * Returns errors for failures and warnings for near-limit content (>90% of character limit).
49
51
  *
@@ -57,9 +59,9 @@ export const validatePost = <ThrowOnError extends boolean = false>(options: Opti
57
59
 
58
60
  /**
59
61
  * Validate media URL
60
- * Check if a media URL is accessible and return metadata (content type, file size) plus per-platform size limit comparisons.
62
+ * Check that a media URL is reachable and that its bytes are a real image, video or PDF, then return metadata (detected format, file size, dimensions) plus per-platform size limit comparisons.
61
63
  *
62
- * Performs a HEAD request (with GET fallback) to detect content type and size. Rejects private/localhost URLs for SSRF protection.
64
+ * `valid: true` means the content was verified, not just the extension or Content-Type. Images up to 32 MB are fully decoded (`inspection: decoded`); videos, PDFs and larger images are verified by their file signature and header (`inspection: header`). The type and format come from the bytes, not the Content-Type header. Corrupt, truncated or non-media files return `valid: false` with code `MEDIA_UNDECODABLE`. Rejects private/localhost URLs for SSRF protection.
63
65
  *
64
66
  * Platform limits are sourced from each platform's actual upload constraints.
65
67
  *
@@ -17288,13 +17288,17 @@ export type TikTokPlatformData = {
17288
17288
  */
17289
17289
  mediaType?: 'video' | 'photo';
17290
17290
  /**
17291
- * Optional for video posts. Timestamp in milliseconds to select which frame to use as thumbnail (defaults to 1000ms/1 second). Ignored when videoCoverImageUrl is provided.
17291
+ * Optional for video posts. Timestamp in milliseconds to select which frame to use as thumbnail (defaults to 1000ms/1 second). Ignored when the videoCoverImageUrl image becomes the cover, and used when Zernio skips that image (see videoCoverImageUrl).
17292
17292
  */
17293
17293
  videoCoverTimestampMs?: number;
17294
17294
  /**
17295
17295
  * Optional for video posts. URL of a custom thumbnail image (JPG, PNG, or WebP, max 20MB). Any downloadable URL works: we rehost it ourselves. Overrides videoCoverTimestampMs when provided.
17296
17296
  *
17297
- * The image is stitched as a single frame at the start of the video to serve as the cover. Accounts connected through the TikTok for Business app instead hand it to TikTok as the cover, with no stitching, falling back to videoCoverTimestampMs without it.
17297
+ * The image is stitched as a single frame at the start of the video to serve as the cover.
17298
+ *
17299
+ * When the image shape is far from the video shape (it would fill less than half of the frame, for example a landscape cover on a vertical video), or the stitch fails, Zernio skips the image and TikTok uses videoCoverTimestampMs.
17300
+ *
17301
+ * Accounts connected through the TikTok for Business app instead hand it to TikTok as the cover, with no stitching, falling back to videoCoverTimestampMs without it.
17298
17302
  *
17299
17303
  */
17300
17304
  videoCoverImageUrl?: string;
@@ -24712,6 +24716,10 @@ export type ValidatePostResponse = (({
24712
24716
  errors?: Array<{
24713
24717
  platform?: string;
24714
24718
  error?: string;
24719
+ /**
24720
+ * Present on media errors. MEDIA_UNDECODABLE means the bytes at the URL are not a valid image, video or PDF.
24721
+ */
24722
+ code?: 'MEDIA_UNDECODABLE';
24715
24723
  }>;
24716
24724
  warnings?: Array<{
24717
24725
  platform?: string;
@@ -24737,13 +24745,39 @@ export type ValidateMediaResponse = ({
24737
24745
  * Error message if valid is false
24738
24746
  */
24739
24747
  error?: string;
24748
+ /**
24749
+ * Stable reason when valid is false. MEDIA_UNDECODABLE: the bytes are not a valid image, video or PDF. MEDIA_URL_UNREACHABLE: HTTP error, timeout or network failure. MEDIA_URL_NOT_ALLOWED: not a public HTTP(S) URL.
24750
+ */
24751
+ code?: 'MEDIA_UNDECODABLE' | 'MEDIA_URL_UNREACHABLE' | 'MEDIA_URL_NOT_ALLOWED';
24752
+ /**
24753
+ * Content-Type header the server sent (may disagree with the detected format)
24754
+ */
24740
24755
  contentType?: string;
24741
24756
  /**
24742
24757
  * File size in bytes
24743
24758
  */
24744
24759
  size?: (number) | null;
24745
24760
  sizeFormatted?: string;
24746
- type?: 'image' | 'video' | 'unknown';
24761
+ /**
24762
+ * Detected from the file bytes
24763
+ */
24764
+ type?: 'image' | 'video' | 'document';
24765
+ /**
24766
+ * Detected format (jpeg, png, webp, gif, heif, mp4, mov, webm, pdf, ...)
24767
+ */
24768
+ format?: string;
24769
+ /**
24770
+ * Image width in pixels (images only)
24771
+ */
24772
+ width?: number;
24773
+ /**
24774
+ * Image height in pixels (images only)
24775
+ */
24776
+ height?: number;
24777
+ /**
24778
+ * How deeply the content was verified. decoded: every pixel decoded. header: file signature and header verified (videos, PDFs, HEIC/AVIF, images over 32 MB).
24779
+ */
24780
+ inspection?: 'decoded' | 'header';
24747
24781
  /**
24748
24782
  * Per-platform size limit comparison (only present when size and type are known)
24749
24783
  */