@remit/backend 0.0.149 → 0.0.151
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createSqliteRepositories, openSqliteDatabases, sqliteDatabasePathsFromEnv, } from "@remit/drizzle-service";
|
|
1
|
+
import { BETTER_SQLITE3_LIMITS, createSqliteRepositories, openSqliteDatabases, sqliteDatabasePathsFromEnv, } from "@remit/drizzle-service";
|
|
2
2
|
import { createRemitClient, } from "./create-remit-client.js";
|
|
3
3
|
import { buildSharedDeps, sqsQueues, sqsQueueUrlsFromEnv, } from "./shared-deps.js";
|
|
4
4
|
// The SQLite adapter composition (RFC 036). Every repo runs on the database
|
|
@@ -6,7 +6,7 @@ import { buildSharedDeps, sqsQueues, sqsQueueUrlsFromEnv, } from "./shared-deps.
|
|
|
6
6
|
export const composeSqliteClient = async (shared) => {
|
|
7
7
|
const databases = await openSqliteDatabases(sqliteDatabasePathsFromEnv());
|
|
8
8
|
return createRemitClient({
|
|
9
|
-
repositories: createSqliteRepositories(databases),
|
|
9
|
+
repositories: createSqliteRepositories(databases, BETTER_SQLITE3_LIMITS),
|
|
10
10
|
...shared,
|
|
11
11
|
});
|
|
12
12
|
};
|
|
@@ -339,6 +339,16 @@ export const backApplyFilter = async (deps, accountConfigId, filterId) => {
|
|
|
339
339
|
...nothing,
|
|
340
340
|
matched: match.messageIds.length,
|
|
341
341
|
};
|
|
342
|
+
const active = await client.filter.listByAccountAndState(accountConfigId, FilterState.Active);
|
|
343
|
+
const preparedByAccount = new Map();
|
|
344
|
+
const preparedFor = (accountId) => {
|
|
345
|
+
const known = preparedByAccount.get(accountId);
|
|
346
|
+
if (known)
|
|
347
|
+
return known;
|
|
348
|
+
const prepared = pipeline.prepare(accountConfigId, accountId, active);
|
|
349
|
+
preparedByAccount.set(accountId, prepared);
|
|
350
|
+
return prepared;
|
|
351
|
+
};
|
|
342
352
|
for (const messageId of match.messageIds) {
|
|
343
353
|
const message = await filterMessageOf(client, accountConfigId, messageId);
|
|
344
354
|
if (!message)
|
|
@@ -349,7 +359,7 @@ export const backApplyFilter = async (deps, accountConfigId, filterId) => {
|
|
|
349
359
|
if (folderAccountId !== undefined && folderAccountId !== accountId) {
|
|
350
360
|
continue;
|
|
351
361
|
}
|
|
352
|
-
const decision =
|
|
362
|
+
const decision = pipeline.decide(await preparedFor(accountId), message);
|
|
353
363
|
const move = (decision.move?.filterId ?? filterId) === filterId;
|
|
354
364
|
if (!move && filter.actionLabelId === NO_ACTION)
|
|
355
365
|
continue;
|