| 1 | import * as vault from "@distilled.cloud/gcp/vault_v1"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import { MinimumLogLevel } from "effect/References"; |
| 4 | |
| 5 | // Vault needs a Workspace customer with Vault licenses; the testing |
| 6 | // service account gets Forbidden "Request had insufficient authentication |
| 7 | // scopes." Set GCP_TEST_VAULT=1 (and GCP_TEST_VAULT_ACCOUNT) on one. |
| 8 | export const runLifecycle = !process.env.FAST && !!process.env.GCP_TEST_VAULT; |
| 9 | |
| 10 | export const vaultAccount = process.env.GCP_TEST_VAULT_ACCOUNT?.trim(); |
| 11 | |
| 12 | export const runAccountLifecycle = runLifecycle && !!vaultAccount; |
| 13 | |
| 14 | export const logLevel = Effect.provideService( |
| 15 | MinimumLogLevel, |
| 16 | process.env.DEBUG ? "Debug" : "Info", |
| 17 | ); |
| 18 | |
| 19 | export const sampleMailQuery = (email: string): vault.Query => ({ |
| 20 | corpus: "MAIL", |
| 21 | dataScope: "ALL_DATA", |
| 22 | searchMethod: "ACCOUNT", |
| 23 | accountInfo: { emails: [email] }, |
| 24 | terms: "subject:alchemy", |
| 25 | timeZone: "America/Los_Angeles", |
| 26 | }); |
| 27 | |
| 28 | export const sampleMailExportOptions = (): vault.ExportOptions => ({ |
| 29 | mailOptions: { exportFormat: "MBOX" }, |
| 30 | }); |