@googlemaps/routing 1.1.0 → 1.3.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.
Files changed (31) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/build/protos/google/geo/type/viewport.proto +1 -1
  3. package/build/protos/google/maps/routing/v2/fallback_info.proto +5 -4
  4. package/build/protos/google/maps/routing/v2/geocoding_results.proto +4 -4
  5. package/build/protos/google/maps/routing/v2/localized_time.proto +1 -1
  6. package/build/protos/google/maps/routing/v2/location.proto +2 -2
  7. package/build/protos/google/maps/routing/v2/maneuver.proto +2 -2
  8. package/build/protos/google/maps/routing/v2/navigation_instruction.proto +5 -4
  9. package/build/protos/google/maps/routing/v2/polyline.proto +3 -3
  10. package/build/protos/google/maps/routing/v2/route.proto +11 -11
  11. package/build/protos/google/maps/routing/v2/route_label.proto +3 -3
  12. package/build/protos/google/maps/routing/v2/route_modifiers.proto +6 -6
  13. package/build/protos/google/maps/routing/v2/route_travel_mode.proto +1 -1
  14. package/build/protos/google/maps/routing/v2/routes_service.proto +49 -40
  15. package/build/protos/google/maps/routing/v2/routing_preference.proto +6 -4
  16. package/build/protos/google/maps/routing/v2/speed_reading_interval.proto +3 -3
  17. package/build/protos/google/maps/routing/v2/toll_info.proto +5 -5
  18. package/build/protos/google/maps/routing/v2/toll_passes.proto +17 -2
  19. package/build/protos/google/maps/routing/v2/traffic_model.proto +1 -1
  20. package/build/protos/google/maps/routing/v2/transit.proto +1 -1
  21. package/build/protos/google/maps/routing/v2/transit_preferences.proto +1 -1
  22. package/build/protos/google/maps/routing/v2/units.proto +1 -1
  23. package/build/protos/google/maps/routing/v2/vehicle_emission_type.proto +2 -2
  24. package/build/protos/google/maps/routing/v2/vehicle_info.proto +2 -2
  25. package/build/protos/google/maps/routing/v2/waypoint.proto +5 -5
  26. package/build/protos/protos.d.ts +779 -16
  27. package/build/protos/protos.js +3019 -257
  28. package/build/protos/protos.json +358 -16
  29. package/build/src/v2/routes_client.d.ts +45 -36
  30. package/build/src/v2/routes_client.js +34 -27
  31. package/package.json +3 -3
