@getlatedev/node 0.2.1208 → 0.2.1210
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 +3 -1
- package/dist/index.d.mts +43 -10
- package/dist/index.d.ts +43 -10
- package/dist/index.js +7 -3
- package/dist/index.mjs +7 -3
- package/package.json +1 -1
- package/src/client.ts +13 -5
- package/src/generated/sdk.gen.ts +1 -1
- package/src/generated/types.gen.ts +39 -5
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: "@getlatedev/node",
|
|
39
|
-
version: "0.2.
|
|
39
|
+
version: "0.2.1210",
|
|
40
40
|
description: "The official Node.js library for the Zernio API",
|
|
41
41
|
main: "dist/index.js",
|
|
42
42
|
module: "dist/index.mjs",
|
|
@@ -8128,7 +8128,8 @@ var Zernio = class _Zernio {
|
|
|
8128
8128
|
}
|
|
8129
8129
|
this.apiKey = apiKey;
|
|
8130
8130
|
this.baseURL = options.baseURL ?? "https://zernio.com/api";
|
|
8131
|
-
|
|
8131
|
+
const timeout = options.timeout ?? 3e5;
|
|
8132
|
+
this._timeout = timeout > 0 && Number.isFinite(timeout) ? Math.min(Math.ceil(timeout), 2 ** 32 - 1) : void 0;
|
|
8132
8133
|
this._client = M(
|
|
8133
8134
|
q({
|
|
8134
8135
|
baseUrl: this.baseURL,
|
|
@@ -8159,7 +8160,7 @@ var Zernio = class _Zernio {
|
|
|
8159
8160
|
* Routes a generated operation through this instance's client, preserving the
|
|
8160
8161
|
* operation's own signature. Reads `_client` when the method is called, not
|
|
8161
8162
|
* when it is bound, because class fields initialize before the constructor
|
|
8162
|
-
* body runs.
|
|
8163
|
+
* body runs. Each call gets its own timeout signal.
|
|
8163
8164
|
*/
|
|
8164
8165
|
_bind(operation) {
|
|
8165
8166
|
return ((options) => {
|
|
@@ -8167,6 +8168,9 @@ var Zernio = class _Zernio {
|
|
|
8167
8168
|
if (withClient["client"] === void 0) {
|
|
8168
8169
|
withClient["client"] = this._dispatchClient;
|
|
8169
8170
|
}
|
|
8171
|
+
if (withClient["signal"] === void 0 && this._timeout !== void 0) {
|
|
8172
|
+
withClient["signal"] = AbortSignal.timeout(this._timeout);
|
|
8173
|
+
}
|
|
8170
8174
|
return operation(withClient);
|
|
8171
8175
|
});
|
|
8172
8176
|
}
|
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: "@getlatedev/node",
|
|
8
|
-
version: "0.2.
|
|
8
|
+
version: "0.2.1210",
|
|
9
9
|
description: "The official Node.js library for the Zernio API",
|
|
10
10
|
main: "dist/index.js",
|
|
11
11
|
module: "dist/index.mjs",
|
|
@@ -8097,7 +8097,8 @@ var Zernio = class _Zernio {
|
|
|
8097
8097
|
}
|
|
8098
8098
|
this.apiKey = apiKey;
|
|
8099
8099
|
this.baseURL = options.baseURL ?? "https://zernio.com/api";
|
|
8100
|
-
|
|
8100
|
+
const timeout = options.timeout ?? 3e5;
|
|
8101
|
+
this._timeout = timeout > 0 && Number.isFinite(timeout) ? Math.min(Math.ceil(timeout), 2 ** 32 - 1) : void 0;
|
|
8101
8102
|
this._client = M(
|
|
8102
8103
|
q({
|
|
8103
8104
|
baseUrl: this.baseURL,
|
|
@@ -8128,7 +8129,7 @@ var Zernio = class _Zernio {
|
|
|
8128
8129
|
* Routes a generated operation through this instance's client, preserving the
|
|
8129
8130
|
* operation's own signature. Reads `_client` when the method is called, not
|
|
8130
8131
|
* when it is bound, because class fields initialize before the constructor
|
|
8131
|
-
* body runs.
|
|
8132
|
+
* body runs. Each call gets its own timeout signal.
|
|
8132
8133
|
*/
|
|
8133
8134
|
_bind(operation) {
|
|
8134
8135
|
return ((options) => {
|
|
@@ -8136,6 +8137,9 @@ var Zernio = class _Zernio {
|
|
|
8136
8137
|
if (withClient["client"] === void 0) {
|
|
8137
8138
|
withClient["client"] = this._dispatchClient;
|
|
8138
8139
|
}
|
|
8140
|
+
if (withClient["signal"] === void 0 && this._timeout !== void 0) {
|
|
8141
|
+
withClient["signal"] = AbortSignal.timeout(this._timeout);
|
|
8142
|
+
}
|
|
8139
8143
|
return operation(withClient);
|
|
8140
8144
|
});
|
|
8141
8145
|
}
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -983,8 +983,8 @@ export interface ClientOptions {
|
|
|
983
983
|
baseURL?: string | null | undefined;
|
|
984
984
|
|
|
985
985
|
/**
|
|
986
|
-
*
|
|
987
|
-
* @default
|
|
986
|
+
* Maximum time in milliseconds for each request, response body included. A timed-out call rejects with a `TimeoutError` DOMException. `0` or `Infinity` disables it, and a `signal` passed to a call replaces it for that call. Creates with `publishNow` publish inside the request and can take minutes.
|
|
987
|
+
* @default 300000
|
|
988
988
|
*/
|
|
989
989
|
timeout?: number;
|
|
990
990
|
|
|
@@ -1019,7 +1019,7 @@ export interface ClientOptions {
|
|
|
1019
1019
|
* ```
|
|
1020
1020
|
*/
|
|
1021
1021
|
export class Zernio {
|
|
1022
|
-
private
|
|
1022
|
+
private _timeout: number | undefined;
|
|
1023
1023
|
|
|
1024
1024
|
/**
|
|
1025
1025
|
* HTTP client owned by this instance. Every namespace method below is bound
|
|
@@ -1049,7 +1049,7 @@ export class Zernio {
|
|
|
1049
1049
|
* Routes a generated operation through this instance's client, preserving the
|
|
1050
1050
|
* operation's own signature. Reads `_client` when the method is called, not
|
|
1051
1051
|
* when it is bound, because class fields initialize before the constructor
|
|
1052
|
-
* body runs.
|
|
1052
|
+
* body runs. Each call gets its own timeout signal.
|
|
1053
1053
|
*/
|
|
1054
1054
|
private _bind<F>(operation: F): F {
|
|
1055
1055
|
return ((options?: Record<string, unknown>) => {
|
|
@@ -1057,6 +1057,10 @@ export class Zernio {
|
|
|
1057
1057
|
if (withClient['client'] === undefined) {
|
|
1058
1058
|
withClient['client'] = this._dispatchClient;
|
|
1059
1059
|
}
|
|
1060
|
+
// A caller signal replaces the timeout instead of joining it: AbortSignal.any needs Node 18.17 and engines allows 18.0.
|
|
1061
|
+
if (withClient['signal'] === undefined && this._timeout !== undefined) {
|
|
1062
|
+
withClient['signal'] = AbortSignal.timeout(this._timeout);
|
|
1063
|
+
}
|
|
1060
1064
|
return (operation as (opts: unknown) => unknown)(withClient);
|
|
1061
1065
|
}) as F;
|
|
1062
1066
|
}
|
|
@@ -3016,7 +3020,11 @@ export class Zernio {
|
|
|
3016
3020
|
|
|
3017
3021
|
this.apiKey = apiKey;
|
|
3018
3022
|
this.baseURL = options.baseURL ?? 'https://zernio.com/api';
|
|
3019
|
-
|
|
3023
|
+
// AbortSignal.timeout throws a RangeError outside uint32 integers, and `timeout` was
|
|
3024
|
+
// ignored by every earlier release, so no value an integrator already passes may start throwing.
|
|
3025
|
+
const timeout = options.timeout ?? 300000;
|
|
3026
|
+
this._timeout =
|
|
3027
|
+
timeout > 0 && Number.isFinite(timeout) ? Math.min(Math.ceil(timeout), 2 ** 32 - 1) : undefined;
|
|
3020
3028
|
|
|
3021
3029
|
// One client per instance. Interceptors used to be registered on the
|
|
3022
3030
|
// module-global client, so every `new Zernio()` stacked another auth
|
package/src/generated/sdk.gen.ts
CHANGED
|
@@ -12855,7 +12855,7 @@ export const replaceGoogleListingGroupFilters = <ThrowOnError extends boolean =
|
|
|
12855
12855
|
* **Meta required fields per shape** (a missing one is a 400 naming it in `param`):
|
|
12856
12856
|
*
|
|
12857
12857
|
* - Every shape that builds a new ad set (no `adSetId`, `existingCampaignId` or `buyingType: "RESERVED"`): `budgetAmount` and `budgetType`, plus `endDate` for a lifetime budget.
|
|
12858
|
-
* - Single image or video (the default), also with `adSetId`: `headline` (max 255), `body`, `callToAction`, exactly one of `imageUrl` / `video` (none for
|
|
12858
|
+
* - Single image or video (the default), also with `adSetId`: `headline` (max 255), `body`, `callToAction`, exactly one of `imageUrl` / `video` (none for a catalog template creative, which ignores and does not upload any sent), and `linkUrl` unless the goal is `lead_generation` or `page_visits` or `leadGenFormId` is set.
|
|
12859
12859
|
* - `bodies[]` / `headlines[]` text variations: `body`, one list with 2+ items, `callToAction`, `imageUrl` or `video`, and `linkUrl` unless the goal is `lead_generation` or `leadGenFormId` is set. `headline` is not required.
|
|
12860
12860
|
* - `placementAssets`: `headline`, `body`, `callToAction`, and `linkUrl` with the same exemptions as the single shape; the media comes from `placementAssets`.
|
|
12861
12861
|
* - `carouselCards`: `body`, `callToAction`, and `linkUrl` unless the goal is `lead_generation` or `leadGenFormId` is set. `headline` is not required.
|
|
@@ -340,6 +340,30 @@ export type Ad = {
|
|
|
340
340
|
* Meta ad creative id backing this ad. Reusable via existingCreativeId on POST /v1/ads/create.
|
|
341
341
|
*/
|
|
342
342
|
creativeId?: (string) | null;
|
|
343
|
+
/**
|
|
344
|
+
* Meta only. The creativeFeatures map sent at creation (degrees_of_freedom_spec.creative_features_spec). Absent on ads synced from Meta.
|
|
345
|
+
*/
|
|
346
|
+
creativeFeatures?: MetaCreativeFeatures;
|
|
347
|
+
/**
|
|
348
|
+
* Meta catalog template ads created through Zernio only (absent on ads synced from Meta).
|
|
349
|
+
*/
|
|
350
|
+
catalog?: {
|
|
351
|
+
/**
|
|
352
|
+
* The creative's product_set_id.
|
|
353
|
+
*/
|
|
354
|
+
productSetId?: string;
|
|
355
|
+
/**
|
|
356
|
+
* object_story_spec.template_data.format_option, from catalogFormat.
|
|
357
|
+
*/
|
|
358
|
+
format?: 'single_image' | 'carousel_images_multi_items' | 'carousel_images_single_item' | 'carousel_slideshows';
|
|
359
|
+
/**
|
|
360
|
+
* The format_transformation_spec sent on the creative, as Meta's raw objects. Present for single_image.
|
|
361
|
+
*/
|
|
362
|
+
formatTransformationSpec?: Array<{
|
|
363
|
+
format?: string;
|
|
364
|
+
data_source?: Array<(string)>;
|
|
365
|
+
}>;
|
|
366
|
+
};
|
|
343
367
|
/**
|
|
344
368
|
* Meta creative object_type (e.g. SHARE, VIDEO, PRIVACY_CHECK_FAIL, POST_DELETED). Use this to render state-aware previews: when Meta moderation strips image/video fields, only thumbnailUrl at 64x64 is available.
|
|
345
369
|
*/
|
|
@@ -501,6 +525,11 @@ export type goal = 'engagement' | 'traffic' | 'awareness' | 'video_views' | 'lea
|
|
|
501
525
|
|
|
502
526
|
export type type = 'daily' | 'lifetime';
|
|
503
527
|
|
|
528
|
+
/**
|
|
529
|
+
* object_story_spec.template_data.format_option, from catalogFormat.
|
|
530
|
+
*/
|
|
531
|
+
export type format = 'single_image' | 'carousel_images_multi_items' | 'carousel_images_single_item' | 'carousel_slideshows';
|
|
532
|
+
|
|
504
533
|
/**
|
|
505
534
|
* Request-side publish switch for `adStatus` on ad creation endpoints only (`status`, `campaignStatus` and `adSetStatus` carry their own inline ACTIVE/PAUSED enum there; the status-update endpoints are a separate lowercase `active`/`paused` enum). Distinct from `AdStatus` (the platform-reported delivery status returned on reads).
|
|
506
535
|
*/
|
|
@@ -1317,7 +1346,7 @@ export type AdPromotedObject = {
|
|
|
1317
1346
|
*/
|
|
1318
1347
|
productCatalogId?: string;
|
|
1319
1348
|
/**
|
|
1320
|
-
* Meta product SET ID, for example from GET /v1/ads/catalogs/{catalogId}/product-sets. Creating catalog ads needs only ads_management on the Meta login, not catalog_management. Zernio reads the set before creation and returns a 400 naming promotedObject.productSetId when Meta rejects the ID outright. When Meta answers that the login lacks the permission to read it (common without catalog_management, even for a set a live ad set already uses), Zernio leaves the check to Meta's own create validation, which rejects an unusable set or a catalog ID with the same 400. When the login can also read the set's catalog (catalog_management), a mismatch with productCatalogId returns a 400 naming promotedObject.productCatalogId; otherwise Meta judges the catalog match. With validateOnly and a new campaign, Meta cannot dry-run the set inside the ad set, so the adSet result carries a reason; pass existingCampaignId to dry-run it in full.
|
|
1349
|
+
* Meta product SET ID, for example from GET /v1/ads/catalogs/{catalogId}/product-sets. Creating catalog ads needs only ads_management on the Meta login, not catalog_management. With goal catalog_sales the set goes on the ad set's promoted_object and on the template creative; with goal traffic, or with adSetId, only on the creative. Zernio reads the set before creation and returns a 400 naming promotedObject.productSetId when Meta rejects the ID outright. When Meta answers that the login lacks the permission to read it (common without catalog_management, even for a set a live ad set already uses), Zernio leaves the check to Meta's own create validation, which rejects an unusable set or a catalog ID with the same 400. When the login can also read the set's catalog (catalog_management), a mismatch with productCatalogId returns a 400 naming promotedObject.productCatalogId; otherwise Meta judges the catalog match. With validateOnly and a new campaign, Meta cannot dry-run the set inside the ad set, so the adSet result carries a reason; pass existingCampaignId to dry-run it in full.
|
|
1321
1350
|
*/
|
|
1322
1351
|
productSetId?: string;
|
|
1323
1352
|
/**
|
|
@@ -7762,7 +7791,7 @@ export type metric = 'follower_demographics' | 'engaged_audience_demographics';
|
|
|
7762
7791
|
export type timeframe = 'this_week' | 'this_month';
|
|
7763
7792
|
|
|
7764
7793
|
/**
|
|
7765
|
-
* Feed aspect ratio 0.5625-1.91, carousels up to
|
|
7794
|
+
* Feed aspect ratio 0.5625-1.91, carousels up to 20 items, stories require media (no captions). User tag coordinates 0.0-1.0 from top-left. Images over 8 MB and videos over platform limits are auto-compressed.
|
|
7766
7795
|
*/
|
|
7767
7796
|
export type InstagramPlatformData = {
|
|
7768
7797
|
/**
|
|
@@ -16001,7 +16030,7 @@ export type WhatsAppHeaderComponent = {
|
|
|
16001
16030
|
};
|
|
16002
16031
|
};
|
|
16003
16032
|
|
|
16004
|
-
export type
|
|
16033
|
+
export type format2 = 'text' | 'image' | 'video' | 'gif' | 'document' | 'location';
|
|
16005
16034
|
|
|
16006
16035
|
export type WhatsAppLimitedTimeOfferComponent = {
|
|
16007
16036
|
type: 'limited_time_offer';
|
|
@@ -48321,7 +48350,8 @@ export type CreateStandaloneAdData = {
|
|
|
48321
48350
|
* - `lead_conversion`: OUTCOME_LEADS optimizing website pixel leads. Same pixel and event fields, but with a leads-class event such as LEAD, SUBMIT_APPLICATION, SCHEDULE or CONTACT (or `promotedObject.customConversionId` to optimise against a Custom Conversion instead). Meta gates conversion events by objective, so leads-class events are rejected under `conversions`.
|
|
48322
48351
|
* - `lead_generation`: OUTCOME_LEADS with instant forms. Requires `leadGenFormId`. `promotedObject.pageId` is optional and auto-filled from the connected Page.
|
|
48323
48352
|
* - `app_promotion`: requires `promotedObject.applicationId` and `promotedObject.objectStoreUrl`.
|
|
48324
|
-
* - `catalog_sales`: Advantage+ catalog ads, for example vehicle inventory. Requires `promotedObject.productSetId`, `promotedObject.pixelId` and `promotedObject.customEventType`. Builds a catalog TEMPLATE creative from the copy fields, which may carry template tags like {{product.name}} or {{vehicle.make}}. No imageUrl or video is sent; Meta renders the visuals per catalog item. Discover catalogs via GET /v1/ads/catalogs and product sets via GET /v1/ads/catalogs/{catalogId}/product-sets. Single shape only, no creatives[],
|
|
48353
|
+
* - `catalog_sales`: Advantage+ catalog ads, for example vehicle inventory. Requires `promotedObject.productSetId`, `promotedObject.pixelId` and `promotedObject.customEventType`. Builds a catalog TEMPLATE creative from the copy fields, which may carry template tags like {{product.name}} or {{vehicle.make}}. No imageUrl or video is sent; Meta renders the visuals per catalog item. Discover catalogs via GET /v1/ads/catalogs and product sets via GET /v1/ads/catalogs/{catalogId}/product-sets. Single shape only, no creatives[], dynamicCreative, placementAssets, existingCreativeId or carouselCards; an imageUrl or video sent with it is ignored and not uploaded. Works with `existingCampaignId`, and with `adSetId` to add a catalog ad to an existing ad set (then only `promotedObject.productSetId` is required; pixel and event stay on the ad set). Pick the format with `catalogFormat`.
|
|
48354
|
+
* - `traffic` with `promotedObject.productSetId`: a catalog ad without a pixel (OUTCOME_TRAFFIC, `optimizationGoal` LINK_CLICKS by default or LANDING_PAGE_VIEWS). The product set goes on the template creative only, never on the ad set's promoted_object, and no `pixelId` or `customEventType` is needed. Same creative rules as `catalog_sales`.
|
|
48325
48355
|
* - `page_likes`: Page Likes conversion location under OUTCOME_ENGAGEMENT (destination_type ON_PAGE, optimization PAGE_LIKES). `promotedObject.pageId` is optional and auto-filled from the connected Page. The creative CTA is fixed to LIKE_PAGE targeting that Page; headline / body / linkUrl / callToAction / imageUrl / video are all optional (Meta derives the link and the Like button from the Page).
|
|
48326
48356
|
* - `page_visits`: Meta's "Page visits and followers" under OUTCOME_TRAFFIC (destination_type FACEBOOK_PAGE, optimization PROFILE_VISIT). `promotedObject.pageId` is optional and auto-filled from the connected Page, and `linkUrl` defaults to the Page. Meta enables Profile Visit ads per ad account: one it has not enabled is refused with Meta's "This account isn't eligible to use Profile Visit ads yet".
|
|
48327
48357
|
*
|
|
@@ -48386,9 +48416,13 @@ export type CreateStandaloneAdData = {
|
|
|
48386
48416
|
*/
|
|
48387
48417
|
promotion?: MetaPromotion;
|
|
48388
48418
|
/**
|
|
48389
|
-
* Meta only. Applied to each new creative, including standalone and
|
|
48419
|
+
* Meta only. Applied to each new creative, including standalone, attach and catalog template shapes. With creatives[], these are defaults; an item replaces the whole feature map, including an empty map. auto_promotion_tag is an Advantage+ enhancement, not the Ads Manager Promotion setting. On catalog ads, the catalog enhancements are keys of this same map, for example `{ "product_extensions": "OPT_OUT", "media_type_automation": "OPT_OUT", "standard_enhancements_catalog": "OPT_OUT", "multi_creative_post_carousel": "OPT_OUT" }`.
|
|
48390
48420
|
*/
|
|
48391
48421
|
creativeFeatures?: MetaCreativeFeatures;
|
|
48422
|
+
/**
|
|
48423
|
+
* Meta catalog template creatives only (goal `catalog_sales`, goal `traffic` with `promotedObject.productSetId`, or `adSetId` with `promotedObject.productSetId`); a 400 otherwise. Sent as `object_story_spec.template_data.format_option`. `force_single_link` is never sent with it (Meta rejects the pair, subcode 1443051). `single_image` also sends `format_transformation_spec` with `carousel` and `da_collection` set to `data_source: ["none"]`, so Meta keeps the single image instead of turning it into a carousel or collection. `carousel_images_single_item` also sends `template_data.multi_share_end_card: false`, which Meta requires for that format (subcode 1443167). Omit it to let Meta pick the format.
|
|
48424
|
+
*/
|
|
48425
|
+
catalogFormat?: 'single_image' | 'carousel_images_multi_items' | 'carousel_images_single_item' | 'carousel_slideshows';
|
|
48392
48426
|
/**
|
|
48393
48427
|
* Meta only. Multi-advertiser ads: whether Meta may show this ad alongside other advertisers' in one unit. Meta auto-enrols since Aug 2024, so send OPT_OUT to leave. It is a top-level creative field, NOT a `creativeFeatures` key, and Meta rejects it there.
|
|
48394
48428
|
*/
|