From 1cd5b2bf2234ffd6276bd6223bc416db76098fd1 Mon Sep 17 00:00:00 2001 From: Sergei Dorogin Date: Wed, 2 Oct 2024 12:40:06 +0400 Subject: [PATCH] gaarf-js@2.12.1 Fetch only non-hidden accounts from MCC Change-Id: Ie7cb49370d8d00fa5b811617d5c5cff3bf27ad37 --- js/CHANGELOG.md | 3 +++ js/dist/lib/ads-utils.js | 8 +++++--- js/dist/lib/ads-utils.js.map | 2 +- js/package-lock.json | 4 ++-- js/package.json | 2 +- js/src/lib/ads-utils.ts | 8 +++++--- 6 files changed, 17 insertions(+), 10 deletions(-) diff --git a/js/CHANGELOG.md b/js/CHANGELOG.md index 8eb55724..c2aa25c2 100644 --- a/js/CHANGELOG.md +++ b/js/CHANGELOG.md @@ -1,4 +1,7 @@ # Changelog +## 2.12.1 +* added filtering ouf of hidden accounts while expanding MCC + ## 2.12 * support Google Ads API v17.1 (updated google-ads-api to v17.1) diff --git a/js/dist/lib/ads-utils.js b/js/dist/lib/ads-utils.js index 47e77c28..c6430109 100644 --- a/js/dist/lib/ads-utils.js +++ b/js/dist/lib/ads-utils.js @@ -105,7 +105,8 @@ async function getCustomerInfo(adsClient, customerId) { FROM customer_client WHERE customer_client.level <= 1 - AND customer_client.status = "ENABLED" + AND customer_client.status = ENABLED + AND customer_client.hidden = FALSE ORDER BY customer_client.level`; // const queryText2 = 'SELECT customer.descriptive_name FROM customer'; @@ -148,8 +149,9 @@ async function getCustomerIds(adsClient, customerId) { customer_client.id as cid FROM customer_client WHERE - customer_client.status = "ENABLED" AND - customer_client.manager = False`; + customer_client.status = ENABLED + AND customer_client.hidden = FALSE + AND customer_client.manager = FALSE`; if (typeof customerId === 'string') { customerId = [customerId]; } diff --git a/js/dist/lib/ads-utils.js.map b/js/dist/lib/ads-utils.js.map index 375593b3..d3d62c52 100644 --- a/js/dist/lib/ads-utils.js.map +++ b/js/dist/lib/ads-utils.js.map @@ -1 +1 @@ -{"version":3,"file":"ads-utils.js","sourceRoot":"","sources":["../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CAAC,CAAC;QAC5D,MAAM,GAAG,GAAG,GAAI,CAAC,IAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;QACrD,OAAO,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC;KACtB;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAvBD,wCAuBC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,iBAAiB,CACrC,SAA8B,EAC9B,GAAa,EACb,kBAA0B;IAE1B,MAAM,KAAK,GAAG,SAAS,CAAC,cAAc,EAAE,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAC;IACxE,MAAM,QAAQ,GAAgB,IAAI,GAAG,EAAE,CAAC;IACxC,MAAM,QAAQ,GAAG,IAAI,qCAAgB,CAAC,SAAS,CAAC,CAAC;IACjD,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE;QACpB,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,oBAAoB,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC9D,IAAI,MAAM,CAAC,QAAQ,GAAG,CAAC,EAAE;YACvB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAK,EAAE;gBAC9B,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;aACtB;SACF;QACD,sDAAsD;KACvD;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC9B,CAAC;AAlBD,8CAkBC"} \ No newline at end of file diff --git a/js/package-lock.json b/js/package-lock.json index 1d6c4185..7cbb0dc6 100644 --- a/js/package-lock.json +++ b/js/package-lock.json @@ -1,12 +1,12 @@ { "name": "google-ads-api-report-fetcher", - "version": "2.12.0", + "version": "2.12.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "google-ads-api-report-fetcher", - "version": "2.12.0", + "version": "2.12.1", "license": "Apache-2.0", "dependencies": { "@google-cloud/bigquery": "^7.9.0", diff --git a/js/package.json b/js/package.json index d213b82b..d16e24a5 100644 --- a/js/package.json +++ b/js/package.json @@ -1,6 +1,6 @@ { "name": "google-ads-api-report-fetcher", - "version": "2.12.0", + "version": "2.12.1", "description": "Google Ads API Report Fetcher (gaarf)", "main": "./dist/index.js", "types": "./src/index.ts", diff --git a/js/src/lib/ads-utils.ts b/js/src/lib/ads-utils.ts index f79f032a..82d2d0a6 100644 --- a/js/src/lib/ads-utils.ts +++ b/js/src/lib/ads-utils.ts @@ -117,7 +117,8 @@ export async function getCustomerInfo( FROM customer_client WHERE customer_client.level <= 1 - AND customer_client.status = "ENABLED" + AND customer_client.status = ENABLED + AND customer_client.hidden = FALSE ORDER BY customer_client.level`; // const queryText2 = 'SELECT customer.descriptive_name FROM customer'; @@ -166,8 +167,9 @@ export async function getCustomerIds( customer_client.id as cid FROM customer_client WHERE - customer_client.status = "ENABLED" AND - customer_client.manager = False`; + customer_client.status = ENABLED + AND customer_client.hidden = FALSE + AND customer_client.manager = FALSE`; if (typeof customerId === 'string') { customerId = [customerId]; }