@social-mail/social-mail-web-server 1.8.452 → 1.8.455

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@social-mail/social-mail-web-server",
3
- "version": "1.8.452",
3
+ "version": "1.8.455",
4
4
  "description": "## Phase 1",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -26,7 +26,9 @@ export default class IndexEmailService {
26
26
  // delete all search email tokens if exists
27
27
  const { db } = this;
28
28
 
29
- await this.insertText(emailID, textBody, "body");
29
+ if(textBody) {
30
+ await this.insertText(emailID, textBody, "body");
31
+ }
30
32
 
31
33
  // for all attachments...
32
34
  const attachments = await db.appFiles.where({ emailID}, (p) => (x) => x.emailID === p.emailID)
@@ -1,8 +1,8 @@
1
1
  import EntityAccessError from "@entity-access/entity-access/dist/common/EntityAccessError.js";
2
2
  import { RegisterSingleton, ServiceProvider } from "@entity-access/entity-access/dist/di/di.js";
3
3
  import { cacheFor, ICacheContainer, ObjectCache } from "../../../common/cacheFor.js";
4
- import ReplicaReader from "../replica/ReplicaReader.js";
5
4
  import SocialMailContext from "../../model/SocialMailContext.js";
5
+ import ReadOnlySocialMailContext from "../../model/ReadOnlySocialMailContext.js";
6
6
 
7
7
  @RegisterSingleton
8
8
  export default class SearchTokenService implements ICacheContainer<SearchTokenService>{
@@ -20,12 +20,12 @@ export default class SearchTokenService implements ICacheContainer<SearchTokenSe
20
20
  @cacheFor()
21
21
  private async getRegisteredToken(word: string) {
22
22
  using scope = ServiceProvider.createScope(this);
23
- const replica = scope.resolve(ReplicaReader);
24
- const db = scope.resolve(SocialMailContext);
25
- let existing = await replica.query((x) => x.searchTokens.statements.select({}, { word }));
23
+ const replica = scope.resolve(ReadOnlySocialMailContext);
24
+ let existing = await replica.searchTokens.statements.select({}, { word });
26
25
  if (existing) {
27
26
  return existing;
28
27
  }
28
+ const db = scope.resolve(SocialMailContext);
29
29
  existing = await db.searchTokens.statements.selectOrInsert({ word }, { word });
30
30
  return existing;
31
31
  }