@googlemaps/routing 0.5.1 → 1.0.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.
@@ -163,8 +163,16 @@ export declare class RoutesClient {
163
163
  * Optional. Specifies the preferred encoding for the polyline.
164
164
  * @param {google.protobuf.Timestamp} [request.departureTime]
165
165
  * Optional. The departure time. If you don't set this value, then this value
166
- * defaults to the time that you made the request. If you set this value to a
167
- * time that has already occurred, then the request fails.
166
+ * defaults to the time that you made the request.
167
+ * NOTE: You can only specify a `departure_time` in the past when
168
+ * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} is set to
169
+ * `TRANSIT`.
170
+ * @param {google.protobuf.Timestamp} [request.arrivalTime]
171
+ * Optional. The arrival time.
172
+ * NOTE: Can only be set when
173
+ * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} is set to
174
+ * `TRANSIT`. You can specify either departure_time or arrival_time, but not
175
+ * both.
168
176
  * @param {boolean} [request.computeAlternativeRoutes]
169
177
  * Optional. Specifies whether to calculate alternate routes in addition to
170
178
  * the route. No alternative routes are returned for requests that have
@@ -184,12 +192,23 @@ export declare class RoutesClient {
184
192
  * two-character value. For more information see
185
193
  * https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains#Country_code_top-level_domains
186
194
  * @param {google.maps.routing.v2.Units} [request.units]
187
- * Optional. Specifies the units of measure for the display fields. This
188
- * includes the `instruction` field in
189
- * {@link google.maps.routing.v2.NavigationInstruction|NavigationInstruction}. The
195
+ * Optional. Specifies the units of measure for the display fields. These
196
+ * fields include the `instruction` field in
197
+ * {@link protos.google.maps.routing.v2.NavigationInstruction|NavigationInstruction}. The
190
198
  * units of measure used for the route, leg, step distance, and duration are
191
199
  * not affected by this value. If you don't provide this value, then the
192
- * display units are inferred from the location of the request.
200
+ * display units are inferred from the location of the first origin.
201
+ * @param {boolean} [request.optimizeWaypointOrder]
202
+ * Optional. If set to true, the service attempts to minimize the overall cost
203
+ * of the route by re-ordering the specified intermediate waypoints. The
204
+ * request fails if any of the intermediate waypoints is a `via` waypoint. Use
205
+ * `ComputeRoutesResponse.Routes.optimized_intermediate_waypoint_index` to
206
+ * find the new ordering.
207
+ * If `ComputeRoutesResponseroutes.optimized_intermediate_waypoint_index` is
208
+ * not requested in the `X-Goog-FieldMask` header, the request fails.
209
+ * If `optimize_waypoint_order` is set to false,
210
+ * `ComputeRoutesResponse.optimized_intermediate_waypoint_index` will be
211
+ * empty.
193
212
  * @param {number[]} [request.requestedReferenceRoutes]
194
213
  * Optional. Specifies what reference routes to calculate as part of the
195
214
  * request in addition to the default route. A reference route is a route with
@@ -201,12 +220,28 @@ export declare class RoutesClient {
201
220
  * request. Note: These extra computations may return extra fields on the
202
221
  * response. These extra fields must also be specified in the field mask to be
203
222
  * returned in the response.
223
+ * @param {google.maps.routing.v2.TrafficModel} [request.trafficModel]
224
+ * Optional. Specifies the assumptions to use when calculating time in
225
+ * traffic. This setting affects the value returned in the duration field in
226
+ * the {@link protos.google.maps.routing.v2.Route|Route} and
227
+ * {@link protos.google.maps.routing.v2.RouteLeg|RouteLeg} which contains the predicted
228
+ * time in traffic based on historical averages.
229
+ * `TrafficModel` is only available for requests that have set
230
+ * {@link protos.google.maps.routing.v2.RoutingPreference|RoutingPreference} to
231
+ * `TRAFFIC_AWARE_OPTIMAL` and
232
+ * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} to `DRIVE`.
233
+ * Defaults to `BEST_GUESS` if traffic is requested and `TrafficModel` is not
234
+ * specified.
235
+ * @param {google.maps.routing.v2.TransitPreferences} [request.transitPreferences]
236
+ * Optional. Specifies preferences that influence the route returned for
237
+ * `TRANSIT` routes. NOTE: You can only specify a `transit_preferences` when
238
+ * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} is set to
239
+ * `TRANSIT`.
204
240
  * @param {object} [options]
205
241
  * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
206
242
  * @returns {Promise} - The promise which resolves to an array.
207
- * The first element of the array is an object representing {@link google.maps.routing.v2.ComputeRoutesResponse | ComputeRoutesResponse}.
208
- * Please see the
209
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
243
+ * The first element of the array is an object representing {@link protos.google.maps.routing.v2.ComputeRoutesResponse|ComputeRoutesResponse}.
244
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
210
245
  * for more details and examples.
