@remit/backend 0.0.150 → 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.
@@ -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 = await pipeline.evaluate(accountConfigId, accountId, messageId, message);
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remit/backend",
3
- "version": "0.0.150",
3
+ "version": "0.0.151",
4
4
  "description": "Remit Mail Inspector API backend",
5
5
  "license": "MIT",
6
6
  "author": "",