@googlemaps/fleetengine-delivery 0.6.1 → 0.7.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.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2025 Google LLC
2
+ // Copyright 2026 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.
@@ -96,17 +96,26 @@ class DeliveryServiceClient {
96
96
  constructor(opts, gaxInstance) {
97
97
  // Ensure that options include all the required fields.
98
98
  const staticMembers = this.constructor;
99
- if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) {
99
+ if (opts?.universe_domain &&
100
+ opts?.universeDomain &&
101
+ opts?.universe_domain !== opts?.universeDomain) {
100
102
  throw new Error('Please set either universe_domain or universeDomain, but not both.');
101
103
  }
102
- const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined;
103
- this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com';
104
+ const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
105
+ ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
106
+ : undefined;
107
+ this._universeDomain =
108
+ opts?.universeDomain ??
109
+ opts?.universe_domain ??
110
+ universeDomainEnvVar ??
111
+ 'googleapis.com';
104
112
  this._servicePath = 'fleetengine.' + this._universeDomain;
105
113
  const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
106
114
  this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
107
115
  const port = opts?.port || staticMembers.port;
108
116
  const clientConfig = opts?.clientConfig ?? {};
109
- const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function');
117
+ const fallback = opts?.fallback ??
118
+ (typeof window !== 'undefined' && typeof window?.fetch === 'function');
110
119
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
111
120
  // Request numeric enum values if REST transport is used.
112
121
  opts.numericEnums = true;
@@ -135,10 +144,7 @@ class DeliveryServiceClient {
135
144
  this.auth.defaultScopes = staticMembers.scopes;
136
145
  }
137
146
  // Determine the client header string.
138
- const clientHeader = [
139
- `gax/${this._gaxModule.version}`,
140
- `gapic/${version}`,
141
- ];
147
+ const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
142
148
  if (typeof process === 'object' && 'versions' in process) {
143
149
  clientHeader.push(`gl-node/${process.versions.node}`);
144
150
  }
@@ -170,7 +176,7 @@ class DeliveryServiceClient {
170
176
  // pages). Denote the keys used for pagination and results.
171
177
  this.descriptors.page = {
172
178
  listTasks: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'tasks'),
173
- listDeliveryVehicles: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'deliveryVehicles')
179
+ listDeliveryVehicles: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'deliveryVehicles'),
174
180
  };
175
181
  // Put together the default options sent with requests.
