Skip to content

Commit 224063c

Browse files
committed
test
1 parent 5cffef5 commit 224063c

File tree

9 files changed

+21
-25
lines changed

9 files changed

+21
-25
lines changed

packages/loot-core/src/platform/server/fs/index.web.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,6 @@ export const populateFileHeirarchy = async function () {
258258

259259
export const init = async function () {
260260
const Module = _getModule();
261-
// @ts-expect-error - incorrect types
262261
FS = Module.FS;
263262

264263
// When a user "uploads" a file, we just put it in memory in this
@@ -284,7 +283,6 @@ export const init = async function () {
284283
connection.send('fallback-write-error');
285284
});
286285
BFS = new SQLiteFS(FS, backend);
287-
// @ts-expect-error - incorrect types
288286
Module.register_for_idb(BFS);
289287

290288
FS.mount(BFS, {}, '/blocked');

packages/loot-core/src/platform/server/sqlite/index.d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import type { SqlJsStatic, Database } from '@jlongster/sql.js';
1+
import { type Database } from '@jlongster/sql.js';
22

3-
export function init(): Promise<void>;
3+
export async function init(): Promise<void>;
44

55
export function _getModule(): SqlJsStatic;
66

@@ -23,13 +23,13 @@ export function execQuery(db: Database, sql): void;
2323

2424
export function transaction(db: Database, fn: () => void): void;
2525

26-
export function asyncTransaction(
26+
export async function asyncTransaction(
2727
db: Database,
2828
fn: () => Promise<void>,
2929
): Promise<void>;
3030

31-
export function openDatabase(pathOrBuffer?: string | Buffer): Promise<Database>;
31+
export async function openDatabase(pathOrBuffer?: string | Buffer): Database;
3232

3333
export function closeDatabase(db: Database): void;
3434

35-
export function exportDatabase(db: Database): Promise<Uint8Array>;
35+
export async function exportDatabase(db: Database): Promise<Uint8Array>;

packages/loot-core/src/platform/server/sqlite/index.electron.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ function regexp(regex: string, text: string | null) {
102102
return new RegExp(regex).test(text || '') ? 1 : 0;
103103
}
104104

105-
export async function openDatabase(pathOrBuffer: string | Buffer) {
105+
export function openDatabase(pathOrBuffer: string | Buffer) {
106106
const db = new SQL(pathOrBuffer);
107107
// Define Unicode-aware LOWER, UPPER, and LIKE implementation.
108108
// This is necessary because better-sqlite3 uses SQLite build without ICU support.

packages/loot-core/src/server/accounts/transactions.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,5 @@ export async function batchUpdateTransactions({
184184
return {
185185
added: resultAdded,
186186
updated: runTransfers ? transfersUpdated : resultUpdated,
187-
deleted: allDeleted,
188187
};
189188
}

packages/loot-core/src/server/backups.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export async function makeBackup(id: string) {
122122
await fs.copyFile(fs.join(budgetDir, 'db.sqlite'), backupPath);
123123

124124
// Remove all the messages from the backup
125-
const db = await sqlite.openDatabase(backupPath);
125+
const db = sqlite.openDatabase(backupPath);
126126
await sqlite.runQuery(db, 'DELETE FROM messages_crdt');
127127
await sqlite.runQuery(db, 'DELETE FROM messages_clock');
128128
sqlite.closeDatabase(db);

packages/loot-core/src/server/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ handlers['create-query'] = async function ({ sheetName, name, query }) {
553553
};
554554

555555
handlers['query'] = async function (query) {
556-
if (query['table'] == null) {
556+
if (query.table == null) {
557557
throw new Error('query has no table, did you forgot to call `.serialize`?');
558558
}
559559

packages/loot-core/src/server/mutators.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1+
// @ts-strict-ignore
12
import { captureException, captureBreadcrumb } from '../platform/exceptions';
23
import { sequential } from '../shared/async';
34
import { type HandlerFunctions, type Handlers } from '../types/handlers';
45

56
const runningMethods = new Set();
67

7-
let currentContext: Record<string, unknown> | null = null;
8+
let currentContext = null;
89
const mutatingMethods = new WeakMap();
910
let globalMutationsEnabled = false;
1011

11-
let _latestHandlerNames: (string | undefined)[] = [];
12+
let _latestHandlerNames = [];
1213

1314
export function mutator<T extends HandlerFunctions>(handler: T): T {
1415
mutatingMethods.set(handler, true);
1516
return handler;
1617
}
1718

18-
export function isMutating<T extends HandlerFunctions>(handler: T) {
19+
export function isMutating(handler) {
1920
return mutatingMethods.has(handler);
2021
}
2122

@@ -33,14 +34,14 @@ async function flushRunningMethods() {
3334
}
3435
}
3536

36-
function wait(time: number) {
37+
function wait(time) {
3738
return new Promise(resolve => setTimeout(resolve, time));
3839
}
3940

4041
export async function runHandler<T extends Handlers[keyof Handlers]>(
4142
handler: T,
4243
args?: Parameters<T>[0],
43-
{ undoTag, name }: { undoTag?: string; name?: string } = {},
44+
{ undoTag, name }: { undoTag?; name? } = {},
4445
): Promise<ReturnType<T>> {
4546
// For debug reasons, track the latest handlers that have been
4647
// called

packages/loot-core/src/types/server-handlers.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Backup } from '../server/backups';
44
import { RemoteFile } from '../server/cloud-storage';
55
import { Node as SpreadsheetNode } from '../server/spreadsheet/spreadsheet';
66
import { Message } from '../server/sync';
7-
import { Query, QueryState } from '../shared/query';
7+
import { QueryState } from '../shared/query';
88

99
import { Budget } from './budget';
1010
import {
@@ -19,6 +19,8 @@ import {
1919
} from './models';
2020
import { OpenIdConfig } from './models/openid';
2121
import { GlobalPrefs, MetadataPrefs } from './prefs';
22+
// eslint-disable-next-line import/no-unresolved
23+
import { Query } from './query';
2224
import { EmptyObject } from './util';
2325

2426
export interface ServerHandlers {
@@ -137,9 +139,7 @@ export interface ServerHandlers {
137139

138140
'create-query': (arg: { sheetName; name; query }) => Promise<unknown>;
139141

140-
query: (
141-
query: Query | QueryState,
142-
) => Promise<{ data: unknown; dependencies }>;
142+
query: (query: Query) => Promise<{ data: unknown; dependencies }>;
143143

144144
'account-update': (arg: { id; name }) => Promise<unknown>;
145145

packages/loot-core/src/types/util.d.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ export type StripNever<T> = {
44
[K in keyof T as T[K] extends never ? never : K]: T[K];
55
};
66

7-
export type EverythingButIdOptional<
8-
T extends {
9-
id: unknown;
10-
},
11-
> = { id: T['id'] } & Partial<Omit<T, 'id'>>;
7+
export type EverythingButIdOptional<T> = { id: T['id'] } & Partial<
8+
Omit<T, 'id'>
9+
>;
1210

1311
export type WithRequired<T, K extends keyof T> = T & Required<Pick<T, K>>;
1412

0 commit comments

Comments
 (0)