Kaizen
Browse modulesInsightsinsights/serverInterfaces

Interface: CreateInsightsServicesOptions

Defined in: server/insights/factory.ts:22

Properties

drafter?

optional drafter?: ReportDrafter;

Defined in: server/insights/factory.ts:66

LLM adapter for the Ask surface — e.g. createAnthropicReportDrafter from @the-kaizen-labs/taproot/insights/ask-anthropic, or any object implementing the one-method ReportDrafter port.

Omit it and askService is simply absent: the core module has zero AI dependencies and nothing about Ask is constructed. Because it is a plain option, adapters are swappable per environment or per request. When Ask auditing is required, also configure hooks.onAskDrafted above.


export?

optional export?: {
  csv?: CsvExportOptions;
  now?: () => Date;
  xlsxWorkbookFactory?: XlsxWorkbookFactory;
};

Defined in: server/insights/factory.ts:50

Export knobs. xlsxWorkbookFactory overrides the lazy exceljs loader — pass one to use a different writer, or to avoid needing exceljs at all. csv carries delimiter / BOM / formula-guard / totals-row options.

csv?

optional csv?: CsvExportOptions;

now?

optional now?: () => Date;

Clock for the filename timestamp and PDF stamp. Injected for tests.

Returns

Date

xlsxWorkbookFactory?

optional xlsxWorkbookFactory?: XlsxWorkbookFactory;

getActorId

getActorId: () => string | null;

Defined in: server/insights/factory.ts:24

Returns the current actor's ID for audit fields, or null for system/anonymous.

Returns

string | null


hooks?

optional hooks?: InsightsHooks;

Defined in: server/insights/factory.ts:42

Optional lifecycle hooks.

When drafter enables Ask and durable Ask auditing is required, wire onAskDrafted to storage owned by the consuming application. Taproot emits the audit event but does not persist it.


model

model: ReportingModel;

Defined in: server/insights/factory.ts:26

The consumer's validated reporting model (from defineReportingModel).


queryClient?

optional queryClient?: PrismaClient<PrismaClientOptions, never, DefaultArgs>;

Defined in: server/insights/factory.ts:32

Optional read replica for query execution. Reads run here when provided; ALL writes still go to the ambient primary. The replica must carry the same RLS role/policies.


statementTimeoutMs?

optional statementTimeoutMs?: number;

Defined in: server/insights/factory.ts:44

Per-run statement_timeout (ms); defaults to the executor's default.


tenancy?

optional tenancy?: TenancyConfig;

Defined in: server/insights/factory.ts:34

Optional RLS backstop wrapping read execution.

On this page