//#region src/db/manage/scope-definitions.d.ts /** * Single source of truth for hierarchical scope column definitions. * * Everything else — TypeScript config types, WHERE clause helpers, and * compile-time table constraints — is derived from these key arrays. * * The schema column helpers (tenantScoped, projectScoped, etc.) in * manage-schema.ts define the Drizzle columns using the same key names. * If a key is added or removed here, the schema columns and all * downstream consumers (types, query helpers) must be updated together — * but now they'll fail at compile time instead of silently drifting. */ declare const SCOPE_KEYS: { readonly tenant: readonly ["tenantId"]; readonly project: readonly ["tenantId", "projectId"]; readonly agent: readonly ["tenantId", "projectId", "agentId"]; readonly subAgent: readonly ["tenantId", "projectId", "agentId", "subAgentId"]; readonly tool: readonly ["tenantId", "projectId", "toolId"]; }; type ScopeLevel = keyof typeof SCOPE_KEYS; type ScopeKeysOf = (typeof SCOPE_KEYS)[L][number]; /** A table that has the columns required for a given scope level. */ type ScopedTable = { [K in ScopeKeysOf]: any }; /** The parameter object shape required to filter by a given scope level. */ type ScopeConfig = { [K in ScopeKeysOf]: string }; type TenantScopeConfig = ScopeConfig<'tenant'>; type ProjectScopeConfig = ScopeConfig<'project'>; type AgentScopeConfig = ScopeConfig<'agent'>; type SubAgentScopeConfig = ScopeConfig<'subAgent'>; type ToolScopeConfig = ScopeConfig<'tool'>; //#endregion export { AgentScopeConfig, ProjectScopeConfig, SCOPE_KEYS, ScopeConfig, ScopeKeysOf, ScopeLevel, ScopedTable, SubAgentScopeConfig, TenantScopeConfig, ToolScopeConfig };