Document that storage should be removed once engine can provide invitation data. Also documented memory adapter should be moved as its only used in the tests

This commit is contained in:
2026-05-04 12:15:39 +00:00
parent dec228063b
commit c2334b2cdd

View File

@@ -1,6 +1,11 @@
import Database from "better-sqlite3"; import Database from "better-sqlite3";
import { decodeExtendedJson, encodeExtendedJson } from "../utils/ext-json.js"; import { decodeExtendedJson, encodeExtendedJson } from "../utils/ext-json.js";
/**
* This is not an actual storage adapter that we want to make use of. This storage adapter is a stop-gap while the engine is under development.
* At the time of writing the storage adapter, the engine provided no way to read data about your currenty invitations, so that is where this is coming in.
* Its providing a Developer facing way to store/read the invitation data and then we can just import them into the engine whenever we want to interact with an invitation.
*/
export abstract class BaseStorage { export abstract class BaseStorage {
abstract all(): Promise<{ key: string; value: any }[]>; abstract all(): Promise<{ key: string; value: any }[]>;
abstract set(key: string, value: any): Promise<void>; abstract set(key: string, value: any): Promise<void>;
@@ -10,6 +15,9 @@ export abstract class BaseStorage {
abstract child(key: string): BaseStorage; abstract child(key: string): BaseStorage;
} }
/**
* SQLite Database Storage Adapter.
*/
export class Storage extends BaseStorage { export class Storage extends BaseStorage {
static async create(dbPath: string): Promise<Storage> { static async create(dbPath: string): Promise<Storage> {
// Create the database // Create the database
@@ -134,6 +142,9 @@ export class Storage extends BaseStorage {
* *
* This adapter is useful for tests and short-lived sessions where persisted * This adapter is useful for tests and short-lived sessions where persisted
* SQLite state is not needed. * SQLite state is not needed.
*
* TODO: Move this somewhere else. There is no reason for this to be in the main codebase. We should put this stricly in the tests beacuse that were its actually being used.
* Ideally, we would provide these kind of generic fills as part of our packages somewhere, but these interfaces dont fit our current design.
*/ */
export class InMemoryStorage extends BaseStorage { export class InMemoryStorage extends BaseStorage {
static async create(): Promise<InMemoryStorage> { static async create(): Promise<InMemoryStorage> {