@google-cloud/discoveryengine 2.1.0 → 2.3.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 (172) hide show
  1. package/README.md +13 -0
  2. package/build/protos/google/cloud/discoveryengine/v1/answer.proto +17 -0
  3. package/build/protos/google/cloud/discoveryengine/v1/chunk.proto +52 -0
  4. package/build/protos/google/cloud/discoveryengine/v1/cmek_config_service.proto +300 -0
  5. package/build/protos/google/cloud/discoveryengine/v1/common.proto +67 -0
  6. package/build/protos/google/cloud/discoveryengine/v1/control.proto +1 -3
  7. package/build/protos/google/cloud/discoveryengine/v1/conversational_search_service.proto +3 -0
  8. package/build/protos/google/cloud/discoveryengine/v1/data_store.proto +54 -2
  9. package/build/protos/google/cloud/discoveryengine/v1/data_store_service.proto +14 -0
  10. package/build/protos/google/cloud/discoveryengine/v1/document.proto +95 -4
  11. package/build/protos/google/cloud/discoveryengine/v1/document_processing_config.proto +28 -1
  12. package/build/protos/google/cloud/discoveryengine/v1/engine.proto +131 -6
  13. package/build/protos/google/cloud/discoveryengine/v1/grounded_generation_service.proto +8 -0
  14. package/build/protos/google/cloud/discoveryengine/v1/grounding.proto +9 -0
  15. package/build/protos/google/cloud/discoveryengine/v1/identity_mapping_store.proto +84 -0
  16. package/build/protos/google/cloud/discoveryengine/v1/identity_mapping_store_service.proto +375 -0
  17. package/build/protos/google/cloud/discoveryengine/v1/search_service.proto +6 -0
  18. package/build/protos/google/cloud/discoveryengine/v1/site_search_engine.proto +6 -0
  19. package/build/protos/google/cloud/discoveryengine/v1/user_license.proto +98 -0
  20. package/build/protos/google/cloud/discoveryengine/v1/user_license_service.proto +191 -0
  21. package/build/protos/protos.d.ts +5415 -578
  22. package/build/protos/protos.js +77830 -63391
  23. package/build/protos/protos.json +1537 -92
  24. package/build/src/index.d.ts +10 -1
  25. package/build/src/index.js +8 -22
  26. package/build/src/v1/cmek_config_service_client.d.ts +2287 -0
  27. package/build/src/v1/cmek_config_service_client.js +3274 -0
  28. package/build/src/v1/cmek_config_service_client_config.json +42 -0
  29. package/build/src/v1/cmek_config_service_proto_list.json +44 -0
  30. package/build/src/v1/completion_service_client.d.ts +166 -76
  31. package/build/src/v1/completion_service_client.js +258 -263
  32. package/build/src/v1/completion_service_proto_list.json +6 -1
  33. package/build/src/v1/control_service_client.d.ts +171 -81
  34. package/build/src/v1/control_service_client.js +246 -132
  35. package/build/src/v1/control_service_proto_list.json +6 -1
  36. package/build/src/v1/conversational_search_service_client.d.ts +233 -143
  37. package/build/src/v1/conversational_search_service_client.js +330 -226
  38. package/build/src/v1/conversational_search_service_proto_list.json +6 -1
  39. package/build/src/v1/data_store_service_client.d.ts +218 -122
  40. package/build/src/v1/data_store_service_client.js +273 -281
  41. package/build/src/v1/data_store_service_proto_list.json +6 -1
  42. package/build/src/v1/document_service_client.d.ts +210 -120
  43. package/build/src/v1/document_service_client.js +300 -301
  44. package/build/src/v1/document_service_proto_list.json +6 -1
  45. package/build/src/v1/engine_service_client.d.ts +193 -103
  46. package/build/src/v1/engine_service_client.js +273 -280
  47. package/build/src/v1/engine_service_proto_list.json +6 -1
  48. package/build/src/v1/gapic_metadata.json +184 -0
  49. package/build/src/v1/grounded_generation_service_client.d.ts +138 -48
  50. package/build/src/v1/grounded_generation_service_client.js +217 -100
  51. package/build/src/v1/grounded_generation_service_proto_list.json +6 -1
  52. package/build/src/v1/identity_mapping_store_service_client.d.ts +2470 -0
  53. package/build/src/v1/identity_mapping_store_service_client.js +3449 -0
  54. package/build/src/v1/identity_mapping_store_service_client_config.json +54 -0
  55. package/build/src/v1/identity_mapping_store_service_proto_list.json +44 -0
  56. package/build/src/v1/index.d.ts +3 -0
  57. package/build/src/v1/index.js +7 -1
  58. package/build/src/v1/project_service_client.d.ts +166 -76
  59. package/build/src/v1/project_service_client.js +235 -223
  60. package/build/src/v1/project_service_proto_list.json +6 -1
  61. package/build/src/v1/rank_service_client.d.ts +137 -47
  62. package/build/src/v1/rank_service_client.js +204 -85
  63. package/build/src/v1/rank_service_proto_list.json +6 -1
  64. package/build/src/v1/recommendation_service_client.d.ts +137 -47
  65. package/build/src/v1/recommendation_service_client.js +202 -82
  66. package/build/src/v1/recommendation_service_proto_list.json +6 -1
  67. package/build/src/v1/schema_service_client.d.ts +201 -111
  68. package/build/src/v1/schema_service_client.js +264 -274
  69. package/build/src/v1/schema_service_proto_list.json +6 -1
  70. package/build/src/v1/search_service_client.d.ts +661 -571
  71. package/build/src/v1/search_service_client.js +216 -113
  72. package/build/src/v1/search_service_proto_list.json +6 -1
  73. package/build/src/v1/search_tuning_service_client.d.ts +167 -77
  74. package/build/src/v1/search_tuning_service_client.js +246 -236
  75. package/build/src/v1/search_tuning_service_proto_list.json +6 -1
  76. package/build/src/v1/serving_config_service_client.d.ts +138 -48
  77. package/build/src/v1/serving_config_service_client.js +201 -80
  78. package/build/src/v1/serving_config_service_proto_list.json +6 -1
  79. package/build/src/v1/site_search_engine_service_client.d.ts +238 -148
  80. package/build/src/v1/site_search_engine_service_client.js +324 -379
  81. package/build/src/v1/site_search_engine_service_proto_list.json +6 -1
  82. package/build/src/v1/user_event_service_client.d.ts +167 -77
  83. package/build/src/v1/user_event_service_client.js +260 -254
  84. package/build/src/v1/user_event_service_proto_list.json +6 -1
  85. package/build/src/v1/user_license_service_client.d.ts +2256 -0
  86. package/build/src/v1/user_license_service_client.js +3194 -0
  87. package/build/src/v1/user_license_service_client_config.json +34 -0
  88. package/build/src/v1/user_license_service_proto_list.json +44 -0
  89. package/build/src/v1alpha/acl_config_service_client.d.ts +49 -49
  90. package/build/src/v1alpha/acl_config_service_client.js +94 -106
  91. package/build/src/v1alpha/chunk_service_client.d.ts +88 -88
  92. package/build/src/v1alpha/chunk_service_client.js +98 -120
  93. package/build/src/v1alpha/completion_service_client.d.ts +77 -77
  94. package/build/src/v1alpha/completion_service_client.js +141 -281
  95. package/build/src/v1alpha/control_service_client.d.ts +85 -85
  96. package/build/src/v1alpha/control_service_client.js +129 -151
  97. package/build/src/v1alpha/conversational_search_service_client.d.ts +143 -143
  98. package/build/src/v1alpha/conversational_search_service_client.js +211 -237
  99. package/build/src/v1alpha/data_store_service_client.d.ts +126 -126
  100. package/build/src/v1alpha/data_store_service_client.js +176 -317
  101. package/build/src/v1alpha/document_service_client.d.ts +126 -126
  102. package/build/src/v1alpha/document_service_client.js +193 -329
  103. package/build/src/v1alpha/engine_service_client.d.ts +106 -106
  104. package/build/src/v1alpha/engine_service_client.js +180 -326
  105. package/build/src/v1alpha/estimate_billing_service_client.d.ts +76 -76
  106. package/build/src/v1alpha/estimate_billing_service_client.js +119 -244
  107. package/build/src/v1alpha/evaluation_service_client.d.ts +161 -161
  108. package/build/src/v1alpha/evaluation_service_client.js +150 -296
  109. package/build/src/v1alpha/grounded_generation_service_client.d.ts +48 -48
  110. package/build/src/v1alpha/grounded_generation_service_client.js +85 -100
  111. package/build/src/v1alpha/project_service_client.d.ts +78 -78
  112. package/build/src/v1alpha/project_service_client.js +139 -263
  113. package/build/src/v1alpha/rank_service_client.d.ts +47 -47
  114. package/build/src/v1alpha/rank_service_client.js +87 -104
  115. package/build/src/v1alpha/recommendation_service_client.d.ts +47 -47
  116. package/build/src/v1alpha/recommendation_service_client.js +85 -100
  117. package/build/src/v1alpha/sample_query_service_client.d.ts +123 -123
  118. package/build/src/v1alpha/sample_query_service_client.js +169 -302
  119. package/build/src/v1alpha/sample_query_set_service_client.d.ts +94 -94
  120. package/build/src/v1alpha/sample_query_set_service_client.js +130 -153
  121. package/build/src/v1alpha/schema_service_client.d.ts +112 -112
  122. package/build/src/v1alpha/schema_service_client.js +147 -293
  123. package/build/src/v1alpha/search_service_client.d.ts +327 -327
  124. package/build/src/v1alpha/search_service_client.js +88 -112
  125. package/build/src/v1alpha/search_tuning_service_client.d.ts +77 -77
  126. package/build/src/v1alpha/search_tuning_service_client.js +129 -254
  127. package/build/src/v1alpha/serving_config_service_client.d.ts +75 -75
  128. package/build/src/v1alpha/serving_config_service_client.js +109 -133
  129. package/build/src/v1alpha/site_search_engine_service_client.d.ts +151 -151
  130. package/build/src/v1alpha/site_search_engine_service_client.js +203 -388
  131. package/build/src/v1alpha/user_event_service_client.d.ts +78 -78
  132. package/build/src/v1alpha/user_event_service_client.js +143 -272
  133. package/build/src/v1beta/completion_service_client.d.ts +78 -78
  134. package/build/src/v1beta/completion_service_client.js +149 -280
  135. package/build/src/v1beta/control_service_client.d.ts +84 -84
  136. package/build/src/v1beta/control_service_client.js +127 -147
  137. package/build/src/v1beta/conversational_search_service_client.d.ts +142 -142
  138. package/build/src/v1beta/conversational_search_service_client.js +209 -233
  139. package/build/src/v1beta/data_store_service_client.d.ts +124 -124
  140. package/build/src/v1beta/data_store_service_client.js +154 -289
  141. package/build/src/v1beta/document_service_client.d.ts +124 -124
  142. package/build/src/v1beta/document_service_client.js +181 -310
  143. package/build/src/v1beta/engine_service_client.d.ts +106 -106
  144. package/build/src/v1beta/engine_service_client.js +178 -316
  145. package/build/src/v1beta/evaluation_service_client.d.ts +161 -161
  146. package/build/src/v1beta/evaluation_service_client.js +148 -286
  147. package/build/src/v1beta/grounded_generation_service_client.d.ts +49 -49
  148. package/build/src/v1beta/grounded_generation_service_client.js +98 -114
  149. package/build/src/v1beta/project_service_client.d.ts +76 -76
  150. package/build/src/v1beta/project_service_client.js +116 -232
  151. package/build/src/v1beta/rank_service_client.d.ts +47 -47
  152. package/build/src/v1beta/rank_service_client.js +85 -99
  153. package/build/src/v1beta/recommendation_service_client.d.ts +47 -47
  154. package/build/src/v1beta/recommendation_service_client.js +83 -96
  155. package/build/src/v1beta/sample_query_service_client.d.ts +123 -123
  156. package/build/src/v1beta/sample_query_service_client.js +167 -292
  157. package/build/src/v1beta/sample_query_set_service_client.d.ts +94 -94
  158. package/build/src/v1beta/sample_query_set_service_client.js +128 -149
  159. package/build/src/v1beta/schema_service_client.d.ts +111 -111
  160. package/build/src/v1beta/schema_service_client.js +145 -283
  161. package/build/src/v1beta/search_service_client.d.ts +665 -665
  162. package/build/src/v1beta/search_service_client.js +97 -128
  163. package/build/src/v1beta/search_tuning_service_client.d.ts +77 -77
  164. package/build/src/v1beta/search_tuning_service_client.js +127 -244
  165. package/build/src/v1beta/serving_config_service_client.d.ts +75 -75
  166. package/build/src/v1beta/serving_config_service_client.js +107 -129
  167. package/build/src/v1beta/site_search_engine_service_client.d.ts +151 -151
  168. package/build/src/v1beta/site_search_engine_service_client.js +205 -387
  169. package/build/src/v1beta/user_event_service_client.d.ts +78 -78
  170. package/build/src/v1beta/user_event_service_client.js +141 -262
  171. package/package.json +7 -7
  172. package/CHANGELOG.md +0 -267
