import type { RawCard, Builder, Unsaved, CardId } from '@cardstack/core/src/interfaces';
import type RealmManager from './services/realm-manager';
import { IndexerHandle } from './services/search-index';
import { PgPrimitive } from './utils/expressions';
const ENVIRONMENTS_OBJ = {
browser: '',
node: '',
};
export type Environment = keyof typeof ENVIRONMENTS_OBJ;
export const ENVIRONMENTS = Object.keys(ENVIRONMENTS_OBJ) as Environment[];
export const BROWSER = ENVIRONMENTS[0];
export const NODE = ENVIRONMENTS[1];
export interface CardstackContext {
builder: Builder;
cardRouter: any;
realms: RealmManager;
requireCard: (path: string) => any;
}
export interface RealmInterface {
url: string;
read(cardId: CardId): Promise;
create(raw: RawCard): Promise;
update(raw: RawCard): Promise;
delete(cardId: CardId): Promise;
reindex(ops: IndexerHandle, meta: Meta | null): Promise;
teardown(): Promise;
}
export interface Cache {
get(url: string): CardType | undefined;
set(url: string, payload: CardType): void;
update(url: string, payload: CardType): void;
delete(url: string): void;
}