@zernio/node 0.2.548 → 0.2.550

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.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.548",
39
+ version: "0.2.550",
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.548",
8
+ version: "0.2.550",
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.548",
3
+ "version": "0.2.550",
4
4
  "description": "The official Node.js library for the Zernio API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -375,6 +375,34 @@ export type goal = 'engagement' | 'traffic' | 'awareness' | 'video_views' | 'lea
375
375
 
376
376
  export type type = 'daily' | 'lifetime';
377
377
 
378
+ export type AdAnalyticsResponse = {
379
+ /**
380
+ * Present and true while historical data is being backfilled.
381
+ */
382
+ backfillPending?: boolean;
383
+ ad?: {
384
+ id?: string;
385
+ name?: string;
386
+ platform?: string;
387
+ status?: string;
388
+ /**
389
+ * ISO 4217 code of the ad account that owns this ad (e.g. USD, THB, INR). All money values in `summary` and `daily` are in this currency. Null only on legacy ads synced before currency was persisted.
390
+ */
391
+ currency?: (string) | null;
392
+ };
393
+ analytics?: {
394
+ summary?: AdMetrics;
395
+ daily?: Array<(AdMetrics & {
396
+ date?: string;
397
+ })>;
398
+ breakdowns?: {
399
+ [key: string]: Array<{
400
+ [key: string]: unknown;
401
+ }>;
402
+ };
403
+ };
404
+ };
405
+
378
406
  /**
379
407
  * Budget amount in the ad account's native currency (see the campaign's `currency` field for the code).
380
408
  */
@@ -547,7 +575,7 @@ export type AdEngagementCounts = {
547
575
  */
548
576
  videoViews?: number;
549
577
  /**
550
- * Attributed link clicks (`link_click`). This is the attribution-window count, which differs from the in-session `inline_link_clicks` reported by `GET /v1/ads/{adId}/analytics`.
578
+ * Attributed link clicks (`link_click`). This is the attribution-window count, which differs from the in-session count in the sibling `inlineLinkClicks` field.
551
579
  */
552
580
  linkClicks?: number;
553
581
  };
