@google-cloud/discoveryengine 0.5.0 → 0.6.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.
@@ -319,6 +319,69 @@ export declare class DocumentServiceClient {
319
319
  * region_tag:discoveryengine_v1beta_generated_DocumentService_ImportDocuments_async
320
320
  */
321
321
  checkImportDocumentsProgress(name: string): Promise<LROperation<protos.google.cloud.discoveryengine.v1beta.ImportDocumentsResponse, protos.google.cloud.discoveryengine.v1beta.ImportDocumentsMetadata>>;
322
+ /**
323
+ * Permanently deletes all selected
324
+ * {@link google.cloud.discoveryengine.v1beta.Document|Document}s in a branch.
325
+ *
326
+ * This process is asynchronous. Depending on the number of
327
+ * {@link google.cloud.discoveryengine.v1beta.Document|Document}s to be deleted,
328
+ * this operation can take hours to complete. Before the delete operation
329
+ * completes, some {@link google.cloud.discoveryengine.v1beta.Document|Document}s
330
+ * might still be returned by
331
+ * {@link google.cloud.discoveryengine.v1beta.DocumentService.GetDocument|DocumentService.GetDocument}
332
+ * or
333
+ * {@link google.cloud.discoveryengine.v1beta.DocumentService.ListDocuments|DocumentService.ListDocuments}.
334
+ *
335
+ * To get a list of the
336
+ * {@link google.cloud.discoveryengine.v1beta.Document|Document}s to be deleted,
337
+ * set
338
+ * {@link google.cloud.discoveryengine.v1beta.PurgeDocumentsRequest.force|PurgeDocumentsRequest.force}
339
+ * to false.
340
+ *
341
+ * @param {Object} request
342
+ * The request object that will be sent.
343
+ * @param {string} request.parent
344
+ * Required. The parent resource name, such as
345
+ * `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}`.
346
+ * @param {string} request.filter
347
+ * Required. Filter matching documents to purge. Only currently supported
348
+ * value is
349
+ * `*` (all items).
350
+ * @param {boolean} request.force
351
+ * Actually performs the purge. If `force` is set to false, return the
352
+ * expected purge count without deleting any documents.
353
+ * @param {object} [options]
354
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
355
+ * @returns {Promise} - The promise which resolves to an array.
356
+ * The first element of the array is an object representing
357
+ * a long running operation. Its `promise()` method returns a promise
358
+ * you can `await` for.
359
+ * Please see the
360
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
361
+ * for more details and examples.
362
+ * @example <caption>include:samples/generated/v1beta/document_service.purge_documents.js</caption>
363
+ * region_tag:discoveryengine_v1beta_generated_DocumentService_PurgeDocuments_async
364
+ */
365
+ purgeDocuments(request?: protos.google.cloud.discoveryengine.v1beta.IPurgeDocumentsRequest, options?: CallOptions): Promise<[
366
+ LROperation<protos.google.cloud.discoveryengine.v1beta.IPurgeDocumentsResponse, protos.google.cloud.discoveryengine.v1beta.IPurgeDocumentsMetadata>,
367
+ protos.google.longrunning.IOperation | undefined,
368
+ {} | undefined
369
+ ]>;
370
+ purgeDocuments(request: protos.google.cloud.discoveryengine.v1beta.IPurgeDocumentsRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.discoveryengine.v1beta.IPurgeDocumentsResponse, protos.google.cloud.discoveryengine.v1beta.IPurgeDocumentsMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
371
+ purgeDocuments(request: protos.google.cloud.discoveryengine.v1beta.IPurgeDocumentsRequest, callback: Callback<LROperation<protos.google.cloud.discoveryengine.v1beta.IPurgeDocumentsResponse, protos.google.cloud.discoveryengine.v1beta.IPurgeDocumentsMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
372
+ /**
373
+ * Check the status of the long running operation returned by `purgeDocuments()`.
374
+ * @param {String} name
375
+ * The operation name that will be passed.
376
+ * @returns {Promise} - The promise which resolves to an object.
377
+ * The decoded operation object has result and metadata field to get information from.
378
+ * Please see the
379
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
380
+ * for more details and examples.
381
+ * @example <caption>include:samples/generated/v1beta/document_service.purge_documents.js</caption>
382
+ * region_tag:discoveryengine_v1beta_generated_DocumentService_PurgeDocuments_async
383
+ */
384
+ checkPurgeDocumentsProgress(name: string): Promise<LROperation<protos.google.cloud.discoveryengine.v1beta.PurgeDocumentsResponse, protos.google.cloud.discoveryengine.v1beta.PurgeDocumentsMetadata>>;
322
385
  /**
323
386
  * Gets a list of {@link google.cloud.discoveryengine.v1beta.Document|Document}s.
324
387
  *
@@ -223,8 +223,11 @@ class DocumentServiceClient {
223
223
  .operationsClient(opts);
224
224
  const importDocumentsResponse = protoFilesRoot.lookup('.google.cloud.discoveryengine.v1beta.ImportDocumentsResponse');
225
225
  const importDocumentsMetadata = protoFilesRoot.lookup('.google.cloud.discoveryengine.v1beta.ImportDocumentsMetadata');
226
+ const purgeDocumentsResponse = protoFilesRoot.lookup('.google.cloud.discoveryengine.v1beta.PurgeDocumentsResponse');
227
+ const purgeDocumentsMetadata = protoFilesRoot.lookup('.google.cloud.discoveryengine.v1beta.PurgeDocumentsMetadata');
226
228
  this.descriptors.longrunning = {
227
229
  importDocuments: new this._gaxModule.LongrunningDescriptor(this.operationsClient, importDocumentsResponse.decode.bind(importDocumentsResponse), importDocumentsMetadata.decode.bind(importDocumentsMetadata)),
230
+ purgeDocuments: new this._gaxModule.LongrunningDescriptor(this.operationsClient, purgeDocumentsResponse.decode.bind(purgeDocumentsResponse), purgeDocumentsMetadata.decode.bind(purgeDocumentsMetadata)),
228
231
  };
229
232
  // Put together the default options sent with requests.
230
233
  this._defaults = this._gaxGrpc.constructSettings('google.cloud.discoveryengine.v1beta.DocumentService', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') });
@@ -267,6 +270,7 @@ class DocumentServiceClient {
267
270
  'updateDocument',
268
271
  'deleteDocument',
269
272
  'importDocuments',
273
+ 'purgeDocuments',
270
274
  ];
271
275
  for (const methodName of documentServiceStubMethods) {
272
276
  const callPromise = this.documentServiceStub.then(stub => (...args) => {
@@ -450,6 +454,45 @@ class DocumentServiceClient {
450
454
  const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.importDocuments, this._gaxModule.createDefaultBackoffSettings());
451
455
  return decodeOperation;
452
456
  }
457
+ purgeDocuments(request, optionsOrCallback, callback) {
458
+ var _a;
459
+ request = request || {};
460
+ let options;
461
+ if (typeof optionsOrCallback === 'function' && callback === undefined) {
462
+ callback = optionsOrCallback;
463
+ options = {};
464
+ }
465
+ else {
466
+ options = optionsOrCallback;
467
+ }
468
+ options = options || {};
469
+ options.otherArgs = options.otherArgs || {};
470
+ options.otherArgs.headers = options.otherArgs.headers || {};
471
+ options.otherArgs.headers['x-goog-request-params'] =
472
+ this._gaxModule.routingHeader.fromParams({
473
+ parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '',
474
+ });
475
+ this.initialize();
476
+ return this.innerApiCalls.purgeDocuments(request, options, callback);
477
+ }
478
+ /**
479
+ * Check the status of the long running operation returned by `purgeDocuments()`.
480
+ * @param {String} name
481
+ * The operation name that will be passed.
482
+ * @returns {Promise} - The promise which resolves to an object.
483
+ * The decoded operation object has result and metadata field to get information from.
484
+ * Please see the
485
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
486
+ * for more details and examples.
487
+ * @example <caption>include:samples/generated/v1beta/document_service.purge_documents.js</caption>
488
+ * region_tag:discoveryengine_v1beta_generated_DocumentService_PurgeDocuments_async
489
+ */
490
+ async checkPurgeDocumentsProgress(name) {
491
+ const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name });
492
+ const [operation] = await this.operationsClient.getOperation(request);
493
+ const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.purgeDocuments, this._gaxModule.createDefaultBackoffSettings());
494
+ return decodeOperation;
495
+ }
453
496
  listDocuments(request, optionsOrCallback, callback) {
454
497
  var _a;
455
498
  request = request || {};
@@ -70,6 +70,11 @@
70
70
  "timeout_millis": 300000,
71
71
  "retry_codes_name": "unavailable",
72
72
  "retry_params_name": "e6a9f61a856ca7c2128ab9550ca4fb9e97c77876"
73
+ },
74
+ "PurgeDocuments": {
75
+ "timeout_millis": 30000,
76
+ "retry_codes_name": "unavailable",
77
+ "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f"
73
78
  }
