feat: release 3.0.0

This commit is contained in:
2026-01-05 23:19:42 +01:00
parent ed15a0eb27
commit 4aaf12948c
25 changed files with 1799 additions and 1812 deletions

View File

@@ -7,6 +7,18 @@ export class PrimaryIndex<TSchema extends AnyDocument> {
constructor(readonly key: string) {}
get documents() {
return Array.from(this.#index.values());
}
keys() {
return Array.from(this.#index.keys());
}
has(pk: PrimaryKey): boolean {
return this.#index.has(pk);
}
insert(pk: PrimaryKey, document: TSchema) {
if (this.#index.has(pk)) {
throw new Error(`Duplicate primary key: ${pk}`);
@@ -18,7 +30,15 @@ export class PrimaryIndex<TSchema extends AnyDocument> {
return this.#index.get(pk);
}
replace(pk: PrimaryKey, document: TSchema) {
this.#index.set(pk, document);
}
delete(pk: PrimaryKey) {
this.#index.delete(pk);
}
flush() {
this.#index.clear();
}
}