/* eslint-disable @typescript-eslint/no-unused-vars */ import type { DatafileContent, EnvironmentKey, ExistingState, HistoryEntry, Commit, CommitHash, EntityType, } from "@featurevisor/types"; import type { Scope } from "../config"; export interface DatafileOptions { environment: EnvironmentKey | false; tag?: string; scope?: Scope; datafilesDir?: string; } export type FeatureEnvironmentProperty = "rules" | "force" | "expose"; export interface FeatureSourcePaths { baseFilePath: string; environmentFilePaths: Record; } export abstract class Adapter { // entities abstract listEntities(entityType: EntityType): Promise; abstract entityExists(entityType: EntityType, entityKey: string): Promise; abstract readEntity(entityType: EntityType, entityKey: string): Promise; abstract writeEntity(entityType: EntityType, entityKey: string, entity: T): Promise; abstract deleteEntity(entityType: EntityType, entityKey: string): Promise; // state abstract readState(environment: EnvironmentKey | false): Promise; abstract writeState( environment: EnvironmentKey | false, existingState: ExistingState, ): Promise; // datafile abstract readDatafile(options: DatafileOptions): Promise; abstract writeDatafile(datafileContent: DatafileContent, options: DatafileOptions): Promise; // revision abstract readRevision(): Promise; abstract writeRevision(revision: string): Promise; // history abstract listHistoryEntries(entityType?: EntityType, entityKey?: string): Promise; abstract readCommit( commit: CommitHash, entityType?: EntityType, entityKey?: string, ): Promise; // feature source helpers (used by lint/history attribution) async getFeatureSourcePaths(_featureKey: string): Promise { return undefined; } async getFeaturePropertySourcePath( _featureKey: string, _property: FeatureEnvironmentProperty, _environment?: string, ): Promise { return undefined; } }