import { D as DbAdapter, j as CreateFlagInput, F as Flag, U as ListFlagsInput, V as ListFlagsResult, ak as UpdateFlagInput, I as FlagStatus, A as AddRuleInput, H as FlagRule, al as UpdateRuleInput, l as CreateSegmentInput, ad as Segment, am as UpdateSegmentInput, ae as SegmentUsage, k as CreateReleaseInput, $ as Release, q as ExclusionLayer, r as ExclusionLayerAllocation, O as HistoryEntry, ai as TrackEventInput, aj as TrackingEvent } from '../types-DdEZ8iqq.mjs'; import '../core/metrics.mjs'; import '../core/flag-types.mjs'; type ModelLike = { rawAttributes?: Record; tableAttributes?: Record; getAttributes?: () => Record; create(values: Record): Promise; findOne(options: { where: Record; }): Promise; findAll(options?: { where?: Record; order?: Array<[string, "ASC" | "DESC"]>; }): Promise; update(values: Record, options: { where: Record; }): Promise; destroy(options: { where: Record; }): Promise; }; type SequelizeLike = { define: (modelName: string, attributes: Record, options?: Record) => ModelLike; sync?: (options?: Record) => Promise; close?: () => Promise; }; type SequelizeModuleLike = { DataTypes: Record; }; type Models = { Flag: ModelLike; Rule: ModelLike; Segment: ModelLike; Release: ModelLike; Assignment: ModelLike; History: ModelLike; Impression: ModelLike; ExclusionLayer: ModelLike; }; type SequelizeAdapterModelName = keyof Models; type SequelizeAdapterModels = Partial>; interface SequelizeAdapterOptions { /** Sequelize instance owned by the application. */ sequelize: SequelizeLike; /** Optional sequelize module injection for tests or custom module loading. */ sequelizeModule?: SequelizeModuleLike; /** Optional existing Sequelize models. Missing models are defined by Rollease. */ models?: SequelizeAdapterModels; /** Validate that models expose every column Rollease needs. Defaults to true. */ validateColumns?: boolean; /** Table prefix. Defaults to "rollease_". */ tablePrefix?: string; /** Model name prefix. Defaults to "Rollease". */ modelNamePrefix?: string; /** Call sequelize.sync() after defining models. */ sync?: boolean | Record; } /** * `ExclusionLayer` is optional — it's kept in the column contract record but * skipped by `validateSequelizeAdapterModels` when absent so existing users * without that table aren't blocked on construction. */ declare const ROLLEASE_SEQUELIZE_REQUIRED_MODELS: SequelizeAdapterModelName[]; declare const ROLLEASE_SEQUELIZE_OPTIONAL_MODELS: SequelizeAdapterModelName[]; declare const ROLLEASE_SEQUELIZE_REQUIRED_COLUMNS: Record; declare class SequelizeDbAdapter implements DbAdapter { private sequelize; private sequelizeModule?; private providedModels?; private validateColumns; private tablePrefix; private modelNamePrefix; private syncOptions; private models?; private initPromise?; private idCounter; constructor(options: SequelizeAdapterOptions); private genId; sync(options?: Record): Promise; createFlag(input: CreateFlagInput): Promise; getFlag(key: string): Promise; listFlags(input?: ListFlagsInput): Promise; updateFlag(key: string, input: UpdateFlagInput): Promise; setFlagStatus(key: string, status: FlagStatus): Promise; deleteFlag(key: string): Promise; cloneFlag(sourceKey: string, newKey: string, includeRules: boolean, includeRollout: boolean): Promise; setRollout(key: string, rollout: { percentage?: number; sticky?: boolean; hashKey?: string; rampSchedule?: { at: string; percentage: number; }[]; }): Promise; addRule(flagKey: string, input: AddRuleInput): Promise; updateRule(flagKey: string, ruleId: string, input: UpdateRuleInput): Promise; removeRule(flagKey: string, ruleId: string): Promise; listRules(flagKey: string): Promise; reorderRules(flagKey: string, ordering: { ruleId: string; priority: number; }[]): Promise; createSegment(input: CreateSegmentInput): Promise; updateSegment(key: string, input: UpdateSegmentInput): Promise; deleteSegment(key: string): Promise; listSegments(): Promise; getSegment(key: string): Promise; getSegmentUsage(key: string): Promise; createRelease(input: CreateReleaseInput): Promise; approveRelease(releaseId: string, approverId: string): Promise; rejectRelease(releaseId: string, rejectorId: string, reason?: string): Promise; createExclusionLayer(input: ExclusionLayer): Promise; getExclusionLayer(key: string): Promise; updateExclusionLayer(key: string, allocations: ExclusionLayerAllocation[]): Promise; deleteExclusionLayer(key: string): Promise; listExclusionLayers(): Promise; touchFlagEvaluation(key: string): Promise; private toExclusionLayer; getRelease(releaseId: string): Promise; listReleases(filters?: { environment?: string; status?: string; limit?: number; }): Promise; deployRelease(releaseId: string, deployedBy?: string): Promise; rollbackRelease(releaseId: string, rolledBackBy?: string, reason?: string): Promise; getUserAssignment(flagKey: string, userId: string): Promise; getUserAssignments(flagKeys: string[], userId: string): Promise>; setUserAssignment(flagKey: string, userId: string, variantKey: string): Promise; addHistory(entry: Omit): Promise; getHistory(flagKey: string, opts?: { limit?: number; }): Promise; trackImpression(params: { flagKey: string; userId: string; value: unknown; variant: string | null; reason: string; }): Promise; getAllActiveFlags(opts?: { namespace?: string; tags?: string[]; keys?: string[]; limit?: number; offset?: number; }): Promise; addTags(flagKey: string, tags: string[]): Promise; removeTags(flagKey: string, tags: string[]): Promise; trackEvent(event: TrackEventInput): Promise; listTrackingEvents(filters?: { userId?: string; event?: string; limit?: number; }): Promise; getUserImpressions(userId: string, opts?: { limit?: number; flagKey?: string; }): Promise>; private toTrackingEvent; private plain; close(): Promise; private getRequiredRelease; private getModels; private ensureInitialized; private initialize; private useModel; private toFlag; private toRule; private toSegment; private toRelease; private toHistory; } declare function createSequelizeAdapter(options: SequelizeAdapterOptions): SequelizeDbAdapter; declare function validateSequelizeAdapterModels(models: SequelizeAdapterModels): void; export { ROLLEASE_SEQUELIZE_OPTIONAL_MODELS, ROLLEASE_SEQUELIZE_REQUIRED_COLUMNS, ROLLEASE_SEQUELIZE_REQUIRED_MODELS, type SequelizeAdapterModelName, type SequelizeAdapterModels, type SequelizeAdapterOptions, SequelizeDbAdapter, createSequelizeAdapter, validateSequelizeAdapterModels };