211
246
  * @example <caption>include:samples/generated/v2/routes.compute_routes.js</caption>
212
247
  * region_tag:routes_v2_generated_Routes_ComputeRoutes_async
@@ -280,9 +315,17 @@ export declare class RoutesClient {
280
315
  * returned. You can specify this option only when the `travel_mode` is
281
316
  * `DRIVE` or `TWO_WHEELER`, otherwise the request fails.
282
317
  * @param {google.protobuf.Timestamp} [request.departureTime]
283
- * Optional. The departure time. If you don't set this value, this defaults to
284
- * the time that you made the request. If you set this value to a time that
285
- * has already occurred, the request fails.
318
+ * Optional. The departure time. If you don't set this value, then this value
319
+ * defaults to the time that you made the request.
320
+ * NOTE: You can only specify a `departure_time` in the past when
321
+ * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} is set to
322
+ * `TRANSIT`.
323
+ * @param {google.protobuf.Timestamp} [request.arrivalTime]
324
+ * Optional. The arrival time.
325
+ * NOTE: Can only be set when
326
+ * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} is set to
327
+ * `TRANSIT`. You can specify either departure_time or arrival_time, but not
328
+ * both.
286
329
  * @param {string} [request.languageCode]
287
330
  * Optional. The BCP-47 language code, such as "en-US" or "sr-Latn". For more
288
331
  * information, see
@@ -299,12 +342,26 @@ export declare class RoutesClient {
299
342
  * request. Note: These extra computations may return extra fields on the
300
343
  * response. These extra fields must also be specified in the field mask to be
301
344
  * returned in the response.
345
+ * @param {google.maps.routing.v2.TrafficModel} [request.trafficModel]
346
+ * Optional. Specifies the assumptions to use when calculating time in
347
+ * traffic. This setting affects the value returned in the duration field in
348
+ * the {@link protos.google.maps.routing.v2.RouteMatrixElement|RouteMatrixElement} which
349
+ * contains the predicted time in traffic based on historical averages.
350
+ * {@link protos.google.maps.routing.v2.RoutingPreference|RoutingPreference} to
351
+ * `TRAFFIC_AWARE_OPTIMAL` and
352
+ * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} to `DRIVE`.
353
+ * Defaults to `BEST_GUESS` if traffic is requested and `TrafficModel` is not
354
+ * specified.
355
+ * @param {google.maps.routing.v2.TransitPreferences} [request.transitPreferences]
356
+ * Optional. Specifies preferences that influence the route returned for
357
+ * `TRANSIT` routes. NOTE: You can only specify a `transit_preferences` when
358
+ * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} is set to
359
+ * `TRANSIT`.
302
360
  * @param {object} [options]
303
361
  * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
304
362
  * @returns {Stream}
305
- * An object stream which emits {@link google.maps.routing.v2.RouteMatrixElement | RouteMatrixElement} on 'data' event.
306
- * Please see the
307
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming)
363
+ * An object stream which emits {@link protos.google.maps.routing.v2.RouteMatrixElement|RouteMatrixElement} on 'data' event.
364
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming | documentation }
308
365
  * for more details and examples.
309
366
  * @example <caption>include:samples/generated/v2/routes.compute_route_matrix.js</caption>
310
367
  * region_tag:routes_v2_generated_Routes_ComputeRouteMatrix_async
@@ -316,9 +316,17 @@ class RoutesClient {
316
316
  * returned. You can specify this option only when the `travel_mode` is
317
317
  * `DRIVE` or `TWO_WHEELER`, otherwise the request fails.
318
318
  * @param {google.protobuf.Timestamp} [request.departureTime]
319
- * Optional. The departure time. If you don't set this value, this defaults to
320
- * the time that you made the request. If you set this value to a time that
321
- * has already occurred, the request fails.
319
+ * Optional. The departure time. If you don't set this value, then this value
320
+ * defaults to the time that you made the request.
321
+ * NOTE: You can only specify a `departure_time` in the past when
322
+ * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} is set to
323
+ * `TRANSIT`.
324
+ * @param {google.protobuf.Timestamp} [request.arrivalTime]
325
+ * Optional. The arrival time.
326
+ * NOTE: Can only be set when
327
+ * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} is set to
328
+ * `TRANSIT`. You can specify either departure_time or arrival_time, but not
329
+ * both.
322
330
  * @param {string} [request.languageCode]
323
331
  * Optional. The BCP-47 language code, such as "en-US" or "sr-Latn". For more
324
332
  * information, see
