bump deps version

This commit is contained in:
undefined committed 2022-03-12 23:38:41 +08:00
1 parent e7b4b5de5e
commit f621d26ed7
29 files changed
+75 -63

No files matched your search

+1 -1
View File
@@ -5,7 +5,7 @@ const _CACHE_INFO = {
};
function _LOGP(x: number) {
const sqrtPi = 2.506628274631000502415765284811; // Sqrt[Pi]
const sqrtPi = 2.506628274631; // Sqrt[Pi]
return (2 * Math.exp(-1.0 * (Math.log(x) ** 2) * 2)) / x / sqrtPi;
}
+1 -3
View File
@@ -91,9 +91,7 @@ class DomainModel {
static async inc(domainId: string, field: NumberKeys<DomainDoc>, n: number): Promise<number | null> {
const res = await coll.findOneAndUpdate(
{ _id: domainId },
// FIXME
// @ts-expect-error
{ $inc: { [field]: n } },
{ $inc: { [field]: n } as any },
{ returnDocument: 'after' },
);
return res.value?.[field];
+1 -3
View File
@@ -52,9 +52,7 @@ export async function set(_id: string, value: any, broadcast = true) {
export async function inc<K extends NumberKeys<SystemKeys>>(_id: K) {
const res = await coll.findOneAndUpdate(
{ _id },
// FIXME NumberKeys<>
// @ts-ignore
{ $inc: { value: 1 } },
{ $inc: { value: 1 } as any },
{ upsert: true, returnDocument: 'after' },
);
cache[_id] = res.value.value;
+3 -3
View File
@@ -35,12 +35,12 @@ export function deleteUserCache(udoc: User | Udoc | string | undefined | null, r
}
if (typeof udoc === 'string') {
// is domainId
for (const key of cache.keys().filter((i) => i.endsWith(`/${udoc}`))) cache.del(key);
for (const key of [...cache.keys()].filter((i) => i.endsWith(`/${udoc}`))) cache.delete(key);
return;
}
const id = [`id/${udoc._id.toString()}`, `name/${udoc.uname.toLowerCase()}`, `mail/${udoc.mail.toLowerCase()}`];
for (const key of cache.keys().filter((k) => id.includes(`${k.split('/')[0]}/${k.split('/')[1]}`))) {
cache.del(key);
for (const key of [...cache.keys()].filter((k) => id.includes(`${k.split('/')[0]}/${k.split('/')[1]}`))) {
cache.delete(key);
}
}
bus.on('user/delcache', (content) => deleteUserCache(JSON.parse(content), true));
+2
View File
@@ -25,6 +25,7 @@ function isBailed(value: any) {
export type Disposable = () => void;
export type VoidReturn = Promise<any> | any;
/* eslint-disable @typescript-eslint/naming-convention */
export interface EventMap extends Record<string, any> {
'app/started': () => void
'app/load/lib': () => VoidReturn
@@ -100,6 +101,7 @@ export interface EventMap extends Record<string, any> {
'record/change': (rdoc: RecordDoc, $set?: any, $push?: any) => void
'record/judge': (rdoc: RecordDoc, updated: boolean) => VoidReturn
}
/* eslint-enable @typescript-eslint/naming-convention */
function getHooks<K extends keyof EventMap>(name: K) {
const hooks = _hooks[name] || (_hooks[name] = []);