feat: complete Ancestor quote bot with production-ready Docker support

This commit is contained in:
unfunny
2026-09-13 14:14:38 -04:00
parent f2016da05a
commit fe7351a7dc
1145 changed files with 30890 additions and 97684 deletions

View File

@@ -1,25 +1,31 @@
import { MemoryStore, type IOpts as IBaseOpts } from "./memory.ts";
import { type IEvent } from "../models/event.ts";
import { type ISavedSync } from "./index.ts";
import { type IIndexedDBBackend } from "./indexeddb-backend.ts";
import { type ISyncResponse } from "../sync-accumulator.ts";
import { type EventEmitterEvents } from "../models/typed-event-emitter.ts";
import { type IStateEventWithRoomId } from "../@types/search.ts";
import { type IndexedToDeviceBatch, type ToDeviceBatchWithTxnId } from "../models/ToDeviceMessage.ts";
import { type IStoredClientOpts } from "../client.ts";
import { type SyncUserProfile } from "../models/user.ts";
import { MemoryStore, IOpts as IBaseOpts } from "./memory";
import { IEvent } from "../models/event";
import { ISavedSync } from "./index";
import { IIndexedDBBackend } from "./indexeddb-backend";
import { ISyncResponse } from "../sync-accumulator";
import { TypedEventEmitter } from "../models/typed-event-emitter";
import { IStateEventWithRoomId } from "../@types/search";
import { IndexedToDeviceBatch, ToDeviceBatchWithTxnId } from "../models/ToDeviceMessage";
import { IStoredClientOpts } from "../client";
interface IOpts extends IBaseOpts {
/** The Indexed DB interface e.g. `window.indexedDB` */
indexedDB?: IDBFactory;
indexedDB: IDBFactory;
/** Optional database name. The same name must be used to open the same database. */
dbName?: string;
/** Optional factory to spin up a Worker to execute the IDB transactions within. */
workerFactory?: () => Worker;
}
type EventHandlerMap = {
degraded: (e: Error) => void;
closed: () => void;
};
export declare class IndexedDBStore extends MemoryStore {
private readonly opts;
static exists(indexedDB: IDBFactory, dbName: string): Promise<boolean>;
_backend: IIndexedDBBackend;
/**
* The backend instance.
* Call through to this API if you need to perform specific indexeddb actions like deleting the database.
*/
readonly backend: IIndexedDBBackend;
private startedUp;
private syncTs;
private userModifiedMap;
@@ -37,10 +43,10 @@ export declare class IndexedDBStore extends MemoryStore {
* ```
* let opts = { indexedDB: window.indexedDB, localStorage: window.localStorage };
* let store = new IndexedDBStore(opts);
* await store.startup(); // load from indexed db
* let client = sdk.createClient({
* store: store,
* });
* await store.startup(); // load from indexed db, must be called after createClient
* client.startClient();
* client.on("sync", function(state, prevState, data) {
* if (state === "PREPARED") {
@@ -52,13 +58,7 @@ export declare class IndexedDBStore extends MemoryStore {
* @param opts - Options object.
*/
constructor(opts: IOpts);
/**
* The backend instance.
* Call through to this API if you need to perform specific indexeddb actions like deleting the database.
*/
get backend(): IIndexedDBBackend;
/** Re-exports `TypedEventEmitter.on` */
on(event: EventEmitterEvents | "degraded" | "closed", handler: (...args: any[]) => void): void;
on: <T extends import("../models/typed-event-emitter").EventEmitterEvents | keyof EventHandlerMap>(event: T, listener: import("../models/typed-event-emitter").Listener<keyof EventHandlerMap, EventHandlerMap, T>) => TypedEventEmitter<keyof EventHandlerMap, EventHandlerMap, EventHandlerMap>;
/**
* @returns Resolved when loaded from indexed db.
*/
@@ -139,9 +139,6 @@ export declare class IndexedDBStore extends MemoryStore {
saveToDeviceBatches(batches: ToDeviceBatchWithTxnId[]): Promise<void>;
getOldestToDeviceBatch(): Promise<IndexedToDeviceBatch | null>;
removeToDeviceBatch(id: number): Promise<void>;
getUserProfile(userId: string): Promise<SyncUserProfile | undefined>;
storeUserProfiles(userProfiles: Map<string, SyncUserProfile>): Promise<void>;
removeUserProfiles(userIds: string[]): Promise<void>;
}
type DegradableFn<A extends Array<any>, T> = (...args: A) => Promise<T>;
export {};