@googlemaps/routing 1.4.0 → 2.0.1
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 +23 -0
- package/README.md +2 -2
- package/build/protos/google/geo/type/viewport.proto +1 -1
- package/build/protos/google/maps/routing/v2/fallback_info.proto +1 -1
- package/build/protos/google/maps/routing/v2/geocoding_results.proto +1 -1
- package/build/protos/google/maps/routing/v2/localized_time.proto +1 -1
- package/build/protos/google/maps/routing/v2/location.proto +1 -1
- package/build/protos/google/maps/routing/v2/maneuver.proto +1 -1
- package/build/protos/google/maps/routing/v2/navigation_instruction.proto +1 -1
- package/build/protos/google/maps/routing/v2/polyline.proto +1 -1
- package/build/protos/google/maps/routing/v2/polyline_details.proto +1 -1
- package/build/protos/google/maps/routing/v2/route.proto +1 -1
- package/build/protos/google/maps/routing/v2/route_label.proto +1 -1
- package/build/protos/google/maps/routing/v2/route_modifiers.proto +1 -1
- package/build/protos/google/maps/routing/v2/route_travel_mode.proto +1 -1
- package/build/protos/google/maps/routing/v2/routes_service.proto +1 -1
- package/build/protos/google/maps/routing/v2/routing_preference.proto +1 -1
- package/build/protos/google/maps/routing/v2/speed_reading_interval.proto +1 -1
- package/build/protos/google/maps/routing/v2/toll_info.proto +1 -1
- package/build/protos/google/maps/routing/v2/toll_passes.proto +1 -1
- package/build/protos/google/maps/routing/v2/traffic_model.proto +1 -1
- package/build/protos/google/maps/routing/v2/transit.proto +1 -1
- package/build/protos/google/maps/routing/v2/transit_preferences.proto +1 -1
- package/build/protos/google/maps/routing/v2/units.proto +1 -1
- package/build/protos/google/maps/routing/v2/vehicle_emission_type.proto +1 -1
- package/build/protos/google/maps/routing/v2/vehicle_info.proto +1 -1
- package/build/protos/google/maps/routing/v2/waypoint.proto +1 -1
- package/build/protos/protos.d.ts +1 -1
- package/build/protos/protos.js +1 -1
- package/build/protos/protos.json +0 -3
- package/build/src/index.js +1 -1
- package/build/src/v2/gapic_metadata.json +38 -0
- package/build/src/v2/index.js +1 -1
- package/build/src/v2/routes_client.d.ts +2 -1
- package/build/src/v2/routes_client.js +58 -23
- package/build/src/v2/routes_proto_list.json +27 -0
- package/package.json +16 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.0.1](https://github.com/googleapis/google-cloud-node/compare/routing-v2.0.0...routing-v2.0.1) (2025-03-19)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* [Many APIs] await/catch promises, and update listOperationsAsync return type ([#6190](https://github.com/googleapis/google-cloud-node/issues/6190)) ([f4866df](https://github.com/googleapis/google-cloud-node/commit/f4866dfa6ab481163150f54928a9857d2dfef948))
|
|
9
|
+
|
|
10
|
+
## [2.0.0](https://github.com/googleapis/google-cloud-node/compare/routing-v1.4.0...routing-v2.0.0) (2025-03-18)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### ⚠ BREAKING CHANGES
|
|
14
|
+
|
|
15
|
+
* upgrade to Node 18 ([#6096](https://github.com/googleapis/google-cloud-node/issues/6096))
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* [Many APIs] add request/response debug logging to gapics ([388b4e2](https://github.com/googleapis/google-cloud-node/commit/388b4e20329b7f6fc0dd061dddff573c45104213))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Miscellaneous Chores
|
|
23
|
+
|
|
24
|
+
* Upgrade to Node 18 ([#6096](https://github.com/googleapis/google-cloud-node/issues/6096)) ([eadae64](https://github.com/googleapis/google-cloud-node/commit/eadae64d54e07aa2c65097ea52e65008d4e87436))
|
|
25
|
+
|
|
3
26
|
## [1.4.0](https://github.com/googleapis/google-cloud-node/compare/routing-v1.3.0...routing-v1.4.0) (2024-12-18)
|
|
4
27
|
|
|
5
28
|
|
package/README.md
CHANGED
|
@@ -44,7 +44,7 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained].
|
|
|
44
44
|
1. [Select or create a Cloud Platform project][projects].
|
|
45
45
|
1. [Enable billing for your project][billing].
|
|
46
46
|
1. [Enable the Google Maps Routing API][enable_api].
|
|
47
|
-
1. [Set up authentication][auth] so you can access the
|
|
47
|
+
1. [Set up authentication with a service account][auth] so you can access the
|
|
48
48
|
API from your local workstation.
|
|
49
49
|
|
|
50
50
|
### Installing the client library
|
|
@@ -233,4 +233,4 @@ See [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE)
|
|
|
233
233
|
[projects]: https://console.cloud.google.com/project
|
|
234
234
|
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
|
|
235
235
|
[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=routes.googleapis.com
|
|
236
|
-
[auth]: https://cloud.google.com/docs/authentication/
|
|
236
|
+
[auth]: https://cloud.google.com/docs/authentication/getting-started
|
package/build/protos/protos.d.ts
CHANGED
package/build/protos/protos.js
CHANGED
package/build/protos/protos.json
CHANGED
package/build/src/index.js
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema": "1.0",
|
|
3
|
+
"comment": "This file maps proto services/RPCs to the corresponding library clients/methods",
|
|
4
|
+
"language": "typescript",
|
|
5
|
+
"protoPackage": "google.maps.routing.v2",
|
|
6
|
+
"libraryPackage": "@googlemaps/routing",
|
|
7
|
+
"services": {
|
|
8
|
+
"Routes": {
|
|
9
|
+
"clients": {
|
|
10
|
+
"grpc": {
|
|
11
|
+
"libraryClient": "RoutesClient",
|
|
12
|
+
"rpcs": {
|
|
13
|
+
"ComputeRoutes": {
|
|
14
|
+
"methods": [
|
|
15
|
+
"computeRoutes"
|
|
16
|
+
]
|
|
17
|
+
},
|
|
18
|
+
"ComputeRouteMatrix": {
|
|
19
|
+
"methods": [
|
|
20
|
+
"computeRouteMatrix"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"grpc-fallback": {
|
|
26
|
+
"libraryClient": "RoutesClient",
|
|
27
|
+
"rpcs": {
|
|
28
|
+
"ComputeRoutes": {
|
|
29
|
+
"methods": [
|
|
30
|
+
"computeRoutes"
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
package/build/src/v2/index.js
CHANGED
|
@@ -16,6 +16,7 @@ export declare class RoutesClient {
|
|
|
16
16
|
private _defaults;
|
|
17
17
|
private _universeDomain;
|
|
18
18
|
private _servicePath;
|
|
19
|
+
private _log;
|
|
19
20
|
auth: gax.GoogleAuth;
|
|
20
21
|
descriptors: Descriptors;
|
|
21
22
|
warn: (code: string, message: string, warnType?: string) => void;
|
|
@@ -47,7 +48,7 @@ export declare class RoutesClient {
|
|
|
47
48
|
* Developer's Console, e.g. 'grape-spaceship-123'. We will also check
|
|
48
49
|
* the environment variable GCLOUD_PROJECT for your project ID. If your
|
|
49
50
|
* app is running in an environment which supports
|
|
50
|
-
* {@link https://
|
|
51
|
+
* {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials},
|
|
51
52
|
* your project ID will be detected automatically.
|
|
52
53
|
* @param {string} [options.apiEndpoint] - The domain name of the
|
|
53
54
|
* API remote host.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright 2025 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.
|
|
@@ -20,6 +20,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
20
20
|
exports.RoutesClient = void 0;
|
|
21
21
|
const stream_1 = require("stream");
|
|
22
22
|
const jsonProtos = require("../../protos/protos.json");
|
|
23
|
+
const google_gax_1 = require("google-gax");
|
|
23
24
|
/**
|
|
24
25
|
* Client JSON configuration object, loaded from
|
|
25
26
|
* `src/v2/routes_client_config.json`.
|
|
@@ -33,6 +34,26 @@ const version = require('../../../package.json').version;
|
|
|
33
34
|
* @memberof v2
|
|
34
35
|
*/
|
|
35
36
|
class RoutesClient {
|
|
37
|
+
_terminated = false;
|
|
38
|
+
_opts;
|
|
39
|
+
_providedCustomServicePath;
|
|
40
|
+
_gaxModule;
|
|
41
|
+
_gaxGrpc;
|
|
42
|
+
_protos;
|
|
43
|
+
_defaults;
|
|
44
|
+
_universeDomain;
|
|
45
|
+
_servicePath;
|
|
46
|
+
_log = google_gax_1.loggingUtils.log('routing');
|
|
47
|
+
auth;
|
|
48
|
+
descriptors = {
|
|
49
|
+
page: {},
|
|
50
|
+
stream: {},
|
|
51
|
+
longrunning: {},
|
|
52
|
+
batching: {},
|
|
53
|
+
};
|
|
54
|
+
warn;
|
|
55
|
+
innerApiCalls;
|
|
56
|
+
routesStub;
|
|
36
57
|
/**
|
|
37
58
|
* Construct an instance of RoutesClient.
|
|
38
59
|
*
|
|
@@ -55,7 +76,7 @@ class RoutesClient {
|
|
|
55
76
|
* Developer's Console, e.g. 'grape-spaceship-123'. We will also check
|
|
56
77
|
* the environment variable GCLOUD_PROJECT for your project ID. If your
|
|
57
78
|
* app is running in an environment which supports
|
|
58
|
-
* {@link https://
|
|
79
|
+
* {@link https://cloud.google.com/docs/authentication/application-default-credentials Application Default Credentials},
|
|
59
80
|
* your project ID will be detected automatically.
|
|
60
81
|
* @param {string} [options.apiEndpoint] - The domain name of the
|
|
61
82
|
* API remote host.
|
|
@@ -73,32 +94,28 @@ class RoutesClient {
|
|
|
73
94
|
* ```
|
|
74
95
|
*/
|
|
75
96
|
constructor(opts, gaxInstance) {
|
|
76
|
-
var _a, _b, _c, _d, _e;
|
|
77
|
-
this._terminated = false;
|
|
78
|
-
this.descriptors = {
|
|
79
|
-
page: {},
|
|
80
|
-
stream: {},
|
|
81
|
-
longrunning: {},
|
|
82
|
-
batching: {},
|
|
83
|
-
};
|
|
84
97
|
// Ensure that options include all the required fields.
|
|
85
98
|
const staticMembers = this.constructor;
|
|
86
|
-
if (
|
|
87
|
-
|
|
88
|
-
|
|
99
|
+
if (opts?.universe_domain &&
|
|
100
|
+
opts?.universeDomain &&
|
|
101
|
+
opts?.universe_domain !== opts?.universeDomain) {
|
|
89
102
|
throw new Error('Please set either universe_domain or universeDomain, but not both.');
|
|
90
103
|
}
|
|
91
104
|
const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
|
|
92
105
|
? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
|
|
93
106
|
: undefined;
|
|
94
107
|
this._universeDomain =
|
|
95
|
-
|
|
108
|
+
opts?.universeDomain ??
|
|
109
|
+
opts?.universe_domain ??
|
|
110
|
+
universeDomainEnvVar ??
|
|
111
|
+
'googleapis.com';
|
|
96
112
|
this._servicePath = 'routes.' + this._universeDomain;
|
|
97
|
-
const servicePath =
|
|
98
|
-
this._providedCustomServicePath = !!(
|
|
99
|
-
const port =
|
|
100
|
-
const clientConfig =
|
|
101
|
-
const fallback =
|
|
113
|
+
const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
|
|
114
|
+
this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
|
|
115
|
+
const port = opts?.port || staticMembers.port;
|
|
116
|
+
const clientConfig = opts?.clientConfig ?? {};
|
|
117
|
+
const fallback = opts?.fallback ??
|
|
118
|
+
(typeof window !== 'undefined' && typeof window?.fetch === 'function');
|
|
102
119
|
opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
|
|
103
120
|
// Request numeric enum values if REST transport is used.
|
|
104
121
|
opts.numericEnums = true;
|
|
@@ -188,7 +205,7 @@ class RoutesClient {
|
|
|
188
205
|
const callPromise = this.routesStub.then(stub => (...args) => {
|
|
189
206
|
if (this._terminated) {
|
|
190
207
|
if (methodName in this.descriptors.stream) {
|
|
191
|
-
const stream = new stream_1.PassThrough();
|
|
208
|
+
const stream = new stream_1.PassThrough({ objectMode: true });
|
|
192
209
|
setImmediate(() => {
|
|
193
210
|
stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.'));
|
|
194
211
|
});
|
|
@@ -280,8 +297,22 @@ class RoutesClient {
|
|
|
280
297
|
options = options || {};
|
|
281
298
|
options.otherArgs = options.otherArgs || {};
|
|
282
299
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
283
|
-
this.initialize()
|
|
284
|
-
|
|
300
|
+
this.initialize().catch(err => {
|
|
301
|
+
throw err;
|
|
302
|
+
});
|
|
303
|
+
this._log.info('computeRoutes request %j', request);
|
|
304
|
+
const wrappedCallback = callback
|
|
305
|
+
? (error, response, options, rawResponse) => {
|
|
306
|
+
this._log.info('computeRoutes response %j', response);
|
|
307
|
+
callback(error, response, options, rawResponse); // We verified callback above.
|
|
308
|
+
}
|
|
309
|
+
: undefined;
|
|
310
|
+
return this.innerApiCalls
|
|
311
|
+
.computeRoutes(request, options, wrappedCallback)
|
|
312
|
+
?.then(([response, options, rawResponse]) => {
|
|
313
|
+
this._log.info('computeRoutes response %j', response);
|
|
314
|
+
return [response, options, rawResponse];
|
|
315
|
+
});
|
|
285
316
|
}
|
|
286
317
|
/**
|
|
287
318
|
* Takes in a list of origins and destinations and returns a stream containing
|
|
@@ -406,7 +437,10 @@ class RoutesClient {
|
|
|
406
437
|
options = options || {};
|
|
407
438
|
options.otherArgs = options.otherArgs || {};
|
|
408
439
|
options.otherArgs.headers = options.otherArgs.headers || {};
|
|
409
|
-
this.initialize()
|
|
440
|
+
this.initialize().catch(err => {
|
|
441
|
+
throw err;
|
|
442
|
+
});
|
|
443
|
+
this._log.info('computeRouteMatrix stream %j', options);
|
|
410
444
|
return this.innerApiCalls.computeRouteMatrix(request, options);
|
|
411
445
|
}
|
|
412
446
|
/**
|
|
@@ -418,6 +452,7 @@ class RoutesClient {
|
|
|
418
452
|
close() {
|
|
419
453
|
if (this.routesStub && !this._terminated) {
|
|
420
454
|
return this.routesStub.then(stub => {
|
|
455
|
+
this._log.info('ending gRPC channel');
|
|
421
456
|
this._terminated = true;
|
|
422
457
|
stub.close();
|
|
423
458
|
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[
|
|
2
|
+
"../../protos/google/geo/type/viewport.proto",
|
|
3
|
+
"../../protos/google/maps/routing/v2/fallback_info.proto",
|
|
4
|
+
"../../protos/google/maps/routing/v2/geocoding_results.proto",
|
|
5
|
+
"../../protos/google/maps/routing/v2/localized_time.proto",
|
|
6
|
+
"../../protos/google/maps/routing/v2/location.proto",
|
|
7
|
+
"../../protos/google/maps/routing/v2/maneuver.proto",
|
|
8
|
+
"../../protos/google/maps/routing/v2/navigation_instruction.proto",
|
|
9
|
+
"../../protos/google/maps/routing/v2/polyline.proto",
|
|
10
|
+
"../../protos/google/maps/routing/v2/polyline_details.proto",
|
|
11
|
+
"../../protos/google/maps/routing/v2/route.proto",
|
|
12
|
+
"../../protos/google/maps/routing/v2/route_label.proto",
|
|
13
|
+
"../../protos/google/maps/routing/v2/route_modifiers.proto",
|
|
14
|
+
"../../protos/google/maps/routing/v2/route_travel_mode.proto",
|
|
15
|
+
"../../protos/google/maps/routing/v2/routes_service.proto",
|
|
16
|
+
"../../protos/google/maps/routing/v2/routing_preference.proto",
|
|
17
|
+
"../../protos/google/maps/routing/v2/speed_reading_interval.proto",
|
|
18
|
+
"../../protos/google/maps/routing/v2/toll_info.proto",
|
|
19
|
+
"../../protos/google/maps/routing/v2/toll_passes.proto",
|
|
20
|
+
"../../protos/google/maps/routing/v2/traffic_model.proto",
|
|
21
|
+
"../../protos/google/maps/routing/v2/transit.proto",
|
|
22
|
+
"../../protos/google/maps/routing/v2/transit_preferences.proto",
|
|
23
|
+
"../../protos/google/maps/routing/v2/units.proto",
|
|
24
|
+
"../../protos/google/maps/routing/v2/vehicle_emission_type.proto",
|
|
25
|
+
"../../protos/google/maps/routing/v2/vehicle_info.proto",
|
|
26
|
+
"../../protos/google/maps/routing/v2/waypoint.proto"
|
|
27
|
+
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@googlemaps/routing",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": " client for Node.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -46,26 +46,26 @@
|
|
|
46
46
|
"test": "c8 mocha build/test"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"google-gax": "^
|
|
49
|
+
"google-gax": "^5.0.1-rc.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@types/mocha": "^
|
|
53
|
-
"@types/node": "^
|
|
54
|
-
"@types/sinon": "^17.0.
|
|
55
|
-
"c8": "^
|
|
56
|
-
"gapic-tools": "^0.
|
|
57
|
-
"gts": "^
|
|
58
|
-
"jsdoc": "^4.0.
|
|
52
|
+
"@types/mocha": "^10.0.10",
|
|
53
|
+
"@types/node": "^22.13.9",
|
|
54
|
+
"@types/sinon": "^17.0.4",
|
|
55
|
+
"c8": "^10.1.3",
|
|
56
|
+
"gapic-tools": "^1.0.0",
|
|
57
|
+
"gts": "^6.0.2",
|
|
58
|
+
"jsdoc": "^4.0.4",
|
|
59
59
|
"jsdoc-fresh": "^3.0.0",
|
|
60
60
|
"jsdoc-region-tag": "^3.0.0",
|
|
61
|
-
"linkinator": "
|
|
62
|
-
"long": "^5.
|
|
63
|
-
"mocha": "^
|
|
64
|
-
"pack-n-play": "^
|
|
65
|
-
"sinon": "^
|
|
66
|
-
"typescript": "^5.
|
|
61
|
+
"linkinator": "^6.1.2",
|
|
62
|
+
"long": "^5.3.1",
|
|
63
|
+
"mocha": "^11.1.0",
|
|
64
|
+
"pack-n-play": "^3.0.0",
|
|
65
|
+
"sinon": "^19.0.2",
|
|
66
|
+
"typescript": "^5.8.2"
|
|
67
67
|
},
|
|
68
68
|
"engines": {
|
|
69
|
-
"node": ">=
|
|
69
|
+
"node": ">=18"
|
|
70
70
|
}
|
|
71
71
|
}
|