@googlemaps/routing 0.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE +202 -0
  3. package/README.md +238 -0
  4. package/build/protos/google/geo/type/viewport.proto +69 -0
  5. package/build/protos/google/maps/routing/v2/fallback_info.proto +72 -0
  6. package/build/protos/google/maps/routing/v2/location.proto +43 -0
  7. package/build/protos/google/maps/routing/v2/maneuver.proto +88 -0
  8. package/build/protos/google/maps/routing/v2/navigation_instruction.proto +40 -0
  9. package/build/protos/google/maps/routing/v2/polyline.proto +74 -0
  10. package/build/protos/google/maps/routing/v2/route.proto +208 -0
  11. package/build/protos/google/maps/routing/v2/route_modifiers.proto +64 -0
  12. package/build/protos/google/maps/routing/v2/route_travel_mode.proto +46 -0
  13. package/build/protos/google/maps/routing/v2/routes_service.proto +311 -0
  14. package/build/protos/google/maps/routing/v2/routing_preference.proto +55 -0
  15. package/build/protos/google/maps/routing/v2/speed_reading_interval.proto +57 -0
  16. package/build/protos/google/maps/routing/v2/toll_info.proto +40 -0
  17. package/build/protos/google/maps/routing/v2/toll_passes.proto +321 -0
  18. package/build/protos/google/maps/routing/v2/units.proto +40 -0
  19. package/build/protos/google/maps/routing/v2/vehicle_emission_type.proto +43 -0
  20. package/build/protos/google/maps/routing/v2/vehicle_info.proto +37 -0
  21. package/build/protos/google/maps/routing/v2/waypoint.proto +71 -0
  22. package/build/protos/protos.d.ts +8392 -0
  23. package/build/protos/protos.js +22576 -0
  24. package/build/protos/protos.json +2144 -0
  25. package/build/src/index.d.ts +11 -0
  26. package/build/src/index.js +28 -0
  27. package/build/src/index.js.map +1 -0
  28. package/build/src/v2/index.d.ts +1 -0
  29. package/build/src/v2/index.js +23 -0
  30. package/build/src/v2/index.js.map +1 -0
  31. package/build/src/v2/routes_client.d.ts +289 -0
  32. package/build/src/v2/routes_client.js +356 -0
  33. package/build/src/v2/routes_client.js.map +1 -0
  34. package/build/src/v2/routes_client_config.json +34 -0
  35. package/package.json +66 -0
