import type { FeatureFlagStore, FlagOverrideRow, FlagRow } from '@pikku/core/services'; import type { CachedFlagSourceOptions, DeclaredFlag, FlagConfigSnapshot, FlagSubject } from '@pikku/core/flag'; import { CachedFlagSource } from '@pikku/core/flag'; import type { Kysely } from 'kysely'; import type { KyselyPikkuDB } from './kysely-tables.js'; export type KyselyFeatureFlagStoreOptions = CachedFlagSourceOptions; /** * Feature flags backed by two tables pikku owns. * * The full store, not just a source: the declaration lifecycle and the operator * controls both live here, which is what makes the console's Flags tab * writable. A third-party provider implements `FeatureFlagSource` alone. */ export declare class KyselyFeatureFlagStore extends CachedFlagSource implements FeatureFlagStore { private db; private initialized; constructor(db: Kysely, options?: KyselyFeatureFlagStoreOptions); init(): Promise; protected fetchSnapshot(): Promise; syncFlags(flags: DeclaredFlag[]): Promise; listFlags(): Promise; listOverrides(key: string): Promise; setEnabled(key: string, enabled: boolean, actor?: string, note?: string): Promise; setRollout(key: string, percent: number | null, actor?: string): Promise; setOverride(key: string, subject: FlagSubject, enabled: boolean, actor?: string): Promise; clearOverride(key: string, subject: FlagSubject): Promise; findStaleFlags(): Promise; /** * Deletes what is still undeclared, and reports only what it deleted. * * The `declared = false` predicate is repeated on the delete rather than * carried over from the read: a deploy running `syncFlags` between the two * would redeclare a flag, and deleting on the earlier answer would take a * live flag and cascade away every override an operator had set on it. */ pruneFlags(): Promise; }