Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

enrich data before appending to stream

Thiago Araujo da Silva4c777ede5b87
diff --git a/backend/src/ee/services/audit-log/audit-log-queue.test.ts b/backend/src/ee/services/audit-log/audit-log-queue.test.ts
index 042a6b5254..ef18aec648 100644
--- a/backend/src/ee/services/audit-log/audit-log-queue.test.ts
+++ b/backend/src/ee/services/audit-log/audit-log-queue.test.ts
@@ -24,10 +24,22 @@ vi.mock("@app/lib/logger", () => ({
}));
const STREAM_KEY = "audit-log-stream";
+const MS_IN_DAY = 24 * 60 * 60 * 1000;
+// A push-time DTO (what pushToLog / the legacy shim receive — no resolved metadata yet).
+const dto = (overrides: Record<string, unknown> = {}) => ({
+ event: { type: "test-event", metadata: { k: "v" } },
+ actor: { type: "platform", metadata: {} },
+ orgId: "org-1",
+ ...overrides
+});
+
+// A fully-resolved stream entry (what the consumer reads — org/expiresAt/projectName pinned at
+// push time). createdAt/expiresAt default 30 days apart to mirror a resolved retention window.
const streamEntry = (overrides: Record<string, unknown> = {}) => ({
id: "log-1",
createdAt: new Date("2026-05-27T00:00:00.000Z").toISOString(),
+ expiresAt: new Date("2026-06-26T00:00:00.000Z").toISOString(),
event: { type: "test-event", metadata: { k: "v" } },
actor: { type: "platform", metadata: {} },
orgId: "org-1",
@@ -74,7 +86,7 @@ const createHarness = async ({ clickhouse = false, streamsEnabled = false } = {}
const auditLogDAL = { batchCreate: vi.fn<(logs: Record<string, unknown>[]) => Promise<void>>(async () => undefined) };
const projectDAL = {
- find: vi.fn<(filter: { $in: { id: string[] } }) => Promise<Record<string, unknown>[]>>(async () => [])
+ findById: vi.fn<(id: string) => Promise<Record<string, unknown> | undefined>>(async () => undefined)
};
const licenseService = {
getPlan: vi.fn<(orgId: string) => Promise<{ auditLogsRetentionDays: number }>>(async () => ({
@@ -117,47 +129,101 @@ const createHarness = async ({ clickhouse = false, streamsEnabled = false } = {}
};
};
+// Read the single stream entry that was pushed via streamAdd.
+const pushedEntry = (keyStore: { streamAdd: { mock: { calls: unknown[][] } } }) =>
+ JSON.parse((keyStore.streamAdd.mock.calls[0][2] as { data: string }).data) as Record<string, unknown>;
+
beforeEach(() => {
vi.clearAllMocks();
});
describe("audit-log-queue pushToLog", () => {
- test("appends a stream entry with a pinned id and an ISO createdAt", async () => {
+ test("resolves the entry and appends it with a pinned id, ISO timestamps, and orgId", async () => {
const { service, keyStore } = await createHarness();
- await service.pushToLog({
- event: { type: "e", metadata: {} },
- actor: { type: "platform", metadata: {} },
- orgId: "org-1"
- } as never);
+ await service.pushToLog(dto({ orgId: "org-1" }) as never);
expect(keyStore.streamAdd).toHaveBeenCalledTimes(1);
const [key, id, fields] = keyStore.streamAdd.mock.calls[0];
expect(key).toBe(STREAM_KEY);
expect(id).toBe("*");
- const parsed = JSON.parse(fields.data) as { id: string; createdAt: string };
+ const parsed = JSON.parse(fields.data) as { id: string; createdAt: string; expiresAt: string; orgId: string };
expect(typeof parsed.id).toBe("string");
expect(parsed.id).toHaveLength(36);
expect(new Date(parsed.createdAt).toISOString()).toBe(parsed.createdAt);
+ expect(new Date(parsed.expiresAt).toISOString()).toBe(parsed.expiresAt);
+ expect(parsed.orgId).toBe("org-1");
+ });
+
+ test("resolves orgId + projectName via the project for an org-less (project-scoped) event", async () => {
+ const { service, keyStore, projectDAL } = await createHarness();
+ projectDAL.findById.mockResolvedValueOnce({ id: "p1", orgId: "org-1", name: "proj", auditLogsRetentionDays: null });
+
+ await service.pushToLog(dto({ orgId: undefined, projectId: "p1" }) as never);
+
+ expect(projectDAL.findById).toHaveBeenCalledWith("p1");
+ const parsed = pushedEntry(keyStore);
+ expect(parsed.orgId).toBe("org-1");
+ expect(parsed.projectName).toBe("proj");
+ });
+
+ test("caps the TTL at the project-level retention when it is lower than the plan", async () => {
+ const { service, keyStore, projectDAL, licenseService } = await createHarness();
+ projectDAL.findById.mockResolvedValueOnce({ id: "p1", orgId: "org-1", name: "proj", auditLogsRetentionDays: 5 });
+ licenseService.getPlan.mockResolvedValueOnce({ auditLogsRetentionDays: 30 });
+
+ await service.pushToLog(dto({ orgId: undefined, projectId: "p1" }) as never);
+
+ const parsed = pushedEntry(keyStore);
+ const ttl = new Date(parsed.expiresAt as string).getTime() - new Date(parsed.createdAt as string).getTime();
+ expect(ttl).toBe(5 * MS_IN_DAY);
+ });
+
+ test("drops (no streamAdd) an entry with neither orgId nor projectId", async () => {
+ const { service, keyStore } = await createHarness();
+
+ await service.pushToLog(dto({ orgId: undefined, projectId: undefined }) as never);
+
+ expect(keyStore.streamAdd).not.toHaveBeenCalled();
+ });
+
+ test("drops (no streamAdd) when the project was deleted", async () => {
+ const { service, keyStore, projectDAL } = await createHarness();
+ projectDAL.findById.mockResolvedValueOnce(undefined);
+
+ await service.pushToLog(dto({ orgId: undefined, projectId: "gone" }) as never);
+
+ expect(keyStore.streamAdd).not.toHaveBeenCalled();
+ });
+
+ test("drops (no streamAdd) when audit log retention is 0/unset", async () => {
+ const { service, keyStore, licenseService } = await createHarness();
+ licenseService.getPlan.mockResolvedValueOnce({ auditLogsRetentionDays: 0 });
+
+ await service.pushToLog(dto({ orgId: "org-zero" }) as never);
+
+ expect(keyStore.streamAdd).not.toHaveBeenCalled();
});
test("never throws when streamAdd fails", async () => {
const { service, keyStore } = await createHarness();
keyStore.streamAdd.mockRejectedValueOnce(new Error("redis down"));
- await expect(
- service.pushToLog({
- event: { type: "e", metadata: {} },
- actor: { type: "platform", metadata: {} },
- orgId: "o"
- } as never)
- ).resolves.toBeUndefined();
+ await expect(service.pushToLog(dto({ orgId: "o" }) as never)).resolves.toBeUndefined();
+ });
+
+ test("never throws when a resolution lookup fails", async () => {
+ const { service, keyStore, licenseService } = await createHarness();
+ licenseService.getPlan.mockRejectedValueOnce(new Error("license service down"));
+
+ await expect(service.pushToLog(dto({ orgId: "o" }) as never)).resolves.toBeUndefined();
+ expect(keyStore.streamAdd).not.toHaveBeenCalled();
});
test("compatibility shim re-routes legacy jobs into the stream", async () => {
const { shim, keyStore } = await createHarness();
- await shim({ data: { event: { type: "e", metadata: {} }, actor: { type: "platform", metadata: {} }, orgId: "o" } });
+ await shim({ data: dto({ orgId: "o" }) });
expect(keyStore.streamAdd).toHaveBeenCalledTimes(1);
});
@@ -166,9 +232,7 @@ describe("audit-log-queue pushToLog", () => {
const { shim, keyStore } = await createHarness();
keyStore.streamAdd.mockRejectedValueOnce(new Error("redis down"));
- await expect(
- shim({ data: { event: { type: "e", metadata: {} }, actor: { type: "platform", metadata: {} }, orgId: "o" } })
- ).rejects.toThrow("redis down");
+ await expect(shim({ data: dto({ orgId: "o" }) })).rejects.toThrow("redis down");
});
});
@@ -183,11 +247,20 @@ describe("audit-log-queue unified consumer", () => {
expect(keyStore.streamTrim).not.toHaveBeenCalled();
});
- test("postgres branch batch-inserts with null-normalized empties + projectName, then trims", async () => {
- const { consumer, auditLogDAL, projectDAL, keyStore } = await createHarness();
- projectDAL.find.mockResolvedValue([{ id: "p1", orgId: "org-1", name: "proj", auditLogsRetentionDays: null }]);
+ test("does not perform any DB lookups while draining", async () => {
+ const { consumer, projectDAL, licenseService, keyStore } = await createHarness();
+ keyStore.streamCollect.mockResolvedValueOnce(collectResult([streamEntry({ projectId: "p1" })]));
+
+ await consumer();
+
+ expect(projectDAL.findById).not.toHaveBeenCalled();
+ expect(licenseService.getPlan).not.toHaveBeenCalled();
+ });
+
+ test("postgres branch inserts the resolved entry (null-normalized empties + projectName), then trims", async () => {
+ const { consumer, auditLogDAL, keyStore } = await createHarness();
keyStore.streamCollect.mockResolvedValueOnce(
- collectResult([streamEntry({ orgId: undefined, projectId: "p1", ipAddress: undefined })])
+ collectResult([streamEntry({ orgId: "org-1", projectId: "p1", projectName: "proj", ipAddress: undefined })])
);
await consumer();
@@ -214,18 +287,13 @@ describe("audit-log-queue unified consumer", () => {
expect(args.values[0]).not.toHaveProperty("projectName");
});
- test("drops entries failing skip rules and inserts only survivors", async () => {
- const { consumer, auditLogDAL, projectDAL, licenseService, keyStore } = await createHarness();
- projectDAL.find.mockResolvedValue([{ id: "pD", orgId: "orgD", name: "d" }]); // pB absent → treated as deleted
- licenseService.getPlan.mockImplementation(async (orgId: string) => ({
- auditLogsRetentionDays: orgId === "orgZero" ? 0 : 30
- }));
+ test("drops entries missing resolved metadata and inserts only survivors", async () => {
+ const { consumer, auditLogDAL, keyStore } = await createHarness();
keyStore.streamCollect.mockResolvedValueOnce(
collectResult([
- streamEntry({ id: "A", orgId: undefined, projectId: undefined }), // neither → drop
- streamEntry({ id: "B", orgId: undefined, projectId: "pB" }), // project deleted → drop
- streamEntry({ id: "C", orgId: "orgZero" }), // retention 0 → drop
- streamEntry({ id: "D", orgId: undefined, projectId: "pD" }) // valid
+ streamEntry({ id: "A", orgId: undefined }), // missing resolved orgId → drop
+ streamEntry({ id: "B", expiresAt: undefined }), // missing resolved expiresAt → drop
+ streamEntry({ id: "C" }) // valid
])
);
@@ -233,30 +301,10 @@ describe("audit-log-queue unified consumer", () => {
const rows = auditLogDAL.batchCreate.mock.calls[0][0];
expect(rows).toHaveLength(1);
- expect(rows[0].id).toBe("D");
+ expect(rows[0].id).toBe("C");
expect(keyStore.streamTrim).toHaveBeenCalledTimes(1);
});
- test("dedups project and plan lookups across the batch", async () => {
- const { consumer, projectDAL, licenseService, keyStore } = await createHarness();
- projectDAL.find.mockImplementation(async ({ $in }) =>
- $in.id.map((id) => ({ id, orgId: id === "p1" ? "orgA" : "orgB", name: id }))
- );
- keyStore.streamCollect.mockResolvedValueOnce(
- collectResult([
- streamEntry({ id: "1", orgId: undefined, projectId: "p1" }),
- streamEntry({ id: "2", orgId: undefined, projectId: "p1" }),
- streamEntry({ id: "3", orgId: undefined, projectId: "p2" }),
- streamEntry({ id: "4", orgId: "orgA" })
- ])
- );
-
- await consumer();
-
- expect(projectDAL.find).toHaveBeenCalledTimes(1); // single batched lookup for p1, p2
- expect(licenseService.getPlan).toHaveBeenCalledTimes(2); // orgA, orgB
- });
-
test("insert failure skips both the outbox and the trim", async () => {
const { consumer, auditLogDAL, auditLogStreamOutboxService, keyStore } = await createHarness({
streamsEnabled: true
@@ -305,9 +353,10 @@ describe("audit-log-queue unified consumer", () => {
});
test("an all-dropped batch still trims without inserting", async () => {
- const { consumer, auditLogDAL, licenseService, keyStore } = await createHarness();
- licenseService.getPlan.mockResolvedValue({ auditLogsRetentionDays: 0 });
- keyStore.streamCollect.mockResolvedValueOnce(collectResult([streamEntry(), streamEntry({ id: "log-2" })]));
+ const { consumer, auditLogDAL, keyStore } = await createHarness();
+ keyStore.streamCollect.mockResolvedValueOnce(
+ collectResult([streamEntry({ orgId: undefined }), streamEntry({ id: "log-2", orgId: undefined })])
+ );
await consumer();
diff --git a/backend/src/ee/services/audit-log/audit-log-queue.ts b/backend/src/ee/services/audit-log/audit-log-queue.ts
index 9c4c18797e..0e52b7c366 100644
--- a/backend/src/ee/services/audit-log/audit-log-queue.ts
+++ b/backend/src/ee/services/audit-log/audit-log-queue.ts
@@ -2,11 +2,13 @@ import type { ClickHouseClient } from "@clickhouse/client";
import { randomUUID } from "crypto";
import { v7 as uuidv7 } from "uuid";
-import type { TAuditLogs, TProjects } from "@app/db/schemas";
+import type { TAuditLogs } from "@app/db/schemas";
import { TAuditLogStreamOutboxServiceFactory } from "@app/ee/services/audit-log-stream-outbox/audit-log-stream-outbox-service";
import { KeyStorePrefixes, TKeyStoreFactory } from "@app/keystore/keystore";
import { getConfig } from "@app/lib/config/env";
import { logger } from "@app/lib/logger";
+import { requestMemoKeys } from "@app/lib/request-context/memo-keys";
+import { requestMemoize } from "@app/lib/request-context/request-memoizer";
import { JOB_SCHEDULER_PREFIX, QueueJobs, QueueName, TQueueServiceFactory } from "@app/queue";
import { TProjectDALFactory } from "@app/services/project/project-dal";
@@ -18,7 +20,7 @@ type TAuditLogQueueServiceFactoryDep = {
auditLogDAL: TAuditLogDALFactory;
auditLogStreamOutboxService: Pick<TAuditLogStreamOutboxServiceFactory, "enqueueForLogs">;
queueService: TQueueServiceFactory;
- projectDAL: Pick<TProjectDALFactory, "find">;
+ projectDAL: Pick<TProjectDALFactory, "findById">;
licenseService: Pick<TLicenseServiceFactory, "getPlan">;
clickhouseClient: ClickHouseClient | null;
keyStore: Pick<TKeyStoreFactory, "streamAdd" | "streamCollect" | "streamTrim" | "acquireLock">;
@@ -74,19 +76,60 @@ export const auditLogQueueServiceFactory = async ({
const isClickHouseBatchEnabled = Boolean(clickhouseClient && CLICKHOUSE_AUDIT_LOG_ENABLED);
- // Append the log to the Redis ingest stream. We pin `id` and `createdAt` here so a consumer
- // retry (reprocessing the same batch after a failed insert) re-inserts byte-identical rows
- // instead of regenerating ids. UUIDv7 embeds the timestamp for ClickHouse's time-sorted id;
- // UUIDv4 keeps the existing Postgres schema expectation.
- const appendToIngestStream = async (data: TCreateAuditLogDTO) => {
+ const buildStreamEntry = async (data: TCreateAuditLogDTO): Promise<TAuditLogStreamEntry | null> => {
+ const { projectId } = data;
+
+ if (!data.orgId && !projectId) {
+ logger.error(`audit-log-queue: Skipping entry with neither orgId nor projectId [event=${data.event?.type}]`);
+ return null;
+ }
+
+ const project =
+ !data.orgId && projectId
+ ? await requestMemoize(requestMemoKeys.projectFindById(projectId), () => projectDAL.findById(projectId))
+ : undefined;
+ if (!data.orgId && projectId && !project) {
+ logger.error(
+ `audit-log-queue: Skipping entry, project was deleted [projectId=${projectId}] [event=${data.event?.type}]`
+ );
+ return null;
+ }
+
+ const orgId = data.orgId ?? project?.orgId;
+ if (!orgId) return null;
+
+ const plan = await licenseService.getPlan(orgId);
+ if (!plan?.auditLogsRetentionDays) return null;
+
+ const ttlInDays =
+ project?.auditLogsRetentionDays && project.auditLogsRetentionDays < plan.auditLogsRetentionDays
+ ? project.auditLogsRetentionDays
+ : plan.auditLogsRetentionDays;
+ const ttl = ttlInDays * MS_IN_DAY;
+
const createdAt = new Date();
const id = isClickHouseBatchEnabled ? uuidv7({ msecs: createdAt.getTime() }) : randomUUID();
- const entry: TAuditLogStreamEntry = { ...data, id, createdAt: createdAt.toISOString() };
+
+ return {
+ ...data,
+ id,
+ orgId,
+ createdAt: createdAt.toISOString(),
+ expiresAt: new Date(createdAt.getTime() + ttl).toISOString(),
+ projectName: project?.name
+ };
+ };
+
+ // Append the resolved log to the Redis ingest stream. A dropped (null) entry is a no-op.
+ const appendToIngestStream = async (data: TCreateAuditLogDTO) => {
+ const entry = await buildStreamEntry(data);
+ if (!entry) return;
await keyStore.streamAdd(AUDIT_LOG_STREAM_KEY, "*", { data: JSON.stringify(entry) });
};
- // Request-path push: a transient Redis failure must not fail the request that produced
- // the audit event, so errors are logged and swallowed (at-most-once on this path).
+ // Request-path push: a transient Redis/DB failure must not fail the request that produced
+ // the audit event, so errors (resolution lookups included) are logged and swallowed
+ // (at-most-once on this path).
const pushToLog = async (data: TCreateAuditLogDTO) => {
try {
await appendToIngestStream(data);
@@ -123,8 +166,9 @@ export const auditLogQueueServiceFactory = async ({
}
};
- // Unified consumer: drain a batch from the ingest stream, enrich each entry, batch-insert
- // into the active backend, fan out to the stream outbox, and trim. Trim happens only after a
+ // Unified consumer: drain a batch from the ingest stream, map each (already-resolved) entry to
+ // an audit-log row, batch-insert into the active backend, fan out to the stream outbox, and
+ // trim. No DB lookups happen here — org/plan/retention were resolved at push time. Trim happens only after a
// successful insert so a failed batch is retried on the next tick (re-inserts are idempotent:
// ClickHouse ReplacingMergeTree dedups on id, Postgres uses ON CONFLICT (id) DO NOTHING).
const drainAuditLogStream = async () => {
@@ -157,70 +201,18 @@ export const auditLogQueueServiceFactory = async ({
}
}
- // Resolve projects for entries that arrived without an orgId (deduped by projectId). A
- // lookup that returns nothing means the project was deleted → drop that entry; a lookup
- // that throws bubbles up to fail the tick (no trim → retry) so a transient DB error
- // doesn't silently lose logs.
- const projectCache = new Map<string, TProjects | undefined>();
- const distinctProjectIds = [
- ...new Set(parsed.filter((entry) => !entry.orgId && entry.projectId).map((entry) => entry.projectId as string))
- ];
- if (distinctProjectIds.length > 0) {
- const projects = await projectDAL.find({ $in: { id: distinctProjectIds } });
- for (const project of projects) {
- projectCache.set(project.id, project);
- }
- }
-
- const resolveOrgId = (entry: TAuditLogStreamEntry): string | undefined =>
- entry.orgId ?? (entry.projectId ? projectCache.get(entry.projectId)?.orgId : undefined);
-
- // Resolve license plans (deduped by orgId) — drives the audit-log retention check + TTL.
- const planCache = new Map<string, Awaited<ReturnType<typeof licenseService.getPlan>>>();
- const distinctOrgIds = new Set<string>();
- for (const entry of parsed) {
- const orgId = resolveOrgId(entry);
- if (orgId) distinctOrgIds.add(orgId);
- }
- for (const orgId of distinctOrgIds) {
- // eslint-disable-next-line no-await-in-loop
- planCache.set(orgId, await licenseService.getPlan(orgId));
- }
-
- // Enrich one entry into a persistable audit log, or return null to drop it (skip rules
- // mirror the prior per-log worker). Only org-less (project-scoped) entries carry project
- // context — a directly-supplied orgId skips the project lookup entirely, as before.
+ // Map a resolved stream entry into a persistable audit log. org/plan/TTL/projectName were all
+ // resolved at push time (see buildStreamEntry), so this is a pure shape transform with no DB
+ // lookups. Entries that predate push-time resolution (in-flight during a rolling deploy) lack
+ // `orgId`/`expiresAt`; drop them rather than persist a row with a missing org or expiry.
const enrichEntry = (entry: TAuditLogStreamEntry): TAuditLogs | null => {
- const { projectId } = entry;
-
- if (!entry.orgId && !projectId) {
- logger.error(`audit-log-queue: Skipping entry with neither orgId nor projectId [event=${entry.event?.type}]`);
- return null;
- }
-
- const project = !entry.orgId && projectId ? projectCache.get(projectId) : undefined;
- if (!entry.orgId && projectId && !project) {
+ if (!entry.orgId || !entry.expiresAt) {
logger.error(
- `audit-log-queue: Skipping entry, project was deleted [projectId=${projectId}] [event=${entry.event?.type}]`
+ `audit-log-queue: Skipping entry missing resolved metadata [event=${entry.event?.type}] [orgId=${entry.orgId}]`
);
return null;
}
- const orgId = entry.orgId ?? project?.orgId;
- if (!orgId) return null;
-
- const plan = planCache.get(orgId);
- // Skip inserting if audit log retention is 0/unset, meaning it's not supported.
- if (!plan?.auditLogsRetentionDays) return null;
-
- // For project actions, cap TTL at the project-level retention so the plan's retention
- // days cannot be bypassed upward.
- const ttlInDays =
- project?.auditLogsRetentionDays && project.auditLogsRetentionDays < plan.auditLogsRetentionDays
- ? project.auditLogsRetentionDays
- : plan.auditLogsRetentionDays;
- const ttl = ttlInDays * MS_IN_DAY;
-
const createdAt = new Date(entry.createdAt);
return {
id: entry.id,
@@ -231,13 +223,13 @@ export const auditLogQueueServiceFactory = async ({
eventMetadata: normalizeJsonPayload(entry.event.metadata),
userAgent: normalizeEmptyValue(entry.userAgent, isClickHouseBatchEnabled),
userAgentType: normalizeEmptyValue(entry.userAgentType, isClickHouseBatchEnabled),
- projectId: normalizeEmptyValue(projectId, isClickHouseBatchEnabled),
- orgId,
- expiresAt: new Date(createdAt.getTime() + ttl),
+ projectId: normalizeEmptyValue(entry.projectId, isClickHouseBatchEnabled),
+ orgId: entry.orgId,
+ expiresAt: new Date(entry.expiresAt),
createdAt,
updatedAt: createdAt,
// project name is only stored for non-ClickHouse insertion
- ...(!isClickHouseBatchEnabled ? { projectName: project?.name } : {})
+ ...(!isClickHouseBatchEnabled ? { projectName: entry.projectName } : {})
};
};
diff --git a/backend/src/ee/services/audit-log/audit-log-types.ts b/backend/src/ee/services/audit-log/audit-log-types.ts
index 6615b60e04..c7a06dddb0 100644
--- a/backend/src/ee/services/audit-log/audit-log-types.ts
+++ b/backend/src/ee/services/audit-log/audit-log-types.ts
@@ -104,10 +104,18 @@ export type AuditLogInfo = Pick<TCreateAuditLogDTO, "userAgent" | "userAgentType
// What `pushToLog` writes to the Redis ingest stream. We pin `id` and `createdAt` at
// push time so a consumer retry (reprocessing the same batch after a failed insert)
// re-inserts byte-identical rows instead of regenerating ids and creating duplicates.
-// `createdAt` is an ISO string for JSON round-tripping through the stream.
+// `createdAt`/`expiresAt` are ISO strings for JSON round-tripping through the stream.
+//
+// org/plan/retention are also resolved at push time and travel with the entry, so the
+// consumer persists it with no further DB lookups: `orgId` is the resolved org (never
+// undefined for a streamed entry), `expiresAt` is the precomputed TTL boundary, and
+// `projectName` is captured for project-scoped events (Postgres-only at insert time).
export type TAuditLogStreamEntry = TCreateAuditLogDTO & {
id: string;
createdAt: string;
+ orgId: string;
+ expiresAt: string;
+ projectName?: string;
};
export type TAuditLogServiceFactory = {