@googlemaps/routing 1.0.1 → 1.1.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.1.0](https://github.com/googleapis/google-cloud-node/compare/routing-v1.0.2...routing-v1.1.0) (2024-02-09)
4
+
5
+
6
+ ### Features
7
+
8
+ * Trusted Private Cloud support, use the universeDomain parameter ([#5029](https://github.com/googleapis/google-cloud-node/issues/5029)) ([09e59ad](https://github.com/googleapis/google-cloud-node/commit/09e59ad6e34001a33d01894ccd5a0643f1a84883))
9
+
10
+ ## [1.0.2](https://github.com/googleapis/google-cloud-node/compare/routing-v1.0.1...routing-v1.0.2) (2024-01-23)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * [Many APIs] improve retry logic for streaming API calls ([#4969](https://github.com/googleapis/google-cloud-node/issues/4969)) ([70fe30a](https://github.com/googleapis/google-cloud-node/commit/70fe30af077ab6042822d62d31ca740dd5df55dd))
16
+
3
17
  ## [1.0.1](https://github.com/googleapis/google-cloud-node/compare/routing-v1.0.0...routing-v1.0.1) (2023-09-06)
4
18
 
5
19
 
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Google LLC
1
+ // Copyright 2024 Google LLC
2
2
  //
3
3
  // Licensed under the Apache License, Version 2.0 (the "License");
4
4
  // you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- // Copyright 2023 Google LLC
1
+ // Copyright 2024 Google LLC
2
2
  //
3
3
  // Licensed under the Apache License, Version 2.0 (the "License");
4
4
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2023 Google LLC
2
+ // Copyright 2024 Google LLC
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2023 Google LLC
2
+ // Copyright 2024 Google LLC
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -14,6 +14,8 @@ export declare class RoutesClient {
14
14
  private _gaxGrpc;
15
15
  private _protos;
16
16
  private _defaults;
17
+ private _universeDomain;
18
+ private _servicePath;
17
19
  auth: gax.GoogleAuth;
18
20
  descriptors: Descriptors;
19
21
  warn: (code: string, message: string, warnType?: string) => void;
@@ -79,15 +81,22 @@ export declare class RoutesClient {
79
81
  }>;
80
82
  /**
81
83
  * The DNS address for this API service.
84
+ * @deprecated Use the apiEndpoint method of the client instance.
82
85
  * @returns {string} The DNS address for this service.
83
86
  */
84
87
  static get servicePath(): string;
85
88
  /**
86
- * The DNS address for this API service - same as servicePath(),
87
- * exists for compatibility reasons.
89
+ * The DNS address for this API service - same as servicePath.
90
+ * @deprecated Use the apiEndpoint method of the client instance.
88
91
  * @returns {string} The DNS address for this service.
89
92
  */
90
93
  static get apiEndpoint(): string;
94
+ /**
95
+ * The DNS address for this API service.
96
+ * @returns {string} The DNS address for this service.
97
+ */
98
+ get apiEndpoint(): string;
99
+ get universeDomain(): string;
91
100
  /**
92
101
  * The port for this API service.
93
102
  * @returns {number} The default port for this service.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2023 Google LLC
2
+ // Copyright 2024 Google LLC
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -73,7 +73,7 @@ class RoutesClient {
73
73
  * ```
74
74
  */
75
75
  constructor(opts, gaxInstance) {
76
- var _a, _b;
76
+ var _a, _b, _c, _d;
77
77
  this._terminated = false;
78
78
  this.descriptors = {
79
79
  page: {},
@@ -83,16 +83,24 @@ class RoutesClient {
83
83
  };
84
84
  // Ensure that options include all the required fields.
85
85
  const staticMembers = this.constructor;
86
- const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || staticMembers.servicePath;
86
+ if ((opts === null || opts === void 0 ? void 0 : opts.universe_domain) &&
87
+ (opts === null || opts === void 0 ? void 0 : opts.universeDomain) &&
88
+ (opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== (opts === null || opts === void 0 ? void 0 : opts.universeDomain)) {
89
+ throw new Error('Please set either universe_domain or universeDomain, but not both.');
90
+ }
91
+ this._universeDomain =
92
+ (_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';
93
+ this._servicePath = 'routes.' + this._universeDomain;
94
+ const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath;
87
95
  this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint));
88
96
  const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port;
89
- const clientConfig = (_a = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _a !== void 0 ? _a : {};
90
- const fallback = (_b = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _b !== void 0 ? _b : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function');
97
+ const clientConfig = (_c = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _c !== void 0 ? _c : {};
98
+ 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');
91
99
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
92
100
  // Request numeric enum values if REST transport is used.
93
101
  opts.numericEnums = true;
94
102
  // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case.
95
- if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) {
103
+ if (servicePath !== this._servicePath && !('scopes' in opts)) {
96
104
  opts['scopes'] = staticMembers.scopes;
97
105
  }
98
106
  // Load google-gax module synchronously if needed
@@ -110,9 +118,9 @@ class RoutesClient {
110
118
  // Set useJWTAccessWithScope on the auth object.
111
119
  this.auth.useJWTAccessWithScope = true;
112
120
  // Set defaultServicePath on the auth object.
113
- this.auth.defaultServicePath = staticMembers.servicePath;
121
+ this.auth.defaultServicePath = this._servicePath;
114
122
  // Set the default scopes in auth client if needed.
115
- if (servicePath === staticMembers.servicePath) {
123
+ if (servicePath === this._servicePath) {
116
124
  this.auth.defaultScopes = staticMembers.scopes;
117
125
  }
118
126
  // Determine the client header string.
@@ -137,7 +145,8 @@ class RoutesClient {
137
145
  // Some of the methods on this service provide streaming responses.
138
146
  // Provide descriptors for these.
139
147
  this.descriptors.stream = {
140
- computeRouteMatrix: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback),
148
+ computeRouteMatrix: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback,
149
+ /* gaxStreamingRetries: */ false),
141
150
  };
142
151
  // Put together the default options sent with requests.
143
152
  this._defaults = this._gaxGrpc.constructSettings('google.maps.routing.v2.Routes', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
@@ -198,19 +207,38 @@ class RoutesClient {
198
207
  }
199
208
  /**
200
209
  * The DNS address for this API service.
210
+ * @deprecated Use the apiEndpoint method of the client instance.
201
211
  * @returns {string} The DNS address for this service.
202
212
  */
203
213
  static get servicePath() {
214
+ if (typeof process !== undefined &&
215
+ typeof process.emitWarning === 'function') {
216
+ process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
217
+ }
204
218
  return 'routes.googleapis.com';
205
219
  }
206
220
  /**
207
- * The DNS address for this API service - same as servicePath(),
208
- * exists for compatibility reasons.
221
+ * The DNS address for this API service - same as servicePath.
222
+ * @deprecated Use the apiEndpoint method of the client instance.
209
223
  * @returns {string} The DNS address for this service.
210
224
  */
211
225
  static get apiEndpoint() {
226
+ if (typeof process !== undefined &&
227
+ typeof process.emitWarning === 'function') {
228
+ process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
229
+ }
212
230
  return 'routes.googleapis.com';
213
231
  }
232
+ /**
233
+ * The DNS address for this API service.
234
+ * @returns {string} The DNS address for this service.
235
+ */
236
+ get apiEndpoint() {
237
+ return this._servicePath;
238
+ }
239
+ get universeDomain() {
240
+ return this._universeDomain;
241
+ }
214
242
  /**
215
243
  * The port for this API service.
216
244
  * @returns {number} The default port for this service.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@googlemaps/routing",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": " client for Node.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -38,7 +38,7 @@
38
38
  "docs-test": "linkinator docs",
39
39
  "fix": "gts fix",
40
40
  "lint": "gts check",
41
- "prepare": "npm run compile-protos && npm run compile",
41
+ "prepare": "npm run compile",
42
42
  "prelint": "cd samples; npm link ../; npm i",
43
43
  "postpack": "minifyProtoJson",
44
44
  "samples-test": "cd samples/ && npm link ../ && npm i && npm test",
@@ -51,9 +51,9 @@
51
51
  "devDependencies": {
52
52
  "@types/mocha": "^9.0.0",
53
53
  "@types/node": "^20.4.5",
54
- "@types/sinon": "^10.0.0",
54
+ "@types/sinon": "^17.0.0",
55
55
  "c8": "^8.0.1",
56
- "gapic-tools": "^0.1.8",
56
+ "gapic-tools": "^0.3.0",
57
57
  "gts": "^5.0.0",
58
58
  "jsdoc": "^4.0.0",
59
59
  "jsdoc-fresh": "^3.0.0",
@@ -61,8 +61,8 @@
61
61
  "linkinator": "4.1.2",
62
62
  "long": "^5.2.3",
63
63
  "mocha": "^9.2.2",
64
- "pack-n-play": "^1.0.0-2",
65
- "sinon": "^15.0.0",
64
+ "pack-n-play": "^2.0.0",
65
+ "sinon": "^17.0.0",
66
66
  "typescript": "^5.1.6"
67
67
  },
68
68
  "engines": {