176
182
  this._defaults = this._gaxGrpc.constructSettings('maps.fleetengine.delivery.v1.DeliveryService', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
@@ -199,15 +205,28 @@ class DeliveryServiceClient {
199
205
  }
200
206
  // Put together the "service stub" for
201
207
  // maps.fleetengine.delivery.v1.DeliveryService.
202
- this.deliveryServiceStub = this._gaxGrpc.createStub(this._opts.fallback ?
203
- this._protos.lookupService('maps.fleetengine.delivery.v1.DeliveryService') :
204
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
205
- this._protos.maps.fleetengine.delivery.v1.DeliveryService, this._opts, this._providedCustomServicePath);
208
+ this.deliveryServiceStub = this._gaxGrpc.createStub(this._opts.fallback
209
+ ? this._protos.lookupService('maps.fleetengine.delivery.v1.DeliveryService')
210
+ : // eslint-disable-next-line @typescript-eslint/no-explicit-any
211
+ this._protos.maps.fleetengine.delivery.v1.DeliveryService, this._opts, this._providedCustomServicePath);
206
212
  // Iterate over each of the methods that the service provides
207
213
  // and create an API call method for each.
208
- const deliveryServiceStubMethods = ['createDeliveryVehicle', 'getDeliveryVehicle', 'deleteDeliveryVehicle', 'updateDeliveryVehicle', 'batchCreateTasks', 'createTask', 'getTask', 'deleteTask', 'updateTask', 'listTasks', 'getTaskTrackingInfo', 'listDeliveryVehicles'];
214
+ const deliveryServiceStubMethods = [
215
+ 'createDeliveryVehicle',
216
+ 'getDeliveryVehicle',
217
+ 'deleteDeliveryVehicle',
218
+ 'updateDeliveryVehicle',
219
+ 'batchCreateTasks',
220
+ 'createTask',
221
+ 'getTask',
222
+ 'deleteTask',
223
+ 'updateTask',
224
+ 'listTasks',
225
+ 'getTaskTrackingInfo',
226
+ 'listDeliveryVehicles',
227
+ ];
209
228
  for (const methodName of deliveryServiceStubMethods) {
210
- const callPromise = this.deliveryServiceStub.then(stub => (...args) => {
229
+ const callPromise = this.deliveryServiceStub.then((stub) => (...args) => {
211
230
  if (this._terminated) {
212
231
  return Promise.reject('The client has already been closed.');
213
232
  }
@@ -216,8 +235,7 @@ class DeliveryServiceClient {
216
235
  }, (err) => () => {
217
236
  throw err;
218
237
  });
219
- const descriptor = this.descriptors.page[methodName] ||
220
- undefined;
238
+ const descriptor = this.descriptors.page[methodName] || undefined;
221
239
  const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor, this._opts.fallback);
222
240
  this.innerApiCalls[methodName] = apiCall;
223
241
  }
@@ -229,7 +247,8 @@ class DeliveryServiceClient {
229
247
  * @returns {string} The DNS address for this service.
230
248
  */
231
249
  static get servicePath() {
232
- if (typeof process === 'object' && typeof process.emitWarning === 'function') {
250
+ if (typeof process === 'object' &&
251
+ typeof process.emitWarning === 'function') {
233
252
  process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
234
253
  }
235
254
  return 'fleetengine.googleapis.com';
@@ -240,7 +259,8 @@ class DeliveryServiceClient {
240
259
  * @returns {string} The DNS address for this service.
241
260
  */
242
261
  static get apiEndpoint() {
243
- if (typeof process === 'object' && typeof process.emitWarning === 'function') {
262
+ if (typeof process === 'object' &&
263
+ typeof process.emitWarning === 'function') {
244
264
  process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
245
265
  }
246
266
  return 'fleetengine.googleapis.com';
@@ -268,9 +288,7 @@ class DeliveryServiceClient {
268
288
  * @returns {string[]} List of default scopes.
269
289
  */
270
290
  static get scopes() {
271
- return [
272
- 'https://www.googleapis.com/auth/cloud-platform'
273
- ];
291
+ return ['https://www.googleapis.com/auth/cloud-platform'];
274
292
  }
275
293
  /**
276
294
  * Return the project ID used by this class.
@@ -300,15 +318,20 @@ class DeliveryServiceClient {
300
318
  {
301
319
  const fieldValue = request.parent;
302
320
  if (fieldValue !== undefined && fieldValue !== null) {
303
- const match = fieldValue.toString().match(RegExp('(?<provider_id>providers/[^/]+)'));
321
+ const match = fieldValue
322
+ .toString()
323
+ .match(RegExp('(?<provider_id>providers/[^/]+)'));
304
324
  if (match) {
305
325
  const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
306
326
  Object.assign(routingParameter, { provider_id: parameterValue });
307
327
  }
308
328
  }
309
329
  }
310
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
311
- this.initialize().catch(err => { throw err; });
330
+ options.otherArgs.headers['x-goog-request-params'] =
331
+ this._gaxModule.routingHeader.fromParams(routingParameter);
332
+ this.initialize().catch((err) => {
333
+ throw err;
334
+ });
312
335
  this._log.info('createDeliveryVehicle request %j', request);
313
336
  const wrappedCallback = callback
314
337
  ? (error, response, options, rawResponse) => {
@@ -316,12 +339,16 @@ class DeliveryServiceClient {
316
339
  callback(error, response, options, rawResponse); // We verified callback above.
317
340
  }
318
341
  : undefined;
319
- return this.innerApiCalls.createDeliveryVehicle(request, options, wrappedCallback)
342
+ return this.innerApiCalls
343
+ .createDeliveryVehicle(request, options, wrappedCallback)
320
344
  ?.then(([response, options, rawResponse]) => {
321
345
  this._log.info('createDeliveryVehicle response %j', response);
322
346
  return [response, options, rawResponse];
323
- }).catch((error) => {
324
- if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
347
+ })
348
+ .catch((error) => {
349
+ if (error &&
350
+ 'statusDetails' in error &&
351
+ error.statusDetails instanceof Array) {
325
352
  const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
326
353
  error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
327
354
  }
@@ -345,15 +372,20 @@ class DeliveryServiceClient {
345
372
  {
346
373
  const fieldValue = request.name;
347
374
  if (fieldValue !== undefined && fieldValue !== null) {
348
- const match = fieldValue.toString().match(RegExp('(?<provider_id>providers/[^/]+)'));
375
+ const match = fieldValue
376
+ .toString()
377
+ .match(RegExp('(?<provider_id>providers/[^/]+)'));
349
378
  if (match) {
350
379
  const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
351
380
  Object.assign(routingParameter, { provider_id: parameterValue });
352
381
  }
353
382
  }
354
383
  }
355
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
356
- this.initialize().catch(err => { throw err; });
384
+ options.otherArgs.headers['x-goog-request-params'] =
385
+ this._gaxModule.routingHeader.fromParams(routingParameter);
386
+ this.initialize().catch((err) => {
387
+ throw err;
388
+ });
357
389
  this._log.info('getDeliveryVehicle request %j', request);
358
390
  const wrappedCallback = callback
359
391
  ? (error, response, options, rawResponse) => {
@@ -361,12 +393,16 @@ class DeliveryServiceClient {
361
393
  callback(error, response, options, rawResponse); // We verified callback above.
362
394
  }
363
395
  : undefined;
364
- return this.innerApiCalls.getDeliveryVehicle(request, options, wrappedCallback)
396
+ return this.innerApiCalls
397
+ .getDeliveryVehicle(request, options, wrappedCallback)
365
398
  ?.then(([response, options, rawResponse]) => {
366
399
  this._log.info('getDeliveryVehicle response %j', response);
367
400
  return [response, options, rawResponse];
368
- }).catch((error) => {
369
- if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
401
+ })
402
+ .catch((error) => {
403
+ if (error &&
404
+ 'statusDetails' in error &&
405
+ error.statusDetails instanceof Array) {
370
406
  const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
371
407
  error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
372
408
  }
@@ -390,15 +426,20 @@ class DeliveryServiceClient {
390
426
  {
391
427
  const fieldValue = request.name;
392
428
  if (fieldValue !== undefined && fieldValue !== null) {
393
- const match = fieldValue.toString().match(RegExp('(?<provider_id>providers/[^/]+)'));
429
+ const match = fieldValue
430
+ .toString()
431
+ .match(RegExp('(?<provider_id>providers/[^/]+)'));
394
432
  if (match) {
395
433
  const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
396
434
  Object.assign(routingParameter, { provider_id: parameterValue });
397
435
  }
398
436
  }
399
437
  }
400
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
401
- this.initialize().catch(err => { throw err; });
438
+ options.otherArgs.headers['x-goog-request-params'] =
439
+ this._gaxModule.routingHeader.fromParams(routingParameter);
440
+ this.initialize().catch((err) => {
441
+ throw err;
442
+ });
402
443
  this._log.info('deleteDeliveryVehicle request %j', request);
403
444
  const wrappedCallback = callback
404
445
  ? (error, response, options, rawResponse) => {
@@ -406,12 +447,16 @@ class DeliveryServiceClient {
406
447
  callback(error, response, options, rawResponse); // We verified callback above.
407
448
  }
408
449
  : undefined;
409
- return this.innerApiCalls.deleteDeliveryVehicle(request, options, wrappedCallback)
450
+ return this.innerApiCalls
451
+ .deleteDeliveryVehicle(request, options, wrappedCallback)
410
452
  ?.then(([response, options, rawResponse]) => {
411
453
  this._log.info('deleteDeliveryVehicle response %j', response);
412
454
  return [response, options, rawResponse];
413
- }).catch((error) => {
414
- if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
455
+ })
456
+ .catch((error) => {
457
+ if (error &&
458
+ 'statusDetails' in error &&
459
+ error.statusDetails instanceof Array) {
415
460
  const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
416
461
  error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
417
462
  }
@@ -435,15 +480,20 @@ class DeliveryServiceClient {
435
480
  {
436
481
  const fieldValue = request.deliveryVehicle?.name;
437
482
  if (fieldValue !== undefined && fieldValue !== null) {
438
- const match = fieldValue.toString().match(RegExp('(?<provider_id>providers/[^/]+)'));
483
+ const match = fieldValue
484
+ .toString()
485
+ .match(RegExp('(?<provider_id>providers/[^/]+)'));
439
486
  if (match) {
440
487
  const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
441
488
  Object.assign(routingParameter, { provider_id: parameterValue });
442
489
  }
443
490
  }
444
491
  }
445
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
446
- this.initialize().catch(err => { throw err; });
492
+ options.otherArgs.headers['x-goog-request-params'] =
493
+ this._gaxModule.routingHeader.fromParams(routingParameter);
494
+ this.initialize().catch((err) => {
495
+ throw err;
496
+ });
447
497
  this._log.info('updateDeliveryVehicle request %j', request);
448
498
  const wrappedCallback = callback
449
499
  ? (error, response, options, rawResponse) => {
@@ -451,12 +501,16 @@ class DeliveryServiceClient {
451
501
  callback(error, response, options, rawResponse); // We verified callback above.
452
502
  }
453
503
  : undefined;
454
- return this.innerApiCalls.updateDeliveryVehicle(request, options, wrappedCallback)
504
+ return this.innerApiCalls
505
+ .updateDeliveryVehicle(request, options, wrappedCallback)
455
506
  ?.then(([response, options, rawResponse]) => {
456
507
  this._log.info('updateDeliveryVehicle response %j', response);
457
508
  return [response, options, rawResponse];
458
- }).catch((error) => {
459
- if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
509
+ })
510
+ .catch((error) => {
511
+ if (error &&
512
+ 'statusDetails' in error &&
513
+ error.statusDetails instanceof Array) {
460
514
  const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
461
515
  error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
462
516
  }
@@ -480,15 +534,20 @@ class DeliveryServiceClient {
480
534
  {
481
535
  const fieldValue = request.parent;
482
536
  if (fieldValue !== undefined && fieldValue !== null) {
483
- const match = fieldValue.toString().match(RegExp('(?<provider_id>providers/[^/]+)'));
537
+ const match = fieldValue
538
+ .toString()
539
+ .match(RegExp('(?<provider_id>providers/[^/]+)'));
484
540
  if (match) {
485
541
  const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
486
542
  Object.assign(routingParameter, { provider_id: parameterValue });
487
543
  }
488
544
  }
489
545
  }
490
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
491
- this.initialize().catch(err => { throw err; });
546
+ options.otherArgs.headers['x-goog-request-params'] =
547
+ this._gaxModule.routingHeader.fromParams(routingParameter);
548
+ this.initialize().catch((err) => {
549
+ throw err;
550
+ });
492
551
  this._log.info('batchCreateTasks request %j', request);
493
552
  const wrappedCallback = callback
494
553
  ? (error, response, options, rawResponse) => {
@@ -496,12 +555,16 @@ class DeliveryServiceClient {
496
555
  callback(error, response, options, rawResponse); // We verified callback above.
497
556
  }
498
557
  : undefined;
499
- return this.innerApiCalls.batchCreateTasks(request, options, wrappedCallback)
558
+ return this.innerApiCalls
559
+ .batchCreateTasks(request, options, wrappedCallback)
500
560
  ?.then(([response, options, rawResponse]) => {
501
561
  this._log.info('batchCreateTasks response %j', response);
502
562
  return [response, options, rawResponse];
503
- }).catch((error) => {
504
- if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
563
+ })
564
+ .catch((error) => {
565
+ if (error &&
566
+ 'statusDetails' in error &&
567
+ error.statusDetails instanceof Array) {
505
568
  const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
506
569
  error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
507
570
  }
@@ -525,15 +588,20 @@ class DeliveryServiceClient {
525
588
  {
526
589
  const fieldValue = request.parent;
527
590
  if (fieldValue !== undefined && fieldValue !== null) {
528
- const match = fieldValue.toString().match(RegExp('(?<provider_id>providers/[^/]+)'));
591
+ const match = fieldValue
592
+ .toString()
593
+ .match(RegExp('(?<provider_id>providers/[^/]+)'));
529
594
  if (match) {
530
595
  const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
531
596
  Object.assign(routingParameter, { provider_id: parameterValue });
532
597
  }
533
598
  }
534
599
  }
535
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
536
- this.initialize().catch(err => { throw err; });
600
+ options.otherArgs.headers['x-goog-request-params'] =
601
+ this._gaxModule.routingHeader.fromParams(routingParameter);
602
+ this.initialize().catch((err) => {
603
+ throw err;
604
+ });
537
605
  this._log.info('createTask request %j', request);
538
606
  const wrappedCallback = callback
539
607
  ? (error, response, options, rawResponse) => {
@@ -541,12 +609,16 @@ class DeliveryServiceClient {
541
609
  callback(error, response, options, rawResponse); // We verified callback above.
542
610
  }
543
611
  : undefined;
544
- return this.innerApiCalls.createTask(request, options, wrappedCallback)
612
+ return this.innerApiCalls
613
+ .createTask(request, options, wrappedCallback)
545
614
  ?.then(([response, options, rawResponse]) => {
546
615
  this._log.info('createTask response %j', response);
547
616
  return [response, options, rawResponse];
548
- }).catch((error) => {
549
- if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
617
+ })
618
+ .catch((error) => {
619
+ if (error &&
620
+ 'statusDetails' in error &&
621
+ error.statusDetails instanceof Array) {
550
622
  const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
551
623
  error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
552
624
  }
@@ -570,15 +642,20 @@ class DeliveryServiceClient {
570
642
  {
571
643
  const fieldValue = request.name;
572
644
  if (fieldValue !== undefined && fieldValue !== null) {
573
- const match = fieldValue.toString().match(RegExp('(?<provider_id>providers/[^/]+)'));
645
+ const match = fieldValue
646
+ .toString()
647
+ .match(RegExp('(?<provider_id>providers/[^/]+)'));
574
648
  if (match) {
575
649
  const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
576
650
  Object.assign(routingParameter, { provider_id: parameterValue });
577
651
  }
578
652
  }
579
653
  }
580
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
581
- this.initialize().catch(err => { throw err; });
654
+ options.otherArgs.headers['x-goog-request-params'] =
655
+ this._gaxModule.routingHeader.fromParams(routingParameter);
656
+ this.initialize().catch((err) => {
657
+ throw err;
658
+ });
582
659
  this._log.info('getTask request %j', request);
583
660
  const wrappedCallback = callback
584
661
  ? (error, response, options, rawResponse) => {
@@ -586,12 +663,16 @@ class DeliveryServiceClient {
586
663
  callback(error, response, options, rawResponse); // We verified callback above.
587
664
  }
588
665
  : undefined;
589
- return this.innerApiCalls.getTask(request, options, wrappedCallback)
666
+ return this.innerApiCalls
667
+ .getTask(request, options, wrappedCallback)
590
668
  ?.then(([response, options, rawResponse]) => {
591
669
  this._log.info('getTask response %j', response);
592
670
  return [response, options, rawResponse];
593
- }).catch((error) => {
594
- if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
671
+ })
672
+ .catch((error) => {
673
+ if (error &&
674
+ 'statusDetails' in error &&
675
+ error.statusDetails instanceof Array) {
595
676
  const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
596
677
  error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
597
678
  }
@@ -615,15 +696,20 @@ class DeliveryServiceClient {
615
696
  {
616
697
  const fieldValue = request.name;
617
698
  if (fieldValue !== undefined && fieldValue !== null) {
618
- const match = fieldValue.toString().match(RegExp('(?<provider_id>providers/[^/]+)'));
699
+ const match = fieldValue
700
+ .toString()
701
+ .match(RegExp('(?<provider_id>providers/[^/]+)'));
619
702
  if (match) {
620
703
  const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
621
704
  Object.assign(routingParameter, { provider_id: parameterValue });
622
705
  }
623
706
  }
624
707
  }
625
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
626
- this.initialize().catch(err => { throw err; });
708
+ options.otherArgs.headers['x-goog-request-params'] =
709
+ this._gaxModule.routingHeader.fromParams(routingParameter);
710
+ this.initialize().catch((err) => {
711
+ throw err;
712
+ });
627
713
  this._log.info('deleteTask request %j', request);
628
714
  const wrappedCallback = callback
629
715
  ? (error, response, options, rawResponse) => {
@@ -631,12 +717,16 @@ class DeliveryServiceClient {
631
717
  callback(error, response, options, rawResponse); // We verified callback above.
632
718
  }
633
719
  : undefined;
634
- return this.innerApiCalls.deleteTask(request, options, wrappedCallback)
720
+ return this.innerApiCalls
721
+ .deleteTask(request, options, wrappedCallback)
635
722
  ?.then(([response, options, rawResponse]) => {
636
723
  this._log.info('deleteTask response %j', response);
637
724
  return [response, options, rawResponse];
638
- }).catch((error) => {
639
- if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
725
+ })
726
+ .catch((error) => {
727
+ if (error &&
728
+ 'statusDetails' in error &&
729
+ error.statusDetails instanceof Array) {
640
730
  const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
641
731
  error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
642
732
  }
@@ -660,15 +750,20 @@ class DeliveryServiceClient {
660
750
  {
661
751
  const fieldValue = request.task?.name;
662
752
  if (fieldValue !== undefined && fieldValue !== null) {
663
- const match = fieldValue.toString().match(RegExp('(?<provider_id>providers/[^/]+)'));
753
+ const match = fieldValue
754
+ .toString()
755
+ .match(RegExp('(?<provider_id>providers/[^/]+)'));
664
756
  if (match) {
665
757
  const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
666
758
  Object.assign(routingParameter, { provider_id: parameterValue });
667
759
  }
668
760
  }
669
761
  }
670
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
671
- this.initialize().catch(err => { throw err; });
762
+ options.otherArgs.headers['x-goog-request-params'] =
763
+ this._gaxModule.routingHeader.fromParams(routingParameter);
764
+ this.initialize().catch((err) => {
765
+ throw err;
766
+ });
672
767
  this._log.info('updateTask request %j', request);
673
768
  const wrappedCallback = callback
674
769
  ? (error, response, options, rawResponse) => {
@@ -676,12 +771,16 @@ class DeliveryServiceClient {
676
771
  callback(error, response, options, rawResponse); // We verified callback above.
677
772
  }
678
773
  : undefined;
679
- return this.innerApiCalls.updateTask(request, options, wrappedCallback)
774
+ return this.innerApiCalls
775
+ .updateTask(request, options, wrappedCallback)
680
776
  ?.then(([response, options, rawResponse]) => {
681
777
  this._log.info('updateTask response %j', response);
682
778
  return [response, options, rawResponse];
683
- }).catch((error) => {
684
- if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
779
+ })
780
+ .catch((error) => {
781
+ if (error &&
782
+ 'statusDetails' in error &&
783
+ error.statusDetails instanceof Array) {
685
784
  const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
686
785
  error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
687
786
  }
@@ -705,15 +804,20 @@ class DeliveryServiceClient {
705
804
  {
706
805
  const fieldValue = request.name;
707
806
  if (fieldValue !== undefined && fieldValue !== null) {
708
- const match = fieldValue.toString().match(RegExp('(?<provider_id>providers/[^/]+)'));
807
+ const match = fieldValue
808
+ .toString()
809
+ .match(RegExp('(?<provider_id>providers/[^/]+)'));
709
810
  if (match) {
710
811
  const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
711
812
  Object.assign(routingParameter, { provider_id: parameterValue });
712
813
  }
713
814
  }
714
815
  }
715
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
716
- this.initialize().catch(err => { throw err; });
816
+ options.otherArgs.headers['x-goog-request-params'] =
817
+ this._gaxModule.routingHeader.fromParams(routingParameter);
818
+ this.initialize().catch((err) => {
819
+ throw err;
820
+ });
717
821
  this._log.info('getTaskTrackingInfo request %j', request);
718
822
  const wrappedCallback = callback
719
823
  ? (error, response, options, rawResponse) => {
@@ -721,12 +825,16 @@ class DeliveryServiceClient {
721
825
  callback(error, response, options, rawResponse); // We verified callback above.
722
826
  }
723
827
  : undefined;
724
- return this.innerApiCalls.getTaskTrackingInfo(request, options, wrappedCallback)
828
+ return this.innerApiCalls
829
+ .getTaskTrackingInfo(request, options, wrappedCallback)
725
830
  ?.then(([response, options, rawResponse]) => {
726
831
  this._log.info('getTaskTrackingInfo response %j', response);
727
832
  return [response, options, rawResponse];
728
- }).catch((error) => {
729
- if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
833
+ })
834
+ .catch((error) => {
835
+ if (error &&
836
+ 'statusDetails' in error &&
837
+ error.statusDetails instanceof Array) {
730
838
  const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
731
839
  error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
732
840
  }
@@ -750,15 +858,20 @@ class DeliveryServiceClient {
750
858
  {
751
859
  const fieldValue = request.parent;
752
860
  if (fieldValue !== undefined && fieldValue !== null) {
753
- const match = fieldValue.toString().match(RegExp('(?<provider_id>providers/[^/]+)'));
861
+ const match = fieldValue
862
+ .toString()
863
+ .match(RegExp('(?<provider_id>providers/[^/]+)'));
754
864
  if (match) {
755
865
  const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
756
866
  Object.assign(routingParameter, { provider_id: parameterValue });
757
867
  }
758
868
  }
759
869
  }
760
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
761
- this.initialize().catch(err => { throw err; });
870
+ options.otherArgs.headers['x-goog-request-params'] =
871
+ this._gaxModule.routingHeader.fromParams(routingParameter);
872
+ this.initialize().catch((err) => {
873
+ throw err;
874
+ });
762
875
  const wrappedCallback = callback
763
876
  ? (error, values, nextPageRequest, rawResponse) => {
764
877
  this._log.info('listTasks values %j', values);
@@ -819,17 +932,22 @@ class DeliveryServiceClient {
819
932
  {
820
933
  const fieldValue = request.parent;
821
934
  if (fieldValue !== undefined && fieldValue !== null) {
822
- const match = fieldValue.toString().match(RegExp('(?<provider_id>providers/[^/]+)'));
935
+ const match = fieldValue
936
+ .toString()
937
+ .match(RegExp('(?<provider_id>providers/[^/]+)'));
823
938
  if (match) {
824
939
  const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
825
940
  Object.assign(routingParameter, { provider_id: parameterValue });
826
941
  }
827
942
  }
828
943
  }
829
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
944
+ options.otherArgs.headers['x-goog-request-params'] =
945
+ this._gaxModule.routingHeader.fromParams(routingParameter);
830
946
  const defaultCallSettings = this._defaults['listTasks'];
831
947
  const callSettings = defaultCallSettings.merge(options);
832
- this.initialize().catch(err => { throw err; });
948
+ this.initialize().catch((err) => {
949
+ throw err;
950
+ });
833
951
  this._log.info('listTasks stream %j', request);
834
952
  return this.descriptors.page.listTasks.createStream(this.innerApiCalls.listTasks, request, callSettings);
835
953
  }
@@ -882,17 +1000,22 @@ class DeliveryServiceClient {
882
1000
  {
883
1001
  const fieldValue = request.parent;
884
1002
  if (fieldValue !== undefined && fieldValue !== null) {
885
- const match = fieldValue.toString().match(RegExp('(?<provider_id>providers/[^/]+)'));
1003
+ const match = fieldValue
1004
+ .toString()
1005
+ .match(RegExp('(?<provider_id>providers/[^/]+)'));
886
1006
  if (match) {
887
1007
  const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
888
1008
  Object.assign(routingParameter, { provider_id: parameterValue });
889
1009
  }
890
1010
  }
891
1011
  }
892
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
1012
+ options.otherArgs.headers['x-goog-request-params'] =
1013
+ this._gaxModule.routingHeader.fromParams(routingParameter);
893
1014
  const defaultCallSettings = this._defaults['listTasks'];
894
1015
  const callSettings = defaultCallSettings.merge(options);
895
- this.initialize().catch(err => { throw err; });
1016
+ this.initialize().catch((err) => {
1017
+ throw err;
1018
+ });
896
1019
  this._log.info('listTasks iterate %j', request);
897
1020
  return this.descriptors.page.listTasks.asyncIterate(this.innerApiCalls['listTasks'], request, callSettings);
898
1021
  }
@@ -913,15 +1036,20 @@ class DeliveryServiceClient {
913
1036
  {
914
1037
  const fieldValue = request.parent;
915
1038
  if (fieldValue !== undefined && fieldValue !== null) {
916
- const match = fieldValue.toString().match(RegExp('(?<provider_id>providers/[^/]+)'));
1039
+ const match = fieldValue
1040
+ .toString()
1041
+ .match(RegExp('(?<provider_id>providers/[^/]+)'));
917
1042
  if (match) {
918
1043
  const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
919
1044
  Object.assign(routingParameter, { provider_id: parameterValue });
920
1045
  }
921
1046
  }
922
1047
  }
923
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
924
- this.initialize().catch(err => { throw err; });
1048
+ options.otherArgs.headers['x-goog-request-params'] =
1049
+ this._gaxModule.routingHeader.fromParams(routingParameter);
1050
+ this.initialize().catch((err) => {
1051
+ throw err;
1052
+ });
925
1053
  const wrappedCallback = callback
926
1054
  ? (error, values, nextPageRequest, rawResponse) => {
927
1055
  this._log.info('listDeliveryVehicles values %j', values);
@@ -998,17 +1126,22 @@ class DeliveryServiceClient {
998
1126
  {
999
1127
  const fieldValue = request.parent;
1000
1128
  if (fieldValue !== undefined && fieldValue !== null) {
1001
- const match = fieldValue.toString().match(RegExp('(?<provider_id>providers/[^/]+)'));
1129
+ const match = fieldValue
1130
+ .toString()
1131
+ .match(RegExp('(?<provider_id>providers/[^/]+)'));
1002
1132
  if (match) {
1003
1133
  const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
1004
1134
  Object.assign(routingParameter, { provider_id: parameterValue });
1005
1135
  }
1006
1136
  }
1007
1137
  }
1008
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
1138
+ options.otherArgs.headers['x-goog-request-params'] =
1139
+ this._gaxModule.routingHeader.fromParams(routingParameter);
1009
1140
  const defaultCallSettings = this._defaults['listDeliveryVehicles'];
1010
1141
  const callSettings = defaultCallSettings.merge(options);
1011
- this.initialize().catch(err => { throw err; });
1142
+ this.initialize().catch((err) => {
1143
+ throw err;
1144
+ });
1012
1145
  this._log.info('listDeliveryVehicles stream %j', request);
1013
1146
  return this.descriptors.page.listDeliveryVehicles.createStream(this.innerApiCalls.listDeliveryVehicles, request, callSettings);
1014
1147
  }
@@ -1077,17 +1210,22 @@ class DeliveryServiceClient {
1077
1210
  {
1078
1211
  const fieldValue = request.parent;
1079
1212
  if (fieldValue !== undefined && fieldValue !== null) {
1080
- const match = fieldValue.toString().match(RegExp('(?<provider_id>providers/[^/]+)'));
1213
+ const match = fieldValue
1214
+ .toString()
1215
+ .match(RegExp('(?<provider_id>providers/[^/]+)'));
1081
1216
  if (match) {
1082
1217
  const parameterValue = match.groups?.['provider_id'] ?? fieldValue;
1083
1218
  Object.assign(routingParameter, { provider_id: parameterValue });
1084
1219
  }
1085
1220
  }
1086
1221
  }
1087
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams(routingParameter);
1222
+ options.otherArgs.headers['x-goog-request-params'] =
1223
+ this._gaxModule.routingHeader.fromParams(routingParameter);
1088
1224
  const defaultCallSettings = this._defaults['listDeliveryVehicles'];
1089
1225
  const callSettings = defaultCallSettings.merge(options);
1090
- this.initialize().catch(err => { throw err; });
1226
+ this.initialize().catch((err) => {
1227
+ throw err;
1228
+ });
1091
1229
  this._log.info('listDeliveryVehicles iterate %j', request);
1092
1230
  return this.descriptors.page.listDeliveryVehicles.asyncIterate(this.innerApiCalls['listDeliveryVehicles'], request, callSettings);
1093
1231
  }
@@ -1222,7 +1360,7 @@ class DeliveryServiceClient {
1222
1360
  */
1223
1361
  close() {
1224
1362
  if (this.deliveryServiceStub && !this._terminated) {
1225
- return this.deliveryServiceStub.then(stub => {
1363
+ return this.deliveryServiceStub.then((stub) => {
1226
1364
  this._log.info('ending gRPC channel');
1227
1365
  this._terminated = true;
1228
1366
  stub.close();