| 1 | import * as documentai from "@distilled.cloud/gcp/documentai_v1"; |
| 2 | import { waitForOperation as waitForGcpOperation } from "../Operation.ts"; |
| 3 | |
| 4 | /** |
| 5 | * Wait for a Document AI long-running operation. Processor create is |
| 6 | * synchronous; enable, disable, delete, and schema deletes are LROs that |
| 7 | * finish within a few minutes. |
| 8 | */ |
| 9 | export const waitForOperation = ( |
| 10 | operation: documentai.GoogleLongrunningOperation, |
| 11 | ) => |
| 12 | waitForGcpOperation( |
| 13 | operation, |
| 14 | (name) => documentai.getProjectsLocationsOperations({ name }), |
| 15 | { budget: "10 minutes" }, |
| 16 | ); |