@@ -118,7 +118,7 @@ export declare class RoutesClient {
118
118
  * the input. You can provide the response field mask by using URL parameter
119
119
  * `$fields` or `fields`, or by using an HTTP/gRPC header `X-Goog-FieldMask`
120
120
  * (see the [available URL parameters and
121
- * headers](https://cloud.google.com/apis/docs/system-parameters). The value
121
+ * headers](https://cloud.google.com/apis/docs/system-parameters)). The value
122
122
  * is a comma separated list of field paths. See detailed documentation about
123
123
  * [how to construct the field
124
124
  * paths](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto).
@@ -173,14 +173,16 @@ export declare class RoutesClient {
173
173
  * Optional. The departure time. If you don't set this value, then this value
174
174
  * defaults to the time that you made the request.
175
175
  * NOTE: You can only specify a `departure_time` in the past when
176
- * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} is set to
177
- * `TRANSIT`.
176
+ * {@link protos.google.maps.routing.v2.RouteTravelMode|`RouteTravelMode`} is set to
177
+ * `TRANSIT`. Transit trips are available for up to 7 days in the past or 100
178
+ * days in the future.
178
179
  * @param {google.protobuf.Timestamp} [request.arrivalTime]
179
180
  * Optional. The arrival time.
180
181
  * NOTE: Can only be set when
181
182
  * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} is set to
182
- * `TRANSIT`. You can specify either departure_time or arrival_time, but not
183
- * both.
183
+ * `TRANSIT`. You can specify either `departure_time` or `arrival_time`, but
184
+ * not both. Transit trips are available for up to 7 days in the past or 100
185
+ * days in the future.
184
186
  * @param {boolean} [request.computeAlternativeRoutes]
185
187
  * Optional. Specifies whether to calculate alternate routes in addition to
186
188
  * the route. No alternative routes are returned for requests that have
@@ -190,21 +192,22 @@ export declare class RoutesClient {
190
192
  * calculated.
191
193
  * @param {string} [request.languageCode]
192
194
  * Optional. The BCP-47 language code, such as "en-US" or "sr-Latn". For more
193
- * information, see
194
- * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. See
195
- * [Language Support](https://developers.google.com/maps/faq#languagesupport)
195
+ * information, see [Unicode Locale
196
+ * Identifier](http://www.unicode.org/reports/tr35/#Unicode_locale_identifier).
197
+ * See [Language
198
+ * Support](https://developers.google.com/maps/faq#languagesupport)
196
199
  * for the list of supported languages. When you don't provide this value, the
197
200
  * display language is inferred from the location of the route request.
198
201
  * @param {string} [request.regionCode]
199
202
  * Optional. The region code, specified as a ccTLD ("top-level domain")
200
- * two-character value. For more information see
201
- * https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains
203
+ * two-character value. For more information see [Country code top-level
204
+ * domains](https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains).
202
205
  * @param {google.maps.routing.v2.Units} [request.units]
203
206
  * Optional. Specifies the units of measure for the display fields. These
204
207
  * fields include the `instruction` field in
205
- * {@link protos.google.maps.routing.v2.NavigationInstruction|NavigationInstruction}. The
206
- * units of measure used for the route, leg, step distance, and duration are
207
- * not affected by this value. If you don't provide this value, then the
208
+ * {@link protos.google.maps.routing.v2.NavigationInstruction|`NavigationInstruction`}.
209
+ * The units of measure used for the route, leg, step distance, and duration
210
+ * are not affected by this value. If you don't provide this value, then the
208
211
  * display units are inferred from the location of the first origin.
209
212
  * @param {boolean} [request.optimizeWaypointOrder]
210
213
  * Optional. If set to true, the service attempts to minimize the overall cost
@@ -231,19 +234,20 @@ export declare class RoutesClient {
231
234
  * @param {google.maps.routing.v2.TrafficModel} [request.trafficModel]
232
235
  * Optional. Specifies the assumptions to use when calculating time in
233
236
  * traffic. This setting affects the value returned in the duration field in
234
- * the {@link protos.google.maps.routing.v2.Route|Route} and
235
- * {@link protos.google.maps.routing.v2.RouteLeg|RouteLeg} which contains the predicted
237
+ * the
238
+ * {@link protos.google.maps.routing.v2.Route|`Route`} and
239
+ * {@link protos.google.maps.routing.v2.RouteLeg|`RouteLeg`} which contains the predicted
236
240
  * time in traffic based on historical averages.
237
241
  * `TrafficModel` is only available for requests that have set
238
- * {@link protos.google.maps.routing.v2.RoutingPreference|RoutingPreference} to
242
+ * {@link protos.google.maps.routing.v2.RoutingPreference|`RoutingPreference`} to
239
243
  * `TRAFFIC_AWARE_OPTIMAL` and
240
- * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} to `DRIVE`.
244
+ * {@link protos.google.maps.routing.v2.RouteTravelMode|`RouteTravelMode`} to `DRIVE`.
241
245
  * Defaults to `BEST_GUESS` if traffic is requested and `TrafficModel` is not
242
246
  * specified.
243
247
  * @param {google.maps.routing.v2.TransitPreferences} [request.transitPreferences]
244
248
  * Optional. Specifies preferences that influence the route returned for
245
249
  * `TRANSIT` routes. NOTE: You can only specify a `transit_preferences` when
246
- * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} is set to
250
+ * {@link protos.google.maps.routing.v2.RouteTravelMode|`RouteTravelMode`} is set to
247
251
  * `TRANSIT`.
248
252
  * @param {object} [options]
249
253
  * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
@@ -269,9 +273,9 @@ export declare class RoutesClient {
269
273
  * the input. You can provide the response field mask by using the URL
270
274
  * parameter `$fields` or `fields`, or by using the HTTP/gRPC header
271
275
  * `X-Goog-FieldMask` (see the [available URL parameters and
272
- * headers](https://cloud.google.com/apis/docs/system-parameters). The value
273
- * is a comma separated list of field paths. See this detailed documentation
274
- * about [how to construct the field
276
+ * headers](https://cloud.google.com/apis/docs/system-parameters)).
277
+ * The value is a comma separated list of field paths. See this detailed
278
+ * documentation about [how to construct the field
275
279
  * paths](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto).
276
280
  *
277
281
  * For example, in this method:
@@ -305,12 +309,14 @@ export declare class RoutesClient {
305
309
  * matrix. Several size restrictions apply to the cardinality of origins and
306
310
  * destinations:
307
311
  *
308
- * * The number of elements (origins × destinations) must be no greater than
309
- * 625 in any case.
310
- * * The number of elements (origins × destinations) must be no greater than
311
- * 100 if routing_preference is set to `TRAFFIC_AWARE_OPTIMAL`.
312
- * * The number of waypoints (origins + destinations) specified as `place_id`
313
- * must be no greater than 50.
312
+ * * The sum of the number of origins + the number of destinations specified
313
+ * as either `place_id` or `address` must be no greater than 50.
314
+ * * The product of number of origins × number of destinations must be no
315
+ * greater than 625 in any case.
316
+ * * The product of the number of origins × number of destinations must be no
317
+ * greater than 100 if routing_preference is set to `TRAFFIC_AWARE_OPTIMAL`.
318
+ * * The product of the number of origins × number of destinations must be no
319
+ * greater than 100 if travel_mode is set to `TRANSIT`.
314
320
  * @param {number[]} request.destinations
315
321
  * Required. Array of destinations, which determines the columns of the
316
322
  * response matrix.
@@ -326,25 +332,28 @@ export declare class RoutesClient {
326
332
  * Optional. The departure time. If you don't set this value, then this value
327
333
  * defaults to the time that you made the request.
328
334
  * NOTE: You can only specify a `departure_time` in the past when
329
- * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} is set to
335
+ * {@link protos.google.maps.routing.v2.RouteTravelMode|`RouteTravelMode`} is set to
330
336
  * `TRANSIT`.
331
337
  * @param {google.protobuf.Timestamp} [request.arrivalTime]
332
338
  * Optional. The arrival time.
333
339
  * NOTE: Can only be set when
334
- * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} is set to
335
- * `TRANSIT`. You can specify either departure_time or arrival_time, but not
336
- * both.
340
+ * {@link protos.google.maps.routing.v2.RouteTravelMode|`RouteTravelMode`} is set to
341
+ * `TRANSIT`. You can specify either `departure_time` or `arrival_time`, but
342
+ * not both.
337
343
  * @param {string} [request.languageCode]
338
344
  * Optional. The BCP-47 language code, such as "en-US" or "sr-Latn". For more
339
- * information, see
340
- * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. See
341
- * [Language Support](https://developers.google.com/maps/faq#languagesupport)
345
+ * information, see [Unicode Locale
346
+ * Identifier](http://www.unicode.org/reports/tr35/#Unicode_locale_identifier).
347
+ * See [Language
348
+ * Support](https://developers.google.com/maps/faq#languagesupport)
342
349
  * for the list of supported languages. When you don't provide this value, the
343
350
  * display language is inferred from the location of the first origin.
344
351
  * @param {string} [request.regionCode]
345
352
  * Optional. The region code, specified as a ccTLD ("top-level domain")
346
- * two-character value. For more information see
347
- * https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains
353
+ * two-character value. For more information see [Country code top-level
354
+ * domains](https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains).
355
+ * @param {google.maps.routing.v2.Units} [request.units]
356
+ * Optional. Specifies the units of measure for the display fields.
348
357
  * @param {number[]} [request.extraComputations]
349
358
  * Optional. A list of extra computations which may be used to complete the
350
359
  * request. Note: These extra computations may return extra fields on the
@@ -73,7 +73,7 @@ class RoutesClient {
73
73
  * ```
74
74
  */
75
75
  constructor(opts, gaxInstance) {
76
- var _a, _b, _c, _d;
76
+ var _a, _b, _c, _d, _e;
77
77
  this._terminated = false;
78
78
  this.descriptors = {
79
79
  page: {},
@@ -88,14 +88,17 @@ class RoutesClient {
88
88
  (opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== (opts === null || opts === void 0 ? void 0 : opts.universeDomain)) {
89
89
  throw new Error('Please set either universe_domain or universeDomain, but not both.');
90
90
  }
91
+ const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
92
+ ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
93
+ : undefined;
91
94
  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';
95
+ (_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';
93
96
  this._servicePath = 'routes.' + this._universeDomain;
94
97
  const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath;
95
98
  this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint));
96
99
  const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port;
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');
100
+ const clientConfig = (_d = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _d !== void 0 ? _d : {};
101
+ 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');
99
102
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
100
103
  // Request numeric enum values if REST transport is used.
101
104
  opts.numericEnums = true;
@@ -125,7 +128,7 @@ class RoutesClient {
125
128
  }
126
129
  // Determine the client header string.
127
130
  const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
128
- if (typeof process !== 'undefined' && 'versions' in process) {
131
+ if (typeof process === 'object' && 'versions' in process) {
129
132
  clientHeader.push(`gl-node/${process.versions.node}`);
130
133
  }
131
134
  else {
@@ -145,8 +148,7 @@ class RoutesClient {
145
148
  // Some of the methods on this service provide streaming responses.
146
149
  // Provide descriptors for these.
147
150
  this.descriptors.stream = {
148
- computeRouteMatrix: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback,
149
- /* gaxStreamingRetries: */ false),
151
+ computeRouteMatrix: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries),
150
152
  };
151
153
  // Put together the default options sent with requests.
152
154
  this._defaults = this._gaxGrpc.constructSettings('google.maps.routing.v2.Routes', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
@@ -211,7 +213,7 @@ class RoutesClient {
211
213
  * @returns {string} The DNS address for this service.
212
214
  */
213
215
  static get servicePath() {
214
- if (typeof process !== undefined &&
216
+ if (typeof process === 'object' &&
215
217
  typeof process.emitWarning === 'function') {
216
218
  process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
217
219
  }
@@ -223,7 +225,7 @@ class RoutesClient {
223
225
  * @returns {string} The DNS address for this service.
224
226
  */
225
227
  static get apiEndpoint() {
226
- if (typeof process !== undefined &&
228
+ if (typeof process === 'object' &&
227
229
  typeof process.emitWarning === 'function') {
228
230
  process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
229
231
  }
@@ -289,9 +291,9 @@ class RoutesClient {
289
291
  * the input. You can provide the response field mask by using the URL
290
292
  * parameter `$fields` or `fields`, or by using the HTTP/gRPC header
291
293
  * `X-Goog-FieldMask` (see the [available URL parameters and
292
- * headers](https://cloud.google.com/apis/docs/system-parameters). The value
293
- * is a comma separated list of field paths. See this detailed documentation
294
- * about [how to construct the field
294
+ * headers](https://cloud.google.com/apis/docs/system-parameters)).
295
+ * The value is a comma separated list of field paths. See this detailed
296
+ * documentation about [how to construct the field
295
297
  * paths](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto).
296
298
  *
297
299
  * For example, in this method:
@@ -325,12 +327,14 @@ class RoutesClient {
325
327
  * matrix. Several size restrictions apply to the cardinality of origins and
326
328
  * destinations:
327
329
  *
328
- * * The number of elements (origins × destinations) must be no greater than
329
- * 625 in any case.
330
- * * The number of elements (origins × destinations) must be no greater than
331
- * 100 if routing_preference is set to `TRAFFIC_AWARE_OPTIMAL`.
332
- * * The number of waypoints (origins + destinations) specified as `place_id`
333
- * must be no greater than 50.
330
+ * * The sum of the number of origins + the number of destinations specified
331
+ * as either `place_id` or `address` must be no greater than 50.
332
+ * * The product of number of origins × number of destinations must be no
333
+ * greater than 625 in any case.
334
+ * * The product of the number of origins × number of destinations must be no
335
+ * greater than 100 if routing_preference is set to `TRAFFIC_AWARE_OPTIMAL`.
336
+ * * The product of the number of origins × number of destinations must be no
337
+ * greater than 100 if travel_mode is set to `TRANSIT`.
334
338
  * @param {number[]} request.destinations
335
339
  * Required. Array of destinations, which determines the columns of the
336
340
  * response matrix.
@@ -346,25 +350,28 @@ class RoutesClient {
346
350
  * Optional. The departure time. If you don't set this value, then this value
347
351
  * defaults to the time that you made the request.
348
352
  * NOTE: You can only specify a `departure_time` in the past when
349
- * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} is set to
353
+ * {@link protos.google.maps.routing.v2.RouteTravelMode|`RouteTravelMode`} is set to
350
354
  * `TRANSIT`.
351
355
  * @param {google.protobuf.Timestamp} [request.arrivalTime]
352
356
  * Optional. The arrival time.
353
357
  * NOTE: Can only be set when
354
- * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} is set to
355
- * `TRANSIT`. You can specify either departure_time or arrival_time, but not
356
- * both.
358
+ * {@link protos.google.maps.routing.v2.RouteTravelMode|`RouteTravelMode`} is set to
359
+ * `TRANSIT`. You can specify either `departure_time` or `arrival_time`, but
360
+ * not both.
357
361
  * @param {string} [request.languageCode]
358
362
  * Optional. The BCP-47 language code, such as "en-US" or "sr-Latn". For more
359
- * information, see
360
- * http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. See
361
- * [Language Support](https://developers.google.com/maps/faq#languagesupport)
363
+ * information, see [Unicode Locale
364
+ * Identifier](http://www.unicode.org/reports/tr35/#Unicode_locale_identifier).
365
+ * See [Language
366
+ * Support](https://developers.google.com/maps/faq#languagesupport)
362
367
  * for the list of supported languages. When you don't provide this value, the
363
368
  * display language is inferred from the location of the first origin.
364
369
  * @param {string} [request.regionCode]
365
370
  * Optional. The region code, specified as a ccTLD ("top-level domain")
366
- * two-character value. For more information see
367
- * https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains
371
+ * two-character value. For more information see [Country code top-level
372
+ * domains](https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains).
373
+ * @param {google.maps.routing.v2.Units} [request.units]
374
+ * Optional. Specifies the units of measure for the display fields.
368
375
  * @param {number[]} [request.extraComputations]
369
376
  * Optional. A list of extra computations which may be used to complete the
370
377
  * request. Note: These extra computations may return extra fields on the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@googlemaps/routing",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": " client for Node.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -52,8 +52,8 @@
52
52
  "@types/mocha": "^9.0.0",
53
53
  "@types/node": "^20.4.5",
54
54
  "@types/sinon": "^17.0.0",
55
- "c8": "^8.0.1",
56
- "gapic-tools": "^0.3.0",
55
+ "c8": "^9.0.0",
56
+ "gapic-tools": "^0.4.0",
57
57
  "gts": "^5.0.0",
58
58
  "jsdoc": "^4.0.0",
59
59
  "jsdoc-fresh": "^3.0.0",