@social-mail/social-mail-web-server 1.7.415 → 1.7.417

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.415",
3
+ "version": "1.7.417",
4
4
  "description": "## Phase 1",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -22,7 +22,7 @@
22
22
  "@aws-sdk/client-s3": "^3.717.0",
23
23
  "@azure/storage-blob": "^12.25.0",
24
24
  "@entity-access/entity-access": "^1.0.408",
25
- "@entity-access/server-pages": "^1.1.425",
25
+ "@entity-access/server-pages": "^1.1.426",
26
26
  "@ffmpeg/core-mt": "^0.12.6",
27
27
  "@ffmpeg/ffmpeg": "^0.12.10",
28
28
  "@ffmpeg/util": "^0.12.1",
@@ -1,6 +1,6 @@
1
1
  import { tokenizeRegex } from "../protocols/core/tokenizer.js";
2
2
 
3
- const tags = /((?<=\s)|^)(#\p{L}[\p{L}\d\-_\/]{3,200})/gmiu;
3
+ const tags = /((?<=\s)|^)(#\p{L}[\p{L}\d\-_\/]{2,200})/gmiu;
4
4
 
5
5
  export default class Hashtags {
6
6
 
@@ -15,7 +15,7 @@ export const RegExpExtra = {
15
15
  replaceLinks(input: string, blog = "") {
16
16
  return RegExpExtra.replaceAll(
17
17
  input,
18
- /(([^@\s,;]{5,80}@)|([📅📆📆]:\s{0,5}\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{1,5}Z)|(#\p{L}[\p{L}\d\-_\/]{3,200}))/gui,
18
+ /(([^@\s,;]{5,80}@)|([📅📆📆]:\s{0,5}\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{1,5}Z)|(#\p{L}[\p{L}\d\-_\/]{2,200}))/gui,
19
19
  ({ text, match }) => {
20
20
  if (text) {
21
21
  return text;
@@ -47,7 +47,7 @@ export const RegExpExtra = {
47
47
  replaceTimeAndEmail(input: string, blog = "") {
48
48
  return RegExpExtra.replaceAll(
49
49
  input,
50
- /(([^@\s,;]{5,80}@)|([📅📆📆]:\s{0,5}\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{1,5}Z)|(#\p{L}[\p{L}\d\-_\/]{3,200}))/gui,
50
+ /(([^@\s,;]{5,80}@)|([📅📆📆]:\s{0,5}\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{1,5}Z)|(#\p{L}[\p{L}\d\-_\/]{2,200}))/gui,
51
51
  ({ text, match }) => {
52
52
  if (text) {
53
53
  return text;
@@ -10,6 +10,8 @@ import Sql from "@entity-access/entity-access/dist/sql/Sql.js";
10
10
  import DateTime from "@entity-access/entity-access/dist/types/DateTime.js";
11
11
  import EntityAccessError from "@entity-access/entity-access/dist/common/EntityAccessError.js";
12
12
  import TagService from "../../services/tags/TagService.js";
13
+ import WorkflowContext from "@entity-access/entity-access/dist/workflows/WorkflowContext.js";
14
+ import SendLibraryContentWorkflow from "../../workflows/channel/library/SendLibraryContentWorkflow.js";
13
15
 
14
16
  export default class MailboxContactEvents extends AuthenticatedEvents<MailboxContact> {
15
17
 
@@ -209,4 +211,22 @@ export default class MailboxContactEvents extends AuthenticatedEvents<MailboxCon
209
211
  }
210
212
 
211
213
  }
214
+
215
+ async afterInsert(entity: MailboxContact, entry: ChangeEntry<MailboxContact>) {
216
+ if (entity.status !== "unsubscribed") {
217
+ const db = ServiceProvider.resolve(this, SocialMailContext);
218
+ // if channel is library...
219
+ const channel = await db.mailboxes.where(entity, (p) => (x) => x.mailboxID === p.mailboxID && x.isLibrary === true)
220
+ .include((x) => x.emailAddress)
221
+ .first();
222
+ if (channel) {
223
+ const context = ServiceProvider.resolve(this, WorkflowContext);
224
+ await SendLibraryContentWorkflow.broadcast(context, {
225
+ channelID: channel.mailboxID,
226
+ recipientID: entity.emailAddressID,
227
+ from: channel.emailAddress.emailAddress
228
+ });
229
+ }
230
+ }
231
+ }
212
232
  }
@@ -61,9 +61,9 @@ export default class MailboxEmailEvents extends AuthenticatedEvents<ChannelEmail
61
61
 
62
62
  @ExternalQuery
63
63
  async libraryEmails(channelID) {
64
- // get current host
65
- const q = await this.channelEmails(channelID);
66
- return q.where(void 0, (p) => (x) => x.mailbox.isLibrary === true);
64
+ const db = ServiceProvider.resolve(this, SocialMailContext);
65
+ const q = db.channelEmails.where(void 0, (p) => (x) => x.mailbox.isLibrary === true);
66
+ return q.limit(25);
67
67
  }
68
68
 
69
69
  beforeInsert(entity: ChannelEmail, entry: ChangeEntry<ChannelEmail>) {
@@ -38,6 +38,16 @@ export default class SendLibraryContentWorkflow extends Workflow<ISendLibraryCon
38
38
 
39
39
  const { channelID, recipientID } = this.input;
40
40
 
41
+ // verify if unsubscribed...
42
+ const unsubscribed = await db.mailboxContacts.where(this.input, (p) => (x) => x.mailboxID === p.channelID
43
+ && x.emailAddressID === p.channelID
44
+ && x.status === "unsubscribed"
45
+ ).some();
46
+
47
+ if (unsubscribed) {
48
+ return 0;
49
+ }
50
+
41
51
  const list = await db.channelEmails.where({ channelID, start, recipientID }, (p) => (x) => x.mailboxID === p.channelID
42
52
  && x.emailID > p.start
43
53
  && x.datePublished !== null