@google-cloud/nodejs-common 1.7.0 → 1.7.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.
@@ -1552,6 +1552,7 @@ set_cloud_functions_default_settings() {
1552
1552
  local -n default_cf_flag=$1
1553
1553
  default_cf_flag+=(--region="${REGION}")
1554
1554
  default_cf_flag+=(--no-allow-unauthenticated)
1555
+ default_cf_flag+=(--docker-registry=artifact-registry)
1555
1556
  default_cf_flag+=(--timeout=540 --memory="${CF_MEMORY}" --runtime="${CF_RUNTIME}")
1556
1557
  default_cf_flag+=(--set-env-vars=GCP_PROJECT="${GCP_PROJECT}")
1557
1558
  default_cf_flag+=(--set-env-vars=PROJECT_NAMESPACE="${PROJECT_NAMESPACE}")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google-cloud/nodejs-common",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "A NodeJs common library for solutions based on Cloud Functions",
5
5
  "author": "Google Inc.",
6
6
  "license": "Apache-2.0",
@@ -75,6 +75,17 @@ const PICKED_PROPERTIES = [
75
75
  'quantity',
76
76
  ];
77
77
 
78
+ /**
79
+ * Kinds of UserIdentifier.
80
+ * @type {Array<string>}
81
+ */
82
+ const IDENTIFIERS = [
83
+ 'hashedEmail',
84
+ 'hashedPhoneNumber',
85
+ 'addressInfo',
86
+ ];
87
+
88
+ const MAX_IDENTIFIERS_PER_USER = 5;
78
89
  /**
79
90
  * Google DfaReport API v3.0 stub.
80
91
  * see https://developers.google.com/doubleclick-advertisers/service_accounts
@@ -175,6 +186,32 @@ class DfaReporting {
175
186
  conversion.customVariables = config.customVariables.map(
176
187
  (variable) => ({'type': variable, 'value': record[variable],}));
177
188
  }
189
+ // User Identifiers
190
+ if (record.userIdentifiers) {
191
+ const userIdentifiers = [];
192
+ IDENTIFIERS.map((id) => {
193
+ const idValue = record.userIdentifiers[id];
194
+ if (idValue) {
195
+ if (Array.isArray(idValue)) {
196
+ idValue.forEach(
197
+ (user) => void userIdentifiers.push({ [id]: user }));
198
+ } else {
199
+ userIdentifiers.push({ [id]: idValue });
200
+ }
201
+ }
202
+ });
203
+ if (userIdentifiers.length > 0) {
204
+ if (userIdentifiers.length > MAX_IDENTIFIERS_PER_USER) {
205
+ this.logger.warn(
206
+ 'There are too many user identifiers:', record.userIdentifiers);
207
+ }
208
+ conversion.userIdentifiers =
209
+ userIdentifiers.slice(0, MAX_IDENTIFIERS_PER_USER);
210
+ } else {
211
+ this.logger.warn(
212
+ 'There is no valid user identifier:', record.userIdentifiers);
213
+ }
214
+ }
178
215
  return conversion;
179
216
  });
180
217
  const requestBody = {conversions};