@@ -0,0 +1,356 @@
1
+ "use strict";
2
+ // Copyright 2022 Google LLC
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // https://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ //
16
+ // ** This file is automatically generated by gapic-generator-typescript. **
17
+ // ** https://github.com/googleapis/gapic-generator-typescript **
18
+ // ** All changes to this file may be overwritten. **
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.RoutesClient = void 0;
21
+ const stream_1 = require("stream");
22
+ const jsonProtos = require("../../protos/protos.json");
23
+ /**
24
+ * Client JSON configuration object, loaded from
25
+ * `src/v2/routes_client_config.json`.
26
+ * This file defines retry strategy and timeouts for all API methods in this library.
27
+ */
28
+ const gapicConfig = require("./routes_client_config.json");
29
+ const version = require('../../../package.json').version;
30
+ /**
31
+ * The Routes API.
32
+ * @class
33
+ * @memberof v2
34
+ */
35
+ class RoutesClient {
36
+ /**
37
+ * Construct an instance of RoutesClient.
38
+ *
39
+ * @param {object} [options] - The configuration object.
40
+ * The options accepted by the constructor are described in detail
41
+ * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance).
42
+ * The common options are:
43
+ * @param {object} [options.credentials] - Credentials object.
44
+ * @param {string} [options.credentials.client_email]
45
+ * @param {string} [options.credentials.private_key]
46
+ * @param {string} [options.email] - Account email address. Required when
47
+ * using a .pem or .p12 keyFilename.
48
+ * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or
49
+ * .p12 key downloaded from the Google Developers Console. If you provide
50
+ * a path to a JSON file, the projectId option below is not necessary.
51
+ * NOTE: .pem and .p12 require you to specify options.email as well.
52
+ * @param {number} [options.port] - The port on which to connect to
53
+ * the remote host.
54
+ * @param {string} [options.projectId] - The project ID from the Google
55
+ * Developer's Console, e.g. 'grape-spaceship-123'. We will also check
56
+ * the environment variable GCLOUD_PROJECT for your project ID. If your
57
+ * app is running in an environment which supports
58
+ * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
59
+ * your project ID will be detected automatically.
60
+ * @param {string} [options.apiEndpoint] - The domain name of the
61
+ * API remote host.
62
+ * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
63
+ * Follows the structure of {@link gapicConfig}.
64
+ * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
65
+ * Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
66
+ * For more information, please check the
67
+ * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
68
+ * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
69
+ * need to avoid loading the default gRPC version and want to use the fallback
70
+ * HTTP implementation. Load only fallback version and pass it to the constructor:
71
+ * ```
72
+ * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
73
+ * const client = new RoutesClient({fallback: 'rest'}, gax);
74
+ * ```
75
+ */
76
+ constructor(opts, gaxInstance) {
77
+ var _a, _b;
78
+ this._terminated = false;
79
+ this.descriptors = {
80
+ page: {},
81
+ stream: {},
82
+ longrunning: {},
83
+ batching: {},
84
+ };
85
+ // Ensure that options include all the required fields.
86
+ const staticMembers = this.constructor;
87
+ const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || staticMembers.servicePath;
88
+ this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint));
89
+ const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port;
90
+ const clientConfig = (_a = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _a !== void 0 ? _a : {};
91
+ 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');
92
+ opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
93
+ // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case.
94
+ if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) {
95
+ opts['scopes'] = staticMembers.scopes;
96
+ }
97
+ // Load google-gax module synchronously if needed
98
+ if (!gaxInstance) {
99
+ gaxInstance = require('google-gax');
100
+ }
101
+ // Choose either gRPC or proto-over-HTTP implementation of google-gax.
102
+ this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance;
103
+ // Create a `gaxGrpc` object, with any grpc-specific options sent to the client.
104
+ this._gaxGrpc = new this._gaxModule.GrpcClient(opts);
105
+ // Save options to use in initialize() method.
106
+ this._opts = opts;
107
+ // Save the auth object to the client, for use by other methods.
108
+ this.auth = this._gaxGrpc.auth;
109
+ // Set useJWTAccessWithScope on the auth object.
110
+ this.auth.useJWTAccessWithScope = true;
111
+ // Set defaultServicePath on the auth object.
112
+ this.auth.defaultServicePath = staticMembers.servicePath;
113
+ // Set the default scopes in auth client if needed.
114
+ if (servicePath === staticMembers.servicePath) {
115
+ this.auth.defaultScopes = staticMembers.scopes;
116
+ }
117
+ // Determine the client header string.
118
+ const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
119
+ if (typeof process !== 'undefined' && 'versions' in process) {
120
+ clientHeader.push(`gl-node/${process.versions.node}`);
121
+ }
122
+ else {
123
+ clientHeader.push(`gl-web/${this._gaxModule.version}`);
124
+ }
125
+ if (!opts.fallback) {
126
+ clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
127
+ }
128
+ else if (opts.fallback === 'rest') {
129
+ clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
130
+ }
131
+ if (opts.libName && opts.libVersion) {
132
+ clientHeader.push(`${opts.libName}/${opts.libVersion}`);
133
+ }
134
+ // Load the applicable protos.
135
+ this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos);
136
+ // Some of the methods on this service provide streaming responses.
137
+ // Provide descriptors for these.
138
+ this.descriptors.stream = {
139
+ computeRouteMatrix: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, opts.fallback === 'rest'),
140
+ };
141
+ // Put together the default options sent with requests.
142
+ this._defaults = this._gaxGrpc.constructSettings('google.maps.routing.v2.Routes', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
143
+ // Set up a dictionary of "inner API calls"; the core implementation
144
+ // of calling the API is handled in `google-gax`, with this code
145
+ // merely providing the destination and request information.
146
+ this.innerApiCalls = {};
147
+ // Add a warn function to the client constructor so it can be easily tested.
148
+ this.warn = this._gaxModule.warn;
149
+ }
150
+ /**
151
+ * Initialize the client.
152
+ * Performs asynchronous operations (such as authentication) and prepares the client.
153
+ * This function will be called automatically when any class method is called for the
154
+ * first time, but if you need to initialize it before calling an actual method,
155
+ * feel free to call initialize() directly.
156
+ *
157
+ * You can await on this method if you want to make sure the client is initialized.
158
+ *
159
+ * @returns {Promise} A promise that resolves to an authenticated service stub.
160
+ */
161
+ initialize() {
162
+ // If the client stub promise is already initialized, return immediately.
163
+ if (this.routesStub) {
164
+ return this.routesStub;
165
+ }
166
+ // Put together the "service stub" for
167
+ // google.maps.routing.v2.Routes.
168
+ this.routesStub = this._gaxGrpc.createStub(this._opts.fallback
169
+ ? this._protos.lookupService('google.maps.routing.v2.Routes')
170
+ : // eslint-disable-next-line @typescript-eslint/no-explicit-any
171
+ this._protos.google.maps.routing.v2.Routes, this._opts, this._providedCustomServicePath);
172
+ // Iterate over each of the methods that the service provides
173
+ // and create an API call method for each.
174
+ const routesStubMethods = ['computeRoutes', 'computeRouteMatrix'];
175
+ for (const methodName of routesStubMethods) {
176
+ const callPromise = this.routesStub.then(stub => (...args) => {
177
+ if (this._terminated) {
178
+ if (methodName in this.descriptors.stream) {
179
+ const stream = new stream_1.PassThrough();
180
+ setImmediate(() => {
181
+ stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.'));
182
+ });
183
+ return stream;
184
+ }
185
+ return Promise.reject('The client has already been closed.');
186
+ }
187
+ const func = stub[methodName];
188
+ return func.apply(stub, args);
189
+ }, (err) => () => {
190
+ throw err;
191
+ });
192
+ const descriptor = this.descriptors.stream[methodName] || undefined;
193
+ const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor, this._opts.fallback);
194
+ this.innerApiCalls[methodName] = apiCall;
195
+ }
196
+ return this.routesStub;
197
+ }
198
+ /**
199
+ * The DNS address for this API service.
200
+ * @returns {string} The DNS address for this service.
201
+ */
202
+ static get servicePath() {
203
+ return 'routes.googleapis.com';
204
+ }
205
+ /**
206
+ * The DNS address for this API service - same as servicePath(),
207
+ * exists for compatibility reasons.
208
+ * @returns {string} The DNS address for this service.
209
+ */
210
+ static get apiEndpoint() {
211
+ return 'routes.googleapis.com';
212
+ }
213
+ /**
214
+ * The port for this API service.
215
+ * @returns {number} The default port for this service.
216
+ */
217
+ static get port() {
218
+ return 443;
219
+ }
220
+ /**
221
+ * The scopes needed to make gRPC calls for every method defined
222
+ * in this service.
223
+ * @returns {string[]} List of default scopes.
224
+ */
225
+ static get scopes() {
226
+ return [];
227
+ }
228
+ /**
229
+ * Return the project ID used by this class.
230
+ * @returns {Promise} A promise that resolves to string containing the project ID.
231
+ */
232
+ getProjectId(callback) {
233
+ if (callback) {
234
+ this.auth.getProjectId(callback);
235
+ return;
236
+ }
237
+ return this.auth.getProjectId();
238
+ }
239
+ computeRoutes(request, optionsOrCallback, callback) {
240
+ request = request || {};
241
+ let options;
242
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
243
+ callback = optionsOrCallback;
244
+ options = {};
245
+ }
246
+ else {
247
+ options = optionsOrCallback;
248
+ }
249
+ options = options || {};
250
+ options.otherArgs = options.otherArgs || {};
251
+ options.otherArgs.headers = options.otherArgs.headers || {};
252
+ this.initialize();
253
+ return this.innerApiCalls.computeRoutes(request, options, callback);
254
+ }
255
+ /**
256
+ * Takes in a list of origins and destinations and returns a stream containing
257
+ * route information for each combination of origin and destination.
258
+ *
259
+ * **NOTE:** This method requires that you specify a response field mask in
260
+ * the input. You can provide the response field mask by using the URL
261
+ * parameter `$fields` or `fields`, or by using the HTTP/gRPC header
262
+ * `X-Goog-FieldMask` (see the [available URL parameters and
263
+ * headers](https://cloud.google.com/apis/docs/system-parameters). The value
264
+ * is a comma separated list of field paths. See this detailed documentation
265
+ * about [how to construct the field
266
+ * paths](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/field_mask.proto).
267
+ *
268
+ * For example, in this method:
269
+ *
270
+ * * Field mask of all available fields (for manual inspection):
271
+ * `X-Goog-FieldMask: *`
272
+ * * Field mask of route durations, distances, element status, condition, and
273
+ * element indices (an example production setup):
274
+ * `X-Goog-FieldMask:
275
+ * originIndex,destinationIndex,status,condition,distanceMeters,duration`
276
+ *
277
+ * It is critical that you include `status` in your field mask as otherwise
278
+ * all messages will appear to be OK. Google discourages the use of the
279
+ * wildcard (`*`) response field mask, because:
280
+ *
281
+ * * Selecting only the fields that you need helps our server save computation
282
+ * cycles, allowing us to return the result to you with a lower latency.
283
+ * * Selecting only the fields that you need in your production job ensures
284
+ * stable latency performance. We might add more response fields in the
285
+ * future, and those new fields might require extra computation time. If you
286
+ * select all fields, or if you select all fields at the top level, then you
287
+ * might experience performance degradation because any new field we add will
288
+ * be automatically included in the response.
289
+ * * Selecting only the fields that you need results in a smaller response
290
+ * size, and thus higher network throughput.
291
+ *
292
+ * @param {Object} request
293
+ * The request object that will be sent.
294
+ * @param {number[]} request.origins
295
+ * Required. Array of origins, which determines the rows of the response matrix.
296
+ * Several size restrictions apply to the cardinality of origins and
297
+ * destinations:
298
+ *
299
+ * * The number of elements (origins × destinations) must be no greater than
300
+ * 625 in any case.
301
+ * * The number of elements (origins × destinations) must be no greater than
302
+ * 100 if routing_preference is set to `TRAFFIC_AWARE_OPTIMAL`.
303
+ * * The number of waypoints (origins + destinations) specified as `place_id`
304
+ * must be no greater than 50.
305
+ * @param {number[]} request.destinations
306
+ * Required. Array of destinations, which determines the columns of the response matrix.
307
+ * @param {google.maps.routing.v2.RouteTravelMode} [request.travelMode]
308
+ * Optional. Specifies the mode of transportation.
309
+ * @param {google.maps.routing.v2.RoutingPreference} [request.routingPreference]
310
+ * Optional. Specifies how to compute the route. The server attempts to use the selected
311
+ * routing preference to compute the route. If the routing preference results
312
+ * in an error or an extra long latency, an error is returned. In the future,
313
+ * we might implement a fallback mechanism to use a different option when the
314
+ * preferred option does not give a valid result. You can specify this option
315
+ * only when the `travel_mode` is `DRIVE` or `TWO_WHEELER`, otherwise the
316
+ * request fails.
317
+ * @param {google.protobuf.Timestamp} [request.departureTime]
318
+ * Optional. The departure time. If you don't set this value, this defaults to the time
319
+ * that you made the request. If you set this value to a time that has already
320
+ * occurred, the request fails.
321
+ * @param {object} [options]
322
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
323
+ * @returns {Stream}
324
+ * An object stream which emits [RouteMatrixElement]{@link google.maps.routing.v2.RouteMatrixElement} on 'data' event.
325
+ * Please see the
326
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#server-streaming)
327
+ * for more details and examples.
328
+ * @example <caption>include:samples/generated/v2/routes.compute_route_matrix.js</caption>
329
+ * region_tag:routes_v2_generated_Routes_ComputeRouteMatrix_async
330
+ */
331
+ computeRouteMatrix(request, options) {
332
+ request = request || {};
333
+ options = options || {};
334
+ options.otherArgs = options.otherArgs || {};
335
+ options.otherArgs.headers = options.otherArgs.headers || {};
336
+ this.initialize();
337
+ return this.innerApiCalls.computeRouteMatrix(request, options);
338
+ }
339
+ /**
340
+ * Terminate the gRPC channel and close the client.
341
+ *
342
+ * The client will no longer be usable and all future behavior is undefined.
343
+ * @returns {Promise} A promise that resolves when the client is closed.
344
+ */
345
+ close() {
346
+ if (this.routesStub && !this._terminated) {
347
+ return this.routesStub.then(stub => {
348
+ this._terminated = true;
349
+ stub.close();
350
+ });
351
+ }
352
+ return Promise.resolve();
353
+ }
354
+ }
355
+ exports.RoutesClient = RoutesClient;
356
+ //# sourceMappingURL=routes_client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes_client.js","sourceRoot":"","sources":["../../../src/v2/routes_client.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,kDAAkD;AAClD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,EAAE;AACF,4EAA4E;AAC5E,iEAAiE;AACjE,qDAAqD;;;AAUrD,mCAAmC;AAEnC,uDAAwD;AACxD;;;;GAIG;AACH,2DAA2D;AAC3D,MAAM,OAAO,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAC;AAEzD;;;;GAIG;AACH,MAAa,YAAY;IAmBvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuCG;IACH,YACE,IAAoB,EACpB,WAA8C;;QA5DxC,gBAAW,GAAG,KAAK,CAAC;QAQ5B,gBAAW,GAAgB;YACzB,IAAI,EAAE,EAAE;YACR,MAAM,EAAE,EAAE;YACV,WAAW,EAAE,EAAE;YACf,QAAQ,EAAE,EAAE;SACb,CAAC;QAiDA,uDAAuD;QACvD,MAAM,aAAa,GAAG,IAAI,CAAC,WAAkC,CAAC;QAC9D,MAAM,WAAW,GACf,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,MAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI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ED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2EG;IACH,kBAAkB,CAChB,OAAkE,EAClE,OAAqB;QAErB,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;QACxB,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;QACxB,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,EAAE,CAAC;QAC5C,OAAO,CAAC,SAAS,CAAC,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,OAAO,IAAI,EAAE,CAAC;QAC5D,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC,aAAa,CAAC,kBAAkB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACjE,CAAC;IAED;;;;;OAKG;IACH,KAAK;QACH,IAAI,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACxC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;gBACjC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;gBACxB,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,CAAC,CAAC,CAAC;SACJ;QACD,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;CACF;AA9hBD,oCA8hBC"}
@@ -0,0 +1,34 @@
1
+ {
2
+ "interfaces": {
3
+ "google.maps.routing.v2.Routes": {
4
+ "retry_codes": {
5
+ "non_idempotent": [],
6
+ "idempotent": [
7
+ "DEADLINE_EXCEEDED",
8
+ "UNAVAILABLE"
9
+ ]
10
+ },
11
+ "retry_params": {
12
+ "default": {
13
+ "initial_retry_delay_millis": 100,
14
+ "retry_delay_multiplier": 1.3,
15
+ "max_retry_delay_millis": 60000,
16
+ "initial_rpc_timeout_millis": 60000,
17
+ "rpc_timeout_multiplier": 1,
18
+ "max_rpc_timeout_millis": 60000,
19
+ "total_timeout_millis": 600000
20
+ }
21
+ },
22
+ "methods": {
23
+ "ComputeRoutes": {
24
+ "retry_codes_name": "non_idempotent",
25
+ "retry_params_name": "default"
26
+ },
27
+ "ComputeRouteMatrix": {
28
+ "retry_codes_name": "non_idempotent",
29
+ "retry_params_name": "default"
30
+ }
31
+ }
32
+ }
33
+ }
34
+ }
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "@googlemaps/routing",
3
+ "version": "0.1.0",
4
+ "description": " client for Node.js",
5
+ "repository": "googleapis/google-cloud-node",
6
+ "license": "Apache-2.0",
7
+ "author": "Google LLC",
8
+ "main": "build/src/index.js",
9
+ "files": [
10
+ "build/src",
11
+ "build/protos"
12
+ ],
13
+ "keywords": [
14
+ "google apis client",
15
+ "google api client",
16
+ "google apis",
17
+ "google api",
18
+ "google",
19
+ "google cloud platform",
20
+ "google cloud",
21
+ "cloud",
22
+ "google routing",
23
+ "routing",
24
+ ""
25
+ ],
26
+ "scripts": {
27
+ "clean": "gts clean",
28
+ "compile": "tsc -p . && cp -r protos build/",
29
+ "compile-protos": "compileProtos src",
30
+ "docs": "jsdoc -c .jsdoc.js",
31
+ "predocs-test": "npm run docs",
32
+ "docs-test": "linkinator docs",
33
+ "fix": "gts fix",
34
+ "lint": "gts check",
35
+ "prepare": "npm run compile-protos && npm run compile",
36
+ "system-test": "npm run compile && c8 mocha build/system-test",
37
+ "test": "c8 mocha build/test",
38
+ "samples-test": "npm run compile && cd samples/ && npm link ../ && npm i && npm test",
39
+ "prelint": "cd samples; npm link ../; npm i"
40
+ },
41
+ "dependencies": {
42
+ "google-gax": "^3.0.1"
43
+ },
44
+ "devDependencies": {
45
+ "@types/mocha": "^9.0.0",
46
+ "@types/node": "^16.0.0",
47
+ "@types/sinon": "^10.0.0",
48
+ "c8": "^7.3.5",
49
+ "gts": "^3.1.0",
50
+ "jsdoc": "^3.6.6",
51
+ "jsdoc-fresh": "^2.0.0",
52
+ "jsdoc-region-tag": "^2.0.0",
53
+ "linkinator": "^4.0.0",
54
+ "mocha": "^9.2.2",
55
+ "null-loader": "^4.0.1",
56
+ "pack-n-play": "^1.0.0-2",
57
+ "sinon": "^14.0.0",
58
+ "ts-loader": "^9.0.0",
59
+ "typescript": "^4.6.4",
60
+ "webpack": "^5.9.0",
61
+ "webpack-cli": "^4.2.0"
62
+ },
63
+ "engines": {
64
+ "node": ">=12.0.0"
65
+ }
66
+ }