@owox/connectors 0.13.0-next-20251118102534 → 0.13.0-next-20251119104944
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.cjs +14 -4
- package/dist/index.js +14 -4
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -14380,7 +14380,7 @@ const GoogleAds = (function() {
|
|
|
14380
14380
|
isRequired: true,
|
|
14381
14381
|
requiredType: "string",
|
|
14382
14382
|
label: "Customer ID",
|
|
14383
|
-
description: "Google Ads Customer ID (format:
|
|
14383
|
+
description: "Google Ads Customer ID (format: 1234567890)"
|
|
14384
14384
|
},
|
|
14385
14385
|
AuthType: {
|
|
14386
14386
|
requiredType: "object",
|
|
@@ -14624,7 +14624,7 @@ const GoogleAds = (function() {
|
|
|
14624
14624
|
* @returns {Array<Object>} - API response data
|
|
14625
14625
|
*/
|
|
14626
14626
|
async makeRequest({ customerId, query, nodeName, fields }) {
|
|
14627
|
-
var _a, _b, _c, _d;
|
|
14627
|
+
var _a, _b, _c, _d, _e;
|
|
14628
14628
|
const accessToken = await this.getAccessToken();
|
|
14629
14629
|
const url = `https://googleads.googleapis.com/v21/customers/${customerId}/googleAds:search`;
|
|
14630
14630
|
console.log(`Google Ads API Request URL: ${url}`);
|
|
@@ -14639,12 +14639,13 @@ const GoogleAds = (function() {
|
|
|
14639
14639
|
requestBody.pageToken = nextPageToken;
|
|
14640
14640
|
}
|
|
14641
14641
|
const loginCustomerId = (_b = (_a = this.config.AuthType.items) == null ? void 0 : _a.LoginCustomerId) == null ? void 0 : _b.value;
|
|
14642
|
+
const shouldIncludeLoginCustomerIdHeader = loginCustomerId && loginCustomerId !== customerId;
|
|
14642
14643
|
const headers = {
|
|
14643
14644
|
"Authorization": `Bearer ${accessToken}`,
|
|
14644
14645
|
"developer-token": (_d = (_c = this.config.AuthType.items) == null ? void 0 : _c.DeveloperToken) == null ? void 0 : _d.value,
|
|
14645
14646
|
"Content-Type": "application/json"
|
|
14646
14647
|
};
|
|
14647
|
-
if (
|
|
14648
|
+
if (shouldIncludeLoginCustomerIdHeader) {
|
|
14648
14649
|
headers["login-customer-id"] = loginCustomerId;
|
|
14649
14650
|
}
|
|
14650
14651
|
const options = {
|
|
@@ -14654,10 +14655,19 @@ const GoogleAds = (function() {
|
|
|
14654
14655
|
body: JSON.stringify(requestBody),
|
|
14655
14656
|
muteHttpExceptions: true
|
|
14656
14657
|
};
|
|
14657
|
-
|
|
14658
|
+
let response;
|
|
14659
|
+
try {
|
|
14660
|
+
response = await this.urlFetchWithRetry(url, options);
|
|
14661
|
+
} catch (error) {
|
|
14662
|
+
if ((_e = error.payload) == null ? void 0 : _e.error) {
|
|
14663
|
+
this.config.logMessage(`Google Ads API error payload: ${JSON.stringify(error.payload.error, null, 2)}`);
|
|
14664
|
+
}
|
|
14665
|
+
throw error;
|
|
14666
|
+
}
|
|
14658
14667
|
const text = await response.getContentText();
|
|
14659
14668
|
const jsonData = JSON.parse(text);
|
|
14660
14669
|
if (jsonData.error) {
|
|
14670
|
+
this.config.logMessage(`Google Ads API error payload: ${JSON.stringify(jsonData.error, null, 2)}`);
|
|
14661
14671
|
throw new Error(`Google Ads API error: ${jsonData.error.message}`);
|
|
14662
14672
|
}
|
|
14663
14673
|
if (jsonData.results) {
|
package/dist/index.js
CHANGED
|
@@ -14385,7 +14385,7 @@ API Response: ${JSON.stringify(statusResult, null, 2)}`);
|
|
|
14385
14385
|
isRequired: true,
|
|
14386
14386
|
requiredType: "string",
|
|
14387
14387
|
label: "Customer ID",
|
|
14388
|
-
description: "Google Ads Customer ID (format:
|
|
14388
|
+
description: "Google Ads Customer ID (format: 1234567890)"
|
|
14389
14389
|
},
|
|
14390
14390
|
AuthType: {
|
|
14391
14391
|
requiredType: "object",
|
|
@@ -14629,7 +14629,7 @@ API Response: ${JSON.stringify(statusResult, null, 2)}`);
|
|
|
14629
14629
|
* @returns {Array<Object>} - API response data
|
|
14630
14630
|
*/
|
|
14631
14631
|
async makeRequest({ customerId, query, nodeName, fields }) {
|
|
14632
|
-
var _a, _b, _c, _d;
|
|
14632
|
+
var _a, _b, _c, _d, _e;
|
|
14633
14633
|
const accessToken = await this.getAccessToken();
|
|
14634
14634
|
const url = `https://googleads.googleapis.com/v21/customers/${customerId}/googleAds:search`;
|
|
14635
14635
|
console.log(`Google Ads API Request URL: ${url}`);
|
|
@@ -14644,12 +14644,13 @@ API Response: ${JSON.stringify(statusResult, null, 2)}`);
|
|
|
14644
14644
|
requestBody.pageToken = nextPageToken;
|
|
14645
14645
|
}
|
|
14646
14646
|
const loginCustomerId = (_b = (_a = this.config.AuthType.items) == null ? void 0 : _a.LoginCustomerId) == null ? void 0 : _b.value;
|
|
14647
|
+
const shouldIncludeLoginCustomerIdHeader = loginCustomerId && loginCustomerId !== customerId;
|
|
14647
14648
|
const headers = {
|
|
14648
14649
|
"Authorization": `Bearer ${accessToken}`,
|
|
14649
14650
|
"developer-token": (_d = (_c = this.config.AuthType.items) == null ? void 0 : _c.DeveloperToken) == null ? void 0 : _d.value,
|
|
14650
14651
|
"Content-Type": "application/json"
|
|
14651
14652
|
};
|
|
14652
|
-
if (
|
|
14653
|
+
if (shouldIncludeLoginCustomerIdHeader) {
|
|
14653
14654
|
headers["login-customer-id"] = loginCustomerId;
|
|
14654
14655
|
}
|
|
14655
14656
|
const options = {
|
|
@@ -14659,10 +14660,19 @@ API Response: ${JSON.stringify(statusResult, null, 2)}`);
|
|
|
14659
14660
|
body: JSON.stringify(requestBody),
|
|
14660
14661
|
muteHttpExceptions: true
|
|
14661
14662
|
};
|
|
14662
|
-
|
|
14663
|
+
let response;
|
|
14664
|
+
try {
|
|
14665
|
+
response = await this.urlFetchWithRetry(url, options);
|
|
14666
|
+
} catch (error) {
|
|
14667
|
+
if ((_e = error.payload) == null ? void 0 : _e.error) {
|
|
14668
|
+
this.config.logMessage(`Google Ads API error payload: ${JSON.stringify(error.payload.error, null, 2)}`);
|
|
14669
|
+
}
|
|
14670
|
+
throw error;
|
|
14671
|
+
}
|
|
14663
14672
|
const text = await response.getContentText();
|
|
14664
14673
|
const jsonData = JSON.parse(text);
|
|
14665
14674
|
if (jsonData.error) {
|
|
14675
|
+
this.config.logMessage(`Google Ads API error payload: ${JSON.stringify(jsonData.error, null, 2)}`);
|
|
14666
14676
|
throw new Error(`Google Ads API error: ${jsonData.error.message}`);
|
|
14667
14677
|
}
|
|
14668
14678
|
if (jsonData.results) {
|