@@ -674,6 +702,36 @@ export type AdMetrics = {
674
702
  * Return on ad spend — derived as `purchaseValue / spend`. 0 when `spend` is 0. Equivalent to Meta's `purchase_roas` under default attribution. At ad-set and campaign levels this is recomputed from summed purchaseValue + spend (NOT averaged across children) so it's mathematically correct at every rollup level.
675
703
  */
676
704
  roas?: number;
705
+ /**
706
+ * Derived `spend / actions[type]` for every action type with a non-zero count, in ad-account native currency. Same keys as `actions`. Rounded to 4 decimals because cheap actions cost well under a cent. Recomputed from summed spend + counts at every rollup level. Empty object when spend is 0 or no actions are reported.
707
+ */
708
+ costPerAction?: {
709
+ [key: string]: (number);
710
+ };
711
+ /**
712
+ * Clicks leading off Meta's surfaces to the advertiser's destination. Meta-only; other platforms report 0.
713
+ */
714
+ outboundClicks?: number;
715
+ /**
716
+ * Derived `outboundClicks / impressions * 100`, recomputed from sums at every rollup level.
717
+ */
718
+ outboundClicksCtr?: number;
719
+ /**
720
+ * In-session link clicks. Differs from the attributed `link_click` count in `actions`/`engagementBreakdown.linkClicks`, which uses the attribution window. Meta-only.
721
+ */
722
+ inlineLinkClicks?: number;
723
+ /**
724
+ * Derived `inlineLinkClicks / impressions * 100`, recomputed from sums at every rollup level.
725
+ */
726
+ inlineLinkClickCtr?: number;
727
+ /**
728
+ * People who clicked at least once. NOT additive: summed across days/children it overcounts people who clicked on multiple days or ads, so treat rollups as an upper bound (same caveat as `reach`). Meta-only.
729
+ */
730
+ uniqueClicks?: number;
731
+ /**
732
+ * Derived `uniqueClicks / impressions * 100` (NOT Meta's reach-based unique_ctr). Inherits the non-additivity caveat of `uniqueClicks`.
733
+ */
734
+ uniqueCtr?: number;
677
735
  /**
678
736
  * Number of times the video started playing, summed over the date range and across children at ad-set/campaign level. 0 for non-video ads. Sources: Meta `video_play_actions`, TikTok `video_play_actions`.
679
737
  */
@@ -727,8 +785,75 @@ export type AdMetrics = {
727
785
  */
728
786
  export type AdReviewStatus = 'in_review' | 'approved' | 'rejected' | 'with_issues';
729
787
 
788
+ export type AdsListResponse = {
789
+ ads?: Array<Ad>;
790
+ pagination?: Pagination;
791
+ /**
792
+ * Present and true while historical data is being backfilled.
793
+ */
794
+ backfillPending?: boolean;
795
+ };
796
+
730
797
  export type AdStatus = 'active' | 'paused' | 'pending_review' | 'rejected' | 'completed' | 'cancelled' | 'error';
731
798
 
799
+ export type AdsTimelineResponse = {
800
+ /**
801
+ * Present and true while historical data is being backfilled.
802
+ */
803
+ backfillPending?: boolean;
804
+ rows?: Array<{
805
+ date?: string;
806
+ /**
807
+ * Native currency units (matches /ads/tree convention).
808
+ */
809
+ spend?: number;
810
+ impressions?: number;
811
+ /**
812
+ * Reach summed across the account's ads for this single day. A person seen by two ads the same day counts twice, and reach is de-duplicated per day only: do NOT sum it across days (people reached on multiple days would be double-counted).
813
+ */
814
+ reach?: number;
815
+ clicks?: number;
816
+ engagement?: number;
817
+ /**
818
+ * Click-through rate as a percentage (0–100).
819
+ */
820
+ ctr?: number;
821
+ /**
822
+ * Cost per click in native currency.
823
+ */
824
+ cpc?: number;
825
+ /**
826
+ * Cost per 1000 impressions in native currency.
827
+ */
828
+ cpm?: number;
829
+ /**
830
+ * Sum of conversion events over the range. Fractional values are normal (attribution splitting + Google modeled conversions). Meta: events matching the campaign optimization goal. Google: tracked conversions. X / LinkedIn: reported website/lead conversions (added 2026-07).
831
+ */
832
+ conversions?: number;
833
+ costPerConversion?: number;
834
+ /**
835
+ * Per-action-type counts merged across all ads on this day. Keys are platform-native action types.
836
+ */
837
+ actions?: {
838
+ [key: string]: (number);
839
+ };
840
+ /**
841
+ * Monetary mirror of `actions` in native currency.
842
+ */
843
+ actionValues?: {
844
+ [key: string]: (number);
845
+ };
846
+ /**
847
+ * Sum of purchase-type action values on this day, native currency.
848
+ */
849
+ purchaseValue?: number;
850
+ /**
851
+ * Derived purchaseValue / spend.
852
+ */
853
+ roas?: number;
854
+ }>;
855
+ };
856
+
732
857
  /**
733
858
  * Ad set (or ad group/line item depending on platform) with rolled-up metrics and child ads
734
859
  */
@@ -906,6 +1031,15 @@ export type AdTreeCampaign = {
906
1031
  daily?: Array<AdDailyMetrics>;
907
1032
  };
908
1033
 
1034
+ export type AdTreeResponse = {
1035
+ campaigns?: Array<AdTreeCampaign>;
1036
+ pagination?: Pagination;
1037
+ /**
1038
+ * Present and true while historical data is being backfilled.
1039
+ */
1040
+ backfillPending?: boolean;
1041
+ };
1042
+
909
1043
  export type AnalyticsListResponse = {
910
1044
  overview?: AnalyticsOverview;
911
1045
  posts?: Array<{
@@ -1391,6 +1525,37 @@ export type transcriptionLanguage = 'auto' | 'en' | 'es';
1391
1525
 
1392
1526
  export type endReason = 'hangup' | 'no_answer' | 'rejected' | 'error';
1393
1527
 
1528
+ export type CampaignAnalyticsResponse = {
1529
+ /**
1530
+ * Present and true while historical data is being backfilled.
1531
+ */
1532
+ backfillPending?: boolean;
1533
+ campaign?: {
1534
+ id?: string;
1535
+ name?: (string) | null;
1536
+ platform?: string;
1537
+ /**
1538
+ * Effective campaign status (ACTIVE when any child ad is active).
1539
+ */
1540
+ status?: (string) | null;
1541
+ /**
1542
+ * ISO 4217 code of the ad account (e.g. USD, THB). All money values in `summary` and `daily` are in this currency.
1543
+ */
1544
+ currency?: (string) | null;
1545
+ };
1546
+ analytics?: {
1547
+ summary?: AdMetrics;
1548
+ daily?: Array<(AdMetrics & {
1549
+ date?: string;
1550
+ })>;
1551
+ breakdowns?: {
1552
+ [key: string]: Array<{
1553
+ [key: string]: unknown;
1554
+ }>;
1555
+ };
1556
+ };
1557
+ };
1558
+
1394
1559
  /**
1395
1560
  * Who a comment automation answers. Instagram only - Meta exposes the follow
1396
1561
  * relationship on no other platform, and only for people who have MESSAGED the
@@ -26668,14 +26833,9 @@ export type ListAdsData = {
26668
26833
  };
26669
26834
  };
26670
26835
 
26671
- export type ListAdsResponse = ({
26672
- ads?: Array<Ad>;
26673
- /**
26674
- * Present and true only on `202` responses: part of the requested date range is still being backfilled from the platform in the background. Retry the same request shortly; it returns 200 once the range is fully ingested.
26675
- */
26676
- backfillPending?: boolean;
26677
- pagination?: Pagination;
26678
- } | unknown);
26836
+ export type ListAdsResponse = (AdsListResponse | (AdsListResponse & {
26837
+ backfillPending: true;
26838
+ }));
26679
26839
 
26680
26840
  export type ListAdsError = (ErrorResponse | {
26681
26841
  error?: string;
@@ -27509,14 +27669,9 @@ export type GetAdTreeData = {
27509
27669
  };
27510
27670
  };
27511
27671
 
27512
- export type GetAdTreeResponse = ({
27513
- campaigns?: Array<AdTreeCampaign>;
27514
- /**
27515
- * Present and true only on `202` responses: part of the requested date range is still being backfilled from the platform in the background. Retry the same request shortly; it returns 200 once the range is fully ingested.
27516
- */
27517
- backfillPending?: boolean;
27518
- pagination?: Pagination;
27519
- } | unknown);
27672
+ export type GetAdTreeResponse = (AdTreeResponse | (AdTreeResponse & {
27673
+ backfillPending: true;
27674
+ }));
27520
27675
 
27521
27676
  export type GetAdTreeError = ({
27522
27677
  error?: string;
@@ -27547,63 +27702,9 @@ export type GetAdsTimelineData = {
27547
27702
  };
27548
27703
  };
27549
27704
 
27550
- export type GetAdsTimelineResponse = ({
27551
- rows?: Array<{
27552
- date?: string;
27553
- /**
27554
- * Native currency units (matches /ads/tree convention).
27555
- */
27556
- spend?: number;
27557
- impressions?: number;
27558
- /**
27559
- * Reach summed across the account's ads for this single day. A person seen by two ads the same day counts twice, and reach is de-duplicated per day only: do NOT sum it across days (people reached on multiple days would be double-counted).
27560
- */
27561
- reach?: number;
27562
- clicks?: number;
27563
- engagement?: number;
27564
- /**
27565
- * Click-through rate as a percentage (0–100).
27566
- */
27567
- ctr?: number;
27568
- /**
27569
- * Cost per click in native currency.
27570
- */
27571
- cpc?: number;
27572
- /**
27573
- * Cost per 1000 impressions in native currency.
27574
- */
27575
- cpm?: number;
27576
- /**
27577
- * Sum of conversion events over the range. Fractional values are normal (attribution splitting + Google modeled conversions). Meta: events matching the campaign optimization goal. Google: tracked conversions. X / LinkedIn: reported website/lead conversions (added 2026-07).
27578
- */
27579
- conversions?: number;
27580
- costPerConversion?: number;
27581
- /**
27582
- * Per-action-type counts merged across all ads on this day. Keys are platform-native action types.
27583
- */
27584
- actions?: {
27585
- [key: string]: (number);
27586
- };
27587
- /**
27588
- * Monetary mirror of `actions` in native currency.
27589
- */
27590
- actionValues?: {
27591
- [key: string]: (number);
27592
- };
27593
- /**
27594
- * Sum of purchase-type action values on this day, native currency.
27595
- */
27596
- purchaseValue?: number;
27597
- /**
27598
- * Derived purchaseValue / spend.
27599
- */
27600
- roas?: number;
27601
- }>;
27602
- /**
27603
- * Present and true only on `202` responses: part of the requested date range is still being backfilled from the platform in the background. Retry the same request shortly; it returns 200 once the range is fully ingested.
27604
- */
27605
- backfillPending?: boolean;
27606
- } | unknown);
27705
+ export type GetAdsTimelineResponse = (AdsTimelineResponse | (AdsTimelineResponse & {
27706
+ backfillPending: true;
27707
+ }));
27607
27708
 
27608
27709
  export type GetAdsTimelineError = (ErrorResponse | {
27609
27710
  error?: string;
@@ -27797,36 +27898,9 @@ export type GetCampaignAnalyticsData = {
27797
27898
  };
27798
27899
  };
27799
27900
 
27800
- export type GetCampaignAnalyticsResponse = ({
27801
- campaign?: {
27802
- id?: string;
27803
- name?: (string) | null;
27804
- platform?: string;
27805
- /**
27806
- * Effective campaign status (ACTIVE when any child ad is active).
27807
- */
27808
- status?: (string) | null;
27809
- /**
27810
- * ISO 4217 code of the ad account (e.g. USD, THB). All money values in `summary` and `daily` are in this currency.
27811
- */
27812
- currency?: (string) | null;
27813
- };
27814
- /**
27815
- * Present and true only on `202` responses: part of the requested date range is still being backfilled from the platform in the background. Retry the same request shortly; it returns 200 once the range is fully ingested.
27816
- */
27817
- backfillPending?: boolean;
27818
- analytics?: {
27819
- summary?: AdMetrics;
27820
- daily?: Array<(AdMetrics & {
27821
- date?: string;
27822
- })>;
27823
- breakdowns?: {
27824
- [key: string]: Array<{
27825
- [key: string]: unknown;
27826
- }>;
27827
- };
27828
- };
27829
- } | unknown);
27901
+ export type GetCampaignAnalyticsResponse = (CampaignAnalyticsResponse | (CampaignAnalyticsResponse & {
27902
+ backfillPending: true;
27903
+ }));
27830
27904
 
27831
27905
  export type GetCampaignAnalyticsError = (ErrorResponse | {
27832
27906
  error?: string;
@@ -28250,34 +28324,9 @@ export type GetAdAnalyticsData = {
28250
28324
  };
28251
28325
  };
28252
28326
 
28253
- export type GetAdAnalyticsResponse = ({
28254
- ad?: {
28255
- id?: string;
28256
- name?: string;
28257
- platform?: string;
28258
- trigger?: 'comment' | 'story_reply';
28259
- status?: string;
28260
- /**
28261
- * ISO 4217 code of the ad account that owns this ad (e.g. USD, THB, INR). All money values in `summary` and `daily` are in this currency. Null only on legacy ads synced before currency was persisted.
28262
- */
28263
- currency?: (string) | null;
28264
- };
28265
- /**
28266
- * Present and true only on `202` responses: part of the requested date range is still being backfilled from the platform in the background. Retry the same request shortly; it returns 200 once the range is fully ingested.
28267
- */
28268
- backfillPending?: boolean;
28269
- analytics?: {
28270
- summary?: AdMetrics;
28271
- daily?: Array<(AdMetrics & {
28272
- date?: string;
28273
- })>;
28274
- breakdowns?: {
28275
- [key: string]: Array<{
28276
- [key: string]: unknown;
28277
- }>;
28278
- };
28279
- };
28280
- } | unknown);
28327
+ export type GetAdAnalyticsResponse = (AdAnalyticsResponse | (AdAnalyticsResponse & {
28328
+ backfillPending: true;
28329
+ }));
28281
28330
 
28282
28331
  export type GetAdAnalyticsError = (ErrorResponse | {
28283
28332
  error?: string;