@google-cloud/apikeys 2.2.1 → 3.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.
@@ -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.
@@ -97,17 +97,26 @@ class ApiKeysClient {
97
97
  constructor(opts, gaxInstance) {
98
98
  // Ensure that options include all the required fields.
99
99
  const staticMembers = this.constructor;
100
- if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) {
100
+ if (opts?.universe_domain &&
101
+ opts?.universeDomain &&
102
+ opts?.universe_domain !== opts?.universeDomain) {
101
103
  throw new Error('Please set either universe_domain or universeDomain, but not both.');
102
104
  }
103
- const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined;
104
- this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com';
105
+ const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
106
+ ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
107
+ : undefined;
108
+ this._universeDomain =
109
+ opts?.universeDomain ??
110
+ opts?.universe_domain ??
111
+ universeDomainEnvVar ??
112
+ 'googleapis.com';
105
113
  this._servicePath = 'apikeys.' + this._universeDomain;
106
114
  const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
107
115
  this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
108
116
  const port = opts?.port || staticMembers.port;
109
117
  const clientConfig = opts?.clientConfig ?? {};
110
- const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function');
118
+ const fallback = opts?.fallback ??
119
+ (typeof window !== 'undefined' && typeof window?.fetch === 'function');
111
120
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
112
121
  // Request numeric enum values if REST transport is used.
113
122
  opts.numericEnums = true;
@@ -136,10 +145,7 @@ class ApiKeysClient {
136
145
  this.auth.defaultScopes = staticMembers.scopes;
137
146
  }
138
147
  // Determine the client header string.
139
- const clientHeader = [
140
- `gax/${this._gaxModule.version}`,
141
- `gapic/${version}`,
142
- ];
148
+ const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
143
149
  if (typeof process === 'object' && 'versions' in process) {
144
150
  clientHeader.push(`gl-node/${process.versions.node}`);
145
151
  }
@@ -169,7 +175,7 @@ class ApiKeysClient {
169
175
  // (e.g. 50 results at a time, with tokens to get subsequent
170
176
  // pages). Denote the keys used for pagination and results.
171
177
  this.descriptors.page = {
172
- listKeys: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'keys')
178
+ listKeys: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'keys'),
173
179
  };
174
180
  const protoFilesRoot = this._gaxModule.protobufFromJSON(jsonProtos);
175
181
  // This API contains "long-running operations", which return a
@@ -177,13 +183,20 @@ class ApiKeysClient {
177
183
  // rather than holding a request open.
178
184
  const lroOptions = {
179
185
  auth: this.auth,
180
- grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined
186
+ grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
181
187
  };
182
188
  if (opts.fallback) {
183
189
  lroOptions.protoJson = protoFilesRoot;
184
- lroOptions.httpRules = [{ selector: 'google.longrunning.Operations.GetOperation', get: '/v2/{name=operations/*}', }];
190
+ lroOptions.httpRules = [
191
+ {
192
+ selector: 'google.longrunning.Operations.GetOperation',
193
+ get: '/v2/{name=operations/*}',
194
+ },
195
+ ];
185
196
  }
186
- this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts);
197
+ this.operationsClient = this._gaxModule
198
+ .lro(lroOptions)
199
+ .operationsClient(opts);
187
200
  const createKeyResponse = protoFilesRoot.lookup('.google.api.apikeys.v2.Key');
188
201
  const createKeyMetadata = protoFilesRoot.lookup('.google.protobuf.Empty');
189
202
  const updateKeyResponse = protoFilesRoot.lookup('.google.api.apikeys.v2.Key');
@@ -196,7 +209,7 @@ class ApiKeysClient {
196
209
  createKey: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createKeyResponse.decode.bind(createKeyResponse), createKeyMetadata.decode.bind(createKeyMetadata)),
197
210
  updateKey: new this._gaxModule.LongrunningDescriptor(this.operationsClient, updateKeyResponse.decode.bind(updateKeyResponse), updateKeyMetadata.decode.bind(updateKeyMetadata)),
198
211
  deleteKey: new this._gaxModule.LongrunningDescriptor(this.operationsClient, deleteKeyResponse.decode.bind(deleteKeyResponse), deleteKeyMetadata.decode.bind(deleteKeyMetadata)),
199
- undeleteKey: new this._gaxModule.LongrunningDescriptor(this.operationsClient, undeleteKeyResponse.decode.bind(undeleteKeyResponse), undeleteKeyMetadata.decode.bind(undeleteKeyMetadata))
212
+ undeleteKey: new this._gaxModule.LongrunningDescriptor(this.operationsClient, undeleteKeyResponse.decode.bind(undeleteKeyResponse), undeleteKeyMetadata.decode.bind(undeleteKeyMetadata)),
200
213
  };
