@google-cloud/nodejs-common 2.4.0 → 2.4.1
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/package.json
CHANGED
package/src/apis/gmail.js
CHANGED
|
@@ -73,6 +73,9 @@ class Gmail extends GoogleApiClient {
|
|
|
73
73
|
message.push(`${key}: ${value}`);
|
|
74
74
|
}
|
|
75
75
|
});
|
|
76
|
+
if (options.type) {
|
|
77
|
+
message.push(`content-type: ${options.type}`);
|
|
78
|
+
}
|
|
76
79
|
if (message.length === 0)
|
|
77
80
|
throw new Error(`Can not get email from ${options}`);
|
|
78
81
|
message.push('\n');
|
package/src/apis/search_ads.js
CHANGED
|
@@ -183,6 +183,7 @@ class SearchAds extends GoogleApiClient {
|
|
|
183
183
|
const selectedColumns = {};
|
|
184
184
|
const getSelectedColumn = (column) => {
|
|
185
185
|
if (columnIds.indexOf(column.id) > -1) {
|
|
186
|
+
column.safeName = changeStringToBigQuerySafe(column.name);
|
|
186
187
|
selectedColumns[column.id] = column;
|
|
187
188
|
}
|
|
188
189
|
}
|
|
@@ -193,6 +194,12 @@ class SearchAds extends GoogleApiClient {
|
|
|
193
194
|
(await this.listCustomColumns(customerId, loginCustomerId))
|
|
194
195
|
.forEach(getSelectedColumn);
|
|
195
196
|
}
|
|
197
|
+
if (Object.keys(selectedColumns).length < columnIds.length) {
|
|
198
|
+
const missing = columnIds.filter(
|
|
199
|
+
(id) => Object.keys(selectedColumns).indexOf(id) === -1
|
|
200
|
+
);
|
|
201
|
+
throw new Error(`Fail to find custom column(s): ${missing.join()}.`);
|
|
202
|
+
}
|
|
196
203
|
return columnIds.map((columnId) => selectedColumns[columnId]);
|
|
197
204
|
}
|
|
198
205
|
|
|
@@ -208,11 +215,10 @@ class SearchAds extends GoogleApiClient {
|
|
|
208
215
|
async getCustomColumnsConvertor(customerId, loginCustomerId, query) {
|
|
209
216
|
const customerColumns = await this.getCustomColumnsFromQuery(
|
|
210
217
|
customerId, loginCustomerId, query);
|
|
211
|
-
const columnConvertors = customerColumns.map(({
|
|
218
|
+
const columnConvertors = customerColumns.map(({ safeName, valueType }) => {
|
|
212
219
|
return (obj) => {
|
|
213
|
-
const key = changeStringToBigQuerySafe(name);
|
|
214
220
|
const value = obj[`${valueType.toLowerCase()}Value`];
|
|
215
|
-
return { [
|
|
221
|
+
return { [safeName]: value };
|
|
216
222
|
};
|
|
217
223
|
});
|
|
218
224
|
const convertor = (customerColumns) => {
|
|
@@ -160,9 +160,15 @@ class CloudScheduler {
|
|
|
160
160
|
const requestPrefix = `projects/${projectId}/locations`;
|
|
161
161
|
const jobs = locations.map(async (location) => {
|
|
162
162
|
const request = { parent: `${requestPrefix}/${location}` };
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
163
|
+
try {
|
|
164
|
+
const response =
|
|
165
|
+
await this.instance.projects.locations.jobs.list(request);
|
|
166
|
+
if (!response.data.jobs) return [];
|
|
167
|
+
return response.data.jobs.map((job) => job.name);
|
|
168
|
+
} catch (error) {
|
|
169
|
+
console.warn(`Failed to list jobs for ${location}`, error);
|
|
170
|
+
return [];
|
|
171
|
+
}
|
|
166
172
|
});
|
|
167
173
|
// Waits for all jobs names and flattens nested job name arrays, however
|
|
168
174
|
// there is no 'flat' available in current Cloud Functions runtime.
|