@@ -100,26 +100,17 @@ class ControlServiceClient {
100
100
  constructor(opts, gaxInstance) {
101
101
  // Ensure that options include all the required fields.
102
102
  const staticMembers = this.constructor;
103
- if (opts?.universe_domain &&
104
- opts?.universeDomain &&
105
- opts?.universe_domain !== opts?.universeDomain) {
103
+ if (opts?.universe_domain && opts?.universeDomain && opts?.universe_domain !== opts?.universeDomain) {
106
104
  throw new Error('Please set either universe_domain or universeDomain, but not both.');
107
105
  }
108
- const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object'
109
- ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN']
110
- : undefined;
111
- this._universeDomain =
112
- opts?.universeDomain ??
113
- opts?.universe_domain ??
114
- universeDomainEnvVar ??
115
- 'googleapis.com';
106
+ const universeDomainEnvVar = (typeof process === 'object' && typeof process.env === 'object') ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] : undefined;
107
+ this._universeDomain = opts?.universeDomain ?? opts?.universe_domain ?? universeDomainEnvVar ?? 'googleapis.com';
116
108
  this._servicePath = 'discoveryengine.' + this._universeDomain;
117
109
  const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
118
110
  this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
119
111
  const port = opts?.port || staticMembers.port;
120
112
  const clientConfig = opts?.clientConfig ?? {};
121
- const fallback = opts?.fallback ??
122
- (typeof window !== 'undefined' && typeof window?.fetch === 'function');
113
+ const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function');
123
114
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
124
115
  // Request numeric enum values if REST transport is used.
125
116
  opts.numericEnums = true;
@@ -149,7 +140,10 @@ class ControlServiceClient {
149
140
  }
150
141
  this.locationsClient = new this._gaxModule.LocationsClient(this._gaxGrpc, opts);
151
142
  // Determine the client header string.
152
- const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
143
+ const clientHeader = [
144
+ `gax/${this._gaxModule.version}`,
145
+ `gapic/${version}`,
146
+ ];
153
147
  if (typeof process === 'object' && 'versions' in process) {
154
148
  clientHeader.push(`gl-node/${process.versions.node}`);
155
149
  }
@@ -214,7 +208,7 @@ class ControlServiceClient {
214
208
  // (e.g. 50 results at a time, with tokens to get subsequent
215
209
  // pages). Denote the keys used for pagination and results.
216
210
  this.descriptors.page = {
217
- listControls: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'controls'),
211
+ listControls: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'controls')
218
212
  };
219
213
  // Put together the default options sent with requests.
220
214
  this._defaults = this._gaxGrpc.constructSettings('google.cloud.discoveryengine.v1alpha.ControlService', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
@@ -243,20 +237,13 @@ class ControlServiceClient {
243
237
  }
244
238
  // Put together the "service stub" for
245
239
  // google.cloud.discoveryengine.v1alpha.ControlService.
246
- this.controlServiceStub = this._gaxGrpc.createStub(this._opts.fallback
247
- ? this._protos.lookupService('google.cloud.discoveryengine.v1alpha.ControlService')
248
- : // eslint-disable-next-line @typescript-eslint/no-explicit-any
249
- this._protos.google.cloud.discoveryengine.v1alpha
250
- .ControlService, this._opts, this._providedCustomServicePath);
240
+ this.controlServiceStub = this._gaxGrpc.createStub(this._opts.fallback ?
241
+ this._protos.lookupService('google.cloud.discoveryengine.v1alpha.ControlService') :
242
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
243
+ this._protos.google.cloud.discoveryengine.v1alpha.ControlService, this._opts, this._providedCustomServicePath);
251
244
  // Iterate over each of the methods that the service provides
252
245
  // and create an API call method for each.
253
- const controlServiceStubMethods = [
254
- 'createControl',
255
- 'deleteControl',
256
- 'updateControl',
257
- 'getControl',
258
- 'listControls',
259
- ];
246
+ const controlServiceStubMethods = ['createControl', 'deleteControl', 'updateControl', 'getControl', 'listControls'];
260
247
  for (const methodName of controlServiceStubMethods) {
261
248
  const callPromise = this.controlServiceStub.then(stub => (...args) => {
262
249
  if (this._terminated) {
@@ -267,7 +254,8 @@ class ControlServiceClient {
267
254
  }, (err) => () => {
268
255
  throw err;
269
256
  });
270
- const descriptor = this.descriptors.page[methodName] || undefined;
257
+ const descriptor = this.descriptors.page[methodName] ||
258
+ undefined;
271
259
  const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor, this._opts.fallback);
272
260
  this.innerApiCalls[methodName] = apiCall;
273
261
  }
@@ -279,8 +267,7 @@ class ControlServiceClient {
279
267
  * @returns {string} The DNS address for this service.
280
268
  */
281
269
  static get servicePath() {
282
- if (typeof process === 'object' &&
283
- typeof process.emitWarning === 'function') {
270
+ if (typeof process === 'object' && typeof process.emitWarning === 'function') {
284
271
  process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
285
272
  }
286
273
  return 'discoveryengine.googleapis.com';
@@ -291,8 +278,7 @@ class ControlServiceClient {
291
278
  * @returns {string} The DNS address for this service.
292
279
  */
293
280
  static get apiEndpoint() {
294
- if (typeof process === 'object' &&
295
- typeof process.emitWarning === 'function') {
281
+ if (typeof process === 'object' && typeof process.emitWarning === 'function') {
296
282
  process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
297
283
  }
298
284
  return 'discoveryengine.googleapis.com';
@@ -320,7 +306,9 @@ class ControlServiceClient {
320
306
  * @returns {string[]} List of default scopes.
321
307
  */
322
308
  static get scopes() {
323
- return ['https://www.googleapis.com/auth/cloud-platform'];
309
+ return [
310
+ 'https://www.googleapis.com/auth/cloud-platform'
311
+ ];
324
312
  }
325
313
  /**
326
314
  * Return the project ID used by this class.
@@ -346,13 +334,10 @@ class ControlServiceClient {
346
334
  options = options || {};
347
335
  options.otherArgs = options.otherArgs || {};
348
336
  options.otherArgs.headers = options.otherArgs.headers || {};
349
- options.otherArgs.headers['x-goog-request-params'] =
350
- this._gaxModule.routingHeader.fromParams({
351
- parent: request.parent ?? '',
352
- });
353
- this.initialize().catch(err => {
354
- throw err;
337
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
338
+ 'parent': request.parent ?? '',
355
339
  });
340
+ this.initialize().catch(err => { throw err; });
356
341
  this._log.info('createControl request %j', request);
357
342
  const wrappedCallback = callback
358
343
  ? (error, response, options, rawResponse) => {
@@ -360,11 +345,16 @@ class ControlServiceClient {
360
345
  callback(error, response, options, rawResponse); // We verified callback above.
361
346
  }
362
347
  : undefined;
363
- return this.innerApiCalls
364
- .createControl(request, options, wrappedCallback)
348
+ return this.innerApiCalls.createControl(request, options, wrappedCallback)
365
349
  ?.then(([response, options, rawResponse]) => {
366
350
  this._log.info('createControl response %j', response);
367
351
  return [response, options, rawResponse];
352
+ }).catch((error) => {
353
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
354
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
355
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
356
+ }
357
+ throw error;
368
358
  });
369
359
  }
370
360
  deleteControl(request, optionsOrCallback, callback) {
@@ -380,13 +370,10 @@ class ControlServiceClient {
380
370
  options = options || {};
381
371
  options.otherArgs = options.otherArgs || {};
382
372
  options.otherArgs.headers = options.otherArgs.headers || {};
383
- options.otherArgs.headers['x-goog-request-params'] =
384
- this._gaxModule.routingHeader.fromParams({
385
- name: request.name ?? '',
386
- });
387
- this.initialize().catch(err => {
388
- throw err;
373
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
374
+ 'name': request.name ?? '',
389
375
  });
376
+ this.initialize().catch(err => { throw err; });
390
377
  this._log.info('deleteControl request %j', request);
391
378
  const wrappedCallback = callback
392
379
  ? (error, response, options, rawResponse) => {
@@ -394,11 +381,16 @@ class ControlServiceClient {
394
381
  callback(error, response, options, rawResponse); // We verified callback above.
395
382
  }
396
383
  : undefined;
397
- return this.innerApiCalls
398
- .deleteControl(request, options, wrappedCallback)
384
+ return this.innerApiCalls.deleteControl(request, options, wrappedCallback)
399
385
  ?.then(([response, options, rawResponse]) => {
400
386
  this._log.info('deleteControl response %j', response);
401
387
  return [response, options, rawResponse];
388
+ }).catch((error) => {
389
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
390
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
391
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
392
+ }
393
+ throw error;
402
394
  });
403
395
  }
404
396
  updateControl(request, optionsOrCallback, callback) {
@@ -414,13 +406,10 @@ class ControlServiceClient {
414
406
  options = options || {};
415
407
  options.otherArgs = options.otherArgs || {};
416
408
  options.otherArgs.headers = options.otherArgs.headers || {};
417
- options.otherArgs.headers['x-goog-request-params'] =
418
- this._gaxModule.routingHeader.fromParams({
419
- 'control.name': request.control.name ?? '',
420
- });
421
- this.initialize().catch(err => {
422
- throw err;
409
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
410
+ 'control.name': request.control.name ?? '',
423
411
  });
412
+ this.initialize().catch(err => { throw err; });
424
413
  this._log.info('updateControl request %j', request);
425
414
  const wrappedCallback = callback
426
415
  ? (error, response, options, rawResponse) => {
@@ -428,11 +417,16 @@ class ControlServiceClient {
428
417
  callback(error, response, options, rawResponse); // We verified callback above.
429
418
  }
430
419
  : undefined;
431
- return this.innerApiCalls
432
- .updateControl(request, options, wrappedCallback)
420
+ return this.innerApiCalls.updateControl(request, options, wrappedCallback)
433
421
  ?.then(([response, options, rawResponse]) => {
434
422
  this._log.info('updateControl response %j', response);
435
423
  return [response, options, rawResponse];
424
+ }).catch((error) => {
425
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
426
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
427
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
428
+ }
429
+ throw error;
436
430
  });
437
431
  }
438
432
  getControl(request, optionsOrCallback, callback) {
@@ -448,13 +442,10 @@ class ControlServiceClient {
448
442
  options = options || {};
449
443
  options.otherArgs = options.otherArgs || {};
450
444
  options.otherArgs.headers = options.otherArgs.headers || {};
451
- options.otherArgs.headers['x-goog-request-params'] =
452
- this._gaxModule.routingHeader.fromParams({
453
- name: request.name ?? '',
454
- });
455
- this.initialize().catch(err => {
456
- throw err;
445
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
446
+ 'name': request.name ?? '',
457
447
  });
448
+ this.initialize().catch(err => { throw err; });
458
449
  this._log.info('getControl request %j', request);
459
450
  const wrappedCallback = callback
460
451
  ? (error, response, options, rawResponse) => {
@@ -462,11 +453,16 @@ class ControlServiceClient {
462
453
  callback(error, response, options, rawResponse); // We verified callback above.
463
454
  }
464
455
  : undefined;
465
- return this.innerApiCalls
466
- .getControl(request, options, wrappedCallback)
456
+ return this.innerApiCalls.getControl(request, options, wrappedCallback)
467
457
  ?.then(([response, options, rawResponse]) => {
468
458
  this._log.info('getControl response %j', response);
469
459
  return [response, options, rawResponse];
460
+ }).catch((error) => {
461
+ if (error && 'statusDetails' in error && error.statusDetails instanceof Array) {
462
+ const protos = this._gaxModule.protobuf.Root.fromJSON(jsonProtos);
463
+ error.statusDetails = (0, google_gax_1.decodeAnyProtosInArray)(error.statusDetails, protos);
464
+ }
465
+ throw error;
470
466
  });
471
467
  }
472
468
  listControls(request, optionsOrCallback, callback) {
@@ -482,13 +478,10 @@ class ControlServiceClient {
482
478
  options = options || {};
483
479
  options.otherArgs = options.otherArgs || {};
484
480
  options.otherArgs.headers = options.otherArgs.headers || {};
485
- options.otherArgs.headers['x-goog-request-params'] =
486
- this._gaxModule.routingHeader.fromParams({
487
- parent: request.parent ?? '',
488
- });
489
- this.initialize().catch(err => {
490
- throw err;
481
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
482
+ 'parent': request.parent ?? '',
491
483
  });
484
+ this.initialize().catch(err => { throw err; });
492
485
  const wrappedCallback = callback
493
486
  ? (error, values, nextPageRequest, rawResponse) => {
494
487
  this._log.info('listControls values %j', values);
@@ -540,15 +533,12 @@ class ControlServiceClient {
540
533
  options = options || {};
541
534
  options.otherArgs = options.otherArgs || {};
542
535
  options.otherArgs.headers = options.otherArgs.headers || {};
543
- options.otherArgs.headers['x-goog-request-params'] =
544
- this._gaxModule.routingHeader.fromParams({
545
- parent: request.parent ?? '',
546
- });
536
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
537
+ 'parent': request.parent ?? '',
538
+ });
547
539
  const defaultCallSettings = this._defaults['listControls'];
548
540
  const callSettings = defaultCallSettings.merge(options);
549
- this.initialize().catch(err => {
550
- throw err;
551
- });
541
+ this.initialize().catch(err => { throw err; });
552
542
  this._log.info('listControls stream %j', request);
553
543
  return this.descriptors.page.listControls.createStream(this.innerApiCalls.listControls, request, callSettings);
554
544
  }
@@ -592,70 +582,67 @@ class ControlServiceClient {
592
582
  options = options || {};
593
583
  options.otherArgs = options.otherArgs || {};
594
584
  options.otherArgs.headers = options.otherArgs.headers || {};
595
- options.otherArgs.headers['x-goog-request-params'] =
596
- this._gaxModule.routingHeader.fromParams({
597
- parent: request.parent ?? '',
598
- });
585
+ options.otherArgs.headers['x-goog-request-params'] = this._gaxModule.routingHeader.fromParams({
586
+ 'parent': request.parent ?? '',
587
+ });
599
588
  const defaultCallSettings = this._defaults['listControls'];
600
589
  const callSettings = defaultCallSettings.merge(options);
601
- this.initialize().catch(err => {
602
- throw err;
603
- });
590
+ this.initialize().catch(err => { throw err; });
604
591
  this._log.info('listControls iterate %j', request);
605
592
  return this.descriptors.page.listControls.asyncIterate(this.innerApiCalls['listControls'], request, callSettings);
606
593
  }
607
594
  /**
608
- * Gets information about a location.
609
- *
610
- * @param {Object} request
611
- * The request object that will be sent.
612
- * @param {string} request.name
613
- * Resource name for the location.
614
- * @param {object} [options]
615
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details.
616
- * @returns {Promise} - The promise which resolves to an array.
617
- * The first element of the array is an object representing {@link google.cloud.location.Location | Location}.
618
- * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
619
- * for more details and examples.
620
- * @example
621
- * ```
622
- * const [response] = await client.getLocation(request);
623
- * ```
624
- */
595
+ * Gets information about a location.
596
+ *
597
+ * @param {Object} request
598
+ * The request object that will be sent.
599
+ * @param {string} request.name
600
+ * Resource name for the location.
601
+ * @param {object} [options]
602
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details.
603
+ * @returns {Promise} - The promise which resolves to an array.
604
+ * The first element of the array is an object representing {@link google.cloud.location.Location | Location}.
605
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods | documentation }
606
+ * for more details and examples.
607
+ * @example
608
+ * ```
609
+ * const [response] = await client.getLocation(request);
610
+ * ```
611
+ */
625
612
  getLocation(request, options, callback) {
626
613
  return this.locationsClient.getLocation(request, options, callback);
627
614
  }
628
615
  /**
629
- * Lists information about the supported locations for this service. Returns an iterable object.
630
- *
631
- * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
632
- * @param {Object} request
633
- * The request object that will be sent.
634
- * @param {string} request.name
635
- * The resource that owns the locations collection, if applicable.
636
- * @param {string} request.filter
637
- * The standard list filter.
638
- * @param {number} request.pageSize
639
- * The standard list page size.
640
- * @param {string} request.pageToken
641
- * The standard list page token.
642
- * @param {object} [options]
643
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
644
- * @returns {Object}
645
- * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
646
- * When you iterate the returned iterable, each element will be an object representing
647
- * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page,
648
- * so you can stop the iteration when you don't need more results.
649
- * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
650
- * for more details and examples.
651
- * @example
652
- * ```
653
- * const iterable = client.listLocationsAsync(request);
654
- * for await (const response of iterable) {
655
- * // process response
656
- * }
657
- * ```
658
- */
616
+ * Lists information about the supported locations for this service. Returns an iterable object.
617
+ *
618
+ * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
619
+ * @param {Object} request
620
+ * The request object that will be sent.
621
+ * @param {string} request.name
622
+ * The resource that owns the locations collection, if applicable.
623
+ * @param {string} request.filter
624
+ * The standard list filter.
625
+ * @param {number} request.pageSize
626
+ * The standard list page size.
627
+ * @param {string} request.pageToken
628
+ * The standard list page token.
629
+ * @param {object} [options]
630
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
631
+ * @returns {Object}
632
+ * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }.
633
+ * When you iterate the returned iterable, each element will be an object representing
634
+ * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page,
635
+ * so you can stop the iteration when you don't need more results.
636
+ * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation }
637
+ * for more details and examples.
638
+ * @example
639
+ * ```
640
+ * const iterable = client.listLocationsAsync(request);
641
+ * for await (const response of iterable) {
642
+ * // process response
643
+ * }
644
+ * ```
645
+ */
659
646
  listLocationsAsync(request, options) {
660
647
  return this.locationsClient.listLocationsAsync(request, options);
661
648
  }
@@ -683,8 +670,7 @@ class ControlServiceClient {
683
670
  * @returns {string} A string representing the project.
684
671
  */
685
672
  matchProjectFromAclConfigName(aclConfigName) {
686
- return this.pathTemplates.aclConfigPathTemplate.match(aclConfigName)
687
- .project;
673
+ return this.pathTemplates.aclConfigPathTemplate.match(aclConfigName).project;
688
674
  }
689
675
  /**
690
676
  * Parse the location from AclConfig resource.
@@ -694,8 +680,7 @@ class ControlServiceClient {
694
680
  * @returns {string} A string representing the location.
695
681
  */
696
682
  matchLocationFromAclConfigName(aclConfigName) {
697
- return this.pathTemplates.aclConfigPathTemplate.match(aclConfigName)
698
- .location;
683
+ return this.pathTemplates.aclConfigPathTemplate.match(aclConfigName).location;
699
684
  }
700
685
  /**
701
686
  * Return a fully-qualified engine resource name string.
@@ -777,8 +762,7 @@ class ControlServiceClient {
777
762
  * @returns {string} A string representing the project.
778
763
  */
779
764
  matchProjectFromEvaluationName(evaluationName) {
780
- return this.pathTemplates.evaluationPathTemplate.match(evaluationName)
781
- .project;
765
+ return this.pathTemplates.evaluationPathTemplate.match(evaluationName).project;
782
766
  }
783
767
  /**
784
768
  * Parse the location from Evaluation resource.
@@ -788,8 +772,7 @@ class ControlServiceClient {
788
772
  * @returns {string} A string representing the location.
789
773
  */
790
774
  matchLocationFromEvaluationName(evaluationName) {
791
- return this.pathTemplates.evaluationPathTemplate.match(evaluationName)
792
- .location;
775
+ return this.pathTemplates.evaluationPathTemplate.match(evaluationName).location;
793
776
  }
794
777
  /**
795
778
  * Parse the evaluation from Evaluation resource.
@@ -799,8 +782,7 @@ class ControlServiceClient {
799
782
  * @returns {string} A string representing the evaluation.
800
783
  */
801
784
  matchEvaluationFromEvaluationName(evaluationName) {
802
- return this.pathTemplates.evaluationPathTemplate.match(evaluationName)
803
- .evaluation;
785
+ return this.pathTemplates.evaluationPathTemplate.match(evaluationName).evaluation;
804
786
  }
805
787
  /**
806
788
  * Return a fully-qualified location resource name string.
@@ -2900,8 +2882,7 @@ class ControlServiceClient {
2900
2882
  * @returns {string} A string representing the project.
2901
2883
  */
2902
2884
  matchProjectFromSampleQueryName(sampleQueryName) {
2903
- return this.pathTemplates.sampleQueryPathTemplate.match(sampleQueryName)
2904
- .project;
2885
+ return this.pathTemplates.sampleQueryPathTemplate.match(sampleQueryName).project;
2905
2886
  }
2906
2887
  /**
2907
2888
  * Parse the location from SampleQuery resource.
@@ -2911,8 +2892,7 @@ class ControlServiceClient {
2911
2892
  * @returns {string} A string representing the location.
2912
2893
  */
2913
2894
  matchLocationFromSampleQueryName(sampleQueryName) {
2914
- return this.pathTemplates.sampleQueryPathTemplate.match(sampleQueryName)
2915
- .location;
2895
+ return this.pathTemplates.sampleQueryPathTemplate.match(sampleQueryName).location;
2916
2896
  }
2917
2897
  /**
2918
2898
  * Parse the sample_query_set from SampleQuery resource.
@@ -2922,8 +2902,7 @@ class ControlServiceClient {
2922
2902
  * @returns {string} A string representing the sample_query_set.
2923
2903
  */
2924
2904
  matchSampleQuerySetFromSampleQueryName(sampleQueryName) {
2925
- return this.pathTemplates.sampleQueryPathTemplate.match(sampleQueryName)
2926
- .sample_query_set;
2905
+ return this.pathTemplates.sampleQueryPathTemplate.match(sampleQueryName).sample_query_set;
2927
2906
  }
2928
2907
  /**
2929
2908
  * Parse the sample_query from SampleQuery resource.
@@ -2933,8 +2912,7 @@ class ControlServiceClient {
2933
2912
  * @returns {string} A string representing the sample_query.
2934
2913
  */
2935
2914
  matchSampleQueryFromSampleQueryName(sampleQueryName) {
2936
- return this.pathTemplates.sampleQueryPathTemplate.match(sampleQueryName)
2937
- .sample_query;
2915
+ return this.pathTemplates.sampleQueryPathTemplate.match(sampleQueryName).sample_query;
2938
2916
  }
2939
2917
  /**
2940
2918
  * Return a fully-qualified sampleQuerySet resource name string.
@@ -2993,7 +2971,7 @@ class ControlServiceClient {
2993
2971
  this._log.info('ending gRPC channel');
2994
2972
  this._terminated = true;
2995
2973
  stub.close();
2996
- this.locationsClient.close();
2974
+ this.locationsClient.close().catch(err => { throw err; });
2997
2975
  });
2998
2976
  }
2999
2977
  return Promise.resolve();