defining storage modes

This commit is contained in:
Roland Osborne 2024-06-20 22:08:35 -07:00
parent d9d3180d88
commit 81d6d91eea
3 changed files with 14 additions and 7 deletions

View File

@ -1,5 +1,7 @@
import { AccountSession } from './accountSession';
import { AdminSession } from './adminSession';
import { SqlStore } from './sqlStore';
import { WebStore } from './webStore';
export class DatabagSDK {
@ -7,15 +9,11 @@ export class DatabagSDK {
console.log("databag sdk");
}
public async initSqlStore(path: string): Promise<AccountSession | null> {
public async initOfflineStore(store: SqlStore): Promise<AccountSession | null> {
return new AccountSession();
}
public async initWebStore(): Promise<AccountSession | null> {
return new AccountSession();
}
public async initMemStore(): Promise<AccountSession | null> {
public async initOnlineStore(store: WebStore): Promise<AccountSession | null> {
return new AccountSession();
}
@ -38,7 +36,7 @@ export class DatabagSDK {
return new AdminSession();
}
public async adminLogout(): Promise<void> {
public async adminLogout(session: AdminSession): Promise<void> {
}
}

3
app/sdk/src/sqlStore.ts Normal file
View File

@ -0,0 +1,3 @@
export interface SqlStore {
query(stmt: string, params: (string | number)[]): any[];
}

6
app/sdk/src/webStore.ts Normal file
View File

@ -0,0 +1,6 @@
export interface WebStore {
getValue(key: string): string;
setValue(key: string, value: string): void;
clearValue(key: string): void;
clearAll(): void;
}