@social-mail/social-mail-web-server 1.7.509 → 1.7.511

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.7.509",
3
+ "version": "1.7.511",
4
4
  "description": "## Phase 1",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -5,6 +5,8 @@ import { randomUUID } from "node:crypto";
5
5
  import DispatchEmailToMX from "../../smtp/DispatchEmailToMX.js";
6
6
  import BroadcastEmail from "../BroadcastEmail.js";
7
7
  import WorkflowContext from "@entity-access/entity-access/dist/workflows/WorkflowContext.js";
8
+ import Inject from "@entity-access/entity-access/dist/di/di.js";
9
+ import EmailAddressService from "../../../services/EmailAddressService.js";
8
10
 
9
11
  export interface ISendLibraryContentWorkflowParams {
10
12
  channelID, recipientID, from: string;
@@ -33,7 +35,7 @@ export default class SendLibraryContentWorkflow extends Workflow<ISendLibraryCon
33
35
  @UniqueActivity
34
36
  async send(
35
37
  start,
36
- db?: SocialMailContext
38
+ @Inject db?: SocialMailContext
37
39
  ) {
38
40
 
39
41
  const { channelID, recipientID } = this.input;
@@ -48,6 +50,10 @@ export default class SendLibraryContentWorkflow extends Workflow<ISendLibraryCon
48
50
  return 0;
49
51
  }
50
52
 
53
+ const recipient = await db.emailAddresses.statements.select({ }, { emailAddressID: recipientID });
54
+
55
+ const to = recipient.emailAddress;
56
+
51
57
  const list = await db.channelEmails.where({ channelID, start, recipientID }, (p) => (x) => x.mailboxID === p.channelID
52
58
  && x.emailID > p.start
53
59
  && x.datePublished !== null
@@ -68,7 +74,10 @@ export default class SendLibraryContentWorkflow extends Workflow<ISendLibraryCon
68
74
  const emailAddressID = recipientID;
69
75
  const { from } = this.input;
70
76
 
71
- for (const { email: { emailID, dateCreated, senderID, senderEmail: { emailAddress: to } } } of list) {
77
+ for (const { email: { emailID, dateCreated, senderID } } of list) {
78
+
79
+ start = emailID;
80
+
72
81
  const accessCode = randomUUID().replaceAll("-", "");
73
82
 
74
83
  await using tx = await db.connection.createTransaction();