201
214
  // Put together the default options sent with requests.
202
215
  this._defaults = this._gaxGrpc.constructSettings('google.api.apikeys.v2.ApiKeys', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
@@ -225,15 +238,24 @@ class ApiKeysClient {
225
238
  }
226
239
  // Put together the "service stub" for
227
240
  // google.api.apikeys.v2.ApiKeys.
228
- this.apiKeysStub = this._gaxGrpc.createStub(this._opts.fallback ?
229
- this._protos.lookupService('google.api.apikeys.v2.ApiKeys') :
230
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
231
- this._protos.google.api.apikeys.v2.ApiKeys, this._opts, this._providedCustomServicePath);
241
+ this.apiKeysStub = this._gaxGrpc.createStub(this._opts.fallback
242
+ ? this._protos.lookupService('google.api.apikeys.v2.ApiKeys')
243
+ : // eslint-disable-next-line @typescript-eslint/no-explicit-any
244
+ this._protos.google.api.apikeys.v2.ApiKeys, this._opts, this._providedCustomServicePath);
232
245
  // Iterate over each of the methods that the service provides
233
246
  // and create an API call method for each.
234
- const apiKeysStubMethods = ['createKey', 'listKeys', 'getKey', 'getKeyString', 'updateKey', 'deleteKey', 'undeleteKey', 'lookupKey'];
247
+ const apiKeysStubMethods = [
248
+ 'createKey',
249
+ 'listKeys',
250
+ 'getKey',
251
+ 'getKeyString',
252
+ 'updateKey',
253
+ 'deleteKey',
254
+ 'undeleteKey',
255
+ 'lookupKey',
256
+ ];
235
257
  for (const methodName of apiKeysStubMethods) {
236
- const callPromise = this.apiKeysStub.then(stub => (...args) => {
258
+ const callPromise = this.apiKeysStub.then((stub) => (...args) => {
237
259
  if (this._terminated) {
238
260
  return Promise.reject('The client has already been closed.');
239
261
  }
@@ -256,7 +278,8 @@ class ApiKeysClient {
256
278
  * @returns {string} The DNS address for this service.
257
279
  */
258
280
  static get servicePath() {
259
- if (typeof process === 'object' && typeof process.emitWarning === 'function') {
281
+ if (typeof process === 'object' &&
282
+ typeof process.emitWarning === 'function') {
260
283
  process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
261
284
  }
262
285
  return 'apikeys.googleapis.com';
@@ -267,7 +290,8 @@ class ApiKeysClient {
267
290
  * @returns {string} The DNS address for this service.
268
291
  */
269
292
  static get apiEndpoint() {
270
- if (typeof process === 'object' && typeof process.emitWarning === 'function') {
293
+ if (typeof process === 'object' &&
294
+ typeof process.emitWarning === 'function') {
271
295
  process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
272
296
  }
273
297
  return 'apikeys.googleapis.com';
@@ -297,7 +321,7 @@ class ApiKeysClient {
297
321
  static get scopes() {
298
322
  return [
299
323
  'https://www.googleapis.com/auth/cloud-platform',
300
- 'https://www.googleapis.com/auth/cloud-platform.read-only'
324
+ 'https://www.googleapis.com/auth/cloud-platform.read-only',
301
325
  ];
302
326
  }
303
327
  /**
@@ -324,10 +348,13 @@ class ApiKeysClient {
324
348
  options = options || {};
325
349
  options.otherArgs = options.otherArgs || {};
326
350
  options.otherArgs.headers = options.otherArgs.headers || {};
327
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
328
- 'name': request.name ?? '',
351
+ options.otherArgs.headers['x-goog-request-params'] =
352
+ this._gaxModule.routingHeader.fromParams({
353
+ name: request.name ?? '',
354
+ });
355
+ this.initialize().catch((err) => {
356
+ throw err;
329
357
  });
330
- this.initialize().catch(err => { throw err; });
331
358
  this._log.info('getKey request %j', request);
332
359
  const wrappedCallback = callback
333
360
  ? (error, response, options, rawResponse) => {
@@ -335,12 +362,16 @@ class ApiKeysClient {
335
362
  callback(error, response, options, rawResponse); // We verified callback above.
336
363
  }
337
364
  : undefined;
338
- return this.innerApiCalls.getKey(request, options, wrappedCallback)
365
+ return this.innerApiCalls
366
+ .getKey(request, options, wrappedCallback)
339
367
  ?.then(([response, options, rawResponse]) => {
340
368
  this._log.info('getKey response %j', response);
341
369
  return [response, options, rawResponse];
342
- }).catch((error) => {
343
- if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
370
+ })
371
+ .catch((error) => {
372
+ if (error &&
373
+ 'statusDetails' in error &&
374
+ error.statusDetails instanceof Array) {
344
375
  const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
345
376
  error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
346
377
  }
@@ -360,10 +391,13 @@ class ApiKeysClient {
360
391
  options = options || {};
361
392
  options.otherArgs = options.otherArgs || {};
362
393
  options.otherArgs.headers = options.otherArgs.headers || {};
363
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
364
- 'name': request.name ?? '',
394
+ options.otherArgs.headers['x-goog-request-params'] =
395
+ this._gaxModule.routingHeader.fromParams({
396
+ name: request.name ?? '',
397
+ });
398
+ this.initialize().catch((err) => {
399
+ throw err;
365
400
  });
366
- this.initialize().catch(err => { throw err; });
367
401
  this._log.info('getKeyString request %j', request);
368
402
  const wrappedCallback = callback
369
403
  ? (error, response, options, rawResponse) => {
@@ -371,12 +405,16 @@ class ApiKeysClient {
371
405
  callback(error, response, options, rawResponse); // We verified callback above.
372
406
  }
373
407
  : undefined;
374
- return this.innerApiCalls.getKeyString(request, options, wrappedCallback)
408
+ return this.innerApiCalls
409
+ .getKeyString(request, options, wrappedCallback)
375
410
  ?.then(([response, options, rawResponse]) => {
376
411
  this._log.info('getKeyString response %j', response);
377
412
  return [response, options, rawResponse];
378
- }).catch((error) => {
379
- if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
413
+ })
414
+ .catch((error) => {
415
+ if (error &&
416
+ 'statusDetails' in error &&
417
+ error.statusDetails instanceof Array) {
380
418
  const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
381
419
  error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
382
420
  }
@@ -396,7 +434,9 @@ class ApiKeysClient {
396
434
  options = options || {};
397
435
  options.otherArgs = options.otherArgs || {};
398
436
  options.otherArgs.headers = options.otherArgs.headers || {};
399
- this.initialize().catch(err => { throw err; });
437
+ this.initialize().catch((err) => {
438
+ throw err;
439
+ });
400
440
  this._log.info('lookupKey request %j', request);
401
441
  const wrappedCallback = callback
402
442
  ? (error, response, options, rawResponse) => {
@@ -404,12 +444,16 @@ class ApiKeysClient {
404
444
  callback(error, response, options, rawResponse); // We verified callback above.
405
445
  }
406
446
  : undefined;
407
- return this.innerApiCalls.lookupKey(request, options, wrappedCallback)
447
+ return this.innerApiCalls
448
+ .lookupKey(request, options, wrappedCallback)
408
449
  ?.then(([response, options, rawResponse]) => {
409
450
  this._log.info('lookupKey response %j', response);
410
451
  return [response, options, rawResponse];
411
- }).catch((error) => {
412
- if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
452
+ })
453
+ .catch((error) => {
454
+ if (error &&
455
+ 'statusDetails' in error &&
456
+ error.statusDetails instanceof Array) {
413
457
  const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
414
458
  error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
415
459
  }
@@ -429,10 +473,13 @@ class ApiKeysClient {
429
473
  options = options || {};
430
474
  options.otherArgs = options.otherArgs || {};
431
475
  options.otherArgs.headers = options.otherArgs.headers || {};
432
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
433
- 'parent': request.parent ?? '',
476
+ options.otherArgs.headers['x-goog-request-params'] =
477
+ this._gaxModule.routingHeader.fromParams({
478
+ parent: request.parent ?? '',
479
+ });
480
+ this.initialize().catch((err) => {
481
+ throw err;
434
482
  });
435
- this.initialize().catch(err => { throw err; });
436
483
  const wrappedCallback = callback
437
484
  ? (error, response, rawResponse, _) => {
438
485
  this._log.info('createKey response %j', rawResponse);
@@ -440,7 +487,8 @@ class ApiKeysClient {
440
487
  }
441
488
  : undefined;
442
489
  this._log.info('createKey request %j', request);
443
- return this.innerApiCalls.createKey(request, options, wrappedCallback)
490
+ return this.innerApiCalls
491
+ .createKey(request, options, wrappedCallback)
444
492
  ?.then(([response, rawResponse, _]) => {
445
493
  this._log.info('createKey response %j', rawResponse);
446
494
  return [response, rawResponse, _];
@@ -477,10 +525,13 @@ class ApiKeysClient {
477
525
  options = options || {};
478
526
  options.otherArgs = options.otherArgs || {};
479
527
  options.otherArgs.headers = options.otherArgs.headers || {};
480
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
481
- 'key.name': request.key.name ?? '',
528
+ options.otherArgs.headers['x-goog-request-params'] =
529
+ this._gaxModule.routingHeader.fromParams({
530
+ 'key.name': request.key.name ?? '',
531
+ });
532
+ this.initialize().catch((err) => {
533
+ throw err;
482
534
  });
483
- this.initialize().catch(err => { throw err; });
484
535
  const wrappedCallback = callback
485
536
  ? (error, response, rawResponse, _) => {
486
537
  this._log.info('updateKey response %j', rawResponse);
@@ -488,7 +539,8 @@ class ApiKeysClient {
488
539
  }
489
540
  : undefined;
490
541
  this._log.info('updateKey request %j', request);
491
- return this.innerApiCalls.updateKey(request, options, wrappedCallback)
542
+ return this.innerApiCalls
543
+ .updateKey(request, options, wrappedCallback)
492
544
  ?.then(([response, rawResponse, _]) => {
493
545
  this._log.info('updateKey response %j', rawResponse);
494
546
  return [response, rawResponse, _];
@@ -525,10 +577,13 @@ class ApiKeysClient {
525
577
  options = options || {};
526
578
  options.otherArgs = options.otherArgs || {};
527
579
  options.otherArgs.headers = options.otherArgs.headers || {};
528
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
529
- 'name': request.name ?? '',
580
+ options.otherArgs.headers['x-goog-request-params'] =
581
+ this._gaxModule.routingHeader.fromParams({
582
+ name: request.name ?? '',
583
+ });
584
+ this.initialize().catch((err) => {
585
+ throw err;
530
586
  });
531
- this.initialize().catch(err => { throw err; });
532
587
  const wrappedCallback = callback
533
588
  ? (error, response, rawResponse, _) => {
534
589
  this._log.info('deleteKey response %j', rawResponse);
@@ -536,7 +591,8 @@ class ApiKeysClient {
536
591
  }
537
592
  : undefined;
538
593
  this._log.info('deleteKey request %j', request);
539
- return this.innerApiCalls.deleteKey(request, options, wrappedCallback)
594
+ return this.innerApiCalls
595
+ .deleteKey(request, options, wrappedCallback)
540
596
  ?.then(([response, rawResponse, _]) => {
541
597
  this._log.info('deleteKey response %j', rawResponse);
542
598
  return [response, rawResponse, _];
@@ -573,10 +629,13 @@ class ApiKeysClient {
573
629
  options = options || {};
574
630
  options.otherArgs = options.otherArgs || {};
575
631
  options.otherArgs.headers = options.otherArgs.headers || {};
576
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
577
- 'name': request.name ?? '',
632
+ options.otherArgs.headers['x-goog-request-params'] =
633
+ this._gaxModule.routingHeader.fromParams({
634
+ name: request.name ?? '',
635
+ });
636
+ this.initialize().catch((err) => {
637
+ throw err;
578
638
  });
579
- this.initialize().catch(err => { throw err; });
580
639
  const wrappedCallback = callback
581
640
  ? (error, response, rawResponse, _) => {
582
641
  this._log.info('undeleteKey response %j', rawResponse);
@@ -584,7 +643,8 @@ class ApiKeysClient {
584
643
  }
585
644
  : undefined;
586
645
  this._log.info('undeleteKey request %j', request);
587
- return this.innerApiCalls.undeleteKey(request, options, wrappedCallback)
646
+ return this.innerApiCalls
647
+ .undeleteKey(request, options, wrappedCallback)
588
648
  ?.then(([response, rawResponse, _]) => {
589
649
  this._log.info('undeleteKey response %j', rawResponse);
590
650
  return [response, rawResponse, _];
@@ -621,10 +681,13 @@ class ApiKeysClient {
621
681
  options = options || {};
622
682
  options.otherArgs = options.otherArgs || {};
623
683
  options.otherArgs.headers = options.otherArgs.headers || {};
624
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
625
- 'parent': request.parent ?? '',
684
+ options.otherArgs.headers['x-goog-request-params'] =
685
+ this._gaxModule.routingHeader.fromParams({
686
+ parent: request.parent ?? '',
687
+ });
688
+ this.initialize().catch((err) => {
689
+ throw err;
626
690
  });
627
- this.initialize().catch(err => { throw err; });
628
691
  const wrappedCallback = callback
629
692
  ? (error, values, nextPageRequest, rawResponse) => {
630
693
  this._log.info('listKeys values %j', values);
@@ -668,12 +731,15 @@ class ApiKeysClient {
668
731
  options = options || {};
669
732
  options.otherArgs = options.otherArgs || {};
670
733
  options.otherArgs.headers = options.otherArgs.headers || {};
671
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
672
- 'parent': request.parent ?? '',
673
- });
734
+ options.otherArgs.headers['x-goog-request-params'] =
735
+ this._gaxModule.routingHeader.fromParams({
736
+ parent: request.parent ?? '',
737
+ });
674
738
  const defaultCallSettings = this._defaults['listKeys'];
675
739
  const callSettings = defaultCallSettings.merge(options);
676
- this.initialize().catch(err => { throw err; });
740
+ this.initialize().catch((err) => {
741
+ throw err;
742
+ });
677
743
  this._log.info('listKeys stream %j', request);
678
744
  return this.descriptors.page.listKeys.createStream(this.innerApiCalls.listKeys, request, callSettings);
679
745
  }
@@ -709,45 +775,48 @@ class ApiKeysClient {
709
775
  options = options || {};
710
776
  options.otherArgs = options.otherArgs || {};
711
777
  options.otherArgs.headers = options.otherArgs.headers || {};
712
- options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
713
- 'parent': request.parent ?? '',
714
- });
778
+ options.otherArgs.headers['x-goog-request-params'] =
779
+ this._gaxModule.routingHeader.fromParams({
780
+ parent: request.parent ?? '',
781
+ });
715
782
  const defaultCallSettings = this._defaults['listKeys'];
716
783
  const callSettings = defaultCallSettings.merge(options);
717
- this.initialize().catch(err => { throw err; });
784
+ this.initialize().catch((err) => {
785
+ throw err;
786
+ });
718
787
  this._log.info('listKeys iterate %j', request);
719
788
  return this.descriptors.page.listKeys.asyncIterate(this.innerApiCalls['listKeys'], request, callSettings);
720
789
  }
721
790
  /**
722
- * Gets the latest state of a long-running operation. Clients can use this
723
- * method to poll the operation result at intervals as recommended by the API
724
- * service.
725
- *
726
- * @param {Object} request - The request object that will be sent.
727
- * @param {string} request.name - The name of the operation resource.
728
- * @param {Object=} options
729
- * Optional parameters. You can override the default settings for this call,
730
- * e.g, timeout, retries, paginations, etc. See {@link
731
- * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
732
- * for the details.
733
- * @param {function(?Error, ?Object)=} callback
734
- * The function which will be called with the result of the API call.
735
- *
736
- * The second parameter to the callback is an object representing
737
- * {@link google.longrunning.Operation | google.longrunning.Operation}.
738
- * @return {Promise} - The promise which resolves to an array.
739
- * The first element of the array is an object representing
740
- * {@link google.longrunning.Operation | google.longrunning.Operation}.
741
- * The promise has a method named "cancel" which cancels the ongoing API call.
742
- *
743
- * @example
744
- * ```
745
- * const client = longrunning.operationsClient();
746
- * const name = '';
747
- * const [response] = await client.getOperation({name});
748
- * // doThingsWith(response)
749
- * ```
750
- */
791
+ * Gets the latest state of a long-running operation. Clients can use this
792
+ * method to poll the operation result at intervals as recommended by the API
793
+ * service.
794
+ *
795
+ * @param {Object} request - The request object that will be sent.
796
+ * @param {string} request.name - The name of the operation resource.
797
+ * @param {Object=} options
798
+ * Optional parameters. You can override the default settings for this call,
799
+ * e.g, timeout, retries, paginations, etc. See {@link
800
+ * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions}
801
+ * for the details.
802
+ * @param {function(?Error, ?Object)=} callback
803
+ * The function which will be called with the result of the API call.
804
+ *
805
+ * The second parameter to the callback is an object representing
806
+ * {@link google.longrunning.Operation | google.longrunning.Operation}.
807
+ * @return {Promise} - The promise which resolves to an array.
808
+ * The first element of the array is an object representing
809
+ * {@link google.longrunning.Operation | google.longrunning.Operation}.
810
+ * The promise has a method named "cancel" which cancels the ongoing API call.
811
+ *
812
+ * @example
813
+ * ```
814
+ * const client = longrunning.operationsClient();
815
+ * const name = '';
816
+ * const [response] = await client.getOperation({name});
817
+ * // doThingsWith(response)
818
+ * ```
819
+ */
751
820
  getOperation(request, optionsOrCallback, callback) {
752
821
  let options;
753
822
  if (typeof optionsOrCallback === 'function' && callback === undefined) {
@@ -1008,7 +1077,7 @@ class ApiKeysClient {
1008
1077
  */
1009
1078
  close() {
1010
1079
  if (this.apiKeysStub && !this._terminated) {
1011
- return this.apiKeysStub.then(stub => {
1080
+ return this.apiKeysStub.then((stub) => {
1012
1081
  this._log.info('ending gRPC channel');
1013
1082
  this._terminated = true;
1014
1083
  stub.close();
@@ -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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google-cloud/apikeys",
3
- "version": "2.2.1",
3
+ "version": "3.0.0",
4
4
  "description": "API Keys API client for Node.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,38 +34,43 @@
34
34
  "compile": "tsc -p . && cp -r protos build/",
35
35
  "compile-protos": "compileProtos src",
36
36
  "docs": "jsdoc -c .jsdoc.js",
37
- "predocs-test": "npm run docs",
38
- "docs-test": "linkinator docs",
39
37
  "fix": "gts fix",
40
38
  "lint": "gts check",
41
39
  "prepare": "npm run compile",
42
40
  "prelint": "cd samples; npm link ../; npm i",
43
41
  "postpack": "minifyProtoJson",
44
42
  "samples-test": "cd samples/ && npm link ../ && npm i && npm test",
45
- "system-test": "c8 mocha build/system-test",
46
- "test": "c8 mocha build/test"
43
+ "system-test": "c8 mocha --config ../../.mocharc.cjs --no-parallel build/system-test",
44
+ "test": "c8 mocha --config ../../.mocharc.cjs build/test"
47
45
  },
48
46
  "dependencies": {
49
- "google-gax": "^5.0.0"
47
+ "google-gax": "^6.0.0"
50
48
  },
51
49
  "devDependencies": {
52
50
  "@types/mocha": "^10.0.10",
53
51
  "@types/node": "^22.13.9",
54
52
  "@types/sinon": "^17.0.4",
55
53
  "c8": "^10.1.3",
56
- "gapic-tools": "^1.0.0",
54
+ "gapic-tools": "^2.0.0",
57
55
  "gts": "^6.0.2",
58
56
  "jsdoc": "^4.0.4",
59
- "jsdoc-fresh": "^4.0.0",
60
- "jsdoc-region-tag": "^3.0.0",
61
- "linkinator": "^6.1.2",
57
+ "jsdoc-fresh": "^6.0.0",
58
+ "jsdoc-region-tag": "^5.0.0",
62
59
  "long": "^5.3.1",
63
60
  "mocha": "^11.1.0",
64
- "pack-n-play": "^3.0.0",
65
- "sinon": "^21.0.0",
61
+ "pack-n-play": "^5.0.0",
62
+ "sinon": "21.0.3",
66
63
  "typescript": "^5.8.2"
67
64
  },
68
65
  "engines": {
69
- "node": ">=18"
66
+ "node": ">=22"
67
+ },
68
+ "overrides": {
69
+ "@sinonjs/fake-timers": "15.2.1"
70
+ },
71
+ "pnpm": {
72
+ "overrides": {
73
+ "@sinonjs/fake-timers": "15.2.1"
74
+ }
70
75
  }
71
76
  }