Skip to content

Commit

Permalink
DBSchemas should be ReadonlyArray
Browse files Browse the repository at this point in the history
SBSchema.stores should be ReadonlyRecord
  • Loading branch information
wolfmcr committed Dec 22, 2023
1 parent f935c60 commit c2b4409
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ import * as R from 'fp-ts/lib/Record';
import * as TE from 'fp-ts/lib/TaskEither';

import * as t from 'io-ts';
import type { ReadonlyRecord } from 'fp-ts/lib/ReadonlyRecord';
import { pipe } from 'fp-ts/lib/function';

type StoreName = string;
type Store<StoreC extends t.Mixed> = { key: string, codec: StoreC };

export type DBSchema<StoreC extends t.Mixed> = {
version: number;
stores: Record<StoreName, Store<StoreC>>;
stores: ReadonlyRecord<StoreName, Store<StoreC>>;
};

export type DBSchemas<StoreC extends t.Mixed> = Array<DBSchema<StoreC>>;
export type DBSchemas<StoreC extends t.Mixed> = ReadonlyArray<DBSchema<StoreC>>;
export type DatabaseInfo<StoreC extends t.Mixed> = { database: IDBDatabase, schema: DBSchema<StoreC> };
export type IndexedDbError = DOMException | Error;

Expand Down

0 comments on commit c2b4409

Please sign in to comment.