chore: update typedefs and fix dbkv issue (#1840)

* chore: update typedefs

* fix:dbkv decr
This commit is contained in:
Daniel Salazar
2025-10-27 18:13:49 -07:00
committed by GitHub
parent cd5d0ca5dc
commit d1ae2bfe80
4 changed files with 49 additions and 83 deletions
+2 -2
View File
@@ -1,8 +1,8 @@
import type { Actor } from "./auth/Actor";
import type { Actor } from './auth/Actor';
export class SUService {
_construct(): void;
get_system_actor(): Promise<any>;
get_system_actor(): Promise<Actor>;
sudo<T>(callback: () => Promise<T>): Promise<T>;
sudo<T>(actorOrCallback: Actor, callback: () => Promise<T>): Promise<T>;
}
@@ -309,8 +309,8 @@ export class DBKVStore {
return currVal as T extends { '': number } ? number : RecursiveRecord<number>;
}
async decr(...params: Parameters<typeof DBKVStore.prototype.incr>): ReturnType<typeof DBKVStore.prototype.incr> {
return await this.incr(...params);
async decr({ key, pathAndAmountMap }: Parameters<typeof DBKVStore.prototype.incr>[0]): ReturnType<typeof DBKVStore.prototype.incr> {
return await this.incr({ key, pathAndAmountMap: Object.fromEntries(Object.entries(pathAndAmountMap).map(([k, v]) => [k, -v])) });
}
async #expireat(key: string, timestamp: number){