@stamhoofd/backend 2.80.0 → 2.80.1

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": "@stamhoofd/backend",
3
- "version": "2.80.0",
3
+ "version": "2.80.1",
4
4
  "main": "./dist/index.js",
5
5
  "exports": {
6
6
  ".": {
@@ -38,14 +38,14 @@
38
38
  "@simonbackx/simple-encoding": "2.22.0",
39
39
  "@simonbackx/simple-endpoints": "1.19.1",
40
40
  "@simonbackx/simple-logging": "^1.0.1",
41
- "@stamhoofd/backend-i18n": "2.80.0",
42
- "@stamhoofd/backend-middleware": "2.80.0",
43
- "@stamhoofd/email": "2.80.0",
44
- "@stamhoofd/models": "2.80.0",
45
- "@stamhoofd/queues": "2.80.0",
46
- "@stamhoofd/sql": "2.80.0",
47
- "@stamhoofd/structures": "2.80.0",
48
- "@stamhoofd/utility": "2.80.0",
41
+ "@stamhoofd/backend-i18n": "2.80.1",
42
+ "@stamhoofd/backend-middleware": "2.80.1",
43
+ "@stamhoofd/email": "2.80.1",
44
+ "@stamhoofd/models": "2.80.1",
45
+ "@stamhoofd/queues": "2.80.1",
46
+ "@stamhoofd/sql": "2.80.1",
47
+ "@stamhoofd/structures": "2.80.1",
48
+ "@stamhoofd/utility": "2.80.1",
49
49
  "archiver": "^7.0.1",
50
50
  "aws-sdk": "^2.885.0",
51
51
  "axios": "1.6.8",
@@ -65,5 +65,5 @@
65
65
  "publishConfig": {
66
66
  "access": "public"
67
67
  },
68
- "gitHead": "252faf1dbd8ebdd8469810e9c51e510d93f21fc2"
68
+ "gitHead": "37793d55487f7e8792d7b97df20750f8bd5be9a3"
69
69
  }
@@ -72,14 +72,9 @@ async function handleBounce(message: any) {
72
72
  )
73
73
  ) {
74
74
  const organization: Organization | undefined = source ? await Organization.getByEmail(source) : undefined;
75
- if (organization) {
76
- const emailAddress = await EmailAddress.getOrCreate(email, organization.id);
77
- emailAddress.hardBounce = true;
78
- await emailAddress.save();
79
- }
80
- else {
81
- console.error('[AWS BOUNCES] Unknown organization for email address ' + source);
82
- }
75
+ const emailAddress = await EmailAddress.getOrCreate(email, organization?.id ?? null);
76
+ emailAddress.hardBounce = true;
77
+ await emailAddress.save();
83
78
 
84
79
  await saveLog({
85
80
  id: b.feedbackId,
@@ -123,44 +118,39 @@ async function handleComplaint(message: any) {
123
118
 
124
119
  const type: 'abuse' | 'auth-failure' | 'fraud' | 'not-spam' | 'other' | 'virus' = b.complaintFeedbackType;
125
120
 
126
- if (organization) {
127
- for (const recipient of b.complainedRecipients) {
128
- const email = recipient.emailAddress;
129
- const emailAddress = await EmailAddress.getOrCreate(email, organization.id);
130
- emailAddress.markedAsSpam = type !== 'not-spam';
131
- await emailAddress.save();
132
-
133
- if (type !== 'not-spam') {
134
- if (type === 'virus' || type === 'fraud') {
135
- await saveLog({
136
- id: b.feedbackId,
137
- email: source,
138
- organization,
139
- type: AuditLogType.EmailAddressFraudComplaint,
140
- subType: type || 'unknown',
141
- sender: source,
142
- response: recipient.diagnosticCode || '',
143
- subject: message.mail.commonHeaders?.subject || '',
144
- });
145
- }
146
- else {
147
- await saveLog({
148
- id: b.feedbackId,
149
- email: source,
150
- organization,
151
- type: AuditLogType.EmailAddressMarkedAsSpam,
152
- subType: type || 'unknown',
153
- sender: source,
154
- response: recipient.diagnosticCode || '',
155
- subject: message.mail.commonHeaders?.subject || '',
156
- });
157
- }
121
+ for (const recipient of b.complainedRecipients) {
122
+ const email = recipient.emailAddress;
123
+ const emailAddress = await EmailAddress.getOrCreate(email, organization?.id ?? null);
124
+ emailAddress.markedAsSpam = type !== 'not-spam';
125
+ await emailAddress.save();
126
+
127
+ if (type !== 'not-spam') {
128
+ if (type === 'virus' || type === 'fraud') {
129
+ await saveLog({
130
+ id: b.feedbackId,
131
+ email: source,
132
+ organization,
133
+ type: AuditLogType.EmailAddressFraudComplaint,
134
+ subType: type || 'unknown',
135
+ sender: source,
136
+ response: recipient.diagnosticCode || '',
137
+ subject: message.mail.commonHeaders?.subject || '',
138
+ });
139
+ }
140
+ else {
141
+ await saveLog({
142
+ id: b.feedbackId,
143
+ email: source,
144
+ organization,
145
+ type: AuditLogType.EmailAddressMarkedAsSpam,
146
+ subType: type || 'unknown',
147
+ sender: source,
148
+ response: recipient.diagnosticCode || '',
149
+ subject: message.mail.commonHeaders?.subject || '',
150
+ });
158
151
  }
159
152
  }
160
153
  }
161
- else {
162
- console.error('[AWS COMPLAINTS] Unknown organization for email address ' + source);
163
- }
164
154
 
165
155
  if (type === 'virus' || type === 'fraud') {
166
156
  console.error('[AWS COMPLAINTS] Received virus / fraud complaint!');
@@ -18,7 +18,7 @@ class Query extends AutoEncoder {
18
18
 
19
19
  type ResponseBody = EmailAddressSettings;
20
20
 
21
- export class ManageEmailAddressEndpoint extends Endpoint<Params, Query, Body, ResponseBody> {
21
+ export class GetEmailAddressEndpoint extends Endpoint<Params, Query, Body, ResponseBody> {
22
22
  queryDecoder = Query as Decoder<Query>;
23
23
 
24
24
  protected doesMatch(request: Request): [true, Params] | [false] {