@google-analytics/data 4.4.0 → 4.6.0

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.
@@ -72,7 +72,7 @@ class BetaAnalyticsDataClient {
72
72
  * ```
73
73
  */
74
74
  constructor(opts, gaxInstance) {
75
- var _a, _b, _c, _d;
75
+ var _a, _b, _c, _d, _e;
76
76
  this._terminated = false;
77
77
  this.descriptors = {
78
78
  page: {},
@@ -87,14 +87,17 @@ class BetaAnalyticsDataClient {
87
87
  (opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== (opts === null || opts === void 0 ? void 0 : opts.universeDomain)) {
88
88
  throw new Error('Please set either universe_domain or universeDomain, but not both.');
89
89
  }
90
+ const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
91
+ ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
92
+ : undefined;
90
93
  this._universeDomain =
91
- (_b = (_a = opts === null || opts === void 0 ? void 0 : opts.universeDomain) !== null && _a !== void 0 ? _a : opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== null && _b !== void 0 ? _b : 'googleapis.com';
94
+ (_c = (_b = (_a = opts === null || opts === void 0 ? void 0 : opts.universeDomain) !== null && _a !== void 0 ? _a : opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== null && _b !== void 0 ? _b : universeDomainEnvVar) !== null && _c !== void 0 ? _c : 'googleapis.com';
92
95
  this._servicePath = 'analyticsdata.' + this._universeDomain;
93
96
  const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath;
94
97
  this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint));
95
98
  const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port;
96
- const clientConfig = (_c = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _c !== void 0 ? _c : {};
97
- const fallback = (_d = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _d !== void 0 ? _d : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function');
99
+ const clientConfig = (_d = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _d !== void 0 ? _d : {};
100
+ const fallback = (_e = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _e !== void 0 ? _e : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function');
98
101
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
99
102
  // Request numeric enum values if REST transport is used.
100
103
  opts.numericEnums = true;
@@ -124,7 +127,7 @@ class BetaAnalyticsDataClient {
124
127
  }
125
128
  // Determine the client header string.
126
129
  const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
127
- if (typeof process !== 'undefined' && 'versions' in process) {
130
+ if (typeof process === 'object' && 'versions' in process) {
128
131
  clientHeader.push(`gl-node/${process.versions.node}`);
129
132
  }
130
133
  else {
@@ -245,7 +248,7 @@ class BetaAnalyticsDataClient {
245
248
  * @returns {string} The DNS address for this service.
246
249
  */
247
250
  static get servicePath() {
248
- if (typeof process !== undefined &&
251
+ if (typeof process === 'object' &&
249
252
  typeof process.emitWarning === 'function') {
250
253
  process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
251
254
  }
@@ -257,7 +260,7 @@ class BetaAnalyticsDataClient {
257
260
  * @returns {string} The DNS address for this service.
258
261
  */
259
262
  static get apiEndpoint() {
260
- if (typeof process !== undefined &&
263
+ if (typeof process === 'object' &&
261
264
  typeof process.emitWarning === 'function') {
262
265
  process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
263
266
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google-analytics/data",
3
- "version": "4.4.0",
3
+ "version": "4.6.0",
4
4
  "description": "Data client for Node.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -51,8 +51,8 @@
51
51
  "@types/mocha": "^9.0.0",
52
52
  "@types/node": "^20.4.5",
53
53
  "@types/sinon": "^17.0.0",
54
- "c8": "^8.0.1",
55
- "gapic-tools": "^0.3.0",
54
+ "c8": "^9.0.0",
55
+ "gapic-tools": "^0.4.0",
56
56
  "gts": "^5.0.0",
57
57
  "jsdoc": "^4.0.0",
58
58
  "jsdoc-fresh": "^3.0.0",