74
79
  }
75
80
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google-cloud/discoveryengine",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Discovery Engine API client for Node.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -31,7 +31,7 @@
31
31
  ],
32
32
  "scripts": {
33
33
  "clean": "gts clean",
34
- "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson",
34
+ "compile": "tsc -p . && cp -r protos build/",
35
35
  "compile-protos": "compileProtos src",
36
36
  "docs": "jsdoc -c .jsdoc.js",
37
37
  "predocs-test": "npm run docs",
@@ -39,10 +39,11 @@
39
39
  "fix": "gts fix",
40
40
  "lint": "gts check",
41
41
  "prepare": "npm run compile-protos && npm run compile",
42
- "system-test": "npm run compile && c8 mocha build/system-test",
43
- "test": "c8 mocha build/test",
44
- "samples-test": "npm run compile && cd samples/ && npm link ../ && npm i && npm test",
45
- "prelint": "cd samples; npm link ../; npm i"
42
+ "prelint": "cd samples; npm link ../; npm i",
43
+ "postpack": "minifyProtoJson",
44
+ "samples-test": "cd samples/ && npm link ../ && npm i && npm test",
45
+ "system-test": "c8 mocha build/system-test",
46
+ "test": "c8 mocha build/test"
46
47
  },
47
48
  "dependencies": {
48
49
  "google-gax": "^3.5.8"
@@ -57,6 +58,7 @@
57
58
  "jsdoc-fresh": "^2.0.0",
58
59
  "jsdoc-region-tag": "^2.0.0",
59
60
  "linkinator": "^4.0.0",
61
+ "long": "^5.2.3",
60
62
  "mocha": "^9.2.2",
61
63
  "null-loader": "^4.0.1",
62
64
  "pack-n-play": "^1.0.0-2",