1import * as vault from "@distilled.cloud/gcp/vault_v1";
2import * as Effect from "effect/Effect";
3import { 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.
8export const runLifecycle = !process.env.FAST && !!process.env.GCP_TEST_VAULT;
9
10export const vaultAccount = process.env.GCP_TEST_VAULT_ACCOUNT?.trim();
11
12export const runAccountLifecycle = runLifecycle && !!vaultAccount;
13
14export const logLevel = Effect.provideService(
15 MinimumLogLevel,
16 process.env.DEBUG ? "Debug" : "Info",
17);
18
19export 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
28export const sampleMailExportOptions = (): vault.ExportOptions => ({
29 mailOptions: { exportFormat: "MBOX" },
30});