@googlemaps/routing 1.0.2 → 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,12 @@
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
+
3
10
  ## [1.0.2](https://github.com/googleapis/google-cloud-node/compare/routing-v1.0.1...routing-v1.0.2) (2024-01-23)
4
11
 
5
12
 
@@ -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.
@@ -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.
@@ -138,7 +146,7 @@ class RoutesClient {
138
146
  // Provide descriptors for these.
139
147
  this.descriptors.stream = {
140
148
  computeRouteMatrix: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback,
141
- /* gaxStreamingRetries: */ true),
149
+ /* gaxStreamingRetries: */ false),
142
150
  };
143
151
  // Put together the default options sent with requests.
144
152
  this._defaults = this._gaxGrpc.constructSettings('google.maps.routing.v2.Routes', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
@@ -199,19 +207,38 @@ class RoutesClient {
199
207
  }
200
208
  /**
201
209
  * The DNS address for this API service.
210
+ * @deprecated Use the apiEndpoint method of the client instance.
202
211
  * @returns {string} The DNS address for this service.
203
212
  */
204
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
+ }
205
218
  return 'routes.googleapis.com';
206
219
  }
207
220
  /**
208
- * The DNS address for this API service - same as servicePath(),
209
- * 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.
210
223
  * @returns {string} The DNS address for this service.
211
224
  */
212
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
+ }
213
230
  return 'routes.googleapis.com';
214
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
+ }
215
242
  /**
216
243
  * The port for this API service.
217
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.2",
3
+ "version": "1.1.0",
4
4
  "description": " client for Node.js",
5
5
  "repository": {
6
6
  "type": "git",