@@ -335,12 +343,26 @@ class RoutesClient {
335
343
  * request. Note: These extra computations may return extra fields on the
336
344
  * response. These extra fields must also be specified in the field mask to be
337
345
  * returned in the response.
346
+ * @param {google.maps.routing.v2.TrafficModel} [request.trafficModel]
347
+ * Optional. Specifies the assumptions to use when calculating time in
348
+ * traffic. This setting affects the value returned in the duration field in
349
+ * the {@link protos.google.maps.routing.v2.RouteMatrixElement|RouteMatrixElement} which
350
+ * contains the predicted time in traffic based on historical averages.
351
+ * {@link protos.google.maps.routing.v2.RoutingPreference|RoutingPreference} to
352
+ * `TRAFFIC_AWARE_OPTIMAL` and
353
+ * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} to `DRIVE`.
354
+ * Defaults to `BEST_GUESS` if traffic is requested and `TrafficModel` is not
355
+ * specified.
356
+ * @param {google.maps.routing.v2.TransitPreferences} [request.transitPreferences]
357
+ * Optional. Specifies preferences that influence the route returned for
358
+ * `TRANSIT` routes. NOTE: You can only specify a `transit_preferences` when
359
+ * {@link protos.google.maps.routing.v2.RouteTravelMode|RouteTravelMode} is set to
360
+ * `TRANSIT`.
338
361
  * @param {object} [options]
339
362
  * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
340
363
  * @returns {Stream}
341
- * An object stream which emits {@link google.maps.routing.v2.RouteMatrixElement | RouteMatrixElement} on 'data' event.
342
- * Please see the
343
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming)
364
+ * An object stream which emits {@link protos.google.maps.routing.v2.RouteMatrixElement|RouteMatrixElement} on 'data' event.
365
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming | documentation }
344
366
  * for more details and examples.
345
367
  * @example <caption>include:samples/generated/v2/routes.compute_route_matrix.js</caption>
346
368
  * region_tag:routes_v2_generated_Routes_ComputeRouteMatrix_async
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@googlemaps/routing",
3
- "version": "0.5.1",
3
+ "version": "1.0.0",
4
4
  "description": " client for Node.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -31,7 +31,7 @@
31
31
  ],
32
32
  "scripts": {
33
33
  "clean": "gts clean",
34
- "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson",
34
+ "compile": "tsc -p . && cp -r protos build/",
35
35
  "compile-protos": "compileProtos src",
36
36
  "docs": "jsdoc -c .jsdoc.js",
37
37
  "predocs-test": "npm run docs",
@@ -39,34 +39,33 @@
39
39
  "fix": "gts fix",
40
40
  "lint": "gts check",
41
41
  "prepare": "npm run compile-protos && npm run compile",
42
- "system-test": "npm run compile && c8 mocha build/system-test",
43
- "test": "c8 mocha build/test",
44
- "samples-test": "npm run compile && cd samples/ && npm link ../ && npm i && npm test",
45
- "prelint": "cd samples; npm link ../; npm i"
42
+ "prelint": "cd samples; npm link ../; npm i",
43
+ "postpack": "minifyProtoJson",
44
+ "samples-test": "cd samples/ && npm link ../ && npm i && npm test",
45
+ "system-test": "c8 mocha build/system-test",
46
+ "test": "c8 mocha build/test"
46
47
  },
47
48
  "dependencies": {
48
- "google-gax": "^3.5.8"
49
+ "google-gax": "^4.0.3"
49
50
  },
50
51
  "devDependencies": {
51
52
  "@types/mocha": "^9.0.0",
52
- "@types/node": "^18.0.0",
53
+ "@types/node": "^20.4.5",
53
54
  "@types/sinon": "^10.0.0",
54
- "c8": "^7.3.5",
55
- "gts": "^3.1.0",
55
+ "c8": "^8.0.1",
56
+ "gapic-tools": "^0.1.8",
57
+ "gts": "^5.0.0",
56
58
  "jsdoc": "^4.0.0",
57
59
  "jsdoc-fresh": "^2.0.0",
58
60
  "jsdoc-region-tag": "^2.0.0",
59
- "linkinator": "^4.0.0",
61
+ "linkinator": "4.1.2",
62
+ "long": "^5.2.3",
60
63
  "mocha": "^9.2.2",
61
- "null-loader": "^4.0.1",
62
64
  "pack-n-play": "^1.0.0-2",
63
65
  "sinon": "^15.0.0",
64
- "ts-loader": "^9.0.0",
65
- "typescript": "^4.6.4",
66
- "webpack": "^5.9.0",
67
- "webpack-cli": "^5.0.0"
66
+ "typescript": "^5.1.6"
68
67
  },
69
68
  "engines": {
70
- "node": ">=12.0.0"
69
+ "node": ">=14.0.0"
71
70
  }
72
71
  }